@teipublisher/pb-components 1.30.1 → 1.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/Dockerfile +1 -1
- package/dist/demo/demos.json +3 -0
- package/dist/demo/pb-custom-form.html +61 -0
- package/dist/demo/pb-leaflet-map3.html +12 -17
- package/dist/pb-components-bundle.js +159 -112
- package/dist/pb-elements.json +163 -2
- package/dist/pb-leaflet-map.js +1 -1
- package/i18n/common/de.json +20 -0
- package/i18n/common/en.json +20 -0
- package/package.json +1 -1
- package/pb-elements.json +163 -2
- package/src/pb-components.js +1 -0
- package/src/pb-custom-form.js +49 -7
- package/src/pb-geolocation.js +30 -11
- package/src/pb-leaflet-map.js +5 -4
- package/src/pb-select-feature.js +6 -0
- package/src/pb-split-list.js +196 -0
- package/src/pb-view-annotate.js +7 -4
package/src/pb-view-annotate.js
CHANGED
|
@@ -323,7 +323,7 @@ class PbViewAnnotate extends PbView {
|
|
|
323
323
|
|
|
324
324
|
set annotations(annoData) {
|
|
325
325
|
this._ranges = annoData;
|
|
326
|
-
this.updateAnnotations();
|
|
326
|
+
this.updateAnnotations(true);
|
|
327
327
|
this._initAnnotationColors();
|
|
328
328
|
this._annotationStyles();
|
|
329
329
|
}
|
|
@@ -413,7 +413,7 @@ class PbViewAnnotate extends PbView {
|
|
|
413
413
|
}, 300));
|
|
414
414
|
}
|
|
415
415
|
|
|
416
|
-
_updateAnnotation(teiRange, batch = false) {
|
|
416
|
+
_updateAnnotation(teiRange, silent = false, batch = false) {
|
|
417
417
|
const view = this.shadowRoot.getElementById('view');
|
|
418
418
|
const context = Array.from(view.querySelectorAll(`[data-tei="${teiRange.context}"]`)).filter(
|
|
419
419
|
node => node.closest('pb-popover') === null && node.getAttribute('rel') !== 'footnote',
|
|
@@ -467,6 +467,9 @@ class PbViewAnnotate extends PbView {
|
|
|
467
467
|
try {
|
|
468
468
|
range.surroundContents(span);
|
|
469
469
|
} catch (e) {
|
|
470
|
+
if (silent) {
|
|
471
|
+
return null;
|
|
472
|
+
}
|
|
470
473
|
throw new Error('An error occurred. The annotation may not be displayed. You should consider saving and reloading the document.');
|
|
471
474
|
}
|
|
472
475
|
this._rangesMap.set(span, teiRange);
|
|
@@ -478,7 +481,7 @@ class PbViewAnnotate extends PbView {
|
|
|
478
481
|
return span;
|
|
479
482
|
}
|
|
480
483
|
|
|
481
|
-
updateAnnotations() {
|
|
484
|
+
updateAnnotations(silent = false) {
|
|
482
485
|
this._ranges.forEach((teiRange) => {
|
|
483
486
|
let span;
|
|
484
487
|
switch (teiRange.type) {
|
|
@@ -495,7 +498,7 @@ class PbViewAnnotate extends PbView {
|
|
|
495
498
|
span.dataset.annotation = JSON.stringify(teiRange.properties);
|
|
496
499
|
break;
|
|
497
500
|
default:
|
|
498
|
-
this._updateAnnotation(teiRange, true);
|
|
501
|
+
this._updateAnnotation(teiRange, silent, true);
|
|
499
502
|
break;
|
|
500
503
|
}
|
|
501
504
|
});
|