payload-richtext-tiptap 0.0.121 → 0.0.123
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/fields/TiptapEditor/extensions/AudioBlock/AudioBlock.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/AudioBlock/components/AudioBlockMenu.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/AudioBlock/components/AudioBlockView.js +0 -1
- package/dist/src/fields/TiptapEditor/extensions/AudioBlock/components/AudioBlockView.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/FontSize/FontSize.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/Heading/Heading.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/ImageBlock/ImageBlock.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/ImageBlock/components/ImageBlockMenu.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/ImageBlock/components/ImageBlockView.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/ImageBlock/components/ImageBlockView.js +0 -1
- package/dist/src/fields/TiptapEditor/extensions/ImageBlock/components/ImageBlockView.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/ImageUpload/view/ImageUpload.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/ImageUpload/view/ImageUpload.js +6 -5
- package/dist/src/fields/TiptapEditor/extensions/ImageUpload/view/ImageUpload.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/ImageUpload/view/ImageUploader.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/ImageUpload/view/ImageUploader.js +0 -1
- package/dist/src/fields/TiptapEditor/extensions/ImageUpload/view/ImageUploader.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/InsideLinks/InsideLink.client.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/InsideLinks/InsideLinksComponent.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/InsideLinks/InsideLinksComponent.js +0 -1
- package/dist/src/fields/TiptapEditor/extensions/InsideLinks/InsideLinksComponent.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/LinkPreview/LinkPreview.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/LinkPreview/LinkPreview.js +1 -2
- package/dist/src/fields/TiptapEditor/extensions/LinkPreview/LinkPreview.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/MultiColumn/Columns.js +3 -3
- package/dist/src/fields/TiptapEditor/extensions/MultiColumn/Columns.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/MultiColumn/menus/ColumnsMenu.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/SlashCommand/MenuList.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/SocialMedia/SocialMediaEmbed.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/SocialMedia/SocialMediaEmbed.js +0 -2
- package/dist/src/fields/TiptapEditor/extensions/SocialMedia/SocialMediaEmbed.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/SocialMedia/SocialMediaEmbedServerside.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/SocialMedia/SocialMediaEmbedServerside.js +0 -1
- package/dist/src/fields/TiptapEditor/extensions/SocialMedia/SocialMediaEmbedServerside.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/VideoBlock.d.ts +2 -0
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/VideoBlock.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/VideoBlock.js +11 -2
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/VideoBlock.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockMenu.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockView.js +2 -3
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockView.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockViewClientside.js +1 -2
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockViewClientside.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/quality-selector/events.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/extension-kit.d.ts +1 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/EmbedContentInlineRenderer.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/EmbedContentSideRenderer.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/EmbedContentSidebarRenderer.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/FacebookServerside.js +1 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/FacebookServerside.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/InstagramServerside.js +1 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/InstagramServerside.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/LinkedinServerside.js +1 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/LinkedinServerside.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/RenderEmbedClientSide.js +1 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/RenderEmbedClientSide.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/TiktokServerside.js +1 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/TiktokServerside.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/TwitterBlockServerside.js +1 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/TwitterBlockServerside.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/YouTubeServerside.js +1 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/YouTubeServerside.js.map +1 -1
- package/dist/src/fields/TiptapEditor/features/menus/TextMenu/components/FontFamilyPicker.js.map +1 -1
- package/dist/src/fields/TiptapEditor/features/menus/TextMenu/components/FontSizePicker.js.map +1 -1
- package/dist/src/fields/TiptapEditor/features/panels/AICommandPanel/AICommandPanel.js.map +1 -1
- package/dist/src/fields/TiptapEditor/features/panels/AIEditorPanel/utils.js.map +1 -1
- package/dist/src/fields/TiptapEditor/hooks/useBlockEditor.js.map +1 -1
- package/dist/src/fields/TiptapEditor/lib/utils/cssVar.js.map +1 -1
- package/dist/src/index.d.ts +0 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +0 -1
- package/dist/src/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +25 -28
- package/dist/src/fields/TiptapEditor/extensions/TableOfContentsNode/TableOfContentsNode.d.ts +0 -10
- package/dist/src/fields/TiptapEditor/extensions/TableOfContentsNode/TableOfContentsNode.d.ts.map +0 -1
- package/dist/src/fields/TiptapEditor/extensions/TableOfContentsNode/TableOfContentsNode.js +0 -55
- package/dist/src/fields/TiptapEditor/extensions/TableOfContentsNode/TableOfContentsNode.js.map +0 -1
- package/dist/src/fields/TiptapEditor/extensions/TableOfContentsNode/index.d.ts +0 -2
- package/dist/src/fields/TiptapEditor/extensions/TableOfContentsNode/index.d.ts.map +0 -1
- package/dist/src/fields/TiptapEditor/extensions/TableOfContentsNode/index.js +0 -3
- package/dist/src/fields/TiptapEditor/extensions/TableOfContentsNode/index.js.map +0 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/ContentEmbedSupport.d.ts +0 -4
- package/dist/src/fields/TiptapEditor/extensions/serverside/ContentEmbedSupport.d.ts.map +0 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/ContentEmbedSupport.js +0 -148
- package/dist/src/fields/TiptapEditor/extensions/serverside/ContentEmbedSupport.js.map +0 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/useAppendIdToClientsideBlocks.d.ts +0 -2
- package/dist/src/fields/TiptapEditor/extensions/serverside/useAppendIdToClientsideBlocks.d.ts.map +0 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/useAppendIdToClientsideBlocks.js +0 -35
- package/dist/src/fields/TiptapEditor/extensions/serverside/useAppendIdToClientsideBlocks.js.map +0 -1
- package/dist/src/fields/TiptapEditor/features/Sidebar/Sidebar.d.ts +0 -8
- package/dist/src/fields/TiptapEditor/features/Sidebar/Sidebar.d.ts.map +0 -1
- package/dist/src/fields/TiptapEditor/features/Sidebar/Sidebar.js +0 -32
- package/dist/src/fields/TiptapEditor/features/Sidebar/Sidebar.js.map +0 -1
- package/dist/src/fields/TiptapEditor/features/Sidebar/index.d.ts +0 -2
- package/dist/src/fields/TiptapEditor/features/Sidebar/index.d.ts.map +0 -1
- package/dist/src/fields/TiptapEditor/features/Sidebar/index.js +0 -3
- package/dist/src/fields/TiptapEditor/features/Sidebar/index.js.map +0 -1
- package/dist/src/fields/TiptapEditor/features/TableOfContents/TableOfContents.d.ts +0 -8
- package/dist/src/fields/TiptapEditor/features/TableOfContents/TableOfContents.d.ts.map +0 -1
- package/dist/src/fields/TiptapEditor/features/TableOfContents/TableOfContents.js +0 -57
- package/dist/src/fields/TiptapEditor/features/TableOfContents/TableOfContents.js.map +0 -1
- package/dist/src/fields/TiptapEditor/features/TableOfContents/index.d.ts +0 -2
- package/dist/src/fields/TiptapEditor/features/TableOfContents/index.d.ts.map +0 -1
- package/dist/src/fields/TiptapEditor/features/TableOfContents/index.js +0 -3
- package/dist/src/fields/TiptapEditor/features/TableOfContents/index.js.map +0 -1
- package/dist/src/fields/TiptapEditor/features/panels/AICommandPanel/tiptap.schema.d.ts +0 -847
- package/dist/src/fields/TiptapEditor/features/panels/AICommandPanel/tiptap.schema.d.ts.map +0 -1
- package/dist/src/fields/TiptapEditor/features/panels/AICommandPanel/tiptap.schema.js +0 -88
- package/dist/src/fields/TiptapEditor/features/panels/AICommandPanel/tiptap.schema.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/SlashCommand/MenuList.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from \"react\";\n\nimport { DropdownButton } from \"../../features/ui/Dropdown/Dropdown.js\";\nimport { Surface } from \"../../features/ui/Surface.js\";\nimport { Command, MenuListProps } from \"./types.js\";\n\nimport { Icon } from \"../../features/ui/Icon.js\";\nimport { AICommandPanel } from \"../../features/panels/AICommandPanel/AICommandPanel.js\";\n\nexport const MenuList = React.forwardRef((props: MenuListProps, ref) => {\n const scrollContainer = useRef<HTMLDivElement>(null);\n const activeItem = useRef<HTMLButtonElement>(null);\n const [selectedGroupIndex, setSelectedGroupIndex] = useState(0);\n const [selectedCommandIndex, setSelectedCommandIndex] = useState(0);\n\n // Anytime the groups change, i.e. the user types to narrow it down, we want to\n // reset the current selection to the first menu item\n useEffect(() => {\n setSelectedGroupIndex(0);\n setSelectedCommandIndex(0);\n }, [props.items]);\n\n const selectItem = useCallback(\n (groupIndex: number, commandIndex: number) => {\n const command = props.items[groupIndex].commands[commandIndex];\n props.command(command);\n },\n [props]\n );\n\n React.useImperativeHandle(ref, () => ({\n onKeyDown: ({ event }: { event: React.KeyboardEvent }) => {\n if (event.key === \"ArrowDown\") {\n if (!props.items.length) {\n return false;\n }\n\n const commands = props.items[selectedGroupIndex].commands;\n\n let newCommandIndex = selectedCommandIndex + 1;\n let newGroupIndex = selectedGroupIndex;\n\n if (commands.length - 1 < newCommandIndex) {\n newCommandIndex = 0;\n newGroupIndex = selectedGroupIndex + 1;\n }\n\n if (props.items.length - 1 < newGroupIndex) {\n newGroupIndex = 0;\n }\n\n setSelectedCommandIndex(newCommandIndex);\n setSelectedGroupIndex(newGroupIndex);\n\n return true;\n }\n\n if (event.key === \"ArrowUp\") {\n if (!props.items.length) {\n return false;\n }\n\n let newCommandIndex = selectedCommandIndex - 1;\n let newGroupIndex = selectedGroupIndex;\n\n if (newCommandIndex < 0) {\n newGroupIndex = selectedGroupIndex - 1;\n newCommandIndex =\n props.items[newGroupIndex]?.commands.length - 1 || 0;\n }\n\n if (newGroupIndex < 0) {\n newGroupIndex = props.items.length - 1;\n newCommandIndex = props.items[newGroupIndex].commands.length - 1;\n }\n\n setSelectedCommandIndex(newCommandIndex);\n setSelectedGroupIndex(newGroupIndex);\n\n return true;\n }\n\n if (event.key === \"Enter\") {\n if (\n !props.items.length ||\n selectedGroupIndex === -1 ||\n selectedCommandIndex === -1\n ) {\n return false;\n }\n\n selectItem(selectedGroupIndex, selectedCommandIndex);\n\n return true;\n }\n\n return false;\n },\n }));\n\n useEffect(() => {\n if (activeItem.current && scrollContainer.current) {\n const offsetTop = activeItem.current.offsetTop;\n const offsetHeight = activeItem.current.offsetHeight;\n\n scrollContainer.current.scrollTop = offsetTop - offsetHeight;\n }\n }, [selectedCommandIndex, selectedGroupIndex]);\n\n const createCommandClickHandler = useCallback(\n (groupIndex: number, commandIndex: number) => {\n return () => {\n selectItem(groupIndex, commandIndex);\n };\n },\n [selectItem]\n );\n\n if (!props.items.length) {\n return null;\n }\n\n return (\n <>\n <Surface\n ref={scrollContainer}\n className=\"text-black max-h-[min(80vh,24rem)] overflow-auto flex-wrap mb-8 p-2\"\n >\n <div className=\"grid grid-cols-1 gap-0.5\">\n {props.items.map((group, groupIndex: number) => (\n <React.Fragment key={`${group.title}-wrapper`}>\n <div\n className=\"text-neutral-500 text-[0.65rem] col-[1/-1] mx-2 mt-4 font-semibold tracking-wider select-none uppercase first:mt-0.5\"\n key={`${group.title}`}\n >\n {group.title}\n </div>\n {group.commands.map((command: Command, commandIndex: number) => (\n <DropdownButton\n key={`${command.label}`}\n isActive={\n selectedGroupIndex === groupIndex &&\n selectedCommandIndex === commandIndex\n }\n onClick={createCommandClickHandler(groupIndex, commandIndex)}\n >\n <Icon icon={command.icon} className=\"mr-1\" />\n {command.label}\n </DropdownButton>\n ))}\n </React.Fragment>\n ))}\n </div>\n </Surface>\n </>\n );\n});\n\nMenuList.displayName = \"MenuList\";\n\nexport default MenuList;\n"],"names":["React","useCallback","useEffect","useRef","useState","DropdownButton","Surface","Icon","MenuList","forwardRef","props","ref","scrollContainer","activeItem","selectedGroupIndex","setSelectedGroupIndex","selectedCommandIndex","setSelectedCommandIndex","items","selectItem","groupIndex","commandIndex","command","commands","useImperativeHandle","onKeyDown","event","key","length","newCommandIndex","newGroupIndex","current","offsetTop","offsetHeight","scrollTop","createCommandClickHandler","className","div","map","group","Fragment","title","isActive","onClick","icon","label","displayName"],"mappings":";AAAA,OAAOA,SAASC,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAExE,SAASC,cAAc,QAAQ,yCAAyC;AACxE,SAASC,OAAO,QAAQ,+BAA+B;AAGvD,SAASC,IAAI,QAAQ,4BAA4B;AAGjD,OAAO,MAAMC,yBAAWR,MAAMS,UAAU,CAAC,CAACC,OAAsBC;IAC9D,MAAMC,kBAAkBT,OAAuB;IAC/C,MAAMU,aAAaV,OAA0B;IAC7C,MAAM,CAACW,oBAAoBC,sBAAsB,GAAGX,SAAS;IAC7D,MAAM,CAACY,sBAAsBC,wBAAwB,GAAGb,SAAS;IAEjE,+EAA+E;IAC/E,qDAAqD;IACrDF,UAAU;QACRa,sBAAsB;QACtBE,wBAAwB;IAC1B,GAAG;QAACP,MAAMQ,KAAK;KAAC;IAEhB,MAAMC,aAAalB,YACjB,CAACmB,YAAoBC;QACnB,MAAMC,UAAUZ,MAAMQ,KAAK,CAACE,WAAW,CAACG,QAAQ,CAACF,aAAa;QAC9DX,MAAMY,OAAO,CAACA;IAChB,GACA;QAACZ;KAAM;IAGTV,MAAMwB,mBAAmB,CAACb,KAAK,IAAO,CAAA;YACpCc,WAAW,CAAC,EAAEC,KAAK,EAAkC;gBACnD,IAAIA,MAAMC,GAAG,KAAK,aAAa;oBAC7B,IAAI,CAACjB,MAAMQ,KAAK,CAACU,MAAM,EAAE;wBACvB,OAAO;oBACT;oBAEA,MAAML,WAAWb,MAAMQ,KAAK,CAACJ,mBAAmB,CAACS,QAAQ;oBAE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,gBAAgBmB,OAAO,CAACG,SAAS,GAAGF,YAAYC;QAClD;IACF,GAAG;QAACjB;QAAsBF;KAAmB;IAE7C,MAAMqB,4BAA4BlC,YAChC,CAACmB,YAAoBC;QACnB,OAAO;YACLF,WAAWC,YAAYC;QACzB;IACF,GACA;QAACF;KAAW;IAGd,IAAI,CAACT,MAAMQ,KAAK,CAACU,MAAM,EAAE;QACvB,OAAO;IACT;IAEA,qBACE;kBACE,cAAA,KAACtB;YACCK,KAAKC;YACLwB,WAAU;sBAEV,cAAA,KAACC;gBAAID,WAAU;0BACZ1B,MAAMQ,KAAK,CAACoB,GAAG,CAAC,CAACC,OAAOnB,2BACvB,MAACpB,MAAMwC,QAAQ;;0CACb,KAACH;gCACCD,WAAU;0CAGTG,MAAME,KAAK;+BAFP,
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/SlashCommand/MenuList.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from \"react\";\n\nimport { DropdownButton } from \"../../features/ui/Dropdown/Dropdown.js\";\nimport { Surface } from \"../../features/ui/Surface.js\";\nimport { Command, MenuListProps } from \"./types.js\";\n\nimport { Icon } from \"../../features/ui/Icon.js\";\nimport { AICommandPanel } from \"../../features/panels/AICommandPanel/AICommandPanel.js\";\n\nexport const MenuList = React.forwardRef((props: MenuListProps, ref) => {\n const scrollContainer = useRef<HTMLDivElement>(null);\n const activeItem = useRef<HTMLButtonElement>(null);\n const [selectedGroupIndex, setSelectedGroupIndex] = useState(0);\n const [selectedCommandIndex, setSelectedCommandIndex] = useState(0);\n\n // Anytime the groups change, i.e. the user types to narrow it down, we want to\n // reset the current selection to the first menu item\n useEffect(() => {\n setSelectedGroupIndex(0);\n setSelectedCommandIndex(0);\n }, [props.items]);\n\n const selectItem = useCallback(\n (groupIndex: number, commandIndex: number) => {\n const command = props.items[groupIndex].commands[commandIndex];\n props.command(command);\n },\n [props]\n );\n\n React.useImperativeHandle(ref, () => ({\n onKeyDown: ({ event }: { event: React.KeyboardEvent }) => {\n if (event.key === \"ArrowDown\") {\n if (!props.items.length) {\n return false;\n }\n\n const commands = props.items[selectedGroupIndex].commands;\n\n let newCommandIndex = selectedCommandIndex + 1;\n let newGroupIndex = selectedGroupIndex;\n\n if (commands.length - 1 < newCommandIndex) {\n newCommandIndex = 0;\n newGroupIndex = selectedGroupIndex + 1;\n }\n\n if (props.items.length - 1 < newGroupIndex) {\n newGroupIndex = 0;\n }\n\n setSelectedCommandIndex(newCommandIndex);\n setSelectedGroupIndex(newGroupIndex);\n\n return true;\n }\n\n if (event.key === \"ArrowUp\") {\n if (!props.items.length) {\n return false;\n }\n\n let newCommandIndex = selectedCommandIndex - 1;\n let newGroupIndex = selectedGroupIndex;\n\n if (newCommandIndex < 0) {\n newGroupIndex = selectedGroupIndex - 1;\n newCommandIndex =\n props.items[newGroupIndex]?.commands.length - 1 || 0;\n }\n\n if (newGroupIndex < 0) {\n newGroupIndex = props.items.length - 1;\n newCommandIndex = props.items[newGroupIndex].commands.length - 1;\n }\n\n setSelectedCommandIndex(newCommandIndex);\n setSelectedGroupIndex(newGroupIndex);\n\n return true;\n }\n\n if (event.key === \"Enter\") {\n if (\n !props.items.length ||\n selectedGroupIndex === -1 ||\n selectedCommandIndex === -1\n ) {\n return false;\n }\n\n selectItem(selectedGroupIndex, selectedCommandIndex);\n\n return true;\n }\n\n return false;\n },\n }));\n\n useEffect(() => {\n if (activeItem.current && scrollContainer.current) {\n const offsetTop = activeItem.current.offsetTop;\n const offsetHeight = activeItem.current.offsetHeight;\n\n scrollContainer.current.scrollTop = offsetTop - offsetHeight;\n }\n }, [selectedCommandIndex, selectedGroupIndex]);\n\n const createCommandClickHandler = useCallback(\n (groupIndex: number, commandIndex: number) => {\n return () => {\n selectItem(groupIndex, commandIndex);\n };\n },\n [selectItem]\n );\n\n if (!props.items.length) {\n return null;\n }\n\n return (\n <>\n <Surface\n ref={scrollContainer}\n className=\"text-black max-h-[min(80vh,24rem)] overflow-auto flex-wrap mb-8 p-2\"\n >\n <div className=\"grid grid-cols-1 gap-0.5\">\n {props.items.map((group, groupIndex: number) => (\n <React.Fragment key={`${group.title}-wrapper`}>\n <div\n className=\"text-neutral-500 text-[0.65rem] col-[1/-1] mx-2 mt-4 font-semibold tracking-wider select-none uppercase first:mt-0.5\"\n key={`${group.title}`}\n >\n {group.title}\n </div>\n {group.commands.map((command: Command, commandIndex: number) => (\n <DropdownButton\n key={`${command.label}`}\n isActive={\n selectedGroupIndex === groupIndex &&\n selectedCommandIndex === commandIndex\n }\n onClick={createCommandClickHandler(groupIndex, commandIndex)}\n >\n <Icon icon={command.icon} className=\"mr-1\" />\n {command.label}\n </DropdownButton>\n ))}\n </React.Fragment>\n ))}\n </div>\n </Surface>\n </>\n );\n});\n\nMenuList.displayName = \"MenuList\";\n\nexport default MenuList;\n"],"names":["React","useCallback","useEffect","useRef","useState","DropdownButton","Surface","Icon","MenuList","forwardRef","props","ref","scrollContainer","activeItem","selectedGroupIndex","setSelectedGroupIndex","selectedCommandIndex","setSelectedCommandIndex","items","selectItem","groupIndex","commandIndex","command","commands","useImperativeHandle","onKeyDown","event","key","length","newCommandIndex","newGroupIndex","current","offsetTop","offsetHeight","scrollTop","createCommandClickHandler","className","div","map","group","Fragment","title","isActive","onClick","icon","label","displayName"],"mappings":";AAAA,OAAOA,SAASC,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAExE,SAASC,cAAc,QAAQ,yCAAyC;AACxE,SAASC,OAAO,QAAQ,+BAA+B;AAGvD,SAASC,IAAI,QAAQ,4BAA4B;AAGjD,OAAO,MAAMC,yBAAWR,MAAMS,UAAU,CAAC,CAACC,OAAsBC;IAC9D,MAAMC,kBAAkBT,OAAuB;IAC/C,MAAMU,aAAaV,OAA0B;IAC7C,MAAM,CAACW,oBAAoBC,sBAAsB,GAAGX,SAAS;IAC7D,MAAM,CAACY,sBAAsBC,wBAAwB,GAAGb,SAAS;IAEjE,+EAA+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MAAMtB,QAAQsB,IAAI;4CAAER,WAAU;;wCACnCd,QAAQuB,KAAK;;mCART,GAAGvB,QAAQuB,KAAK,EAAE;;uBATR,GAAGN,MAAME,KAAK,CAAC,QAAQ,CAAC;;;;AA0BzD,GAAG;AAEHjC,SAASsC,WAAW,GAAG;AAEvB,eAAetC,SAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SocialMediaEmbed.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/SocialMedia/SocialMediaEmbed.tsx"],"names":[],"mappings":"0DAEiD,GAAG;AAApD,
|
|
1
|
+
{"version":3,"file":"SocialMediaEmbed.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/SocialMedia/SocialMediaEmbed.tsx"],"names":[],"mappings":"0DAEiD,GAAG;AAApD,wBAyCE"}
|
|
@@ -19,7 +19,6 @@ export default (({ props, children, Icon, text })=>{
|
|
|
19
19
|
className: "w-full bg-zinc-100 py-8 px-6 flex items-center justify-center gap-2 socialMediaCard",
|
|
20
20
|
draggable: "true",
|
|
21
21
|
"data-drag-handle": "",
|
|
22
|
-
contentEditable: "false",
|
|
23
22
|
children: [
|
|
24
23
|
/*#__PURE__*/ _jsx(Icon, {
|
|
25
24
|
size: 24
|
|
@@ -39,7 +38,6 @@ export default (({ props, children, Icon, text })=>{
|
|
|
39
38
|
},
|
|
40
39
|
draggable: "true",
|
|
41
40
|
"data-drag-handle": "",
|
|
42
|
-
contentEditable: "false",
|
|
43
41
|
children: children
|
|
44
42
|
})
|
|
45
43
|
}) : null
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/SocialMedia/SocialMediaEmbed.tsx"],"sourcesContent":["import { NodeViewContent, NodeViewWrapper } from \"@tiptap/react\";\n\nexport default ({ props, children, Icon, text }: any) => {\n return (\n <NodeViewWrapper\n className=\"react-component\"\n onClick={() => {\n props.editor.commands.setNodeSelection(props.getPos());\n }}\n >\n <NodeViewContent contentEditable=\"false\" className=\"socialMediaContainer\">\n {props?.node.type.spec.draggable ? (\n <div draggable=\"true\" data-drag-handle=\"\" style={{ width: \"100%\" }}>\n {!(props?.node?.attrs?.url ?? props?.node?.attrs?.src) ? (\n <div\n className=\"w-full bg-zinc-100 py-8 px-6 flex items-center justify-center gap-2 socialMediaCard\"\n draggable=\"true\"\n data-drag-handle=\"\"\n
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/SocialMedia/SocialMediaEmbed.tsx"],"sourcesContent":["import { NodeViewContent, NodeViewWrapper } from \"@tiptap/react\";\n\nexport default ({ props, children, Icon, text }: any) => {\n return (\n <NodeViewWrapper\n className=\"react-component\"\n onClick={() => {\n props.editor.commands.setNodeSelection(props.getPos());\n }}\n >\n <NodeViewContent contentEditable=\"false\" className=\"socialMediaContainer\">\n {props?.node.type.spec.draggable ? (\n <div draggable=\"true\" data-drag-handle=\"\" style={{ width: \"100%\" }}>\n {!(props?.node?.attrs?.url ?? props?.node?.attrs?.src) ? (\n <div\n className=\"w-full bg-zinc-100 py-8 px-6 flex items-center justify-center gap-2 socialMediaCard\"\n draggable=\"true\"\n data-drag-handle=\"\"\n >\n <Icon size={24} />\n <p\n className=\"w-full flex items-center justify-start mt-0\"\n style={{\n marginTop: 0,\n }}\n >\n {text}\n </p>\n </div>\n ) : (\n <div\n style={{ display: \"flex\", justifyContent: \"center\" }}\n draggable=\"true\"\n data-drag-handle=\"\"\n >\n {children}\n </div>\n )}\n </div>\n ) : null}\n </NodeViewContent>\n </NodeViewWrapper>\n );\n};\n"],"names":["NodeViewContent","NodeViewWrapper","props","children","Icon","text","className","onClick","editor","commands","setNodeSelection","getPos","contentEditable","node","type","spec","draggable","div","data-drag-handle","style","width","attrs","url","src","size","p","marginTop","display","justifyContent"],"mappings":";AAAA,SAASA,eAAe,EAAEC,eAAe,QAAQ,gBAAgB;AAEjE,eAAe,CAAA,CAAC,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,IAAI,EAAEC,IAAI,EAAO;IAClD,qBACE,KAACJ;QACCK,WAAU;QACVC,SAAS;YACPL,MAAMM,MAAM,CAACC,QAAQ,CAACC,gBAAgB,CAACR,MAAMS,MAAM;QACrD;kBAEA,cAAA,KAACX;YAAgBY,iBAAgB;YAAQN,WAAU;sBAChDJ,OAAOW,KAAKC,KAAKC,KAAKC,0BACrB,KAACC;gBAAID,WAAU;gBAAOE,oBAAiB;gBAAGC,OAAO;oBAAEC,OAAO;gBAAO;0BAC9D,CAAElB,CAAAA,OAAOW,MAAMQ,OAAOC,OAAOpB,OAAOW,MAAMQ,OAAOE,GAAE,kBAClD,MAACN;oBACCX,WAAU;oBACVU,WAAU;oBACVE,oBAAiB;;sCAEjB,KAACd;4BAAKoB,MAAM;;sCACZ,KAACC;4BACCnB,WAAU;4BACVa,OAAO;gCACLO,WAAW;4BACb;sCAECrB;;;mCAIL,KAACY;oBACCE,OAAO;wBAAEQ,SAAS;wBAAQC,gBAAgB;oBAAS;oBACnDZ,WAAU;oBACVE,oBAAiB;8BAEhBf;;iBAIL;;;AAIZ,CAAA,EAAE"}
|
package/dist/src/fields/TiptapEditor/extensions/SocialMedia/SocialMediaEmbedServerside.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SocialMediaEmbedServerside.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/SocialMedia/SocialMediaEmbedServerside.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,0BAA0B,4BAA6B,GAAG,
|
|
1
|
+
{"version":3,"file":"SocialMediaEmbedServerside.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/SocialMedia/SocialMediaEmbedServerside.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,0BAA0B,4BAA6B,GAAG,gCActE,CAAC"}
|
package/dist/src/fields/TiptapEditor/extensions/SocialMedia/SocialMediaEmbedServerside.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/SocialMedia/SocialMediaEmbedServerside.tsx"],"sourcesContent":["import { NodeViewContent, NodeViewWrapper } from \"@tiptap/react\";\nimport { cn } from \"../../lib/utils/index.js\";\n\nexport const SocialMediaEmbedServerside = ({ children, className }: any) => {\n return (\n <NodeViewWrapper className={cn(\"react-component\", className)}>\n <NodeViewContent contentEditable=\"false\" className=\"socialMediaContainer\">\n <div\n style={{ display: \"flex\", justifyContent: \"center\" }}\n draggable=\"false\"\n data-drag-handle=\"\"\n
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/SocialMedia/SocialMediaEmbedServerside.tsx"],"sourcesContent":["import { NodeViewContent, NodeViewWrapper } from \"@tiptap/react\";\nimport { cn } from \"../../lib/utils/index.js\";\n\nexport const SocialMediaEmbedServerside = ({ children, className }: any) => {\n return (\n <NodeViewWrapper className={cn(\"react-component\", className)}>\n <NodeViewContent contentEditable=\"false\" className=\"socialMediaContainer\">\n <div\n style={{ display: \"flex\", justifyContent: \"center\" }}\n draggable=\"false\"\n data-drag-handle=\"\"\n >\n {children}\n </div>\n </NodeViewContent>\n </NodeViewWrapper>\n );\n};\n"],"names":["NodeViewContent","NodeViewWrapper","cn","SocialMediaEmbedServerside","children","className","contentEditable","div","style","display","justifyContent","draggable","data-drag-handle"],"mappings":";AAAA,SAASA,eAAe,EAAEC,eAAe,QAAQ,gBAAgB;AACjE,SAASC,EAAE,QAAQ,2BAA2B;AAE9C,OAAO,MAAMC,6BAA6B,CAAC,EAAEC,QAAQ,EAAEC,SAAS,EAAO;IACrE,qBACE,KAACJ;QAAgBI,WAAWH,GAAG,mBAAmBG;kBAChD,cAAA,KAACL;YAAgBM,iBAAgB;YAAQD,WAAU;sBACjD,cAAA,KAACE;gBACCC,OAAO;oBAAEC,SAAS;oBAAQC,gBAAgB;gBAAS;gBACnDC,WAAU;gBACVC,oBAAiB;0BAEhBR;;;;AAKX,EAAE"}
|
|
@@ -7,12 +7,14 @@ declare module "@tiptap/core" {
|
|
|
7
7
|
poster: string;
|
|
8
8
|
assetId: string;
|
|
9
9
|
playlistUrl?: string;
|
|
10
|
+
title: string;
|
|
10
11
|
}) => ReturnType;
|
|
11
12
|
setVideoBlockAt: (attributes: {
|
|
12
13
|
src: string;
|
|
13
14
|
poster: string;
|
|
14
15
|
assetId: string;
|
|
15
16
|
playlistUrl?: string;
|
|
17
|
+
title: string;
|
|
16
18
|
pos: number | Range;
|
|
17
19
|
}) => ReturnType;
|
|
18
20
|
setVideoBlockAlign: (align: "left" | "center" | "right") => ReturnType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VideoBlock.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/VideoBlock.ts"],"names":[],"mappings":"AAGA,OAAO,EAAmB,KAAK,EAAE,MAAM,cAAc,CAAC;AAKtD,OAAO,QAAQ,cAAc,CAAC;IAC5B,UAAU,QAAQ,CAAC,UAAU;QAC3B,UAAU,EAAE;YACV,aAAa,EAAE,CAAC,UAAU,EAAE;gBAC1B,GAAG,EAAE,MAAM,CAAC;gBACZ,MAAM,EAAE,MAAM,CAAC;gBACf,OAAO,EAAE,MAAM,CAAC;gBAChB,WAAW,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"VideoBlock.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/VideoBlock.ts"],"names":[],"mappings":"AAGA,OAAO,EAAmB,KAAK,EAAE,MAAM,cAAc,CAAC;AAKtD,OAAO,QAAQ,cAAc,CAAC;IAC5B,UAAU,QAAQ,CAAC,UAAU;QAC3B,UAAU,EAAE;YACV,aAAa,EAAE,CAAC,UAAU,EAAE;gBAC1B,GAAG,EAAE,MAAM,CAAC;gBACZ,MAAM,EAAE,MAAM,CAAC;gBACf,OAAO,EAAE,MAAM,CAAC;gBAChB,WAAW,CAAC,EAAE,MAAM,CAAC;gBACrB,KAAK,EAAE,MAAM,CAAA;aACd,KAAK,UAAU,CAAC;YACjB,eAAe,EAAE,CAAC,UAAU,EAAE;gBAC5B,GAAG,EAAE,MAAM,CAAC;gBACZ,MAAM,EAAE,MAAM,CAAC;gBACf,OAAO,EAAE,MAAM,CAAC;gBAChB,WAAW,CAAC,EAAE,MAAM,CAAC;gBACrB,KAAK,EAAE,MAAM,CAAA;gBACb,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC;aACrB,KAAK,UAAU,CAAC;YACjB,kBAAkB,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,KAAK,UAAU,CAAC;YACvE,kBAAkB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,UAAU,CAAC;YAClD,oBAAoB,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,UAAU,CAAC;SACxD,CAAC;KACH;CACF;AAED,eAAO,MAAM,UAAU,6EA4IrB,CAAC;AAEH,eAAe,UAAU,CAAC"}
|
|
@@ -17,6 +17,13 @@ export const VideoBlock = Video.extend({
|
|
|
17
17
|
src: attributes.src
|
|
18
18
|
})
|
|
19
19
|
},
|
|
20
|
+
title: {
|
|
21
|
+
default: "",
|
|
22
|
+
parseHTML: (element)=>element.getAttribute("title"),
|
|
23
|
+
renderHTML: (attributes)=>({
|
|
24
|
+
title: attributes.title
|
|
25
|
+
})
|
|
26
|
+
},
|
|
20
27
|
poster: {
|
|
21
28
|
default: "",
|
|
22
29
|
parseHTML: (element)=>element.getAttribute("poster"),
|
|
@@ -83,7 +90,8 @@ export const VideoBlock = Video.extend({
|
|
|
83
90
|
src: attrs.src,
|
|
84
91
|
poster: attrs.poster,
|
|
85
92
|
assetId: attrs.assetId,
|
|
86
|
-
playlistUrl: attrs.playlistUrl
|
|
93
|
+
playlistUrl: attrs.playlistUrl,
|
|
94
|
+
title: attrs.title
|
|
87
95
|
}
|
|
88
96
|
});
|
|
89
97
|
},
|
|
@@ -94,7 +102,8 @@ export const VideoBlock = Video.extend({
|
|
|
94
102
|
src: attrs.src,
|
|
95
103
|
poster: attrs.poster,
|
|
96
104
|
assetId: attrs.assetId,
|
|
97
|
-
playlistUrl: attrs.playlistUrl
|
|
105
|
+
playlistUrl: attrs.playlistUrl,
|
|
106
|
+
title: attrs.title
|
|
98
107
|
}
|
|
99
108
|
});
|
|
100
109
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/VideoBlock.ts"],"sourcesContent":["\"use client\";\n\nimport { ReactNodeViewRenderer } from \"@tiptap/react\";\nimport { mergeAttributes, Range } from \"@tiptap/core\";\n\nimport { VideoBlockView } from \"./components/VideoBlockView.js\";\nimport { Video } from \"../Video/Video.js\";\n\ndeclare module \"@tiptap/core\" {\n interface Commands<ReturnType> {\n videoBlock: {\n setVideoBlock: (attributes: {\n src: string;\n poster: string;\n assetId: string;\n playlistUrl?: string;\n }) => ReturnType;\n setVideoBlockAt: (attributes: {\n src: string;\n poster: string;\n assetId: string;\n playlistUrl?: string;\n\n pos: number | Range;\n }) => ReturnType;\n setVideoBlockAlign: (align: \"left\" | \"center\" | \"right\") => ReturnType;\n setVideoBlockWidth: (width: number) => ReturnType;\n setVideoBlockCaption: (caption: boolean) => ReturnType;\n };\n }\n}\n\nexport const VideoBlock = Video.extend({\n name: \"videoBlock\",\n\n group: \"block\",\n\n defining: true,\n\n isolating: true,\n\n addAttributes() {\n return {\n src: {\n default: \"\",\n parseHTML: (element) => element.getAttribute(\"src\"),\n renderHTML: (attributes) => ({\n src: attributes.src,\n }),\n },\n poster: {\n default: \"\",\n parseHTML: (element) => element.getAttribute(\"poster\"),\n renderHTML: (attributes) => ({\n poster: attributes.poster,\n }),\n },\n playlistUrl: {\n default: \"\",\n parseHTML: (element) => element.getAttribute(\"data-playlist-url\"),\n renderHTML: (attributes) => ({\n \"data-playlist-url\": attributes.playlistUrl,\n }),\n },\n width: {\n default: \"100%\",\n parseHTML: (element) => element.getAttribute(\"data-width\"),\n renderHTML: (attributes) => ({\n \"data-width\": attributes.width,\n }),\n },\n align: {\n default: \"center\",\n parseHTML: (element) => element.getAttribute(\"data-align\"),\n renderHTML: (attributes) => ({\n \"data-align\": attributes.align,\n }),\n },\n alt: {\n default: undefined,\n parseHTML: (element) => element.getAttribute(\"alt\"),\n renderHTML: (attributes) => ({\n alt: attributes.alt,\n }),\n },\n caption: {\n default: true,\n parseHTML: (element) => element.getAttribute(\"data-caption\") === \"true\",\n renderHTML: (attributes) => ({\n \"data-caption\": attributes.caption,\n }),\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'video[src*=\"tiptap.dev\"]:not([src^=\"data:\"]), video[src*=\"windows.net\"]:not([src^=\"data:\"])',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n \"video\",\n mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),\n ];\n },\n\n addCommands() {\n return {\n setVideoBlock:\n (attrs) =>\n ({ commands }) => {\n return commands.insertContent({\n type: \"videoBlock\",\n attrs: {\n src: attrs.src,\n poster: attrs.poster,\n assetId: attrs.assetId,\n playlistUrl: attrs.playlistUrl,\n },\n });\n },\n\n setVideoBlockAt:\n (attrs) =>\n ({ commands }) => {\n return commands.insertContentAt(attrs.pos, {\n type: \"videoBlock\",\n attrs: {\n src: attrs.src,\n poster: attrs.poster,\n assetId: attrs.assetId,\n playlistUrl: attrs.playlistUrl,\n },\n });\n },\n\n setVideoBlockAlign:\n (align) =>\n ({ commands }) =>\n commands.updateAttributes(\"videoBlock\", { align }),\n\n setVideoBlockWidth:\n (width) =>\n ({ commands }) =>\n commands.updateAttributes(\"videoBlock\", {\n width: `${Math.max(0, Math.min(100, width))}%`,\n }),\n\n setVideoBlockCaption:\n (caption) =>\n ({ commands }) =>\n commands.updateAttributes(\"videoBlock\", { caption }),\n };\n },\n\n addNodeView() {\n //@ts-ignore\n return ReactNodeViewRenderer(VideoBlockView);\n },\n});\n\nexport default VideoBlock;\n"],"names":["ReactNodeViewRenderer","mergeAttributes","VideoBlockView","Video","VideoBlock","extend","name","group","defining","isolating","addAttributes","src","default","parseHTML","element","getAttribute","renderHTML","attributes","poster","playlistUrl","width","align","alt","undefined","caption","tag","HTMLAttributes","options","addCommands","setVideoBlock","attrs","commands","insertContent","type","assetId","setVideoBlockAt","insertContentAt","pos","setVideoBlockAlign","updateAttributes","setVideoBlockWidth","Math","max","min","setVideoBlockCaption","addNodeView"],"mappings":"AAAA;AAEA,SAASA,qBAAqB,QAAQ,gBAAgB;AACtD,SAASC,eAAe,QAAe,eAAe;AAEtD,SAASC,cAAc,QAAQ,iCAAiC;AAChE,SAASC,KAAK,QAAQ,oBAAoB;
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/VideoBlock.ts"],"sourcesContent":["\"use client\";\n\nimport { ReactNodeViewRenderer } from \"@tiptap/react\";\nimport { mergeAttributes, Range } from \"@tiptap/core\";\n\nimport { VideoBlockView } from \"./components/VideoBlockView.js\";\nimport { Video } from \"../Video/Video.js\";\n\ndeclare module \"@tiptap/core\" {\n interface Commands<ReturnType> {\n videoBlock: {\n setVideoBlock: (attributes: {\n src: string;\n poster: string;\n assetId: string;\n playlistUrl?: string;\n title: string\n }) => ReturnType;\n setVideoBlockAt: (attributes: {\n src: string;\n poster: string;\n assetId: string;\n playlistUrl?: string;\n title: string\n pos: number | Range;\n }) => ReturnType;\n setVideoBlockAlign: (align: \"left\" | \"center\" | \"right\") => ReturnType;\n setVideoBlockWidth: (width: number) => ReturnType;\n setVideoBlockCaption: (caption: boolean) => ReturnType;\n };\n }\n}\n\nexport const VideoBlock = Video.extend({\n name: \"videoBlock\",\n\n group: \"block\",\n\n defining: true,\n\n isolating: true,\n\n addAttributes() {\n return {\n src: {\n default: \"\",\n parseHTML: (element) => element.getAttribute(\"src\"),\n renderHTML: (attributes) => ({\n src: attributes.src,\n }),\n },\n title: {\n default: \"\",\n parseHTML: (element) => element.getAttribute(\"title\"),\n renderHTML: (attributes) => ({\n title: attributes.title,\n }),\n },\n poster: {\n default: \"\",\n parseHTML: (element) => element.getAttribute(\"poster\"),\n renderHTML: (attributes) => ({\n poster: attributes.poster,\n }),\n },\n playlistUrl: {\n default: \"\",\n parseHTML: (element) => element.getAttribute(\"data-playlist-url\"),\n renderHTML: (attributes) => ({\n \"data-playlist-url\": attributes.playlistUrl,\n }),\n },\n width: {\n default: \"100%\",\n parseHTML: (element) => element.getAttribute(\"data-width\"),\n renderHTML: (attributes) => ({\n \"data-width\": attributes.width,\n }),\n },\n align: {\n default: \"center\",\n parseHTML: (element) => element.getAttribute(\"data-align\"),\n renderHTML: (attributes) => ({\n \"data-align\": attributes.align,\n }),\n },\n alt: {\n default: undefined,\n parseHTML: (element) => element.getAttribute(\"alt\"),\n renderHTML: (attributes) => ({\n alt: attributes.alt,\n }),\n },\n caption: {\n default: true,\n parseHTML: (element) => element.getAttribute(\"data-caption\") === \"true\",\n renderHTML: (attributes) => ({\n \"data-caption\": attributes.caption,\n }),\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'video[src*=\"tiptap.dev\"]:not([src^=\"data:\"]), video[src*=\"windows.net\"]:not([src^=\"data:\"])',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n \"video\",\n mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),\n ];\n },\n\n addCommands() {\n return {\n setVideoBlock:\n (attrs) =>\n ({ commands }) => {\n return commands.insertContent({\n type: \"videoBlock\",\n attrs: {\n src: attrs.src,\n poster: attrs.poster,\n assetId: attrs.assetId,\n playlistUrl: attrs.playlistUrl,\n title: attrs.title,\n },\n });\n },\n\n setVideoBlockAt:\n (attrs) =>\n ({ commands }) => {\n return commands.insertContentAt(attrs.pos, {\n type: \"videoBlock\",\n attrs: {\n src: attrs.src,\n poster: attrs.poster,\n assetId: attrs.assetId,\n playlistUrl: attrs.playlistUrl,\n title: attrs.title\n },\n });\n },\n\n setVideoBlockAlign:\n (align) =>\n ({ commands }) =>\n commands.updateAttributes(\"videoBlock\", { align }),\n\n setVideoBlockWidth:\n (width) =>\n ({ commands }) =>\n commands.updateAttributes(\"videoBlock\", {\n width: `${Math.max(0, Math.min(100, width))}%`,\n }),\n\n setVideoBlockCaption:\n (caption) =>\n ({ commands }) =>\n commands.updateAttributes(\"videoBlock\", { caption }),\n };\n },\n\n addNodeView() {\n //@ts-ignore\n return ReactNodeViewRenderer(VideoBlockView);\n },\n});\n\nexport default VideoBlock;\n"],"names":["ReactNodeViewRenderer","mergeAttributes","VideoBlockView","Video","VideoBlock","extend","name","group","defining","isolating","addAttributes","src","default","parseHTML","element","getAttribute","renderHTML","attributes","title","poster","playlistUrl","width","align","alt","undefined","caption","tag","HTMLAttributes","options","addCommands","setVideoBlock","attrs","commands","insertContent","type","assetId","setVideoBlockAt","insertContentAt","pos","setVideoBlockAlign","updateAttributes","setVideoBlockWidth","Math","max","min","setVideoBlockCaption","addNodeView"],"mappings":"AAAA;AAEA,SAASA,qBAAqB,QAAQ,gBAAgB;AACtD,SAASC,eAAe,QAAe,eAAe;AAEtD,SAASC,cAAc,QAAQ,iCAAiC;AAChE,SAASC,KAAK,QAAQ,oBAAoB;AA2B1C,OAAO,MAAMC,aAAaD,MAAME,MAAM,CAAC;IACrCC,MAAM;IAENC,OAAO;IAEPC,UAAU;IAEVC,WAAW;IAEXC;QACE,OAAO;YACLC,KAAK;gBACHC,SAAS;gBACTC,WAAW,CAACC,UAAYA,QAAQC,YAAY,CAAC;gBAC7CC,YAAY,CAACC,aAAgB,CAAA;wBAC3BN,KAAKM,WAAWN,GAAG;oBACrB,CAAA;YACF;YACAO,OAAO;gBACLN,SAAS;gBACTC,WAAW,CAACC,UAAYA,QAAQC,YAAY,CAAC;gBAC7CC,YAAY,CAACC,aAAgB,CAAA;wBAC3BC,OAAOD,WAAWC,KAAK;oBACzB,CAAA;YACF;YACAC,QAAQ;gBACNP,SAAS;gBAC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MpB,GAAG;4BACdQ,QAAQY,MAAMZ,MAAM;4BACpBgB,SAASJ,MAAMI,OAAO;4BACtBf,aAAaW,MAAMX,WAAW;4BAC9BF,OAAOa,MAAMb,KAAK;wBACpB;oBACF;gBACF;YAEFkB,iBACE,CAACL,QACD,CAAC,EAAEC,QAAQ,EAAE;oBACX,OAAOA,SAASK,eAAe,CAACN,MAAMO,GAAG,EAAE;wBACzCJ,MAAM;wBACNH,OAAO;4BACLpB,KAAKoB,MAAMpB,GAAG;4BACdQ,QAAQY,MAAMZ,MAAM;4BACpBgB,SAASJ,MAAMI,OAAO;4BACtBf,aAAaW,MAAMX,WAAW;4BAC9BF,OAAOa,MAAMb,KAAK;wBACpB;oBACF;gBACF;YAEFqB,oBACE,CAACjB,QACD,CAAC,EAAEU,QAAQ,EAAE,GACXA,SAASQ,gBAAgB,CAAC,cAAc;wBAAElB;oBAAM;YAEpDmB,oBACE,CAACpB,QACD,CAAC,EAAEW,QAAQ,EAAE,GACXA,SAASQ,gBAAgB,CAAC,cAAc;wBACtCnB,OAAO,GAAGqB,KAAKC,GAAG,CAAC,GAAGD,KAAKE,GAAG,CAAC,KAAKvB,QAAQ,CAAC,CAAC;oBAChD;YAEJwB,sBACE,CAACpB,UACD,CAAC,EAAEO,QAAQ,EAAE,GACXA,SAASQ,gBAAgB,CAAC,cAAc;wBAAEf;oBAAQ;QACxD;IACF;IAEAqB;QACE,YAAY;QACZ,OAAO9C,sBAAsBE;IAC/B;AACF,GAAG;AAEH,eAAeE,WAAW"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockMenu.tsx"],"sourcesContent":["import { BubbleMenu as BaseBubbleMenu } from \"@tiptap/react\";\nimport { ReactNode, useCallback, useRef } from \"react\";\nimport { Instance, sticky } from \"tippy.js\";\nimport { v4 as uuid } from \"uuid\";\n\nimport {\n AlignHorizontalDistributeCenter,\n AlignHorizontalDistributeEnd,\n AlignHorizontalDistributeStart,\n Pencil,\n PencilOff,\n} from \"lucide-react\";\nimport { MenuProps } from \"../../../features/menus/types.js\";\nimport { Icon } from \"../../../features/ui/Icon.js\";\nimport { Toolbar } from \"../../../features/ui/Toolbar.js\";\nimport { getRenderContainer } from \"../../../lib/utils/index.js\";\nimport { VideoBlockWidth } from \"./VideoBlockWidth.js\";\nimport i18next from \"i18next\";\n\nexport const VideoBlockMenu = ({ editor, appendTo }: MenuProps): ReactNode => {\n const menuRef = useRef<HTMLDivElement>(null);\n const tippyInstance = useRef<Instance | null>(null);\n\n const getReferenceClientRect = useCallback(() => {\n const renderContainer = getRenderContainer(editor, \"node-videoBlock\");\n const rect =\n renderContainer?.getBoundingClientRect() ||\n new DOMRect(-1000, -1000, 0, 0);\n\n return rect;\n }, [editor]);\n\n const shouldShow = useCallback(() => {\n const isActive = editor.isActive(\"videoBlock\");\n\n return isActive;\n }, [editor]);\n\n const onAlignVideoLeft = useCallback(() => {\n editor\n .chain()\n .focus(undefined, { scrollIntoView: false })\n .setVideoBlockAlign(\"left\")\n .run();\n }, [editor]);\n\n const onAlignVideoCenter = useCallback(() => {\n editor\n .chain()\n .focus(undefined, { scrollIntoView: false })\n .setVideoBlockAlign(\"center\")\n .run();\n }, [editor]);\n\n const onAlignVideoRight = useCallback(() => {\n editor\n .chain()\n .focus(undefined, { scrollIntoView: false })\n .setVideoBlockAlign(\"right\")\n .run();\n }, [editor]);\n\n const onHideCaption = useCallback(() => {\n editor\n .chain()\n .focus(undefined, { scrollIntoView: false })\n .setVideoBlockCaption(\n editor.isActive(\"videoBlock\", { caption: false }) ? true : false\n )\n .run();\n }, [editor]);\n\n const onWidthChange = useCallback(\n (value: number) => {\n editor\n .chain()\n .focus(undefined, { scrollIntoView: false })\n .setVideoBlockWidth(value)\n .run();\n },\n [editor]\n );\n\n return (\n <BaseBubbleMenu\n editor={editor}\n pluginKey={`videoBlockMenu-${uuid()}`}\n shouldShow={shouldShow}\n updateDelay={0}\n tippyOptions={{\n offset: [0, 8],\n popperOptions: {\n modifiers: [{ name: \"flip\", enabled: false }],\n },\n getReferenceClientRect,\n onCreate: (instance: Instance) => {\n tippyInstance.current = instance;\n },\n appendTo: () => {\n return appendTo?.current;\n },\n plugins: [sticky],\n sticky: \"popper\",\n }}\n >\n <Toolbar.Wrapper shouldShowContent={shouldShow()} ref={menuRef}>\n <Toolbar.Button\n type=\"button\"\n tooltip={i18next.t(\"toggleCaption\") || \"Hide/Show caption\"}\n active={editor.isActive(\"videoBlock\", { caption: false })}\n onClick={onHideCaption}\n >\n <Icon\n icon={\n editor.isActive(\"videoBlock\", { caption: false })\n ? PencilOff\n : Pencil\n }\n />\n </Toolbar.Button>\n <Toolbar.Button\n type=\"button\"\n tooltip={i18next.t(\"alignVideoLeft\") || \"Align video left\"}\n active={editor.isActive(\"videoBlock\", { align: \"left\" })}\n onClick={onAlignVideoLeft}\n >\n <Icon icon={AlignHorizontalDistributeStart} />\n </Toolbar.Button>\n <Toolbar.Button\n type=\"button\"\n tooltip={i18next.t(\"alignVideoCenter\") || \"Align video center\"}\n active={editor.isActive(\"videoBlock\", { align: \"center\" })}\n onClick={onAlignVideoCenter}\n >\n <Icon icon={AlignHorizontalDistributeCenter} />\n </Toolbar.Button>\n <Toolbar.Button\n type=\"button\"\n tooltip={i18next.t(\"alignVideoRight\") || \"Align video right\"}\n active={editor.isActive(\"videoBlock\", { align: \"right\" })}\n onClick={onAlignVideoRight}\n >\n <Icon icon={AlignHorizontalDistributeEnd} />\n </Toolbar.Button>\n <Toolbar.Divider />\n <VideoBlockWidth\n onChange={onWidthChange}\n value={parseInt(editor.getAttributes(\"videoBlock\").width)}\n />\n </Toolbar.Wrapper>\n </BaseBubbleMenu>\n );\n};\n\nexport default VideoBlockMenu;\n"],"names":["BubbleMenu","BaseBubbleMenu","useCallback","useRef","sticky","v4","uuid","AlignHorizontalDistributeCenter","AlignHorizontalDistributeEnd","AlignHorizontalDistributeStart","Pencil","PencilOff","Icon","Toolbar","getRenderContainer","VideoBlockWidth","i18next","VideoBlockMenu","editor","appendTo","menuRef","tippyInstance","getReferenceClientRect","renderContainer","rect","getBoundingClientRect","DOMRect","shouldShow","isActive","onAlignVideoLeft","chain","focus","undefined","scrollIntoView","setVideoBlockAlign","run","onAlignVideoCenter","onAlignVideoRight","onHideCaption","setVideoBlockCaption","caption","onWidthChange","value","setVideoBlockWidth","pluginKey","updateDelay","tippyOptions","offset","popperOptions","modifiers","name","enabled","onCreate","instance","current","plugins","Wrapper","shouldShowContent","ref","Button","type","tooltip","t","active","onClick","icon","align","Divider","onChange","parseInt","getAttributes","width"],"mappings":";AAAA,SAASA,cAAcC,cAAc,QAAQ,gBAAgB;AAC7D,SAAoBC,WAAW,EAAEC,MAAM,QAAQ,QAAQ;AACvD,SAAmBC,MAAM,QAAQ,WAAW;AAC5C,SAASC,MAAMC,IAAI,QAAQ,OAAO;AAElC,SACEC,+BAA+B,EAC/BC,4BAA4B,EAC5BC,8BAA8B,EAC9BC,MAAM,EACNC,SAAS,QACJ,eAAe;AAEtB,SAASC,IAAI,QAAQ,+BAA+B;AACpD,SAASC,OAAO,QAAQ,kCAAkC;AAC1D,SAASC,kBAAkB,QAAQ,8BAA8B;AACjE,SAASC,eAAe,QAAQ,uBAAuB;AACvD,OAAOC,aAAa,UAAU;AAE9B,OAAO,MAAMC,iBAAiB,CAAC,EAAEC,MAAM,EAAEC,QAAQ,EAAa;IAC5D,MAAMC,UAAUjB,OAAuB;IACvC,MAAMkB,gBAAgBlB,OAAwB;IAE9C,MAAMmB,yBAAyBpB,YAAY;QACzC,MAAMqB,kBAAkBT,mBAAmBI,QAAQ;QACnD,MAAMM,OACJD,iBAAiBE,2BACjB,IAAIC,QAAQ,CAAC,MAAM,CAAC,MAAM,GAAG;QAE/B,OAAOF;IACT,GAAG;QAACN;KAAO;IAEX,MAAMS,aAAazB,YAAY;QAC7B,MAAM0B,WAAWV,OAAOU,QAAQ,CAAC;QAEjC,OAAOA;IACT,GAAG;QAACV;KAAO;IAEX,MAAMW,mBAAmB3B,YAAY;QACnCgB,OACGY,KAAK,GACLC,KAAK,CAACC,WAAW;YAAEC,gBAAgB;QAAM,GACzCC,kBAAkB,CAAC,QACnBC,GAAG;IACR,GAAG;QAACjB;KAAO;IAEX,MAAMkB,qBAAqBlC,YAAY;QACrCgB,OACGY,KAAK,GACLC,KAAK,CAACC,WAAW;YAAEC,gBAAgB;QAAM,GACzCC,kBAAkB,CAAC,UACnBC,GAAG;IACR,GAAG;QAACjB;KAAO;IAEX,MAAMmB,oBAAoBnC,YAAY;QACpCgB,OACGY,KAAK,GACLC,KAAK,CAACC,WAAW;YAAEC,gBAAgB;QAAM,GACzCC,kBAAkB,CAAC,SACnBC,GAAG;IACR,GAAG;QAACjB;KAAO;IAEX,MAAMoB,gBAAgBpC,YAAY;QAChCgB,OACGY,KAAK,GACLC,KAAK,CAACC,WAAW;YAAEC,gBAAgB;QAAM,GACzCM,oBAAoB,CACnBrB,OAAOU,QAAQ,CAAC,cAAc;YAAEY,SAAS;QAAM,KAAK,OAAO,OAE5DL,GAAG;IACR,GAAG;QAACjB;KAAO;IAEX,MAAMuB,gBAAgBvC,YACpB,CAACwC;QACCxB,OACGY,KAAK,GACLC,KAAK,CAACC,WAAW;YAAEC,gBAAgB;QAAM,GACzCU,kBAAkB,CAACD,OACnBP,GAAG;IACR,GACA;QAACjB;KAAO;IAGV,qBACE,KAACjB;QACCiB,QAAQA;QACR0B,WAAW,CAAC,eAAe,EAAEtC,
|
|
1
|
+
{"version":3,"sources":["../../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockMenu.tsx"],"sourcesContent":["import { BubbleMenu as BaseBubbleMenu } from \"@tiptap/react\";\nimport { ReactNode, useCallback, useRef } from \"react\";\nimport { Instance, sticky } from \"tippy.js\";\nimport { v4 as uuid } from \"uuid\";\n\nimport {\n AlignHorizontalDistributeCenter,\n AlignHorizontalDistributeEnd,\n AlignHorizontalDistributeStart,\n Pencil,\n PencilOff,\n} from \"lucide-react\";\nimport { MenuProps } from \"../../../features/menus/types.js\";\nimport { Icon } from \"../../../features/ui/Icon.js\";\nimport { Toolbar } from \"../../../features/ui/Toolbar.js\";\nimport { getRenderContainer } from \"../../../lib/utils/index.js\";\nimport { VideoBlockWidth } from \"./VideoBlockWidth.js\";\nimport i18next from \"i18next\";\n\nexport const VideoBlockMenu = ({ editor, appendTo }: MenuProps): ReactNode => {\n const menuRef = useRef<HTMLDivElement>(null);\n const tippyInstance = useRef<Instance | null>(null);\n\n const getReferenceClientRect = useCallback(() => {\n const renderContainer = getRenderContainer(editor, \"node-videoBlock\");\n const rect =\n renderContainer?.getBoundingClientRect() ||\n new DOMRect(-1000, -1000, 0, 0);\n\n return rect;\n }, [editor]);\n\n const shouldShow = useCallback(() => {\n const isActive = editor.isActive(\"videoBlock\");\n\n return isActive;\n }, [editor]);\n\n const onAlignVideoLeft = useCallback(() => {\n editor\n .chain()\n .focus(undefined, { scrollIntoView: false })\n .setVideoBlockAlign(\"left\")\n .run();\n }, [editor]);\n\n const onAlignVideoCenter = useCallback(() => {\n editor\n .chain()\n .focus(undefined, { scrollIntoView: false })\n .setVideoBlockAlign(\"center\")\n .run();\n }, [editor]);\n\n const onAlignVideoRight = useCallback(() => {\n editor\n .chain()\n .focus(undefined, { scrollIntoView: false })\n .setVideoBlockAlign(\"right\")\n .run();\n }, [editor]);\n\n const onHideCaption = useCallback(() => {\n editor\n .chain()\n .focus(undefined, { scrollIntoView: false })\n .setVideoBlockCaption(\n editor.isActive(\"videoBlock\", { caption: false }) ? true : false\n )\n .run();\n }, [editor]);\n\n const onWidthChange = useCallback(\n (value: number) => {\n editor\n .chain()\n .focus(undefined, { scrollIntoView: false })\n .setVideoBlockWidth(value)\n .run();\n },\n [editor]\n );\n\n return (\n <BaseBubbleMenu\n editor={editor}\n pluginKey={`videoBlockMenu-${uuid()}`}\n shouldShow={shouldShow}\n updateDelay={0}\n tippyOptions={{\n offset: [0, 8],\n popperOptions: {\n modifiers: [{ name: \"flip\", enabled: false }],\n },\n getReferenceClientRect,\n onCreate: (instance: Instance) => {\n tippyInstance.current = instance;\n },\n appendTo: () => {\n return appendTo?.current;\n },\n plugins: [sticky],\n sticky: \"popper\",\n }}\n >\n <Toolbar.Wrapper shouldShowContent={shouldShow()} ref={menuRef}>\n <Toolbar.Button\n type=\"button\"\n tooltip={i18next.t(\"toggleCaption\") || \"Hide/Show caption\"}\n active={editor.isActive(\"videoBlock\", { caption: false })}\n onClick={onHideCaption}\n >\n <Icon\n icon={\n editor.isActive(\"videoBlock\", { caption: false })\n ? PencilOff\n : Pencil\n }\n />\n </Toolbar.Button>\n <Toolbar.Button\n type=\"button\"\n tooltip={i18next.t(\"alignVideoLeft\") || \"Align video left\"}\n active={editor.isActive(\"videoBlock\", { align: \"left\" })}\n onClick={onAlignVideoLeft}\n >\n <Icon icon={AlignHorizontalDistributeStart} />\n </Toolbar.Button>\n <Toolbar.Button\n type=\"button\"\n tooltip={i18next.t(\"alignVideoCenter\") || \"Align video center\"}\n active={editor.isActive(\"videoBlock\", { align: \"center\" })}\n onClick={onAlignVideoCenter}\n >\n <Icon icon={AlignHorizontalDistributeCenter} />\n </Toolbar.Button>\n <Toolbar.Button\n type=\"button\"\n tooltip={i18next.t(\"alignVideoRight\") || \"Align video right\"}\n active={editor.isActive(\"videoBlock\", { align: \"right\" })}\n onClick={onAlignVideoRight}\n >\n <Icon icon={AlignHorizontalDistributeEnd} />\n </Toolbar.Button>\n <Toolbar.Divider />\n <VideoBlockWidth\n onChange={onWidthChange}\n value={parseInt(editor.getAttributes(\"videoBlock\").width)}\n />\n </Toolbar.Wrapper>\n </BaseBubbleMenu>\n );\n};\n\nexport default VideoBlockMenu;\n"],"names":["BubbleMenu","BaseBubbleMenu","useCallback","useRef","sticky","v4","uuid","AlignHorizontalDistributeCenter","AlignHorizontalDistributeEnd","AlignHorizontalDistributeStart","Pencil","PencilOff","Icon","Toolbar","getRenderContainer","VideoBlockWidth","i18next","VideoBlockMenu","editor","appendTo","menuRef","tippyInstance","getReferenceClientRect","renderContainer","rect","getBoundingClientRect","DOMRect","shouldShow","isActive","onAlignVideoLeft","chain","focus","undefined","scrollIntoView","setVideoBlockAlign","run","onAlignVideoCenter","onAlignVideoRight","onHideCaption","setVideoBlockCaption","caption","onWidthChange","value","setVideoBlockWidth","pluginKey","updateDelay","tippyOptions","offset","popperOptions","modifiers","name","enabled","onCreate","instance","current","plugins","Wrapper","shouldShowContent","ref","Button","type","tooltip","t","active","onClick","icon","align","Divider","onChange","parseInt","getAttributes","width"],"mappings":";AAAA,SAASA,cAAcC,cAAc,QAAQ,gBAAgB;AAC7D,SAAoBC,WAAW,EAAEC,MAAM,QAAQ,QAAQ;AACvD,SAAmBC,MAAM,QAAQ,WAAW;AAC5C,SAASC,MAAMC,IAAI,QAAQ,OAAO;AAElC,SACEC,+BAA+B,EAC/BC,4BAA4B,EAC5BC,8BAA8B,EAC9BC,MAAM,EACNC,SAAS,QACJ,eAAe;AAEtB,SAASC,IAAI,QAAQ,+BAA+B;AACpD,SAASC,OAAO,QAAQ,kCAAkC;AAC1D,SAASC,kBAAkB,QAAQ,8BAA8B;AACjE,SAASC,eAAe,QAAQ,uBAAuB;AACvD,OAAOC,aAAa,UAAU;AAE9B,OAAO,MAAMC,iBAAiB,CAAC,EAAEC,MAAM,EAAEC,QAAQ,EAAa;IAC5D,MAAMC,UAAUjB,OAAuB;IACvC,MAAMkB,gBAAgBlB,OAAwB;IAE9C,MAAMmB,yBAAyBpB,YAAY;QACzC,MAAMqB,kBAAkBT,mBAAmBI,QAAQ;QACnD,MAAMM,OACJD,iBAAiBE,2BACjB,IAAIC,QAAQ,CAAC,MAAM,CAAC,MAAM,GAAG;QAE/B,OAAOF;IACT,GAAG;QAACN;KAAO;IAEX,MAAMS,aAAazB,YAAY;QAC7B,MAAM0B,WAAWV,OAAOU,QAAQ,CAAC;QAEjC,OAAOA;IACT,GAAG;QAACV;KAAO;IAEX,MAAMW,mBAAmB3B,YAAY;QACn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C,mBAAmB9B;YAAc+B,KAAKtC;;8BACrD,KAACP,QAAQ8C,MAAM;oBACbC,MAAK;oBACLC,SAAS7C,QAAQ8C,CAAC,CAAC,oBAAoB;oBACvCC,QAAQ7C,OAAOU,QAAQ,CAAC,cAAc;wBAAEY,SAAS;oBAAM;oBACvDwB,SAAS1B;8BAET,cAAA,KAAC1B;wBACCqD,MACE/C,OAAOU,QAAQ,CAAC,cAAc;4BAAEY,SAAS;wBAAM,KAC3C7B,YACAD;;;8BAIV,KAACG,QAAQ8C,MAAM;oBACbC,MAAK;oBACLC,SAAS7C,QAAQ8C,CAAC,CAAC,qBAAqB;oBACxCC,QAAQ7C,OAAOU,QAAQ,CAAC,cAAc;wBAAEsC,OAAO;oBAAO;oBACtDF,SAASnC;8BAET,cAAA,KAACjB;wBAAKqD,MAAMxD;;;8BAEd,KAACI,QAAQ8C,MAAM;oBACbC,MAAK;oBACLC,SAAS7C,QAAQ8C,CAAC,CAAC,uBAAuB;oBAC1CC,QAAQ7C,OAAOU,QAAQ,CAAC,cAAc;wBAAEsC,OAAO;oBAAS;oBACxDF,SAAS5B;8BAET,cAAA,KAACxB;wBAAKqD,MAAM1D;;;8BAEd,KAACM,QAAQ8C,MAAM;oBACbC,MAAK;oBACLC,SAAS7C,QAAQ8C,CAAC,CAAC,sBAAsB;oBACzCC,QAAQ7C,OAAOU,QAAQ,CAAC,cAAc;wBAAEsC,OAAO;oBAAQ;oBACvDF,SAAS3B;8BAET,cAAA,KAACzB;wBAAKqD,MAAMzD;;;8BAEd,KAACK,QAAQsD,OAAO;8BAChB,KAACpD;oBACCqD,UAAU3B;oBACVC,OAAO2B,SAASnD,OAAOoD,aAAa,CAAC,cAAcC,KAAK;;;;;AAKlE,EAAE;AAEF,eAAetD,eAAe"}
|
|
@@ -6,7 +6,7 @@ import VideoPlayer from "./videojs/VideoPlayer.js";
|
|
|
6
6
|
export const VideoBlockView = (props)=>{
|
|
7
7
|
const { editor, getPos, node } = props;
|
|
8
8
|
const videoWrapperRef = useRef(null);
|
|
9
|
-
const { src, poster, playlistUrl, caption } = node.attrs;
|
|
9
|
+
const { src, poster, playlistUrl, caption, title } = node.attrs;
|
|
10
10
|
const [playlistContent, setPlaylistContent] = React.useState();
|
|
11
11
|
const [error, setError] = React.useState();
|
|
12
12
|
useEffect(()=>{
|
|
@@ -67,7 +67,6 @@ export const VideoBlockView = (props)=>{
|
|
|
67
67
|
width: node.attrs.width
|
|
68
68
|
},
|
|
69
69
|
children: /*#__PURE__*/ _jsxs("div", {
|
|
70
|
-
contentEditable: false,
|
|
71
70
|
ref: videoWrapperRef,
|
|
72
71
|
children: [
|
|
73
72
|
error && /*#__PURE__*/ _jsx("div", {
|
|
@@ -78,7 +77,7 @@ export const VideoBlockView = (props)=>{
|
|
|
78
77
|
}),
|
|
79
78
|
caption && playlistContent?.title && /*#__PURE__*/ _jsx("caption", {
|
|
80
79
|
className: "text-center block text-sm text-gray-500",
|
|
81
|
-
children: playlistContent?.title
|
|
80
|
+
children: title || playlistContent?.title
|
|
82
81
|
})
|
|
83
82
|
]
|
|
84
83
|
})
|
|
@@ -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\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
|
|
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, title } = 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 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 {title || 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","title","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","ref","options"],"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,EAAEC,KAAK,EAAE,GAAGN,KAAKO,KAAK;IAC/D,MAAM,CAACC,iBAAiBC,mBAAmB,GAAGpB,MAAMqB,QAAQ;IAG5D,MAAM,CAACC,OAAOC,SAAS,GAAGvB,MAAMqB,QAAQ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oBACb8B,MAAMD,KAAKC,IAAI;oBACfI,OAAOL,KAAKK,KAAK;gBACnB,CAAA;YACAjC,QAAQK,gBAAgBL,MAAM;QAChC;IACF,GAAG;QAACK;KAAgB;IACpB,qBACE,KAACpB;kBACC,cAAA,KAACiD;YAAIC,WAAWhB;YAAkBiB,OAAO;gBAAEC,OAAOxC,KAAKO,KAAK,CAACiC,KAAK;YAAC;sBACjE,cAAA,MAACH;gBAAII,KAAKxC;;oBACPU,uBAAS,KAAC0B;kCAAK1B;;oBASfH,iCAAmB,KAACb;wBAAY+C,SAASf;;oBACzCtB,WAAWG,iBAAiBF,uBAC3B,KAACD;wBAAQiC,WAAU;kCAChBhC,SAASE,iBAAiBF;;;;;;AAOzC,EAAE;AAEF,eAAeV,eAAe"}
|
package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockViewClientside.js
CHANGED
|
@@ -62,7 +62,6 @@ export const VideoBlockViewClientside = ({ className, ...props })=>{
|
|
|
62
62
|
width: node.attrs.width
|
|
63
63
|
},
|
|
64
64
|
children: /*#__PURE__*/ _jsxs("div", {
|
|
65
|
-
contentEditable: false,
|
|
66
65
|
ref: videoWrapperRef,
|
|
67
66
|
children: [
|
|
68
67
|
error && /*#__PURE__*/ _jsx("div", {
|
|
@@ -71,7 +70,7 @@ export const VideoBlockViewClientside = ({ className, ...props })=>{
|
|
|
71
70
|
playlistContent && /*#__PURE__*/ _jsx(VideoPlayer, {
|
|
72
71
|
options: videoJsOptions
|
|
73
72
|
}),
|
|
74
|
-
caption && playlistContent?.title && /*#__PURE__*/ _jsx("
|
|
73
|
+
caption && playlistContent?.title && /*#__PURE__*/ _jsx("div", {
|
|
75
74
|
className: "text-center block text-sm text-gray-500",
|
|
76
75
|
children: playlistContent?.title
|
|
77
76
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockViewClientside.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 className?: string;\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 VideoBlockViewClientside = ({\n className,\n ...props\n}: VideoBlockViewProps) => {\n const { 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 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 className={className}>\n <div className={wrapperClassName} style={{ width: node.attrs.width }}>\n <div
|
|
1
|
+
{"version":3,"sources":["../../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockViewClientside.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 className?: string;\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 VideoBlockViewClientside = ({\n className,\n ...props\n}: VideoBlockViewProps) => {\n const { 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 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 className={className}>\n <div className={wrapperClassName} style={{ width: node.attrs.width }}>\n <div 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 <div className=\"text-center block text-sm text-gray-500\">\n {playlistContent?.title}\n </div>\n )}\n </div>\n </div>\n </NodeViewWrapper>\n );\n};\n\nexport default VideoBlockViewClientside;\n"],"names":["NodeViewWrapper","React","useEffect","useMemo","useRef","cn","VideoPlayer","VideoBlockViewClientside","className","props","node","videoWrapperRef","src","poster","playlistUrl","caption","attrs","playlistContent","setPlaylistContent","useState","error","setError","getPlaylistContent","res","fetch","cache","json","then","data","catch","err","wrapperClassName","align","videoJsOptions","undefined","items","some","item","type","sources","filter","map","label","div","style","width","ref","options","title"],"mappings":";AACA,SAAiBA,eAAe,QAAQ,gBAAgB;AACxD,OAAOC,SAAsBC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,QAAQ;AACvE,SAASC,EAAE,QAAQ,8BAA8B;AACjD,OAAOC,iBAAiB,2BAA2B;AAiCnD,OAAO,MAAMC,2BAA2B,CAA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,OAAOL,KAAKK,KAAK;oBACnB,CAAA;gBACF7B,QAAQI,gBAAgBJ,MAAM;YAChC;QACF;QACA,OAAO;YACL0B,SAAStB,gBAAgBkB,KAAK,CAACM,GAAG,CAAC,CAACJ,OAAU,CAAA;oBAC5CzB,KAAKyB,KAAKzB,GAAG;oBACb0B,MAAMD,KAAKC,IAAI;oBACfI,OAAOL,KAAKK,KAAK;gBACnB,CAAA;YACA7B,QAAQI,gBAAgBJ,MAAM;QAChC;IACF,GAAG;QAACI;KAAgB;IACpB,qBACE,KAACjB;QAAgBQ,WAAWA;kBAC1B,cAAA,KAACmC;YAAInC,WAAWuB;YAAkBa,OAAO;gBAAEC,OAAOnC,KAAKM,KAAK,CAAC6B,KAAK;YAAC;sBACjE,cAAA,MAACF;gBAAIG,KAAKnC;;oBACPS,uBAAS,KAACuB;kCAAKvB;;oBASfH,iCAAmB,KAACX;wBAAYyC,SAASd;;oBACzClB,WAAWE,iBAAiB+B,uBAC3B,KAACL;wBAAInC,WAAU;kCACZS,iBAAiB+B;;;;;;AAOhC,EAAE;AAEF,eAAezC,yBAAyB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/quality-selector/events.js"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/quality-selector/events.js"],"names":[],"mappings":"AAAA,gCAAiC,kBAAkB,CAAC;AACpD,+BAAgC,iBAAiB,CAAC;AAClD,qCAAsC,sBAAsB,CAAC"}
|
|
@@ -3,6 +3,6 @@ interface ExtensionKitProps {
|
|
|
3
3
|
openAssetHQHandler: openAssetHQType;
|
|
4
4
|
dir?: "ltr" | "rtl";
|
|
5
5
|
}
|
|
6
|
-
export declare const ExtensionKit: ({ dir, openAssetHQHandler, }: ExtensionKitProps) => (import("@tiptap/core").
|
|
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>)[];
|
|
7
7
|
export default ExtensionKit;
|
|
8
8
|
//# sourceMappingURL=extension-kit.d.ts.map
|
package/dist/src/fields/TiptapEditor/extensions/serverside/EmbedContentInlineRenderer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/serverside/EmbedContentInlineRenderer.tsx"],"sourcesContent":["\"use client\";\n\nimport { Portal } from \"@radix-ui/react-portal\";\nimport { ComponentProps, memo, useEffect, useState } from \"react\";\n\nimport { renderEmbedContent } from \"./RenderEmbedClientSide.js\";\n\nconst CustomPortal = memo(\n ({ content, ...props }: ComponentProps<typeof Portal>) => {\n useEffect(() => {}, []);\n return <Portal {...props}>{renderEmbedContent(content)}</Portal>;\n }\n);\n\nexport function EmbedContentInlineRenderer({ body }) {\n const [mounted, setMounted] = useState(false);\n useEffect(() => {\n setMounted(true);\n }, []);\n\n if (!mounted) return null;\n return (\n <>\n {body.content\n .filter((content) => content?.attrs?.[\"data-id\"])\n .map((content) => {\n return (\n <CustomPortal\n key={`embed-content-inline-${content.attrs[\"data-id\"]}-${content.attrs.key}`}\n container={document?.querySelector(\n `[data-id='${content.attrs[\"data-id\"]}']`\n )}\n content={content}\n />\n );\n })}\n </>\n );\n}\n"],"names":["Portal","memo","useEffect","useState","renderEmbedContent","CustomPortal","content","props","EmbedContentInlineRenderer","body","mounted","setMounted","filter","attrs","map","container","document","querySelector","key"],"mappings":"AAAA;;AAEA,SAASA,MAAM,QAAQ,yBAAyB;AAChD,SAAyBC,IAAI,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,QAAQ;AAElE,SAASC,kBAAkB,QAAQ,6BAA6B;AAEhE,MAAMC,6BAAeJ,KACnB,CAAC,EAAEK,OAAO,EAAE,GAAGC,OAAsC;IACnDL,UAAU,KAAO,GAAG,EAAE;IACtB,qBAAO,KAACF;QAAQ,GAAGO,KAAK;kBAAGH,mBAAmBE;;AAChD;AAGF,OAAO,SAASE,2BAA2B,EAAEC,IAAI,EAAE;IACjD,MAAM,CAACC,SAASC,WAAW,GAAGR,SAAS;IACvCD,UAAU;QACRS,WAAW;IACb,GAAG,EAAE;IAEL,IAAI,CAACD,SAAS,OAAO;IACrB,qBACE;kBACGD,KAAKH,OAAO,CACVM,MAAM,CAAC,CAACN,UAAYA,SAASO,OAAO,CAAC,UAAU,EAC/CC,GAAG,CAAC,CAACR;YACJ,qBACE,KAACD;gBAECU,WAAWC,UAAUC,cACnB,CAAC,UAAU,EAAEX,QAAQO,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC;gBAE3CP,SAASA;eAJJ,CAAC,qBAAqB,EAAEA,QAAQO,KAAK,CAAC,UAAU,CAAC,CAAC,EAAEP,QAAQO,KAAK,CAACK,GAAG,
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/serverside/EmbedContentInlineRenderer.tsx"],"sourcesContent":["\"use client\";\n\nimport { Portal } from \"@radix-ui/react-portal\";\nimport { ComponentProps, memo, useEffect, useState } from \"react\";\n\nimport { renderEmbedContent } from \"./RenderEmbedClientSide.js\";\n\nconst CustomPortal = memo(\n ({ content, ...props }: ComponentProps<typeof Portal>) => {\n useEffect(() => {}, []);\n return <Portal {...props}>{renderEmbedContent(content)}</Portal>;\n }\n);\n\nexport function EmbedContentInlineRenderer({ body }) {\n const [mounted, setMounted] = useState(false);\n useEffect(() => {\n setMounted(true);\n }, []);\n\n if (!mounted) return null;\n return (\n <>\n {body.content\n .filter((content) => content?.attrs?.[\"data-id\"])\n .map((content) => {\n return (\n <CustomPortal\n key={`embed-content-inline-${content.attrs[\"data-id\"]}-${content.attrs.key}`}\n container={document?.querySelector(\n `[data-id='${content.attrs[\"data-id\"]}']`\n )}\n content={content}\n />\n );\n })}\n </>\n );\n}\n"],"names":["Portal","memo","useEffect","useState","renderEmbedContent","CustomPortal","content","props","EmbedContentInlineRenderer","body","mounted","setMounted","filter","attrs","map","container","document","querySelector","key"],"mappings":"AAAA;;AAEA,SAASA,MAAM,QAAQ,yBAAyB;AAChD,SAAyBC,IAAI,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,QAAQ;AAElE,SAASC,kBAAkB,QAAQ,6BAA6B;AAEhE,MAAMC,6BAAeJ,KACnB,CAAC,EAAEK,OAAO,EAAE,GAAGC,OAAsC;IACnDL,UAAU,KAAO,GAAG,EAAE;IACtB,qBAAO,KAACF;QAAQ,GAAGO,KAAK;kBAAGH,mBAAmBE;;AAChD;AAGF,OAAO,SAASE,2BAA2B,EAAEC,IAAI,EAAE;IACjD,MAAM,CAACC,SAASC,WAAW,GAAGR,SAAS;IACvCD,UAAU;QACRS,WAAW;IACb,GAAG,EAAE;IAEL,IAAI,CAACD,SAAS,OAAO;IACrB,qBACE;kBACGD,KAAKH,OAAO,CACVM,MAAM,CAAC,CAACN,UAAYA,SAASO,OAAO,CAAC,UAAU,EAC/CC,GAAG,CAAC,CAACR;YACJ,qBACE,KAACD;gBAECU,WAAWC,UAAUC,cACnB,CAAC,UAAU,EAAEX,QAAQO,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC;gBAE3CP,SAASA;eAJJ,CAAC,qBAAqB,EAAEA,QAAQO,KAAK,CAAC,UAAU,CAAC,CAAC,EAAEP,QAAQO,KAAK,CAACK,GAAG,EAAE;QAOlF;;AAGR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/serverside/EmbedContentSideRenderer.tsx"],"sourcesContent":["\"use client\";\n\nimport { Portal } from \"@radix-ui/react-portal\";\nimport { ComponentProps, memo, useEffect, useState } from \"react\";\n\nimport { renderEmbedContent } from \"./RenderEmbedClientSide.js\";\n\nconst CustomPortal = memo(\n ({ content, ...props }: ComponentProps<typeof Portal>) => {\n useEffect(() => {}, []);\n return <Portal {...props}>{renderEmbedContent(content)}</Portal>;\n }\n);\n\nexport function EmbedContentSideRenderer({ body }) {\n const [mounted, setMounted] = useState(false);\n useEffect(() => {\n setMounted(true);\n }, []);\n\n if (!mounted) return null;\n return (\n <>\n {body.content\n .filter((content) => content?.attrs?.[\"data-id\"])\n .filter((content) => content?.attrs?.side)\n .map((content) => {\n return (\n <CustomPortal\n key={`embed-content-side-${content.attrs[\"data-id\"]}-${content.attrs.key}`}\n container={document?.querySelector(\n `[data-id='${content.attrs[\"data-id\"]}']`\n )}\n content={content}\n />\n );\n })}\n </>\n );\n}\n"],"names":["Portal","memo","useEffect","useState","renderEmbedContent","CustomPortal","content","props","EmbedContentSideRenderer","body","mounted","setMounted","filter","attrs","side","map","container","document","querySelector","key"],"mappings":"AAAA;;AAEA,SAASA,MAAM,QAAQ,yBAAyB;AAChD,SAAyBC,IAAI,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,QAAQ;AAElE,SAASC,kBAAkB,QAAQ,6BAA6B;AAEhE,MAAMC,6BAAeJ,KACnB,CAAC,EAAEK,OAAO,EAAE,GAAGC,OAAsC;IACnDL,UAAU,KAAO,GAAG,EAAE;IACtB,qBAAO,KAACF;QAAQ,GAAGO,KAAK;kBAAGH,mBAAmBE;;AAChD;AAGF,OAAO,SAASE,yBAAyB,EAAEC,IAAI,EAAE;IAC/C,MAAM,CAACC,SAASC,WAAW,GAAGR,SAAS;IACvCD,UAAU;QACRS,WAAW;IACb,GAAG,EAAE;IAEL,IAAI,CAACD,SAAS,OAAO;IACrB,qBACE;kBACGD,KAAKH,OAAO,CACVM,MAAM,CAAC,CAACN,UAAYA,SAASO,OAAO,CAAC,UAAU,EAC/CD,MAAM,CAAC,CAACN,UAAYA,SAASO,OAAOC,MACpCC,GAAG,CAAC,CAACT;YACJ,qBACE,KAACD;gBAECW,WAAWC,UAAUC,cACnB,CAAC,UAAU,EAAEZ,QAAQO,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC;gBAE3CP,SAASA;eAJJ,CAAC,mBAAmB,EAAEA,QAAQO,KAAK,CAAC,UAAU,CAAC,CAAC,EAAEP,QAAQO,KAAK,CAACM,GAAG,
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/serverside/EmbedContentSideRenderer.tsx"],"sourcesContent":["\"use client\";\n\nimport { Portal } from \"@radix-ui/react-portal\";\nimport { ComponentProps, memo, useEffect, useState } from \"react\";\n\nimport { renderEmbedContent } from \"./RenderEmbedClientSide.js\";\n\nconst CustomPortal = memo(\n ({ content, ...props }: ComponentProps<typeof Portal>) => {\n useEffect(() => {}, []);\n return <Portal {...props}>{renderEmbedContent(content)}</Portal>;\n }\n);\n\nexport function EmbedContentSideRenderer({ body }) {\n const [mounted, setMounted] = useState(false);\n useEffect(() => {\n setMounted(true);\n }, []);\n\n if (!mounted) return null;\n return (\n <>\n {body.content\n .filter((content) => content?.attrs?.[\"data-id\"])\n .filter((content) => content?.attrs?.side)\n .map((content) => {\n return (\n <CustomPortal\n key={`embed-content-side-${content.attrs[\"data-id\"]}-${content.attrs.key}`}\n container={document?.querySelector(\n `[data-id='${content.attrs[\"data-id\"]}']`\n )}\n content={content}\n />\n );\n })}\n </>\n );\n}\n"],"names":["Portal","memo","useEffect","useState","renderEmbedContent","CustomPortal","content","props","EmbedContentSideRenderer","body","mounted","setMounted","filter","attrs","side","map","container","document","querySelector","key"],"mappings":"AAAA;;AAEA,SAASA,MAAM,QAAQ,yBAAyB;AAChD,SAAyBC,IAAI,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,QAAQ;AAElE,SAASC,kBAAkB,QAAQ,6BAA6B;AAEhE,MAAMC,6BAAeJ,KACnB,CAAC,EAAEK,OAAO,EAAE,GAAGC,OAAsC;IACnDL,UAAU,KAAO,GAAG,EAAE;IACtB,qBAAO,KAACF;QAAQ,GAAGO,KAAK;kBAAGH,mBAAmBE;;AAChD;AAGF,OAAO,SAASE,yBAAyB,EAAEC,IAAI,EAAE;IAC/C,MAAM,CAACC,SAASC,WAAW,GAAGR,SAAS;IACvCD,UAAU;QACRS,WAAW;IACb,GAAG,EAAE;IAEL,IAAI,CAACD,SAAS,OAAO;IACrB,qBACE;kBACGD,KAAKH,OAAO,CACVM,MAAM,CAAC,CAACN,UAAYA,SAASO,OAAO,CAAC,UAAU,EAC/CD,MAAM,CAAC,CAACN,UAAYA,SAASO,OAAOC,MACpCC,GAAG,CAAC,CAACT;YACJ,qBACE,KAACD;gBAECW,WAAWC,UAAUC,cACnB,CAAC,UAAU,EAAEZ,QAAQO,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC;gBAE3CP,SAASA;eAJJ,CAAC,mBAAmB,EAAEA,QAAQO,KAAK,CAAC,UAAU,CAAC,CAAC,EAAEP,QAAQO,KAAK,CAACM,GAAG,EAAE;QAOhF;;AAGR"}
|
package/dist/src/fields/TiptapEditor/extensions/serverside/EmbedContentSidebarRenderer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/serverside/EmbedContentSidebarRenderer.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef, useState } from \"react\";\nimport { renderEmbedContent } from \"./RenderEmbedClientSide.js\";\nconst HEIGHT = 320;\n\nfunction getContainerElement(containerId) {\n if (typeof window === \"undefined\" || !containerId) return null;\n return document.getElementById(containerId);\n}\n\nexport function EmbedContentSidebarRenderer({ body, containerId }) {\n const [mounted, setMounted] = useState(false);\n useEffect(() => {\n setTimeout(() => {\n setMounted(true);\n }, 200);\n }, []);\n const containerEl = useRef(getContainerElement(containerId));\n if (!mounted || typeof window === \"undefined\") return null;\n if (!containerEl.current) {\n containerEl.current = getContainerElement(containerId);\n }\n let lastRenderedPixel =\n containerEl.current?.getBoundingClientRect()?.top + window.scrollY ||\n window.innerHeight;\n\n return (\n <>\n {body.content\n .filter((content) => content?.attrs?.[\"data-id\"])\n .filter((content) => content?.attrs?.side)\n .map((content) => {\n const el = document?.querySelector(\n `[data-id='${content.attrs[\"data-id\"]}']`\n );\n const relativeTopPosition = el.getBoundingClientRect().top;\n const topPosition = relativeTopPosition + window.scrollY;\n\n const tempBottomPixel = lastRenderedPixel;\n\n const marginTop = Math.max(\n 8,\n topPosition - tempBottomPixel - HEIGHT / 2\n );\n lastRenderedPixel = topPosition + HEIGHT;\n console.log(\n topPosition,\n tempBottomPixel,\n marginTop,\n window.innerHeight\n );\n return (\n <div\n key={`embed-content-sidebar-${content.attrs[\"data-id\"]}-${content.attrs.key}`}\n className=\"w-full\"\n style={{ marginTop }}\n >\n {renderEmbedContent(content)}\n </div>\n );\n })}\n </>\n );\n}\n"],"names":["useEffect","useRef","useState","renderEmbedContent","HEIGHT","getContainerElement","containerId","window","document","getElementById","EmbedContentSidebarRenderer","body","mounted","setMounted","setTimeout","containerEl","current","lastRenderedPixel","getBoundingClientRect","top","scrollY","innerHeight","content","filter","attrs","side","map","el","querySelector","relativeTopPosition","topPosition","tempBottomPixel","marginTop","Math","max","console","log","div","className","style","key"],"mappings":"AAAA;;AAEA,SAASA,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AACpD,SAASC,kBAAkB,QAAQ,6BAA6B;AAChE,MAAMC,SAAS;AAEf,SAASC,oBAAoBC,WAAW;IACtC,IAAI,OAAOC,WAAW,eAAe,CAACD,aAAa,OAAO;IAC1D,OAAOE,SAASC,cAAc,CAACH;AACjC;AAEA,OAAO,SAASI,4BAA4B,EAAEC,IAAI,EAAEL,WAAW,EAAE;IAC/D,MAAM,CAACM,SAASC,WAAW,GAAGX,SAAS;IACvCF,UAAU;QACRc,WAAW;YACTD,WAAW;QACb,GAAG;IACL,GAAG,EAAE;IACL,MAAME,cAAcd,OAAOI,oBAAoBC;IAC/C,IAAI,CAACM,WAAW,OAAOL,WAAW,aAAa,OAAO;IACtD,IAAI,CAACQ,YAAYC,OAAO,EAAE;QACxBD,YAAYC,OAAO,GAAGX,oBAAoBC;IAC5C;IACA,IAAIW,oBACFF,YAAYC,OAAO,EAAEE,yBAAyBC,MAAMZ,OAAOa,OAAO,IAClEb,OAAOc,WAAW;IAEpB,qBACE;kBACGV,KAAKW,OAAO,CACVC,MAAM,CAAC,CAACD,UAAYA,SAASE,OAAO,CAAC,UAAU,EAC/CD,MAAM,CAAC,CAACD,UAAYA,SAASE,OAAOC,MACpCC,GAAG,CAAC,CAACJ;YACJ,MAAMK,KAAKnB,UAAUoB,cACnB,CAAC,UAAU,EAAEN,QAAQE,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC;YAE3C,MAAMK,sBAAsBF,GAAGT,qBAAqB,GAAGC,GAAG;YAC1D,MAAMW,cAAcD,sBAAsBtB,OAAOa,OAAO;YAExD,MAAMW,kBAAkBd;YAExB,MAAMe,YAAYC,KAAKC,GAAG,CACxB,GACAJ,cAAcC,kBAAkB3B,SAAS;YAE3Ca,oBAAoBa,cAAc1B;YAClC+B,QAAQC,GAAG,CACTN,aACAC,iBACAC,WACAzB,OAAOc,WAAW;YAEpB,qBACE,KAACgB;gBAECC,WAAU;gBACVC,OAAO;oBAAEP;gBAAU;0BAElB7B,mBAAmBmB;eAJf,CAAC,sBAAsB,EAAEA,QAAQE,KAAK,CAAC,UAAU,CAAC,CAAC,EAAEF,QAAQE,KAAK,CAACgB,GAAG,
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/serverside/EmbedContentSidebarRenderer.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef, useState } from \"react\";\nimport { renderEmbedContent } from \"./RenderEmbedClientSide.js\";\nconst HEIGHT = 320;\n\nfunction getContainerElement(containerId) {\n if (typeof window === \"undefined\" || !containerId) return null;\n return document.getElementById(containerId);\n}\n\nexport function EmbedContentSidebarRenderer({ body, containerId }) {\n const [mounted, setMounted] = useState(false);\n useEffect(() => {\n setTimeout(() => {\n setMounted(true);\n }, 200);\n }, []);\n const containerEl = useRef(getContainerElement(containerId));\n if (!mounted || typeof window === \"undefined\") return null;\n if (!containerEl.current) {\n containerEl.current = getContainerElement(containerId);\n }\n let lastRenderedPixel =\n containerEl.current?.getBoundingClientRect()?.top + window.scrollY ||\n window.innerHeight;\n\n return (\n <>\n {body.content\n .filter((content) => content?.attrs?.[\"data-id\"])\n .filter((content) => content?.attrs?.side)\n .map((content) => {\n const el = document?.querySelector(\n `[data-id='${content.attrs[\"data-id\"]}']`\n );\n const relativeTopPosition = el.getBoundingClientRect().top;\n const topPosition = relativeTopPosition + window.scrollY;\n\n const tempBottomPixel = lastRenderedPixel;\n\n const marginTop = Math.max(\n 8,\n topPosition - tempBottomPixel - HEIGHT / 2\n );\n lastRenderedPixel = topPosition + HEIGHT;\n console.log(\n topPosition,\n tempBottomPixel,\n marginTop,\n window.innerHeight\n );\n return (\n <div\n key={`embed-content-sidebar-${content.attrs[\"data-id\"]}-${content.attrs.key}`}\n className=\"w-full\"\n style={{ marginTop }}\n >\n {renderEmbedContent(content)}\n </div>\n );\n })}\n </>\n );\n}\n"],"names":["useEffect","useRef","useState","renderEmbedContent","HEIGHT","getContainerElement","containerId","window","document","getElementById","EmbedContentSidebarRenderer","body","mounted","setMounted","setTimeout","containerEl","current","lastRenderedPixel","getBoundingClientRect","top","scrollY","innerHeight","content","filter","attrs","side","map","el","querySelector","relativeTopPosition","topPosition","tempBottomPixel","marginTop","Math","max","console","log","div","className","style","key"],"mappings":"AAAA;;AAEA,SAASA,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AACpD,SAASC,kBAAkB,QAAQ,6BAA6B;AAChE,MAAMC,SAAS;AAEf,SAASC,oBAAoBC,WAAW;IACtC,IAAI,OAAOC,WAAW,eAAe,CAACD,aAAa,OAAO;IAC1D,OAAOE,SAASC,cAAc,CAACH;AACjC;AAEA,OAAO,SAASI,4BAA4B,EAAEC,IAAI,EAAEL,WAAW,EAAE;IAC/D,MAAM,CAACM,SAASC,WAAW,GAAGX,SAAS;IACvCF,UAAU;QACRc,WAAW;YACTD,WAAW;QACb,GAAG;IACL,GAAG,EAAE;IACL,MAAME,cAAcd,OAAOI,oBAAoBC;IAC/C,IAAI,CAACM,WAAW,OAAOL,WAAW,aAAa,OAAO;IACtD,IAAI,CAACQ,YAAYC,OAAO,EAAE;QACxBD,YAAYC,OAAO,GAAGX,oBAAoBC;IAC5C;IACA,IAAIW,oBACFF,YAAYC,OAAO,EAAEE,yBAAyBC,MAAMZ,OAAOa,OAAO,IAClEb,OAAOc,WAAW;IAEpB,qBACE;kBACGV,KAAKW,OAAO,CACVC,MAAM,CAAC,CAACD,UAAYA,SAASE,OAAO,CAAC,UAAU,EAC/CD,MAAM,CAAC,CAACD,UAAYA,SAASE,OAAOC,MACpCC,GAAG,CAAC,CAACJ;YACJ,MAAMK,KAAKnB,UAAUoB,cACnB,CAAC,UAAU,EAAEN,QAAQE,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC;YAE3C,MAAMK,sBAAsBF,GAAGT,qBAAqB,GAAGC,GAAG;YAC1D,MAAMW,cAAcD,sBAAsBtB,OAAOa,OAAO;YAExD,MAAMW,kBAAkBd;YAExB,MAAMe,YAAYC,KAAKC,GAAG,CACxB,GACAJ,cAAcC,kBAAkB3B,SAAS;YAE3Ca,oBAAoBa,cAAc1B;YAClC+B,QAAQC,GAAG,CACTN,aACAC,iBACAC,WACAzB,OAAOc,WAAW;YAEpB,qBACE,KAACgB;gBAECC,WAAU;gBACVC,OAAO;oBAAEP;gBAAU;0BAElB7B,mBAAmBmB;eAJf,CAAC,sBAAsB,EAAEA,QAAQE,KAAK,CAAC,UAAU,CAAC,CAAC,EAAEF,QAAQE,KAAK,CAACgB,GAAG,EAAE;QAOnF;;AAGR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/serverside/FacebookServerside.ts"],"sourcesContent":["import { Node, mergeAttributes } from \"@tiptap/core\";\n\nexport const FacebookServerside = Node.create({\n name: \"facebook\",\n\n group: \"block\",\n content: \"inline*\",\n\n parseHTML() {\n return [\n {\n tag: 'a[data-type=\"facebook\"]',\n },\n ];\n },\n addAttributes() {\n return {\n url: { default: null },\n \"data-id\": { default: null },\n class: { default: \"inline-facebook\" },\n };\n },\n renderHTML({ HTMLAttributes }) {\n return [\n \"
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/serverside/FacebookServerside.ts"],"sourcesContent":["import { Node, mergeAttributes } from \"@tiptap/core\";\n\nexport const FacebookServerside = Node.create({\n name: \"facebook\",\n\n group: \"block\",\n content: \"inline*\",\n\n parseHTML() {\n return [\n {\n tag: 'a[data-type=\"facebook\"]',\n },\n ];\n },\n addAttributes() {\n return {\n url: { default: null },\n \"data-id\": { default: null },\n class: { default: \"inline-facebook\" },\n };\n },\n renderHTML({ HTMLAttributes }) {\n return [\n \"div\",\n mergeAttributes(HTMLAttributes, {\n \"data-type\": \"facebook\",\n class: `react-renderer node-facebook ${HTMLAttributes.class}`,\n }),\n 0,\n ];\n },\n});\n"],"names":["Node","mergeAttributes","FacebookServerside","create","name","group","content","parseHTML","tag","addAttributes","url","default","class","renderHTML","HTMLAttributes"],"mappings":"AAAA,SAASA,IAAI,EAAEC,eAAe,QAAQ,eAAe;AAErD,OAAO,MAAMC,qBAAqBF,KAAKG,MAAM,CAAC;IAC5CC,MAAM;IAENC,OAAO;IACPC,SAAS;IAETC;QACE,OAAO;YACL;gBACEC,KAAK;YACP;SACD;IACH;IACAC;QACE,OAAO;YACLC,KAAK;gBAAEC,SAAS;YAAK;YACrB,WAAW;gBAAEA,SAAS;YAAK;YAC3BC,OAAO;gBAAED,SAAS;YAAkB;QACtC;IACF;IACAE,YAAW,EAAEC,cAAc,EAAE;QAC3B,OAAO;YACL;YACAb,gBAAgBa,gBAAgB;gBAC9B,aAAa;gBACbF,OAAO,CAAC,6BAA6B,EAAEE,eAAeF,KAAK,EAAE;YAC/D;YACA;SACD;IACH;AACF,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/serverside/InstagramServerside.ts"],"sourcesContent":["import { Node, mergeAttributes } from \"@tiptap/core\";\n\nexport const InstagramServerside = Node.create({\n name: \"instagram\",\n\n group: \"block\",\n content: \"inline*\",\n\n parseHTML() {\n return [\n {\n tag: 'a[data-type=\"instagram\"]',\n },\n ];\n },\n addAttributes() {\n return {\n url: { default: null },\n \"data-id\": { default: null },\n class: { default: \"inline-instagram\" },\n };\n },\n renderHTML({ HTMLAttributes }) {\n return [\n \"
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/serverside/InstagramServerside.ts"],"sourcesContent":["import { Node, mergeAttributes } from \"@tiptap/core\";\n\nexport const InstagramServerside = Node.create({\n name: \"instagram\",\n\n group: \"block\",\n content: \"inline*\",\n\n parseHTML() {\n return [\n {\n tag: 'a[data-type=\"instagram\"]',\n },\n ];\n },\n addAttributes() {\n return {\n url: { default: null },\n \"data-id\": { default: null },\n class: { default: \"inline-instagram\" },\n };\n },\n renderHTML({ HTMLAttributes }) {\n return [\n \"div\",\n mergeAttributes(HTMLAttributes, {\n \"data-type\": \"instagram\",\n class: `react-renderer node-instagram ${HTMLAttributes.class}`,\n }),\n 0,\n ];\n },\n});\n"],"names":["Node","mergeAttributes","InstagramServerside","create","name","group","content","parseHTML","tag","addAttributes","url","default","class","renderHTML","HTMLAttributes"],"mappings":"AAAA,SAASA,IAAI,EAAEC,eAAe,QAAQ,eAAe;AAErD,OAAO,MAAMC,sBAAsBF,KAAKG,MAAM,CAAC;IAC7CC,MAAM;IAENC,OAAO;IACPC,SAAS;IAETC;QACE,OAAO;YACL;gBACEC,KAAK;YACP;SACD;IACH;IACAC;QACE,OAAO;YACLC,KAAK;gBAAEC,SAAS;YAAK;YACrB,WAAW;gBAAEA,SAAS;YAAK;YAC3BC,OAAO;gBAAED,SAAS;YAAmB;QACvC;IACF;IACAE,YAAW,EAAEC,cAAc,EAAE;QAC3B,OAAO;YACL;YACAb,gBAAgBa,gBAAgB;gBAC9B,aAAa;gBACbF,OAAO,CAAC,8BAA8B,EAAEE,eAAeF,KAAK,EAAE;YAChE;YACA;SACD;IACH;AACF,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/serverside/LinkedinServerside.ts"],"sourcesContent":["import { Node, mergeAttributes } from \"@tiptap/core\";\n\nexport const LinkedinServerside = Node.create({\n name: \"linkedin\",\n\n group: \"block\",\n content: \"inline*\",\n\n parseHTML() {\n return [\n {\n tag: 'a[data-type=\"linkedin\"]',\n },\n ];\n },\n addAttributes() {\n return {\n url: { default: null },\n \"data-id\": { default: null },\n class: { default: \"inline-tiktok\" },\n };\n },\n renderHTML({ HTMLAttributes }) {\n return [\n \"
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/serverside/LinkedinServerside.ts"],"sourcesContent":["import { Node, mergeAttributes } from \"@tiptap/core\";\n\nexport const LinkedinServerside = Node.create({\n name: \"linkedin\",\n\n group: \"block\",\n content: \"inline*\",\n\n parseHTML() {\n return [\n {\n tag: 'a[data-type=\"linkedin\"]',\n },\n ];\n },\n addAttributes() {\n return {\n url: { default: null },\n \"data-id\": { default: null },\n class: { default: \"inline-tiktok\" },\n };\n },\n renderHTML({ HTMLAttributes }) {\n return [\n \"div\",\n mergeAttributes(HTMLAttributes, {\n \"data-type\": \"linkedin\",\n class: `react-renderer node-linkedin ${HTMLAttributes.class}`,\n }),\n 0,\n ];\n },\n});\n"],"names":["Node","mergeAttributes","LinkedinServerside","create","name","group","content","parseHTML","tag","addAttributes","url","default","class","renderHTML","HTMLAttributes"],"mappings":"AAAA,SAASA,IAAI,EAAEC,eAAe,QAAQ,eAAe;AAErD,OAAO,MAAMC,qBAAqBF,KAAKG,MAAM,CAAC;IAC5CC,MAAM;IAENC,OAAO;IACPC,SAAS;IAETC;QACE,OAAO;YACL;gBACEC,KAAK;YACP;SACD;IACH;IACAC;QACE,OAAO;YACLC,KAAK;gBAAEC,SAAS;YAAK;YACrB,WAAW;gBAAEA,SAAS;YAAK;YAC3BC,OAAO;gBAAED,SAAS;YAAgB;QACpC;IACF;IACAE,YAAW,EAAEC,cAAc,EAAE;QAC3B,OAAO;YACL;YACAb,gBAAgBa,gBAAgB;gBAC9B,aAAa;gBACbF,OAAO,CAAC,6BAA6B,EAAEE,eAAeF,KAAK,EAAE;YAC/D;YACA;SACD;IACH;AACF,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/serverside/RenderEmbedClientSide.tsx"],"sourcesContent":["import Image from \"next/image.js\";\nimport {\n FacebookEmbed,\n InstagramEmbed,\n LinkedInEmbed,\n TikTokEmbed,\n XEmbed,\n YouTubeEmbed,\n} from \"react-social-media-embed\";\nimport { cn } from \"../../lib/utils/index.js\";\nimport VideoBlockViewClientside from \"../VideoBlock/components/VideoBlockViewClientside.js\";\nimport { SocialMediaEmbedServerside } from \"../SocialMedia/SocialMediaEmbedServerside.js\";\nimport InsideLinksComponent from \"../InsideLinks/InsideLinksComponent.js\";\n\nfunction checkIfValidLink(link: string) {\n return typeof link === \"string\";\n}\nexport const renderEmbedContent = (content) => {\n switch (content.type) {\n case \"twitter\":\n if (!checkIfValidLink(content.attrs.url)) {\n return null;\n }\n return (\n <SocialMediaEmbedServerside>\n <XEmbed url={content.attrs.url || \"\"} width={325} />\n </SocialMediaEmbedServerside>\n );\n case \"youtube\":\n if (!checkIfValidLink(content.attrs.url)) {\n return null;\n }\n return (\n <SocialMediaEmbedServerside>\n <YouTubeEmbed url={content.attrs.url || \"\"} />\n </SocialMediaEmbedServerside>\n );\n case \"instagram\":\n if (!checkIfValidLink(content.attrs.url)) {\n return null;\n }\n return (\n <SocialMediaEmbedServerside>\n <InstagramEmbed\n className=\"max-w-[328px]\"\n url={content.attrs.url || \"\"}\n width={328}\n captioned\n />\n </SocialMediaEmbedServerside>\n );\n case \"tiktok\":\n if (!checkIfValidLink(content.attrs.url)) {\n return null;\n }\n return (\n <SocialMediaEmbedServerside>\n <TikTokEmbed\n className=\"max-w-[328px]\"\n url={content.attrs.url || \"\"}\n width={328}\n />\n </SocialMediaEmbedServerside>\n );\n case \"imageBlock\":\n return (\n <>\n <div\n className={cn(\"relative object-cover\", {\n \"aspect-video\": !content.attrs.height,\n })}\n style={{\n width: content.attrs.width || \"100%\",\n ...(content.attrs.height ? { height: content.attrs.height } : {}),\n }}\n >\n {/* @ts-ignore */}\n <Image\n className=\"rounded\"\n src={content.attrs.src}\n alt={content.attrs.alt || content.attrs.caption}\n fill\n />\n </div>\n {content.attrs?.caption ? (\n <p\n className={cn(\n \"tiptap-image-caption\",\n \"pt-2 font-sf text-sm font-light text-grey-7 mx-6 sm:mx-0 line-clamp-2\"\n )}\n >\n {content.attrs?.caption}\n </p>\n ) : null}\n </>\n );\n case \"videoBlock\":\n // @ts-ignore\n return <VideoBlockViewClientside node={content} />;\n case \"facebook\":\n return (\n <SocialMediaEmbedServerside>\n <FacebookEmbed url={content.attrs.url || \"\"} width={550} />\n </SocialMediaEmbedServerside>\n );\n case \"linkedin\":\n if (!checkIfValidLink(content.attrs.url)) {\n return null;\n }\n return (\n <SocialMediaEmbedServerside>\n <LinkedInEmbed\n url={content.attrs.url || \"\"}\n width={325}\n height={570}\n />\n </SocialMediaEmbedServerside>\n );\n case \"insideLinks\":\n return <InsideLinksComponent {...content} />;\n case \"iframe\":\n return (\n <SocialMediaEmbedServerside>\n <div className=\"iframe-wrapper\">\n <iframe src={content?.attrs?.src ?? \"\"} allowFullScreen={true} />\n </div>\n </SocialMediaEmbedServerside>\n );\n default:\n return null;\n }\n};\n"],"names":["Image","FacebookEmbed","InstagramEmbed","LinkedInEmbed","TikTokEmbed","XEmbed","YouTubeEmbed","cn","VideoBlockViewClientside","SocialMediaEmbedServerside","InsideLinksComponent","checkIfValidLink","link","renderEmbedContent","content","type","attrs","url","width","className","captioned","div","height","style","src","alt","caption","fill","p","node","iframe","allowFullScreen"],"mappings":";AAAA,OAAOA,WAAW,gBAAgB;AAClC,SACEC,aAAa,EACbC,cAAc,EACdC,aAAa,EACbC,WAAW,EACXC,MAAM,EACNC,YAAY,QACP,2BAA2B;AAClC,SAASC,EAAE,QAAQ,2BAA2B;AAC9C,OAAOC,8BAA8B,uDAAuD;AAC5F,SAASC,0BAA0B,QAAQ,+CAA+C;AAC1F,OAAOC,0BAA0B,yCAAyC;AAE1E,SAASC,iBAAiBC,IAAY;IACpC,OAAO,OAAOA,SAAS;AACzB;AACA,OAAO,MAAMC,qBAAqB,CAACC;IACjC,OAAQA,QAAQC,IAAI;QAClB,KAAK;YACH,IAAI,CAACJ,iBAAiBG,QAAQE,KAAK,CAACC,GAAG,GAAG;gBACxC,OAAO;YACT;YACA,qBACE,KAACR;0BACC,cAAA,KAACJ;oBAAOY,KAAKH,QAAQE,KAAK,CAACC,GAAG,IAAI;oBAAIC,OAAO;;;QAGnD,KAAK;YACH,IAAI,CAACP,iBAAiBG,QAAQE,KAAK,CAACC,GAAG,GAAG;gBACxC,OAAO;YACT;YACA,qBACE,KAACR;0BACC,cAAA,KAACH;oBAAaW,KAAKH,QAAQE,KAAK,CAACC,GAAG,IAAI;;;QAG9C,KAAK;YACH,IAAI,CAACN,iBAAiBG,QAAQE,KAAK,CAACC,GAAG,GAAG;gBACxC,OAAO;YACT;YACA,qBACE,KAACR;0BACC,cAAA,KAACP;oBACCiB,WAAU;oBACVF,KAAKH,QAAQE,KAAK,CAACC,GAAG,IAAI;oBAC1BC,OAAO;oBACPE,SAAS;;;QAIjB,KAAK;YACH,IAAI,CAACT,iBAAiBG,QAAQE,KAAK,CAACC,GAAG,GAAG;gBACxC,OAAO;YACT;YACA,qBACE,KAACR;0BACC,cAAA,KAACL;oBACCe,WAAU;oBACVF,KAAKH,QAAQE,KAAK,CAACC,GAAG,IAAI;oBAC1BC,OAAO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ensions/serverside/RenderEmbedClientSide.tsx"],"sourcesContent":["import Image from \"next/image.js\";\nimport {\n FacebookEmbed,\n InstagramEmbed,\n LinkedInEmbed,\n TikTokEmbed,\n XEmbed,\n YouTubeEmbed,\n} from \"react-social-media-embed\";\nimport { cn } from \"../../lib/utils/index.js\";\nimport VideoBlockViewClientside from \"../VideoBlock/components/VideoBlockViewClientside.js\";\nimport { SocialMediaEmbedServerside } from \"../SocialMedia/SocialMediaEmbedServerside.js\";\nimport InsideLinksComponent from \"../InsideLinks/InsideLinksComponent.js\";\n\nfunction checkIfValidLink(link: string) {\n return typeof link === \"string\";\n}\nexport const renderEmbedContent = (content) => {\n switch (content.type) {\n case \"twitter\":\n if (!checkIfValidLink(content.attrs.url)) {\n return null;\n }\n return (\n <SocialMediaEmbedServerside>\n <XEmbed url={content.attrs.url || \"\"} width={325} />\n </SocialMediaEmbedServerside>\n );\n case \"youtube\":\n if (!checkIfValidLink(content.attrs.url)) {\n return null;\n }\n return (\n <SocialMediaEmbedServerside>\n <YouTubeEmbed url={content.attrs.url || \"\"} />\n </SocialMediaEmbedServerside>\n );\n case \"instagram\":\n if (!checkIfValidLink(content.attrs.url)) {\n return null;\n }\n return (\n <SocialMediaEmbedServerside>\n <InstagramEmbed\n className=\"max-w-[328px]\"\n url={content.attrs.url || \"\"}\n width={328}\n captioned\n />\n </SocialMediaEmbedServerside>\n );\n case \"tiktok\":\n if (!checkIfValidLink(content.attrs.url)) {\n return null;\n }\n return (\n <SocialMediaEmbedServerside>\n <TikTokEmbed\n className=\"max-w-[328px]\"\n url={content.attrs.url || \"\"}\n width={328}\n />\n </SocialMediaEmbedServerside>\n );\n case \"imageBlock\":\n return (\n <>\n <div\n className={cn(\"relative object-cover\", {\n \"aspect-video\": !content.attrs.height,\n })}\n style={{\n width: content.attrs.width || \"100%\",\n ...(content.attrs.height ? { height: content.attrs.height } : {}),\n }}\n >\n {/* @ts-ignore */}\n <Image\n className=\"rounded object-cover\"\n src={content.attrs.src}\n alt={content.attrs.alt || content.attrs.caption}\n fill\n />\n </div>\n {content.attrs?.caption ? (\n <p\n className={cn(\n \"tiptap-image-caption\",\n \"pt-2 font-sf text-sm font-light text-grey-7 mx-6 sm:mx-0 line-clamp-2\"\n )}\n >\n {content.attrs?.caption}\n </p>\n ) : null}\n </>\n );\n case \"videoBlock\":\n // @ts-ignore\n return <VideoBlockViewClientside node={content} />;\n case \"facebook\":\n return (\n <SocialMediaEmbedServerside>\n <FacebookEmbed url={content.attrs.url || \"\"} width={550} />\n </SocialMediaEmbedServerside>\n );\n case \"linkedin\":\n if (!checkIfValidLink(content.attrs.url)) {\n return null;\n }\n return (\n <SocialMediaEmbedServerside>\n <LinkedInEmbed\n url={content.attrs.url || \"\"}\n width={325}\n height={570}\n />\n </SocialMediaEmbedServerside>\n );\n case \"insideLinks\":\n return <InsideLinksComponent {...content} />;\n case \"iframe\":\n return (\n <SocialMediaEmbedServerside>\n <div className=\"iframe-wrapper\">\n <iframe src={content?.attrs?.src ?? \"\"} allowFullScreen={true} />\n </div>\n </SocialMediaEmbedServerside>\n );\n default:\n return null;\n }\n};\n"],"names":["Image","FacebookEmbed","InstagramEmbed","LinkedInEmbed","TikTokEmbed","XEmbed","YouTubeEmbed","cn","VideoBlockViewClientside","SocialMediaEmbedServerside","InsideLinksComponent","checkIfValidLink","link","renderEmbedContent","content","type","attrs","url","width","className","captioned","div","height","style","src","alt","caption","fill","p","node","iframe","allowFullScreen"],"mappings":";AAAA,OAAOA,WAAW,gBAAgB;AAClC,SACEC,aAAa,EACbC,cAAc,EACdC,aAAa,EACbC,WAAW,EACXC,MAAM,EACNC,YAAY,QACP,2BAA2B;AAClC,SAASC,EAAE,QAAQ,2BAA2B;AAC9C,OAAOC,8BAA8B,uDAAuD;AAC5F,SAASC,0BAA0B,QAAQ,+CAA+C;AAC1F,OAAOC,0BAA0B,yCAAyC;AAE1E,SAASC,iBAAiBC,IAAY;IACpC,OAAO,OAAOA,SAAS;AACzB;AACA,OAAO,MAAMC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