1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-08 10:59:57 +00:00

Merge branch 'master' into demo-alternate-store

This commit is contained in:
Jeremy Ruston 2023-07-28 11:42:40 +01:00
commit bb41ae0c9b
11 changed files with 48 additions and 45 deletions

View File

@ -27,6 +27,11 @@ exports.startup = function() {
if($tw.browser) {
$tw.browser.isIE = (/msie|trident/i.test(navigator.userAgent));
$tw.browser.isFirefox = !!document.mozFullScreenEnabled;
// 2023-07-21 Edge returns UA below. So we use "isChromeLike"
//'mozilla/5.0 (windows nt 10.0; win64; x64) applewebkit/537.36 (khtml, like gecko) chrome/114.0.0.0 safari/537.36 edg/114.0.1823.82'
$tw.browser.isChromeLike = navigator.userAgent.toLowerCase().indexOf("chrome") > -1;
$tw.browser.hasTouch = !!window.matchMedia && window.matchMedia("(pointer: coarse)").matches;
$tw.browser.isMobileChrome = $tw.browser.isChromeLike && $tw.browser.hasTouch;
}
// Platform detection
$tw.platform = {};

View File

@ -106,7 +106,9 @@ exports.makeDraggable = function(options) {
dataTransfer.setData("text/vnd.tiddler",jsonData);
dataTransfer.setData("text/plain",titleString);
dataTransfer.setData("text/x-moz-url","data:text/vnd.tiddler," + encodeURIComponent(jsonData));
} else {
}
// If browser is Chrome-like and has a touch-input device do NOT .setData
if(!($tw.browser.isMobileChrome)) {
dataTransfer.setData("URL","data:text/vnd.tiddler," + encodeURIComponent(jsonData));
}
dataTransfer.setData("Text",titleString);

View File

@ -47,6 +47,8 @@ TranscludeWidget.prototype.execute = function() {
this.sourceText = target.text;
this.parserType = target.type;
this.parseAsInline = target.parseAsInline;
// Set 'thisTiddler'
this.setVariable("thisTiddler",this.transcludeTitle);
// Process the transclusion according to the output type
switch(this.transcludeOutput || "text/html") {
case "text/html":
@ -266,8 +268,6 @@ TranscludeWidget.prototype.getTransclusionTarget = function() {
defaultType: this.transcludeType
});
}
// Set 'thisTiddler'
this.setVariable("thisTiddler",this.transcludeTitle);
// Return the parse tree
if(parser) {
return {

View File

@ -719,46 +719,23 @@ Widget.prototype.findFirstDomNode = function() {
};
/*
Entry into destroy procedure
*/
Widget.prototype.destroyChildren = function() {
$tw.utils.each(this.children,function(childWidget) {
childWidget.destroy();
});
};
/*
Legacy entry into destroy procedure
Remove any DOM nodes created by this widget or its children
*/
Widget.prototype.removeChildDomNodes = function() {
this.destroy();
};
/*
Default destroy
*/
Widget.prototype.destroy = function() {
// call children to remove their resources
this.destroyChildren();
// remove our resources
this.children = [];
this.removeLocalDomNodes();
};
/*
Remove any DOM nodes created by this widget
*/
Widget.prototype.removeLocalDomNodes = function() {
// If this widget has directly created DOM nodes, delete them and exit.
// If this widget has directly created DOM nodes, delete them and exit. This assumes that any child widgets are contained within the created DOM nodes, which would normally be the case
if(this.domNodes.length > 0) {
$tw.utils.each(this.domNodes,function(domNode) {
if(domNode.parentNode) {
domNode.parentNode.removeChild(domNode);
}
});
this.domNodes = [];
} else {
// Otherwise, ask the child widgets to delete their DOM nodes
$tw.utils.each(this.children,function(childWidget) {
childWidget.removeChildDomNodes();
});
}
};
/*
Invoke the action widgets that are descendents of the current widget.
*/

View File

@ -7,7 +7,7 @@ tags: $:/tags/Macro
\define toc-caption()
\whitespace trim
<span class="tc-toc-caption">
<span class="tc-toc-caption tc-tiny-gap-left">
<$set name="tv-wikilinks" value="no">
<$transclude field="caption">
<$view field="title"/>
@ -145,7 +145,7 @@ tags: $:/tags/Macro
<$qualify name="toc-state" title={{{ [[$:/state/toc]addsuffix<__path__>addsuffix[-]addsuffix<currentTiddler>] }}}>
<$set name="toc-item-class" filter=<<__itemClassFilter__>> emptyValue="toc-item-selected" value="toc-item">
<li class=<<toc-item-class>>>
<$list filter="[all[current]tagging[]$sort$limit[1]]" variable="ignore" emptyMessage="<$button class='tc-btn-invisible'>{{$:/core/images/blank}}</$button> <$view field='caption'><$view field='title'/></$view>">
<$list filter="[all[current]tagging[]$sort$limit[1]]" variable="ignore" emptyMessage="""<$button class="tc-btn-invisible">{{$:/core/images/blank}}</$button><span class="toc-item-muted"><<toc-caption>></span>""">
<$reveal type="nomatch" stateTitle=<<toc-state>> text="open">
<$button setTitle=<<toc-state>> setTo="open" class="tc-btn-invisible tc-popup-keep">
<$transclude tiddler=<<toc-closed-icon>> />

View File

@ -9,6 +9,9 @@ type: text/vnd.tiddlywiki
! Overview of v5.3.1
! Reversions of v5.3.0 Changes
* Reverted adding the `widget.destroy()` method because of performance concerns (see https://github.com/Jermolene/TiddlyWiki5/pull/7468)
! Plugin Improvements
@ -40,8 +43,12 @@ Improvements to the following translations:
! Bug Fixes
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7627">> table of contents indentation
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7595">> bindStatus and bindProgress parameters of [[WidgetMessage: tm-http-request]]
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7606">> attribute substitution to handle variables containing non-word characters
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7624">> the pragmas introduced in v5.3.0 so that they can be indented with whitespace
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7619">> size of tiddler icons
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7622">> drag and drop from Chrome-like browsers to Firefox
! Node.js Improvements

View File

@ -1,6 +1,8 @@
caption: Fourth-Caption
created: 20150221194405000
modified: 20211114013601188
tags: Contents [[Table-of-Contents Demonstrations]]
title: Fourth
type: text/vnd.tiddlywiki
<<.toc-lorem>>

View File

@ -2,5 +2,15 @@ created: 20150221194423000
modified: 20211114013601189
tags: SecondThree [[Table-of-Contents Demonstrations]]
title: SecondThreeThree
toc-link: no
type: text/vnd.tiddlywiki
''Important''
It's important that this tiddler has no "child" to be able to visually test every possible toc code-path.
* This tiddler has a field ''toc-link: no''
* Do not tag any other tiddler with the title of this one
<<.toc-lorem>>

View File

@ -1,7 +1,9 @@
caption: Third-Caption
created: 20150221194436000
list: ThirdOne ThirdTwo ThirdThree
modified: 20211114013601191
tags: Contents [[Table-of-Contents Demonstrations]]
title: Third
type: text/vnd.tiddlywiki
<<.toc-lorem>>

View File

@ -537,3 +537,5 @@ Tavin Cole, @tavin, 2023/05/25
WhiteFall, @Zacharia2, 2023/06/04
@oeyoews, 2023/06/30
@catter-fly, 2023/07/27

View File

@ -2779,15 +2779,11 @@ input.tc-palette-manager-colour-input {
white-space: nowrap;
}
.tc-table-of-contents button {
.tc-table-of-contents button,
.tc-table-of-contents .toc-item-muted {
color: <<colour sidebar-foreground>>;
}
button + .tc-toc-caption,
button > .tc-toc-caption{
margin-left: .25em;
}
.tc-table-of-contents svg {
width: 0.7em;
height: 0.7em;