1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-16 10:29:54 +00:00

Add support for a custom class to modal wrapper (#4490)

* Add support for a custom class to modal wrapper

As per https://github.com/Jermolene/TiddlyWiki5/issues/4485 add support for a custom class to modal wrapper, by means of a field in the modal tiddler. The class is added to the modal wrapper in addition to the default class, allowing for custom styling via css of any part of the modal.

* Remove redundant check for tiddler.
This commit is contained in:
saqimtiaz 2020-03-12 17:58:14 +01:00 committed by GitHub
parent 195b3b0209
commit ca6dd93214
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -58,6 +58,9 @@ Modal.prototype.display = function(title,options) {
this.adjustPageClass();
// Add classes
$tw.utils.addClass(wrapper,"tc-modal-wrapper");
if(tiddler.fields && tiddler.fields.class) {
$tw.utils.addClass(wrapper,tiddler.fields.class);
}
$tw.utils.addClass(modalBackdrop,"tc-modal-backdrop");
$tw.utils.addClass(modalWrapper,"tc-modal");
$tw.utils.addClass(modalHeader,"tc-modal-header");
@ -104,7 +107,7 @@ Modal.prototype.display = function(title,options) {
modalBody.appendChild(modalLink);
}
// Render the footer of the message
if(tiddler && tiddler.fields && tiddler.fields.help) {
if(tiddler.fields && tiddler.fields.help) {
var link = this.srcDocument.createElement("a");
link.setAttribute("href",tiddler.fields.help);
link.setAttribute("target","_blank");