aboutsummaryrefslogtreecommitdiff
path: root/js/components/tools-properties/text-properties.reel/text-properties.js
diff options
context:
space:
mode:
authorPushkar Joshi2012-02-24 12:08:49 -0800
committerPushkar Joshi2012-02-24 12:08:49 -0800
commit03ca7a5ed13c25faaa9100bb666e062fd15335e6 (patch)
treec51112223ceb9121cd595a60335eb2795215590f /js/components/tools-properties/text-properties.reel/text-properties.js
parentfcb12cc09eb3cd3b42bd215877ba18f449275b75 (diff)
parent053fc63a2950c7a5ee4ebf98033b64d474a3c46e (diff)
downloadninja-03ca7a5ed13c25faaa9100bb666e062fd15335e6.tar.gz
Merge branch 'pentool' into brushtool
Conflicts: imports/codemirror/mode/scheme/scheme.js js/tools/BrushTool.js
Diffstat (limited to 'js/components/tools-properties/text-properties.reel/text-properties.js')
-rwxr-xr-x[-rw-r--r--]js/components/tools-properties/text-properties.reel/text-properties.js310
1 files changed, 297 insertions, 13 deletions
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 313693b1..88d38ffe 100644..100755
--- a/js/components/tools-properties/text-properties.reel/text-properties.js
+++ b/js/components/tools-properties/text-properties.reel/text-properties.js
@@ -6,6 +6,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
6 6
7var Montage = require("montage/core/core").Montage; 7var Montage = require("montage/core/core").Montage;
8var Component = require("montage/ui/component").Component; 8var Component = require("montage/ui/component").Component;
9var ArrayController = require("montage/ui/controller/array-controller").ArrayController;
9var ToolProperties = require("js/components/tools-properties/tool-properties").ToolProperties; 10var ToolProperties = require("js/components/tools-properties/tool-properties").ToolProperties;
10 11
11exports.TextProperties = Montage.create(ToolProperties, { 12exports.TextProperties = Montage.create(ToolProperties, {
@@ -25,26 +26,64 @@ exports.TextProperties = Montage.create(ToolProperties, {
25 alignCenter: {value: null}, 26 alignCenter: {value: null},
26 alignRight: {value: null}, 27 alignRight: {value: null},
27 alignJustify: {value: null}, 28 alignJustify: {value: null},
28 indentRight: {value: null}, 29 indent: {value: null},
29 indentLeft: {value: null}, 30 outdent: {value: null},
30 numberedList: {value: null}, 31 numberedList: {value: null},
31 bulletedList: {value: null}, 32 bulletedList: {value: null},
33 fontTypes: {value: null},
34 fontSizes: {value: null},
32 35
33 prepareForDraw: { 36 prepareForDraw: {
34 value: function() { 37 value: function() {
35 this.linkTarget.items = ["Target","_blank","_self","_parent", "_top"]; 38 // code commented out because montage ui element select-input is incomplete. Will switch back when they fix or actually complete the component
36 this.fontSettings.label = "Settings"; 39// this.fontTypes = Montage.create(ArrayController);
37 this.btnBold.label = "Bold"; 40// this.fontTypes.content = [
38 this.btnItalic.label = "Italic"; 41// { value: "Arial", text: "Arial" },
39 this.btnUnderline.label = "Underline"; 42// { value: "Arial Black", text: "Arial Black" },
40 this.btnStrikethrough.label = "Strikethrough"; 43// { value: "Courier New", text: "Courier New" },
41 this.alignLeft.label = "Left"; 44// { value: "Garamond", text: "Garamond" },
42 this.alignCenter.label = "Center"; 45// { value: "Georgia", text: "Georgia" },
43 this.alignRight.label = "Right"; 46// { value: "Open Sans", text: "Open Sans" },
44 this.alignJustify.label = "Justify"; 47// { value: "Tahoma", text: "Tahoma" },
48// { value: "Times New Roman", text: "Times New Roman" },
49// { value: "Trebuchet MS", text: "Trebuchet MS" },
50// { value: "Verdana", text: "Verdana" }
51// ];
52
53 //this.fontSelection.contentController = this.fontTypes;
54//
55// this.fontSizes = Montage.create(ArrayController);
56// this.fontSizes.content = [
57// { value: 1, text: "8pt" },
58// { value: 2, text: "10pt" },
59// { value: 3, text: "12pt" },
60// { value: 4, text: "14pt" },
61// { value: 5, text: "18pt" },
62// { value: 6, text: "24pt" },
63// { value: 7, text: "36pt" }
64// ];
65// this.fontSize.contentController = this.fontSizes;
66
67 this.fontSelection.items = ["Arial", "Arial Black", "Courier New", "Garamond", "Georgia", "Open Sans", "Tahoma", "Times New Roman", "Trebuchet MS", "Verdana"];
68 this.fontSize.items = ["8pt","10pt","12pt","14pt","18pt","24pt","36pt"];
69 this.tagType.items = ["div", "span", "p", "section", "article", "h1", "h2", "h3", "h4", "h5", "h6"];
45 } 70 }
46 }, 71 },
47 72
73 handleEditorSelect: {
74 value: function(e) {
75 this.application.ninja.stage.textTool.updateStates();
76// this.fontSelection.value = this.application.ninja.stage.textTool.states.fontname;
77//
78// for( var i = 0; i < this.fontSize.items.length; i++) {
79// if (this.application.ninja.stage.textTool.states.fontsize == i + 1) {
80// this.fontSize.value = this.fontSize.items[i]
81// break;
82// }
83// }
84 }
85 },
86
48 _subPrepare: { 87 _subPrepare: {
49 value: function() { 88 value: function() {
50 //this.divElement.addEventListener("click", this, false); 89 //this.divElement.addEventListener("click", this, false);
@@ -54,6 +93,251 @@ exports.TextProperties = Montage.create(ToolProperties, {
54 handleClick: { 93 handleClick: {
55 value: function(event) { 94 value: function(event) {
56 // this.selectedElement = event._event.target.id; 95 // this.selectedElement = event._event.target.id;
96
97 }
98 },
99
100 handleBtnBoldAction: {
101 value: function(e) {
102 this.application.ninja.stage.textTool.doAction("bold");
103 }
104 },
105
106 handleBtnItalicAction: {
107 value: function(e) {
108 this.application.ninja.stage.textTool.doAction("italic");
109 }
110 },
111
112 handleBtnUnderlineAction: {
113 value: function(e) {
114 this.application.ninja.stage.textTool.doAction("underline");
115 }
116 },
117
118 handleBtnStrikethroughAction: {
119 value: function(e) {
120 this.application.ninja.stage.textTool.doAction("strikethrough");
121 }
122 },
123
124 handleAlignLeftAction: {
125 value: function(e) {
126 //this.alignLeft.value = false;
127 this.alignCenter.value = false;
128 this.alignRight.value = false;
129 this.alignJustify.value = false;
130 this.application.ninja.stage.textTool.doAction("justifyleft");
131 }
132 },
133
134 handleAlignCenterAction: {
135 value: function(e) {
136 this.alignLeft.value = false;
137 //this.alignCenter.value = false;
138 this.alignRight.value = false;
139 this.alignJustify.value = false;
140 this.application.ninja.stage.textTool.doAction("justifycenter");
141 }
142 },
143
144 handleAlignRightAction: {
145 value: function(e) {
146 this.alignLeft.value = false;
147 this.alignCenter.value = false;
148 //this.alignRight.value = false;
149 this.alignJustify.value = false;
150 this.application.ninja.stage.textTool.doAction("justifyright");
151 }
152 },
153
154 handleAlignJustifyAction: {
155 value: function(e) {
156 this.alignLeft.value = false;
157 this.alignCenter.value = false;
158 this.alignRight.value = false;
159 //this.alignJustify.value = false;
160 this.application.ninja.stage.textTool.doAction("justifyfull");
161 }
162 },
163
164 handleIndentAction: {
165 value: function(e) {
166 this.application.ninja.stage.textTool.doAction("indent");
167 }
168 },
169
170 handleOutdentAction: {
171 value: function(e) {
172 this.application.ninja.stage.textTool.doAction("outdent");
173 }
174 },
175
176 handleBulletedListAction: {
177 value: function(e) {
178 this.application.ninja.stage.textTool.doAction("insertunorderedlist");
179 }
180 },
181
182 handleNumberedListAction: {
183 value: function(e) {
184 this.application.ninja.stage.textTool.doAction("insertorderedlist");
185 }
186 },
187
188 handleFontSizeChange: {
189 value: function(e) {
190 //We need the index of whats selected. This is a temporary solution til we can have a variable amount for font-size.
191 for( var i = 0; i < this.fontSize.items.length; i++) {