Added 'rhs_margin' option that accepts 'left' or 'right' to indicate the side to render the margin. Defaults to 'right'.

This commit is contained in:
Jamie Peabody
2013-06-06 18:11:29 +01:00
parent 18bc465d90
commit 0cd70a833f

View File

@@ -351,6 +351,7 @@ jQuery.extend(Mgly.mergely.prototype, {
this.settings = {
autoupdate: true,
autoresize: true,
rhs_margin: 'right',
lcs: true,
sidebar: true,
ignorews: false,
@@ -605,8 +606,14 @@ jQuery.extend(Mgly.mergely.prototype, {
jQuery(this.element).append(jQuery('<div class="mergely-margin" style="height: ' + height + '"><canvas id="' + this.id + '-lhs-margin" width="8px" height="' + height + '"></canvas></div>'));
jQuery(this.element).append(jQuery('<div style="width:' + width + '; height:' + height + '" id="' + this.id + '-editor-lhs" class="mergely-column"><textarea style="" id="' + this.id + '-lhs"></textarea></div>'));
jQuery(this.element).append(jQuery('<div class="mergely-canvas" style="height: ' + height + '"><canvas id="' + this.id + '-lhs-' + this.id + '-rhs-canvas" style="width:28px" width="28px" height="' + height + '"></canvas></div>'));
var rmargin = jQuery('<div class="mergely-margin" style="height: ' + height + '"><canvas id="' + this.id + '-rhs-margin" width="8px" height="' + height + '"></canvas></div>');
if (this.settings.rhs_margin == 'left') {
jQuery(this.element).append(rmargin);
}
jQuery(this.element).append(jQuery('<div style="width:' + width + '; height:' + height + '" id="' + this.id + '-editor-rhs" class="mergely-column"><textarea style="" id="' + this.id + '-rhs"></textarea></div>'));
jQuery(this.element).append(jQuery('<div class="mergely-margin" style="height: ' + height + '"><canvas id="' + this.id + '-rhs-margin" width="8px" height="' + height + '"></canvas></div>'));
if (this.settings.rhs_margin != 'left') {
jQuery(this.element).append(rmargin);
}
//codemirror
var cmstyle = '#' + this.id + ' .CodeMirror-gutter-text { padding: 5px 0 0 0; }' +
'#' + this.id + ' .CodeMirror-lines pre, ' + '#' + this.id + ' .CodeMirror-gutter-text pre { line-height: 18px; }' +