aboutsummaryrefslogtreecommitdiff
path: root/js/components/tools-properties/text-properties.reel/text-properties.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/components/tools-properties/text-properties.reel/text-properties.js')
-rwxr-xr-xjs/components/tools-properties/text-properties.reel/text-properties.js128
1 files changed, 83 insertions, 45 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 4f944adf..126665e2 100755
--- a/js/components/tools-properties/text-properties.reel/text-properties.js
+++ b/js/components/tools-properties/text-properties.reel/text-properties.js
@@ -8,32 +8,70 @@ var 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 ArrayController = require("montage/ui/controller/array-controller").ArrayController;
10var ToolProperties = require("js/components/tools-properties/tool-properties").ToolProperties; 10var ToolProperties = require("js/components/tools-properties/tool-properties").ToolProperties;
11var Converter = require("montage/core/converter/converter").Converter;
12 11
13exports.TextProperties = Montage.create(ToolProperties, { 12exports.TextProperties = Montage.create(ToolProperties, {
14 13
15 fontName: {value: null, serializable: true}, 14 fontName: {value: null, serializable: true},
16 fontSize: {value: null, serializable: true}, 15 fontSize: {value: null, serializable: true},
17
18 fontSettings: {value: null, serializable: true}, // Note: Isn't used currently will need fontSettings Popup
19
20 fontColor: {value: null, serializable: true}, 16 fontColor: {value: null, serializable: true},
17
21 btnBold: {value: null, serializable: true}, 18 btnBold: {value: null, serializable: true},
22 btnItalic: {value: null, serializable: true}, 19 btnItalic: {value: null, serializable: true},
23 btnUnderline: {value: null, serializable: true}, 20 btnUnderline: {value: null, serializable: true},
24 btnStrikethrough: {value: null, serializable: true}, 21 btnStrikethrough: {value: null, serializable: true},
25 txtLink: {value: null, serializable: true}, 22
26 linkTarget: {value: null, serializable: true},
27 alignLeft: {value: null, serializable: true}, 23 alignLeft: {value: null, serializable: true},
28 alignCenter: {value: null, serializable: true}, 24 alignCenter: {value: null, serializable: true},
29 alignRight: {value: null, serializable: true}, 25 alignRight: {value: null, serializable: true},
30 alignJustify: {value: null, serializable: true}, 26 alignJustify: {value: null, serializable: true},
27
31 indent: {value: null, serializable: true}, 28 indent: {value: null, serializable: true},
32 outdent: {value: null, serializable: true}, 29 outdent: {value: null, serializable: true},
30
33 numberedList: {value: null, serializable: true}, 31 numberedList: {value: null, serializable: true},
34 bulletedList: {value: null, serializable: true}, 32 bulletedList: {value: null, serializable: true},
35 fontTypes: {value: null, serializable: true}, 33
36 fontSizes: {value: null, serializable: true}, 34 // Events
35 handleEditorSelect: {
36 value: function(e) {
37 this.alignLeft.pressed = false;
38 this.alignCenter.pressed = false;
39 this.alignRight.pressed = false;
40 this.alignJustify.pressed = false;
41 this.bulletedList.pressed = false;
42 this.numberedList.pressed = false;
43
44
45 switch(this.application.ninja.stage.textTool.justify) {
46 case "left":
47 this.alignLeft.pressed = true;
48 break;
49 case "center":
50 this.alignCenter.pressed = true;
51 break;
52 case "right":
53 this.alignRight.pressed = true;
54 break;
55 case "full":
56 this.alignJustify.pressed = true;
57 }
58
59 switch(this.application.ninja.stage.textTool.listStyle) {
60 case "ordered":
61 this.numberedList.pressed = true;
62 break;
63 case "unordered":
64 this.bulletedList.pressed = true;
65 }
66 }
67 },
68
69 handleEditorBlur: {
70 value: function(e) {
71
72 }
73 },
74
37 75
38 // Draw Cycle 76 // Draw Cycle
39 prepareForDraw: { 77 prepareForDraw: {
@@ -46,6 +84,7 @@ exports.TextProperties = Montage.create(ToolProperties, {
46 84
47 this.application.ninja.stage.textTool.addEventListener("editorSelect", this.handleEditorSelect.bind(this), false); 85 this.application.ninja.stage.textTool.addEventListener("editorSelect", this.handleEditorSelect.bind(this), false);
48 86
87
49 //Bind to Rich Text editor that lives on the stage component 88 //Bind to Rich Text editor that lives on the stage component
50 Object.defineBinding(this.application.ninja.stage.textTool, "fontName", { 89 Object.defineBinding(this.application.ninja.stage.textTool, "fontName", {
51 boundObject: this.fontName, 90 boundObject: this.fontName,
@@ -85,83 +124,82 @@ exports.TextProperties = Montage.create(ToolProperties, {
85 } 124 }
86 }, 125 },
87 126
88 // Events 127 // Actions
89 handleEditorSelect: { 128 handleJustifyLeftAction: {
90 value: function(e) {
91
92 }
93 },
94
95 handleAlignLeftAction: {
96 value: function(e) { 129 value: function(e) {
97 //this.alignLeft.value = false; 130 this.alignCenter.pressed = false;
98 this.alignCenter.value = false; 131 this.alignRight.pressed = false;
99 this.alignRight.value = false; 132 this.alignJustify.pressed = false;
100 this.alignJustify.value = false; 133 this.application.ninja.stage.textTool.justify = "left";
101 this.application.ninja.stage.textTool.doAction("justifyleft");
102 } 134 }
103 }, 135 },
104 136
105 handleAlignCenterAction: { 137 handleJustifyCenterAction: {
106 value: function(e) { 138 value: function(e) {
107 this.alignLeft.value = false; 139 this.alignLeft.pressed = false;
108 //this.alignCenter.value = false; 140 this.alignRight.pressed = false;
109 this.alignRight.value = false; 141 this.alignJustify.pressed = false;
110 this.alignJustify.value = false; 142 this.application.ninja.stage.textTool.justify = "center"
111 this.application.ninja.stage.textTool.doAction("justifycenter");
112 } 143 }
113 }, 144 },
114 145
115 handleAlignRightAction: { 146 handleJustifyRightAction: {
116 value: function(e) { 147 value: function(e) {
117 this.alignLeft.value = false; 148 this.alignLeft.pressed = false;
118 this.alignCenter.value = false; 149 this.alignCenter.pressed = false;
119 //this.alignRight.value = false; 150 this.alignJustify.pressed = false;
120 this.alignJustify.value = false; 151 this.application.ninja.stage.textTool.justify = "right";
121 this.application.ninja.stage.textTool.doAction("justifyright");
122 } 152 }
123 }, 153 },
124 154
125 handleAlignJustifyAction: { 155 handleJustifyAction: {
126 value: function(e) { 156 value: function(e) {
127 this.alignLeft.value = false; 157 this.alignLeft.pressed = false;
128 this.alignCenter.value = false; 158 this.alignCenter.pressed = false;
129 this.alignRight.value = false; 159 this.alignRight.pressed = false;
130 //this.alignJustify.value = false; 160 this.application.ninja.stage.textTool.justify = "full";
131 this.application.ninja.stage.textTool.doAction("justifyfull");
132 } 161 }
133 }, 162 },
134 163
135 handleIndentAction: { 164 handleIndentAction: {
136 value: function(e) { 165 value: function(e) {
137 this.application.ninja.stage.textTool.doAction("indent"); 166 this.application.ninja.stage.textTool.indent();
138 } 167 }
139 }, 168 },
140 169
141 handleOutdentAction: { 170 handleOutdentAction: {
142 value: function(e) { 171 value: function(e) {
143 this.application.ninja.stage.textTool.doAction("outdent"); 172 this.application.ninja.stage.textTool.outdent();
144 } 173 }
145 }, 174 },
146 175
147 handleBulletedListAction: { 176 handleBulletedListAction: {
148 value: function(e) { 177