Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
mountedComponent() {
const config = {
...{ mode: `ace/mode/${this.mode}`,
showPrintMargin: false,
wrap: this.softWraps },
...this.editorConfig
};
this.editor = Ace.edit(this.$refs['editor'.concat(this.editorId)], config);
this.defineAutocompletion(this.completerFunction);
this.editor.setValue(this.value || '', 1);
this.editor.on('input', this.onInput);
this.editor.on('blur', this.onBlur);
if (this.setFocus) {
this.editor.focus();
}
},
didInsertElement() {
this._super();
let aceId = this.aceId;
let $element = this.$().find('textarea');
$element.hide();
$element.before('<div class="span12" data-form-property="' + this.fieldName + '" id="' + aceId + '"></div>');
this.editor = ace.edit(aceId);
let editor = this.editor;
let session = this.editor.getSession();
editor.$blockScrolling = Infinity;
editor.setTheme('ace/theme/textmate');
editor.setShowPrintMargin(false);
editor.setHighlightActiveLine(false);
session.setUseWorker(false);
session.setTabSize(2);
session.setMode('ace/mode/' + $element.data('ace-mode'));
session.setValue($element.val());
let $textElement = $(editor.textInput.getElement());
$textElement.attr('id', this.aceTextInputId);
$textElement.attr('data-raw-input-id', $element.attr('id'));
mountedComponent() {
const config = {
...{ mode: `ace/mode/${this.mode}`,
showPrintMargin: false,
wrap: this.softWraps },
...this.editorConfig
};
this.editor = Ace.edit(this.$refs['editor'.concat(this.editorId)], config);
this.defineAutocompletion(this.completerFunction);
this.editor.setValue(this.value || '', 1);
this.editor.on('input', this.onInput);
this.editor.on('blur', this.onBlur);
if (this.setFocus) {
this.editor.focus();
}
},
componentDidMount() {
this.editor = ace.edit(this.divRef.current)
const editorRef = this.editor;
ace.config.loadModule("ace/ext/keybinding_menu", function (module) {
module.init(editorRef);
})
if(this.props.onCreate) {
this.props.onCreate(this.editor);
}
this.configureEditor();
this.updateValue();
}