Skip to content

Commit

Permalink
fix(pb-view-annotate): changes not saved after editing/correcting an …
Browse files Browse the repository at this point in the history
…added (but not yet merged) annotation
  • Loading branch information
wolfgangmm committed Jan 22, 2024
1 parent cf1db83 commit 837b37f
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/pb-view-annotate.js
Original file line number Diff line number Diff line change
Expand Up @@ -677,16 +677,7 @@ class PbViewAnnotate extends PbView {
}

editAnnotation(span, properties) {
if (span.dataset.type === 'edit') {
let range = this._rangesMap.get(span);
if (range) {
range.properties = properties;
range = clearProperties(range);
this.emitTo('pb-annotations-changed', { ranges: this._ranges });
} else {
console.error('no range found for edit span %o', span);
}
} else if (span.dataset.tei) {
if (span.dataset.tei) {
// TODO: check in _ranges if it has already been modified
const context = span.closest('[data-tei]');
let range = this._ranges.find(r => r.type === 'modify' && r.node === span.dataset.tei);
Expand All @@ -701,6 +692,15 @@ class PbViewAnnotate extends PbView {
range.properties = properties;
range = clearProperties(range);
this.emitTo('pb-annotations-changed', { ranges: this._ranges });
} else {
let range = this._rangesMap.get(span);
if (range) {
range.properties = properties;
range = clearProperties(range);
this.emitTo('pb-annotations-changed', { ranges: this._ranges });
} else {
console.error('no range found for edit span %o', span);
}
}
const jsonOld = JSON.parse(span.dataset.annotation);
const json = Object.assign(jsonOld || {}, properties);
Expand Down

0 comments on commit 837b37f

Please sign in to comment.