sn-code-editor
Advanced tools
Comparing version 1.0.19 to 1.0.21
@@ -73,3 +73,6 @@ module.exports = function(grunt) { | ||
css: { | ||
src: ['dist/app.css', 'node_modules/codemirror/lib/codemirror.css'], | ||
options: { | ||
separator: '', | ||
}, | ||
src: ['node_modules/codemirror/lib/codemirror.css', 'dist/app.css'], | ||
dest: 'dist/dist.css', | ||
@@ -76,0 +79,0 @@ } |
{ | ||
"name": "sn-code-editor", | ||
"version": "1.0.19", | ||
"version": "1.0.21", | ||
"description": "", | ||
"main": "dist/dist.js", | ||
"author": "Standard Notes <hello@standardnotes.org>", | ||
"dependencies": { | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"codemirror": "^5.31.0", | ||
"sn-components-api": "^1.0.16", | ||
"sn-components-api": "^1.0.242", | ||
"babel-cli": "^6.18.0", | ||
@@ -13,0 +12,0 @@ "babel-preset-env": "^1.1.1", |
@@ -20,5 +20,6 @@ document.addEventListener("DOMContentLoaded", function(event) { | ||
var componentManager; | ||
var workingNote, clientData, lastValue; | ||
var workingNote, clientData; | ||
var lastValue, lastUUID; | ||
var editor, modeInput, select; | ||
var defaultMode = "swift"; | ||
var defaultMode = "javascript"; | ||
var ignoreTextChange = false; | ||
@@ -48,2 +49,9 @@ var initialLoad = true; | ||
function onReceivedNote(note) { | ||
if(note.uuid !== lastUUID) { | ||
// Note changed, reset last values | ||
lastValue = null; | ||
initialLoad = true; | ||
lastUUID = note.uuid; | ||
} | ||
workingNote = note; | ||
@@ -75,3 +83,6 @@ // Only update UI on non-metadata updates. | ||
function loadEditor() { | ||
editor = CodeMirror.fromTextArea(document.getElementById("code"), {lineNumbers: true}); | ||
editor = CodeMirror.fromTextArea(document.getElementById("code"), { | ||
lineNumbers: true, | ||
styleSelectedText: true | ||
}); | ||
editor.setSize("100%", "100%"); | ||
@@ -111,2 +122,6 @@ | ||
window.setKeyMap = function(keymap) { | ||
editor.setOption("keyMap", keymap); | ||
} | ||
window.onLanguageSelect = function(event) { | ||
@@ -113,0 +128,0 @@ var language = modes[select.selectedIndex]; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
3917941
573
71878