+PlinnStylesCombo.prototype.loadStyle = function(definition) {
+ this.styles.push(definition);
+ this.styles[definition.name] = definition;
+};
+
+PlinnStylesCombo.prototype.init = function() {
+ var i, style;
+ for (i=0 ; i < this.styles.length ; i++) {
+ style = this.styles[i];
+ this.add(style.name,
+ '<div class="' + style.className + '">' +
+ style.name +
+ '</div>',
+ style.name
+ );
+ }
+};
+
+PlinnStylesCombo.prototype.onClick = function(value) {
+ this.editor.focus();
+ this.editor.fire( 'saveSnapshot' );
+ var style = this.styles[value]
+ var className = style.className;
+ var element = this.editor.elementPath().lastElement;
+ if (element.hasClass(className)) {
+ element.removeClass(className);
+ }
+ else {
+ element.addClass(className);
+ }
+ this.editor.fire( 'saveSnapshot' );
+};