Merge "Update CodeMirror to 5.50.2"
diff --git a/gr-editor/codemirror-element.js b/gr-editor/codemirror-element.js
index 65182d8..22e3f74 100644
--- a/gr-editor/codemirror-element.js
+++ b/gr-editor/codemirror-element.js
@@ -20,6 +20,10 @@
* @event content-change
*/
+ properties: {
+ lineNum: Number,
+ },
+
ready() {
this.scopeSubtree(this.$.wrapper, true);
},
@@ -50,6 +54,11 @@
this.async(() => {
this._nativeMirror.refresh();
this._nativeMirror.focus();
+ if (this.lineNum) {
+ // We have to take away one from the line number,
+ // ... because CodeMirror's line count is zero-based.
+ this._nativeMirror.setCursor(this.lineNum - 1);
+ }
}, 1);
this._addEventListeners();
},
diff --git a/gr-editor/gr-editor.html b/gr-editor/gr-editor.html
index 74d01a8..3fe859b 100644
--- a/gr-editor/gr-editor.html
+++ b/gr-editor/gr-editor.html
@@ -16,7 +16,7 @@
<dom-module id="gr-editor">
<template>
- <codemirror-element id="codemirror"></codemirror-element>
+ <codemirror-element id="codemirror" line-num="[[lineNum]]"></codemirror-element>
</template>
<script src="gr-editor.js"></script>
</dom-module>
diff --git a/gr-editor/gr-editor.js b/gr-editor/gr-editor.js
index ee2f455..add4a96 100644
--- a/gr-editor/gr-editor.js
+++ b/gr-editor/gr-editor.js
@@ -31,6 +31,7 @@
properties: {
fileContent: String,
fileType: String,
+ lineNum: Number,
mirror: Object,
prefs: Object,
plugin: Object,