diff --git a/public/assets/js/bridge/blocks-placeholder.js b/public/assets/js/bridge/blocks-placeholder.js index 8945ce6..063fe3b 100644 --- a/public/assets/js/bridge/blocks-placeholder.js +++ b/public/assets/js/bridge/blocks-placeholder.js @@ -1041,7 +1041,8 @@ const refreshPlaceholderComponent = (component) => { fetchPlaceholderSchema().catch(() => {}); } - if (!editor.Commands.get('bridge-placeholder:edit')) { + const existingCmd = editor.Commands.get('bridge-placeholder:edit'); + if (!existingCmd || existingCmd.__bridgePlaceholderStub) { editor.Commands.add('bridge-placeholder:edit', { run(ed, sender, opts = {}) { const component = opts.component || ed.getSelected(); diff --git a/public/editor/bridge-core.js b/public/editor/bridge-core.js index dd724ca..b336db3 100644 --- a/public/editor/bridge-core.js +++ b/public/editor/bridge-core.js @@ -1108,6 +1108,23 @@ } }); + const ensurePlaceholderCommandStub = (editor) => { + if (!editor || !editor.Commands) return; + const existing = editor.Commands.get && editor.Commands.get('bridge-placeholder:edit'); + if (existing) return; + editor.Commands.add('bridge-placeholder:edit', { + __bridgePlaceholderStub: true, + run(ed, sender, opts = {}) { + if (sender && sender.set) sender.set('active', 0); + const component = opts.component || (ed.getSelected && ed.getSelected()); + if (window.BridgeBlocksPlaceholder && typeof window.BridgeBlocksPlaceholder.openModal === 'function') { + window.BridgeBlocksPlaceholder.openModal(ed, component); + } + }, + }); + }; + ensurePlaceholderCommandStub(ed); + try { const textTags = ['p','span','div','br','b','strong','i','em','u','a','ul','ol','li']; if (ed.Config) {