@platejs/cli
Published @platejs/cli@54.0.0-beta.3.
@platejs/test
Published @platejs/test@54.0.0-beta.3.
platejs
Patch Changes
-
- Fix Backspace or Delete that empties a heading turning it into a paragraph. The empty heading stays, and the next Backspace turns it into a paragraph.
- Fix Turn into Quote, the blockquote shortcut and
editor.plugin(BlockquotePlugin).update.wrap()putting each selected block in its own blockquote. Adjacent selected blocks now share one blockquote.
-
- Fix the AI menu's first edit suggestion replacing the old selected text, and leaving stray characters, when you typed inside the selection after sending the request
-
- Keep
AIChatPlugin's preview and pending proposal when a transaction guard refuses its write.accept,insertBelowandreplaceSelectionclose the session only once their write commits. - Return
{ status: 'invalid' }fromhide,reset,show,submitandreload, and keep the session, when a guard refuses discarding the pending proposal. - Keep a streamed proposal when a guard refuses a chunk, and add the next chunk to the same undo step.
- Keep
-
- Paste text or a link onto a focused board to add it as a selected note at the pointer, or at the view's center when the pointer is off the board. One undo removes it.
- Paste or drop picture files onto a board to upload them as image shapes, in a row centered on the pointer or the drop point.
- Upload the file of a picture copied from a web page when its link does not load, so the picture still lands on the board.
- Add
upload(files)touseBoardActions()to upload picture files, such as ones from a toolbar's file picker. ReadtakesPictureFilesthroughuseBoardViewto disable that button on a board that takes no picture files. - Add
fitsAfter(key)to the upload plugin's API to ask whether another file's placeholder fits after an upload placeholder, such as before a file picker opens for several files.
-
- Fix board pen lines, geo shapes and notes whose type an app renames through
schema.override. They now draw, erase, take the toolbar's styles and get announced like shapes of the default type.
- Fix board pen lines, geo shapes and notes whose type an app renames through
-
- Add
read.board.strokePath(id), which returns the SVG path a board draws for a pen line, ornullwhenidnames no pen line. It needs no mounted board. - Move
BoardStrokePathfromplatejs/board/reacttoplatejs/board. Import it fromplatejs/board.
- Add
-
- Add a
caretplugin slot, rendered after the Editable, for UI that follows the caret. Inside it,useEditor()and theeditableRefprop answer for the view that holds the caret, such as a board note, so a floating toolbar in this slot follows the caret into the note. - Remove
EditorSelectionViewand theuseSelectionViewhook fromplatejs/react.
Migration: Drop the
<EditorSelectionView>wrapper. Move UI that used it inside an editing area, such as a floating toolbar, fromafterEditableto thecaretslot:const FloatingToolbarPlugin = definePlugin('floatingToolbar', { slots: { caret: () => <FloatingToolbar /> }, });
- Add a
-
- Keep a code fence's info string after its language, such as
title="a.ts" {3-5}, as the code block'smetathrough Markdown and HTML import and export
- Keep a code fence's info string after its language, such as
-
- Fix a CodeMirror code block dropping the next keystroke, paste, cut or drop when the editor resets its text during an input method composition, such as after a refused edit or a collaborator's change.
- Keep a CodeMirror code block's caret where the editor puts it when the editor resets its text.
- Fix a CodeMirror code block turning into a paragraph in WebKit browsers when an input method empties it.
-
- Fix Enter in the empty last body line of an open Details moving the caret into the block after it. Enter now adds an empty paragraph right after the Details and puts the caret there.
-
- Report
condition-loopon each field of a loop of conditions, such as A naming B while B names A, and refuse anupdatewhose condition would close one. - Refuse a
fieldIdin the settings ofinsertor the patch ofupdate. - Check a condition that names its own field against the kind the same
updatesets. - List the page's fields in
read.fields()from a board note's view, in reading order.
- Report
-
- Add
fillRoletoBaseFieldPlugin's state. While it is set, the editor refuses every local change except a fitting or cleared value on that role's fields, and undo or redo returnsblockedat a step that changed anything else. - Start a new undo step when a field write's role differs from the step before it, so a fill never shares an undo step with an author's edit.
- Refuse the whole update instead of throwing when, while a fill role is set,
updatenames a field that no longer exists or a value that no longer fits it.
- Add
-
5c0aff5by @zbeyens – Addeditor.plugin(BaseHeadingPlugin).read.canSetLevel(level), which answers whethersetLevel(level)can apply to every selected block. A menu can disable a heading level the caret's parent cannot hold. -
868638aby @zbeyens – Fix a hydration mismatch in a control that readsuseEditorFocused()and hydrates after its editor took focus, such as a toolbar behindSuspensebeside anEditorContentwithautoFocus -
7a0e402by @zbeyens – ReplaceInkLayerwithInkContent, which mounts as the ink plugin'swrapContentslot. In development, it throws when anything sits between the Editable and the ink layer, such as a toolbar the layer would cover.Migration: Replace the
wrapContentslot that rendered<InkLayer sign={Sign} />after its children withwrapContent: (props) => <InkContent {...props} sign={Sign} />. -
405fd82by @zbeyens – Keep a pen mark's sign where its block stood when the block is deleted while the mark is being drawn, here or by a collaborator, however many other edits come before the mark saves -
0938c3dby @zbeyens – Save pen marks in a packed format about half the size. Marks saved by 54.0.0-beta.2 still read, but an app still on 54.0.0-beta.2 shows none of the marks this version saves -
dffae16by @zbeyens – Fix ink marks left off their words after a style change moves the words without resizing the paragraph. Marks now place again a quarter second after the last edit, layout change or scroll -
7bc3175by @zbeyens – Speed up typing, drawing, scrolling and deleting many marked blocks in documents with many ink marks.read.marks()keeps each unchanged mark's object between reads. -
6d7c412by @zbeyens – Leave out the ink paragraph snapshots no mark points at when an editor opens a saved document, so a removed mark's words leave the file at its next save. Snapshots saved by 54.0.0-beta.2 stay, so an app still on beta.2 can undo back to its own marks. -
- Keep a Markdown file's leading YAML or TOML front matter.
editor.api.markdown.parsestores it atmeta['markdown.frontmatter']instead of reading it as a rule and a heading,serializewrites it back first, andgetMarkdownFrontmatterfromplatejs/markdownreads it - Fail
serializeunder the reject policy withmarkdown-frontmatter-omittedwhen it cannot write the stored front matter back. UnderlossPolicy: 'allow'it writes the file without the block and warns - Start a serialized file with a line ending when its body would otherwise read back as front matter, such as two
---rules
- Keep a Markdown file's leading YAML or TOML front matter.
-
- Style an unclosed bold, italic or strikethrough run in a
partialparse,parseSliceorparseInlinepreview as it will read once it closes, and hide up to three trailing*,_,~or\characters until the next chunk decides them. A later chunk can take back styling a preview showed
- Style an unclosed bold, italic or strikethrough run in a
-
- Fix Markdown that read back differently after a save: code spans with line endings or edge spaces, emphasis around a link, nested emphasis, a bare URL right after text and an empty list item before a nested ordered list
- Fix streamed Markdown parses that missed a link definition inside a quote or a list item
-
- Fix
parseSlicewithpreviousreturning a different preview than a fresh parse for streamed Markdown that holds, among others, no-break spaces in a blank line, a math block opened with more than two dollars, a link definition with an escaped bracket, a byte order mark or a lone CR line ending
- Fix
-
- Make
useEditor()outside every editing area of anEditorRoot, such as in a fixed toolbar, return the editor of the root that holds the caret. A toolbar command such aseditor.plugin(BoldPlugin).update.toggle()then changes a board's note while the caret is in it. With nothing selected it returns the editor of the primary root.useEditorSelector,useEditorReadOnly,useEditorFocusedand the other hooks that read that editor follow it too, and a component whose selected value stays equal no longer renders when the caret moves. - Make
useEditorHistory()with noeditororrootundo and redo the editoruseEditor()returns. It no longer needs anEditorRootaround it. - Make
useModelEditor()underEditorControllerreturn the document editor of theEditorRootused last, where it threw.
Migration: A lock set through the editor that
useEditor()returns outside every editing area refuses the commands sent through that editor and no longer locks anEditorContent. To lock oneEditorContent, calluseEditor()inside itsEditorContainer:function Lock() { const editor = useEditor(); return ( <button onClick={() => setEditorReadOnly(editor, true)}>Lock</button> ); } <EditorRoot editor={editor}> <EditorContainer> <Lock /> <EditorContent /> </EditorContainer> </EditorRoot>;
- Make
-
038a7bcby @zbeyens – Give each tile of a table paste, and each cell of a table fill, its own copy of an element another element references, such as a field. Each copy gets a new id, and each copied reference names the copy in its own tile or cell. -
- Add
admitandfillto the upload plugin's update API. A plugin with its own insert, such as one that wraps each file's placeholder in a container, checks a batch withadmit, inserts the placeholders it returns and gives each file its placeholder withfill.
- Add
-
- Report an unsupported file type first when a file of another kind is picked for an upload placeholder, before the size and configuration checks.
- Fix an upload placeholder's submit sending its file twice, losing it or sending an older file when its transaction spec replays, another commit or a Cancel comes first, or a newer submit overtakes it.
plitejs
Patch Changes
-
cccbe29by @zbeyens – Fix Next.js production builds with Turbopack's default scope hoisting, where a page with an editor failed to prerender withEditor read registrations must be created by the plugin read factory. Apps no longer needexperimental.turbopackScopeHoisting: false. -
18448e7by @zbeyens – Fix a delete into a code block turning all of its lines into text of the block before it. Delete at the end of the block before joins only the first code line, and the code block keeps its other lines and its language. A range delete that covers the whole block before removes that block and keeps the code block whole. -
18448e7by @zbeyens – Fix a click right of a code line putting the caret at another line's end or at the block's start. A click past a line's end now puts the caret at that line's end, and a click on an empty line puts it on that line. -
44ce4cbby @zbeyens – Fix Backspace and Delete next to mentions, inline voids and inlines a caret may not stop in- Word Backspace and word Delete count a mention or another inline void as one word, and remove only that atom with the spaces between it and the caret.
- Backspace and Delete inside or at the edge of a writable inline with
selectable: falseremove one character, as they do in a link. - Delete that stops before a read-only inline leaves the caret before it, so the next Delete removes it and typing works.
- Backspace and Delete beside a block with
selectable: falseremove it whole even when it holds a mention.
-
77ca905by @zbeyens – Open closed content, such as a closed details, when a block drag rests on its block for 800 ms, so the drop can land inside. The content'sonMaterializecallback runs with the newdragreason; ignore that reason to keep the content closed during a drag. -
1861fc4by @zbeyens – Fix the range a paste or a transfer copy returns with the authored plugin in Editing, which started one character late when the pasted text joined the text before it. -
- Return
stalefrom an external-text view'sdispatchwhen the editor refuses the edit, such as one Suggesting cannot record, and reset the view to the editor's text. - Keep the undo boundary when the editor refuses an external-text edit, so the next edit after a composition gets its own undo step.
- Return
-
7ca1ad5by @zbeyens – Fix ArrowDown and ArrowUp in Firefox into a block that scrolls, such as a code block withoverflow-x: auto, which put the caret at the end of the block instead of on its nearest line -
022a98bby @zbeyens – Run a plugin'supdatefactory the first time an update or a correction reads its group, not at the start of every update, so updates that never read a group skip it -
0b0f932by @zbeyens – Fix pasting blocks at a caret inside a link. A quote pasted in the middle of a link in a quoted paragraph no longer splits the quote in three, and blocks pasted at a link's start or end land just outside the link instead of joining into one line. -
8623edfby @zbeyens – Fix the caret after pasting a link right before another link, or an inline void such as a mention right before another inline void, so a typed letter lands between the two -
d472a04by @zbeyens – Fix the caret and selection in mixed content and around marked controls- Home and End stay on the text before or after a block nested in a text block.
- After a command removes a text element's only text, a typed letter lands in that element.
- A click after a double-click in decorated text, such as a lint underline, puts the caret at the clicked offset.
- A read-only editor keeps its selection painted after a command that re-renders it, such as Add comment.
- A triple-click selects only the clicked line in a code block or a block with line breaks, and only the clicked text beside a nested block.
- A backward selection stays backward after typing over it and undoing.
- The selection stays painted when focus moves to a marked control in Firefox or Safari.
-
7ca1ad5by @zbeyens – Fix Undo and Redo pressed in an independent editor nested in a void element, which ran the outer editor's history instead of its own -
- Fix a paste into a code block, or any element whose schema allows one text, being refused in Editing and in your own pending code block in Suggesting.
- Fix a letter or newline typed in Editing at the start or end of a pending code block, or in an empty one, being refused. The text now joins the block's suggestion.
- Fix a letter or paste in Editing being refused in a code block whose text holds another author's pending format, such as a color.
- Refuse typing, Enter, paste, Backspace, Delete and mark toggles in a code block whose deletion is pending, in Suggesting and Editing, instead of landing the edit beside the block or in its struck text. The refusal reaches
subscribeRefusalsasunrepresentable. Decide the block's pending deletion first.
-
60c44c5by @zbeyens – FixRangeGeometry.clipRectandvisiblefor an Editable whose text paints outside its own box without clipping, such as a board's. A popup placed byuseSelectionGeometry, such as the floating toolbar, now shows over that text, anduseEditableClipcuts by the same area. -
16716a6by @zbeyens – Give each pasted or duplicated element a new value for every unique property another property'sreferencesnames, such as a field id, and point each copied reference at the copy. A reference whose target the paste or duplicate drops keeps naming the original. -
70560eeby @zbeyens – Fix a property write in the same update as a paste, a document replace or a content completion, such as a plugin completing a pasted field's id, which landed on another node or was lost when the authored plugin recorded the update -
94e8d60by @zbeyens – Fix a closed quote pasted at a caret inside a quoted paragraph losing the text after the caret. A table pasted at a caret inside a table cell keeps the cell's text after the caret too. -
19995c7by @zbeyens – AddnamedByto a schema record set, so a set declares which set's records point at its records through anamesfunction that lists the ids a record points at.- An editor created on a saved value leaves out the records of that set that nothing points at and
keepdoes not accept, so the next save drops them. tx.history.restorestops undo or redo before a step whose replay would point a record at a missing one.- Undo and redo skip writes to a record set the current schema retains.
- An editor created on a saved value leaves out the records of that set that nothing points at and
-
02007e6by @zbeyens – Open a document's saved records faster. Each record loads once as text and parses the first time something reads it. Records read back fromeditor.read.value()now always list their keys in sorted order, as records written after the open already did -
- Return
{ reason, status: 'blocked' }fromeditor.api.history.undo()andredo()when the editor refuses the replay, instead of throwing, and pass it to the Editable'sonHistoryReplayfor a keyboard undo or redo. The step stays in history. - Fix history left busy after a session undo or redo, such as a comment thread restore.
- Send an edit that a plugin makes in reaction to a remote Yjs import or another collaboration update to the other peers.
- Fix the authored plugin's
subscribeRefusalspassing on refusals from other plugins, such as a node write veto.
- Return
-
60c44c5by @zbeyens – RemoveuseSelectionViewfromplitejs/react. UseuseCaretEditor()for the editor of the root that holds the caret. -
67de7deby @zbeyens – MakeuseRootEditor()anduseCaretEditor()return one editor per root under anEditorRoot, so a lock set through that editor holds after the caret leaves its root and comes back. A renderer inside an editing area, such as a shape on a board, gets an editor of its own, so a lock set from outside never reaches it. The editor'sisFocused(),isComposing(),focus()andblur()act on the editing area that shows its root, and throw while none does. -
5c0aff5by @zbeyens – Addeditor.read.schema.canPlace(nodes, { at, replace, root }), which answers whethernodescan land at a slot, or take the place of the child there, under the ruletx.blocks.insertenforces. A menu can disable what the parent cannot hold. -
b294cdfby @zbeyens – Fix selector hooks calling a customequalityFnwithnullbefore the first result.equalityFnnow takes(a: T, b: T) => boolean. -
24651f9by @zbeyens – Fixtx.blocks.toggle(props, { wrap: true })wrapping each selected block in its own wrapper. Adjacent selected blocks with the same parent now share one wrapper. -
- Fix
unique.holderin an authored preview or a projected document view returning the stored document's key and path, or nothing. A read that finds a node by a unique id, such as a board'sread.board.shape, now works there.
- Fix
-
59aa10bby @zbeyens – Speed up typing in documents whose schema declares auniqueproperty, such as block ids. -
25fc8f2by @zbeyens – Makeeditor.plugin(Plugin)on a React view editor, such as the oneuseRootEditor()returns, return the same object on every call, so a hook that lists it as a dependency no longer runs again on each render. -
1946357by @zbeyens – LetsetEditorViewing()take the editorcreateEditor()returns instead of throwing. That editor has no Mode apart from its lock, so Viewing locks it and leaving Viewing unlocks it, assetEditorReadOnly()does. -
014d1c8by @zbeyens – Fix selections across blocks a virtualized editor has not mounted, and arrow keys beside hidden content- A Shift-click or Shift+ArrowDown range that reaches unmounted blocks stays selected, and the next letter replaces it.
- Undo that restores a range far above the viewport scrolls to it and shows it selected.
- ArrowUp and ArrowDown after a click move into content an app hides, such as a collapsed accordion, instead of skipping past it.
-
- Fix Backspace after a triple-click putting the caret at the end of the block above. The caret now starts the block that moves up.
- Fix Backspace after a triple-click on the last block, a block next to a table or a table's only cell removing it. The block or cell now stays, empty, with the caret in it.
- Fix Backspace over whole blocks selected as text replacing them with a paragraph. The first block stays, so a checklist item keeps its checkbox.
- Fix typing over several whole blocks giving the new text the default block type. The text now takes the first block's type.
-
- Fix
comparetext changes to mark whole words instead of letters, so "like" to "love" is one change instead of "ik" to "ov"
- Fix
Contributors
Thanks to everyone who contributed to this release:
Full changelog: v54.0.0-beta.2...v54.0.0-beta.3