mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-27 03:57:21 +00:00
Make "tc-dirty" update also on external windows (#5129)
* Update windows.js * Update saver-handler.js * Update saver-handler.js
This commit is contained in:
parent
b3cbd7d733
commit
eb7f59a855
@ -197,8 +197,12 @@ SaverHandler.prototype.isDirty = function() {
|
|||||||
Update the document body with the class "tc-dirty" if the wiki has unsaved/unsynced changes
|
Update the document body with the class "tc-dirty" if the wiki has unsaved/unsynced changes
|
||||||
*/
|
*/
|
||||||
SaverHandler.prototype.updateDirtyStatus = function() {
|
SaverHandler.prototype.updateDirtyStatus = function() {
|
||||||
|
var self = this;
|
||||||
if($tw.browser) {
|
if($tw.browser) {
|
||||||
$tw.utils.toggleClass(document.body,"tc-dirty",this.isDirty());
|
$tw.utils.toggleClass(document.body,"tc-dirty",this.isDirty());
|
||||||
|
$tw.utils.each($tw.windows,function(win) {
|
||||||
|
$tw.utils.toggleClass(win.document.body,"tc-dirty",self.isDirty());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ exports.after = ["startup"];
|
|||||||
exports.synchronous = true;
|
exports.synchronous = true;
|
||||||
|
|
||||||
// Global to keep track of open windows (hashmap by title)
|
// Global to keep track of open windows (hashmap by title)
|
||||||
var windows = {};
|
$tw.windows = {};
|
||||||
|
|
||||||
exports.startup = function() {
|
exports.startup = function() {
|
||||||
// Handle open window message
|
// Handle open window message
|
||||||
@ -44,7 +44,7 @@ exports.startup = function() {
|
|||||||
catch(e) {
|
catch(e) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
windows[title] = srcWindow;
|
$tw.windows[title] = srcWindow;
|
||||||
// Check for reopening the same window
|
// Check for reopening the same window
|
||||||
if(srcWindow.haveInitialisedWindow) {
|
if(srcWindow.haveInitialisedWindow) {
|
||||||
return;
|
return;
|
||||||
@ -54,7 +54,7 @@ exports.startup = function() {
|
|||||||
srcDocument.close();
|
srcDocument.close();
|
||||||
srcDocument.title = windowTitle;
|
srcDocument.title = windowTitle;
|
||||||
srcWindow.addEventListener("beforeunload",function(event) {
|
srcWindow.addEventListener("beforeunload",function(event) {
|
||||||
delete windows[title];
|
delete $tw.windows[title];
|
||||||
$tw.wiki.removeEventListener("change",refreshHandler);
|
$tw.wiki.removeEventListener("change",refreshHandler);
|
||||||
},false);
|
},false);
|
||||||
// Set up the styles
|
// Set up the styles
|
||||||
@ -90,7 +90,7 @@ exports.startup = function() {
|
|||||||
});
|
});
|
||||||
// Close open windows when unloading main window
|
// Close open windows when unloading main window
|
||||||
$tw.addUnloadTask(function() {
|
$tw.addUnloadTask(function() {
|
||||||
$tw.utils.each(windows,function(win) {
|
$tw.utils.each($tw.windows,function(win) {
|
||||||
win.close();
|
win.close();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user