Sha256: eb68a4598b8a17fc475a5eb6f36a4e564d8a512080db2b9dbbe908773426c237

Contents?: true

Size: 929 Bytes

Versions: 10

Compression:

Stored size: 929 Bytes

Contents

"use strict";

var activeLine = "line@activine"

function onCursorActivity(editor) {
  var line = editor.getLineHandle(editor.getCursor().line)
  var active = editor[activeLine]
  if (line != active) {
    editor.removeLineClass(active, "background", "activeline")
    editor[activeLine] = editor.addLineClass(line, "background", "activeline")
  }
}

function setup(editor, value) {
  /**
  Takes editor and enables persists changes to the buffer across the sessions.
  **/
  if (value) {
    editor[activeLine] = editor.addLineClass(0, "background", "activeline")
    editor.on("cursorActivity", onCursorActivity)
    onCursorActivity(editor)
  } else {
    editor.removeLineClass(editor[activeLine], "background", "activeline")
    delete editor[activeLine]
    editor.off("cursorActivity", onCursorActivity)
  }
}

function plugin(CodeMirror) {
  CodeMirror.defineOption("activeLine", false, setup)
}

module.exports = plugin

Version data entries

10 entries across 2 versions & 1 rubygems

Version Path
ruby-wisp-source-0.8.0 vendor/interactivate/node_modules/codemirror-activine/core.js
ruby-wisp-source-0.8.0 vendor/interactivate/node_modules/interactivate/demo/node_modules/codemirror-activine/core.js
ruby-wisp-source-0.8.0 vendor/node_modules/wisp/interactivate/node_modules/codemirror-activine/core.js
ruby-wisp-source-0.8.0 vendor/node_modules/wisp/interactivate/node_modules/interactivate/demo/node_modules/codemirror-activine/core.js
ruby-wisp-source-0.7.0 vendor/try/node_modules/~wisp/interactivate/node_modules/codemirror-activine/core.js
ruby-wisp-source-0.7.0 vendor/interactivate/node_modules/codemirror-activine/core.js
ruby-wisp-source-0.7.0 vendor/try/node_modules/~wisp/interactivate/node_modules/interactivate/demo/node_modules/codemirror-activine/core.js
ruby-wisp-source-0.7.0 vendor/interactivate/node_modules/interactivate/demo/node_modules/codemirror-activine/core.js
ruby-wisp-source-0.7.0 vendor/node_modules/wisp/interactivate/node_modules/codemirror-activine/core.js
ruby-wisp-source-0.7.0 vendor/node_modules/wisp/interactivate/node_modules/interactivate/demo/node_modules/codemirror-activine/core.js