mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-10-29 22:53:00 +00:00
Add warning notification when viewing a document on a data: uri
The intent is to handhold the user through their first save+verification
This commit is contained in:
40
core/modules/utils/dom/modal.js
Normal file
40
core/modules/utils/dom/modal.js
Normal file
@@ -0,0 +1,40 @@
|
||||
/*\
|
||||
title: $:/core/modules/utils/dom/modal.js
|
||||
type: application/javascript
|
||||
module-type: utils
|
||||
|
||||
Modal message mechanism
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
var Modal = function(wiki) {
|
||||
this.wiki = wiki;
|
||||
};
|
||||
|
||||
Modal.prototype.display = function(title) {
|
||||
var wrapper = document.createElement("div"),
|
||||
template,renderer;
|
||||
template = "$:/templates/ModalMessage";
|
||||
renderer = $tw.wiki.parseTiddler(template);
|
||||
renderer.execute([],title);
|
||||
renderer.renderInDom(wrapper);
|
||||
$tw.wiki.addEventListener("",function(changes) {
|
||||
renderer.refreshInDom(changes);
|
||||
});
|
||||
wrapper.addEventListener("tw-close",function(event) {
|
||||
console.log("Got tw-close event");
|
||||
document.body.removeChild(wrapper);
|
||||
event.stopPropogation();
|
||||
return false;
|
||||
},false);
|
||||
document.body.appendChild(wrapper);
|
||||
};
|
||||
|
||||
exports.Modal = Modal;
|
||||
|
||||
})();
|
||||
Reference in New Issue
Block a user