fnp
/
fnpeditor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
smartxml: minor tests fix (incorrect grouping)
[fnpeditor.git]
/
src
/
editor
/
modules
/
data
/
data.js
diff --git
a/src/editor/modules/data/data.js
b/src/editor/modules/data/data.js
index
dd81909
..
7488390
100644
(file)
--- a/
src/editor/modules/data/data.js
+++ b/
src/editor/modules/data/data.js
@@
-41,11
+41,14
@@
return function(sandbox) {
});
var modificationFlag = true;
});
var modificationFlag = true;
-
wlxmlDocument.on('change',
function() {
+
var handleChange =
function() {
documentDirty = true;
draftDirty = true;
modificationFlag = true;
documentDirty = true;
draftDirty = true;
modificationFlag = true;
- });
+ };
+ wlxmlDocument.on('change', handleChange);
+ wlxmlDocument.on('contentSet', handleChange);
+
if(window.localStorage) {
window.setInterval(function() {
if(modificationFlag) {
if(window.localStorage) {
window.setInterval(function() {
if(modificationFlag) {
@@
-54,9
+57,9
@@
return function(sandbox) {
}
if(wlxmlDocument && documentDirty && draftDirty) {
logger.debug('Saving draft to local storage.');
}
if(wlxmlDocument && documentDirty && draftDirty) {
logger.debug('Saving draft to local storage.');
- sandbox.publish('savingStarted');
+ sandbox.publish('savingStarted'
, 'local'
);
window.localStorage.setItem(getLocalStorageKey(), wlxmlDocument.toXML());
window.localStorage.setItem(getLocalStorageKey(), wlxmlDocument.toXML());
- sandbox.publish('savingEnded', 'success');
+ sandbox.publish('savingEnded', 'success'
, 'local'
);
draftDirty = false;
}
}, sandbox.getConfig().autoSaveInterval || 2500);
draftDirty = false;
}
}, sandbox.getConfig().autoSaveInterval || 2500);
@@
-156,7
+159,7
@@
return function(sandbox) {
});
dialog.on('execute', function(event) {
});
dialog.on('execute', function(event) {
- sandbox.publish('savingStarted');
+ sandbox.publish('savingStarted'
, 'remote'
);
var formData = event.formData;
formData[documentSaveForm.content_field_name] = wlxmlDocument.toXML();
var formData = event.formData;
formData[documentSaveForm.content_field_name] = wlxmlDocument.toXML();
@@
-172,11
+175,11
@@
return function(sandbox) {
data: formData,
success: function(data) {
event.success();
data: formData,
success: function(data) {
event.success();
- sandbox.publish('savingEnded', 'success', data.version);
+ sandbox.publish('savingEnded', 'success',
'remote',
data.version);
document_version = data.version;
reloadHistory();
},
document_version = data.version;
reloadHistory();
},
- error: function() {event.error(); sandbox.publish('savingEnded', 'error');}
+ error: function() {event.error(); sandbox.publish('savingEnded', 'error'
, 'remote'
);}
});
});
dialog.on('cancel', function() {
});
});
dialog.on('cancel', function() {