From ffeda1ae05ea36367a6fd9dd893b6b5c5314c733 Mon Sep 17 00:00:00 2001 From: Julian Viereck Date: Sat, 21 May 2011 00:06:10 +0200 Subject: [PATCH] Add setFontSize on Split --- demo/demo.js | 2 +- lib/ace/split.js | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/demo/demo.js b/demo/demo.js index 75ea91d7..b331d642 100644 --- a/demo/demo.js +++ b/demo/demo.js @@ -304,7 +304,7 @@ exports.launch = function(env) { }); bindDropdown("fontsize", function(value) { - document.getElementById("editor").style.fontSize = value; + env.split.setFontSize(value); }); bindDropdown("soft_wrap", function(value) { diff --git a/lib/ace/split.js b/lib/ace/split.js index 07fa0000..b1cd2961 100644 --- a/lib/ace/split.js +++ b/lib/ace/split.js @@ -75,7 +75,6 @@ var Split = function(container, theme, splits) { dom.className = this.$editorCSS; dom.style = "position: absolute; top:0px; bottom:0px"; this.$container.appendChild(dom); - var session = new EditSession(""); var editor = new Editor(new Renderer(dom, this.$theme)); @@ -84,6 +83,7 @@ var Split = function(container, theme, splits) { }.bind(this)); this.$editors.push(editor); + editor.container.style.fontSize = this.$fontSize; return editor; } @@ -99,6 +99,7 @@ var Split = function(container, theme, splits) { while (this.$splits < this.$editors.length && this.$splits < splits) { var editor = this.$editors[this.$splits]; this.$container.appendChild(editor.container); + editor.container.style.fontSize = this.$fontSize; this.$splits ++; } while (this.$splits < splits) { @@ -148,7 +149,14 @@ var Split = function(container, theme, splits) { } this.forEach = function(callback, scope) { - this.$ditors.forEach(callback, scope); + this.$editors.forEach(callback, scope); + } + + this.setFontSize = function(size) { + this.$fontSize = size; + this.forEach(function(editor) { + editor.container.style.fontSize = size; + }); } this.$cloneSession = function(session) {