@frontify/fondue 12.0.0-beta.159 → 12.0.0-beta.160
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/RichTextEditor/Plugins/CheckboxListPlugin/CheckboxListButton/CheckboxListToolbarButton.es.js +27 -18
- package/dist/components/RichTextEditor/Plugins/CheckboxListPlugin/CheckboxListButton/CheckboxListToolbarButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/Plugins/TextStylePlugin/TextStyleDropdown/DropdownItem.es.js +5 -5
- package/dist/components/RichTextEditor/Plugins/TextStylePlugin/TextStyleDropdown/DropdownItem.es.js.map +1 -1
- package/dist/index.cjs.js +10 -10
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +2 -1
|
@@ -1,28 +1,37 @@
|
|
|
1
|
-
import { getTooltip as
|
|
2
|
-
import { withPlateProvider as
|
|
3
|
-
import
|
|
4
|
-
const
|
|
5
|
-
({ id:
|
|
6
|
-
var
|
|
7
|
-
const t =
|
|
8
|
-
return /* @__PURE__ */
|
|
9
|
-
|
|
1
|
+
import { getTooltip as E } from "../../../helpers/getTooltip.es.js";
|
|
2
|
+
import { withPlateProvider as g, usePlateEditorState as v, useEventPlateId as y, getNode as N, someNode as T, ToolbarButton as x, unwrapList as A, getPreventDefaultHandler as S, toggleNodeType as b, getParentNode as w, setElements as p, ELEMENT_PARAGRAPH as L } from "@udecode/plate";
|
|
3
|
+
import R from "react";
|
|
4
|
+
const D = g(
|
|
5
|
+
({ id: u, type: s, active: f, ...m }) => {
|
|
6
|
+
var c, n, l;
|
|
7
|
+
const t = v(y(u)), e = ((c = t.selection) == null ? void 0 : c.focus.path) && N(t, (l = (n = t == null ? void 0 : t.selection) == null ? void 0 : n.focus) == null ? void 0 : l.path), o = f ?? (!!(t != null && t.selection) && T(t, { match: { type: s } }));
|
|
8
|
+
return /* @__PURE__ */ R.createElement(
|
|
9
|
+
x,
|
|
10
10
|
{
|
|
11
|
-
tooltip:
|
|
11
|
+
tooltip: E("Checklist"),
|
|
12
12
|
active: o,
|
|
13
|
-
onMouseDown: (
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
onMouseDown: (P) => {
|
|
14
|
+
var a, i;
|
|
15
|
+
if (!(!t || !t.selection)) {
|
|
16
|
+
if (o || A(t, {}), S(b, t, {
|
|
17
|
+
activeType: s
|
|
18
|
+
})(P), !(e != null && e.textStyle)) {
|
|
19
|
+
const r = w(t, (i = (a = t == null ? void 0 : t.selection) == null ? void 0 : a.focus) == null ? void 0 : i.path), h = r && r[0].type;
|
|
20
|
+
p(t, {
|
|
21
|
+
textStyle: h
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
o && p(t, {
|
|
25
|
+
type: (e == null ? void 0 : e.textStyle) ?? L
|
|
26
|
+
});
|
|
27
|
+
}
|
|
19
28
|
},
|
|
20
|
-
...
|
|
29
|
+
...m
|
|
21
30
|
}
|
|
22
31
|
);
|
|
23
32
|
}
|
|
24
33
|
);
|
|
25
34
|
export {
|
|
26
|
-
|
|
35
|
+
D as CheckboxListToolbarButton
|
|
27
36
|
};
|
|
28
37
|
//# sourceMappingURL=CheckboxListToolbarButton.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxListToolbarButton.es.js","sources":["../../../../../../src/components/RichTextEditor/Plugins/CheckboxListPlugin/CheckboxListButton/CheckboxListToolbarButton.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { getTooltip } from '@components/RichTextEditor/helpers/getTooltip';\nimport {\n BlockToolbarButtonProps,\n ELEMENT_PARAGRAPH,\n ToolbarButton,\n getNode,\n getPreventDefaultHandler,\n setElements,\n someNode,\n toggleNodeType,\n unwrapList,\n useEventPlateId,\n usePlateEditorState,\n withPlateProvider,\n} from '@udecode/plate';\nimport React from 'react';\n\nexport const CheckboxListToolbarButton = withPlateProvider(\n ({ id, type, active, ...props }: BlockToolbarButtonProps) => {\n const editor = usePlateEditorState(useEventPlateId(id));\n const node = editor.selection?.focus.path && getNode(editor, editor?.selection?.focus?.path);\n\n const isActive = active ?? (!!editor?.selection && someNode(editor, { match: { type } }));\n\n return (\n <ToolbarButton\n tooltip={getTooltip('Checklist')}\n active={isActive}\n onMouseDown={(event) => {\n if (!editor || !editor.selection) {\n return;\n }\n\n if (!isActive) {\n unwrapList(editor, {});\n }\n\n getPreventDefaultHandler(toggleNodeType, editor, {\n activeType: type,\n })(event);\n\n if (isActive) {\n setElements(editor, {\n type: (node?.textStyle as string) ?? ELEMENT_PARAGRAPH,\n });\n }\n }}\n {...props}\n />\n );\n },\n);\n"],"names":["CheckboxListToolbarButton","withPlateProvider","id","type","active","props","editor","usePlateEditorState","useEventPlateId","node","_a","getNode","_c","_b","isActive","someNode","React","ToolbarButton","getTooltip","event","unwrapList","getPreventDefaultHandler","toggleNodeType","setElements","ELEMENT_PARAGRAPH"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"CheckboxListToolbarButton.es.js","sources":["../../../../../../src/components/RichTextEditor/Plugins/CheckboxListPlugin/CheckboxListButton/CheckboxListToolbarButton.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { getTooltip } from '@components/RichTextEditor/helpers/getTooltip';\nimport {\n BlockToolbarButtonProps,\n ELEMENT_PARAGRAPH,\n ToolbarButton,\n getNode,\n getParentNode,\n getPreventDefaultHandler,\n setElements,\n someNode,\n toggleNodeType,\n unwrapList,\n useEventPlateId,\n usePlateEditorState,\n withPlateProvider,\n} from '@udecode/plate';\nimport React from 'react';\n\nexport const CheckboxListToolbarButton = withPlateProvider(\n ({ id, type, active, ...props }: BlockToolbarButtonProps) => {\n const editor = usePlateEditorState(useEventPlateId(id));\n const node = editor.selection?.focus.path && getNode(editor, editor?.selection?.focus?.path);\n\n const isActive = active ?? (!!editor?.selection && someNode(editor, { match: { type } }));\n\n return (\n <ToolbarButton\n tooltip={getTooltip('Checklist')}\n active={isActive}\n onMouseDown={(event) => {\n if (!editor || !editor.selection) {\n return;\n }\n\n if (!isActive) {\n unwrapList(editor, {});\n }\n\n getPreventDefaultHandler(toggleNodeType, editor, {\n activeType: type,\n })(event);\n if (!node?.textStyle) {\n const parentNode = getParentNode(editor, editor?.selection?.focus?.path);\n const textStyle = parentNode && parentNode[0].type;\n setElements(editor, {\n textStyle,\n });\n }\n\n if (isActive) {\n setElements(editor, {\n type: (node?.textStyle as string) ?? ELEMENT_PARAGRAPH,\n });\n }\n }}\n {...props}\n />\n );\n },\n);\n"],"names":["CheckboxListToolbarButton","withPlateProvider","id","type","active","props","editor","usePlateEditorState","useEventPlateId","node","_a","getNode","_c","_b","isActive","someNode","React","ToolbarButton","getTooltip","event","unwrapList","getPreventDefaultHandler","toggleNodeType","parentNode","getParentNode","textStyle","setElements","ELEMENT_PARAGRAPH"],"mappings":";;;AAoBO,MAAMA,IAA4BC;AAAA,EACrC,CAAC,EAAE,IAAAC,GAAI,MAAAC,GAAM,QAAAC,GAAQ,GAAGC,QAAqC;;AACzD,UAAMC,IAASC,EAAoBC,EAAgBN,CAAE,CAAC,GAChDO,MAAOC,IAAAJ,EAAO,cAAP,gBAAAI,EAAkB,MAAM,SAAQC,EAAQL,IAAQM,KAAAC,IAAAP,KAAA,gBAAAA,EAAQ,cAAR,gBAAAO,EAAmB,UAAnB,gBAAAD,EAA0B,IAAI,GAErFE,IAAWV,MAAW,CAAC,EAACE,KAAA,QAAAA,EAAQ,cAAaS,EAAST,GAAQ,EAAE,OAAO,EAAE,MAAAH,KAAQ;AAGnF,WAAA,gBAAAa,EAAA;AAAA,MAACC;AAAA,MAAA;AAAA,QACG,SAASC,EAAW,WAAW;AAAA,QAC/B,QAAQJ;AAAA,QACR,aAAa,CAACK,MAAU;;AACpB,cAAI,GAACb,KAAU,CAACA,EAAO,YAWnB;AAAA,gBAPCQ,KACUM,EAAAd,GAAQ,CAAA,CAAE,GAGzBe,EAAyBC,GAAgBhB,GAAQ;AAAA,cAC7C,YAAYH;AAAA,YAAA,CACf,EAAEgB,CAAK,GACJ,EAACV,KAAA,QAAAA,EAAM,YAAW;AAClB,oBAAMc,IAAaC,EAAclB,IAAQO,KAAAH,IAAAJ,KAAA,gBAAAA,EAAQ,cAAR,gBAAAI,EAAmB,UAAnB,gBAAAG,EAA0B,IAAI,GACjEY,IAAYF,KAAcA,EAAW,CAAC,EAAE;AAC9C,cAAAG,EAAYpB,GAAQ;AAAA,gBAChB,WAAAmB;AAAA,cAAA,CACH;AAAA,YACL;AAEA,YAAIX,KACAY,EAAYpB,GAAQ;AAAA,cAChB,OAAOG,KAAA,gBAAAA,EAAM,cAAwBkB;AAAA,YAAA,CACxC;AAAA;AAAA,QAET;AAAA,QACC,GAAGtB;AAAA,MAAA;AAAA,IAAA;AAAA,EAGhB;AACJ;"}
|
package/dist/components/RichTextEditor/Plugins/TextStylePlugin/TextStyleDropdown/DropdownItem.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getMark as
|
|
1
|
+
import { getMark as s, someNode as m, setMarks as l, getPreventDefaultHandler as c, toggleNodeType as u, getAboveNode as x, ELEMENT_LI as p } from "@udecode/plate";
|
|
2
2
|
import { merge as v } from "../../../../../utilities/merge.es.js";
|
|
3
3
|
import E from "react";
|
|
4
4
|
import { MARK_TEXT_STYLE as o } from "../../ListPlugin/ListPlugin.es.js";
|
|
@@ -10,7 +10,7 @@ const n = (t) => x(t, {
|
|
|
10
10
|
match: { type: b },
|
|
11
11
|
mode: "lowest"
|
|
12
12
|
}), M = ({ editor: t, type: e, children: r }) => {
|
|
13
|
-
const a = t != null && t.selection && n(t) ?
|
|
13
|
+
const a = t != null && t.selection && n(t) ? s(t, o) === e : m(t, { match: { type: e } });
|
|
14
14
|
return /* @__PURE__ */ E.createElement(
|
|
15
15
|
"button",
|
|
16
16
|
{
|
|
@@ -20,11 +20,11 @@ const n = (t) => x(t, {
|
|
|
20
20
|
"tw-block tw-w-full tw-text-left tw-px-3 tw-py-2 tw-outline-none tw-cursor-pointer tw-truncate hover:tw-bg-box-neutral-hover hover:w-text-box-neutral-inverse-hover tw-max-h-20 tw-max-w-[15rem] tw-min-h-[2.25rem]",
|
|
21
21
|
a ? "tw-text-box-neutral-inverse tw-bg-box-neutral" : "tw-text-text"
|
|
22
22
|
]),
|
|
23
|
-
onMouseDown: (
|
|
24
|
-
!t || !t.selection || (
|
|
23
|
+
onMouseDown: (w) => {
|
|
24
|
+
!t || !t.selection || (l(t, { [o]: e }), n(t) || c(u, t, {
|
|
25
25
|
activeType: e,
|
|
26
26
|
inactiveType: e
|
|
27
|
-
})(
|
|
27
|
+
})(w));
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
r
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownItem.es.js","sources":["../../../../../../src/components/RichTextEditor/Plugins/TextStylePlugin/TextStyleDropdown/DropdownItem.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n ELEMENT_LI,\n PlateEditor,\n getAboveNode,\n getMark,\n getPreventDefaultHandler,\n setMarks,\n someNode,\n toggleNodeType,\n} from '@udecode/plate';\nimport { merge } from '@utilities/merge';\nimport React from 'react';\nimport { ELEMENT_CHECK_ITEM } from '../../CheckboxListPlugin';\nimport { MARK_TEXT_STYLE } from '../../ListPlugin/ListPlugin';\nimport { DropdownItemProps } from './types';\n\nconst isInList = (editor: PlateEditor) =>\n getAboveNode(editor, {\n match: { type: ELEMENT_LI },\n mode: 'lowest',\n }) ||\n someNode(editor, {\n match: { type: ELEMENT_CHECK_ITEM },\n mode: 'lowest',\n });\n\nexport const DropdownItem = ({ editor, type, children }: DropdownItemProps) => {\n const isActive =\n !!editor?.selection && isInList(editor)\n ? getMark(editor, MARK_TEXT_STYLE) === type\n : someNode(editor, { match: { type } });\n\n return (\n <button\n data-test-id=\"textstyle-option\"\n type=\"button\"\n className={merge([\n 'tw-block tw-w-full tw-text-left tw-px-3 tw-py-2 tw-outline-none tw-cursor-pointer tw-truncate hover:tw-bg-box-neutral-hover hover:w-text-box-neutral-inverse-hover tw-max-h-20 tw-max-w-[15rem] tw-min-h-[2.25rem]',\n isActive ? 'tw-text-box-neutral-inverse tw-bg-box-neutral' : 'tw-text-text',\n ])}\n onMouseDown={(event) => {\n if (!editor || !editor.selection) {\n return;\n }\n
|
|
1
|
+
{"version":3,"file":"DropdownItem.es.js","sources":["../../../../../../src/components/RichTextEditor/Plugins/TextStylePlugin/TextStyleDropdown/DropdownItem.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n ELEMENT_LI,\n PlateEditor,\n getAboveNode,\n getMark,\n getPreventDefaultHandler,\n setMarks,\n someNode,\n toggleNodeType,\n} from '@udecode/plate';\nimport { merge } from '@utilities/merge';\nimport React from 'react';\nimport { ELEMENT_CHECK_ITEM } from '../../CheckboxListPlugin';\nimport { MARK_TEXT_STYLE } from '../../ListPlugin/ListPlugin';\nimport { DropdownItemProps } from './types';\n\nconst isInList = (editor: PlateEditor) =>\n getAboveNode(editor, {\n match: { type: ELEMENT_LI },\n mode: 'lowest',\n }) ||\n someNode(editor, {\n match: { type: ELEMENT_CHECK_ITEM },\n mode: 'lowest',\n });\n\nexport const DropdownItem = ({ editor, type, children }: DropdownItemProps) => {\n const isActive =\n !!editor?.selection && isInList(editor)\n ? getMark(editor, MARK_TEXT_STYLE) === type\n : someNode(editor, { match: { type } });\n\n return (\n <button\n data-test-id=\"textstyle-option\"\n type=\"button\"\n className={merge([\n 'tw-block tw-w-full tw-text-left tw-px-3 tw-py-2 tw-outline-none tw-cursor-pointer tw-truncate hover:tw-bg-box-neutral-hover hover:w-text-box-neutral-inverse-hover tw-max-h-20 tw-max-w-[15rem] tw-min-h-[2.25rem]',\n isActive ? 'tw-text-box-neutral-inverse tw-bg-box-neutral' : 'tw-text-text',\n ])}\n onMouseDown={(event) => {\n if (!editor || !editor.selection) {\n return;\n }\n setMarks(editor, { [MARK_TEXT_STYLE]: type });\n if (!isInList(editor)) {\n getPreventDefaultHandler(toggleNodeType, editor, {\n activeType: type,\n inactiveType: type,\n })(event);\n }\n }}\n >\n {children}\n </button>\n );\n};\n"],"names":["isInList","editor","getAboveNode","ELEMENT_LI","someNode","ELEMENT_CHECK_ITEM","DropdownItem","type","children","isActive","getMark","MARK_TEXT_STYLE","React","merge","event","setMarks","getPreventDefaultHandler","toggleNodeType"],"mappings":";;;;;AAkBA,MAAMA,IAAW,CAACC,MACdC,EAAaD,GAAQ;AAAA,EACjB,OAAO,EAAE,MAAME,EAAW;AAAA,EAC1B,MAAM;AACV,CAAC,KACDC,EAASH,GAAQ;AAAA,EACb,OAAO,EAAE,MAAMI,EAAmB;AAAA,EAClC,MAAM;AACV,CAAC,GAEQC,IAAe,CAAC,EAAE,QAAAL,GAAQ,MAAAM,GAAM,UAAAC,QAAkC;AACrE,QAAAC,IACAR,KAAA,QAAAA,EAAQ,aAAaD,EAASC,CAAM,IAChCS,EAAQT,GAAQU,CAAe,MAAMJ,IACrCH,EAASH,GAAQ,EAAE,OAAO,EAAE,MAAAM,KAAQ;AAG1C,SAAA,gBAAAK,EAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,gBAAa;AAAA,MACb,MAAK;AAAA,MACL,WAAWC,EAAM;AAAA,QACb;AAAA,QACAJ,IAAW,kDAAkD;AAAA,MAAA,CAChE;AAAA,MACD,aAAa,CAACK,MAAU;AACpB,QAAI,CAACb,KAAU,CAACA,EAAO,cAGvBc,EAASd,GAAQ,EAAE,CAACU,CAAe,GAAGJ,EAAM,CAAA,GACvCP,EAASC,CAAM,KAChBe,EAAyBC,GAAgBhB,GAAQ;AAAA,UAC7C,YAAYM;AAAA,UACZ,cAAcA;AAAA,QAAA,CACjB,EAAEO,CAAK;AAAA,MAEhB;AAAA,IAAA;AAAA,IAECN;AAAA,EAAA;AAGb;"}
|