feat(core): predictive input model via beforeinput#131
Merged
Conversation
- Added applySpanInput function to handle various input events for span elements. - Updated handleBeforeInput to utilize applySpanInput for better content management. - Removed unused handlePaste function from TextSpan component. - Exported applySpanInput from KeyDownController for broader usage.
- Added checks in KeyDownController to prevent deletion when caret is not at the beginning or end for editable marks. - Updated handleBeforeInput to ensure focus is editable before processing input events. - Removed unused handlePaste function from EditableSpan component to streamline code.
- Added support for 'insertReplacementText' in applySpanInput function to handle additional input events. - Removed the unused #subscribeInputEvent method from Lifecycle class to streamline event management.
- Updated handleBeforeInput in KeyDownController to prevent default behavior for 'insertFromPaste' events. - Removed unused handlePaste functions from EditableSpan and TextSpan components to streamline code.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Nowely
pushed a commit
that referenced
this pull request
Mar 6, 2026
🤖 I have created a release *beep* *boop* --- ## [0.4.0](0.3.0...0.4.0) (2026-03-06) ### Features * **core:** predictive input model via beforeinput ([#131](#131)) ([80d0369](80d0369)) ### Documentation * Add AGENTS.md ([#135](#135)) ([675a8e2](675a8e2)) * update Storybook links and reorganize badges by framewor ([#137](#137)) ([9884dc1](9884dc1)) ### Miscellaneous * migrate from prettier to oxfmt ([#139](#139)) ([4349b1b](4349b1b)) * remove unused EditableSpan components ([#133](#133)) ([2e5388a](2e5388a)) * remove unused Vercel configuration file from Storybook ([#136](#136)) ([60129be](60129be)) * upgrade vue-tsc to v3.2.5 ([#138](#138)) ([a189b53](a189b53)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.
Replaces the browser-driven input model with a predictive one: all text
mutations are now intercepted via
beforeinput, applied programmaticallythrough
NodeProxy, and synced to the token model — the DOM never mutatesnatively during normal editing.
Changes
applySpanInput(new,@markput/core)Handles all common input types using
event.getTargetRanges()for exactbounds and
event.dataTransferfor text content. Returnsfalseat tokenboundaries to hand off to the existing mark-delete path.
Covered
inputTypes:insertTextdeleteContentBackward/deleteContentForwarddeleteWordBackward/deleteWordForwarddeleteSoftLineBackward/deleteSoftLineForwardinsertFromPasteinsertReplacementText(autocorrect / spellcheck)handleBeforeInputextended to callapplySpanInputfor anyisEditableelement — covers text spans and editable mark spans uniformly.#handleDeleteupdated: for editable marks, the mark is only deletedwhen the caret is at the boundary. Mid-content backspace/delete is now
handled by
beforeinput.Lifecycle.#subscribeInputEventremoved — the DOMinputlistener isno longer needed.
preventDefault()onbeforeinputpreventsinputfromfiring for all handled cases, and
insertReplacementTextcloses the last gap.React and Vue
TextSpan/EditableSpan— removedonPaste+document.execCommand('insertText')from both packages. Paste is handledby
insertFromPastein core.Before / After
input→ read backbeforeinput→preventDefault→ apply to modelexecCommand('insertText')(deprecated)insertFromPasteviaevent.dataTransferinputlistener fallbackinsertReplacementTextinapplySpanInputonPastelogic per framework