payload-richtext-tiptap 0.0.147 → 0.0.148
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/MultiColumn/Columns.js +3 -3
- package/dist/src/fields/TiptapEditor/extensions/MultiColumn/Columns.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockViewClientside.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockViewClientside.js +6 -4
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockViewClientside.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/VideoPlayer.d.ts +1 -0
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/VideoPlayer.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/VideoPlayer.js +3 -2
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/VideoPlayer.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/getAssetsAspectRatio.d.ts +1 -0
- package/dist/src/fields/TiptapEditor/extensions/serverside/getAssetsAspectRatio.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/getAssetsAspectRatio.js +5 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/getAssetsAspectRatio.js.map +1 -1
- package/dist/src/fields/TiptapEditor/lib/tiptapSchema.d.ts +40 -40
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +26 -30
- 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/error-boundary.d.ts +0 -15
- package/dist/src/fields/TiptapEditor/extensions/error-boundary.d.ts.map +0 -1
- package/dist/src/fields/TiptapEditor/extensions/error-boundary.js +0 -35
- package/dist/src/fields/TiptapEditor/extensions/error-boundary.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.148",
|
|
4
4
|
"description": "Rich text tiptap for Payload CMS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"payload",
|
|
@@ -21,21 +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 && pnpm build:fonts",
|
|
31
|
-
"build:fonts": "copyfiles -u 1 src/fonts/fonts/**/* dist/src/",
|
|
32
|
-
"build:css": "tailwindcss build -i src/styles.scss -o dist/src/styles.css --minify && tailwindcss build -i src/styles/article-custom.css -o dist/src/article-custom.css --minify && tailwindcss build -i src/styles/globals.css -o dist/src/globals.css --minify && tailwindcss build -i src/styles/mobile.css -o dist/src/mobile.css --minify",
|
|
33
|
-
"build:swc": "swc ./src -d ./dist/src --config-file .swcrc --strip-leading-paths",
|
|
34
|
-
"build:types": "tsc --emitDeclarationOnly --outDir dist",
|
|
35
|
-
"clean": "rimraf {dist,*.tsbuildinfo}",
|
|
36
|
-
"prepublishOnly": " pnpm build",
|
|
37
|
-
"test": "echo \"No tests available.\""
|
|
38
|
-
},
|
|
39
29
|
"sideEffects": false,
|
|
40
30
|
"dependencies": {
|
|
41
31
|
"@ai-sdk/openai": "^1.1.9",
|
|
@@ -175,21 +165,7 @@
|
|
|
175
165
|
"react-dom": "^19.0.0 || ^19.0.0-rc-f994737d14-20240522"
|
|
176
166
|
},
|
|
177
167
|
"publishConfig": {
|
|
178
|
-
"
|
|
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
|
-
},
|
|
190
|
-
"main": "./dist/src/index.js",
|
|
191
|
-
"registry": "https://registry.npmjs.org/",
|
|
192
|
-
"types": "./dist/src/index.d.ts"
|
|
168
|
+
"registry": "https://registry.npmjs.org/"
|
|
193
169
|
},
|
|
194
170
|
"homepage:": "https://payloadcms.com",
|
|
195
171
|
"overrides": {
|
|
@@ -200,5 +176,25 @@
|
|
|
200
176
|
"url": "https://github.com/payloadcms/payload/issues"
|
|
201
177
|
},
|
|
202
178
|
"homepage": "https://github.com/payloadcms/payload#readme",
|
|
203
|
-
"
|
|
204
|
-
|
|
179
|
+
"scripts": {
|
|
180
|
+
"build": "pnpm build:css && pnpm build:types && pnpm build:swc && pnpm build:fonts",
|
|
181
|
+
"build:fonts": "copyfiles -u 1 src/fonts/fonts/**/* dist/src/",
|
|
182
|
+
"build:css": "tailwindcss build -i src/styles.scss -o dist/src/styles.css --minify && tailwindcss build -i src/styles/article-custom.css -o dist/src/article-custom.css --minify && tailwindcss build -i src/styles/globals.css -o dist/src/globals.css --minify && tailwindcss build -i src/styles/mobile.css -o dist/src/mobile.css --minify",
|
|
183
|
+
"build:swc": "swc ./src -d ./dist/src --config-file .swcrc --strip-leading-paths",
|
|
184
|
+
"build:types": "tsc --emitDeclarationOnly --outDir dist",
|
|
185
|
+
"clean": "rimraf {dist,*.tsbuildinfo}",
|
|
186
|
+
"test": "echo \"No tests available.\""
|
|
187
|
+
},
|
|
188
|
+
"exports": {
|
|
189
|
+
".": {
|
|
190
|
+
"import": "./dist/src/index.js",
|
|
191
|
+
"types": "./dist/src/index.d.ts",
|
|
192
|
+
"default": "./dist/src/index.js"
|
|
193
|
+
},
|
|
194
|
+
"./types": {
|
|
195
|
+
"import": "./dist/exports/types.js",
|
|
196
|
+
"types": "./dist/exports/types.d.ts",
|
|
197
|
+
"default": "./dist/exports/types.js"
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
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,15 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode, ErrorInfo } from 'react';
|
|
2
|
-
interface ErrorBoundaryProps {
|
|
3
|
-
children: ReactNode;
|
|
4
|
-
}
|
|
5
|
-
interface ErrorBoundaryState {
|
|
6
|
-
hasError: boolean;
|
|
7
|
-
}
|
|
8
|
-
export declare class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
9
|
-
constructor(props: ErrorBoundaryProps);
|
|
10
|
-
static getDerivedStateFromError(_: Error): ErrorBoundaryState;
|
|
11
|
-
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
12
|
-
render(): string | number | bigint | boolean | React.JSX.Element | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode>>;
|
|
13
|
-
}
|
|
14
|
-
export {};
|
|
15
|
-
//# sourceMappingURL=error-boundary.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"error-boundary.d.ts","sourceRoot":"","sources":["../../../../../src/fields/TiptapEditor/extensions/error-boundary.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEpD,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,qBAAa,aAAc,SAAQ,KAAK,CAAC,SAAS,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;gBAC5E,KAAK,EAAE,kBAAkB;IAOrC,MAAM,CAAC,wBAAwB,CAAC,CAAC,EAAE,KAAK,GAAG,kBAAkB;IAK7D,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS;IAKpD,MAAM;CAUP"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import React from 'react';
|
|
3
|
-
export class ErrorBoundary extends React.Component {
|
|
4
|
-
constructor(props){
|
|
5
|
-
super(props);
|
|
6
|
-
// Define a state variable to track whether there is an error or not
|
|
7
|
-
this.state = {
|
|
8
|
-
hasError: false
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
static getDerivedStateFromError(_) {
|
|
12
|
-
// Update state so the next render will show the fallback UI
|
|
13
|
-
return {
|
|
14
|
-
hasError: true
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
componentDidCatch(error, errorInfo) {
|
|
18
|
-
// You can use your own error logging service here
|
|
19
|
-
console.log({
|
|
20
|
-
error,
|
|
21
|
-
errorInfo
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
render() {
|
|
25
|
-
// Check if the error is thrown
|
|
26
|
-
if (this.state.hasError) {
|
|
27
|
-
// You can render any custom fallback UI
|
|
28
|
-
return /*#__PURE__*/ _jsx(_Fragment, {});
|
|
29
|
-
}
|
|
30
|
-
// Return children components in case of no error
|
|
31
|
-
return this.props.children;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
//# sourceMappingURL=error-boundary.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/fields/TiptapEditor/extensions/error-boundary.tsx"],"sourcesContent":["import React, { ReactNode, ErrorInfo } from 'react';\n\ninterface ErrorBoundaryProps {\n children: ReactNode;\n}\n\ninterface ErrorBoundaryState {\n hasError: boolean;\n}\n\nexport class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {\n constructor(props: ErrorBoundaryProps) {\n super(props);\n\n // Define a state variable to track whether there is an error or not\n this.state = { hasError: false };\n }\n\n static getDerivedStateFromError(_: Error): ErrorBoundaryState {\n // Update state so the next render will show the fallback UI\n return { hasError: true };\n }\n\n componentDidCatch(error: Error, errorInfo: ErrorInfo) {\n // You can use your own error logging service here\n console.log({ error, errorInfo });\n }\n\n render() {\n // Check if the error is thrown\n if (this.state.hasError) {\n // You can render any custom fallback UI\n return <></>;\n }\n\n // Return children components in case of no error\n return this.props.children;\n }\n}\n\n"],"names":["React","ErrorBoundary","Component","constructor","props","state","hasError","getDerivedStateFromError","_","componentDidCatch","error","errorInfo","console","log","render","children"],"mappings":";AAAA,OAAOA,WAAqC,QAAQ;AAUpD,OAAO,MAAMC,sBAAsBD,MAAME,SAAS;IAChDC,YAAYC,KAAyB,CAAE;QACrC,KAAK,CAACA;QAEN,oEAAoE;QACpE,IAAI,CAACC,KAAK,GAAG;YAAEC,UAAU;QAAM;IACjC;IAEA,OAAOC,yBAAyBC,CAAQ,EAAsB;QAC5D,4DAA4D;QAC5D,OAAO;YAAEF,UAAU;QAAK;IAC1B;IAEAG,kBAAkBC,KAAY,EAAEC,SAAoB,EAAE;QACpD,kDAAkD;QAClDC,QAAQC,GAAG,CAAC;YAAEH;YAAOC;QAAU;IACjC;IAEAG,SAAS;QACP,+BAA+B;QAC/B,IAAI,IAAI,CAACT,KAAK,CAACC,QAAQ,EAAE;YACvB,wCAAwC;YACxC,qBAAO;QACT;QAEA,iDAAiD;QACjD,OAAO,IAAI,CAACF,KAAK,CAACW,QAAQ;IAC5B;AACF"}
|
|
@@ -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,EAAE;wBACnBC,OAAO;4BAAEC,YAAY,GAAG,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"}
|