@lofcz/platejs-core 53.4.5 → 53.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index-lBpQT8qX.d.ts → index-fLEDAjcC.d.ts} +27 -27
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/react/index.d.ts +220 -409
- package/dist/react/index.js +2 -2
- package/dist/static/index.d.ts +1 -1
- package/dist/static/index.js +2 -2
- package/dist/{static-BoOSg4dr.js → static-CTmHK15f.js} +3 -6
- package/dist/{withSlate-B-XNrpsk.js → withSlate-CGuPv-qn.js} +8 -12
- package/package.json +6 -7
package/dist/react/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Ut as BaseParagraphPlugin, bt as getSlateClass, cn as getEditorPlugin$1, dt as ChunkingPlugin, ln as createSlatePlugin, m as isEditOnly, n as withSlate, nn as getPluginByType, s as SlateExtensionPlugin, st as DOMPlugin, x as NavigationFeedbackPlugin$1, xt as getPluginNodeProps } from "../withSlate-
|
|
1
|
+
import { Ut as BaseParagraphPlugin, bt as getSlateClass, cn as getEditorPlugin$1, dt as ChunkingPlugin, ln as createSlatePlugin, m as isEditOnly, n as withSlate, nn as getPluginByType, s as SlateExtensionPlugin, st as DOMPlugin, x as NavigationFeedbackPlugin$1, xt as getPluginNodeProps } from "../withSlate-CGuPv-qn.js";
|
|
2
2
|
import { t as Hotkeys } from "../hotkeys-DI1HPO2Q.js";
|
|
3
|
-
import { A as pipeInjectNodeProps, C as createStaticEditor, k as pipeDecorate, s as PlateStatic } from "../static-
|
|
3
|
+
import { A as pipeInjectNodeProps, C as createStaticEditor, k as pipeDecorate, s as PlateStatic } from "../static-CTmHK15f.js";
|
|
4
4
|
import { NodeApi, PathApi, createEditor } from "@platejs/slate";
|
|
5
5
|
import { isDefined } from "@udecode/utils";
|
|
6
6
|
import { DefaultPlaceholder, Editable, Slate, useComposing, useFocused, useReadOnly, useSelected, useSlateStatic, withReact } from "slate-react";
|
package/dist/static/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $a as getEditorDOMFromHtmlString, Ao as SlateRenderElement, Ba as stripHtmlClassNames, Co as SlateRenderText, Do as pipeRenderLeafStatic, Eo as SlateRenderLeaf, Ga as getSelectedDomBlocks, Ha as isSelectOutside, Ja as getPluginDataAttributes, Ka as getRenderNodeStaticProps, Oo as pluginRenderLeafStatic, Qa as createStaticEditor, So as PlateStaticProps, To as pluginRenderTextStatic, Ua as getSelectedDomNode, Va as pipeDecorate, Wa as getSelectedDomFragment, Xa as getStaticPlugins, Ya as createStaticString, Za as ViewPlugin, _o as SerializeHtmlOptions, ao as SlateNodeProps, bo as LeafStatic, co as StyledSlateElementProps, do as useNodeAttributes, eo as SlateElement, fo as BoxStaticProps, go as SlateRenderTextProps, ho as SlateRenderNodeProps, io as SlateLeafProps, jo as pluginRenderElementStatic, ko as pipeRenderElementStatic, lo as StyledSlateLeafProps, mo as SlateRenderLeafProps, no as SlateHTMLProps, oo as SlateText, po as SlateRenderElementProps, qa as getNodeDataAttributes, ro as SlateLeaf, so as SlateTextProps, to as SlateElementProps, uo as StyledSlateTextProps, vo as serializeHtml, wo as pipeRenderTextStatic, xo as PlateStatic, yo as ElementStatic, za as stripSlateDataAttributes } from "../index-
|
|
1
|
+
import { $a as getEditorDOMFromHtmlString, Ao as SlateRenderElement, Ba as stripHtmlClassNames, Co as SlateRenderText, Do as pipeRenderLeafStatic, Eo as SlateRenderLeaf, Ga as getSelectedDomBlocks, Ha as isSelectOutside, Ja as getPluginDataAttributes, Ka as getRenderNodeStaticProps, Oo as pluginRenderLeafStatic, Qa as createStaticEditor, So as PlateStaticProps, To as pluginRenderTextStatic, Ua as getSelectedDomNode, Va as pipeDecorate, Wa as getSelectedDomFragment, Xa as getStaticPlugins, Ya as createStaticString, Za as ViewPlugin, _o as SerializeHtmlOptions, ao as SlateNodeProps, bo as LeafStatic, co as StyledSlateElementProps, do as useNodeAttributes, eo as SlateElement, fo as BoxStaticProps, go as SlateRenderTextProps, ho as SlateRenderNodeProps, io as SlateLeafProps, jo as pluginRenderElementStatic, ko as pipeRenderElementStatic, lo as StyledSlateLeafProps, mo as SlateRenderLeafProps, no as SlateHTMLProps, oo as SlateText, po as SlateRenderElementProps, qa as getNodeDataAttributes, ro as SlateLeaf, so as SlateTextProps, to as SlateElementProps, uo as StyledSlateTextProps, vo as serializeHtml, wo as pipeRenderTextStatic, xo as PlateStatic, yo as ElementStatic, za as stripSlateDataAttributes } from "../index-fLEDAjcC";
|
|
2
2
|
export { BoxStaticProps, ElementStatic, LeafStatic, PlateStatic, PlateStaticProps, SerializeHtmlOptions, SlateElement, SlateElementProps, SlateHTMLProps, SlateLeaf, SlateLeafProps, SlateNodeProps, SlateRenderElement, SlateRenderElementProps, SlateRenderLeaf, SlateRenderLeafProps, SlateRenderNodeProps, SlateRenderText, SlateRenderTextProps, SlateText, SlateTextProps, StyledSlateElementProps, StyledSlateLeafProps, StyledSlateTextProps, ViewPlugin, createStaticEditor, createStaticString, getEditorDOMFromHtmlString, getNodeDataAttributes, getPluginDataAttributes, getRenderNodeStaticProps, getSelectedDomBlocks, getSelectedDomFragment, getSelectedDomNode, getStaticPlugins, isSelectOutside, pipeDecorate, pipeRenderElementStatic, pipeRenderLeafStatic, pipeRenderTextStatic, pluginRenderElementStatic, pluginRenderLeafStatic, pluginRenderTextStatic, serializeHtml, stripHtmlClassNames, stripSlateDataAttributes, useNodeAttributes };
|
package/dist/static/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../withSlate-
|
|
2
|
-
import { C as createStaticEditor, D as getSelectedDomNode, E as isSelectOutside, O as getSelectedDomFragment, S as useNodeAttributes, T as ViewPlugin, _ as getPluginDataAttributes, a as ElementStatic, b as SlateLeaf, c as pipeRenderTextStatic, d as pluginRenderElementStatic, f as stripSlateDataAttributes, g as getNodeDataAttributes, h as getRenderNodeStaticProps, i as pluginRenderLeafStatic, k as pipeDecorate, l as pluginRenderTextStatic, m as getSelectedDomBlocks, n as serializeHtml, o as LeafStatic, p as stripHtmlClassNames, r as pipeRenderLeafStatic, s as PlateStatic, t as getEditorDOMFromHtmlString, u as pipeRenderElementStatic, v as createStaticString, w as getStaticPlugins, x as SlateText, y as SlateElement } from "../static-
|
|
1
|
+
import "../withSlate-CGuPv-qn.js";
|
|
2
|
+
import { C as createStaticEditor, D as getSelectedDomNode, E as isSelectOutside, O as getSelectedDomFragment, S as useNodeAttributes, T as ViewPlugin, _ as getPluginDataAttributes, a as ElementStatic, b as SlateLeaf, c as pipeRenderTextStatic, d as pluginRenderElementStatic, f as stripSlateDataAttributes, g as getNodeDataAttributes, h as getRenderNodeStaticProps, i as pluginRenderLeafStatic, k as pipeDecorate, l as pluginRenderTextStatic, m as getSelectedDomBlocks, n as serializeHtml, o as LeafStatic, p as stripHtmlClassNames, r as pipeRenderLeafStatic, s as PlateStatic, t as getEditorDOMFromHtmlString, u as pipeRenderElementStatic, v as createStaticString, w as getStaticPlugins, x as SlateText, y as SlateElement } from "../static-CTmHK15f.js";
|
|
3
3
|
|
|
4
4
|
export { ElementStatic, LeafStatic, PlateStatic, SlateElement, SlateLeaf, SlateText, ViewPlugin, createStaticEditor, createStaticString, getEditorDOMFromHtmlString, getNodeDataAttributes, getPluginDataAttributes, getRenderNodeStaticProps, getSelectedDomBlocks, getSelectedDomFragment, getSelectedDomNode, getStaticPlugins, isSelectOutside, pipeDecorate, pipeRenderElementStatic, pipeRenderLeafStatic, pipeRenderTextStatic, pluginRenderElementStatic, pluginRenderLeafStatic, pluginRenderTextStatic, serializeHtml, stripHtmlClassNames, stripSlateDataAttributes, useNodeAttributes };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { Ct as keyToDataAttribute, Tt as getInjectMatch, bt as getSlateClass, cn as getEditorPlugin, m as isEditOnly, n as withSlate, nn as getPluginByType, st as DOMPlugin, xt as getPluginNodeProps } from "./withSlate-
|
|
1
|
+
import { Ct as keyToDataAttribute, Tt as getInjectMatch, bt as getSlateClass, cn as getEditorPlugin, m as isEditOnly, n as withSlate, nn as getPluginByType, st as DOMPlugin, xt as getPluginNodeProps } from "./withSlate-CGuPv-qn.js";
|
|
2
2
|
import { ElementApi, NodeApi, RangeApi, TextApi, createEditor, isElementDecorationsEqual, isTextDecorationsEqual } from "@platejs/slate";
|
|
3
3
|
import { isDefined } from "@udecode/utils";
|
|
4
4
|
import React from "react";
|
|
5
5
|
import clsx$1, { clsx } from "clsx";
|
|
6
|
-
import { decode } from "html-entities";
|
|
7
6
|
|
|
8
7
|
//#region src/internal/plugin/pluginInjectNodeProps.ts
|
|
9
8
|
/**
|
|
@@ -706,7 +705,7 @@ const pipeRenderLeafStatic = (editor, { renderLeaf: renderLeafProp } = {}) => {
|
|
|
706
705
|
const getReactDOMServer = async () => {
|
|
707
706
|
return (await import("react-dom/server")).default;
|
|
708
707
|
};
|
|
709
|
-
const renderComponentToHtml = (ReactDOMServer, Component, props) =>
|
|
708
|
+
const renderComponentToHtml = (ReactDOMServer, Component, props) => ReactDOMServer.renderToStaticMarkup(React.createElement(Component, props));
|
|
710
709
|
/**
|
|
711
710
|
* Serialize the editor content to HTML. By default, uses `PlateStatic` as the
|
|
712
711
|
* editor component, but you can provide a custom component (e.g.
|
|
@@ -731,9 +730,7 @@ const serializeHtml = async (editor, { editorComponent: EditorComponent = PlateS
|
|
|
731
730
|
* @returns The Editor element without head and body.
|
|
732
731
|
*/
|
|
733
732
|
const getEditorDOMFromHtmlString = (html) => {
|
|
734
|
-
|
|
735
|
-
node.innerHTML = html;
|
|
736
|
-
return node.querySelector("[data-slate-editor=\"true\"]");
|
|
733
|
+
return new DOMParser().parseFromString(html, "text/html").querySelector("[data-slate-editor=\"true\"]");
|
|
737
734
|
};
|
|
738
735
|
|
|
739
736
|
//#endregion
|
|
@@ -2486,14 +2486,14 @@ const deserializeHtmlNode = (editor) => (node) => {
|
|
|
2486
2486
|
/** Deserialize HTML element to fragment. */
|
|
2487
2487
|
const deserializeHtmlElement = (editor, element) => deserializeHtmlNode(editor)(element);
|
|
2488
2488
|
|
|
2489
|
+
//#endregion
|
|
2490
|
+
//#region src/lib/plugins/html/utils/parseHtmlDocument.ts
|
|
2491
|
+
const parseHtmlDocument = (html) => new DOMParser().parseFromString(html, "text/html");
|
|
2492
|
+
|
|
2489
2493
|
//#endregion
|
|
2490
2494
|
//#region src/lib/plugins/html/utils/htmlStringToDOMNode.ts
|
|
2491
2495
|
/** Convert HTML string into HTML element. */
|
|
2492
|
-
const htmlStringToDOMNode = (rawHtml) =>
|
|
2493
|
-
const node = document.createElement("body");
|
|
2494
|
-
node.innerHTML = rawHtml;
|
|
2495
|
-
return node;
|
|
2496
|
-
};
|
|
2496
|
+
const htmlStringToDOMNode = (rawHtml) => parseHtmlDocument(rawHtml).body;
|
|
2497
2497
|
|
|
2498
2498
|
//#endregion
|
|
2499
2499
|
//#region src/lib/plugins/html/utils/deserializeHtml.ts
|
|
@@ -2507,10 +2507,6 @@ const deserializeHtml = (editor, { collapseWhiteSpace: shouldCollapseWhiteSpace
|
|
|
2507
2507
|
});
|
|
2508
2508
|
};
|
|
2509
2509
|
|
|
2510
|
-
//#endregion
|
|
2511
|
-
//#region src/lib/plugins/html/utils/parseHtmlDocument.ts
|
|
2512
|
-
const parseHtmlDocument = (html) => new DOMParser().parseFromString(html, "text/html");
|
|
2513
|
-
|
|
2514
2510
|
//#endregion
|
|
2515
2511
|
//#region src/lib/plugins/html/HtmlPlugin.ts
|
|
2516
2512
|
/**
|
|
@@ -2520,8 +2516,8 @@ const parseHtmlDocument = (html) => new DOMParser().parseFromString(html, "text/
|
|
|
2520
2516
|
const HtmlPlugin = createSlatePlugin({ key: "html" }).extendApi(({ editor }) => ({ deserialize: bindFirst(deserializeHtml, editor) })).extend({ parser: {
|
|
2521
2517
|
format: "text/html",
|
|
2522
2518
|
deserialize: ({ api, data }) => {
|
|
2523
|
-
const document
|
|
2524
|
-
return api.html.deserialize({ element: document
|
|
2519
|
+
const document = parseHtmlDocument(data);
|
|
2520
|
+
return api.html.deserialize({ element: document.body });
|
|
2525
2521
|
}
|
|
2526
2522
|
} });
|
|
2527
2523
|
|
|
@@ -3873,4 +3869,4 @@ const withSlate = (e, { id, affinity = true, autoSelect, chunking = true, maxLen
|
|
|
3873
3869
|
const createSlateEditor = ({ editor = createEditor(), ...options } = {}) => withSlate(editor, options);
|
|
3874
3870
|
|
|
3875
3871
|
//#endregion
|
|
3876
|
-
export { isLastNonEmptyTextOfInlineFormattingContext as $, matchDelimitedInline as $t,
|
|
3872
|
+
export { isLastNonEmptyTextOfInlineFormattingContext as $, matchDelimitedInline as $t, deserializeHtml as A, isSlateNode as At, pluginDeserializeHtml as B, withMergeRules as Bt, clearNavigationFeedbackTarget as C, keyToDataAttribute as Ct, NavigationFeedbackPluginKey as D, isSlateEditor as Dt, NAVIGATION_FEEDBACK_KEY as E, getSlateElements as Et, htmlTextNodeToString as F, isSlateVoid as Ft, collapseWhiteSpace as G, withPlateHistory as Gt, htmlBrToNewLine as H, withBreakRules as Ht, htmlElementToLeaf as I, applyDeepToNodes as It, collapseWhiteSpaceChildren as J, createBlockStartInputRule as Jt, collapseWhiteSpaceElement as K, AstPlugin as Kt, pipeDeserializeHtmlLeaf as L, OverridePlugin as Lt, parseHtmlDocument as M, isSlatePluginNode as Mt, deserializeHtmlElement as N, isSlateString as Nt, LengthPlugin as O, isSlateElement as Ot, deserializeHtmlNode as P, isSlateText as Pt, upsertInlineFormattingContext as Q, matchBlockStart as Qt, htmlElementToElement as R, withOverrides as Rt, navigate as S, getNodeDataAttributeKeys as St, resolveNavigationFeedbackTarget as T, getInjectMatch as Tt, htmlBodyToFragment as U, BaseParagraphPlugin as Ut, getDataNodeProps as V, withDeleteRules as Vt, deserializeHtmlNodeChildren as W, HistoryPlugin as Wt, collapseWhiteSpaceText as X, createTextSubstitutionInputRule as Xt, collapseWhiteSpaceNode as Y, createMarkInputRule as Yt, endInlineFormattingContext as Z, matchBlockFence as Zt, NodeIdPlugin as _, getMarkBoundaryAffinity as _t, pipeInsertDataQuery as a, getPluginType as an, isHtmlElement as at, withNodeId as b, getSlateClass as bt, isElementStateEmpty as c, getEditorPlugin as cn, withScrolling as ct, liftBlock as d, ChunkingPlugin as dt, defineInputRule as en, collapseString as et, insertExitBreak as f, withChunking as ft, pipeOnNodeChange as g, isNodesAffinity as gt, pipeOnTextChange as h, isNodeAffinity as ht, ParserPlugin as i, getPluginKeys as in, isHtmlText as it, htmlStringToDOMNode as j, isSlatePluginElement as jt, HtmlPlugin as k, isSlateLeaf as kt, setValue as l, createSlatePlugin as ln, DebugPlugin as lt, isEditOnly as m, setAffinitySelection as mt, withSlate as n, getPluginByType as nn, isHtmlInlineElement as nt, normalizeDescendantsToDocumentFragment as o, getPluginTypes as on, AUTO_SCROLL as ot, init as p, AffinityPlugin as pt, inferWhiteSpaceRule as q, createBlockFenceInputRule as qt, getCorePlugins as r, getPluginKey as rn, inlineTagNames as rt, SlateExtensionPlugin as s, getSlatePlugin as sn, DOMPlugin as st, createSlateEditor as t, getContainerTypes as tn, isHtmlBlockElement as tt, resetBlock as u, createTSlatePlugin as un, PlateError as ut, normalizeNodeId as v, getEdgeNodes as vt, flashTarget as w, getInjectedPlugins as wt, NavigationFeedbackPlugin as x, getPluginNodeProps as xt, normalizeNodeIdWithEditor as y, mergeDeepToNodes as yt, pipeDeserializeHtmlElement as z, withNormalizeRules as zt };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lofcz/platejs-core",
|
|
3
|
-
"version": "53.4.
|
|
3
|
+
"version": "53.4.7",
|
|
4
4
|
"description": "The core of Plate – a plugin system for slate",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"contentEditable",
|
|
@@ -37,11 +37,9 @@
|
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"clsx": "^2.1.1",
|
|
40
|
-
"html-entities": "^2.6.0",
|
|
41
40
|
"is-hotkey": "^0.2.0",
|
|
42
|
-
"jotai": "
|
|
41
|
+
"jotai": "^3.0.0",
|
|
43
42
|
"jotai-optics": "0.4.0",
|
|
44
|
-
"jotai-x": "2.3.4",
|
|
45
43
|
"lodash": "^4.17.21",
|
|
46
44
|
"nanoid": "^5.1.5",
|
|
47
45
|
"optics-ts": "2.4.1",
|
|
@@ -49,14 +47,15 @@
|
|
|
49
47
|
"slate": "0.126.2",
|
|
50
48
|
"slate-dom": "0.126.0",
|
|
51
49
|
"slate-hyperscript": "0.125.0",
|
|
52
|
-
"slate-react": "0.126.
|
|
50
|
+
"slate-react": "0.126.4",
|
|
53
51
|
"use-deep-compare": "^1.3.0",
|
|
54
52
|
"zustand": "^5.0.5",
|
|
55
53
|
"zustand-x": "6.2.1",
|
|
56
|
-
"@platejs/slate": "npm:@lofcz/platejs-slate@53.
|
|
54
|
+
"@platejs/slate": "npm:@lofcz/platejs-slate@53.4.6",
|
|
57
55
|
"@udecode/react-hotkeys": "npm:@lofcz/udecode-react-hotkeys@52.3.6",
|
|
58
56
|
"@udecode/react-utils": "npm:@lofcz/udecode-react-utils@52.3.4",
|
|
59
|
-
"@udecode/utils": "npm:@lofcz/udecode-utils@52.3.4"
|
|
57
|
+
"@udecode/utils": "npm:@lofcz/udecode-utils@52.3.4",
|
|
58
|
+
"jotai-x": "npm:@lofcz/jotai-x@2.4.0"
|
|
60
59
|
},
|
|
61
60
|
"peerDependencies": {
|
|
62
61
|
"react": ">=18.0.0",
|