adsasd
This commit is contained in:
@@ -108,6 +108,26 @@
|
|||||||
addOrUpdate(bm, 'std-button', { label:'Button (Basis)',
|
addOrUpdate(bm, 'std-button', { label:'Button (Basis)',
|
||||||
content:`<a href="#" data-gjs-type="button" style="${css({display:'inline-block','background-color':'#0ea5e9',color:'#fff','text-decoration':'none',padding:'10px 18px','border-radius':'6px','font-family':'Arial,sans-serif','font-size':'14px'})}">Button</a>` });
|
content:`<a href="#" data-gjs-type="button" style="${css({display:'inline-block','background-color':'#0ea5e9',color:'#fff','text-decoration':'none',padding:'10px 18px','border-radius':'6px','font-family':'Arial,sans-serif','font-size':'14px'})}">Button</a>` });
|
||||||
|
|
||||||
|
// TABLE (Registriert als 'std-table')
|
||||||
|
addOrUpdate(bm, 'std-table', { label:'Tabelle (Basis)',
|
||||||
|
content:`<table role="presentation" width="100%" cellpadding="0" cellspacing="0" style="${css({'font-family':'Arial,sans-serif','border-collapse':'collapse','width':'100%'})}">
|
||||||
|
<tr>
|
||||||
|
<th style="${css({'text-align':'left','padding':'8px','border':'1px solid #e2e8f0','background-color':'#f8fafc','font-size':'13px'})}">Spalte A</th>
|
||||||
|
<th style="${css({'text-align':'left','padding':'8px','border':'1px solid #e2e8f0','background-color':'#f8fafc','font-size':'13px'})}">Spalte B</th>
|
||||||
|
<th style="${css({'text-align':'left','padding':'8px','border':'1px solid #e2e8f0','background-color':'#f8fafc','font-size':'13px'})}">Spalte C</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="${css({'padding':'8px','border':'1px solid #e2e8f0','font-size':'13px'})}">Zeile 1</td>
|
||||||
|
<td style="${css({'padding':'8px','border':'1px solid #e2e8f0','font-size':'13px'})}">...</td>
|
||||||
|
<td style="${css({'padding':'8px','border':'1px solid #e2e8f0','font-size':'13px'})}">...</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="${css({'padding':'8px','border':'1px solid #e2e8f0','font-size':'13px'})}">Zeile 2</td>
|
||||||
|
<td style="${css({'padding':'8px','border':'1px solid #e2e8f0','font-size':'13px'})}">...</td>
|
||||||
|
<td style="${css({'padding':'8px','border':'1px solid #e2e8f0','font-size':'13px'})}">...</td>
|
||||||
|
</tr>
|
||||||
|
</table>` });
|
||||||
|
|
||||||
// DIVIDER (Registriert als 'std-divider')
|
// DIVIDER (Registriert als 'std-divider')
|
||||||
addOrUpdate(bm, 'std-divider',{ label:'Trenner (Basis)',
|
addOrUpdate(bm, 'std-divider',{ label:'Trenner (Basis)',
|
||||||
content:`<hr data-gjs-type="divider" style="${css({border:'0',height:'1px','background-color':'#e2e8f0',margin:'16px 0'})}">` });
|
content:`<hr data-gjs-type="divider" style="${css({border:'0',height:'1px','background-color':'#e2e8f0',margin:'16px 0'})}">` });
|
||||||
|
|||||||
@@ -319,6 +319,8 @@
|
|||||||
|
|
||||||
const modal = editor.Modal;
|
const modal = editor.Modal;
|
||||||
if (!modal) return;
|
if (!modal) return;
|
||||||
|
if (editor.__bridgeRteModalOpen) return;
|
||||||
|
editor.__bridgeRteModalOpen = true;
|
||||||
|
|
||||||
const doc = document;
|
const doc = document;
|
||||||
const container = doc.createElement('div');
|
const container = doc.createElement('div');
|
||||||
@@ -498,10 +500,14 @@
|
|||||||
if (component.set) {
|
if (component.set) {
|
||||||
component.set('content', html);
|
component.set('content', html);
|
||||||
component.trigger && component.trigger('change:content');
|
component.trigger && component.trigger('change:content');
|
||||||
|
component.trigger && component.trigger('change:components');
|
||||||
}
|
}
|
||||||
if (component.view && component.view.render) {
|
if (component.view && component.view.render) {
|
||||||
component.view.render();
|
component.view.render();
|
||||||
}
|
}
|
||||||
|
if (editor && typeof editor.trigger === 'function') {
|
||||||
|
editor.trigger('component:update', component);
|
||||||
|
}
|
||||||
} catch {}
|
} catch {}
|
||||||
modal.close();
|
modal.close();
|
||||||
});
|
});
|
||||||
@@ -512,6 +518,16 @@
|
|||||||
|
|
||||||
modal.setTitle('Richtext Editor');
|
modal.setTitle('Richtext Editor');
|
||||||
modal.setContent(container);
|
modal.setContent(container);
|
||||||
|
const mdl = modal.getModel && modal.getModel();
|
||||||
|
if (mdl && typeof mdl.set === 'function') {
|
||||||
|
mdl.set('closeOnEsc', false);
|
||||||
|
mdl.set('closeOnClick', false);
|
||||||
|
}
|
||||||
|
if (typeof modal.onceClose === 'function') {
|
||||||
|
modal.onceClose(() => {
|
||||||
|
editor.__bridgeRteModalOpen = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
modal.open();
|
modal.open();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -581,7 +597,7 @@
|
|||||||
});
|
});
|
||||||
if (!(rte.get && rte.get('bridge-open-richtext'))) {
|
if (!(rte.get && rte.get('bridge-open-richtext'))) {
|
||||||
rte.add('bridge-open-richtext', {
|
rte.add('bridge-open-richtext', {
|
||||||
icon: 'RTE',
|
icon: '<svg viewBox="0 0 24 24" width="14" height="14" aria-hidden="true"><path d="M4 20h4l10-10-4-4L4 16v4zm14.7-11.3c.4-.4.4-1 0-1.4l-2-2c-.4-.4-1-.4-1.4 0l-1.3 1.3 4 4 1.7-1.9z" fill="currentColor"/></svg>',
|
||||||
attributes: { title: 'Richtext Editor' },
|
attributes: { title: 'Richtext Editor' },
|
||||||
result: () => {
|
result: () => {
|
||||||
const component = editor.getSelected && editor.getSelected();
|
const component = editor.getSelected && editor.getSelected();
|
||||||
@@ -614,13 +630,33 @@
|
|||||||
'bridge-placeholder',
|
'bridge-placeholder',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
editor.on('component:selected', (model) => ensureTextToolbarButton(editor, model));
|
let lastTextSelection = { id: null, ts: 0 };
|
||||||
|
editor.on('component:selected', (model) => {
|
||||||
|
ensureTextToolbarButton(editor, model);
|
||||||
|
if (!model || !model.is || !model.is('text')) return;
|
||||||
|
const now = Date.now();
|
||||||
|
if (lastTextSelection.id === model.cid && (now - lastTextSelection.ts) < 450) {
|
||||||
|
openRichTextModal(editor, model);
|
||||||
|
}
|
||||||
|
lastTextSelection = { id: model.cid, ts: now };
|
||||||
|
});
|
||||||
editor.on('component:add', (model) => ensureTextToolbarButton(editor, model));
|
editor.on('component:add', (model) => ensureTextToolbarButton(editor, model));
|
||||||
editor.on('component:dblclick', (model) => {
|
editor.on('component:dblclick', (model) => {
|
||||||
if (model && model.is && model.is('text')) {
|
if (model && model.is && model.is('text')) {
|
||||||
openRichTextModal(editor, model);
|
openRichTextModal(editor, model);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
editor.on('canvas:frame:load', () => {
|
||||||
|
const body = editor.Canvas && editor.Canvas.getBody && editor.Canvas.getBody();
|
||||||
|
if (!body || body.__bridgeRteDblclickBound) return;
|
||||||
|
body.__bridgeRteDblclickBound = true;
|
||||||
|
body.addEventListener('dblclick', () => {
|
||||||
|
const selected = editor.getSelected && editor.getSelected();
|
||||||
|
if (selected && selected.is && selected.is('text')) {
|
||||||
|
openRichTextModal(editor, selected);
|
||||||
|
}
|
||||||
|
}, true);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadDynamicFonts = async () => {
|
const loadDynamicFonts = async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user