Skip to content

Commit bbfa8ad

Browse files
committed
Add forceReconfigure() function.
Update dependencies.
1 parent 15286dc commit bbfa8ad

File tree

5 files changed

+127
-102
lines changed

5 files changed

+127
-102
lines changed

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -261,13 +261,14 @@ export default defineComponent({
261261

262262
## Methods
263263

264-
| Method | Description |
265-
| --------- | --------------------------------------------------------------------------------------------------- |
266-
| selection | Get and set the [EditorSelection](https://codemirror.net/docs/ref/#state.EditorSelection) instance. |
267-
| cursor | Get and set the [cursor](https://codemirror.net/docs/ref/#state.EditorSelection^cursor) location. |
268-
| state | Get and set [EditorState](https://codemirror.net/docs/ref/#state.EditorState). |
269-
| focus | Get and set [focus](https://codemirror.net/docs/ref/#view.EditorView.focus). |
270-
| lint | Force run linter (Only if `linter` prop is specified) |
264+
| Method | Description |
265+
| ---------------- | --------------------------------------------------------------------------------------------------- |
266+
| selection | Get and set the [EditorSelection](https://codemirror.net/docs/ref/#state.EditorSelection) instance. |
267+
| cursor | Get and set the [cursor](https://codemirror.net/docs/ref/#state.EditorSelection^cursor) location. |
268+
| state | Get and set [EditorState](https://codemirror.net/docs/ref/#state.EditorState). |
269+
| focus | Get and set [focus](https://codemirror.net/docs/ref/#view.EditorView.focus). |
270+
| lint | Force run linter (Only if `linter` prop is specified) |
271+
| forceReconfigure | Re register all extensions. |
271272

272273
The instructions below are compatible methods for those familiar with [codemirror5](https://codemirror.net/5/). Since the above method is usually sufficient, its active use is not recommended.
273274

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://json.schemastore.org/package.json",
33
"name": "vue-codemirror6",
4-
"version": "1.1.6",
4+
"version": "1.1.7",
55
"license": "MIT",
66
"description": "CodeMirror6 Component for vue2 and vue3.",
77
"keywords": [
@@ -93,21 +93,21 @@
9393
"@codemirror/lang-markdown": "^6.0.5",
9494
"@types/lodash": "^4.14.191",
9595
"@types/node": "^18.11.18",
96-
"@typescript-eslint/eslint-plugin": "^5.48.1",
97-
"@typescript-eslint/parser": "^5.48.1",
96+
"@typescript-eslint/eslint-plugin": "^5.48.2",
97+
"@typescript-eslint/parser": "^5.48.2",
9898
"@vitejs/plugin-vue": "^4.0.0",
9999
"@vue/eslint-config-prettier": "^7.0.0",
100100
"@vue/tsconfig": "^0.1.3",
101-
"@vueuse/core": "^9.10.0",
101+
"@vueuse/core": "^9.11.1",
102102
"eslint": "^8.32.0",
103103
"eslint-config-google": "^0.14.0",
104104
"eslint-config-prettier": "^8.6.0",
105105
"eslint-import-resolver-alias": "^1.1.2",
106106
"eslint-import-resolver-typescript": "^3.5.3",
107107
"eslint-linter-browserify": "^8.32.0",
108108
"eslint-plugin-html": "^7.1.0",
109-
"eslint-plugin-import": "^2.27.4",
110-
"eslint-plugin-jsdoc": "^39.6.4",
109+
"eslint-plugin-import": "^2.27.5",
110+
"eslint-plugin-jsdoc": "^39.6.7",
111111
"eslint-plugin-prettier": "^4.2.1",
112112
"eslint-plugin-tsdoc": "^0.2.17",
113113
"eslint-plugin-vue": "^9.9.0",
@@ -117,12 +117,12 @@
117117
"lint-staged": "^13.1.0",
118118
"npm-run-all": "^4.1.5",
119119
"prettier": "^2.8.3",
120-
"rimraf": "^4.0.7",
120+
"rimraf": "^4.1.1",
121121
"rollup-plugin-visualizer": "^5.9.0",
122122
"typescript": "^4.9.4",
123123
"vite": "^4.0.4",
124124
"vite-plugin-banner": "^0.7.0",
125-
"vite-plugin-checker": "^0.5.3",
125+
"vite-plugin-checker": "^0.5.4",
126126
"vue": "^3.2.45",
127127
"vue-eslint-parser": "^9.1.0",
128128
"vue-markdown-wasm": "^0.2.0",

src-docs/DemoPage.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ const linterAndCrossBindingDemoSrc = LinterAndCrossBindingDemoSrc.trim();
6565
vue-markdown-wasm
6666
</a>
6767
.
68+
<br />
69+
Full demo is
70+
<a href="https://logue.dev/vue-markdown-wasm" target="_blank">here</a>
71+
.
6872
</div>
6973
</div>
7074
</section>

src/components/CodeMirror.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,22 @@ export default defineComponent({
460460
}
461461
};
462462

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+
463479
/* ----- Bellow is experimental. ------ */
464480

465481
/**
@@ -575,6 +591,7 @@ export default defineComponent({
575591
focus,
576592
length,
577593
lint,
594+
forceReconfigure,
578595
// Bellow is CodeMirror5's function
579596
getRange,
580597
getLine,

0 commit comments

Comments
 (0)