diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d31d8f..acc9a6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to this project will be documented in this file. +## 2.5.10 - 2026-08-05 + +### Fixed + +- Slide editor rich-text updates now keep the hidden field and preview state in sync after inline formatting actions. + ## 2.5.9 - 2026-08-05 ### Fixed diff --git a/package.json b/package.json index 17bff15..e157469 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pulse-signage", - "version": "2.5.9", + "version": "2.5.10", "private": false, "description": "Pulse Signage application with MySQL and media storage", "repository": { diff --git a/src/web/public/js/slides/slide-form-editor.js b/src/web/public/js/slides/slide-form-editor.js index 0d230dd..f509499 100644 --- a/src/web/public/js/slides/slide-form-editor.js +++ b/src/web/public/js/slides/slide-form-editor.js @@ -94,6 +94,39 @@ export function createSlideFormEditorController(options) { }; } + function syncEditorState(regionId, editor, shouldLock, hydrated) { + if (editor && typeof editor.save === 'function') { + editor.save(); + } + + var content = editor.getContent({ format: 'html' }); + content = isEmptyRichTextValue(content) ? '' : content; + var hidden = getEditorHiddenInput(regionId); + var sourceElm = editor && editor.targetElm ? editor.targetElm : null; + + if (hidden) { + hidden.value = content; + } + if (sourceElm) { + sourceElm.value = content; + } + if (typeof editor.nodeChanged === 'function') { + editor.nodeChanged(); + } + if (typeof editor.setDirty === 'function') { + editor.setDirty(true); + } + if (shouldLock && templateSelectorLock && typeof templateSelectorLock.arm === 'function') { + templateSelectorLock.arm(); + } + if (shouldLock && templateSelectorLock && typeof templateSelectorLock.markEdited === 'function') { + templateSelectorLock.markEdited(); + } + if (hydrated) { + requestPreviewRender(); + } + } + function getEditorRegionType(card) { if (!card) { return ''; @@ -228,38 +261,6 @@ export function createSlideFormEditorController(options) { }); } - function syncEditorState(regionId, editor, shouldLock, hydrated) { - if (editor && typeof editor.save === 'function') { - editor.save(); - } - var content = editor.getContent({ format: 'html' }); - content = isEmptyRichTextValue(content) ? '' : content; - var hidden = getEditorHiddenInput(regionId); - var sourceElm = editor && editor.targetElm ? editor.targetElm : null; - - if (hidden) { - hidden.value = content; - } - if (sourceElm) { - sourceElm.value = content; - } - if (typeof editor.nodeChanged === 'function') { - editor.nodeChanged(); - } - if (typeof editor.setDirty === 'function') { - editor.setDirty(true); - } - if (shouldLock && templateSelectorLock && typeof templateSelectorLock.arm === 'function') { - templateSelectorLock.arm(); - } - if (shouldLock && templateSelectorLock && typeof templateSelectorLock.markEdited === 'function') { - templateSelectorLock.markEdited(); - } - if (hydrated) { - requestPreviewRender(); - } - } - function applyInlineFormat(regionId, editor, formatName) { if (editor && editor.undoManager && typeof editor.undoManager.transact === 'function') { editor.undoManager.transact(function () {