vue-codemirror6 1.1.4 → 1.1.10
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/CHANGELOG.md +3 -4
- package/README.md +8 -7
- package/dist/Meta.d.ts +3 -0
- package/dist/Meta.js +6 -0
- package/dist/components/CodeMirror.d.ts +417 -0
- package/dist/components/CodeMirror.js +509 -0
- package/dist/helpers/h-demi.d.ts +18 -0
- package/dist/helpers/h-demi.js +27 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.es.js +13 -5
- package/dist/index.iife.js +16 -12
- package/dist/index.js +11 -0
- package/dist/index.umd.js +18 -14
- package/dist/interfaces/MetaInterface.d.ts +7 -0
- package/dist/interfaces/MetaInterface.js +1 -0
- package/package.json +17 -17
- package/src/components/CodeMirror.ts +19 -3
package/dist/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import CodeMirror from './components/CodeMirror';
|
|
2
|
+
import Meta from './Meta';
|
|
3
|
+
// TODO: Move phrases props to option.
|
|
4
|
+
const installCodeMirror = (app) => app.component('CodeMirror', CodeMirror);
|
|
5
|
+
export { CodeMirror as default, installCodeMirror as install, Meta };
|
|
6
|
+
// For CDN. (Maybe Vue2 only)
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
if (typeof window !== 'undefined' && window.Vue) {
|
|
9
|
+
// @ts-ignore
|
|
10
|
+
window.Vue.use(CodeMirror);
|
|
11
|
+
}
|
package/dist/index.umd.js
CHANGED
|
@@ -5,20 +5,15 @@
|
|
|
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.10
|
|
9
9
|
* @see {@link https://github.com/logue/vue-codemirror6}
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
(function (global, factory) {
|
|
13
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue-demi'), require('lodash
|
|
14
|
-
typeof define === 'function' && define.amd ? define(['exports', 'vue-demi', 'lodash
|
|
15
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.CodeMirror = {}, global.VueDemi, global.
|
|
16
|
-
})(this, (function (exports, vueDemi,
|
|
17
|
-
|
|
18
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
19
|
-
|
|
20
|
-
var compact__default = /*#__PURE__*/_interopDefaultCompat(compact);
|
|
21
|
-
var trim__default = /*#__PURE__*/_interopDefaultCompat(trim);
|
|
13
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue-demi'), require('lodash'), require('codemirror'), require('@codemirror/state'), require('@codemirror/view'), require('@codemirror/commands'), require('@codemirror/lint')) :
|
|
14
|
+
typeof define === 'function' && define.amd ? define(['exports', 'vue-demi', 'lodash', 'codemirror', '@codemirror/state', '@codemirror/view', '@codemirror/commands', '@codemirror/lint'], factory) :
|
|
15
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.CodeMirror = {}, global.VueDemi, global.lodash, global.codemirror, global.state, global.view, global.commands, global.lint));
|
|
16
|
+
})(this, (function (exports, vueDemi, lodash, codemirror, state, view, commands, lint) { 'use strict';
|
|
22
17
|
|
|
23
18
|
const adaptOnsV3 = (ons) => {
|
|
24
19
|
if (!ons)
|
|
@@ -165,7 +160,7 @@
|
|
|
165
160
|
() => view$1.value.state.doc.length
|
|
166
161
|
);
|
|
167
162
|
const extensions = vueDemi.computed(
|
|
168
|
-
() =>
|
|
163
|
+
() => lodash.compact([
|
|
169
164
|
props.basic ? codemirror.basicSetup : void 0,
|
|
170
165
|
props.minimal && !props.basic ? codemirror.minimalSetup : void 0,
|
|
171
166
|
view.EditorView.updateListener.of(
|
|
@@ -215,7 +210,7 @@
|
|
|
215
210
|
"[CodeMirror.vue] The <code-mirror> tag contains child elements that overwrite the `v-model` values."
|
|
216
211
|
);
|
|
217
212
|
}
|
|
218
|
-
value =
|
|
213
|
+
value = lodash.trim(editor.value.childNodes[0].innerText);
|
|
219
214
|
}
|
|
220
215
|
view$1.value = new view.EditorView({
|
|
221
216
|
doc: value,
|
|
@@ -248,6 +243,14 @@
|
|
|
248
243
|
lint.forceLinting(view$1.value);
|
|
249
244
|
}
|
|
250
245
|
};
|
|
246
|
+
const forceReconfigure = () => {
|
|
247
|
+
view$1.value.dispatch({
|
|
248
|
+
effects: state.StateEffect.reconfigure.of([])
|
|
249
|
+
});
|
|
250
|
+
view$1.value.dispatch({
|
|
251
|
+
effects: state.StateEffect.appendConfig.of(extensions.value)
|
|
252
|
+
});
|
|
253
|
+
};
|
|
251
254
|
const getRange = (from, to) => view$1.value.state.sliceDoc(from, to);
|
|
252
255
|
const getLine = (number) => view$1.value.state.doc.line(number + 1).text;
|
|
253
256
|
const lineCount = () => view$1.value.state.doc.lines;
|
|
@@ -285,6 +288,7 @@
|
|
|
285
288
|
focus,
|
|
286
289
|
length,
|
|
287
290
|
lint: lint$1,
|
|
291
|
+
forceReconfigure,
|
|
288
292
|
getRange,
|
|
289
293
|
getLine,
|
|
290
294
|
lineCount,
|
|
@@ -321,8 +325,8 @@
|
|
|
321
325
|
});
|
|
322
326
|
|
|
323
327
|
const meta = {
|
|
324
|
-
version: "1.1.
|
|
325
|
-
date: "2023-01-
|
|
328
|
+
version: "1.1.10",
|
|
329
|
+
date: "2023-01-29T01:57:06.994Z"
|
|
326
330
|
};
|
|
327
331
|
|
|
328
332
|
const installCodeMirror = (app) => app.component("CodeMirror", CodeMirror);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "vue-codemirror6",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.10",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "CodeMirror6 Component for vue2 and vue3.",
|
|
7
7
|
"keywords": [
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"./sfc": "./src/components/CodeMirror.ts"
|
|
54
54
|
},
|
|
55
55
|
"engines": {
|
|
56
|
-
"node": ">=18.
|
|
56
|
+
"node": ">=18.13.0",
|
|
57
57
|
"yarn": ">=1.22.10"
|
|
58
58
|
},
|
|
59
59
|
"packageManager": "yarn@3.3.1",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"build:clean": "rimraf dist docs",
|
|
68
68
|
"build:docs": "vite build --mode=docs",
|
|
69
69
|
"build-only": "vite build",
|
|
70
|
-
"build-declaration": "tsc -p tsconfig.app.json --composite false
|
|
70
|
+
"build-declaration": "tsc -p tsconfig.app.json --composite false",
|
|
71
71
|
"lint": "eslint . --fix --cache --cache-location ./node_modules/.vite/vite-plugin-eslint && prettier . --write",
|
|
72
72
|
"preview": "vite preview --mode=docs",
|
|
73
73
|
"prepare": "husky install",
|
|
@@ -75,6 +75,7 @@
|
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
77
|
"codemirror": "^6.0.1",
|
|
78
|
+
"lodash": "^4.17.21",
|
|
78
79
|
"vue-demi": "latest"
|
|
79
80
|
},
|
|
80
81
|
"peerDependencies": {
|
|
@@ -92,40 +93,39 @@
|
|
|
92
93
|
"@codemirror/lang-markdown": "^6.0.5",
|
|
93
94
|
"@types/lodash": "^4.14.191",
|
|
94
95
|
"@types/node": "^18.11.18",
|
|
95
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
96
|
-
"@typescript-eslint/parser": "^5.
|
|
96
|
+
"@typescript-eslint/eslint-plugin": "^5.49.0",
|
|
97
|
+
"@typescript-eslint/parser": "^5.49.0",
|
|
97
98
|
"@vitejs/plugin-vue": "^4.0.0",
|
|
98
99
|
"@vue/eslint-config-prettier": "^7.0.0",
|
|
99
100
|
"@vue/tsconfig": "^0.1.3",
|
|
100
|
-
"@vueuse/core": "^9.
|
|
101
|
-
"eslint": "^8.
|
|
101
|
+
"@vueuse/core": "^9.11.1",
|
|
102
|
+
"eslint": "^8.33.0",
|
|
102
103
|
"eslint-config-google": "^0.14.0",
|
|
103
104
|
"eslint-config-prettier": "^8.6.0",
|
|
104
105
|
"eslint-import-resolver-alias": "^1.1.2",
|
|
105
106
|
"eslint-import-resolver-typescript": "^3.5.3",
|
|
106
|
-
"eslint-linter-browserify": "^8.
|
|
107
|
+
"eslint-linter-browserify": "^8.33.0",
|
|
107
108
|
"eslint-plugin-html": "^7.1.0",
|
|
108
|
-
"eslint-plugin-import": "^2.27.
|
|
109
|
-
"eslint-plugin-jsdoc": "^39.
|
|
109
|
+
"eslint-plugin-import": "^2.27.5",
|
|
110
|
+
"eslint-plugin-jsdoc": "^39.7.0",
|
|
110
111
|
"eslint-plugin-prettier": "^4.2.1",
|
|
111
112
|
"eslint-plugin-tsdoc": "^0.2.17",
|
|
112
|
-
"eslint-plugin-vue": "^9.
|
|
113
|
-
"eslint-plugin-vuejs-accessibility": "^2.
|
|
113
|
+
"eslint-plugin-vue": "^9.9.0",
|
|
114
|
+
"eslint-plugin-vuejs-accessibility": "^2.1.0",
|
|
114
115
|
"eslint-plugin-yaml": "^0.5.0",
|
|
115
116
|
"husky": "^8.0.3",
|
|
116
117
|
"lint-staged": "^13.1.0",
|
|
117
|
-
"lodash": "^4.17.21",
|
|
118
118
|
"npm-run-all": "^4.1.5",
|
|
119
|
-
"prettier": "^2.8.
|
|
120
|
-
"rimraf": "^
|
|
119
|
+
"prettier": "^2.8.3",
|
|
120
|
+
"rimraf": "^4.1.2",
|
|
121
121
|
"rollup-plugin-visualizer": "^5.9.0",
|
|
122
122
|
"typescript": "^4.9.4",
|
|
123
123
|
"vite": "^4.0.4",
|
|
124
124
|
"vite-plugin-banner": "^0.7.0",
|
|
125
|
-
"vite-plugin-checker": "^0.5.
|
|
125
|
+
"vite-plugin-checker": "^0.5.5",
|
|
126
126
|
"vue": "^3.2.45",
|
|
127
127
|
"vue-eslint-parser": "^9.1.0",
|
|
128
|
-
"vue-markdown-wasm": "^0.
|
|
128
|
+
"vue-markdown-wasm": "^0.3.1",
|
|
129
129
|
"vue-tsc": "^1.0.24"
|
|
130
130
|
},
|
|
131
131
|
"husky": {
|
|
@@ -18,8 +18,7 @@ import {
|
|
|
18
18
|
|
|
19
19
|
// Helpers
|
|
20
20
|
import h, { slot } from '@/helpers/h-demi';
|
|
21
|
-
import compact from 'lodash
|
|
22
|
-
import trim from 'lodash/trim';
|
|
21
|
+
import { compact, trim } from 'lodash';
|
|
23
22
|
|
|
24
23
|
// CodeMirror
|
|
25
24
|
import { basicSetup, minimalSetup } from 'codemirror';
|
|
@@ -332,7 +331,7 @@ export default defineComponent({
|
|
|
332
331
|
/** Get CodeMirror Extension */
|
|
333
332
|
const extensions: ComputedRef<Extension[]> = computed(() =>
|
|
334
333
|
// TODO: Ignore previous prop was not changed.
|
|
335
|
-
compact([
|
|
334
|
+
compact<Extension>([
|
|
336
335
|
// Toggle basic setup
|
|
337
336
|
props.basic ? basicSetup : undefined,
|
|
338
337
|
// Toggle minimal setup
|
|
@@ -461,6 +460,22 @@ export default defineComponent({
|
|
|
461
460
|
}
|
|
462
461
|
};
|
|
463
462
|
|
|
463
|
+
/**
|
|
464
|
+
* Force Reconfigure Extension
|
|
465
|
+
*
|
|
466
|
+
* @see {@link https://codemirror.net/examples/config/#top-level-reconfiguration}
|
|
467
|
+
*/
|
|
468
|
+
const forceReconfigure = () => {
|
|
469
|
+
// Deconfigure all Extensions
|
|
470
|
+
view.value.dispatch({
|
|
471
|
+
effects: StateEffect.reconfigure.of([]),
|
|
472
|
+
});
|
|
473
|
+
// Register extensions
|
|
474
|
+
view.value.dispatch({
|
|
475
|
+
effects: StateEffect.appendConfig.of(extensions.value),
|
|
476
|
+
});
|
|
477
|
+
};
|
|
478
|
+
|
|
464
479
|
/* ----- Bellow is experimental. ------ */
|
|
465
480
|
|
|
466
481
|
/**
|
|
@@ -576,6 +591,7 @@ export default defineComponent({
|
|
|
576
591
|
focus,
|
|
577
592
|
length,
|
|
578
593
|
lint,
|
|
594
|
+
forceReconfigure,
|
|
579
595
|
// Bellow is CodeMirror5's function
|
|
580
596
|
getRange,
|
|
581
597
|
getLine,
|