From 9e9e0f4d21bb6dea2e414c982815a9e6f9c04c3e Mon Sep 17 00:00:00 2001 From: Ben Trewern Date: Thu, 23 Jul 2026 14:38:37 +0100 Subject: [PATCH 1/4] Fix initializing and saving stretched. --- src/plugin.js | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/src/plugin.js b/src/plugin.js index 60b599f9..8c5c02e3 100644 --- a/src/plugin.js +++ b/src/plugin.js @@ -104,6 +104,17 @@ export default class TableBlock { return this.container; } + /** + * Hook called after the block is fully rendered and mounted + * + * @returns {void} + */ + rendered() { + if (this.block) { + this.block.stretched = !!this.data.stretched; + } + } + /** * Returns plugin settings * @@ -119,7 +130,7 @@ export default class TableBlock { toggle: true, onActivate: () => { this.data.withHeadings = true; - this.table.setHeadingsSetting(this.data.withHeadings); + this._updateTunes(); } }, { label: this.api.i18n.t('Without headings'), @@ -129,7 +140,7 @@ export default class TableBlock { toggle: true, onActivate: () => { this.data.withHeadings = false; - this.table.setHeadingsSetting(this.data.withHeadings); + this._updateTunes(); } }, { label: this.data.stretched ? this.api.i18n.t('Collapse') : this.api.i18n.t('Stretch'), @@ -138,11 +149,26 @@ export default class TableBlock { toggle: true, onActivate: () => { this.data.stretched = !this.data.stretched; - this.block.stretched = this.data.stretched; + this._updateTunes(); } } ]; } + + /** + * Handle updating UI for tunes + * + * @returns {void} + */ + _updateTunes() { + this.table.setHeadingsSetting(this.data.withHeadings); + + if (this.block) { + this.block.stretched = !!this.data.stretched; + this.block.dispatchChange(); + } + } + /** * Extract table data from the view * From 109af1ed963320d1acd6a13f8c0bbc8ce45d3591 Mon Sep 17 00:00:00 2001 From: Ben Trewern Date: Thu, 23 Jul 2026 14:42:45 +0100 Subject: [PATCH 2/4] Set stretched after pasting. --- src/plugin.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugin.js b/src/plugin.js index 8c5c02e3..715a2ee1 100644 --- a/src/plugin.js +++ b/src/plugin.js @@ -248,6 +248,7 @@ export default class TableBlock { /** Update Tool's data */ this.data = { withHeadings: firstRowHeading !== null, + stretched: false, content }; From 0dfccf3ba92be19bdd4dc540fcb33215c9e460a5 Mon Sep 17 00:00:00 2001 From: Ben Trewern Date: Thu, 23 Jul 2026 19:36:44 +0100 Subject: [PATCH 3/4] Add comment --- src/plugin.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugin.js b/src/plugin.js index 715a2ee1..902829b3 100644 --- a/src/plugin.js +++ b/src/plugin.js @@ -70,6 +70,7 @@ export default class TableBlock { }; this.table = null; this.block = block; + this.container = null; } /** @@ -106,6 +107,7 @@ export default class TableBlock { /** * Hook called after the block is fully rendered and mounted + * Set this.block.stretched here as block is not initialized in render(). * * @returns {void} */ From 982fee22eb37b1ecfc35f7ed7b3fc27b58ccb66c Mon Sep 17 00:00:00 2001 From: Ben Trewern Date: Fri, 24 Jul 2026 15:40:00 +0100 Subject: [PATCH 4/4] Revert unintended change. --- src/plugin.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugin.js b/src/plugin.js index 902829b3..0e457f00 100644 --- a/src/plugin.js +++ b/src/plugin.js @@ -70,7 +70,6 @@ export default class TableBlock { }; this.table = null; this.block = block; - this.container = null; } /**