File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -58,3 +58,18 @@ export function putToClipboard(
5858 theme : 'success' ,
5959 } )
6060}
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 1818<script lang="ts">
1919import pako from ' pako'
2020import Vue from ' vue'
21- import { undoUrlSafeBase64 } from ' ../../helpers/utils'
21+ import { getMonacoEditorDefaultOptions , undoUrlSafeBase64 } from ' ../../helpers/utils'
2222import DiffActionBar from ' ~/components/v2/diffActionBar.vue'
2323import Navbar from ' ~/components/v2/navbar.vue'
2424import { DiffData } from ' ~/helpers/types'
@@ -67,24 +67,13 @@ export default Vue.extend({
6767 mounted() {
6868 const monacoDiffViewerEl = document .getElementById (' monaco-diff-viewer' )
6969 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 );
8371 if (monacoDiffViewerEl ) {
8472 this .monacoDiffEditor = monaco .editor .createDiffEditor (
8573 monacoDiffViewerEl ,
8674 {
8775 ... monacoEditorOptions ,
76+ readOnly: true
8877 }
8978 ) as any
9079 if (this .monacoDiffEditor ) {
Original file line number Diff line number Diff line change 6868<script lang="ts">
6969import Vue from ' vue'
7070import pako from ' pako'
71- import { doUrlSafeBase64 } from ' ../../helpers/utils'
71+ import {
72+ doUrlSafeBase64 ,
73+ getMonacoEditorDefaultOptions ,
74+ } from ' ../../helpers/utils'
7275import showTutorials from ' ../../helpers/driverjsTutorials'
7376import Navbar from ' ~/components/v2/navbar.vue'
7477declare namespace monaco {
@@ -106,17 +109,7 @@ export default Vue.extend({
106109 const lhs = document .getElementById (' lhs' )
107110 const rhs = document .getElementById (' rhs' )
108111 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 )
120113 if (lhs ) {
121114 this .lhsEditor = monaco .editor .create (lhs , {
122115 ... monacoEditorOptions ,
You can’t perform that action at this time.
0 commit comments