1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-11-07 19:13:00 +00:00

Fixes to make nested popups work

Thus making the export button a lot more useful
This commit is contained in:
Jermolene
2014-11-21 17:07:03 +00:00
parent 27c9e7269e
commit b882a0dff1
9 changed files with 154 additions and 67 deletions

View File

@@ -36,15 +36,19 @@ ButtonWidget.prototype.render = function(parent,nextSibling) {
// Create element
var domNode = this.document.createElement("button");
// Assign classes
var classes = this["class"].split(" ") || [];
var classes = this["class"].split(" ") || [],
isPoppedUp = this.popup && this.isPoppedUp();
if(this.selectedClass) {
if(this.set && this.setTo && this.isSelected()) {
$tw.utils.pushTop(classes,this.selectedClass.split(" "));
}
if(this.popup && this.isPoppedUp()) {
if(isPoppedUp) {
$tw.utils.pushTop(classes,this.selectedClass.split(" "));
}
}
if(isPoppedUp) {
$tw.utils.pushTop(classes,"tc-popup-handle");
}
domNode.className = classes.join(" ");
// Assign other attributes
if(this.style) {
@@ -101,7 +105,7 @@ ButtonWidget.prototype.isSelected = function() {
ButtonWidget.prototype.isPoppedUp = function() {
var tiddler = this.wiki.getTiddler(this.popup);
var result = tiddler && tiddler.fields.text ? $tw.popup.readPopupState(this.popup,tiddler.fields.text) : false;
var result = tiddler && tiddler.fields.text ? $tw.popup.readPopupState(tiddler.fields.text) : false;
return result;
};