This commit is contained in:
2026-01-16 01:15:00 +01:00
parent f265e3b3e1
commit ecb948606e
2 changed files with 19 additions and 1 deletions

View File

@@ -1041,7 +1041,8 @@ const refreshPlaceholderComponent = (component) => {
fetchPlaceholderSchema().catch(() => {}); 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', { editor.Commands.add('bridge-placeholder:edit', {
run(ed, sender, opts = {}) { run(ed, sender, opts = {}) {
const component = opts.component || ed.getSelected(); const component = opts.component || ed.getSelected();

View File

@@ -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 { try {
const textTags = ['p','span','div','br','b','strong','i','em','u','a','ul','ol','li']; const textTags = ['p','span','div','br','b','strong','i','em','u','a','ul','ol','li'];
if (ed.Config) { if (ed.Config) {