fix(editable-html-tip-tap): honor the spellCheck prop PIE-978 - #2331
Merged
Conversation
EditableHtml never read props.spellCheck, so the browser spellchecked the
editor regardless of what the caller requested. In extended-text-entry this
caused students to see red underlines even when spellcheck was disabled. The
Slate editor this replaced honored the setting, which is why 13.4.0 behaves
correctly.
Set spellcheck, autocorrect and autocapitalize through editorProps.attributes
so ProseMirror applies them to the contenteditable element. This allows
extended-text-entry to disable browser spellcheck when playerSpellCheckDisabled
is true or absent: its controller resolves the absent property to an explicit
spellCheck={false}. Callers that pass nothing keep the browser default, as they
did under slate, so authoring editors are unaffected.
editorProps also has to be pushed through setOptions when it changes. useEditor
only re-applies options automatically when called with an empty dependency
array, and this call site depends on charactersLimit, so changing the setting
on a mounted editor was otherwise inert.
Adds tests that drive the real TipTap editor and assert the resulting DOM
attribute for the supported spellCheck values and when it changes on a mounted
editor.
…PIE-978 Re-applying the whole editorProps object through setOptions ran on every render for callers that pass an inline onKeyDown, such as mask-markup's constructed response, because the object identity changed each time. Push only the attributes, keyed on the spellCheck value, so handleKeyDown keeps the closure it was created with and setOptions runs only when spellcheck actually changes.
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.
EditableHtml never read props.spellCheck, so the browser spellchecked the
editor regardless of what the caller requested. In extended-text-entry this
caused students to see red underlines even when spellcheck was disabled. The
Slate editor this replaced honored the setting, which is why 13.4.0 behaves
correctly.
Set spellcheck, autocorrect and autocapitalize through editorProps.attributes
so ProseMirror applies them to the contenteditable element. This allows
extended-text-entry to disable browser spellcheck when playerSpellCheckDisabled
is true or absent: its controller resolves the absent property to an explicit
spellCheck={false}. Callers that pass nothing keep the browser default, as they
did under slate, so authoring editors are unaffected.
editorProps also has to be pushed through setOptions when it changes. useEditor
only re-applies options automatically when called with an empty dependency
array, and this call site depends on charactersLimit, so changing the setting
on a mounted editor was otherwise inert.
Adds tests that drive the real TipTap editor and assert the resulting DOM
attribute for the supported spellCheck values and when it changes on a mounted
editor.
https://illuminate.atlassian.net/browse/PIE-978