@portabletext/plugin-markdown-shortcuts 1.2.0 → 1.3.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.cjs +190 -213
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -7
- package/dist/index.d.ts +8 -7
- package/dist/index.js +188 -212
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/behavior.markdown-shortcuts.ts +1 -296
- package/src/plugin.markdown-shortcuts.tsx +26 -15
- package/src/rule.blockquote.ts +53 -0
- package/src/rule.heading.ts +59 -0
- package/src/rule.ordered-list.ts +56 -0
- package/src/rule.unordered-list.ts +56 -0
package/dist/index.d.cts
CHANGED
|
@@ -11,13 +11,6 @@ declare type MarkdownBehaviorsConfig = {
|
|
|
11
11
|
}
|
|
12
12
|
| undefined
|
|
13
13
|
defaultStyle?: (context: {schema: EditorSchema}) => string | undefined
|
|
14
|
-
headingStyle?: (context: {
|
|
15
|
-
schema: EditorSchema
|
|
16
|
-
level: number
|
|
17
|
-
}) => string | undefined
|
|
18
|
-
blockquoteStyle?: (context: {schema: EditorSchema}) => string | undefined
|
|
19
|
-
unorderedList?: (context: {schema: EditorSchema}) => string | undefined
|
|
20
|
-
orderedList?: (context: {schema: EditorSchema}) => string | undefined
|
|
21
14
|
}
|
|
22
15
|
|
|
23
16
|
/**
|
|
@@ -40,6 +33,14 @@ export declare function MarkdownShortcutsPlugin({
|
|
|
40
33
|
* @beta
|
|
41
34
|
*/
|
|
42
35
|
export declare type MarkdownShortcutsPluginProps = MarkdownBehaviorsConfig & {
|
|
36
|
+
blockquoteStyle?: (context: {schema: EditorSchema}) => string | undefined
|
|
37
|
+
defaultStyle?: (context: {schema: EditorSchema}) => string | undefined
|
|
38
|
+
headingStyle?: (context: {
|
|
39
|
+
schema: EditorSchema
|
|
40
|
+
level: number
|
|
41
|
+
}) => string | undefined
|
|
42
|
+
unorderedList?: (context: {schema: EditorSchema}) => string | undefined
|
|
43
|
+
orderedList?: (context: {schema: EditorSchema}) => string | undefined
|
|
43
44
|
boldDecorator?: ({schema}: {schema: EditorSchema}) => string | undefined
|
|
44
45
|
codeDecorator?: ({schema}: {schema: EditorSchema}) => string | undefined
|
|
45
46
|
italicDecorator?: ({schema}: {schema: EditorSchema}) => string | undefined
|
package/dist/index.d.ts
CHANGED
|
@@ -11,13 +11,6 @@ declare type MarkdownBehaviorsConfig = {
|
|
|
11
11
|
}
|
|
12
12
|
| undefined
|
|
13
13
|
defaultStyle?: (context: {schema: EditorSchema}) => string | undefined
|
|
14
|
-
headingStyle?: (context: {
|
|
15
|
-
schema: EditorSchema
|
|
16
|
-
level: number
|
|
17
|
-
}) => string | undefined
|
|
18
|
-
blockquoteStyle?: (context: {schema: EditorSchema}) => string | undefined
|
|
19
|
-
unorderedList?: (context: {schema: EditorSchema}) => string | undefined
|
|
20
|
-
orderedList?: (context: {schema: EditorSchema}) => string | undefined
|
|
21
14
|
}
|
|
22
15
|
|
|
23
16
|
/**
|
|
@@ -40,6 +33,14 @@ export declare function MarkdownShortcutsPlugin({
|
|
|
40
33
|
* @beta
|
|
41
34
|
*/
|
|
42
35
|
export declare type MarkdownShortcutsPluginProps = MarkdownBehaviorsConfig & {
|
|
36
|
+
blockquoteStyle?: (context: {schema: EditorSchema}) => string | undefined
|
|
37
|
+
defaultStyle?: (context: {schema: EditorSchema}) => string | undefined
|
|
38
|
+
headingStyle?: (context: {
|
|
39
|
+
schema: EditorSchema
|
|
40
|
+
level: number
|
|
41
|
+
}) => string | undefined
|
|
42
|
+
unorderedList?: (context: {schema: EditorSchema}) => string | undefined
|
|
43
|
+
orderedList?: (context: {schema: EditorSchema}) => string | undefined
|
|
43
44
|
boldDecorator?: ({schema}: {schema: EditorSchema}) => string | undefined
|
|
44
45
|
codeDecorator?: ({schema}: {schema: EditorSchema}) => string | undefined
|
|
45
46
|
italicDecorator?: ({schema}: {schema: EditorSchema}) => string | undefined
|
package/dist/index.js
CHANGED
|
@@ -7,70 +7,8 @@ import { useEffect } from "react";
|
|
|
7
7
|
import { defineBehavior, execute, raise } from "@portabletext/editor/behaviors";
|
|
8
8
|
import * as selectors from "@portabletext/editor/selectors";
|
|
9
9
|
import { getPreviousInlineObject } from "@portabletext/editor/selectors";
|
|
10
|
-
import * as utils from "@portabletext/editor/utils";
|
|
11
10
|
function createMarkdownBehaviors(config) {
|
|
12
|
-
const
|
|
13
|
-
on: "insert.text",
|
|
14
|
-
guard: ({
|
|
15
|
-
snapshot,
|
|
16
|
-
event
|
|
17
|
-
}) => {
|
|
18
|
-
if (event.text !== " ")
|
|
19
|
-
return !1;
|
|
20
|
-
const selectionCollapsed = selectors.isSelectionCollapsed(snapshot), focusTextBlock = selectors.getFocusTextBlock(snapshot), focusSpan = selectors.getFocusSpan(snapshot);
|
|
21
|
-
if (!selectionCollapsed || !focusTextBlock || !focusSpan)
|
|
22
|
-
return !1;
|
|
23
|
-
const previousInlineObject = selectors.getPreviousInlineObject(snapshot), blockOffset = utils.spanSelectionPointToBlockOffset({
|
|
24
|
-
context: snapshot.context,
|
|
25
|
-
selectionPoint: {
|
|
26
|
-
path: [{
|
|
27
|
-
_key: focusTextBlock.node._key
|
|
28
|
-
}, "children", {
|
|
29
|
-
_key: focusSpan.node._key
|
|
30
|
-
}],
|
|
31
|
-
offset: snapshot.context.selection?.focus.offset ?? 0
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
if (previousInlineObject || !blockOffset)
|
|
35
|
-
return !1;
|
|
36
|
-
const blockText = utils.getTextBlockText(focusTextBlock.node), caretAtTheEndOfQuote = blockOffset.offset === 1, looksLikeMarkdownQuote = /^>/.test(blockText), blockquoteStyle = config.blockquoteStyle?.({
|
|
37
|
-
schema: snapshot.context.schema
|
|
38
|
-
});
|
|
39
|
-
return caretAtTheEndOfQuote && looksLikeMarkdownQuote && blockquoteStyle !== void 0 ? {
|
|
40
|
-
focusTextBlock,
|
|
41
|
-
style: blockquoteStyle
|
|
42
|
-
} : !1;
|
|
43
|
-
},
|
|
44
|
-
actions: [() => [execute({
|
|
45
|
-
type: "insert.text",
|
|
46
|
-
text: " "
|
|
47
|
-
})], (_, {
|
|
48
|
-
focusTextBlock,
|
|
49
|
-
style
|
|
50
|
-
}) => [execute({
|
|
51
|
-
type: "block.unset",
|
|
52
|
-
props: ["listItem", "level"],
|
|
53
|
-
at: focusTextBlock.path
|
|
54
|
-
}), execute({
|
|
55
|
-
type: "block.set",
|
|
56
|
-
props: {
|
|
57
|
-
style
|
|
58
|
-
},
|
|
59
|
-
at: focusTextBlock.path
|
|
60
|
-
}), execute({
|
|
61
|
-
type: "delete.text",
|
|
62
|
-
at: {
|
|
63
|
-
anchor: {
|
|
64
|
-
path: focusTextBlock.path,
|
|
65
|
-
offset: 0
|
|
66
|
-
},
|
|
67
|
-
focus: {
|
|
68
|
-
path: focusTextBlock.path,
|
|
69
|
-
offset: 2
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
})]]
|
|
73
|
-
}), automaticHrOnPaste = defineBehavior({
|
|
11
|
+
const automaticHrOnPaste = defineBehavior({
|
|
74
12
|
on: "clipboard.paste",
|
|
75
13
|
guard: ({
|
|
76
14
|
snapshot,
|
|
@@ -122,72 +60,6 @@ function createMarkdownBehaviors(config) {
|
|
|
122
60
|
},
|
|
123
61
|
placement: "after"
|
|
124
62
|
})]]
|
|
125
|
-
}), automaticHeadingOnSpace = defineBehavior({
|
|
126
|
-
on: "insert.text",
|
|
127
|
-
guard: ({
|
|
128
|
-
snapshot,
|
|
129
|
-
event
|
|
130
|
-
}) => {
|
|
131
|
-
if (event.text !== " ")
|
|
132
|
-
return !1;
|
|
133
|
-
const selectionCollapsed = selectors.isSelectionCollapsed(snapshot), focusTextBlock = selectors.getFocusTextBlock(snapshot), focusSpan = selectors.getFocusSpan(snapshot);
|
|
134
|
-
if (!selectionCollapsed || !focusTextBlock || !focusSpan)
|
|
135
|
-
return !1;
|
|
136
|
-
const blockOffset = utils.spanSelectionPointToBlockOffset({
|
|
137
|
-
context: snapshot.context,
|
|
138
|
-
selectionPoint: {
|
|
139
|
-
path: [{
|
|
140
|
-
_key: focusTextBlock.node._key
|
|
141
|
-
}, "children", {
|
|
142
|
-
_key: focusSpan.node._key
|
|
143
|
-
}],
|
|
144
|
-
offset: snapshot.context.selection?.focus.offset ?? 0
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
if (!blockOffset)
|
|
148
|
-
return !1;
|
|
149
|
-
const previousInlineObject = selectors.getPreviousInlineObject(snapshot), blockText = utils.getTextBlockText(focusTextBlock.node), markdownHeadingSearch = /^#+/.exec(blockText), level = markdownHeadingSearch ? markdownHeadingSearch[0].length : void 0, caretAtTheEndOfHeading = blockOffset.offset === level;
|
|
150
|
-
if (previousInlineObject || !caretAtTheEndOfHeading)
|
|
151
|
-
return !1;
|
|
152
|
-
const style = level !== void 0 ? config.headingStyle?.({
|
|
153
|
-
schema: snapshot.context.schema,
|
|
154
|
-
level
|
|
155
|
-
}) : void 0;
|
|
156
|
-
return level !== void 0 && style !== void 0 ? {
|
|
157
|
-
focusTextBlock,
|
|
158
|
-
style,
|
|
159
|
-
level
|
|
160
|
-
} : !1;
|
|
161
|
-
},
|
|
162
|
-
actions: [({
|
|
163
|
-
event
|
|
164
|
-
}) => [execute(event)], (_, {
|
|
165
|
-
focusTextBlock,
|
|
166
|
-
style,
|
|
167
|
-
level
|
|
168
|
-
}) => [execute({
|
|
169
|
-
type: "block.unset",
|
|
170
|
-
props: ["listItem", "level"],
|
|
171
|
-
at: focusTextBlock.path
|
|
172
|
-
}), execute({
|
|
173
|
-
type: "block.set",
|
|
174
|
-
props: {
|
|
175
|
-
style
|
|
176
|
-
},
|
|
177
|
-
at: focusTextBlock.path
|
|
178
|
-
}), execute({
|
|
179
|
-
type: "delete.text",
|
|
180
|
-
at: {
|
|
181
|
-
anchor: {
|
|
182
|
-
path: focusTextBlock.path,
|
|
183
|
-
offset: 0
|
|
184
|
-
},
|
|
185
|
-
focus: {
|
|
186
|
-
path: focusTextBlock.path,
|
|
187
|
-
offset: level + 1
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
})]]
|
|
191
63
|
}), clearStyleOnBackspace = defineBehavior({
|
|
192
64
|
on: "delete.backward",
|
|
193
65
|
guard: ({
|
|
@@ -214,82 +86,89 @@ function createMarkdownBehaviors(config) {
|
|
|
214
86
|
},
|
|
215
87
|
at: focusTextBlock.path
|
|
216
88
|
})]]
|
|
217
|
-
})
|
|
218
|
-
|
|
89
|
+
});
|
|
90
|
+
return [automaticHrOnPaste, clearStyleOnBackspace];
|
|
91
|
+
}
|
|
92
|
+
function createBlockquoteRule(config) {
|
|
93
|
+
return defineInputRule({
|
|
94
|
+
on: /^> /,
|
|
219
95
|
guard: ({
|
|
220
96
|
snapshot,
|
|
221
97
|
event
|
|
222
98
|
}) => {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
const selectionCollapsed = selectors.isSelectionCollapsed(snapshot), focusTextBlock = selectors.getFocusTextBlock(snapshot), focusSpan = selectors.getFocusSpan(snapshot);
|
|
226
|
-
if (!selectionCollapsed || !focusTextBlock || !focusSpan)
|
|
227
|
-
return !1;
|
|
228
|
-
const previousInlineObject = selectors.getPreviousInlineObject(snapshot), blockOffset = utils.spanSelectionPointToBlockOffset({
|
|
229
|
-
context: snapshot.context,
|
|
230
|
-
selectionPoint: {
|
|
231
|
-
path: [{
|
|
232
|
-
_key: focusTextBlock.node._key
|
|
233
|
-
}, "children", {
|
|
234
|
-
_key: focusSpan.node._key
|
|
235
|
-
}],
|
|
236
|
-
offset: snapshot.context.selection?.focus.offset ?? 0
|
|
237
|
-
}
|
|
99
|
+
const style = config.blockquoteStyle({
|
|
100
|
+
schema: snapshot.context.schema
|
|
238
101
|
});
|
|
239
|
-
if (
|
|
102
|
+
if (!style || getPreviousInlineObject(snapshot))
|
|
240
103
|
return !1;
|
|
241
|
-
const
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
}), caretAtTheEndOfUnorderedList = blockOffset.offset === 1;
|
|
246
|
-
if (defaultStyle && caretAtTheEndOfUnorderedList && looksLikeUnorderedList && unorderedList !== void 0)
|
|
247
|
-
return {
|
|
248
|
-
focusTextBlock,
|
|
249
|
-
listItem: unorderedList,
|
|
250
|
-
listItemLength: 1,
|
|
251
|
-
style: defaultStyle
|
|
252
|
-
};
|
|
253
|
-
const looksLikeOrderedList = /^1\./.test(blockText), orderedList = config.orderedList?.({
|
|
254
|
-
schema: snapshot.context.schema
|
|
255
|
-
}), caretAtTheEndOfOrderedList = blockOffset.offset === 2;
|
|
256
|
-
return defaultStyle && caretAtTheEndOfOrderedList && looksLikeOrderedList && orderedList !== void 0 ? {
|
|
257
|
-
focusTextBlock,
|
|
258
|
-
listItem: orderedList,
|
|
259
|
-
listItemLength: 2,
|
|
260
|
-
style: defaultStyle
|
|
104
|
+
const match = event.matches.at(0);
|
|
105
|
+
return match ? {
|
|
106
|
+
style,
|
|
107
|
+
match
|
|
261
108
|
} : !1;
|
|
262
109
|
},
|
|
263
110
|
actions: [({
|
|
264
111
|
event
|
|
265
|
-
}
|
|
266
|
-
focusTextBlock,
|
|
112
|
+
}, {
|
|
267
113
|
style,
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
114
|
+
match
|
|
115
|
+
}) => [raise({
|
|
116
|
+
type: "block.unset",
|
|
117
|
+
props: ["listItem", "level"],
|
|
118
|
+
at: event.focusTextBlock.path
|
|
119
|
+
}), raise({
|
|
271
120
|
type: "block.set",
|
|
272
121
|
props: {
|
|
273
|
-
listItem,
|
|
274
|
-
level: 1,
|
|
275
122
|
style
|
|
276
123
|
},
|
|
277
|
-
at: focusTextBlock.path
|
|
278
|
-
}),
|
|
279
|
-
type: "delete
|
|
280
|
-
at:
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
124
|
+
at: event.focusTextBlock.path
|
|
125
|
+
}), raise({
|
|
126
|
+
type: "delete",
|
|
127
|
+
at: match.targetOffsets
|
|
128
|
+
})]]
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
function createHeadingRule(config) {
|
|
132
|
+
return defineInputRule({
|
|
133
|
+
on: /^#+ /,
|
|
134
|
+
guard: ({
|
|
135
|
+
snapshot,
|
|
136
|
+
event
|
|
137
|
+
}) => {
|
|
138
|
+
if (getPreviousInlineObject(snapshot))
|
|
139
|
+
return !1;
|
|
140
|
+
const match = event.matches.at(0);
|
|
141
|
+
if (!match)
|
|
142
|
+
return !1;
|
|
143
|
+
const level = match.text.length - 1, style = config.headingStyle({
|
|
144
|
+
schema: snapshot.context.schema,
|
|
145
|
+
level
|
|
146
|
+
});
|
|
147
|
+
return style ? {
|
|
148
|
+
match,
|
|
149
|
+
style
|
|
150
|
+
} : !1;
|
|
151
|
+
},
|
|
152
|
+
actions: [({
|
|
153
|
+
event
|
|
154
|
+
}, {
|
|
155
|
+
match,
|
|
156
|
+
style
|
|
157
|
+
}) => [raise({
|
|
158
|
+
type: "block.unset",
|
|
159
|
+
props: ["listItem", "level"],
|
|
160
|
+
at: event.focusTextBlock.path
|
|
161
|
+
}), raise({
|
|
162
|
+
type: "block.set",
|
|
163
|
+
props: {
|
|
164
|
+
style
|
|
165
|
+
},
|
|
166
|
+
at: event.focusTextBlock.path
|
|
167
|
+
}), raise({
|
|
168
|
+
type: "delete",
|
|
169
|
+
at: match.targetOffsets
|
|
290
170
|
})]]
|
|
291
171
|
});
|
|
292
|
-
return [automaticBlockquoteOnSpace, automaticHeadingOnSpace, automaticHrOnPaste, clearStyleOnBackspace, automaticListOnSpace];
|
|
293
172
|
}
|
|
294
173
|
function createHorizontalRuleRule(config) {
|
|
295
174
|
return defineInputRule({
|
|
@@ -326,8 +205,88 @@ function createHorizontalRuleRule(config) {
|
|
|
326
205
|
})]]
|
|
327
206
|
});
|
|
328
207
|
}
|
|
208
|
+
function createOrderedListRule(config) {
|
|
209
|
+
return defineInputRule({
|
|
210
|
+
on: /^1\. /,
|
|
211
|
+
guard: ({
|
|
212
|
+
snapshot,
|
|
213
|
+
event
|
|
214
|
+
}) => {
|
|
215
|
+
const orderedList = config.orderedList({
|
|
216
|
+
schema: snapshot.context.schema
|
|
217
|
+
});
|
|
218
|
+
if (!orderedList || getPreviousInlineObject(snapshot))
|
|
219
|
+
return !1;
|
|
220
|
+
const match = event.matches.at(0);
|
|
221
|
+
return match ? {
|
|
222
|
+
match,
|
|
223
|
+
orderedList
|
|
224
|
+
} : !1;
|
|
225
|
+
},
|
|
226
|
+
actions: [({
|
|
227
|
+
event
|
|
228
|
+
}, {
|
|
229
|
+
match,
|
|
230
|
+
orderedList
|
|
231
|
+
}) => [raise({
|
|
232
|
+
type: "block.unset",
|
|
233
|
+
props: ["style"],
|
|
234
|
+
at: event.focusTextBlock.path
|
|
235
|
+
}), raise({
|
|
236
|
+
type: "block.set",
|
|
237
|
+
props: {
|
|
238
|
+
listItem: orderedList,
|
|
239
|
+
level: event.focusTextBlock.node.level ?? 1
|
|
240
|
+
},
|
|
241
|
+
at: event.focusTextBlock.path
|
|
242
|
+
}), raise({
|
|
243
|
+
type: "delete",
|
|
244
|
+
at: match.targetOffsets
|
|
245
|
+
})]]
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
function createUnorderedListRule(config) {
|
|
249
|
+
return defineInputRule({
|
|
250
|
+
on: /^(-|\*) /,
|
|
251
|
+
guard: ({
|
|
252
|
+
snapshot,
|
|
253
|
+
event
|
|
254
|
+
}) => {
|
|
255
|
+
const unorderedList = config.unorderedList({
|
|
256
|
+
schema: snapshot.context.schema
|
|
257
|
+
});
|
|
258
|
+
if (!unorderedList || getPreviousInlineObject(snapshot))
|
|
259
|
+
return !1;
|
|
260
|
+
const match = event.matches.at(0);
|
|
261
|
+
return match ? {
|
|
262
|
+
match,
|
|
263
|
+
unorderedList
|
|
264
|
+
} : !1;
|
|
265
|
+
},
|
|
266
|
+
actions: [({
|
|
267
|
+
event
|
|
268
|
+
}, {
|
|
269
|
+
match,
|
|
270
|
+
unorderedList
|
|
271
|
+
}) => [raise({
|
|
272
|
+
type: "block.unset",
|
|
273
|
+
props: ["style"],
|
|
274
|
+
at: event.focusTextBlock.path
|
|
275
|
+
}), raise({
|
|
276
|
+
type: "block.set",
|
|
277
|
+
props: {
|
|
278
|
+
listItem: unorderedList,
|
|
279
|
+
level: event.focusTextBlock.node.level ?? 1
|
|
280
|
+
},
|
|
281
|
+
at: event.focusTextBlock.path
|
|
282
|
+
}), raise({
|
|
283
|
+
type: "delete",
|
|
284
|
+
at: match.targetOffsets
|
|
285
|
+
})]]
|
|
286
|
+
});
|
|
287
|
+
}
|
|
329
288
|
function MarkdownShortcutsPlugin(t0) {
|
|
330
|
-
const $ = c(
|
|
289
|
+
const $ = c(35), {
|
|
331
290
|
blockquoteStyle,
|
|
332
291
|
boldDecorator,
|
|
333
292
|
codeDecorator,
|
|
@@ -339,15 +298,10 @@ function MarkdownShortcutsPlugin(t0) {
|
|
|
339
298
|
strikeThroughDecorator,
|
|
340
299
|
unorderedList
|
|
341
300
|
} = t0, editor = useEditor();
|
|
342
|
-
let t1
|
|
343
|
-
$[0] !==
|
|
301
|
+
let t1;
|
|
302
|
+
$[0] !== defaultStyle || $[1] !== editor ? (t1 = () => {
|
|
344
303
|
const unregisterBehaviors = createMarkdownBehaviors({
|
|
345
|
-
|
|
346
|
-
defaultStyle,
|
|
347
|
-
headingStyle,
|
|
348
|
-
horizontalRuleObject,
|
|
349
|
-
orderedList,
|
|
350
|
-
unorderedList
|
|
304
|
+
defaultStyle
|
|
351
305
|
}).map((behavior) => editor.registerBehavior({
|
|
352
306
|
behavior
|
|
353
307
|
}));
|
|
@@ -355,9 +309,11 @@ function MarkdownShortcutsPlugin(t0) {
|
|
|
355
309
|
for (const unregisterBehavior of unregisterBehaviors)
|
|
356
310
|
unregisterBehavior();
|
|
357
311
|
};
|
|
358
|
-
},
|
|
312
|
+
}, $[0] = defaultStyle, $[1] = editor, $[2] = t1) : t1 = $[2];
|
|
313
|
+
let t2;
|
|
314
|
+
$[3] !== defaultStyle || $[4] !== editor || $[5] !== horizontalRuleObject ? (t2 = [defaultStyle, editor, horizontalRuleObject], $[3] = defaultStyle, $[4] = editor, $[5] = horizontalRuleObject, $[6] = t2) : t2 = $[6], useEffect(t1, t2);
|
|
359
315
|
let t3;
|
|
360
|
-
$[
|
|
316
|
+
$[7] !== boldDecorator ? (t3 = boldDecorator ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
361
317
|
/* @__PURE__ */ jsx(CharacterPairDecoratorPlugin, { decorator: boldDecorator, pair: {
|
|
362
318
|
char: "*",
|
|
363
319
|
amount: 2
|
|
@@ -366,14 +322,14 @@ function MarkdownShortcutsPlugin(t0) {
|
|
|
366
322
|
char: "_",
|
|
367
323
|
amount: 2
|
|
368
324
|
} })
|
|
369
|
-
] }) : null, $[
|
|
325
|
+
] }) : null, $[7] = boldDecorator, $[8] = t3) : t3 = $[8];
|
|
370
326
|
let t4;
|
|
371
|
-
$[
|
|
327
|
+
$[9] !== codeDecorator ? (t4 = codeDecorator ? /* @__PURE__ */ jsx(CharacterPairDecoratorPlugin, { decorator: codeDecorator, pair: {
|
|
372
328
|
char: "`",
|
|
373
329
|
amount: 1
|
|
374
|
-
} }) : null, $[
|
|
330
|
+
} }) : null, $[9] = codeDecorator, $[10] = t4) : t4 = $[10];
|
|
375
331
|
let t5;
|
|
376
|
-
$[
|
|
332
|
+
$[11] !== italicDecorator ? (t5 = italicDecorator ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
377
333
|
/* @__PURE__ */ jsx(CharacterPairDecoratorPlugin, { decorator: italicDecorator, pair: {
|
|
378
334
|
char: "*",
|
|
379
335
|
amount: 1
|
|
@@ -382,24 +338,44 @@ function MarkdownShortcutsPlugin(t0) {
|
|
|
382
338
|
char: "_",
|
|
383
339
|
amount: 1
|
|
384
340
|
} })
|
|
385
|
-
] }) : null, $[
|
|
341
|
+
] }) : null, $[11] = italicDecorator, $[12] = t5) : t5 = $[12];
|
|
386
342
|
let t6;
|
|
387
|
-
$[
|
|
343
|
+
$[13] !== strikeThroughDecorator ? (t6 = strikeThroughDecorator ? /* @__PURE__ */ jsx(CharacterPairDecoratorPlugin, { decorator: strikeThroughDecorator, pair: {
|
|
388
344
|
char: "~",
|
|
389
345
|
amount: 2
|
|
390
|
-
} }) : null, $[
|
|
346
|
+
} }) : null, $[13] = strikeThroughDecorator, $[14] = t6) : t6 = $[14];
|
|
391
347
|
let t7;
|
|
392
|
-
$[
|
|
393
|
-
|
|
394
|
-
})] }) : null, $[
|
|
348
|
+
$[15] !== blockquoteStyle ? (t7 = blockquoteStyle ? /* @__PURE__ */ jsx(InputRulePlugin, { rules: [createBlockquoteRule({
|
|
349
|
+
blockquoteStyle
|
|
350
|
+
})] }) : null, $[15] = blockquoteStyle, $[16] = t7) : t7 = $[16];
|
|
395
351
|
let t8;
|
|
396
|
-
|
|
352
|
+
$[17] !== headingStyle ? (t8 = headingStyle ? /* @__PURE__ */ jsx(InputRulePlugin, { rules: [createHeadingRule({
|
|
353
|
+
headingStyle
|
|
354
|
+
})] }) : null, $[17] = headingStyle, $[18] = t8) : t8 = $[18];
|
|
355
|
+
let t9;
|
|
356
|
+
$[19] !== horizontalRuleObject ? (t9 = horizontalRuleObject ? /* @__PURE__ */ jsx(InputRulePlugin, { rules: [createHorizontalRuleRule({
|
|
357
|
+
horizontalRuleObject
|
|
358
|
+
})] }) : null, $[19] = horizontalRuleObject, $[20] = t9) : t9 = $[20];
|
|
359
|
+
let t10;
|
|
360
|
+
$[21] !== orderedList ? (t10 = orderedList ? /* @__PURE__ */ jsx(InputRulePlugin, { rules: [createOrderedListRule({
|
|
361
|
+
orderedList
|
|
362
|
+
})] }) : null, $[21] = orderedList, $[22] = t10) : t10 = $[22];
|
|
363
|
+
let t11;
|
|
364
|
+
$[23] !== unorderedList ? (t11 = unorderedList ? /* @__PURE__ */ jsx(InputRulePlugin, { rules: [createUnorderedListRule({
|
|
365
|
+
unorderedList
|
|
366
|
+
})] }) : null, $[23] = unorderedList, $[24] = t11) : t11 = $[24];
|
|
367
|
+
let t12;
|
|
368
|
+
return $[25] !== t10 || $[26] !== t11 || $[27] !== t3 || $[28] !== t4 || $[29] !== t5 || $[30] !== t6 || $[31] !== t7 || $[32] !== t8 || $[33] !== t9 ? (t12 = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
397
369
|
t3,
|
|
398
370
|
t4,
|
|
399
371
|
t5,
|
|
400
372
|
t6,
|
|
401
|
-
t7
|
|
402
|
-
|
|
373
|
+
t7,
|
|
374
|
+
t8,
|
|
375
|
+
t9,
|
|
376
|
+
t10,
|
|
377
|
+
t11
|
|
378
|
+
] }), $[25] = t10, $[26] = t11, $[27] = t3, $[28] = t4, $[29] = t5, $[30] = t6, $[31] = t7, $[32] = t8, $[33] = t9, $[34] = t12) : t12 = $[34], t12;
|
|
403
379
|
}
|
|
404
380
|
export {
|
|
405
381
|
MarkdownShortcutsPlugin
|