Skip to content

Commit

Permalink
Log more debug info about multi-target draft loading.
Browse files Browse the repository at this point in the history
  • Loading branch information
mk-pmb committed Oct 23, 2024
1 parent 105a438 commit ff8877c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const EX = async function downloadAndRestoreDraft(meta) {
...meta,
});
EX.neverRestoreFields.forEach(k => delete draftData[k]);
console.debug('Anno-Editor: downloadAndRestoreDraft:', draftData);

await panel.editorApi.loadAnnoData(draftData);
eventBus.$emit('switchEditorTabByRefName', 'commentTextTab');
Expand Down
27 changes: 19 additions & 8 deletions src/components/anno-editor/adjustMultiTarget.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,26 @@

const categorizeTargets = require('./categorizeTargets.js');

function jsonDeepCopy(x) { return JSON.parse(JSON.stringify(x)); }

const EX = function adjustMultiTarget(appCfg, origTgt) {
const report = categorizeTargets(appCfg, origTgt);
let adjusted = '';
if (report.subjOrigIdx > report.localAnnos.length) { adjusted = 'hoisted'; }
if (report.guessSubjTgtIfMissing()) { adjusted = 'added'; }
const targets = report.recombine();
targets.primaryTargetAdjustHint = adjusted;
return targets;


const EX = function adjustMultiTarget(appCfg, orig) {
const report = categorizeTargets(appCfg, orig);
let summary = '';
if (report.subjOrigIdx > report.localAnnos.length) { summary = 'hoisted'; }
if (report.guessSubjTgtIfMissing()) { summary = 'added'; }
const updated = report.recombine();
updated.primaryTargetAdjustHint = summary;

const dbg = { orig, report, summary, updated };
if (typeof window === 'object') { window.debugAdjustTarget = dbg; }
// console.debug('Anno-Editor: adjustMultiTarget:', dbg);

return jsonDeepCopy(
// ^-- Protect the log message in the browser console from retroactive
// getter/setter proxification by vue.
updated);
};


Expand Down

0 comments on commit ff8877c

Please sign in to comment.