summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/ui/editor/TextEditor.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/assets/javascripts/ui/editor/TextEditor.js')
-rw-r--r--public/assets/javascripts/ui/editor/TextEditor.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/public/assets/javascripts/ui/editor/TextEditor.js b/public/assets/javascripts/ui/editor/TextEditor.js
index c867d94..1e35c12 100644
--- a/public/assets/javascripts/ui/editor/TextEditor.js
+++ b/public/assets/javascripts/ui/editor/TextEditor.js
@@ -10,6 +10,7 @@ var TextEditor = FormView.extend({
"mousedown": "stopPropagation",
"change [name=font-family]": 'changeFontFamily',
"change [name=font-size]": 'changeFontSize',
+ "change [name=text-align]": 'changeTextAlign',
"input [name=text-body]": 'changeText',
"click [data-role=destroy-text]": "destroy",
},
@@ -23,6 +24,7 @@ var TextEditor = FormView.extend({
this.$fontFamily = this.$("[name=font-family]")
this.$fontSize = this.$("[name=font-size]")
this.$textBody = this.$("[name=text-body]")
+ this.$textAlign = this.$("[name=text-align]")
},
toggle: function(state){
@@ -35,8 +37,7 @@ var TextEditor = FormView.extend({
width: 600,
height: 450,
scale: 0.5,
- font: { family: 'Lato', size: 12 },
- align: 'left',
+ font: { family: 'Lato', size: 12, align: 'left' },
}
this.createMode(true)
@@ -94,6 +95,10 @@ var TextEditor = FormView.extend({
this.bind(scenery)
this.$el.toggleClass("active", true)
this.$textBody.val( this.scenery.media.description )
+
+ this.$fontFamily.val( this.scenery.media.font.family )
+ this.$fontSize.val( this.scenery.media.font.size )
+ this.$textAlign.val( this.scenery.media.font.align )
this.createMode(false)
@@ -111,6 +116,10 @@ var TextEditor = FormView.extend({
changeFontFamily: function(){
this.scenery.setFont({ family: this.$fontFamily.val() })
},
+
+ changeTextAlign: function(){
+ this.scenery.setFont({ align: this.$textAlign.val() })
+ },
changeFontSize: function(){
var size = parseInt( this.$fontSize.val() )