Skip to content

Commit

Permalink
Fixed typo. (#38)
Browse files Browse the repository at this point in the history
Update sample code.
Update yarn, vue etc.
  • Loading branch information
logue committed Apr 30, 2024
1 parent 8633e67 commit e96b8d3
Show file tree
Hide file tree
Showing 5 changed files with 419 additions and 693 deletions.
324 changes: 162 additions & 162 deletions .yarn/releases/yarn-4.1.0.cjs → .yarn/releases/yarn-4.1.1.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ enableGlobalCache: false

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.1.0.cjs
yarnPath: .yarn/releases/yarn-4.1.1.cjs
169 changes: 73 additions & 96 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,20 +202,10 @@ export default defineComponent({

### Full Example

When using as a Markdown editor on [vite-vue2-vuetify-ts-starter](https://github.com/logue/vite-vue2-vuetify-ts-starter).
When using as a Markdown editor on [https://github.com/logue/vite-vue3-ts-starter](vite-vue3-ts-starter).

```vue
<template>
<code-mirror
v-model="value"
basic
:dark="dark"
:lang="lang"
:phrases="phreses"
/>
</template>
<script lang="ts">
<script lang="ts" setup>
import { ref, defineComponent, type Ref } from 'vue';
// Load component
Expand All @@ -227,90 +217,76 @@ import type { LanguageSupport } from '@codemirror/language';
import type { Extension } from '@codemirror/state';
import type { ViewUpdate } from '@codemirror/view';
export default defineComponent({
components: {
CodeMirror,
},
setup() {
/**
* Get Vuetify instance
*
* @see {@link https://github.com/logue/vite-vue2-vuetify-ts-starter | vite-vue2-vuetify-ts-starter}
*/
const vuetify = useVuetify();
/** text */
const value: Ref<string> = ref('');
/** Dark mode **/
const dark: Ref<boolean> = ref(
window.matchMedia('(prefers-color-scheme: dark)').matches
);
/**
* CodeMirror Language
*
* @see {@link https://codemirror.net/6/docs/ref/#language | @codemirror/language}
*/
const lang: LanguageSupport = md();
/**
* Internationalization Config.
* In this example, the display language to Japanese.
* Must be reactive when used in combination with vue-i18n.
*
* @see {@link https://codemirror.net/6/examples/translate/ | Example: Internationalization}
*/
const phrases: Ref<Record<string, string>> = ref({
// @codemirror/view
'Control character': '制御文字',
// @codemirror/commands
'Selection deleted': '選択を削除',
// @codemirror/language
'Folded lines': '折り畳まれた行',
'Unfolded lines': '折り畳める行',
to: '行き先',
'folded code': '折り畳まれたコード',
unfold: '折り畳みを解除',
'Fold line': '行を折り畳む',
'Unfold line': '行の折り畳む解除',
// @codemirror/search
'Go to line': '行き先の行',
go: 'OK',
Find: '検索',
Replace: '置き換え',
next: '▼',
previous: '▲',
all: 'すべて',
'match case': '一致条件',
'by word': '全文検索',
regexp: '正規表現',
replace: '置き換え',
'replace all': 'すべてを置き換え',
close: '閉じる',
'current match': '現在の一致',
'replaced $ matches': '$ 件の一致を置き換え',
'replaced match on line $': '$ 行の一致を置き換え',
'on line': 'した行',
// @codemirror/autocomplete
Completions: '自動補完',
// @codemirror/lint
Diagnostics: 'エラー',
'No diagnostics': 'エラーなし',
});
/** When dark value changed, sync vuetify's dark mode */
watch(dark, v => (vuetify.theme.dark = v));
return {
dark,
value,
lang,
phrases,
};
},
});
/** text */
const value: Ref<string> = ref('');
/** Dark mode **/
const dark: Ref<boolean> = ref(
window.matchMedia('(prefers-color-scheme: dark)').matches
);
/**
* CodeMirror Language
*
* @see {@link https://codemirror.net/6/docs/ref/#language | @codemirror/language}
*/
const lang: LanguageSupport = md();
/**
* Internationalization Config.
* In this example, the display language to Japanese.
* Must be reactive when used in combination with vue-i18n.
*
* @see {@link https://codemirror.net/6/examples/translate/ | Example: Internationalization}
*/
const phrases: Record<string, string> = {
// @codemirror/view
'Control character': '制御文字',
// @codemirror/commands
'Selection deleted': '選択を削除',
// @codemirror/language
'Folded lines': '折り畳まれた行',
'Unfolded lines': '折り畳める行',
to: '行き先',
'folded code': '折り畳まれたコード',
unfold: '折り畳みを解除',
'Fold line': '行を折り畳む',
'Unfold line': '行の折り畳む解除',
// @codemirror/search
'Go to line': '行き先の行',
go: 'OK',
Find: '検索',
Replace: '置き換え',
next: '▼',
previous: '▲',
all: 'すべて',
'match case': '一致条件',
'by word': '全文検索',
regexp: '正規表現',
replace: '置き換え',
'replace all': 'すべてを置き換え',
close: '閉じる',
'current match': '現在の一致',
'replaced $ matches': '$ 件の一致を置き換え',
'replaced match on line $': '$ 行の一致を置き換え',
'on line': 'した行',
// @codemirror/autocomplete
Completions: '自動補完',
// @codemirror/lint
Diagnostics: 'エラー',
'No diagnostics': 'エラーなし',
};
</script>
<template>
<code-mirror
v-model="value"
basic
:dark="dark"
:lang="lang"
:phrases="phrases"
/>
</template>
```

## Events
Expand Down Expand Up @@ -413,4 +389,5 @@ const config: UserConfig = {

## LICENSE

©2022-2023 by Logue. Licensed under the [MIT License](LICENSE).
©2022-2024 by Logue.
Licensed under the [MIT License](LICENSE).
18 changes: 7 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/package.json",
"name": "vue-codemirror6",
"version": "1.3.0",
"version": "1.3.1",
"license": "MIT",
"description": "CodeMirror6 Component for vue2 and vue3.",
"keywords": [
Expand Down Expand Up @@ -55,7 +55,7 @@
"engines": {
"yarn": ">=1.22.19"
},
"packageManager": "[email protected].0",
"packageManager": "[email protected].1",
"sideEffects": false,
"scripts": {
"dev": "vite",
Expand Down Expand Up @@ -86,24 +86,20 @@
"@eslint/js": "^9.1.1",
"@tsconfig/node-lts": "^20.1.3",
"@types/node": "^20.12.7",
"@typescript-eslint/eslint-plugin": "^7.7.1",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@vitejs/plugin-vue": "^5.0.4",
"@vue/compiler-sfc": "^3.4.24",
"@vue/compiler-sfc": "^3.4.26",
"@vue/eslint-config-prettier": "^9.0.0",
"@vue/tsconfig": "^0.5.1",
"@vueuse/core": "^10.9.0",
"bootstrap": "^5.3.3",
"eslint": "^9.1.1",
"eslint-config-standard-with-typescript": "^43.0.1",
"eslint-import-resolver-alias": "^1.1.2",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-linter-browserify": "^9.1.1",
"eslint-plugin-html": "^8.1.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-n": "^17.2.1",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-tsdoc": "^0.2.17",
"eslint-plugin-vue": "latest",
"eslint-plugin-vue": "^9.25.0",
"eslint-plugin-vuejs-accessibility": "^2.3.0",
"eslint-plugin-yaml": "^0.5.0",
"husky": "^9.0.11",
Expand All @@ -114,12 +110,12 @@
"rollup-plugin-visualizer": "^5.12.0",
"sass": "^1.75.0",
"typescript": "^5.4.5",
"typescript-eslint": "^7.7.1",
"typescript-eslint": "^7.8.0",
"vite": "^5.2.10",
"vite-plugin-banner": "^0.7.1",
"vite-plugin-checker": "^0.6.4",
"vite-plugin-dts": "^3.9.0",
"vue": "^3.4.24",
"vue": "^3.4.26",
"vue-eslint-parser": "^9.4.2",
"vue-markdown-wasm": "^0.4.0",
"vue-tsc": "^2.0.14"
Expand Down
Loading

0 comments on commit e96b8d3

Please sign in to comment.