-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add more containment + readd contain-intrinsic-size
- Loading branch information
1 parent
e68211c
commit 5d17fed
Showing
4 changed files
with
89 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/*\ | ||
title: $:/plugins/BTC/TiddlyFlex/modules/widgets/subclasses/transclude.js | ||
type: application/javascript | ||
module-type: widget-subclass | ||
Widget base class | ||
\*/ | ||
(function(){ | ||
|
||
/*jslint node: true, browser: true */ | ||
/*global $tw: false */ | ||
"use strict"; | ||
|
||
exports.baseClass = "transclude"; | ||
|
||
exports.constructor = function(parseTreeNode,options) { | ||
this.initialise(parseTreeNode,options); | ||
}; | ||
|
||
exports.prototype = {}; | ||
|
||
exports.prototype.findParentContainedElement = function() { | ||
var widget = this; | ||
while(widget) { | ||
for(var i=0; i<widget.domNodes.length; i++) { | ||
var domNode = widget.domNodes[i]; | ||
if(domNode.style && domNode.style["contain"]) { | ||
return domNode; | ||
} | ||
} | ||
widget = widget.parentWidget; | ||
} | ||
return null; | ||
}; | ||
|
||
/* | ||
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering | ||
*/ | ||
exports.prototype.refresh = function(changedTiddlers) { | ||
var changedAttributes = this.computeAttributes(); | ||
if(($tw.utils.count(changedAttributes) > 0) || (this.transcludeVariableIsFunction && this.functionNeedsRefresh()) || (!this.transcludeVariable && changedTiddlers[this.transcludeTitle] && this.parserNeedsRefresh())) { | ||
var containedElement = this.findParentContainedElement(); | ||
this.refreshSelf(); | ||
if(containedElement) { | ||
$tw.utils.setStyle(containedElement,[ | ||
{ contain: null } | ||
]); | ||
} | ||
return true; | ||
} else { | ||
return this.refreshChildren(changedTiddlers); | ||
} | ||
}; | ||
|
||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters