table
This commit is contained in:
@@ -1 +1 @@
|
||||
1.2.83
|
||||
1.2.84
|
||||
|
||||
@@ -209,6 +209,8 @@
|
||||
return attrs && attrs['data-bridge-table'] === '1';
|
||||
};
|
||||
|
||||
let lastClickedCellComp = null;
|
||||
|
||||
if (editor.Commands && editor.Commands.add) {
|
||||
editor.Commands.add('bridge-table:edit', {
|
||||
run(ed, sender, opts = {}) {
|
||||
@@ -224,6 +226,10 @@
|
||||
editor.on('component:selected', (model) => {
|
||||
if (!model) return;
|
||||
if (model.get && model.get('tagName') === 'tr') {
|
||||
if (lastClickedCellComp) {
|
||||
editor.select(lastClickedCellComp);
|
||||
return;
|
||||
}
|
||||
const parent = model.parent && model.parent();
|
||||
const table = parent && (parent.get && parent.get('tagName') === 'table' ? parent : parent.parent && parent.parent());
|
||||
if (isBridgeTableComponent(table)) {
|
||||
@@ -260,10 +266,19 @@
|
||||
if (!target) return;
|
||||
const tableEl = target.closest && target.closest('table');
|
||||
if (!tableEl || tableEl.getAttribute('data-bridge-table') !== '1') return;
|
||||
const comp = editor.DomComponents && editor.DomComponents.getComponent
|
||||
? editor.DomComponents.getComponent(target)
|
||||
: null;
|
||||
if (comp) {
|
||||
lastClickedCellComp = comp;
|
||||
editor.select(comp);
|
||||
return;
|
||||
}
|
||||
const id = target.getAttribute('id');
|
||||
if (id && editor.getWrapper && editor.getWrapper().find) {
|
||||
const found = editor.getWrapper().find(`#${id}`);
|
||||
if (found && found[0]) {
|
||||
lastClickedCellComp = found[0];
|
||||
editor.select(found[0]);
|
||||
return;
|
||||
}
|
||||
@@ -271,7 +286,10 @@
|
||||
if (model.get && model.get('tagName') === 'tr') {
|
||||
const cells = model.components && model.components();
|
||||
const firstCell = cells && cells.length ? cells.at(0) : null;
|
||||
if (firstCell) editor.select(firstCell);
|
||||
if (firstCell) {
|
||||
lastClickedCellComp = firstCell;
|
||||
editor.select(firstCell);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user