1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-11-17 07:47:24 +00:00

Support custom HTML element tags for reveal widget

This commit is contained in:
Jermolene
2015-03-10 12:44:47 +00:00
parent 64e1a76987
commit 1808b1597e
2 changed files with 8 additions and 2 deletions

View File

@@ -30,7 +30,11 @@ RevealWidget.prototype.render = function(parent,nextSibling) {
this.parentDomNode = parent;
this.computeAttributes();
this.execute();
var domNode = this.document.createElement(this.parseTreeNode.isBlock ? "div" : "span");
var tag = this.parseTreeNode.isBlock ? "div" : "span";
if($tw.config.htmlUnsafeElements.indexOf(this.revealTag) === -1) {
tag = this.revealTag;
}
var domNode = this.document.createElement(tag);
var classes = this["class"].split(" ") || [];
classes.push("tc-reveal");
domNode.className = classes.join(" ");
@@ -83,6 +87,7 @@ Compute the internal state of the widget
RevealWidget.prototype.execute = function() {
// Get our parameters
this.state = this.getAttribute("state");
this.revealTag = this.getAttribute("tag");
this.type = this.getAttribute("type");
this.text = this.getAttribute("text");
this.position = this.getAttribute("position");