vue-codemirror6 1.1.26 → 1.1.27
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.es.js +56 -59
- package/dist/index.iife.js +56 -59
- package/dist/index.umd.js +56 -59
- package/package.json +1 -1
- package/src/components/CodeMirror.ts +15 -22
package/dist/index.es.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @author Logue <logue@hotmail.co.jp>
|
|
6
6
|
* @copyright 2022-2023 By Masashi Yoshikawa All rights reserved.
|
|
7
7
|
* @license MIT
|
|
8
|
-
* @version 1.1.
|
|
8
|
+
* @version 1.1.27
|
|
9
9
|
* @see {@link https://github.com/logue/vue-codemirror6}
|
|
10
10
|
*/
|
|
11
11
|
|
|
@@ -300,60 +300,59 @@ var CodeMirror = defineComponent({
|
|
|
300
300
|
);
|
|
301
301
|
const length = ref(0);
|
|
302
302
|
const diagnosticCount$1 = ref(0);
|
|
303
|
-
const
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
//
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
}
|
|
322
|
-
diagnosticCount$1.value = props.linter(view.value).length;
|
|
303
|
+
const extensions = computed(() => {
|
|
304
|
+
const language = new Compartment();
|
|
305
|
+
const tabSize = new Compartment();
|
|
306
|
+
return [
|
|
307
|
+
// Toggle basic setup
|
|
308
|
+
props.basic ? basicSetup : void 0,
|
|
309
|
+
// Toggle minimal setup
|
|
310
|
+
props.minimal && !props.basic ? minimalSetup : void 0,
|
|
311
|
+
// ViewUpdate event listener
|
|
312
|
+
EditorView.updateListener.of((update) => {
|
|
313
|
+
context.emit("focus", view.value.hasFocus);
|
|
314
|
+
length.value = view.value.state.doc.length;
|
|
315
|
+
if (update.changes.empty || !update.docChanged) {
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
if (props.linter) {
|
|
319
|
+
if (props.forceLinting) {
|
|
320
|
+
forceLinting(view.value);
|
|
323
321
|
}
|
|
324
|
-
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
322
|
+
diagnosticCount$1.value = props.linter(view.value).length;
|
|
323
|
+
}
|
|
324
|
+
context.emit("update", update);
|
|
325
|
+
}),
|
|
326
|
+
// Toggle light/dark mode.
|
|
327
|
+
EditorView.theme(props.theme, { dark: props.dark }),
|
|
328
|
+
// Toggle line wrapping
|
|
329
|
+
props.wrap ? EditorView.lineWrapping : void 0,
|
|
330
|
+
// Indent with tab
|
|
331
|
+
props.tab ? keymap.of([indentWithTab]) : void 0,
|
|
332
|
+
// Allow Multiple Selections
|
|
333
|
+
EditorState.allowMultipleSelections.of(props.allowMultipleSelections),
|
|
334
|
+
// Indent tab size
|
|
335
|
+
props.tabSize ? tabSize.of(EditorState.tabSize.of(props.tabSize)) : void 0,
|
|
336
|
+
// locale settings
|
|
337
|
+
props.phrases ? EditorState.phrases.of(props.phrases) : void 0,
|
|
338
|
+
// Readonly option
|
|
339
|
+
EditorState.readOnly.of(props.readonly),
|
|
340
|
+
// Editable option
|
|
341
|
+
EditorView.editable.of(!props.disabled),
|
|
342
|
+
// Set Line break char
|
|
343
|
+
props.lineSeparator ? EditorState.lineSeparator.of(props.lineSeparator) : void 0,
|
|
344
|
+
// Lang
|
|
345
|
+
props.lang ? language.of(props.lang) : void 0,
|
|
346
|
+
// Append Linter settings
|
|
347
|
+
props.linter ? linter(props.linter, props.linterConfig) : void 0,
|
|
348
|
+
// Show 🔴 to error line when linter enabled.
|
|
349
|
+
props.linter && props.gutter ? lintGutter(props.gutterConfig) : void 0,
|
|
350
|
+
// Placeholder
|
|
351
|
+
props.placeholder ? placeholder(props.placeholder) : void 0,
|
|
352
|
+
// Append Extensions
|
|
353
|
+
...props.extensions
|
|
354
|
+
].filter((extension) => !!extension);
|
|
355
|
+
});
|
|
357
356
|
watch(
|
|
358
357
|
extensions,
|
|
359
358
|
(exts) => {
|
|
@@ -368,7 +367,6 @@ var CodeMirror = defineComponent({
|
|
|
368
367
|
async (value) => {
|
|
369
368
|
if (view.value.composing || // IME fix
|
|
370
369
|
view.value.state.doc.toJSON().join(props.lineSeparator ?? "\n") === value) {
|
|
371
|
-
length.value = view.value.state.doc.length;
|
|
372
370
|
return;
|
|
373
371
|
}
|
|
374
372
|
view.value.dispatch({
|
|
@@ -376,11 +374,9 @@ var CodeMirror = defineComponent({
|
|
|
376
374
|
selection: view.value.state.selection,
|
|
377
375
|
scrollIntoView: true
|
|
378
376
|
});
|
|
379
|
-
length.value = view.value.state.doc.length;
|
|
380
377
|
},
|
|
381
378
|
{ immediate: true }
|
|
382
379
|
);
|
|
383
|
-
watch(focus, (isFocus) => context.emit("focus", isFocus));
|
|
384
380
|
onMounted(async () => {
|
|
385
381
|
let value = doc.value;
|
|
386
382
|
if (!editor.value) {
|
|
@@ -484,6 +480,7 @@ var CodeMirror = defineComponent({
|
|
|
484
480
|
length,
|
|
485
481
|
json,
|
|
486
482
|
diagnosticCount: diagnosticCount$1,
|
|
483
|
+
dom: view.value.contentDOM,
|
|
487
484
|
lint,
|
|
488
485
|
forceReconfigure,
|
|
489
486
|
// Bellow is CodeMirror5's function
|
|
@@ -525,8 +522,8 @@ var CodeMirror = defineComponent({
|
|
|
525
522
|
});
|
|
526
523
|
|
|
527
524
|
const meta = {
|
|
528
|
-
version: "1.1.
|
|
529
|
-
date: "2023-
|
|
525
|
+
version: "1.1.27",
|
|
526
|
+
date: "2023-09-01T16:38:44.335Z"
|
|
530
527
|
};
|
|
531
528
|
var meta$1 = meta;
|
|
532
529
|
|
package/dist/index.iife.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @author Logue <logue@hotmail.co.jp>
|
|
6
6
|
* @copyright 2022-2023 By Masashi Yoshikawa All rights reserved.
|
|
7
7
|
* @license MIT
|
|
8
|
-
* @version 1.1.
|
|
8
|
+
* @version 1.1.27
|
|
9
9
|
* @see {@link https://github.com/logue/vue-codemirror6}
|
|
10
10
|
*/
|
|
11
11
|
|
|
@@ -296,60 +296,59 @@ var CodeMirror = (function (exports, vueDemi, codemirror, view, state, lint, com
|
|
|
296
296
|
);
|
|
297
297
|
const length = vueDemi.ref(0);
|
|
298
298
|
const diagnosticCount = vueDemi.ref(0);
|
|
299
|
-
const
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
//
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
view.
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
}
|
|
318
|
-
diagnosticCount.value = props.linter(view$1.value).length;
|
|
299
|
+
const extensions = vueDemi.computed(() => {
|
|
300
|
+
const language = new state.Compartment();
|
|
301
|
+
const tabSize = new state.Compartment();
|
|
302
|
+
return [
|
|
303
|
+
// Toggle basic setup
|
|
304
|
+
props.basic ? codemirror.basicSetup : void 0,
|
|
305
|
+
// Toggle minimal setup
|
|
306
|
+
props.minimal && !props.basic ? codemirror.minimalSetup : void 0,
|
|
307
|
+
// ViewUpdate event listener
|
|
308
|
+
view.EditorView.updateListener.of((update) => {
|
|
309
|
+
context.emit("focus", view$1.value.hasFocus);
|
|
310
|
+
length.value = view$1.value.state.doc.length;
|
|
311
|
+
if (update.changes.empty || !update.docChanged) {
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
if (props.linter) {
|
|
315
|
+
if (props.forceLinting) {
|
|
316
|
+
lint.forceLinting(view$1.value);
|
|
319
317
|
}
|
|
320
|
-
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
318
|
+
diagnosticCount.value = props.linter(view$1.value).length;
|
|
319
|
+
}
|
|
320
|
+
context.emit("update", update);
|
|
321
|
+
}),
|
|
322
|
+
// Toggle light/dark mode.
|
|
323
|
+
view.EditorView.theme(props.theme, { dark: props.dark }),
|
|
324
|
+
// Toggle line wrapping
|
|
325
|
+
props.wrap ? view.EditorView.lineWrapping : void 0,
|
|
326
|
+
// Indent with tab
|
|
327
|
+
props.tab ? view.keymap.of([commands.indentWithTab]) : void 0,
|
|
328
|
+
// Allow Multiple Selections
|
|
329
|
+
state.EditorState.allowMultipleSelections.of(props.allowMultipleSelections),
|
|
330
|
+
// Indent tab size
|
|
331
|
+
props.tabSize ? tabSize.of(state.EditorState.tabSize.of(props.tabSize)) : void 0,
|
|
332
|
+
// locale settings
|
|
333
|
+
props.phrases ? state.EditorState.phrases.of(props.phrases) : void 0,
|
|
334
|
+
// Readonly option
|
|
335
|
+
state.EditorState.readOnly.of(props.readonly),
|
|
336
|
+
// Editable option
|
|
337
|
+
view.EditorView.editable.of(!props.disabled),
|
|
338
|
+
// Set Line break char
|
|
339
|
+
props.lineSeparator ? state.EditorState.lineSeparator.of(props.lineSeparator) : void 0,
|
|
340
|
+
// Lang
|
|
341
|
+
props.lang ? language.of(props.lang) : void 0,
|
|
342
|
+
// Append Linter settings
|
|
343
|
+
props.linter ? lint.linter(props.linter, props.linterConfig) : void 0,
|
|
344
|
+
// Show 🔴 to error line when linter enabled.
|
|
345
|
+
props.linter && props.gutter ? lint.lintGutter(props.gutterConfig) : void 0,
|
|
346
|
+
// Placeholder
|
|
347
|
+
props.placeholder ? view.placeholder(props.placeholder) : void 0,
|
|
348
|
+
// Append Extensions
|
|
349
|
+
...props.extensions
|
|
350
|
+
].filter((extension) => !!extension);
|
|
351
|
+
});
|
|
353
352
|
vueDemi.watch(
|
|
354
353
|
extensions,
|
|
355
354
|
(exts) => {
|
|
@@ -364,7 +363,6 @@ var CodeMirror = (function (exports, vueDemi, codemirror, view, state, lint, com
|
|
|
364
363
|
async (value) => {
|
|
365
364
|
if (view$1.value.composing || // IME fix
|
|
366
365
|
view$1.value.state.doc.toJSON().join(props.lineSeparator ?? "\n") === value) {
|
|
367
|
-
length.value = view$1.value.state.doc.length;
|
|
368
366
|
return;
|
|
369
367
|
}
|
|
370
368
|
view$1.value.dispatch({
|
|
@@ -372,11 +370,9 @@ var CodeMirror = (function (exports, vueDemi, codemirror, view, state, lint, com
|
|
|
372
370
|
selection: view$1.value.state.selection,
|
|
373
371
|
scrollIntoView: true
|
|
374
372
|
});
|
|
375
|
-
length.value = view$1.value.state.doc.length;
|
|
376
373
|
},
|
|
377
374
|
{ immediate: true }
|
|
378
375
|
);
|
|
379
|
-
vueDemi.watch(focus, (isFocus) => context.emit("focus", isFocus));
|
|
380
376
|
vueDemi.onMounted(async () => {
|
|
381
377
|
let value = doc.value;
|
|
382
378
|
if (!editor.value) {
|
|
@@ -480,6 +476,7 @@ var CodeMirror = (function (exports, vueDemi, codemirror, view, state, lint, com
|
|
|
480
476
|
length,
|
|
481
477
|
json,
|
|
482
478
|
diagnosticCount,
|
|
479
|
+
dom: view$1.value.contentDOM,
|
|
483
480
|
lint: lint$1,
|
|
484
481
|
forceReconfigure,
|
|
485
482
|
// Bellow is CodeMirror5's function
|
|
@@ -521,8 +518,8 @@ var CodeMirror = (function (exports, vueDemi, codemirror, view, state, lint, com
|
|
|
521
518
|
});
|
|
522
519
|
|
|
523
520
|
const meta = {
|
|
524
|
-
version: "1.1.
|
|
525
|
-
date: "2023-
|
|
521
|
+
version: "1.1.27",
|
|
522
|
+
date: "2023-09-01T16:38:44.335Z"
|
|
526
523
|
};
|
|
527
524
|
var meta$1 = meta;
|
|
528
525
|
|
package/dist/index.umd.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @author Logue <logue@hotmail.co.jp>
|
|
6
6
|
* @copyright 2022-2023 By Masashi Yoshikawa All rights reserved.
|
|
7
7
|
* @license MIT
|
|
8
|
-
* @version 1.1.
|
|
8
|
+
* @version 1.1.27
|
|
9
9
|
* @see {@link https://github.com/logue/vue-codemirror6}
|
|
10
10
|
*/
|
|
11
11
|
|
|
@@ -299,60 +299,59 @@
|
|
|
299
299
|
);
|
|
300
300
|
const length = vueDemi.ref(0);
|
|
301
301
|
const diagnosticCount = vueDemi.ref(0);
|
|
302
|
-
const
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
//
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
view.
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
}
|
|
321
|
-
diagnosticCount.value = props.linter(view$1.value).length;
|
|
302
|
+
const extensions = vueDemi.computed(() => {
|
|
303
|
+
const language = new state.Compartment();
|
|
304
|
+
const tabSize = new state.Compartment();
|
|
305
|
+
return [
|
|
306
|
+
// Toggle basic setup
|
|
307
|
+
props.basic ? codemirror.basicSetup : void 0,
|
|
308
|
+
// Toggle minimal setup
|
|
309
|
+
props.minimal && !props.basic ? codemirror.minimalSetup : void 0,
|
|
310
|
+
// ViewUpdate event listener
|
|
311
|
+
view.EditorView.updateListener.of((update) => {
|
|
312
|
+
context.emit("focus", view$1.value.hasFocus);
|
|
313
|
+
length.value = view$1.value.state.doc.length;
|
|
314
|
+
if (update.changes.empty || !update.docChanged) {
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
if (props.linter) {
|
|
318
|
+
if (props.forceLinting) {
|
|
319
|
+
lint.forceLinting(view$1.value);
|
|
322
320
|
}
|
|
323
|
-
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
321
|
+
diagnosticCount.value = props.linter(view$1.value).length;
|
|
322
|
+
}
|
|
323
|
+
context.emit("update", update);
|
|
324
|
+
}),
|
|
325
|
+
// Toggle light/dark mode.
|
|
326
|
+
view.EditorView.theme(props.theme, { dark: props.dark }),
|
|
327
|
+
// Toggle line wrapping
|
|
328
|
+
props.wrap ? view.EditorView.lineWrapping : void 0,
|
|
329
|
+
// Indent with tab
|
|
330
|
+
props.tab ? view.keymap.of([commands.indentWithTab]) : void 0,
|
|
331
|
+
// Allow Multiple Selections
|
|
332
|
+
state.EditorState.allowMultipleSelections.of(props.allowMultipleSelections),
|
|
333
|
+
// Indent tab size
|
|
334
|
+
props.tabSize ? tabSize.of(state.EditorState.tabSize.of(props.tabSize)) : void 0,
|
|
335
|
+
// locale settings
|
|
336
|
+
props.phrases ? state.EditorState.phrases.of(props.phrases) : void 0,
|
|
337
|
+
// Readonly option
|
|
338
|
+
state.EditorState.readOnly.of(props.readonly),
|
|
339
|
+
// Editable option
|
|
340
|
+
view.EditorView.editable.of(!props.disabled),
|
|
341
|
+
// Set Line break char
|
|
342
|
+
props.lineSeparator ? state.EditorState.lineSeparator.of(props.lineSeparator) : void 0,
|
|
343
|
+
// Lang
|
|
344
|
+
props.lang ? language.of(props.lang) : void 0,
|
|
345
|
+
// Append Linter settings
|
|
346
|
+
props.linter ? lint.linter(props.linter, props.linterConfig) : void 0,
|
|
347
|
+
// Show 🔴 to error line when linter enabled.
|
|
348
|
+
props.linter && props.gutter ? lint.lintGutter(props.gutterConfig) : void 0,
|
|
349
|
+
// Placeholder
|
|
350
|
+
props.placeholder ? view.placeholder(props.placeholder) : void 0,
|
|
351
|
+
// Append Extensions
|
|
352
|
+
...props.extensions
|
|
353
|
+
].filter((extension) => !!extension);
|
|
354
|
+
});
|
|
356
355
|
vueDemi.watch(
|
|
357
356
|
extensions,
|
|
358
357
|
(exts) => {
|
|
@@ -367,7 +366,6 @@
|
|
|
367
366
|
async (value) => {
|
|
368
367
|
if (view$1.value.composing || // IME fix
|
|
369
368
|
view$1.value.state.doc.toJSON().join(props.lineSeparator ?? "\n") === value) {
|
|
370
|
-
length.value = view$1.value.state.doc.length;
|
|
371
369
|
return;
|
|
372
370
|
}
|
|
373
371
|
view$1.value.dispatch({
|
|
@@ -375,11 +373,9 @@
|
|
|
375
373
|
selection: view$1.value.state.selection,
|
|
376
374
|
scrollIntoView: true
|
|
377
375
|
});
|
|
378
|
-
length.value = view$1.value.state.doc.length;
|
|
379
376
|
},
|
|
380
377
|
{ immediate: true }
|
|
381
378
|
);
|
|
382
|
-
vueDemi.watch(focus, (isFocus) => context.emit("focus", isFocus));
|
|
383
379
|
vueDemi.onMounted(async () => {
|
|
384
380
|
let value = doc.value;
|
|
385
381
|
if (!editor.value) {
|
|
@@ -483,6 +479,7 @@
|
|
|
483
479
|
length,
|
|
484
480
|
json,
|
|
485
481
|
diagnosticCount,
|
|
482
|
+
dom: view$1.value.contentDOM,
|
|
486
483
|
lint: lint$1,
|
|
487
484
|
forceReconfigure,
|
|
488
485
|
// Bellow is CodeMirror5's function
|
|
@@ -524,8 +521,8 @@
|
|
|
524
521
|
});
|
|
525
522
|
|
|
526
523
|
const meta = {
|
|
527
|
-
version: "1.1.
|
|
528
|
-
date: "2023-
|
|
524
|
+
version: "1.1.27",
|
|
525
|
+
date: "2023-09-01T16:38:44.335Z"
|
|
529
526
|
};
|
|
530
527
|
var meta$1 = meta;
|
|
531
528
|
|
package/package.json
CHANGED
|
@@ -274,8 +274,6 @@ export default defineComponent({
|
|
|
274
274
|
}) => true,
|
|
275
275
|
/** CodeMirror onFocus */
|
|
276
276
|
focus: (value: boolean) => true,
|
|
277
|
-
/** blur */
|
|
278
|
-
// blur: (value: boolean) => true,
|
|
279
277
|
/** State Changed */
|
|
280
278
|
change: (value: EditorState) => true,
|
|
281
279
|
/** CodeMirror onDestroy */
|
|
@@ -349,22 +347,26 @@ export default defineComponent({
|
|
|
349
347
|
*/
|
|
350
348
|
const diagnosticCount: Ref<number> = ref(0);
|
|
351
349
|
|
|
352
|
-
// Synamic Reconfiguration
|
|
353
|
-
// @see https://codemirror.net/examples/config/
|
|
354
|
-
|
|
355
|
-
const language = new Compartment();
|
|
356
|
-
const tabSize = new Compartment();
|
|
357
|
-
|
|
358
350
|
/** Get CodeMirror Extension */
|
|
359
|
-
const extensions: ComputedRef<Extension[]> = computed(() =>
|
|
351
|
+
const extensions: ComputedRef<Extension[]> = computed(() => {
|
|
352
|
+
// Synamic Reconfiguration
|
|
353
|
+
// @see https://codemirror.net/examples/config/
|
|
354
|
+
const language = new Compartment();
|
|
355
|
+
const tabSize = new Compartment();
|
|
356
|
+
|
|
360
357
|
// TODO: Ignore previous prop was not changed.
|
|
361
|
-
[
|
|
358
|
+
return [
|
|
362
359
|
// Toggle basic setup
|
|
363
360
|
props.basic ? basicSetup : undefined,
|
|
364
361
|
// Toggle minimal setup
|
|
365
362
|
props.minimal && !props.basic ? minimalSetup : undefined,
|
|
366
363
|
// ViewUpdate event listener
|
|
367
364
|
EditorView.updateListener.of((update: ViewUpdate): void => {
|
|
365
|
+
// Emit focus status
|
|
366
|
+
context.emit('focus', view.value.hasFocus);
|
|
367
|
+
// Update count
|
|
368
|
+
length.value = view.value.state.doc.length;
|
|
369
|
+
|
|
368
370
|
if (update.changes.empty || !update.docChanged) {
|
|
369
371
|
// Suppress event firing if no change
|
|
370
372
|
return;
|
|
@@ -381,7 +383,6 @@ export default defineComponent({
|
|
|
381
383
|
).length;
|
|
382
384
|
}
|
|
383
385
|
context.emit('update', update);
|
|
384
|
-
context.emit('focus', view.value.hasFocus);
|
|
385
386
|
}),
|
|
386
387
|
// Toggle light/dark mode.
|
|
387
388
|
EditorView.theme(props.theme, { dark: props.dark }),
|
|
@@ -417,8 +418,8 @@ export default defineComponent({
|
|
|
417
418
|
props.placeholder ? placeholder(props.placeholder) : undefined,
|
|
418
419
|
// Append Extensions
|
|
419
420
|
...props.extensions,
|
|
420
|
-
].filter((extension): extension is Extension => !!extension)
|
|
421
|
-
);
|
|
421
|
+
].filter((extension): extension is Extension => !!extension);
|
|
422
|
+
});
|
|
422
423
|
|
|
423
424
|
// Extension (mostly props) Changed
|
|
424
425
|
watch(
|
|
@@ -440,8 +441,6 @@ export default defineComponent({
|
|
|
440
441
|
view.value.state.doc.toJSON().join(props.lineSeparator ?? '\n') ===
|
|
441
442
|
value // don't need to update
|
|
442
443
|
) {
|
|
443
|
-
// Update count
|
|
444
|
-
length.value = view.value.state.doc.length;
|
|
445
444
|
// Do not commit CodeMirror's store.
|
|
446
445
|
return;
|
|
447
446
|
}
|
|
@@ -452,15 +451,10 @@ export default defineComponent({
|
|
|
452
451
|
selection: view.value.state.selection,
|
|
453
452
|
scrollIntoView: true,
|
|
454
453
|
});
|
|
455
|
-
// Update count
|
|
456
|
-
length.value = view.value.state.doc.length;
|
|
457
454
|
},
|
|
458
455
|
{ immediate: true }
|
|
459
456
|
);
|
|
460
457
|
|
|
461
|
-
// focus changed
|
|
462
|
-
watch(focus, isFocus => context.emit('focus', isFocus));
|
|
463
|
-
|
|
464
458
|
/** When loaded */
|
|
465
459
|
onMounted(async () => {
|
|
466
460
|
/** Initial value */
|
|
@@ -485,8 +479,6 @@ export default defineComponent({
|
|
|
485
479
|
dispatch: (tr: Transaction) => {
|
|
486
480
|
view.value.update([tr]);
|
|
487
481
|
|
|
488
|
-
context.emit('focus', view.value.hasFocus);
|
|
489
|
-
|
|
490
482
|
if (tr.changes.empty || !tr.docChanged) {
|
|
491
483
|
// if not change value, no fire emit event
|
|
492
484
|
return;
|
|
@@ -677,6 +669,7 @@ export default defineComponent({
|
|
|
677
669
|
length,
|
|
678
670
|
json,
|
|
679
671
|
diagnosticCount,
|
|
672
|
+
dom: view.value.contentDOM,
|
|
680
673
|
lint,
|
|
681
674
|
forceReconfigure,
|
|
682
675
|
// Bellow is CodeMirror5's function
|