@portabletext/plugin-markdown-shortcuts 1.0.15 → 1.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/index.cjs +262 -247
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +262 -246
- package/dist/index.js.map +1 -1
- package/package.json +7 -6
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
3
|
-
var jsxRuntime = require("react/jsx-runtime"), editor = require("@portabletext/editor"), pluginCharacterPairDecorator = require("@portabletext/plugin-character-pair-decorator"), react = require("react"), behaviors = require("@portabletext/editor/behaviors"), selectors = require("@portabletext/editor/selectors"), utils = require("@portabletext/editor/utils");
|
|
3
|
+
var jsxRuntime = require("react/jsx-runtime"), compilerRuntime = require("react/compiler-runtime"), editor = require("@portabletext/editor"), pluginCharacterPairDecorator = require("@portabletext/plugin-character-pair-decorator"), react = require("react"), behaviors = require("@portabletext/editor/behaviors"), selectors = require("@portabletext/editor/selectors"), utils = require("@portabletext/editor/utils");
|
|
4
4
|
function _interopNamespaceCompat(e) {
|
|
5
5
|
if (e && typeof e == "object" && "default" in e) return e;
|
|
6
6
|
var n = /* @__PURE__ */ Object.create(null);
|
|
@@ -20,7 +20,10 @@ var selectors__namespace = /* @__PURE__ */ _interopNamespaceCompat(selectors), u
|
|
|
20
20
|
function createMarkdownBehaviors(config) {
|
|
21
21
|
const automaticBlockquoteOnSpace = behaviors.defineBehavior({
|
|
22
22
|
on: "insert.text",
|
|
23
|
-
guard: ({
|
|
23
|
+
guard: ({
|
|
24
|
+
snapshot,
|
|
25
|
+
event
|
|
26
|
+
}) => {
|
|
24
27
|
if (event.text !== " ")
|
|
25
28
|
return !1;
|
|
26
29
|
const selectionCollapsed = selectors__namespace.isSelectionCollapsed(snapshot), focusTextBlock = selectors__namespace.getFocusTextBlock(snapshot), focusSpan = selectors__namespace.getFocusSpan(snapshot);
|
|
@@ -29,11 +32,11 @@ function createMarkdownBehaviors(config) {
|
|
|
29
32
|
const previousInlineObject = selectors__namespace.getPreviousInlineObject(snapshot), blockOffset = utils__namespace.spanSelectionPointToBlockOffset({
|
|
30
33
|
context: snapshot.context,
|
|
31
34
|
selectionPoint: {
|
|
32
|
-
path: [
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
],
|
|
35
|
+
path: [{
|
|
36
|
+
_key: focusTextBlock.node._key
|
|
37
|
+
}, "children", {
|
|
38
|
+
_key: focusSpan.node._key
|
|
39
|
+
}],
|
|
37
40
|
offset: snapshot.context.selection?.focus.offset ?? 0
|
|
38
41
|
}
|
|
39
42
|
});
|
|
@@ -42,44 +45,46 @@ function createMarkdownBehaviors(config) {
|
|
|
42
45
|
const blockText = utils__namespace.getTextBlockText(focusTextBlock.node), caretAtTheEndOfQuote = blockOffset.offset === 1, looksLikeMarkdownQuote = /^>/.test(blockText), blockquoteStyle = config.blockquoteStyle?.({
|
|
43
46
|
schema: snapshot.context.schema
|
|
44
47
|
});
|
|
45
|
-
return caretAtTheEndOfQuote && looksLikeMarkdownQuote && blockquoteStyle !== void 0 ? {
|
|
48
|
+
return caretAtTheEndOfQuote && looksLikeMarkdownQuote && blockquoteStyle !== void 0 ? {
|
|
49
|
+
focusTextBlock,
|
|
50
|
+
style: blockquoteStyle
|
|
51
|
+
} : !1;
|
|
46
52
|
},
|
|
47
|
-
actions: [
|
|
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
|
-
]
|
|
53
|
+
actions: [() => [behaviors.execute({
|
|
54
|
+
type: "insert.text",
|
|
55
|
+
text: " "
|
|
56
|
+
})], (_, {
|
|
57
|
+
focusTextBlock,
|
|
58
|
+
style
|
|
59
|
+
}) => [behaviors.execute({
|
|
60
|
+
type: "block.unset",
|
|
61
|
+
props: ["listItem", "level"],
|
|
62
|
+
at: focusTextBlock.path
|
|
63
|
+
}), behaviors.execute({
|
|
64
|
+
type: "block.set",
|
|
65
|
+
props: {
|
|
66
|
+
style
|
|
67
|
+
},
|
|
68
|
+
at: focusTextBlock.path
|
|
69
|
+
}), behaviors.execute({
|
|
70
|
+
type: "delete.text",
|
|
71
|
+
at: {
|
|
72
|
+
anchor: {
|
|
73
|
+
path: focusTextBlock.path,
|
|
74
|
+
offset: 0
|
|
75
|
+
},
|
|
76
|
+
focus: {
|
|
77
|
+
path: focusTextBlock.path,
|
|
78
|
+
offset: 2
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
})]]
|
|
80
82
|
}), automaticHr = behaviors.defineBehavior({
|
|
81
83
|
on: "insert.text",
|
|
82
|
-
guard: ({
|
|
84
|
+
guard: ({
|
|
85
|
+
snapshot,
|
|
86
|
+
event
|
|
87
|
+
}) => {
|
|
83
88
|
const hrCharacter = event.text === "-" ? "-" : event.text === "*" ? "*" : event.text === "_" ? "_" : void 0;
|
|
84
89
|
if (hrCharacter === void 0)
|
|
85
90
|
return !1;
|
|
@@ -98,81 +103,91 @@ function createMarkdownBehaviors(config) {
|
|
|
98
103
|
offset: 3
|
|
99
104
|
}
|
|
100
105
|
};
|
|
101
|
-
return !previousInlineObject && textBefore === `${hrCharacter}${hrCharacter}` ? {
|
|
106
|
+
return !previousInlineObject && textBefore === `${hrCharacter}${hrCharacter}` ? {
|
|
107
|
+
hrObject,
|
|
108
|
+
focusBlock,
|
|
109
|
+
hrCharacter,
|
|
110
|
+
hrBlockOffsets
|
|
111
|
+
} : !1;
|
|
102
112
|
},
|
|
103
|
-
actions: [
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
})
|
|
124
|
-
]
|
|
125
|
-
]
|
|
113
|
+
actions: [(_, {
|
|
114
|
+
hrCharacter
|
|
115
|
+
}) => [behaviors.execute({
|
|
116
|
+
type: "insert.text",
|
|
117
|
+
text: hrCharacter
|
|
118
|
+
})], (_, {
|
|
119
|
+
hrObject,
|
|
120
|
+
hrBlockOffsets
|
|
121
|
+
}) => [behaviors.execute({
|
|
122
|
+
type: "insert.block",
|
|
123
|
+
block: {
|
|
124
|
+
_type: hrObject.name,
|
|
125
|
+
...hrObject.value ?? {}
|
|
126
|
+
},
|
|
127
|
+
placement: "before",
|
|
128
|
+
select: "none"
|
|
129
|
+
}), behaviors.execute({
|
|
130
|
+
type: "delete.text",
|
|
131
|
+
at: hrBlockOffsets
|
|
132
|
+
})]]
|
|
126
133
|
}), automaticHrOnPaste = behaviors.defineBehavior({
|
|
127
134
|
on: "clipboard.paste",
|
|
128
|
-
guard: ({
|
|
135
|
+
guard: ({
|
|
136
|
+
snapshot,
|
|
137
|
+
event
|
|
138
|
+
}) => {
|
|
129
139
|
const text = event.originEvent.dataTransfer.getData("text/plain"), hrRegExp = /^(---)$|(___)$|(\*\*\*)$/, hrCharacters = text.match(hrRegExp)?.[0], hrObject = config.horizontalRuleObject?.({
|
|
130
140
|
schema: snapshot.context.schema
|
|
131
141
|
}), focusBlock = selectors__namespace.getFocusBlock(snapshot), focusTextBlock = selectors__namespace.getFocusTextBlock(snapshot);
|
|
132
|
-
return !hrCharacters || !hrObject || !focusBlock ? !1 : {
|
|
142
|
+
return !hrCharacters || !hrObject || !focusBlock ? !1 : {
|
|
143
|
+
hrCharacters,
|
|
144
|
+
hrObject,
|
|
145
|
+
focusBlock,
|
|
146
|
+
focusTextBlock
|
|
147
|
+
};
|
|
133
148
|
},
|
|
134
|
-
actions: [
|
|
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
|
-
]
|
|
149
|
+
actions: [(_, {
|
|
150
|
+
hrCharacters
|
|
151
|
+
}) => [behaviors.execute({
|
|
152
|
+
type: "insert.text",
|
|
153
|
+
text: hrCharacters
|
|
154
|
+
})], ({
|
|
155
|
+
snapshot
|
|
156
|
+
}, {
|
|
157
|
+
hrObject,
|
|
158
|
+
focusBlock,
|
|
159
|
+
focusTextBlock
|
|
160
|
+
}) => focusTextBlock ? [behaviors.execute({
|
|
161
|
+
type: "insert.block",
|
|
162
|
+
block: {
|
|
163
|
+
_type: snapshot.context.schema.block.name,
|
|
164
|
+
children: focusTextBlock.node.children
|
|
165
|
+
},
|
|
166
|
+
placement: "after"
|
|
167
|
+
}), behaviors.execute({
|
|
168
|
+
type: "insert.block",
|
|
169
|
+
block: {
|
|
170
|
+
_type: hrObject.name,
|
|
171
|
+
...hrObject.value ?? {}
|
|
172
|
+
},
|
|
173
|
+
placement: "after"
|
|
174
|
+
}), behaviors.execute({
|
|
175
|
+
type: "delete.block",
|
|
176
|
+
at: focusBlock.path
|
|
177
|
+
})] : [behaviors.execute({
|
|
178
|
+
type: "insert.block",
|
|
179
|
+
block: {
|
|
180
|
+
_type: hrObject.name,
|
|
181
|
+
...hrObject.value ?? {}
|
|
182
|
+
},
|
|
183
|
+
placement: "after"
|
|
184
|
+
})]]
|
|
173
185
|
}), automaticHeadingOnSpace = behaviors.defineBehavior({
|
|
174
186
|
on: "insert.text",
|
|
175
|
-
guard: ({
|
|
187
|
+
guard: ({
|
|
188
|
+
snapshot,
|
|
189
|
+
event
|
|
190
|
+
}) => {
|
|
176
191
|
if (event.text !== " ")
|
|
177
192
|
return !1;
|
|
178
193
|
const selectionCollapsed = selectors__namespace.isSelectionCollapsed(snapshot), focusTextBlock = selectors__namespace.getFocusTextBlock(snapshot), focusSpan = selectors__namespace.getFocusSpan(snapshot);
|
|
@@ -181,11 +196,11 @@ function createMarkdownBehaviors(config) {
|
|
|
181
196
|
const blockOffset = utils__namespace.spanSelectionPointToBlockOffset({
|
|
182
197
|
context: snapshot.context,
|
|
183
198
|
selectionPoint: {
|
|
184
|
-
path: [
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
],
|
|
199
|
+
path: [{
|
|
200
|
+
_key: focusTextBlock.node._key
|
|
201
|
+
}, "children", {
|
|
202
|
+
_key: focusSpan.node._key
|
|
203
|
+
}],
|
|
189
204
|
offset: snapshot.context.selection?.focus.offset ?? 0
|
|
190
205
|
}
|
|
191
206
|
});
|
|
@@ -194,64 +209,77 @@ function createMarkdownBehaviors(config) {
|
|
|
194
209
|
const previousInlineObject = selectors__namespace.getPreviousInlineObject(snapshot), blockText = utils__namespace.getTextBlockText(focusTextBlock.node), markdownHeadingSearch = /^#+/.exec(blockText), level = markdownHeadingSearch ? markdownHeadingSearch[0].length : void 0, caretAtTheEndOfHeading = blockOffset.offset === level;
|
|
195
210
|
if (previousInlineObject || !caretAtTheEndOfHeading)
|
|
196
211
|
return !1;
|
|
197
|
-
const style = level !== void 0 ? config.headingStyle?.({
|
|
212
|
+
const style = level !== void 0 ? config.headingStyle?.({
|
|
213
|
+
schema: snapshot.context.schema,
|
|
214
|
+
level
|
|
215
|
+
}) : void 0;
|
|
198
216
|
return level !== void 0 && style !== void 0 ? {
|
|
199
217
|
focusTextBlock,
|
|
200
218
|
style,
|
|
201
219
|
level
|
|
202
220
|
} : !1;
|
|
203
221
|
},
|
|
204
|
-
actions: [
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
222
|
+
actions: [({
|
|
223
|
+
event
|
|
224
|
+
}) => [behaviors.execute(event)], (_, {
|
|
225
|
+
focusTextBlock,
|
|
226
|
+
style,
|
|
227
|
+
level
|
|
228
|
+
}) => [behaviors.execute({
|
|
229
|
+
type: "block.unset",
|
|
230
|
+
props: ["listItem", "level"],
|
|
231
|
+
at: focusTextBlock.path
|
|
232
|
+
}), behaviors.execute({
|
|
233
|
+
type: "block.set",
|
|
234
|
+
props: {
|
|
235
|
+
style
|
|
236
|
+
},
|
|
237
|
+
at: focusTextBlock.path
|
|
238
|
+
}), behaviors.execute({
|
|
239
|
+
type: "delete.text",
|
|
240
|
+
at: {
|
|
241
|
+
anchor: {
|
|
242
|
+
path: focusTextBlock.path,
|
|
243
|
+
offset: 0
|
|
244
|
+
},
|
|
245
|
+
focus: {
|
|
246
|
+
path: focusTextBlock.path,
|
|
247
|
+
offset: level + 1
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
})]]
|
|
232
251
|
}), clearStyleOnBackspace = behaviors.defineBehavior({
|
|
233
252
|
on: "delete.backward",
|
|
234
|
-
guard: ({
|
|
253
|
+
guard: ({
|
|
254
|
+
snapshot
|
|
255
|
+
}) => {
|
|
235
256
|
const selectionCollapsed = selectors__namespace.isSelectionCollapsed(snapshot), focusTextBlock = selectors__namespace.getFocusTextBlock(snapshot), focusSpan = selectors__namespace.getFocusSpan(snapshot);
|
|
236
257
|
if (!selectionCollapsed || !focusTextBlock || !focusSpan)
|
|
237
258
|
return !1;
|
|
238
259
|
const atTheBeginningOfBLock = focusTextBlock.node.children[0]._key === focusSpan.node._key && snapshot.context.selection?.focus.offset === 0, defaultStyle = config.defaultStyle?.({
|
|
239
260
|
schema: snapshot.context.schema
|
|
240
261
|
});
|
|
241
|
-
return atTheBeginningOfBLock && defaultStyle && focusTextBlock.node.style !== defaultStyle ? {
|
|
262
|
+
return atTheBeginningOfBLock && defaultStyle && focusTextBlock.node.style !== defaultStyle ? {
|
|
263
|
+
defaultStyle,
|
|
264
|
+
focusTextBlock
|
|
265
|
+
} : !1;
|
|
242
266
|
},
|
|
243
|
-
actions: [
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
267
|
+
actions: [(_, {
|
|
268
|
+
defaultStyle,
|
|
269
|
+
focusTextBlock
|
|
270
|
+
}) => [behaviors.execute({
|
|
271
|
+
type: "block.set",
|
|
272
|
+
props: {
|
|
273
|
+
style: defaultStyle
|
|
274
|
+
},
|
|
275
|
+
at: focusTextBlock.path
|
|
276
|
+
})]]
|
|
252
277
|
}), automaticListOnSpace = behaviors.defineBehavior({
|
|
253
278
|
on: "insert.text",
|
|
254
|
-
guard: ({
|
|
279
|
+
guard: ({
|
|
280
|
+
snapshot,
|
|
281
|
+
event
|
|
282
|
+
}) => {
|
|
255
283
|
if (event.text !== " ")
|
|
256
284
|
return !1;
|
|
257
285
|
const selectionCollapsed = selectors__namespace.isSelectionCollapsed(snapshot), focusTextBlock = selectors__namespace.getFocusTextBlock(snapshot), focusSpan = selectors__namespace.getFocusSpan(snapshot);
|
|
@@ -260,11 +288,11 @@ function createMarkdownBehaviors(config) {
|
|
|
260
288
|
const previousInlineObject = selectors__namespace.getPreviousInlineObject(snapshot), blockOffset = utils__namespace.spanSelectionPointToBlockOffset({
|
|
261
289
|
context: snapshot.context,
|
|
262
290
|
selectionPoint: {
|
|
263
|
-
path: [
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
],
|
|
291
|
+
path: [{
|
|
292
|
+
_key: focusTextBlock.node._key
|
|
293
|
+
}, "children", {
|
|
294
|
+
_key: focusSpan.node._key
|
|
295
|
+
}],
|
|
268
296
|
offset: snapshot.context.selection?.focus.offset ?? 0
|
|
269
297
|
}
|
|
270
298
|
});
|
|
@@ -292,101 +320,88 @@ function createMarkdownBehaviors(config) {
|
|
|
292
320
|
style: defaultStyle
|
|
293
321
|
} : !1;
|
|
294
322
|
},
|
|
295
|
-
actions: [
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
323
|
+
actions: [({
|
|
324
|
+
event
|
|
325
|
+
}) => [behaviors.execute(event)], (_, {
|
|
326
|
+
focusTextBlock,
|
|
327
|
+
style,
|
|
328
|
+
listItem,
|
|
329
|
+
listItemLength
|
|
330
|
+
}) => [behaviors.execute({
|
|
331
|
+
type: "block.set",
|
|
332
|
+
props: {
|
|
333
|
+
listItem,
|
|
334
|
+
level: 1,
|
|
335
|
+
style
|
|
336
|
+
},
|
|
337
|
+
at: focusTextBlock.path
|
|
338
|
+
}), behaviors.execute({
|
|
339
|
+
type: "delete.text",
|
|
340
|
+
at: {
|
|
341
|
+
anchor: {
|
|
342
|
+
path: focusTextBlock.path,
|
|
343
|
+
offset: 0
|
|
344
|
+
},
|
|
345
|
+
focus: {
|
|
346
|
+
path: focusTextBlock.path,
|
|
347
|
+
offset: listItemLength + 1
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
})]]
|
|
322
351
|
});
|
|
323
|
-
return [
|
|
324
|
-
automaticBlockquoteOnSpace,
|
|
325
|
-
automaticHeadingOnSpace,
|
|
326
|
-
automaticHr,
|
|
327
|
-
automaticHrOnPaste,
|
|
328
|
-
clearStyleOnBackspace,
|
|
329
|
-
automaticListOnSpace
|
|
330
|
-
];
|
|
352
|
+
return [automaticBlockquoteOnSpace, automaticHeadingOnSpace, automaticHr, automaticHrOnPaste, clearStyleOnBackspace, automaticListOnSpace];
|
|
331
353
|
}
|
|
332
354
|
function MarkdownShortcutsPlugin(props) {
|
|
333
|
-
const editor$1 = editor.useEditor();
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
355
|
+
const $ = compilerRuntime.c(17), editor$1 = editor.useEditor();
|
|
356
|
+
let t0, t1;
|
|
357
|
+
$[0] !== editor$1 || $[1] !== props ? (t0 = () => {
|
|
358
|
+
const unregisterBehaviors = createMarkdownBehaviors(props).map((behavior) => editor$1.registerBehavior({
|
|
359
|
+
behavior
|
|
360
|
+
}));
|
|
338
361
|
return () => {
|
|
339
362
|
for (const unregisterBehavior of unregisterBehaviors)
|
|
340
363
|
unregisterBehavior();
|
|
341
364
|
};
|
|
342
|
-
}, [editor$1, props]
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
props.strikeThroughDecorator ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
383
|
-
pluginCharacterPairDecorator.CharacterPairDecoratorPlugin,
|
|
384
|
-
{
|
|
385
|
-
decorator: props.strikeThroughDecorator,
|
|
386
|
-
pair: { char: "~", amount: 2 }
|
|
387
|
-
}
|
|
388
|
-
) : null
|
|
389
|
-
] });
|
|
365
|
+
}, t1 = [editor$1, props], $[0] = editor$1, $[1] = props, $[2] = t0, $[3] = t1) : (t0 = $[2], t1 = $[3]), react.useEffect(t0, t1);
|
|
366
|
+
let t2;
|
|
367
|
+
$[4] !== props.boldDecorator ? (t2 = props.boldDecorator ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
368
|
+
/* @__PURE__ */ jsxRuntime.jsx(pluginCharacterPairDecorator.CharacterPairDecoratorPlugin, { decorator: props.boldDecorator, pair: {
|
|
369
|
+
char: "*",
|
|
370
|
+
amount: 2
|
|
371
|
+
} }),
|
|
372
|
+
/* @__PURE__ */ jsxRuntime.jsx(pluginCharacterPairDecorator.CharacterPairDecoratorPlugin, { decorator: props.boldDecorator, pair: {
|
|
373
|
+
char: "_",
|
|
374
|
+
amount: 2
|
|
375
|
+
} })
|
|
376
|
+
] }) : null, $[4] = props.boldDecorator, $[5] = t2) : t2 = $[5];
|
|
377
|
+
let t3;
|
|
378
|
+
$[6] !== props.codeDecorator ? (t3 = props.codeDecorator ? /* @__PURE__ */ jsxRuntime.jsx(pluginCharacterPairDecorator.CharacterPairDecoratorPlugin, { decorator: props.codeDecorator, pair: {
|
|
379
|
+
char: "`",
|
|
380
|
+
amount: 1
|
|
381
|
+
} }) : null, $[6] = props.codeDecorator, $[7] = t3) : t3 = $[7];
|
|
382
|
+
let t4;
|
|
383
|
+
$[8] !== props.italicDecorator ? (t4 = props.italicDecorator ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
384
|
+
/* @__PURE__ */ jsxRuntime.jsx(pluginCharacterPairDecorator.CharacterPairDecoratorPlugin, { decorator: props.italicDecorator, pair: {
|
|
385
|
+
char: "*",
|
|
386
|
+
amount: 1
|
|
387
|
+
} }),
|
|
388
|
+
/* @__PURE__ */ jsxRuntime.jsx(pluginCharacterPairDecorator.CharacterPairDecoratorPlugin, { decorator: props.italicDecorator, pair: {
|
|
389
|
+
char: "_",
|
|
390
|
+
amount: 1
|
|
391
|
+
} })
|
|
392
|
+
] }) : null, $[8] = props.italicDecorator, $[9] = t4) : t4 = $[9];
|
|
393
|
+
let t5;
|
|
394
|
+
$[10] !== props.strikeThroughDecorator ? (t5 = props.strikeThroughDecorator ? /* @__PURE__ */ jsxRuntime.jsx(pluginCharacterPairDecorator.CharacterPairDecoratorPlugin, { decorator: props.strikeThroughDecorator, pair: {
|
|
395
|
+
char: "~",
|
|
396
|
+
amount: 2
|
|
397
|
+
} }) : null, $[10] = props.strikeThroughDecorator, $[11] = t5) : t5 = $[11];
|
|
398
|
+
let t6;
|
|
399
|
+
return $[12] !== t2 || $[13] !== t3 || $[14] !== t4 || $[15] !== t5 ? (t6 = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
400
|
+
t2,
|
|
401
|
+
t3,
|
|
402
|
+
t4,
|
|
403
|
+
t5
|
|
404
|
+
] }), $[12] = t2, $[13] = t3, $[14] = t4, $[15] = t5, $[16] = t6) : t6 = $[16], t6;
|
|
390
405
|
}
|
|
391
406
|
exports.MarkdownShortcutsPlugin = MarkdownShortcutsPlugin;
|
|
392
407
|
//# sourceMappingURL=index.cjs.map
|