mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 10:07:19 +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
|
||||
*/
|
||||
SaverHandler.prototype.updateDirtyStatus = function() {
|
||||
var self = this;
|
||||
if($tw.browser) {
|
||||
$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;
|
||||
|
||||
// Global to keep track of open windows (hashmap by title)
|
||||
var windows = {};
|
||||
$tw.windows = {};
|
||||
|
||||
exports.startup = function() {
|
||||
// Handle open window message
|
||||
@ -44,7 +44,7 @@ exports.startup = function() {
|
||||
catch(e) {
|
||||
return;
|
||||
}
|
||||
windows[title] = srcWindow;
|
||||
$tw.windows[title] = srcWindow;
|
||||
// Check for reopening the same window
|
||||
if(srcWindow.haveInitialisedWindow) {
|
||||
return;
|
||||
@ -54,7 +54,7 @@ exports.startup = function() {
|
||||
srcDocument.close();
|
||||
srcDocument.title = windowTitle;
|
||||
srcWindow.addEventListener("beforeunload",function(event) {
|
||||
delete windows[title];
|
||||
delete $tw.windows[title];
|
||||
$tw.wiki.removeEventListener("change",refreshHandler);
|
||||
},false);
|
||||
// Set up the styles
|
||||
@ -90,7 +90,7 @@ exports.startup = function() {
|
||||
});
|
||||
// Close open windows when unloading main window
|
||||
$tw.addUnloadTask(function() {
|
||||
$tw.utils.each(windows,function(win) {
|
||||
$tw.utils.each($tw.windows,function(win) {
|
||||
win.close();
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user