Skip to content

Commit

Permalink
reuse CodeMirror instance
Browse files Browse the repository at this point in the history
  • Loading branch information
tophf committed Jan 6, 2025
1 parent 9d59f77 commit ee61b9d
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/cm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {template} from '@/js/localization';
import * as prefs from '@/js/prefs';
import {WINDOWS} from '@/js/ua';
import {deepMerge} from '@/js/util';
import CodeMirror from 'codemirror';
import CM from 'codemirror';
import 'codemirror/lib/codemirror.css';
import 'codemirror/addon/comment/comment';
import 'codemirror/addon/dialog/dialog';
Expand Down Expand Up @@ -35,7 +35,7 @@ import '@/vendor-overwrites/codemirror-addon/match-highlighter.js';
import {THEME_KEY} from './themes';
import './index.css';

export {CodeMirror};
export const CodeMirror = CM; // workaround for webpack's `codemirror_default()` import
export * from './themes';

export const extraKeys = Object.assign(CodeMirror.defaults.extraKeys || {}, {
Expand Down
2 changes: 1 addition & 1 deletion src/edit/autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {getStyleAtPos} from '@/cm/util';
import {kCssPropSuffix, UCD} from '@/js/consts';
import * as prefs from '@/js/prefs';
import {hasOwn, stringAsRegExpStr, tryRegExp} from '@/js/util';
import CodeMirror from 'codemirror';
import {CodeMirror} from '@/cm';
import {
addSuffix, autocompleteOnTyping, Completion, execAt, findAllCssVars, getTokenState, isSameToken,
testAt, USO_INVALID_VAR, USO_VALID_VAR,
Expand Down
2 changes: 1 addition & 1 deletion src/edit/global-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {setInputValue} from '@/js/dom-util';
import {htmlToTemplateCache, templateCache} from '@/js/localization';
import {chromeLocal} from '@/js/storage-util';
import {debounce, stringAsRegExp, t, tryRegExp} from '@/js/util';
import CodeMirror from 'codemirror';
import {CodeMirror} from '@/cm';
import editor from './editor';
import html from './global-search.html';

Expand Down
2 changes: 1 addition & 1 deletion src/edit/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import '@/js/dom-init';
import {tBody} from '@/js/localization';
import * as prefs from '@/js/prefs';
import CodeMirror from 'codemirror';
import {CodeMirror} from '@/cm';
import CompactHeader from './compact-header';
import editor from './editor';
import EditorHeader from './editor-header';
Expand Down
2 changes: 1 addition & 1 deletion src/edit/moz-section-finder.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {deepEqual} from '@/js/util';
import CodeMirror from 'codemirror';
import {CodeMirror} from '@/cm';
import {trimCommentLabel} from './util';

export default function MozSectionFinder(cm) {
Expand Down
2 changes: 1 addition & 1 deletion src/edit/moz-section-widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {messageBox} from '@/js/dom-util';
import {htmlToTemplate, templateCache} from '@/js/localization';
import * as msg from '@/js/msg';
import {sleep, t} from '@/js/util';
import CodeMirror from 'codemirror';
import {CodeMirror} from '@/cm';
import editor from './editor';
import MozSectionFinder from './moz-section-finder';
import {htmlAppliesTo} from './util';
Expand Down
2 changes: 1 addition & 1 deletion src/edit/sections-editor-section.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {templateCache, htmlToTemplate, template} from '@/js/localization';
import * as prefs from '@/js/prefs';
import {FROM_CSS, TO_CSS} from '@/js/sections-util';
import {debounce} from '@/js/util';
import CodeMirror from 'codemirror';
import {CodeMirror} from '@/cm';
import {initBeautifyButton} from './beautify';
import cmFactory from './codemirror-factory';
import editor from './editor';
Expand Down
2 changes: 1 addition & 1 deletion src/edit/source-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {API} from '@/js/msg-api';
import * as prefs from '@/js/prefs';
import {styleToCss} from '@/js/sections-util';
import {RX_META, t} from '@/js/util';
import CodeMirror from 'codemirror';
import {CodeMirror} from '@/cm';
import cmFactory from './codemirror-factory';
import editor, {failRegexp} from './editor';
import * as linterMan from './linter';
Expand Down
2 changes: 1 addition & 1 deletion src/js/color/color-view.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {getStyleAtPos} from '@/cm/util';
import * as colorConverter from '@/js/color/color-converter';
import ColorPicker from '@/js/color/color-picker';
import CodeMirror from 'codemirror';
import {CodeMirror} from '@/cm';

//region Constants

Expand Down

0 comments on commit ee61b9d

Please sign in to comment.