Merge pull request #15118 from calixteman/editor_selection

[Editor] Allow to select a freetext editor when in ink mode
This commit is contained in:
calixteman 2022-06-29 19:49:13 +02:00 committed by GitHub
commit a520fc9d9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 1 deletions

View File

@ -95,6 +95,15 @@ class AnnotationEditorLayer {
this.#uiManager.addLayer(this);
}
/**
* Update the toolbar if it's required to reflect the tool currently used.
* @param {number} mode
* @returns {undefined}
*/
updateToolbar(mode) {
this.#uiManager.updateToolbar(mode);
}
/**
* The mode has changed: it must be updated.
* @param {number} mode

View File

@ -209,6 +209,7 @@ class FreeTextEditor extends AnnotationEditor {
/** @inheritdoc */
enableEditMode() {
this.parent.updateToolbar(AnnotationEditorType.FREETEXT);
super.enableEditMode();
this.overlayDiv.classList.remove("enabled");
this.editorDiv.contentEditable = true;

View File

@ -319,7 +319,7 @@ class AnnotationEditorUIManager {
}
#dispatchUpdateUI(details) {
this.#eventBus?.dispatch("annotationeditorparamschanged", {
this.#eventBus.dispatch("annotationeditorparamschanged", {
source: this,
details,
});
@ -377,6 +377,21 @@ class AnnotationEditorUIManager {
}
}
/**
* Update the toolbar if it's required to reflect the tool currently used.
* @param {number} mode
* @returns {undefined}
*/
updateToolbar(mode) {
if (mode === this.#mode) {
return;
}
this.#eventBus.dispatch("switchannotationeditormode", {
source: this,
mode,
});
}
/**
* Update a parameter in the current editor or globally.
* @param {number} type

View File

@ -47,6 +47,7 @@
resize: none;
width: auto;
height: auto;
z-index: 1;
transform-origin: 0 0;
}