payload-richtext-tiptap 0.0.57 → 0.0.59

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.
Files changed (22) hide show
  1. package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockView.d.ts.map +1 -1
  2. package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockView.js +10 -0
  3. package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockView.js.map +1 -1
  4. package/dist/src/fields/TiptapEditor/extensions/extension-kit.d.ts +1 -1
  5. package/dist/src/fields/TiptapEditor/extensions/extension-kit.d.ts.map +1 -1
  6. package/dist/src/fields/TiptapEditor/extensions/extension-kit.js +10 -1
  7. package/dist/src/fields/TiptapEditor/extensions/extension-kit.js.map +1 -1
  8. package/dist/src/fields/TiptapEditor/features/BlockEditor/BlockEditor.d.ts.map +1 -1
  9. package/dist/src/fields/TiptapEditor/features/BlockEditor/BlockEditor.js +1 -15
  10. package/dist/src/fields/TiptapEditor/features/BlockEditor/BlockEditor.js.map +1 -1
  11. package/dist/src/fields/TiptapEditor/features/menus/ContentItemMenu/ContentItemMenu.d.ts.map +1 -1
  12. package/dist/src/fields/TiptapEditor/features/menus/ContentItemMenu/ContentItemMenu.js +0 -2
  13. package/dist/src/fields/TiptapEditor/features/menus/ContentItemMenu/ContentItemMenu.js.map +1 -1
  14. package/dist/src/fields/TiptapEditor/hooks/useBlockEditor.d.ts.map +1 -1
  15. package/dist/src/fields/TiptapEditor/hooks/useBlockEditor.js +1 -0
  16. package/dist/src/fields/TiptapEditor/hooks/useBlockEditor.js.map +1 -1
  17. package/dist/src/fields/TiptapEditor/lib/constants.d.ts.map +1 -1
  18. package/dist/src/fields/TiptapEditor/lib/constants.js +188 -33
  19. package/dist/src/fields/TiptapEditor/lib/constants.js.map +1 -1
  20. package/dist/src/styles.css +5 -2
  21. package/dist/tsconfig.tsbuildinfo +1 -1
  22. package/package.json +66 -66
