table default
This commit is contained in:
@@ -1 +1 @@
|
|||||||
1.2.87
|
1.2.88
|
||||||
|
|||||||
@@ -112,6 +112,22 @@
|
|||||||
return [tbody];
|
return [tbody];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const normalizeTableComponent = (component) => {
|
||||||
|
if (!isBridgeTableComponent(component)) return false;
|
||||||
|
const attrs = (component.get && component.get('attributes')) || {};
|
||||||
|
const rows = Number(attrs['data-bridge-rows'] || 3) || 3;
|
||||||
|
const cols = Number(attrs['data-bridge-cols'] || 2) || 2;
|
||||||
|
const existing = collectTableCells(component);
|
||||||
|
const components = buildTableComponents(rows, cols, existing);
|
||||||
|
component.addAttributes && component.addAttributes({
|
||||||
|
'data-bridge-rows': String(rows),
|
||||||
|
'data-bridge-cols': String(cols),
|
||||||
|
});
|
||||||
|
component.components && component.components(components);
|
||||||
|
component.view && component.view.render && component.view.render();
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
const openTableModal = (component) => {
|
const openTableModal = (component) => {
|
||||||
if (!component) return;
|
if (!component) return;
|
||||||
const modal = editor.Modal;
|
const modal = editor.Modal;
|
||||||
@@ -352,6 +368,14 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
editor.on('component:add', (model) => {
|
||||||
|
try {
|
||||||
|
if (isBridgeTableComponent(model)) {
|
||||||
|
setTimeout(() => normalizeTableComponent(model), 0);
|
||||||
|
}
|
||||||
|
} catch {}
|
||||||
|
});
|
||||||
|
|
||||||
editor.on('component:dblclick', (model) => {
|
editor.on('component:dblclick', (model) => {
|
||||||
if (isBridgeTableComponent(model)) {
|
if (isBridgeTableComponent(model)) {
|
||||||
openTableModal(model);
|
openTableModal(model);
|
||||||
|
|||||||
Reference in New Issue
Block a user