@atlaskit/editor-plugin-better-type-history
v8.0.2
Published
Better Type History plugin for @atlaskit/editor-core
Readme
Editor Plugin Better Type History
Better Type History plugin for @atlaskit/editor-core
Overview
The Better Type History plugin improves undo behavior for custom editor applications by intelligently handling text operations. It optimizes the undo history for paste events, block splitting, and new line insertion, ensuring a better user experience when undoing changes in these specific scenarios.
Key features
- Paste event handling - Automatically flags and closes history for paste operations to improve undo behavior
- Block splitting detection - Detects when Enter key splits block nodes and optimizes history accordingly
- Newline handling - Intelligently manages history for newline character insertions
- Transaction metadata - Uses ProseMirror transaction metadata to track and manage paste events
- Undo optimization - Closes history at appropriate points to create better undo snapshots
Install
- Install -
yarn add @atlaskit/editor-plugin-better-type-history - npm - @atlaskit/editor-plugin-better-type-history
- Source - Bitbucket
- Bundle - unpkg.com
Usage
The Better Type History plugin is intended for internal use by @atlaskit/editor-core and as a plugin dependency of the Editor within your product.
import { betterTypeHistoryPlugin } from '@atlaskit/editor-plugin-better-type-history';Use the flagPasteEvent action to mark paste events in transactions:
const api = editorAPI.betterTypeHistory;
api.flagPasteEvent(transaction);Detailed docs and example usage can be found here.
Support
For internal Atlassian, visit the slack channel #help-editor for support or visit go/editor-help to submit a bug.
License
Please see Atlassian Frontend - License for more licensing information.
