How to use the codemirror.Pass function in codemirror

To help you get started, we’ve selected a few codemirror 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 ProseMirror / website / example / codemirror / index.js View on Github external
maybeEscape(unit, dir) {
    let pos = this.cm.getCursor()
    if (this.cm.somethingSelected() ||
        pos.line != (dir < 0 ? this.cm.firstLine() : this.cm.lastLine()) ||
        (unit == "char" &&
         pos.ch != (dir < 0 ? 0 : this.cm.getLine(pos.line).length)))
      return CodeMirror.Pass
    this.view.focus()
    let targetPos = this.getPos() + (dir < 0 ? 0 : this.node.nodeSize)
    let selection = Selection.near(this.view.state.doc.resolve(targetPos), dir)
    this.view.dispatch(this.view.state.tr.setSelection(selection).scrollIntoView())
    this.view.focus()
  }
// }
github anssip / dispatch / src / models / intellisense.js View on Github external
Tab: (cm, widget) => {
          // Override default behavior and don't select hint on Tab
          widget.close();
          return CodeMirror.Pass;
        }
      }
github princejwesley / Mancy / src / components / ReplActiveInput.js View on Github external
onKeyTab(cm) {
    let {activeSuggestion} = ReplActiveInputStore.getStore();
    if(activeSuggestion && activeSuggestion.id === this.props.tag) {
      let {suggestion} = activeSuggestion;
      this.onSelectTabCompletion(suggestion.input, suggestion.expect);
      return;
    }
    return CodeMirror.Pass;
  }
github carbon-app / carbon / lib / custom / modes / nimrod.js View on Github external
indent: function(state) {
      if (state.tokenize != tokenBase) return state.tokenize.isString ? CodeMirror.Pass : 0

      return state.scopes[0].offset
    },
github Kong / insomnia / app / ui / components / codemirror / extensions / autocomplete.js View on Github external
function completeIfInVariableName (cm) {
    completeAfter(cm, () => {
      const cur = cm.getCursor();
      const pos = CodeMirror.Pos(cur.line, cur.ch - MAX_HINT_LOOK_BACK);
      const range = cm.getRange(pos, cur);
      return range.match(COMPLETE_AFTER_WORD);
    });

    return CodeMirror.Pass;
  }
github laobubu / HyperMD / src / keymap / hypermd.ts View on Github external
export function newline(cm: cm_t) {
  if (cm.getOption("disableInput")) return CodeMirror.Pass

  const selections = cm.listSelections()
  var replacements: string[] = repeat("\n", selections.length)

  for (let i = 0; i < selections.length; i++) {
    var range = selections[i]
    var pos = range.head
    const eolState = cm.getStateAfter(pos.line) as HyperMDState

    if (eolState.list !== false) {
      replacements[i] += repeatStr(" ", eolState.listStack.slice(-1)[0])
    }
  }

  cm.replaceSelections(replacements)
}
github opendialogai / opendialog / resources / js / mixins / XmlCodemirror.vue View on Github external
completeAfter(cm, pred) {
      var cur = cm.getCursor();
      if (!pred || pred()) setTimeout(() => {
        if (!cm.state.completionActive) {
          cm.showHint({ completeSingle: false });
        }
      }, 100);
      return CodeMirror.Pass;
    },
    completeIfInTag(cm) {
github dremio / dremio-oss / dac / ui / src / components / CodeMirror-sqlMode.js View on Github external
indent: function(state, textAfter) {
      var cx = state.context;
      if (!cx) return CodeMirror.Pass;
      var closing = textAfter.charAt(0) == cx.type;
      if (cx.align) return cx.col + (closing ? 0 : 1);
      else return cx.indent + (closing ? 0 : config.indentUnit);
    },
github brunosimon / notedown / src / javascript / Code.js View on Github external
CodeMirror.commands.swapLineDown = (cm) =>
        {
            if(cm.isReadOnly())
            {
                return CodeMirror.Pass
            }

            const ranges = cm.listSelections()
            const linesToMove = []
            let at = cm.lastLine() + 1

            for(let i = ranges.length - 1; i >= 0; i--)
            {
                const range = ranges[i]
                let from = range.to().line + 1
                const to = range.from().line

                if(range.to().ch == 0 && !range.empty())
                {
                    from--
                }
github nhn / tui.editor / src / js / codemirror / fixOrderedListNumber.js View on Github external
CodeMirror.commands.indentLessOrderedList = cm => {
  if (cm.getOption('disableInput')) {
    return CodeMirror.Pass;
  }
  cm.execCommand('indentLess');
  cm.execCommand('fixOrderedListNumber');

  return null;
};