[editor] Drop JQuery dependency from the AceEditor component
</template>
<script lang="ts">
- import $ from 'jquery';
import Vue from 'vue';
import Component from 'vue-class-component';
import { Prop } from 'vue-property-decorator';
editor.customMenuOptions.getErrorHighlighting = () => errorHighlightingEnabled;
editor.customMenuOptions.setClearIgnoredSyntaxChecks = () => {
setInLocalStorage('hue.syntax.checker.suppressedRules', {});
- $('#setClearIgnoredSyntaxChecks')
- .hide()
- .before('<div style="margin-top:5px;float:right;">done</div>');
+ const el = document.getElementById('setClearIgnoredSyntaxChecks');
+ if (!el || !el.parentNode) {
+ return;
+ }
+ el.style.display = 'none';
+ const doneElem = document.createElement('div');
+ doneElem.style.marginTop = '5px';
+ doneElem.style.float = 'right';
+ doneElem.innerText = 'done';
+ el.insertAdjacentElement('beforebegin', doneElem);
};
editor.customMenuOptions.getClearIgnoredSyntaxChecks = () => false;
}
setEnableAutocompleter: (enabled: boolean): void => {
editor.setOption('enableBasicAutocompletion', enabled);
setInLocalStorage('hue.ace.enableBasicAutocompletion', enabled);
- const $enableLiveAutocompletionChecked = $('#setEnableLiveAutocompletion:checked');
- const $setEnableLiveAutocompletion = $('#setEnableLiveAutocompletion');
- if (enabled && $enableLiveAutocompletionChecked.length === 0) {
- $setEnableLiveAutocompletion.trigger('click');
- } else if (!enabled && $enableLiveAutocompletionChecked.length !== 0) {
- $setEnableLiveAutocompletion.trigger('click');
+ const setElem = <HTMLInputElement>document.getElementById('setEnableLiveAutocompletion');
+ if (setElem && ((enabled && !setElem.checked) || (!enabled && setElem.checked))) {
+ setElem.click();
}
},
getEnableAutocompleter: () => editor.getOption('enableBasicAutocompletion'),
setEnableLiveAutocompletion: (enabled: boolean): void => {
editor.setOption('enableLiveAutocompletion', enabled);
setInLocalStorage('hue.ace.enableLiveAutocompletion', enabled);
- if (enabled && $('#setEnableAutocompleter:checked').length === 0) {
- $('#setEnableAutocompleter').trigger('click');
+ const setElem = <HTMLInputElement>document.getElementById('setEnableAutocompleter');
+ if (setElem && enabled && !setElem.checked) {
+ setElem.click();
}
},
getEnableLiveAutocompletion: () => editor.getOption('enableLiveAutocompletion'),
