This commit is contained in:
2026-01-31 01:31:16 +01:00
parent ffed8fd9d9
commit 2a16d662d7
3 changed files with 54 additions and 2 deletions

View File

@@ -1 +1 @@
1.1.70
1.1.71

View File

@@ -333,7 +333,7 @@ const refreshPlaceholderComponent = (component) => {
const openPlaceholderModal = (editor, component, opts = {}) => {
if (!editor) return;
const modal = editor.Modal;
const modal = opts.modal || editor.Modal;
if (!modal) return;
ensureInlinePlaceholderStyles();

View File

@@ -1039,6 +1039,56 @@
return (payload.key || 'PLATZHALTER').toUpperCase();
};
const buildPlaceholderText = (payload) => `{{${buildPlaceholderLabel(payload)}}}`;
const createInlineModal = () => {
const overlay = doc.createElement('div');
overlay.style.display = 'none';
overlay.style.position = 'absolute';
overlay.style.inset = '0';
overlay.style.background = 'rgba(15,23,42,0.35)';
overlay.style.alignItems = 'center';
overlay.style.justifyContent = 'center';
overlay.style.zIndex = '30';
const panel = doc.createElement('div');
panel.style.display = 'flex';
panel.style.flexDirection = 'column';
panel.style.gap = '10px';
panel.style.padding = '12px';
panel.style.border = '1px solid #cbd5f5';
panel.style.borderRadius = '8px';
panel.style.background = '#ffffff';
panel.style.boxShadow = '0 6px 24px rgba(15,23,42,0.2)';
panel.style.minWidth = '320px';
panel.style.maxWidth = '640px';
panel.style.maxHeight = '80vh';
panel.style.overflow = 'auto';
const titleEl = doc.createElement('div');
titleEl.style.fontWeight = '600';
titleEl.style.fontSize = '14px';
const bodyEl = doc.createElement('div');
panel.appendChild(titleEl);
panel.appendChild(bodyEl);
overlay.appendChild(panel);
container.appendChild(overlay);
let closeCb = null;
return {
el: overlay,
setTitle(text) { titleEl.textContent = text || ''; },
setContent(node) {
bodyEl.innerHTML = '';
if (node) bodyEl.appendChild(node);
},
open() { overlay.style.display = 'flex'; },
close() {
overlay.style.display = 'none';
if (typeof closeCb === 'function') closeCb();
},
onceClose(cb) { closeCb = cb; },
};
};
const insertTextAtSelection = (text) => {
try {
content.focus();
@@ -1084,7 +1134,9 @@
saveSelection();
const api = window.BridgeBlocksPlaceholder;
if (!api || typeof api.openModal !== 'function') return;
const inlineModal = createInlineModal();
api.openModal(editor, null, {
modal: inlineModal,
onCancel: () => {
if (content && typeof content.focus === 'function') {
setTimeout(() => content.focus(), 0);