Releases: udecode/plate
@udecode/[email protected]
Patch Changes
- #3955 by @doctormarty – Resolved the “Cannot assign to read only property ‘0’” error by creating a new array for the fragment instead of mutating it.
@udecode/[email protected]
@udecode/[email protected]
@udecode/[email protected]
Major Changes
-
- Remove
slate,slate-dom,slate-react,slate-historyandslate-hyperscriptfrom your dependencies. It's now part of this package and@udecode/plate. All exports remain the same or have equivalents (see below). - Renamed
createTEditortocreateEditor. createEditornow returns an editor (Editor) with all queries undereditor.apiand transforms undereditor.tf. You can see or override them at a glance. For example, we now useeditor.tf.setNodesinstead of importingsetNodes. This marks the completion of generic typing and the removal of error throws fromslate,slate-dom, andslate-historyqueries/transforms, without forking implementations. We’ve also reduced the number of queries/transforms by merging a bunch of them.
The following interfaces from
slateandslate-domare now part ofEditor:-
Editor,EditorInterface -
Transforms -
HistoryEditor(noop, unchanged),HistoryEditorInterface -
DOMEditor(noop, unchanged),DOMEditorInterface -
editor.findPathnow returnsDOMEditor.findPath(memo) and falls back tofindNodePath(traversal, less performant) if not found. -
Removed the first parameter (
editor) from:editor.hasEditableTargeteditor.hasSelectableTargeteditor.isTargetInsideNonReadonlyVoideditor.hasRangeeditor.hasTarget
-
editor.api.node(options)(previouslyfindNode)atoption is nowat ?? editor.selectioninstead ofat ?? editor.selection ?? []. That means if you want to lookup the entire document, you need to pass[]explicitly. -
Removed
setNodein favor ofsetNodes(you can now pass aTNodetoatdirectly). -
Removed
setElementsin favor ofsetNodes. -
Removed unused
isWordAfterTrigger,setBlockAboveNode,setBlockAboveTexts,setBlockNodes,getPointNextToVoid. -
Replaced
Pathfrom slate withPath(type) andPathApi(static methods). -
Replaced
Operationfrom slate withOperation(type) andOperationApi(static methods). -
Replaced
Pointfrom slate withPoint(type) andPointApi(static methods). -
Replaced
Textfrom slate withTText(type) andTextApi(static methods). We also exportTexttype likeslatebut we don't recommend it as it's conflicting with the DOM type. -
Replaced
Rangefrom slate withTRange(type) andRangeApi(static methods). We also exportRangetype likeslatebut we don't recommend it as it's conflicting with the DOM type. -
Replaced
Locationfrom slate withTLocation(type) andLocationApi(static methods). We also exportLocationtype likeslatebut we don't recommend it as it's conflicting with the DOM type. -
Replaced
Spanfrom slate withSpan(type) andSpanApi(static methods). -
Replaced
Nodefrom slate withTNode(type) andNodeApi(static methods). We also exportNodetype likeslatebut we don't recommend it as it's conflicting with the DOM type. -
Replaced
Elementfrom slate withTElement(type) andElementApi(static methods). We also exportElementtype likeslatebut we don't recommend it as it's conflicting with the DOM type. -
Signature change:
editor.tf.toggle.block({ type, ...options })->editor.tf.toggleBlock(type, options)editor.tf.toggle.mark({ key, clear })->editor.tf.toggleMark(key, { remove: clear })
-
Moved editor functions:
addMark->editor.tf.addMarkaddRangeMarks->editor.tf.setNodes(props, { at, marks: true })blurEditor->editor.tf.blurcollapseSelection->editor.tf.collapsecreateDocumentNode->editor.api.create.value(core)createNode->editor.api.create.blockcreatePathRef->editor.api.pathRefcreatePointRef->editor.api.pointRefcreateRangeRef->editor.api.rangeRefdeleteBackward({ unit })->editor.tf.deleteBackward(unit)deleteForward({ unit })->editor.tf.deleteForward(unit)deleteFragment->editor.tf.deleteFragmentdeleteText->editor.tf.deletedeselect->editor.tf.deselectdeselectEditor->editor.tf.deselectDOMduplicateBlocks->editor.tf.duplicateNodes({ nodes })findDescendant->editor.api.descendantfindEditorDocumentOrShadowRoot->editor.api.findDocumentOrShadowRootfindEventRange->editor.api.findEventRangefindNode(options)->editor.api.node(options)findNodeKey->editor.api.findKeyfindNodePath->editor.api.findPathfindPath->editor.api.findPathfocusEditor->editor.tf.focus({ at })focusEditorEdge->editor.tf.focus({ at, edge: 'startEditor' | 'endEditor' })getAboveNode->editor.api.abovegetAncestorNode->editor.api.block({ highest: true })getBlockAbove->editor.api.block({ at, above: true })oreditor.api.block()ifatis not a pathgetBlocks->editor.api.blocksgetEdgeBlocksAbove->editor.api.edgeBlocksgetEdgePoints->editor.api.edgesgetEditorString->editor.api.stringgetEditorWindow->editor.api.getWindowgetEndPoint->editor.api.endgetFirstNode->editor.api.firstgetFragment->editor.api.fragmentgetFragmentProp(fragment, options)->editor.api.prop({ nodes, ...options})getLastNode->editor.api.lastgetLastNodeByLevel(level)->editor.api.last([], { level })getLeafNode->editor.api.leafgetLevels->editor.api.levelsgetMark->editor.api.markgetMarks->editor.api.marksgetNextNode->editor.api.nextgetNextNodeStartPoint->editor.api.start(at, { next: true })getNodeEntries->editor.api.nodesgetNodeEntry->editor.api.node(at, options)getNodesRange->editor.api.nodesRangegetParentNode->editor.api.parentgetPath->editor.api.pathgetPathRefs->editor.api.pathRefsgetPoint->editor.api.pointgetPointAfter->editor.api.aftergetPointBefore->editor.api.beforegetPointBeforeLocation->editor.api.beforegetPointRefs->editor.api.pointRefsgetPositions->editor.api.positionsgetPreviousBlockById->editor.api.previous({ id, block: true })getPreviousNode->editor.api.previousgetPreviousNodeEndPoint->editor.api.end({ previous: true })getPreviousSiblingNode->editor.api.previous({ at, sibling: true })getRange->editor.api.rangegetRangeBefore->editor.api.range('before', to, { before })getRangeFromBlockStart->editor.api.range('start', to)getRangeRefs->editor.api.rangeRefsgetSelectionFragment->editor.api.fragment(editor.selection, { structuralTypes })getSelectionText->editor.api.string()getStartPoint->editor.api.startgetVoidNode->editor.api.voidhasBlocks->editor.api.hasBlockshasEditorDOMNode->editor.api.hasDOMNodehasEditorEditableTarget->editor.api.hasEditableTargethasEditorSelectableTarget->editor.api.hasSelectableTargethasEditorTarget->editor.api.hasTargethasInlines->editor.api.hasInlineshasTexts->editor.api.hasTextsinsertBreak->editor.tf.insertBreakinsertData->editor.tf.insertDatainsertElements->editor.tf.insertNodes<TElement>insertEmptyElement->editor.tf.insertNodes(editor.api.create.block({ type }))insertFragment->editor.tf.insertFragmentinsertNode->editor.tf.insertNodeinsertNodes->editor.tf.insertNodesinsertText->editor.tf.insertTextisAncestorEmpty->editor.api.isEmptyisBlock->editor.api.isBlockisBlockAboveEmpty->editor.api.isEmpty(editor.selection, { block: true })isBlockTextEmptyAfterSelection->editor.api.isEmpty(editor.selection, { after: true })isCollapsed(editor.selection)->editor.api.isCollapsed()isComposing->editor.api.isComposingisDocumentEnd->editor.api.isEditorEndisEdgePoint->editor.api.isEdgeisEditor->editor.api.isEditorisEditorEmpty->editor.api.isEmpty()isEditorFocused->editor.api.isFocusedisEditorNormalizing->editor.api.isNormalizingisEditorReadOnly->editor.api.isReadOnlyisElementEmpty->editor.api.isEmptyisElementReadOnly->editor.api.elementReadOnlyisEndPoint->editor.api.isEndisExpanded(editor.selection)->editor.api.isCollapsed()isInline->editor.api.isInlineisMarkableVoid->editor.api.markableVoidisMarkActive->editor.api.hasMark(key)isPointAtWordEnd->editor.api.isAt({ at, word: true, end: true })- `i...
- Remove
@udecode/[email protected]
@udecode/[email protected]
@udecode/[email protected]
@udecode/[email protected]
@udecode/[email protected]
Major Changes
-
#3920 by @zbeyens – This package is now the new common package, so all plugin packages are being removed. Migration:
- Add the following dependencies:
"@udecode/plate-alignment": "42.0.0", "@udecode/plate-autoformat": "42.0.0", "@udecode/plate-basic-elements": "42.0.0", "@udecode/plate-basic-marks": "42.0.0", "@udecode/plate-block-quote": "42.0.0", "@udecode/plate-break": "42.0.0", "@udecode/plate-code-block": "42.0.0", "@udecode/plate-combobox": "42.0.0", "@udecode/plate-comments": "42.0.0", "@udecode/plate-csv": "42.0.0", "@udecode/plate-diff": "42.0.0", "@udecode/plate-docx": "42.0.0", "@udecode/plate-find-replace": "42.0.0", "@udecode/plate-floating": "42.0.0", "@udecode/plate-font": "42.0.0", "@udecode/plate-heading": "42.0.0", "@udecode/plate-highlight": "42.0.0", "@udecode/plate-horizontal-rule": "42.0.0", "@udecode/plate-indent": "42.0.0", "@udecode/plate-indent-list": "42.0.0", "@udecode/plate-kbd": "42.0.0", "@udecode/plate-layout": "42.0.0", "@udecode/plate-line-height": "42.0.0", "@udecode/plate-link": "42.0.0", "@udecode/plate-list": "42.0.0", "@udecode/plate-markdown": "42.0.0", "@udecode/plate-media": "42.0.0", "@udecode/plate-mention": "42.0.0", "@udecode/plate-node-id": "42.0.0", "@udecode/plate-normalizers": "42.0.0", "@udecode/plate-reset-node": "42.0.0", "@udecode/plate-resizable": "42.0.0", "@udecode/plate-select": "42.0.0", "@udecode/plate-selection": "42.0.0", "@udecode/plate-slash-command": "42.0.0", "@udecode/plate-suggestion": "42.0.0", "@udecode/plate-tabbable": "42.0.0", "@udecode/plate-table": "42.0.0", "@udecode/plate-toggle": "42.0.0", "@udecode/plate-trailing-block": "42.0.0"
- Either replace all
@udecode/plateimports with the individual package imports, or export the following in a new file (e.g.src/plate.ts):
export * from '@udecode/plate-alignment'; export * from '@udecode/plate-autoformat'; export * from '@udecode/plate-basic-elements'; export * from '@udecode/plate-basic-marks'; export * from '@udecode/plate-block-quote'; export * from '@udecode/plate-break'; export * from '@udecode/plate-code-block'; export * from '@udecode/plate-combobox'; export * from '@udecode/plate-comments'; export * from '@udecode/plate-diff'; export * from '@udecode/plate-find-replace'; export * from '@udecode/plate-font'; export * from '@udecode/plate-heading'; export * from '@udecode/plate-highlight'; export * from '@udecode/plate-horizontal-rule'; export * from '@udecode/plate-indent'; export * from '@udecode/plate-indent-list'; export * from '@udecode/plate-kbd'; export * from '@udecode/plate-layout'; export * from '@udecode/plate-line-height'; export * from '@udecode/plate-link'; export * from '@udecode/plate-list'; export * from '@udecode/plate-media'; export * from '@udecode/plate-mention'; export * from '@udecode/plate-node-id'; export * from '@udecode/plate-normalizers'; export * from '@udecode/plate-reset-node'; export * from '@udecode/plate-select'; export * from '@udecode/plate-csv'; export * from '@udecode/plate-docx'; export * from '@udecode/plate-markdown'; export * from '@udecode/plate-slash-command'; export * from '@udecode/plate-suggestion'; export * from '@udecode/plate-tabbable'; export * from '@udecode/plate-table'; export * from '@udecode/plate-toggle'; export * from '@udecode/plate-trailing-block'; export * from '@udecode/plate-alignment/react'; export * from '@udecode/plate-autoformat/react'; export * from '@udecode/plate-basic-elements/react'; export * from '@udecode/plate-basic-marks/react'; export * from '@udecode/plate-block-quote/react'; export * from '@udecode/plate-break/react'; export * from '@udecode/plate-code-block/react'; export * from '@udecode/plate-combobox/react'; export * from '@udecode/plate-comments/react'; export * from '@udecode/plate-floating'; export * from '@udecode/plate-font/react'; export * from '@udecode/plate-heading/react'; export * from '@udecode/plate-highlight/react'; export * from '@udecode/plate-layout/react'; export * from '@udecode/plate-slash-command/react'; export * from '@udecode/plate-indent/react'; export * from '@udecode/plate-indent-list/react'; export * from '@udecode/plate-kbd/react'; export * from '@udecode/plate-line-height/react'; export * from '@udecode/plate-link/react'; export * from '@udecode/plate-list/react'; export * from '@udecode/plate-media/react'; export * from '@udecode/plate-reset-node/react'; export * from '@udecode/plate-selection'; export * from '@udecode/plate-suggestion/react'; export * from '@udecode/plate-tabbable/react'; export * from '@udecode/plate-table/react'; export * from '@udecode/plate-toggle/react'; export * from '@udecode/plate-resizable';
- Replace all
'@udecode/plate'and'@udecode/plate/react'with'@/plate'in your codebase.