mirror of https://github.com/gorhill/uBlock.git
Fine tune new code viewer
Remove read-only restriction -- it might be useful to enter notes/markers/etc when investigation code flow.
This commit is contained in:
parent
088e90ed42
commit
4ef6420f7c
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
<script src="lib/codemirror/lib/codemirror.js"></script>
|
<script src="lib/codemirror/lib/codemirror.js"></script>
|
||||||
<script src="lib/codemirror/addon/display/panel.js"></script>
|
<script src="lib/codemirror/addon/display/panel.js"></script>
|
||||||
|
<script src="lib/codemirror/addon/edit/matchbrackets.js"></script>
|
||||||
<script src="lib/codemirror/addon/scroll/annotatescrollbar.js"></script>
|
<script src="lib/codemirror/addon/scroll/annotatescrollbar.js"></script>
|
||||||
<script src="lib/codemirror/addon/search/searchcursor.js"></script>
|
<script src="lib/codemirror/addon/search/searchcursor.js"></script>
|
||||||
<script src="lib/codemirror/addon/selection/active-line.js"></script>
|
<script src="lib/codemirror/addon/selection/active-line.js"></script>
|
||||||
|
|
|
@ -37,20 +37,19 @@ import { dom, qs$ } from './dom.js';
|
||||||
dom.attr(a, 'title', url);
|
dom.attr(a, 'title', url);
|
||||||
const response = await fetch(url);
|
const response = await fetch(url);
|
||||||
const text = await response.text();
|
const text = await response.text();
|
||||||
const formatOptions = { indent_size: 2 };
|
|
||||||
let value = '', mode = '';
|
let value = '', mode = '';
|
||||||
switch ( params.get('type') ) {
|
switch ( params.get('type') ) {
|
||||||
case 'css':
|
case 'css':
|
||||||
mode = 'text/css';
|
mode = 'text/css';
|
||||||
value = beautifier.css(text, formatOptions);
|
value = beautifier.css(text, { indent_size: 2 });
|
||||||
break;
|
break;
|
||||||
case 'html':
|
case 'html':
|
||||||
mode = 'text/html';
|
mode = 'text/html';
|
||||||
value = beautifier.html(text, formatOptions);
|
value = beautifier.html(text, { indent_size: 2 });
|
||||||
break;
|
break;
|
||||||
case 'js':
|
case 'js':
|
||||||
mode = 'text/javascript';
|
mode = 'text/javascript';
|
||||||
value = beautifier.js(text, formatOptions);
|
value = beautifier.js(text, { indent_size: 4 });
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -60,8 +59,8 @@ import { dom, qs$ } from './dom.js';
|
||||||
gutters: [ 'CodeMirror-linenumbers' ],
|
gutters: [ 'CodeMirror-linenumbers' ],
|
||||||
lineNumbers: true,
|
lineNumbers: true,
|
||||||
lineWrapping: true,
|
lineWrapping: true,
|
||||||
|
matchBrackets: true,
|
||||||
mode,
|
mode,
|
||||||
readOnly: true,
|
|
||||||
styleActiveLine: {
|
styleActiveLine: {
|
||||||
nonEmpty: true,
|
nonEmpty: true,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue