mirror of https://github.com/status-im/consul.git
[ui] Prettify ember-cli-build (#21731)
* Missed prettification at a pre-merge step earlier * Missed lint-removal
This commit is contained in:
parent
c40eecf8f9
commit
4efac491e7
|
@ -49,7 +49,6 @@ export default Component.extend({
|
|||
|
||||
const editor = this.editor;
|
||||
editor.setOption('mode', mode.mime);
|
||||
this.helper.lint(editor, mode.mode);
|
||||
set(this, 'mode', mode);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
*/
|
||||
|
||||
import Service, { inject as service } from '@ember/service';
|
||||
import lint from 'consul-ui/utils/editor/lint';
|
||||
const MODES = [
|
||||
{
|
||||
name: 'JSON',
|
||||
|
@ -41,10 +40,6 @@ export default class LinterService extends Service {
|
|||
return MODES;
|
||||
}
|
||||
|
||||
lint() {
|
||||
return lint(...arguments);
|
||||
}
|
||||
|
||||
getEditor(element) {
|
||||
return this.dom.element('textarea + div', element).CodeMirror;
|
||||
}
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) HashiCorp, Inc.
|
||||
* SPDX-License-Identifier: BUSL-1.1
|
||||
*/
|
||||
|
||||
/*global CodeMirror*/
|
||||
|
||||
// CodeMirror doesn't seem to have anyway to hook into whether a mode
|
||||
// has already loaded, or when a mode has finished loading
|
||||
// follow more or less what CodeMirror does but doesn't expose
|
||||
// see codemirror/addon/mode/loadmode.js
|
||||
|
||||
export const createLoader = function (
|
||||
$$ = document.getElementsByTagName.bind(document),
|
||||
CM = CodeMirror
|
||||
) {
|
||||
CM.registerHelper('lint', 'ruby', function (text) {
|
||||
return [];
|
||||
});
|
||||
return function (editor, mode, cb) {
|
||||
let scripts = [...$$('script')];
|
||||
const loaded = scripts.find(function (item) {
|
||||
return item.src.indexOf(`/codemirror/mode/${mode}/${mode}.js`) !== -1;
|
||||
});
|
||||
CM.autoLoadMode(editor, mode);
|
||||
if (loaded) {
|
||||
cb();
|
||||
} else {
|
||||
scripts = [...$$('script')];
|
||||
CM.on(scripts[0], 'load', function () {
|
||||
cb();
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
const load = createLoader();
|
||||
export default function (editor, mode) {
|
||||
load(editor, mode, function () {
|
||||
if (editor.getValue().trim().length) {
|
||||
editor.performLint();
|
||||
}
|
||||
});
|
||||
}
|
|
@ -206,11 +206,7 @@ module.exports = function (defaults, $ = process.env) {
|
|||
},
|
||||
codemirror: {
|
||||
keyMaps: ['sublime'],
|
||||
addonFiles: [
|
||||
'lint/lint.css',
|
||||
'lint/yaml-lint.js',
|
||||
'mode/loadmode.js',
|
||||
],
|
||||
addonFiles: ['lint/lint.css', 'lint/yaml-lint.js', 'mode/loadmode.js'],
|
||||
},
|
||||
sassOptions: {
|
||||
implementation: require('sass'),
|
||||
|
|
Loading…
Reference in New Issue