This makes those transactions support automatic rollback on error.
};
if(params.wlxmlTag === 'aside' && params.wlxmlClass === 'comment') {
};
if(params.wlxmlTag === 'aside' && params.wlxmlClass === 'comment') {
- doc.startTransaction();
- node = insertion();
- if(user) {
- creator = user.name;
- if(user.email) {
- creator += ' (' + user.email + ')';
+ doc.transaction(function() {
+ node = insertion();
+ if(user) {
+ creator = user.name;
+ if(user.email) {
+ creator += ' (' + user.email + ')';
+ }
+ } else {
+ creator = 'anonymous';
- } else {
- creator = 'anonymous';
- }
- metadata = node.getMetadata();
- metadata.add({key: 'creator', value: creator});
- metadata.add({key: 'date', value: datetime.currentStrfmt()});
- doc.endTransaction();
+ metadata = node.getMetadata();
+ metadata.add({key: 'creator', value: creator});
+ metadata.add({key: 'date', value: datetime.currentStrfmt()});
+ });
execCallback(node);
} else if(params.wlxmlClass === 'link') {
dialog = Dialog.create({
execCallback(node);
} else if(params.wlxmlClass === 'link') {
dialog = Dialog.create({
]
});
dialog.on('execute', function(event) {
]
});
dialog.on('execute', function(event) {
- doc.startTransaction();
- node = insertion();
- node.setAttr('href', event.formData.href);
- doc.endTransaction();
- event.success();
+ doc.transaction(function() {
+ node = insertion();
+ node.setAttr('href', event.formData.href);
+ event.success();
+ });
execCallback(node);
});
dialog.show();
} else {
execCallback(node);
});
dialog.show();
} else {
- doc.startTransaction();
- node = insertion();
- doc.endTransaction();
+ doc.transaction(function() {
+ node = insertion();
+ });
]
});
dialog.on('execute', function(event) {
]
});
dialog.on('execute', function(event) {
- canvas.wlxmlDocument.startTransaction();
- node.setAttr('href', event.formData.href);
- event.success();
+ canvas.wlxmlDocument.transaction(function() {
+ node.setAttr('href', event.formData.href);
+ event.success();
+ });
canvas.wlxmlDocument.endTransaction();
});
dialog.show();
canvas.wlxmlDocument.endTransaction();
});
dialog.show();