1 define(function(require) {
7 var _ = require('libs/underscore'),
8 Dialog = require('views/dialog/dialog'),
9 wlxml = require('wlxml/wlxml'),
10 logging = require('fnpjs/logging/logging');
13 var logger = logging.getLogger('document');
15 var Document = function() {
16 wlxml.WLXMLDocument.apply(this, Array.prototype.slice.call(arguments, 0));
18 Document.prototype = Object.create(wlxml.WLXMLDocument.prototype);
20 _.extend(Document.prototype, {
21 transaction: function(body, params) {
22 params = params || {};
23 var error = params.error;
24 params.error = function(e) {
27 var dialog = Dialog.create({
28 title: gettext('Error'),
29 text: gettext('Something wrong happend when applying this change so it was undone.'),
30 executeButtonText: gettext('Close')
36 dialog.on('execute', function(e) {
40 return wlxml.WLXMLDocument.prototype.transaction.call(this, body, params);
42 getUrlForLink: function(link) {
43 var cfg = this.options.editorConfig;
44 if(link.substr(0, 7) === 'file://' && cfg && cfg.documentAttachmentUrl) {
45 link = cfg.documentAttachmentUrl(link.substr(7));