mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
Allow user to change CodeMirror input style in "My filters"
Related issue: https://github.com/uBlockOrigin/uBlock-issues/issues/3613
This commit is contained in:
parent
b4aea4ab27
commit
cf7777e9fd
1 changed files with 16 additions and 2 deletions
|
|
@ -28,7 +28,7 @@ import { onBroadcast } from './broadcast.js';
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
const cmEditor = new CodeMirror(qs$('#userFilters'), {
|
const cmOptions = {
|
||||||
autoCloseBrackets: true,
|
autoCloseBrackets: true,
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
extraKeys: {
|
extraKeys: {
|
||||||
|
|
@ -47,7 +47,21 @@ const cmEditor = new CodeMirror(qs$('#userFilters'), {
|
||||||
styleActiveLine: {
|
styleActiveLine: {
|
||||||
nonEmpty: true,
|
nonEmpty: true,
|
||||||
},
|
},
|
||||||
});
|
};
|
||||||
|
(( ) => {
|
||||||
|
try {
|
||||||
|
const url = new URL(self.top.location.href);
|
||||||
|
const input = url.searchParams.get('input');
|
||||||
|
if ( input === 't' ) {
|
||||||
|
cmOptions.inputStyle = 'textarea';
|
||||||
|
} else if ( input === 'c' ) {
|
||||||
|
cmOptions.inputStyle = 'contenteditable';
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
|
const cmEditor = new CodeMirror(qs$('#userFilters'), cmOptions);
|
||||||
|
|
||||||
uBlockDashboard.patchCodeMirrorEditor(cmEditor);
|
uBlockDashboard.patchCodeMirrorEditor(cmEditor);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue