@sequent-org/moodboard 1.4.24 → 1.4.26
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/package.json
CHANGED
|
@@ -221,6 +221,9 @@ export function bindTextEditorInteractions(controller, {
|
|
|
221
221
|
export function closeTextEditorFromState(controller, commit) {
|
|
222
222
|
const textarea = controller.textEditor.textarea;
|
|
223
223
|
if (!textarea) return;
|
|
224
|
+
const wrapper = controller.textEditor.wrapper || null;
|
|
225
|
+
const removeDomListeners = controller.textEditor._removeDomListeners || null;
|
|
226
|
+
const placeholderStyleEl = controller.textEditor._phStyle || null;
|
|
224
227
|
const value = textarea.value.trim();
|
|
225
228
|
const commitValue = commit && value.length > 0;
|
|
226
229
|
const objectType = controller.textEditor.objectType || 'text';
|
|
@@ -252,8 +255,28 @@ export function closeTextEditorFromState(controller, commit) {
|
|
|
252
255
|
}
|
|
253
256
|
}
|
|
254
257
|
|
|
255
|
-
|
|
258
|
+
if (typeof removeDomListeners === 'function') {
|
|
259
|
+
try { removeDomListeners(); } catch (_) {}
|
|
260
|
+
}
|
|
261
|
+
if (placeholderStyleEl && typeof placeholderStyleEl.remove === 'function') {
|
|
262
|
+
try { placeholderStyleEl.remove(); } catch (_) {}
|
|
263
|
+
}
|
|
264
|
+
if (wrapper && typeof wrapper.remove === 'function') {
|
|
265
|
+
wrapper.remove();
|
|
266
|
+
} else {
|
|
267
|
+
textarea.remove();
|
|
268
|
+
}
|
|
256
269
|
controller.textEditor = { active: false, objectId: null, textarea: null, world: null, objectType: 'text' };
|
|
270
|
+
|
|
271
|
+
// Синхронно с createTextEditorFinalize: UI (в т.ч. панель свойств текста) ждёт окончание редактирования.
|
|
272
|
+
if (objectType === 'note') {
|
|
273
|
+
controller.eventBus.emit(Events.UI.NoteEditEnd, { objectId: objectId || null });
|
|
274
|
+
showNotePixiText(controller, objectId);
|
|
275
|
+
} else {
|
|
276
|
+
controller.eventBus.emit(Events.UI.TextEditEnd, { objectId: objectId || null });
|
|
277
|
+
}
|
|
278
|
+
updateGlobalTextEditorHandlesLayer();
|
|
279
|
+
|
|
257
280
|
if (!commitValue) {
|
|
258
281
|
if (shouldDeleteEmptyNewCreation) {
|
|
259
282
|
controller.eventBus.emit(Events.Tool.ObjectsDelete, { objects: [objectId] });
|
|
@@ -99,7 +99,10 @@ export class TextPropertiesPanel {
|
|
|
99
99
|
this.panel = createTextPropertiesPanelRenderer(this);
|
|
100
100
|
this.layer.appendChild(this.panel);
|
|
101
101
|
bindTextPropertiesPanelControls(this);
|
|
102
|
+
}
|
|
103
|
+
if (!this._docMouseDownAttached) {
|
|
102
104
|
document.addEventListener('mousedown', this._onDocMouseDown, true);
|
|
105
|
+
this._docMouseDownAttached = true;
|
|
103
106
|
}
|
|
104
107
|
|
|
105
108
|
this.panel.style.display = 'flex';
|
|
@@ -116,7 +119,10 @@ export class TextPropertiesPanel {
|
|
|
116
119
|
|
|
117
120
|
this._hideColorDropdown();
|
|
118
121
|
this._hideBgColorDropdown();
|
|
119
|
-
|
|
122
|
+
if (this._docMouseDownAttached) {
|
|
123
|
+
document.removeEventListener('mousedown', this._onDocMouseDown, true);
|
|
124
|
+
this._docMouseDownAttached = false;
|
|
125
|
+
}
|
|
120
126
|
}
|
|
121
127
|
|
|
122
128
|
_toggleColorDropdown() {
|
|
@@ -21,6 +21,7 @@ export function createTextPropertiesPanelState() {
|
|
|
21
21
|
_bgPresetButtons: [],
|
|
22
22
|
_onColorDocumentClick: null,
|
|
23
23
|
_onBgDocumentClick: null,
|
|
24
|
+
_docMouseDownAttached: false,
|
|
24
25
|
};
|
|
25
26
|
}
|
|
26
27
|
|
|
@@ -36,4 +37,5 @@ export function clearTextPropertiesPanelState(panel) {
|
|
|
36
37
|
panel._eventBridgeHandlers = null;
|
|
37
38
|
panel._onColorDocumentClick = null;
|
|
38
39
|
panel._onBgDocumentClick = null;
|
|
40
|
+
panel._docMouseDownAttached = false;
|
|
39
41
|
}
|