nuxt-monaco-editor 1.2.5 → 1.2.6

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 CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [1.2.6](https://github.com/e-chan1007/nuxt-monaco-editor/compare/v1.2.5...v1.2.6) (2023-12-10)
6
+
7
+
8
+ ### Features
9
+
10
+ * make `automaticLayout: true` as a default option ([16c3f10](https://github.com/e-chan1007/nuxt-monaco-editor/commit/16c3f10a7c5e86c12b7115ab509d0bca690afb3b))
11
+
5
12
  ### [1.2.5](https://github.com/e-chan1007/nuxt-monaco-editor/compare/v1.2.4...v1.2.5) (2023-12-05)
6
13
 
7
14
 
package/dist/module.json CHANGED
@@ -4,5 +4,5 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.1.0"
6
6
  },
7
- "version": "1.2.5"
7
+ "version": "1.2.6"
8
8
  }
@@ -6,7 +6,8 @@
6
6
 
7
7
  <script lang="ts" setup>
8
8
  import type * as Monaco from 'monaco-editor'
9
- import { onMounted, onUnmounted, ref, watch } from 'vue'
9
+ import { onMounted, onUnmounted, ref, shallowRef, watch } from 'vue'
10
+ import { defu } from 'defu'
10
11
  import { useMonaco } from './composables'
11
12
 
12
13
  interface Props {
@@ -37,13 +38,17 @@ const props = withDefaults(defineProps<Props>(), {
37
38
  const emit = defineEmits<Emits>()
38
39
  const isLoading = ref(true)
39
40
 
40
- const editorElement = ref<HTMLDivElement>()
41
+ const editorElement = shallowRef<HTMLDivElement>()
41
42
  const monaco = useMonaco()!
42
43
 
43
44
  let editor: Monaco.editor.IStandaloneDiffEditor
44
45
  let originalModel: Monaco.editor.ITextModel
45
46
  let modifiedModel: Monaco.editor.ITextModel
46
- const editorRef = ref()
47
+ const editorRef = shallowRef<Monaco.editor.IStandaloneDiffEditor>()
48
+
49
+ const defaultOptions: Monaco.editor.IStandaloneEditorConstructionOptions = {
50
+ automaticLayout: true
51
+ }
47
52
 
48
53
  watch(() => [props.original, props.modelValue], () => {
49
54
  if (originalModel.getValue() !== props.original || modifiedModel.getValue() !== props.modelValue) {
@@ -66,7 +71,7 @@ watch(() => props.lang, () => {
66
71
  })
67
72
 
68
73
  watch(() => props.options, () => {
69
- editor?.updateOptions(props.options)
74
+ editor?.updateOptions(defu(props.options, defaultOptions))
70
75
  })
71
76
 
72
77
  defineExpose({
@@ -77,7 +82,7 @@ defineExpose({
77
82
  })
78
83
 
79
84
  onMounted(() => {
80
- editor = monaco.editor.createDiffEditor(editorElement.value!, props.options)
85
+ editor = monaco.editor.createDiffEditor(editorElement.value!, defu(props.options, defaultOptions))
81
86
  editorRef.value = editor
82
87
  originalModel = monaco.editor.createModel(props.original, props.lang)
83
88
  modifiedModel = monaco.editor.createModel(props.modelValue, props.lang)
@@ -6,7 +6,8 @@
6
6
 
7
7
  <script lang="ts" setup>
8
8
  import type * as Monaco from 'monaco-editor'
9
- import { computed, onMounted, onUnmounted, ref, watch } from 'vue'
9
+ import { computed, onMounted, onUnmounted, ref, shallowRef, watch } from 'vue'
10
+ import { defu } from 'defu'
10
11
  import { useMonaco } from './composables'
11
12
 
12
13
  interface Props {
@@ -37,12 +38,16 @@ const isLoading = ref(true)
37
38
 
38
39
  const lang = computed(() => props.lang || props.options.language)
39
40
 
40
- const editorElement = ref<HTMLDivElement>()
41
+ const editorElement = shallowRef<HTMLDivElement>()
41
42
  const monaco = useMonaco()!
42
43
 
43
44
  let editor: Monaco.editor.IStandaloneCodeEditor
44
45
  let model: Monaco.editor.ITextModel
45
- const editorRef = ref()
46
+ const editorRef = shallowRef<Monaco.editor.IStandaloneCodeEditor>()
47
+
48
+ const defaultOptions: Monaco.editor.IStandaloneEditorConstructionOptions = {
49
+ automaticLayout: true
50
+ }
46
51
 
47
52
  watch(() => props.modelValue, () => {
48
53
  if (editor?.getValue() !== props.modelValue) { editor?.setValue(props.modelValue) }
@@ -55,7 +60,7 @@ watch(() => props.lang, () => {
55
60
  })
56
61
 
57
62
  watch(() => props.options, () => {
58
- editor?.updateOptions(props.options)
63
+ editor?.updateOptions(defu(props.options, defaultOptions))
59
64
  })
60
65
 
61
66
  defineExpose({
@@ -66,7 +71,7 @@ defineExpose({
66
71
  })
67
72
 
68
73
  onMounted(() => {
69
- editor = monaco.editor.create(editorElement.value!, props.options)
74
+ editor = monaco.editor.create(editorElement.value!, defu(props.options, defaultOptions))
70
75
  editorRef.value = editor
71
76
  model = monaco.editor.createModel(props.modelValue, lang.value)
72
77
  editor.setModel(model)
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "type": "git",
12
12
  "url": "https://github.com/e-chan1007/nuxt-monaco-editor.git"
13
13
  },
14
- "version": "1.2.5",
14
+ "version": "1.2.6",
15
15
  "type": "module",
16
16
  "license": "MIT",
17
17
  "exports": {
@@ -46,6 +46,7 @@
46
46
  },
47
47
  "dependencies": {
48
48
  "@nuxt/kit": "^3.8.1",
49
+ "defu": "^6.1.3",
49
50
  "monaco-editor-nls": "^3.1.0",
50
51
  "vite-plugin-static-copy": "^0.17.0"
51
52
  },