@@ -1 +1 @@
1
- {"version":3,"file":"VideoBlockView.d.ts","sourceRoot":"","sources":["../../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,MAAM,EAAmB,MAAM,eAAe,CAAC;AACxD,OAAO,KAAkD,MAAM,OAAO,CAAC;AAIvE,UAAU,mBAAmB;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,MAAM,CAAC;IACrB,IAAI,EAAE,IAAI,GAAG;QACX,KAAK,EAAE;YACL,GAAG,EAAE,MAAM,CAAC;YACZ,MAAM,EAAE,MAAM,CAAC;YACf,OAAO,EAAE,MAAM,CAAC;YAChB,WAAW,CAAC,EAAE,MAAM,CAAC;SACtB,CAAC;KACH,CAAC;IACF,gBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;CAC3D;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,IAAI,EAAE,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,IAAI,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,cAAc,UAAW,mBAAmB,sBA4ExD,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"VideoBlockView.d.ts","sourceRoot":"","sources":["../../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,MAAM,EAAmB,MAAM,eAAe,CAAC;AACxD,OAAO,KAAkD,MAAM,OAAO,CAAC;AAIvE,UAAU,mBAAmB;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,MAAM,CAAC;IACrB,IAAI,EAAE,IAAI,GAAG;QACX,KAAK,EAAE;YACL,GAAG,EAAE,MAAM,CAAC;YACZ,MAAM,EAAE,MAAM,CAAC;YACf,OAAO,EAAE,MAAM,CAAC;YAChB,WAAW,CAAC,EAAE,MAAM,CAAC;SACtB,CAAC;KACH,CAAC;IACF,gBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;CAC3D;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,IAAI,EAAE,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,IAAI,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,cAAc,UAAW,mBAAmB,sBAmGxD,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -39,6 +39,16 @@ export const VideoBlockView = (props)=>{
39
39
  ]);
40
40
  const videoJsOptions = useMemo(()=>{
41
41
  if (playlistContent == undefined) return {};
42
+ if (playlistContent.items.some((item)=>item.type === "application/x-mpegURL" || item.type === "application/vnd.apple.mpegurl")) {
43
+ return {
44
+ sources: playlistContent.items.filter((item)=>item.type === "application/x-mpegURL" || item.type === "application/vnd.apple.mpegurl").map((item)=>({
45
+ src: item.src,
46
+ type: item.type,
47
+ label: item.label
48
+ })),
49
+ poster: playlistContent.poster
50
+ };
51
+ }
42
52
  return {
43
53
  sources: playlistContent.items.map((item)=>({
44
54
  src: item.src,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockView.tsx"],"sourcesContent":["import { Node } from \"@tiptap/pm/model\";\nimport { Editor, NodeViewWrapper } from \"@tiptap/react\";\nimport React, { useCallback, useEffect, useMemo, useRef } from \"react\";\nimport { cn } from \"../../../lib/utils/index.js\";\nimport VideoPlayer from \"./videojs/VideoPlayer.js\";\n\ninterface VideoBlockViewProps {\n editor: Editor;\n getPos: () => number;\n node: Node & {\n attrs: {\n src: string;\n poster: string;\n assetId: string;\n playlistUrl?: string;\n };\n };\n updateAttributes: (attrs: Record<string, string>) => void;\n}\n\nexport type Playlist = {\n id: string;\n title: string;\n description: string;\n poster: string;\n items: Item[];\n};\n\nexport type Item = {\n src: string;\n type: string;\n label: string;\n width: number;\n height: number;\n};\n\nexport const VideoBlockView = (props: VideoBlockViewProps) => {\n const { editor, getPos, node } = props;\n const videoWrapperRef = useRef<HTMLDivElement>(null);\n const { src, poster, playlistUrl, caption } = node.attrs;\n const [playlistContent, setPlaylistContent] = React.useState<\n Playlist | undefined\n >();\n const [error, setError] = React.useState();\n\n useEffect(() => {\n async function getPlaylistContent() {\n const res = await fetch(playlistUrl, {\n cache: \"no-cache\",\n });\n return await res.json();\n }\n\n if (playlistUrl) {\n try {\n getPlaylistContent()\n .then((data) => {\n setPlaylistContent(data);\n })\n .catch((err) => {\n setError(err);\n });\n } catch (error) {\n setError(error);\n }\n }\n }, [playlistUrl]);\n\n const wrapperClassName = cn(\n node.attrs.align === \"left\" ? \"ml-0\" : \"ml-auto\",\n node.attrs.align === \"right\" ? \"mr-0\" : \"mr-auto\",\n node.attrs.align === \"center\" && \"mx-auto\"\n );\n\n const onClick = useCallback(() => {\n editor.commands.setNodeSelection(getPos());\n }, [getPos, editor.commands]);\n\n const videoJsOptions = useMemo(() => {\n if (playlistContent == undefined) return {};\n return {\n sources: playlistContent.items.map((item) => ({\n src: item.src,\n type: item.type,\n label: item.label,\n })),\n poster: playlistContent.poster,\n };\n }, [playlistContent]);\n return (\n <NodeViewWrapper>\n <div className={wrapperClassName} style={{ width: node.attrs.width }}>\n <div contentEditable={false} ref={videoWrapperRef}>\n {error && <div>{error}</div>}\n {/* <video\n controls\n className=\"block\"\n src={src}\n poster={poster}\n title=\"\"\n onClick={onClick}\n /> */}\n {playlistContent && <VideoPlayer options={videoJsOptions} />}\n {caption && playlistContent?.title && (\n <caption className=\"text-center block text-sm text-gray-500\">\n {playlistContent?.title}\n </caption>\n )}\n </div>\n </div>\n </NodeViewWrapper>\n );\n};\n\nexport default VideoBlockView;\n"],"names":["NodeViewWrapper","React","useCallback","useEffect","useMemo","useRef","cn","VideoPlayer","VideoBlockView","props","editor","getPos","node","videoWrapperRef","src","poster","playlistUrl","caption","attrs","playlistContent","setPlaylistContent","useState","error","setError","getPlaylistContent","res","fetch","cache","json","then","data","catch","err","wrapperClassName","align","onClick","commands","setNodeSelection","videoJsOptions","undefined","sources","items","map","item","type","label","div","className","style","width","contentEditable","ref","options","title"],"mappings":";AACA,SAAiBA,eAAe,QAAQ,gBAAgB;AACxD,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,QAAQ;AACvE,SAASC,EAAE,QAAQ,8BAA8B;AACjD,OAAOC,iBAAiB,2BAA2B;AAgCnD,OAAO,MAAMC,iBAAiB,CAACC;IAC7B,MAAM,EAAEC,MAAM,EAAEC,MAAM,EAAEC,IAAI,EAAE,GAAGH;IACjC,MAAMI,kBAAkBR,OAAuB;IAC/C,MAAM,EAAES,GAAG,EAAEC,MAAM,EAAEC,WAAW,EAAEC,OAAO,EAAE,GAAGL,KAAKM,KAAK;IACxD,MAAM,CAACC,iBAAiBC,mBAAmB,GAAGnB,MAAMo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B,KAACZ;wBAAY6C,SAASd;;oBACzCrB,WAAWE,iBAAiBkC,uBAC3B,KAACpC;wBAAQ8B,WAAU;kCAChB5B,iBAAiBkC;;;;;;AAOhC,EAAE;AAEF,eAAe7C,eAAe"}
1
+ {"version":3,"sources":["../../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockView.tsx"],"sourcesContent":["import { Node } from \"@tiptap/pm/model\";\nimport { Editor, NodeViewWrapper } from \"@tiptap/react\";\nimport React, { useCallback, useEffect, useMemo, useRef } from \"react\";\nimport { cn } from \"../../../lib/utils/index.js\";\nimport VideoPlayer from \"./videojs/VideoPlayer.js\";\n\ninterface VideoBlockViewProps {\n editor: Editor;\n getPos: () => number;\n node: Node & {\n attrs: {\n src: string;\n poster: string;\n assetId: string;\n playlistUrl?: string;\n };\n };\n updateAttributes: (attrs: Record<string, string>) => void;\n}\n\nexport type Playlist = {\n id: string;\n title: string;\n description: string;\n poster: string;\n items: Item[];\n};\n\nexport type Item = {\n src: string;\n type: string;\n label: string;\n width: number;\n height: number;\n};\n\nexport const VideoBlockView = (props: VideoBlockViewProps) => {\n const { editor, getPos, node } = props;\n const videoWrapperRef = useRef<HTMLDivElement>(null);\n const { src, poster, playlistUrl, caption } = node.attrs;\n const [playlistContent, setPlaylistContent] = React.useState<\n Playlist | undefined\n >();\n const [error, setError] = React.useState();\n\n useEffect(() => {\n async function getPlaylistContent() {\n const res = await fetch(playlistUrl, {\n cache: \"no-cache\",\n });\n return await res.json();\n }\n\n if (playlistUrl) {\n try {\n getPlaylistContent()\n .then((data) => {\n setPlaylistContent(data);\n })\n .catch((err) => {\n setError(err);\n });\n } catch (error) {\n setError(error);\n }\n }\n }, [playlistUrl]);\n\n const wrapperClassName = cn(\n node.attrs.align === \"left\" ? \"ml-0\" : \"ml-auto\",\n node.attrs.align === \"right\" ? \"mr-0\" : \"mr-auto\",\n node.attrs.align === \"center\" && \"mx-auto\"\n );\n\n const onClick = useCallback(() => {\n editor.commands.setNodeSelection(getPos());\n }, [getPos, editor.commands]);\n\n const videoJsOptions = useMemo(() => {\n if (playlistContent == undefined) return {};\n\n if (\n playlistContent.items.some(\n (item) =>\n item.type === \"application/x-mpegURL\" ||\n item.type === \"application/vnd.apple.mpegurl\"\n )\n ) {\n return {\n sources: playlistContent.items\n .filter(\n (item) =>\n item.type === \"application/x-mpegURL\" ||\n item.type === \"application/vnd.apple.mpegurl\"\n )\n .map((item) => ({\n src: item.src,\n type: item.type,\n label: item.label,\n })),\n poster: playlistContent.poster,\n };\n }\n return {\n sources: playlistContent.items.map((item) => ({\n src: item.src,\n type: item.type,\n label: item.label,\n })),\n poster: playlistContent.poster,\n };\n }, [playlistContent]);\n return (\n <NodeViewWrapper>\n <div className={wrapperClassName} style={{ width: node.attrs.width }}>\n <div contentEditable={false} ref={videoWrapperRef}>\n {error && <div>{error}</div>}\n {/* <video\n controls\n className=\"block\"\n src={src}\n poster={poster}\n title=\"\"\n onClick={onClick}\n /> */}\n {playlistContent && <VideoPlayer options={videoJsOptions} />}\n {caption && playlistContent?.title && (\n <caption className=\"text-center block text-sm text-gray-500\">\n {playlistContent?.title}\n </caption>\n )}\n </div>\n </div>\n </NodeViewWrapper>\n );\n};\n\nexport default VideoBlockView;\n"],"names":["NodeViewWrapper","React","useCallback","useEffect","useMemo","useRef","cn","VideoPlayer","VideoBlockView","props","editor","getPos","node","videoWrapperRef","src","poster","playlistUrl","caption","attrs","playlistContent","setPlaylistContent","useState","error","setError","getPlaylistContent","res","fetch","cache","json","then","data","catch","err","wrapperClassName","align","onClick","commands","setNodeSelection","videoJsOptions","undefined","items","some","item","type","sources","filter","map","label","div","className","style","width","contentEditable","ref","options","title"],"mappings":";AACA,SAAiBA,eAAe,QAAQ,gBAAgB;AACxD,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,QAAQ;AACvE,SAASC,EAAE,QAAQ,8BAA8B;AACjD,OAAOC,iBAAiB,2BAA2B;AAgCnD,OA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KAAK,2BACdD,KAAKC,IAAI,KAAK,iCAEjBG,GAAG,CAAC,CAACJ,OAAU,CAAA;wBACd5B,KAAK4B,KAAK5B,GAAG;wBACb6B,MAAMD,KAAKC,IAAI;wBACfI,OAAOL,KAAKK,KAAK;oBACnB,CAAA;gBACFhC,QAAQI,gBAAgBJ,MAAM;YAChC;QACF;QACA,OAAO;YACL6B,SAASzB,gBAAgBqB,KAAK,CAACM,GAAG,CAAC,CAACJ,OAAU,CAAA;oBAC5C5B,KAAK4B,KAAK5B,GAAG;oBACb6B,MAAMD,KAAKC,IAAI;oBACfI,OAAOL,KAAKK,KAAK;gBACnB,CAAA;YACAhC,QAAQI,gBAAgBJ,MAAM;QAChC;IACF,GAAG;QAACI;KAAgB;IACpB,qBACE,KAACnB;kBACC,cAAA,KAACgD;YAAIC,WAAWhB;YAAkBiB,OAAO;gBAAEC,OAAOvC,KAAKM,KAAK,CAACiC,KAAK;YAAC;sBACjE,cAAA,MAACH;gBAAII,iBAAiB;gBAAOC,KAAKxC;;oBAC/BS,uBAAS,KAAC0B;kCAAK1B;;oBASfH,iCAAmB,KAACZ;wBAAY+C,SAAShB;;oBACzCrB,WAAWE,iBAAiBoC,uBAC3B,KAACtC;wBAAQgC,WAAU;kCAChB9B,iBAAiBoC;;;;;;AAOhC,EAAE;AAEF,eAAe/C,eAAe"}
@@ -3,6 +3,6 @@ interface ExtensionKitProps {
3
3
  dir?: "rtl" | "ltr";
4
4
  openAssetHQHandler: openAssetHQType;
5
5
  }
6
- export declare const ExtensionKit: ({ dir, openAssetHQHandler, }: ExtensionKitProps) => (import("@tiptap/core").Extension<any, any> | import("@tiptap/core").Node<any, any> | import("@tiptap/core").Mark<import("@tiptap/extension-subscript").SubscriptExtensionOptions, any>)[];
6
+ export declare const ExtensionKit: ({ dir, openAssetHQHandler, }: ExtensionKitProps) => (import("@tiptap/core").Node<any, any> | import("@tiptap/core").Extension<any, any> | import("@tiptap/core").Mark<import("@tiptap/extension-subscript").SubscriptExtensionOptions, any>)[];
7
7
  export default ExtensionKit;
8
8
  //# sourceMappingURL=extension-kit.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"extension-kit.d.ts","sourceRoot":"","sources":["../../../../../src/fields/TiptapEditor/extensions/extension-kit.ts"],"names":[],"mappings":"AAyDA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAI9C,UAAU,iBAAiB;IACzB,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IACpB,kBAAkB,EAAE,eAAe,CAAC;CACrC;AAED,eAAO,MAAM,YAAY,iCAGtB,iBAAiB,+LAuHnB,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"extension-kit.d.ts","sourceRoot":"","sources":["../../../../../src/fields/TiptapEditor/extensions/extension-kit.ts"],"names":[],"mappings":"AAyDA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAI9C,UAAU,iBAAiB;IACzB,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IACpB,kBAAkB,EAAE,eAAe,CAAC;CACrC;AAED,eAAO,MAAM,YAAY,iCAGtB,iBAAiB,+LAmInB,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -140,7 +140,16 @@ export const ExtensionKit = ({ dir, openAssetHQHandler })=>[
140
140
  TextDirection.configure({
141
141
  types: [
142
142
  "heading",
143
- "paragraph"
143
+ "paragraph",
144
+ "orderedList",
145
+ "bulletList",
146
+ "listItem",
147
+ "blockquoteFigure",
148
+ "codeBlock",
149
+ "tableCell",
150
+ "tableRow",
151
+ "table",
152
+ "column"
144
153
  ]
145
154
  }),
146
155
  AICommand
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/fields/TiptapEditor/extensions/extension-kit.ts"],"sourcesContent":["import {\n AICommand,\n BlockquoteFigure,\n CharacterCount,\n Color,\n Column,\n // emojiSuggestion,\n Columns,\n Document,\n Dropcursor,\n Facebook,\n Figcaption,\n FileHandler,\n Focus,\n FontFamily,\n FontSize,\n Heading,\n Highlight,\n HorizontalRule,\n VideoBlock,\n ImageBlock,\n AudioBlock,\n InsideLinks,\n Instagram,\n Link,\n Linkedin,\n Placeholder,\n Selection,\n SlashCommand,\n StarterKit,\n Subscript,\n Superscript,\n Table,\n TableCell,\n TableHeader,\n TableOfContents,\n TableRow,\n TaskItem,\n TaskList,\n TextAlign,\n TextStyle,\n Tiktok,\n TrailingNode,\n Twitter,\n Typography,\n Underline,\n Youtube,\n} from \"./index.js\";\n\nimport { CodeBlockLowlight } from \"@tiptap/extension-code-block-lowlight\";\nimport lowlight from \"lowlight\";\nimport TextDirection from \"tiptap-text-direction\";\nimport { ImageUpload } from \"./ImageUpload/ImageUpload.js\";\nimport { TableOfContentsNode } from \"./TableOfContentsNode/TableOfContentsNode.js\";\n\nimport History from \"@tiptap/extension-history\";\nimport API from \"../lib/api.js\";\nimport { openAssetHQType } from \"../types.js\";\nimport { Iframe } from \"./Iframe/iframe.js\";\nimport { Markdown } from \"tiptap-markdown\";\n\ninterface ExtensionKitProps {\n dir?: \"rtl\" | \"ltr\";\n openAssetHQHandler: openAssetHQType;\n}\n\nexport const ExtensionKit = ({\n dir,\n openAssetHQHandler,\n}: ExtensionKitProps) => [\n Markdown,\n Document,\n Columns,\n TaskList,\n TaskItem.configure({\n nested: true,\n }),\n Column,\n Selection,\n Heading.configure({\n levels: [1, 2, 3, 4, 5, 6],\n }),\n HorizontalRule,\n StarterKit.configure({\n document: false,\n dropcursor: false,\n heading: false,\n horizontalRule: false,\n blockquote: false,\n history: false,\n codeBlock: false,\n }),\n CodeBlockLowlight.configure({\n lowlight,\n defaultLanguage: null,\n }),\n TextStyle,\n FontSize,\n FontFamily,\n Color,\n TrailingNode,\n Link.configure({\n openOnClick: false,\n }),\n Highlight.configure({ multicolor: true }),\n Underline,\n CharacterCount.configure({ limit: 50000 }),\n TableOfContents,\n TableOfContentsNode,\n ImageUpload.configure({\n openAssetHQHandler,\n }),\n ImageBlock,\n VideoBlock,\n AudioBlock,\n FileHandler.configure({\n allowedMimeTypes: [\"image/png\", \"image/jpeg\", \"image/gif\", \"image/webp\"],\n onDrop: (currentEditor, files, pos) => {\n const file = files[0];\n (async () => {\n openAssetHQHandler((asset) => {\n currentEditor\n .chain()\n .setImageBlockAt({ pos, src: asset.fullUrl })\n .focus()\n .run();\n }, file);\n })();\n },\n onPaste: (currentEditor, files) => {\n files.forEach(async () => {\n const url = await API.uploadImage();\n\n return currentEditor\n .chain()\n .setImageBlockAt({\n pos: currentEditor.state.selection.anchor,\n src: url,\n })\n .focus()\n .run();\n });\n },\n }),\n // Emoji.configure({\n // enableEmoticons: true,\n // suggestion: emojiSuggestion,\n // }),\n TextAlign.extend({\n addKeyboardShortcuts() {\n return {};\n },\n }).configure({\n types: [\"heading\", \"paragraph\"],\n }),\n Subscript,\n Superscript,\n Table,\n TableCell,\n TableHeader,\n TableRow,\n Typography,\n Placeholder.configure({\n includeChildren: true,\n showOnlyCurrent: false,\n placeholder: () => \"\",\n }),\n SlashCommand,\n Focus,\n Figcaption,\n BlockquoteFigure,\n Dropcursor.configure({\n width: 2,\n class: \"ProseMirror-dropcursor border-black\",\n }),\n History,\n Iframe,\n Twitter,\n Tiktok,\n Instagram,\n Facebook,\n Linkedin,\n Youtube,\n InsideLinks,\n TextDirection.configure({\n types: [\"heading\", \"paragraph\"],\n }),\n AICommand,\n];\n\nexport default ExtensionKit;\n"],"names":["AICommand","BlockquoteFigure","CharacterCount","Color","Column","Columns","Document","Dropcursor","Facebook","Figcaption","FileHandler","Focus","FontFamily","FontSize","Heading","Highlight","HorizontalRule","VideoBlock","ImageBlock","AudioBlock","InsideLinks","Instagram","Link","Linkedin","Placeholder","Selection","SlashCommand","StarterKit","Subscript","Superscript","Table","TableCell","TableHeader","TableOfContents","TableRow","TaskItem","TaskList","TextAlign","TextStyle","Tiktok","TrailingNode","Twitter","Typography","Underline","Youtube","CodeBlockLowlight","lowlight","TextDirection","ImageUpload","TableOfContentsNode","History","API","Iframe","Markdown","ExtensionKit","dir","openAssetHQHandler","configure","nested","levels","document","dropcursor","heading","horizontalRule","blockquote","history","codeBlock","defaultLanguage","openOnClick","multicolor","limit","allowedMimeTypes","onDrop","currentEditor","files","pos","file","asset","chain","setImageBlockAt","src","fullUrl","focus","run","onPaste","forEach","url","uploadImage","state","selection","anchor","extend","addKeyboardShortcuts","types","includeChildren","showOnlyCurrent","placeholder","width","class"],"mappings":"AAAA,SACEA,SAAS,EACTC,gBAAgB,EAChBC,cAAc,EACdC,KAAK,EACLC,MAAM,EAENC,AADA,mBAAmB;AACnBA,OAAO,EACPC,QAAQ,EACRC,UAAU,EACVC,QAAQ,EACRC,UAAU,EACVC,WAAW,EACXC,KAAK,EACLC,UAAU,EACVC,QAAQ,EACRC,OAAO,EACPC,SAAS,EACTC,cAAc,EACdC,UAAU,EACVC,UAAU,EACVC,UAAU,EACVC,WAAW,EACXC,SAAS,EACTC,IAAI,EACJC,QAAQ,EACRC,WAAW,EACXC,SAAS,EACTC,YAAY,EACZC,UAAU,EACVC,SAAS,EACTC,WAAW,EACXC,KAAK,EACLC,SAAS,EACTC,WAAW,EACXC,eAAe,EACfC,QAAQ,EACRC,QAAQ,EACRC,QAAQ,EACRC,SAAS,EACTC,SAAS,EACTC,MAAM,EACNC,YAAY,EACZC,OAAO,EACPC,UAAU,EACVC,SAAS,EACTC,OAAO,QACF,aAAa;AAEpB,SAASC,iBAAiB,QAAQ,wCAAwC;AAC1E,OAAOC,cAAc,WAAW;AAChC,OAAOC,mBAAmB,wBAAwB;AAClD,SAASC,WAAW,QAAQ,+BAA+B;AAC3D,SAASC,mBAAmB,QAAQ,+CAA+C;AAEnF,OAAOC,aAAa,4BAA4B;AAChD,OAAOC,SAAS,gBAAgB;AAEhC,SAASC,MAAM,QAAQ,qBAAqB;AAC5C,SAASC,QAAQ,QAAQ,kBAAkB;AAO3C,OAAO,MAAMC,eAAe,CAAC,EAC3BC,GAAG,EACHC,kBAAkB,EACA,GAAK;QACvBH;QACA/C;QACA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iC;QACjC,MAAM;QACN9C,UAAUsD,MAAM,CAAC;YACfC;gBACE,OAAO,CAAC;YACV;QACF,GAAGnC,SAAS,CAAC;YACXoC,OAAO;gBAAC;gBAAW;aAAY;QACjC;QACAjE;QACAC;QACAC;QACAC;QACAC;QACAE;QACAQ;QACAlB,YAAYiC,SAAS,CAAC;YACpBqC,iBAAiB;YACjBC,iBAAiB;YACjBC,aAAa,IAAM;QACrB;QACAtE;QACAf;QACAF;QACAR;QACAM,WAAWkD,SAAS,CAAC;YACnBwC,OAAO;YACPC,OAAO;QACT;QACAhD;QACAE;QACAX;QACAF;QACAlB;QACAb;QACAe;QACAqB;QACAxB;QACA2B,cAAcU,SAAS,CAAC;YACtBoC,OAAO;gBAAC;gBAAW;aAAY;QACjC;QACA7F;KACD,CAAC;AAEF,eAAesD,aAAa"}
1
+ {"version":3,"sources":["../../../../../src/fields/TiptapEditor/extensions/extension-kit.ts"],"sourcesContent":["import {\n AICommand,\n BlockquoteFigure,\n CharacterCount,\n Color,\n Column,\n // emojiSuggestion,\n Columns,\n Document,\n Dropcursor,\n Facebook,\n Figcaption,\n FileHandler,\n Focus,\n FontFamily,\n FontSize,\n Heading,\n Highlight,\n HorizontalRule,\n VideoBlock,\n ImageBlock,\n AudioBlock,\n InsideLinks,\n Instagram,\n Link,\n Linkedin,\n Placeholder,\n Selection,\n SlashCommand,\n StarterKit,\n Subscript,\n Superscript,\n Table,\n TableCell,\n TableHeader,\n TableOfContents,\n TableRow,\n TaskItem,\n TaskList,\n TextAlign,\n TextStyle,\n Tiktok,\n TrailingNode,\n Twitter,\n Typography,\n Underline,\n Youtube,\n} from \"./index.js\";\n\nimport { CodeBlockLowlight } from \"@tiptap/extension-code-block-lowlight\";\nimport lowlight from \"lowlight\";\nimport TextDirection from \"tiptap-text-direction\";\nimport { ImageUpload } from \"./ImageUpload/ImageUpload.js\";\nimport { TableOfContentsNode } from \"./TableOfContentsNode/TableOfContentsNode.js\";\n\nimport History from \"@tiptap/extension-history\";\nimport API from \"../lib/api.js\";\nimport { openAssetHQType } from \"../types.js\";\nimport { Iframe } from \"./Iframe/iframe.js\";\nimport { Markdown } from \"tiptap-markdown\";\n\ninterface ExtensionKitProps {\n dir?: \"rtl\" | \"ltr\";\n openAssetHQHandler: openAssetHQType;\n}\n\nexport const ExtensionKit = ({\n dir,\n openAssetHQHandler,\n}: ExtensionKitProps) => [\n Markdown,\n Document,\n Columns,\n TaskList,\n TaskItem.configure({\n nested: true,\n }),\n Column,\n Selection,\n Heading.configure({\n levels: [1, 2, 3, 4, 5, 6],\n }),\n HorizontalRule,\n StarterKit.configure({\n document: false,\n dropcursor: false,\n heading: false,\n horizontalRule: false,\n blockquote: false,\n history: false,\n codeBlock: false,\n }),\n CodeBlockLowlight.configure({\n lowlight,\n defaultLanguage: null,\n }),\n TextStyle,\n FontSize,\n FontFamily,\n Color,\n TrailingNode,\n Link.configure({\n openOnClick: false,\n }),\n Highlight.configure({ multicolor: true }),\n Underline,\n CharacterCount.configure({ limit: 50000 }),\n TableOfContents,\n TableOfContentsNode,\n ImageUpload.configure({\n openAssetHQHandler,\n }),\n ImageBlock,\n VideoBlock,\n AudioBlock,\n FileHandler.configure({\n allowedMimeTypes: [\"image/png\", \"image/jpeg\", \"image/gif\", \"image/webp\"],\n onDrop: (currentEditor, files, pos) => {\n const file = files[0];\n (async () => {\n openAssetHQHandler((asset) => {\n currentEditor\n .chain()\n .setImageBlockAt({ pos, src: asset.fullUrl })\n .focus()\n .run();\n }, file);\n })();\n },\n onPaste: (currentEditor, files) => {\n files.forEach(async () => {\n const url = await API.uploadImage();\n\n return currentEditor\n .chain()\n .setImageBlockAt({\n pos: currentEditor.state.selection.anchor,\n src: url,\n })\n .focus()\n .run();\n });\n },\n }),\n // Emoji.configure({\n // enableEmoticons: true,\n // suggestion: emojiSuggestion,\n // }),\n TextAlign.extend({\n addKeyboardShortcuts() {\n return {};\n },\n }).configure({\n types: [\"heading\", \"paragraph\"],\n }),\n Subscript,\n Superscript,\n Table,\n TableCell,\n TableHeader,\n TableRow,\n Typography,\n Placeholder.configure({\n includeChildren: true,\n showOnlyCurrent: false,\n placeholder: () => \"\",\n }),\n SlashCommand,\n Focus,\n Figcaption,\n BlockquoteFigure,\n Dropcursor.configure({\n width: 2,\n class: \"ProseMirror-dropcursor border-black\",\n }),\n History,\n Iframe,\n Twitter,\n Tiktok,\n Instagram,\n Facebook,\n Linkedin,\n Youtube,\n InsideLinks,\n TextDirection.configure({\n types: [\n \"heading\",\n \"paragraph\",\n \"orderedList\",\n \"bulletList\",\n \"listItem\",\n \"blockquoteFigure\",\n \"codeBlock\",\n \"tableCell\",\n \"tableRow\",\n \"table\",\n \"column\",\n ],\n }),\n AICommand,\n];\n\nexport default ExtensionKit;\n"],"names":["AICommand","BlockquoteFigure","CharacterCount","Color","Column","Columns","Document","Dropcursor","Facebook","Figcaption","FileHandler","Focus","FontFamily","FontSize","Heading","Highlight","HorizontalRule","VideoBlock","ImageBlock","AudioBlock","InsideLinks","Instagram","Link","Linkedin","Placeholder","Selection","SlashCommand","StarterKit","Subscript","Superscript","Table","TableCell","TableHeader","TableOfContents","TableRow","TaskItem","TaskList","TextAlign","TextStyle","Tiktok","TrailingNode","Twitter","Typography","Underline","Youtube","CodeBlockLowlight","lowlight","TextDirection","ImageUpload","TableOfContentsNode","History","API","Iframe","Markdown","ExtensionKit","dir","openAssetHQHandler","configure","nested","levels","document","dropcursor","heading","horizontalRule","blockquote","history","codeBlock","defaultLanguage","openOnClick","multicolor","limit","allowedMimeTypes","onDrop","currentEditor","files","pos","file","asset","chain","setImageBlockAt","src","fullUrl","focus","run","onPaste","forEach","url","uploadImage","state","selection","anchor","extend","addKeyboardShortcuts","types","includeChildren","showOnlyCurrent","placeholder","width","class"],"mappings":"AAAA,SACEA,SAAS,EACTC,gBAAgB,EAChBC,cAAc,EACdC,KAAK,EACLC,MAAM,EAENC,AADA,mBAAmB;AACnBA,OAAO,EACPC,QAAQ,EACRC,UAAU,EACVC,QAAQ,EACRC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AxB;QACA2B,cAAcU,SAAS,CAAC;YACtBoC,OAAO;gBACL;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;aACD;QACH;QACA7F;KACD,CAAC;AAEF,eAAesD,aAAa"}
@@ -1 +1 @@
1
- {"version":3,"file":"BlockEditor.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/features/BlockEditor/BlockEditor.tsx"],"names":[],"mappings":"AAkBA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAKjD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,eAAO,MAAM,WAAW,sEAKrB,WAAW,GAAG;IACf,kBAAkB,EAAE,eAAe,CAAC;IACpC,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACzC,gCA2EA,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"BlockEditor.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/features/BlockEditor/BlockEditor.tsx"],"names":[],"mappings":"AAkBA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAKjD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,eAAO,MAAM,WAAW,sEAKrB,WAAW,GAAG;IACf,kBAAkB,EAAE,eAAe,CAAC;IACpC,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACzC,gCA2DA,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -1,9 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { EditorContent } from "@tiptap/react";
4
- import { useEffect, useMemo, useRef } from "react";
5
- import { useLocale } from "@payloadcms/ui/providers/Locale";
6
- import { useTranslation } from "@payloadcms/ui/providers/Translation";
4
+ import { useMemo, useRef } from "react";
7
5
  import { EditorContext } from "../../context/EditorContext.js";
8
6
  import { IframeMenu } from "../../extensions/Iframe/menus/index.js";
9
7
  import ImageBlockMenu from "../../extensions/ImageBlock/components/ImageBlockMenu.js";
@@ -26,24 +24,13 @@ export const BlockEditor = ({ handleChange, content, openAssetHQHandler, additio
26
24
  openAssetHQHandler: openAssetHQHandler,
27
25
  additionalContext: additionalContext
28
26
  });
29
- const { code } = useLocale();
30
27
  const displayedUsers = users.slice(0, 3);
31
28
  const providerValue = useMemo(()=>{
32
29
  return {};
33
30
  }, []);
34
- useEffect(()=>{
35
- if (code === "ar" || code === "fa") {
36
- editor?.commands?.setTextDirection("rtl");
37
- editor?.commands?.setContent("dwa");
38
- }
39
- }, [
40
- code
41
- ]);
42
- const { i18n } = useTranslation();
43
31
  return editor && /*#__PURE__*/ _jsx(EditorContext.Provider, {
44
32
  value: providerValue,
45
33
  children: /*#__PURE__*/ _jsxs("div", {
46
- lang: i18n.language,
47
34
  className: "flex h-full overflow-visible",
48
35
  ref: menuContainerRef,
49
36
  children: [
@@ -58,7 +45,6 @@ export const BlockEditor = ({ handleChange, content, openAssetHQHandler, additio
58
45
  /*#__PURE__*/ _jsx(EditorContent, {
59
46
  editor: editor,
60
47
  ref: editorRef,
61
- lang: i18n.language,
62
48
  className: "flex-1 overflow-y-visible w-full h-full outline-none outline-offset-0",
63
49
  style: {
64
50
  outline: "none"
@@ -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 VideoBlockMenu from \"../../extensions/VideoBlock/components/VideoBlockMenu.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 { openAssetHQType } from \"../../types.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\";\nexport const BlockEditor = ({\n handleChange,\n content,\n openAssetHQHandler,\n additionalContext,\n}: TiptapProps & {\n openAssetHQHandler: openAssetHQType;\n additionalContext?: Record<string, any>;\n}) => {\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 openAssetHQHandler: openAssetHQHandler,\n additionalContext: additionalContext,\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 const { i18n } = useTranslation();\n\n return (\n editor && (\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 <VideoBlockMenu editor={editor} appendTo={menuContainerRef} />\n </div>\n </div>\n </EditorContext.Provider>\n )\n );\n};\n\nexport default BlockEditor;\n"],"names":["EditorContent","useEffect","useMemo","useRef","useLocale","useTranslation","EditorContext","IframeMenu","ImageBlockMenu","VideoBlockMenu","InsideLinksMenu","ColumnsMenu","SocialMediaMenu","TableColumnMenu","TableRowMenu","useBlockEditor","Sidebar","ContentItemMenu","TextMenu","LinkMenu","BlockEditor","handleChange","content","openAssetHQHandler","additionalContext","menuContainerRef","editorRef","editor","users","characterCount","leftSidebar","code","displayedUsers","slice","providerValue","commands","setTextDirection","setContent","i18n","Provider","value","div","lang","language","className","ref","isOpen","onClose","close","style","outline","appendTo"],"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,OAAOC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IG,WAAU;;sCAQb,KAAC5C;4BACC2B,QAAQA;4BACRkB,KAAKnB;4BACLgB,MAAMJ,KAAKK,QAAQ;4BACnBC,WAAU;4BACVK,OAAO;gCACLC,SAAS;4BACX;;sCAEF,KAACjC;4BAAgBU,QAAQA;;sCACzB,KAACR;4BAASQ,QAAQA;4BAAQwB,UAAU1B;;sCAEpC,KAACP;4BAASS,QAAQA;;sCAClB,KAACpB;4BAAWoB,QAAQA;4BAAQwB,UAAU1B;;sCACtC,KAACb;4BAAgBe,QAAQA;4BAAQwB,UAAU1B;;sCAC3C,KAACf;4BAAgBiB,QAAQA;4BAAQwB,UAAU1B;;sCAC3C,KAACd;4BAAYgB,QAAQA;4BAAQwB,UAAU1B;;sCACvC,KAACX;4BAAaa,QAAQA;4BAAQwB,UAAU1B;;sCACxC,KAACZ;4BAAgBc,QAAQA;4BAAQwB,UAAU1B;;sCAC3C,KAACjB;4BAAemB,QAAQA;4BAAQwB,UAAU1B;;sCAC1C,KAAChB;4BAAekB,QAAQA;4BAAQwB,UAAU1B;;;;;;;AAMtD,EAAE;AAEF,eAAeL,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 VideoBlockMenu from \"../../extensions/VideoBlock/components/VideoBlockMenu.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 { openAssetHQType } from \"../../types.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\";\nexport const BlockEditor = ({\n handleChange,\n content,\n openAssetHQHandler,\n additionalContext,\n}: TiptapProps & {\n openAssetHQHandler: openAssetHQType;\n additionalContext?: Record<string, any>;\n}) => {\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 openAssetHQHandler: openAssetHQHandler,\n additionalContext: additionalContext,\n });\n\n const displayedUsers = users.slice(0, 3);\n\n const providerValue = useMemo(() => {\n return {};\n }, []);\n\n return (\n editor && (\n <EditorContext.Provider value={providerValue}>\n <div className=\"flex h-full overflow-visible\" ref={menuContainerRef}>\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 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 <VideoBlockMenu editor={editor} appendTo={menuContainerRef} />\n </div>\n </div>\n </EditorContext.Provider>\n )\n );\n};\n\nexport default BlockEditor;\n"],"names":["EditorContent","useMemo","useRef","EditorContext","IframeMenu","ImageBlockMenu","VideoBlockMenu","InsideLinksMenu","ColumnsMenu","SocialMediaMenu","TableColumnMenu","TableRowMenu","useBlockEditor","Sidebar","ContentItemMenu","TextMenu","LinkMenu","BlockEditor","handleChange","content","openAssetHQHandler","additionalContext","menuContainerRef","editorRef","editor","users","characterCount","leftSidebar","displayedUsers","slice","providerValue","Provider","value","div","className","ref","isOpen","onClose","close","style","outline","appendTo"],"mappings":"AAAA;;AACA,SAASA,aAAa,QAAQ,gBAAgB;AAC9C,SAAoBC,OAAO,EAAEC,MAAM,QAAQ,QAAQ;AAInD,SAASC,aAAa,QAAQ,iCAAiC;AAC/D,SAASC,UAAU,QAAQ,yCAAyC;AACpE,OAAOC,oBAAoB,2DAA2D;AACtF,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,OAAO,QAAQ,wBAAwB;AAChD,SAASC,eAAe,QAAQ,8CAA8C;AAC9E,SAASC,QAAQ,QAAQ,gCAAgC;AACzD,SAASC,QAAQ,QAAQ,oBAAoB;AAE7C,OAAO,MAAMC,cAAc,CAAC,EAC1BC,YAAY,EACZC,OAAO,EACPC,kBAAkB,EAClBC,iBAAiB,EAIlB;IACC,MAAMC,mBAAmBpB,OAAO;IAChC,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../../../src/fields/TiptapEditor/features/menus/ContentItemMenu/ContentItemMenu.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAoBvC,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,eAAe,eAAgB,oBAAoB,gCA4E/D,CAAC"}
1
+ {"version":3,"file":"ContentItemMenu.d.ts","sourceRoot":"","sources":["../../../../../../../src/fields/TiptapEditor/features/menus/ContentItemMenu/ContentItemMenu.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAoBvC,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,eAAe,eAAgB,oBAAoB,gCA2E/D,CAAC"}
@@ -3,7 +3,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { DragHandle } from "@tiptap-pro/extension-drag-handle-react";
4
4
  import { Icon } from "../../ui/Icon.js";
5
5
  import { Toolbar } from "../../ui/Toolbar.js";
6
- import { useTranslation } from "@payloadcms/ui/providers/Translation";
7
6
  import * as Popover from "@radix-ui/react-popover";
8
7
  import { Clipboard, Copy, GripVertical, Plus, RemoveFormatting, Trash2 } from "lucide-react";
9
8
  import { useEffect, useState } from "react";
@@ -15,7 +14,6 @@ export const ContentItemMenu = ({ editor })=>{
15
14
  const [menuOpen, setMenuOpen] = useState(false);
16
15
  const [tippyOptions, setTippyOptions] = useState();
17
16
  const data = useData();
18
- const { i18n } = useTranslation();
19
17
  const actions = useContentItemActions(editor, data.currentNode, data.currentNodePos);
20
18
  useEffect(()=>{
21
19
  if (menuOpen) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../src/fields/TiptapEditor/features/menus/ContentItemMenu/ContentItemMenu.tsx"],"sourcesContent":["\"use client\";\nimport { DragHandle } from \"@tiptap-pro/extension-drag-handle-react\";\nimport { Editor } from \"@tiptap/react\";\nimport { Icon } from \"../../ui/Icon.js\";\nimport { Toolbar } from \"../../ui/Toolbar.js\";\n\nimport { useTranslation } from \"@payloadcms/ui/providers/Translation\";\nimport * as Popover from \"@radix-ui/react-popover\";\nimport {\n Clipboard,\n Copy,\n GripVertical,\n Plus,\n RemoveFormatting,\n Trash2,\n} from \"lucide-react\";\nimport { useEffect, useState } from \"react\";\nimport { DropdownButton } from \"../../ui/Dropdown/Dropdown.js\";\nimport { Surface } from \"../../ui/Surface.js\";\nimport useContentItemActions from \"./hooks/useContentItemActions.js\";\nimport { useData } from \"./hooks/useData.js\";\n\nexport type ContentItemMenuProps = {\n editor: Editor;\n};\n\nexport const ContentItemMenu = ({ editor }: ContentItemMenuProps) => {\n const [menuOpen, setMenuOpen] = useState(false);\n const [tippyOptions, setTippyOptions] = useState();\n const data = useData();\n const { i18n } = useTranslation();\n const actions = useContentItemActions(\n editor,\n data.currentNode,\n data.currentNodePos\n );\n\n useEffect(() => {\n if (menuOpen) {\n editor.commands.setMeta(\"lockDragHandle\", true);\n } else {\n editor.commands.setMeta(\"lockDragHandle\", false);\n }\n }, [editor, menuOpen]);\n\n return (\n <DragHandle\n pluginKey=\"ContentItemMenu\"\n editor={editor}\n onNodeChange={data.handleNodeChange}\n tippyOptions={{\n placement: \"left\",\n offset: [-12, 2],\n zIndex: 99,\n }}\n >\n <div className=\"flex items-center gap-0.5\">\n <Toolbar.Button type=\"button\" onClick={actions.handleAdd}>\n <Icon icon={Plus} />\n </Toolbar.Button>\n <Popover.Root open={menuOpen} onOpenChange={setMenuOpen}>\n <Popover.Trigger asChild>\n <Toolbar.Button type=\"button\">\n <Icon icon={GripVertical} />\n </Toolbar.Button>\n </Popover.Trigger>\n <Popover.Content side=\"bottom\" align=\"start\" sideOffset={8}>\n <Surface className=\"p-2 flex flex-col min-w-[16rem]\">\n <Popover.Close>\n <DropdownButton onClick={actions.resetTextFormatting}>\n <Icon icon={RemoveFormatting} />\n Clear formatting\n </DropdownButton>\n </Popover.Close>\n <Popover.Close>\n <DropdownButton onClick={actions.copyNodeToClipboard}>\n <Icon icon={Clipboard} />\n Copy to clipboard\n </DropdownButton>\n </Popover.Close>\n <Popover.Close>\n <DropdownButton onClick={actions.duplicateNode}>\n <Icon icon={Copy} />\n Duplicate\n </DropdownButton>\n </Popover.Close>\n <Toolbar.Divider horizontal />\n <Popover.Close>\n <DropdownButton\n onClick={actions.deleteNode}\n className=\"text-red-500 bg-red-500 dark:text-red-500 hover:bg-red-500 dark:hover:text-red-500 dark:hover:bg-red-500 bg-opacity-10 hover:bg-opacity-20 dark:hover:bg-opacity-20\"\n >\n <Icon icon={Trash2} />\n Delete\n </DropdownButton>\n </Popover.Close>\n </Surface>\n </Popover.Content>\n </Popover.Root>\n </div>\n </DragHandle>\n );\n};\n"],"names":["DragHandle","Icon","Toolbar","useTranslation","Popover","Clipboard","Copy","GripVertical","Plus","RemoveFormatting","Trash2","useEffect","useState","DropdownButton","Surface","useContentItemActions","useData","ContentItemMenu","editor","menuOpen","setMenuOpen","tippyOptions","setTippyOptions","data","i18n","actions","currentNode","currentNodePos","commands","setMeta","pluginKey","onNodeChange","handleNodeChange","placement","offset","zIndex","div","className","Button","type","onClick","handleAdd","icon","Root","open","onOpenChange","Trigger","asChild","Content","side","align","sideOffset","Close","resetTextFormatting","copyNodeToClipboard","duplicateNode","Divider","horizontal","deleteNode"],"mappings":"AAAA;;AACA,SAASA,UAAU,QAAQ,0CAA0C;AAErE,SAASC,IAAI,QAAQ,mBAAmB;AACxC,SAASC,OAAO,QAAQ,sBAAsB;AAE9C,SAASC,cAAc,QAAQ,uCAAuC;AACtE,YAAYC,aAAa,0BAA0B;AACnD,SACEC,SAAS,EACTC,IAAI,EACJC,YAAY,EACZC,IAAI,EACJC,gBAAgB,EAChBC,MAAM,QACD,eAAe;AACtB,SAASC,SAAS,EAAEC,QAAQ,QAAQ,QAAQ;AAC5C,SAASC,cAAc,QAAQ,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,QAAQ4B,mBAAmB;;8DAClD,KAACpD;oDAAKyC,MAAMjC;;gDAAoB;;;;kDAIpC,KAACL,QAAQgD,KAAK;kDACZ,cAAA,MAACvC;4CAAe2B,SAASf,QAAQ6B,mBAAmB;;8DAClD,KAACrD;oDAAKyC,MAAMrC;;gDAAa;;;;kDAI7B,KAACD,QAAQgD,KAAK;kDACZ,cAAA,MAACvC;4CAAe2B,SAASf,QAAQ8B,aAAa;;8DAC5C,KAACtD;oDAAKyC,MAAMpC;;gDAAQ;;;;kDAIxB,KAACJ,QAAQsD,OAAO;wCAACC,UAAU;;kDAC3B,KAACrD,QAAQgD,KAAK;kDACZ,cAAA,MAACvC;4CACC2B,SAASf,QAAQiC,UAAU;4CAC3BrB,WAAU;;8DAEV,KAACpC;oDAAKyC,MAAMhC;;gDAAU;;;;;;;;;;;;AAUxC,EAAE"}
1
+ {"version":3,"sources":["../../../../../../../src/fields/TiptapEditor/features/menus/ContentItemMenu/ContentItemMenu.tsx"],"sourcesContent":["\"use client\";\nimport { DragHandle } from \"@tiptap-pro/extension-drag-handle-react\";\nimport { Editor } from \"@tiptap/react\";\nimport { Icon } from \"../../ui/Icon.js\";\nimport { Toolbar } from \"../../ui/Toolbar.js\";\n\nimport { useTranslation } from \"@payloadcms/ui/providers/Translation\";\nimport * as Popover from \"@radix-ui/react-popover\";\nimport {\n Clipboard,\n Copy,\n GripVertical,\n Plus,\n RemoveFormatting,\n Trash2,\n} from \"lucide-react\";\nimport { useEffect, useState } from \"react\";\nimport { DropdownButton } from \"../../ui/Dropdown/Dropdown.js\";\nimport { Surface } from \"../../ui/Surface.js\";\nimport useContentItemActions from \"./hooks/useContentItemActions.js\";\nimport { useData } from \"./hooks/useData.js\";\n\nexport type ContentItemMenuProps = {\n editor: Editor;\n};\n\nexport const ContentItemMenu = ({ editor }: ContentItemMenuProps) => {\n const [menuOpen, setMenuOpen] = useState(false);\n const [tippyOptions, setTippyOptions] = useState();\n const data = useData();\n const actions = useContentItemActions(\n editor,\n data.currentNode,\n data.currentNodePos\n );\n\n useEffect(() => {\n if (menuOpen) {\n editor.commands.setMeta(\"lockDragHandle\", true);\n } else {\n editor.commands.setMeta(\"lockDragHandle\", false);\n }\n }, [editor, menuOpen]);\n\n return (\n <DragHandle\n pluginKey=\"ContentItemMenu\"\n editor={editor}\n onNodeChange={data.handleNodeChange}\n tippyOptions={{\n placement: \"left\",\n offset: [-12, 2],\n zIndex: 99,\n }}\n >\n <div className=\"flex items-center gap-0.5\">\n <Toolbar.Button type=\"button\" onClick={actions.handleAdd}>\n <Icon icon={Plus} />\n </Toolbar.Button>\n <Popover.Root open={menuOpen} onOpenChange={setMenuOpen}>\n <Popover.Trigger asChild>\n <Toolbar.Button type=\"button\">\n <Icon icon={GripVertical} />\n </Toolbar.Button>\n </Popover.Trigger>\n <Popover.Content side=\"bottom\" align=\"start\" sideOffset={8}>\n <Surface className=\"p-2 flex flex-col min-w-[16rem]\">\n <Popover.Close>\n <DropdownButton onClick={actions.resetTextFormatting}>\n <Icon icon={RemoveFormatting} />\n Clear formatting\n </DropdownButton>\n </Popover.Close>\n <Popover.Close>\n <DropdownButton onClick={actions.copyNodeToClipboard}>\n <Icon icon={Clipboard} />\n Copy to clipboard\n </DropdownButton>\n </Popover.Close>\n <Popover.Close>\n <DropdownButton onClick={actions.duplicateNode}>\n <Icon icon={Copy} />\n Duplicate\n </DropdownButton>\n </Popover.Close>\n <Toolbar.Divider horizontal />\n <Popover.Close>\n <DropdownButton\n onClick={actions.deleteNode}\n className=\"text-red-500 bg-red-500 dark:text-red-500 hover:bg-red-500 dark:hover:text-red-500 dark:hover:bg-red-500 bg-opacity-10 hover:bg-opacity-20 dark:hover:bg-opacity-20\"\n >\n <Icon icon={Trash2} />\n Delete\n </DropdownButton>\n </Popover.Close>\n </Surface>\n </Popover.Content>\n </Popover.Root>\n </div>\n </DragHandle>\n );\n};\n"],"names":["DragHandle","Icon","Toolbar","Popover","Clipboard","Copy","GripVertical","Plus","RemoveFormatting","Trash2","useEffect","useState","DropdownButton","Surface","useContentItemActions","useData","ContentItemMenu","editor","menuOpen","setMenuOpen","tippyOptions","setTippyOptions","data","actions","currentNode","currentNodePos","commands","setMeta","pluginKey","onNodeChange","handleNodeChange","placement","offset","zIndex","div","className","Button","type","onClick","handleAdd","icon","Root","open","onOpenChange","Trigger","asChild","Content","side","align","sideOffset","Close","resetTextFormatting","copyNodeToClipboard","duplicateNode","Divider","horizontal","deleteNode"],"mappings":"AAAA;;AACA,SAASA,UAAU,QAAQ,0CAA0C;AAErE,SAASC,IAAI,QAAQ,mBAAmB;AACxC,SAASC,OAAO,QAAQ,sBAAsB;AAG9C,YAAYC,aAAa,0BAA0B;AACnD,SACEC,SAAS,EACTC,IAAI,EACJC,YAAY,EACZC,IAAI,EACJC,gBAAgB,EAChBC,MAAM,QACD,eAAe;AACtB,SAASC,SAAS,EAAEC,QAAQ,QAAQ,QAAQ;AAC5C,SAASC,cAAc,QAAQ,gCAAgC;AAC/D,SAASC,OAAO,QAAQ,sBAAsB;AAC9C,OAAOC,2BAA2B,mCAAmC;AACrE,SAASC,OAAO,QAAQ,qBAAqB;AAM7C,OAAO,MAAMC,kBAAkB,CAAC,EAAEC,MAAM,EAAwB;IAC9D,MAAM,CAACC,UAAUC,YAAY,GAAGR,SAAS;IACzC,MAAM,CAACS,cAAcC,gBAAgB,GAAGV;IACxC,MAAMW,OAAOP;IACb,MAAMQ,UAAUT,sBACdG,QACAK,KAAKE,WAAW,EAChBF,KAAKG,cAAc;IAGrBf,UAAU;QACR,IAAIQ,UAAU;YACZD,OAAOS,QAAQ,CAACC,OAAO,CAAC,kBAAkB;QAC5C,OAAO;YACLV,OAAOS,QAAQ,CAACC,OAAO,CAAC,kBAAkB;QAC5C;IACF,GAAG;QAACV;QAAQC;KAAS;IAErB,qBACE,KAAClB;QACC4B,WAAU;QACVX,QAAQA;QACRY,cAAcP,KAAKQ,gBAAgB;QACnCV,cAAc;YACZW,WAAW;YACXC,QAAQ;gBAAC,CAAC;gBAAI;aAAE;YAChBC,QAAQ;QACV;kBAEA,cAAA,MAACC;YAAIC,WAAU;;8BACb,KAACjC,QAAQkC,MAAM;oBAACC,MAAK;oBAASC,SAASf,QAAQgB,SAAS;8BACtD,cAAA,KAACtC;wBAAKuC,MAAMjC;;;8BAEd,MAACJ,QAAQsC,IAAI;oBAACC,MAAMxB;oBAAUyB,cAAcxB;;sCAC1C,KAAChB,QAAQyC,OAAO;4BAACC,OAAO;sCACtB,cAAA,KAAC3C,QAAQkC,MAAM;gCAACC,MAAK;0CACnB,cAAA,KAACpC;oCAAKuC,MAAMlC;;;;sCAGhB,KAACH,QAAQ2C,OAAO;4BAACC,MAAK;4BAASC,OAAM;4BAAQC,YAAY;sCACvD,cAAA,MAACpC;gCAAQsB,WAAU;;kDACjB,KAAChC,QAAQ+C,KAAK;kDACZ,cAAA,MAACtC;4CAAe0B,SAASf,QAAQ4B,mBAAmB;;8DAClD,KAAClD;oDAAKuC,MAAMhC;;gDAAoB;;;;kDAIpC,KAACL,QAAQ+C,KAAK;kDACZ,cAAA,MAACtC;4CAAe0B,SAASf,QAAQ6B,mBAAmB;;8DAClD,KAACnD;oDAAKuC,MAAMpC;;gDAAa;;;;kDAI7B,KAACD,QAAQ+C,KAAK;kDACZ,cAAA,MAACtC;4CAAe0B,SAASf,QAAQ8B,aAAa;;8DAC5C,KAACpD;oDAAKuC,MAAMnC;;gDAAQ;;;;kDAIxB,KAACH,QAAQoD,OAAO;wCAACC,UAAU;;kDAC3B,KAACpD,QAAQ+C,KAAK;kDACZ,cAAA,MAACtC;4CACC0B,SAASf,QAAQiC,UAAU;4CAC3BrB,WAAU;;8DAEV,KAAClC;oDAAKuC,MAAM/B;;gDAAU;;;;;;;;;;;;AAUxC,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"file":"useBlockEditor.d.ts","sourceRoot":"","sources":["../../../../../src/fields/TiptapEditor/hooks/useBlockEditor.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAa,MAAM,eAAe,CAAC;AASlD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;KACvB;CACF;AAED,eAAO,MAAM,cAAc,sEAKxB;IACD,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,GAAG,CAAA;KAAE,CAAC;IACrC,YAAY,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;IAClC,kBAAkB,EAAE,eAAe,CAAC;IACpC,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACzC;;;;;CA+FA,CAAC"}
1
+ {"version":3,"file":"useBlockEditor.d.ts","sourceRoot":"","sources":["../../../../../src/fields/TiptapEditor/hooks/useBlockEditor.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAa,MAAM,eAAe,CAAC;AASlD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;KACvB;CACF;AAED,eAAO,MAAM,cAAc,sEAKxB;IACD,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,GAAG,CAAA;KAAE,CAAC;IACrC,YAAY,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;IAClC,kBAAkB,EAAE,eAAe,CAAC;IACpC,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACzC;;;;;CAgGA,CAAC"}
@@ -20,6 +20,7 @@ export const useBlockEditor = ({ content, handleChange, openAssetHQHandler, addi
20
20
  const { t, i18n } = useTranslation();
21
21
  const editor = useEditor({
22
22
  content: content?.json ?? content ?? {},
23
+ immediatelyRender: false,
23
24
  autofocus: true,
24
25
  onCreate: ({ editor })=>{
25
26
  // provider?.on('synced', () => {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/fields/TiptapEditor/hooks/useBlockEditor.ts"],"sourcesContent":["\"use client\";\nimport { useEffect, useMemo } from \"react\";\n\nimport { Editor, useEditor } from \"@tiptap/react\";\n\nimport ExtensionKit from \"../extensions/extension-kit.js\";\nimport { EditorUser } from \"../features/BlockEditor/types.js\";\nimport { useSidebar } from \"./useSidebar.js\";\n\nimport { useTranslation } from \"@payloadcms/ui/providers/Translation\";\nimport TurndownService from \"turndown\";\nimport { gfm } from \"turndown-plugin-gfm\";\nimport { openAssetHQType } from \"../types.js\";\ndeclare global {\n interface Window {\n editor: Editor | null;\n }\n}\n\nexport const useBlockEditor = ({\n content,\n handleChange,\n openAssetHQHandler,\n additionalContext,\n}: {\n content: { html: string; json: any };\n handleChange: (data: any) => void;\n openAssetHQHandler: openAssetHQType;\n additionalContext?: Record<string, any>;\n}) => {\n const leftSidebar = useSidebar();\n\n const turndownService = new TurndownService({});\n // Use the gfm plugin\n turndownService.use(gfm);\n turndownService.addRule(\"twitter\", {\n filter: \"div\",\n replacement: function (content) {\n return \"\\n\\n\" + content + \"\\n\\n\";\n },\n });\n const { t, i18n } = useTranslation();\n\n const editor = useEditor(\n {\n content: content?.json ?? content ?? {},\n autofocus: true,\n onCreate: ({ editor }) => {\n // provider?.on('synced', () => {\n // if (editor.isEmpty) {\n // editor.commands.setContent(initialContent)\n // }\n // })\n },\n extensions: [\n ...ExtensionKit({\n openAssetHQHandler,\n // provider,\n }),\n // Collaboration.configure({\n // document: ydoc,\n // }),\n // CollaborationCursor.configure({\n // provider,\n // user: {\n // name: randomElement(userNames),\n // color: randomElement(userColors),\n // },\n // }),\n ],\n editorProps: {\n attributes: {\n languages: i18n.language,\n autocomplete: \"off\",\n autocorrect: \"off\",\n autocapitalize: \"off\",\n class: \"min-h-full\",\n },\n },\n onUpdate: ({ editor }) => {\n handleChange(editor?.getJSON() ?? {});\n },\n },\n []\n );\n\n useEffect(() => {\n if (editor?.storage?.aiCommand) {\n editor.storage.aiCommand.title = additionalContext?.title ?? \"\";\n editor.storage.aiCommand.language = additionalContext?.language ?? \"\";\n }\n }, [editor, additionalContext]);\n\n const users = useMemo(() => {\n if (!editor?.storage?.collaborationCursor?.users) {\n return [];\n }\n\n return editor?.storage?.collaborationCursor?.users.map(\n (user: EditorUser) => {\n const names = user.name?.split(\" \");\n const firstName = names?.[0];\n const lastName = names?.[names.length - 1];\n const initials = `${firstName?.[0] || \"?\"}${lastName?.[0] || \"?\"}`;\n\n return { ...user, initials: initials.length ? initials : \"?\" };\n }\n );\n }, [editor?.storage.collaborationCursor?.users]);\n\n const characterCount = editor?.storage.characterCount || {\n characters: () => 0,\n words: () => 0,\n };\n\n // useEffect(() => {\n // provider?.on('status', (event: { status: WebSocketStatus }) => {\n // setCollabState(event.status)\n // })\n // }, [provider])\n\n if (typeof window != \"undefined\") window.editor = editor;\n\n return { editor, users, characterCount, leftSidebar };\n};\n"],"names":["useEffect","useMemo","useEditor","ExtensionKit","useSidebar","useTranslation","TurndownService","gfm","useBlockEditor","content","handleChange","openAssetHQHandler","additionalContext","leftSidebar","turndownService","use","addRule","filter","replacement","t","i18n","editor","json","autofocus","onCreate","extensions","editorProps","attributes","languages","language","autocomplete","autocorrect","autocapitalize","class","onUpdate","getJSON","storage","aiCommand","title","users","collaborationCursor","map","user","names","name","split","firstName","lastName","length","initials","characterCount","characters","words","window"],"mappings":"AAAA;AACA,SAASA,SAAS,EAAEC,OAAO,QAAQ,QAAQ;AAE3C,SAAiBC,SAAS,QAAQ,gBAAgB;AAElD,OAAOC,kBAAkB,iCAAiC;AAE1D,SAASC,UAAU,QAAQ,kBAAkB;AAE7C,SAASC,cAAc,QAAQ,uCAAuC;AACtE,OAAOC,qBAAqB,WAAW;AACvC,SAASC,GAAG,QAAQ,sBAAsB;AAQ1C,OAAO,MAAMC,iBAAiB,CAAC,EAC7BC,OAAO,EACPC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AE;YAC5B,MAAMI,WAAWJ,OAAO,CAACA,MAAMK,MAAM,GAAG,EAAE;YAC1C,MAAMC,WAAW,CAAC,EAAEH,WAAW,CAAC,EAAE,IAAI,IAAI,EAAEC,UAAU,CAAC,EAAE,IAAI,IAAI,CAAC;YAElE,OAAO;gBAAE,GAAGL,IAAI;gBAAEO,UAAUA,SAASD,MAAM,GAAGC,WAAW;YAAI;QAC/D;IAEJ,GAAG;QAAC5B,QAAQe,QAAQI,qBAAqBD;KAAM;IAE/C,MAAMW,iBAAiB7B,QAAQe,QAAQc,kBAAkB;QACvDC,YAAY,IAAM;QAClBC,OAAO,IAAM;IACf;IAEA,oBAAoB;IACpB,qEAAqE;IACrE,mCAAmC;IACnC,OAAO;IACP,iBAAiB;IAEjB,IAAI,OAAOC,UAAU,aAAaA,OAAOhC,MAAM,GAAGA;IAElD,OAAO;QAAEA;QAAQkB;QAAOW;QAAgBrC;IAAY;AACtD,EAAE"}
1
+ {"version":3,"sources":["../../../../../src/fields/TiptapEditor/hooks/useBlockEditor.ts"],"sourcesContent":["\"use client\";\nimport { useEffect, useMemo } from \"react\";\n\nimport { Editor, useEditor } from \"@tiptap/react\";\n\nimport ExtensionKit from \"../extensions/extension-kit.js\";\nimport { EditorUser } from \"../features/BlockEditor/types.js\";\nimport { useSidebar } from \"./useSidebar.js\";\n\nimport { useTranslation } from \"@payloadcms/ui/providers/Translation\";\nimport TurndownService from \"turndown\";\nimport { gfm } from \"turndown-plugin-gfm\";\nimport { openAssetHQType } from \"../types.js\";\ndeclare global {\n interface Window {\n editor: Editor | null;\n }\n}\n\nexport const useBlockEditor = ({\n content,\n handleChange,\n openAssetHQHandler,\n additionalContext,\n}: {\n content: { html: string; json: any };\n handleChange: (data: any) => void;\n openAssetHQHandler: openAssetHQType;\n additionalContext?: Record<string, any>;\n}) => {\n const leftSidebar = useSidebar();\n\n const turndownService = new TurndownService({});\n // Use the gfm plugin\n turndownService.use(gfm);\n turndownService.addRule(\"twitter\", {\n filter: \"div\",\n replacement: function (content) {\n return \"\\n\\n\" + content + \"\\n\\n\";\n },\n });\n const { t, i18n } = useTranslation();\n\n const editor = useEditor(\n {\n content: content?.json ?? content ?? {},\n immediatelyRender: false,\n autofocus: true,\n onCreate: ({ editor }) => {\n // provider?.on('synced', () => {\n // if (editor.isEmpty) {\n // editor.commands.setContent(initialContent)\n // }\n // })\n },\n extensions: [\n ...ExtensionKit({\n openAssetHQHandler,\n // provider,\n }),\n // Collaboration.configure({\n // document: ydoc,\n // }),\n // CollaborationCursor.configure({\n // provider,\n // user: {\n // name: randomElement(userNames),\n // color: randomElement(userColors),\n // },\n // }),\n ],\n editorProps: {\n attributes: {\n languages: i18n.language,\n autocomplete: \"off\",\n autocorrect: \"off\",\n autocapitalize: \"off\",\n class: \"min-h-full\",\n },\n },\n onUpdate: ({ editor }) => {\n handleChange(editor?.getJSON() ?? {});\n },\n },\n []\n );\n\n useEffect(() => {\n if (editor?.storage?.aiCommand) {\n editor.storage.aiCommand.title = additionalContext?.title ?? \"\";\n editor.storage.aiCommand.language = additionalContext?.language ?? \"\";\n }\n }, [editor, additionalContext]);\n\n const users = useMemo(() => {\n if (!editor?.storage?.collaborationCursor?.users) {\n return [];\n }\n\n return editor?.storage?.collaborationCursor?.users.map(\n (user: EditorUser) => {\n const names = user.name?.split(\" \");\n const firstName = names?.[0];\n const lastName = names?.[names.length - 1];\n const initials = `${firstName?.[0] || \"?\"}${lastName?.[0] || \"?\"}`;\n\n return { ...user, initials: initials.length ? initials : \"?\" };\n }\n );\n }, [editor?.storage.collaborationCursor?.users]);\n\n const characterCount = editor?.storage.characterCount || {\n characters: () => 0,\n words: () => 0,\n };\n\n // useEffect(() => {\n // provider?.on('status', (event: { status: WebSocketStatus }) => {\n // setCollabState(event.status)\n // })\n // }, [provider])\n\n if (typeof window != \"undefined\") window.editor = editor;\n\n return { editor, users, characterCount, leftSidebar };\n};\n"],"names":["useEffect","useMemo","useEditor","ExtensionKit","useSidebar","useTranslation","TurndownService","gfm","useBlockEditor","content","handleChange","openAssetHQHandler","additionalContext","leftSidebar","turndownService","use","addRule","filter","replacement","t","i18n","editor","json","immediatelyRender","autofocus","onCreate","extensions","editorProps","attributes","languages","language","autocomplete","autocorrect","autocapitalize","class","onUpdate","getJSON","storage","aiCommand","title","users","collaborationCursor","map","user","names","name","split","firstName","lastName","length","initials","characterCount","characters","words","window"],"mappings":"AAAA;AACA,SAASA,SAAS,EAAEC,OAAO,QAAQ,QAAQ;AAE3C,SAAiBC,SAAS,QAAQ,gBAAgB;AAElD,OAAOC,kBAAkB,iCAAiC;AAE1D,SAASC,UAAU,QAAQ,kBAAkB;AAE7C,SAASC,cAAc,QAAQ,uCAAuC;AACtE,OAAOC,qBAAqB,WAAW;AACvC,SAASC,GAAG,QAAQ,sBAAsB;AAQ1C,OAAO,MAAMC,iBAAiB,CAAC,EAC7BC,OAAO,EACPC,YAAY,EACZC,kBAAkB,EAClBC,iBAAiB,EAMlB;IACC,MAAMC,cAAcT;IAEpB,MAAMU,kBAAkB,IAAIR,gBAAgB,CAAC;IAC7C,qBAAqB;IACrBQ,gBAAgBC,GAAG,CAACR;IACpBO,gBAAgBE,OAAO,CAAC,WAAW;QACjCC,QAAQ;QACRC,aAAa,SAAUT,OAAO;YAC5B,OAAO,SAASA,UAAU;QAC5B;IACF;IACA,MAAM,EAAEU,CAAC,EAAEC,IAAI,EAAE,GAAGf;IAEpB,MAAMgB,SAASnB,UACb;QACEO,SAASA,SAASa,QAAQb,WAAW,CAAC;QACtCc,mBAAmB;QACnBC,WAAW;QACXC,UAAU,CAAC,EAAEJ,MAAM,EAAE;QACnB,iCAAiC;QACjC,0BAA0B;QAC1B,iDAAiD;QACjD,MAAM;QACN,KAAK;QACP;QACAK,YAAY;eACPvB,aAAa;gBACdQ;YAEF;SAWD;QACDgB,aAAa;YACXC,YAAY;gBACVC,WAAWT,KAAKU,QAAQ;gBACxBC,cAAc;gBACdC,aAAa;gBACbC,gBAAgB;gBAChBC,OAAO;YACT;QACF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apEditor/lib/constants.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAEhF,eAAO,MAAM,SAAS,UA0BrB,CAAC;AAEF,eAAO,MAAM,UAAU,UAQtB,CAAC;AAEF,eAAO,MAAM,WAAW,UAOvB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,cAAc,EAuBrC,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,YAAY,EAe/B,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/fields/TiptapEditor/lib/constants.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAEhF,eAAO,MAAM,SAAS,UA0BrB,CAAC;AAEF,eAAO,MAAM,UAAU,UAQtB,CAAC;AAEF,eAAO,MAAM,WAAW,UAOvB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,cAAc,EAkIrC,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,YAAY,EAe/B,CAAC"}
@@ -44,74 +44,229 @@ export const themeColors = [
44
44
  ];
45
45
  export const languages = [
46
46
  {
47
- name: "arabic",
47
+ value: "ar",
48
48
  label: "Arabic",
49
- value: "ar"
49
+ name: "arabic"
50
50
  },
51
51
  {
52
- name: "chinese",
52
+ value: "az",
53
+ label: "Azerbaijani",
54
+ name: "azerbaijani"
55
+ },
56
+ {
57
+ value: "bs",
58
+ label: "Balkan Bosnian",
59
+ name: "balkan_bosnian"
60
+ },
61
+ {
62
+ value: "hr",
63
+ label: "Balkan Hrvatski",
64
+ name: "balkan_hrvatski"
65
+ },
66
+ {
67
+ value: "mk",
68
+ label: "Balkan Macedonian",
69
+ name: "balkan_macedonian"
70
+ },
71
+ {
72
+ value: "sr",
73
+ label: "Balkan Serbian",
74
+ name: "balkan_serbian"
75
+ },
76
+ {
77
+ value: "sq",
78
+ label: "Balkan Albanian",
79
+ name: "balkan_albanian"
80
+ },
81
+ {
82
+ value: "bg",
83
+ label: "Bulgarian",
84
+ name: "bulgarian"
85
+ },
86
+ {
87
+ value: "zh",
53
88
  label: "Chinese",
54
- value: "zh"
89
+ name: "chinese"
90
+ },
91
+ {
92
+ value: "da",
93
+ label: "Danish",
94
+ name: "danish"
55
95
  },
56
96
  {
57
- name: "english",
97
+ value: "fa-AF",
98
+ label: "Dari",
99
+ name: "dari"
100
+ },
101
+ {
102
+ value: "nl",
103
+ label: "Dutch",
104
+ name: "dutch"
105
+ },
106
+ {
107
+ value: "en",
58
108
  label: "English",
59
- value: "en"
109
+ name: "english"
60
110
  },
61
111
  {
62
- name: "farsi",
63
- label: "Farsu",
64
- value: "fa"
112
+ value: "es",
113
+ label: "Espanyol",
114
+ name: "espanyol"
65
115
  },
66
116
  {
67
- name: "french",
68
- label: "French",
69
- value: "fr"
117
+ value: "fi",
118
+ label: "Finnish",
119
+ name: "finnish"
70
120
  },
71
121
  {
72
- name: "german",
73
- label: "German",
74
- value: "de"
122
+ value: "fr",
123
+ label: "Français",
124
+ name: "francais"
75
125
  },
76
126
  {
77
- name: "greek",
127
+ value: "ka",
128
+ label: "Georgian",
129
+ name: "georgian"
130
+ },
131
+ {
132
+ value: "el",
78
133
  label: "Greek",
79
- value: "gr"
134
+ name: "greek"
135
+ },
136
+ {
137
+ value: "ha",
138
+ label: "Afrika Hausa",
139
+ name: "afrika_hausa"
140
+ },
141
+ {
142
+ value: "he",
143
+ label: "Hebrew",
144
+ name: "hebrew"
145
+ },
146
+ {
147
+ value: "hi",
148
+ label: "Hindi",
149
+ name: "hindi"
150
+ },
151
+ {
152
+ value: "hu",
153
+ label: "Hungarian",
154
+ name: "hungarian"
155
+ },
156
+ {
157
+ value: "id",
158
+ label: "Bahasa Indonesia",
159
+ name: "bahasa_indonesia"
80
160
  },
81
161
  {
82
- name: "italian",
162
+ value: "it",
83
163
  label: "Italian",
84
- value: "it"
164
+ name: "italian"
85
165
  },
86
166
  {
87
- name: "japanese",
167
+ value: "ja",
88
168
  label: "Japanese",
89
- value: "jp"
169
+ name: "japanese"
170
+ },
171
+ {
172
+ value: "kk",
173
+ label: "Kazakh",
174
+ name: "kazakh"
90
175
  },
91
176
  {
92
- name: "korean",
177
+ value: "ko",
93
178
  label: "Korean",
94
- value: "ko"
179
+ name: "korean"
180
+ },
181
+ {
182
+ value: "kir",
183
+ label: "Kyrgyz",
184
+ name: "kyrgyz"
185
+ },
186
+ {
187
+ value: "ms",
188
+ label: "Malay",
189
+ name: "malay"
190
+ },
191
+ {
192
+ value: "fa",
193
+ label: "Farsi",
194
+ name: "farsi"
195
+ },
196
+ {
197
+ value: "pl",
198
+ label: "Polish",
199
+ name: "polish"
200
+ },
201
+ {
202
+ value: "pt",
203
+ label: "Portuguese",
204
+ name: "portuguese"
205
+ },
206
+ {
207
+ value: "ro",
208
+ label: "Romanian",
209
+ name: "romanian"
95
210
  },
96
211
  {
97
- name: "russian",
212
+ value: "ru",
98
213
  label: "Russian",
99
- value: "ru"
214
+ name: "russian"
100
215
  },
101
216
  {
102
- name: "spanish",
103
- label: "Spanish",
104
- value: "es"
217
+ value: "so",
218
+ label: "Somali",
219
+ name: "somali"
105
220
  },
106
221
  {
107
- name: "swedish",
222
+ value: "sv",
108
223
  label: "Swedish",
109
- value: "sv"
224
+ name: "swedish"
225
+ },
226
+ {
227
+ value: "tat",
228
+ label: "Tatar",
229
+ name: "tatar"
230
+ },
231
+ {
232
+ value: "tuk",
233
+ label: "Turkmen",
234
+ name: "turkmen"
235
+ },
236
+ {
237
+ value: "ur",
238
+ label: "Urdu",
239
+ name: "urdu"
240
+ },
241
+ {
242
+ value: "uig",
243
+ label: "Uyghur",
244
+ name: "uyghur"
245
+ },
246
+ {
247
+ value: "uz",
248
+ label: "Uzbek",
249
+ name: "uzbek"
250
+ },
251
+ {
252
+ value: "hy",
253
+ label: "Armenian",
254
+ name: "armenian"
255
+ },
256
+ {
257
+ value: "sw",
258
+ label: "Afrika Swahili",
259
+ name: "afrika_swahili"
260
+ },
261
+ {
262
+ value: "pcm",
263
+ label: "Nigerian Pidgin",
264
+ name: "nigerian_pidgin"
110
265
  },
111
266
  {
112
- name: "ukrainian",
113
- label: "Ukrainian",
114
- value: "ua"
267
+ value: "no",
268
+ label: "Norwegian",
269
+ name: "norwegian"
115
270
  }
116
271
  ];
117
272
  export const tones = [