aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-05-10 15:48:51 -0700
committerNivesh Rajbhandari2012-05-10 15:48:51 -0700
commit0467a1cf331c067b21bf5d6acfe47ec9edc2e41c (patch)
treeae6122570b41879b5fa434c970592fe1deb23a2e /js
parent78b3363a1ef802e95a158b5a3584305f84def09c (diff)
parent632a53278826a33506b302b573ee0681840f2d6c (diff)
downloadninja-0467a1cf331c067b21bf5d6acfe47ec9edc2e41c.tar.gz
Merge branch 'refs/heads/ninja-internal' into WebGLFixes
Conflicts: js/io/system/ninjalibrary.json Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js')
-rwxr-xr-xjs/controllers/styles-controller.js4
-rwxr-xr-xjs/document/templates/montage-html/package.json3
-rw-r--r--js/io/system/ninjalibrary.js28
-rw-r--r--js/io/system/ninjalibrary.json2
-rwxr-xr-xjs/tools/TextTool.js40
5 files changed, 32 insertions, 45 deletions
diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js
index 647c0870..2ff3e235 100755
--- a/js/controllers/styles-controller.js
+++ b/js/controllers/styles-controller.js
@@ -795,7 +795,9 @@ var stylesController = exports.StylesController = Montage.create(Component, {
795 ///// method to apply/test the new value 795 ///// method to apply/test the new value
796 dec.setProperty(property, value, priority); 796 dec.setProperty(property, value, priority);
797 797
798 this.styleSheetModified(rule.parentStyleSheet); 798 if(rule.parentStyleSheet) {
799 this.styleSheetModified(rule.parentStyleSheet);
800 }
799 801
800 ///// Return browser value for value we just set 802 ///// Return browser value for value we just set
801 return dec.getPropertyValue(property); 803 return dec.getPropertyValue(property);
diff --git a/js/document/templates/montage-html/package.json b/js/document/templates/montage-html/package.json
index c8bc02fb..d1e839dc 100755
--- a/js/document/templates/montage-html/package.json
+++ b/js/document/templates/montage-html/package.json
@@ -3,6 +3,7 @@
3 "lib": "" 3 "lib": ""
4 }, 4 },
5 "mappings": { 5 "mappings": {
6 "montage": "../../../../node_modules/montage/" 6 "montage": "../../../../node_modules/montage/",
7 "montage-google": "../../../../node_modules/montage-google/"
7 } 8 }
8} \ No newline at end of file 9} \ No newline at end of file
diff --git a/js/io/system/ninjalibrary.js b/js/io/system/ninjalibrary.js
index 201598fc..f4915a91 100644
--- a/js/io/system/ninjalibrary.js
+++ b/js/io/system/ninjalibrary.js
@@ -152,7 +152,8 @@ exports.NinjaLibrary = Montage.create(Object.prototype, {
152 // 152 //
153 this.chromeApi = chrome; 153 this.chromeApi = chrome;
154 // 154 //
155 var i, l, libs, libjson, xhr = new XMLHttpRequest(), tocopylibs = [], copied; 155// debugger;
156 var i, l, libs, libjson, xhr = new XMLHttpRequest(), tocopylibs = [];
156 //Getting known json list of libraries to copy to chrome 157 //Getting known json list of libraries to copy to chrome
157 xhr.open("GET", '/js/io/system/ninjalibrary.json', false); 158 xhr.open("GET", '/js/io/system/ninjalibrary.json', false);
158 xhr.send(); 159 xhr.send();
@@ -166,23 +167,18 @@ exports.NinjaLibrary = Montage.create(Object.prototype, {
166 if (chromeLibs.length > 0) { 167 if (chromeLibs.length > 0) {
167 // 168 //
168 for (i=0; chromeLibs[i]; i++) { 169 for (i=0; chromeLibs[i]; i++) {
169 copied = false;
170 for (var j in libs.libraries) { 170 for (var j in libs.libraries) {
171 if (String(libs.libraries[j].name+libs.libraries[j].version).toLowerCase() === chromeLibs[i]) { 171 if (String(libs.libraries[j].name+libs.libraries[j].version).toLowerCase() === chromeLibs[i]) {
172 copied = true; 172 //TODO: Remove, currently manually removing copied libraries
173 } 173 // //this.chromeApi.directoryDelete(chromeLibs[i]);
174 } 174 } else {
175 // 175 if (libs.libraries[j].file) {
176 if (!copied) { 176 tocopylibs.push({name: String(libs.libraries[j].name+libs.libraries[j].version).toLowerCase(), path: libs.libraries[j].path, file: libs.libraries[j].file});
177 if (libs.libraries[j].file) { 177 } else {
178 tocopylibs.push({name: String(libs.libraries[j].name+libs.libraries[j].version).toLowerCase(), path: libs.libraries[j].path, file: libs.libraries[j].file}); 178 tocopylibs.push({name: String(libs.libraries[j].name+libs.libraries[j].version).toLowerCase(), path: libs.libraries[j].path});
179 } else { 179 }
180 tocopylibs.push({name: String(libs.libraries[j].name+libs.libraries[j].version).toLowerCase(), path: libs.libraries[j].path}); 180 }
181 } 181 }
182 } else {
183 //TODO: Remove, currently manually removing copied libraries
184 //this.chromeApi.directoryDelete(chromeLibs[i]);
185 }
186 } 182 }
187 183
188 } else { 184 } else {
diff --git a/js/io/system/ninjalibrary.json b/js/io/system/ninjalibrary.json
index 3f4584d5..feced079 100644
--- a/js/io/system/ninjalibrary.json
+++ b/js/io/system/ninjalibrary.json
@@ -1,6 +1,6 @@
1{ 1{
2 "libraries": [ 2 "libraries": [
3 {"name": "Montage", "path": "/node_modules/descriptor.json", "version": "0.7.0.0"}, 3 {"name": "Montage", "path": "/node_modules/descriptor.json", "version": "0.8.0.0"},
4 {"name": "RDGE", "path": "/assets/descriptor.json", "version": "0.5.6.0"} 4 {"name": "RDGE", "path": "/assets/descriptor.json", "version": "0.5.6.0"}
5 ] 5 ]
6} \ No newline at end of file 6} \ No newline at end of file
diff --git a/js/tools/TextTool.js b/js/tools/TextTool.js
index a58aacc6..024a92ce 100755
--- a/js/tools/TextTool.js
+++ b/js/tools/TextTool.js
@@ -5,13 +5,18 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
5</copyright> */ 5</copyright> */
6 6
7var Montage = require("montage/core/core").Montage, 7var Montage = require("montage/core/core").Montage,
8 DrawingTool = require("js/tools/drawing-tool").DrawingTool; 8 DrawingTool = require("js/tools/drawing-tool").DrawingTool,
9 RichTextEditor = require("node_modules/labs/rich-text-editor.reel").RichTextEditor, 9 RichTextEditor = require("node_modules/labs/rich-text-editor.reel").RichTextEditor,
10 ElementsMediator = require("js/mediators/element-mediator").ElementMediator; 10 ElementsMediator = require("js/mediators/element-mediator").ElementMediator;
11 11
12exports.TextTool = Montage.create(DrawingTool, { 12exports.TextTool = Montage.create(DrawingTool, {
13 drawingFeedback: {
14 value: { mode: "Draw3D", type: "rectangle" }
15 },
13 16
14 _selectedElement: { value : null }, 17 _selectedElement: {
18 value : null
19 },
15 20
16 selectedElement: { 21 selectedElement: {
17 get: function() { 22 get: function() {
@@ -35,9 +40,6 @@ exports.TextTool = Montage.create(DrawingTool, {
35 } 40 }
36 } 41 }
37 }, 42 },
38
39
40 drawingFeedback: { value: { mode: "Draw3D", type: "rectangle" } },
41 43
42 HandleLeftButtonDown: { 44 HandleLeftButtonDown: {
43 value: function(event) { 45 value: function(event) {
@@ -81,15 +83,7 @@ exports.TextTool = Montage.create(DrawingTool, {
81 return; 83 return;
82 } 84 }
83 85
84 var drawData, selectedItem;
85
86 if(this._hasDraw) { 86 if(this._hasDraw) {
87 drawData = this.getDrawingData();
88
89 if(drawData) {
90 //this.insertElement(drawData);
91 }
92
93 this._hasDraw = false; 87 this._hasDraw = false;
94 this.endDraw(event); 88 this.endDraw(event);
95 } else { 89 } else {
@@ -113,6 +107,8 @@ exports.TextTool = Montage.create(DrawingTool, {
113 107
114 drawTextTool: { 108 drawTextTool: {
115 value: function() { 109 value: function() {
110 var self = this;
111
116 this.application.ninja.stage.textTool.value = this.selectedElement.innerHTML; 112 this.application.ninja.stage.textTool.value = this.selectedElement.innerHTML;
117 if(this.application.ninja.stage.textTool.value === "") { this.application.ninja.stage.textTool.value = " "; } 113 if(this.application.ninja.stage.textTool.value === "") { this.application.ninja.stage.textTool.value = " "; }
118 this.selectedElement.innerHTML = ""; 114 this.selectedElement.innerHTML = "";
@@ -125,35 +121,27 @@ exports.TextTool = Montage.create(DrawingTool, {
125 this.application.ninja.stage.textTool.element.style.width = this.selectedElement.offsetWidth + "px"; 121 this.application.ninja.stage.textTool.element.style.width = this.selectedElement.offsetWidth + "px";
126 this.application.ninja.stage.textTool.element.style.height = this.selectedElement.offsetHeight + "px"; 122 this.application.ninja.stage.textTool.element.style.height = this.selectedElement.offsetHeight + "px";
127 123
128
129 // Set font styling (Size, Style, Weight) 124 // Set font styling (Size, Style, Weight)
130
131 me = this;
132 this.application.ninja.stage.textTool.didDraw = function() { 125 this.application.ninja.stage.textTool.didDraw = function() {
133 me.applyElementStyles(me.selectedElement, me.application.ninja.stage.textTool.element, ["overflow"]); 126 self.applyElementStyles(self.selectedElement, self.application.ninja.stage.textTool.element, ["overflow"]);
134 me.applyElementStyles(me.selectedElement, me.application.ninja.stage.textTool.element.firstChild, ["font","padding-left","padding-top","padding-right","padding-bottom", "color"]); 127 self.applyElementStyles(self.selectedElement, self.application.ninja.stage.textTool.element.firstChild, ["font","padding-left","padding-top","padding-right","padding-bottom", "color"]);
135 var range = document.createRange(), 128 var range = document.createRange(),
136 sel = window.getSelection(); 129 sel = window.getSelection();
137 sel.removeAllRanges(); 130 sel.removeAllRanges();
138 range.selectNodeContents(this.application.ninja.stage.textTool.element.firstChild); 131 range.selectNodeContents(self.application.ninja.stage.textTool.element.firstChild);
139 sel.addRange(range); 132 sel.addRange(range);
140 this.didDraw = function() {}; 133 this.didDraw = function() {};
141 } 134 }
142 } 135 }
143 }, 136 },
144 137
138 /*
145 HandleDoubleClick: { 139 HandleDoubleClick: {
146 value: function(e) { 140 value: function(e) {
147 //this.application.ninja.selectedElements[0].setAttribute("contenteditable", true); 141 //this.application.ninja.selectedElements[0].setAttribute("contenteditable", true);
148
149 //if (!this.application.ninja.textTool) {
150
151 //}
152
153
154
155 } 142 }
156 }, 143 },
144 */
157 145
158 Configure: { 146 Configure: {
159 value: function(wasSelected) { 147 value: function(wasSelected) {