From 54e8a799ac828474a5b961977c3078c3bc4e78cc Mon Sep 17 00:00:00 2001 From: Mihai Sucan Date: Sun, 20 Feb 2011 14:58:59 +0200 Subject: [PATCH] more fixes for Workspace --- build/src/mode-html-uncompressed.js | 1 - build/src/mode-java-uncompressed.js | 1 - build/src/mode-javascript-uncompressed.js | 1 - lib/ace/layer/text.js | 11 ++++++++--- lib/ace/undomanager.js | 12 +++++++++++- 5 files changed, 19 insertions(+), 7 deletions(-) diff --git a/build/src/mode-html-uncompressed.js b/build/src/mode-html-uncompressed.js index b4e81fa9..aecb7c52 100644 --- a/build/src/mode-html-uncompressed.js +++ b/build/src/mode-html-uncompressed.js @@ -547,7 +547,6 @@ var WorkerClient = function(topLevelNamespaces, packagedJs, module, classname) { if (require.packaged) { var base = this.$guessBasePath(); - dump("Worker " + base + " " + packagedJs + "\n"); var worker = this.$worker = new Worker(base + packagedJs); } else { diff --git a/build/src/mode-java-uncompressed.js b/build/src/mode-java-uncompressed.js index 3b9dfe11..04a901f5 100644 --- a/build/src/mode-java-uncompressed.js +++ b/build/src/mode-java-uncompressed.js @@ -470,7 +470,6 @@ var WorkerClient = function(topLevelNamespaces, packagedJs, module, classname) { if (require.packaged) { var base = this.$guessBasePath(); - dump("Worker " + base + " " + packagedJs + "\n"); var worker = this.$worker = new Worker(base + packagedJs); } else { diff --git a/build/src/mode-javascript-uncompressed.js b/build/src/mode-javascript-uncompressed.js index 2304cf62..797dc96b 100644 --- a/build/src/mode-javascript-uncompressed.js +++ b/build/src/mode-javascript-uncompressed.js @@ -446,7 +446,6 @@ var WorkerClient = function(topLevelNamespaces, packagedJs, module, classname) { if (require.packaged) { var base = this.$guessBasePath(); - dump("Worker " + base + " " + packagedJs + "\n"); var worker = this.$worker = new Worker(base + packagedJs); } else { diff --git a/lib/ace/layer/text.js b/lib/ace/layer/text.js index b648cefc..0f68c3ce 100644 --- a/lib/ace/layer/text.js +++ b/lib/ace/layer/text.js @@ -1,4 +1,5 @@ -/* ***** BEGIN LICENSE BLOCK ***** +/* vim:ts=4:sts=4:sw=4: + * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version @@ -112,8 +113,12 @@ var Text = function(parentEl) { // that's why we have to measure many characters // Note: characterWidth can be a float! measureNode.innerHTML = lang.stringRepeat("Xy", n); - var body = document.body || document.documentElement; - body.insertBefore(measureNode, body.firstChild); + + var container = this.element.parentNode; + while (!dom.hasCssClass(container, "ace_editor")) + container = container.parentNode; + + container.appendChild(measureNode); } var style = this.$measureNode.style; diff --git a/lib/ace/undomanager.js b/lib/ace/undomanager.js index d4ad5dfe..e157032b 100644 --- a/lib/ace/undomanager.js +++ b/lib/ace/undomanager.js @@ -1,4 +1,5 @@ -/* ***** BEGIN LICENSE BLOCK ***** +/* vim:ts=4:sts=4:sw=4: + * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version @@ -20,6 +21,7 @@ * * Contributor(s): * Fabian Jakobs + * Mihai Sucan * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or @@ -70,6 +72,14 @@ var UndoManager = function() { this.$redoStack = []; }; + this.hasUndo = function() { + return this.$undoStack.length > 0; + }; + + this.hasRedo = function() { + return this.$redoStack.length > 0; + }; + }).call(UndoManager.prototype); exports.UndoManager = UndoManager;