+/* © 2014 Benoît Pin, MINES ParisTech */
( function() {
var PlinnStylesCombo = function(editor) {
this.styles = [];
};
+PlinnStylesCombo.prototype.onRender = function() {
+ var self = this;
+ this.editor.on('selectionChange', function(evt){self.checkSelection(evt);});
+};
+
+PlinnStylesCombo.prototype.checkSelection = function(evt) {
+ if (evt.data.selection.getRanges().length > 1) {
+ this.disable();
+ }
+ else {
+ this.enable();
+ }
+};
+
PlinnStylesCombo.prototype.loadStyle = function(definition) {
this.styles.push(definition);
this.styles[definition.name] = definition;
this.combo = new PlinnStylesCombo(editor);
editor.ui.addRichCombo('PlinnStyles', this.combo);
var self = this;
- editor.on('stylesSet', function(evt){self.onStylesSet(evt)});
+ editor.on('stylesSet', function(evt){self.onStylesSet(evt);});
};
PlinnStylePlugin.prototype.onStylesSet = function(evt) {