How to use the ace-builds.require function in ace-builds

To help you get started, we’ve selected a few ace-builds examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Khan / live-editor / js / editors / ace / editor-ace.js View on Github external
addUnderlineMarker(row) {
        // Underline the problem line to make it more obvious
        //  if they don't notice the gutter icon
        const AceRange = ace.require("ace/range").Range;
        const line = this.editor.session.getDocument().getLine(row);
        this.editor.session.addMarker(
           new AceRange(row, 0, row, line.length),
           "ace_problem_line", "text", false);
    }
github Khan / live-editor / js / ui / tooltip-base.js View on Github external
updateText: function(newText, customSelection, avoidUndo) {
        if (!this.parent || this.parent.options.record && this.parent.options.record.playing) {
            return;
        }
        var parent = this.parent;
        var editor = parent.editor;

        parent.ignore = true;
        newText = newText.toString();
        var Range = ace.require("ace/range").Range;
        var loc = this.aceLocation;
        var range = new Range(loc.row, loc.start, loc.row, loc.start + loc.length);

        // We probably could just set it to false when we're done, but someone else might
        // be trying a similar hack, or... who knows?
        var undoState;
        if (avoidUndo) {
            undoState = editor.session.$fromUndo;
            editor.session.$fromUndo = true;
        }
        editor.session.replace(range, newText);
        if (avoidUndo) {
            editor.session.$fromUndo = undoState;
        }

        range.end.column = range.start.column + newText.length;
github omohokcoj / motor-admin / ui / src / queries / components / code_editor.vue View on Github external
editorInit (editor) {
      editor.renderer.setScrollMargin(8, 8, 0, 0)

      editor.setOptions({
        indentedSoftWrap: false,
        enableLiveAutocompletion: true,
        showPrintMargin: false,
        highlightActiveLine: false,
        highlightGutterLine: false
      })

      const languageTools = ace.require('ace/ext/language_tools')

      languageTools.addCompleter({
        getCompletions: async (editor, session, pos, prefix, callback) => {
          callback(null, this.completions)
        }
      })

      setTimeout(() => {
        editor.focus()
      }, 100)
    },
    onCmdEnter (e) {