@frontify/guideline-blocks-settings 0.33.5 → 0.34.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Link/LinkSelector/LinkSelector.es.js +66 -58
- package/dist/components/Link/LinkSelector/LinkSelector.es.js.map +1 -1
- package/dist/components/Link/LinkSelector/SectionLink.es.js +3 -3
- package/dist/components/Link/LinkSelector/SectionLink.es.js.map +1 -1
- package/dist/components/Link/utils/getUrl.es.js +1 -1
- package/dist/components/Link/utils/getUrl.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.es.js +24 -37
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonButton.es.js +21 -14
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.es.js +19 -23
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/CustomFloatingButton.es.js +23 -11
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/CustomFloatingButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/EditButtonModal/EditModal.es.js +21 -16
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/EditButtonModal/EditModal.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/useInsertModal.es.js +12 -13
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/useInsertModal.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/floatingButtonStore.es.js +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/floatingButtonStore.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEdit.es.js +31 -32
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEdit.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEnter.es.js +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEnter.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEscape.es.js +2 -2
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEscape.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonInsert.es.js +21 -23
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonInsert.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useVirtualFloatingButton.es.js +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useVirtualFloatingButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.es.js +14 -15
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/insertButton.es.js +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/insertButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/submitFloatingButton.es.js +7 -7
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/submitFloatingButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.es.js +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.es.js +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.es.js +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/wrapButton.es.js +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/wrapButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/createButtonNode.es.js +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/createButtonNode.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getButtonStyle.es.js +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getButtonStyle.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getUrl.es.js +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getUrl.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonEdit.es.js +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonEdit.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonInsert.es.js +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonInsert.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/withButton.es.js +19 -20
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/withButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.es.js +26 -13
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.es.js +31 -39
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertLinkModal.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.es.js +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.es.js +40 -54
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkButton.es.js +12 -15
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.es.js +7 -22
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/index.es.js +4 -5
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/index.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkToolbarButton.es.js +25 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkToolbarButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/index.es.js +26 -26
- package/dist/components/RichTextEditor/plugins/LinkPlugin/index.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/utils/getUrl.es.js +13 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/utils/getUrl.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.es.js +12 -13
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.es.js +12 -13
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.es.js +12 -13
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.es.js +9 -10
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.es.js +9 -10
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.es.js +9 -10
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.es.js +9 -10
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.es.js +12 -13
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.es.js +17 -18
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.es.js +16 -17
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.es.js +20 -21
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.es.js.map +1 -1
- package/dist/index.cjs.js +3 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +30 -33
- package/dist/index.umd.js +3 -3
- package/dist/index.umd.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +3 -6
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButton.es.js +0 -25
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButton.es.js.map +0 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButtonEditButton.es.js +0 -20
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButtonEditButton.es.js.map +0 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButtonUrlInput.es.js +0 -26
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButtonUrlInput.es.js.map +0 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/UnlinkButton.es.js +0 -20
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/UnlinkButton.es.js.map +0 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/useFloatingLinkEdit.es.js +0 -53
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/useFloatingLinkEdit.es.js.map +0 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/FloatingLink.es.js +0 -29
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/FloatingLink.es.js.map +0 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useFloatingLinkInsert.es.js +0 -40
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useFloatingLinkInsert.es.js.map +0 -1
package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upsertButton.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n InsertNodesOptions,\n PlateEditor,\n TNode,\n TNodeEntry,\n UnwrapNodesOptions,\n Value,\n WrapNodesOptions,\n findNode,\n getAboveNode,\n getEditorString,\n getNodeLeaf,\n getNodeProps,\n getPluginOptions,\n getPluginType,\n isDefined,\n isExpanded,\n removeNodes,\n setNodes,\n} from '@
|
|
1
|
+
{"version":3,"file":"upsertButton.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n InsertNodesOptions,\n Path,\n PlateEditor,\n TNode,\n TNodeEntry,\n UnwrapNodesOptions,\n Value,\n WrapNodesOptions,\n findNode,\n getAboveNode,\n getEditorString,\n getNodeLeaf,\n getNodeProps,\n getPluginOptions,\n getPluginType,\n isDefined,\n isExpanded,\n removeNodes,\n setNodes,\n} from '@frontify/fondue';\n\nimport { ButtonPlugin, ELEMENT_BUTTON } from '../createButtonPlugin';\nimport { RichTextButtonStyle, TButtonElement } from '../types';\nimport { CreateButtonNodeOptions } from '../utils/index';\nimport { insertButton, unwrapButton, upsertButtonText, wrapButton } from '.';\n\nexport type UpsertButtonOptions<V extends Value = Value> = CreateButtonNodeOptions & {\n /**\n * If true, insert text when selection is in url.\n */\n insertTextInButton?: boolean;\n insertNodesOptions?: InsertNodesOptions<V>;\n unwrapNodesOptions?: UnwrapNodesOptions<V>;\n wrapNodesOptions?: WrapNodesOptions<V>;\n isUrl?: (url: string) => boolean;\n};\n\n/**\n * If selection in a button or is not url:\n * - insert text with url, exit\n * If selection is expanded or `update` in a button:\n * - remove button node, get button text\n * Then:\n * - insert button node\n */\nexport const upsertButton = <V extends Value>(\n editor: PlateEditor<V>,\n {\n url,\n text,\n buttonStyle,\n target,\n insertTextInButton,\n insertNodesOptions,\n isUrl = getPluginOptions<ButtonPlugin, V>(editor, ELEMENT_BUTTON).isUrl,\n }: UpsertButtonOptions<V>,\n) => {\n const at = editor.selection;\n if (!at) {\n return;\n }\n\n const buttonAbove = getAboveNode<TButtonElement>(editor, {\n at,\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n // anchor and focus in button -> insert text\n if (insertTextInButton && buttonAbove) {\n // we don't want to insert marks in buttons\n editor.insertText(url);\n return true;\n }\n\n if (!isUrl?.(url)) {\n return;\n }\n\n if (isDefined(text) && text.length === 0) {\n text = url;\n }\n\n if (buttonAbove) {\n editButtonUrlAndTarget<V>(url, editor, buttonAbove, target, buttonStyle, text);\n return true;\n }\n\n // selection contains at one edge edge or between the edges\n const buttonEntry = findNode<TButtonElement>(editor, {\n at,\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n const [buttonNode, buttonPath] = buttonEntry ?? [];\n\n const shouldReplaceText = shouldReplaceButtonText<V>(editor, buttonPath, text);\n\n if (isExpanded(at)) {\n anchorAndFocusInButton<V>(buttonAbove, editor, url, buttonStyle, target, text);\n return true;\n }\n\n if (shouldReplaceText) {\n removeNodes(editor, {\n at: buttonPath,\n });\n }\n\n const props = getNodeProps(buttonNode ?? ({} as TNode));\n\n const path = editor.selection?.focus.path;\n if (!path) {\n return;\n }\n\n // button text should have the focused leaf marks\n const leaf = getNodeLeaf(editor, path);\n\n // if text is empty, text is url\n if (!text?.length) {\n text = url;\n }\n\n insertButton(\n editor,\n {\n ...props,\n url,\n target,\n children: [\n {\n ...leaf,\n text,\n },\n ],\n },\n insertNodesOptions,\n );\n return true;\n};\n\nfunction shouldReplaceButtonText<V extends Value>(editor: PlateEditor<V>, buttonPath?: Path, text?: string) {\n return buttonPath && text?.length && text !== getEditorString(editor, buttonPath);\n}\n\nfunction anchorAndFocusInButton<V extends Value>(\n buttonAbove: undefined,\n editor: PlateEditor<V>,\n url: string,\n buttonStyle?: RichTextButtonStyle,\n target?: string,\n text?: string,\n) {\n if (buttonAbove) {\n unwrapButton(editor, {\n at: buttonAbove[1],\n });\n } else {\n unwrapButton(editor, {\n split: true,\n });\n }\n\n wrapButton(editor, {\n url,\n buttonStyle,\n target,\n });\n\n upsertButtonText(editor, { url, target, text });\n}\n\nfunction editButtonUrlAndTarget<V extends Value>(\n url: string,\n editor: PlateEditor<V>,\n buttonAbove: TNodeEntry<TButtonElement>,\n target?: string,\n buttonStyle?: string,\n text?: string,\n) {\n if (\n url !== buttonAbove[0]?.url ||\n target !== buttonAbove[0]?.target ||\n buttonStyle !== buttonAbove[0]?.buttonStyle\n ) {\n setNodes<TButtonElement>(\n editor,\n { url, target, buttonStyle },\n {\n at: buttonAbove[1],\n },\n );\n }\n\n upsertButtonText(editor, { url, text, target });\n}\n"],"names":["upsertButton","editor","url","text","buttonStyle","target","insertTextInButton","insertNodesOptions","isUrl","getPluginOptions","ELEMENT_BUTTON","at","buttonAbove","getAboveNode","getPluginType","isDefined","editButtonUrlAndTarget","buttonEntry","findNode","buttonNode","buttonPath","shouldReplaceText","shouldReplaceButtonText","isExpanded","anchorAndFocusInButton","removeNodes","props","getNodeProps","path","_a","leaf","getNodeLeaf","insertButton","getEditorString","unwrapButton","wrapButton","upsertButtonText","_b","_c","setNodes"],"mappings":";;;;;;AAgDa,MAAAA,IAAe,CACxBC,GACA;AAAA,EACI,KAAAC;AAAA,EACA,MAAAC;AAAA,EACA,aAAAC;AAAA,EACA,QAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,OAAAC,IAAQC,EAAkCR,GAAQS,CAAc,EAAE;AACtE,MACC;;AACD,QAAMC,IAAKV,EAAO;AAClB,MAAI,CAACU;AACD;AAGE,QAAAC,IAAcC,EAA6BZ,GAAQ;AAAA,IACrD,IAAAU;AAAA,IACA,OAAO,EAAE,MAAMG,EAAcb,GAAQS,CAAc,EAAE;AAAA,EAAA,CACxD;AAGD,MAAIJ,KAAsBM;AAEtB,WAAAX,EAAO,WAAWC,CAAG,GACd;AAGP,MAAA,EAACM,KAAA,QAAAA,EAAQN;AACT;AAOJ,MAJIa,EAAUZ,CAAI,KAAKA,EAAK,WAAW,MAC5BA,IAAAD,IAGPU;AACA,WAAAI,EAA0Bd,GAAKD,GAAQW,GAAaP,GAAQD,GAAaD,CAAI,GACtE;AAIL,QAAAc,IAAcC,EAAyBjB,GAAQ;AAAA,IACjD,IAAAU;AAAA,IACA,OAAO,EAAE,MAAMG,EAAcb,GAAQS,CAAc,EAAE;AAAA,EAAA,CACxD,GAEK,CAACS,GAAYC,CAAU,IAAIH,KAAe,CAAA,GAE1CI,IAAoBC,EAA2BrB,GAAQmB,GAAYjB,CAAI;AAEzE,MAAAoB,EAAWZ,CAAE;AACb,WAAAa,EAA0BZ,GAAaX,GAAQC,GAAKE,GAAaC,GAAQF,CAAI,GACtE;AAGX,EAAIkB,KACAI,EAAYxB,GAAQ;AAAA,IAChB,IAAImB;AAAA,EAAA,CACP;AAGL,QAAMM,IAAQC,EAAaR,KAAe,CAAY,CAAA,GAEhDS,KAAOC,IAAA5B,EAAO,cAAP,gBAAA4B,EAAkB,MAAM;AACrC,MAAI,CAACD;AACD;AAIE,QAAAE,IAAOC,EAAY9B,GAAQ2B,CAAI;AAGjC,SAACzB,KAAA,QAAAA,EAAM,WACAA,IAAAD,IAGX8B;AAAA,IACI/B;AAAA,IACA;AAAA,MACI,GAAGyB;AAAA,MACH,KAAAxB;AAAA,MACA,QAAAG;AAAA,MACA,UAAU;AAAA,QACN;AAAA,UACI,GAAGyB;AAAA,UACH,MAAA3B;AAAA,QACJ;AAAA,MACJ;AAAA,IACJ;AAAA,IACAI;AAAA,EAAA,GAEG;AACX;AAEA,SAASe,EAAyCrB,GAAwBmB,GAAmBjB,GAAe;AACxG,SAAOiB,MAAcjB,KAAA,gBAAAA,EAAM,WAAUA,MAAS8B,EAAgBhC,GAAQmB,CAAU;AACpF;AAEA,SAASI,EACLZ,GACAX,GACAC,GACAE,GACAC,GACAF,GACF;AACE,EAAIS,IACAsB,EAAajC,GAAQ;AAAA,IACjB,IAAIW,EAAY,CAAC;AAAA,EAAA,CACpB,IAEDsB,EAAajC,GAAQ;AAAA,IACjB,OAAO;AAAA,EAAA,CACV,GAGLkC,EAAWlC,GAAQ;AAAA,IACf,KAAAC;AAAA,IACA,aAAAE;AAAA,IACA,QAAAC;AAAA,EAAA,CACH,GAED+B,EAAiBnC,GAAQ,EAAE,KAAAC,GAAK,QAAAG,GAAQ,MAAAF,EAAM,CAAA;AAClD;AAEA,SAASa,EACLd,GACAD,GACAW,GACAP,GACAD,GACAD,GACF;;AACE,GACID,QAAQ2B,IAAAjB,EAAY,CAAC,MAAb,gBAAAiB,EAAgB,QACxBxB,QAAWgC,IAAAzB,EAAY,CAAC,MAAb,gBAAAyB,EAAgB,WAC3BjC,QAAgBkC,IAAA1B,EAAY,CAAC,MAAb,gBAAA0B,EAAgB,iBAEhCC;AAAA,IACItC;AAAA,IACA,EAAE,KAAAC,GAAK,QAAAG,GAAQ,aAAAD,EAAY;AAAA,IAC3B;AAAA,MACI,IAAIQ,EAAY,CAAC;AAAA,IACrB;AAAA,EAAA,GAIRwB,EAAiBnC,GAAQ,EAAE,KAAAC,GAAK,MAAAC,GAAM,QAAAE,EAAQ,CAAA;AAClD;"}
|
package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getAboveNode as i, getPluginType as c, getEditorString as p, replaceNodeChildren as u } from "@
|
|
1
|
+
import { getAboveNode as i, getPluginType as c, getEditorString as p, replaceNodeChildren as u } from "@frontify/fondue";
|
|
2
2
|
import { ELEMENT_BUTTON as g } from "../createButtonPlugin.es.js";
|
|
3
3
|
const f = (t, { text: n }) => {
|
|
4
4
|
const e = i(t, {
|
package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upsertButtonText.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n PlateEditor,\n TText,\n Value,\n getAboveNode,\n getEditorString,\n getPluginType,\n replaceNodeChildren,\n} from '@
|
|
1
|
+
{"version":3,"file":"upsertButtonText.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n PlateEditor,\n TText,\n Value,\n getAboveNode,\n getEditorString,\n getPluginType,\n replaceNodeChildren,\n} from '@frontify/fondue';\nimport { ELEMENT_BUTTON, TButtonElement } from '..';\nimport { UpsertButtonOptions } from './upsertButton';\n\n/**\n * If the text is different than the button above text, replace button children by a new text.\n * The new text has the same marks than the first text replaced.\n */\nexport const upsertButtonText = <V extends Value>(editor: PlateEditor<V>, { text }: UpsertButtonOptions<V>) => {\n const newButton = getAboveNode<TButtonElement>(editor, {\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n if (newButton) {\n const [newButtonNode, newButtonPath] = newButton;\n\n if (text?.length && text !== getEditorString(editor, newButtonPath)) {\n const firstText = newButtonNode.children[0];\n\n // remove button children\n replaceNodeChildren<TText>(editor, {\n at: newButtonPath,\n nodes: { ...firstText, text },\n insertOptions: {\n select: true,\n },\n });\n }\n }\n};\n"],"names":["upsertButtonText","editor","text","newButton","getAboveNode","getPluginType","ELEMENT_BUTTON","newButtonNode","newButtonPath","getEditorString","firstText","replaceNodeChildren"],"mappings":";;AAkBO,MAAMA,IAAmB,CAAkBC,GAAwB,EAAE,MAAAC,QAAmC;AACrG,QAAAC,IAAYC,EAA6BH,GAAQ;AAAA,IACnD,OAAO,EAAE,MAAMI,EAAcJ,GAAQK,CAAc,EAAE;AAAA,EAAA,CACxD;AAED,MAAIH,GAAW;AACL,UAAA,CAACI,GAAeC,CAAa,IAAIL;AAEvC,QAAID,KAAA,QAAAA,EAAM,UAAUA,MAASO,EAAgBR,GAAQO,CAAa,GAAG;AAC3D,YAAAE,IAAYH,EAAc,SAAS,CAAC;AAG1C,MAAAI,EAA2BV,GAAQ;AAAA,QAC/B,IAAIO;AAAA,QACJ,OAAO,EAAE,GAAGE,GAAW,MAAAR,EAAK;AAAA,QAC5B,eAAe;AAAA,UACX,QAAQ;AAAA,QACZ;AAAA,MAAA,CACH;AAAA,IACL;AAAA,EACJ;AACJ;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { wrapNodes as i, getPluginType as m } from "@
|
|
1
|
+
import { wrapNodes as i, getPluginType as m } from "@frontify/fondue";
|
|
2
2
|
import { ELEMENT_BUTTON as n } from "../createButtonPlugin.es.js";
|
|
3
3
|
const s = (t, { url: p, buttonStyle: r, target: o, ...e }) => {
|
|
4
4
|
i(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrapButton.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/transforms/wrapButton.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { PlateEditor, Value, WrapNodesOptions, getPluginType, wrapNodes } from '@
|
|
1
|
+
{"version":3,"file":"wrapButton.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/transforms/wrapButton.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { PlateEditor, Value, WrapNodesOptions, getPluginType, wrapNodes } from '@frontify/fondue';\nimport { ELEMENT_BUTTON, RichTextButtonStyle, TButtonElement } from '..';\n\nexport interface WrapButtonOptions<V extends Value = Value> extends WrapNodesOptions<V> {\n url: string;\n buttonStyle?: RichTextButtonStyle;\n target?: string;\n}\n\n/**\n * Wrap a button node with split.\n */\nexport const wrapButton = <V extends Value>(\n editor: PlateEditor<V>,\n { url, buttonStyle, target, ...options }: WrapButtonOptions<V>,\n) => {\n wrapNodes<TButtonElement, Value>(\n editor,\n {\n type: getPluginType(editor, ELEMENT_BUTTON),\n url,\n buttonStyle,\n target,\n children: [],\n },\n { split: true, ...options } as WrapNodesOptions,\n );\n};\n"],"names":["wrapButton","editor","url","buttonStyle","target","options","wrapNodes","getPluginType","ELEMENT_BUTTON"],"mappings":";;AAca,MAAAA,IAAa,CACtBC,GACA,EAAE,KAAAC,GAAK,aAAAC,GAAa,QAAAC,GAAQ,GAAGC,QAC9B;AACD,EAAAC;AAAA,IACIL;AAAA,IACA;AAAA,MACI,MAAMM,EAAcN,GAAQO,CAAc;AAAA,MAC1C,KAAAN;AAAA,MACA,aAAAC;AAAA,MACA,QAAAC;AAAA,MACA,UAAU,CAAC;AAAA,IACf;AAAA,IACA,EAAE,OAAO,IAAM,GAAGC,EAAQ;AAAA,EAAA;AAElC;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getPluginType as i } from "@
|
|
1
|
+
import { getPluginType as i } from "@frontify/fondue";
|
|
2
2
|
import { ELEMENT_BUTTON as m } from "../createButtonPlugin.es.js";
|
|
3
3
|
const u = (t, { url: r, text: e = "", buttonStyle: o = "primary", target: p, children: n }) => ({
|
|
4
4
|
type: i(t, m),
|
package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/createButtonNode.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createButtonNode.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/utils/createButtonNode.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { PlateEditor, TText, Value, getPluginType } from '@
|
|
1
|
+
{"version":3,"file":"createButtonNode.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/utils/createButtonNode.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { PlateEditor, TText, Value, getPluginType } from '@frontify/fondue';\nimport { RichTextButtonStyle, TButtonElement } from '..';\nimport { ELEMENT_BUTTON } from '../createButtonPlugin';\n\nexport interface CreateButtonNodeOptions {\n url: string;\n text?: string;\n buttonStyle?: RichTextButtonStyle;\n target?: string;\n children?: TText[];\n}\n\nexport const createButtonNode = <V extends Value>(\n editor: PlateEditor<V>,\n { url, text = '', buttonStyle = 'primary', target, children }: CreateButtonNodeOptions,\n): TButtonElement => {\n const type = getPluginType(editor, ELEMENT_BUTTON);\n\n return {\n type,\n url,\n target,\n buttonStyle,\n children: children ?? [{ text }],\n };\n};\n"],"names":["createButtonNode","editor","url","text","buttonStyle","target","children","getPluginType","ELEMENT_BUTTON"],"mappings":";;AAca,MAAAA,IAAmB,CAC5BC,GACA,EAAE,KAAAC,GAAK,MAAAC,IAAO,IAAI,aAAAC,IAAc,WAAW,QAAAC,GAAQ,UAAAC,SAI5C;AAAA,EACH,MAHSC,EAAcN,GAAQO,CAAc;AAAA,EAI7C,KAAAN;AAAA,EACA,QAAAG;AAAA,EACA,aAAAD;AAAA,EACA,UAAUE,KAAY,CAAC,EAAE,MAAAH,GAAM;AAAA;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getButtonStyle.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/utils/getButtonStyle.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { PlateEditor, getAboveNode } from '@
|
|
1
|
+
{"version":3,"file":"getButtonStyle.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/utils/getButtonStyle.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { PlateEditor, getAboveNode } from '@frontify/fondue';\nimport { ELEMENT_BUTTON, RichTextButtonStyle, TButtonElement } from '..';\n\nexport const getButtonStyle = (editor: PlateEditor): RichTextButtonStyle => {\n const linkNode = getAboveNode<TButtonElement>(editor, { match: { type: ELEMENT_BUTTON } });\n\n if (!Array.isArray(linkNode)) {\n return 'primary';\n }\n\n return (linkNode[0]?.buttonStyle as RichTextButtonStyle) || 'primary';\n};\n"],"names":["getButtonStyle","editor","linkNode","getAboveNode","ELEMENT_BUTTON","_a"],"mappings":";;AAKa,MAAAA,IAAiB,CAACC,MAA6C;;AAClE,QAAAC,IAAWC,EAA6BF,GAAQ,EAAE,OAAO,EAAE,MAAMG,EAAe,EAAA,CAAG;AAEzF,SAAK,MAAM,QAAQF,CAAQ,OAInBG,IAAAH,EAAS,CAAC,MAAV,gBAAAG,EAAa,gBAAuC;AAChE;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getUrl.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/utils/getUrl.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { PlateEditor, getAboveNode } from '@
|
|
1
|
+
{"version":3,"file":"getUrl.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/utils/getUrl.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { PlateEditor, getAboveNode } from '@frontify/fondue';\nimport { ELEMENT_BUTTON, TButtonElement } from '..';\n\nconst getLinkNode = (editor: PlateEditor, cb: (link: TButtonElement) => string): string => {\n const linkNode = getAboveNode<TButtonElement>(editor, { match: { type: ELEMENT_BUTTON } });\n\n if (!Array.isArray(linkNode)) {\n return '';\n }\n\n return cb(linkNode[0]);\n};\n\nexport const getUrlFromEditor = (editor: PlateEditor) => {\n return getLinkNode(editor, (link) => link.url ?? '');\n};\n"],"names":["getLinkNode","editor","cb","linkNode","getAboveNode","ELEMENT_BUTTON","getUrlFromEditor","link"],"mappings":";;AAKA,MAAMA,IAAc,CAACC,GAAqBC,MAAiD;AACjF,QAAAC,IAAWC,EAA6BH,GAAQ,EAAE,OAAO,EAAE,MAAMI,EAAe,EAAA,CAAG;AAEzF,SAAK,MAAM,QAAQF,CAAQ,IAIpBD,EAAGC,EAAS,CAAC,CAAC,IAHV;AAIf,GAEaG,IAAmB,CAACL,MACtBD,EAAYC,GAAQ,CAACM,MAASA,EAAK,OAAO,EAAE;"}
|
package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButton.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"triggerFloatingButton.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButton.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { PlateEditor, Value } from '@
|
|
1
|
+
{"version":3,"file":"triggerFloatingButton.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButton.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { PlateEditor, Value } from '@frontify/fondue';\nimport { floatingButtonSelectors } from '../components';\nimport { triggerFloatingButtonEdit, triggerFloatingButtonInsert } from '.';\n\nexport const triggerFloatingButton = <V extends Value>(\n editor: PlateEditor<V>,\n {\n focused,\n }: {\n focused?: boolean;\n } = {},\n) => {\n if (floatingButtonSelectors.mode() === 'edit') {\n triggerFloatingButtonEdit(editor);\n return;\n }\n\n triggerFloatingButtonInsert(editor, {\n focused,\n });\n};\n"],"names":["triggerFloatingButton","editor","focused","floatingButtonSelectors","triggerFloatingButtonEdit","triggerFloatingButtonInsert"],"mappings":";;;AAMa,MAAAA,IAAwB,CACjCC,GACA;AAAA,EACI,SAAAC;AACJ,IAEI,OACH;AACG,MAAAC,EAAwB,KAAK,MAAM,QAAQ;AAC3C,IAAAC,EAA0BH,CAAM;AAChC;AAAA,EACJ;AAEA,EAAAI,EAA4BJ,GAAQ;AAAA,IAChC,SAAAC;AAAA,EAAA,CACH;AACL;"}
|
package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonEdit.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { findNode as g, getPluginType as l, getEditorString as u } from "@
|
|
1
|
+
import { findNode as g, getPluginType as l, getEditorString as u } from "@frontify/fondue";
|
|
2
2
|
import { floatingButtonActions as t } from "../components/FloatingButton/floatingButtonStore.es.js";
|
|
3
3
|
import { ELEMENT_BUTTON as f } from "../createButtonPlugin.es.js";
|
|
4
4
|
const E = (i) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"triggerFloatingButtonEdit.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonEdit.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { PlateEditor, Value, findNode, getEditorString, getPluginType } from '@
|
|
1
|
+
{"version":3,"file":"triggerFloatingButtonEdit.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonEdit.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { PlateEditor, Value, findNode, getEditorString, getPluginType } from '@frontify/fondue';\nimport { ELEMENT_BUTTON, TButtonElement } from '..';\nimport { floatingButtonActions } from '../components/FloatingButton/floatingButtonStore';\n\nexport const triggerFloatingButtonEdit = <V extends Value>(editor: PlateEditor<V>) => {\n const entry = findNode<TButtonElement>(editor, {\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n if (!entry) {\n return;\n }\n\n const [link, path] = entry;\n\n let text = getEditorString(editor, path);\n\n floatingButtonActions.url(link.url);\n\n floatingButtonActions.newTab(link.target === undefined);\n\n if (text === link.url) {\n text = '';\n }\n\n floatingButtonActions.text(text);\n\n floatingButtonActions.isEditing(true);\n};\n"],"names":["triggerFloatingButtonEdit","editor","entry","findNode","getPluginType","ELEMENT_BUTTON","link","path","text","getEditorString","floatingButtonActions"],"mappings":";;;AAMa,MAAAA,IAA4B,CAAkBC,MAA2B;AAC5E,QAAAC,IAAQC,EAAyBF,GAAQ;AAAA,IAC3C,OAAO,EAAE,MAAMG,EAAcH,GAAQI,CAAc,EAAE;AAAA,EAAA,CACxD;AACD,MAAI,CAACH;AACD;AAGE,QAAA,CAACI,GAAMC,CAAI,IAAIL;AAEjB,MAAAM,IAAOC,EAAgBR,GAAQM,CAAI;AAEjB,EAAAG,EAAA,IAAIJ,EAAK,GAAG,GAEZI,EAAA,OAAOJ,EAAK,WAAW,MAAS,GAElDE,MAASF,EAAK,QACPE,IAAA,KAGXE,EAAsB,KAAKF,CAAI,GAE/BE,EAAsB,UAAU,EAAI;AACxC;"}
|
package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonInsert.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isRangeAcrossBlocks as e, someNode as r, getPluginType as s, getEditorString as i } from "@
|
|
1
|
+
import { isRangeAcrossBlocks as e, someNode as r, getPluginType as s, getEditorString as i } from "@frontify/fondue";
|
|
2
2
|
import { floatingButtonSelectors as g, floatingButtonActions as n } from "../components/FloatingButton/floatingButtonStore.es.js";
|
|
3
3
|
import { ELEMENT_BUTTON as u } from "../createButtonPlugin.es.js";
|
|
4
4
|
const l = (t, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"triggerFloatingButtonInsert.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonInsert.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { PlateEditor, Value, getEditorString, getPluginType, isRangeAcrossBlocks, someNode } from '@
|
|
1
|
+
{"version":3,"file":"triggerFloatingButtonInsert.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonInsert.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { PlateEditor, Value, getEditorString, getPluginType, isRangeAcrossBlocks, someNode } from '@frontify/fondue';\nimport { floatingButtonActions, floatingButtonSelectors } from '../components/FloatingButton/floatingButtonStore';\nimport { ELEMENT_BUTTON } from '../createButtonPlugin';\n\n/**\n * Trigger floating button.\n *\n * Do not trigger when:\n * - selection is across blocks\n * - selection has more than one leaf node\n * - lowest selection is not text\n * - selection has a button node\n */\nexport const triggerFloatingButtonInsert = <V extends Value>(\n editor: PlateEditor<V>,\n {\n focused,\n }: {\n focused?: boolean;\n } = {},\n) => {\n if (floatingButtonSelectors.mode()) {\n return;\n }\n\n if (!focused) {\n return;\n }\n\n if (isRangeAcrossBlocks(editor, { at: editor.selection })) {\n return;\n }\n\n const hasButton = someNode(editor, {\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n if (hasButton) {\n return;\n }\n floatingButtonActions.text(getEditorString(editor, editor.selection));\n floatingButtonActions.show('insert', editor.id);\n};\n"],"names":["triggerFloatingButtonInsert","editor","focused","floatingButtonSelectors","isRangeAcrossBlocks","someNode","getPluginType","ELEMENT_BUTTON","floatingButtonActions","getEditorString"],"mappings":";;;AAea,MAAAA,IAA8B,CACvCC,GACA;AAAA,EACI,SAAAC;AACJ,IAEI,OACH;AAgBD,EAfIC,EAAwB,UAIxB,CAACD,KAIDE,EAAoBH,GAAQ,EAAE,IAAIA,EAAO,UAAA,CAAW,KAItCI,EAASJ,GAAQ;AAAA,IAC/B,OAAO,EAAE,MAAMK,EAAcL,GAAQM,CAAc,EAAE;AAAA,EAAA,CACxD,MAIDC,EAAsB,KAAKC,EAAgBR,GAAQA,EAAO,SAAS,CAAC,GAC9CO,EAAA,KAAK,UAAUP,EAAO,EAAE;AAClD;"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { isCollapsed as
|
|
2
|
-
import { Path as w } from "slate";
|
|
1
|
+
import { isCollapsed as l, getAboveNode as a, getPluginType as P, isStartPoint as g, getPreviousNodeEndPoint as x, isEndPoint as i, getNextNodeStartPoint as u, select as m, Path as E, insertNodes as h, withRemoveEmptyNodes as w, mockPlugin as T } from "@frontify/fondue";
|
|
3
2
|
import { ELEMENT_BUTTON as p } from "./createButtonPlugin.es.js";
|
|
4
|
-
const
|
|
3
|
+
const z = (t, { type: N }) => {
|
|
5
4
|
const { apply: f, normalizeNode: y } = t;
|
|
6
5
|
return t.apply = (s) => {
|
|
7
6
|
if (s.type !== "set_selection") {
|
|
@@ -9,45 +8,45 @@ const B = (t, { type: N }) => {
|
|
|
9
8
|
return;
|
|
10
9
|
}
|
|
11
10
|
const n = s.newProperties;
|
|
12
|
-
if (!(n != null && n.focus) || !n.anchor || !
|
|
11
|
+
if (!(n != null && n.focus) || !n.anchor || !l(n)) {
|
|
13
12
|
f(s);
|
|
14
13
|
return;
|
|
15
14
|
}
|
|
16
|
-
const
|
|
15
|
+
const o = a(t, {
|
|
17
16
|
at: n,
|
|
18
|
-
match: { type:
|
|
17
|
+
match: { type: P(t, p) }
|
|
19
18
|
});
|
|
20
|
-
if (
|
|
21
|
-
const [,
|
|
19
|
+
if (o) {
|
|
20
|
+
const [, c] = o;
|
|
22
21
|
let e;
|
|
23
|
-
g(t, n.focus,
|
|
22
|
+
g(t, n.focus, c) && (e = x(t, c)), i(t, n.focus, c) && (e = u(t, c)), e && (s.newProperties = {
|
|
24
23
|
anchor: e,
|
|
25
24
|
focus: e
|
|
26
25
|
});
|
|
27
26
|
}
|
|
28
27
|
f(s);
|
|
29
28
|
}, t.normalizeNode = ([s, n]) => {
|
|
30
|
-
if (s.type ===
|
|
31
|
-
const
|
|
32
|
-
if (
|
|
33
|
-
const
|
|
34
|
-
if (
|
|
35
|
-
|
|
29
|
+
if (s.type === P(t, p)) {
|
|
30
|
+
const o = t.selection;
|
|
31
|
+
if (o && l(o) && i(t, o.focus, n)) {
|
|
32
|
+
const c = u(t, n);
|
|
33
|
+
if (c)
|
|
34
|
+
m(t, c);
|
|
36
35
|
else {
|
|
37
|
-
const e =
|
|
38
|
-
|
|
36
|
+
const e = E.next(n);
|
|
37
|
+
h(t, { text: "" }, { at: e }), m(t, e);
|
|
39
38
|
}
|
|
40
39
|
}
|
|
41
40
|
}
|
|
42
41
|
y([s, n]);
|
|
43
|
-
},
|
|
42
|
+
}, w(
|
|
44
43
|
t,
|
|
45
|
-
|
|
44
|
+
T({
|
|
46
45
|
options: { types: N }
|
|
47
46
|
})
|
|
48
47
|
);
|
|
49
48
|
};
|
|
50
49
|
export {
|
|
51
|
-
|
|
50
|
+
z as withButton
|
|
52
51
|
};
|
|
53
52
|
//# sourceMappingURL=withButton.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withButton.es.js","sources":["../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/withButton.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n
|
|
1
|
+
{"version":3,"file":"withButton.es.js","sources":["../../../../../src/components/RichTextEditor/plugins/ButtonPlugin/withButton.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n EText,\n Path,\n PlateEditor,\n Point,\n Range,\n Value,\n WithOverride,\n getAboveNode,\n getNextNodeStartPoint,\n getPluginType,\n getPreviousNodeEndPoint,\n insertNodes,\n isCollapsed,\n isEndPoint,\n isStartPoint,\n mockPlugin,\n select,\n withRemoveEmptyNodes,\n} from '@frontify/fondue';\nimport { ELEMENT_BUTTON } from './createButtonPlugin';\n\n/**\n * Insert space after a url to wrap a button.\n * Lookup from the block start to the cursor to check if there is an url.\n * If not found, lookup before the cursor for a space character to check the url.\n *\n * On insert data:\n * Paste a string inside a button element will edit its children text but not its url.\n *\n */\n\nexport const withButton: WithOverride = (editor, { type }) => {\n const { apply, normalizeNode } = editor;\n\n editor.apply = (operation) => {\n if (operation.type !== 'set_selection') {\n apply(operation);\n return;\n }\n\n const range = operation.newProperties;\n if (!range?.focus || !range.anchor || !isCollapsed(range as Range)) {\n apply(operation);\n return;\n }\n\n const entry = getAboveNode(editor, {\n at: range as Range,\n match: { type: getPluginType(editor, ELEMENT_BUTTON) },\n });\n\n if (entry) {\n const [, path] = entry;\n\n let newPoint: Point | undefined;\n\n if (isStartPoint(editor, range.focus, path)) {\n newPoint = getPreviousNodeEndPoint(editor, path);\n }\n\n if (isEndPoint(editor, range.focus, path)) {\n newPoint = getNextNodeStartPoint(editor, path);\n }\n\n if (newPoint) {\n operation.newProperties = {\n anchor: newPoint,\n focus: newPoint,\n };\n }\n }\n\n apply(operation);\n };\n\n editor.normalizeNode = ([node, path]) => {\n if (node.type === getPluginType(editor, ELEMENT_BUTTON)) {\n const range = editor.selection as Range | null;\n\n if (range && isCollapsed(range) && isEndPoint(editor, range.focus, path)) {\n const nextPoint = getNextNodeStartPoint(editor, path);\n\n // select next text node if any\n if (nextPoint) {\n select(editor, nextPoint);\n } else {\n // insert text node then select\n const nextPath = Path.next(path);\n insertNodes(editor, { text: '' } as EText<Value>, { at: nextPath });\n select(editor, nextPath);\n }\n }\n }\n\n normalizeNode([node, path]);\n };\n\n return withRemoveEmptyNodes<Value, PlateEditor<Value>>(\n editor,\n mockPlugin<Record<string, any>, Value, PlateEditor<Value>>({\n options: { types: type },\n }),\n );\n};\n"],"names":["withButton","editor","type","apply","normalizeNode","operation","range","isCollapsed","entry","getAboveNode","getPluginType","ELEMENT_BUTTON","path","newPoint","isStartPoint","getPreviousNodeEndPoint","isEndPoint","getNextNodeStartPoint","node","nextPoint","select","nextPath","Path","insertNodes","withRemoveEmptyNodes","mockPlugin"],"mappings":";;AAkCO,MAAMA,IAA2B,CAACC,GAAQ,EAAE,MAAAC,QAAW;AACpD,QAAA,EAAE,OAAAC,GAAO,eAAAC,EAAkB,IAAAH;AAE1B,SAAAA,EAAA,QAAQ,CAACI,MAAc;AACtB,QAAAA,EAAU,SAAS,iBAAiB;AACpC,MAAAF,EAAME,CAAS;AACf;AAAA,IACJ;AAEA,UAAMC,IAAQD,EAAU;AACpB,QAAA,EAACC,KAAA,QAAAA,EAAO,UAAS,CAACA,EAAM,UAAU,CAACC,EAAYD,CAAc,GAAG;AAChE,MAAAH,EAAME,CAAS;AACf;AAAA,IACJ;AAEM,UAAAG,IAAQC,EAAaR,GAAQ;AAAA,MAC/B,IAAIK;AAAA,MACJ,OAAO,EAAE,MAAMI,EAAcT,GAAQU,CAAc,EAAE;AAAA,IAAA,CACxD;AAED,QAAIH,GAAO;AACD,YAAA,CAAG,EAAAI,CAAI,IAAIJ;AAEb,UAAAK;AAEJ,MAAIC,EAAab,GAAQK,EAAM,OAAOM,CAAI,MAC3BC,IAAAE,EAAwBd,GAAQW,CAAI,IAG/CI,EAAWf,GAAQK,EAAM,OAAOM,CAAI,MACzBC,IAAAI,EAAsBhB,GAAQW,CAAI,IAG7CC,MACAR,EAAU,gBAAgB;AAAA,QACtB,QAAQQ;AAAA,QACR,OAAOA;AAAA,MAAA;AAAA,IAGnB;AAEA,IAAAV,EAAME,CAAS;AAAA,EAAA,GAGnBJ,EAAO,gBAAgB,CAAC,CAACiB,GAAMN,CAAI,MAAM;AACrC,QAAIM,EAAK,SAASR,EAAcT,GAAQU,CAAc,GAAG;AACrD,YAAML,IAAQL,EAAO;AAEjB,UAAAK,KAASC,EAAYD,CAAK,KAAKU,EAAWf,GAAQK,EAAM,OAAOM,CAAI,GAAG;AAChE,cAAAO,IAAYF,EAAsBhB,GAAQW,CAAI;AAGpD,YAAIO;AACA,UAAAC,EAAOnB,GAAQkB,CAAS;AAAA,aACrB;AAEG,gBAAAE,IAAWC,EAAK,KAAKV,CAAI;AACnB,UAAAW,EAAAtB,GAAQ,EAAE,MAAM,MAAsB,EAAE,IAAIoB,GAAU,GAClED,EAAOnB,GAAQoB,CAAQ;AAAA,QAC3B;AAAA,MACJ;AAAA,IACJ;AAEc,IAAAjB,EAAA,CAACc,GAAMN,CAAI,CAAC;AAAA,EAAA,GAGvBY;AAAA,IACHvB;AAAA,IACAwB,EAA2D;AAAA,MACvD,SAAS,EAAE,OAAOvB,EAAK;AAAA,IAAA,CAC1B;AAAA,EAAA;AAET;"}
|
package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.es.js
CHANGED
|
@@ -1,19 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { jsx as e, jsxs as c, Fragment as u } from "react/jsx-runtime";
|
|
2
|
+
import { offset as g, flip as k, useFloatingLinkInsertState as F, useFloatingLinkInsert as L, useFloatingLinkEditState as x, useFloatingLinkEdit as y } from "@frontify/fondue";
|
|
3
|
+
import { InsertLinkModal as I } from "./InsertLinkModal/InsertLinkModal.es.js";
|
|
4
|
+
import { EditModal as P } from "./EditLinkModal/EditModal.es.js";
|
|
5
|
+
const r = {
|
|
6
|
+
placement: "bottom-start",
|
|
7
|
+
strategy: "absolute",
|
|
8
|
+
middleware: [
|
|
9
|
+
g(12),
|
|
10
|
+
k({
|
|
11
|
+
padding: 12,
|
|
12
|
+
fallbackPlacements: ["bottom-end", "top-start", "top-end"]
|
|
13
|
+
})
|
|
14
|
+
]
|
|
15
|
+
}, S = () => {
|
|
16
|
+
const n = F({
|
|
17
|
+
floatingOptions: r
|
|
18
|
+
}), { props: i, ref: d, hidden: l } = L(n), t = x({
|
|
19
|
+
floatingOptions: r
|
|
20
|
+
}), { props: o, ref: a, editButtonProps: p, unlinkButtonProps: f } = y(t);
|
|
21
|
+
if (l)
|
|
9
22
|
return null;
|
|
10
|
-
const
|
|
11
|
-
return /* @__PURE__ */
|
|
12
|
-
/* @__PURE__ */
|
|
13
|
-
/* @__PURE__ */
|
|
23
|
+
const s = /* @__PURE__ */ e(I, {}), m = t.isEditing ? s : /* @__PURE__ */ e(P, { editButtonProps: p, unlinkButtonProps: f });
|
|
24
|
+
return /* @__PURE__ */ c(u, { children: [
|
|
25
|
+
n.isOpen && !t.isOpen && /* @__PURE__ */ e("div", { ref: d, ...i, style: { ...i.style, zIndex: 1e3 }, children: s }),
|
|
26
|
+
t.isOpen && /* @__PURE__ */ e("div", { ref: a, ...o, style: { ...o.style, zIndex: 1e3 }, children: m })
|
|
14
27
|
] });
|
|
15
28
|
};
|
|
16
29
|
export {
|
|
17
|
-
|
|
30
|
+
S as CustomFloatingLink
|
|
18
31
|
};
|
|
19
32
|
//# sourceMappingURL=CustomFloatingLink.es.js.map
|
package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomFloatingLink.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {
|
|
1
|
+
{"version":3,"file":"CustomFloatingLink.es.js","sources":["../../../../../../src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n LinkFloatingToolbarState,\n UseVirtualFloatingOptions,\n flip,\n offset,\n useFloatingLinkEdit,\n useFloatingLinkEditState,\n useFloatingLinkInsert,\n useFloatingLinkInsertState,\n} from '@frontify/fondue';\nimport { EditModal } from './EditLinkModal';\nimport { InsertLinkModal } from './InsertLinkModal/InsertLinkModal';\n\nconst floatingOptions: UseVirtualFloatingOptions = {\n placement: 'bottom-start',\n strategy: 'absolute',\n middleware: [\n offset(12),\n flip({\n padding: 12,\n fallbackPlacements: ['bottom-end', 'top-start', 'top-end'],\n }),\n ],\n};\n\nexport type LinkFloatingToolbarProps = {\n state?: LinkFloatingToolbarState;\n};\n\nexport const CustomFloatingLink = () => {\n const insertState = useFloatingLinkInsertState({\n floatingOptions,\n });\n const { props: insertProps, ref: insertRef, hidden } = useFloatingLinkInsert(insertState);\n\n const editState = useFloatingLinkEditState({\n floatingOptions,\n });\n\n const { props: editProps, ref: editRef, editButtonProps, unlinkButtonProps } = useFloatingLinkEdit(editState);\n\n if (hidden) {\n return null;\n }\n\n const input = <InsertLinkModal />;\n const editContent = editState.isEditing ? (\n input\n ) : (\n <EditModal editButtonProps={editButtonProps} unlinkButtonProps={unlinkButtonProps} />\n );\n\n return (\n <>\n {insertState.isOpen && !editState.isOpen && (\n <div ref={insertRef} {...insertProps} style={{ ...insertProps.style, zIndex: 1000 }}>\n {input}\n </div>\n )}\n\n {editState.isOpen && (\n <div ref={editRef} {...editProps} style={{ ...editProps.style, zIndex: 1000 }}>\n {editContent}\n </div>\n )}\n </>\n );\n};\n"],"names":["floatingOptions","offset","flip","CustomFloatingLink","insertState","useFloatingLinkInsertState","insertProps","insertRef","hidden","useFloatingLinkInsert","editState","useFloatingLinkEditState","editProps","editRef","editButtonProps","unlinkButtonProps","useFloatingLinkEdit","input","InsertLinkModal","editContent","jsx","EditModal","jsxs","Fragment"],"mappings":";;;;AAeA,MAAMA,IAA6C;AAAA,EAC/C,WAAW;AAAA,EACX,UAAU;AAAA,EACV,YAAY;AAAA,IACRC,EAAO,EAAE;AAAA,IACTC,EAAK;AAAA,MACD,SAAS;AAAA,MACT,oBAAoB,CAAC,cAAc,aAAa,SAAS;AAAA,IAAA,CAC5D;AAAA,EACL;AACJ,GAMaC,IAAqB,MAAM;AACpC,QAAMC,IAAcC,EAA2B;AAAA,IAC3C,iBAAAL;AAAA,EAAA,CACH,GACK,EAAE,OAAOM,GAAa,KAAKC,GAAW,QAAAC,EAAO,IAAIC,EAAsBL,CAAW,GAElFM,IAAYC,EAAyB;AAAA,IACvC,iBAAAX;AAAA,EAAA,CACH,GAEK,EAAE,OAAOY,GAAW,KAAKC,GAAS,iBAAAC,GAAiB,mBAAAC,EAAsB,IAAAC,EAAoBN,CAAS;AAE5G,MAAIF;AACO,WAAA;AAGL,QAAAS,sBAASC,GAAgB,CAAA,CAAA,GACzBC,IAAcT,EAAU,YAC1BO,IAEC,gBAAAG,EAAAC,GAAA,EAAU,iBAAAP,GAAkC,mBAAAC,EAAsC,CAAA;AAGvF,SAES,gBAAAO,EAAAC,GAAA,EAAA,UAAA;AAAA,IAAAnB,EAAY,UAAU,CAACM,EAAU,UAC7B,gBAAAU,EAAA,OAAA,EAAI,KAAKb,GAAY,GAAGD,GAAa,OAAO,EAAE,GAAGA,EAAY,OAAO,QAAQ,OACxE,UACLW,GAAA;AAAA,IAGHP,EAAU,UACP,gBAAAU,EAAC,OAAI,EAAA,KAAKP,GAAU,GAAGD,GAAW,OAAO,EAAE,GAAGA,EAAU,OAAO,QAAQ,OAClE,UACLO,GAAA;AAAA,EAER,EAAA,CAAA;AAER;"}
|
package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.es.js
CHANGED
|
@@ -1,43 +1,35 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
className: "tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",
|
|
32
|
-
children: /* @__PURE__ */ t(n.UnlinkButton, { children: /* @__PURE__ */ t(r, {}) })
|
|
33
|
-
}
|
|
34
|
-
)
|
|
35
|
-
] })
|
|
36
|
-
] })
|
|
37
|
-
}
|
|
38
|
-
);
|
|
1
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
2
|
+
import { useLinkOpenButtonState as o, IconPen16 as s, IconTrashBin16 as d } from "@frontify/fondue";
|
|
3
|
+
import { getUrlFromLinkOrLegacyLink as l } from "../../../../../Link/utils/getUrl.es.js";
|
|
4
|
+
const p = ({ editButtonProps: i, unlinkButtonProps: r }) => {
|
|
5
|
+
const { element: e } = o(), a = e ? l(e) : "";
|
|
6
|
+
return /* @__PURE__ */ t("div", { "data-test-id": "floating-link-edit", className: "tw-bg-white tw-rounded tw-shadow tw-p-4 tw-min-w-[400px]", children: /* @__PURE__ */ n("span", { "data-test-id": "preview-link-flyout", className: "tw-flex tw-justify-between tw-items-center", children: [
|
|
7
|
+
/* @__PURE__ */ t("span", { className: "tw-pointer-events-none", children: a }),
|
|
8
|
+
/* @__PURE__ */ n("span", { className: "tw-flex tw-gap-2", children: [
|
|
9
|
+
/* @__PURE__ */ t(
|
|
10
|
+
"button",
|
|
11
|
+
{
|
|
12
|
+
tabIndex: 0,
|
|
13
|
+
"data-test-id": "edit-link-button",
|
|
14
|
+
className: "tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",
|
|
15
|
+
...i,
|
|
16
|
+
children: /* @__PURE__ */ t(s, {})
|
|
17
|
+
}
|
|
18
|
+
),
|
|
19
|
+
/* @__PURE__ */ t(
|
|
20
|
+
"button",
|
|
21
|
+
{
|
|
22
|
+
tabIndex: 0,
|
|
23
|
+
"data-test-id": "remove-link-button",
|
|
24
|
+
className: "tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",
|
|
25
|
+
...r,
|
|
26
|
+
children: /* @__PURE__ */ t(d, {})
|
|
27
|
+
}
|
|
28
|
+
)
|
|
29
|
+
] })
|
|
30
|
+
] }) });
|
|
39
31
|
};
|
|
40
32
|
export {
|
|
41
|
-
|
|
33
|
+
p as EditModal
|
|
42
34
|
};
|
|
43
35
|
//# sourceMappingURL=EditModal.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditModal.es.js","sources":["../../../../../../../src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconPen16, IconTrashBin16 } from '@frontify/fondue';\nimport {
|
|
1
|
+
{"version":3,"file":"EditModal.es.js","sources":["../../../../../../../src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { MouseEvent } from 'react';\nimport { IconPen16, IconTrashBin16, useLinkOpenButtonState } from '@frontify/fondue';\nimport { getUrlFromLinkOrLegacyLink } from '../../../../../Link';\n\ntype EditModalProps = {\n editButtonProps: {\n onClick: () => void;\n };\n unlinkButtonProps: {\n onMouseDown: (e: MouseEvent<HTMLButtonElement>) => void;\n onClick: () => void;\n };\n};\n\nexport const EditModal = ({ editButtonProps, unlinkButtonProps }: EditModalProps) => {\n const { element } = useLinkOpenButtonState();\n const url = element ? getUrlFromLinkOrLegacyLink(element) : '';\n\n return (\n <div data-test-id=\"floating-link-edit\" className=\"tw-bg-white tw-rounded tw-shadow tw-p-4 tw-min-w-[400px]\">\n <span data-test-id=\"preview-link-flyout\" className=\"tw-flex tw-justify-between tw-items-center\">\n <span className=\"tw-pointer-events-none\">{url}</span>\n <span className=\"tw-flex tw-gap-2\">\n <button\n tabIndex={0}\n data-test-id=\"edit-link-button\"\n className=\"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1\"\n {...editButtonProps}\n >\n <IconPen16 />\n </button>\n\n <button\n tabIndex={0}\n data-test-id=\"remove-link-button\"\n className=\"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1\"\n {...unlinkButtonProps}\n >\n <IconTrashBin16 />\n </button>\n </span>\n </span>\n </div>\n );\n};\n"],"names":["EditModal","editButtonProps","unlinkButtonProps","element","useLinkOpenButtonState","url","getUrlFromLinkOrLegacyLink","jsx","jsxs","IconPen16","IconTrashBin16"],"mappings":";;;AAgBO,MAAMA,IAAY,CAAC,EAAE,iBAAAC,GAAiB,mBAAAC,QAAwC;AAC3E,QAAA,EAAE,SAAAC,MAAYC,KACdC,IAAMF,IAAUG,EAA2BH,CAAO,IAAI;AAGxD,SAAA,gBAAAI,EAAC,OAAI,EAAA,gBAAa,sBAAqB,WAAU,4DAC7C,UAAA,gBAAAC,EAAC,QAAK,EAAA,gBAAa,uBAAsB,WAAU,8CAC/C,UAAA;AAAA,IAAC,gBAAAD,EAAA,QAAA,EAAK,WAAU,0BAA0B,UAAIF,GAAA;AAAA,IAC9C,gBAAAG,EAAC,QAAK,EAAA,WAAU,oBACZ,UAAA;AAAA,MAAA,gBAAAD;AAAA,QAAC;AAAA,QAAA;AAAA,UACG,UAAU;AAAA,UACV,gBAAa;AAAA,UACb,WAAU;AAAA,UACT,GAAGN;AAAA,UAEJ,4BAACQ,GAAU,EAAA;AAAA,QAAA;AAAA,MACf;AAAA,MAEA,gBAAAF;AAAA,QAAC;AAAA,QAAA;AAAA,UACG,UAAU;AAAA,UACV,gBAAa;AAAA,UACb,WAAU;AAAA,UACT,GAAGL;AAAA,UAEJ,4BAACQ,GAAe,EAAA;AAAA,QAAA;AAAA,MACpB;AAAA,IAAA,GACJ;AAAA,EAAA,EACJ,CAAA,EACJ,CAAA;AAER;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InsertLinkModal.es.js","sources":["../../../../../../../src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertLinkModal.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { InsertModal
|
|
1
|
+
{"version":3,"file":"InsertLinkModal.es.js","sources":["../../../../../../../src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertLinkModal.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { InsertModal } from './InsertModal';\nimport { useInsertModal } from './useInsertModal';\n\nexport const InsertLinkModal = () => <InsertModal {...useInsertModal()} testId=\"floating-link-insert\" />;\n"],"names":["InsertLinkModal","jsx","InsertModal","useInsertModal"],"mappings":";;;AAKa,MAAAA,IAAkB,MAAO,gBAAAC,EAAAC,GAAA,EAAa,GAAGC,EAAe,GAAG,QAAO,uBAAuB,CAAA;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InsertModal.es.js","sources":["../../../../../../../src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { AppBridgeBlock } from '@frontify/app-bridge';\nimport {\n Button,\n ButtonEmphasis,\n ButtonSize,\n ButtonStyle,\n FormControl,\n IconCheckMark20,\n TextInput,\n} from '@frontify/fondue';\nimport {
|
|
1
|
+
{"version":3,"file":"InsertModal.es.js","sources":["../../../../../../../src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { MouseEvent, ReactElement, ReactNode } from 'react';\nimport { AppBridgeBlock } from '@frontify/app-bridge';\nimport {\n Button,\n ButtonEmphasis,\n ButtonSize,\n ButtonStyle,\n FormControl,\n IconCheckMark20,\n TextInput,\n} from '@frontify/fondue';\nimport { InsertModalStateProps } from './types';\nimport { LinkInput } from '../../../../../Link';\n\ntype Props = {\n state: InsertModalStateProps;\n onTextChange: (value: string) => void;\n onUrlChange: (value: string) => void;\n onToggleTab: (checked: boolean) => void;\n onCancel: () => void;\n onSave: (event: MouseEvent<HTMLButtonElement, globalThis.MouseEvent> | KeyboardEvent | undefined) => void;\n hasValues: boolean;\n isValidUrlOrEmpty: (url: string) => boolean;\n testId?: string;\n children?: ReactNode;\n appBridge: AppBridgeBlock;\n};\n\nexport const InsertModal = ({\n state,\n onTextChange,\n onUrlChange,\n onToggleTab,\n onCancel,\n onSave,\n isValidUrlOrEmpty,\n hasValues,\n testId,\n appBridge,\n children,\n}: Props): ReactElement => (\n <div data-test-id={testId} className=\"tw-bg-white tw-rounded tw-shadow tw-p-7 tw-min-w-[400px] tw-overflow-y-auto\">\n <FormControl\n label={{\n children: 'Text',\n htmlFor: 'linkText',\n required: true,\n }}\n >\n <TextInput id=\"linkText\" value={state.text} placeholder=\"Link Text\" onChange={onTextChange} />\n </FormControl>\n\n {children}\n\n <div className=\"tw-mt-5\">\n <LinkInput\n url={state.url}\n newTab={state.newTab}\n onUrlChange={onUrlChange}\n onToggleTab={onToggleTab}\n isValidUrlOrEmpty={isValidUrlOrEmpty}\n appBridge={appBridge}\n />\n </div>\n <div className=\"tw-mt-3\">\n <div className={'tw-pt-5 tw-flex tw-gap-x-3 tw-justify-end tw-border-t tw-border-t-black-10'}>\n <Button\n onClick={onCancel}\n size={ButtonSize.Medium}\n style={ButtonStyle.Default}\n emphasis={ButtonEmphasis.Default}\n >\n Cancel\n </Button>\n <Button\n onClick={onSave}\n size={ButtonSize.Medium}\n icon={<IconCheckMark20 />}\n disabled={!isValidUrlOrEmpty(state?.url) || !hasValues}\n >\n Save\n </Button>\n </div>\n </div>\n </div>\n);\n"],"names":["InsertModal","state","onTextChange","onUrlChange","onToggleTab","onCancel","onSave","isValidUrlOrEmpty","hasValues","testId","appBridge","children","jsxs","jsx","FormControl","TextInput","LinkInput","Button","ButtonSize","ButtonStyle","ButtonEmphasis","IconCheckMark20"],"mappings":";;;AA8BO,MAAMA,IAAc,CAAC;AAAA,EACxB,OAAAC;AAAA,EACA,cAAAC;AAAA,EACA,aAAAC;AAAA,EACA,aAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,QAAAC;AAAA,EACA,WAAAC;AAAA,EACA,UAAAC;AACJ,MACK,gBAAAC,EAAA,OAAA,EAAI,gBAAcH,GAAQ,WAAU,+EACjC,UAAA;AAAA,EAAA,gBAAAI;AAAA,IAACC;AAAA,IAAA;AAAA,MACG,OAAO;AAAA,QACH,UAAU;AAAA,QACV,SAAS;AAAA,QACT,UAAU;AAAA,MACd;AAAA,MAEA,UAAA,gBAAAD,EAACE,GAAU,EAAA,IAAG,YAAW,OAAOd,EAAM,MAAM,aAAY,aAAY,UAAUC,EAAc,CAAA;AAAA,IAAA;AAAA,EAChG;AAAA,EAECS;AAAA,EAED,gBAAAE,EAAC,OAAI,EAAA,WAAU,WACX,UAAA,gBAAAA;AAAA,IAACG;AAAA,IAAA;AAAA,MACG,KAAKf,EAAM;AAAA,MACX,QAAQA,EAAM;AAAA,MACd,aAAAE;AAAA,MACA,aAAAC;AAAA,MACA,mBAAAG;AAAA,MACA,WAAAG;AAAA,IAAA;AAAA,EAAA,GAER;AAAA,oBACC,OAAI,EAAA,WAAU,WACX,UAAC,gBAAAE,EAAA,OAAA,EAAI,WAAW,8EACZ,UAAA;AAAA,IAAA,gBAAAC;AAAA,MAACI;AAAA,MAAA;AAAA,QACG,SAASZ;AAAA,QACT,MAAMa,EAAW;AAAA,QACjB,OAAOC,EAAY;AAAA,QACnB,UAAUC,EAAe;AAAA,QAC5B,UAAA;AAAA,MAAA;AAAA,IAED;AAAA,IACA,gBAAAP;AAAA,MAACI;AAAA,MAAA;AAAA,QACG,SAASX;AAAA,QACT,MAAMY,EAAW;AAAA,QACjB,wBAAOG,GAAgB,EAAA;AAAA,QACvB,UAAU,CAACd,EAAkBN,KAAA,gBAAAA,EAAO,GAAG,KAAK,CAACO;AAAA,QAChD,UAAA;AAAA,MAAA;AAAA,IAED;AAAA,EAAA,EAAA,CACJ,EACJ,CAAA;AAAA,EACJ,CAAA;"}
|