From 160cc0e9a90535b7210a2ef021a5389c38ae9917 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Sat, 22 Jul 2023 11:41:36 +0100 Subject: [PATCH 1/7] Revert "Add widget.destroy() function (#7468)" See discussion at https://github.com/Jermolene/TiddlyWiki5/pull/7468#issuecomment-1645753857 --- core/modules/widgets/widget.js | 39 ++++--------------- .../prerelease/tiddlers/Release 5.3.1.tid | 3 ++ 2 files changed, 11 insertions(+), 31 deletions(-) diff --git a/core/modules/widgets/widget.js b/core/modules/widgets/widget.js index 1e6beae25..6c3997179 100755 --- a/core/modules/widgets/widget.js +++ b/core/modules/widgets/widget.js @@ -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); - } + 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. */ diff --git a/editions/prerelease/tiddlers/Release 5.3.1.tid b/editions/prerelease/tiddlers/Release 5.3.1.tid index b950ef3f7..9e1d1e29f 100644 --- a/editions/prerelease/tiddlers/Release 5.3.1.tid +++ b/editions/prerelease/tiddlers/Release 5.3.1.tid @@ -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 From b000f202832f1ca7d8995745122c313e84d8cfd4 Mon Sep 17 00:00:00 2001 From: Mario Pietsch Date: Sat, 22 Jul 2023 13:41:19 +0200 Subject: [PATCH 2/7] Fix toc indentation problem (#7627) * fix toc indentation problem * add caption to Third & Fourth toc tiddlers to see caption-handling * reset modified fields --- core/wiki/macros/toc.tid | 4 ++-- .../demonstrations/TableOfContents/Fourth.tid | 2 ++ .../TableOfContents/SecondThreeThree.tid | 12 +++++++++++- .../demonstrations/TableOfContents/Third.tid | 2 ++ themes/tiddlywiki/vanilla/base.tid | 10 +++------- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/core/wiki/macros/toc.tid b/core/wiki/macros/toc.tid index 528c0e63c..a925e7ee5 100644 --- a/core/wiki/macros/toc.tid +++ b/core/wiki/macros/toc.tid @@ -7,7 +7,7 @@ tags: $:/tags/Macro \define toc-caption() \whitespace trim - + <$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] }}}> <$set name="toc-item-class" filter=<<__itemClassFilter__>> emptyValue="toc-item-selected" value="toc-item">
  • >> - <$list filter="[all[current]tagging[]$sort$limit[1]]" variable="ignore" emptyMessage="<$button class='tc-btn-invisible'>{{$:/core/images/blank}} <$view field='caption'><$view field='title'/>"> + <$list filter="[all[current]tagging[]$sort$limit[1]]" variable="ignore" emptyMessage="""<$button class="tc-btn-invisible">{{$:/core/images/blank}}<>"""> <$reveal type="nomatch" stateTitle=<> text="open"> <$button setTitle=<> setTo="open" class="tc-btn-invisible tc-popup-keep"> <$transclude tiddler=<> /> diff --git a/editions/tw5.com/tiddlers/demonstrations/TableOfContents/Fourth.tid b/editions/tw5.com/tiddlers/demonstrations/TableOfContents/Fourth.tid index dd9d0b78f..cdd9850d8 100644 --- a/editions/tw5.com/tiddlers/demonstrations/TableOfContents/Fourth.tid +++ b/editions/tw5.com/tiddlers/demonstrations/TableOfContents/Fourth.tid @@ -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>> diff --git a/editions/tw5.com/tiddlers/demonstrations/TableOfContents/SecondThreeThree.tid b/editions/tw5.com/tiddlers/demonstrations/TableOfContents/SecondThreeThree.tid index be826c19b..c7fdf343b 100644 --- a/editions/tw5.com/tiddlers/demonstrations/TableOfContents/SecondThreeThree.tid +++ b/editions/tw5.com/tiddlers/demonstrations/TableOfContents/SecondThreeThree.tid @@ -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>> diff --git a/editions/tw5.com/tiddlers/demonstrations/TableOfContents/Third.tid b/editions/tw5.com/tiddlers/demonstrations/TableOfContents/Third.tid index f8a51f8d2..7e2c7c7e1 100644 --- a/editions/tw5.com/tiddlers/demonstrations/TableOfContents/Third.tid +++ b/editions/tw5.com/tiddlers/demonstrations/TableOfContents/Third.tid @@ -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>> diff --git a/themes/tiddlywiki/vanilla/base.tid b/themes/tiddlywiki/vanilla/base.tid index 0feb2582e..4603589ae 100644 --- a/themes/tiddlywiki/vanilla/base.tid +++ b/themes/tiddlywiki/vanilla/base.tid @@ -580,7 +580,7 @@ button svg, button img, label svg, label img { } button:disabled.tc-btn-invisible { - cursor: default; + cursor: default; color: <>; } @@ -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: <>; } -button + .tc-toc-caption, -button > .tc-toc-caption{ - margin-left: .25em; -} - .tc-table-of-contents svg { width: 0.7em; height: 0.7em; From 3ddb852a161a95dc3c45f9cdddef1ba31e4dbf25 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Sat, 22 Jul 2023 12:46:08 +0100 Subject: [PATCH 3/7] Update release note --- editions/prerelease/tiddlers/Release 5.3.1.tid | 3 +++ 1 file changed, 3 insertions(+) diff --git a/editions/prerelease/tiddlers/Release 5.3.1.tid b/editions/prerelease/tiddlers/Release 5.3.1.tid index 9e1d1e29f..8f8ce1f0f 100644 --- a/editions/prerelease/tiddlers/Release 5.3.1.tid +++ b/editions/prerelease/tiddlers/Release 5.3.1.tid @@ -43,8 +43,11 @@ 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 ! Node.js Improvements From ad6e09f1cbb3a3918b6855c653bd6ea418317054 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Sat, 22 Jul 2023 14:01:24 +0100 Subject: [PATCH 4/7] Minor refactor transclude widget Preparing to fix #7592 --- core/modules/widgets/transclude.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/modules/widgets/transclude.js b/core/modules/widgets/transclude.js index 7b4b9581d..05d03a702 100755 --- a/core/modules/widgets/transclude.js +++ b/core/modules/widgets/transclude.js @@ -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 { From e60232e0cbea408e891caaebe9ee6a8caa21033b Mon Sep 17 00:00:00 2001 From: Mario Pietsch Date: Sat, 22 Jul 2023 16:47:39 +0200 Subject: [PATCH 5/7] Fix drag and drop from chrome-like browsers to FireFox (#7622) * fix drag and drop from chrome-like browsers to FireFox * test feature matchMedia function * implement new borwser sniffing functions as utilities * use $tw.browser structure for isMobileChrome detection --- core/modules/startup/startup.js | 5 +++++ core/modules/utils/dom/dragndrop.js | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/core/modules/startup/startup.js b/core/modules/startup/startup.js index e0990228f..e09f6393f 100755 --- a/core/modules/startup/startup.js +++ b/core/modules/startup/startup.js @@ -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 = {}; diff --git a/core/modules/utils/dom/dragndrop.js b/core/modules/utils/dom/dragndrop.js index 0b5360216..c7c32cbaf 100644 --- a/core/modules/utils/dom/dragndrop.js +++ b/core/modules/utils/dom/dragndrop.js @@ -80,7 +80,7 @@ exports.makeDraggable = function(options) { if(dataTransfer.setDragImage) { if(dragImageType === "pill") { dataTransfer.setDragImage(dragImage.firstChild,-16,-16); - } else if (dragImageType === "blank") { + } else if(dragImageType === "blank") { dragImage.removeChild(dragImage.firstChild); dataTransfer.setDragImage(dragImage,0,0); } else { @@ -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); From 1a92fd5dc0455659c0529f0169f429f00443223d Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Sat, 22 Jul 2023 15:51:39 +0100 Subject: [PATCH 6/7] Update release note --- editions/prerelease/tiddlers/Release 5.3.1.tid | 1 + 1 file changed, 1 insertion(+) diff --git a/editions/prerelease/tiddlers/Release 5.3.1.tid b/editions/prerelease/tiddlers/Release 5.3.1.tid index 8f8ce1f0f..5c49b72fe 100644 --- a/editions/prerelease/tiddlers/Release 5.3.1.tid +++ b/editions/prerelease/tiddlers/Release 5.3.1.tid @@ -48,6 +48,7 @@ Improvements to the following translations: * <<.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 From afcbac5e866633f15455ac08e0f99b8bfffd6191 Mon Sep 17 00:00:00 2001 From: catter-fly <58158127+catter-fly@users.noreply.github.com> Date: Thu, 27 Jul 2023 13:23:08 -0400 Subject: [PATCH 7/7] Signing CLA (#7643) * Signing CLA * Fix double entry --------- Co-authored-by: Jeremy Ruston --- licenses/cla-individual.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/licenses/cla-individual.md b/licenses/cla-individual.md index e6b394653..c02612029 100644 --- a/licenses/cla-individual.md +++ b/licenses/cla-individual.md @@ -537,3 +537,5 @@ Tavin Cole, @tavin, 2023/05/25 WhiteFall, @Zacharia2, 2023/06/04 @oeyoews, 2023/06/30 + +@catter-fly, 2023/07/27