Added query params settings to editor

This commit is contained in:
Jamie Peabody
2015-06-28 12:06:06 +01:00
parent aa9c9eaad4
commit e25acfe3b5
4 changed files with 235 additions and 56 deletions

View File

@@ -385,6 +385,8 @@ jQuery.extend(Mgly.CodeMirrorDiffView.prototype, {
autoupdate: true,
autoresize: true,
rhs_margin: 'right',
wrap_lines: false,
line_numbers: true,
lcs: true,
sidebar: true,
viewport: false,
@@ -441,8 +443,8 @@ jQuery.extend(Mgly.CodeMirrorDiffView.prototype, {
var cmsettings = {
mode: 'text/plain',
readOnly: false,
lineWrapping: false,
lineNumbers: true,
lineWrapping: this.settings.wrap_lines,
lineNumbers: this.settings.line_numbers,
gutters: ['merge', 'CodeMirror-linenumbers']
};
this.lhs_cmsettings = {};
@@ -543,6 +545,23 @@ jQuery.extend(Mgly.CodeMirrorDiffView.prototype, {
jQuery(this.element).find('.mergely-margin').css({display: 'none'});
}
}
var le, re;
if (this.settings.hasOwnProperty('wrap_lines')) {
if (this.editor) {
le = this.editor[this.id + '-lhs'];
re = this.editor[this.id + '-rhs'];
le.setOption('lineWrapping', this.settings.wrap_lines);
re.setOption('lineWrapping', this.settings.wrap_lines);
}
}
if (this.settings.hasOwnProperty('line_numbers')) {
if (this.editor) {
le = this.editor[this.id + '-lhs'];
re = this.editor[this.id + '-rhs'];
le.setOption('lineNumbers', this.settings.line_numbers);
re.setOption('lineNumbers', this.settings.line_numbers);
}
}
},
options: function(opts) {
if (opts) {