@lofcz/platejs-core 53.1.8 → 53.2.1
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-BDSzA1zP.d.ts → index-ClAE30YQ.d.ts} +92 -78
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/react/index.d.ts +220 -218
- package/dist/react/index.js +6 -8
- package/dist/static/index.d.ts +1 -1
- package/dist/static/index.js +2 -2
- package/dist/{static-KMalmfNw.js → static-C-jR24Fx.js} +1 -1
- package/dist/{withSlate-NVP0S9vL.js → withSlate-pfxNb3FA.js} +20 -3
- package/package.json +1 -1
package/dist/react/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
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-pfxNb3FA.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-C-jR24Fx.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";
|
|
@@ -1148,10 +1148,9 @@ const pipeRenderLeaf = (editor, renderLeafProp) => {
|
|
|
1148
1148
|
}
|
|
1149
1149
|
props.children = /* @__PURE__ */ React.createElement(Tag, { className }, props.children);
|
|
1150
1150
|
}
|
|
1151
|
-
if (hasActiveComplexRenderLeaf) for (const { key, renderLeaf } of complexRenderLeafEntries) {
|
|
1151
|
+
if (hasActiveComplexRenderLeaf) for (const { key, renderLeaf: RenderLeaf } of complexRenderLeafEntries) {
|
|
1152
1152
|
if (!leaf[key]) continue;
|
|
1153
|
-
|
|
1154
|
-
if (newChildren !== void 0) props.children = newChildren;
|
|
1153
|
+
props.children = /* @__PURE__ */ React.createElement(RenderLeaf, props, props.children);
|
|
1155
1154
|
}
|
|
1156
1155
|
leafPropsPlugins.forEach((plugin) => {
|
|
1157
1156
|
if (props.leaf[plugin.node.type]) {
|
|
@@ -1276,10 +1275,9 @@ const pipeRenderText = (editor, renderTextProp) => {
|
|
|
1276
1275
|
if (isEditOnly(readOnly, plugin, "render")) continue;
|
|
1277
1276
|
props.children = /* @__PURE__ */ React.createElement(Tag, { className }, props.children);
|
|
1278
1277
|
}
|
|
1279
|
-
if (hasActiveRenderText) for (const { renderText, textKey } of renderTexts) {
|
|
1278
|
+
if (hasActiveRenderText) for (const { renderText: RenderText, textKey } of renderTexts) {
|
|
1280
1279
|
if (!text[textKey]) continue;
|
|
1281
|
-
|
|
1282
|
-
if (newChildren !== void 0) props.children = newChildren;
|
|
1280
|
+
props.children = /* @__PURE__ */ React.createElement(RenderText, props, props.children);
|
|
1283
1281
|
}
|
|
1284
1282
|
textPropsPlugins.forEach((plugin) => {
|
|
1285
1283
|
if (props.text[plugin.node.type ?? plugin.key]) {
|
package/dist/static/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $a as
|
|
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-ClAE30YQ";
|
|
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-pfxNb3FA.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-C-jR24Fx.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,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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-pfxNb3FA.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";
|
|
@@ -782,6 +782,7 @@ const resolvePlugins = (editor, plugins = [], createStore = createVanillaStore)
|
|
|
782
782
|
node: {
|
|
783
783
|
isContainer: [],
|
|
784
784
|
isLeaf: [],
|
|
785
|
+
isMetadataProp: [],
|
|
785
786
|
isText: [],
|
|
786
787
|
leafProps: [],
|
|
787
788
|
textProps: [],
|
|
@@ -813,6 +814,7 @@ const resolvePlugins = (editor, plugins = [], createStore = createVanillaStore)
|
|
|
813
814
|
}
|
|
814
815
|
resolvePluginMethods(editor, plugin);
|
|
815
816
|
if (plugin.node?.isContainer) editor.meta.pluginCache.node.isContainer.push(plugin.key);
|
|
817
|
+
if (plugin.node?.isMetadataProp) editor.meta.pluginCache.node.isMetadataProp.push(plugin.key);
|
|
816
818
|
editor.meta.pluginCache.node.types[plugin.node.type] = plugin.key;
|
|
817
819
|
if (plugin.inject?.nodeProps) editor.meta.pluginCache.inject.nodeProps.push(plugin.key);
|
|
818
820
|
if (plugin.render?.node) editor.meta.components[plugin.key] = plugin.render.node;
|
|
@@ -2967,7 +2969,7 @@ const NodeIdPlugin = createTSlatePlugin({
|
|
|
2967
2969
|
filter: defaultNodeIdFilter,
|
|
2968
2970
|
idCreator: () => nanoid(10)
|
|
2969
2971
|
}
|
|
2970
|
-
}).extendTransforms(({ editor, getOptions }) => ({ normalize() {
|
|
2972
|
+
}).extend(({ getOptions }) => ({ node: { isMetadataProp: ({ key }) => key === (getOptions().idKey ?? "id") } })).extendTransforms(({ editor, getOptions }) => ({ normalize() {
|
|
2971
2973
|
const options = getOptions();
|
|
2972
2974
|
const { idCreator, idKey } = options;
|
|
2973
2975
|
const updates = [];
|
|
@@ -3265,6 +3267,21 @@ const setValue = (editor, value) => {
|
|
|
3265
3267
|
//#region src/lib/plugins/slate-extension/SlateExtensionPlugin.ts
|
|
3266
3268
|
const NOOP_ON_NODE_CHANGE = () => {};
|
|
3267
3269
|
const NOOP_ON_TEXT_CHANGE = () => {};
|
|
3270
|
+
const isElementStateEmpty = (editor, element) => {
|
|
3271
|
+
const props = NodeApi.extractProps(element);
|
|
3272
|
+
return Object.entries(props).every(([key, value]) => {
|
|
3273
|
+
if (key === "type") return true;
|
|
3274
|
+
return editor.meta.pluginCache.node.isMetadataProp.some((pluginKey) => {
|
|
3275
|
+
const plugin = editor.plugins[pluginKey];
|
|
3276
|
+
return plugin.node.isMetadataProp?.({
|
|
3277
|
+
...getEditorPlugin(editor, plugin),
|
|
3278
|
+
key,
|
|
3279
|
+
node: element,
|
|
3280
|
+
value
|
|
3281
|
+
});
|
|
3282
|
+
});
|
|
3283
|
+
});
|
|
3284
|
+
};
|
|
3268
3285
|
/** Opinionated extension of slate default behavior. */
|
|
3269
3286
|
const SlateExtensionPlugin = createTSlatePlugin({
|
|
3270
3287
|
api: { redecorate: () => {} },
|
|
@@ -3273,7 +3290,7 @@ const SlateExtensionPlugin = createTSlatePlugin({
|
|
|
3273
3290
|
onNodeChange: NOOP_ON_NODE_CHANGE,
|
|
3274
3291
|
onTextChange: NOOP_ON_TEXT_CHANGE
|
|
3275
3292
|
}
|
|
3276
|
-
}).extendEditorTransforms(({ editor, getOption, tf }) => {
|
|
3293
|
+
}).extendEditorApi(({ editor }) => ({ isElementStateEmpty: bindFirst(isElementStateEmpty, editor) })).extendEditorTransforms(({ editor, getOption, tf }) => {
|
|
3277
3294
|
const apply = tf?.apply ?? editor.tf.apply;
|
|
3278
3295
|
return {
|
|
3279
3296
|
init: bindFirst(init, editor),
|
|
@@ -3807,4 +3824,4 @@ const withSlate = (e, { id, affinity = true, autoSelect, chunking = true, maxLen
|
|
|
3807
3824
|
const createSlateEditor = ({ editor = createEditor(), ...options } = {}) => withSlate(editor, options);
|
|
3808
3825
|
|
|
3809
3826
|
//#endregion
|
|
3810
|
-
export {
|
|
3827
|
+
export { isLastNonEmptyTextOfInlineFormattingContext as $, matchDelimitedInline as $t, parseHtmlDocument 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, htmlStringToDOMNode 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, deserializeHtml 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 };
|