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.js359
1 files changed, 123 insertions, 236 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 c5729e98..126665e2 100755
--- a/js/components/tools-properties/text-properties.reel/text-properties.js
+++ b/js/components/tools-properties/text-properties.reel/text-properties.js
@@ -10,309 +10,196 @@ var ArrayController = require("montage/ui/controller/array-controller").ArrayCon
10var ToolProperties = require("js/components/tools-properties/tool-properties").ToolProperties; 10var ToolProperties = require("js/components/tools-properties/tool-properties").ToolProperties;
11 11
12exports.TextProperties = Montage.create(ToolProperties, { 12exports.TextProperties = Montage.create(ToolProperties, {
13 className: {value: null, serializable: true}, 13
14 tagType: {value: null, serializable: true}, 14 fontName: {value: null, serializable: true},
15 fontSelection: {value: null, serializable: true},
16 fontSettings: {value: null, serializable: true},
17 fontSize: {value: null, serializable: true}, 15 fontSize: {value: null, serializable: true},
18 fontColor: {value: null, serializable: true}, 16 fontColor: {value: null, serializable: true},
17
19 btnBold: {value: null, serializable: true}, 18 btnBold: {value: null, serializable: true},
20 btnItalic: {value: null, serializable: true}, 19 btnItalic: {value: null, serializable: true},
21 btnUnderline: {value: null, serializable: true}, 20 btnUnderline: {value: null, serializable: true},
22 btnStrikethrough: {value: null, serializable: true}, 21 btnStrikethrough: {value: null, serializable: true},
23 txtLink: {value: null, serializable: true}, 22
24 linkTarget: {value: null, serializable: true},
25 alignLeft: {value: null, serializable: true}, 23 alignLeft: {value: null, serializable: true},
26 alignCenter: {value: null, serializable: true}, 24 alignCenter: {value: null, serializable: true},
27 alignRight: {value: null, serializable: true}, 25 alignRight: {value: null, serializable: true},
28 alignJustify: {value: null, serializable: true}, 26 alignJustify: {value: null, serializable: true},
27
29 indent: {value: null, serializable: true}, 28 indent: {value: null, serializable: true},
30 outdent: {value: null, serializable: true}, 29 outdent: {value: null, serializable: true},
30
31 numberedList: {value: null, serializable: true}, 31 numberedList: {value: null, serializable: true},
32 bulletedList: {value: null, serializable: true}, 32 bulletedList: {value: null, serializable: true},
33 fontTypes: {value: null, serializable: true},
34 fontSizes: {value: null, serializable: true},
35 33
36 prepareForDraw: { 34 // Events
37 value: function() { 35 handleEditorSelect: {
38 // code commented out because montage ui element select-input is incomplete. Will switch back when they fix or actually complete the component 36 value: function(e) {
39// this.fontTypes = Montage.create(ArrayController); 37 this.alignLeft.pressed = false;
40// this.fontTypes.content = [ 38 this.alignCenter.pressed = false;
41// { value: "Arial", text: "Arial" }, 39 this.alignRight.pressed = false;
42// { value: "Arial Black", text: "Arial Black" }, 40 this.alignJustify.pressed = false;
43// { value: "Courier New", text: "Courier New" }, 41 this.bulletedList.pressed = false;
44// { value: "Garamond", text: "Garamond" }, 42 this.numberedList.pressed = false;
45// { value: "Georgia", text: "Georgia" }, 43
46// { value: "Open Sans", text: "Open Sans" }, 44
47// { value: "Tahoma", text: "Tahoma" }, 45 switch(this.application.ninja.stage.textTool.justify) {
48// { value: "Times New Roman", text: "Times New Roman" }, 46 case "left":
49// { value: "Trebuchet MS", text: "Trebuchet MS" }, 47 this.alignLeft.pressed = true;
50// { value: "Verdana", text: "Verdana" } 48 break;
51// ]; 49 case "center":
52 50 this.alignCenter.pressed = true;
53 //this.fontSelection.contentController = this.fontTypes; 51 break;
54// 52 case "right":
55// this.fontSizes = Montage.create(ArrayController); 53 this.alignRight.pressed = true;
56// this.fontSizes.content = [ 54 break;
57// { value: 1, text: "8pt" }, 55 case "full":
58// { value: 2, text: "10pt" }, 56 this.alignJustify.pressed = true;
59// { value: 3, text: "12pt" }, 57 }
60// { value: 4, text: "14pt" }, 58
61// { value: 5, text: "18pt" }, 59 switch(this.application.ninja.stage.textTool.listStyle) {
62// { value: 6, text: "24pt" }, 60 case "ordered":
63// { value: 7, text: "36pt" } 61 this.numberedList.pressed = true;
64// ]; 62 break;
65// this.fontSize.contentController = this.fontSizes; 63 case "unordered":
66 64 this.bulletedList.pressed = true;
67 this.fontSelection.items = ["Arial", "Arial Black", "Courier New", "Garamond", "Georgia", "Open Sans", "Tahoma", "Times New Roman", "Trebuchet MS", "Verdana"]; 65 }
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"];
70 } 66 }
71 }, 67 },
72 68
73 handleEditorSelect: { 69 handleEditorBlur: {
74 value: function(e) { 70 value: function(e) {
75 //this.application.ninja.stage.textTool.updateStates(); 71
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 } 72 }
85 }, 73 },
86 74
87 _subPrepare: { 75
76 // Draw Cycle
77 prepareForDraw: {
88 value: function() { 78 value: function() {
89 //this.divElement.addEventListener("click", this, false);
90 }
91 },
92 79
93 handleClick: { 80 this.fontColor.props = {side: 'top', align: 'center', wheel: true, palette: true, gradient: false, image: false, nocolor: true, offset: -80};
94 value: function(event) { 81 this.application.ninja.colorController.addButton("chip", this.fontColor);
95 // this.selectedElement = event._event.target.id; 82 this.fontColor.color('rgb', {wasSetByCode: true, type: 'change', color: {r: 0, g: 0, b: 0}, css: 'rgb(0,0,0)'});
83 this.fontColor.addEventListener("change",this.handleFontColorChange.bind(this),false);
84
85 this.application.ninja.stage.textTool.addEventListener("editorSelect", this.handleEditorSelect.bind(this), false);
86
87
88 //Bind to Rich Text editor that lives on the stage component
89 Object.defineBinding(this.application.ninja.stage.textTool, "fontName", {
90 boundObject: this.fontName,
91 boundObjectPropertyPath: "value",
92 oneway: false
93 });
94
95 Object.defineBinding(this.application.ninja.stage.textTool, "fontSize", {
96 boundObject: this.fontSize,
97 boundObjectPropertyPath: "value",
98 oneway: false
99 });
100
101 Object.defineBinding(this.btnBold, "pressed", {
102 boundObject: this.application.ninja.stage.textTool,
103 boundObjectPropertyPath: "bold",
104 oneway: false
105 });
106
107 Object.defineBinding(this.btnItalic, "pressed", {
108 boundObject: this.application.ninja.stage.textTool,
109 boundObjectPropertyPath: "italic",
110 oneway: false
111 });
112
113 Object.defineBinding(this.btnUnderline, "pressed", {
114 boundObject: this.application.ninja.stage.textTool,
115 boundObjectPropertyPath: "underline",
116 oneway: false
117 });
96 118
119 Object.defineBinding(this.btnStrikethrough, "pressed", {
120 boundObject: this.application.ninja.stage.textTool,
121 boundObjectPropertyPath: "strikeThrough",
122 oneway: false
123 });
97 } 124 }
98 }, 125 },
99 126
100 handleAlignLeftAction: { 127 // Actions
128 handleJustifyLeftAction: {
101 value: function(e) { 129 value: function(e) {
102 //this.alignLeft.value = false; 130 this.alignCenter.pressed = false;
103 this.alignCenter.value = false; 131 this.alignRight.pressed = false;
104 this.alignRight.value = false; 132 this.alignJustify.pressed = false;
105 this.alignJustify.value = false; 133 this.application.ninja.stage.textTool.justify = "left";
106 this.application.ninja.stage.textTool.doAction("justifyleft");
107 } 134 }
108 }, 135 },
109