fnp
/
fnpeditor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
wlxml: cleanup
[fnpeditor.git]
/
src
/
editor
/
modules
/
documentToolbar
/
actionView.js
diff --git
a/src/editor/modules/documentToolbar/actionView.js
b/src/editor/modules/documentToolbar/actionView.js
index
ddef396
..
74db332
100644
(file)
--- a/
src/editor/modules/documentToolbar/actionView.js
+++ b/
src/editor/modules/documentToolbar/actionView.js
@@
-1,6
+1,7
@@
define(function(require) {
'use strict';
define(function(require) {
'use strict';
+/* globals gettext */
var $ = require('libs/jquery'),
Backbone = require('libs/backbone'),
var $ = require('libs/jquery'),
Backbone = require('libs/backbone'),
@@
-44,6
+45,12
@@
var ActionView = Backbone.View.extend({
var actionState = this.action.getState();
var actionState = this.action.getState();
+ if(!actionState) {
+ this.$el.html(buttonTemplate({label: gettext('error :('), iconName:''}));
+ this._button().attr('disabled', true);
+ return;
+ }
+
var templateContext = {
label: actionState.label || '?',
iconName: (iconExists(actionState.icon)) ? actionState.icon : null,
var templateContext = {
label: actionState.label || '?',
iconName: (iconExists(actionState.icon)) ? actionState.icon : null,
@@
-101,8
+108,9
@@
var ActionView = Backbone.View.extend({
this.trigger('mousedown');
},
onExecute: function() {
this.trigger('mousedown');
},
onExecute: function() {
- var ret = this.action.execute();
- this.trigger('actionExecuted', this.action, ret);
+ this.action.execute(function(ret) {
+ this.trigger('actionExecuted', this.action, ret);
+ }.bind(this));
},
onSelectionChange: function(e) {
var select = $(e.target),
},
onSelectionChange: function(e) {
var select = $(e.target),