payload-richtext-tiptap 0.0.97 → 0.0.99
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/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/InsideLinks/InsideLink.client.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/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/serverside/ContentEmbedSupport.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/FacebookServerside.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/InstagramServerside.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/LinkedinServerside.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/ServersideTiptapBody.js +10 -5
- package/dist/src/fields/TiptapEditor/extensions/serverside/ServersideTiptapBody.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/TiktokServerside.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/TwitterBlockServerside.js.map +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/menus/TextMenu/components/ai-selector-commands.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/features/menus/TextMenu/components/ai-selector-commands.js +6 -8
- package/dist/src/fields/TiptapEditor/features/menus/TextMenu/components/ai-selector-commands.js.map +1 -1
- package/dist/src/fields/TiptapEditor/features/panels/AICommandPanel/AICommandPanel.js +3 -4
- package/dist/src/fields/TiptapEditor/features/panels/AICommandPanel/AICommandPanel.js.map +1 -1
- package/dist/src/fields/TiptapEditor/features/panels/AIEditorPanel/AIEditorPanel.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/features/panels/AIEditorPanel/AIEditorPanel.js +3 -6
- package/dist/src/fields/TiptapEditor/features/panels/AIEditorPanel/AIEditorPanel.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/data/initialContent.js +9 -9
- package/dist/src/fields/TiptapEditor/lib/data/initialContent.js.map +1 -1
- package/dist/src/fields/TiptapEditor/lib/utils/cssVar.js.map +1 -1
- package/dist/src/styles.css +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/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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "payload-richtext-tiptap",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.99",
|
|
4
4
|
"description": "Rich text tiptap for Payload CMS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"payload",
|
|
@@ -21,20 +21,11 @@
|
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"author": "Payload <dev@payloadcms.com> (https://payloadcms.com)",
|
|
23
23
|
"type": "module",
|
|
24
|
-
"main": "dist/src/index.js",
|
|
25
|
-
"types": "dist/src/index.d.ts",
|
|
24
|
+
"main": "./dist/src/index.js",
|
|
25
|
+
"types": "./dist/src/index.d.ts",
|
|
26
26
|
"files": [
|
|
27
27
|
"dist/**/*"
|
|
28
28
|
],
|
|
29
|
-
"scripts": {
|
|
30
|
-
"build": "pnpm build:css && pnpm build:types && pnpm build:swc",
|
|
31
|
-
"build:css": "pnpx tailwindcss build -i src/styles.scss -o dist/src/styles.css",
|
|
32
|
-
"build:swc": "swc ./src -d ./dist/src --config-file .swcrc --strip-leading-paths",
|
|
33
|
-
"build:types": "tsc --emitDeclarationOnly --outDir dist",
|
|
34
|
-
"clean": "rimraf {dist,*.tsbuildinfo}",
|
|
35
|
-
"prepublishOnly": "pnpm clean && pnpm build",
|
|
36
|
-
"test": "echo \"No tests available.\""
|
|
37
|
-
},
|
|
38
29
|
"sideEffects": false,
|
|
39
30
|
"dependencies": {
|
|
40
31
|
"@headlessui/tailwindcss": "^0.2.1",
|
|
@@ -165,21 +156,7 @@
|
|
|
165
156
|
"react-dom": "^19.0.0 || ^19.0.0-rc-f994737d14-20240522"
|
|
166
157
|
},
|
|
167
158
|
"publishConfig": {
|
|
168
|
-
"
|
|
169
|
-
".": {
|
|
170
|
-
"import": "./dist/src/index.js",
|
|
171
|
-
"types": "./dist/src/index.d.ts",
|
|
172
|
-
"default": "./dist/src/index.js"
|
|
173
|
-
},
|
|
174
|
-
"./types": {
|
|
175
|
-
"import": "./dist/exports/types.js",
|
|
176
|
-
"types": "./dist/exports/types.d.ts",
|
|
177
|
-
"default": "./dist/exports/types.js"
|
|
178
|
-
}
|
|
179
|
-
},
|
|
180
|
-
"main": "./dist/src/index.js",
|
|
181
|
-
"registry": "https://registry.npmjs.org/",
|
|
182
|
-
"types": "./dist/src/index.d.ts"
|
|
159
|
+
"registry": "https://registry.npmjs.org/"
|
|
183
160
|
},
|
|
184
161
|
"homepage:": "https://payloadcms.com",
|
|
185
162
|
"overrides": {
|
|
@@ -189,5 +166,25 @@
|
|
|
189
166
|
"bugs": {
|
|
190
167
|
"url": "https://github.com/payloadcms/payload/issues"
|
|
191
168
|
},
|
|
192
|
-
"homepage": "https://github.com/payloadcms/payload#readme"
|
|
169
|
+
"homepage": "https://github.com/payloadcms/payload#readme",
|
|
170
|
+
"scripts": {
|
|
171
|
+
"build": "pnpm build:css && pnpm build:types && pnpm build:swc",
|
|
172
|
+
"build:css": "pnpx tailwindcss build -i src/styles.scss -o dist/src/styles.css",
|
|
173
|
+
"build:swc": "swc ./src -d ./dist/src --config-file .swcrc --strip-leading-paths",
|
|
174
|
+
"build:types": "tsc --emitDeclarationOnly --outDir dist",
|
|
175
|
+
"clean": "rimraf {dist,*.tsbuildinfo}",
|
|
176
|
+
"test": "echo \"No tests available.\""
|
|
177
|
+
},
|
|
178
|
+
"exports": {
|
|
179
|
+
".": {
|
|
180
|
+
"import": "./dist/src/index.js",
|
|
181
|
+
"types": "./dist/src/index.d.ts",
|
|
182
|
+
"default": "./dist/src/index.js"
|
|
183
|
+
},
|
|
184
|
+
"./types": {
|
|
185
|
+
"import": "./dist/exports/types.js",
|
|
186
|
+
"types": "./dist/exports/types.d.ts",
|
|
187
|
+
"default": "./dist/exports/types.js"
|
|
188
|
+
}
|
|
189
|
+
}
|
|
193
190
|
}
|
package/dist/src/fields/TiptapEditor/extensions/TableOfContentsNode/TableOfContentsNode.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Node } from "@tiptap/core";
|
|
2
|
-
declare module "@tiptap/core" {
|
|
3
|
-
interface Commands<ReturnType> {
|
|
4
|
-
tableOfContentsNode: {
|
|
5
|
-
insertTableOfContents: () => ReturnType;
|
|
6
|
-
};
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
export declare const TableOfContentsNode: Node<any, any>;
|
|
10
|
-
//# sourceMappingURL=TableOfContentsNode.d.ts.map
|
package/dist/src/fields/TiptapEditor/extensions/TableOfContentsNode/TableOfContentsNode.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TableOfContentsNode.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/TableOfContentsNode/TableOfContentsNode.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAyB,MAAM,cAAc,CAAC;AAgB3D,OAAO,QAAQ,cAAc,CAAC;IAC5B,UAAU,QAAQ,CAAC,UAAU;QAC3B,mBAAmB,EAAE;YACnB,qBAAqB,EAAE,MAAM,UAAU,CAAC;SACzC,CAAC;KACH;CACF;AAED,eAAO,MAAM,mBAAmB,gBAmC9B,CAAC"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { Node } from "@tiptap/core";
|
|
4
|
-
import { NodeViewWrapper, ReactNodeViewRenderer } from "@tiptap/react";
|
|
5
|
-
import { TableOfContents } from "../../features/TableOfContents/index.js";
|
|
6
|
-
const TableOfNodeContent = (props)=>{
|
|
7
|
-
const { editor } = props;
|
|
8
|
-
return /*#__PURE__*/ _jsx(NodeViewWrapper, {
|
|
9
|
-
children: /*#__PURE__*/ _jsx("div", {
|
|
10
|
-
className: "p-2 -m-2 rounded-lg",
|
|
11
|
-
contentEditable: false,
|
|
12
|
-
children: /*#__PURE__*/ _jsx(TableOfContents, {
|
|
13
|
-
editor: editor
|
|
14
|
-
})
|
|
15
|
-
})
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
export const TableOfContentsNode = Node.create({
|
|
19
|
-
name: "tableOfContentsNode",
|
|
20
|
-
group: "block",
|
|
21
|
-
atom: true,
|
|
22
|
-
selectable: true,
|
|
23
|
-
draggable: true,
|
|
24
|
-
inline: false,
|
|
25
|
-
parseHTML () {
|
|
26
|
-
return [
|
|
27
|
-
{
|
|
28
|
-
tag: 'div[data-type="table-of-content"]'
|
|
29
|
-
}
|
|
30
|
-
];
|
|
31
|
-
},
|
|
32
|
-
renderHTML ({ HTMLAttributes }) {
|
|
33
|
-
return [
|
|
34
|
-
"div",
|
|
35
|
-
{
|
|
36
|
-
...HTMLAttributes,
|
|
37
|
-
"data-type": "table-of-content"
|
|
38
|
-
}
|
|
39
|
-
];
|
|
40
|
-
},
|
|
41
|
-
addNodeView () {
|
|
42
|
-
return ReactNodeViewRenderer(TableOfNodeContent);
|
|
43
|
-
},
|
|
44
|
-
addCommands () {
|
|
45
|
-
return {
|
|
46
|
-
insertTableOfContents: ()=>({ commands })=>{
|
|
47
|
-
return commands.insertContent({
|
|
48
|
-
type: this.name
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
//# sourceMappingURL=TableOfContentsNode.js.map
|
package/dist/src/fields/TiptapEditor/extensions/TableOfContentsNode/TableOfContentsNode.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/TableOfContentsNode/TableOfContentsNode.tsx"],"sourcesContent":["import React from \"react\";\nimport { Node, NodeViewRendererProps } from \"@tiptap/core\";\nimport { NodeViewWrapper, ReactNodeViewRenderer } from \"@tiptap/react\";\nimport { TableOfContents } from \"../../features/TableOfContents/index.js\";\n\nconst TableOfNodeContent = (props: NodeViewRendererProps) => {\n const { editor } = props;\n\n return (\n <NodeViewWrapper>\n <div className=\"p-2 -m-2 rounded-lg\" contentEditable={false}>\n <TableOfContents editor={editor} />\n </div>\n </NodeViewWrapper>\n );\n};\n\ndeclare module \"@tiptap/core\" {\n interface Commands<ReturnType> {\n tableOfContentsNode: {\n insertTableOfContents: () => ReturnType;\n };\n }\n}\n\nexport const TableOfContentsNode = Node.create({\n name: \"tableOfContentsNode\",\n group: \"block\",\n atom: true,\n selectable: true,\n draggable: true,\n inline: false,\n\n parseHTML() {\n return [\n {\n tag: 'div[data-type=\"table-of-content\"]',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\"div\", { ...HTMLAttributes, \"data-type\": \"table-of-content\" }];\n },\n\n addNodeView() {\n return ReactNodeViewRenderer(TableOfNodeContent);\n },\n\n addCommands() {\n return {\n insertTableOfContents:\n () =>\n ({ commands }) => {\n return commands.insertContent({\n type: this.name,\n });\n },\n };\n },\n});\n"],"names":["React","Node","NodeViewWrapper","ReactNodeViewRenderer","TableOfContents","TableOfNodeContent","props","editor","div","className","contentEditable","TableOfContentsNode","create","name","group","atom","selectable","draggable","inline","parseHTML","tag","renderHTML","HTMLAttributes","addNodeView","addCommands","insertTableOfContents","commands","insertContent","type"],"mappings":";AAAA,OAAOA,WAAW,QAAQ;AAC1B,SAASC,IAAI,QAA+B,eAAe;AAC3D,SAASC,eAAe,EAAEC,qBAAqB,QAAQ,gBAAgB;AACvE,SAASC,eAAe,QAAQ,0CAA0C;AAE1E,MAAMC,qBAAqB,CAACC;IAC1B,MAAM,EAAEC,MAAM,EAAE,GAAGD;IAEnB,qBACE,KAACJ;kBACC,cAAA,KAACM;YAAIC,WAAU;YAAsBC,iBAAiB;sBACpD,cAAA,KAACN;gBAAgBG,QAAQA;;;;AAIjC;AAUA,OAAO,MAAMI,sBAAsBV,KAAKW,MAAM,CAAC;IAC7CC,MAAM;IACNC,OAAO;IACPC,MAAM;IACNC,YAAY;IACZC,WAAW;IACXC,QAAQ;IAERC;QACE,OAAO;YACL;gBACEC,KAAK;YACP;SACD;IACH;IAEAC,YAAW,EAAEC,cAAc,EAAE;QAC3B,OAAO;YAAC;YAAO;gBAAE,GAAGA,cAAc;gBAAE,aAAa;YAAmB;SAAE;IACxE;IAEAC;QACE,OAAOpB,sBAAsBE;IAC/B;IAEAmB;QACE,OAAO;YACLC,uBACE,IACA,CAAC,EAAEC,QAAQ,EAAE;oBACX,OAAOA,SAASC,aAAa,CAAC;wBAC5BC,MAAM,IAAI,CAACf,IAAI;oBACjB;gBACF;QACJ;IACF;AACF,GAAG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/TableOfContentsNode/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/TableOfContentsNode/index.ts"],"sourcesContent":["export * from \"./TableOfContentsNode.js\";\n"],"names":[],"mappings":"AAAA,cAAc,2BAA2B"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Editor } from "@tiptap/react";
|
|
3
|
-
export declare const Sidebar: React.MemoExoticComponent<({ editor, isOpen, onClose, }: {
|
|
4
|
-
editor: Editor;
|
|
5
|
-
isOpen?: boolean;
|
|
6
|
-
onClose: () => void;
|
|
7
|
-
}) => React.JSX.Element>;
|
|
8
|
-
//# sourceMappingURL=Sidebar.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Sidebar.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/features/Sidebar/Sidebar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAIvC,eAAO,MAAM,OAAO,2DAKf;IACD,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,uBA2BF,CAAC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { memo, useCallback } from "react";
|
|
5
|
-
import { TableOfContents } from "../TableOfContents/index.js";
|
|
6
|
-
import { cn } from "../../lib/utils/index.js";
|
|
7
|
-
export const Sidebar = /*#__PURE__*/ memo(({ editor, isOpen, onClose })=>{
|
|
8
|
-
const handlePotentialClose = useCallback(()=>{
|
|
9
|
-
if (window.innerWidth < 1024) {
|
|
10
|
-
onClose();
|
|
11
|
-
}
|
|
12
|
-
}, [
|
|
13
|
-
onClose
|
|
14
|
-
]);
|
|
15
|
-
const windowClassName = cn("absolute top-0 left-0 bg-white lg:bg-white/30 lg:backdrop-blur-xl h-full lg:h-auto lg:relative z-[999] w-0 duration-300 transition-all", "dark:bg-black lg:dark:bg-black/30", !isOpen && "border-r-transparent", isOpen && "w-80 border-r border-r-neutral-200 dark:border-r-neutral-800");
|
|
16
|
-
return /*#__PURE__*/ _jsx("div", {
|
|
17
|
-
className: windowClassName,
|
|
18
|
-
children: /*#__PURE__*/ _jsx("div", {
|
|
19
|
-
className: "w-full h-full overflow-hidden",
|
|
20
|
-
children: /*#__PURE__*/ _jsx("div", {
|
|
21
|
-
className: "w-full h-full p-2 overflow-auto",
|
|
22
|
-
children: /*#__PURE__*/ _jsx(TableOfContents, {
|
|
23
|
-
onItemClick: handlePotentialClose,
|
|
24
|
-
editor: editor
|
|
25
|
-
})
|
|
26
|
-
})
|
|
27
|
-
})
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
Sidebar.displayName = "TableOfContentSidepanel";
|
|
31
|
-
|
|
32
|
-
//# sourceMappingURL=Sidebar.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/features/Sidebar/Sidebar.tsx"],"sourcesContent":["\"use client\";\nimport React from \"react\";\nimport { memo, useCallback } from \"react\";\nimport { Editor } from \"@tiptap/react\";\nimport { TableOfContents } from \"../TableOfContents/index.js\";\nimport { cn } from \"../../lib/utils/index.js\";\n\nexport const Sidebar = memo(\n ({\n editor,\n isOpen,\n onClose,\n }: {\n editor: Editor;\n isOpen?: boolean;\n onClose: () => void;\n }) => {\n const handlePotentialClose = useCallback(() => {\n if (window.innerWidth < 1024) {\n onClose();\n }\n }, [onClose]);\n\n const windowClassName = cn(\n \"absolute top-0 left-0 bg-white lg:bg-white/30 lg:backdrop-blur-xl h-full lg:h-auto lg:relative z-[999] w-0 duration-300 transition-all\",\n \"dark:bg-black lg:dark:bg-black/30\",\n !isOpen && \"border-r-transparent\",\n isOpen && \"w-80 border-r border-r-neutral-200 dark:border-r-neutral-800\"\n );\n\n return (\n <div className={windowClassName}>\n <div className=\"w-full h-full overflow-hidden\">\n <div className=\"w-full h-full p-2 overflow-auto\">\n <TableOfContents\n onItemClick={handlePotentialClose}\n editor={editor}\n />\n </div>\n </div>\n </div>\n );\n }\n);\n\nSidebar.displayName = \"TableOfContentSidepanel\";\n"],"names":["React","memo","useCallback","TableOfContents","cn","Sidebar","editor","isOpen","onClose","handlePotentialClose","window","innerWidth","windowClassName","div","className","onItemClick","displayName"],"mappings":"AAAA;;AACA,OAAOA,WAAW,QAAQ;AAC1B,SAASC,IAAI,EAAEC,WAAW,QAAQ,QAAQ;AAE1C,SAASC,eAAe,QAAQ,8BAA8B;AAC9D,SAASC,EAAE,QAAQ,2BAA2B;AAE9C,OAAO,MAAMC,wBAAUJ,KACrB,CAAC,EACCK,MAAM,EACNC,MAAM,EACNC,OAAO,EAKR;IACC,MAAMC,uBAAuBP,YAAY;QACvC,IAAIQ,OAAOC,UAAU,GAAG,MAAM;YAC5BH;QACF;IACF,GAAG;QAACA;KAAQ;IAEZ,MAAMI,kBAAkBR,GACtB,0IACA,qCACA,CAACG,UAAU,wBACXA,UAAU;IAGZ,qBACE,KAACM;QAAIC,WAAWF;kBACd,cAAA,KAACC;YAAIC,WAAU;sBACb,cAAA,KAACD;gBAAIC,WAAU;0BACb,cAAA,KAACX;oBACCY,aAAaN;oBACbH,QAAQA;;;;;AAMpB,GACA;AAEFD,QAAQW,WAAW,GAAG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/features/Sidebar/index.tsx"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/features/Sidebar/index.tsx"],"sourcesContent":["export * from \"./Sidebar.js\";\n"],"names":[],"mappings":"AAAA,cAAc,eAAe"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Editor as CoreEditor } from "@tiptap/core";
|
|
3
|
-
export type TableOfContentsProps = {
|
|
4
|
-
editor: CoreEditor;
|
|
5
|
-
onItemClick?: () => void;
|
|
6
|
-
};
|
|
7
|
-
export declare const TableOfContents: React.MemoExoticComponent<({ editor, onItemClick }: TableOfContentsProps) => React.JSX.Element>;
|
|
8
|
-
//# sourceMappingURL=TableOfContents.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TableOfContents.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/features/TableOfContents/TableOfContents.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AAOpD,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,UAAU,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,eAAe,sDACA,oBAAoB,uBAoD/C,CAAC"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { memo, useEffect, useState } from "react";
|
|
4
|
-
import { cn } from "../../lib/utils/index.js";
|
|
5
|
-
// import { toTranslationKey } from '@/languages'
|
|
6
|
-
import { useTranslation } from "@payloadcms/ui/providers/Translation";
|
|
7
|
-
export const TableOfContents = /*#__PURE__*/ memo(({ editor, onItemClick })=>{
|
|
8
|
-
const [data, setData] = useState(null);
|
|
9
|
-
useEffect(()=>{
|
|
10
|
-
const handler = ({ editor: currentEditor })=>{
|
|
11
|
-
setData({
|
|
12
|
-
...currentEditor.extensionStorage.tableOfContents
|
|
13
|
-
});
|
|
14
|
-
};
|
|
15
|
-
handler({
|
|
16
|
-
editor
|
|
17
|
-
});
|
|
18
|
-
editor.on("update", handler);
|
|
19
|
-
editor.on("selectionUpdate", handler);
|
|
20
|
-
return ()=>{
|
|
21
|
-
editor.off("update", handler);
|
|
22
|
-
editor.off("selectionUpdate", handler);
|
|
23
|
-
};
|
|
24
|
-
}, [
|
|
25
|
-
editor
|
|
26
|
-
]);
|
|
27
|
-
const { i18n } = useTranslation();
|
|
28
|
-
return /*#__PURE__*/ _jsxs("div", {
|
|
29
|
-
lang: i18n.language,
|
|
30
|
-
children: [
|
|
31
|
-
/*#__PURE__*/ _jsx("div", {
|
|
32
|
-
className: "mb-2 text-xs font-semibold uppercase text-neutral-500 dark:text-neutral-400"
|
|
33
|
-
}),
|
|
34
|
-
data && data.content.length > 0 ? /*#__PURE__*/ _jsx("div", {
|
|
35
|
-
className: "flex flex-col gap-1",
|
|
36
|
-
children: data.content.map((item)=>/*#__PURE__*/ _jsxs("a", {
|
|
37
|
-
href: `#${item.id}`,
|
|
38
|
-
style: {
|
|
39
|
-
marginLeft: `${1 * item.level - 1}rem`
|
|
40
|
-
},
|
|
41
|
-
onClick: onItemClick,
|
|
42
|
-
className: cn("block font-medium text-neutral-500 dark:text-neutral-300 p-1 rounded bg-opacity-10 text-sm hover:text-neutral-800 transition-all hover:bg-black hover:bg-opacity-5 truncate w-full", item.isActive && "text-neutral-800 bg-neutral-100 dark:text-neutral-100 dark:bg-neutral-900"),
|
|
43
|
-
children: [
|
|
44
|
-
item.itemIndex,
|
|
45
|
-
". ",
|
|
46
|
-
item.textContent
|
|
47
|
-
]
|
|
48
|
-
}, item.id))
|
|
49
|
-
}) : /*#__PURE__*/ _jsx("div", {
|
|
50
|
-
className: "text-sm text-neutral-500"
|
|
51
|
-
})
|
|
52
|
-
]
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
TableOfContents.displayName = "TableOfContents";
|
|
56
|
-
|
|
57
|
-
//# sourceMappingURL=TableOfContents.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/features/TableOfContents/TableOfContents.tsx"],"sourcesContent":["import React from \"react\";\nimport { Editor as CoreEditor } from \"@tiptap/core\";\nimport { memo, useEffect, useState } from \"react\";\nimport { TableOfContentsStorage } from \"@tiptap-pro/extension-table-of-contents\";\nimport { cn } from \"../../lib/utils/index.js\";\n// import { toTranslationKey } from '@/languages'\nimport { useTranslation } from \"@payloadcms/ui/providers/Translation\";\n\nexport type TableOfContentsProps = {\n editor: CoreEditor;\n onItemClick?: () => void;\n};\n\nexport const TableOfContents = memo(\n ({ editor, onItemClick }: TableOfContentsProps) => {\n const [data, setData] = useState<TableOfContentsStorage | null>(null);\n\n useEffect(() => {\n const handler = ({ editor: currentEditor }: { editor: CoreEditor }) => {\n setData({ ...currentEditor.extensionStorage.tableOfContents });\n };\n\n handler({ editor });\n\n editor.on(\"update\", handler);\n editor.on(\"selectionUpdate\", handler);\n\n return () => {\n editor.off(\"update\", handler);\n editor.off(\"selectionUpdate\", handler);\n };\n }, [editor]);\n const { i18n } = useTranslation();\n\n return (\n <div lang={i18n.language}>\n <div className=\"mb-2 text-xs font-semibold uppercase text-neutral-500 dark:text-neutral-400\">\n {/* {toTranslationKey('table_of_contents')}Table of Contents */}\n </div>\n {data && data.content.length > 0 ? (\n <div className=\"flex flex-col gap-1\">\n {data.content.map((item) => (\n <a\n key={item.id}\n href={`#${item.id}`}\n style={{ marginLeft: `${1 * item.level - 1}rem` }}\n onClick={onItemClick}\n className={cn(\n \"block font-medium text-neutral-500 dark:text-neutral-300 p-1 rounded bg-opacity-10 text-sm hover:text-neutral-800 transition-all hover:bg-black hover:bg-opacity-5 truncate w-full\",\n item.isActive &&\n \"text-neutral-800 bg-neutral-100 dark:text-neutral-100 dark:bg-neutral-900\"\n )}\n >\n {item.itemIndex}. {item.textContent}\n </a>\n ))}\n </div>\n ) : (\n <div className=\"text-sm text-neutral-500\">\n {/* Start adding headlines to your document */}\n {/* {toTranslationKey(\"start_adding_headlines_to_your_document\")} */}\n </div>\n )}\n </div>\n );\n }\n);\n\nTableOfContents.displayName = \"TableOfContents\";\n"],"names":["React","memo","useEffect","useState","cn","useTranslation","TableOfContents","editor","onItemClick","data","setData","handler","currentEditor","extensionStorage","tableOfContents","on","off","i18n","div","lang","language","className","content","length","map","item","a","href","id","style","marginLeft","level","onClick","isActive","itemIndex","textContent","displayName"],"mappings":";AAAA,OAAOA,WAAW,QAAQ;AAE1B,SAASC,IAAI,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,QAAQ;AAElD,SAASC,EAAE,QAAQ,2BAA2B;AAC9C,iDAAiD;AACjD,SAASC,cAAc,QAAQ,uCAAuC;AAOtE,OAAO,MAAMC,gCAAkBL,KAC7B,CAAC,EAAEM,MAAM,EAAEC,WAAW,EAAwB;IAC5C,MAAM,CAACC,MAAMC,QAAQ,GAAGP,SAAwC;IAEhED,UAAU;QACR,MAAMS,UAAU,CAAC,EAAEJ,QAAQK,aAAa,EAA0B;YAChEF,QAAQ;gBAAE,GAAGE,cAAcC,gBAAgB,CAACC,eAAe;YAAC;QAC9D;QAEAH,QAAQ;YAAEJ;QAAO;QAEjBA,OAAOQ,EAAE,CAAC,UAAUJ;QACpBJ,OAAOQ,EAAE,CAAC,mBAAmBJ;QAE7B,OAAO;YACLJ,OAAOS,GAAG,CAAC,UAAUL;YACrBJ,OAAOS,GAAG,CAAC,mBAAmBL;QAChC;IACF,GAAG;QAACJ;KAAO;IACX,MAAM,EAAEU,IAAI,EAAE,GAAGZ;IAEjB,qBACE,MAACa;QAAIC,MAAMF,KAAKG,QAAQ;;0BACtB,KAACF;gBAAIG,WAAU;;YAGdZ,QAAQA,KAAKa,OAAO,CAACC,MAAM,GAAG,kBAC7B,KAACL;gBAAIG,WAAU;0BACZZ,KAAKa,OAAO,CAACE,GAAG,CAAC,CAACC,qBACjB,MAACC;wBAECC,MAAM,CAAC,CAAC,EAAEF,KAAKG,EAAE,CAAC,CAAC;wBACnBC,OAAO;4BAAEC,YAAY,CAAC,EAAE,IAAIL,KAAKM,KAAK,GAAG,EAAE,GAAG,CAAC;wBAAC;wBAChDC,SAASxB;wBACTa,WAAWjB,GACT,sLACAqB,KAAKQ,QAAQ,IACX;;4BAGHR,KAAKS,SAAS;4BAAC;4BAAGT,KAAKU,WAAW;;uBAV9BV,KAAKG,EAAE;+BAelB,KAACV;gBAAIG,WAAU;;;;AAOvB,GACA;AAEFf,gBAAgB8B,WAAW,GAAG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/features/TableOfContents/index.tsx"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/features/TableOfContents/index.tsx"],"sourcesContent":["export * from \"./TableOfContents.js\";\n"],"names":[],"mappings":"AAAA,cAAc,uBAAuB"}
|