From 23aec4144f9d4352ba6d10367288f51d57ba990f Mon Sep 17 00:00:00 2001 From: Armen Kesablyan Date: Sat, 23 Jun 2012 13:44:49 -0700 Subject: Text Tool Fix - Can Not Switch Document when Text Tool Initialized Signed-off-by: Armen Kesablyan --- .../text-properties.reel/text-properties.js | 8 ++++++-- js/tools/TextTool.js | 21 ++++++++++++++------- 2 files changed, 20 insertions(+), 9 deletions(-) (limited to 'js') diff --git a/js/components/tools-properties/text-properties.reel/text-properties.js b/js/components/tools-properties/text-properties.reel/text-properties.js index 72a6f034..c5729e98 100755 --- a/js/components/tools-properties/text-properties.reel/text-properties.js +++ b/js/components/tools-properties/text-properties.reel/text-properties.js @@ -296,14 +296,18 @@ exports.TextProperties = Montage.create(ToolProperties, { handleFontSelectionChange: { value: function(e) { - this.application.ninja.stage.textTool.doAction("fontname", this.fontSelection.value); this.application.ninja.stage.textTool.element.focus(); + this.application.ninja.stage.textTool.doAction("fontname", this.fontSelection.value); + + //Note: Set Font Color on selection to ColorChip Component; + //this.this.application.ninja.stage.textTool.foreColor + } }, handleFontColorChange: { value: function(e) { - this.application.ninja.stage.textTool.element.style.color = e._event.color.css; + this.application.ninja.stage.textTool.foreColor = e._event.color.css; this.application.ninja.stage.textTool.element.focus(); //this.application.ninja.stage.textTool.doAction("forecolor",e._event.color.css); diff --git a/js/tools/TextTool.js b/js/tools/TextTool.js index 7f82855b..aa79b8bc 100755 --- a/js/tools/TextTool.js +++ b/js/tools/TextTool.js @@ -6,7 +6,6 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot var Montage = require("montage/core/core").Montage, DrawingTool = require("js/tools/drawing-tool").DrawingTool, - //RichTextEditor = ("node_modules/labs/rich-text-editor.reel").RichTextEditor, ElementsMediator = require("js/mediators/element-mediator").ElementMediator; exports.TextTool = Montage.create(DrawingTool, { @@ -23,22 +22,30 @@ exports.TextTool = Montage.create(DrawingTool, { return this._selectedElement; }, set: function(val) { + //Set Selected Element if (this._selectedElement !== null) { - this.selectedElement.innerHTML = this.application.ninja.stage.textTool.value; - this.application.ninja.stage.textTool.value = ""; - this.application.ninja.stage.textTool.element.style.display = "none"; - ElementsMediator.setProperty(this.application.ninja.selectedElements, "color", [window.getComputedStyle(this.application.ninja.stage.textTool.element)["color"]], "Change", "textTool"); + this.applyStyle(); } - //Set Selected Element this._selectedElement = val; - if(val !== null) { + if(this._selectedElement !== null) { this.drawTextTool(); this.handleScroll(); this.application.ninja.stage._iframeContainer.addEventListener("scroll", this, false); } else { this.application.ninja.stage._iframeContainer.removeEventListener("scroll", this); } + + } + }, + + applyStyle: { + value: function() { + this.selectedElement.innerHTML = this.application.ninja.stage.textTool.value; + this.application.ninja.stage.textTool.value = ""; + this.application.ninja.stage.textTool.element.style.display = "none"; + //ElementsMediator.setProperty([this.selectedElement], "color", [window.getComputedStyle(this.application.ninja.stage.textTool.element)["color"]], "Change", "textTool"); } + }, HandleLeftButtonDown: { -- cgit v1.2.3