mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-23 10:52:43 +01:00
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/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/search/searchcursor.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);
|
||||
const response = await fetch(url);
|
||||
const text = await response.text();
|
||||
const formatOptions = { indent_size: 2 };
|
||||
let value = '', mode = '';
|
||||
switch ( params.get('type') ) {
|
||||
case 'css':
|
||||
mode = 'text/css';
|
||||
value = beautifier.css(text, formatOptions);
|
||||
value = beautifier.css(text, { indent_size: 2 });
|
||||
break;
|
||||
case 'html':
|
||||
mode = 'text/html';
|
||||
value = beautifier.html(text, formatOptions);
|
||||
value = beautifier.html(text, { indent_size: 2 });
|
||||
break;
|
||||
case 'js':
|
||||
mode = 'text/javascript';
|
||||
value = beautifier.js(text, formatOptions);
|
||||
value = beautifier.js(text, { indent_size: 4 });
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -60,8 +59,8 @@ import { dom, qs$ } from './dom.js';
|
||||
gutters: [ 'CodeMirror-linenumbers' ],
|
||||
lineNumbers: true,
|
||||
lineWrapping: true,
|
||||
matchBrackets: true,
|
||||
mode,
|
||||
readOnly: true,
|
||||
styleActiveLine: {
|
||||
nonEmpty: true,
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user