Element rebuild
This commit is contained in:
@@ -1 +1 @@
|
|||||||
1.2.66
|
1.2.67
|
||||||
@@ -1,57 +1,22 @@
|
|||||||
(function(){
|
(function(){
|
||||||
window.BridgeBlocksCustomElements = window.BridgeBlocksCustomElements || [];
|
window.BridgeBlocksCustomElements = window.BridgeBlocksCustomElements || [];
|
||||||
window.BridgeBlocksCustomElements.push(function(ctx){
|
window.BridgeBlocksCustomElements.push(function(ctx){
|
||||||
const { bm, addOnce } = ctx;
|
const { bm, addOnce, css } = ctx;
|
||||||
const hasBridgeTable = !!(ctx.editor && ctx.editor.DomComponents && ctx.editor.DomComponents.getType && ctx.editor.DomComponents.getType('bridge-table'));
|
|
||||||
const tableType = hasBridgeTable ? 'bridge-table' : 'default';
|
|
||||||
addOnce(bm, 'cust-table', { id:'cust-table', label:'🧩 Tabelle (2xN)',
|
addOnce(bm, 'cust-table', { id:'cust-table', label:'🧩 Tabelle (2xN)',
|
||||||
content:{
|
content:`<table data-bridge-table="1" data-bridge-rows="3" data-bridge-cols="2" role="presentation" width="100%" cellpadding="0" cellspacing="0" style="${css({'font-family':'Arial,sans-serif','border-collapse':'collapse','width':'100%','margin-bottom':'16px'})}">
|
||||||
type: tableType,
|
<tr>
|
||||||
tagName:'table',
|
<th style="${css({'text-align':'left','padding':'8px','border':'1px solid #e2e8f0','background-color':'#f8fafc','font-size':'13px'})}">Spalte A</th>
|
||||||
attributes:{
|
<th style="${css({'text-align':'left','padding':'8px','border':'1px solid #e2e8f0','background-color':'#f8fafc','font-size':'13px'})}">Spalte B</th>
|
||||||
role:'presentation',
|
</tr>
|
||||||
width:'100%',
|
<tr>
|
||||||
cellpadding:'0',
|
<td style="${css({'padding':'8px','border':'1px solid #e2e8f0','font-size':'13px'})}">Zeile 1</td>
|
||||||
cellspacing:'0',
|
<td style="${css({'padding':'8px','border':'1px solid #e2e8f0','font-size':'13px'})}">...</td>
|
||||||
'data-bridge-table':'1',
|
</tr>
|
||||||
'data-bridge-rows':'3',
|
<tr>
|
||||||
'data-bridge-cols':'2'
|
<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>
|
||||||
style:{
|
</tr>
|
||||||
'font-family':'Arial,sans-serif',
|
</table>`
|
||||||
'border-collapse':'collapse',
|
|
||||||
'width':'100%',
|
|
||||||
'margin-bottom':'16px'
|
|
||||||
},
|
|
||||||
components: [
|
|
||||||
{
|
|
||||||
tagName: 'tbody',
|
|
||||||
components: [
|
|
||||||
{
|
|
||||||
tagName: 'tr',
|
|
||||||
components: [
|
|
||||||
{ tagName: 'th', content: 'Spalte A', style: {'text-align':'left','padding':'8px','border':'1px solid #e2e8f0','background-color':'#f8fafc','font-size':'13px'} },
|
|
||||||
{ tagName: 'th', content: 'Spalte B', style: {'text-align':'left','padding':'8px','border':'1px solid #e2e8f0','background-color':'#f8fafc','font-size':'13px'} },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
tagName: 'tr',
|
|
||||||
components: [
|
|
||||||
{ tagName: 'td', content: 'Zeile 1', style: {'padding':'8px','border':'1px solid #e2e8f0','font-size':'13px'} },
|
|
||||||
{ tagName: 'td', content: '...', style: {'padding':'8px','border':'1px solid #e2e8f0','font-size':'13px'} },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
tagName: 'tr',
|
|
||||||
components: [
|
|
||||||
{ tagName: 'td', content: 'Zeile 2', style: {'padding':'8px','border':'1px solid #e2e8f0','font-size':'13px'} },
|
|
||||||
{ tagName: 'td', content: '...', style: {'padding':'8px','border':'1px solid #e2e8f0','font-size':'13px'} },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
]
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -20,7 +20,8 @@
|
|||||||
if (window.__PLACEHOLDER_BLOCKS_LOADED) return;
|
if (window.__PLACEHOLDER_BLOCKS_LOADED) return;
|
||||||
window.__PLACEHOLDER_BLOCKS_LOADED = true;
|
window.__PLACEHOLDER_BLOCKS_LOADED = true;
|
||||||
|
|
||||||
const TARGET_CAT_ID = 'placeholders';
|
const TARGET_CAT_ID = 'placeholders';
|
||||||
|
const SHOW_PLACEHOLDER_BLOCKS = (B && B.SHOW_PLACEHOLDER_BLOCKS === true);
|
||||||
const PLACEHOLDER_COMPONENT = 'placeholder-block';
|
const PLACEHOLDER_COMPONENT = 'placeholder-block';
|
||||||
const ALL_PLACEHOLDER_BLOCK_IDS = [];
|
const ALL_PLACEHOLDER_BLOCK_IDS = [];
|
||||||
const INLINE_PLACEHOLDER_CLASS = 'bridge-placeholder-inline';
|
const INLINE_PLACEHOLDER_CLASS = 'bridge-placeholder-inline';
|
||||||
@@ -1088,11 +1089,13 @@ const refreshPlaceholderComponent = (component) => {
|
|||||||
editor.on('load', bindRteButton, { once: true });
|
editor.on('load', bindRteButton, { once: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (SHOW_PLACEHOLDER_BLOCKS) {
|
||||||
addOnce(bm, 'cust-placeholder-custom', {
|
addOnce(bm, 'cust-placeholder-custom', {
|
||||||
id: 'cust-placeholder-custom',
|
id: 'cust-placeholder-custom',
|
||||||
label: '🔖 Placeholder (Text)',
|
label: '🔖 Placeholder (Text)',
|
||||||
content: `<span data-gjs-type="${PLACEHOLDER_COMPONENT}" data-placeholder-type="custom" data-placeholder-key="UEBERSCHRIFT">{{UEBERSCHRIFT}}</span>`
|
content: `<span data-gjs-type="${PLACEHOLDER_COMPONENT}" data-placeholder-type="custom" data-placeholder-key="UEBERSCHRIFT">{{UEBERSCHRIFT}}</span>`
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const ensureDbBlock = (tables) => {
|
const ensureDbBlock = (tables) => {
|
||||||
const fallback = { table: 'tabelle', column: 'feld' };
|
const fallback = { table: 'tabelle', column: 'feld' };
|
||||||
@@ -1109,6 +1112,7 @@ const refreshPlaceholderComponent = (component) => {
|
|||||||
const blockId = 'cust-placeholder-db';
|
const blockId = 'cust-placeholder-db';
|
||||||
const label = '🗄️ Placeholder (DB)';
|
const label = '🗄️ Placeholder (DB)';
|
||||||
const existing = typeof bm.get === 'function' ? bm.get(blockId) : null;
|
const existing = typeof bm.get === 'function' ? bm.get(blockId) : null;
|
||||||
|
if (!SHOW_PLACEHOLDER_BLOCKS) return;
|
||||||
if (existing && typeof existing.set === 'function') {
|
if (existing && typeof existing.set === 'function') {
|
||||||
existing.set('content', content);
|
existing.set('content', content);
|
||||||
existing.set('label', label);
|
existing.set('label', label);
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
// --- 3. API Custom-Blocks (Standard-API) ----
|
// --- 3. API Custom-Blocks (Standard-API) ----
|
||||||
custom: {
|
custom: {
|
||||||
ord: 1,
|
ord: 1,
|
||||||
label: 'Custom',
|
label: 'Templates',
|
||||||
open: true,
|
open: true,
|
||||||
files: ['library-api.js','blocks-api.js'],
|
files: ['library-api.js','blocks-api.js'],
|
||||||
registration_mode: 'async',
|
registration_mode: 'async',
|
||||||
|
|||||||
@@ -173,6 +173,13 @@
|
|||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
view: BaseView,
|
view: BaseView,
|
||||||
|
isComponent(el) {
|
||||||
|
if (!el || !el.hasAttribute) return false;
|
||||||
|
if (el.tagName && el.tagName.toLowerCase() === 'table' && el.getAttribute('data-bridge-table') === '1') {
|
||||||
|
return { type: 'bridge-table' };
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user