Sha256: a76eaf2fdd3eb5b57240d575993a1d435648ceaf275b167c86d59977ab9d6f37
Contents?: true
Size: 597 Bytes
Versions: 11
Compression:
Stored size: 597 Bytes
Contents
"use strict"; function onChange(editor) { localStorage[window.location.href.split("#")[0]] = editor.getValue() } function setup(editor, value) { /** Takes editor and enables persists changes to the buffer across the sessions. **/ if (value) { var address = window.location.href.split("#")[0] var persisted = localStorage[address] || editor.getValue() editor.setValue(persisted) editor.on("change", onChange) } else { editor.off("change", onChange) } } function plugin(CodeMirror) { CodeMirror.defineOption("persist", false, setup) } module.exports = plugin
Version data entries
11 entries across 2 versions & 1 rubygems