Releases: ChrisUser/react-basic-contenteditable
Releases · ChrisUser/react-basic-contenteditable
v1.2.1
Fixed
onChangenow fires reliably for every content mutation, including paste, undo/redo (Ctrl+Z / Ctrl+Y), Ctrl+Backspace clear, and the imperativeclearContent()handler. Previously these paths could update the DOM without notifying the consumer.updatedContentno longer triggers redundant state updates or DOM writes when the incoming value matches the current content, avoiding unnecessary re-renders and caret jumps.
Thanks to @BigDaddySigma for the bug report!
Full Changelog: v1.2.0...v1.2.1
v1.2.0
Features
- Added
tagNameprop to render the editable element as any HTML tag (<p>,<span>,<h1>, etc.) - Added
multiLineprop to enable single-line mode (prevents Enter key and strips newlines from paste) - Added
sanitizecallback prop to post-process content beforeonChangefires - Added
onPastecallback prop for reacting to paste events - Added
styleprop support on the editable element (merged with internal defaults, consumer styles take precedence) - Added prop spread for arbitrary HTML attributes (
id,data-*,tabIndex,spellCheck, etc.) - Added
forwardRefwith imperative API:focus(),blur(),insertAtCaret(),clear(),getCaretPosition() - Added
ContentEditableHandleandContentEditablePropstype exports - Added
aria-multilineattribute for accessibility compliance - Added
contenteditable="plaintext-only"support for modern browsers - Added cursor position metadata to
onChangecallback (meta.caretPosition)
Fixes
- Fixed undo/redo not working on macOS (now checks
metaKeyin addition toctrlKey) - Fixed global event listeners causing cross-instance interference when multiple components are on the same page
- Fixed
disabledprop not actually preventing editing (now setscontentEditable={false}) - Fixed unbounded undo stack memory leak (capped at 100 entries)
- Fixed deprecated
keyCodeusage replaced withkeyproperty - Fixed dead IE-specific fallback code removed (
clipboardData,moveToElementText,setEndPoint) - Fixed dead
selectionStartcheck on contenteditable div (always evaluated tofalse) - Fixed
react-domnot externalized in library build - Fixed SSR safety for
contenteditable="plaintext-only"feature detection
v1.0.6
Features
- Add undo/redo keyboard handlers
Bugfix
- Undo (Ctrl+Z) Not Working After Pasting
Full Changelog: v1.0.5...v1.0.6
v1.0.5
Features
- Add
autoFocusprop - proposed by @tuphan-dn in #14
Bugfix
- Fix placeholder display on empty input by @ChrisUser - reported by @tuphan-dn in #15
Full Changelog: v1.0.4...v1.0.5
v1.0.4
v1.0.3
v1.0.2
What's Changed
- Fix demo page - Github pages by @ChrisUser in #2
Feature
- Removed
onChangefrom required props #3
Full Changelog: v1.0.1...v1.0.2
v1.0.1
v1.0.0
First release
- Add component, logics, customizations and docs.
Full Changelog: https://github.com/ChrisUser/react-basic-contenteditable/commits/v1.0.0