Fix bugs initializing stretched and pasted tables.#189
Closed
btrewern wants to merge 4 commits into
Closed
Conversation
neSpecc
reviewed
Jul 23, 2026
| */ | ||
| rendered() { | ||
| if (this.block) { | ||
| this.block.stretched = !!this.data.stretched; |
Contributor
There was a problem hiding this comment.
explain why this line is needed in jsdoc, please
There was a problem hiding this comment.
Pull request overview
This PR aims to fix stretch-related initialization problems for the Editor.js table tool, ensuring that tables render with the correct “stretched” state and that tune changes properly update the block UI/state.
Changes:
- Add a
rendered()lifecycle hook to apply the saved/configuredstretchedstate after mount. - Centralize tune UI/state updates in
_updateTunes()and trigger block change dispatch on tune toggles. - Initialize
stretchedexplicitly inonPaste()data reconstruction.
Comments suppressed due to low confidence (1)
src/plugin.js:254
- After pasting, the code re-renders by replacing
this.table.wrapperwiththis.render(), which returns a new outer block container. That nests a new block container inside the existing one and also leaks global listeners because the oldTableinstance isn'tdestroy()ed before being orphaned. Rebuild only theTablewrapper (destroying the old instance first) and then re-apply the block stretch state so paste doesn't leave the UI/data out of sync.
withHeadings: firstRowHeading !== null,
stretched: false,
content
};
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
249
to
253
| this.data = { | ||
| withHeadings: firstRowHeading !== null, | ||
| stretched: false, | ||
| content | ||
| }; |
Author
There was a problem hiding this comment.
I can't paste one table over another so the above seems to be irrelevant.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes the following: