@crashbytes/contentful-richtext-editor 1.0.0
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/README.md +0 -0
- package/dist/components/ContentfulDocument.d.ts +2 -0
- package/dist/components/ContentfulEditor.d.ts +25 -0
- package/dist/components/ContentfulEmbedded.d.ts +3 -0
- package/dist/components/Toolbar.d.ts +10 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.esm.css +1 -0
- package/dist/index.esm.js +27406 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +27413 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/contentfulTransform.d.ts +28 -0
- package/dist/utils/types.d.ts +28 -0
- package/package.json +62 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Document } from '@contentful/rich-text-types';
|
|
2
|
+
interface TiptapNode {
|
|
3
|
+
type: string;
|
|
4
|
+
attrs?: Record<string, any>;
|
|
5
|
+
content?: TiptapNode[];
|
|
6
|
+
text?: string;
|
|
7
|
+
marks?: Array<{
|
|
8
|
+
type: string;
|
|
9
|
+
attrs?: Record<string, any>;
|
|
10
|
+
}>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Converts a Contentful Rich Text Document to Tiptap JSON format
|
|
14
|
+
*/
|
|
15
|
+
export declare const contentfulToTiptap: (document: Document) => TiptapNode;
|
|
16
|
+
/**
|
|
17
|
+
* Converts Tiptap JSON format to Contentful Rich Text Document
|
|
18
|
+
*/
|
|
19
|
+
export declare const tiptapToContentful: (tiptapDoc: any) => Document;
|
|
20
|
+
/**
|
|
21
|
+
* Validates if a Contentful document is properly formatted
|
|
22
|
+
*/
|
|
23
|
+
export declare const validateContentfulDocument: (document: any) => document is Document;
|
|
24
|
+
/**
|
|
25
|
+
* Creates an empty Contentful document
|
|
26
|
+
*/
|
|
27
|
+
export declare const createEmptyDocument: () => Document;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export type ContentfulEditorTheme = 'default' | 'minimal' | 'contentful';
|
|
2
|
+
export interface EmbeddedEntry {
|
|
3
|
+
sys: {
|
|
4
|
+
id: string;
|
|
5
|
+
type: string;
|
|
6
|
+
contentType: {
|
|
7
|
+
sys: {
|
|
8
|
+
id: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
fields: Record<string, any>;
|
|
13
|
+
}
|
|
14
|
+
export interface EmbeddedAsset {
|
|
15
|
+
sys: {
|
|
16
|
+
id: string;
|
|
17
|
+
type: string;
|
|
18
|
+
};
|
|
19
|
+
fields: {
|
|
20
|
+
title?: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
file?: {
|
|
23
|
+
url: string;
|
|
24
|
+
fileName: string;
|
|
25
|
+
contentType: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@crashbytes/contentful-richtext-editor",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A Tiptap-based rich text editor compatible with Contentful's rich text format",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"module": "dist/index.esm.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"keywords": [
|
|
13
|
+
"contentful",
|
|
14
|
+
"tiptap",
|
|
15
|
+
"rich-text",
|
|
16
|
+
"editor",
|
|
17
|
+
"react"
|
|
18
|
+
],
|
|
19
|
+
"author": "CrashBytes",
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "git+https://github.com/CrashBytes/contentful-richtext-editor.git"
|
|
24
|
+
},
|
|
25
|
+
"homepage": "https://github.com/CrashBytes/contentful-richtext-editor#readme",
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "rollup -c",
|
|
28
|
+
"build:watch": "rollup -c -w",
|
|
29
|
+
"dev": "rollup -c -w",
|
|
30
|
+
"clean": "rm -rf dist",
|
|
31
|
+
"prepublishOnly": "npm run clean && npm run build"
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"react": ">=16.8.0",
|
|
35
|
+
"react-dom": ">=16.8.0"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@contentful/rich-text-types": "^16.0.0",
|
|
39
|
+
"@tiptap/extension-link": "^2.0.0",
|
|
40
|
+
"@tiptap/extension-table": "^2.0.0",
|
|
41
|
+
"@tiptap/extension-table-cell": "^2.0.0",
|
|
42
|
+
"@tiptap/extension-table-header": "^2.0.0",
|
|
43
|
+
"@tiptap/extension-table-row": "^2.0.0",
|
|
44
|
+
"@tiptap/extension-text-style": "^2.0.0",
|
|
45
|
+
"@tiptap/extension-underline": "^2.0.0",
|
|
46
|
+
"@tiptap/pm": "^2.0.0",
|
|
47
|
+
"@tiptap/react": "^2.0.0",
|
|
48
|
+
"@tiptap/starter-kit": "^2.0.0"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@rollup/plugin-commonjs": "^24.0.0",
|
|
52
|
+
"@rollup/plugin-node-resolve": "^15.0.0",
|
|
53
|
+
"@rollup/plugin-typescript": "^11.0.0",
|
|
54
|
+
"@types/react": "^18.0.0",
|
|
55
|
+
"@types/react-dom": "^18.0.0",
|
|
56
|
+
"rollup": "^3.0.0",
|
|
57
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
58
|
+
"rollup-plugin-postcss": "^4.0.2",
|
|
59
|
+
"tslib": "^2.8.1",
|
|
60
|
+
"typescript": "^5.0.0"
|
|
61
|
+
}
|
|
62
|
+
}
|