From bfdcaf08854e96270e43c28e3befa2e58752de46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=82ngela=20Coelho?= Date: Tue, 21 Nov 2023 15:31:32 +0000 Subject: [PATCH 1/2] Add name to headings settings --- src/plugin.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugin.js b/src/plugin.js index 4d29715..f885f32 100644 --- a/src/plugin.js +++ b/src/plugin.js @@ -104,6 +104,7 @@ export default class TableBlock { return [ { label: this.api.i18n.t('With headings'), + name: 'with-headings', icon: IconTableWithHeadings, isActive: this.data.withHeadings, closeOnActivate: true, @@ -114,6 +115,7 @@ export default class TableBlock { } }, { label: this.api.i18n.t('Without headings'), + name: 'without-headings', icon: IconTableWithoutHeadings, isActive: !this.data.withHeadings, closeOnActivate: true, From e379261b0d66418b50f032ba9e5d6fd5e807ca96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=82ngela=20Coelho?= Date: Tue, 21 Nov 2023 15:32:09 +0000 Subject: [PATCH 2/2] Add data-item-name to items inside row/column settings --- src/table.js | 6 ++++++ src/utils/popover.js | 1 + 2 files changed, 7 insertions(+) diff --git a/src/table.js b/src/table.js index 28d10ad..c295b1a 100644 --- a/src/table.js +++ b/src/table.js @@ -169,6 +169,7 @@ export default class Table { items: [ { label: this.api.i18n.t('Add column to left'), + name: 'column-left', icon: IconDirectionLeftDown, onClick: () => { this.addColumn(this.selectedColumn, true); @@ -177,6 +178,7 @@ export default class Table { }, { label: this.api.i18n.t('Add column to right'), + name: 'column-right', icon: IconDirectionRightDown, onClick: () => { this.addColumn(this.selectedColumn + 1, true); @@ -185,6 +187,7 @@ export default class Table { }, { label: this.api.i18n.t('Delete column'), + name: 'delete', icon: IconCross, hideIf: () => { return this.numberOfColumns === 1; @@ -218,6 +221,7 @@ export default class Table { items: [ { label: this.api.i18n.t('Add row above'), + name: 'row-above', icon: IconDirectionUpRight, onClick: () => { this.addRow(this.selectedRow, true); @@ -226,6 +230,7 @@ export default class Table { }, { label: this.api.i18n.t('Add row below'), + name: 'row-below', icon: IconDirectionDownRight, onClick: () => { this.addRow(this.selectedRow + 1, true); @@ -234,6 +239,7 @@ export default class Table { }, { label: this.api.i18n.t('Delete row'), + name: 'delete', icon: IconCross, hideIf: () => { return this.numberOfRows === 1; diff --git a/src/utils/popover.js b/src/utils/popover.js index b80f29f..ea4424d 100644 --- a/src/utils/popover.js +++ b/src/utils/popover.js @@ -50,6 +50,7 @@ export default class Popover { this.items.forEach((item, index) => { const itemEl = $.make('div', Popover.CSS.item); + itemEl.setAttribute('data-item-name', item.name); const icon = $.make('div', Popover.CSS.itemIcon, { innerHTML: item.icon });