|
202 | 202 | if ((key === 'Z' && e.shiftKey) || key === 'Y') {
|
203 | 203 | // Ctrl/Cmd-shift Z or Cmd-Y => Redo
|
204 | 204 | redoRecordSet();
|
205 |
| - e.stopPropagation(); |
| 205 | + // Prevent graph.js from receiving redo, since it is already taken care of. |
| 206 | + e.stopImmediatePropagation(); |
206 | 207 | e.preventDefault(); // Prevent browser from treating Cmd-Y as "Show all history".
|
207 | 208 | }
|
208 | 209 | else if (key === 'Z') { // lower-case z, no shift
|
209 | 210 | // Ctrl/Cmd-Z => Undo
|
210 | 211 | undoRecordSet();
|
211 |
| - e.stopPropagation(); |
| 212 | + // Prevent graph.js from receiving Cmd-Z and re-doing the undo |
| 213 | + e.stopImmediatePropagation(); |
212 | 214 | e.preventDefault();
|
213 | 215 | }
|
214 | 216 | }
|
|
218 | 220 | /**
|
219 | 221 | * Having made a change to the given record, update the display of it.
|
220 | 222 | *
|
221 |
| - * @param doc The record to update. |
222 |
| - * @param url (optional) The url or filename of the record, if applicable. (Ignored if null) |
223 |
| - * @param editorAlreadyUpdated (optional) Flag for whether the 'editor' is already updated (avoids closing editor when it is being edited still). |
224 |
| - * @param isClean - flag for whether this is a fresh update of the record, so the dirty bit should be cleared rather than set (like usual). |
225 |
| - * @param fromUndoLog - flag for whether this update is coming from the undo history, in which case the undo history should not be updated. |
| 223 | + * @param doc The record to update. |
| 224 | + * @param fromUndoLog - flag for whether this update is coming from the undo history, in which case the undo history should not be updated. |
| 225 | + * @param editorAlreadyUpdated (optional) Flag for whether the 'editor' is already updated (avoids closing editor when it is being edited still). |
| 226 | + * @param url (optional) The url or filename of the record, if applicable. (Ignored if null) |
| 227 | + * @param isClean - flag for whether this is a fresh update of the record, so the dirty bit should be cleared rather than set (like usual). |
226 | 228 | */
|
227 |
| - function updateRecord(doc, url, editorAlreadyUpdated, isClean, fromUndoLog) { |
| 229 | + function updateRecord(doc, fromUndoLog, editorAlreadyUpdated, url, isClean) { |
228 | 230 | url = url ? url : currentUrl;
|
229 | 231 | currentUrl = url;
|
230 | 232 | if (doc.records && doc.records.length > 0) {
|
|
304 | 306 | updateSelectablePersons(doc, $("#copy-person-fact-target-persons"));
|
305 | 307 |
|
306 | 308 | // Rebuild the relationship graph. Set global variable (defined in RelChartBuilder.js).
|
307 |
| - relChart = buildGraph(doc, true, relChart, true); |
| 309 | + relChart = buildGraph(doc, true, relChart, fromUndoLog); |
308 | 310 | }
|
309 | 311 |
|
310 | 312 | /**
|
|
792 | 794 | if (relChart) {
|
793 | 795 | relChart = null; // avoid animation at beginning when switching to different records.
|
794 | 796 | }
|
795 |
| - updateRecord(recordInfo.gxRecord, null, false, true); |
| 797 | + updateRecord(recordInfo.gxRecord, false, false, null, true); |
796 | 798 | }
|
797 | 799 | }
|
798 | 800 |
|
|
2730 | 2732 | else if (backup.text) {
|
2731 | 2733 | setRecordSourceDocument(backup.text, backup.filename);
|
2732 | 2734 | }
|
2733 |
| - updateRecord(backup.doc, backup.url, false, true, true); |
| 2735 | + updateRecord(backup.doc, true, false, backup.url, true); |
2734 | 2736 | $("#download-gx").attr("download", backup.filename ? backup.filename.replace(/(.txt|.nbx|.nbx.xml)?$/, ".gx.json") : "gx.json");
|
2735 | 2737 | }
|
2736 | 2738 |
|
|
2739 | 2741 | setRecordSourceDocument(null);
|
2740 | 2742 | recordInfos = [];
|
2741 | 2743 | currentRecordIndex = -1;
|
2742 |
| - updateRecord({}, null, false, true); |
| 2744 | + updateRecord({}, false, false, null, true); |
2743 | 2745 | }
|
2744 | 2746 | }
|
2745 | 2747 |
|
|
2807 | 2809 | recordInfos = [];
|
2808 | 2810 | currentRecordIndex = -1;
|
2809 | 2811 | relChart = null; // clear out any previous RelationshipChart
|
2810 |
| - updateRecord(makeEmptyRecord(), null, false, true); |
| 2812 | + updateRecord(makeEmptyRecord(), false, false, null, true); |
2811 | 2813 | for (let i = 0; i < files.length; i++) {
|
2812 | 2814 | let f = files[i];
|
2813 | 2815 | let reader = new FileReader();
|
|
0 commit comments