@fibery/prosemirror-schema 4.21.0 → 4.23.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/lib/index.d.ts +10 -8
- package/lib/index.js +9 -26
- package/lib/src/attr-constraints.d.ts +15 -12
- package/lib/src/attr-constraints.js +128 -168
- package/lib/src/block-id-utils.d.ts +10 -7
- package/lib/src/block-id-utils.js +16 -39
- package/lib/src/create-schema.d.ts +16 -15
- package/lib/src/create-schema.js +204 -249
- package/lib/src/marks/code.d.ts +5 -2
- package/lib/src/marks/code.js +10 -10
- package/lib/src/marks/em.d.ts +5 -2
- package/lib/src/marks/em.js +19 -16
- package/lib/src/marks/hint-query.d.ts +5 -2
- package/lib/src/marks/hint-query.js +19 -22
- package/lib/src/marks/link.d.ts +5 -2
- package/lib/src/marks/link.js +40 -36
- package/lib/src/marks/linked-highlight.d.ts +9 -7
- package/lib/src/marks/linked-highlight.js +38 -51
- package/lib/src/marks/strike.d.ts +5 -2
- package/lib/src/marks/strike.js +6 -6
- package/lib/src/marks/strong.d.ts +5 -2
- package/lib/src/marks/strong.js +29 -29
- package/lib/src/marks/text-background-color.d.ts +16 -2
- package/lib/src/marks/text-background-color.js +63 -81
- package/lib/src/marks/underline.d.ts +5 -2
- package/lib/src/marks/underline.js +6 -6
- package/lib/src/nodes/callout.d.ts +29 -28
- package/lib/src/nodes/callout.js +58 -36
- package/lib/src/nodes/check-item.d.ts +13 -10
- package/lib/src/nodes/check-item.js +32 -33
- package/lib/src/nodes/check-list.d.ts +14 -11
- package/lib/src/nodes/check-list.js +23 -30
- package/lib/src/nodes/code-block.d.ts +5 -2
- package/lib/src/nodes/code-block.js +70 -101
- package/lib/src/nodes/column.d.ts +5 -2
- package/lib/src/nodes/column.js +28 -34
- package/lib/src/nodes/columns.d.ts +5 -2
- package/lib/src/nodes/columns.js +34 -36
- package/lib/src/nodes/emoji.d.ts +28 -26
- package/lib/src/nodes/emoji.js +38 -47
- package/lib/src/nodes/entity.d.ts +18 -16
- package/lib/src/nodes/entity.js +48 -49
- package/lib/src/nodes/fibery-view.d.ts +5 -2
- package/lib/src/nodes/fibery-view.js +38 -42
- package/lib/src/nodes/file.d.ts +37 -34
- package/lib/src/nodes/file.js +41 -40
- package/lib/src/nodes/heading.d.ts +6 -3
- package/lib/src/nodes/heading.js +57 -33
- package/lib/src/nodes/image-block.d.ts +5 -2
- package/lib/src/nodes/image-block.js +43 -42
- package/lib/src/nodes/important.d.ts +5 -2
- package/lib/src/nodes/important.js +14 -10
- package/lib/src/nodes/math-display.d.ts +5 -2
- package/lib/src/nodes/math-display.js +14 -15
- package/lib/src/nodes/math-inline.d.ts +5 -2
- package/lib/src/nodes/math-inline.js +14 -15
- package/lib/src/nodes/media.d.ts +6 -3
- package/lib/src/nodes/media.js +52 -68
- package/lib/src/nodes/mention.d.ts +12 -9
- package/lib/src/nodes/mention.js +36 -37
- package/lib/src/nodes/note.d.ts +5 -2
- package/lib/src/nodes/note.js +14 -10
- package/lib/src/nodes/paragraph.d.ts +5 -2
- package/lib/src/nodes/paragraph.js +32 -26
- package/lib/src/nodes/table-nodes.d.ts +5 -2
- package/lib/src/nodes/table-nodes.js +16 -20
- package/lib/src/nodes/types/inline-content.d.ts +10 -8
- package/lib/src/nodes/types/inline-content.js +0 -2
- package/lib/src/nodes/types/text.d.ts +7 -4
- package/lib/src/nodes/types/text.js +0 -2
- package/lib/src/nodes/video.d.ts +7 -4
- package/lib/src/nodes/video.js +49 -54
- package/lib/src/resizable-node-attrs.d.ts +29 -26
- package/lib/src/resizable-node-attrs.js +23 -34
- package/lib/src/transcription-node-attrs.d.ts +10 -7
- package/lib/src/transcription-node-attrs.js +8 -8
- package/lib/test-helpers/index.d.ts +7 -4
- package/lib/test-helpers/index.js +11 -15
- package/package.json +11 -4
package/lib/src/create-schema.js
CHANGED
|
@@ -1,251 +1,206 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
attrs["data-list-item-id"] = id;
|
|
195
|
-
}
|
|
196
|
-
return Object.keys(attrs).length ? ["li", attrs, 0] : ["li", 0];
|
|
197
|
-
},
|
|
198
|
-
});
|
|
199
|
-
// Every block node carries a unified "id" attr so blocks are addressable in
|
|
200
|
-
// collaborative editing and block-level APIs. paragraph/heading/code_block
|
|
201
|
-
// declare it in their own specs (mirrored into the deprecated "guid");
|
|
202
|
-
// check_list/check_item/columns/fiberyView/list_item already have "id".
|
|
203
|
-
// toDOM/parseDOM are deliberately left untouched here so pasted HTML never
|
|
204
|
-
// carries an id and cannot introduce duplicates.
|
|
205
|
-
const blocksNeedingId = [
|
|
206
|
-
"blockquote",
|
|
207
|
-
"horizontal_rule",
|
|
208
|
-
"bullet_list",
|
|
209
|
-
"ordered_list",
|
|
210
|
-
"table",
|
|
211
|
-
"table_row",
|
|
212
|
-
"table_cell",
|
|
213
|
-
"table_header",
|
|
214
|
-
"note",
|
|
215
|
-
"important",
|
|
216
|
-
"callout",
|
|
217
|
-
"media",
|
|
218
|
-
"video",
|
|
219
|
-
"imageBlock",
|
|
220
|
-
"math_display",
|
|
221
|
-
"column",
|
|
222
|
-
];
|
|
223
|
-
for (const name of blocksNeedingId) {
|
|
224
|
-
const spec = actualNodes.get(name);
|
|
225
|
-
actualNodes = actualNodes.update(name, {
|
|
226
|
-
...spec,
|
|
227
|
-
attrs: { ...spec.attrs, id: { default: null } },
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
return new prosemirror_model_1.Schema({
|
|
231
|
-
nodes: actualNodes,
|
|
232
|
-
marks: base.spec.marks
|
|
233
|
-
.addToEnd("strike", strike_1.strike)
|
|
234
|
-
.addToEnd("underline", underline_1.underline)
|
|
235
|
-
.addToEnd("hintQuery", hint_query_1.hintQuery)
|
|
236
|
-
// We leave mark key as "highlight" only because we don't want to do migration.
|
|
237
|
-
// "TextBackgroundColor" term is used everywhere through codebase.
|
|
238
|
-
.addToEnd("highlight", text_background_color_1.textBackgroundColor),
|
|
239
|
-
});
|
|
1
|
+
import { code } from "./marks/code.js";
|
|
2
|
+
import { em } from "./marks/em.js";
|
|
3
|
+
import { hintQuery } from "./marks/hint-query.js";
|
|
4
|
+
import { link } from "./marks/link.js";
|
|
5
|
+
import { makeLinkedHighlight, makeLinkedHighlightEntity } from "./marks/linked-highlight.js";
|
|
6
|
+
import { strike } from "./marks/strike.js";
|
|
7
|
+
import { strong } from "./marks/strong.js";
|
|
8
|
+
import { textBackgroundColor } from "./marks/text-background-color.js";
|
|
9
|
+
import { underline } from "./marks/underline.js";
|
|
10
|
+
import { makeCallout } from "./nodes/callout.js";
|
|
11
|
+
import { check_item } from "./nodes/check-item.js";
|
|
12
|
+
import { check_list } from "./nodes/check-list.js";
|
|
13
|
+
import { code_block } from "./nodes/code-block.js";
|
|
14
|
+
import { column } from "./nodes/column.js";
|
|
15
|
+
import { columns } from "./nodes/columns.js";
|
|
16
|
+
import { makeEmoji } from "./nodes/emoji.js";
|
|
17
|
+
import { entity } from "./nodes/entity.js";
|
|
18
|
+
import { fiberyView } from "./nodes/fibery-view.js";
|
|
19
|
+
import { file } from "./nodes/file.js";
|
|
20
|
+
import { makeHeading } from "./nodes/heading.js";
|
|
21
|
+
import { imageBlock } from "./nodes/image-block.js";
|
|
22
|
+
import { important } from "./nodes/important.js";
|
|
23
|
+
import { math_display } from "./nodes/math-display.js";
|
|
24
|
+
import { math_inline } from "./nodes/math-inline.js";
|
|
25
|
+
import { makeMedia } from "./nodes/media.js";
|
|
26
|
+
import { mention } from "./nodes/mention.js";
|
|
27
|
+
import { note } from "./nodes/note.js";
|
|
28
|
+
import { paragraph } from "./nodes/paragraph.js";
|
|
29
|
+
import { tableNodes } from "./nodes/table-nodes.js";
|
|
30
|
+
import { video } from "./nodes/video.js";
|
|
31
|
+
import { Schema } from "prosemirror-model";
|
|
32
|
+
import { marks, nodes } from "prosemirror-schema-basic";
|
|
33
|
+
import { addListNodes } from "prosemirror-schema-list";
|
|
34
|
+
//#region src/create-schema.ts
|
|
35
|
+
const createSchema = ({ sharedColorGenerator = null, headingToDOM = null, mediaToDom = null, isImageBlockEnabled = false, fiberyViewEnabled = false, emojiOptions } = {}) => {
|
|
36
|
+
nodes.code_block = code_block;
|
|
37
|
+
nodes.paragraph = paragraph;
|
|
38
|
+
nodes.heading = makeHeading({ headingToDOM });
|
|
39
|
+
const base = new Schema({
|
|
40
|
+
nodes,
|
|
41
|
+
marks: {
|
|
42
|
+
link,
|
|
43
|
+
em,
|
|
44
|
+
strong,
|
|
45
|
+
code,
|
|
46
|
+
linkedhighlight: makeLinkedHighlight({ sharedColorGenerator }),
|
|
47
|
+
linkedhighlightentity: makeLinkedHighlightEntity({ sharedColorGenerator })
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
const customNodes = {
|
|
51
|
+
note,
|
|
52
|
+
important,
|
|
53
|
+
entity,
|
|
54
|
+
mention,
|
|
55
|
+
media: makeMedia({ mediaToDom }),
|
|
56
|
+
check_item,
|
|
57
|
+
check_list,
|
|
58
|
+
video,
|
|
59
|
+
file,
|
|
60
|
+
emoji: makeEmoji(emojiOptions),
|
|
61
|
+
callout: makeCallout(emojiOptions),
|
|
62
|
+
columns,
|
|
63
|
+
column,
|
|
64
|
+
math_display,
|
|
65
|
+
math_inline
|
|
66
|
+
};
|
|
67
|
+
let actualNodes = addListNodes(base.spec.nodes, "paragraph block*", "block").append({ ...tableNodes }).append(customNodes);
|
|
68
|
+
if (fiberyViewEnabled) actualNodes = actualNodes.append({ fiberyView });
|
|
69
|
+
if (isImageBlockEnabled) actualNodes = actualNodes.addToStart("imageBlock", imageBlock);
|
|
70
|
+
else actualNodes = actualNodes.addToEnd("imageBlock", imageBlock);
|
|
71
|
+
actualNodes = actualNodes.update("doc", { content: `(block | columns)+` });
|
|
72
|
+
for (const cellType of ["table_cell", "table_header"]) {
|
|
73
|
+
const cellSpec = actualNodes.get(cellType);
|
|
74
|
+
const attrsWithoutValidate = {};
|
|
75
|
+
for (const [key, attrSpec] of Object.entries(cellSpec.attrs ?? {})) {
|
|
76
|
+
const { validate: _, ...rest } = attrSpec;
|
|
77
|
+
attrsWithoutValidate[key] = rest;
|
|
78
|
+
}
|
|
79
|
+
actualNodes = actualNodes.update(cellType, {
|
|
80
|
+
...cellSpec,
|
|
81
|
+
attrs: attrsWithoutValidate
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
const orderedListSpec = actualNodes.get("ordered_list");
|
|
85
|
+
actualNodes = actualNodes.update("ordered_list", {
|
|
86
|
+
...orderedListSpec,
|
|
87
|
+
attrs: { order: { default: 1 } }
|
|
88
|
+
});
|
|
89
|
+
const listItemSpec = actualNodes.get("list_item");
|
|
90
|
+
actualNodes = actualNodes.update("list_item", {
|
|
91
|
+
...listItemSpec,
|
|
92
|
+
attrs: {
|
|
93
|
+
...listItemSpec.attrs,
|
|
94
|
+
state: { default: null },
|
|
95
|
+
id: { default: null }
|
|
96
|
+
},
|
|
97
|
+
parseDOM: [
|
|
98
|
+
{
|
|
99
|
+
tag: "li[data-check-item-state]",
|
|
100
|
+
getAttrs: (dom) => {
|
|
101
|
+
const el = dom;
|
|
102
|
+
const state = el.getAttribute("data-check-item-state");
|
|
103
|
+
const firstBlock = el.firstChild;
|
|
104
|
+
if (firstBlock !== null && firstBlock.nodeType === 1) {
|
|
105
|
+
const firstText = firstBlock.firstChild;
|
|
106
|
+
if (firstText !== null && firstText.nodeType === 3) {
|
|
107
|
+
const text = firstText.textContent ?? "";
|
|
108
|
+
if (text.startsWith("[ ] ") || text.startsWith("[x] ")) {
|
|
109
|
+
const rest = text.slice(4);
|
|
110
|
+
if (rest) firstText.textContent = rest;
|
|
111
|
+
else firstBlock.removeChild(firstText);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
state: state === "TODO" || state === "DONE" ? state : null,
|
|
117
|
+
id: el.getAttribute("data-list-item-id") ?? null
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
tag: "li",
|
|
123
|
+
getAttrs: (dom) => {
|
|
124
|
+
const el = dom;
|
|
125
|
+
const firstChild = el.firstChild;
|
|
126
|
+
if (firstChild === null) return false;
|
|
127
|
+
let textNode = null;
|
|
128
|
+
let textParent = null;
|
|
129
|
+
if (firstChild.nodeType === 3) {
|
|
130
|
+
textNode = firstChild;
|
|
131
|
+
textParent = el;
|
|
132
|
+
} else if (firstChild.nodeType === 1 && firstChild.firstChild?.nodeType === 3) {
|
|
133
|
+
textNode = firstChild.firstChild;
|
|
134
|
+
textParent = firstChild;
|
|
135
|
+
}
|
|
136
|
+
if (textNode === null) return false;
|
|
137
|
+
const text = textNode.textContent ?? "";
|
|
138
|
+
const state = text.startsWith("[ ] ") ? "TODO" : text.startsWith("[x] ") ? "DONE" : null;
|
|
139
|
+
if (state === null) return false;
|
|
140
|
+
const rest = text.slice(4);
|
|
141
|
+
if (rest) textNode.textContent = rest;
|
|
142
|
+
else textParent.removeChild(textNode);
|
|
143
|
+
return {
|
|
144
|
+
state,
|
|
145
|
+
id: null
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
{ tag: "li" }
|
|
150
|
+
],
|
|
151
|
+
toDOM(node) {
|
|
152
|
+
const { state, id } = node.attrs;
|
|
153
|
+
const attrs = {};
|
|
154
|
+
if (state) attrs["data-check-item-state"] = state;
|
|
155
|
+
if (id) attrs["data-list-item-id"] = id;
|
|
156
|
+
return Object.keys(attrs).length ? [
|
|
157
|
+
"li",
|
|
158
|
+
attrs,
|
|
159
|
+
0
|
|
160
|
+
] : ["li", 0];
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
for (const name of [
|
|
164
|
+
"blockquote",
|
|
165
|
+
"horizontal_rule",
|
|
166
|
+
"bullet_list",
|
|
167
|
+
"ordered_list",
|
|
168
|
+
"table",
|
|
169
|
+
"table_row",
|
|
170
|
+
"table_cell",
|
|
171
|
+
"table_header",
|
|
172
|
+
"note",
|
|
173
|
+
"important",
|
|
174
|
+
"callout",
|
|
175
|
+
"media",
|
|
176
|
+
"video",
|
|
177
|
+
"imageBlock",
|
|
178
|
+
"math_display",
|
|
179
|
+
"column"
|
|
180
|
+
]) {
|
|
181
|
+
const spec = actualNodes.get(name);
|
|
182
|
+
actualNodes = actualNodes.update(name, {
|
|
183
|
+
...spec,
|
|
184
|
+
attrs: {
|
|
185
|
+
...spec.attrs,
|
|
186
|
+
id: { default: null }
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
return new Schema({
|
|
191
|
+
nodes: actualNodes,
|
|
192
|
+
marks: base.spec.marks.addToEnd("strike", strike).addToEnd("underline", underline).addToEnd("hintQuery", hintQuery).addToEnd("highlight", textBackgroundColor)
|
|
193
|
+
});
|
|
240
194
|
};
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
},
|
|
195
|
+
const Basic = {
|
|
196
|
+
nodes,
|
|
197
|
+
marks,
|
|
198
|
+
fibery: {
|
|
199
|
+
link,
|
|
200
|
+
strike,
|
|
201
|
+
underline,
|
|
202
|
+
textBackgroundColor
|
|
203
|
+
}
|
|
251
204
|
};
|
|
205
|
+
//#endregion
|
|
206
|
+
export { Basic, createSchema };
|
package/lib/src/marks/code.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { MarkSpec } from "prosemirror-model";
|
|
2
|
+
//#region src/marks/code.d.ts
|
|
2
3
|
/**
|
|
3
4
|
Code font mark. Represented as a `<code>` element.
|
|
4
5
|
*/
|
|
5
|
-
|
|
6
|
+
declare const code: MarkSpec;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { code };
|
package/lib/src/marks/code.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.code = void 0;
|
|
1
|
+
//#region src/marks/code.ts
|
|
4
2
|
const codeDOM = ["code", 0];
|
|
5
3
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
Code font mark. Represented as a `<code>` element.
|
|
5
|
+
*/
|
|
6
|
+
const code = {
|
|
7
|
+
parseDOM: [{ tag: "code" }],
|
|
8
|
+
toDOM() {
|
|
9
|
+
return codeDOM;
|
|
10
|
+
}
|
|
13
11
|
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { code };
|
package/lib/src/marks/em.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { MarkSpec } from "prosemirror-model";
|
|
2
|
+
//#region src/marks/em.d.ts
|
|
2
3
|
/**
|
|
3
4
|
An emphasis mark. Rendered as an `<em>` element. Has parse rules
|
|
4
5
|
that also match `<i>` and `font-style: italic`.
|
|
5
6
|
*/
|
|
6
|
-
|
|
7
|
+
declare const em: MarkSpec;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { em };
|
package/lib/src/marks/em.js
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.em = void 0;
|
|
1
|
+
//#region src/marks/em.ts
|
|
4
2
|
const emDOM = ["em", 0];
|
|
5
3
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
4
|
+
An emphasis mark. Rendered as an `<em>` element. Has parse rules
|
|
5
|
+
that also match `<i>` and `font-style: italic`.
|
|
6
|
+
*/
|
|
7
|
+
const em = {
|
|
8
|
+
parseDOM: [
|
|
9
|
+
{ tag: "i" },
|
|
10
|
+
{ tag: "em" },
|
|
11
|
+
{ style: "font-style=italic" },
|
|
12
|
+
{
|
|
13
|
+
style: "font-style=normal",
|
|
14
|
+
clearMark: (m) => m.type.name === "em"
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
toDOM() {
|
|
18
|
+
return emDOM;
|
|
19
|
+
}
|
|
19
20
|
};
|
|
21
|
+
//#endregion
|
|
22
|
+
export { em };
|
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"data-trigger": node.attrs.trigger,
|
|
19
|
-
"data-guid": node.attrs.guid,
|
|
20
|
-
},
|
|
21
|
-
];
|
|
22
|
-
},
|
|
1
|
+
//#region src/marks/hint-query.ts
|
|
2
|
+
const hintQuery = {
|
|
3
|
+
excludes: "searchQuery",
|
|
4
|
+
inclusive: true,
|
|
5
|
+
group: "searchQuery",
|
|
6
|
+
attrs: {
|
|
7
|
+
trigger: { default: "" },
|
|
8
|
+
guid: { default: "" }
|
|
9
|
+
},
|
|
10
|
+
parseDOM: [{ tag: "span[data-hint-query]" }],
|
|
11
|
+
toDOM(node) {
|
|
12
|
+
return ["span", {
|
|
13
|
+
"data-hint-query": "true",
|
|
14
|
+
"data-trigger": node.attrs.trigger,
|
|
15
|
+
"data-guid": node.attrs.guid
|
|
16
|
+
}];
|
|
17
|
+
}
|
|
23
18
|
};
|
|
19
|
+
//#endregion
|
|
20
|
+
export { hintQuery };
|
package/lib/src/marks/link.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { MarkSpec } from "prosemirror-model";
|
|
2
|
+
//#region src/marks/link.d.ts
|
|
2
3
|
/**
|
|
3
4
|
A link. Has `href` and `title` attributes. `title`
|
|
4
5
|
defaults to the empty string. Rendered and parsed as an `<a>`
|
|
5
6
|
element.
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
+
declare const link: MarkSpec;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { link };
|