@makeswift/runtime 0.9.11 → 0.10.0
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/Box.cjs.js +4 -1
- package/dist/Box.cjs.js.map +1 -1
- package/dist/Box.es.js +5 -2
- package/dist/Box.es.js.map +1 -1
- package/dist/Button.cjs.js +4 -3
- package/dist/Button.cjs.js.map +1 -1
- package/dist/Button.es.js +5 -4
- package/dist/Button.es.js.map +1 -1
- package/dist/Carousel.cjs.js +4 -3
- package/dist/Carousel.cjs.js.map +1 -1
- package/dist/Carousel.es.js +5 -4
- package/dist/Carousel.es.js.map +1 -1
- package/dist/Countdown.cjs.js +4 -1
- package/dist/Countdown.cjs.js.map +1 -1
- package/dist/Countdown.es.js +5 -2
- package/dist/Countdown.es.js.map +1 -1
- package/dist/Divider.cjs.js +4 -1
- package/dist/Divider.cjs.js.map +1 -1
- package/dist/Divider.es.js +5 -2
- package/dist/Divider.es.js.map +1 -1
- package/dist/Embed.cjs.js +1 -0
- package/dist/Embed.cjs.js.map +1 -1
- package/dist/Embed.es.js +2 -1
- package/dist/Embed.es.js.map +1 -1
- package/dist/Form.cjs.js +14 -13
- package/dist/Form.cjs.js.map +1 -1
- package/dist/Form.es.js +6 -5
- package/dist/Form.es.js.map +1 -1
- package/dist/Image.cjs.js +12 -11
- package/dist/Image.cjs.js.map +1 -1
- package/dist/Image.es.js +12 -11
- package/dist/Image.es.js.map +1 -1
- package/dist/LiveProvider.cjs.js +4 -1
- package/dist/LiveProvider.cjs.js.map +1 -1
- package/dist/LiveProvider.es.js +6 -3
- package/dist/LiveProvider.es.js.map +1 -1
- package/dist/Navigation.cjs.js +12 -11
- package/dist/Navigation.cjs.js.map +1 -1
- package/dist/Navigation.es.js +12 -11
- package/dist/Navigation.es.js.map +1 -1
- package/dist/PreviewProvider.cjs.js +7 -4
- package/dist/PreviewProvider.cjs.js.map +1 -1
- package/dist/PreviewProvider.es.js +6 -3
- package/dist/PreviewProvider.es.js.map +1 -1
- package/dist/ReadOnlyText.cjs.js +34 -26
- package/dist/ReadOnlyText.cjs.js.map +1 -1
- package/dist/ReadOnlyText.es.js +30 -22
- package/dist/ReadOnlyText.es.js.map +1 -1
- package/dist/ReadOnlyTextV2.cjs.js +125 -246
- package/dist/ReadOnlyTextV2.cjs.js.map +1 -1
- package/dist/ReadOnlyTextV2.es.js +126 -246
- package/dist/ReadOnlyTextV2.es.js.map +1 -1
- package/dist/Root.cjs.js +4 -1
- package/dist/Root.cjs.js.map +1 -1
- package/dist/Root.es.js +5 -2
- package/dist/Root.es.js.map +1 -1
- package/dist/SocialLinks.cjs.js +7 -6
- package/dist/SocialLinks.cjs.js.map +1 -1
- package/dist/SocialLinks.es.js +8 -7
- package/dist/SocialLinks.es.js.map +1 -1
- package/dist/Text.cjs.js +12 -71
- package/dist/Text.cjs.js.map +1 -1
- package/dist/Text.es.js +13 -64
- package/dist/Text.es.js.map +1 -1
- package/dist/Video.cjs.js +1 -0
- package/dist/Video.cjs.js.map +1 -1
- package/dist/Video.es.js +2 -1
- package/dist/Video.es.js.map +1 -1
- package/dist/builder.cjs.js +2 -0
- package/dist/builder.cjs.js.map +1 -1
- package/dist/builder.es.js +2 -0
- package/dist/builder.es.js.map +1 -1
- package/dist/components.cjs.js +4 -3
- package/dist/components.cjs.js.map +1 -1
- package/dist/components.es.js +4 -3
- package/dist/components.es.js.map +1 -1
- package/dist/control-serialization.es.js +1 -1
- package/dist/controls.cjs.js +31 -21
- package/dist/controls.cjs.js.map +1 -1
- package/dist/controls.es.js +4 -2
- package/dist/controls.es.js.map +1 -1
- package/dist/index.cjs.js +307 -243
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs2.js +3 -3
- package/dist/index.cjs2.js.map +1 -1
- package/dist/index.cjs3.js +21 -107
- package/dist/index.cjs3.js.map +1 -1
- package/dist/index.cjs4.js +16 -57
- package/dist/index.cjs4.js.map +1 -1
- package/dist/index.cjs5.js +53 -243
- package/dist/index.cjs5.js.map +1 -1
- package/dist/index.cjs6.js +16 -37
- package/dist/index.cjs6.js.map +1 -1
- package/dist/index.cjs7.js +376 -14
- package/dist/index.cjs7.js.map +1 -1
- package/dist/index.cjs8.js +276 -12
- package/dist/index.cjs8.js.map +1 -1
- package/dist/index.es.js +279 -215
- package/dist/index.es.js.map +1 -1
- package/dist/index.es2.js +2 -2
- package/dist/index.es3.js +22 -103
- package/dist/index.es3.js.map +1 -1
- package/dist/index.es4.js +16 -57
- package/dist/index.es4.js.map +1 -1
- package/dist/index.es5.js +53 -241
- package/dist/index.es5.js.map +1 -1
- package/dist/index.es6.js +16 -32
- package/dist/index.es6.js.map +1 -1
- package/dist/index.es7.js +372 -16
- package/dist/index.es7.js.map +1 -1
- package/dist/index.es8.js +271 -11
- package/dist/index.es8.js.map +1 -1
- package/dist/main.cjs.js +2 -0
- package/dist/main.cjs.js.map +1 -1
- package/dist/main.es.js +2 -0
- package/dist/main.es.js.map +1 -1
- package/dist/next.cjs.js +4 -1
- package/dist/next.cjs.js.map +1 -1
- package/dist/next.es.js +5 -2
- package/dist/next.es.js.map +1 -1
- package/dist/prop-controllers.cjs.js +2 -0
- package/dist/prop-controllers.cjs.js.map +1 -1
- package/dist/prop-controllers.es.js +2 -0
- package/dist/prop-controllers.es.js.map +1 -1
- package/dist/react-page.cjs.js +1731 -183
- package/dist/react-page.cjs.js.map +1 -1
- package/dist/react-page.es.js +1694 -182
- package/dist/react-page.es.js.map +1 -1
- package/dist/react.cjs.js +4 -1
- package/dist/react.cjs.js.map +1 -1
- package/dist/react.es.js +4 -1
- package/dist/react.es.js.map +1 -1
- package/dist/slate.cjs.js +32 -377
- package/dist/slate.cjs.js.map +1 -1
- package/dist/slate.es.js +14 -363
- package/dist/slate.es.js.map +1 -1
- package/dist/text-input.cjs.js +26 -0
- package/dist/text-input.cjs.js.map +1 -0
- package/dist/text-input.es.js +18 -0
- package/dist/text-input.es.js.map +1 -0
- package/dist/types/src/components/builtin/Text/Text.d.ts +3 -4
- package/dist/types/src/components/builtin/Text/Text.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Text/register.d.ts.map +1 -1
- package/dist/types/src/controls/list.d.ts +5 -2
- package/dist/types/src/controls/list.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text/fixtures/v2-data-types.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text/introspection.d.ts +5 -0
- package/dist/types/src/controls/rich-text/introspection.d.ts.map +1 -0
- package/dist/types/src/controls/rich-text/introspection.test.d.ts +2 -0
- package/dist/types/src/controls/rich-text/introspection.test.d.ts.map +1 -0
- package/dist/types/src/controls/rich-text/rich-text.d.ts +0 -1
- package/dist/types/src/controls/rich-text/rich-text.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text/translation.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text-v2/introspection.d.ts +5 -0
- package/dist/types/src/controls/rich-text-v2/introspection.d.ts.map +1 -0
- package/dist/types/src/controls/rich-text-v2/introspection.test.d.ts +2 -0
- package/dist/types/src/controls/rich-text-v2/introspection.test.d.ts.map +1 -0
- package/dist/types/src/controls/rich-text-v2/plugin.d.ts +29 -0
- package/dist/types/src/controls/rich-text-v2/plugin.d.ts.map +1 -0
- package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts +32 -34
- package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text-v2/translation.d.ts +1 -1
- package/dist/types/src/controls/rich-text-v2/translation.d.ts.map +1 -1
- package/dist/types/src/controls/shape.d.ts +5 -2
- package/dist/types/src/controls/shape.d.ts.map +1 -1
- package/dist/types/src/controls/typography.d.ts +2 -0
- package/dist/types/src/controls/typography.d.ts.map +1 -1
- package/dist/types/src/next/client.d.ts.map +1 -1
- package/dist/types/src/prop-controllers/descriptors.d.ts +11 -1
- package/dist/types/src/prop-controllers/descriptors.d.ts.map +1 -1
- package/dist/types/src/prop-controllers/introspection.d.ts +0 -2
- package/dist/types/src/prop-controllers/introspection.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/control.d.ts +1 -1
- package/dist/types/src/runtimes/react/controls/control.d.ts.map +1 -1
- package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/EditableText/editable-text.d.ts +4 -3
- package/dist/types/src/runtimes/react/controls/rich-text/EditableText/editable-text.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text/EditableText/index.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text/EditableText/useSyncDOMSelection.d.ts.map +1 -0
- package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/EditableText/useSyncWithBuilder.d.ts +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text/EditableText/useSyncWithBuilder.d.ts.map +1 -0
- package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/ReadOnlyText.d.ts +2 -2
- package/dist/types/src/runtimes/react/controls/rich-text/ReadOnlyText.d.ts.map +1 -0
- package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/components/Element/block.d.ts +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text/components/Element/block.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text/components/Element/element.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text/components/Element/index.d.ts.map +1 -0
- package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/components/Element/inline.d.ts +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text/components/Element/inline.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text/components/Leaf/index.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text/components/Leaf/leaf.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text/components/index.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text/index.d.ts +2 -0
- package/dist/types/src/runtimes/react/controls/rich-text/index.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/{rich-text.d.ts → rich-text/rich-text.d.ts} +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text/rich-text.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/editable-text-v2.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-element.d.ts +3 -2
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-element.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-leaf.d.ts +2 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-leaf.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/useRemoteChanges.d.ts +4 -0
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/useRemoteChanges.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.d.ts +8 -16
- package/dist/types/src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.d.ts.map +1 -1
- package/dist/types/src/slate/BlockPlugin/index.d.ts +3 -3
- package/dist/types/src/slate/BlockPlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/InlineModePlugin/index.d.ts +6 -4
- package/dist/types/src/slate/InlineModePlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/InlinePlugin/index.d.ts +3 -3
- package/dist/types/src/slate/InlinePlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/InlinePlugin/types.d.ts +1 -1
- package/dist/types/src/slate/InlinePlugin/types.d.ts.map +1 -1
- package/dist/types/src/slate/LinkPlugin/index.d.ts +3 -3
- package/dist/types/src/slate/LinkPlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/LinkPlugin/linkPluginWithoutRenderElement.d.ts +16 -0
- package/dist/types/src/slate/LinkPlugin/linkPluginWithoutRenderElement.d.ts.map +1 -0
- package/dist/types/src/slate/LocalChangesPlugin/index.d.ts +16 -0
- package/dist/types/src/slate/LocalChangesPlugin/index.d.ts.map +1 -0
- package/dist/types/src/slate/TextAlignPlugin/index.d.ts +3 -3
- package/dist/types/src/slate/TextAlignPlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/TypographyPlugin/index.d.ts +3 -3
- package/dist/types/src/slate/TypographyPlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/index.d.ts +1 -0
- package/dist/types/src/slate/index.d.ts.map +1 -1
- package/dist/types/src/slate/types.d.ts +3 -12
- package/dist/types/src/slate/types.d.ts.map +1 -1
- package/dist/types/src/slate/utils/element.d.ts.map +1 -1
- package/dist/types/src/state/modules/locales.d.ts.map +1 -1
- package/package.json +1 -2
- package/dist/index.cjs10.js +0 -390
- package/dist/index.cjs10.js.map +0 -1
- package/dist/index.cjs9.js +0 -299
- package/dist/index.cjs9.js.map +0 -1
- package/dist/index.es10.js +0 -383
- package/dist/index.es10.js.map +0 -1
- package/dist/index.es9.js +0 -292
- package/dist/index.es9.js.map +0 -1
- package/dist/types/src/components/builtin/Text/EditableText/editable-text.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/EditableText/index.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/EditableText/useSyncDOMSelection.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/EditableText/useSyncWithBuilder.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/ReadOnlyText.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/components/Element/block.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/components/Element/element.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/components/Element/index.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/components/Element/inline.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/components/Leaf/index.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/components/Leaf/leaf.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/components/index.d.ts.map +0 -1
- package/dist/types/src/runtimes/react/controls/rich-text.d.ts.map +0 -1
- package/dist/types.cjs2.js +0 -746
- package/dist/types.cjs2.js.map +0 -1
- package/dist/types.es2.js +0 -729
- package/dist/types.es2.js.map +0 -1
- package/dist/typography.cjs.js +0 -56
- package/dist/typography.cjs.js.map +0 -1
- package/dist/typography.es.js +0 -41
- package/dist/typography.es.js.map +0 -1
- /package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/EditableText/index.d.ts +0 -0
- /package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/EditableText/useSyncDOMSelection.d.ts +0 -0
- /package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/components/Element/element.d.ts +0 -0
- /package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/components/Element/index.d.ts +0 -0
- /package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/components/Leaf/index.d.ts +0 -0
- /package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/components/Leaf/leaf.d.ts +0 -0
- /package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/components/index.d.ts +0 -0
package/dist/react-page.es.js
CHANGED
|
@@ -17,6 +17,18 @@ var __spreadValues = (a, b) => {
|
|
|
17
17
|
return a;
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
20
32
|
var __publicField = (obj, key, value) => {
|
|
21
33
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
22
34
|
return value;
|
|
@@ -26,12 +38,14 @@ var _a;
|
|
|
26
38
|
import { combineReducers, createStore, applyMiddleware } from "redux";
|
|
27
39
|
import thunk from "redux-thunk";
|
|
28
40
|
import { A as ActionTypes, n as localeStringSchema } from "./actions.es.js";
|
|
29
|
-
import { reducer as reducer$a, getInitialState as getInitialState$9 } from "./state/breakpoints.es.js";
|
|
41
|
+
import { findBreakpointOverride, reducer as reducer$a, getInitialState as getInitialState$9 } from "./state/breakpoints.es.js";
|
|
30
42
|
import React__default from "react";
|
|
31
|
-
import { cache } from "@emotion/css";
|
|
43
|
+
import { cache, cx } from "@emotion/css";
|
|
32
44
|
import { serializeStyles } from "@emotion/serialize";
|
|
33
45
|
import { registerStyles, insertStyles } from "@emotion/utils";
|
|
34
|
-
import { Element, Text } from "slate";
|
|
46
|
+
import { Element, Range, Editor, Text, Path, Transforms, Node, Point } from "slate";
|
|
47
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
48
|
+
import isHotkey from "is-hotkey";
|
|
35
49
|
const ComponentIcon = {
|
|
36
50
|
Billing: "billing",
|
|
37
51
|
Bolt: "bolt",
|
|
@@ -285,6 +299,12 @@ function reducer$1(state = getInitialState(), action) {
|
|
|
285
299
|
}
|
|
286
300
|
}
|
|
287
301
|
function parseLocalesInput(input) {
|
|
302
|
+
if (input.locales == null) {
|
|
303
|
+
throw new Error(`Locales cannot be null or undefined. Please provide the locales array.`);
|
|
304
|
+
}
|
|
305
|
+
if (input.locales.includes(input.defaultLocale) === false) {
|
|
306
|
+
throw new Error(`Default locale "${input.defaultLocale}" is not included in locales: ${input.locales}. Please add the default locale to the locales array.`);
|
|
307
|
+
}
|
|
288
308
|
return {
|
|
289
309
|
locales: input.locales.map((locale) => localeStringSchema.parse(locale)),
|
|
290
310
|
defaultLocale: localeStringSchema.parse(input.defaultLocale),
|
|
@@ -599,6 +619,21 @@ function introspectListPropControllerData(descriptor, value, func) {
|
|
|
599
619
|
return [];
|
|
600
620
|
return value.flatMap((item) => item.value ? func(descriptor.options.type, item.value) : []);
|
|
601
621
|
}
|
|
622
|
+
function getListPropControllerElementChildren(descriptor, value) {
|
|
623
|
+
return introspectListPropControllerData(descriptor, value, getElementChildren);
|
|
624
|
+
}
|
|
625
|
+
function getListPropControllerSwatchIds(descriptor, value) {
|
|
626
|
+
return introspectListPropControllerData(descriptor, value, getSwatchIds);
|
|
627
|
+
}
|
|
628
|
+
function getListPropControllerFileIds(descriptor, value) {
|
|
629
|
+
return introspectListPropControllerData(descriptor, value, getFileIds);
|
|
630
|
+
}
|
|
631
|
+
function getListPropControllerTypographyIds(descriptor, value) {
|
|
632
|
+
return introspectListPropControllerData(descriptor, value, getTypographyIds);
|
|
633
|
+
}
|
|
634
|
+
function getListPropControllerPageIds(descriptor, value) {
|
|
635
|
+
return introspectListPropControllerData(descriptor, value, getPageIds);
|
|
636
|
+
}
|
|
602
637
|
const MarginPropControllerFormat = {
|
|
603
638
|
ClassName: "makeswift::prop-controllers::margin::format::class-name",
|
|
604
639
|
ResponsiveValue: "makeswift::prop-controllers::margin::format::responsive-value"
|
|
@@ -656,7 +691,22 @@ function Shape$1(options) {
|
|
|
656
691
|
function introspectShapePropControllerData(descriptor, value, func) {
|
|
657
692
|
if (value == null)
|
|
658
693
|
return [];
|
|
659
|
-
return Object.entries(descriptor.options.type).flatMap(([key,
|
|
694
|
+
return Object.entries(descriptor.options.type).flatMap(([key, definition2]) => func(definition2, value[key]));
|
|
695
|
+
}
|
|
696
|
+
function getShapePropControllerElementChildren(descriptor, value) {
|
|
697
|
+
return introspectShapePropControllerData(descriptor, value, getElementChildren);
|
|
698
|
+
}
|
|
699
|
+
function getShapePropControllerFileIds(descriptor, value) {
|
|
700
|
+
return introspectShapePropControllerData(descriptor, value, getFileIds);
|
|
701
|
+
}
|
|
702
|
+
function getShapePropControllerTypographyIds(descriptor, value) {
|
|
703
|
+
return introspectShapePropControllerData(descriptor, value, getTypographyIds);
|
|
704
|
+
}
|
|
705
|
+
function getShapePropControllerPageIds(descriptor, value) {
|
|
706
|
+
return introspectShapePropControllerData(descriptor, value, getPageIds);
|
|
707
|
+
}
|
|
708
|
+
function getShapePropControllerSwatchIds(descriptor, value) {
|
|
709
|
+
return introspectShapePropControllerData(descriptor, value, getSwatchIds);
|
|
660
710
|
}
|
|
661
711
|
function SocialLinks(options = {}) {
|
|
662
712
|
return { type: Types.SocialLinks, options };
|
|
@@ -710,6 +760,11 @@ var descriptors = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro
|
|
|
710
760
|
Link: Link$1,
|
|
711
761
|
List: List$1,
|
|
712
762
|
introspectListPropControllerData,
|
|
763
|
+
getListPropControllerElementChildren,
|
|
764
|
+
getListPropControllerSwatchIds,
|
|
765
|
+
getListPropControllerFileIds,
|
|
766
|
+
getListPropControllerTypographyIds,
|
|
767
|
+
getListPropControllerPageIds,
|
|
713
768
|
MarginPropControllerFormat,
|
|
714
769
|
Margin,
|
|
715
770
|
NavigationLinks,
|
|
@@ -727,6 +782,11 @@ var descriptors = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro
|
|
|
727
782
|
Shadows,
|
|
728
783
|
Shape: Shape$1,
|
|
729
784
|
introspectShapePropControllerData,
|
|
785
|
+
getShapePropControllerElementChildren,
|
|
786
|
+
getShapePropControllerFileIds,
|
|
787
|
+
getShapePropControllerTypographyIds,
|
|
788
|
+
getShapePropControllerPageIds,
|
|
789
|
+
getShapePropControllerSwatchIds,
|
|
730
790
|
SocialLinks,
|
|
731
791
|
Table,
|
|
732
792
|
TableFormFields,
|
|
@@ -997,17 +1057,32 @@ class ListControl extends PropController {
|
|
|
997
1057
|
this.controls = /* @__PURE__ */ new Map();
|
|
998
1058
|
}
|
|
999
1059
|
}
|
|
1000
|
-
function copyListData(
|
|
1060
|
+
function copyListData(definition2, value, context) {
|
|
1001
1061
|
if (value == null)
|
|
1002
1062
|
return value;
|
|
1003
1063
|
return value && value.map((item) => __spreadProps(__spreadValues({}, item), {
|
|
1004
|
-
value: copy(
|
|
1064
|
+
value: copy(definition2.config.type, item.value, context)
|
|
1005
1065
|
}));
|
|
1006
1066
|
}
|
|
1007
|
-
function introspectListData(
|
|
1067
|
+
function introspectListData(definition2, value, func) {
|
|
1008
1068
|
if (value == null)
|
|
1009
1069
|
return [];
|
|
1010
|
-
return value.flatMap((item) => func(
|
|
1070
|
+
return value.flatMap((item) => func(definition2.config.type, item.value));
|
|
1071
|
+
}
|
|
1072
|
+
function getListElementChildren(definition2, value) {
|
|
1073
|
+
return introspectListData(definition2, value, getElementChildren);
|
|
1074
|
+
}
|
|
1075
|
+
function getListSwatchIds(definition2, value) {
|
|
1076
|
+
return introspectListData(definition2, value, getSwatchIds);
|
|
1077
|
+
}
|
|
1078
|
+
function getListFileIds(definition2, value) {
|
|
1079
|
+
return introspectListData(definition2, value, getFileIds);
|
|
1080
|
+
}
|
|
1081
|
+
function getListTypographyIds(definition2, value) {
|
|
1082
|
+
return introspectListData(definition2, value, getTypographyIds);
|
|
1083
|
+
}
|
|
1084
|
+
function getListPageIds(definition2, value) {
|
|
1085
|
+
return introspectListData(definition2, value, getPageIds);
|
|
1011
1086
|
}
|
|
1012
1087
|
const ShapeControlType = "makeswift::controls::shape";
|
|
1013
1088
|
function Shape(config) {
|
|
@@ -1052,20 +1127,35 @@ class ShapeControl extends PropController {
|
|
|
1052
1127
|
this.setControls();
|
|
1053
1128
|
}
|
|
1054
1129
|
}
|
|
1055
|
-
function copyShapeData(
|
|
1130
|
+
function copyShapeData(definition2, value, context) {
|
|
1056
1131
|
if (value == null)
|
|
1057
1132
|
return value;
|
|
1058
1133
|
const newValue = {};
|
|
1059
|
-
for (const [key, itemDefinition] of Object.entries(
|
|
1134
|
+
for (const [key, itemDefinition] of Object.entries(definition2.config.type)) {
|
|
1060
1135
|
const prop = value[key];
|
|
1061
1136
|
newValue[key] = copy(itemDefinition, prop, context);
|
|
1062
1137
|
}
|
|
1063
1138
|
return newValue;
|
|
1064
1139
|
}
|
|
1065
|
-
function introspectShapeData(
|
|
1140
|
+
function introspectShapeData(definition2, value, func) {
|
|
1066
1141
|
if (value == null)
|
|
1067
1142
|
return [];
|
|
1068
|
-
return Object.entries(
|
|
1143
|
+
return Object.entries(definition2.config.type).flatMap(([key, definition22]) => func(definition22, value[key]));
|
|
1144
|
+
}
|
|
1145
|
+
function getShapeElementChildren(definition2, data) {
|
|
1146
|
+
return introspectShapeData(definition2, data, getElementChildren);
|
|
1147
|
+
}
|
|
1148
|
+
function getShapeSwatchIds(definition2, data) {
|
|
1149
|
+
return introspectShapeData(definition2, data, getSwatchIds);
|
|
1150
|
+
}
|
|
1151
|
+
function getShapeTypographyIds(definition2, data) {
|
|
1152
|
+
return introspectShapeData(definition2, data, getTypographyIds);
|
|
1153
|
+
}
|
|
1154
|
+
function getShapePageIds(definition2, data) {
|
|
1155
|
+
return introspectShapeData(definition2, data, getPageIds);
|
|
1156
|
+
}
|
|
1157
|
+
function getShapeFileIds(definition2, data) {
|
|
1158
|
+
return introspectShapeData(definition2, data, getFileIds);
|
|
1069
1159
|
}
|
|
1070
1160
|
const SlotControlType = "makeswift::controls::slot";
|
|
1071
1161
|
function Slot() {
|
|
@@ -1863,8 +1953,8 @@ function copy$1(descriptor, value, context) {
|
|
|
1863
1953
|
function copyElementReference(value, context) {
|
|
1864
1954
|
return context.replacementContext.globalElementIds.get(value) || value;
|
|
1865
1955
|
}
|
|
1866
|
-
function copy(
|
|
1867
|
-
switch (
|
|
1956
|
+
function copy(definition2, value, context) {
|
|
1957
|
+
switch (definition2.type) {
|
|
1868
1958
|
case Types.Backgrounds:
|
|
1869
1959
|
case Types.Grid:
|
|
1870
1960
|
case Types.NavigationLinks:
|
|
@@ -1878,7 +1968,7 @@ function copy(definition, value, context) {
|
|
|
1878
1968
|
case Types.Border:
|
|
1879
1969
|
case Types.RichText:
|
|
1880
1970
|
case Types.ElementID:
|
|
1881
|
-
return copy$1(
|
|
1971
|
+
return copy$1(definition2, value, context);
|
|
1882
1972
|
case ColorControlType:
|
|
1883
1973
|
return copyColorData(value, context);
|
|
1884
1974
|
case ImageControlType:
|
|
@@ -1886,9 +1976,9 @@ function copy(definition, value, context) {
|
|
|
1886
1976
|
case LinkControlType:
|
|
1887
1977
|
return copyLinkData(value, context);
|
|
1888
1978
|
case ShapeControlType:
|
|
1889
|
-
return copyShapeData(
|
|
1979
|
+
return copyShapeData(definition2, value, context);
|
|
1890
1980
|
case ListControlType:
|
|
1891
|
-
return copyListData(
|
|
1981
|
+
return copyListData(definition2, value, context);
|
|
1892
1982
|
case StyleControlType:
|
|
1893
1983
|
return copyStyleData(value, context);
|
|
1894
1984
|
case SlotControlType:
|
|
@@ -1897,14 +1987,31 @@ function copy(definition, value, context) {
|
|
|
1897
1987
|
return value;
|
|
1898
1988
|
}
|
|
1899
1989
|
}
|
|
1900
|
-
function merge(
|
|
1901
|
-
switch (
|
|
1990
|
+
function merge(definition2, a, b = a, context) {
|
|
1991
|
+
switch (definition2.type) {
|
|
1902
1992
|
case SlotControlType:
|
|
1903
1993
|
return mergeSlotData(a, b, context);
|
|
1904
1994
|
default:
|
|
1905
1995
|
return b;
|
|
1906
1996
|
}
|
|
1907
1997
|
}
|
|
1998
|
+
const unstable_IconRadioGroupIcon = {
|
|
1999
|
+
TextAlignCenter: "TextAlignCenter",
|
|
2000
|
+
TextAlignJustify: "TextAlignJustify",
|
|
2001
|
+
TextAlignLeft: "TextAlignLeft",
|
|
2002
|
+
TextAlignRight: "TextAlignRight",
|
|
2003
|
+
Superscript: "Superscript16",
|
|
2004
|
+
Subscript: "Subscript16",
|
|
2005
|
+
Code: "Code16"
|
|
2006
|
+
};
|
|
2007
|
+
const IconRadioGroupControlType = "makeswift::controls::icon-radio-group";
|
|
2008
|
+
function unstable_IconRadioGroup(config) {
|
|
2009
|
+
return { type: IconRadioGroupControlType, config };
|
|
2010
|
+
}
|
|
2011
|
+
const SelectControlType = "makeswift::controls::select";
|
|
2012
|
+
function Select(config) {
|
|
2013
|
+
return { type: SelectControlType, config };
|
|
2014
|
+
}
|
|
1908
2015
|
const isServer = typeof window === "undefined";
|
|
1909
2016
|
const useInsertionEffectSpecifier = "useInsertionEffect";
|
|
1910
2017
|
const useInsertionEffect = (_a = React__default[useInsertionEffectSpecifier]) != null ? _a : React__default.useLayoutEffect;
|
|
@@ -1970,7 +2077,6 @@ const ObjectType = {
|
|
|
1970
2077
|
};
|
|
1971
2078
|
const RootBlockType = {
|
|
1972
2079
|
Default: "default",
|
|
1973
|
-
Text: "text-block",
|
|
1974
2080
|
Paragraph: "paragraph",
|
|
1975
2081
|
Heading1: "heading-one",
|
|
1976
2082
|
Heading2: "heading-two",
|
|
@@ -2142,7 +2248,6 @@ function toNodeDTO(node) {
|
|
|
2142
2248
|
case BlockType.Heading5:
|
|
2143
2249
|
case BlockType.Heading6:
|
|
2144
2250
|
case BlockType.Default:
|
|
2145
|
-
case BlockType.Text:
|
|
2146
2251
|
case BlockType.BlockQuote:
|
|
2147
2252
|
case BlockType.Paragraph:
|
|
2148
2253
|
case BlockType.OrderedList:
|
|
@@ -2196,9 +2301,6 @@ function richTextDAOToDTO(children, selection) {
|
|
|
2196
2301
|
};
|
|
2197
2302
|
}
|
|
2198
2303
|
const RichTextControlType = "makeswift::controls::rich-text";
|
|
2199
|
-
function RichText() {
|
|
2200
|
-
return { type: RichTextControlType };
|
|
2201
|
-
}
|
|
2202
2304
|
const RichTextControlMessageType = {
|
|
2203
2305
|
CHANGE_BUILDER_EDIT_MODE: "CHANGE_BUILDER_EDIT_MODE",
|
|
2204
2306
|
INITIALIZE_EDITOR: "INITIALIZE_EDITOR",
|
|
@@ -2268,30 +2370,1362 @@ class RichTextControl extends PropController {
|
|
|
2268
2370
|
function richTextV2DataToDescendents(data) {
|
|
2269
2371
|
return data.descendants;
|
|
2270
2372
|
}
|
|
2271
|
-
function richTextV2DescendentsToData(descendants) {
|
|
2373
|
+
function richTextV2DescendentsToData(descendants, key) {
|
|
2272
2374
|
return {
|
|
2273
2375
|
type: RichTextV2ControlType,
|
|
2274
2376
|
version: 2,
|
|
2275
|
-
descendants
|
|
2377
|
+
descendants,
|
|
2378
|
+
key
|
|
2276
2379
|
};
|
|
2277
2380
|
}
|
|
2278
|
-
const RichTextV2ControlType = "makeswift::controls::rich-text-v2";
|
|
2279
|
-
const RichTextV2Mode = {
|
|
2280
|
-
Inline: "makeswift::controls::rich-text-v2::mode::inline",
|
|
2281
|
-
Block: "makeswift::controls::rich-text-v2::mode::block"
|
|
2282
|
-
};
|
|
2283
2381
|
function createRichTextV2Plugin({
|
|
2284
2382
|
control,
|
|
2285
2383
|
withPlugin,
|
|
2286
|
-
onKeyDown,
|
|
2384
|
+
onKeyDown: onKeyDown2,
|
|
2287
2385
|
renderElement,
|
|
2288
2386
|
renderLeaf
|
|
2289
2387
|
}) {
|
|
2290
|
-
return { control, withPlugin, onKeyDown, renderElement, renderLeaf };
|
|
2388
|
+
return { control, withPlugin, onKeyDown: onKeyDown2, renderElement, renderLeaf };
|
|
2389
|
+
}
|
|
2390
|
+
const ElementUtils = {
|
|
2391
|
+
isRootBlock(node) {
|
|
2392
|
+
return Element.isElement(node) && (Element.isElementType(node, BlockType.Paragraph) || Element.isElementType(node, BlockType.Heading1) || Element.isElementType(node, BlockType.Heading2) || Element.isElementType(node, BlockType.Heading3) || Element.isElementType(node, BlockType.Heading3) || Element.isElementType(node, BlockType.Heading4) || Element.isElementType(node, BlockType.Heading5) || Element.isElementType(node, BlockType.Heading6) || Element.isElementType(node, BlockType.BlockQuote) || Element.isElementType(node, BlockType.UnorderedList) || Element.isElementType(node, BlockType.OrderedList) || Element.isElementType(node, BlockType.Default));
|
|
2393
|
+
},
|
|
2394
|
+
isBlock(node) {
|
|
2395
|
+
return Element.isElement(node) && (this.isRootBlock(node) || Element.isElementType(node, BlockType.ListItem) || Element.isElementType(node, BlockType.ListItemChild));
|
|
2396
|
+
},
|
|
2397
|
+
isInline(node) {
|
|
2398
|
+
return Element.isElementType(node, InlineType.Code) || Element.isElementType(node, InlineType.Link) || Element.isElementType(node, InlineType.SubScript) || Element.isElementType(node, InlineType.SuperScript);
|
|
2399
|
+
},
|
|
2400
|
+
isConvertibleToListTextNode(node) {
|
|
2401
|
+
return !this.isList(node) && !this.isListItem(node) && !this.isListItemChild(node);
|
|
2402
|
+
},
|
|
2403
|
+
isList(node) {
|
|
2404
|
+
return Element.isElementType(node, BlockType.OrderedList) || Element.isElementType(node, BlockType.UnorderedList);
|
|
2405
|
+
},
|
|
2406
|
+
isListItem(node) {
|
|
2407
|
+
return Element.isElementType(node, BlockType.ListItem);
|
|
2408
|
+
},
|
|
2409
|
+
isListItemChild(node) {
|
|
2410
|
+
return Element.isElementType(node, BlockType.ListItemChild);
|
|
2411
|
+
},
|
|
2412
|
+
createText() {
|
|
2413
|
+
return { text: "" };
|
|
2414
|
+
},
|
|
2415
|
+
createParagraph() {
|
|
2416
|
+
return {
|
|
2417
|
+
children: [this.createText()],
|
|
2418
|
+
type: BlockType.Paragraph
|
|
2419
|
+
};
|
|
2420
|
+
},
|
|
2421
|
+
createList(type = BlockType.UnorderedList) {
|
|
2422
|
+
return { children: [this.createText()], type };
|
|
2423
|
+
},
|
|
2424
|
+
createListItem() {
|
|
2425
|
+
return {
|
|
2426
|
+
children: [this.createListItemChild()],
|
|
2427
|
+
type: BlockType.ListItem
|
|
2428
|
+
};
|
|
2429
|
+
},
|
|
2430
|
+
createListItemChild() {
|
|
2431
|
+
return {
|
|
2432
|
+
children: [this.createText()],
|
|
2433
|
+
type: BlockType.ListItemChild
|
|
2434
|
+
};
|
|
2435
|
+
}
|
|
2436
|
+
};
|
|
2437
|
+
function isLinkElement(node) {
|
|
2438
|
+
return ElementUtils.isInline(node) && node.type === InlineType.Link;
|
|
2439
|
+
}
|
|
2440
|
+
function isLinkEntry(inline) {
|
|
2441
|
+
return ElementUtils.isInline(inline[0]) && inline[0].type === InlineType.Link;
|
|
2442
|
+
}
|
|
2443
|
+
function unhangRange(editor, range) {
|
|
2444
|
+
let [start, end] = Range.edges(range);
|
|
2445
|
+
if (start.offset !== 0 || end.offset !== 0 || Range.isCollapsed(range)) {
|
|
2446
|
+
return range;
|
|
2447
|
+
}
|
|
2448
|
+
const endBlock = Editor.above(editor, {
|
|
2449
|
+
at: end,
|
|
2450
|
+
match: (n) => Element.isElement(n) && Editor.isBlock(editor, n)
|
|
2451
|
+
});
|
|
2452
|
+
const blockPath = endBlock ? endBlock[1] : [];
|
|
2453
|
+
const first = Editor.start(editor, start);
|
|
2454
|
+
const before = { anchor: first, focus: end };
|
|
2455
|
+
let skip = true;
|
|
2456
|
+
for (const [node, path] of Editor.nodes(editor, {
|
|
2457
|
+
at: before,
|
|
2458
|
+
match: Text.isText,
|
|
2459
|
+
reverse: true
|
|
2460
|
+
})) {
|
|
2461
|
+
if (skip) {
|
|
2462
|
+
skip = false;
|
|
2463
|
+
continue;
|
|
2464
|
+
}
|
|
2465
|
+
if (node.text !== "" || Path.isBefore(path, blockPath)) {
|
|
2466
|
+
end = { path, offset: node.text.length };
|
|
2467
|
+
break;
|
|
2468
|
+
}
|
|
2469
|
+
}
|
|
2470
|
+
return { anchor: start, focus: end };
|
|
2471
|
+
}
|
|
2472
|
+
function is(x, y) {
|
|
2473
|
+
if (x === y)
|
|
2474
|
+
return x !== 0 || y !== 0 || 1 / x === 1 / y;
|
|
2475
|
+
return x !== x && y !== y;
|
|
2476
|
+
}
|
|
2477
|
+
const { hasOwnProperty: hasOwnProperty$1 } = Object.prototype;
|
|
2478
|
+
const shallowEqual = (a, b) => {
|
|
2479
|
+
if (is(a, b))
|
|
2480
|
+
return true;
|
|
2481
|
+
if (typeof a !== "object" || a === null || typeof b !== "object" || b === null)
|
|
2482
|
+
return false;
|
|
2483
|
+
const keysA = Object.keys(a);
|
|
2484
|
+
const keysB = Object.keys(b);
|
|
2485
|
+
if (keysA.length !== keysB.length)
|
|
2486
|
+
return false;
|
|
2487
|
+
for (let i = 0; i < keysA.length; i += 1) {
|
|
2488
|
+
if (!hasOwnProperty$1.call(b, keysA[i]) || !is(a[keysA[i]], b[keysA[i]]))
|
|
2489
|
+
return false;
|
|
2490
|
+
}
|
|
2491
|
+
return true;
|
|
2492
|
+
};
|
|
2493
|
+
function isNonNullable(value) {
|
|
2494
|
+
return value != null;
|
|
2495
|
+
}
|
|
2496
|
+
const { hasOwnProperty } = Object.prototype;
|
|
2497
|
+
const deepEqual = (a, b) => {
|
|
2498
|
+
if (shallowEqual(a, b))
|
|
2499
|
+
return true;
|
|
2500
|
+
if (typeof a !== "object" || a === null || typeof b !== "object" || b === null)
|
|
2501
|
+
return false;
|
|
2502
|
+
const keysA = Object.keys(a);
|
|
2503
|
+
const keysB = Object.keys(b);
|
|
2504
|
+
if (keysA.length !== keysB.length)
|
|
2505
|
+
return false;
|
|
2506
|
+
for (let i = 0; i < keysA.length; i += 1) {
|
|
2507
|
+
if (!hasOwnProperty.call(b, keysA[i]) || !deepEqual(a[keysA[i]], b[keysA[i]]))
|
|
2508
|
+
return false;
|
|
2509
|
+
}
|
|
2510
|
+
return true;
|
|
2511
|
+
};
|
|
2512
|
+
function getSelection(editor) {
|
|
2513
|
+
if (editor.selection)
|
|
2514
|
+
return unhangRange(editor, editor.selection);
|
|
2515
|
+
return {
|
|
2516
|
+
anchor: Editor.start(editor, []),
|
|
2517
|
+
focus: Editor.end(editor, [])
|
|
2518
|
+
};
|
|
2519
|
+
}
|
|
2520
|
+
function getBlocksInSelection(editor) {
|
|
2521
|
+
return Array.from(Editor.nodes(editor, {
|
|
2522
|
+
at: getSelection(editor),
|
|
2523
|
+
match: (node) => ElementUtils.isRootBlock(node)
|
|
2524
|
+
})).filter((entry) => ElementUtils.isRootBlock(entry[0]));
|
|
2525
|
+
}
|
|
2526
|
+
function getActiveBlockType(editor) {
|
|
2527
|
+
var _a2;
|
|
2528
|
+
const rootBlocks = getBlocksInSelection(editor).map(([node]) => node.type);
|
|
2529
|
+
return rootBlocks.reduce((a, b) => a === b ? b : null, (_a2 = rootBlocks.at(0)) != null ? _a2 : null);
|
|
2530
|
+
}
|
|
2531
|
+
function unwrapInline(editor, type) {
|
|
2532
|
+
Transforms.unwrapNodes(editor, {
|
|
2533
|
+
match: (node) => ElementUtils.isInline(node) && node.type === type,
|
|
2534
|
+
at: getSelection(editor)
|
|
2535
|
+
});
|
|
2536
|
+
}
|
|
2537
|
+
function wrapInline(editor, inline) {
|
|
2538
|
+
Transforms.wrapNodes(editor, inline, {
|
|
2539
|
+
at: getSelection(editor),
|
|
2540
|
+
split: true
|
|
2541
|
+
});
|
|
2542
|
+
}
|
|
2543
|
+
function filterForSubtreeRoots(entries) {
|
|
2544
|
+
return entries.filter(([, nodePath]) => !Path.ancestors(nodePath).some((ancestor) => {
|
|
2545
|
+
return entries.some(([, path]) => Path.equals(path, ancestor));
|
|
2546
|
+
}));
|
|
2547
|
+
}
|
|
2548
|
+
function getLinksAndTextInSelection(editor) {
|
|
2549
|
+
return Array.from(Editor.nodes(editor, {
|
|
2550
|
+
at: getSelection(editor),
|
|
2551
|
+
match: (node) => ElementUtils.isInline(node) && isLinkElement(node) || Text.isText(node)
|
|
2552
|
+
}));
|
|
2553
|
+
}
|
|
2554
|
+
const getValue$3 = (editor) => {
|
|
2555
|
+
var _a2;
|
|
2556
|
+
const roots = filterForSubtreeRoots(getLinksAndTextInSelection(editor));
|
|
2557
|
+
const areAllRootsLinks = roots.every(([root]) => isLinkElement(root) || Text.isText(root));
|
|
2558
|
+
if (!areAllRootsLinks)
|
|
2559
|
+
return void 0;
|
|
2560
|
+
const matchingValues = roots.map(([node]) => node).filter(isLinkElement);
|
|
2561
|
+
const match = matchingValues.reduce((a, b) => deepEqual(a == null ? void 0 : a.link, b == null ? void 0 : b.link) ? b : null, (_a2 = matchingValues.at(0)) != null ? _a2 : void 0);
|
|
2562
|
+
return match == null ? match : match.link;
|
|
2563
|
+
};
|
|
2564
|
+
const onChange$1 = (editor, value) => {
|
|
2565
|
+
if (value == null)
|
|
2566
|
+
return unwrapInline(editor, InlineType.Link);
|
|
2567
|
+
const roots = filterForSubtreeRoots(getLinksAndTextInSelection(editor));
|
|
2568
|
+
const root = roots.at(0);
|
|
2569
|
+
if (roots.length === 1 && root != null && isLinkEntry(root)) {
|
|
2570
|
+
Transforms.setNodes(editor, {
|
|
2571
|
+
link: value
|
|
2572
|
+
}, { at: root[1] });
|
|
2573
|
+
} else {
|
|
2574
|
+
unwrapInline(editor, InlineType.Link);
|
|
2575
|
+
wrapInline(editor, { type: InlineType.Link, link: value, children: [] });
|
|
2576
|
+
}
|
|
2577
|
+
};
|
|
2578
|
+
function LinkPlugin() {
|
|
2579
|
+
return createRichTextV2Plugin({
|
|
2580
|
+
control: {
|
|
2581
|
+
definition: Link({
|
|
2582
|
+
label: "On Click"
|
|
2583
|
+
}),
|
|
2584
|
+
onChange: onChange$1,
|
|
2585
|
+
getValue: getValue$3,
|
|
2586
|
+
getElementValue: (element) => {
|
|
2587
|
+
return ElementUtils.isInline(element) && isLinkElement(element) ? element.link : void 0;
|
|
2588
|
+
}
|
|
2589
|
+
}
|
|
2590
|
+
});
|
|
2591
|
+
}
|
|
2592
|
+
const supportedInlineOptions = [
|
|
2593
|
+
{
|
|
2594
|
+
icon: unstable_IconRadioGroupIcon.Superscript,
|
|
2595
|
+
label: "Superscript",
|
|
2596
|
+
value: "superscript"
|
|
2597
|
+
},
|
|
2598
|
+
{
|
|
2599
|
+
icon: unstable_IconRadioGroupIcon.Subscript,
|
|
2600
|
+
label: "Subscript",
|
|
2601
|
+
value: "subscript"
|
|
2602
|
+
},
|
|
2603
|
+
{
|
|
2604
|
+
icon: unstable_IconRadioGroupIcon.Code,
|
|
2605
|
+
label: "Code",
|
|
2606
|
+
value: "code"
|
|
2607
|
+
}
|
|
2608
|
+
];
|
|
2609
|
+
function isSupportedInlineType(inline) {
|
|
2610
|
+
return supportedInlineOptions.findIndex((option) => option.value === inline) !== -1;
|
|
2611
|
+
}
|
|
2612
|
+
function isSupportedInlineEntry(entry) {
|
|
2613
|
+
const node = entry[0];
|
|
2614
|
+
return ElementUtils.isInline(node) && supportedInlineOptions.findIndex((option) => option.value === node.type) !== -1;
|
|
2615
|
+
}
|
|
2616
|
+
function getSupportedInlinesAndTextInSelection(editor) {
|
|
2617
|
+
return Array.from(Editor.nodes(editor, {
|
|
2618
|
+
at: getSelection(editor),
|
|
2619
|
+
match: (node) => ElementUtils.isInline(node) && isSupportedInlineType(node.type) || Text.isText(node)
|
|
2620
|
+
}));
|
|
2621
|
+
}
|
|
2622
|
+
const getValue$2 = (editor) => {
|
|
2623
|
+
var _a2;
|
|
2624
|
+
const roots = filterForSubtreeRoots(getSupportedInlinesAndTextInSelection(editor));
|
|
2625
|
+
const areAllRootsSupportedInlineTypesOrText = roots.every((entry) => isSupportedInlineEntry(entry) || Text.isText(entry[0]));
|
|
2626
|
+
if (!areAllRootsSupportedInlineTypesOrText)
|
|
2627
|
+
return void 0;
|
|
2628
|
+
const matchingValues = roots.filter(isSupportedInlineEntry).map(([node]) => node);
|
|
2629
|
+
const match = matchingValues.reduce((a, b) => (a == null ? void 0 : a.type) === (b == null ? void 0 : b.type) ? b : null, (_a2 = matchingValues.at(0)) != null ? _a2 : void 0);
|
|
2630
|
+
return match == null ? match : match.type;
|
|
2631
|
+
};
|
|
2632
|
+
const onChange = (editor, value) => {
|
|
2633
|
+
function unwrapAllSupportedTypes() {
|
|
2634
|
+
supportedInlineOptions.forEach(({ value: optionValue }) => unwrapInline(editor, optionValue));
|
|
2635
|
+
}
|
|
2636
|
+
function unwrapAllInlines() {
|
|
2637
|
+
Transforms.unwrapNodes(editor, {
|
|
2638
|
+
match: (node) => ElementUtils.isInline(node),
|
|
2639
|
+
at: getSelection(editor)
|
|
2640
|
+
});
|
|
2641
|
+
}
|
|
2642
|
+
if (value == null)
|
|
2643
|
+
return unwrapAllSupportedTypes();
|
|
2644
|
+
if (!isSupportedInlineType(value))
|
|
2645
|
+
return;
|
|
2646
|
+
const roots = filterForSubtreeRoots(getSupportedInlinesAndTextInSelection(editor));
|
|
2647
|
+
const root = roots.at(0);
|
|
2648
|
+
if (roots.length === 1 && root != null && isSupportedInlineEntry(root) && root[0].type === value) {
|
|
2649
|
+
unwrapInline(editor, value);
|
|
2650
|
+
} else {
|
|
2651
|
+
unwrapAllInlines();
|
|
2652
|
+
wrapInline(editor, { type: value, children: [] });
|
|
2653
|
+
}
|
|
2654
|
+
};
|
|
2655
|
+
const withInline = (editor) => {
|
|
2656
|
+
const {
|
|
2657
|
+
isInline
|
|
2658
|
+
} = editor;
|
|
2659
|
+
editor.isInline = (entry) => {
|
|
2660
|
+
return ElementUtils.isInline(entry) && isInline(entry);
|
|
2661
|
+
};
|
|
2662
|
+
return editor;
|
|
2663
|
+
};
|
|
2664
|
+
function InlinePlugin() {
|
|
2665
|
+
return createRichTextV2Plugin({
|
|
2666
|
+
control: {
|
|
2667
|
+
definition: unstable_IconRadioGroup({
|
|
2668
|
+
label: "Inline",
|
|
2669
|
+
options: supportedInlineOptions
|
|
2670
|
+
}),
|
|
2671
|
+
onChange,
|
|
2672
|
+
getValue: getValue$2,
|
|
2673
|
+
getElementValue: (element) => {
|
|
2674
|
+
return ElementUtils.isInline(element) ? element.type : void 0;
|
|
2675
|
+
}
|
|
2676
|
+
},
|
|
2677
|
+
withPlugin: withInline,
|
|
2678
|
+
renderElement: (renderElement) => (props) => {
|
|
2679
|
+
return /* @__PURE__ */ jsx(InlinePluginComponent, __spreadProps(__spreadValues({}, props), {
|
|
2680
|
+
renderElement
|
|
2681
|
+
}));
|
|
2682
|
+
}
|
|
2683
|
+
});
|
|
2684
|
+
}
|
|
2685
|
+
function InlinePluginComponent(_b) {
|
|
2686
|
+
var _c = _b, {
|
|
2687
|
+
renderElement
|
|
2688
|
+
} = _c, props = __objRest(_c, [
|
|
2689
|
+
"renderElement"
|
|
2690
|
+
]);
|
|
2691
|
+
switch (props.element.type) {
|
|
2692
|
+
case InlineType.Code:
|
|
2693
|
+
return /* @__PURE__ */ jsx("code", __spreadProps(__spreadValues({}, props.attributes), {
|
|
2694
|
+
children: renderElement(props)
|
|
2695
|
+
}));
|
|
2696
|
+
case InlineType.SuperScript:
|
|
2697
|
+
return /* @__PURE__ */ jsx("sup", __spreadProps(__spreadValues({}, props.attributes), {
|
|
2698
|
+
children: renderElement(props)
|
|
2699
|
+
}));
|
|
2700
|
+
case InlineType.SubScript:
|
|
2701
|
+
return /* @__PURE__ */ jsx("sub", __spreadProps(__spreadValues({}, props.attributes), {
|
|
2702
|
+
children: renderElement(props)
|
|
2703
|
+
}));
|
|
2704
|
+
default:
|
|
2705
|
+
return /* @__PURE__ */ jsx(Fragment, {
|
|
2706
|
+
children: renderElement(props)
|
|
2707
|
+
});
|
|
2708
|
+
}
|
|
2709
|
+
}
|
|
2710
|
+
function setResponsiveValue(editor, key, value, options) {
|
|
2711
|
+
Editor.withoutNormalizing(editor, () => {
|
|
2712
|
+
const at = getSelection(editor);
|
|
2713
|
+
if (!at)
|
|
2714
|
+
return;
|
|
2715
|
+
const atRef = Editor.rangeRef(editor, at);
|
|
2716
|
+
if (atRef.current) {
|
|
2717
|
+
Transforms.setNodes(editor, {
|
|
2718
|
+
slice: true
|
|
2719
|
+
}, {
|
|
2720
|
+
at: atRef.current,
|
|
2721
|
+
match: options.match,
|
|
2722
|
+
split: options.split
|
|
2723
|
+
});
|
|
2724
|
+
}
|
|
2725
|
+
if (atRef.current) {
|
|
2726
|
+
const nodesToUpdate = Array.from(Editor.nodes(editor, {
|
|
2727
|
+
at: atRef.current,
|
|
2728
|
+
match: (node, path) => options.match(node, path) && node.slice === true
|
|
2729
|
+
}));
|
|
2730
|
+
for (const [, path] of nodesToUpdate) {
|
|
2731
|
+
Transforms.setNodes(editor, {
|
|
2732
|
+
[key]: value
|
|
2733
|
+
}, { at: path });
|
|
2734
|
+
}
|
|
2735
|
+
}
|
|
2736
|
+
atRef.unref();
|
|
2737
|
+
});
|
|
2738
|
+
}
|
|
2739
|
+
function normalizeResponsiveValue(editor, key, options) {
|
|
2740
|
+
return (entry) => {
|
|
2741
|
+
const [node, path] = entry;
|
|
2742
|
+
if (!options.match(node, path)) {
|
|
2743
|
+
return false;
|
|
2744
|
+
}
|
|
2745
|
+
const responsiveValue = node == null ? void 0 : node[key];
|
|
2746
|
+
if (Array.isArray(responsiveValue) && responsiveValue.length === 0) {
|
|
2747
|
+
Transforms.unsetNodes(editor, key, { at: path });
|
|
2748
|
+
return true;
|
|
2749
|
+
}
|
|
2750
|
+
if ((node == null ? void 0 : node.slice) != null) {
|
|
2751
|
+
Transforms.unsetNodes(editor, "slice", { at: path });
|
|
2752
|
+
return true;
|
|
2753
|
+
}
|
|
2754
|
+
return false;
|
|
2755
|
+
};
|
|
2756
|
+
}
|
|
2757
|
+
function responsiveShallowEqual(a = [], b = []) {
|
|
2758
|
+
const aObject = a.reduce((acc, curr) => __spreadProps(__spreadValues({}, acc), {
|
|
2759
|
+
[curr.deviceId]: curr.value
|
|
2760
|
+
}), {});
|
|
2761
|
+
const bObject = b.reduce((acc, curr) => __spreadProps(__spreadValues({}, acc), {
|
|
2762
|
+
[curr.deviceId]: curr.value
|
|
2763
|
+
}), {});
|
|
2764
|
+
const definedDevices = /* @__PURE__ */ new Set([...a.map((a2) => a2.deviceId), ...b.map((b2) => b2.deviceId)]);
|
|
2765
|
+
return Array.from(definedDevices).map((deviceId) => {
|
|
2766
|
+
const aVal = aObject[deviceId];
|
|
2767
|
+
const bVal = bObject[deviceId];
|
|
2768
|
+
if (aVal === void 0 && bVal === void 0)
|
|
2769
|
+
return { deviceId, value: void 0 };
|
|
2770
|
+
return shallowEqual(aVal, bVal) ? { deviceId, value: aVal } : { deviceId, value: null };
|
|
2771
|
+
});
|
|
2772
|
+
}
|
|
2773
|
+
function getValue$1(editor) {
|
|
2774
|
+
const matchingValues = Array.from(Editor.nodes(editor, {
|
|
2775
|
+
at: getSelection(editor),
|
|
2776
|
+
match: ElementUtils.isRootBlock
|
|
2777
|
+
})).map(([node]) => node["textAlign"]);
|
|
2778
|
+
return matchingValues.length === 0 ? void 0 : matchingValues.reduce((a, b) => {
|
|
2779
|
+
return responsiveShallowEqual(a, b);
|
|
2780
|
+
});
|
|
2781
|
+
}
|
|
2782
|
+
const TEXT_ALIGN_KEY = "textAlign";
|
|
2783
|
+
const withTextAlign = (editor) => {
|
|
2784
|
+
const {
|
|
2785
|
+
normalizeNode
|
|
2786
|
+
} = editor;
|
|
2787
|
+
editor.normalizeNode = (entry) => {
|
|
2788
|
+
if (normalizeResponsiveValue(editor, TEXT_ALIGN_KEY, {
|
|
2789
|
+
match: ElementUtils.isRootBlock
|
|
2790
|
+
})(entry)) {
|
|
2791
|
+
return;
|
|
2792
|
+
}
|
|
2793
|
+
normalizeNode(entry);
|
|
2794
|
+
};
|
|
2795
|
+
return editor;
|
|
2796
|
+
};
|
|
2797
|
+
function TextAlignPlugin() {
|
|
2798
|
+
return createRichTextV2Plugin({
|
|
2799
|
+
control: {
|
|
2800
|
+
definition: unstable_StyleV2({
|
|
2801
|
+
type: unstable_IconRadioGroup({
|
|
2802
|
+
label: "Alignment",
|
|
2803
|
+
options: [{
|
|
2804
|
+
icon: unstable_IconRadioGroupIcon.TextAlignLeft,
|
|
2805
|
+
label: "Left Align",
|
|
2806
|
+
value: "left"
|
|
2807
|
+
}, {
|
|
2808
|
+
icon: unstable_IconRadioGroupIcon.TextAlignCenter,
|
|
2809
|
+
label: "Center Align",
|
|
2810
|
+
value: "center"
|
|
2811
|
+
}, {
|
|
2812
|
+
icon: unstable_IconRadioGroupIcon.TextAlignRight,
|
|
2813
|
+
label: "Right Align",
|
|
2814
|
+
value: "right"
|
|
2815
|
+
}, {
|
|
2816
|
+
icon: unstable_IconRadioGroupIcon.TextAlignJustify,
|
|
2817
|
+
label: "Justify",
|
|
2818
|
+
value: "justify"
|
|
2819
|
+
}],
|
|
2820
|
+
defaultValue: "left"
|
|
2821
|
+
}),
|
|
2822
|
+
getStyle(textAlign) {
|
|
2823
|
+
return {
|
|
2824
|
+
textAlign
|
|
2825
|
+
};
|
|
2826
|
+
}
|
|
2827
|
+
}),
|
|
2828
|
+
onChange: (editor, value) => setResponsiveValue(editor, TEXT_ALIGN_KEY, value, {
|
|
2829
|
+
match: ElementUtils.isRootBlock,
|
|
2830
|
+
split: false
|
|
2831
|
+
}),
|
|
2832
|
+
getValue: (editor) => getValue$1(editor),
|
|
2833
|
+
getElementValue: (element) => {
|
|
2834
|
+
return ElementUtils.isRootBlock(element) ? element.textAlign : void 0;
|
|
2835
|
+
}
|
|
2836
|
+
},
|
|
2837
|
+
withPlugin: withTextAlign,
|
|
2838
|
+
renderElement: (renderElement, className) => (props) => {
|
|
2839
|
+
return renderElement(__spreadProps(__spreadValues({}, props), {
|
|
2840
|
+
element: __spreadProps(__spreadValues({}, props.element), {
|
|
2841
|
+
className
|
|
2842
|
+
})
|
|
2843
|
+
}));
|
|
2844
|
+
}
|
|
2845
|
+
});
|
|
2846
|
+
}
|
|
2847
|
+
function setBlockKeyForDevice(editor, breakpoints, deviceId, key, value, options) {
|
|
2848
|
+
var _a2, _b;
|
|
2849
|
+
const at = (_a2 = options == null ? void 0 : options.at) != null ? _a2 : editor.selection;
|
|
2850
|
+
if (!at)
|
|
2851
|
+
return;
|
|
2852
|
+
const rootElements = getBlocksInSelection(editor);
|
|
2853
|
+
for (const [node, path] of rootElements) {
|
|
2854
|
+
if (ElementUtils.isBlock(node)) {
|
|
2855
|
+
const deviceValues = (_b = node[key]) != null ? _b : [];
|
|
2856
|
+
const currentDeviceValue = findBreakpointOverride(breakpoints, deviceValues, deviceId, (v) => v);
|
|
2857
|
+
const nextDeviceValue = __spreadProps(__spreadValues({}, currentDeviceValue), {
|
|
2858
|
+
deviceId,
|
|
2859
|
+
value
|
|
2860
|
+
});
|
|
2861
|
+
Transforms.setNodes(editor, {
|
|
2862
|
+
[key]: [...deviceValues.filter((v) => v.deviceId !== deviceId), nextDeviceValue]
|
|
2863
|
+
}, { at: path });
|
|
2864
|
+
}
|
|
2865
|
+
}
|
|
2866
|
+
}
|
|
2867
|
+
function clearBlockKeyForDevice(editor, deviceId, key) {
|
|
2868
|
+
var _a2;
|
|
2869
|
+
const rootElements = getBlocksInSelection(editor);
|
|
2870
|
+
for (const [node, path] of rootElements) {
|
|
2871
|
+
if (ElementUtils.isBlock(node)) {
|
|
2872
|
+
const deviceOverrides = (_a2 = node[key]) != null ? _a2 : [];
|
|
2873
|
+
Transforms.setNodes(editor, {
|
|
2874
|
+
[key]: deviceOverrides.filter((v) => v.deviceId !== deviceId)
|
|
2875
|
+
}, { at: path });
|
|
2876
|
+
}
|
|
2877
|
+
}
|
|
2878
|
+
}
|
|
2879
|
+
const EditorUtils = {
|
|
2880
|
+
getFirstAncestorList(editor, path) {
|
|
2881
|
+
try {
|
|
2882
|
+
const parentList = Editor.above(editor, {
|
|
2883
|
+
at: path,
|
|
2884
|
+
match: (node) => ElementUtils.isList(node)
|
|
2885
|
+
});
|
|
2886
|
+
return parentList != null ? parentList : null;
|
|
2887
|
+
} catch (e) {
|
|
2888
|
+
return null;
|
|
2889
|
+
}
|
|
2890
|
+
},
|
|
2891
|
+
getFirstAncestorListItem(editor, path) {
|
|
2892
|
+
try {
|
|
2893
|
+
const parentListItem = Editor.above(editor, {
|
|
2894
|
+
at: path,
|
|
2895
|
+
match: (node) => ElementUtils.isListItem(node)
|
|
2896
|
+
});
|
|
2897
|
+
return parentListItem != null ? parentListItem : null;
|
|
2898
|
+
} catch (e) {
|
|
2899
|
+
return null;
|
|
2900
|
+
}
|
|
2901
|
+
}
|
|
2902
|
+
};
|
|
2903
|
+
const LIST_ITEM_CHILD_POSITION = 0;
|
|
2904
|
+
const LIST_ITEM_LIST_POSITION = 1;
|
|
2905
|
+
function unwrapPath(editor, listItemPath) {
|
|
2906
|
+
const parentList = EditorUtils.getFirstAncestorList(editor, listItemPath);
|
|
2907
|
+
const listItemContainingParentList = EditorUtils.getFirstAncestorListItem(editor, listItemPath);
|
|
2908
|
+
if (!parentList || listItemContainingParentList)
|
|
2909
|
+
return;
|
|
2910
|
+
Editor.withoutNormalizing(editor, () => {
|
|
2911
|
+
const listItemTextPath = [...listItemPath, LIST_ITEM_CHILD_POSITION];
|
|
2912
|
+
const listItemNestedListPath = [...listItemPath, LIST_ITEM_LIST_POSITION];
|
|
2913
|
+
if (Node.has(editor, listItemNestedListPath)) {
|
|
2914
|
+
Transforms.setNodes(editor, { type: parentList[0].type }, { at: listItemNestedListPath });
|
|
2915
|
+
Transforms.liftNodes(editor, { at: listItemNestedListPath });
|
|
2916
|
+
Transforms.liftNodes(editor, { at: Path.next(listItemPath) });
|
|
2917
|
+
}
|
|
2918
|
+
if (Node.has(editor, listItemTextPath)) {
|
|
2919
|
+
Transforms.setNodes(editor, { type: BlockType.Paragraph }, {
|
|
2920
|
+
at: listItemTextPath
|
|
2921
|
+
});
|
|
2922
|
+
Transforms.liftNodes(editor, { at: listItemTextPath });
|
|
2923
|
+
Transforms.liftNodes(editor, { at: listItemPath });
|
|
2924
|
+
}
|
|
2925
|
+
});
|
|
2926
|
+
}
|
|
2927
|
+
function unwrapList(editor, options) {
|
|
2928
|
+
var _a2;
|
|
2929
|
+
const at = (_a2 = options == null ? void 0 : options.at) != null ? _a2 : editor.selection;
|
|
2930
|
+
if (!at)
|
|
2931
|
+
return;
|
|
2932
|
+
const listItems = Array.from(Editor.nodes(editor, {
|
|
2933
|
+
at,
|
|
2934
|
+
match: (node) => {
|
|
2935
|
+
return Element.isElement(node) && ElementUtils.isListItem(node);
|
|
2936
|
+
}
|
|
2937
|
+
}));
|
|
2938
|
+
const subRoots = filterForSubtreeRoots(listItems);
|
|
2939
|
+
const refs = subRoots.map(([_, path]) => Editor.pathRef(editor, path));
|
|
2940
|
+
refs.forEach((ref) => {
|
|
2941
|
+
if (ref.current) {
|
|
2942
|
+
unwrapPath(editor, ref.current);
|
|
2943
|
+
}
|
|
2944
|
+
ref.unref();
|
|
2945
|
+
});
|
|
2946
|
+
}
|
|
2947
|
+
function wrapList(editor, options = { type: BlockType.UnorderedList }) {
|
|
2948
|
+
var _a2;
|
|
2949
|
+
const at = (_a2 = options.at) != null ? _a2 : editor.selection;
|
|
2950
|
+
if (!at)
|
|
2951
|
+
return;
|
|
2952
|
+
const nonListEntries = Array.from(Editor.nodes(editor, {
|
|
2953
|
+
at,
|
|
2954
|
+
match: (node) => {
|
|
2955
|
+
return Element.isElement(node) && ElementUtils.isConvertibleToListTextNode(node);
|
|
2956
|
+
}
|
|
2957
|
+
}));
|
|
2958
|
+
const refs = nonListEntries.map(([_, path]) => Editor.pathRef(editor, path));
|
|
2959
|
+
refs.forEach((ref) => {
|
|
2960
|
+
const path = ref.current;
|
|
2961
|
+
if (path) {
|
|
2962
|
+
Editor.withoutNormalizing(editor, () => {
|
|
2963
|
+
Transforms.setNodes(editor, { type: BlockType.ListItemChild }, {
|
|
2964
|
+
at: path
|
|
2965
|
+
});
|
|
2966
|
+
Transforms.wrapNodes(editor, ElementUtils.createListItem(), {
|
|
2967
|
+
match: (node) => ElementUtils.isListItemChild(node),
|
|
2968
|
+
at: path
|
|
2969
|
+
});
|
|
2970
|
+
Transforms.wrapNodes(editor, ElementUtils.createList(options.type), {
|
|
2971
|
+
at: path
|
|
2972
|
+
});
|
|
2973
|
+
});
|
|
2974
|
+
}
|
|
2975
|
+
ref.unref();
|
|
2976
|
+
});
|
|
2977
|
+
}
|
|
2978
|
+
const LocationUtils = {
|
|
2979
|
+
getStartPath(location) {
|
|
2980
|
+
if (Range.isRange(location))
|
|
2981
|
+
return Range.start(location).path;
|
|
2982
|
+
if (Point.isPoint(location))
|
|
2983
|
+
return location.path;
|
|
2984
|
+
return location;
|
|
2985
|
+
}
|
|
2986
|
+
};
|
|
2987
|
+
function getSelectedListItems(editor) {
|
|
2988
|
+
var _a2, _b;
|
|
2989
|
+
if (!editor.selection)
|
|
2990
|
+
return [];
|
|
2991
|
+
const start = LocationUtils.getStartPath(editor.selection);
|
|
2992
|
+
const listItems = Editor.nodes(editor, {
|
|
2993
|
+
at: editor.selection,
|
|
2994
|
+
match: (node) => ElementUtils.isListItem(node)
|
|
2995
|
+
});
|
|
2996
|
+
const firstAncestorPath = (_b = (_a2 = EditorUtils.getFirstAncestorListItem(editor, start)) == null ? void 0 : _a2[1]) != null ? _b : [];
|
|
2997
|
+
return Array.from(listItems).filter((node) => Path.isDescendant(start, node[1]) ? Path.equals(node[1], firstAncestorPath) : !Path.isAfter(start, node[1]));
|
|
2998
|
+
}
|
|
2999
|
+
function indentPath(editor, path) {
|
|
3000
|
+
const parent = Node.parent(editor, path);
|
|
3001
|
+
if (!path || !Path.hasPrevious(path) || !ElementUtils.isList(parent))
|
|
3002
|
+
return;
|
|
3003
|
+
const previosPath = Path.previous(path);
|
|
3004
|
+
const previousChildListPath = [...previosPath, LIST_ITEM_LIST_POSITION];
|
|
3005
|
+
const previousHasChildList = Node.has(editor, previousChildListPath);
|
|
3006
|
+
Editor.withoutNormalizing(editor, () => {
|
|
3007
|
+
if (!previousHasChildList) {
|
|
3008
|
+
Transforms.insertNodes(editor, ElementUtils.createList(parent.type), {
|
|
3009
|
+
at: previousChildListPath
|
|
3010
|
+
});
|
|
3011
|
+
}
|
|
3012
|
+
const previousChildList = Node.get(editor, previousChildListPath);
|
|
3013
|
+
if (ElementUtils.isList(previousChildList)) {
|
|
3014
|
+
const index = previousHasChildList ? previousChildList.children.length : 0;
|
|
3015
|
+
Transforms.moveNodes(editor, {
|
|
3016
|
+
at: path,
|
|
3017
|
+
to: [...previousChildListPath, index]
|
|
3018
|
+
});
|
|
3019
|
+
}
|
|
3020
|
+
});
|
|
3021
|
+
}
|
|
3022
|
+
function indent(editor) {
|
|
3023
|
+
if (!editor.selection)
|
|
3024
|
+
return;
|
|
3025
|
+
const listItems = getSelectedListItems(editor);
|
|
3026
|
+
const subRoots = filterForSubtreeRoots(listItems);
|
|
3027
|
+
const refs = subRoots.map(([_, path]) => Editor.pathRef(editor, path));
|
|
3028
|
+
refs.forEach((ref) => {
|
|
3029
|
+
if (ref.current) {
|
|
3030
|
+
indentPath(editor, ref.current);
|
|
3031
|
+
}
|
|
3032
|
+
ref.unref();
|
|
3033
|
+
});
|
|
3034
|
+
}
|
|
3035
|
+
function dedentPath(editor, listItemPath) {
|
|
3036
|
+
const parentList = EditorUtils.getFirstAncestorList(editor, listItemPath);
|
|
3037
|
+
const listItemContainingParentList = EditorUtils.getFirstAncestorListItem(editor, listItemPath);
|
|
3038
|
+
if (!parentList || !listItemContainingParentList)
|
|
3039
|
+
return;
|
|
3040
|
+
const [parentListNode, parentListPath] = parentList;
|
|
3041
|
+
const [_, listItemContainingParentListPath] = listItemContainingParentList;
|
|
3042
|
+
const listItemPosition = listItemPath[listItemPath.length - 1];
|
|
3043
|
+
const previousSiblings = parentListNode.children.slice(0, listItemPosition);
|
|
3044
|
+
const nextSiblings = parentListNode.children.slice(listItemPosition + 1);
|
|
3045
|
+
Editor.withoutNormalizing(editor, () => {
|
|
3046
|
+
nextSiblings.forEach(() => {
|
|
3047
|
+
const nextSiblingPath = [...parentListPath, listItemPosition + 1];
|
|
3048
|
+
indentPath(editor, nextSiblingPath);
|
|
3049
|
+
});
|
|
3050
|
+
Transforms.moveNodes(editor, {
|
|
3051
|
+
at: listItemPath,
|
|
3052
|
+
to: Path.next(listItemContainingParentListPath)
|
|
3053
|
+
});
|
|
3054
|
+
if (previousSiblings.length === 0) {
|
|
3055
|
+
Transforms.removeNodes(editor, { at: parentListPath });
|
|
3056
|
+
}
|
|
3057
|
+
});
|
|
3058
|
+
}
|
|
3059
|
+
function dedent(editor) {
|
|
3060
|
+
if (!editor.selection)
|
|
3061
|
+
return;
|
|
3062
|
+
const listItems = getSelectedListItems(editor);
|
|
3063
|
+
const subRoots = filterForSubtreeRoots(listItems);
|
|
3064
|
+
const refs = subRoots.map(([_, path]) => Editor.pathRef(editor, path));
|
|
3065
|
+
refs.forEach((ref) => {
|
|
3066
|
+
if (ref.current) {
|
|
3067
|
+
dedentPath(editor, ref.current);
|
|
3068
|
+
}
|
|
3069
|
+
ref.unref();
|
|
3070
|
+
});
|
|
3071
|
+
}
|
|
3072
|
+
function toggleList(editor, options = { type: BlockType.UnorderedList }) {
|
|
3073
|
+
var _a2;
|
|
3074
|
+
const at = (_a2 = options.at) != null ? _a2 : editor.selection;
|
|
3075
|
+
if (at == null)
|
|
3076
|
+
return;
|
|
3077
|
+
const start = LocationUtils.getStartPath(at);
|
|
3078
|
+
const ancestorPath = Path.ancestors(start).at(1);
|
|
3079
|
+
if (!ancestorPath || !Node.has(editor, ancestorPath))
|
|
3080
|
+
return;
|
|
3081
|
+
const ancestor = Node.get(editor, ancestorPath);
|
|
3082
|
+
if (!ElementUtils.isList(ancestor)) {
|
|
3083
|
+
return wrapList(editor, { type: options.type, at });
|
|
3084
|
+
}
|
|
3085
|
+
if (ancestor.type === options.type) {
|
|
3086
|
+
unwrapList(editor, { at });
|
|
3087
|
+
} else {
|
|
3088
|
+
Transforms.setNodes(editor, { type: options.type }, { at: ancestorPath });
|
|
3089
|
+
}
|
|
3090
|
+
}
|
|
3091
|
+
const BlockActions = {
|
|
3092
|
+
setBlockKeyForDevice,
|
|
3093
|
+
clearBlockKeyForDevice,
|
|
3094
|
+
wrapInline,
|
|
3095
|
+
unwrapInline
|
|
3096
|
+
};
|
|
3097
|
+
const ListActions = {
|
|
3098
|
+
unwrapList,
|
|
3099
|
+
wrapList,
|
|
3100
|
+
indent,
|
|
3101
|
+
dedent,
|
|
3102
|
+
toggleList
|
|
3103
|
+
};
|
|
3104
|
+
function onKeyDown(e, editor) {
|
|
3105
|
+
if (!editor.selection || Array.from(Editor.nodes(editor, {
|
|
3106
|
+
match: (node) => ElementUtils.isListItem(node)
|
|
3107
|
+
})).length === 0)
|
|
3108
|
+
return;
|
|
3109
|
+
if (isHotkey("shift+tab", e)) {
|
|
3110
|
+
e.preventDefault();
|
|
3111
|
+
ListActions.dedent(editor);
|
|
3112
|
+
}
|
|
3113
|
+
if (isHotkey("tab", e)) {
|
|
3114
|
+
e.preventDefault();
|
|
3115
|
+
ListActions.indent(editor);
|
|
3116
|
+
}
|
|
3117
|
+
if (isHotkey("backspace", e)) {
|
|
3118
|
+
if (!editor.selection)
|
|
3119
|
+
return;
|
|
3120
|
+
if (Range.isExpanded(editor.selection))
|
|
3121
|
+
return;
|
|
3122
|
+
const listItem = EditorUtils.getFirstAncestorListItem(editor, editor.selection.anchor.path);
|
|
3123
|
+
if (editor.selection.anchor.offset === 0 && listItem) {
|
|
3124
|
+
e.preventDefault();
|
|
3125
|
+
const parentListItem = EditorUtils.getFirstAncestorListItem(editor, listItem[1]);
|
|
3126
|
+
const list = EditorUtils.getFirstAncestorList(editor, listItem[1]);
|
|
3127
|
+
if (parentListItem) {
|
|
3128
|
+
ListActions.dedent(editor);
|
|
3129
|
+
} else if (list) {
|
|
3130
|
+
ListActions.unwrapList(editor);
|
|
3131
|
+
}
|
|
3132
|
+
return;
|
|
3133
|
+
}
|
|
3134
|
+
}
|
|
3135
|
+
if (isHotkey("enter", e)) {
|
|
3136
|
+
e.preventDefault();
|
|
3137
|
+
if (!editor.selection)
|
|
3138
|
+
return;
|
|
3139
|
+
if (Range.isExpanded(editor.selection)) {
|
|
3140
|
+
Transforms.delete(editor);
|
|
3141
|
+
return;
|
|
3142
|
+
}
|
|
3143
|
+
const listItem = EditorUtils.getFirstAncestorListItem(editor, editor.selection.anchor.path);
|
|
3144
|
+
if (editor.selection.anchor.offset === 0 && listItem && Editor.string(editor, listItem[1]) === "") {
|
|
3145
|
+
const parentListItem = EditorUtils.getFirstAncestorListItem(editor, listItem[1]);
|
|
3146
|
+
if (parentListItem) {
|
|
3147
|
+
ListActions.dedent(editor);
|
|
3148
|
+
} else {
|
|
3149
|
+
ListActions.unwrapList(editor);
|
|
3150
|
+
}
|
|
3151
|
+
return;
|
|
3152
|
+
}
|
|
3153
|
+
Transforms.splitNodes(editor, {
|
|
3154
|
+
at: editor.selection,
|
|
3155
|
+
always: true,
|
|
3156
|
+
match: (node) => ElementUtils.isListItem(node)
|
|
3157
|
+
});
|
|
3158
|
+
}
|
|
3159
|
+
if (isHotkey("shift+enter", e)) {
|
|
3160
|
+
e.preventDefault();
|
|
3161
|
+
editor.insertText("\n");
|
|
3162
|
+
}
|
|
3163
|
+
}
|
|
3164
|
+
function withBlock(editor) {
|
|
3165
|
+
const {
|
|
3166
|
+
normalizeNode
|
|
3167
|
+
} = editor;
|
|
3168
|
+
editor.isInline = (entry) => {
|
|
3169
|
+
return ElementUtils.isInline(entry);
|
|
3170
|
+
};
|
|
3171
|
+
editor.normalizeNode = (entry) => {
|
|
3172
|
+
var _a2;
|
|
3173
|
+
const [normalizationNode, normalizationPath] = entry;
|
|
3174
|
+
if (ElementUtils.isBlock(normalizationNode) && ((_a2 = normalizationNode == null ? void 0 : normalizationNode.textAlign) == null ? void 0 : _a2.length) == 0) {
|
|
3175
|
+
Transforms.unsetNodes(editor, "textAlign", {
|
|
3176
|
+
at: normalizationPath
|
|
3177
|
+
});
|
|
3178
|
+
return;
|
|
3179
|
+
}
|
|
3180
|
+
if (ElementUtils.isListItem(normalizationNode)) {
|
|
3181
|
+
const pathToListItemText = [...normalizationPath, LIST_ITEM_CHILD_POSITION];
|
|
3182
|
+
if (Node.has(editor, pathToListItemText)) {
|
|
3183
|
+
const nodeInListItemTextPosition = Node.get(editor, pathToListItemText);
|
|
3184
|
+
if (ElementUtils.isRootBlock(nodeInListItemTextPosition)) {
|
|
3185
|
+
Transforms.setNodes(editor, {
|
|
3186
|
+
type: BlockType.ListItemChild
|
|
3187
|
+
}, {
|
|
3188
|
+
at: pathToListItemText
|
|
3189
|
+
});
|
|
3190
|
+
return;
|
|
3191
|
+
}
|
|
3192
|
+
} else {
|
|
3193
|
+
Transforms.insertNodes(editor, ElementUtils.createListItem(), {
|
|
3194
|
+
at: pathToListItemText
|
|
3195
|
+
});
|
|
3196
|
+
return;
|
|
3197
|
+
}
|
|
3198
|
+
}
|
|
3199
|
+
if (!Text.isText(normalizationNode)) {
|
|
3200
|
+
const mergeableChildren = Array.from(Node.children(editor, normalizationPath)).map((child, index, children) => {
|
|
3201
|
+
const potentialNodeToBeMerged = children.at(index + 1);
|
|
3202
|
+
if (!potentialNodeToBeMerged || !ElementUtils.isList(potentialNodeToBeMerged[0]) || !ElementUtils.isList(child[0]) || potentialNodeToBeMerged[0].type !== child[0].type) {
|
|
3203
|
+
return null;
|
|
3204
|
+
}
|
|
3205
|
+
return [Editor.pathRef(editor, child[1]), Editor.pathRef(editor, potentialNodeToBeMerged[1])];
|
|
3206
|
+
}).filter((mergeableNodes) => Boolean(mergeableNodes));
|
|
3207
|
+
if (mergeableChildren.length !== 0) {
|
|
3208
|
+
mergeableChildren.reverse().forEach(([nodePathRef, nodeToBeMergedPathRef]) => {
|
|
3209
|
+
const nodePath = nodePathRef.current;
|
|
3210
|
+
const nodeToBeMergedPath = nodeToBeMergedPathRef.current;
|
|
3211
|
+
if (nodePath == null || nodeToBeMergedPath == null)
|
|
3212
|
+
return;
|
|
3213
|
+
const nodeChildren = Array.from(Node.children(editor, nodePath));
|
|
3214
|
+
const childrenToBeMerged = Array.from(Node.children(editor, nodeToBeMergedPath));
|
|
3215
|
+
Editor.withoutNormalizing(editor, () => {
|
|
3216
|
+
childrenToBeMerged.reverse().forEach(([_, childPath]) => {
|
|
3217
|
+
Transforms.moveNodes(editor, {
|
|
3218
|
+
at: childPath,
|
|
3219
|
+
to: [...nodePath, nodeChildren.length]
|
|
3220
|
+
});
|
|
3221
|
+
});
|
|
3222
|
+
Transforms.removeNodes(editor, {
|
|
3223
|
+
at: nodeToBeMergedPath
|
|
3224
|
+
});
|
|
3225
|
+
});
|
|
3226
|
+
nodePathRef.unref();
|
|
3227
|
+
nodeToBeMergedPathRef.unref();
|
|
3228
|
+
});
|
|
3229
|
+
return;
|
|
3230
|
+
}
|
|
3231
|
+
}
|
|
3232
|
+
normalizeNode(entry);
|
|
3233
|
+
};
|
|
3234
|
+
return editor;
|
|
3235
|
+
}
|
|
3236
|
+
const definition = Select({
|
|
3237
|
+
label: "Block",
|
|
3238
|
+
labelOrientation: "horizontal",
|
|
3239
|
+
options: [{
|
|
3240
|
+
value: BlockType.Paragraph,
|
|
3241
|
+
label: "Paragraph"
|
|
3242
|
+
}, {
|
|
3243
|
+
value: BlockType.Heading1,
|
|
3244
|
+
label: "Heading 1"
|
|
3245
|
+
}, {
|
|
3246
|
+
value: BlockType.Heading2,
|
|
3247
|
+
label: "Heading 2"
|
|
3248
|
+
}, {
|
|
3249
|
+
value: BlockType.Heading3,
|
|
3250
|
+
label: "Heading 3"
|
|
3251
|
+
}, {
|
|
3252
|
+
value: BlockType.Heading4,
|
|
3253
|
+
label: "Heading 4"
|
|
3254
|
+
}, {
|
|
3255
|
+
value: BlockType.Heading5,
|
|
3256
|
+
label: "Heading 5"
|
|
3257
|
+
}, {
|
|
3258
|
+
value: BlockType.Heading6,
|
|
3259
|
+
label: "Heading 6"
|
|
3260
|
+
}, {
|
|
3261
|
+
value: BlockType.UnorderedList,
|
|
3262
|
+
label: "Bulleted list"
|
|
3263
|
+
}, {
|
|
3264
|
+
value: BlockType.OrderedList,
|
|
3265
|
+
label: "Numbered list"
|
|
3266
|
+
}, {
|
|
3267
|
+
value: BlockType.BlockQuote,
|
|
3268
|
+
label: "Quote"
|
|
3269
|
+
}],
|
|
3270
|
+
defaultValue: BlockType.Paragraph
|
|
3271
|
+
});
|
|
3272
|
+
function BlockPlugin() {
|
|
3273
|
+
return createRichTextV2Plugin({
|
|
3274
|
+
withPlugin: withBlock,
|
|
3275
|
+
onKeyDown,
|
|
3276
|
+
control: {
|
|
3277
|
+
definition,
|
|
3278
|
+
onChange: (editor, value) => {
|
|
3279
|
+
const activeBlockType = getActiveBlockType(editor);
|
|
3280
|
+
if (value === BlockType.UnorderedList || value === BlockType.OrderedList) {
|
|
3281
|
+
ListActions.toggleList(editor, {
|
|
3282
|
+
type: value,
|
|
3283
|
+
at: getSelection(editor)
|
|
3284
|
+
});
|
|
3285
|
+
} else if (activeBlockType === value) {
|
|
3286
|
+
Transforms.setNodes(editor, {
|
|
3287
|
+
type: BlockType.Default
|
|
3288
|
+
}, {
|
|
3289
|
+
at: getSelection(editor)
|
|
3290
|
+
});
|
|
3291
|
+
} else {
|
|
3292
|
+
ListActions.unwrapList(editor, {
|
|
3293
|
+
at: getSelection(editor)
|
|
3294
|
+
});
|
|
3295
|
+
Transforms.setNodes(editor, {
|
|
3296
|
+
type: value != null ? value : BlockType.Default
|
|
3297
|
+
}, {
|
|
3298
|
+
at: getSelection(editor)
|
|
3299
|
+
});
|
|
3300
|
+
}
|
|
3301
|
+
},
|
|
3302
|
+
getValue: (editor) => {
|
|
3303
|
+
const activeBlock = getActiveBlockType(editor);
|
|
3304
|
+
if (activeBlock === RootBlockType.Default)
|
|
3305
|
+
return void 0;
|
|
3306
|
+
return activeBlock;
|
|
3307
|
+
}
|
|
3308
|
+
},
|
|
3309
|
+
renderElement: (renderElement) => (props) => /* @__PURE__ */ jsx(BlockPluginComponent, __spreadProps(__spreadValues({}, props), {
|
|
3310
|
+
renderElement
|
|
3311
|
+
}))
|
|
3312
|
+
});
|
|
3313
|
+
}
|
|
3314
|
+
function BlockPluginComponent(_d) {
|
|
3315
|
+
var _e = _d, {
|
|
3316
|
+
renderElement
|
|
3317
|
+
} = _e, props = __objRest(_e, [
|
|
3318
|
+
"renderElement"
|
|
3319
|
+
]);
|
|
3320
|
+
const blockStyles = [useStyle({
|
|
3321
|
+
margin: 0
|
|
3322
|
+
}), props.element.className];
|
|
3323
|
+
const quoteStyles = useStyle({
|
|
3324
|
+
padding: "0.5em 10px",
|
|
3325
|
+
fontSize: "1.25em",
|
|
3326
|
+
fontWeight: "300",
|
|
3327
|
+
borderLeft: "5px solid rgba(0, 0, 0, 0.1)"
|
|
3328
|
+
});
|
|
3329
|
+
const unorderedListStyles = useStyle({
|
|
3330
|
+
listStylePosition: "inside",
|
|
3331
|
+
paddingInlineStart: "20px",
|
|
3332
|
+
listStyleType: "disc",
|
|
3333
|
+
ul: {
|
|
3334
|
+
listStyleType: "circle"
|
|
3335
|
+
},
|
|
3336
|
+
"ul ul": {
|
|
3337
|
+
listStyleType: "square"
|
|
3338
|
+
}
|
|
3339
|
+
});
|
|
3340
|
+
const orderedListStyles = useStyle({
|
|
3341
|
+
listStylePosition: "inside",
|
|
3342
|
+
paddingInlineStart: "20px",
|
|
3343
|
+
listStyleType: "decimal"
|
|
3344
|
+
});
|
|
3345
|
+
switch (props.element.type) {
|
|
3346
|
+
case BlockType.Default:
|
|
3347
|
+
case BlockType.Paragraph:
|
|
3348
|
+
return /* @__PURE__ */ jsx("p", __spreadProps(__spreadValues({}, props.attributes), {
|
|
3349
|
+
className: cx(...blockStyles),
|
|
3350
|
+
children: renderElement(props)
|
|
3351
|
+
}));
|
|
3352
|
+
case BlockType.Heading1:
|
|
3353
|
+
return /* @__PURE__ */ jsx("h1", __spreadProps(__spreadValues({}, props.attributes), {
|
|
3354
|
+
className: cx(...blockStyles),
|
|
3355
|
+
children: renderElement(props)
|
|
3356
|
+
}));
|
|
3357
|
+
case BlockType.Heading2:
|
|
3358
|
+
return /* @__PURE__ */ jsx("h2", __spreadProps(__spreadValues({}, props.attributes), {
|
|
3359
|
+
className: cx(...blockStyles),
|
|
3360
|
+
children: renderElement(props)
|
|
3361
|
+
}));
|
|
3362
|
+
case BlockType.Heading3:
|
|
3363
|
+
return /* @__PURE__ */ jsx("h3", __spreadProps(__spreadValues({}, props.attributes), {
|
|
3364
|
+
className: cx(...blockStyles),
|
|
3365
|
+
children: renderElement(props)
|
|
3366
|
+
}));
|
|
3367
|
+
case BlockType.Heading4:
|
|
3368
|
+
return /* @__PURE__ */ jsx("h4", __spreadProps(__spreadValues({}, props.attributes), {
|
|
3369
|
+
className: cx(...blockStyles),
|
|
3370
|
+
children: renderElement(props)
|
|
3371
|
+
}));
|
|
3372
|
+
case BlockType.Heading5:
|
|
3373
|
+
return /* @__PURE__ */ jsx("h5", __spreadProps(__spreadValues({}, props.attributes), {
|
|
3374
|
+
className: cx(...blockStyles),
|
|
3375
|
+
children: renderElement(props)
|
|
3376
|
+
}));
|
|
3377
|
+
case BlockType.Heading6:
|
|
3378
|
+
return /* @__PURE__ */ jsx("h6", __spreadProps(__spreadValues({}, props.attributes), {
|
|
3379
|
+
className: cx(...blockStyles),
|
|
3380
|
+
children: renderElement(props)
|
|
3381
|
+
}));
|
|
3382
|
+
case BlockType.BlockQuote:
|
|
3383
|
+
return /* @__PURE__ */ jsx("blockquote", __spreadProps(__spreadValues({}, props.attributes), {
|
|
3384
|
+
className: cx(...blockStyles, quoteStyles),
|
|
3385
|
+
children: renderElement(props)
|
|
3386
|
+
}));
|
|
3387
|
+
case BlockType.OrderedList:
|
|
3388
|
+
return /* @__PURE__ */ jsx("ol", __spreadProps(__spreadValues({}, props.attributes), {
|
|
3389
|
+
className: cx(...blockStyles, orderedListStyles),
|
|
3390
|
+
children: renderElement(props)
|
|
3391
|
+
}));
|
|
3392
|
+
case BlockType.UnorderedList:
|
|
3393
|
+
return /* @__PURE__ */ jsx("ul", __spreadProps(__spreadValues({}, props.attributes), {
|
|
3394
|
+
className: cx(...blockStyles, unorderedListStyles),
|
|
3395
|
+
children: renderElement(props)
|
|
3396
|
+
}));
|
|
3397
|
+
case BlockType.ListItem:
|
|
3398
|
+
return /* @__PURE__ */ jsx("li", __spreadProps(__spreadValues({}, props.attributes), {
|
|
3399
|
+
className: cx(...blockStyles),
|
|
3400
|
+
children: renderElement(props)
|
|
3401
|
+
}));
|
|
3402
|
+
case BlockType.ListItemChild:
|
|
3403
|
+
return /* @__PURE__ */ jsx("span", __spreadProps(__spreadValues({}, props.attributes), {
|
|
3404
|
+
className: cx(...blockStyles),
|
|
3405
|
+
children: renderElement(props)
|
|
3406
|
+
}));
|
|
3407
|
+
default:
|
|
3408
|
+
return /* @__PURE__ */ jsx(Fragment, {
|
|
3409
|
+
children: renderElement(props)
|
|
3410
|
+
});
|
|
3411
|
+
}
|
|
3412
|
+
}
|
|
3413
|
+
function clearActiveTypographyStyle(editor, options) {
|
|
3414
|
+
Editor.withoutNormalizing(editor, () => {
|
|
3415
|
+
var _a2;
|
|
3416
|
+
const at = (_a2 = options == null ? void 0 : options.at) != null ? _a2 : editor.selection;
|
|
3417
|
+
if (!at)
|
|
3418
|
+
return;
|
|
3419
|
+
const atRef = Editor.rangeRef(editor, at);
|
|
3420
|
+
if (atRef.current) {
|
|
3421
|
+
Transforms.setNodes(editor, {
|
|
3422
|
+
slice: true
|
|
3423
|
+
}, {
|
|
3424
|
+
at: atRef.current,
|
|
3425
|
+
match: (node) => Text.isText(node),
|
|
3426
|
+
split: Range.isExpanded(atRef.current)
|
|
3427
|
+
});
|
|
3428
|
+
}
|
|
3429
|
+
if (atRef.current) {
|
|
3430
|
+
const textNodes = Array.from(Editor.nodes(editor, {
|
|
3431
|
+
at: atRef.current,
|
|
3432
|
+
match: (node) => Text.isText(node) && node.slice === true
|
|
3433
|
+
}));
|
|
3434
|
+
for (const [node, path] of textNodes) {
|
|
3435
|
+
if (Text.isText(node)) {
|
|
3436
|
+
const typography = __spreadProps(__spreadValues({}, node.typography), {
|
|
3437
|
+
style: []
|
|
3438
|
+
});
|
|
3439
|
+
Transforms.setNodes(editor, {
|
|
3440
|
+
typography
|
|
3441
|
+
}, { at: path });
|
|
3442
|
+
}
|
|
3443
|
+
}
|
|
3444
|
+
}
|
|
3445
|
+
atRef.unref();
|
|
3446
|
+
});
|
|
3447
|
+
}
|
|
3448
|
+
function clearDeviceActiveTypography(editor, currentDeviceId, options) {
|
|
3449
|
+
Editor.withoutNormalizing(editor, () => {
|
|
3450
|
+
var _a2, _b, _c;
|
|
3451
|
+
const at = (_a2 = options == null ? void 0 : options.at) != null ? _a2 : editor.selection;
|
|
3452
|
+
if (!at)
|
|
3453
|
+
return;
|
|
3454
|
+
const atRef = Editor.rangeRef(editor, at);
|
|
3455
|
+
if (atRef.current) {
|
|
3456
|
+
Transforms.setNodes(editor, {
|
|
3457
|
+
slice: true
|
|
3458
|
+
}, {
|
|
3459
|
+
at: atRef.current,
|
|
3460
|
+
match: (node) => Text.isText(node),
|
|
3461
|
+
split: Range.isExpanded(atRef.current)
|
|
3462
|
+
});
|
|
3463
|
+
}
|
|
3464
|
+
if (atRef.current) {
|
|
3465
|
+
const textNodes = Array.from(Editor.nodes(editor, {
|
|
3466
|
+
at: atRef.current,
|
|
3467
|
+
match: (node) => Text.isText(node) && node.slice === true
|
|
3468
|
+
}));
|
|
3469
|
+
for (const [node, path] of textNodes) {
|
|
3470
|
+
if (Text.isText(node)) {
|
|
3471
|
+
const typography = __spreadProps(__spreadValues({}, node.typography), {
|
|
3472
|
+
style: (_c = (_b = node == null ? void 0 : node.typography) == null ? void 0 : _b.style.filter(({ deviceId }) => deviceId !== currentDeviceId)) != null ? _c : []
|
|
3473
|
+
});
|
|
3474
|
+
Transforms.setNodes(editor, {
|
|
3475
|
+
typography
|
|
3476
|
+
}, { at: path });
|
|
3477
|
+
}
|
|
3478
|
+
}
|
|
3479
|
+
}
|
|
3480
|
+
atRef.unref();
|
|
3481
|
+
});
|
|
3482
|
+
}
|
|
3483
|
+
function detachActiveTypography(editor, value, options) {
|
|
3484
|
+
Editor.withoutNormalizing(editor, () => {
|
|
3485
|
+
var _a2;
|
|
3486
|
+
const at = (_a2 = options == null ? void 0 : options.at) != null ? _a2 : editor.selection;
|
|
3487
|
+
if (!at)
|
|
3488
|
+
return;
|
|
3489
|
+
const atRef = Editor.rangeRef(editor, at);
|
|
3490
|
+
if (atRef.current) {
|
|
3491
|
+
Transforms.setNodes(editor, {
|
|
3492
|
+
slice: true
|
|
3493
|
+
}, {
|
|
3494
|
+
at: atRef.current,
|
|
3495
|
+
match: (node) => Text.isText(node),
|
|
3496
|
+
split: Range.isExpanded(atRef.current)
|
|
3497
|
+
});
|
|
3498
|
+
}
|
|
3499
|
+
if (atRef.current) {
|
|
3500
|
+
const textNodes = Array.from(Editor.nodes(editor, {
|
|
3501
|
+
at: atRef.current,
|
|
3502
|
+
match: (node) => Text.isText(node) && node.slice === true
|
|
3503
|
+
}));
|
|
3504
|
+
for (const [node, path] of textNodes) {
|
|
3505
|
+
if (Text.isText(node)) {
|
|
3506
|
+
Transforms.setNodes(editor, {
|
|
3507
|
+
typography: {
|
|
3508
|
+
style: value
|
|
3509
|
+
}
|
|
3510
|
+
}, { at: path });
|
|
3511
|
+
}
|
|
3512
|
+
}
|
|
3513
|
+
}
|
|
3514
|
+
atRef.unref();
|
|
3515
|
+
});
|
|
2291
3516
|
}
|
|
2292
|
-
function
|
|
2293
|
-
|
|
3517
|
+
function setActiveTypographyId(editor, id, options) {
|
|
3518
|
+
var _a2;
|
|
3519
|
+
const at = (_a2 = options == null ? void 0 : options.at) != null ? _a2 : editor.selection;
|
|
3520
|
+
if (!at)
|
|
3521
|
+
return;
|
|
3522
|
+
Transforms.setNodes(editor, {
|
|
3523
|
+
typography: {
|
|
3524
|
+
id,
|
|
3525
|
+
style: []
|
|
3526
|
+
}
|
|
3527
|
+
}, {
|
|
3528
|
+
at,
|
|
3529
|
+
match: (node) => Text.isText(node),
|
|
3530
|
+
split: Range.isExpanded(at)
|
|
3531
|
+
});
|
|
2294
3532
|
}
|
|
3533
|
+
function setActiveTypographyStyle(editor, breakpoints, deviceId, prop, value, options) {
|
|
3534
|
+
Editor.withoutNormalizing(editor, () => {
|
|
3535
|
+
var _a2, _b, _c;
|
|
3536
|
+
const at = (_a2 = options == null ? void 0 : options.at) != null ? _a2 : editor.selection;
|
|
3537
|
+
if (!at)
|
|
3538
|
+
return;
|
|
3539
|
+
const atRef = Editor.rangeRef(editor, at);
|
|
3540
|
+
if (atRef.current) {
|
|
3541
|
+
Transforms.setNodes(editor, {
|
|
3542
|
+
slice: true
|
|
3543
|
+
}, {
|
|
3544
|
+
at: atRef.current,
|
|
3545
|
+
match: (node) => Text.isText(node),
|
|
3546
|
+
split: Range.isExpanded(atRef.current)
|
|
3547
|
+
});
|
|
3548
|
+
}
|
|
3549
|
+
if (atRef.current) {
|
|
3550
|
+
const textNodes = Array.from(Editor.nodes(editor, {
|
|
3551
|
+
at: atRef.current,
|
|
3552
|
+
match: (node) => Text.isText(node) && node.slice === true
|
|
3553
|
+
}));
|
|
3554
|
+
for (const [node, path] of textNodes) {
|
|
3555
|
+
if (Text.isText(node)) {
|
|
3556
|
+
const deviceOverrides = (_c = (_b = node == null ? void 0 : node.typography) == null ? void 0 : _b.style) != null ? _c : [];
|
|
3557
|
+
const deviceStyle = findBreakpointOverride(breakpoints, deviceOverrides, deviceId, (v) => v) || {
|
|
3558
|
+
value: {}
|
|
3559
|
+
};
|
|
3560
|
+
const nextDeviceStyle = {
|
|
3561
|
+
deviceId,
|
|
3562
|
+
value: __spreadProps(__spreadValues({}, deviceStyle.value), { [prop]: value })
|
|
3563
|
+
};
|
|
3564
|
+
const nextTypography = __spreadProps(__spreadValues({}, node.typography), {
|
|
3565
|
+
style: [...deviceOverrides.filter((v) => v.deviceId !== deviceId), nextDeviceStyle]
|
|
3566
|
+
});
|
|
3567
|
+
Transforms.setNodes(editor, {
|
|
3568
|
+
typography: nextTypography
|
|
3569
|
+
}, { at: path });
|
|
3570
|
+
}
|
|
3571
|
+
}
|
|
3572
|
+
}
|
|
3573
|
+
atRef.unref();
|
|
3574
|
+
});
|
|
3575
|
+
}
|
|
3576
|
+
function getValue(editor) {
|
|
3577
|
+
const matchingValues = Array.from(Editor.nodes(editor, {
|
|
3578
|
+
at: getSelection(editor),
|
|
3579
|
+
match: Text.isText
|
|
3580
|
+
})).map(([node]) => node["typography"]);
|
|
3581
|
+
return matchingValues;
|
|
3582
|
+
}
|
|
3583
|
+
const TypographyActions = {
|
|
3584
|
+
setActiveTypographyId,
|
|
3585
|
+
setActiveTypographyStyle,
|
|
3586
|
+
clearActiveTypographyStyle,
|
|
3587
|
+
clearDeviceActiveTypography,
|
|
3588
|
+
detachActiveTypography
|
|
3589
|
+
};
|
|
3590
|
+
const TYPOGRAPHY_KEY = "typography";
|
|
3591
|
+
function withTypography(editor) {
|
|
3592
|
+
const { normalizeNode } = editor;
|
|
3593
|
+
editor.normalizeNode = (entry) => {
|
|
3594
|
+
var _a2, _b;
|
|
3595
|
+
const [normalizationNode, normalizationPath] = entry;
|
|
3596
|
+
if (Text.isText(normalizationNode) && ((_a2 = normalizationNode == null ? void 0 : normalizationNode.typography) == null ? void 0 : _a2.id) == null && ((_b = normalizationNode == null ? void 0 : normalizationNode.typography) == null ? void 0 : _b.style.length) === 0) {
|
|
3597
|
+
Transforms.unsetNodes(editor, TYPOGRAPHY_KEY, { at: normalizationPath });
|
|
3598
|
+
return;
|
|
3599
|
+
}
|
|
3600
|
+
if (Text.isText(normalizationNode) && (normalizationNode == null ? void 0 : normalizationNode.slice) != null) {
|
|
3601
|
+
Transforms.unsetNodes(editor, "slice", { at: normalizationPath });
|
|
3602
|
+
return;
|
|
3603
|
+
}
|
|
3604
|
+
normalizeNode(entry);
|
|
3605
|
+
};
|
|
3606
|
+
return editor;
|
|
3607
|
+
}
|
|
3608
|
+
function TypographyPlugin() {
|
|
3609
|
+
return createRichTextV2Plugin({
|
|
3610
|
+
withPlugin: withTypography,
|
|
3611
|
+
control: {
|
|
3612
|
+
definition: unstable_Typography(),
|
|
3613
|
+
onChange: (editor, value) => {
|
|
3614
|
+
Editor.withoutNormalizing(editor, () => {
|
|
3615
|
+
const at = getSelection(editor);
|
|
3616
|
+
if (!at)
|
|
3617
|
+
return;
|
|
3618
|
+
const atRef = Editor.rangeRef(editor, at);
|
|
3619
|
+
if (atRef.current) {
|
|
3620
|
+
Transforms.setNodes(editor, {
|
|
3621
|
+
slice: true
|
|
3622
|
+
}, {
|
|
3623
|
+
at: atRef.current,
|
|
3624
|
+
match: Text.isText,
|
|
3625
|
+
split: true
|
|
3626
|
+
});
|
|
3627
|
+
}
|
|
3628
|
+
if (atRef.current) {
|
|
3629
|
+
const nodesToUpdate = Array.from(Editor.nodes(editor, {
|
|
3630
|
+
at: atRef.current,
|
|
3631
|
+
match: (node) => Text.isText(node) && node.slice === true
|
|
3632
|
+
}));
|
|
3633
|
+
if (nodesToUpdate.length !== (value == null ? void 0 : value.length))
|
|
3634
|
+
return console.error(`TypographyControl.onChange received the wrong number of arguments.
|
|
3635
|
+
Called with ${value == null ? void 0 : value.length} values mapping to ${nodesToUpdate.length} nodes.`);
|
|
3636
|
+
for (const [index, [, path]] of nodesToUpdate.entries()) {
|
|
3637
|
+
Transforms.setNodes(editor, {
|
|
3638
|
+
typography: value == null ? void 0 : value.at(index)
|
|
3639
|
+
}, { at: path, match: Text.isText });
|
|
3640
|
+
}
|
|
3641
|
+
}
|
|
3642
|
+
atRef.unref();
|
|
3643
|
+
});
|
|
3644
|
+
},
|
|
3645
|
+
getValue: (editor) => getValue(editor),
|
|
3646
|
+
getLeafValue: (text) => {
|
|
3647
|
+
return Text.isText(text) ? text.typography : void 0;
|
|
3648
|
+
}
|
|
3649
|
+
},
|
|
3650
|
+
renderLeaf: (renderLeaf, className) => (props) => {
|
|
3651
|
+
return renderLeaf(__spreadProps(__spreadValues({}, props), {
|
|
3652
|
+
leaf: __spreadProps(__spreadValues({}, props.leaf), {
|
|
3653
|
+
className: `${props.leaf.className} ${className}`
|
|
3654
|
+
})
|
|
3655
|
+
}));
|
|
3656
|
+
}
|
|
3657
|
+
});
|
|
3658
|
+
}
|
|
3659
|
+
const BLOCK_ONE_PATH = [0];
|
|
3660
|
+
const BLOCK_TWO_PATH = [1];
|
|
3661
|
+
function withInlineMode(editor) {
|
|
3662
|
+
const {
|
|
3663
|
+
normalizeNode
|
|
3664
|
+
} = editor;
|
|
3665
|
+
editor.normalizeNode = (entry) => {
|
|
3666
|
+
const [normalizationNode, normalizationPath] = entry;
|
|
3667
|
+
if (Path.equals(BLOCK_TWO_PATH, normalizationPath)) {
|
|
3668
|
+
Transforms.mergeNodes(editor, {
|
|
3669
|
+
at: BLOCK_TWO_PATH
|
|
3670
|
+
});
|
|
3671
|
+
return;
|
|
3672
|
+
}
|
|
3673
|
+
if (Path.isAncestor(BLOCK_ONE_PATH, normalizationPath) && ElementUtils.isBlock(normalizationNode)) {
|
|
3674
|
+
Transforms.unwrapNodes(editor, {
|
|
3675
|
+
at: normalizationPath
|
|
3676
|
+
});
|
|
3677
|
+
return;
|
|
3678
|
+
}
|
|
3679
|
+
if (Path.equals(BLOCK_ONE_PATH, normalizationPath)) {
|
|
3680
|
+
Transforms.setNodes(editor, {
|
|
3681
|
+
type: BlockType.Default
|
|
3682
|
+
}, {
|
|
3683
|
+
at: normalizationPath
|
|
3684
|
+
});
|
|
3685
|
+
return;
|
|
3686
|
+
}
|
|
3687
|
+
normalizeNode(entry);
|
|
3688
|
+
};
|
|
3689
|
+
return editor;
|
|
3690
|
+
}
|
|
3691
|
+
function InlineModePlugin() {
|
|
3692
|
+
return createRichTextV2Plugin({
|
|
3693
|
+
onKeyDown: (e) => {
|
|
3694
|
+
if (isHotkey("enter", e))
|
|
3695
|
+
e.preventDefault();
|
|
3696
|
+
},
|
|
3697
|
+
withPlugin: withInlineMode,
|
|
3698
|
+
renderElement: (renderElement) => (props) => /* @__PURE__ */ jsx(InlineModePluginComponent, __spreadProps(__spreadValues({}, props), {
|
|
3699
|
+
renderElement
|
|
3700
|
+
}))
|
|
3701
|
+
});
|
|
3702
|
+
}
|
|
3703
|
+
function InlineModePluginComponent(_f) {
|
|
3704
|
+
var _g = _f, {
|
|
3705
|
+
renderElement
|
|
3706
|
+
} = _g, props = __objRest(_g, [
|
|
3707
|
+
"renderElement"
|
|
3708
|
+
]);
|
|
3709
|
+
return /* @__PURE__ */ jsx("span", __spreadProps(__spreadValues({}, props.attributes), {
|
|
3710
|
+
children: renderElement(props)
|
|
3711
|
+
}));
|
|
3712
|
+
}
|
|
3713
|
+
const RichTextV2ControlType = "makeswift::controls::rich-text-v2";
|
|
3714
|
+
const RichTextV2Mode = {
|
|
3715
|
+
Inline: "makeswift::controls::rich-text-v2::mode::inline",
|
|
3716
|
+
Block: "makeswift::controls::rich-text-v2::mode::block"
|
|
3717
|
+
};
|
|
3718
|
+
function RichText(config = {}) {
|
|
3719
|
+
return {
|
|
3720
|
+
type: RichTextV2ControlType,
|
|
3721
|
+
config: {
|
|
3722
|
+
mode: config.mode,
|
|
3723
|
+
defaultValue: config == null ? void 0 : config.unstable_defaultValue,
|
|
3724
|
+
plugins: (config == null ? void 0 : config.mode) === RichTextV2Mode.Inline ? [InlineModePlugin()] : [BlockPlugin(), TypographyPlugin(), TextAlignPlugin(), InlinePlugin(), LinkPlugin()]
|
|
3725
|
+
}
|
|
3726
|
+
};
|
|
3727
|
+
}
|
|
3728
|
+
RichText.Mode = RichTextV2Mode;
|
|
2295
3729
|
const RichTextV2ControlMessageType = {
|
|
2296
3730
|
RESET_VALUE: "makeswift::controls::rich-text-v2::control-message::reset-value",
|
|
2297
3731
|
FOCUS: "makeswift::controls::rich-text-v2::control-message::focus",
|
|
@@ -2301,7 +3735,9 @@ const RichTextV2ControlMessageType = {
|
|
|
2301
3735
|
ON_CHANGE: "makeswift::controls::rich-text-v2::control-message::on-change",
|
|
2302
3736
|
SELECT: "makeswift::controls::rich-text-v2::control-message::select",
|
|
2303
3737
|
SWITCH_TO_BUILD_MODE: "makeswift::controls::rich-text-v2::control-message::switch-to-build-mode",
|
|
2304
|
-
CHANGE_BOX_MODEL: "makeswift::controls::rich-text-v2::control-message::change-box-model"
|
|
3738
|
+
CHANGE_BOX_MODEL: "makeswift::controls::rich-text-v2::control-message::change-box-model",
|
|
3739
|
+
REDO: "makeswift::controls::rich-text-v2::control-message::redo",
|
|
3740
|
+
UNDO: "makeswift::controls::rich-text-v2::control-message::undo"
|
|
2305
3741
|
};
|
|
2306
3742
|
class RichTextV2Control extends PropController {
|
|
2307
3743
|
constructor(send, descriptor) {
|
|
@@ -2321,8 +3757,9 @@ class RichTextV2Control extends PropController {
|
|
|
2321
3757
|
case RichTextV2ControlMessageType.RESET_VALUE: {
|
|
2322
3758
|
if (this.defaultValue) {
|
|
2323
3759
|
this.editor.selection = null;
|
|
2324
|
-
this.editor.children = this.defaultValue
|
|
3760
|
+
this.editor.children = this.defaultValue;
|
|
2325
3761
|
this.editor.onChange();
|
|
3762
|
+
this.onLocalUserChange();
|
|
2326
3763
|
}
|
|
2327
3764
|
break;
|
|
2328
3765
|
}
|
|
@@ -2345,29 +3782,35 @@ class RichTextV2Control extends PropController {
|
|
|
2345
3782
|
return (_a3 = plugin == null ? void 0 : plugin.control) == null ? void 0 : _a3.getValue(editor);
|
|
2346
3783
|
})) != null ? _c : []
|
|
2347
3784
|
});
|
|
3785
|
+
const _onChange = editor.onChange;
|
|
3786
|
+
this.editor.onChange = (options) => {
|
|
3787
|
+
_onChange(options);
|
|
3788
|
+
this.updatePluginValues();
|
|
3789
|
+
if (this.editor == null || (options == null ? void 0 : options.operation) == null)
|
|
3790
|
+
return;
|
|
3791
|
+
this.onLocalUserChange();
|
|
3792
|
+
};
|
|
2348
3793
|
}
|
|
2349
3794
|
setDefaultValue(defaultValue) {
|
|
2350
|
-
this.defaultValue =
|
|
3795
|
+
this.defaultValue = defaultValue;
|
|
2351
3796
|
this.send({
|
|
2352
3797
|
type: RichTextV2ControlMessageType.SET_DEFAULT_VALUE,
|
|
2353
|
-
value:
|
|
3798
|
+
value: defaultValue
|
|
2354
3799
|
});
|
|
2355
3800
|
}
|
|
2356
|
-
|
|
2357
|
-
this.
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
3801
|
+
onLocalUserChange() {
|
|
3802
|
+
if (this.editor == null)
|
|
3803
|
+
return;
|
|
3804
|
+
this.send({
|
|
3805
|
+
type: RichTextV2ControlMessageType.ON_CHANGE,
|
|
3806
|
+
value: richTextV2DescendentsToData(this.editor.children, this.editor.currentKey)
|
|
3807
|
+
});
|
|
2361
3808
|
}
|
|
2362
|
-
|
|
3809
|
+
updatePluginValues() {
|
|
2363
3810
|
var _a2, _b, _c;
|
|
2364
3811
|
const editor = this.editor;
|
|
2365
3812
|
if (editor == null)
|
|
2366
3813
|
return;
|
|
2367
|
-
this.send({
|
|
2368
|
-
type: RichTextV2ControlMessageType.ON_CHANGE,
|
|
2369
|
-
value: richTextV2DescendentsToData(value)
|
|
2370
|
-
});
|
|
2371
3814
|
this.send({
|
|
2372
3815
|
type: RichTextV2ControlMessageType.SET_PLUGIN_CONTROL_VALUE,
|
|
2373
3816
|
value: (_c = (_b = (_a2 = this.descriptor.config) == null ? void 0 : _a2.plugins) == null ? void 0 : _b.map((plugin) => {
|
|
@@ -2376,15 +3819,167 @@ class RichTextV2Control extends PropController {
|
|
|
2376
3819
|
})) != null ? _c : []
|
|
2377
3820
|
});
|
|
2378
3821
|
}
|
|
3822
|
+
select() {
|
|
3823
|
+
this.send({ type: RichTextV2ControlMessageType.SELECT });
|
|
3824
|
+
}
|
|
3825
|
+
switchToBuildMode() {
|
|
3826
|
+
this.send({ type: RichTextV2ControlMessageType.SWITCH_TO_BUILD_MODE });
|
|
3827
|
+
}
|
|
3828
|
+
undo() {
|
|
3829
|
+
this.send({ type: RichTextV2ControlMessageType.UNDO });
|
|
3830
|
+
}
|
|
3831
|
+
redo() {
|
|
3832
|
+
this.send({ type: RichTextV2ControlMessageType.REDO });
|
|
3833
|
+
}
|
|
2379
3834
|
changeBoxModel(boxModel) {
|
|
2380
3835
|
this.send({ type: RichTextV2ControlMessageType.CHANGE_BOX_MODEL, payload: { boxModel } });
|
|
2381
3836
|
}
|
|
2382
3837
|
}
|
|
2383
3838
|
function isRichTextV1Data(value) {
|
|
2384
|
-
return value !== void 0 && typeof value === "object" && !Array.isArray(value) && "
|
|
3839
|
+
return value !== void 0 && typeof value === "object" && !Array.isArray(value) && "document" in value;
|
|
2385
3840
|
}
|
|
2386
|
-
|
|
2387
|
-
|
|
3841
|
+
const TypographyControlType = "makeswift::controls::typography";
|
|
3842
|
+
function unstable_Typography() {
|
|
3843
|
+
return {
|
|
3844
|
+
type: TypographyControlType
|
|
3845
|
+
};
|
|
3846
|
+
}
|
|
3847
|
+
function getTypographySwatchIds(value) {
|
|
3848
|
+
var _a2;
|
|
3849
|
+
return (_a2 = value == null ? void 0 : value.style.flatMap((style) => {
|
|
3850
|
+
var _a3, _b;
|
|
3851
|
+
return (_b = (_a3 = style.value.color) == null ? void 0 : _a3.swatchId) != null ? _b : [];
|
|
3852
|
+
}).filter(isNonNullable)) != null ? _a2 : [];
|
|
3853
|
+
}
|
|
3854
|
+
function getTypographyTypographyIds(value) {
|
|
3855
|
+
return [value == null ? void 0 : value.id].filter(isNonNullable);
|
|
3856
|
+
}
|
|
3857
|
+
function getRichTextSwatchIds(value) {
|
|
3858
|
+
if (value == null || value.document == null)
|
|
3859
|
+
return [];
|
|
3860
|
+
return getNodeSwatchIds(value.document);
|
|
3861
|
+
function getNodeSwatchIds(node) {
|
|
3862
|
+
var _a2, _b, _c, _d;
|
|
3863
|
+
switch (node.object) {
|
|
3864
|
+
case "document":
|
|
3865
|
+
case "block":
|
|
3866
|
+
case "inline":
|
|
3867
|
+
return (_b = (_a2 = node.nodes) == null ? void 0 : _a2.flatMap(getNodeSwatchIds)) != null ? _b : [];
|
|
3868
|
+
case "text":
|
|
3869
|
+
return (_d = (_c = node.marks) == null ? void 0 : _c.flatMap(getMarkSwatchIds)) != null ? _d : [];
|
|
3870
|
+
default:
|
|
3871
|
+
return [];
|
|
3872
|
+
}
|
|
3873
|
+
}
|
|
3874
|
+
function getTypographyStyleSwatchIds(style) {
|
|
3875
|
+
var _a2;
|
|
3876
|
+
return (_a2 = style == null ? void 0 : style.map((override) => override.value).flatMap((typographyStyle) => {
|
|
3877
|
+
var _a3;
|
|
3878
|
+
return (_a3 = typographyStyle.color) == null ? void 0 : _a3.swatchId;
|
|
3879
|
+
}).filter(isNonNullable)) != null ? _a2 : [];
|
|
3880
|
+
}
|
|
3881
|
+
function getMarkSwatchIds(mark) {
|
|
3882
|
+
var _a2, _b;
|
|
3883
|
+
return getTypographyStyleSwatchIds((_b = (_a2 = mark.data) == null ? void 0 : _a2.value) == null ? void 0 : _b.style);
|
|
3884
|
+
}
|
|
3885
|
+
}
|
|
3886
|
+
function getRichTextTypographyIds(value) {
|
|
3887
|
+
if (value == null || value.document == null)
|
|
3888
|
+
return [];
|
|
3889
|
+
return getNodeSwatchIds(value.document);
|
|
3890
|
+
function getNodeSwatchIds(node) {
|
|
3891
|
+
var _a2, _b, _c, _d;
|
|
3892
|
+
switch (node.object) {
|
|
3893
|
+
case "document":
|
|
3894
|
+
case "block":
|
|
3895
|
+
case "inline":
|
|
3896
|
+
return (_b = (_a2 = node.nodes) == null ? void 0 : _a2.flatMap(getNodeSwatchIds)) != null ? _b : [];
|
|
3897
|
+
case "text":
|
|
3898
|
+
return (_d = (_c = node.marks) == null ? void 0 : _c.flatMap(getMarkSwatchIds)) != null ? _d : [];
|
|
3899
|
+
default:
|
|
3900
|
+
return [];
|
|
3901
|
+
}
|
|
3902
|
+
}
|
|
3903
|
+
function getMarkSwatchIds(mark) {
|
|
3904
|
+
var _a2, _b;
|
|
3905
|
+
return [(_b = (_a2 = mark.data) == null ? void 0 : _a2.value) == null ? void 0 : _b.id].filter(isNonNullable);
|
|
3906
|
+
}
|
|
3907
|
+
}
|
|
3908
|
+
function getRichTextPageIds(value) {
|
|
3909
|
+
if (value == null || value.document == null)
|
|
3910
|
+
return [];
|
|
3911
|
+
return getNodePageIds(value.document);
|
|
3912
|
+
function getNodePageIds(node) {
|
|
3913
|
+
var _a2, _b;
|
|
3914
|
+
switch (node.object) {
|
|
3915
|
+
case "document":
|
|
3916
|
+
case "block":
|
|
3917
|
+
return (_b = (_a2 = node.nodes) == null ? void 0 : _a2.flatMap(getNodePageIds)) != null ? _b : [];
|
|
3918
|
+
case "inline":
|
|
3919
|
+
return getInlinePageIds(node);
|
|
3920
|
+
default:
|
|
3921
|
+
return [];
|
|
3922
|
+
}
|
|
3923
|
+
}
|
|
3924
|
+
function getInlinePageIds(inline) {
|
|
3925
|
+
var _a2, _b, _c, _d;
|
|
3926
|
+
switch (inline.type) {
|
|
3927
|
+
case "link": {
|
|
3928
|
+
const nodePageIds = (_b = (_a2 = inline.nodes) == null ? void 0 : _a2.flatMap(getNodePageIds)) != null ? _b : [];
|
|
3929
|
+
const dataPageIds = inline.data ? getLinkDataPageIds(inline.data) : [];
|
|
3930
|
+
return [...nodePageIds, ...dataPageIds];
|
|
3931
|
+
}
|
|
3932
|
+
default:
|
|
3933
|
+
return (_d = (_c = inline.nodes) == null ? void 0 : _c.flatMap(getNodePageIds)) != null ? _d : [];
|
|
3934
|
+
}
|
|
3935
|
+
}
|
|
3936
|
+
function getLinkDataPageIds(link) {
|
|
3937
|
+
switch (link.type) {
|
|
3938
|
+
case "OPEN_PAGE":
|
|
3939
|
+
return link.payload.pageId == null ? [] : [link.payload.pageId];
|
|
3940
|
+
default:
|
|
3941
|
+
return [];
|
|
3942
|
+
}
|
|
3943
|
+
}
|
|
3944
|
+
}
|
|
3945
|
+
function introspectRichTextV2Data(definition2, data, func) {
|
|
3946
|
+
const plugins = definition2.config.plugins;
|
|
3947
|
+
return data.descendants.flatMap((d) => getDescendantTypographyIds(d));
|
|
3948
|
+
function getDescendantTypographyIds(descendant) {
|
|
3949
|
+
if (Element.isElement(descendant)) {
|
|
3950
|
+
return [
|
|
3951
|
+
...getElementTypographyIds(descendant),
|
|
3952
|
+
...descendant.children.flatMap((d) => getDescendantTypographyIds(d))
|
|
3953
|
+
];
|
|
3954
|
+
}
|
|
3955
|
+
if (Text.isText(descendant)) {
|
|
3956
|
+
return getTextTypographyIds(descendant);
|
|
3957
|
+
}
|
|
3958
|
+
return [];
|
|
3959
|
+
}
|
|
3960
|
+
function getElementTypographyIds(descendant) {
|
|
3961
|
+
var _a2;
|
|
3962
|
+
return (_a2 = plugins == null ? void 0 : plugins.flatMap((plugin) => {
|
|
3963
|
+
var _a3;
|
|
3964
|
+
return ((_a3 = plugin.control) == null ? void 0 : _a3.definition) && plugin.control.getElementValue ? func(plugin.control.definition, plugin.control.getElementValue(descendant)) : [];
|
|
3965
|
+
})) != null ? _a2 : [];
|
|
3966
|
+
}
|
|
3967
|
+
function getTextTypographyIds(text) {
|
|
3968
|
+
var _a2;
|
|
3969
|
+
return (_a2 = plugins == null ? void 0 : plugins.flatMap((plugin) => {
|
|
3970
|
+
var _a3;
|
|
3971
|
+
return ((_a3 = plugin.control) == null ? void 0 : _a3.definition) && plugin.control.getLeafValue ? func(plugin.control.definition, plugin.control.getLeafValue(text)) : [];
|
|
3972
|
+
})) != null ? _a2 : [];
|
|
3973
|
+
}
|
|
3974
|
+
}
|
|
3975
|
+
function getRichTextV2SwatchIds(definition2, data) {
|
|
3976
|
+
return introspectRichTextV2Data(definition2, data, getSwatchIds);
|
|
3977
|
+
}
|
|
3978
|
+
function getRichTextV2TypographyIds(definition2, data) {
|
|
3979
|
+
return introspectRichTextV2Data(definition2, data, getTypographyIds);
|
|
3980
|
+
}
|
|
3981
|
+
function getRichTextV2PageIds(definition2, data) {
|
|
3982
|
+
return introspectRichTextV2Data(definition2, data, getPageIds);
|
|
2388
3983
|
}
|
|
2389
3984
|
function getElementChildren(descriptor, prop) {
|
|
2390
3985
|
if (prop == null)
|
|
@@ -2397,16 +3992,16 @@ function getElementChildren(descriptor, prop) {
|
|
|
2397
3992
|
case ListControlType:
|
|
2398
3993
|
return prop.flatMap(({ value }) => getElementChildren(descriptor.config.type, value));
|
|
2399
3994
|
case ShapeControlType: {
|
|
2400
|
-
return
|
|
3995
|
+
return getShapeElementChildren(descriptor, prop);
|
|
2401
3996
|
}
|
|
2402
3997
|
case ListControlType: {
|
|
2403
|
-
return
|
|
3998
|
+
return getListElementChildren(descriptor, prop);
|
|
2404
3999
|
}
|
|
2405
4000
|
case Types.Shape: {
|
|
2406
|
-
return
|
|
4001
|
+
return getShapePropControllerElementChildren(descriptor, prop);
|
|
2407
4002
|
}
|
|
2408
4003
|
case Types.List: {
|
|
2409
|
-
return
|
|
4004
|
+
return getListPropControllerElementChildren(descriptor, prop);
|
|
2410
4005
|
}
|
|
2411
4006
|
default:
|
|
2412
4007
|
return [];
|
|
@@ -2459,13 +4054,6 @@ function getResponsiveColorSwatchIds(value) {
|
|
|
2459
4054
|
var _a2;
|
|
2460
4055
|
return (_a2 = value == null ? void 0 : value.map((override) => override.value).map((color) => color.swatchId)) != null ? _a2 : [];
|
|
2461
4056
|
}
|
|
2462
|
-
function getTypographyStyleSwatchIds(style) {
|
|
2463
|
-
var _a2;
|
|
2464
|
-
return (_a2 = style == null ? void 0 : style.map((override) => override.value).flatMap((typographyStyle) => {
|
|
2465
|
-
var _a3;
|
|
2466
|
-
return (_a3 = typographyStyle.color) == null ? void 0 : _a3.swatchId;
|
|
2467
|
-
}).filter(isNonNullable)) != null ? _a2 : [];
|
|
2468
|
-
}
|
|
2469
4057
|
function getSwatchIds(descriptor, prop) {
|
|
2470
4058
|
var _a2, _b;
|
|
2471
4059
|
if (prop == null)
|
|
@@ -2493,78 +4081,38 @@ function getSwatchIds(descriptor, prop) {
|
|
|
2493
4081
|
return getResponsiveColorSwatchIds(prop);
|
|
2494
4082
|
case Types.Shadows:
|
|
2495
4083
|
return getBoxShadowsSwatchIds(prop);
|
|
4084
|
+
case RichTextControlType:
|
|
2496
4085
|
case Types.RichText: {
|
|
2497
|
-
|
|
2498
|
-
var _a3, _b2, _c, _d;
|
|
2499
|
-
switch (node.object) {
|
|
2500
|
-
case "document":
|
|
2501
|
-
case "block":
|
|
2502
|
-
case "inline":
|
|
2503
|
-
return (_b2 = (_a3 = node.nodes) == null ? void 0 : _a3.flatMap(getNodeSwatchIds)) != null ? _b2 : [];
|
|
2504
|
-
case "text":
|
|
2505
|
-
return (_d = (_c = node.marks) == null ? void 0 : _c.flatMap(getMarkSwatchIds)) != null ? _d : [];
|
|
2506
|
-
default:
|
|
2507
|
-
return [];
|
|
2508
|
-
}
|
|
2509
|
-
}, getMarkSwatchIds = function(mark) {
|
|
2510
|
-
var _a3, _b2;
|
|
2511
|
-
return getTypographyStyleSwatchIds((_b2 = (_a3 = mark.data) == null ? void 0 : _a3.value) == null ? void 0 : _b2.style);
|
|
2512
|
-
};
|
|
2513
|
-
const value = prop;
|
|
2514
|
-
if (value == null || value.document == null)
|
|
2515
|
-
return [];
|
|
2516
|
-
return getNodeSwatchIds(value.document);
|
|
4086
|
+
return getRichTextSwatchIds(prop);
|
|
2517
4087
|
}
|
|
2518
4088
|
case ColorControlType: {
|
|
2519
4089
|
const value = prop;
|
|
2520
4090
|
return (value == null ? void 0 : value.swatchId) == null ? [] : [value.swatchId];
|
|
2521
4091
|
}
|
|
4092
|
+
case TypographyControlType: {
|
|
4093
|
+
return getTypographySwatchIds(prop);
|
|
4094
|
+
}
|
|
2522
4095
|
case StyleV2ControlType: {
|
|
2523
4096
|
const value = prop;
|
|
2524
4097
|
return (_b = value == null ? void 0 : value.flatMap((value2) => getSwatchIds(descriptor.config.type, value2.value))) != null ? _b : [];
|
|
2525
4098
|
}
|
|
2526
4099
|
case RichTextV2ControlType: {
|
|
2527
|
-
let getDescendantSwatchIds = function(descendant) {
|
|
2528
|
-
if (Element.isElement(descendant)) {
|
|
2529
|
-
return [
|
|
2530
|
-
...getSlateElementSwatchIds(descendant),
|
|
2531
|
-
...descendant.children.flatMap((d) => getDescendantSwatchIds(d))
|
|
2532
|
-
];
|
|
2533
|
-
}
|
|
2534
|
-
if (Text.isText(descendant)) {
|
|
2535
|
-
return getTextSwatchIds(descendant);
|
|
2536
|
-
}
|
|
2537
|
-
return [];
|
|
2538
|
-
}, getSlateElementSwatchIds = function(descendant) {
|
|
2539
|
-
var _a3;
|
|
2540
|
-
return (_a3 = plugins == null ? void 0 : plugins.flatMap((plugin) => {
|
|
2541
|
-
var _a4;
|
|
2542
|
-
return ((_a4 = plugin.control) == null ? void 0 : _a4.definition) && plugin.control.getElementValue ? getSwatchIds(plugin.control.definition, plugin.control.getElementValue(descendant)) : [];
|
|
2543
|
-
})) != null ? _a3 : [];
|
|
2544
|
-
}, getTextSwatchIds = function(text) {
|
|
2545
|
-
var _a3;
|
|
2546
|
-
return (_a3 = plugins == null ? void 0 : plugins.flatMap((plugin) => {
|
|
2547
|
-
var _a4;
|
|
2548
|
-
return ((_a4 = plugin.control) == null ? void 0 : _a4.definition) && plugin.control.getLeafValue ? getSwatchIds(plugin.control.definition, plugin.control.getLeafValue(text)) : [];
|
|
2549
|
-
})) != null ? _a3 : [];
|
|
2550
|
-
};
|
|
2551
4100
|
const data = prop;
|
|
2552
|
-
const plugins = descriptor.config.plugins;
|
|
2553
4101
|
if (isRichTextV1Data(data))
|
|
2554
|
-
return
|
|
2555
|
-
return
|
|
4102
|
+
return getRichTextSwatchIds(data);
|
|
4103
|
+
return getRichTextV2SwatchIds(descriptor, data);
|
|
2556
4104
|
}
|
|
2557
4105
|
case ShapeControlType: {
|
|
2558
|
-
return
|
|
4106
|
+
return getShapeSwatchIds(descriptor, prop);
|
|
2559
4107
|
}
|
|
2560
4108
|
case ListControlType: {
|
|
2561
|
-
return
|
|
4109
|
+
return getListSwatchIds(descriptor, prop);
|
|
2562
4110
|
}
|
|
2563
4111
|
case Types.Shape: {
|
|
2564
|
-
return
|
|
4112
|
+
return getShapePropControllerSwatchIds(descriptor, prop);
|
|
2565
4113
|
}
|
|
2566
4114
|
case Types.List: {
|
|
2567
|
-
return
|
|
4115
|
+
return getListPropControllerSwatchIds(descriptor, prop);
|
|
2568
4116
|
}
|
|
2569
4117
|
default:
|
|
2570
4118
|
return [];
|
|
@@ -2601,16 +4149,16 @@ function getFileIds(descriptor, prop) {
|
|
|
2601
4149
|
return value == null ? [] : [value];
|
|
2602
4150
|
}
|
|
2603
4151
|
case ShapeControlType: {
|
|
2604
|
-
return
|
|
4152
|
+
return getShapeFileIds(descriptor, prop);
|
|
2605
4153
|
}
|
|
2606
4154
|
case ListControlType: {
|
|
2607
|
-
return
|
|
4155
|
+
return getListFileIds(descriptor, prop);
|
|
2608
4156
|
}
|
|
2609
4157
|
case Types.Shape: {
|
|
2610
|
-
return
|
|
4158
|
+
return getShapePropControllerFileIds(descriptor, prop);
|
|
2611
4159
|
}
|
|
2612
4160
|
case Types.List: {
|
|
2613
|
-
return
|
|
4161
|
+
return getListPropControllerFileIds(descriptor, prop);
|
|
2614
4162
|
}
|
|
2615
4163
|
default:
|
|
2616
4164
|
return [];
|
|
@@ -2620,39 +4168,30 @@ function getTypographyIds(descriptor, prop) {
|
|
|
2620
4168
|
if (prop == null)
|
|
2621
4169
|
return [];
|
|
2622
4170
|
switch (descriptor.type) {
|
|
4171
|
+
case TypographyControlType: {
|
|
4172
|
+
return getTypographyTypographyIds(prop);
|
|
4173
|
+
}
|
|
4174
|
+
case RichTextControlType:
|
|
2623
4175
|
case Types.RichText: {
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
case "text":
|
|
2632
|
-
return (_d = (_c = node.marks) == null ? void 0 : _c.flatMap(getMarkTypographyIds)) != null ? _d : [];
|
|
2633
|
-
default:
|
|
2634
|
-
return [];
|
|
2635
|
-
}
|
|
2636
|
-
}, getMarkTypographyIds = function(mark) {
|
|
2637
|
-
var _a2, _b;
|
|
2638
|
-
return [(_b = (_a2 = mark.data) == null ? void 0 : _a2.value) == null ? void 0 : _b.id].filter((id) => id != null);
|
|
2639
|
-
};
|
|
2640
|
-
const value = prop;
|
|
2641
|
-
if (value == null || value.document == null)
|
|
2642
|
-
return [];
|
|
2643
|
-
return getNodeTypographyIds(value.document);
|
|
4176
|
+
return getRichTextTypographyIds(prop);
|
|
4177
|
+
}
|
|
4178
|
+
case RichTextV2ControlType: {
|
|
4179
|
+
const data = prop;
|
|
4180
|
+
if (isRichTextV1Data(data))
|
|
4181
|
+
return getRichTextTypographyIds(data);
|
|
4182
|
+
return getRichTextV2TypographyIds(descriptor, data);
|
|
2644
4183
|
}
|
|
2645
4184
|
case ShapeControlType: {
|
|
2646
|
-
return
|
|
4185
|
+
return getShapeTypographyIds(descriptor, prop);
|
|
2647
4186
|
}
|
|
2648
4187
|
case ListControlType: {
|
|
2649
|
-
return
|
|
4188
|
+
return getListTypographyIds(descriptor, prop);
|
|
2650
4189
|
}
|
|
2651
4190
|
case Types.Shape: {
|
|
2652
|
-
return
|
|
4191
|
+
return getShapePropControllerTypographyIds(descriptor, prop);
|
|
2653
4192
|
}
|
|
2654
4193
|
case Types.List: {
|
|
2655
|
-
return
|
|
4194
|
+
return getListPropControllerTypographyIds(descriptor, prop);
|
|
2656
4195
|
}
|
|
2657
4196
|
default:
|
|
2658
4197
|
return [];
|
|
@@ -2729,53 +4268,27 @@ function getPageIds(descriptor, prop) {
|
|
|
2729
4268
|
}
|
|
2730
4269
|
})) != null ? _a2 : [];
|
|
2731
4270
|
}
|
|
4271
|
+
case RichTextControlType:
|
|
2732
4272
|
case Types.RichText: {
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
return getInlinePageIds(node);
|
|
2741
|
-
default:
|
|
2742
|
-
return [];
|
|
2743
|
-
}
|
|
2744
|
-
}, getInlinePageIds = function(inline) {
|
|
2745
|
-
var _a3, _b, _c, _d;
|
|
2746
|
-
switch (inline.type) {
|
|
2747
|
-
case "link": {
|
|
2748
|
-
const nodePageIds = (_b = (_a3 = inline.nodes) == null ? void 0 : _a3.flatMap(getNodePageIds)) != null ? _b : [];
|
|
2749
|
-
const dataPageIds = inline.data ? getLinkDataPageIds(inline.data) : [];
|
|
2750
|
-
return [...nodePageIds, ...dataPageIds];
|
|
2751
|
-
}
|
|
2752
|
-
default:
|
|
2753
|
-
return (_d = (_c = inline.nodes) == null ? void 0 : _c.flatMap(getNodePageIds)) != null ? _d : [];
|
|
2754
|
-
}
|
|
2755
|
-
}, getLinkDataPageIds = function(link) {
|
|
2756
|
-
switch (link.type) {
|
|
2757
|
-
case "OPEN_PAGE":
|
|
2758
|
-
return link.payload.pageId == null ? [] : [link.payload.pageId];
|
|
2759
|
-
default:
|
|
2760
|
-
return [];
|
|
2761
|
-
}
|
|
2762
|
-
};
|
|
2763
|
-
const value = prop;
|
|
2764
|
-
if (value == null || value.document == null)
|
|
2765
|
-
return [];
|
|
2766
|
-
return getNodePageIds(value.document);
|
|
4273
|
+
return getRichTextPageIds(prop);
|
|
4274
|
+
}
|
|
4275
|
+
case RichTextV2ControlType: {
|
|
4276
|
+
const data = prop;
|
|
4277
|
+
if (isRichTextV1Data(data))
|
|
4278
|
+
return getRichTextPageIds(data);
|
|
4279
|
+
return getRichTextV2PageIds(descriptor, data);
|
|
2767
4280
|
}
|
|
2768
4281
|
case ShapeControlType: {
|
|
2769
|
-
return
|
|
4282
|
+
return getShapePageIds(descriptor, prop);
|
|
2770
4283
|
}
|
|
2771
4284
|
case ListControlType: {
|
|
2772
|
-
return
|
|
4285
|
+
return getListPageIds(descriptor, prop);
|
|
2773
4286
|
}
|
|
2774
4287
|
case Types.Shape: {
|
|
2775
|
-
return
|
|
4288
|
+
return getShapePropControllerPageIds(descriptor, prop);
|
|
2776
4289
|
}
|
|
2777
4290
|
case Types.List: {
|
|
2778
|
-
return
|
|
4291
|
+
return getListPropControllerPageIds(descriptor, prop);
|
|
2779
4292
|
}
|
|
2780
4293
|
default:
|
|
2781
4294
|
return [];
|
|
@@ -2789,7 +4302,6 @@ var introspection = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
|
|
|
2789
4302
|
getBorderSwatchIds,
|
|
2790
4303
|
getBoxShadowsSwatchIds,
|
|
2791
4304
|
getResponsiveColorSwatchIds,
|
|
2792
|
-
getTypographyStyleSwatchIds,
|
|
2793
4305
|
getSwatchIds,
|
|
2794
4306
|
getBackgroundsFileIds,
|
|
2795
4307
|
getFileIds,
|
|
@@ -2968,5 +4480,5 @@ function configureStore({
|
|
|
2968
4480
|
locales: getInitialState(locales != null ? locales : preloadedState == null ? void 0 : preloadedState.locales)
|
|
2969
4481
|
}), applyMiddleware(thunk));
|
|
2970
4482
|
}
|
|
2971
|
-
export {
|
|
4483
|
+
export { getBorderSwatchIds as $, ResponsiveLength as A, Backgrounds as B, ComponentIcon as C, Date as D, ElementID as E, Font as F, GapY as G, TextArea as H, Images as I, Table as J, TableFormFields as K, Link$1 as L, Margin as M, Number as N, Image$1 as O, Padding as P, ResponsiveOpacity as Q, RichTextPropControllerMessageType as R, Shadows as S, TableFormFieldsMessageType as T, NavigationLinks as U, SocialLinks as V, Width as W, RichText as X, BlockType as Y, Video as Z, useStyle as _, deepEqual as a, ShapeControl as a$, getBoxShadowsSwatchIds as a0, getResponsiveColorSwatchIds as a1, StyleControlProperty as a2, ImageControlValueFormat as a3, isPropControllersHandle as a4, isRichTextV1Data as a5, isNonNullable as a6, TypographyControlType as a7, StyleControlType as a8, RichTextV2ControlType as a9, getIsInBuilder as aA, getBuilderEditMode as aB, getIsPreview as aC, getBackgroundsFileIds as aD, getBackgroundsSwatchIds as aE, Color as aF, copyColorData as aG, copy as aH, merge as aI, unstable_IconRadioGroupIcon as aJ, unstable_IconRadioGroup as aK, Image as aL, copyImageData as aM, Link as aN, copyLinkData as aO, List as aP, ListControlMessageType as aQ, ListControl as aR, copyListData as aS, getListElementChildren as aT, getListSwatchIds as aU, getListFileIds as aV, getListTypographyIds as aW, getListPageIds as aX, Select as aY, Shape as aZ, ShapeControlMessageType as a_, RichTextControlType as aa, SlotControlType as ab, StyleV2ControlType as ac, ListControlType as ad, ShapeControlType as ae, LinkControlType as af, ImageControlType as ag, IconRadioGroupControlType as ah, ColorControlType as ai, SelectControlType as aj, getComponentPropControllerDescriptors as ak, getPropControllers as al, Types as am, BorderPropControllerFormat as an, ShadowsPropControllerFormat as ao, BorderRadiusPropControllerFormat as ap, MarginPropControllerFormat as aq, PaddingPropControllerFormat as ar, WidthPropControllerFormat as as, configureStore as at, copyElementTree as au, getBreakpoints as av, parseLocalesInput as aw, getElementId as ax, getReactComponent as ay, getDocument as az, createDocumentReference as b, getDocumentKeysSortedByDepth as b$, copyShapeData as b0, getShapeElementChildren as b1, getShapeSwatchIds as b2, getShapeTypographyIds as b3, getShapePageIds as b4, getShapeFileIds as b5, Slot as b6, SlotControlMessageType as b7, SlotControl as b8, copySlotData as b9, withTypography as bA, TypographyPlugin as bB, BlockActions as bC, ListActions as bD, onKeyDown as bE, withBlock as bF, BlockPlugin as bG, withInlineMode as bH, InlineModePlugin as bI, withTextAlign as bJ, TextAlignPlugin as bK, RootBlockType as bL, InlineType as bM, BlockTextAlignment as bN, withInline as bO, InlinePlugin as bP, ElementUtils as bQ, createRichTextV2Plugin as bR, onChange$1 as bS, getValue$3 as bT, isLinkElement as bU, getInitialState$7 as bV, reducer$8 as bW, getDocument$1 as bX, getComponentsMeta as bY, getComponentPropControllerDescriptors$1 as bZ, BuilderEditMode as b_, mergeSlotData as ba, Style as bb, StyleControlMessageType as bc, StyleControl as bd, copyStyleData as be, unstable_useStyleV2ClassName as bf, unstable_StyleV2 as bg, StyleV2ControlMessageType as bh, StyleV2Control as bi, ObjectType as bj, RichTextControlMessageType as bk, RichTextControl as bl, richTextDTOtoSelection as bm, richTextDTOtoDAO as bn, toSelectionDTO as bo, richTextDAOToDTO as bp, RichTextV2Mode as bq, RichTextV2ControlMessageType as br, RichTextV2Control as bs, richTextV2DataToDescendents as bt, richTextV2DescendentsToData as bu, unstable_Typography as bv, getTypographySwatchIds as bw, getTypographyTypographyIds as bx, TypographyActions as by, TYPOGRAPHY_KEY as bz, createDocument as c, getPropController as c0, getPropControllersHandle as c1, getElement as c2, getElementPropControllerDescriptors as c3, createPropController as c4, reducer$7 as c5, reducer$9 as c6, reducer$6 as c7, reducer$5 as c8, reducer$4 as c9, reducer$3 as ca, reducer$2 as cb, reducer$1 as cc, getInitialState$2 as cd, descriptors as d, isElementReference as e, getDefaultLocale as f, getPropControllerDescriptors as g, getLocales as h, introspection as i, getSwatchIds as j, getFileIds as k, getTypographyIds as l, getTableIds as m, getPageIds as n, getElementChildren as o, ResponsiveIconRadioGroup as p, Border as q, BorderRadius as r, GapX as s, ResponsiveSelect as t, ResponsiveNumber as u, Checkbox as v, Grid as w, TextInput as x, ResponsiveColor as y, TextStyle as z };
|
|
2972
4484
|
//# sourceMappingURL=react-page.es.js.map
|