File tree Expand file tree Collapse file tree 3 files changed +23
-26
lines changed Expand file tree Collapse file tree 3 files changed +23
-26
lines changed Original file line number Diff line number Diff line change @@ -58,3 +58,18 @@ export function putToClipboard(
58
58
theme : 'success' ,
59
59
} )
60
60
}
61
+
62
+ export function getMonacoEditorDefaultOptions ( theme : string ) {
63
+ return {
64
+ language : 'javascript' ,
65
+ theme,
66
+ fontSize : parseFloat ( getComputedStyle ( document . documentElement ) . fontSize ) ,
67
+ scrollBeyondLastLine : false ,
68
+ scrollBeyondLastColumn : false ,
69
+ minimap : {
70
+ enabled : false ,
71
+ } ,
72
+ wordWrap : 'on' ,
73
+ contextmenu : false ,
74
+ }
75
+ }
Original file line number Diff line number Diff line change 18
18
<script lang="ts">
19
19
import pako from ' pako'
20
20
import Vue from ' vue'
21
- import { undoUrlSafeBase64 } from ' ../../helpers/utils'
21
+ import { getMonacoEditorDefaultOptions , undoUrlSafeBase64 } from ' ../../helpers/utils'
22
22
import DiffActionBar from ' ~/components/v2/diffActionBar.vue'
23
23
import Navbar from ' ~/components/v2/navbar.vue'
24
24
import { DiffData } from ' ~/helpers/types'
@@ -67,24 +67,13 @@ export default Vue.extend({
67
67
mounted() {
68
68
const monacoDiffViewerEl = document .getElementById (' monaco-diff-viewer' )
69
69
const theme = this .$cookies .isDarkMode ? ' vs-dark' : ' light'
70
- const monacoEditorOptions = {
71
- language: ' javascript' ,
72
- theme ,
73
- fontSize: parseFloat (getComputedStyle (document .documentElement ).fontSize ),
74
- readOnly: true ,
75
- scrollBeyondLastLine: false ,
76
- scrollBeyondLastColumn: false ,
77
- minimap: {
78
- enabled: false ,
79
- },
80
- wordWrap: ' on' ,
81
- contextmenu: false ,
82
- }
70
+ const monacoEditorOptions = getMonacoEditorDefaultOptions (theme );
83
71
if (monacoDiffViewerEl ) {
84
72
this .monacoDiffEditor = monaco .editor .createDiffEditor (
85
73
monacoDiffViewerEl ,
86
74
{
87
75
... monacoEditorOptions ,
76
+ readOnly: true
88
77
}
89
78
) as any
90
79
if (this .monacoDiffEditor ) {
Original file line number Diff line number Diff line change 68
68
<script lang="ts">
69
69
import Vue from ' vue'
70
70
import pako from ' pako'
71
- import { doUrlSafeBase64 } from ' ../../helpers/utils'
71
+ import {
72
+ doUrlSafeBase64 ,
73
+ getMonacoEditorDefaultOptions ,
74
+ } from ' ../../helpers/utils'
72
75
import showTutorials from ' ../../helpers/driverjsTutorials'
73
76
import Navbar from ' ~/components/v2/navbar.vue'
74
77
declare namespace monaco {
@@ -106,17 +109,7 @@ export default Vue.extend({
106
109
const lhs = document .getElementById (' lhs' )
107
110
const rhs = document .getElementById (' rhs' )
108
111
const theme = this .$cookies .isDarkMode ? ' vs-dark' : ' light'
109
- const monacoEditorOptions = {
110
- language: ' javascript' ,
111
- theme ,
112
- fontSize: parseFloat (getComputedStyle (document .documentElement ).fontSize ),
113
- scrollBeyondLastLine: false ,
114
- scrollBeyondLastColumn: false ,
115
- minimap: {
116
- enabled: false ,
117
- },
118
- wordWrap: ' on' ,
119
- }
112
+ const monacoEditorOptions = getMonacoEditorDefaultOptions (theme )
120
113
if (lhs ) {
121
114
this .lhsEditor = monaco .editor .create (lhs , {
122
115
... monacoEditorOptions ,
You can’t perform that action at this time.
0 commit comments