@knapsack/tiptap-utils 4.100.0 → 4.100.1--canary.7985.eb739a3.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/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/tiptap-extensions.d.ts +2 -10
- package/dist/tiptap-extensions.d.ts.map +1 -1
- package/dist/tiptap-extensions.js +2 -34
- package/dist/tiptap-extensions.js.map +1 -1
- package/package.json +8 -10
- package/src/index.ts +0 -1
- package/src/tiptap-extensions.ts +1 -45
- package/tsconfig.json +1 -7
- package/.turbo/turbo-test.log +0 -12
- package/dist/find-unrecognized-content.d.ts +0 -64
- package/dist/find-unrecognized-content.d.ts.map +0 -1
- package/dist/find-unrecognized-content.js +0 -297
- package/dist/find-unrecognized-content.js.map +0 -1
- package/dist/unrecognized-content-placeholder-node.d.ts +0 -16
- package/dist/unrecognized-content-placeholder-node.d.ts.map +0 -1
- package/dist/unrecognized-content-placeholder-node.js +0 -88
- package/dist/unrecognized-content-placeholder-node.js.map +0 -1
- package/dist/unsupported-formatting-node.d.ts +0 -10
- package/dist/unsupported-formatting-node.d.ts.map +0 -1
- package/dist/unsupported-formatting-node.js +0 -26
- package/dist/unsupported-formatting-node.js.map +0 -1
- package/src/find-unrecognized-content.ts +0 -386
- package/src/unrecognized-content-placeholder-node.ts +0 -94
- package/src/unsupported-formatting-node.ts +0 -27
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC"}
|
|
@@ -20,8 +20,6 @@ import { FileHandler } from '@tiptap/extension-file-handler';
|
|
|
20
20
|
import { FloatingMenu } from '@tiptap/extension-floating-menu';
|
|
21
21
|
import { Dropcursor, Gapcursor, Placeholder, UndoRedo } from '@tiptap/extensions';
|
|
22
22
|
import { Link } from './custom-link/link.js';
|
|
23
|
-
import { UnrecognizedContentPlaceholder, UnrecognizedContentPlaceholderBlock, UnrecognizedContentPlaceholderRoot } from './unrecognized-content-placeholder-node.js';
|
|
24
|
-
import { UnsupportedFormatting } from './unsupported-formatting-node.js';
|
|
25
23
|
export type { JSONContent, Editor };
|
|
26
24
|
export declare const baseExtensions: (import("@tiptap/core").Node<any, any> | import("@tiptap/core").Extension<any, any>)[];
|
|
27
25
|
/**
|
|
@@ -29,14 +27,8 @@ export declare const baseExtensions: (import("@tiptap/core").Node<any, any> | im
|
|
|
29
27
|
* so we do not include with the formatting options.
|
|
30
28
|
*/
|
|
31
29
|
export declare const formattingExtensions: (import("@tiptap/core").Node<import("@tiptap/extension-blockquote").BlockquoteOptions, any> | import("@tiptap/core").Mark<import("@tiptap/extension-bold").BoldOptions, any>)[];
|
|
32
|
-
export declare const listExtensions: (import("@tiptap/core").Node<import("@tiptap/extension-list").
|
|
30
|
+
export declare const listExtensions: (import("@tiptap/core").Node<import("@tiptap/extension-list").BulletListOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-list").ListItemOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-list").ListKeymapOptions, any>)[];
|
|
33
31
|
export declare const tableExtensions: import("@tiptap/core").Node<import("@tiptap/extension-table").TableRowOptions, any>[];
|
|
34
32
|
export declare const allExtensions: (import("@tiptap/core").Node<any, any> | import("@tiptap/core").Extension<any, any> | import("@tiptap/core").Mark<import("@tiptap/extension-bold").BoldOptions, any>)[];
|
|
35
|
-
|
|
36
|
-
* Node/Mark type names that can legitimately appear as a `type` value
|
|
37
|
-
* anywhere in a JSONContent tree. Plain `Extension`s (Dropcursor,
|
|
38
|
-
* Placeholder, UndoRedo, etc.) never do, so they're excluded.
|
|
39
|
-
*/
|
|
40
|
-
export declare const recognizedTiptapTypeNames: ReadonlySet<string>;
|
|
41
|
-
export { Doc, Dropcursor, FileHandler, FloatingMenu, Gapcursor, Placeholder, UndoRedo, Text, Paragraph, Blockquote, Bold, BulletList, Code, CodeBlock, HardBreak, Heading, Strike, HorizontalRule, Image, Italic, Link, ListItem, ListKeymap, OrderedList, Table, TableCell, TableHeader, TableRow, TextAlign, Underline, UnsupportedFormatting, UnrecognizedContentPlaceholder, UnrecognizedContentPlaceholderBlock, UnrecognizedContentPlaceholderRoot, };
|
|
33
|
+
export { Doc, Dropcursor, FileHandler, FloatingMenu, Gapcursor, Placeholder, UndoRedo, Text, Paragraph, Blockquote, Bold, BulletList, Code, CodeBlock, HardBreak, Heading, Strike, HorizontalRule, Image, Italic, Link, ListItem, ListKeymap, OrderedList, Table, TableCell, TableHeader, TableRow, TextAlign, Underline, };
|
|
42
34
|
//# sourceMappingURL=tiptap-extensions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tiptap-extensions.d.ts","sourceRoot":"","sources":["../src/tiptap-extensions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAChF,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,wBA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AM,EAAE,CAAC;AAGpC,eAAO,MAAM,cAAc,wFAUD,CAAC;AAE3B;;;GAGG;AACH,eAAO,MAAM,oBAAoB,iLAQP,CAAC;AAE3B,eAAO,MAAM,cAAc,2QAY1B,CAAC;AAEF,eAAO,MAAM,eAAe,uFAKF,CAAC;AAE3B,eAAO,MAAM,aAAa,yKAWzB,CAAC;AAMF,OAAO,EACL,GAAG,EACH,UAAU,EACV,WAAW,EACX,YAAY,EACZ,SAAS,EACT,WAAW,EACX,QAAQ,EACR,IAAI,EACJ,SAAS,EACT,UAAU,EACV,IAAI,EACJ,UAAU,EACV,IAAI,EACJ,SAAS,EACT,SAAS,EACT,OAAO,EACP,MAAM,EACN,cAAc,EACd,KAAK,EACL,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,WAAW,EACX,KAAK,EACL,SAAS,EACT,WAAW,EACX,QAAQ,EACR,SAAS,EACT,SAAS,GACV,CAAC"}
|
|
@@ -20,8 +20,6 @@ import { FloatingMenu } from '@tiptap/extension-floating-menu';
|
|
|
20
20
|
import { Dropcursor, Gapcursor, Placeholder, UndoRedo, } from '@tiptap/extensions';
|
|
21
21
|
// Custom extensions
|
|
22
22
|
import { Link } from './custom-link/link.js';
|
|
23
|
-
import { UnrecognizedContentPlaceholder, UnrecognizedContentPlaceholderBlock, UnrecognizedContentPlaceholderRoot, } from './unrecognized-content-placeholder-node.js';
|
|
24
|
-
import { UnsupportedFormatting } from './unsupported-formatting-node.js';
|
|
25
23
|
// Required for all Editor instances
|
|
26
24
|
export const baseExtensions = [
|
|
27
25
|
Doc,
|
|
@@ -47,27 +45,9 @@ export const formattingExtensions = [
|
|
|
47
45
|
Strike,
|
|
48
46
|
Underline,
|
|
49
47
|
];
|
|
50
|
-
// `ListItem`'s stock content spec is `'paragraph block*'` - the first
|
|
51
|
-
// child must be a node literally named `paragraph`, not merely a member of
|
|
52
|
-
// the `block` group. `UnrecognizedContentPlaceholderBlock` (`group:
|
|
53
|
-
// 'block'`, see unrecognized-content-placeholder-node.ts) can be swapped
|
|
54
|
-
// in as any block-level child by `stripUnrecognizedTiptapContent`'s
|
|
55
|
-
// `'conceal'` mode - including a list item's first child, for legacy
|
|
56
|
-
// content where the removed/unrecognized type was there. Under the stock
|
|
57
|
-
// spec that produces a schema-invalid document, which is exactly the
|
|
58
|
-
// condition that makes tiptap silently empty the whole document - the bug
|
|
59
|
-
// this package exists to eliminate, just reintroduced one level down.
|
|
60
|
-
// Relaxed to `'block+'` (a plain node/mark spec change, not a behavioral
|
|
61
|
-
// override of any command) so any `block`-group node - including a real
|
|
62
|
-
// `paragraph` - can lead a list item; ProseMirror's list commands
|
|
63
|
-
// (splitListItem/sinkListItem/liftListItem, used via ListKeymap) query the
|
|
64
|
-
// content match generically and aren't hardcoded to the `paragraph` name.
|
|
65
|
-
const ListItemAnyBlockFirst = ListItem.extend({
|
|
66
|
-
content: 'block+',
|
|
67
|
-
});
|
|
68
48
|
export const listExtensions = [
|
|
69
49
|
BulletList,
|
|
70
|
-
|
|
50
|
+
ListItem,
|
|
71
51
|
OrderedList,
|
|
72
52
|
ListKeymap.configure({
|
|
73
53
|
listTypes: [
|
|
@@ -95,22 +75,10 @@ export const allExtensions = [
|
|
|
95
75
|
HorizontalRule,
|
|
96
76
|
Image,
|
|
97
77
|
Link,
|
|
98
|
-
UnsupportedFormatting,
|
|
99
|
-
UnrecognizedContentPlaceholder,
|
|
100
|
-
UnrecognizedContentPlaceholderBlock,
|
|
101
|
-
UnrecognizedContentPlaceholderRoot,
|
|
102
78
|
];
|
|
103
|
-
/**
|
|
104
|
-
* Node/Mark type names that can legitimately appear as a `type` value
|
|
105
|
-
* anywhere in a JSONContent tree. Plain `Extension`s (Dropcursor,
|
|
106
|
-
* Placeholder, UndoRedo, etc.) never do, so they're excluded.
|
|
107
|
-
*/
|
|
108
|
-
export const recognizedTiptapTypeNames = new Set(allExtensions
|
|
109
|
-
.filter((e) => e.type === 'node' || e.type === 'mark')
|
|
110
|
-
.map((e) => e.name));
|
|
111
79
|
// These need to get exported out as well so that each of their `import`
|
|
112
80
|
// statements exist in outputted code. That is needed because the TypeScript
|
|
113
81
|
// Declaration Merging of `@tiptap/core` to ensure that the `Editor` type has
|
|
114
82
|
// `Commands` from each of these extensions.
|
|
115
|
-
export { Doc, Dropcursor, FileHandler, FloatingMenu, Gapcursor, Placeholder, UndoRedo, Text, Paragraph, Blockquote, Bold, BulletList, Code, CodeBlock, HardBreak, Heading, Strike, HorizontalRule, Image, Italic, Link, ListItem, ListKeymap, OrderedList, Table, TableCell, TableHeader, TableRow, TextAlign, Underline,
|
|
83
|
+
export { Doc, Dropcursor, FileHandler, FloatingMenu, Gapcursor, Placeholder, UndoRedo, Text, Paragraph, Blockquote, Bold, BulletList, Code, CodeBlock, HardBreak, Heading, Strike, HorizontalRule, Image, Italic, Link, ListItem, ListKeymap, OrderedList, Table, TableCell, TableHeader, TableRow, TextAlign, Underline, };
|
|
116
84
|
//# sourceMappingURL=tiptap-extensions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tiptap-extensions.js","sourceRoot":"","sources":["../src/tiptap-extensions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,QAAQ,IAAI,GAAG,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,0BA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EAAE,CAAC,YAAY,EAAE,aAAa,CAAC;aAC5C;SACF;KACF,CAAC;CACH,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,KAAK;IACL,QAAQ;IACR,WAAW;IACX,SAAS;CACe,CAAC;AAE3B,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,GAAG,cAAc;IACjB,GAAG,oBAAoB;IACvB,GAAG,cAAc;IACjB,GAAG,eAAe;IAClB,OAAO,CAAC,SAAS,CAAC;QAChB,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;KACxB,CAAC;IACF,cAAc;IACd,KAAK;IACL,IAAI;CACL,CAAC;AAEF,wEAAwE;AACxE,4EAA4E;AAC5E,6EAA6E;AAC7E,4CAA4C;AAC5C,OAAO,EACL,GAAG,EACH,UAAU,EACV,WAAW,EACX,YAAY,EACZ,SAAS,EACT,WAAW,EACX,QAAQ,EACR,IAAI,EACJ,SAAS,EACT,UAAU,EACV,IAAI,EACJ,UAAU,EACV,IAAI,EACJ,SAAS,EACT,SAAS,EACT,OAAO,EACP,MAAM,EACN,cAAc,EACd,KAAK,EACL,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,WAAW,EACX,KAAK,EACL,SAAS,EACT,WAAW,EACX,QAAQ,EACR,SAAS,EACT,SAAS,GACV,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knapsack/tiptap-utils",
|
|
3
3
|
"description": "",
|
|
4
|
-
"version": "4.100.0",
|
|
4
|
+
"version": "4.100.1--canary.7985.eb739a3.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
@@ -15,11 +15,10 @@
|
|
|
15
15
|
"scripts": {
|
|
16
16
|
"build": "tsc",
|
|
17
17
|
"clean": "rm -rf dist",
|
|
18
|
-
"lint": "eslint ./"
|
|
19
|
-
"test": "tsc -p tsconfig.test.json && vitest run"
|
|
18
|
+
"lint": "eslint ./"
|
|
20
19
|
},
|
|
21
20
|
"dependencies": {
|
|
22
|
-
"@knapsack/utils": "4.100.0",
|
|
21
|
+
"@knapsack/utils": "4.100.1--canary.7985.eb739a3.0",
|
|
23
22
|
"@tiptap/core": "^3.24.0",
|
|
24
23
|
"@tiptap/extension-blockquote": "^3.24.0",
|
|
25
24
|
"@tiptap/extension-bold": "^3.24.0",
|
|
@@ -47,13 +46,12 @@
|
|
|
47
46
|
"linkifyjs": "^4.3.2"
|
|
48
47
|
},
|
|
49
48
|
"devDependencies": {
|
|
50
|
-
"@knapsack/eslint-config-starter": "4.100.0",
|
|
51
|
-
"@knapsack/prettier-config": "4.100.0",
|
|
52
|
-
"@knapsack/typescript-config-starter": "4.100.0",
|
|
49
|
+
"@knapsack/eslint-config-starter": "4.100.1--canary.7985.eb739a3.0",
|
|
50
|
+
"@knapsack/prettier-config": "4.100.1--canary.7985.eb739a3.0",
|
|
51
|
+
"@knapsack/typescript-config-starter": "4.100.1--canary.7985.eb739a3.0",
|
|
53
52
|
"@types/node": "^24.13.2",
|
|
54
53
|
"eslint": "^9.20.0",
|
|
55
|
-
"typescript": "^6.0.3"
|
|
56
|
-
"vitest": "^4.1.9"
|
|
54
|
+
"typescript": "^6.0.3"
|
|
57
55
|
},
|
|
58
56
|
"license": "GPL-2.0-or-later",
|
|
59
57
|
"publishConfig": {
|
|
@@ -64,5 +62,5 @@
|
|
|
64
62
|
"directory": "libs/tiptap-utils",
|
|
65
63
|
"type": "git"
|
|
66
64
|
},
|
|
67
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "eb739a3cd2db8ea086b59da709826b3d73cb8607"
|
|
68
66
|
}
|
package/src/index.ts
CHANGED
package/src/tiptap-extensions.ts
CHANGED
|
@@ -37,12 +37,6 @@ import {
|
|
|
37
37
|
|
|
38
38
|
// Custom extensions
|
|
39
39
|
import { Link } from './custom-link/link.js';
|
|
40
|
-
import {
|
|
41
|
-
UnrecognizedContentPlaceholder,
|
|
42
|
-
UnrecognizedContentPlaceholderBlock,
|
|
43
|
-
UnrecognizedContentPlaceholderRoot,
|
|
44
|
-
} from './unrecognized-content-placeholder-node.js';
|
|
45
|
-
import { UnsupportedFormatting } from './unsupported-formatting-node.js';
|
|
46
40
|
|
|
47
41
|
export type { JSONContent, Editor };
|
|
48
42
|
|
|
@@ -73,28 +67,9 @@ export const formattingExtensions = [
|
|
|
73
67
|
Underline,
|
|
74
68
|
] satisfies AnyExtension[];
|
|
75
69
|
|
|
76
|
-
// `ListItem`'s stock content spec is `'paragraph block*'` - the first
|
|
77
|
-
// child must be a node literally named `paragraph`, not merely a member of
|
|
78
|
-
// the `block` group. `UnrecognizedContentPlaceholderBlock` (`group:
|
|
79
|
-
// 'block'`, see unrecognized-content-placeholder-node.ts) can be swapped
|
|
80
|
-
// in as any block-level child by `stripUnrecognizedTiptapContent`'s
|
|
81
|
-
// `'conceal'` mode - including a list item's first child, for legacy
|
|
82
|
-
// content where the removed/unrecognized type was there. Under the stock
|
|
83
|
-
// spec that produces a schema-invalid document, which is exactly the
|
|
84
|
-
// condition that makes tiptap silently empty the whole document - the bug
|
|
85
|
-
// this package exists to eliminate, just reintroduced one level down.
|
|
86
|
-
// Relaxed to `'block+'` (a plain node/mark spec change, not a behavioral
|
|
87
|
-
// override of any command) so any `block`-group node - including a real
|
|
88
|
-
// `paragraph` - can lead a list item; ProseMirror's list commands
|
|
89
|
-
// (splitListItem/sinkListItem/liftListItem, used via ListKeymap) query the
|
|
90
|
-
// content match generically and aren't hardcoded to the `paragraph` name.
|
|
91
|
-
const ListItemAnyBlockFirst = ListItem.extend({
|
|
92
|
-
content: 'block+',
|
|
93
|
-
});
|
|
94
|
-
|
|
95
70
|
export const listExtensions = [
|
|
96
71
|
BulletList,
|
|
97
|
-
|
|
72
|
+
ListItem,
|
|
98
73
|
OrderedList,
|
|
99
74
|
ListKeymap.configure({
|
|
100
75
|
listTypes: [
|
|
@@ -124,23 +99,8 @@ export const allExtensions = [
|
|
|
124
99
|
HorizontalRule,
|
|
125
100
|
Image,
|
|
126
101
|
Link,
|
|
127
|
-
UnsupportedFormatting,
|
|
128
|
-
UnrecognizedContentPlaceholder,
|
|
129
|
-
UnrecognizedContentPlaceholderBlock,
|
|
130
|
-
UnrecognizedContentPlaceholderRoot,
|
|
131
102
|
];
|
|
132
103
|
|
|
133
|
-
/**
|
|
134
|
-
* Node/Mark type names that can legitimately appear as a `type` value
|
|
135
|
-
* anywhere in a JSONContent tree. Plain `Extension`s (Dropcursor,
|
|
136
|
-
* Placeholder, UndoRedo, etc.) never do, so they're excluded.
|
|
137
|
-
*/
|
|
138
|
-
export const recognizedTiptapTypeNames: ReadonlySet<string> = new Set(
|
|
139
|
-
allExtensions
|
|
140
|
-
.filter((e) => e.type === 'node' || e.type === 'mark')
|
|
141
|
-
.map((e) => e.name),
|
|
142
|
-
);
|
|
143
|
-
|
|
144
104
|
// These need to get exported out as well so that each of their `import`
|
|
145
105
|
// statements exist in outputted code. That is needed because the TypeScript
|
|
146
106
|
// Declaration Merging of `@tiptap/core` to ensure that the `Editor` type has
|
|
@@ -176,8 +136,4 @@ export {
|
|
|
176
136
|
TableRow,
|
|
177
137
|
TextAlign,
|
|
178
138
|
Underline,
|
|
179
|
-
UnsupportedFormatting,
|
|
180
|
-
UnrecognizedContentPlaceholder,
|
|
181
|
-
UnrecognizedContentPlaceholderBlock,
|
|
182
|
-
UnrecognizedContentPlaceholderRoot,
|
|
183
139
|
};
|
package/tsconfig.json
CHANGED
package/.turbo/turbo-test.log
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
$ tsc -p tsconfig.test.json && vitest run
|
|
2
|
-
|
|
3
|
-
[1m[30m[46m RUN [49m[39m[22m [36mv4.1.9 [39m[90m/home/runner/work/app-monorepo/app-monorepo/libs/tiptap-utils[39m
|
|
4
|
-
|
|
5
|
-
[32m✓[39m src/find-unrecognized-content.test.ts [2m([22m[2m30 tests[22m[2m)[22m[32m 12[2mms[22m[39m
|
|
6
|
-
[32m✓[39m src/conceal-mode-schema-validity.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 13[2mms[22m[39m
|
|
7
|
-
|
|
8
|
-
[2m Test Files [22m [1m[32m2 passed[39m[22m[90m (2)[39m
|
|
9
|
-
[2m Tests [22m [1m[32m33 passed[39m[22m[90m (33)[39m
|
|
10
|
-
[2m Start at [22m 19:24:58
|
|
11
|
-
[2m Duration [22m 320ms[2m (transform 146ms, setup 0ms, import 250ms, tests 26ms, environment 0ms)[22m
|
|
12
|
-
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import type { JSONContent } from '@tiptap/core';
|
|
2
|
-
/**
|
|
3
|
-
* `'salvage'` (used for admins, and for Doctor's explicit Fix action):
|
|
4
|
-
* unrecognized nodes are replaced with their plain-text content, visibly
|
|
5
|
-
* flagged via an `unsupportedFormatting` node - an explicit, visible fix.
|
|
6
|
-
*
|
|
7
|
-
* `'conceal'` (used for everyone else): unrecognized content must not
|
|
8
|
-
* render or be visible at all, but also must not be destroyed by an
|
|
9
|
-
* unrelated edit elsewhere in the same document - only an admin's explicit
|
|
10
|
-
* action should ever cause it to be dropped. Each unrecognized node is
|
|
11
|
-
* replaced with an invisible `unrecognizedContentPlaceholder(Block)` node
|
|
12
|
-
* carrying the exact original JSON in an opaque attr; `restoreConcealedContent`
|
|
13
|
-
* splices it back in verbatim before a save is persisted.
|
|
14
|
-
*/
|
|
15
|
-
export type UnrecognizedContentMode = 'salvage' | 'conceal';
|
|
16
|
-
/**
|
|
17
|
-
* Walks a JSONContent tree (node.type, node.marks[].type at every level,
|
|
18
|
-
* including nested `content` arrays) and returns the deduped list of type
|
|
19
|
-
* names not present in `recognizedTypeNames`. Never calls
|
|
20
|
-
* `schema.nodeFromJSON`/`createNodeFromContent` - cannot trigger tiptap's
|
|
21
|
-
* destructive "empty the whole doc" fallback.
|
|
22
|
-
*/
|
|
23
|
-
export declare function findUnrecognizedTiptapTypes(content: JSONContent | null | undefined, recognizedTypeNames: ReadonlySet<string>): string[];
|
|
24
|
-
/**
|
|
25
|
-
* Returns a new tree with the unrecognized nodes/marks handled per `mode`
|
|
26
|
-
* (see `UnrecognizedContentMode`) - every recognized sibling/ancestor is
|
|
27
|
-
* left untouched. Unrecognized marks are mode-dependent, like unrecognized
|
|
28
|
-
* nodes: `'salvage'` drops the mark from the node's `marks` array, leaving
|
|
29
|
-
* the text unstyled and visibly rendering; `'conceal'` preserves the mark
|
|
30
|
-
* losslessly by concealing the whole marked node behind the same
|
|
31
|
-
* placeholder mechanism used for unrecognized node types, since dropping
|
|
32
|
-
* it would otherwise permanently destroy data conceal mode guarantees
|
|
33
|
-
* survives until an admin explicitly acts. Only if the root node's own
|
|
34
|
-
* `type` is unrecognized and nothing was preserved (salvage mode with no
|
|
35
|
-
* text) does this fall back to an empty doc, since there's no parent to
|
|
36
|
-
* replace it in place - reported via `removedTypes` either way, never
|
|
37
|
-
* silent to the caller.
|
|
38
|
-
*/
|
|
39
|
-
export declare function stripUnrecognizedTiptapContent(content: JSONContent | null | undefined, recognizedTypeNames: ReadonlySet<string>, { mode }?: {
|
|
40
|
-
mode?: UnrecognizedContentMode;
|
|
41
|
-
}): {
|
|
42
|
-
content: JSONContent | null | undefined;
|
|
43
|
-
removedTypes: string[];
|
|
44
|
-
};
|
|
45
|
-
/**
|
|
46
|
-
* Reverses `stripUnrecognizedTiptapContent`'s `mode: 'conceal'` - splices
|
|
47
|
-
* each `unrecognizedContentPlaceholder(Block)` node back into its exact
|
|
48
|
-
* original JSON before a save is persisted, so the original unrecognized
|
|
49
|
-
* content survives edits made anywhere else in the same document. A no-op
|
|
50
|
-
* on content with no placeholders (e.g. anything produced in `'salvage'`
|
|
51
|
-
* mode), so it's always safe to call unconditionally before saving.
|
|
52
|
-
*
|
|
53
|
-
* A placeholder's `original` attr is untrusted (see `parseOriginal`'s doc
|
|
54
|
-
* comment) - anything that doesn't parse, or doesn't look like plausible
|
|
55
|
-
* JSONContent, is left as the placeholder rather than spliced in. This
|
|
56
|
-
* bounds a forged placeholder's damage to "stays invisibly inert" instead
|
|
57
|
-
* of crashing the save or injecting arbitrary structure into the document;
|
|
58
|
-
* it does not (and can't, without signing the payload) distinguish a
|
|
59
|
-
* well-formed forged node from genuinely concealed content, since neither
|
|
60
|
-
* carries any proof of where it came from.
|
|
61
|
-
*/
|
|
62
|
-
export declare function restoreConcealedContent(content: JSONContent): JSONContent;
|
|
63
|
-
export declare function restoreConcealedContent(content: JSONContent | null | undefined): JSONContent | null | undefined;
|
|
64
|
-
//# sourceMappingURL=find-unrecognized-content.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"find-unrecognized-content.d.ts","sourceRoot":"","sources":["../src/find-unrecognized-content.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AA4GhD;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,uBAAuB,GAAG,SAAS,GAAG,SAAS,CAAC;AA8D5D;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,EACvC,mBAAmB,EAAE,WAAW,CAAC,MAAM,CAAC,GACvC,MAAM,EAAE,CAKV;AA2DD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,EACvC,mBAAmB,EAAE,WAAW,CAAC,MAAM,CAAC,EACxC,EAAE,IAAgB,EAAE,GAAE;IAAE,IAAI,CAAC,EAAE,uBAAuB,CAAA;CAAO,GAC5D;IAAE,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,CAAC;IAAC,YAAY,EAAE,MAAM,EAAE,CAAA;CAAE,CA8CrE;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,WAAW,GAAG,WAAW,CAAC;AAC3E,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GACtC,WAAW,GAAG,IAAI,GAAG,SAAS,CAAC"}
|