mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 18:17:20 +00:00
Support custom HTML element tags for reveal widget
This commit is contained in:
parent
64e1a76987
commit
1808b1597e
@ -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");
|
||||
|
@ -1,5 +1,5 @@
|
||||
created: 20131024141900000
|
||||
modified: 20140211232346858
|
||||
modified: 20150310124305795
|
||||
tags: Widgets
|
||||
title: RevealWidget
|
||||
type: text/vnd.tiddlywiki
|
||||
@ -19,6 +19,7 @@ The content of the `<$reveal>` widget is displayed according to the rules given
|
||||
|
||||
|!Attribute |!Description |
|
||||
|state |The title of the tiddler containing the state |
|
||||
|tag |Overrides the default HTML element tag (`<div>` in block mode or `<span>` in inline mode) |
|
||||
|type |The type of matching performed: ''match'', ''nomatch'' or ''popup'' |
|
||||
|text |The text to match when the type is ''match'' and ''nomatch'' |
|
||||
|position |The position used for the popup when the type is ''popup''. Can be ''left'', ''above'', ''aboveright'', ''right'', ''belowleft'' or ''below'' |
|
||||
|
Loading…
Reference in New Issue
Block a user