payload-richtext-tiptap 0.0.21 → 0.0.23

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__*/ _jsxs("div", {
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
- /*#__PURE__*/ _jsx(Sidebar, {
64
- isOpen: leftSidebar.isOpen,
65
- onClose: leftSidebar.close,
66
- editor: editor
67
- }),
68
- /*#__PURE__*/ _jsxs("div", {
69
- className: "relative flex flex-col flex-1 h-full justify-center items-center ",
70
- children: [
71
- /*#__PURE__*/ _jsx(EditorContent, {
72
- editor: editor,
73
- ref: editorRef,
74
- lang: i18n.language,
75
- className: "flex-1 overflow-y-visible w-full h-full outline-none outline-offset-0",
76
- style: {
77
- outline: "none"
78
- }
79
- }),
80
- /*#__PURE__*/ _jsx(ContentItemMenu, {
81
- editor: editor
82
- }),
83
- /*#__PURE__*/ _jsx(LinkMenu, {
84
- editor: editor,
85
- appendTo: menuContainerRef
86
- }),
87
- /*#__PURE__*/ _jsx(TextMenu, {
88
- editor: editor
89
- }),
90
- /*#__PURE__*/ _jsx(IframeMenu, {
91
- editor: editor,
92
- appendTo: menuContainerRef
93
- }),
94
- /*#__PURE__*/ _jsx(SocialMediaMenu, {
95
- editor: editor,
96
- appendTo: menuContainerRef
97
- }),
98
- /*#__PURE__*/ _jsx(InsideLinksMenu, {
99
- editor: editor,
100
- appendTo: menuContainerRef
101
- }),
102
- /*#__PURE__*/ _jsx(ColumnsMenu, {
103
- editor: editor,
104
- appendTo: menuContainerRef
105
- }),
106
- /*#__PURE__*/ _jsx(TableRowMenu, {
107
- editor: editor,
108
- appendTo: menuContainerRef
109
- }),
110
- /*#__PURE__*/ _jsx(TableColumnMenu, {
111
- editor: editor,
112
- appendTo: menuContainerRef
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 />\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","Sidebar","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","isOpen","onClose","close","style","outline","appendTo"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;AACA,SAASA,aAAa,QAAQ,gBAAgB;AAC9C,SAASC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,QAAQ;AAEnD,SAASC,SAAS,QAAQ,kCAAkC;AAC5D,SAASC,cAAc,QAAQ,uCAAuC;AACtE,SAASC,aAAa,QAAQ,iCAAiC;AAC/D,SAASC,UAAU,QAAQ,yCAAyC;AACpE,OAAOC,oBAAoB,2DAA2D;AACtF,SAASC,eAAe,QAAQ,8CAA8C;AAC9E,SAASC,WAAW,QAAQ,oDAAoD;AAChF,SAASC,eAAe,QAAQ,8CAA8C;AAC9E,SACEC,eAAe,EACfC,YAAY,QACP,wCAAwC;AAC/C,SAASC,cAAc,QAAQ,gCAAgC;AAC/D,SAASC,OAAO,QAAQ,wBAAwB;AAChD,SAASC,eAAe,QAAQ,8CAA8C;AAC9E,SAASC,QAAQ,QAAQ,gCAAgC;AACzD,SAASC,QAAQ,QAAQ,oBAAoB;AAG7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AAQA;;sCAClB,KAACjB;4BAAWiB,QAAQA;4BAAQ2B,UAAU7B;;sCACtC,KAACX;4BAAgBa,QAAQA;4BAAQ2B,UAAU7B;;sCAC3C,KAACb;4BAAgBe,QAAQA;4BAAQ2B,UAAU7B;;sCAC3C,KAACZ;4BAAYc,QAAQA;4BAAQ2B,UAAU7B;;sCACvC,KAACT;4BAAaW,QAAQA;4BAAQ2B,UAAU7B;;sCACxC,KAACV;4BAAgBY,QAAQA;4BAAQ2B,UAAU7B;;sCAC3C,KAACd;4BAAegB,QAAQA;4BAAQ2B,UAAU7B;;;;;;;AAKpD,EAAE;AAEF,eAAeH,YAAY"}
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,SAASC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,QAAQ;AAEnD,SAASC,SAAS,QAAQ,kCAAkC;AAC5D,SAASC,cAAc,QAAQ,uCAAuC;AACtE,SAASC,aAAa,QAAQ,iCAAiC;AAC/D,SAASC,UAAU,QAAQ,yCAAyC;AACpE,OAAOC,oBAAoB,2DAA2D;AACtF,SAASC,eAAe,QAAQ,8CAA8C;AAC9E,SAASC,WAAW,QAAQ,oDAAoD;AAChF,SAASC,eAAe,QAAQ,8CAA8C;AAC9E,SACEC,eAAe,EACfC,YAAY,QACP,wCAAwC;AAC/C,SAASC,cAAc,QAAQ,gCAAgC;AAE/D,SAASC,eAAe,QAAQ,8CAA8C;AAC9E,SAASC,QAAQ,QAAQ,gCAAgC;AACzD,SAASC,QAAQ,QAAQ,oBAAoB;AAG7C,OAAO,MAAMC,cAAc,CAAC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C,KAACZ;wBAAgBc,QAAQA;wBAAQwB,UAAU1B;;kCAC3C,KAACX;wBAAYa,QAAQA;wBAAQwB,UAAU1B;;kCACvC,KAACR;wBAAaU,QAAQA;wBAAQwB,UAAU1B;;kCACxC,KAACT;wBAAgBW,QAAQA;wBAAQwB,UAAU1B;;kCAC3C,KAACb;wBAAee,QAAQA;wBAAQwB,UAAU1B;;;;;;AAKpD,EAAE;AAEF,eAAeH,YAAY"}
@@ -29,8 +29,7 @@ export const TableOfContents = /*#__PURE__*/ memo(({ editor, onItemClick })=>{
29
29
  lang: i18n.language,
30
30
  children: [
31
31
  /*#__PURE__*/ _jsx("div", {
32
- className: "mb-2 text-xs font-semibold uppercase text-neutral-500 dark:text-neutral-400",
33
- children: "Table of Contents"
32
+ className: "mb-2 text-xs font-semibold uppercase text-neutral-500 dark:text-neutral-400"
34
33
  }),
35
34
  data && data.content.length > 0 ? /*#__PURE__*/ _jsx("div", {
36
35
  className: "flex flex-col gap-1",
@@ -48,8 +47,7 @@ export const TableOfContents = /*#__PURE__*/ memo(({ editor, onItemClick })=>{
48
47
  ]
49
48
  }, item.id))
50
49
  }) : /*#__PURE__*/ _jsx("div", {
51
- className: "text-sm text-neutral-500",
52
- children: "Start adding headlines to your document"
50
+ className: "text-sm text-neutral-500"
53
51
  })
54
52
  ]
55
53
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/fields/TiptapEditor/features/TableOfContents/TableOfContents.tsx"],"sourcesContent":["import React from \"react\";\nimport { Editor as CoreEditor } from \"@tiptap/core\";\nimport { memo, useEffect, useState } from \"react\";\nimport { TableOfContentsStorage } from \"@tiptap-pro/extension-table-of-contents\";\nimport { cn } from \"../../lib/utils/index.js\";\n// import { toTranslationKey } from '@/languages'\nimport { useTranslation } from \"@payloadcms/ui/providers/Translation\";\n\nexport type TableOfContentsProps = {\n editor: CoreEditor;\n onItemClick?: () => void;\n};\n\nexport const TableOfContents = memo(\n ({ editor, onItemClick }: TableOfContentsProps) => {\n const [data, setData] = useState<TableOfContentsStorage | null>(null);\n\n useEffect(() => {\n const handler = ({ editor: currentEditor }: { editor: CoreEditor }) => {\n setData({ ...currentEditor.extensionStorage.tableOfContents });\n };\n\n handler({ editor });\n\n editor.on(\"update\", handler);\n editor.on(\"selectionUpdate\", handler);\n\n return () => {\n editor.off(\"update\", handler);\n editor.off(\"selectionUpdate\", handler);\n };\n }, [editor]);\n const { i18n } = useTranslation();\n\n return (\n <div lang={i18n.language}>\n <div className=\"mb-2 text-xs font-semibold uppercase text-neutral-500 dark:text-neutral-400\">\n {/* {toTranslationKey('table_of_contents')} */}Table of Contents\n </div>\n {data && data.content.length > 0 ? (\n <div className=\"flex flex-col gap-1\">\n {data.content.map((item) => (\n <a\n key={item.id}\n href={`#${item.id}`}\n style={{ marginLeft: `${1 * item.level - 1}rem` }}\n onClick={onItemClick}\n className={cn(\n \"block font-medium text-neutral-500 dark:text-neutral-300 p-1 rounded bg-opacity-10 text-sm hover:text-neutral-800 transition-all hover:bg-black hover:bg-opacity-5 truncate w-full\",\n item.isActive &&\n \"text-neutral-800 bg-neutral-100 dark:text-neutral-100 dark:bg-neutral-900\"\n )}\n >\n {item.itemIndex}. {item.textContent}\n </a>\n ))}\n </div>\n ) : (\n <div className=\"text-sm text-neutral-500\">\n Start adding headlines to your document\n {/* {toTranslationKey(\"start_adding_headlines_to_your_document\")} */}\n </div>\n )}\n </div>\n );\n }\n);\n\nTableOfContents.displayName = \"TableOfContents\";\n"],"names":["React","memo","useEffect","useState","cn","useTranslation","TableOfContents","editor","onItemClick","data","setData","handler","currentEditor","extensionStorage","tableOfContents","on","off","i18n","div","lang","language","className","content","length","map","item","a","href","id","style","marginLeft","level","onClick","isActive","itemIndex","textContent","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";AAAA,OAAOA,WAAW,QAAQ;AAE1B,SAASC,IAAI,EAAEC,SAAS,EAAEC,QAAQ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["../../../../../../src/fields/TiptapEditor/features/TableOfContents/TableOfContents.tsx"],"sourcesContent":["import React from \"react\";\nimport { Editor as CoreEditor } from \"@tiptap/core\";\nimport { memo, useEffect, useState } from \"react\";\nimport { TableOfContentsStorage } from \"@tiptap-pro/extension-table-of-contents\";\nimport { cn } from \"../../lib/utils/index.js\";\n// import { toTranslationKey } from '@/languages'\nimport { useTranslation } from \"@payloadcms/ui/providers/Translation\";\n\nexport type TableOfContentsProps = {\n editor: CoreEditor;\n onItemClick?: () => void;\n};\n\nexport const TableOfContents = memo(\n ({ editor, onItemClick }: TableOfContentsProps) => {\n const [data, setData] = useState<TableOfContentsStorage | null>(null);\n\n useEffect(() => {\n const handler = ({ editor: currentEditor }: { editor: CoreEditor }) => {\n setData({ ...currentEditor.extensionStorage.tableOfContents });\n };\n\n handler({ editor });\n\n editor.on(\"update\", handler);\n editor.on(\"selectionUpdate\", handler);\n\n return () => {\n editor.off(\"update\", handler);\n editor.off(\"selectionUpdate\", handler);\n };\n }, [editor]);\n const { i18n } = useTranslation();\n\n return (\n <div lang={i18n.language}>\n <div className=\"mb-2 text-xs font-semibold uppercase text-neutral-500 dark:text-neutral-400\">\n {/* {toTranslationKey('table_of_contents')}Table of Contents */}\n </div>\n {data && data.content.length > 0 ? (\n <div className=\"flex flex-col gap-1\">\n {data.content.map((item) => (\n <a\n key={item.id}\n href={`#${item.id}`}\n style={{ marginLeft: `${1 * item.level - 1}rem` }}\n onClick={onItemClick}\n className={cn(\n \"block font-medium text-neutral-500 dark:text-neutral-300 p-1 rounded bg-opacity-10 text-sm hover:text-neutral-800 transition-all hover:bg-black hover:bg-opacity-5 truncate w-full\",\n item.isActive &&\n \"text-neutral-800 bg-neutral-100 dark:text-neutral-100 dark:bg-neutral-900\"\n )}\n >\n {item.itemIndex}. {item.textContent}\n </a>\n ))}\n </div>\n ) : (\n <div className=\"text-sm text-neutral-500\">\n {/* Start adding headlines to your document */}\n {/* {toTranslationKey(\"start_adding_headlines_to_your_document\")} */}\n </div>\n )}\n </div>\n );\n }\n);\n\nTableOfContents.displayName = \"TableOfContents\";\n"],"names":["React","memo","useEffect","useState","cn","useTranslation","TableOfContents","editor","onItemClick","data","setData","handler","currentEditor","extensionStorage","tableOfContents","on","off","i18n","div","lang","language","className","content","length","map","item","a","href","id","style","marginLeft","level","onClick","isActive","itemIndex","textContent","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";AAAA,OAAOA,WAAW,QAAQ;AAE1B,SAASC,IAAI,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,QAAQ;AAElD,SAASC,EAAE,QAAQ,2BAA2B;AAC9C,iDAAiD;AACjD,SAASC,cAAc,QAAQ,uCAAuC;AAOtE,OAAO,MAAMC,gCAAkBL,KAC7B,CAAC,EAAEM,MAAM,EAAEC,WAAW,EAAwB;IAC5C,MAAM,CAACC,MAAMC,QAAQ,GAAGP,SAAwC;IAEhED,UAAU;QACR,MAAMS,UAAU,CAAC,EAAEJ,QAAQK,aAAa,EAA0B;YAChEF,QAAQ;gBAAE,GAAGE,cAAcC,gBAAgB,CAACC,eAAe;YAAC;QAC9D;QAEAH,QAAQ;YAAEJ;QAAO;QAEjBA,OAAOQ,EAAE,CAAC,UAAUJ;QACpBJ,OAAOQ,EAAE,CAAC,mBAAmBJ;QAE7B,OAAO;YACLJ,OAAOS,GAAG,CAAC,UAAUL;YACrBJ,OAAOS,GAAG,CAAC,mBAAmBL;QAChC;IACF,GAAG;QAACJ;KAAO;IACX,MAAM,EAAEU,IAAI,EAAE,GAAGZ;IAEjB,qBACE,MAACa;QAAIC,MAAMF,KAAKG,QAAQ;;0BACtB,KAACF;gBAAIG,WAAU;;YAGdZ,QAAQA,KAAKa,OAAO,CAACC,MAAM,GAAG,kBAC7B,KAACL;gBAAIG,WAAU;0BACZZ,KAAKa,OAAO,CAACE,GAAG,CAAC,CAACC,qBACjB,MAACC;wBAECC,MAAM,CAAC,C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