@frontify/fondue 12.0.0-beta.12 → 12.0.0-beta.14
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/components/AssetInput/AssetInput.d.ts +2 -0
- package/dist/components/AssetInput/AssetInput.es.js +33 -29
- package/dist/components/AssetInput/AssetInput.es.js.map +1 -1
- package/dist/components/AssetInput/SingleAsset/AssetSubline.d.ts +1 -1
- package/dist/components/AssetInput/SingleAsset/AssetSubline.es.js +25 -16
- package/dist/components/AssetInput/SingleAsset/AssetSubline.es.js.map +1 -1
- package/dist/components/AssetInput/SingleAsset/SelectedAsset.d.ts +2 -2
- package/dist/components/AssetInput/SingleAsset/SelectedAsset.es.js +46 -44
- package/dist/components/AssetInput/SingleAsset/SelectedAsset.es.js.map +1 -1
- package/dist/components/RichTextEditor/Plugins/GeneratePlugins.es.js +17 -21
- package/dist/components/RichTextEditor/Plugins/GeneratePlugins.es.js.map +1 -1
- package/dist/components/RichTextEditor/RichTextEditor.d.ts +0 -1
- package/dist/components/RichTextEditor/RichTextEditor.es.js +54 -76
- package/dist/components/RichTextEditor/RichTextEditor.es.js.map +1 -1
- package/dist/components/RichTextEditor/Toolbar/index.d.ts +1 -1
- package/dist/components/RichTextEditor/Toolbar/index.es.js +19 -18
- package/dist/components/RichTextEditor/Toolbar/index.es.js.map +1 -1
- package/dist/components/RichTextEditor/Toolbar/types.d.ts +0 -2
- package/dist/components/RichTextEditor/context/EditorResizeContext.es.js +13 -25
- package/dist/components/RichTextEditor/context/EditorResizeContext.es.js.map +1 -1
- package/dist/components/RichTextEditor/context/RichTextEditorContext.d.ts +1 -1
- package/dist/components/RichTextEditor/context/RichTextEditorContext.es.js +16 -17
- package/dist/components/RichTextEditor/context/RichTextEditorContext.es.js.map +1 -1
- package/dist/components/RichTextEditor/hooks/useEditorState.d.ts +4 -1
- package/dist/components/RichTextEditor/hooks/useEditorState.es.js +12 -11
- package/dist/components/RichTextEditor/hooks/useEditorState.es.js.map +1 -1
- package/dist/components/RichTextEditor/serializer/serializeToHtml.es.js +1 -1
- package/dist/components/RichTextEditor/serializer/serializeToHtml.es.js.map +1 -1
- package/dist/components/RichTextEditor/utils/parseRawValue.d.ts +6 -1
- package/dist/components/RichTextEditor/utils/parseRawValue.es.js +11 -11
- package/dist/components/RichTextEditor/utils/parseRawValue.es.js.map +1 -1
- package/dist/components/ScrollWrapper/ScrollWrapper.es.js +1 -1
- package/dist/components/Table/TableCell.es.js +1 -1
- package/dist/components/Table/TableColumnHeader.es.js +1 -1
- package/dist/components/Tree/utils/mocks.es.js +1 -1
- package/dist/index.cjs.js +4 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.umd.js +4 -4
- package/dist/index.umd.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -1,92 +1,70 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Plate as
|
|
3
|
-
import { useMemoizedId as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import "
|
|
11
|
-
import { ON_SAVE_DELAY_IN_MS as G } from "./utils/constants.es.js";
|
|
12
|
-
import { defaultDesignTokens as s } from "./utils/defaultDesignTokens.es.js";
|
|
13
|
-
import { parseRawValue as M } from "./utils/parseRawValue.es.js";
|
|
14
|
-
import { TextStyles as d } from "./Plugins/TextStylePlugin/TextStyles/textStyles.es.js";
|
|
15
|
-
import "./Plugins/TextStylePlugin/TextStyles/Custom1Plugin/createCustom1Plugin.es.js";
|
|
16
|
-
import "./Plugins/TextStylePlugin/TextStyles/Custom2Plugin/createCustom2Plugin.es.js";
|
|
17
|
-
import "./Plugins/TextStylePlugin/TextStyles/Custom3Plugin/createCustom3Plugin.es.js";
|
|
18
|
-
import "./Plugins/TextStylePlugin/TextStyles/Heading1Plugin/createHeading1Plugin.es.js";
|
|
19
|
-
import "./Plugins/TextStylePlugin/TextStyles/Heading2Plugin/createHeading2Plugin.es.js";
|
|
20
|
-
import "./Plugins/TextStylePlugin/TextStyles/Heading3Plugin/createHeading3Plugin.es.js";
|
|
21
|
-
import "./Plugins/TextStylePlugin/TextStyles/Heading4Plugin/createHeading4Plugin.es.js";
|
|
22
|
-
import "./Plugins/TextStylePlugin/TextStyles/Quote/createQuotePlugin.es.js";
|
|
1
|
+
import r from "react";
|
|
2
|
+
import { Plate as v } from "@udecode/plate";
|
|
3
|
+
import { useMemoizedId as y } from "../../hooks/useMemoizedId.es.js";
|
|
4
|
+
import { Toolbar as A } from "./components/Toolbar/Toolbar.es.js";
|
|
5
|
+
import { RichTextEditorProvider as N } from "./context/RichTextEditorContext.es.js";
|
|
6
|
+
import { useEditorState as R } from "./hooks/useEditorState.es.js";
|
|
7
|
+
import { PaddingSizes as S } from "./types.es.js";
|
|
8
|
+
import { defaultActions as w } from "./utils/actions.es.js";
|
|
9
|
+
import { defaultDesignTokens as C } from "./utils/defaultDesignTokens.es.js";
|
|
10
|
+
import { parseRawValue as L } from "./utils/parseRawValue.es.js";
|
|
23
11
|
import "./EditorPositioningWrapper/index.es.js";
|
|
24
|
-
import { getEditorConfig as
|
|
25
|
-
import { defaultPlugins as
|
|
26
|
-
import { forceTabOutOfActiveElement as
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
const
|
|
12
|
+
import { getEditorConfig as x } from "./utils/editorConfig.es.js";
|
|
13
|
+
import { defaultPlugins as D } from "./Plugins/index.es.js";
|
|
14
|
+
import { forceTabOutOfActiveElement as I } from "./helpers/forceTabOutOfActiveElement.es.js";
|
|
15
|
+
import { Position as V } from "./EditorPositioningWrapper/types.es.js";
|
|
16
|
+
import { GeneratePlugins as z } from "./Plugins/GeneratePlugins.es.js";
|
|
17
|
+
const G = {
|
|
30
18
|
position: "relative",
|
|
31
19
|
height: "0"
|
|
32
|
-
},
|
|
33
|
-
id:
|
|
34
|
-
value:
|
|
35
|
-
placeholder:
|
|
36
|
-
readonly:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
plugins: N = H
|
|
20
|
+
}, $ = ({
|
|
21
|
+
id: l,
|
|
22
|
+
value: s,
|
|
23
|
+
placeholder: f = "",
|
|
24
|
+
readonly: c = !1,
|
|
25
|
+
designTokens: d = C,
|
|
26
|
+
actions: n = w,
|
|
27
|
+
onTextChange: p,
|
|
28
|
+
onBlur: m,
|
|
29
|
+
padding: u = S.None,
|
|
30
|
+
position: g = V.FLOATING,
|
|
31
|
+
plugins: E = D
|
|
45
32
|
}) => {
|
|
46
|
-
const e =
|
|
47
|
-
placeholder:
|
|
48
|
-
renderPlaceholder: ({ children:
|
|
49
|
-
const
|
|
50
|
-
...
|
|
33
|
+
const e = y(l), { localValue: P, onChange: T } = R(p), h = {
|
|
34
|
+
placeholder: f,
|
|
35
|
+
renderPlaceholder: ({ children: i, attributes: a }) => {
|
|
36
|
+
const b = {
|
|
37
|
+
...a,
|
|
51
38
|
style: {
|
|
52
|
-
...
|
|
53
|
-
...
|
|
39
|
+
...a.style,
|
|
40
|
+
...G
|
|
54
41
|
}
|
|
55
42
|
};
|
|
56
|
-
return /* @__PURE__ */
|
|
57
|
-
...
|
|
58
|
-
},
|
|
43
|
+
return /* @__PURE__ */ r.createElement("span", {
|
|
44
|
+
...b
|
|
45
|
+
}, i);
|
|
59
46
|
},
|
|
60
|
-
readOnly:
|
|
61
|
-
onBlur: () =>
|
|
62
|
-
className:
|
|
63
|
-
onKeyDown: (
|
|
64
|
-
|
|
47
|
+
readOnly: c,
|
|
48
|
+
onBlur: () => m && m(JSON.stringify(P.current)),
|
|
49
|
+
className: u,
|
|
50
|
+
onKeyDown: (i) => {
|
|
51
|
+
i.code === "Tab" && I();
|
|
65
52
|
}
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}, [o]);
|
|
71
|
-
const p = C((t) => {
|
|
72
|
-
a && a(JSON.stringify(t));
|
|
73
|
-
}, G), h = T((t) => {
|
|
74
|
-
p(t), l.current = t;
|
|
75
|
-
}, [p, l]), r = Y(e, N), i = !!r && f.length === 0, y = i ? r.create() : z();
|
|
76
|
-
return /* @__PURE__ */ n.createElement(I, {
|
|
77
|
-
value: { designTokens: o, position: b }
|
|
78
|
-
}, /* @__PURE__ */ n.createElement(_, {
|
|
53
|
+
}, o = z(e, E), t = !!o && n.length === 0, O = t ? o.create() : x();
|
|
54
|
+
return /* @__PURE__ */ r.createElement(N, {
|
|
55
|
+
value: { designTokens: d, position: g }
|
|
56
|
+
}, /* @__PURE__ */ r.createElement(v, {
|
|
79
57
|
id: e,
|
|
80
|
-
initialValue:
|
|
81
|
-
onChange:
|
|
82
|
-
editableProps:
|
|
83
|
-
plugins:
|
|
84
|
-
},
|
|
58
|
+
initialValue: L({ editorId: e, raw: s }),
|
|
59
|
+
onChange: T,
|
|
60
|
+
editableProps: h,
|
|
61
|
+
plugins: O
|
|
62
|
+
}, t && o.toolbar(), t && o.inline(), !t && /* @__PURE__ */ r.createElement(A, {
|
|
85
63
|
editorId: e,
|
|
86
|
-
actions:
|
|
64
|
+
actions: n
|
|
87
65
|
})));
|
|
88
66
|
};
|
|
89
67
|
export {
|
|
90
|
-
|
|
68
|
+
$ as RichTextEditor
|
|
91
69
|
};
|
|
92
70
|
//# sourceMappingURL=RichTextEditor.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichTextEditor.es.js","sources":["../../../src/components/RichTextEditor/RichTextEditor.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport React, { FC
|
|
1
|
+
{"version":3,"file":"RichTextEditor.es.js","sources":["../../../src/components/RichTextEditor/RichTextEditor.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport React, { FC } from 'react';\nimport { Plate } from '@udecode/plate';\nimport { useMemoizedId } from '@hooks/useMemoizedId';\nimport { EditableProps, RenderPlaceholderProps } from 'slate-react/dist/components/editable';\nimport { Toolbar } from './components/Toolbar/Toolbar';\nimport { RichTextEditorProvider } from './context/RichTextEditorContext';\nimport { useEditorState } from './hooks';\nimport { DesignTokens, PaddingSizes } from './types';\nimport { EditorActions, defaultActions } from './utils/actions';\nimport { defaultDesignTokens } from './utils/defaultDesignTokens';\nimport { parseRawValue } from './utils/parseRawValue';\nimport { Position } from './EditorPositioningWrapper';\nimport { getEditorConfig } from './utils/editorConfig';\nimport { GeneratePlugins, PluginComposer, defaultPlugins } from './Plugins';\nimport { forceTabOutOfActiveElement } from './helpers';\n\nconst PLACEHOLDER_STYLES: RenderPlaceholderProps['attributes']['style'] = {\n position: 'relative',\n height: '0',\n};\n\nexport type RichTextEditorProps = {\n id?: string;\n placeholder?: string;\n value?: string;\n onTextChange?: (value: string) => void;\n onBlur?: (value: string) => void;\n readonly?: boolean;\n designTokens?: DesignTokens;\n actions?: EditorActions[][];\n padding?: PaddingSizes;\n position?: Position;\n plugins?: PluginComposer;\n};\n\nexport const RichTextEditor: FC<RichTextEditorProps> = ({\n id,\n value: initialValue,\n placeholder = '',\n readonly = false,\n designTokens = defaultDesignTokens,\n actions = defaultActions,\n onTextChange,\n onBlur,\n padding = PaddingSizes.None,\n position = Position.FLOATING,\n plugins = defaultPlugins,\n}) => {\n const editorId = useMemoizedId(id);\n const { localValue, onChange } = useEditorState(onTextChange);\n\n const editableProps: EditableProps = {\n placeholder,\n renderPlaceholder: ({ children, attributes }) => {\n const mergedAttributes = {\n ...attributes,\n style: {\n ...attributes.style,\n ...PLACEHOLDER_STYLES,\n },\n };\n return <span {...mergedAttributes}>{children}</span>;\n },\n readOnly: readonly,\n onBlur: () => onBlur && onBlur(JSON.stringify(localValue.current)),\n className: padding,\n onKeyDown: (event) => {\n if (event.code === 'Tab') {\n // Forcing a blur event because of accessibility\n forceTabOutOfActiveElement();\n }\n },\n };\n\n const config = GeneratePlugins(editorId, plugins);\n const isNew = !!config && actions.length === 0;\n const editorConfig = isNew ? config.create() : getEditorConfig();\n\n return (\n <RichTextEditorProvider value={{ designTokens, position }}>\n <Plate\n id={editorId}\n initialValue={parseRawValue({ editorId, raw: initialValue })}\n onChange={onChange}\n editableProps={editableProps}\n plugins={editorConfig}\n >\n {isNew && config.toolbar()}\n {isNew && config.inline()}\n {!isNew && <Toolbar editorId={editorId} actions={actions} />}\n </Plate>\n </RichTextEditorProvider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAkBA,MAAM,IAAoE;AAAA,EACtE,UAAU;AAAA,EACV,QAAQ;AACZ,GAgBa,IAA0C,CAAC;AAAA,EACpD;AAAA,EACA,OAAO;AAAA,EACP,iBAAc;AAAA,EACd,cAAW;AAAA,EACX,kBAAe;AAAA,EACf,aAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA,aAAU,EAAa;AAAA,EACvB,cAAW,EAAS;AAAA,EACpB,aAAU;AAAA,MACR;AACI,QAAA,IAAW,EAAc,CAAE,GAC3B,EAAE,eAAY,gBAAa,EAAe,CAAY,GAEtD,IAA+B;AAAA,IACjC;AAAA,IACA,mBAAmB,CAAC,EAAE,aAAU,oBAAiB;AAC7C,YAAM,IAAmB;AAAA,QACrB,GAAG;AAAA,QACH,OAAO;AAAA,UACH,GAAG,EAAW;AAAA,UACd,GAAG;AAAA,QACP;AAAA,MAAA;AAEJ,aAAQ,kBAAA,cAAA,QAAA;AAAA,QAAM,GAAG;AAAA,MAAA,GAAmB,CAAS;AAAA,IACjD;AAAA,IACA,UAAU;AAAA,IACV,QAAQ,MAAM,KAAU,EAAO,KAAK,UAAU,EAAW,OAAO,CAAC;AAAA,IACjE,WAAW;AAAA,IACX,WAAW,CAAC,MAAU;AACd,MAAA,EAAM,SAAS,SAEY;IAEnC;AAAA,EAAA,GAGE,IAAS,EAAgB,GAAU,CAAO,GAC1C,IAAQ,CAAC,CAAC,KAAU,EAAQ,WAAW,GACvC,IAAe,IAAQ,EAAO,WAAW,EAAgB;AAE/D,SACK,kBAAA,cAAA,GAAA;AAAA,IAAuB,OAAO,EAAE,iBAAc,YAAS;AAAA,EAAA,GACnD,kBAAA,cAAA,GAAA;AAAA,IACG,IAAI;AAAA,IACJ,cAAc,EAAc,EAAE,aAAU,KAAK,GAAc;AAAA,IAC3D;AAAA,IACA;AAAA,IACA,SAAS;AAAA,EAER,GAAA,KAAS,EAAO,QAAA,GAChB,KAAS,EAAO,OAAO,GACvB,CAAC,KAAU,kBAAA,cAAA,GAAA;AAAA,IAAQ;AAAA,IAAoB;AAAA,EAAkB,CAAA,CAC9D,CACJ;AAER;"}
|
|
@@ -1,28 +1,29 @@
|
|
|
1
|
+
import { usePlateEditorRef as w } from "@udecode/plate";
|
|
1
2
|
import t from "react";
|
|
2
|
-
import { useEditorResizeContext as
|
|
3
|
-
import { useRichTextEditorContext as
|
|
4
|
-
import { EditorPositioningWrapper as
|
|
5
|
-
import { ButtonGroupWrapper as
|
|
6
|
-
import { getButtonGroupWidths as
|
|
7
|
-
const
|
|
8
|
-
const { editorWidth:
|
|
3
|
+
import { useEditorResizeContext as x } from "../context/EditorResizeContext.es.js";
|
|
4
|
+
import { useRichTextEditorContext as E } from "../context/RichTextEditorContext.es.js";
|
|
5
|
+
import { EditorPositioningWrapper as W } from "../EditorPositioningWrapper/index.es.js";
|
|
6
|
+
import { ButtonGroupWrapper as G } from "../Plugins/helper.es.js";
|
|
7
|
+
import { getButtonGroupWidths as R, getButtonGroupsPerRow as b } from "./utils.es.js";
|
|
8
|
+
const C = ({ buttons: p, editorId: o }) => {
|
|
9
|
+
const m = w(o), { editorWidth: e } = x(), { position: s } = E(), a = R(p), r = b(e || 0, a), u = W[s];
|
|
9
10
|
return /* @__PURE__ */ t.createElement(u.ToolbarWrapper, {
|
|
10
|
-
editorWidth:
|
|
11
|
-
toolbarButtonGroups:
|
|
12
|
-
},
|
|
11
|
+
editorWidth: e,
|
|
12
|
+
toolbarButtonGroups: r
|
|
13
|
+
}, r.map((d, c) => /* @__PURE__ */ t.createElement("div", {
|
|
13
14
|
className: "tw-divide-x tw-divide-line tw-flex tw-w-full tw-flex-wrap",
|
|
14
15
|
key: c
|
|
15
|
-
}, d.map(({ group: l, index:
|
|
16
|
-
index:
|
|
17
|
-
key:
|
|
18
|
-
}, l.map((
|
|
19
|
-
editor:
|
|
20
|
-
editorId:
|
|
21
|
-
id:
|
|
16
|
+
}, d.map(({ group: l, index: i }) => /* @__PURE__ */ t.createElement(G, {
|
|
17
|
+
index: i,
|
|
18
|
+
key: i
|
|
19
|
+
}, l.map((n, f) => /* @__PURE__ */ t.createElement(n.button, {
|
|
20
|
+
editor: m,
|
|
21
|
+
editorId: o,
|
|
22
|
+
id: n.id,
|
|
22
23
|
key: f.toString()
|
|
23
24
|
})))))));
|
|
24
25
|
};
|
|
25
26
|
export {
|
|
26
|
-
|
|
27
|
+
C as Toolbar
|
|
27
28
|
};
|
|
28
29
|
//# sourceMappingURL=index.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":["../../../../src/components/RichTextEditor/Toolbar/index.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport React from 'react';\nimport { useEditorResizeContext } from '../context/EditorResizeContext';\nimport { useRichTextEditorContext } from '../context/RichTextEditorContext';\nimport { EditorPositioningWrapper } from '../EditorPositioningWrapper';\nimport { ButtonGroupWrapper } from '../Plugins/helper';\nimport { ToolbarProps } from './types';\nimport { getButtonGroupWidths, getButtonGroupsPerRow } from './utils';\n\nexport const Toolbar = ({ buttons,
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../../../../src/components/RichTextEditor/Toolbar/index.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { usePlateEditorRef } from '@udecode/plate';\nimport React from 'react';\nimport { useEditorResizeContext } from '../context/EditorResizeContext';\nimport { useRichTextEditorContext } from '../context/RichTextEditorContext';\nimport { EditorPositioningWrapper } from '../EditorPositioningWrapper';\nimport { ButtonGroupWrapper } from '../Plugins/helper';\nimport { ToolbarProps } from './types';\nimport { getButtonGroupWidths, getButtonGroupsPerRow } from './utils';\n\nexport const Toolbar = ({ buttons, editorId }: ToolbarProps) => {\n const editor = usePlateEditorRef(editorId)!;\n const { editorWidth } = useEditorResizeContext();\n const { position } = useRichTextEditorContext();\n\n const buttonGroupWidths = getButtonGroupWidths(buttons);\n const buttonGroupsPerRow = getButtonGroupsPerRow(editorWidth || 0, buttonGroupWidths);\n\n const PositioningWrapper = EditorPositioningWrapper[position];\n\n return (\n <PositioningWrapper.ToolbarWrapper editorWidth={editorWidth} toolbarButtonGroups={buttonGroupsPerRow}>\n {buttonGroupsPerRow.map((row, index) => (\n <div className=\"tw-divide-x tw-divide-line tw-flex tw-w-full tw-flex-wrap\" key={index}>\n {row.map(({ group, index }) => (\n <ButtonGroupWrapper index={index} key={index}>\n {group.map((ToolbarButton, idx) => (\n <ToolbarButton.button\n editor={editor}\n editorId={editorId}\n id={ToolbarButton.id}\n key={idx.toString()}\n />\n ))}\n </ButtonGroupWrapper>\n ))}\n </div>\n ))}\n </PositioningWrapper.ToolbarWrapper>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAWO,MAAM,IAAU,CAAC,EAAE,YAAS,kBAA6B;AACtD,QAAA,IAAS,EAAkB,CAAQ,GACnC,EAAE,mBAAgB,KAClB,EAAE,gBAAa,KAEf,IAAoB,EAAqB,CAAO,GAChD,IAAqB,EAAsB,KAAe,GAAG,CAAiB,GAE9E,IAAqB,EAAyB;AAGhD,SAAA,kBAAA,cAAC,EAAmB,gBAAnB;AAAA,IAAkC;AAAA,IAA0B,qBAAqB;AAAA,EAAA,GAC7E,EAAmB,IAAI,CAAC,GAAK,MACzB,kBAAA,cAAA,OAAA;AAAA,IAAI,WAAU;AAAA,IAA4D,KAAK;AAAA,EAAA,GAC3E,EAAI,IAAI,CAAC,EAAE,UAAO,eACd,kBAAA,cAAA,GAAA;AAAA,IAAmB,OAAO;AAAA,IAAO,KAAK;AAAA,EAAA,GAClC,EAAM,IAAI,CAAC,GAAe,MACvB,kBAAA,cAAC,EAAc,QAAd;AAAA,IACG;AAAA,IACA;AAAA,IACA,IAAI,EAAc;AAAA,IAClB,KAAK,EAAI,SAAS;AAAA,EAAA,CACtB,CACH,CACL,CACH,CACL,CACH,CACL;AAER;"}
|
|
@@ -1,33 +1,21 @@
|
|
|
1
|
-
import
|
|
1
|
+
import t, { createContext as n, useContext as d } from "react";
|
|
2
2
|
import "@udecode/plate";
|
|
3
|
-
import "
|
|
4
|
-
import "../
|
|
5
|
-
import "
|
|
6
|
-
|
|
7
|
-
import "../Plugins/TextStylePlugin/TextStyles/textStyles.es.js";
|
|
8
|
-
import "../Plugins/TextStylePlugin/TextStyles/Custom1Plugin/createCustom1Plugin.es.js";
|
|
9
|
-
import "../Plugins/TextStylePlugin/TextStyles/Custom2Plugin/createCustom2Plugin.es.js";
|
|
10
|
-
import "../Plugins/TextStylePlugin/TextStyles/Custom3Plugin/createCustom3Plugin.es.js";
|
|
11
|
-
import "../Plugins/TextStylePlugin/TextStyles/Heading1Plugin/createHeading1Plugin.es.js";
|
|
12
|
-
import "../Plugins/TextStylePlugin/TextStyles/Heading2Plugin/createHeading2Plugin.es.js";
|
|
13
|
-
import "../Plugins/TextStylePlugin/TextStyles/Heading3Plugin/createHeading3Plugin.es.js";
|
|
14
|
-
import "../Plugins/TextStylePlugin/TextStyles/Heading4Plugin/createHeading4Plugin.es.js";
|
|
15
|
-
import "../Plugins/TextStylePlugin/TextStyles/Quote/createQuotePlugin.es.js";
|
|
16
|
-
import { useEditorResize as n } from "../hooks/useEditorResize.es.js";
|
|
17
|
-
import { PlateWrapper as d } from "../EditorPositioningWrapper/PlateWrapper.es.js";
|
|
18
|
-
const r = m({
|
|
3
|
+
import "slate";
|
|
4
|
+
import { useEditorResize as s } from "../hooks/useEditorResize.es.js";
|
|
5
|
+
import { PlateWrapper as m } from "../EditorPositioningWrapper/PlateWrapper.es.js";
|
|
6
|
+
const r = n({
|
|
19
7
|
editorWidth: 0,
|
|
20
8
|
editorRef: null
|
|
21
|
-
}),
|
|
22
|
-
const { editorWidth: i, editorRef:
|
|
23
|
-
return /* @__PURE__ */
|
|
24
|
-
value: { editorWidth: i, editorRef:
|
|
25
|
-
}, /* @__PURE__ */
|
|
26
|
-
ref:
|
|
9
|
+
}), l = () => d(r), u = ({ children: o }) => {
|
|
10
|
+
const { editorWidth: i, editorRef: e } = s();
|
|
11
|
+
return /* @__PURE__ */ t.createElement(r.Provider, {
|
|
12
|
+
value: { editorWidth: i, editorRef: e }
|
|
13
|
+
}, /* @__PURE__ */ t.createElement(m, {
|
|
14
|
+
ref: e
|
|
27
15
|
}, o));
|
|
28
16
|
};
|
|
29
17
|
export {
|
|
30
|
-
|
|
31
|
-
|
|
18
|
+
u as EditorResizeContextProvider,
|
|
19
|
+
l as useEditorResizeContext
|
|
32
20
|
};
|
|
33
21
|
//# sourceMappingURL=EditorResizeContext.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorResizeContext.es.js","sources":["../../../../src/components/RichTextEditor/context/EditorResizeContext.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport React, { createContext, useContext } from 'react';\nimport { useEditorResize } from '../hooks';\nimport { PlateWrapper } from '../EditorPositioningWrapper/PlateWrapper';\n\ntype EditorResizeContextProps = {\n editorWidth: number | undefined;\n editorRef: ((node: HTMLDivElement) => ResizeObserver | undefined) | null;\n};\nconst EditorResizeContext = createContext<EditorResizeContextProps>({\n editorWidth: 0,\n editorRef: null,\n});\nexport const useEditorResizeContext = () => useContext(EditorResizeContext);\n\ntype EditorResizeContextProviderProps = {\n children: React.ReactNode;\n};\n\nexport const EditorResizeContextProvider = ({ children }: EditorResizeContextProviderProps) => {\n const { editorWidth, editorRef } = useEditorResize();\n\n return (\n <EditorResizeContext.Provider value={{ editorWidth, editorRef }}>\n <PlateWrapper ref={editorRef}>{children}</PlateWrapper>\n </EditorResizeContext.Provider>\n );\n};\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EditorResizeContext.es.js","sources":["../../../../src/components/RichTextEditor/context/EditorResizeContext.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport React, { createContext, useContext } from 'react';\nimport { useEditorResize } from '../hooks';\nimport { PlateWrapper } from '../EditorPositioningWrapper/PlateWrapper';\n\ntype EditorResizeContextProps = {\n editorWidth: number | undefined;\n editorRef: ((node: HTMLDivElement) => ResizeObserver | undefined) | null;\n};\nconst EditorResizeContext = createContext<EditorResizeContextProps>({\n editorWidth: 0,\n editorRef: null,\n});\nexport const useEditorResizeContext = () => useContext(EditorResizeContext);\n\ntype EditorResizeContextProviderProps = {\n children: React.ReactNode;\n};\n\nexport const EditorResizeContextProvider = ({ children }: EditorResizeContextProviderProps) => {\n const { editorWidth, editorRef } = useEditorResize();\n\n return (\n <EditorResizeContext.Provider value={{ editorWidth, editorRef }}>\n <PlateWrapper ref={editorRef}>{children}</PlateWrapper>\n </EditorResizeContext.Provider>\n );\n};\n"],"names":[],"mappings":";;;;;AAUA,MAAM,IAAsB,EAAwC;AAAA,EAChE,aAAa;AAAA,EACb,WAAW;AACf,CAAC,GACY,IAAyB,MAAM,EAAW,CAAmB,GAM7D,IAA8B,CAAC,EAAE,kBAAiD;AACrF,QAAA,EAAE,gBAAa,iBAAc,EAAgB;AAG/C,SAAA,kBAAA,cAAC,EAAoB,UAApB;AAAA,IAA6B,OAAO,EAAE,gBAAa,aAAU;AAAA,EAAA,GACzD,kBAAA,cAAA,GAAA;AAAA,IAAa,KAAK;AAAA,EAAA,GAAY,CAAS,CAC5C;AAER;"}
|
|
@@ -5,7 +5,7 @@ declare type RichTextEditorContextProps = {
|
|
|
5
5
|
designTokens: DesignTokens;
|
|
6
6
|
position: Position;
|
|
7
7
|
};
|
|
8
|
-
export declare const useRichTextEditorContext: () => RichTextEditorContextProps
|
|
8
|
+
export declare const useRichTextEditorContext: () => RichTextEditorContextProps;
|
|
9
9
|
declare type RichTextEditorProviderProps = {
|
|
10
10
|
children: React.ReactNode;
|
|
11
11
|
value: {
|
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { defaultDesignTokens as
|
|
1
|
+
import o, { createContext as d, useContext as x } from "react";
|
|
2
|
+
import { defaultDesignTokens as r } from "../utils/defaultDesignTokens.es.js";
|
|
3
3
|
import "../EditorPositioningWrapper/index.es.js";
|
|
4
|
-
import { EditorResizeContextProvider as
|
|
5
|
-
import { Position as
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
position: e != null ? e : u.FLOATING
|
|
4
|
+
import { EditorResizeContextProvider as a } from "./EditorResizeContext.es.js";
|
|
5
|
+
import { Position as i } from "../EditorPositioningWrapper/types.es.js";
|
|
6
|
+
const n = d({
|
|
7
|
+
designTokens: r,
|
|
8
|
+
position: i.FLOATING
|
|
9
|
+
}), f = () => x(n), C = ({ children: s, value: c }) => {
|
|
10
|
+
const { designTokens: t, position: e } = c, m = {
|
|
11
|
+
designTokens: t != null ? t : r,
|
|
12
|
+
position: e != null ? e : i.FLOATING
|
|
14
13
|
};
|
|
15
|
-
return /* @__PURE__ */
|
|
16
|
-
value:
|
|
17
|
-
}, /* @__PURE__ */
|
|
14
|
+
return /* @__PURE__ */ o.createElement(n.Provider, {
|
|
15
|
+
value: m
|
|
16
|
+
}, /* @__PURE__ */ o.createElement(a, null, s));
|
|
18
17
|
};
|
|
19
18
|
export {
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
C as RichTextEditorProvider,
|
|
20
|
+
f as useRichTextEditorContext
|
|
22
21
|
};
|
|
23
22
|
//# sourceMappingURL=RichTextEditorContext.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichTextEditorContext.es.js","sources":["../../../../src/components/RichTextEditor/context/RichTextEditorContext.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport React from 'react';\nimport { createContext, useContext } from 'react';\nimport { DesignTokens } from '../types';\nimport { defaultDesignTokens } from '../utils/defaultDesignTokens';\nimport { Position } from '../EditorPositioningWrapper';\nimport { EditorResizeContextProvider } from './EditorResizeContext';\n\ntype RichTextEditorContextProps = {\n designTokens: DesignTokens;\n position: Position;\n};\n\nconst RichTextEditorContext = createContext<RichTextEditorContextProps
|
|
1
|
+
{"version":3,"file":"RichTextEditorContext.es.js","sources":["../../../../src/components/RichTextEditor/context/RichTextEditorContext.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport React from 'react';\nimport { createContext, useContext } from 'react';\nimport { DesignTokens } from '../types';\nimport { defaultDesignTokens } from '../utils/defaultDesignTokens';\nimport { Position } from '../EditorPositioningWrapper';\nimport { EditorResizeContextProvider } from './EditorResizeContext';\n\ntype RichTextEditorContextProps = {\n designTokens: DesignTokens;\n position: Position;\n};\n\nconst RichTextEditorContext = createContext<RichTextEditorContextProps>({\n designTokens: defaultDesignTokens,\n position: Position.FLOATING,\n});\nexport const useRichTextEditorContext = () => useContext(RichTextEditorContext);\n\ntype RichTextEditorProviderProps = {\n children: React.ReactNode;\n value: {\n designTokens: DesignTokens;\n position: Position;\n };\n};\n\nexport const RichTextEditorProvider = ({ children, value }: RichTextEditorProviderProps) => {\n const { designTokens, position } = value;\n\n const state = {\n designTokens: designTokens ?? defaultDesignTokens,\n position: position ?? Position.FLOATING,\n };\n\n return (\n <RichTextEditorContext.Provider value={state}>\n <EditorResizeContextProvider>{children}</EditorResizeContextProvider>\n </RichTextEditorContext.Provider>\n );\n};\n"],"names":[],"mappings":";;;;;AAcA,MAAM,IAAwB,EAA0C;AAAA,EACpE,cAAc;AAAA,EACd,UAAU,EAAS;AACvB,CAAC,GACY,IAA2B,MAAM,EAAW,CAAqB,GAUjE,IAAyB,CAAC,EAAE,aAAU,eAAyC;AAClF,QAAA,EAAE,iBAAc,gBAAa,GAE7B,IAAQ;AAAA,IACV,cAAc,gBAAgB;AAAA,IAC9B,UAAU,gBAAY,EAAS;AAAA,EAAA;AAI/B,SAAA,kBAAA,cAAC,EAAsB,UAAtB;AAAA,IAA+B,OAAO;AAAA,EAAA,GACnC,kBAAA,cAAC,GAA6B,MAAA,CAAS,CAC3C;AAER;"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { TNode } from '@udecode/plate';
|
|
3
|
-
|
|
3
|
+
declare type useEditorStateProps = ((value: string) => void) | undefined;
|
|
4
|
+
export declare const useEditorState: (onTextChange: useEditorStateProps) => {
|
|
4
5
|
localValue: import("react").MutableRefObject<TNode[] | null>;
|
|
6
|
+
onChange: (value: any) => void;
|
|
5
7
|
};
|
|
8
|
+
export {};
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { useRef as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}, [
|
|
1
|
+
import { useRef as c, useCallback as i } from "react";
|
|
2
|
+
import { debounce as m } from "../../../utilities/debounce.es.js";
|
|
3
|
+
import "@udecode/plate";
|
|
4
|
+
import "slate";
|
|
5
|
+
import { ON_SAVE_DELAY_IN_MS as s } from "../utils/constants.es.js";
|
|
6
|
+
const d = (t) => {
|
|
7
|
+
const r = c(null), e = m((o) => {
|
|
8
|
+
t && t(JSON.stringify(o));
|
|
9
|
+
}, s), n = i((o) => {
|
|
10
|
+
e(o), r.current = o;
|
|
11
|
+
}, [e, r]);
|
|
12
|
+
return { localValue: r, onChange: n };
|
|
12
13
|
};
|
|
13
14
|
export {
|
|
14
15
|
d as useEditorState
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEditorState.es.js","sources":["../../../../src/components/RichTextEditor/hooks/useEditorState.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {
|
|
1
|
+
{"version":3,"file":"useEditorState.es.js","sources":["../../../../src/components/RichTextEditor/hooks/useEditorState.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { useCallback, useRef } from 'react';\nimport { TNode } from '@udecode/plate';\nimport { debounce } from '@utilities/debounce';\nimport { ON_SAVE_DELAY_IN_MS } from '../utils';\n\ntype useEditorStateProps = ((value: string) => void) | undefined;\n\nexport const useEditorState = (onTextChange: useEditorStateProps) => {\n const localValue = useRef<TNode[] | null>(null);\n\n const debouncedOnChange = debounce((value: TNode[]) => {\n onTextChange && onTextChange(JSON.stringify(value));\n }, ON_SAVE_DELAY_IN_MS);\n\n const onChange = useCallback(\n (value) => {\n debouncedOnChange(value);\n localValue.current = value;\n },\n [debouncedOnChange, localValue],\n );\n\n return { localValue, onChange };\n};\n"],"names":[],"mappings":";;;;;AASa,MAAA,IAAiB,CAAC,MAAsC;AAC3D,QAAA,IAAa,EAAuB,IAAI,GAExC,IAAoB,EAAS,CAAC,MAAmB;AACnD,SAAgB,EAAa,KAAK,UAAU,CAAK,CAAC;AAAA,KACnD,CAAmB,GAEhB,IAAW,EACb,CAAC,MAAU;AACP,MAAkB,CAAK,GACvB,EAAW,UAAU;AAAA,EAAA,GAEzB,CAAC,GAAmB,CAAU,CAClC;AAEO,SAAA,EAAE,eAAY;AACzB;"}
|
|
@@ -3,7 +3,7 @@ import { parseRawValue as i } from "../utils/parseRawValue.es.js";
|
|
|
3
3
|
import { serializeNodeToHtmlRecursive as n } from "./utils/serializeNodeToHtmlRecursive.es.js";
|
|
4
4
|
import { setDefaultDesignTokensIfNull as m } from "./utils/setDefaultDesignTokensIfNull.es.js";
|
|
5
5
|
const T = (e, o = s) => {
|
|
6
|
-
const r = i(e);
|
|
6
|
+
const r = i({ raw: e });
|
|
7
7
|
return l(r, o);
|
|
8
8
|
}, l = (e, o = s) => {
|
|
9
9
|
const r = m(s, o);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializeToHtml.es.js","sources":["../../../../src/components/RichTextEditor/serializer/serializeToHtml.ts"],"sourcesContent":["import { TDescendant } from '@udecode/plate';\nimport { DesignTokens } from '../types';\nimport { defaultDesignTokens } from '../utils/defaultDesignTokens';\nimport { parseRawValue } from '../utils/parseRawValue';\nimport { serializeNodeToHtmlRecursive } from './utils/serializeNodeToHtmlRecursive';\nimport { setDefaultDesignTokensIfNull } from './utils/setDefaultDesignTokensIfNull';\n\nexport const serializeRawToHtml = (raw: string, designTokens: DesignTokens = defaultDesignTokens): string => {\n const nodes = parseRawValue(raw);\n return serializeNodesToHtml(nodes, designTokens);\n};\n\nexport const serializeNodesToHtml = (\n nodes: TDescendant[],\n designTokens: DesignTokens = defaultDesignTokens,\n): string => {\n const mergedDesignTokens = setDefaultDesignTokensIfNull(defaultDesignTokens, designTokens);\n return nodes.map((node) => serializeNodeToHtmlRecursive(node, mergedDesignTokens)).join('');\n};\n"],"names":[],"mappings":";;;;AAOO,MAAM,IAAqB,CAAC,GAAa,IAA6B,MAAgC;
|
|
1
|
+
{"version":3,"file":"serializeToHtml.es.js","sources":["../../../../src/components/RichTextEditor/serializer/serializeToHtml.ts"],"sourcesContent":["import { TDescendant } from '@udecode/plate';\nimport { DesignTokens } from '../types';\nimport { defaultDesignTokens } from '../utils/defaultDesignTokens';\nimport { parseRawValue } from '../utils/parseRawValue';\nimport { serializeNodeToHtmlRecursive } from './utils/serializeNodeToHtmlRecursive';\nimport { setDefaultDesignTokensIfNull } from './utils/setDefaultDesignTokensIfNull';\n\nexport const serializeRawToHtml = (raw: string, designTokens: DesignTokens = defaultDesignTokens): string => {\n const nodes = parseRawValue({ raw });\n return serializeNodesToHtml(nodes, designTokens);\n};\n\nexport const serializeNodesToHtml = (\n nodes: TDescendant[],\n designTokens: DesignTokens = defaultDesignTokens,\n): string => {\n const mergedDesignTokens = setDefaultDesignTokensIfNull(defaultDesignTokens, designTokens);\n return nodes.map((node) => serializeNodeToHtmlRecursive(node, mergedDesignTokens)).join('');\n};\n"],"names":[],"mappings":";;;;AAOO,MAAM,IAAqB,CAAC,GAAa,IAA6B,MAAgC;AACzG,QAAM,IAAQ,EAAc,EAAE,OAAK,CAAA;AAC5B,SAAA,EAAqB,GAAO,CAAY;AACnD,GAEa,IAAuB,CAChC,GACA,IAA6B,MACpB;AACH,QAAA,IAAqB,EAA6B,GAAqB,CAAY;AAClF,SAAA,EAAM,IAAI,CAAC,MAAS,EAA6B,GAAM,CAAkB,CAAC,EAAE,KAAK,EAAE;AAC9F;"}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import { Value } from '@udecode/plate';
|
|
2
2
|
export declare const EMPTY_RICH_TEXT_VALUE: Value;
|
|
3
|
-
|
|
3
|
+
declare type ParseRawValueOptions = {
|
|
4
|
+
editorId?: string;
|
|
5
|
+
raw?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const parseRawValue: ({ editorId, raw }: ParseRawValueOptions) => Value;
|
|
8
|
+
export {};
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { ELEMENT_PARAGRAPH as
|
|
2
|
-
import { getEditorConfig as
|
|
3
|
-
const d = (
|
|
4
|
-
let
|
|
1
|
+
import { ELEMENT_PARAGRAPH as i, createPlateEditor as l, parseHtmlDocument as m, deserializeHtml as p } from "@udecode/plate";
|
|
2
|
+
import { getEditorConfig as u } from "./editorConfig.es.js";
|
|
3
|
+
const d = (e) => /^<\w+>.*<\/\w+>$/.test(e) ? e : `<p>${e}</p>`, E = [{ type: i, children: [{ text: "" }] }], h = ({ editorId: e = "parseRawValue", raw: t }) => {
|
|
4
|
+
let r = E;
|
|
5
5
|
if (!t)
|
|
6
|
-
return
|
|
6
|
+
return r;
|
|
7
7
|
try {
|
|
8
|
-
|
|
8
|
+
r = JSON.parse(t);
|
|
9
9
|
} catch {
|
|
10
|
-
const
|
|
11
|
-
element:
|
|
10
|
+
const s = l({ id: `${e}_parseRawValue`, plugins: u() }), n = t.trim().replace(/>\s+</g, "><"), c = d(n), a = m(c), o = p(s, {
|
|
11
|
+
element: a.body,
|
|
12
12
|
stripWhitespace: !0
|
|
13
13
|
});
|
|
14
|
-
|
|
14
|
+
o && (r = o);
|
|
15
15
|
}
|
|
16
|
-
return
|
|
16
|
+
return r;
|
|
17
17
|
};
|
|
18
18
|
export {
|
|
19
|
-
|
|
19
|
+
E as EMPTY_RICH_TEXT_VALUE,
|
|
20
20
|
h as parseRawValue
|
|
21
21
|
};
|
|
22
22
|
//# sourceMappingURL=parseRawValue.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseRawValue.es.js","sources":["../../../../src/components/RichTextEditor/utils/parseRawValue.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { ELEMENT_PARAGRAPH, Value, createPlateEditor, deserializeHtml, parseHtmlDocument } from '@udecode/plate';\nimport { getEditorConfig } from './editorConfig';\n\nconst wrapTextInHtml = (text: string) => {\n const htmlDocRegex = /^<\\w+>.*<\\/\\w+>$/;\n\n return htmlDocRegex.test(text) ? text : `<p>${text}</p>`;\n};\n\nexport const EMPTY_RICH_TEXT_VALUE: Value = [{ type: ELEMENT_PARAGRAPH, children: [{ text: '' }] }];\n\nexport const parseRawValue = (raw
|
|
1
|
+
{"version":3,"file":"parseRawValue.es.js","sources":["../../../../src/components/RichTextEditor/utils/parseRawValue.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { ELEMENT_PARAGRAPH, Value, createPlateEditor, deserializeHtml, parseHtmlDocument } from '@udecode/plate';\nimport { getEditorConfig } from './editorConfig';\n\nconst wrapTextInHtml = (text: string) => {\n const htmlDocRegex = /^<\\w+>.*<\\/\\w+>$/;\n\n return htmlDocRegex.test(text) ? text : `<p>${text}</p>`;\n};\n\nexport const EMPTY_RICH_TEXT_VALUE: Value = [{ type: ELEMENT_PARAGRAPH, children: [{ text: '' }] }];\n\ntype ParseRawValueOptions = {\n editorId?: string;\n raw?: string;\n};\n\nexport const parseRawValue = ({ editorId = 'parseRawValue', raw }: ParseRawValueOptions): Value => {\n let parsedValue = EMPTY_RICH_TEXT_VALUE;\n\n if (!raw) {\n return parsedValue;\n }\n\n try {\n parsedValue = JSON.parse(raw);\n } catch {\n const editor = createPlateEditor({ id: `${editorId}_parseRawValue`, plugins: getEditorConfig() });\n const trimmed = raw.trim().replace(/>\\s+</g, '><');\n const htmlDocumentString = wrapTextInHtml(trimmed);\n const document = parseHtmlDocument(htmlDocumentString);\n const parsedHtml = deserializeHtml(editor, {\n element: document.body,\n stripWhitespace: true,\n }) as Value;\n if (parsedHtml) {\n parsedValue = parsedHtml;\n }\n }\n\n return parsedValue;\n};\n"],"names":[],"mappings":";;AAKA,MAAM,IAAiB,CAAC,MAGb,AAFc,mBAED,KAAK,CAAI,IAAI,IAAO,MAAM,SAGrC,IAA+B,CAAC,EAAE,MAAM,GAAmB,UAAU,CAAC,EAAE,MAAM,GAAI,CAAA,GAAG,GAOrF,IAAgB,CAAC,EAAE,cAAW,iBAAiB,aAAuC;AAC/F,MAAI,IAAc;AAElB,MAAI,CAAC;AACM,WAAA;AAGP,MAAA;AACc,QAAA,KAAK,MAAM,CAAG;AAAA,EAAA,QAC9B;AACQ,UAAA,IAAS,EAAkB,EAAE,IAAI,GAAG,mBAA0B,SAAS,EAAgB,EAAG,CAAA,GAC1F,IAAU,EAAI,KAAA,EAAO,QAAQ,UAAU,IAAI,GAC3C,IAAqB,EAAe,CAAO,GAC3C,IAAW,EAAkB,CAAkB,GAC/C,IAAa,EAAgB,GAAQ;AAAA,MACvC,SAAS,EAAS;AAAA,MAClB,iBAAiB;AAAA,IAAA,CACpB;AACD,IAAI,KACc,KAAA;AAAA,EAEtB;AAEO,SAAA;AACX;"}
|
|
@@ -1727,10 +1727,10 @@ import "../RichTextEditor/Plugins/TextStylePlugin/TextStyles/Heading4Plugin/crea
|
|
|
1727
1727
|
import "../RichTextEditor/Plugins/TextStylePlugin/TextStyles/Quote/createQuotePlugin.es.js";
|
|
1728
1728
|
import "../RichTextEditor/context/EditorResizeContext.es.js";
|
|
1729
1729
|
import "../RichTextEditor/EditorPositioningWrapper/index.es.js";
|
|
1730
|
+
import "slate";
|
|
1730
1731
|
import "../RichTextEditor/Plugins/CheckboxListPlugin/index.es.js";
|
|
1731
1732
|
import "slate-react";
|
|
1732
1733
|
import "../RichTextEditor/Plugins/LinkPlugin/index.es.js";
|
|
1733
|
-
import "slate";
|
|
1734
1734
|
import "../RichTextEditor/Plugins/index.es.js";
|
|
1735
1735
|
import { useScrollWrapper as g } from "./hooks/useScrollWrapper.es.js";
|
|
1736
1736
|
import { ScrollWrapperDirection as i, scrollWrapperDirections as h } from "./types.es.js";
|
|
@@ -1726,10 +1726,10 @@ import "../RichTextEditor/Plugins/TextStylePlugin/TextStyles/Heading4Plugin/crea
|
|
|
1726
1726
|
import "../RichTextEditor/Plugins/TextStylePlugin/TextStyles/Quote/createQuotePlugin.es.js";
|
|
1727
1727
|
import "../RichTextEditor/context/EditorResizeContext.es.js";
|
|
1728
1728
|
import "../RichTextEditor/EditorPositioningWrapper/index.es.js";
|
|
1729
|
+
import "slate";
|
|
1729
1730
|
import "../RichTextEditor/Plugins/CheckboxListPlugin/index.es.js";
|
|
1730
1731
|
import "slate-react";
|
|
1731
1732
|
import "../RichTextEditor/Plugins/LinkPlugin/index.es.js";
|
|
1732
|
-
import "slate";
|
|
1733
1733
|
import "../RichTextEditor/Plugins/index.es.js";
|
|
1734
1734
|
import "../../styles.es.js";
|
|
1735
1735
|
import { SelectionMode as k } from "./Table.es.js";
|
|
@@ -1727,10 +1727,10 @@ import "../RichTextEditor/Plugins/TextStylePlugin/TextStyles/Heading4Plugin/crea
|
|
|
1727
1727
|
import "../RichTextEditor/Plugins/TextStylePlugin/TextStyles/Quote/createQuotePlugin.es.js";
|
|
1728
1728
|
import "../RichTextEditor/context/EditorResizeContext.es.js";
|
|
1729
1729
|
import "../RichTextEditor/EditorPositioningWrapper/index.es.js";
|
|
1730
|
+
import "slate";
|
|
1730
1731
|
import "../RichTextEditor/Plugins/CheckboxListPlugin/index.es.js";
|
|
1731
1732
|
import "slate-react";
|
|
1732
1733
|
import "../RichTextEditor/Plugins/LinkPlugin/index.es.js";
|
|
1733
|
-
import "slate";
|
|
1734
1734
|
import "../RichTextEditor/Plugins/index.es.js";
|
|
1735
1735
|
import "../../styles.es.js";
|
|
1736
1736
|
import { SortDirection as O, SelectionMode as _ } from "./Table.es.js";
|
|
@@ -1728,10 +1728,10 @@ import "../../RichTextEditor/Plugins/TextStylePlugin/TextStyles/Heading4Plugin/c
|
|
|
1728
1728
|
import "../../RichTextEditor/Plugins/TextStylePlugin/TextStyles/Quote/createQuotePlugin.es.js";
|
|
1729
1729
|
import "../../RichTextEditor/context/EditorResizeContext.es.js";
|
|
1730
1730
|
import "../../RichTextEditor/EditorPositioningWrapper/index.es.js";
|
|
1731
|
+
import "slate";
|
|
1731
1732
|
import "../../RichTextEditor/Plugins/CheckboxListPlugin/index.es.js";
|
|
1732
1733
|
import "slate-react";
|
|
1733
1734
|
import "../../RichTextEditor/Plugins/LinkPlugin/index.es.js";
|
|
1734
|
-
import "slate";
|
|
1735
1735
|
import "../../RichTextEditor/Plugins/index.es.js";
|
|
1736
1736
|
import "@react-stately/table";
|
|
1737
1737
|
import "react-textarea-autosize";
|