@verdant-web/tiptap 1.0.1 → 2.1.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/dist/esm/__browserTests__/react.test.js +152 -13
- package/dist/esm/__browserTests__/react.test.js.map +1 -1
- package/dist/esm/extensions/NodeId.d.ts +2 -0
- package/dist/esm/extensions/NodeId.js +66 -0
- package/dist/esm/extensions/NodeId.js.map +1 -0
- package/dist/esm/{plugins.d.ts → extensions/Verdant.d.ts} +0 -1
- package/dist/esm/{plugins.js → extensions/Verdant.js} +24 -81
- package/dist/esm/extensions/Verdant.js.map +1 -0
- package/dist/esm/extensions/VerdantMedia.d.ts +30 -0
- package/dist/esm/extensions/VerdantMedia.js +261 -0
- package/dist/esm/extensions/VerdantMedia.js.map +1 -0
- package/dist/esm/fields.d.ts +45 -10
- package/dist/esm/fields.js +18 -1
- package/dist/esm/fields.js.map +1 -1
- package/dist/esm/index.d.ts +3 -1
- package/dist/esm/index.js +3 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/react.d.ts +4 -2
- package/dist/esm/react.js +12 -4
- package/dist/esm/react.js.map +1 -1
- package/package.json +9 -8
- package/src/__browserTests__/fixtures/cat.jpg +0 -0
- package/src/__browserTests__/fixtures/cat.m4a +0 -0
- package/src/__browserTests__/fixtures/cat.mp4 +0 -0
- package/src/__browserTests__/react.test.tsx +227 -14
- package/src/extensions/NodeId.ts +67 -0
- package/src/{plugins.ts → extensions/Verdant.ts} +22 -85
- package/src/extensions/VerdantMedia.ts +299 -0
- package/src/fields.ts +61 -10
- package/src/index.ts +3 -1
- package/src/react.ts +22 -9
- package/dist/esm/plugins.js.map +0 -1
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import { mergeAttributes, Node } from '@tiptap/core';
|
|
2
|
+
import { id, } from '@verdant-web/store';
|
|
3
|
+
const fileIdAttribute = 'data-verdant-file';
|
|
4
|
+
export const VerdantMediaExtension = Node.create({
|
|
5
|
+
name: 'verdant-media',
|
|
6
|
+
group: 'block',
|
|
7
|
+
draggable: true,
|
|
8
|
+
addOptions() {
|
|
9
|
+
return {
|
|
10
|
+
fileMap: null,
|
|
11
|
+
};
|
|
12
|
+
},
|
|
13
|
+
addAttributes() {
|
|
14
|
+
return {
|
|
15
|
+
[fileIdAttribute]: {
|
|
16
|
+
default: null,
|
|
17
|
+
},
|
|
18
|
+
alt: {
|
|
19
|
+
default: null,
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
parseHTML() {
|
|
24
|
+
return [
|
|
25
|
+
{
|
|
26
|
+
tag: `[${fileIdAttribute}]`,
|
|
27
|
+
getAttrs: (element) => {
|
|
28
|
+
const fileId = element.getAttribute(fileIdAttribute);
|
|
29
|
+
return {
|
|
30
|
+
[fileIdAttribute]: fileId,
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
];
|
|
35
|
+
},
|
|
36
|
+
renderHTML(props) {
|
|
37
|
+
const fileId = props.node.attrs[fileIdAttribute];
|
|
38
|
+
if (!fileId) {
|
|
39
|
+
return ['div', props.HTMLAttributes, 'Missing file'];
|
|
40
|
+
}
|
|
41
|
+
const file = this.options.fileMap.get(fileId);
|
|
42
|
+
if (!file) {
|
|
43
|
+
return ['div', props.HTMLAttributes, 'Missing file'];
|
|
44
|
+
}
|
|
45
|
+
if (file.loading) {
|
|
46
|
+
// this means the user didn't preload files before rendering...
|
|
47
|
+
return [
|
|
48
|
+
'div',
|
|
49
|
+
props.HTMLAttributes,
|
|
50
|
+
'Loading file. This file was not preloaded before rendering the document.',
|
|
51
|
+
];
|
|
52
|
+
}
|
|
53
|
+
const type = file.type;
|
|
54
|
+
if (type === null || type === void 0 ? void 0 : type.startsWith('image/')) {
|
|
55
|
+
return ['img', mergeAttributes({ src: file.url }, props.HTMLAttributes)];
|
|
56
|
+
}
|
|
57
|
+
else if (type === null || type === void 0 ? void 0 : type.startsWith('video/')) {
|
|
58
|
+
return [
|
|
59
|
+
'video',
|
|
60
|
+
mergeAttributes({ src: file.url }, props.HTMLAttributes),
|
|
61
|
+
];
|
|
62
|
+
}
|
|
63
|
+
else if (type === null || type === void 0 ? void 0 : type.startsWith('audio/')) {
|
|
64
|
+
return [
|
|
65
|
+
'audio',
|
|
66
|
+
mergeAttributes({ src: file.url }, props.HTMLAttributes),
|
|
67
|
+
];
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
// TODO: render file download
|
|
71
|
+
return ['div', props.HTMLAttributes, 'Unsupported file type'];
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
onBeforeCreate() {
|
|
75
|
+
this.editor.on('paste', (event) => {
|
|
76
|
+
var _a, _b;
|
|
77
|
+
const files = Array.from((_b = (_a = event.event.clipboardData) === null || _a === void 0 ? void 0 : _a.files) !== null && _b !== void 0 ? _b : []);
|
|
78
|
+
if (files.length === 0) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
for (const file of files) {
|
|
82
|
+
this.editor.chain().insertMedia(file).run();
|
|
83
|
+
}
|
|
84
|
+
event.event.preventDefault();
|
|
85
|
+
});
|
|
86
|
+
this.editor.on('drop', (event) => {
|
|
87
|
+
var _a, _b;
|
|
88
|
+
const files = Array.from((_b = (_a = event.event.dataTransfer) === null || _a === void 0 ? void 0 : _a.files) !== null && _b !== void 0 ? _b : []);
|
|
89
|
+
if (files.length === 0) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
for (const file of files) {
|
|
93
|
+
this.editor.chain().insertMedia(file).run();
|
|
94
|
+
}
|
|
95
|
+
event.event.preventDefault();
|
|
96
|
+
});
|
|
97
|
+
this.editor.on('update', ({ transaction }) => {
|
|
98
|
+
const fileIds = new Set();
|
|
99
|
+
transaction.doc.forEach((node) => {
|
|
100
|
+
if (node.attrs[fileIdAttribute]) {
|
|
101
|
+
fileIds.add(node.attrs[fileIdAttribute]);
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
transaction.before.forEach((node) => {
|
|
105
|
+
const fileId = node.attrs[fileIdAttribute];
|
|
106
|
+
if (fileId && !fileIds.has(fileId)) {
|
|
107
|
+
// the file was removed from the document
|
|
108
|
+
this.options.fileMap.delete(fileId);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
},
|
|
113
|
+
addCommands() {
|
|
114
|
+
return {
|
|
115
|
+
insertMedia: (file) => ({ commands }) => {
|
|
116
|
+
const fileId = id();
|
|
117
|
+
this.options.fileMap.set(fileId, file);
|
|
118
|
+
return commands.insertContent({
|
|
119
|
+
type: this.name,
|
|
120
|
+
attrs: {
|
|
121
|
+
[fileIdAttribute]: fileId,
|
|
122
|
+
},
|
|
123
|
+
}, {
|
|
124
|
+
updateSelection: false,
|
|
125
|
+
});
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
},
|
|
129
|
+
addNodeView() {
|
|
130
|
+
return ({ node, HTMLAttributes, extension }) => {
|
|
131
|
+
// create a root div to house all content
|
|
132
|
+
const root = document.createElement('div');
|
|
133
|
+
// we don't want users editing this content
|
|
134
|
+
root.setAttribute('contenteditable', 'false');
|
|
135
|
+
// attach any existing attributes if they are not null
|
|
136
|
+
Object.entries(HTMLAttributes).forEach(([key, value]) => {
|
|
137
|
+
if (value !== null) {
|
|
138
|
+
root.setAttribute(key, value);
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
// get the file ID from attrs
|
|
142
|
+
const fileId = node.attrs[fileIdAttribute];
|
|
143
|
+
if (!fileId) {
|
|
144
|
+
root.textContent = 'Missing file';
|
|
145
|
+
return {
|
|
146
|
+
dom: root,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
// look up the file in the file map
|
|
150
|
+
// NOTE: for convenience/typing, "this" is used
|
|
151
|
+
// here, but in a userland node view you'd use `extension`.
|
|
152
|
+
const file = this.options.fileMap.get(fileId);
|
|
153
|
+
// this is a helper function to reconstruct the DOM
|
|
154
|
+
// whenever the file changes
|
|
155
|
+
function updateRootContent() {
|
|
156
|
+
// clear the DOM
|
|
157
|
+
root.innerHTML = '';
|
|
158
|
+
if (file) {
|
|
159
|
+
// minimal loading state
|
|
160
|
+
if (file.loading) {
|
|
161
|
+
root.textContent = 'Loading...';
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
// minimal error state
|
|
165
|
+
if (file.failed) {
|
|
166
|
+
root.textContent = 'Failed to load file';
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
// it's unlikely we get here without a url
|
|
170
|
+
// but just in case
|
|
171
|
+
const url = file.url;
|
|
172
|
+
if (!url) {
|
|
173
|
+
root.textContent = 'Failed to load file';
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
// based on the file type, we try to render
|
|
177
|
+
// a useful DOM representation
|
|
178
|
+
const type = file.type;
|
|
179
|
+
if (type === null || type === void 0 ? void 0 : type.startsWith('image/')) {
|
|
180
|
+
const img = document.createElement('img');
|
|
181
|
+
img.src = file.url;
|
|
182
|
+
root.appendChild(img);
|
|
183
|
+
}
|
|
184
|
+
else if (type === null || type === void 0 ? void 0 : type.startsWith('video/')) {
|
|
185
|
+
const video = document.createElement('video');
|
|
186
|
+
video.src = file.url;
|
|
187
|
+
video.controls = true;
|
|
188
|
+
root.appendChild(video);
|
|
189
|
+
}
|
|
190
|
+
else if (type === null || type === void 0 ? void 0 : type.startsWith('audio/')) {
|
|
191
|
+
const audio = document.createElement('audio');
|
|
192
|
+
audio.src = file.url;
|
|
193
|
+
audio.controls = true;
|
|
194
|
+
root.appendChild(audio);
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
const a = document.createElement('a');
|
|
198
|
+
a.href = file.url;
|
|
199
|
+
a.textContent = 'Download';
|
|
200
|
+
root.appendChild(a);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
// if the file is not in the file map, we subscribe to changes
|
|
205
|
+
// to its key in the map, and update the DOM when it changes.
|
|
206
|
+
if (!file) {
|
|
207
|
+
const unsub = this.options.fileMap.subscribeToField(fileId, 'change', (file) => {
|
|
208
|
+
if (!file)
|
|
209
|
+
return;
|
|
210
|
+
// we can unsub after the first change, all further
|
|
211
|
+
// changes can be monitored on the file itself.
|
|
212
|
+
unsub();
|
|
213
|
+
file.subscribe('change', updateRootContent);
|
|
214
|
+
updateRootContent();
|
|
215
|
+
});
|
|
216
|
+
root.textContent = 'Missing file';
|
|
217
|
+
return {
|
|
218
|
+
dom: root,
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
// otherwise, we go ahead and render whatever we have, and
|
|
223
|
+
// subscribe to future changes on the file for further
|
|
224
|
+
// updates.
|
|
225
|
+
updateRootContent();
|
|
226
|
+
file.subscribe('change', updateRootContent);
|
|
227
|
+
return {
|
|
228
|
+
dom: root,
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
},
|
|
233
|
+
});
|
|
234
|
+
export function createVerdantMediaExtension(fileMap) {
|
|
235
|
+
return VerdantMediaExtension.configure({ fileMap });
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Preloads all files provided in the file map field. Use of this
|
|
239
|
+
* is highly recommended, if not required, when rendering a document
|
|
240
|
+
* to HTML. TipTap will not wait for files to load, so if they are
|
|
241
|
+
* not preloaded they will be blank in the rendered version.
|
|
242
|
+
*/
|
|
243
|
+
export async function preloadMedia(files) {
|
|
244
|
+
await Promise.all(Array.from(files.values()).map((file) => {
|
|
245
|
+
if (!file)
|
|
246
|
+
return Promise.resolve();
|
|
247
|
+
// since files immediately begin loading on access,
|
|
248
|
+
// we just wait for the file to finish loading
|
|
249
|
+
if (!file.loading)
|
|
250
|
+
return Promise.resolve();
|
|
251
|
+
return new Promise((resolve) => {
|
|
252
|
+
const unsub = file.subscribe('change', () => {
|
|
253
|
+
if (!file.loading) {
|
|
254
|
+
unsub();
|
|
255
|
+
resolve();
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
});
|
|
259
|
+
}));
|
|
260
|
+
}
|
|
261
|
+
//# sourceMappingURL=VerdantMedia.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VerdantMedia.js","sourceRoot":"","sources":["../../../src/extensions/VerdantMedia.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAGN,EAAE,GAEF,MAAM,oBAAoB,CAAC;AA2B5B,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAC5C,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC,MAAM,CAA+B;IAC9E,IAAI,EAAE,eAAe;IACrB,KAAK,EAAE,OAAO;IACd,SAAS,EAAE,IAAI;IACf,UAAU;QACT,OAAO;YACN,OAAO,EAAE,IAAW;SACpB,CAAC;IACH,CAAC;IACD,aAAa;QACZ,OAAO;YACN,CAAC,eAAe,CAAC,EAAE;gBAClB,OAAO,EAAE,IAAI;aACb;YACD,GAAG,EAAE;gBACJ,OAAO,EAAE,IAAI;aACb;SACD,CAAC;IACH,CAAC;IACD,SAAS;QACR,OAAO;YACN;gBACC,GAAG,EAAE,IAAI,eAAe,GAAG;gBAC3B,QAAQ,EAAE,CAAC,OAAO,EAAE,EAAE;oBACrB,MAAM,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;oBACrD,OAAO;wBACN,CAAC,eAAe,CAAC,EAAE,MAAM;qBACzB,CAAC;gBACH,CAAC;aACD;SACD,CAAC;IACH,CAAC;IACD,UAAU,CAAC,KAAK;QACf,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;QACjD,IAAI,CAAC,MAAM,EAAE,CAAC;YACb,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;QACtD,CAAC;QACD,MAAM,IAAI,GAAG,IAAI,CA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E,CAAC;QAC5C,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;YACpC,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,GAAG,EAAE;gBAC3C,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;oBACnB,KAAK,EAAE,CAAC;oBACR,OAAO,EAAE,CAAC;gBACX,CAAC;YACF,CAAC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CACF,CAAC;AACH,CAAC"}
|
package/dist/esm/fields.d.ts
CHANGED
|
@@ -1,16 +1,49 @@
|
|
|
1
|
-
import { ShapeFromProperty, StorageAnyFieldSchema, StorageArrayFieldSchema, StorageNumberFieldSchema, StorageObjectFieldSchema, StorageStringFieldSchema } from '@verdant-web/common';
|
|
1
|
+
import { ShapeFromProperty, StorageAnyFieldSchema, StorageArrayFieldSchema, StorageMapFieldSchema, StorageNumberFieldSchema, StorageObjectFieldSchema, StorageStringFieldSchema } from '@verdant-web/common';
|
|
2
|
+
import { ListEntity, ObjectEntity } from '@verdant-web/store';
|
|
2
3
|
export type TiptapFieldSchema = StorageObjectFieldSchema<{
|
|
3
4
|
type: StorageStringFieldSchema;
|
|
4
|
-
from: StorageNumberFieldSchema
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
from: StorageNumberFieldSchema & {
|
|
6
|
+
nullable: true;
|
|
7
|
+
};
|
|
8
|
+
to: StorageNumberFieldSchema & {
|
|
9
|
+
nullable: true;
|
|
10
|
+
};
|
|
11
|
+
attrs: StorageMapFieldSchema<StorageAnyFieldSchema>;
|
|
12
|
+
content: StorageArrayFieldSchema<TiptapFieldSchema> & {
|
|
13
|
+
nullable: true;
|
|
14
|
+
};
|
|
15
|
+
text: StorageStringFieldSchema & {
|
|
16
|
+
nullable: true;
|
|
17
|
+
};
|
|
18
|
+
marks: StorageArrayFieldSchema<TiptapFieldSchema> & {
|
|
19
|
+
nullable: true;
|
|
20
|
+
};
|
|
12
21
|
}>;
|
|
13
|
-
|
|
22
|
+
type PartialNull<T> = {
|
|
23
|
+
[K in keyof T]?: T[K] | null;
|
|
24
|
+
};
|
|
25
|
+
export type TipTapFieldInitializer = Pick<ShapeFromProperty<TiptapFieldSchema>, 'type'> & PartialNull<ShapeFromProperty<TiptapFieldSchema>>;
|
|
26
|
+
export type TipTapAttrsEntity = ObjectEntity<{
|
|
27
|
+
[key: string]: any;
|
|
28
|
+
}, {
|
|
29
|
+
[key: string]: any;
|
|
30
|
+
}, {
|
|
31
|
+
[key: string]: any;
|
|
32
|
+
}>;
|
|
33
|
+
export type TipTapContentEntity = ListEntity<TipTapFieldInitializer[], TipTapDocumentEntity[], ShapeFromProperty<TiptapFieldSchema>[]>;
|
|
34
|
+
/**
|
|
35
|
+
* NOTE: it's not recommended to use this type directly. Instead rely on the generated
|
|
36
|
+
* types from the Verdant CLI.
|
|
37
|
+
*/
|
|
38
|
+
export type TipTapDocumentEntity = ObjectEntity<TipTapFieldInitializer, {
|
|
39
|
+
type: string;
|
|
40
|
+
from: number | null;
|
|
41
|
+
to: number | null;
|
|
42
|
+
attrs: TipTapAttrsEntity;
|
|
43
|
+
content: TipTapContentEntity;
|
|
44
|
+
text: string | null;
|
|
45
|
+
marks: TipTapContentEntity;
|
|
46
|
+
}, ShapeFromProperty<TiptapFieldSchema>>;
|
|
14
47
|
/**
|
|
15
48
|
* Creates a generic TipTap schema field. You must invoke this and assign it
|
|
16
49
|
* individually to every TipTap document field in your schema, DO NOT reuse
|
|
@@ -19,3 +52,5 @@ export type TipTapFieldInitializer = Pick<ShapeFromProperty<TiptapFieldSchema>,
|
|
|
19
52
|
export declare function createTipTapFieldSchema(options: {
|
|
20
53
|
default: TipTapFieldInitializer | null;
|
|
21
54
|
}): TiptapFieldSchema;
|
|
55
|
+
export declare function createTipTapFileMapSchema(): StorageMapFieldSchema<import("@verdant-web/common").StorageFileFieldSchema>;
|
|
56
|
+
export {};
|
package/dist/esm/fields.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { schema, } from '@verdant-web/common';
|
|
2
|
+
const otherDefaults = {
|
|
3
|
+
content: [],
|
|
4
|
+
marks: null,
|
|
5
|
+
attrs: {},
|
|
6
|
+
from: null,
|
|
7
|
+
to: null,
|
|
8
|
+
text: null,
|
|
9
|
+
};
|
|
2
10
|
/**
|
|
3
11
|
* Creates a generic TipTap schema field. You must invoke this and assign it
|
|
4
12
|
* individually to every TipTap document field in your schema, DO NOT reuse
|
|
@@ -20,10 +28,12 @@ export function createTipTapFieldSchema(options) {
|
|
|
20
28
|
}),
|
|
21
29
|
content: schema.fields.array({
|
|
22
30
|
items: baseField,
|
|
31
|
+
nullable: true,
|
|
23
32
|
}),
|
|
24
33
|
text: schema.fields.string({ nullable: true }),
|
|
25
34
|
marks: schema.fields.array({
|
|
26
35
|
items: baseField,
|
|
36
|
+
nullable: true,
|
|
27
37
|
}),
|
|
28
38
|
});
|
|
29
39
|
const rootField = schema.fields.object({
|
|
@@ -36,20 +46,27 @@ export function createTipTapFieldSchema(options) {
|
|
|
36
46
|
}),
|
|
37
47
|
content: schema.fields.array({
|
|
38
48
|
items: nestedContent,
|
|
49
|
+
nullable: true,
|
|
39
50
|
}),
|
|
40
51
|
text: schema.fields.string({ nullable: true }),
|
|
41
52
|
marks: schema.fields.array({
|
|
42
53
|
items: nestedContent,
|
|
54
|
+
nullable: true,
|
|
43
55
|
}),
|
|
44
56
|
},
|
|
45
57
|
default: () => {
|
|
46
58
|
if (options.default === null) {
|
|
47
59
|
return null;
|
|
48
60
|
}
|
|
49
|
-
return structuredClone(options.default);
|
|
61
|
+
return Object.assign(Object.assign({}, otherDefaults), structuredClone(options.default));
|
|
50
62
|
},
|
|
51
63
|
nullable: options.default === null,
|
|
52
64
|
});
|
|
53
65
|
return rootField;
|
|
54
66
|
}
|
|
67
|
+
export function createTipTapFileMapSchema() {
|
|
68
|
+
return schema.fields.map({
|
|
69
|
+
values: schema.fields.file(),
|
|
70
|
+
});
|
|
71
|
+
}
|
|
55
72
|
//# sourceMappingURL=fields.js.map
|
package/dist/esm/fields.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../src/fields.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,MAAM,
|
|
1
|
+
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../src/fields.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,MAAM,GAQN,MAAM,qBAAqB,CAAC;AAmD7B,MAAM,aAAa,GAAG;IACrB,OAAO,EAAE,EAAE;IACX,KAAK,EAAE,IAAI;IACX,KAAK,EAAE,EAAE;IACT,IAAI,EAAE,IAAI;IACV,EAAE,EAAE,IAAI;IACR,IAAI,EAAE,IAAI;CACV,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAEvC;IACA,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CACd,8FAA8F,CAC9F,CAAC;IACH,CAAC;IAED,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;QACtC,MAAM,EAAE,EAAE;KACV,CAAC,CAAC;IACH,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE;QAClE,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE;QAC5B,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QAC9C,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QAC5C,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC;YACxB,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,G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AI,CAAC;YACb,CAAC;YACD,uCAAY,aAAa,GAAK,eAAe,CAAC,OAAO,CAAC,OAAO,CAAC,EAAG;QAClE,CAAC;QACD,QAAQ,EAAE,OAAO,CAAC,OAAO,KAAK,IAAI;KAClC,CAAC,CAAC;IAEH,OAAO,SAAgB,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,yBAAyB;IACxC,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC;QACxB,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;KAC5B,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/esm/index.d.ts
CHANGED
package/dist/esm/index.js
CHANGED
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,aAAa,CAAC"}
|
package/dist/esm/react.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { UseEditorOptions } from '@tiptap/react';
|
|
2
2
|
import { AnyEntity } from '@verdant-web/store';
|
|
3
|
-
import { VerdantExtensionOptions, type EntitySnapshot, type ValidEntityKey } from './
|
|
4
|
-
|
|
3
|
+
import { VerdantExtensionOptions, type EntitySnapshot, type ValidEntityKey } from './extensions/Verdant.js';
|
|
4
|
+
import { VerdantMediaFileMap } from './extensions/VerdantMedia.js';
|
|
5
|
+
export declare function useSyncedEditor<Ent extends AnyEntity<any, any, any>, Key extends ValidEntityKey<Ent>>(parent: Ent, fieldName: Key, { editorOptions: extraOptions, editorDependencies, nullDocumentDefault, extensionOptions, files, }?: {
|
|
5
6
|
editorOptions?: UseEditorOptions;
|
|
6
7
|
editorDependencies?: any[];
|
|
7
8
|
nullDocumentDefault?: EntitySnapshot<Ent, Key>;
|
|
8
9
|
extensionOptions?: Partial<VerdantExtensionOptions>;
|
|
10
|
+
files?: VerdantMediaFileMap;
|
|
9
11
|
}): import("@tiptap/react").Editor | null;
|
package/dist/esm/react.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { useEditor } from '@tiptap/react';
|
|
2
2
|
import { useRef, useState } from 'react';
|
|
3
|
-
import { VerdantExtension, } from './
|
|
4
|
-
|
|
3
|
+
import { VerdantExtension, } from './extensions/Verdant.js';
|
|
4
|
+
import { VerdantMediaExtension, } from './extensions/VerdantMedia.js';
|
|
5
|
+
export function useSyncedEditor(parent, fieldName, { editorOptions: extraOptions, editorDependencies, nullDocumentDefault, extensionOptions, files, } = {}) {
|
|
5
6
|
var _a;
|
|
6
7
|
const cachedOptions = useRef({
|
|
7
8
|
nullDocumentDefault,
|
|
@@ -13,10 +14,17 @@ export function useSyncedEditor(parent, fieldName, { editorOptions: extraOptions
|
|
|
13
14
|
};
|
|
14
15
|
// create a configured version of the Verdant extension, which handles
|
|
15
16
|
// the actual syncing of the editor content to the field
|
|
16
|
-
const [
|
|
17
|
+
const [extensions] = useState(() => [
|
|
18
|
+
VerdantExtension.configure(Object.assign({ parent, fieldName: fieldName, nullDocumentDefault }, extensionOptions)),
|
|
19
|
+
files
|
|
20
|
+
? VerdantMediaExtension.configure({
|
|
21
|
+
fileMap: files,
|
|
22
|
+
})
|
|
23
|
+
: undefined,
|
|
24
|
+
].filter((v) => !!v));
|
|
17
25
|
const editor = useEditor(Object.assign(Object.assign({}, extraOptions), { onContentError(props) {
|
|
18
26
|
console.error('Content error:', props.error);
|
|
19
|
-
}, extensions: [
|
|
27
|
+
}, extensions: [...extensions, ...((_a = extraOptions === null || extraOptions === void 0 ? void 0 : extraOptions.extensions) !== null && _a !== void 0 ? _a : [])] }), editorDependencies);
|
|
20
28
|
return editor;
|
|
21
29
|
}
|
|
22
30
|
//# sourceMappingURL=react.js.map
|
package/dist/esm/react.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.js","sourceRoot":"","sources":["../../src/react.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAoB,MAAM,eAAe,CAAC;AAE5D,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EACN,gBAAgB,GAIhB,MAAM,
|
|
1
|
+
{"version":3,"file":"react.js","sourceRoot":"","sources":["../../src/react.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAoB,MAAM,eAAe,CAAC;AAE5D,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EACN,gBAAgB,GAIhB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,qBAAqB,GAErB,MAAM,8BAA8B,CAAC;AAEtC,MAAM,UAAU,eAAe,CAI9B,MAAW,EACX,SAAc,EACd,EACC,aAAa,EAAE,YAAY,EAC3B,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,KAAK,MAOF,EAAE;;IAEN,MAAM,aAAa,GAAG,MAAM,CAAC;QAC5B,mBAAmB;QACnB,SAAS;KACT,CAAC,CAAC;IACH,aAAa,CAAC,OAAO,GAAG;QACvB,mBAAmB;QACnB,SAAS;KACT,CAAC;IACF,sEAAsE;IACtE,wDAAwD;IACxD,MAAM,CAAC,UAAU,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,CAClC;QACC,gBAAgB,CAAC,SAAS,iBACzB,MAAM,EACN,SAAS,EAAE,SAA4B,EACvC,mBAAmB,IAChB,gBAAgB,EAClB;QACF,KAAK;YACJ,CAAC,CAAC,qBAAqB,CAAC,SAAS,CAAC;gBAChC,OAAO,EAAE,KAAK;aACd,CAAC;YACH,CAAC,CAAC,SAAS;KACZ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CACpB,CAAC;IACF,MAAM,MAAM,GAAG,SAAS,iCAEnB,YAAY,KACf,cAAc,CAAC,KAAK;YACnB,OAAO,CAAC,KAAK,CAAC,gBAAgB,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;QAC9C,CAAC,EACD,UAAU,EAAE,CAAC,GAAG,UAAU,EAAE,GAAG,CAAC,MAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,UAAU,mCAAI,EAAE,CAAC,CAAC,KAEjE,kBAAkB,CAClB,CAAC;IAEF,OAAO,MAAM,CAAC;AACf,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verdant-web/tiptap",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"access": "public",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"@tiptap/pm": "^2.11.5",
|
|
27
27
|
"@tiptap/react": "^2.11.5",
|
|
28
28
|
"react": "^19.0.0",
|
|
29
|
-
"@verdant-web/react": "
|
|
30
|
-
"@verdant-web/store": "4.
|
|
29
|
+
"@verdant-web/react": "42.0.0",
|
|
30
|
+
"@verdant-web/store": "4.3.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependenciesMeta": {
|
|
33
33
|
"@verdant-web/react": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@verdant-web/common": "2.
|
|
44
|
+
"@verdant-web/common": "2.9.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"typescript": "5.7.3",
|
|
@@ -57,12 +57,13 @@
|
|
|
57
57
|
"playwright": "1.51.0",
|
|
58
58
|
"vite": "6.1.1",
|
|
59
59
|
"@vitejs/plugin-react": "4.3.4",
|
|
60
|
+
"@vitejs/plugin-basic-ssl": "2.0.0",
|
|
60
61
|
"react-dom": "19.0.0",
|
|
61
62
|
"@types/react-dom": "19.0.4",
|
|
62
|
-
"@verdant-web/store": "4.
|
|
63
|
-
"@verdant-web/react": "
|
|
64
|
-
"@verdant-web/
|
|
65
|
-
"@verdant-web/
|
|
63
|
+
"@verdant-web/store": "4.3.0",
|
|
64
|
+
"@verdant-web/react": "42.0.0",
|
|
65
|
+
"@verdant-web/server": "3.3.10",
|
|
66
|
+
"@verdant-web/cli": "4.8.2"
|
|
66
67
|
},
|
|
67
68
|
"scripts": {
|
|
68
69
|
"test": "vitest",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|