payload-richtext-tiptap 0.0.22 → 0.0.24
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.
|
@@ -12,7 +12,6 @@ import { ColumnsMenu } from "../../extensions/MultiColumn/menus/ColumnsMenu.js";
|
|
|
12
12
|
import { SocialMediaMenu } from "../../extensions/SocialMedia/menus/index.js";
|
|
13
13
|
import { TableColumnMenu, TableRowMenu } from "../../extensions/Table/menus/index.js";
|
|
14
14
|
import { useBlockEditor } from "../../hooks/useBlockEditor.js";
|
|
15
|
-
import { Sidebar } from "../Sidebar/Sidebar.js";
|
|
16
15
|
import { ContentItemMenu } from "../menus/ContentItemMenu/ContentItemMenu.js";
|
|
17
16
|
import { TextMenu } from "../menus/TextMenu/TextMenu.js";
|
|
18
17
|
import { LinkMenu } from "../menus/index.js";
|
|
@@ -55,69 +54,62 @@ export const BlockEditor = ({ handleChange, content })=>{
|
|
|
55
54
|
editor.commands.setContent(contentEn)
|
|
56
55
|
}*/ return /*#__PURE__*/ _jsx(EditorContext.Provider, {
|
|
57
56
|
value: providerValue,
|
|
58
|
-
children: /*#__PURE__*/
|
|
57
|
+
children: /*#__PURE__*/ _jsx("div", {
|
|
59
58
|
lang: i18n.language,
|
|
60
59
|
className: "flex h-full overflow-visible",
|
|
61
60
|
ref: menuContainerRef,
|
|
62
|
-
children:
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
/*#__PURE__*/ _jsx(ImageBlockMenu, {
|
|
115
|
-
editor: editor,
|
|
116
|
-
appendTo: menuContainerRef
|
|
117
|
-
})
|
|
118
|
-
]
|
|
119
|
-
})
|
|
120
|
-
]
|
|
61
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
62
|
+
className: "relative flex flex-col flex-1 h-full justify-center items-center ",
|
|
63
|
+
children: [
|
|
64
|
+
/*#__PURE__*/ _jsx(EditorContent, {
|
|
65
|
+
editor: editor,
|
|
66
|
+
ref: editorRef,
|
|
67
|
+
lang: i18n.language,
|
|
68
|
+
className: "flex-1 overflow-y-visible w-full h-full outline-none outline-offset-0",
|
|
69
|
+
style: {
|
|
70
|
+
outline: "none"
|
|
71
|
+
}
|
|
72
|
+
}),
|
|
73
|
+
/*#__PURE__*/ _jsx(ContentItemMenu, {
|
|
74
|
+
editor: editor
|
|
75
|
+
}),
|
|
76
|
+
/*#__PURE__*/ _jsx(LinkMenu, {
|
|
77
|
+
editor: editor,
|
|
78
|
+
appendTo: menuContainerRef
|
|
79
|
+
}),
|
|
80
|
+
/*#__PURE__*/ _jsx(TextMenu, {
|
|
81
|
+
editor: editor
|
|
82
|
+
}),
|
|
83
|
+
/*#__PURE__*/ _jsx(IframeMenu, {
|
|
84
|
+
editor: editor,
|
|
85
|
+
appendTo: menuContainerRef
|
|
86
|
+
}),
|
|
87
|
+
/*#__PURE__*/ _jsx(SocialMediaMenu, {
|
|
88
|
+
editor: editor,
|
|
89
|
+
appendTo: menuContainerRef
|
|
90
|
+
}),
|
|
91
|
+
/*#__PURE__*/ _jsx(InsideLinksMenu, {
|
|
92
|
+
editor: editor,
|
|
93
|
+
appendTo: menuContainerRef
|
|
94
|
+
}),
|
|
95
|
+
/*#__PURE__*/ _jsx(ColumnsMenu, {
|
|
96
|
+
editor: editor,
|
|
97
|
+
appendTo: menuContainerRef
|
|
98
|
+
}),
|
|
99
|
+
/*#__PURE__*/ _jsx(TableRowMenu, {
|
|
100
|
+
editor: editor,
|
|
101
|
+
appendTo: menuContainerRef
|
|
102
|
+
}),
|
|
103
|
+
/*#__PURE__*/ _jsx(TableColumnMenu, {
|
|
104
|
+
editor: editor,
|
|
105
|
+
appendTo: menuContainerRef
|
|
106
|
+
}),
|
|
107
|
+
/*#__PURE__*/ _jsx(ImageBlockMenu, {
|
|
108
|
+
editor: editor,
|
|
109
|
+
appendTo: menuContainerRef
|
|
110
|
+
})
|
|
111
|
+
]
|
|
112
|
+
})
|
|
121
113
|
})
|
|
122
114
|
});
|
|
123
115
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/features/BlockEditor/BlockEditor.tsx"],"sourcesContent":["\"use client\";\nimport { EditorContent } from \"@tiptap/react\";\nimport { useEffect, useMemo, useRef } from \"react\";\n\nimport { useLocale } from \"@payloadcms/ui/providers/Locale\";\nimport { useTranslation } from \"@payloadcms/ui/providers/Translation\";\nimport { EditorContext } from \"../../context/EditorContext.js\";\nimport { IframeMenu } from \"../../extensions/Iframe/menus/index.js\";\nimport ImageBlockMenu from \"../../extensions/ImageBlock/components/ImageBlockMenu.js\";\nimport { InsideLinksMenu } from \"../../extensions/InsideLinks/menus/index.js\";\nimport { ColumnsMenu } from \"../../extensions/MultiColumn/menus/ColumnsMenu.js\";\nimport { SocialMediaMenu } from \"../../extensions/SocialMedia/menus/index.js\";\nimport {\n TableColumnMenu,\n TableRowMenu,\n} from \"../../extensions/Table/menus/index.js\";\nimport { useBlockEditor } from \"../../hooks/useBlockEditor.js\";\nimport { Sidebar } from \"../Sidebar/Sidebar.js\";\nimport { ContentItemMenu } from \"../menus/ContentItemMenu/ContentItemMenu.js\";\nimport { TextMenu } from \"../menus/TextMenu/TextMenu.js\";\nimport { LinkMenu } from \"../menus/index.js\";\nimport { TiptapProps } from \"./types.js\";\n\nexport const BlockEditor = ({ handleChange, content }: TiptapProps) => {\n const menuContainerRef = useRef(null);\n const editorRef = useRef<HTMLDivElement>(null);\n\n const { editor, users, characterCount, leftSidebar } = useBlockEditor({\n content: content,\n handleChange: handleChange,\n });\n\n const { code } = useLocale();\n\n const displayedUsers = users.slice(0, 3);\n\n const providerValue = useMemo(() => {\n return {};\n }, []);\n\n useEffect(() => {\n if (code === \"ar\" || code === \"fa\") {\n editor?.commands?.setTextDirection(\"rtl\");\n editor?.commands?.setContent(\"dwa\");\n }\n }, [code]);\n\n if (!editor) {\n return null;\n }\n const { i18n } = useTranslation();\n\n // Define the content for different languages\n const contentEn = \"للكتابة...\"; // Content for English or default language\n const contentAr = \"انقر هنا للكتابة...\"; // Content for Arabic language\n const contentFa = \"اینجا کلیک کنید تا شروع به نوشتن کنید...\";\n\n /*switch (i18n.language) {\n case 'ar':\n editor.commands.setContent(contentAr)\n break\n case 'fa':\n editor.commands.setContent(contentFa)\n break\n default:\n editor.commands.setContent(contentEn)\n }*/\n\n return (\n <EditorContext.Provider value={providerValue}>\n <div\n lang={i18n.language}\n className=\"flex h-full overflow-visible\"\n ref={menuContainerRef}\n >\n <Sidebar\n isOpen={leftSidebar.isOpen}\n onClose={leftSidebar.close}\n editor={editor}\n
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/features/BlockEditor/BlockEditor.tsx"],"sourcesContent":["\"use client\";\nimport { EditorContent } from \"@tiptap/react\";\nimport { useEffect, useMemo, useRef } from \"react\";\n\nimport { useLocale } from \"@payloadcms/ui/providers/Locale\";\nimport { useTranslation } from \"@payloadcms/ui/providers/Translation\";\nimport { EditorContext } from \"../../context/EditorContext.js\";\nimport { IframeMenu } from \"../../extensions/Iframe/menus/index.js\";\nimport ImageBlockMenu from \"../../extensions/ImageBlock/components/ImageBlockMenu.js\";\nimport { InsideLinksMenu } from \"../../extensions/InsideLinks/menus/index.js\";\nimport { ColumnsMenu } from \"../../extensions/MultiColumn/menus/ColumnsMenu.js\";\nimport { SocialMediaMenu } from \"../../extensions/SocialMedia/menus/index.js\";\nimport {\n TableColumnMenu,\n TableRowMenu,\n} from \"../../extensions/Table/menus/index.js\";\nimport { useBlockEditor } from \"../../hooks/useBlockEditor.js\";\nimport { Sidebar } from \"../Sidebar/Sidebar.js\";\nimport { ContentItemMenu } from \"../menus/ContentItemMenu/ContentItemMenu.js\";\nimport { TextMenu } from \"../menus/TextMenu/TextMenu.js\";\nimport { LinkMenu } from \"../menus/index.js\";\nimport { TiptapProps } from \"./types.js\";\n\nexport const BlockEditor = ({ handleChange, content }: TiptapProps) => {\n const menuContainerRef = useRef(null);\n const editorRef = useRef<HTMLDivElement>(null);\n\n const { editor, users, characterCount, leftSidebar } = useBlockEditor({\n content: content,\n handleChange: handleChange,\n });\n\n const { code } = useLocale();\n\n const displayedUsers = users.slice(0, 3);\n\n const providerValue = useMemo(() => {\n return {};\n }, []);\n\n useEffect(() => {\n if (code === \"ar\" || code === \"fa\") {\n editor?.commands?.setTextDirection(\"rtl\");\n editor?.commands?.setContent(\"dwa\");\n }\n }, [code]);\n\n if (!editor) {\n return null;\n }\n const { i18n } = useTranslation();\n\n // Define the content for different languages\n const contentEn = \"للكتابة...\"; // Content for English or default language\n const contentAr = \"انقر هنا للكتابة...\"; // Content for Arabic language\n const contentFa = \"اینجا کلیک کنید تا شروع به نوشتن کنید...\";\n\n /*switch (i18n.language) {\n case 'ar':\n editor.commands.setContent(contentAr)\n break\n case 'fa':\n editor.commands.setContent(contentFa)\n break\n default:\n editor.commands.setContent(contentEn)\n }*/\n\n return (\n <EditorContext.Provider value={providerValue}>\n <div\n lang={i18n.language}\n className=\"flex h-full overflow-visible\"\n ref={menuContainerRef}\n >\n {/* <Sidebar\n isOpen={leftSidebar.isOpen}\n onClose={leftSidebar.close}\n editor={editor}\n /> */}\n <div className=\"relative flex flex-col flex-1 h-full justify-center items-center \">\n {/* <EditorHeader\n characters={characterCount.characters()}\n users={displayedUsers}\n words={characterCount.words()}\n isSidebarOpen={leftSidebar.isOpen}\n toggleSidebar={leftSidebar.toggle}\n /> */}\n <EditorContent\n editor={editor}\n ref={editorRef}\n lang={i18n.language}\n className=\"flex-1 overflow-y-visible w-full h-full outline-none outline-offset-0\"\n style={{\n outline: \"none\",\n }}\n />\n <ContentItemMenu editor={editor} />\n <LinkMenu editor={editor} appendTo={menuContainerRef} />\n\n <TextMenu editor={editor} />\n <IframeMenu editor={editor} appendTo={menuContainerRef} />\n <SocialMediaMenu editor={editor} appendTo={menuContainerRef} />\n <InsideLinksMenu editor={editor} appendTo={menuContainerRef} />\n <ColumnsMenu editor={editor} appendTo={menuContainerRef} />\n <TableRowMenu editor={editor} appendTo={menuContainerRef} />\n <TableColumnMenu editor={editor} appendTo={menuContainerRef} />\n <ImageBlockMenu editor={editor} appendTo={menuContainerRef} />\n </div>\n </div>\n </EditorContext.Provider>\n );\n};\n\nexport default BlockEditor;\n"],"names":["EditorContent","useEffect","useMemo","useRef","useLocale","useTranslation","EditorContext","IframeMenu","ImageBlockMenu","InsideLinksMenu","ColumnsMenu","SocialMediaMenu","TableColumnMenu","TableRowMenu","useBlockEditor","ContentItemMenu","TextMenu","LinkMenu","BlockEditor","handleChange","content","menuContainerRef","editorRef","editor","users","characterCount","leftSidebar","code","displayedUsers","slice","providerValue","commands","setTextDirection","setContent","i18n","contentEn","contentAr","contentFa","Provider","value","div","lang","language","className","ref","style","outline","appendTo"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;AACA,SAASA,aAAa,QAAQ,gBAAgB;AAC9C,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