tiptap-rusty-parser 0.3.0 → 0.3.1
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/package.json
CHANGED
|
@@ -14,6 +14,10 @@ export class TiptapDoc {
|
|
|
14
14
|
* returns whether it was newly added.
|
|
15
15
|
*/
|
|
16
16
|
addMark(path: any, mark_type: string, attrs: any): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Add a mark (`mark_type` + optional `attrs`) over a `Range`.
|
|
19
|
+
*/
|
|
20
|
+
addMarkRange(path: any, range: any, mark_type: string, attrs: any): void;
|
|
17
21
|
/**
|
|
18
22
|
* Apply a change array (as produced by [`diff`](Self::diff)) in place.
|
|
19
23
|
*/
|
|
@@ -38,6 +42,10 @@ export class TiptapDoc {
|
|
|
38
42
|
* Child count of the node at `path`, or `undefined` if no such node.
|
|
39
43
|
*/
|
|
40
44
|
childCount(path: any): number | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Delete a `Range` from the inline content of the block at `path`.
|
|
47
|
+
*/
|
|
48
|
+
deleteRange(path: any, range: any): void;
|
|
41
49
|
/**
|
|
42
50
|
* Structural diff from this document to `other`; returns an array of
|
|
43
51
|
* change objects (each tagged with an `op`).
|
|
@@ -59,6 +67,11 @@ export class TiptapDoc {
|
|
|
59
67
|
* Insert `child` at `index` under the node at `path` (index clamped).
|
|
60
68
|
*/
|
|
61
69
|
insertChild(path: any, index: number, child: any): void;
|
|
70
|
+
/**
|
|
71
|
+
* Insert `text` (with optional `marks` array) at a `Position` within the
|
|
72
|
+
* inline content of the block at `path`.
|
|
73
|
+
*/
|
|
74
|
+
insertText(path: any, position: any, text: string, marks: any): void;
|
|
62
75
|
/**
|
|
63
76
|
* Invert a change array relative to this document (the pre-image); returns
|
|
64
77
|
* the reverse change array for undo. See `applyChanges`.
|
|
@@ -108,6 +121,14 @@ export class TiptapDoc {
|
|
|
108
121
|
* Remove all marks of `mark_type` from the node at `path`; returns the count removed.
|
|
109
122
|
*/
|
|
110
123
|
removeMark(path: any, mark_type: string): number;
|
|
124
|
+
/**
|
|
125
|
+
* Remove all marks of `mark_type` over a `Range`.
|
|
126
|
+
*/
|
|
127
|
+
removeMarkRange(path: any, range: any, mark_type: string): void;
|
|
128
|
+
/**
|
|
129
|
+
* Replace a `Range` with `text` (and optional `marks` array).
|
|
130
|
+
*/
|
|
131
|
+
replaceRange(path: any, range: any, text: string, marks: any): void;
|
|
111
132
|
/**
|
|
112
133
|
* Set attribute `key` to `value` on the node at `path`.
|
|
113
134
|
*/
|
|
@@ -136,6 +157,10 @@ export class TiptapDoc {
|
|
|
136
157
|
* Serialize the document to a JSON string.
|
|
137
158
|
*/
|
|
138
159
|
toJSONString(): string;
|
|
160
|
+
/**
|
|
161
|
+
* Toggle a mark (`mark_type` + optional `attrs`) over a `Range`.
|
|
162
|
+
*/
|
|
163
|
+
toggleMarkRange(path: any, range: any, mark_type: string, attrs: any): void;
|
|
139
164
|
/**
|
|
140
165
|
* Validate against a `schema` object; returns an array of violations
|
|
141
166
|
* (empty = valid).
|
|
@@ -36,6 +36,21 @@ export class TiptapDoc {
|
|
|
36
36
|
}
|
|
37
37
|
return ret[0] !== 0;
|
|
38
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Add a mark (`mark_type` + optional `attrs`) over a `Range`.
|
|
41
|
+
* @param {any} path
|
|
42
|
+
* @param {any} range
|
|
43
|
+
* @param {string} mark_type
|
|
44
|
+
* @param {any} attrs
|
|
45
|
+
*/
|
|
46
|
+
addMarkRange(path, range, mark_type, attrs) {
|
|
47
|
+
const ptr0 = passStringToWasm0(mark_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
48
|
+
const len0 = WASM_VECTOR_LEN;
|
|
49
|
+
const ret = wasm.tiptapdoc_addMarkRange(this.__wbg_ptr, path, range, ptr0, len0, attrs);
|
|
50
|
+
if (ret[1]) {
|
|
51
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
39
54
|
/**
|
|
40
55
|
* Apply a change array (as produced by [`diff`](Self::diff)) in place.
|
|
41
56
|
* @param {any} changes
|
|
@@ -109,6 +124,17 @@ export class TiptapDoc {
|
|
|
109
124
|
}
|
|
110
125
|
return ret[0] === Number.MAX_SAFE_INTEGER ? undefined : ret[0];
|
|
111
126
|
}
|
|
127
|
+
/**
|
|
128
|
+
* Delete a `Range` from the inline content of the block at `path`.
|
|
129
|
+
* @param {any} path
|
|
130
|
+
* @param {any} range
|
|
131
|
+
*/
|
|
132
|
+
deleteRange(path, range) {
|
|
133
|
+
const ret = wasm.tiptapdoc_deleteRange(this.__wbg_ptr, path, range);
|
|
134
|
+
if (ret[1]) {
|
|
135
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
112
138
|
/**
|
|
113
139
|
* Structural diff from this document to `other`; returns an array of
|
|
114
140
|
* change objects (each tagged with an `op`).
|
|
@@ -175,6 +201,22 @@ export class TiptapDoc {
|
|
|
175
201
|
throw takeFromExternrefTable0(ret[0]);
|
|
176
202
|
}
|
|
177
203
|
}
|
|
204
|
+
/**
|
|
205
|
+
* Insert `text` (with optional `marks` array) at a `Position` within the
|
|
206
|
+
* inline content of the block at `path`.
|
|
207
|
+
* @param {any} path
|
|
208
|
+
* @param {any} position
|
|
209
|
+
* @param {string} text
|
|
210
|
+
* @param {any} marks
|
|
211
|
+
*/
|
|
212
|
+
insertText(path, position, text, marks) {
|
|
213
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
214
|
+
const len0 = WASM_VECTOR_LEN;
|
|
215
|
+
const ret = wasm.tiptapdoc_insertText(this.__wbg_ptr, path, position, ptr0, len0, marks);
|
|
216
|
+
if (ret[1]) {
|
|
217
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
178
220
|
/**
|
|
179
221
|
* Invert a change array relative to this document (the pre-image); returns
|
|
180
222
|
* the reverse change array for undo. See `applyChanges`.
|
|
@@ -325,6 +367,35 @@ export class TiptapDoc {
|
|
|
325
367
|
}
|
|
326
368
|
return ret[0] >>> 0;
|
|
327
369
|
}
|
|
370
|
+
/**
|
|
371
|
+
* Remove all marks of `mark_type` over a `Range`.
|
|
372
|
+
* @param {any} path
|
|
373
|
+
* @param {any} range
|
|
374
|
+
* @param {string} mark_type
|
|
375
|
+
*/
|
|
376
|
+
removeMarkRange(path, range, mark_type) {
|
|
377
|
+
const ptr0 = passStringToWasm0(mark_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
378
|
+
const len0 = WASM_VECTOR_LEN;
|
|
379
|
+
const ret = wasm.tiptapdoc_removeMarkRange(this.__wbg_ptr, path, range, ptr0, len0);
|
|
380
|
+
if (ret[1]) {
|
|
381
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Replace a `Range` with `text` (and optional `marks` array).
|
|
386
|
+
* @param {any} path
|
|
387
|
+
* @param {any} range
|
|
388
|
+
* @param {string} text
|
|
389
|
+
* @param {any} marks
|
|
390
|
+
*/
|
|
391
|
+
replaceRange(path, range, text, marks) {
|
|
392
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
393
|
+
const len0 = WASM_VECTOR_LEN;
|
|
394
|
+
const ret = wasm.tiptapdoc_replaceRange(this.__wbg_ptr, path, range, ptr0, len0, marks);
|
|
395
|
+
if (ret[1]) {
|
|
396
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
328
399
|
/**
|
|
329
400
|
* Set attribute `key` to `value` on the node at `path`.
|
|
330
401
|
* @param {any} path
|
|
@@ -440,6 +511,21 @@ export class TiptapDoc {
|
|
|
440
511
|
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
441
512
|
}
|
|
442
513
|
}
|
|
514
|
+
/**
|
|
515
|
+
* Toggle a mark (`mark_type` + optional `attrs`) over a `Range`.
|
|
516
|
+
* @param {any} path
|
|
517
|
+
* @param {any} range
|
|
518
|
+
* @param {string} mark_type
|
|
519
|
+
* @param {any} attrs
|
|
520
|
+
*/
|
|
521
|
+
toggleMarkRange(path, range, mark_type, attrs) {
|
|
522
|
+
const ptr0 = passStringToWasm0(mark_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
523
|
+
const len0 = WASM_VECTOR_LEN;
|
|
524
|
+
const ret = wasm.tiptapdoc_toggleMarkRange(this.__wbg_ptr, path, range, ptr0, len0, attrs);
|
|
525
|
+
if (ret[1]) {
|
|
526
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
527
|
+
}
|
|
528
|
+
}
|
|
443
529
|
/**
|
|
444
530
|
* Validate against a `schema` object; returns an array of violations
|
|
445
531
|
* (empty = valid).
|
|
Binary file
|