payload-richtext-tiptap 0.0.70 → 0.0.72
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/src/fields/TiptapEditor/Components.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/Components.js +3 -4
- package/dist/src/fields/TiptapEditor/Components.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/AICommand/AICommand.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/AICommand/AICommand.js +2 -2
- package/dist/src/fields/TiptapEditor/extensions/AICommand/AICommand.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/AICommand/groups.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/AICommand/groups.js +16 -15
- package/dist/src/fields/TiptapEditor/extensions/AICommand/groups.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/AudioBlock/AudioBlock.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/AudioBlock/AudioBlock.js +1 -0
- package/dist/src/fields/TiptapEditor/extensions/AudioBlock/AudioBlock.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/AudioBlock/components/AudioBlockMenu.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/AudioBlock/components/AudioBlockMenu.js +5 -4
- package/dist/src/fields/TiptapEditor/extensions/AudioBlock/components/AudioBlockMenu.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/FontSize/FontSize.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/Heading/Heading.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/Iframe/menus/IframeMenu.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/Iframe/menus/IframeMenu.js +2 -1
- package/dist/src/fields/TiptapEditor/extensions/Iframe/menus/IframeMenu.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/ImageBlock/ImageBlock.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/ImageBlock/ImageBlock.js +1 -0
- package/dist/src/fields/TiptapEditor/extensions/ImageBlock/ImageBlock.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/ImageBlock/components/ImageBlockMenu.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/ImageBlock/components/ImageBlockMenu.js +4 -3
- package/dist/src/fields/TiptapEditor/extensions/ImageBlock/components/ImageBlockMenu.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/InsideLinks/InsideLink.client.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/InsideLinks/InsideLinksComponent.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/InsideLinks/InsideLinksComponent.js +1 -0
- package/dist/src/fields/TiptapEditor/extensions/InsideLinks/InsideLinksComponent.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/MultiColumn/Columns.js +3 -3
- package/dist/src/fields/TiptapEditor/extensions/MultiColumn/Columns.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/MultiColumn/menus/ColumnsMenu.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/MultiColumn/menus/ColumnsMenu.js +4 -3
- package/dist/src/fields/TiptapEditor/extensions/MultiColumn/menus/ColumnsMenu.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/SlashCommand/MenuList.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/SlashCommand/SlashCommand.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/SlashCommand/SlashCommand.js +2 -2
- package/dist/src/fields/TiptapEditor/extensions/SlashCommand/SlashCommand.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/SlashCommand/groups.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/SlashCommand/groups.js +30 -29
- package/dist/src/fields/TiptapEditor/extensions/SlashCommand/groups.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/VideoBlock.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/VideoBlock.js +1 -0
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/VideoBlock.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockMenu.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockMenu.js +5 -4
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockMenu.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/extension-kit.d.ts +1 -1
- package/dist/src/fields/TiptapEditor/features/BlockEditor/BlockEditor.d.ts +2 -2
- package/dist/src/fields/TiptapEditor/features/BlockEditor/BlockEditor.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/features/BlockEditor/BlockEditor.js +16 -1
- package/dist/src/fields/TiptapEditor/features/BlockEditor/BlockEditor.js.map +1 -1
- package/dist/src/fields/TiptapEditor/features/BlockEditor/components/EditorHeader.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/features/BlockEditor/components/EditorHeader.js +2 -1
- package/dist/src/fields/TiptapEditor/features/BlockEditor/components/EditorHeader.js.map +1 -1
- package/dist/src/fields/TiptapEditor/features/BlockEditor/types.d.ts +7 -0
- package/dist/src/fields/TiptapEditor/features/BlockEditor/types.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/features/BlockEditor/types.js.map +1 -1
- package/dist/src/fields/TiptapEditor/features/menus/ContentItemMenu/ContentItemMenu.js +5 -4
- package/dist/src/fields/TiptapEditor/features/menus/ContentItemMenu/ContentItemMenu.js.map +1 -1
- package/dist/src/fields/TiptapEditor/features/menus/TextMenu/TextMenu.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/features/menus/TextMenu/TextMenu.js +16 -15
- package/dist/src/fields/TiptapEditor/features/menus/TextMenu/TextMenu.js.map +1 -1
- package/dist/src/fields/TiptapEditor/features/menus/TextMenu/components/EditIframeLinkPopover.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/features/menus/TextMenu/components/EditIframeLinkPopover.js +2 -1
- package/dist/src/fields/TiptapEditor/features/menus/TextMenu/components/EditIframeLinkPopover.js.map +1 -1
- package/dist/src/fields/TiptapEditor/features/menus/TextMenu/components/EditLinkPopover.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/features/menus/TextMenu/components/EditLinkPopover.js +2 -1
- package/dist/src/fields/TiptapEditor/features/menus/TextMenu/components/EditLinkPopover.js.map +1 -1
- package/dist/src/fields/TiptapEditor/features/menus/TextMenu/components/FontFamilyPicker.js.map +1 -1
- package/dist/src/fields/TiptapEditor/features/menus/TextMenu/components/FontSizePicker.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/features/menus/TextMenu/components/FontSizePicker.js +24 -23
- package/dist/src/fields/TiptapEditor/features/menus/TextMenu/components/FontSizePicker.js.map +1 -1
- package/dist/src/fields/TiptapEditor/features/menus/TextMenu/components/SocialMediaPopover.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/features/menus/TextMenu/components/SocialMediaPopover.js +2 -1
- package/dist/src/fields/TiptapEditor/features/menus/TextMenu/components/SocialMediaPopover.js.map +1 -1
- package/dist/src/fields/TiptapEditor/features/menus/TextMenu/components/ai-selector-commands.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/features/menus/TextMenu/components/ai-selector-commands.js +2 -1
- package/dist/src/fields/TiptapEditor/features/menus/TextMenu/components/ai-selector-commands.js.map +1 -1
- package/dist/src/fields/TiptapEditor/features/menus/TextMenu/hooks/useTextmenuContentTypes.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/features/menus/TextMenu/hooks/useTextmenuContentTypes.js +9 -8
- package/dist/src/fields/TiptapEditor/features/menus/TextMenu/hooks/useTextmenuContentTypes.js.map +1 -1
- package/dist/src/fields/TiptapEditor/features/panels/AICommandPanel/AICommandPanel.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/features/panels/AICommandPanel/AICommandPanel.js +2 -1
- package/dist/src/fields/TiptapEditor/features/panels/AICommandPanel/AICommandPanel.js.map +1 -1
- package/dist/src/fields/TiptapEditor/features/panels/AIEditorPanel/AIEditorPanel.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/features/panels/AIEditorPanel/AIEditorPanel.js +2 -1
- package/dist/src/fields/TiptapEditor/features/panels/AIEditorPanel/AIEditorPanel.js.map +1 -1
- package/dist/src/fields/TiptapEditor/features/panels/Colorpicker/Colorpicker.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/features/panels/Colorpicker/Colorpicker.js +2 -1
- package/dist/src/fields/TiptapEditor/features/panels/Colorpicker/Colorpicker.js.map +1 -1
- package/dist/src/fields/TiptapEditor/features/panels/IframeLinkEditorPanel/IframeLinkEditorPanel.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/features/panels/IframeLinkEditorPanel/IframeLinkEditorPanel.js +2 -1
- package/dist/src/fields/TiptapEditor/features/panels/IframeLinkEditorPanel/IframeLinkEditorPanel.js.map +1 -1
- package/dist/src/fields/TiptapEditor/features/panels/LinkEditorPanel/LinkEditorPanel.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/features/panels/LinkEditorPanel/LinkEditorPanel.js +2 -1
- package/dist/src/fields/TiptapEditor/features/panels/LinkEditorPanel/LinkEditorPanel.js.map +1 -1
- package/dist/src/fields/TiptapEditor/hooks/useBlockEditor.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/hooks/useBlockEditor.js +4 -10
- package/dist/src/fields/TiptapEditor/hooks/useBlockEditor.js.map +1 -1
- package/dist/src/fields/TiptapEditor/lib/extract.d.ts +3 -1
- package/dist/src/fields/TiptapEditor/lib/extract.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/lib/extract.js +12 -0
- package/dist/src/fields/TiptapEditor/lib/extract.js.map +1 -1
- package/dist/src/fields/TiptapEditor/lib/utils/cssVar.js.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/styles.css +2 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +39 -38
- package/dist/src/fields/TiptapEditor/extensions/TableOfContentsNode/TableOfContentsNode.d.ts +0 -10
- package/dist/src/fields/TiptapEditor/extensions/TableOfContentsNode/TableOfContentsNode.d.ts.map +0 -1
- package/dist/src/fields/TiptapEditor/extensions/TableOfContentsNode/TableOfContentsNode.js +0 -55
- package/dist/src/fields/TiptapEditor/extensions/TableOfContentsNode/TableOfContentsNode.js.map +0 -1
- package/dist/src/fields/TiptapEditor/extensions/TableOfContentsNode/index.d.ts +0 -2
- package/dist/src/fields/TiptapEditor/extensions/TableOfContentsNode/index.d.ts.map +0 -1
- package/dist/src/fields/TiptapEditor/extensions/TableOfContentsNode/index.js +0 -3
- package/dist/src/fields/TiptapEditor/extensions/TableOfContentsNode/index.js.map +0 -1
- package/dist/src/fields/TiptapEditor/features/Sidebar/Sidebar.d.ts +0 -8
- package/dist/src/fields/TiptapEditor/features/Sidebar/Sidebar.d.ts.map +0 -1
- package/dist/src/fields/TiptapEditor/features/Sidebar/Sidebar.js +0 -32
- package/dist/src/fields/TiptapEditor/features/Sidebar/Sidebar.js.map +0 -1
- package/dist/src/fields/TiptapEditor/features/Sidebar/index.d.ts +0 -2
- package/dist/src/fields/TiptapEditor/features/Sidebar/index.d.ts.map +0 -1
- package/dist/src/fields/TiptapEditor/features/Sidebar/index.js +0 -3
- package/dist/src/fields/TiptapEditor/features/Sidebar/index.js.map +0 -1
- package/dist/src/fields/TiptapEditor/features/TableOfContents/TableOfContents.d.ts +0 -8
- package/dist/src/fields/TiptapEditor/features/TableOfContents/TableOfContents.d.ts.map +0 -1
- package/dist/src/fields/TiptapEditor/features/TableOfContents/TableOfContents.js +0 -57
- package/dist/src/fields/TiptapEditor/features/TableOfContents/TableOfContents.js.map +0 -1
- package/dist/src/fields/TiptapEditor/features/TableOfContents/index.d.ts +0 -2
- package/dist/src/fields/TiptapEditor/features/TableOfContents/index.d.ts.map +0 -1
- package/dist/src/fields/TiptapEditor/features/TableOfContents/index.js +0 -3
- package/dist/src/fields/TiptapEditor/features/TableOfContents/index.js.map +0 -1
|
@@ -8,6 +8,7 @@ import { Icon } from "../../../features/ui/Icon.js";
|
|
|
8
8
|
import { Toolbar } from "../../../features/ui/Toolbar.js";
|
|
9
9
|
import { getRenderContainer } from "../../../lib/utils/index.js";
|
|
10
10
|
import { ImageBlockWidth } from "./ImageBlockWidth.js";
|
|
11
|
+
import i18next from "i18next";
|
|
11
12
|
export const ImageBlockMenu = ({ editor, appendTo })=>{
|
|
12
13
|
const menuRef = useRef(null);
|
|
13
14
|
const tippyInstance = useRef(null);
|
|
@@ -88,7 +89,7 @@ export const ImageBlockMenu = ({ editor, appendTo })=>{
|
|
|
88
89
|
children: [
|
|
89
90
|
/*#__PURE__*/ _jsx(Toolbar.Button, {
|
|
90
91
|
type: "button",
|
|
91
|
-
tooltip: "Align image left",
|
|
92
|
+
tooltip: i18next.t("alignImageLeft") || "Align image left",
|
|
92
93
|
active: editor.isActive("imageBlock", {
|
|
93
94
|
align: "left"
|
|
94
95
|
}),
|
|
@@ -99,7 +100,7 @@ export const ImageBlockMenu = ({ editor, appendTo })=>{
|
|
|
99
100
|
}),
|
|
100
101
|
/*#__PURE__*/ _jsx(Toolbar.Button, {
|
|
101
102
|
type: "button",
|
|
102
|
-
tooltip: "Align image center",
|
|
103
|
+
tooltip: i18next.t("alignImageCenter") || "Align image center",
|
|
103
104
|
active: editor.isActive("imageBlock", {
|
|
104
105
|
align: "center"
|
|
105
106
|
}),
|
|
@@ -110,7 +111,7 @@ export const ImageBlockMenu = ({ editor, appendTo })=>{
|
|
|
110
111
|
}),
|
|
111
112
|
/*#__PURE__*/ _jsx(Toolbar.Button, {
|
|
112
113
|
type: "button",
|
|
113
|
-
tooltip: "Align image right",
|
|
114
|
+
tooltip: i18next.t("alignImageRight") || "Align image right",
|
|
114
115
|
active: editor.isActive("imageBlock", {
|
|
115
116
|
align: "right"
|
|
116
117
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../src/fields/TiptapEditor/extensions/ImageBlock/components/ImageBlockMenu.tsx"],"sourcesContent":["import { BubbleMenu as BaseBubbleMenu } from \"@tiptap/react\";\nimport { ReactNode, useCallback, useRef } from \"react\";\nimport { Instance, sticky } from \"tippy.js\";\nimport { v4 as uuid } from \"uuid\";\n\nimport {\n AlignHorizontalDistributeCenter,\n AlignHorizontalDistributeEnd,\n AlignHorizontalDistributeStart,\n} from \"lucide-react\";\nimport { MenuProps } from \"../../../features/menus/types.js\";\nimport { Icon } from \"../../../features/ui/Icon.js\";\nimport { Toolbar } from \"../../../features/ui/Toolbar.js\";\nimport { getRenderContainer } from \"../../../lib/utils/index.js\";\nimport { ImageBlockWidth } from \"./ImageBlockWidth.js\";\n\nexport const ImageBlockMenu = ({ editor, appendTo }: MenuProps): ReactNode => {\n const menuRef = useRef<HTMLDivElement>(null);\n const tippyInstance = useRef<Instance | null>(null);\n\n const getReferenceClientRect = useCallback(() => {\n const renderContainer = getRenderContainer(editor, \"node-imageBlock\");\n const rect =\n renderContainer?.getBoundingClientRect() ||\n new DOMRect(-1000, -1000, 0, 0);\n\n return rect;\n }, [editor]);\n\n const shouldShow = useCallback(() => {\n const isActive = editor.isActive(\"imageBlock\");\n\n return isActive;\n }, [editor]);\n\n const onAlignImageLeft = useCallback(() => {\n editor\n .chain()\n .focus(undefined, { scrollIntoView: false })\n .setImageBlockAlign(\"left\")\n .run();\n }, [editor]);\n\n const onAlignImageCenter = useCallback(() => {\n editor\n .chain()\n .focus(undefined, { scrollIntoView: false })\n .setImageBlockAlign(\"center\")\n .run();\n }, [editor]);\n\n const onAlignImageRight = useCallback(() => {\n editor\n .chain()\n .focus(undefined, { scrollIntoView: false })\n .setImageBlockAlign(\"right\")\n .run();\n }, [editor]);\n\n const onWidthChange = useCallback(\n (value: number) => {\n editor\n .chain()\n .focus(undefined, { scrollIntoView: false })\n .setImageBlockWidth(value)\n .run();\n },\n [editor]\n );\n\n return (\n <BaseBubbleMenu\n editor={editor}\n pluginKey={`imageBlockMenu-${uuid()}`}\n shouldShow={shouldShow}\n updateDelay={0}\n tippyOptions={{\n offset: [0, 8],\n popperOptions: {\n modifiers: [{ name: \"flip\", enabled: false }],\n },\n getReferenceClientRect,\n onCreate: (instance: Instance) => {\n tippyInstance.current = instance;\n },\n appendTo: () => {\n return appendTo?.current;\n },\n plugins: [sticky],\n sticky: \"popper\",\n }}\n >\n <Toolbar.Wrapper shouldShowContent={shouldShow()} ref={menuRef}>\n <Toolbar.Button\n type=\"button\"\n tooltip
|
|
1
|
+
{"version":3,"sources":["../../../../../../../src/fields/TiptapEditor/extensions/ImageBlock/components/ImageBlockMenu.tsx"],"sourcesContent":["import { BubbleMenu as BaseBubbleMenu } from \"@tiptap/react\";\nimport { ReactNode, useCallback, useRef } from \"react\";\nimport { Instance, sticky } from \"tippy.js\";\nimport { v4 as uuid } from \"uuid\";\n\nimport {\n AlignHorizontalDistributeCenter,\n AlignHorizontalDistributeEnd,\n AlignHorizontalDistributeStart,\n} from \"lucide-react\";\nimport { MenuProps } from \"../../../features/menus/types.js\";\nimport { Icon } from \"../../../features/ui/Icon.js\";\nimport { Toolbar } from \"../../../features/ui/Toolbar.js\";\nimport { getRenderContainer } from \"../../../lib/utils/index.js\";\nimport { ImageBlockWidth } from \"./ImageBlockWidth.js\";\nimport i18next from \"i18next\";\n\nexport const ImageBlockMenu = ({ editor, appendTo }: MenuProps): ReactNode => {\n const menuRef = useRef<HTMLDivElement>(null);\n const tippyInstance = useRef<Instance | null>(null);\n\n const getReferenceClientRect = useCallback(() => {\n const renderContainer = getRenderContainer(editor, \"node-imageBlock\");\n const rect =\n renderContainer?.getBoundingClientRect() ||\n new DOMRect(-1000, -1000, 0, 0);\n\n return rect;\n }, [editor]);\n\n const shouldShow = useCallback(() => {\n const isActive = editor.isActive(\"imageBlock\");\n\n return isActive;\n }, [editor]);\n\n const onAlignImageLeft = useCallback(() => {\n editor\n .chain()\n .focus(undefined, { scrollIntoView: false })\n .setImageBlockAlign(\"left\")\n .run();\n }, [editor]);\n\n const onAlignImageCenter = useCallback(() => {\n editor\n .chain()\n .focus(undefined, { scrollIntoView: false })\n .setImageBlockAlign(\"center\")\n .run();\n }, [editor]);\n\n const onAlignImageRight = useCallback(() => {\n editor\n .chain()\n .focus(undefined, { scrollIntoView: false })\n .setImageBlockAlign(\"right\")\n .run();\n }, [editor]);\n\n const onWidthChange = useCallback(\n (value: number) => {\n editor\n .chain()\n .focus(undefined, { scrollIntoView: false })\n .setImageBlockWidth(value)\n .run();\n },\n [editor]\n );\n\n return (\n <BaseBubbleMenu\n editor={editor}\n pluginKey={`imageBlockMenu-${uuid()}`}\n shouldShow={shouldShow}\n updateDelay={0}\n tippyOptions={{\n offset: [0, 8],\n popperOptions: {\n modifiers: [{ name: \"flip\", enabled: false }],\n },\n getReferenceClientRect,\n onCreate: (instance: Instance) => {\n tippyInstance.current = instance;\n },\n appendTo: () => {\n return appendTo?.current;\n },\n plugins: [sticky],\n sticky: \"popper\",\n }}\n >\n <Toolbar.Wrapper shouldShowContent={shouldShow()} ref={menuRef}>\n <Toolbar.Button\n type=\"button\"\n tooltip={i18next.t(\"alignImageLeft\") || \"Align image left\"}\n active={editor.isActive(\"imageBlock\", { align: \"left\" })}\n onClick={onAlignImageLeft}\n >\n <Icon icon={AlignHorizontalDistributeStart} />\n </Toolbar.Button>\n <Toolbar.Button\n type=\"button\"\n tooltip={i18next.t(\"alignImageCenter\") || \"Align image center\"}\n active={editor.isActive(\"imageBlock\", { align: \"center\" })}\n onClick={onAlignImageCenter}\n >\n <Icon icon={AlignHorizontalDistributeCenter} />\n </Toolbar.Button>\n <Toolbar.Button\n type=\"button\"\n tooltip={i18next.t(\"alignImageRight\") || \"Align image right\"}\n active={editor.isActive(\"imageBlock\", { align: \"right\" })}\n onClick={onAlignImageRight}\n >\n <Icon icon={AlignHorizontalDistributeEnd} />\n </Toolbar.Button>\n <Toolbar.Divider />\n <ImageBlockWidth\n onChange={onWidthChange}\n value={parseInt(editor.getAttributes(\"imageBlock\").width)}\n />\n </Toolbar.Wrapper>\n </BaseBubbleMenu>\n );\n};\n\nexport default ImageBlockMenu;\n"],"names":["BubbleMenu","BaseBubbleMenu","useCallback","useRef","sticky","v4","uuid","AlignHorizontalDistributeCenter","AlignHorizontalDistributeEnd","AlignHorizontalDistributeStart","Icon","Toolbar","getRenderContainer","ImageBlockWidth","i18next","ImageBlockMenu","editor","appendTo","menuRef","tippyInstance","getReferenceClientRect","renderContainer","rect","getBoundingClientRect","DOMRect","shouldShow","isActive","onAlignImageLeft","chain","focus","undefined","scrollIntoView","setImageBlockAlign","run","onAlignImageCenter","onAlignImageRight","onWidthChange","value","setImageBlockWidth","pluginKey","updateDelay","tippyOptions","offset","popperOptions","modifiers","name","enabled","onCreate","instance","current","plugins","Wrapper","shouldShowContent","ref","Button","type","tooltip","t","active","align","onClick","icon","Divider","onChange","parseInt","getAttributes","width"],"mappings":";AAAA,SAASA,cAAcC,cAAc,QAAQ,gBAAgB;AAC7D,SAAoBC,WAAW,EAAEC,MAAM,QAAQ,QAAQ;AACvD,SAAmBC,MAAM,QAAQ,WAAW;AAC5C,SAASC,MAAMC,IAAI,QAAQ,OAAO;AAElC,SACEC,+BAA+B,EAC/BC,4BAA4B,EAC5BC,8BAA8B,QACzB,eAAe;AAEtB,SAASC,IAAI,QAAQ,+BAA+B;AACpD,SAASC,OAAO,QAAQ,kCAAkC;AAC1D,SAASC,kBAAkB,QAAQ,8BAA8B;AACjE,SAASC,eAAe,QAAQ,uBAAuB;AACvD,OAAOC,aAAa,UAAU;AAE9B,OAAO,MAAMC,iBAAiB,CAAC,EAAEC,MAAM,EAAEC,QAAQ,EAAa;IAC5D,MAAMC,UAAUf,OAAuB;IACvC,MAAMgB,gBAAgBhB,OAAwB;IAE9C,MAAMiB,yBAAyBlB,YAAY;QACzC,MAAMmB,kBAAkBT,mBAAmBI,Q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;QACV;kBAEA,cAAA,MAACO,QAAQwC,OAAO;YAACC,mBAAmB3B;YAAc4B,KAAKnC;;8BACrD,KAACP,QAAQ2C,MAAM;oBACbC,MAAK;oBACLC,SAAS1C,QAAQ2C,CAAC,CAAC,qBAAqB;oBACxCC,QAAQ1C,OAAOU,QAAQ,CAAC,cAAc;wBAAEiC,OAAO;oBAAO;oBACtDC,SAASjC;8BAET,cAAA,KAACjB;wBAAKmD,MAAMpD;;;8BAEd,KAACE,QAAQ2C,MAAM;oBACbC,MAAK;oBACLC,SAAS1C,QAAQ2C,CAAC,CAAC,uBAAuB;oBAC1CC,QAAQ1C,OAAOU,QAAQ,CAAC,cAAc;wBAAEiC,OAAO;oBAAS;oBACxDC,SAAS1B;8BAET,cAAA,KAACxB;wBAAKmD,MAAMtD;;;8BAEd,KAACI,QAAQ2C,MAAM;oBACbC,MAAK;oBACLC,SAAS1C,QAAQ2C,CAAC,CAAC,sBAAsB;oBACzCC,QAAQ1C,OAAOU,QAAQ,CAAC,cAAc;wBAAEiC,OAAO;oBAAQ;oBACvDC,SAASzB;8BAET,cAAA,KAACzB;wBAAKmD,MAAMrD;;;8BAEd,KAACG,QAAQmD,OAAO;8BAChB,KAACjD;oBACCkD,UAAU3B;oBACVC,OAAO2B,SAAShD,OAAOiD,aAAa,CAAC,cAAcC,KAAK;;;;;AAKlE,EAAE;AAEF,eAAenD,eAAe"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/InsideLinks/InsideLink.client.tsx"],"sourcesContent":["\"use client\";\n\n// import { CustomRelationShipComponent } from '@/components/CustomRelationshipComponent'\n// import { PayloadAsyncSelect } from '@/components/PayloadAsyncSelect'\nimport { Button } from \"@payloadcms/ui/elements/Button\";\nimport { useCallback, useState } from \"react\";\n\nconst limit = 10;\nexport const ContentRelationship = ({\n setRelationship,\n cancelSelection,\n}: {\n type?: string;\n relationId?: string;\n cancelSelection: () => void;\n setRelationship: ({\n id,\n type,\n thumbnail,\n title,\n url,\n }: {\n id: string;\n type: string;\n thumbnail: string;\n title: string;\n url: string;\n }) => void;\n}) => {\n const [optionType, setOptionType] = useState(\"articles\");\n const [relationOption, setRelationOption] = useState<any>(null);\n const opts = [\n {\n label: \"Article\",\n value: \"articles\",\n },\n {\n label: \"Video\",\n value: \"video\",\n },\n {\n label: \"Audio\",\n value: \"audios\",\n },\n // {\n // label: 'Media',\n // value: 'media',\n // },\n ];\n\n const fetchContentTypes = useCallback(\n async (search: any, loadedOptions: any, { page }: any) => {\n try {\n // Perform your API call with the endpoint and inputValue\n\n return {\n options: opts,\n hasMore: opts?.length === limit,\n additional: {\n page: page + 1,\n },\n };\n } catch (error) {\n // console.error('Error fetching data:', error)\n }\n },\n []\n );\n return (\n <div className=\"w-full min-w-[300px] \">\n {/* <PayloadAsyncSelect\n fetchData={fetchContentTypes as any}\n handleChange={(val: string) => {\n setOptionType(val);\n }}\n defaultValue={opts?.find((option) => {\n return option.value === optionType;\n })}\n cacheOptions={null}\n /> */}\n\n {/* <CustomRelationShipComponent\n label={`${\n opts?.find((option) => {\n return option.value === optionType\n })?.label\n } Content`}\n collection={optionType}\n key={optionType}\n value={relationOption?.id ?? null}\n handleChange={(val: any) => {\n setRelationOption(val)\n }}\n handleInitialLoad={(val: any) => {\n setRelationOption(val)\n }}\n /> */}\n\n <div>\n <Button\n onClick={() => {\n let url = \"\";\n const topic = relationOption?.topics?.[0]?.slug ?? \"\";\n switch (optionType) {\n case \"articles\":\n url = `/${topic}/${relationOption?.slug}`;\n break;\n case \"video\":\n url = `/video/${relationOption?.slug}`;\n\n break;\n case \"audios\":\n url = `/audio/${relationOption?.slug}`;\n break;\n }\n setRelationship({\n id: relationOption?.id,\n type: optionType,\n thumbnail: relationOption?.thumbnail?.url,\n title: relationOption?.title,\n url: url,\n });\n }}\n >\n Save\n </Button>\n\n {/* <Button\n onClick={() => {\n cancelSelection()\n }}\n >\n Cancel\n </Button> */}\n </div>\n </div>\n );\n};\n"],"names":["Button","useCallback","useState","limit","ContentRelationship","setRelationship","cancelSelection","optionType","setOptionType","relationOption","setRelationOption","opts","label","value","fetchContentTypes","search","loadedOptions","page","options","hasMore","length","additional","error","div","className","onClick","url","topic","topics","slug","id","type","thumbnail","title"],"mappings":"AAAA;;AAEA,yFAAyF;AACzF,uEAAuE;AACvE,SAASA,MAAM,QAAQ,iCAAiC;AACxD,SAASC,WAAW,EAAEC,QAAQ,QAAQ,QAAQ;AAE9C,MAAMC,QAAQ;AACd,OAAO,MAAMC,sBAAsB,CAAC,EAClCC,eAAe,EACfC,eAAe,EAkBhB;IACC,MAAM,CAACC,YAAYC,cAAc,GAAGN,SAAS;IAC7C,MAAM,CAACO,gBAAgBC,kBAAkB,GAAGR,SAAc;IAC1D,MAAMS,OAAO;QACX;YACEC,OAAO;YACPC,OAAO;QACT;QACA;YACED,OAAO;YACPC,OAAO;QACT;QACA;YACED,OAAO;YACPC,OAAO;QACT;KAKD;IAED,MAAMC,oBAAoBb,YACxB,OAAOc,QAAaC,eAAoB,EAAEC,IAAI,EAAO;QACnD,IAAI;YACF,yDAAyD;YAEzD,OAAO;gBACLC,SAASP;gBACTQ,SAASR,MAAMS,WAAWjB;gBAC1BkB,YAAY;oBACVJ,MAAMA,OAAO;gBACf;YACF;QACF,EAAE,OAAOK,OAAO;QACd,+CAA+C;QACjD;IACF,GACA,EAAE;IAEJ,qBACE,KAACC;QAAIC,WAAU;kBA6Bb,cAAA,KAACD;sBACC,cAAA,KAACvB;gBACCyB,SAAS;oBACP,IAAIC,MAAM;oBACV,MAAMC,QAAQlB,gBAAgBmB,QAAQ,CAAC,EAAE,EAAEC,QAAQ;oBACnD,OAAQtB;wBACN,KAAK;4BACHmB,MAAM,CAAC,CAAC,EAAEC,MAAM,CAAC,EAAElB,gBAAgBoB,
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/InsideLinks/InsideLink.client.tsx"],"sourcesContent":["\"use client\";\n\n// import { CustomRelationShipComponent } from '@/components/CustomRelationshipComponent'\n// import { PayloadAsyncSelect } from '@/components/PayloadAsyncSelect'\nimport { Button } from \"@payloadcms/ui/elements/Button\";\nimport { useCallback, useState } from \"react\";\n\nconst limit = 10;\nexport const ContentRelationship = ({\n setRelationship,\n cancelSelection,\n}: {\n type?: string;\n relationId?: string;\n cancelSelection: () => void;\n setRelationship: ({\n id,\n type,\n thumbnail,\n title,\n url,\n }: {\n id: string;\n type: string;\n thumbnail: string;\n title: string;\n url: string;\n }) => void;\n}) => {\n const [optionType, setOptionType] = useState(\"articles\");\n const [relationOption, setRelationOption] = useState<any>(null);\n const opts = [\n {\n label: \"Article\",\n value: \"articles\",\n },\n {\n label: \"Video\",\n value: \"video\",\n },\n {\n label: \"Audio\",\n value: \"audios\",\n },\n // {\n // label: 'Media',\n // value: 'media',\n // },\n ];\n\n const fetchContentTypes = useCallback(\n async (search: any, loadedOptions: any, { page }: any) => {\n try {\n // Perform your API call with the endpoint and inputValue\n\n return {\n options: opts,\n hasMore: opts?.length === limit,\n additional: {\n page: page + 1,\n },\n };\n } catch (error) {\n // console.error('Error fetching data:', error)\n }\n },\n []\n );\n return (\n <div className=\"w-full min-w-[300px] \">\n {/* <PayloadAsyncSelect\n fetchData={fetchContentTypes as any}\n handleChange={(val: string) => {\n setOptionType(val);\n }}\n defaultValue={opts?.find((option) => {\n return option.value === optionType;\n })}\n cacheOptions={null}\n /> */}\n\n {/* <CustomRelationShipComponent\n label={`${\n opts?.find((option) => {\n return option.value === optionType\n })?.label\n } Content`}\n collection={optionType}\n key={optionType}\n value={relationOption?.id ?? null}\n handleChange={(val: any) => {\n setRelationOption(val)\n }}\n handleInitialLoad={(val: any) => {\n setRelationOption(val)\n }}\n /> */}\n\n <div>\n <Button\n onClick={() => {\n let url = \"\";\n const topic = relationOption?.topics?.[0]?.slug ?? \"\";\n switch (optionType) {\n case \"articles\":\n url = `/${topic}/${relationOption?.slug}`;\n break;\n case \"video\":\n url = `/video/${relationOption?.slug}`;\n\n break;\n case \"audios\":\n url = `/audio/${relationOption?.slug}`;\n break;\n }\n setRelationship({\n id: relationOption?.id,\n type: optionType,\n thumbnail: relationOption?.thumbnail?.url,\n title: relationOption?.title,\n url: url,\n });\n }}\n >\n Save\n </Button>\n\n {/* <Button\n onClick={() => {\n cancelSelection()\n }}\n >\n Cancel\n </Button> */}\n </div>\n </div>\n );\n};\n"],"names":["Button","useCallback","useState","limit","ContentRelationship","setRelationship","cancelSelection","optionType","setOptionType","relationOption","setRelationOption","opts","label","value","fetchContentTypes","search","loadedOptions","page","options","hasMore","length","additional","error","div","className","onClick","url","topic","topics","slug","id","type","thumbnail","title"],"mappings":"AAAA;;AAEA,yFAAyF;AACzF,uEAAuE;AACvE,SAASA,MAAM,QAAQ,iCAAiC;AACxD,SAASC,WAAW,EAAEC,QAAQ,QAAQ,QAAQ;AAE9C,MAAMC,QAAQ;AACd,OAAO,MAAMC,sBAAsB,CAAC,EAClCC,eAAe,EACfC,eAAe,EAkBhB;IACC,MAAM,CAACC,YAAYC,cAAc,GAAGN,SAAS;IAC7C,MAAM,CAACO,gBAAgBC,kBAAkB,GAAGR,SAAc;IAC1D,MAAMS,OAAO;QACX;YACEC,OAAO;YACPC,OAAO;QACT;QACA;YACED,OAAO;YACPC,OAAO;QACT;QACA;YACED,OAAO;YACPC,OAAO;QACT;KAKD;IAED,MAAMC,oBAAoBb,YACxB,OAAOc,QAAaC,eAAoB,EAAEC,IAAI,EAAO;QACnD,IAAI;YACF,yDAAyD;YAEzD,OAAO;gBACLC,SAASP;gBACTQ,SAASR,MAAMS,WAAWjB;gBAC1BkB,YAAY;oBACVJ,MAAMA,OAAO;gBACf;YACF;QACF,EAAE,OAAOK,OAAO;QACd,+CAA+C;QACjD;IACF,GACA,EAAE;IAEJ,qBACE,KAACC;QAAIC,WAAU;kBA6Bb,cAAA,KAACD;sBACC,cAAA,KAACvB;gBACCyB,SAAS;oBACP,IAAIC,MAAM;oBACV,MAAMC,QAAQlB,gBAAgBmB,QAAQ,CAAC,EAAE,EAAEC,QAAQ;oBACnD,OAAQtB;wBACN,KAAK;4BACHmB,MAAM,CAAC,CAAC,EAAEC,MAAM,CAAC,EAAElB,gBAAgBoB,MAAM;4BACzC;wBACF,KAAK;4BACHH,MAAM,CAAC,OAAO,EAAEjB,gBAAgBoB,MAAM;4BAEtC;wBACF,KAAK;4BACHH,MAAM,CAAC,OAAO,EAAEjB,gBAAgBoB,MAAM;4BACtC;oBACJ;oBACAxB,gBAAgB;wBACdyB,IAAIrB,gBAAgBqB;wBACpBC,MAAMxB;wBACNyB,WAAWvB,gBAAgBuB,WAAWN;wBACtCO,OAAOxB,gBAAgBwB;wBACvBP,KAAKA;oBACP;gBACF;0BACD;;;;AAcT,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InsideLinksComponent.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/InsideLinks/InsideLinksComponent.tsx"],"names":[],"mappings":"gCAIuB,GAAG;AAA1B,
|
|
1
|
+
{"version":3,"file":"InsideLinksComponent.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/InsideLinks/InsideLinksComponent.tsx"],"names":[],"mappings":"gCAIuB,GAAG;AAA1B,wBAkEE"}
|
|
@@ -58,6 +58,7 @@ export default ((props)=>{
|
|
|
58
58
|
/*#__PURE__*/ _jsx("a", {
|
|
59
59
|
className: "text-black dark:text-white text-lg capitalize w-full",
|
|
60
60
|
// href={`https://test-payload.trtglobal.tech/en${props?.node?.attrs?.url}` ?? ''}
|
|
61
|
+
//@ts-ignore
|
|
61
62
|
dir: isRTL("بیشتر بخوانید" ?? "") ? "rtl" : "ltr",
|
|
62
63
|
children: "بیشتر بخوانید"
|
|
63
64
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/InsideLinks/InsideLinksComponent.tsx"],"sourcesContent":["import { ExternalLinkIcon } from \"@payloadcms/ui/graphics/ExternalLink\";\nimport { NodeViewContent, NodeViewWrapper } from \"@tiptap/react\";\nimport { isRTL } from \"../../lib/utils/isRtl.js\";\n\nexport default (props: any) => {\n return (\n <NodeViewWrapper\n className=\"react-component\"\n onClick={() => {\n props.editor.commands.setNodeSelection(props.getPos());\n }}\n >\n <NodeViewContent contentEditable=\"false\" className=\"socialMediaContainer\">\n {props?.node.type.spec.draggable ? (\n <div draggable=\"true\" data-drag-handle=\"\" style={{ width: \"100%\" }}>\n {!props?.node?.attrs?.id ?? \"\" ? (\n <div\n className=\"w-full bg-zinc-100 py-8 px-6 flex items-center justify-center gap-2 socialMediaCard\"\n draggable=\"true\"\n data-drag-handle=\"\"\n contentEditable=\"false\"\n >\n <ExternalLinkIcon className=\"h-6 w-6\" />\n\n <p\n className=\"w-full flex items-center justify-start mt-0\"\n style={{\n marginTop: 0,\n }}\n >\n Add Internal Content Links\n {/* {text} */}\n </p>\n </div>\n ) : (\n <div className=\"flex justify-center items-center w-full gap-x-6\">\n <div className=\"flex justify-center items-center\">\n <div className=\"w-[32px] h-[64px] bg-blue-400\"></div>\n <img\n src={props?.node?.attrs?.thumbnail ?? \"\"}\n width={212}\n height={120}\n alt={\"\"}\n className=\"-ml-6 !w-[212px] !h-[120px] object-cover\"\n />\n </div>\n <div className=\"flex flex-col justidy-start items-start font-trt gap-y-2 \">\n <a\n className=\"text-black dark:text-white text-lg capitalize w-full\"\n // href={`https://test-payload.trtglobal.tech/en${props?.node?.attrs?.url}` ?? ''}\n\n dir={isRTL(\"بیشتر بخوانید\" ?? \"\") ? \"rtl\" : \"ltr\"}\n >\n بیشتر بخوانید\n </a>\n <h3\n className=\"text-2xl font-bold !mt-0 w-full\"\n dir={isRTL(props?.node?.attrs?.title ?? \"\") ? \"rtl\" : \"ltr\"}\n >\n {props?.node?.attrs?.title}\n </h3>\n </div>\n </div>\n )}\n </div>\n ) : null}\n </NodeViewContent>\n </NodeViewWrapper>\n );\n};\n"],"names":["ExternalLinkIcon","NodeViewContent","NodeViewWrapper","isRTL","props","className","onClick","editor","commands","setNodeSelection","getPos","contentEditable","node","type","spec","draggable","div","data-drag-handle","style","width","attrs","id","p","marginTop","img","src","thumbnail","height","alt","a","dir","h3","title"],"mappings":";AAAA,SAASA,gBAAgB,QAAQ,uCAAuC;AACxE,SAASC,eAAe,EAAEC,eAAe,QAAQ,gBAAgB;AACjE,SAASC,KAAK,QAAQ,2BAA2B;AAEjD,eAAe,CAAA,CAACC;IACd,qBACE,KAACF;QACCG,WAAU;QACVC,SAAS;YACPF,MAAMG,MAAM,CAACC,QAAQ,CAACC,gBAAgB,CAACL,MAAMM,MAAM;QACrD;kBAEA,cAAA,KAACT;YAAgBU,iBAAgB;YAAQN,WAAU;sBAChDD,OAAOQ,KAAKC,KAAKC,KAAKC,0BACrB,KAACC;gBAAID,WAAU;gBAAOE,oBAAiB;gBAAGC,OAAO;oBAAEC,OAAO;gBAAO;
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/InsideLinks/InsideLinksComponent.tsx"],"sourcesContent":["import { ExternalLinkIcon } from \"@payloadcms/ui/graphics/ExternalLink\";\nimport { NodeViewContent, NodeViewWrapper } from \"@tiptap/react\";\nimport { isRTL } from \"../../lib/utils/isRtl.js\";\n\nexport default (props: any) => {\n return (\n <NodeViewWrapper\n className=\"react-component\"\n onClick={() => {\n props.editor.commands.setNodeSelection(props.getPos());\n }}\n >\n <NodeViewContent contentEditable=\"false\" className=\"socialMediaContainer\">\n {props?.node.type.spec.draggable ? (\n <div draggable=\"true\" data-drag-handle=\"\" style={{ width: \"100%\" }}>\n {/*@ts-ignore*/}\n {!props?.node?.attrs?.id ?? \"\" ? (\n <div\n className=\"w-full bg-zinc-100 py-8 px-6 flex items-center justify-center gap-2 socialMediaCard\"\n draggable=\"true\"\n data-drag-handle=\"\"\n contentEditable=\"false\"\n >\n <ExternalLinkIcon className=\"h-6 w-6\" />\n\n <p\n className=\"w-full flex items-center justify-start mt-0\"\n style={{\n marginTop: 0,\n }}\n >\n Add Internal Content Links\n {/* {text} */}\n </p>\n </div>\n ) : (\n <div className=\"flex justify-center items-center w-full gap-x-6\">\n <div className=\"flex justify-center items-center\">\n <div className=\"w-[32px] h-[64px] bg-blue-400\"></div>\n <img\n src={props?.node?.attrs?.thumbnail ?? \"\"}\n width={212}\n height={120}\n alt={\"\"}\n className=\"-ml-6 !w-[212px] !h-[120px] object-cover\"\n />\n </div>\n <div className=\"flex flex-col justidy-start items-start font-trt gap-y-2 \">\n <a\n className=\"text-black dark:text-white text-lg capitalize w-full\"\n // href={`https://test-payload.trtglobal.tech/en${props?.node?.attrs?.url}` ?? ''}\n //@ts-ignore\n dir={isRTL(\"بیشتر بخوانید\" ?? \"\") ? \"rtl\" : \"ltr\"}\n >\n بیشتر بخوانید\n </a>\n <h3\n className=\"text-2xl font-bold !mt-0 w-full\"\n dir={isRTL(props?.node?.attrs?.title ?? \"\") ? \"rtl\" : \"ltr\"}\n >\n {props?.node?.attrs?.title}\n </h3>\n </div>\n </div>\n )}\n </div>\n ) : null}\n </NodeViewContent>\n </NodeViewWrapper>\n );\n};\n"],"names":["ExternalLinkIcon","NodeViewContent","NodeViewWrapper","isRTL","props","className","onClick","editor","commands","setNodeSelection","getPos","contentEditable","node","type","spec","draggable","div","data-drag-handle","style","width","attrs","id","p","marginTop","img","src","thumbnail","height","alt","a","dir","h3","title"],"mappings":";AAAA,SAASA,gBAAgB,QAAQ,uCAAuC;AACxE,SAASC,eAAe,EAAEC,eAAe,QAAQ,gBAAgB;AACjE,SAASC,KAAK,QAAQ,2BAA2B;AAEjD,eAAe,CAAA,CAACC;IACd,qBACE,KAACF;QACCG,WAAU;QACVC,SAAS;YACPF,MAAMG,MAAM,CAACC,QAAQ,CAACC,gBAAgB,CAACL,MAAMM,MAAM;QACrD;kBAEA,cAAA,KAACT;YAAgBU,iBAAgB;YAAQN,WAAU;sBAChDD,OAAOQ,KAAKC,KAAKC,KAAKC,0BACrB,KAACC;gBAAID,WAAU;gBAAOE,oBAAiB;gBAAGC,OAAO;oBAAEC,OAAO;gBAAO;0BAE9D,CAACf,OAAOQ,MAAMQ,OAAOC,MAAM,mBAC1B,MAACL;oBACCX,WAAU;oBACVU,WAAU;oBACVE,oBAAiB;oBACjBN,iBAAgB;;sCAEhB,KAACX;4BAAiBK,WAAU;;sCAE5B,KAACiB;4BACCjB,WAAU;4BACVa,OAAO;gCACLK,WAAW;4BACb;sCACD;;;mCAMH,MAACP;oBAAIX,WAAU;;sCACb,MAACW;4BAAIX,WAAU;;8CACb,KAACW;oCAAIX,WAAU;;8CACf,KAACmB;oCACCC,KAAKrB,OAAOQ,MAAMQ,OAAOM,aAAa;oCACtCP,OAAO;oCACPQ,QAAQ;oCACRC,KAAK;oCACLvB,WAAU;;;;sCAGd,MAACW;4BAAIX,WAAU;;8CACb,KAACwB;oCACCxB,WAAU;oCACV,kFAAkF;oCAClF,YAAY;oCACZyB,KAAK3B,MAAM,mBAAmB,MAAM,QAAQ;8CAC7C;;8CAGD,KAAC4B;oCACC1B,WAAU;oCACVyB,KAAK3B,MAAMC,OAAOQ,MAAMQ,OAAOY,SAAS,MAAM,QAAQ;8CAErD5B,OAAOQ,MAAMQ,OAAOY;;;;;;iBAM7B;;;AAIZ,CAAA,EAAE"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Node } from '@tiptap/core';
|
|
2
|
-
export var ColumnLayout
|
|
3
|
-
(function(ColumnLayout) {
|
|
2
|
+
export var ColumnLayout = /*#__PURE__*/ function(ColumnLayout) {
|
|
4
3
|
ColumnLayout["SidebarLeft"] = "sidebar-left";
|
|
5
4
|
ColumnLayout["SidebarRight"] = "sidebar-right";
|
|
6
5
|
ColumnLayout["TwoColumn"] = "two-column";
|
|
7
|
-
|
|
6
|
+
return ColumnLayout;
|
|
7
|
+
}({});
|
|
8
8
|
export const Columns = Node.create({
|
|
9
9
|
name: 'columns',
|
|
10
10
|
group: 'columns',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/MultiColumn/Columns.ts"],"sourcesContent":["import { Node } from '@tiptap/core'\n\nexport enum ColumnLayout {\n SidebarLeft = 'sidebar-left',\n SidebarRight = 'sidebar-right',\n TwoColumn = 'two-column',\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n columns: {\n setColumns: () => ReturnType\n setLayout: (layout: ColumnLayout) => ReturnType\n }\n }\n}\n\nexport const Columns = Node.create({\n name: 'columns',\n\n group: 'columns',\n\n content: 'column column',\n\n defining: true,\n\n isolating: true,\n\n addAttributes() {\n return {\n layout: {\n default: ColumnLayout.TwoColumn,\n },\n }\n },\n\n addCommands() {\n return {\n setColumns:\n () =>\n ({ commands }) =>\n commands.insertContent(\n `<div data-type=\"columns\"><div data-type=\"column\" data-position=\"left\"><p></p></div><div data-type=\"column\" data-position=\"right\"><p></p></div></div>`,\n ),\n setLayout:\n (layout: ColumnLayout) =>\n ({ commands }) =>\n commands.updateAttributes('columns', { layout }),\n }\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['div', { 'data-type': 'columns', class: `layout-${HTMLAttributes.layout}` }, 0]\n },\n\n parseHTML() {\n return [\n {\n tag: 'div[data-type=\"columns\"]',\n },\n ]\n },\n})\n\nexport default Columns\n"],"names":["Node","ColumnLayout","Columns","create","name","group","content","defining","isolating","addAttributes","layout","default","addCommands","setColumns","commands","insertContent","setLayout","updateAttributes","renderHTML","HTMLAttributes","class","parseHTML","tag"],"mappings":"AAAA,SAASA,IAAI,QAAQ,eAAc
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/MultiColumn/Columns.ts"],"sourcesContent":["import { Node } from '@tiptap/core'\n\nexport enum ColumnLayout {\n SidebarLeft = 'sidebar-left',\n SidebarRight = 'sidebar-right',\n TwoColumn = 'two-column',\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n columns: {\n setColumns: () => ReturnType\n setLayout: (layout: ColumnLayout) => ReturnType\n }\n }\n}\n\nexport const Columns = Node.create({\n name: 'columns',\n\n group: 'columns',\n\n content: 'column column',\n\n defining: true,\n\n isolating: true,\n\n addAttributes() {\n return {\n layout: {\n default: ColumnLayout.TwoColumn,\n },\n }\n },\n\n addCommands() {\n return {\n setColumns:\n () =>\n ({ commands }) =>\n commands.insertContent(\n `<div data-type=\"columns\"><div data-type=\"column\" data-position=\"left\"><p></p></div><div data-type=\"column\" data-position=\"right\"><p></p></div></div>`,\n ),\n setLayout:\n (layout: ColumnLayout) =>\n ({ commands }) =>\n commands.updateAttributes('columns', { layout }),\n }\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['div', { 'data-type': 'columns', class: `layout-${HTMLAttributes.layout}` }, 0]\n },\n\n parseHTML() {\n return [\n {\n tag: 'div[data-type=\"columns\"]',\n },\n ]\n },\n})\n\nexport default Columns\n"],"names":["Node","ColumnLayout","Columns","create","name","group","content","defining","isolating","addAttributes","layout","default","addCommands","setColumns","commands","insertContent","setLayout","updateAttributes","renderHTML","HTMLAttributes","class","parseHTML","tag"],"mappings":"AAAA,SAASA,IAAI,QAAQ,eAAc;AAEnC,OAAO,IAAA,AAAKC,sCAAAA;;;;WAAAA;MAIX;AAWD,OAAO,MAAMC,UAAUF,KAAKG,MAAM,CAAC;IACjCC,MAAM;IAENC,OAAO;IAEPC,SAAS;IAETC,UAAU;IAEVC,WAAW;IAEXC;QACE,OAAO;YACLC,QAAQ;gBACNC,OAAO;YACT;QACF;IACF;IAEAC;QACE,OAAO;YACLC,YACE,IACA,CAAC,EAAEC,QAAQ,EAAE,GACXA,SAASC,aAAa,CACpB,CAAC,oJAAoJ,CAAC;YAE5JC,WACE,CAACN,SACD,CAAC,EAAEI,QAAQ,EAAE,GACXA,SAASG,gBAAgB,CAAC,WAAW;wBAAEP;oBAAO;QACpD;IACF;IAEAQ,YAAW,EAAEC,cAAc,EAAE;QAC3B,OAAO;YAAC;YAAO;gBAAE,aAAa;gBAAWC,OAAO,CAAC,OAAO,EAAED,eAAeT,MAAM,EAAE;YAAC;YAAG;SAAE;IACzF;IAEAW;QACE,OAAO;YACL;gBACEC,KAAK;YACP;SACD;IACH;AACF,GAAE;AAEF,eAAepB,QAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColumnsMenu.d.ts","sourceRoot":"","sources":["../../../../../../../src/fields/TiptapEditor/extensions/MultiColumn/menus/ColumnsMenu.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"ColumnsMenu.d.ts","sourceRoot":"","sources":["../../../../../../../src/fields/TiptapEditor/extensions/MultiColumn/menus/ColumnsMenu.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAO7D,eAAO,MAAM,WAAW,yBAA0B,SAAS,gCA8E1D,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -8,6 +8,7 @@ import { Icon } from "../../../features/ui/Icon.js";
|
|
|
8
8
|
import { Toolbar } from "../../../features/ui/Toolbar.js";
|
|
9
9
|
import { getRenderContainer } from "../../../lib/utils/index.js";
|
|
10
10
|
import { ColumnLayout } from "../Columns.js";
|
|
11
|
+
import i18next from "i18next";
|
|
11
12
|
export const ColumnsMenu = ({ editor, appendTo })=>{
|
|
12
13
|
const getReferenceClientRect = useCallback(()=>{
|
|
13
14
|
const renderContainer = getRenderContainer(editor, "columns");
|
|
@@ -66,7 +67,7 @@ export const ColumnsMenu = ({ editor, appendTo })=>{
|
|
|
66
67
|
children: [
|
|
67
68
|
/*#__PURE__*/ _jsx(Toolbar.Button, {
|
|
68
69
|
type: "button",
|
|
69
|
-
tooltip: "Sidebar left",
|
|
70
|
+
tooltip: i18next.t("sidebarLeft") || "Sidebar left",
|
|
70
71
|
active: editor.isActive("columns", {
|
|
71
72
|
layout: ColumnLayout.SidebarLeft
|
|
72
73
|
}),
|
|
@@ -77,7 +78,7 @@ export const ColumnsMenu = ({ editor, appendTo })=>{
|
|
|
77
78
|
}),
|
|
78
79
|
/*#__PURE__*/ _jsx(Toolbar.Button, {
|
|
79
80
|
type: "button",
|
|
80
|
-
tooltip: "Two columns",
|
|
81
|
+
tooltip: i18next.t("twoColumns") || "Two columns",
|
|
81
82
|
active: editor.isActive("columns", {
|
|
82
83
|
layout: ColumnLayout.TwoColumn
|
|
83
84
|
}),
|
|
@@ -88,7 +89,7 @@ export const ColumnsMenu = ({ editor, appendTo })=>{
|
|
|
88
89
|
}),
|
|
89
90
|
/*#__PURE__*/ _jsx(Toolbar.Button, {
|
|
90
91
|
type: "button",
|
|
91
|
-
tooltip: "Sidebar right",
|
|
92
|
+
tooltip: i18next.t("sidebarRight") || "Sidebar right",
|
|
92
93
|
active: editor.isActive("columns", {
|
|
93
94
|
layout: ColumnLayout.SidebarRight
|
|
94
95
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../src/fields/TiptapEditor/extensions/MultiColumn/menus/ColumnsMenu.tsx"],"sourcesContent":["import { BubbleMenu as BaseBubbleMenu } from \"@tiptap/react\";\nimport { useCallback } from \"react\";\nimport { sticky } from \"tippy.js\";\nimport { v4 as uuid } from \"uuid\";\n\nimport { Columns2, PanelLeft, PanelRight } from \"lucide-react\";\nimport { MenuProps } from \"../../../features/menus/types.js\";\nimport { Icon } from \"../../../features/ui/Icon.js\";\nimport { Toolbar } from \"../../../features/ui/Toolbar.js\";\nimport { getRenderContainer } from \"../../../lib/utils/index.js\";\nimport { ColumnLayout } from \"../Columns.js\";\n\nexport const ColumnsMenu = ({ editor, appendTo }: MenuProps) => {\n const getReferenceClientRect = useCallback(() => {\n const renderContainer = getRenderContainer(editor, \"columns\");\n const rect =\n renderContainer?.getBoundingClientRect() ||\n new DOMRect(-1000, -1000, 0, 0);\n\n return rect;\n }, [editor]);\n\n const shouldShow = useCallback(() => {\n const isColumns = editor.isActive(\"columns\");\n return isColumns;\n }, [editor]);\n\n const onColumnLeft = useCallback(() => {\n editor.chain().focus().setLayout(ColumnLayout.SidebarLeft).run();\n }, [editor]);\n\n const onColumnRight = useCallback(() => {\n editor.chain().focus().setLayout(ColumnLayout.SidebarRight).run();\n }, [editor]);\n\n const onColumnTwo = useCallback(() => {\n editor.chain().focus().setLayout(ColumnLayout.TwoColumn).run();\n }, [editor]);\n\n return (\n <BaseBubbleMenu\n editor={editor}\n pluginKey={`columnsMenu-${uuid()}`}\n shouldShow={shouldShow}\n updateDelay={0}\n tippyOptions={{\n offset: [0, 8],\n popperOptions: {\n modifiers: [{ name: \"flip\", enabled: false }],\n },\n getReferenceClientRect,\n appendTo: () => appendTo?.current,\n plugins: [sticky],\n sticky: \"popper\",\n }}\n >\n <Toolbar.Wrapper>\n <Toolbar.Button\n type=\"button\"\n tooltip
|
|
1
|
+
{"version":3,"sources":["../../../../../../../src/fields/TiptapEditor/extensions/MultiColumn/menus/ColumnsMenu.tsx"],"sourcesContent":["import { BubbleMenu as BaseBubbleMenu } from \"@tiptap/react\";\nimport { useCallback } from \"react\";\nimport { sticky } from \"tippy.js\";\nimport { v4 as uuid } from \"uuid\";\n\nimport { Columns2, PanelLeft, PanelRight } from \"lucide-react\";\nimport { MenuProps } from \"../../../features/menus/types.js\";\nimport { Icon } from \"../../../features/ui/Icon.js\";\nimport { Toolbar } from \"../../../features/ui/Toolbar.js\";\nimport { getRenderContainer } from \"../../../lib/utils/index.js\";\nimport { ColumnLayout } from \"../Columns.js\";\nimport i18next from \"i18next\";\n\nexport const ColumnsMenu = ({ editor, appendTo }: MenuProps) => {\n const getReferenceClientRect = useCallback(() => {\n const renderContainer = getRenderContainer(editor, \"columns\");\n const rect =\n renderContainer?.getBoundingClientRect() ||\n new DOMRect(-1000, -1000, 0, 0);\n\n return rect;\n }, [editor]);\n\n const shouldShow = useCallback(() => {\n const isColumns = editor.isActive(\"columns\");\n return isColumns;\n }, [editor]);\n\n const onColumnLeft = useCallback(() => {\n editor.chain().focus().setLayout(ColumnLayout.SidebarLeft).run();\n }, [editor]);\n\n const onColumnRight = useCallback(() => {\n editor.chain().focus().setLayout(ColumnLayout.SidebarRight).run();\n }, [editor]);\n\n const onColumnTwo = useCallback(() => {\n editor.chain().focus().setLayout(ColumnLayout.TwoColumn).run();\n }, [editor]);\n\n return (\n <BaseBubbleMenu\n editor={editor}\n pluginKey={`columnsMenu-${uuid()}`}\n shouldShow={shouldShow}\n updateDelay={0}\n tippyOptions={{\n offset: [0, 8],\n popperOptions: {\n modifiers: [{ name: \"flip\", enabled: false }],\n },\n getReferenceClientRect,\n appendTo: () => appendTo?.current,\n plugins: [sticky],\n sticky: \"popper\",\n }}\n >\n <Toolbar.Wrapper>\n <Toolbar.Button\n type=\"button\"\n tooltip={i18next.t(\"sidebarLeft\") || \"Sidebar left\"}\n active={editor.isActive(\"columns\", {\n layout: ColumnLayout.SidebarLeft,\n })}\n onClick={onColumnLeft}\n >\n <Icon icon={PanelLeft} />\n </Toolbar.Button>\n <Toolbar.Button\n type=\"button\"\n tooltip={i18next.t(\"twoColumns\") || \"Two columns\"}\n active={editor.isActive(\"columns\", {\n layout: ColumnLayout.TwoColumn,\n })}\n onClick={onColumnTwo}\n >\n <Icon icon={Columns2} />\n </Toolbar.Button>\n <Toolbar.Button\n type=\"button\"\n tooltip={i18next.t(\"sidebarRight\") || \"Sidebar right\"}\n active={editor.isActive(\"columns\", {\n layout: ColumnLayout.SidebarRight,\n })}\n onClick={onColumnRight}\n >\n <Icon icon={PanelRight} />\n </Toolbar.Button>\n </Toolbar.Wrapper>\n </BaseBubbleMenu>\n );\n};\n\nexport default ColumnsMenu;\n"],"names":["BubbleMenu","BaseBubbleMenu","useCallback","sticky","v4","uuid","Columns2","PanelLeft","PanelRight","Icon","Toolbar","getRenderContainer","ColumnLayout","i18next","ColumnsMenu","editor","appendTo","getReferenceClientRect","renderContainer","rect","getBoundingClientRect","DOMRect","shouldShow","isColumns","isActive","onColumnLeft","chain","focus","setLayout","SidebarLeft","run","onColumnRight","SidebarRight","onColumnTwo","TwoColumn","pluginKey","updateDelay","tippyOptions","offset","popperOptions","modifiers","name","enabled","current","plugins","Wrapper","Button","type","tooltip","t","active","layout","onClick","icon"],"mappings":";AAAA,SAASA,cAAcC,cAAc,QAAQ,gBAAgB;AAC7D,SAASC,WAAW,QAAQ,QAAQ;AACpC,SAASC,MAAM,QAAQ,WAAW;AAClC,SAASC,MAAMC,IAAI,QAAQ,OAAO;AAElC,SAASC,QAAQ,EAAEC,SAAS,EAAEC,UAAU,QAAQ,eAAe;AAE/D,SAASC,IAAI,QAAQ,+BAA+B;AACpD,SAASC,OAAO,QAAQ,kCAAkC;AAC1D,SAASC,kBAAkB,QAAQ,8BAA8B;AACjE,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,OAAOC,aAAa,UAAU;AAE9B,OAAO,MAAMC,cAAc,CAAC,EAAEC,MAAM,EAAEC,QAAQ,EAAa;IACzD,MAAMC,yBAAyBf,YAAY;QACzC,MAAMgB,kBAAkBP,mBAAmBI,QAAQ;QACnD,MAAMI,OACJD,iBAAiBE,2BACjB,IAAIC,QAAQ,CAAC,MAAM,CAAC,MAAM,GAAG;QAE/B,OAAOF;IACT,GAAG;QAACJ;KAAO;IAEX,MAAMO,aAAapB,YAAY;QAC7B,MAAMqB,YAAYR,OAAOS,QAAQ,CAAC;QAClC,OAAOD;IACT,GAAG;QAACR;KAAO;IAEX,MAAMU,eAAevB,YAAY;QAC/Ba,OAAOW,KAAK,GAAGC,KAAK,GAAGC,SAAS,CAAChB,aAAaiB,WAAW,EAAEC,GAAG;IAChE,GAAG;QAACf;KAAO;IAEX,MAAMgB,gBAAgB7B,YAAY;QAChCa,OAAOW,KAAK,GAAGC,KAAK,GAAGC,SAAS,CAAChB,aAAaoB,YAAY,EAAEF,GAAG;IACjE,GAAG;QAACf;KAAO;IAEX,MAAMkB,cAAc/B,YAAY;QAC9Ba,OAAOW,KAAK,GAAGC,KAAK,GAAGC,SAAS,CAAChB,aAAasB,SAAS,EAAEJ,GAAG;IAC9D,GAAG;QAACf;KAAO;IAEX,qBACE,KAACd;QACCc,QAAQA;QACRoB,WAAW,CAAC,YAAY,EAAE9B,QAAQ;QAClCiB,YAAYA;QACZc,aAAa;QACbC,cAAc;YACZC,QAAQ;gBAAC;gBAAG;aAAE;YACdC,eAAe;gBACbC,WAAW;oBAAC;wBAAEC,MAAM;wBAAQC,SAAS;oBAAM;iBAAE;YAC/C;YACAzB;YACAD,UAAU,IAAMA,UAAU2B;YAC1BC,SAAS;gBAACzC;aAAO;YACjBA,QAAQ;QACV;kBAEA,cAAA,MAACO,QAAQmC,OAAO;;8BACd,KAACnC,QAAQoC,MAAM;oBACbC,MAAK;oBACLC,SAASnC,QAAQoC,CAAC,CAAC,kBAAkB;oBACrCC,QAAQnC,OAAOS,QAAQ,CAAC,WAAW;wBACjC2B,QAAQvC,aAAaiB,WAAW;oBAClC;oBACAuB,SAAS3B;8BAET,cAAA,KAAChB;wBAAK4C,MAAM9C;;;8BAEd,KAACG,QAAQoC,MAAM;oBACbC,MAAK;oBACLC,SAASnC,QAAQoC,CAAC,CAAC,iBAAiB;oBACpCC,QAAQnC,OAAOS,QAAQ,CAAC,WAAW;wBACjC2B,QAAQvC,aAAasB,SAAS;oBAChC;oBACAkB,SAASnB;8BAET,cAAA,KAACxB;wBAAK4C,MAAM/C;;;8BAEd,KAACI,QAAQoC,MAAM;oBACbC,MAAK;oBACLC,SAASnC,QAAQoC,CAAC,CAAC,mBAAmB;oBACtCC,QAAQnC,OAAOS,QAAQ,CAAC,WAAW;wBACjC2B,QAAQvC,aAAaoB,YAAY;oBACnC;oBACAoB,SAASrB;8BAET,cAAA,KAACtB;wBAAK4C,MAAM7C;;;;;;AAKtB,EAAE;AAEF,eAAeM,YAAY"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/SlashCommand/MenuList.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from \"react\";\n\nimport { DropdownButton } from \"../../features/ui/Dropdown/Dropdown.js\";\nimport { Surface } from \"../../features/ui/Surface.js\";\nimport { Command, MenuListProps } from \"./types.js\";\n\nimport { Icon } from \"../../features/ui/Icon.js\";\nimport { AICommandPanel } from \"../../features/panels/AICommandPanel/AICommandPanel.js\";\n\nexport const MenuList = React.forwardRef((props: MenuListProps, ref) => {\n const scrollContainer = useRef<HTMLDivElement>(null);\n const activeItem = useRef<HTMLButtonElement>(null);\n const [selectedGroupIndex, setSelectedGroupIndex] = useState(0);\n const [selectedCommandIndex, setSelectedCommandIndex] = useState(0);\n\n // Anytime the groups change, i.e. the user types to narrow it down, we want to\n // reset the current selection to the first menu item\n useEffect(() => {\n setSelectedGroupIndex(0);\n setSelectedCommandIndex(0);\n }, [props.items]);\n\n const selectItem = useCallback(\n (groupIndex: number, commandIndex: number) => {\n const command = props.items[groupIndex].commands[commandIndex];\n props.command(command);\n },\n [props]\n );\n\n React.useImperativeHandle(ref, () => ({\n onKeyDown: ({ event }: { event: React.KeyboardEvent }) => {\n if (event.key === \"ArrowDown\") {\n if (!props.items.length) {\n return false;\n }\n\n const commands = props.items[selectedGroupIndex].commands;\n\n let newCommandIndex = selectedCommandIndex + 1;\n let newGroupIndex = selectedGroupIndex;\n\n if (commands.length - 1 < newCommandIndex) {\n newCommandIndex = 0;\n newGroupIndex = selectedGroupIndex + 1;\n }\n\n if (props.items.length - 1 < newGroupIndex) {\n newGroupIndex = 0;\n }\n\n setSelectedCommandIndex(newCommandIndex);\n setSelectedGroupIndex(newGroupIndex);\n\n return true;\n }\n\n if (event.key === \"ArrowUp\") {\n if (!props.items.length) {\n return false;\n }\n\n let newCommandIndex = selectedCommandIndex - 1;\n let newGroupIndex = selectedGroupIndex;\n\n if (newCommandIndex < 0) {\n newGroupIndex = selectedGroupIndex - 1;\n newCommandIndex =\n props.items[newGroupIndex]?.commands.length - 1 || 0;\n }\n\n if (newGroupIndex < 0) {\n newGroupIndex = props.items.length - 1;\n newCommandIndex = props.items[newGroupIndex].commands.length - 1;\n }\n\n setSelectedCommandIndex(newCommandIndex);\n setSelectedGroupIndex(newGroupIndex);\n\n return true;\n }\n\n if (event.key === \"Enter\") {\n if (\n !props.items.length ||\n selectedGroupIndex === -1 ||\n selectedCommandIndex === -1\n ) {\n return false;\n }\n\n selectItem(selectedGroupIndex, selectedCommandIndex);\n\n return true;\n }\n\n return false;\n },\n }));\n\n useEffect(() => {\n if (activeItem.current && scrollContainer.current) {\n const offsetTop = activeItem.current.offsetTop;\n const offsetHeight = activeItem.current.offsetHeight;\n\n scrollContainer.current.scrollTop = offsetTop - offsetHeight;\n }\n }, [selectedCommandIndex, selectedGroupIndex]);\n\n const createCommandClickHandler = useCallback(\n (groupIndex: number, commandIndex: number) => {\n return () => {\n selectItem(groupIndex, commandIndex);\n };\n },\n [selectItem]\n );\n\n if (!props.items.length) {\n return null;\n }\n\n return (\n <>\n <Surface\n ref={scrollContainer}\n className=\"text-black max-h-[min(80vh,24rem)] overflow-auto flex-wrap mb-8 p-2\"\n >\n <div className=\"grid grid-cols-1 gap-0.5\">\n {props.items.map((group, groupIndex: number) => (\n <React.Fragment key={`${group.title}-wrapper`}>\n <div\n className=\"text-neutral-500 text-[0.65rem] col-[1/-1] mx-2 mt-4 font-semibold tracking-wider select-none uppercase first:mt-0.5\"\n key={`${group.title}`}\n >\n {group.title}\n </div>\n {group.commands.map((command: Command, commandIndex: number) => (\n <DropdownButton\n key={`${command.label}`}\n isActive={\n selectedGroupIndex === groupIndex &&\n selectedCommandIndex === commandIndex\n }\n onClick={createCommandClickHandler(groupIndex, commandIndex)}\n >\n <Icon icon={command.icon} className=\"mr-1\" />\n {command.label}\n </DropdownButton>\n ))}\n </React.Fragment>\n ))}\n </div>\n </Surface>\n </>\n );\n});\n\nMenuList.displayName = \"MenuList\";\n\nexport default MenuList;\n"],"names":["React","useCallback","useEffect","useRef","useState","DropdownButton","Surface","Icon","MenuList","forwardRef","props","ref","scrollContainer","activeItem","selectedGroupIndex","setSelectedGroupIndex","selectedCommandIndex","setSelectedCommandIndex","items","selectItem","groupIndex","commandIndex","command","commands","useImperativeHandle","onKeyDown","event","key","length","newCommandIndex","newGroupIndex","current","offsetTop","offsetHeight","scrollTop","createCommandClickHandler","className","div","map","group","Fragment","title","isActive","onClick","icon","label","displayName"],"mappings":";AAAA,OAAOA,SAASC,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAExE,SAASC,cAAc,QAAQ,yCAAyC;AACxE,SAASC,OAAO,QAAQ,+BAA+B;AAGvD,SAASC,IAAI,QAAQ,4BAA4B;AAGjD,OAAO,MAAMC,yBAAWR,MAAMS,UAAU,CAAC,CAACC,OAAsBC;IAC9D,MAAMC,kBAAkBT,OAAuB;IAC/C,MAAMU,aAAaV,OAA0B;IAC7C,MAAM,CAACW,oBAAoBC,sBAAsB,GAAGX,SAAS;IAC7D,MAAM,CAACY,sBAAsBC,wBAAwB,GAAGb,SAAS;IAEjE,+EAA+E;IAC/E,qDAAqD;IACrDF,UAAU;QACRa,sBAAsB;QACtBE,wBAAwB;IAC1B,GAAG;QAACP,MAAMQ,KAAK;KAAC;IAEhB,MAAMC,aAAalB,YACjB,CAACmB,YAAoBC;QACnB,MAAMC,UAAUZ,MAAMQ,KAAK,CAACE,WAAW,CAACG,QAAQ,CAACF,aAAa;QAC9DX,MAAMY,OAAO,CAACA;IAChB,GACA;QAACZ;KAAM;IAGTV,MAAMwB,mBAAmB,CAACb,KAAK,IAAO,CAAA;YACpCc,WAAW,CAAC,EAAEC,KAAK,EAAkC;gBACnD,IAAIA,MAAMC,GAAG,KAAK,aAAa;oBAC7B,IAAI,CAACjB,MAAMQ,KAAK,CAACU,MAAM,EAAE;wBACvB,OAAO;oBACT;oBAEA,MAAML,WAAWb,MAAMQ,KAAK,CAACJ,mBAAmB,CAACS,QAAQ;oBAEzD,IAAIM,kBAAkBb,uBAAuB;oBAC7C,IAAIc,gBAAgBhB;oB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AG;QAACjB;QAAsBF;KAAmB;IAE7C,MAAMqB,4BAA4BlC,YAChC,CAACmB,YAAoBC;QACnB,OAAO;YACLF,WAAWC,YAAYC;QACzB;IACF,GACA;QAACF;KAAW;IAGd,IAAI,CAACT,MAAMQ,KAAK,CAACU,MAAM,EAAE;QACvB,OAAO;IACT;IAEA,qBACE;kBACE,cAAA,KAACtB;YACCK,KAAKC;YACLwB,WAAU;sBAEV,cAAA,KAACC;gBAAID,WAAU;0BACZ1B,MAAMQ,KAAK,CAACoB,GAAG,CAAC,CAACC,OAAOnB,2BACvB,MAACpB,MAAMwC,QAAQ;;0CACb,KAACH;gCACCD,WAAU;0CAGTG,MAAME,KAAK;+BAFP,
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/SlashCommand/MenuList.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from \"react\";\n\nimport { DropdownButton } from \"../../features/ui/Dropdown/Dropdown.js\";\nimport { Surface } from \"../../features/ui/Surface.js\";\nimport { Command, MenuListProps } from \"./types.js\";\n\nimport { Icon } from \"../../features/ui/Icon.js\";\nimport { AICommandPanel } from \"../../features/panels/AICommandPanel/AICommandPanel.js\";\n\nexport const MenuList = React.forwardRef((props: MenuListProps, ref) => {\n const scrollContainer = useRef<HTMLDivElement>(null);\n const activeItem = useRef<HTMLButtonElement>(null);\n const [selectedGroupIndex, setSelectedGroupIndex] = useState(0);\n const [selectedCommandIndex, setSelectedCommandIndex] = useState(0);\n\n // Anytime the groups change, i.e. the user types to narrow it down, we want to\n // reset the current selection to the first menu item\n useEffect(() => {\n setSelectedGroupIndex(0);\n setSelectedCommandIndex(0);\n }, [props.items]);\n\n const selectItem = useCallback(\n (groupIndex: number, commandIndex: number) => {\n const command = props.items[groupIndex].commands[commandIndex];\n props.command(command);\n },\n [props]\n );\n\n React.useImperativeHandle(ref, () => ({\n onKeyDown: ({ event }: { event: React.KeyboardEvent }) => {\n if (event.key === \"ArrowDown\") {\n if (!props.items.length) {\n return false;\n }\n\n const commands = props.items[selectedGroupIndex].commands;\n\n let newCommandIndex = selectedCommandIndex + 1;\n let newGroupIndex = selectedGroupIndex;\n\n if (commands.length - 1 < newCommandIndex) {\n newCommandIndex = 0;\n newGroupIndex = selectedGroupIndex + 1;\n }\n\n if (props.items.length - 1 < newGroupIndex) {\n newGroupIndex = 0;\n }\n\n setSelectedCommandIndex(newCommandIndex);\n setSelectedGroupIndex(newGroupIndex);\n\n return true;\n }\n\n if (event.key === \"ArrowUp\") {\n if (!props.items.length) {\n return false;\n }\n\n let newCommandIndex = selectedCommandIndex - 1;\n let newGroupIndex = selectedGroupIndex;\n\n if (newCommandIndex < 0) {\n newGroupIndex = selectedGroupIndex - 1;\n newCommandIndex =\n props.items[newGroupIndex]?.commands.length - 1 || 0;\n }\n\n if (newGroupIndex < 0) {\n newGroupIndex = props.items.length - 1;\n newCommandIndex = props.items[newGroupIndex].commands.length - 1;\n }\n\n setSelectedCommandIndex(newCommandIndex);\n setSelectedGroupIndex(newGroupIndex);\n\n return true;\n }\n\n if (event.key === \"Enter\") {\n if (\n !props.items.length ||\n selectedGroupIndex === -1 ||\n selectedCommandIndex === -1\n ) {\n return false;\n }\n\n selectItem(selectedGroupIndex, selectedCommandIndex);\n\n return true;\n }\n\n return false;\n },\n }));\n\n useEffect(() => {\n if (activeItem.current && scrollContainer.current) {\n const offsetTop = activeItem.current.offsetTop;\n const offsetHeight = activeItem.current.offsetHeight;\n\n scrollContainer.current.scrollTop = offsetTop - offsetHeight;\n }\n }, [selectedCommandIndex, selectedGroupIndex]);\n\n const createCommandClickHandler = useCallback(\n (groupIndex: number, commandIndex: number) => {\n return () => {\n selectItem(groupIndex, commandIndex);\n };\n },\n [selectItem]\n );\n\n if (!props.items.length) {\n return null;\n }\n\n return (\n <>\n <Surface\n ref={scrollContainer}\n className=\"text-black max-h-[min(80vh,24rem)] overflow-auto flex-wrap mb-8 p-2\"\n >\n <div className=\"grid grid-cols-1 gap-0.5\">\n {props.items.map((group, groupIndex: number) => (\n <React.Fragment key={`${group.title}-wrapper`}>\n <div\n className=\"text-neutral-500 text-[0.65rem] col-[1/-1] mx-2 mt-4 font-semibold tracking-wider select-none uppercase first:mt-0.5\"\n key={`${group.title}`}\n >\n {group.title}\n </div>\n {group.commands.map((command: Command, commandIndex: number) => (\n <DropdownButton\n key={`${command.label}`}\n isActive={\n selectedGroupIndex === groupIndex &&\n selectedCommandIndex === commandIndex\n }\n onClick={createCommandClickHandler(groupIndex, commandIndex)}\n >\n <Icon icon={command.icon} className=\"mr-1\" />\n {command.label}\n </DropdownButton>\n ))}\n </React.Fragment>\n ))}\n </div>\n </Surface>\n </>\n );\n});\n\nMenuList.displayName = \"MenuList\";\n\nexport default MenuList;\n"],"names":["React","useCallback","useEffect","useRef","useState","DropdownButton","Surface","Icon","MenuList","forwardRef","props","ref","scrollContainer","activeItem","selectedGroupIndex","setSelectedGroupIndex","selectedCommandIndex","setSelectedCommandIndex","items","selectItem","groupIndex","commandIndex","command","commands","useImperativeHandle","onKeyDown","event","key","length","newCommandIndex","newGroupIndex","current","offsetTop","offsetHeight","scrollTop","createCommandClickHandler","className","div","map","group","Fragment","title","isActive","onClick","icon","label","displayName"],"mappings":";AAAA,OAAOA,SAASC,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAExE,SAASC,cAAc,QAAQ,yCAAyC;AACxE,SAASC,OAAO,QAAQ,+BAA+B;AAGvD,SAASC,IAAI,QAAQ,4BAA4B;AAGjD,OAAO,MAAMC,yBAAWR,MAAMS,UAAU,CAAC,CAACC,OAAsBC;IAC9D,MAAMC,kBAAkBT,OAAuB;IAC/C,MAAMU,aAAaV,OAA0B;IAC7C,MAAM,CAACW,oBAAoBC,sBAAsB,GAAGX,SAAS;IAC7D,MAAM,CAACY,sBAAsBC,wBAAwB,GAAGb,SAAS;IAEjE,+EAA+E;IAC/E,qDAAqD;IACrDF,UAAU;QACRa,sBAAsB;QACtBE,wBAA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K;;mCART,GAAGvB,QAAQuB,KAAK,EAAE;;uBATR,GAAGN,MAAME,KAAK,CAAC,QAAQ,CAAC;;;;AA0BzD,GAAG;AAEHjC,SAASsC,WAAW,GAAG;AAEvB,eAAetC,SAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SlashCommand.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/SlashCommand/SlashCommand.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"SlashCommand.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/SlashCommand/SlashCommand.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,SAAS,EAAE,MAAM,cAAc,CAAC;AAejD,eAAO,MAAM,YAAY,qBA8QvB,CAAC;AAEH,eAAe,YAAY,CAAC"}
|
|
@@ -4,7 +4,6 @@ import { ReactRenderer } from "@tiptap/react";
|
|
|
4
4
|
import Suggestion from "@tiptap/suggestion";
|
|
5
5
|
import { PluginKey } from "@tiptap/pm/state";
|
|
6
6
|
import tippy from "tippy.js";
|
|
7
|
-
import { GROUPS } from "./groups.js";
|
|
8
7
|
import { MenuList } from "./MenuList.js";
|
|
9
8
|
const extensionName = "slashCommand";
|
|
10
9
|
let popup;
|
|
@@ -63,7 +62,8 @@ export const SlashCommand = Extension.create({
|
|
|
63
62
|
props.action(editor);
|
|
64
63
|
view.focus();
|
|
65
64
|
},
|
|
66
|
-
items: ({ query })=>{
|
|
65
|
+
items: async ({ query })=>{
|
|
66
|
+
const GROUPS = (await import("./groups.js")).default;
|
|
67
67
|
const withFilteredCommands = GROUPS.map((group)=>({
|
|
68
68
|
...group,
|
|
69
69
|
commands: group.commands.filter((item)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/SlashCommand/SlashCommand.ts"],"sourcesContent":["\"use client\";\nimport { Editor, Extension } from \"@tiptap/core\";\nimport { ReactRenderer } from \"@tiptap/react\";\nimport Suggestion, {\n SuggestionProps,\n SuggestionKeyDownProps,\n} from \"@tiptap/suggestion\";\nimport { PluginKey } from \"@tiptap/pm/state\";\nimport tippy from \"tippy.js\";\n\nimport { GROUPS } from \"./groups.js\";\nimport { MenuList } from \"./MenuList.js\";\n\nconst extensionName = \"slashCommand\";\n\nlet popup: any;\n\nexport const SlashCommand = Extension.create({\n name: extensionName,\n\n priority: 200,\n\n onCreate() {\n const t = tippy as any;\n popup = t(\"body\", {\n interactive: true,\n trigger: \"manual\",\n placement: \"bottom-start\",\n theme: \"slash-command\",\n maxWidth: \"16rem\",\n offset: [16, 8],\n popperOptions: {\n strategy: \"fixed\",\n modifiers: [\n {\n name: \"flip\",\n enabled: false,\n },\n ],\n },\n });\n },\n\n addProseMirrorPlugins() {\n return [\n Suggestion({\n editor: this.editor,\n char: \"/\",\n allowSpaces: true,\n startOfLine: true,\n pluginKey: new PluginKey(extensionName),\n allow: ({ state, range }) => {\n const $from = state.doc.resolve(range.from);\n const isRootDepth = $from.depth === 1;\n const isParagraph = $from.parent.type.name === \"paragraph\";\n const isStartOfNode = $from.parent.textContent?.charAt(0) === \"/\";\n // TODO\n const isInColumn = this.editor.isActive(\"column\");\n\n const afterContent = $from.parent.textContent?.substring(\n $from.parent.textContent?.indexOf(\"/\")\n );\n const isValidAfterContent = !afterContent?.endsWith(\" \");\n\n return (\n ((isRootDepth && isParagraph && isStartOfNode) ||\n (isInColumn && isParagraph && isStartOfNode)) &&\n isValidAfterContent\n );\n },\n command: ({ editor, props }: { editor: Editor; props: any }) => {\n const { view, state } = editor;\n const { $head, $from } = view.state.selection;\n\n const end = $from.pos;\n const from = $head?.nodeBefore\n ? end -\n ($head.nodeBefore.text?.substring(\n $head.nodeBefore.text?.indexOf(\"/\")\n ).length ?? 0)\n : $from.start();\n\n const tr = state.tr.deleteRange(from, end);\n view.dispatch(tr);\n\n props.action(editor);\n view.focus();\n },\n items: ({ query }: { query: string }) => {\n const withFilteredCommands = GROUPS.map((group) => ({\n ...group,\n commands: group.commands\n .filter((item) => {\n const labelNormalized = item.label.toLowerCase().trim();\n const queryNormalized = query.toLowerCase().trim();\n\n if (item.aliases) {\n const aliases = item.aliases.map((alias) =>\n alias.toLowerCase().trim()\n );\n\n return (\n labelNormalized.includes(queryNormalized) ||\n aliases.includes(queryNormalized)\n );\n }\n\n return labelNormalized.includes(queryNormalized);\n })\n .filter((command) =>\n command.shouldBeHidden\n ? !command.shouldBeHidden(this.editor)\n : true\n ),\n }));\n\n const withoutEmptyGroups = withFilteredCommands.filter((group) => {\n if (group.commands.length > 0) {\n return true;\n }\n\n return false;\n });\n\n const withEnabledSettings = withoutEmptyGroups.map((group) => ({\n ...group,\n commands: group.commands.map((command) => ({\n ...command,\n isEnabled: true,\n })),\n }));\n\n return withEnabledSettings;\n },\n render: () => {\n let component: any;\n\n let scrollHandler: (() => void) | null = null;\n\n return {\n onStart: (props: SuggestionProps) => {\n component = new ReactRenderer(MenuList, {\n props,\n editor: props.editor,\n });\n\n const { view } = props.editor;\n\n const editorNode = view.dom as HTMLElement;\n\n const getReferenceClientRect = () => {\n if (!props.clientRect) {\n return props.editor.storage[extensionName].rect;\n }\n\n const rect = props.clientRect();\n\n if (!rect) {\n return props.editor.storage[extensionName].rect;\n }\n\n let yPos = rect.y;\n\n if (\n rect.top + component.element.offsetHeight + 40 >\n window.innerHeight\n ) {\n const diff =\n rect.top +\n component.element.offsetHeight -\n window.innerHeight +\n 40;\n yPos = rect.y - diff;\n }\n\n // Account for when the editor is bound inside a container that doesn't go all the way to the edge of the screen\n const editorXOffset = editorNode.getBoundingClientRect().x;\n return new DOMRect(rect.x, yPos, rect.width, rect.height);\n };\n\n scrollHandler = () => {\n popup?.[0].setProps({\n getReferenceClientRect,\n });\n };\n\n view.dom.parentElement?.addEventListener(\"scroll\", scrollHandler);\n\n popup?.[0].setProps({\n getReferenceClientRect,\n appendTo: () => document.body,\n content: component.element,\n });\n\n popup?.[0].show();\n },\n\n onUpdate(props: SuggestionProps) {\n component.updateProps(props);\n\n const { view } = props.editor;\n\n const editorNode = view.dom as HTMLElement;\n\n const getReferenceClientRect = () => {\n if (!props.clientRect) {\n return props.editor.storage[extensionName].rect;\n }\n\n const rect = props.clientRect();\n\n if (!rect) {\n return props.editor.storage[extensionName].rect;\n }\n\n // Account for when the editor is bound inside a container that doesn't go all the way to the edge of the screen\n return new DOMRect(rect.x, rect.y, rect.width, rect.height);\n };\n\n let scrollHandler = () => {\n popup?.[0].setProps({\n getReferenceClientRect,\n });\n };\n\n view.dom.parentElement?.addEventListener(\"scroll\", scrollHandler);\n\n // eslint-disable-next-line no-param-reassign\n props.editor.storage[extensionName].rect = props.clientRect\n ? getReferenceClientRect()\n : {\n width: 0,\n height: 0,\n left: 0,\n top: 0,\n right: 0,\n bottom: 0,\n };\n popup?.[0].setProps({\n getReferenceClientRect,\n });\n },\n\n onKeyDown(props: SuggestionKeyDownProps) {\n if (props.event.key === \"Escape\") {\n popup?.[0].hide();\n\n return true;\n }\n\n if (!popup?.[0].state.isShown) {\n popup?.[0].show();\n }\n\n return component.ref?.onKeyDown(props);\n },\n\n onExit(props) {\n popup?.[0].hide();\n if (scrollHandler) {\n const { view } = props.editor;\n view.dom.parentElement?.removeEventListener(\n \"scroll\",\n scrollHandler\n );\n }\n component.destroy();\n },\n };\n },\n }),\n ];\n },\n\n addStorage() {\n return {\n rect: {\n width: 0,\n height: 0,\n left: 0,\n top: 0,\n right: 0,\n bottom: 0,\n },\n };\n },\n});\n\nexport default SlashCommand;\n"],"names":["Extension","ReactRenderer","Suggestion","PluginKey","tippy","GROUPS","MenuList","extensionName","popup","SlashCommand","create","name","priority","onCreate","t","interactive","trigger","placement","theme","maxWidth","offset","popperOptions","strategy","modifiers","enabled","addProseMirrorPlugins","editor","char","allowSpaces","startOfLine","pluginKey","allow","state","range","$from","doc","resolve","from","isRootDepth","depth","isParagraph","parent","type","isStartOfNode","textContent","charAt","isInColumn","isActive","afterContent","substring","indexOf","isValidAfterContent","endsWith","command","props","view","$head","selection","end","pos","nodeBefore","text","length","start","tr","deleteRange","dispatch","action","focus","items","query","withFilteredCommands","map","group","commands","filter","item","labelNormalized","label","toLowerCase","trim","queryNormalized","aliases","alias","includes","shouldBeHidden","withoutEmptyGroups","withEnabledSettings","isEnabled","render","component","scrollHandler","onStart","editorNode","dom","getReferenceClientRect","clientRect","storage","rect","yPos","y","top","element","offsetHeight","window","innerHeight","diff","editorXOffset","getBoundingClientRect","x","DOMRect","width","height","setProps","parentElement","addEventListener","appendTo","document","body","content","show","onUpdate","updateProps","left","right","bottom","onKeyDown","event","key","hide","isShown","ref","onExit","removeEventListener","destroy","addStorage"],"mappings":"AAAA;AACA,SAAiBA,SAAS,QAAQ,eAAe;AACjD,SAASC,aAAa,QAAQ,gBAAgB;AAC9C,OAAOC,gBAGA,qBAAqB;AAC5B,SAASC,SAAS,QAAQ,mBAAmB;AAC7C,OAAOC,WAAW,WAAW;AAE7B,SAASC,MAAM,QAAQ,cAAc;AACrC,SAASC,QAAQ,QAAQ,gBAAgB;AAEzC,MAAMC,gBAAgB;AAEtB,IAAIC;AAEJ,OAAO,MAAMC,eAAeT,UAAUU,MAAM,CAAC;IAC3CC,MAAMJ;IAENK,UAAU;IAEVC;QACE,MAAMC,IAAIV;QACVI,QAAQM,EAAE,QAAQ;YAChBC,aAAa;YACbC,SAAS;YACTC,WAAW;YACXC,OAAO;YACPC,UAAU;YACVC,QAAQ;gBAAC;gBAAI;aAAE;YACfC,eAAe;gBACbC,UAAU;gBACVC,WAAW;oBACT;wBACEZ,MAAM;wBACNa,SAAS;oBACX;iBACD;YACH;QACF;IACF;IAEAC;QACE,OAAO;YACLvB,WAAW;gBACTwB,QAAQ,IAAI,CAACA,MAAM;gBACnBC,MAAM;gBACNC,aAAa;gBACbC,aAAa;gBACbC,WAAW,IAAI3B,UAAUI;gBACzBwB,OAAO,CAAC,EAAEC,KAAK,EAAEC,K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AEJ;4BACAD,UAAU4C,OAAO;wBACnB;oBACF;gBACF;YACF;SACD;IACH;IAEAC;QACE,OAAO;YACLrC,MAAM;gBACJa,OAAO;gBACPC,QAAQ;gBACRW,MAAM;gBACNtB,KAAK;gBACLuB,OAAO;gBACPC,QAAQ;YACV;QACF;IACF;AACF,GAAG;AAEH,eAAepH,aAAa"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/SlashCommand/SlashCommand.ts"],"sourcesContent":["\"use client\";\nimport { Editor, Extension } from \"@tiptap/core\";\nimport { ReactRenderer } from \"@tiptap/react\";\nimport Suggestion, {\n SuggestionProps,\n SuggestionKeyDownProps,\n} from \"@tiptap/suggestion\";\nimport { PluginKey } from \"@tiptap/pm/state\";\nimport tippy from \"tippy.js\";\n\nimport { MenuList } from \"./MenuList.js\";\n\nconst extensionName = \"slashCommand\";\n\nlet popup: any;\n\nexport const SlashCommand = Extension.create({\n name: extensionName,\n\n priority: 200,\n\n onCreate() {\n const t = tippy as any;\n popup = t(\"body\", {\n interactive: true,\n trigger: \"manual\",\n placement: \"bottom-start\",\n theme: \"slash-command\",\n maxWidth: \"16rem\",\n offset: [16, 8],\n popperOptions: {\n strategy: \"fixed\",\n modifiers: [\n {\n name: \"flip\",\n enabled: false,\n },\n ],\n },\n });\n },\n\n addProseMirrorPlugins() {\n return [\n Suggestion({\n editor: this.editor,\n char: \"/\",\n allowSpaces: true,\n startOfLine: true,\n pluginKey: new PluginKey(extensionName),\n allow: ({ state, range }) => {\n const $from = state.doc.resolve(range.from);\n const isRootDepth = $from.depth === 1;\n const isParagraph = $from.parent.type.name === \"paragraph\";\n const isStartOfNode = $from.parent.textContent?.charAt(0) === \"/\";\n // TODO\n const isInColumn = this.editor.isActive(\"column\");\n\n const afterContent = $from.parent.textContent?.substring(\n $from.parent.textContent?.indexOf(\"/\")\n );\n const isValidAfterContent = !afterContent?.endsWith(\" \");\n\n return (\n ((isRootDepth && isParagraph && isStartOfNode) ||\n (isInColumn && isParagraph && isStartOfNode)) &&\n isValidAfterContent\n );\n },\n command: ({ editor, props }: { editor: Editor; props: any }) => {\n const { view, state } = editor;\n const { $head, $from } = view.state.selection;\n\n const end = $from.pos;\n const from = $head?.nodeBefore\n ? end -\n ($head.nodeBefore.text?.substring(\n $head.nodeBefore.text?.indexOf(\"/\")\n ).length ?? 0)\n : $from.start();\n\n const tr = state.tr.deleteRange(from, end);\n view.dispatch(tr);\n\n props.action(editor);\n view.focus();\n },\n items: async ({ query }: { query: string }) => {\n const GROUPS = (await import(\"./groups.js\")).default;\n const withFilteredCommands = GROUPS.map((group) => ({\n ...group,\n commands: group.commands\n .filter((item) => {\n const labelNormalized = item.label.toLowerCase().trim();\n const queryNormalized = query.toLowerCase().trim();\n\n if (item.aliases) {\n const aliases = item.aliases.map((alias) =>\n alias.toLowerCase().trim()\n );\n\n return (\n labelNormalized.includes(queryNormalized) ||\n aliases.includes(queryNormalized)\n );\n }\n\n return labelNormalized.includes(queryNormalized);\n })\n .filter((command) =>\n command.shouldBeHidden\n ? !command.shouldBeHidden(this.editor)\n : true\n ),\n }));\n\n const withoutEmptyGroups = withFilteredCommands.filter((group) => {\n if (group.commands.length > 0) {\n return true;\n }\n\n return false;\n });\n\n const withEnabledSettings = withoutEmptyGroups.map((group) => ({\n ...group,\n commands: group.commands.map((command) => ({\n ...command,\n isEnabled: true,\n })),\n }));\n\n return withEnabledSettings;\n },\n render: () => {\n let component: any;\n\n let scrollHandler: (() => void) | null = null;\n\n return {\n onStart: (props: SuggestionProps) => {\n component = new ReactRenderer(MenuList, {\n props,\n editor: props.editor,\n });\n\n const { view } = props.editor;\n\n const editorNode = view.dom as HTMLElement;\n\n const getReferenceClientRect = () => {\n if (!props.clientRect) {\n return props.editor.storage[extensionName].rect;\n }\n\n const rect = props.clientRect();\n\n if (!rect) {\n return props.editor.storage[extensionName].rect;\n }\n\n let yPos = rect.y;\n\n if (\n rect.top + component.element.offsetHeight + 40 >\n window.innerHeight\n ) {\n const diff =\n rect.top +\n component.element.offsetHeight -\n window.innerHeight +\n 40;\n yPos = rect.y - diff;\n }\n\n // Account for when the editor is bound inside a container that doesn't go all the way to the edge of the screen\n const editorXOffset = editorNode.getBoundingClientRect().x;\n return new DOMRect(rect.x, yPos, rect.width, rect.height);\n };\n\n scrollHandler = () => {\n popup?.[0].setProps({\n getReferenceClientRect,\n });\n };\n\n view.dom.parentElement?.addEventListener(\"scroll\", scrollHandler);\n\n popup?.[0].setProps({\n getReferenceClientRect,\n appendTo: () => document.body,\n content: component.element,\n });\n\n popup?.[0].show();\n },\n\n onUpdate(props: SuggestionProps) {\n component.updateProps(props);\n\n const { view } = props.editor;\n\n const editorNode = view.dom as HTMLElement;\n\n const getReferenceClientRect = () => {\n if (!props.clientRect) {\n return props.editor.storage[extensionName].rect;\n }\n\n const rect = props.clientRect();\n\n if (!rect) {\n return props.editor.storage[extensionName].rect;\n }\n\n // Account for when the editor is bound inside a container that doesn't go all the way to the edge of the screen\n return new DOMRect(rect.x, rect.y, rect.width, rect.height);\n };\n\n let scrollHandler = () => {\n popup?.[0].setProps({\n getReferenceClientRect,\n });\n };\n\n view.dom.parentElement?.addEventListener(\"scroll\", scrollHandler);\n\n // eslint-disable-next-line no-param-reassign\n props.editor.storage[extensionName].rect = props.clientRect\n ? getReferenceClientRect()\n : {\n width: 0,\n height: 0,\n left: 0,\n top: 0,\n right: 0,\n bottom: 0,\n };\n popup?.[0].setProps({\n getReferenceClientRect,\n });\n },\n\n onKeyDown(props: SuggestionKeyDownProps) {\n if (props.event.key === \"Escape\") {\n popup?.[0].hide();\n\n return true;\n }\n\n if (!popup?.[0].state.isShown) {\n popup?.[0].show();\n }\n\n return component.ref?.onKeyDown(props);\n },\n\n onExit(props) {\n popup?.[0].hide();\n if (scrollHandler) {\n const { view } = props.editor;\n view.dom.parentElement?.removeEventListener(\n \"scroll\",\n scrollHandler\n );\n }\n component.destroy();\n },\n };\n },\n }),\n ];\n },\n\n addStorage() {\n return {\n rect: {\n width: 0,\n height: 0,\n left: 0,\n top: 0,\n right: 0,\n bottom: 0,\n },\n };\n },\n});\n\nexport default SlashCommand;\n"],"names":["Extension","ReactRenderer","Suggestion","PluginKey","tippy","MenuList","extensionName","popup","SlashCommand","create","name","priority","onCreate","t","interactive","trigger","placement","theme","maxWidth","offset","popperOptions","strategy","modifiers","enabled","addProseMirrorPlugins","editor","char","allowSpaces","startOfLine","pluginKey","allow","state","range","$from","doc","resolve","from","isRootDepth","depth","isParagraph","parent","type","isStartOfNode","textContent","charAt","isInColumn","isActive","afterContent","substring","indexOf","isValidAfterContent","endsWith","command","props","view","$head","selection","end","pos","nodeBefore","text","length","start","tr","deleteRange","dispatch","action","focus","items","query","GROUPS","default","withFilteredCommands","map","group","commands","filter","item","labelNormalized","label","toLowerCase","trim","queryNormalized","aliases","alias","includes","shouldBeHidden","withoutEmptyGroups","withEnabledSettings","isEnabled","render","component","scrollHandler","onStart","editorNode","dom","getReferenceClientRect","clientRect","storage","rect","yPos","y","top","element","offsetHeight","window","innerHeight","diff","editorXOffset","getBoundingClientRect","x","DOMRect","width","height","setProps","parentElement","addEventListener","appendTo","document","body","content","show","onUpdate","updateProps","left","right","bottom","onKeyDown","event","key","hide","isShown","ref","onExit","removeEventListener","destroy","addStorage"],"mappings":"AAAA;AACA,SAAiBA,SAAS,QAAQ,eAAe;AACjD,SAASC,aAAa,QAAQ,gBAAgB;AAC9C,OAAOC,gBAGA,qBAAqB;AAC5B,SAASC,SAAS,QAAQ,mBAAmB;AAC7C,OAAOC,WAAW,WAAW;AAE7B,SAASC,QAAQ,QAAQ,gBAAgB;AAEzC,MAAMC,gBAAgB;AAEtB,IAAIC;AAEJ,OAAO,MAAMC,eAAeR,UAAUS,MAAM,CAAC;IAC3CC,MAAMJ;IAENK,UAAU;IAEVC;QACE,MAAMC,IAAIT;QACVG,QAAQM,EAAE,QAAQ;YAChBC,aAAa;YACbC,SAAS;YACTC,WAAW;YACXC,OAAO;YACPC,UAAU;YACVC,QAAQ;g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H;gCAEX,OAAO;4BACT;4BAEA,IAAI,CAAC3H,OAAO,CAAC,EAAE,CAACwB,MAAMoG,SAAS;gCAC7B5H,OAAO,CAAC,EAAE,CAACkH;4BACb;4BAEA,OAAO9B,UAAUyC,GAAG,EAAEL,UAAU1E;wBAClC;wBAEAgF,QAAOhF,KAAK;4BACV9C,OAAO,CAAC,EAAE,CAAC2H;4BACX,IAAItC,eAAe;gCACjB,MAAM,EAAEtC,IAAI,EAAE,GAAGD,MAAM5B,MAAM;gCAC7B6B,KAAKyC,GAAG,CAACoB,aAAa,EAAEmB,oBACtB,UACA1C;4BAEJ;4BACAD,UAAU4C,OAAO;wBACnB;oBACF;gBACF;YACF;SACD;IACH;IAEAC;QACE,OAAO;YACLrC,MAAM;gBACJa,OAAO;gBACPC,QAAQ;gBACRW,MAAM;gBACNtB,KAAK;gBACLuB,OAAO;gBACPC,QAAQ;YACV;QACF;IACF;AACF,GAAG;AAEH,eAAetH,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"groups.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/SlashCommand/groups.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"groups.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/SlashCommand/groups.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAGnC,eAAO,MAAM,MAAM,EAAE,KAAK,EAsKzB,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { Facebook, Heading1, Heading2, Heading3, Image, Instagram, List, ListOrdered, Minus, Music, Quote, Twitter, Video, Youtube } from "lucide-react";
|
|
2
|
+
import i18next from "i18next";
|
|
2
3
|
export const GROUPS = [
|
|
3
4
|
{
|
|
4
5
|
name: "format",
|
|
5
|
-
title: "Format",
|
|
6
|
+
title: i18next.t("format") || "Format",
|
|
6
7
|
commands: [
|
|
7
8
|
{
|
|
8
9
|
name: "heading1",
|
|
9
|
-
label: "Heading 1
|
|
10
|
+
label: i18next.t("heading1") || 'Heading 1',
|
|
11
|
+
description: i18next.t("heading1Desc") || "High priority section title",
|
|
10
12
|
icon: Heading1,
|
|
11
|
-
description: "High priority section title",
|
|
12
13
|
aliases: [
|
|
13
14
|
"h1"
|
|
14
15
|
],
|
|
@@ -20,9 +21,9 @@ export const GROUPS = [
|
|
|
20
21
|
},
|
|
21
22
|
{
|
|
22
23
|
name: "heading2",
|
|
23
|
-
label: "Heading 2
|
|
24
|
+
label: i18next.t("heading2") || 'Heading 2',
|
|
25
|
+
description: i18next.t("heading2Desc") || "Medium priority section title",
|
|
24
26
|
icon: Heading2,
|
|
25
|
-
description: "Medium priority section title",
|
|
26
27
|
aliases: [
|
|
27
28
|
"h2"
|
|
28
29
|
],
|
|
@@ -34,9 +35,9 @@ export const GROUPS = [
|
|
|
34
35
|
},
|
|
35
36
|
{
|
|
36
37
|
name: "heading3",
|
|
37
|
-
label: "Heading 3
|
|
38
|
+
label: i18next.t("heading3") || 'Heading 3',
|
|
39
|
+
description: i18next.t("heading3Desc") || "Low priority section title",
|
|
38
40
|
icon: Heading3,
|
|
39
|
-
description: "Low priority section title",
|
|
40
41
|
aliases: [
|
|
41
42
|
"h3"
|
|
42
43
|
],
|
|
@@ -48,9 +49,9 @@ export const GROUPS = [
|
|
|
48
49
|
},
|
|
49
50
|
{
|
|
50
51
|
name: "bulletList",
|
|
51
|
-
label: "Bullet List
|
|
52
|
+
label: i18next.t("bulletList") || 'Bullet List',
|
|
53
|
+
description: i18next.t("bulletListDesc") || "Unordered list of items",
|
|
52
54
|
icon: List,
|
|
53
|
-
description: "Unordered list of items",
|
|
54
55
|
aliases: [
|
|
55
56
|
"ul"
|
|
56
57
|
],
|
|
@@ -60,9 +61,9 @@ export const GROUPS = [
|
|
|
60
61
|
},
|
|
61
62
|
{
|
|
62
63
|
name: "numberedList",
|
|
63
|
-
label: "Numbered List
|
|
64
|
+
label: i18next.t("numberedList") || 'Numbered List',
|
|
65
|
+
description: i18next.t("numberedListDesc") || "Ordered list of items",
|
|
64
66
|
icon: ListOrdered,
|
|
65
|
-
description: "Ordered list of items",
|
|
66
67
|
aliases: [
|
|
67
68
|
"ol"
|
|
68
69
|
],
|
|
@@ -72,9 +73,9 @@ export const GROUPS = [
|
|
|
72
73
|
},
|
|
73
74
|
{
|
|
74
75
|
name: "blockquote",
|
|
75
|
-
label: "Blockquote
|
|
76
|
+
label: i18next.t("blockquote") || 'Blockquote',
|
|
77
|
+
description: i18next.t("blockquoteDesc") || "Element for quoting",
|
|
76
78
|
icon: Quote,
|
|
77
|
-
description: "Element for quoting",
|
|
78
79
|
action: (editor)=>{
|
|
79
80
|
editor.chain().focus().setBlockquote().run();
|
|
80
81
|
}
|
|
@@ -87,9 +88,9 @@ export const GROUPS = [
|
|
|
87
88
|
commands: [
|
|
88
89
|
{
|
|
89
90
|
name: "image",
|
|
90
|
-
label: "Image
|
|
91
|
+
label: i18next.t("image") || 'Image',
|
|
92
|
+
description: i18next.t("imageDesc") || "Insert an image",
|
|
91
93
|
icon: Image,
|
|
92
|
-
description: "Insert an image",
|
|
93
94
|
aliases: [
|
|
94
95
|
"img"
|
|
95
96
|
],
|
|
@@ -99,9 +100,9 @@ export const GROUPS = [
|
|
|
99
100
|
},
|
|
100
101
|
{
|
|
101
102
|
name: "video",
|
|
102
|
-
label: "Video
|
|
103
|
+
label: i18next.t("video") || 'Video',
|
|
104
|
+
description: i18next.t("videoDesc") || "Insert a video",
|
|
103
105
|
icon: Video,
|
|
104
|
-
description: "Insert a video",
|
|
105
106
|
aliases: [
|
|
106
107
|
"video"
|
|
107
108
|
],
|
|
@@ -111,9 +112,9 @@ export const GROUPS = [
|
|
|
111
112
|
},
|
|
112
113
|
{
|
|
113
114
|
name: "horizontalRule",
|
|
114
|
-
label: "
|
|
115
|
+
label: i18next.t("horizontalRule") || 'HorizontalRule',
|
|
116
|
+
description: i18next.t("horizontalRuleDesc") || "Insert a horizontal divider",
|
|
115
117
|
icon: Minus,
|
|
116
|
-
description: "Insert a horizontal divider",
|
|
117
118
|
aliases: [
|
|
118
119
|
"hr"
|
|
119
120
|
],
|
|
@@ -129,13 +130,13 @@ export const GROUPS = [
|
|
|
129
130
|
commands: [
|
|
130
131
|
{
|
|
131
132
|
name: "twitter",
|
|
132
|
-
label: "Twitter
|
|
133
|
+
label: i18next.t("twitter") || 'Twitter',
|
|
134
|
+
description: i18next.t("twitterDesc") || "Insert a Twitter embed",
|
|
133
135
|
icon: Twitter,
|
|
134
136
|
aliases: [
|
|
135
137
|
"x",
|
|
136
138
|
"twitter"
|
|
137
139
|
],
|
|
138
|
-
description: "Insert a Twitter embed",
|
|
139
140
|
shouldBeHidden: (editor)=>editor.isActive("twitter"),
|
|
140
141
|
action: (editor)=>{
|
|
141
142
|
editor.chain().focus().insertTwitter().run();
|
|
@@ -143,13 +144,13 @@ export const GROUPS = [
|
|
|
143
144
|
},
|
|
144
145
|
{
|
|
145
146
|
name: "facebook",
|
|
146
|
-
label: "Facebook
|
|
147
|
+
label: i18next.t("facebook") || 'Facebook',
|
|
148
|
+
description: i18next.t("facebookDesc") || "Insert a Facebook embed",
|
|
147
149
|
icon: Facebook,
|
|
148
150
|
aliases: [
|
|
149
151
|
"meta",
|
|
150
152
|
"facebook"
|
|
151
153
|
],
|
|
152
|
-
description: "Insert a Facebook embed",
|
|
153
154
|
shouldBeHidden: (editor)=>editor.isActive("facebook"),
|
|
154
155
|
action: (editor)=>{
|
|
155
156
|
editor.chain().focus().insertFacebook().run();
|
|
@@ -157,12 +158,12 @@ export const GROUPS = [
|
|
|
157
158
|
},
|
|
158
159
|
{
|
|
159
160
|
name: "instagram",
|
|
160
|
-
label: "Instagram
|
|
161
|
+
label: i18next.t("instagram") || 'Instagram',
|
|
162
|
+
description: i18next.t("instagramDesc") || "Insert a Instagram embed",
|
|
161
163
|
icon: Instagram,
|
|
162
164
|
aliases: [
|
|
163
165
|
"instagram"
|
|
164
166
|
],
|
|
165
|
-
description: "Insert a Instagram embed",
|
|
166
167
|
shouldBeHidden: (editor)=>editor.isActive("instagram"),
|
|
167
168
|
action: (editor)=>{
|
|
168
169
|
editor.chain().focus().insertInstagram().run();
|
|
@@ -170,12 +171,12 @@ export const GROUPS = [
|
|
|
170
171
|
},
|
|
171
172
|
{
|
|
172
173
|
name: "youtube",
|
|
173
|
-
label: "Youtube
|
|
174
|
+
label: i18next.t("youtube") || 'Youtube',
|
|
175
|
+
description: i18next.t("youtubeDesc") || "Insert a Youtube embed",
|
|
174
176
|
icon: Youtube,
|
|
175
177
|
aliases: [
|
|
176
178
|
"youtube"
|
|
177
179
|
],
|
|
178
|
-
description: "Insert a Youtube embed",
|
|
179
180
|
shouldBeHidden: (editor)=>editor.isActive("youtube"),
|
|
180
181
|
action: (editor)=>{
|
|
181
182
|
editor.chain().focus().insertYoutube().run();
|
|
@@ -183,12 +184,12 @@ export const GROUPS = [
|
|
|
183
184
|
},
|
|
184
185
|
{
|
|
185
186
|
name: "tiktok",
|
|
186
|
-
label: "Tiktok
|
|
187
|
+
label: i18next.t("tiktok") || 'Tiktok',
|
|
188
|
+
description: i18next.t("tiktokDesc") || "Insert a Tiktok embed",
|
|
187
189
|
icon: Music,
|
|
188
190
|
aliases: [
|
|
189
191
|
"tiktok"
|
|
190
192
|
],
|
|
191
|
-
description: "Insert a Tiktok embed",
|
|
192
193
|
shouldBeHidden: (editor)=>editor.isActive("tiktok"),
|
|
193
194
|
action: (editor)=>{
|
|
194
195
|
editor.chain().focus().insertTiktok().run();
|