Repository navigation
[BUGFIX] Keep untouched values when a content element is moved - #158
Merged
Merged
Conversation
connectedCallback parsed the validation attribute into a new object on every connect. Moving a content element with drag and drop reconnects the editable texts inside, so Lit treated validation as changed and normalized and stored their values, although the editor typed nothing: values were trimmed or cut, and values shorter than min were emptied. Lit already parses the attribute, so connectedCallback no longer assigns it.
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.
Problem
Moving a content element with drag and drop disconnects and reconnects the
ve-editable-textelements inside it.connectedCallbackparsed thevalidationattribute into a new object on every connect, so Lit treatedvalidationas changed andupdated()normalized and stored the value, although the editor typed nothing. Values that violate the TCA were trimmed or cut, and values shorter than a non-requiredminwere emptied. In 1.10.4, moving a content element never changed field values.Implemented behavior
validationattribute (type: Object), andconnectedCallbackno longer assigns it.{}as the default for elements without the attribute.Tests
ve-editable-text.test.js(browser): moving the elements withinsertBefore, likeflipInsertBeforedoes, keeps untouched values and the parsed validation. This test fails without the fix.createElement) pass with Lit's parsing alone.npm run test: 90 passing,npm run lintFollow-up
Moving an edited field also set
valueInitialto the edited value, so the reset button did not restore the initial value afterwards. Fixed in #160.