], function($, _, Backbone, logging, documentElement, keyboard, utils, wlxmlListener) {
'use strict';
-/* global document:false, window:false, Node:false */
+/* global document:false, window:false, Node:false, gettext */
var logger = logging.getLogger('canvas');
},
setText: function(text, node) {
//this.canvas.wlxmlDocument.transform('setText', {node:node, text: text});
- node.setText(text);
+ node.document.transaction(function() {
+ node.setText(text);
+ }, {
+ metadata:{
+ description: gettext('Changing text')
+ }
+ });
}
], function($, _, mainTemplate, itemTemplate, OpenSelectView) {
'use strict';
+/* globals gettext */
return function(sandbox) {
this.node.find('.rng-module-metadataEditor-addBtn').click(function() {
adding = true;
- currentNode.getMetadata().add('','');
+ currentNode.document.transaction(function() {
+ currentNode.getMetadata().add('','');
+ }, this, gettext('Add metadata row'));
});
this.metaTable.on('click', '.rng-visualEditor-metaRemoveBtn', function(e) {
- $(e.target).closest('tr').data('row').remove();
+ currentNode.document.transaction(function() {
+ $(e.target).closest('tr').data('row').remove();
+ }, this, gettext('Remove metadata row'));
});
this.metaTable.on('keydown', '[contenteditable]', function(e) {
row = editable.parents('tr').data('row'),
isKey = _.last(editable.attr('class').split('-')) === 'metaItemKey',
method = isKey ? 'setKey' : 'setValue';
- row[method](toSet);
+ row.metadata.node.document.transaction(function() {
+ row[method](toSet);
+ }, this, gettext('Metadata edit'));
}
}, 500));
},
var allowed = params.document && !!(params.document[dir+'Stack'].length),
desc = dir === 'undo' ? gettext('Undo') : gettext('Redo'),
descEmpty = dir === 'undo' ? gettext('There is nothing to undo') : gettext('There is nothing to redo');
+ if(allowed) {
+ desc += ': ' + (_.last(params.document[dir+'Stack']).metadata || gettext('unknown operation'));
+ }
return {
allowed: allowed,
description: allowed ? desc : descEmpty