From 4d040d2499e51adba369562e1f8e0d547cfb334f Mon Sep 17 00:00:00 2001 From: twMat Date: Mon, 16 Jan 2023 13:56:51 +0100 Subject: [PATCH 01/34] Docs: Update is.tid (#7213) Ref [discussion](https://talk.tiddlywiki.org/t/filter-q-is-tiddler-or-shadow-how/5888) --- editions/tw5.com/tiddlers/filters/is.tid | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/editions/tw5.com/tiddlers/filters/is.tid b/editions/tw5.com/tiddlers/filters/is.tid index a38f8315f..cc23a9598 100644 --- a/editions/tw5.com/tiddlers/filters/is.tid +++ b/editions/tw5.com/tiddlers/filters/is.tid @@ -33,6 +33,8 @@ If <<.place C>> is anything else an error message is returned. <<.from-version " When <<.op is[missing]>> is the first operator in a [[run|Filter Run]], its output is always empty. And when <<.op is[shadow]>> comes first, it outputs only those shadow tiddlers that have been overridden. This is because the [[initial input to a run|Filter Expression]] contains only <<.em non>>-shadow tiddlers. -The <<.olink all>> operator is similar, but its scope is the whole wiki. +<<.tip "Use `has[title]` to match any tiddler title that is either a tiddler //or// a shadow tiddler.">> -<<.operator-examples "is">> \ No newline at end of file +The <<.olink all>> operator is similar to <<.olink is>>, but its scope is the whole wiki. + +<<.operator-examples "is">> From 34643a42790777f1b235f57b5093bb29bd0b3a14 Mon Sep 17 00:00:00 2001 From: "jeremy@jermolene.com" Date: Mon, 16 Jan 2023 13:21:40 +0000 Subject: [PATCH 02/34] Add icon to default page layout and show in switcher Thanks @linonetwo Fixes #7197 --- core/ui/LayoutSwitcher.tid | 4 ++-- core/ui/PageTemplate.tid | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/core/ui/LayoutSwitcher.tid b/core/ui/LayoutSwitcher.tid index 2c5243553..0f7e3f15e 100644 --- a/core/ui/LayoutSwitcher.tid +++ b/core/ui/LayoutSwitcher.tid @@ -13,13 +13,13 @@ caption: {{$:/language/ControlPanel/LayoutSwitcher/Caption}} <$set name="cls" filter="[all[current]field:title{$:/layout}]" value="tc-chooser-item tc-chosen" emptyValue="tc-chooser-item">
>> <$link to={{!!title}}> - ''<$transclude field="name"/>'' - <$transclude field="description"/> + ''<$transclude tiddler={{{ [get[icon]] }}}/><$transclude field="name"/>'' - <$transclude field="description"/>
"""> <$set name="cls" filter="[all[current]field:title[$:/core/ui/PageTemplate]]" value="tc-chooser-item tc-chosen" emptyValue="tc-chooser-item">
>> <$link to={{!!title}}> -''<$transclude field="name"/>'' - <$transclude field="description"/> +''<$transclude tiddler={{{ [get[icon]] }}}/><$transclude field="name"/>'' - <$transclude field="description"/>
diff --git a/core/ui/PageTemplate.tid b/core/ui/PageTemplate.tid index c9e929551..892e1b166 100644 --- a/core/ui/PageTemplate.tid +++ b/core/ui/PageTemplate.tid @@ -1,6 +1,7 @@ title: $:/core/ui/PageTemplate name: {{$:/language/PageTemplate/Name}} description: {{$:/language/PageTemplate/Description}} +icon: $:/core/images/layout-button \whitespace trim \import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]] From 0039c2134bfa9266c879079cdcef91e455b4217d Mon Sep 17 00:00:00 2001 From: "jeremy@jermolene.com" Date: Mon, 16 Jan 2023 14:05:36 +0000 Subject: [PATCH 03/34] Use correct image for Mastodon link --- editions/tw5.com/tiddlers/hellothere/HelloThere.tid | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editions/tw5.com/tiddlers/hellothere/HelloThere.tid b/editions/tw5.com/tiddlers/hellothere/HelloThere.tid index bcb85c071..d80da69c4 100644 --- a/editions/tw5.com/tiddlers/hellothere/HelloThere.tid +++ b/editions/tw5.com/tiddlers/hellothere/HelloThere.tid @@ -32,7 +32,7 @@ Unlike conventional online services, TiddlyWiki lets you choose where to keep yo {{$:/core/images/twitter}} Twitter -{{$:/core/images/globe}} Mastodon +{{$:/core/images/mastodon}} Mastodon {{$:/core/images/github}} ~GitHub From fecb7edca4068173c6054fe337c2265959ea8dcd Mon Sep 17 00:00:00 2001 From: "jeremy@jermolene.com" Date: Mon, 16 Jan 2023 19:34:02 +0000 Subject: [PATCH 04/34] Fix typo in messagecatcher widget I think this was a copy-paste error, but would appreciate other eyes on this... --- core/modules/widgets/messagecatcher.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/modules/widgets/messagecatcher.js b/core/modules/widgets/messagecatcher.js index 85a3561f2..1457cd11f 100644 --- a/core/modules/widgets/messagecatcher.js +++ b/core/modules/widgets/messagecatcher.js @@ -82,7 +82,7 @@ MessageCatcherWidget.prototype.render = function(parent,nextSibling) { } }); // Render children - this.renderChildren(parent,null); + this.renderChildren(parent,nextSibling); }; /* From 166f68cc15f2b85371efae2effae7a051c4b5308 Mon Sep 17 00:00:00 2001 From: yaisog Date: Tue, 17 Jan 2023 13:31:07 +0100 Subject: [PATCH 05/34] Improve \parsermode documentation (#7214) --- editions/tw5.com/tiddlers/concepts/Pragma.tid | 6 ++++-- .../tiddlers/pragmas/Pragma_ _parsermode.tid | 16 ++++++---------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/editions/tw5.com/tiddlers/concepts/Pragma.tid b/editions/tw5.com/tiddlers/concepts/Pragma.tid index 05a29a2cc..4c39b022c 100644 --- a/editions/tw5.com/tiddlers/concepts/Pragma.tid +++ b/editions/tw5.com/tiddlers/concepts/Pragma.tid @@ -1,5 +1,5 @@ created: 20150219175930000 -modified: 20220122182842041 +modified: 20230117112239663 tags: Concepts [[WikiText Parser Modes]] title: Pragma type: text/vnd.tiddlywiki @@ -17,4 +17,6 @@ The following pragmas are available: ;`\whitespace trim` or `\whitespace notrim` : <<.from-version "5.1.15">> Control whether whitespace is trimmed from the start and end of text runs (the default is ''notrim''). This setting can be useful when the whitespace generated by linebreaks disturbs formatting ;`\import ` -: <<.from-version "5.1.18">> for importing macro definitions from tiddlers identified by a filter expression +: <<.from-version "5.1.18">> Import macro definitions from tiddlers identified by a filter expression +;`\parsermode block` or `\parsermode inline` +: <<.from-version "5.2.4">> Adjust whether the remaining text is parsed in block mode or inline mode. \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/pragmas/Pragma_ _parsermode.tid b/editions/tw5.com/tiddlers/pragmas/Pragma_ _parsermode.tid index 2b0444ef4..13574551a 100644 --- a/editions/tw5.com/tiddlers/pragmas/Pragma_ _parsermode.tid +++ b/editions/tw5.com/tiddlers/pragmas/Pragma_ _parsermode.tid @@ -1,17 +1,13 @@ created: 20221123223127425 -modified: 20221123223127425 -tags: Pragmas +modified: 20230117112244779 +tags: Pragma title: Pragma: \parsermode type: text/vnd.tiddlywiki -The ''\parsermode'' [[pragma|Pragmas]] adjusts whether the remaining text is parsed in block mode or inline mode. See [[WikiText Parser Modes]] for details of parser modes. +<<.from-version "5.2.4">> -``` -\parsermode block|inline -``` +The ''\parsermode'' [[pragma|Pragma]] adjusts whether the remaining text is parsed in block mode or inline mode. See [[WikiText Parser Modes]] for details of parser modes. -For example: +As with all pragmas, setting the parser mode this way can only be done at the start of text, not within the main body of the text. -``` -\parsermode inline -``` +;`\parsermode block` or `\parsermode inline` From 8f7441f296351a4dd0852c3c782f8874d398e052 Mon Sep 17 00:00:00 2001 From: "jeremy@jermolene.com" Date: Tue, 17 Jan 2023 14:34:06 +0000 Subject: [PATCH 06/34] Share plugin: Further fixes to c39ef398bffae12c0ed7324d9b6d9d29f0f2f9ff See https://talk.tiddlywiki.org/t/revived-share-plugin/5887/14 Thanks @btheado --- boot/boot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boot/boot.js b/boot/boot.js index aeaa919fe..1a06c843f 100644 --- a/boot/boot.js +++ b/boot/boot.js @@ -313,7 +313,7 @@ $tw.utils.getLocationHash = function() { var idx = href.indexOf('#'); if(idx === -1) { return "#"; - } else if(idx < href.length-1 && href[idx+1] === '#') { + } else if(href.substr(idx + 1,1) === "#" || href.substr(idx + 1,3) === "%23") { // Special case: ignore location hash if it itself starts with a # return "#"; } else { From e41511c6523d58b3fce92b2cc55a6a2b87c6f9cd Mon Sep 17 00:00:00 2001 From: Mario Pietsch Date: Tue, 17 Jan 2023 15:57:49 +0100 Subject: [PATCH 07/34] make core/ui/MoreSideBar/Tags look nice in the story river (#7212) --- core/ui/MoreSideBar/Tags.tid | 27 +++++++++------------------ core/ui/UntaggedTemplate.tid | 8 +++----- themes/tiddlywiki/vanilla/base.tid | 11 ++++++++--- 3 files changed, 20 insertions(+), 26 deletions(-) diff --git a/core/ui/MoreSideBar/Tags.tid b/core/ui/MoreSideBar/Tags.tid index 6eeb010be..0a4727bc3 100644 --- a/core/ui/MoreSideBar/Tags.tid +++ b/core/ui/MoreSideBar/Tags.tid @@ -2,26 +2,17 @@ title: $:/core/ui/MoreSideBar/Tags tags: $:/tags/MoreSideBar caption: {{$:/language/SideBar/Tags/Caption}} -<$set name="tv-config-toolbar-icons" value="yes"> - -<$set name="tv-config-toolbar-text" value="yes"> - -<$set name="tv-config-toolbar-class" value=""> - -{{$:/core/ui/Buttons/tag-manager}} - - - - - - +\whitespace trim +<$let tv-config-toolbar-icons="yes" tv-config-toolbar-text="yes" tv-config-toolbar-class=""> +
+ {{$:/core/ui/Buttons/tag-manager}} +
+ <$list filter={{$:/core/Filters/AllTags!!filter}}> - -<$transclude tiddler="$:/core/ui/TagTemplate"/> - +
+ <$transclude tiddler="$:/core/ui/TagTemplate"/> +
-
- {{$:/core/ui/UntaggedTemplate}} diff --git a/core/ui/UntaggedTemplate.tid b/core/ui/UntaggedTemplate.tid index 95ebcd695..d5cd97006 100644 --- a/core/ui/UntaggedTemplate.tid +++ b/core/ui/UntaggedTemplate.tid @@ -3,10 +3,8 @@ title: $:/core/ui/UntaggedTemplate \define lingo-base() $:/language/SideBar/ \whitespace trim <$button popup=<> class="tc-btn-invisible tc-untagged-label tc-tag-label"> -<> + <> -<$reveal state=<> type="popup" position="below"> -
-<$list filter="[untagged[]!is[system]] -[tags[]] +[sort[title]]" template="$:/core/ui/ListItemTemplate"/> -
+<$reveal class="tc-drop-down" tag="div" state=<> type="popup" position="below"> + <$list filter="[untagged[]!is[system]] -[tags[]] +[sort[title]]" template="$:/core/ui/ListItemTemplate"/> diff --git a/themes/tiddlywiki/vanilla/base.tid b/themes/tiddlywiki/vanilla/base.tid index baf195107..027541cc7 100644 --- a/themes/tiddlywiki/vanilla/base.tid +++ b/themes/tiddlywiki/vanilla/base.tid @@ -814,9 +814,6 @@ button.tc-tag-label, span.tc-tag-label { } .tc-untagged-separator { - width: 10em; - left: 0; - margin-left: 0; border: 0; height: 1px; background: <>; @@ -3137,6 +3134,8 @@ select { ** Other utility classes */ +/* Horizontal gaps */ + .tc-tiny-gap { margin-left: .25em; margin-right: .25em; @@ -3179,3 +3178,9 @@ select { .tc-word-break { word-break: break-all; } + +/* Vertical gaps */ + +.tc-tiny-v-gap-bottom { + margin-bottom: 3px; +} \ No newline at end of file From c51816e8260e1423a0b415c041d40f711ca10422 Mon Sep 17 00:00:00 2001 From: Mario Pietsch Date: Tue, 17 Jan 2023 16:02:57 +0100 Subject: [PATCH 08/34] Fix pasting of multiple types at once (#6622) * wip fix dropzone closure variable problem * just a new commit to autocreate at test wiki --- core/modules/widgets/dropzone.js | 51 ++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/core/modules/widgets/dropzone.js b/core/modules/widgets/dropzone.js index efa08162c..729ad26ed 100644 --- a/core/modules/widgets/dropzone.js +++ b/core/modules/widgets/dropzone.js @@ -232,10 +232,32 @@ DropZoneWidget.prototype.handleDropEvent = function(event) { }; DropZoneWidget.prototype.handlePasteEvent = function(event) { - var self = this, - readFileCallback = function(tiddlerFieldsArray) { + var self = this; + var readFileCallback = function(tiddlerFieldsArray) { self.readFileCallback(tiddlerFieldsArray); }; + var getItem = function(type) { + type = type || "text/plain"; + return function(str) { + // Use the deserializer specified if any + if(self.dropzoneDeserializer) { + tiddlerFields = self.wiki.deserializeTiddlers(null,str,{title: self.wiki.generateNewTitle("Untitled " + type)},{deserializer:self.dropzoneDeserializer}); + if(tiddlerFields && tiddlerFields.length) { + readFileCallback(tiddlerFields); + } + } else { + tiddlerFields = { + title: self.wiki.generateNewTitle("Untitled " + type), + text: str, + type: type + }; + if($tw.log.IMPORT) { + console.log("Importing string '" + str + "', type: '" + type + "'"); + } + readFileCallback([tiddlerFields]); + } + } + }; // Let the browser handle it if we're in a textarea or input box if(["TEXTAREA","INPUT"].indexOf(event.target.tagName) == -1 && !event.target.isContentEditable) { var self = this, @@ -251,27 +273,10 @@ DropZoneWidget.prototype.handlePasteEvent = function(event) { }); } else if(item.kind === "string") { // Create tiddlers from string items - var tiddlerFields, - type = item.type; - item.getAsString(function(str) { - // Use the deserializer specified if any - if(self.dropzoneDeserializer) { - tiddlerFields = self.wiki.deserializeTiddlers(null,str,{title: self.wiki.generateNewTitle("Untitled")},{deserializer:self.dropzoneDeserializer}); - if(tiddlerFields && tiddlerFields.length) { - readFileCallback(tiddlerFields); - } - } else { - tiddlerFields = { - title: self.wiki.generateNewTitle("Untitled"), - text: str, - type: type - }; - if($tw.log.IMPORT) { - console.log("Importing string '" + str + "', type: '" + type + "'"); - } - readFileCallback([tiddlerFields]); - } - }); + var tiddlerFields; + // It's important to give getAsString a closure with the right type + // So it can be added to the import queue + item.getAsString(getItem(item.type)); } } // Tell the browser that we've handled the paste From db88eed88f5fa8db9390e1288dd4c673c70e6fe5 Mon Sep 17 00:00:00 2001 From: Mario Pietsch Date: Tue, 17 Jan 2023 17:45:51 +0100 Subject: [PATCH 09/34] Improve docs for genesis-widget (#7174) * Improve docs for genesis-widget * improve wording * use <<.attr macro instead of <<.param --- .../tiddlers/widgets/GenesisWidget.tid | 24 ++++++++++++------- .../tiddlers/wikitext/HTML in WikiText.tid | 11 +++++++-- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/editions/tw5.com/tiddlers/widgets/GenesisWidget.tid b/editions/tw5.com/tiddlers/widgets/GenesisWidget.tid index 4f60c96dc..acc4c36ec 100644 --- a/editions/tw5.com/tiddlers/widgets/GenesisWidget.tid +++ b/editions/tw5.com/tiddlers/widgets/GenesisWidget.tid @@ -1,34 +1,34 @@ caption: genesis created: 20221101100729587 -modified: 20221101100729587 +modified: 20230115101800345 tags: Widgets title: GenesisWidget type: text/vnd.tiddlywiki ! Introduction -<<.from-version "5.2.4">> The <<.wlink GenesisWidget>> widget allows the dynamic construction of another widget, where the name and attributes of the new widget can be dynamically determined, without needing to be known in advance. +<<.from-version "5.2.4">> The <<.wid genesis>> widget allows the dynamic construction of another widget, where the name and attributes of the new widget can be dynamically determined, without needing to be known in advance. ! Content and Attributes -The content of the <<.wlink GenesisWidget>> widget is used as the content of the dynamically created widget. +The content of the <<.wid genesis>> widget is used as the content of the dynamically created widget. |!Attribute |!Description | |$type |The type of widget or element to create (an initial `$` indicates a widget, otherwise an HTML element will be created) | |$names |An optional filter evaluating to the names of a list of attributes to be applied to the widget | -|$values |An optional filter evaluating to the values corresponding to the list of names specified in `$names` | +|$values |An optional filter evaluating to the values corresponding to the list of names specified in <<.attr $names>> | |//{other attributes starting with $}// |Other attributes starting with a single dollar sign are reserved for future use | |//{attributes starting with $$}// |Attributes starting with two dollar signs are applied as attributes to the output widget, but with the attribute name changed to use a single dollar sign | |//{attributes not starting with $}// |Any other attributes that do not start with a dollar are applied as attributes to the output widget | -Note that attributes explicitly specified take precedence over attributes with the same name specified in the `$names` filter. +<<.tip """Note that attributes explicitly specified take precedence over attributes with the same name specified in the <<.attr $names>> filter.""">> ! Examples -<$macrocall $name='wikitext-example-without-html' -src='<$genesis $type="div" class="tc-thing" label="Squeak">Mouse'/> +<$macrocall $name="wikitext-example" +src="""<$genesis $type="div" class="tc-thing" label="Squeak">Mouse"""/> -<$macrocall $name='wikitext-example-without-html' +<$macrocall $name="wikitext-example" src="""\define my-banner(mode:"inline",caption) <$genesis $type={{{ [<__mode__>match[inline]then[span]else[div]] }}} class="tc-mybanner"> <<__caption__>> @@ -39,3 +39,11 @@ src="""\define my-banner(mode:"inline",caption) <> """/> + +! Important + +<$macrocall $name=".warning" _=""" +In the following example the widget attribute named `one` is absent from the HTML output, since HTML attributes with the prefix `on` are removed for security reasons. See [[HTML in WikiText]] "Security" for more details. + +<Test Genesis Widget'>> +"""/> \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/wikitext/HTML in WikiText.tid b/editions/tw5.com/tiddlers/wikitext/HTML in WikiText.tid index 544c3c5fc..ea926336d 100644 --- a/editions/tw5.com/tiddlers/wikitext/HTML in WikiText.tid +++ b/editions/tw5.com/tiddlers/wikitext/HTML in WikiText.tid @@ -1,6 +1,6 @@ caption: HTML created: 20131205160816081 -modified: 20220123174919252 +modified: 20230115100934146 tags: WikiText title: HTML in WikiText type: text/vnd.tiddlywiki @@ -31,7 +31,14 @@ some text ! Important -<<.tip """[[Widgets share the same syntax as HTML tags|Widgets in WikiText]], and so the following information applies to them, too.""">> +!! Security + +<<.warning """Every HTML attribute prefixed with `on` is removed from rendered HTML content for security reasons. eg: `onclick="some evil code"` would be executed, if no sanitation is active. In ~TiddlyWiki It's important to remove every attribute prefixed with `on` so future extensions to the HTML spec will be secure by default. This can lead to some inconvenience since custom attributes like eg: `one` are removed too. """>> + +!! Widgets + +<<.tip """[[Widgets share the same syntax as HTML tags|Widgets in WikiText]]
and so the following information applies to them, too.""">> + ! Block mode versus Inline mode From 45468285413ca4b5564e74c3832724b796716657 Mon Sep 17 00:00:00 2001 From: "jeremy@jermolene.com" Date: Tue, 17 Jan 2023 16:56:25 +0000 Subject: [PATCH 10/34] Genesis widget rewording --- editions/tw5.com/tiddlers/widgets/GenesisWidget.tid | 3 +-- editions/tw5.com/tiddlers/wikitext/HTML in WikiText.tid | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/editions/tw5.com/tiddlers/widgets/GenesisWidget.tid b/editions/tw5.com/tiddlers/widgets/GenesisWidget.tid index acc4c36ec..e37183c8a 100644 --- a/editions/tw5.com/tiddlers/widgets/GenesisWidget.tid +++ b/editions/tw5.com/tiddlers/widgets/GenesisWidget.tid @@ -43,7 +43,6 @@ src="""\define my-banner(mode:"inline",caption) ! Important <$macrocall $name=".warning" _=""" -In the following example the widget attribute named `one` is absent from the HTML output, since HTML attributes with the prefix `on` are removed for security reasons. See [[HTML in WikiText]] "Security" for more details. +In the following example the widget attribute named `one` is not present in the HTML output. This is because HTML attributes starting with the prefix `on` are removed for security reasons. See [[HTML in WikiText]] "Security" for more details. This restriction only affects generated HTML elements, and does not prevent the use of attributes prefixed `on` with other widgets"""/> <Test Genesis Widget'>> -"""/> \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/wikitext/HTML in WikiText.tid b/editions/tw5.com/tiddlers/wikitext/HTML in WikiText.tid index ea926336d..15d8b0a2f 100644 --- a/editions/tw5.com/tiddlers/wikitext/HTML in WikiText.tid +++ b/editions/tw5.com/tiddlers/wikitext/HTML in WikiText.tid @@ -33,7 +33,7 @@ some text !! Security -<<.warning """Every HTML attribute prefixed with `on` is removed from rendered HTML content for security reasons. eg: `onclick="some evil code"` would be executed, if no sanitation is active. In ~TiddlyWiki It's important to remove every attribute prefixed with `on` so future extensions to the HTML spec will be secure by default. This can lead to some inconvenience since custom attributes like eg: `one` are removed too. """>> +<<.warning """Note that any HTML attributes prefixed with `on` are removed from the rendered HTML content. This is done to prevent event handlers (such as "onclick") being used as a clandestine way to execute untrusted JavaScript. A design goal of TiddlyWiki is to ensure that executable JavaScript can only enter the system through explicit JavaScript module tiddlers or raw markup tiddlers. This makes it possible to filter unsafe content in multiuser environments, and also makes it safer to copy untrusted wikitext examples.""">> !! Widgets From 5bf60cd26f835c92ca6bc4152eea80861b167872 Mon Sep 17 00:00:00 2001 From: "jeremy@jermolene.com" Date: Tue, 17 Jan 2023 16:56:52 +0000 Subject: [PATCH 11/34] Remove some contractions that have crept in They do not belong in technical documentation --- editions/tw5.com/tiddlers/filters/indexes.tid | 2 +- editions/tw5.com/tiddlers/saving/Saving via WebDAV.tid | 2 +- editions/tw5.com/tiddlers/wikitext/HTML in WikiText.tid | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/editions/tw5.com/tiddlers/filters/indexes.tid b/editions/tw5.com/tiddlers/filters/indexes.tid index 44b5fbf50..a65784118 100644 --- a/editions/tw5.com/tiddlers/filters/indexes.tid +++ b/editions/tw5.com/tiddlers/filters/indexes.tid @@ -11,7 +11,7 @@ op-output: all the property names or indices contained in the input data tiddler Each input title is processed in turn, and is ignored if it does not denote a [[data tiddler|DataTiddlers]]. The sorted list of property names is retrieved from the data tiddler and then [[dominantly appended|Dominant Append]] to the operator's output. -Note that behind the scenes, the name/value pairs in a dictionary tiddler are represented as a [[JSON object|JSONTiddlers]]. JSON objects do not maintain a guaranteed ordering and so we can’t reliably retain the ordering of the data in the file. +Note that behind the scenes, the name/value pairs in a dictionary tiddler are represented as a [[JSON object|JSONTiddlers]]. JSON objects do not maintain a guaranteed ordering and so we cannot reliably retain the ordering of the data in the file. Where the content of a tiddler is in JSON format with an array as its root, the <<.op indexes>> operator retrieves a selection of integer indices instead. diff --git a/editions/tw5.com/tiddlers/saving/Saving via WebDAV.tid b/editions/tw5.com/tiddlers/saving/Saving via WebDAV.tid index fe10ad98e..63959a1d6 100644 --- a/editions/tw5.com/tiddlers/saving/Saving via WebDAV.tid +++ b/editions/tw5.com/tiddlers/saving/Saving via WebDAV.tid @@ -34,7 +34,7 @@ Lightweight, portable and easy to use solutions * ~SharePoint / ~OneDrive for Windows ** Save your ~TiddlyWiki file with an `.aspx` extension ** Copy it to a ~SharePoint/~OneDrive for Business sync'd library -** As long as ~WebDAV hasn’t been disabled, renaming single-file wiki from .html to .aspx “just works” when stored in one of these folders +** As long as ~WebDAV has not been disabled, renaming single-file wiki from .html to .aspx “just works” when stored in one of these folders ** This //might// work with Mac also. !! OSX diff --git a/editions/tw5.com/tiddlers/wikitext/HTML in WikiText.tid b/editions/tw5.com/tiddlers/wikitext/HTML in WikiText.tid index 15d8b0a2f..d000cd975 100644 --- a/editions/tw5.com/tiddlers/wikitext/HTML in WikiText.tid +++ b/editions/tw5.com/tiddlers/wikitext/HTML in WikiText.tid @@ -54,7 +54,7 @@ The following tags are treated as 'void'. This means that `` is treated as * ``, ``, `
`, ``, ``, ``, `
`, ``, ``, ``, ``, ``, ``, ``, ``, `` -If you don’t close any other tag then it will behave as if the missing closing tag were at the end of the tiddler. +If you do not close any other tag then it will behave as if the missing closing tag were at the end of the tiddler. ! Attributes @@ -121,7 +121,7 @@ attr={{tiddler}} attr={{!!field}} attr={{tiddler!!field}} ``` -<<.warning "The attribute's value will be the exact text retrieved from the TextReference. Any wiki syntax in that text will be left as-is.">> +<<.warning "The value of the attribute value will be the exact text retrieved from the TextReference. Any wiki syntax in that text will be left as-is.">> !! Variable Attribute Values @@ -132,7 +132,7 @@ Variable attribute values are indicated with double angle brackets around a [[ma ... ``` -<<.warning "The text from the macro's definition will be retrieved and text substitution will be performed (i.e. <<.param $param$>> and <<.param $(...)$>> syntax). The attribute's value will be the resulting text. Any wiki syntax in that text (including further macro calls and variable references) will be left as-is.">> +<<.warning "The text from the definition of the macro will be retrieved and text substitution will be performed (i.e. <<.param $param$>> and <<.param $(...)$>> syntax). The value of the attribute value will be the resulting text. Any wiki syntax in that text (including further macro calls and variable references) will be left as-is.">> !! Filtered Attribute Values @@ -145,4 +145,4 @@ This example shows how to add a prefix to a value: ``` <$text text={{{ [addprefix[$:/myprefix/]] }}} /> ``` -<<.warning "The attribute's value will be the exact text from the first item in the resulting list. Any wiki syntax in that text will be left as-is.">> +<<.warning "The value of the attribute will be the exact text from the first item in the resulting list. Any wiki syntax in that text will be left as-is.">> From af1cc56c0c3f9c933f34278b4b85d43493a11ba8 Mon Sep 17 00:00:00 2001 From: Mario Pietsch Date: Tue, 17 Jan 2023 18:29:08 +0100 Subject: [PATCH 12/34] [DOC] Improve ActionCreateTiddlerWidget documentation (#7202) * [DOC] Improve ActionCreateTiddlerWidget documentation * action-createtitddler improve docs as requested --- .../ActionCreateTiddlerWidget Example 1.tid | 2 +- .../ActionCreateTiddlerWidget Example 2.tid | 2 +- .../ActionCreateTiddlerWidget Example 3.tid | 2 +- .../ActionCreateTiddlerWidget Example 4.tid | 2 +- .../ActionCreateTiddlerWidget Example 5.tid | 32 +++++++++++++++++++ .../widgets/ActionCreateTiddlerWidget.tid | 27 ++++++++++------ .../ActionCreateTiddlerWidget_Example.tid | 2 +- 7 files changed, 55 insertions(+), 14 deletions(-) create mode 100644 editions/tw5.com/tiddlers/widgets/ActionCreateTiddlerWidget Example 5.tid diff --git a/editions/tw5.com/tiddlers/widgets/ActionCreateTiddlerWidget Example 1.tid b/editions/tw5.com/tiddlers/widgets/ActionCreateTiddlerWidget Example 1.tid index 713b6b156..57aee6673 100644 --- a/editions/tw5.com/tiddlers/widgets/ActionCreateTiddlerWidget Example 1.tid +++ b/editions/tw5.com/tiddlers/widgets/ActionCreateTiddlerWidget Example 1.tid @@ -1,6 +1,6 @@ created: 20200131142401129 modified: 20211113230406823 -tags: ActionCreateTiddlerWidget Widgets +tags: ActionCreateTiddlerWidget title: ActionCreateTiddlerWidget Example 1 type: text/vnd.tiddlywiki diff --git a/editions/tw5.com/tiddlers/widgets/ActionCreateTiddlerWidget Example 2.tid b/editions/tw5.com/tiddlers/widgets/ActionCreateTiddlerWidget Example 2.tid index bfb0d759f..336972a16 100644 --- a/editions/tw5.com/tiddlers/widgets/ActionCreateTiddlerWidget Example 2.tid +++ b/editions/tw5.com/tiddlers/widgets/ActionCreateTiddlerWidget Example 2.tid @@ -1,6 +1,6 @@ created: 20200131144828713 modified: 20211113011036840 -tags: ActionCreateTiddlerWidget Widgets +tags: ActionCreateTiddlerWidget title: ActionCreateTiddlerWidget Example 2 type: text/vnd.tiddlywiki diff --git a/editions/tw5.com/tiddlers/widgets/ActionCreateTiddlerWidget Example 3.tid b/editions/tw5.com/tiddlers/widgets/ActionCreateTiddlerWidget Example 3.tid index 296b32e74..2e137e330 100644 --- a/editions/tw5.com/tiddlers/widgets/ActionCreateTiddlerWidget Example 3.tid +++ b/editions/tw5.com/tiddlers/widgets/ActionCreateTiddlerWidget Example 3.tid @@ -1,6 +1,6 @@ created: 20200131145355658 modified: 20211113011111052 -tags: ActionCreateTiddlerWidget Widgets +tags: ActionCreateTiddlerWidget title: ActionCreateTiddlerWidget Example 3 type: text/vnd.tiddlywiki diff --git a/editions/tw5.com/tiddlers/widgets/ActionCreateTiddlerWidget Example 4.tid b/editions/tw5.com/tiddlers/widgets/ActionCreateTiddlerWidget Example 4.tid index 394bf61a9..1335893e5 100644 --- a/editions/tw5.com/tiddlers/widgets/ActionCreateTiddlerWidget Example 4.tid +++ b/editions/tw5.com/tiddlers/widgets/ActionCreateTiddlerWidget Example 4.tid @@ -1,6 +1,6 @@ created: 20200131150229551 modified: 20211113011129601 -tags: ActionCreateTiddlerWidget Widgets +tags: ActionCreateTiddlerWidget title: ActionCreateTiddlerWidget Example 4 type: text/vnd.tiddlywiki diff --git a/editions/tw5.com/tiddlers/widgets/ActionCreateTiddlerWidget Example 5.tid b/editions/tw5.com/tiddlers/widgets/ActionCreateTiddlerWidget Example 5.tid new file mode 100644 index 000000000..03f719b8b --- /dev/null +++ b/editions/tw5.com/tiddlers/widgets/ActionCreateTiddlerWidget Example 5.tid @@ -0,0 +1,32 @@ +created: 20200131144828713 +modified: 20230111220933412 +tags: ActionCreateTiddlerWidget +title: ActionCreateTiddlerWidget Example 5 +type: text/vnd.tiddlywiki + +\define testCreate() +<$action-createtiddler $basetitle="base" $template="ActionCreateTiddlerWidget Template"> + <$action-sendmessage $message="tm-edit-tiddler" $param=<>/> + +\end + +This example will use the base title defined in [[ActionCreateTiddlerWidget Template]]. + +It will create: "base", "base 1", "base 2" and so on, and navigate to this tiddler in draft mode. + +``` +\define testCreate() +<$action-createtiddler $basetitle="base" $template="ActionCreateTiddlerWidget Template"> + <$action-sendmessage $message="tm-edit-tiddler" $param=<>/> + +\end + +<$button actions=<> > +Create Tiddler + +``` + +<$button actions=<> > +<$action-setfield $tiddler="$:/state/tab/sidebar--595412856" text="$:/core/ui/SideBar/Recent"/> +Create Tiddler + - Clicking this button, will also open the Right sidebar: Recent tab diff --git a/editions/tw5.com/tiddlers/widgets/ActionCreateTiddlerWidget.tid b/editions/tw5.com/tiddlers/widgets/ActionCreateTiddlerWidget.tid index 56b3e0e27..632b71686 100644 --- a/editions/tw5.com/tiddlers/widgets/ActionCreateTiddlerWidget.tid +++ b/editions/tw5.com/tiddlers/widgets/ActionCreateTiddlerWidget.tid @@ -1,35 +1,39 @@ caption: action-createtiddler created: 20161020152745942 -modified: 20210601092956998 +modified: 20230115084716196 tags: Widgets ActionWidgets title: ActionCreateTiddlerWidget type: text/vnd.tiddlywiki ! Introduction -The ''action-createtiddler'' widget is an [[action widget|ActionWidgets]] that creates new tiddlers. ActionWidgets are used within triggering widgets such as the ButtonWidget. +The <<.wid "action-createtiddler">> widget is an [[action widget|ActionWidgets]] that creates new tiddlers. Action widgets are used within triggering widgets such as the ButtonWidget. -There are several differences from the [[tm-new-tiddler message|WidgetMessage: tm-new-tiddler]]: +There are several //differences// from the [[tm-new-tiddler message|WidgetMessage: tm-new-tiddler]]: -* The new tiddler is not automatically displayed in the [[story river|StoryRiver]] +* The new tiddler is not automatically displayed in the [[story river|Story River]] * The title of the new tiddler is made available for subsequent operations ! Content and Attributes The ''action-createtiddler'' widget is invisible. -<<.from-version "5.2.0">> The action widgets contained within the ''action-createtiddler'' widget are executed after the new tiddler has been created with the title of the tiddler in the variable `createTiddler-title` and `createTiddler-draftTitle`. - |!Attribute |!Description | |$basetitle |The initial title that will be attempted. If a tiddler with that title already exists, then a numerical counter is added to the title and incremented until it is unique| -|$savetitle |//(deprecated – see below)// A text reference identifying a field or index into which the title of the newly created tiddler will be stored after it is created | -|$savedrafttitle |//(deprecated – see below)// <<.from-version "5.1.20">> A text reference identifying a field or index into which the draft title associated with the newly created tiddler will be stored after it is created. This is useful when using a sequence of action widgets to create a new tiddler, put it into edit mode, and position it within the list of its parent tag | +|$savetitle |<<.deprecated-since "5.1.20" "ActionCreateTiddlerWidget Example 5">> A text reference identifying a field or index into which the title of the newly created tiddler will be stored after it is created | +|$savedrafttitle |<<.deprecated-since "5.1.20" "ActionCreateTiddlerWidget Example 5">> A text reference identifying a field or index into which the draft title associated with the newly created tiddler will be stored after it is created. This is useful when using a sequence of action widgets to create a new tiddler, put it into edit mode, and position it within the list of its parent tag | |$timestamp |Specifies whether the timestamp(s) of the target tiddler will be updated (''modified'' and ''modifier'', plus ''created'' and ''creator'' for newly created tiddlers). Can be "yes" (the default) or "no" | |$template |<<.from-version "5.1.22">> The title of a template tiddler, that will be used to create a new tiddler | |$overwrite |<<.from-version "5.1.22">> If set to "yes", it will overwrite existing tiddlers. ''Be careful!'' | |//{any attributes not starting with $}// |Each attribute name specifies a field to be created in the new tiddler | -<<.from-version "5.2.0">> Note that the attributes `$savetitle` and `$savedrafttitle` are no longer needed. Instead, any action widgets that need to use the title of the newly created tiddler should be contained within the ''action-createtiddler'' widget, and reference the variables `createTiddler-title` and `createTiddler-draftTitle` to obtain the title. +! Variables + +<<.from-version "5.2.0">> The content of the <<.wid "action-createtiddler">> widget is executed after the new tiddler has been created. The title of the newly created tiddler is stored in the variable <<.var "createTiddler-title">>. + +|!Variables |!Description | +|`createTiddler-title` |The tittle of the tiddler that has been created. See [[ActionCreateTiddlerWidget Example 5]] | +|`createTiddler-draftTitle` |This variable only exists to have feature parity with the deprecated parameters. It contains the title of a "draft tiddler" | ! Examples @@ -61,4 +65,9 @@ The ''action-createtiddler'' widget is invisible. {{ActionCreateTiddlerWidget Example 4}} <<< +--- + +<<< +{{ActionCreateTiddlerWidget Example 5}} +<<< diff --git a/editions/tw5.com/tiddlers/widgets/ActionCreateTiddlerWidget_Example.tid b/editions/tw5.com/tiddlers/widgets/ActionCreateTiddlerWidget_Example.tid index e1184f00f..2a431ead9 100644 --- a/editions/tw5.com/tiddlers/widgets/ActionCreateTiddlerWidget_Example.tid +++ b/editions/tw5.com/tiddlers/widgets/ActionCreateTiddlerWidget_Example.tid @@ -1,6 +1,6 @@ created: 20161020153426686 modified: 20211113011019510 -tags: ActionCreateTiddlerWidget Widgets +tags: ActionCreateTiddlerWidget title: ActionCreateTiddlerWidget Example type: text/vnd.tiddlywiki From 005dfdadf09e588a23a5c775d17c0ced52daebb6 Mon Sep 17 00:00:00 2001 From: fkmiec Date: Tue, 17 Jan 2023 16:12:18 -0600 Subject: [PATCH 13/34] Automatic sync of tiddler changes in browser storage when sync connection is re-established (#7169) * Add automatic sync of tiddler changes in browswer-storage on restoration of server connection in tiddlywebadaptor * Fix issue with new tiddlers not being synced. * Fix issue with new tiddlers not being synced. * Added logging * Modified browser-storage plugin. Refactored into utility class. * Modified browser-storage plugin. Refactored into utility class. * Fix: browser storage config tiddler created on load only if not already exists * Fix: Removed extra indent in util.js --- .../tiddlywiki/browser-storage/rawmarkup.js | 1 - plugins/tiddlywiki/browser-storage/startup.js | 78 +++---------- plugins/tiddlywiki/browser-storage/util.js | 106 ++++++++++++++++++ .../tiddlywiki/tiddlyweb/tiddlywebadaptor.js | 12 ++ 4 files changed, 134 insertions(+), 63 deletions(-) create mode 100644 plugins/tiddlywiki/browser-storage/util.js diff --git a/plugins/tiddlywiki/browser-storage/rawmarkup.js b/plugins/tiddlywiki/browser-storage/rawmarkup.js index ad788476b..bf7c41e0a 100644 --- a/plugins/tiddlywiki/browser-storage/rawmarkup.js +++ b/plugins/tiddlywiki/browser-storage/rawmarkup.js @@ -14,7 +14,6 @@ $tw = window.$tw || Object.create(null); $tw.hooks = $tw.hooks || { names: {}}; $tw.boot = $tw.boot || {}; $tw.boot.preloadDirty = $tw.boot.preloadDirty || []; - // Hook the point in the startup process when the tiddlers have been loaded but plugins not unpacked var hookName = "th-boot-tiddlers-loaded"; if(Object.prototype.hasOwnProperty.call($tw.hooks.names,hookName)) { diff --git a/plugins/tiddlywiki/browser-storage/startup.js b/plugins/tiddlywiki/browser-storage/startup.js index 33989e8a7..69cc5119e 100644 --- a/plugins/tiddlywiki/browser-storage/startup.js +++ b/plugins/tiddlywiki/browser-storage/startup.js @@ -19,19 +19,29 @@ exports.after = ["startup"]; exports.synchronous = true; var ENABLED_TITLE = "$:/config/BrowserStorage/Enabled", - SAVE_FILTER_TITLE = "$:/config/BrowserStorage/SaveFilter", - QUOTA_EXCEEDED_ALERT_TITLE = "$:/config/BrowserStorage/QuotaExceededAlert", - DEFAULT_QUOTA_EXCEEDED_ALERT_PREFIX = "Quota exceeded attempting to store `", - DEFAULT_QUOTA_EXCEEDED_ALERT_SUFFIX = "` in browser local storage"; + SAVE_FILTER_TITLE = "$:/config/BrowserStorage/SaveFilter"; + +var BrowserStorageUtil = require("$:/plugins/tiddlywiki/browser-storage/util.js").BrowserStorageUtil; exports.startup = function() { var self = this; + + // If not exists, add ENABLED tiddler with default value "yes" + if(!$tw.wiki.getTiddler(ENABLED_TITLE)) { + $tw.wiki.addTiddler({title: ENABLED_TITLE, text: "yes"}); + } // Compute our prefix for local storage keys var prefix = "tw5#" + window.location.pathname + "#"; // Make a logger var logger = new $tw.utils.Logger("browser-storage",{ colour: "cyan" }); + // Add browserStorage object to $tw + $tw.browserStorage = new BrowserStorageUtil($tw.wiki,{ + enabledTitle: ENABLED_TITLE, + prefix: prefix, + logger: logger + }); // Function to compile the filter var filterFn, compileFilter = function() { @@ -41,7 +51,7 @@ exports.startup = function() { // Listen for tm-clear-browser-storage messages $tw.rootWidget.addEventListener("tm-clear-browser-storage",function(event) { $tw.wiki.addTiddler({title: ENABLED_TITLE, text: "no"}); - clearLocalStorage(); + $tw.browserStorage.clearLocalStorage(); }); // Track tiddler changes $tw.wiki.addEventListener("change",function(changes) { @@ -67,65 +77,9 @@ exports.startup = function() { return; } // Save the tiddler - saveTiddlerToLocalStorage(title,{ - logger: logger, - prefix: prefix - }); + $tw.browserStorage.saveTiddlerToLocalStorage(title); }); }); }; -function saveTiddlerToLocalStorage(title,options) { - options = options || {}; - // Get the tiddler - var tiddler = $tw.wiki.getTiddler(title); - if(tiddler) { - console.log("browser-storage: Saving",title); - // Get the JSON of the tiddler - var json = JSON.stringify(tiddler.getFieldStrings()); - // Try to save it to local storage - try { - window.localStorage.setItem(options.prefix + title,json); - } catch(e) { - if(e.name === "QuotaExceededError") { - // Complain if we failed - var msg = $tw.wiki.getTiddlerText(QUOTA_EXCEEDED_ALERT_TITLE,DEFAULT_QUOTA_EXCEEDED_ALERT_PREFIX + title + DEFAULT_QUOTA_EXCEEDED_ALERT_SUFFIX); - if(options.logger) { - options.logger.alert(msg); - } - // No point in keeping old values around for this tiddler - window.localStorage.removeItem(options.prefix + title); - } else { - console.log("Browser-storage error:",e); - } - } - } else { - // In local storage, use the special value of empty string to mark the tiddler as deleted - // On future page loads, if the tiddler is already gone from startup then the blank entry - // will be removed from localstorage. Otherwise, the tiddler will be deleted. - console.log("browser-storage: Blanking",title); - try { - window.localStorage.setItem(options.prefix + title, ""); - } catch(e) { - console.log("Browser-storage error:",e); - } - } -} - -function clearLocalStorage() { - var url = window.location.pathname, - log = []; - // Step through each browser storage item - if(window.localStorage) { - for(var index=window.localStorage.length - 1; index>=0; index--) { - var key = window.localStorage.key(index), - parts = key.split("#"); - // Delete it if it is ours - if(parts[0] === "tw5" && parts[1] === url) { - window.localStorage.removeItem(key); - } - } - } -} - })(); diff --git a/plugins/tiddlywiki/browser-storage/util.js b/plugins/tiddlywiki/browser-storage/util.js new file mode 100644 index 000000000..a88c358f6 --- /dev/null +++ b/plugins/tiddlywiki/browser-storage/util.js @@ -0,0 +1,106 @@ +/*\ +title: $:/plugins/tiddlywiki/browser-storage/util.js +type: application/javascript +module-type: library + +Utility methods for browser-storage plugin + +\*/ + +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +function BrowserStorageUtil(wiki,options) { + this.options = options || {}; + this.wiki = wiki; + this.cachedTiddlers = []; + this.QUOTA_EXCEEDED_ALERT_TITLE = "$:/config/BrowserStorage/QuotaExceededAlert"; + this.DEFAULT_QUOTA_EXCEEDED_ALERT_PREFIX = "Quota exceeded attempting to store `"; + this.DEFAULT_QUOTA_EXCEEDED_ALERT_SUFFIX = "` in browser local storage"; +} + +BrowserStorageUtil.prototype.isEnabled = function() { + return $tw.wiki.getTiddlerText(this.options.enabledTitle) === "yes"; +}; + +BrowserStorageUtil.prototype.cachePreloadTiddlers = function() { + var self = this; + $tw.utils.each($tw.boot.preloadDirty, function(item){ + var tiddler = $tw.wiki.getTiddler(item); + self.cachedTiddlers.push(tiddler); + }); +}; + +BrowserStorageUtil.prototype.addCachedTiddlers = function() { + var self = this; + if(this.cachedTiddlers.length > 0) { + $tw.utils.each(this.cachedTiddlers, function(item){ + $tw.wiki.addTiddler(item); + }); + this.cachedTiddlers.length = 0; + } +}; + +BrowserStorageUtil.prototype.removeTiddlerFromLocalStorage = function(title) { + console.log("browser-storage: Removing", title); + window.localStorage.removeItem(this.options.prefix + title); +}; + +BrowserStorageUtil.prototype.saveTiddlerToLocalStorage = function(title) { + // Get the tiddler + var tiddler = $tw.wiki.getTiddler(title); + if(tiddler) { + console.log("browser-storage: Saving",title); + // Get the JSON of the tiddler + var json = JSON.stringify(tiddler.getFieldStrings()); + // Try to save it to local storage + try { + window.localStorage.setItem(this.options.prefix + title,json); + } catch(e) { + if(e.name === "QuotaExceededError") { + // Complain if we failed + var msg = $tw.wiki.getTiddlerText(this.QUOTA_EXCEEDED_ALERT_TITLE,this.DEFAULT_QUOTA_EXCEEDED_ALERT_PREFIX + title + this.DEFAULT_QUOTA_EXCEEDED_ALERT_SUFFIX); + if(this.options.logger) { + this.options.logger.alert(msg); + } + // No point in keeping old values around for this tiddler + window.localStorage.removeItem(this.options.prefix + title); + } else { + console.log("Browser-storage error:",e); + } + } + } else { + // In local storage, use the special value of empty string to mark the tiddler as deleted + // On future page loads, if the tiddler is already gone from startup then the blank entry + // will be removed from localstorage. Otherwise, the tiddler will be deleted. + console.log("browser-storage: Blanking",title); + try { + window.localStorage.setItem(this.options.prefix + title, ""); + } catch(e) { + console.log("Browser-storage error:",e); + } + } +}; + +BrowserStorageUtil.prototype.clearLocalStorage = function() { + var url = window.location.pathname, + log = []; + // Step through each browser storage item + if(window.localStorage) { + for(var index=window.localStorage.length - 1; index>=0; index--) { + var key = window.localStorage.key(index), + parts = key.split("#"); + // Delete it if it is ours + if(parts[0] === "tw5" && parts[1] === url) { + window.localStorage.removeItem(key); + } + } + } +}; + +exports.BrowserStorageUtil = BrowserStorageUtil; + +})(); diff --git a/plugins/tiddlywiki/tiddlyweb/tiddlywebadaptor.js b/plugins/tiddlywiki/tiddlyweb/tiddlywebadaptor.js index 712077974..15fbaa4fd 100644 --- a/plugins/tiddlywiki/tiddlyweb/tiddlywebadaptor.js +++ b/plugins/tiddlywiki/tiddlyweb/tiddlywebadaptor.js @@ -76,6 +76,10 @@ TiddlyWebAdaptor.prototype.getStatus = function(callback) { if(err) { return callback(err); } + //If Browser-Storage plugin is present, cache pre-loaded tiddlers and add back after sync from server completes + if($tw.browserStorage && $tw.browserStorage.isEnabled()) { + $tw.browserStorage.cachePreloadTiddlers(); + } // Decode the status JSON var json = null; try { @@ -188,6 +192,10 @@ TiddlyWebAdaptor.prototype.getSkinnyTiddlers = function(callback) { } // Invoke the callback with the skinny tiddlers callback(null,tiddlers); + // If Browswer Storage tiddlers were cached on reloading the wiki, add them after sync from server completes in the above callback. + if($tw.browserStorage && $tw.browserStorage.isEnabled()) { + $tw.browserStorage.addCachedTiddlers(); + } } }); }; @@ -211,6 +219,10 @@ TiddlyWebAdaptor.prototype.saveTiddler = function(tiddler,callback,options) { if(err) { return callback(err); } + //If Browser-Storage plugin is present, remove tiddler from local storage after successful sync to the server + if($tw.browserStorage && $tw.browserStorage.isEnabled()) { + $tw.browserStorage.removeTiddlerFromLocalStorage(tiddler.fields.title) + } // Save the details of the new revision of the tiddler var etag = request.getResponseHeader("Etag"); if(!etag) { From 5aa5fc72b17dfc0c30569f1daa3ce33e73f9ec80 Mon Sep 17 00:00:00 2001 From: GameDungeon <60719255+GameDungeon@users.noreply.github.com> Date: Tue, 17 Jan 2023 16:16:09 -0600 Subject: [PATCH 14/34] Gamedungeon Sign CLA (#7216) --- licenses/cla-individual.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/licenses/cla-individual.md b/licenses/cla-individual.md index 3ffb6e552..290fa85f5 100644 --- a/licenses/cla-individual.md +++ b/licenses/cla-individual.md @@ -517,3 +517,5 @@ Pippo Peppo, @pippep, 2023-01-03 Scott Sauye, @CrossEye, 2023-01-04 Marcus Winter, @yaisog, 2023-01-07 + +Ethan Weller, @gamedungeon, 2023-01-17 From 9541f3c28315848a0b46a69a04b8390e058881a3 Mon Sep 17 00:00:00 2001 From: "jeremy@jermolene.com" Date: Tue, 17 Jan 2023 23:13:58 +0000 Subject: [PATCH 15/34] Clean up build errors --- bin/build-site.sh | 16 ++++++++-------- editions/de-DE/tiddlywiki.info | 7 ++++--- editions/es-ES/tiddlywiki.info | 4 ++-- editions/fr-FR/tiddlywiki.info | 4 ++-- editions/introduction/tiddlywiki.info | 3 --- editions/ja-JP/tiddlywiki.info | 4 ++-- languages/ja-JP/Misc.multids | 2 -- languages/pl-PL/ControlPanel.multids | 2 -- 8 files changed, 18 insertions(+), 24 deletions(-) diff --git a/bin/build-site.sh b/bin/build-site.sh index cd5267389..7f56e6d30 100755 --- a/bin/build-site.sh +++ b/bin/build-site.sh @@ -359,14 +359,14 @@ node $TW5_BUILD_TIDDLYWIKI \ # Delete any existing static content -rm $TW5_BUILD_OUTPUT/languages/de-AT/static/* -rm $TW5_BUILD_OUTPUT/languages/de-DE/static/* -rm $TW5_BUILD_OUTPUT/languages/es-ES/static/* -rm $TW5_BUILD_OUTPUT/languages/fr-FR/static/* -rm $TW5_BUILD_OUTPUT/languages/ja-JP/static/* -rm $TW5_BUILD_OUTPUT/languages/ko-KR/static/* -rm $TW5_BUILD_OUTPUT/languages/zh-Hans/static/* -rm $TW5_BUILD_OUTPUT/languages/zh-Hant/static/* +rm -rf $TW5_BUILD_OUTPUT/languages/de-AT/static/* +rm -rf $TW5_BUILD_OUTPUT/languages/de-DE/static/* +rm -rf $TW5_BUILD_OUTPUT/languages/es-ES/static/* +rm -rf $TW5_BUILD_OUTPUT/languages/fr-FR/static/* +rm -rf $TW5_BUILD_OUTPUT/languages/ja-JP/static/* +rm -rf $TW5_BUILD_OUTPUT/languages/ko-KR/static/* +rm -rf $TW5_BUILD_OUTPUT/languages/zh-Hans/static/* +rm -rf $TW5_BUILD_OUTPUT/languages/zh-Hant/static/* # /languages/de-AT/index.html Demo wiki with de-AT language # /languages/de-AT/empty.html Empty wiki with de-AT language diff --git a/editions/de-DE/tiddlywiki.info b/editions/de-DE/tiddlywiki.info index e1806f4a8..5c0224f62 100755 --- a/editions/de-DE/tiddlywiki.info +++ b/editions/de-DE/tiddlywiki.info @@ -1,7 +1,9 @@ { "description": "Deutsche Basis Edition", "plugins": [ - "tiddlywiki/browser-sniff"], + "tiddlywiki/browser-sniff", + "tiddlywiki/internals" + ], "themes": [ "tiddlywiki/vanilla", "tiddlywiki/snowwhite", @@ -9,8 +11,7 @@ "tiddlywiki/seamless", "tiddlywiki/centralised", "tiddlywiki/tight", - "tiddlywiki/readonly", - "tiddlywiki/internals" + "tiddlywiki/readonly" ], "languages": [ "de-AT", diff --git a/editions/es-ES/tiddlywiki.info b/editions/es-ES/tiddlywiki.info index b72f0b5ee..466e87c01 100644 --- a/editions/es-ES/tiddlywiki.info +++ b/editions/es-ES/tiddlywiki.info @@ -1,6 +1,7 @@ { "description": "Spanish (Spain) edition", "plugins": [ + "tiddlywiki/internals" ], "themes": [ "tiddlywiki/vanilla", @@ -9,8 +10,7 @@ "tiddlywiki/seamless", "tiddlywiki/centralised", "tiddlywiki/tight", - "tiddlywiki/readonly", - "tiddlywiki/internals" + "tiddlywiki/readonly" ], "languages": [ "es-ES" diff --git a/editions/fr-FR/tiddlywiki.info b/editions/fr-FR/tiddlywiki.info index a710d5775..186c610e6 100644 --- a/editions/fr-FR/tiddlywiki.info +++ b/editions/fr-FR/tiddlywiki.info @@ -1,6 +1,7 @@ { "description": "French (France) edition", "plugins": [ + "tiddlywiki/internals" ], "themes": [ "tiddlywiki/vanilla", @@ -9,8 +10,7 @@ "tiddlywiki/seamless", "tiddlywiki/centralised", "tiddlywiki/tight", - "tiddlywiki/readonly", - "tiddlywiki/internals" + "tiddlywiki/readonly" ], "languages": [ "fr-FR" diff --git a/editions/introduction/tiddlywiki.info b/editions/introduction/tiddlywiki.info index 14c629414..456316e06 100644 --- a/editions/introduction/tiddlywiki.info +++ b/editions/introduction/tiddlywiki.info @@ -49,9 +49,6 @@ ], "build": { "index": [ - "--savetiddlers","[tag[external-image]]","images", - "--setfield","[tag[external-image]]","_canonical_uri","$:/core/templates/canonical-uri-external-image","text/plain", - "--setfield","[tag[external-image]]","text","","text/plain", "--rendertiddler","$:/core/save/all","index.html","text/plain"], "favicon": [ "--savetiddler","$:/favicon.ico","favicon.ico", diff --git a/editions/ja-JP/tiddlywiki.info b/editions/ja-JP/tiddlywiki.info index b6732ac05..3b4187547 100644 --- a/editions/ja-JP/tiddlywiki.info +++ b/editions/ja-JP/tiddlywiki.info @@ -1,6 +1,7 @@ { "description": "Japanese (Japan) edition", "plugins": [ + "tiddlywiki/internals" ], "themes": [ "tiddlywiki/vanilla", @@ -9,8 +10,7 @@ "tiddlywiki/seamless", "tiddlywiki/centralised", "tiddlywiki/tight", - "tiddlywiki/readonly", - "tiddlywiki/internals" + "tiddlywiki/readonly" ], "languages": [ "ja-JP" diff --git a/languages/ja-JP/Misc.multids b/languages/ja-JP/Misc.multids index c939ccb08..9caa602dc 100644 --- a/languages/ja-JP/Misc.multids +++ b/languages/ja-JP/Misc.multids @@ -104,5 +104,3 @@ TagManager/Tag/Heading: タグ Tiddler/DateFormat: YYYY年MM月DD日(ddd) 0hh:0mm UnsavedChangesWarning: 保存していない編集内容があります。 Yes: はい -$:/SiteSubtitle: 非線形パーソナルウェブノートブック -$:/SiteTitle: 私の ~TiddlyWiki diff --git a/languages/pl-PL/ControlPanel.multids b/languages/pl-PL/ControlPanel.multids index 38e4b7fad..2ee8983c2 100644 --- a/languages/pl-PL/ControlPanel.multids +++ b/languages/pl-PL/ControlPanel.multids @@ -8,8 +8,6 @@ Basics/AnimDuration/Prompt: Długość animacji Basics/AutoFocus/Prompt: Domyślne wybrane pole do edycji przy tworzeniu nowego tiddlera Basics/Caption: Podstawowe Basics/DefaultTiddlers/BottomHint: Tiddlery, które mają spację w nazie otocz [[podwójnymi nawiasami kwadratowymi]]. Możesz też ustawić, by zawsze widzieć {{ostatnio otwarte tiddlery||$:/snippets/retain-story-ordering-button}} -Basics/DefaultTiddlers/BottomHint: Use [[double square brackets]] for titles with spaces. Or you can choose to <$button set="$:/DefaultTiddlers" setTo="[list[$:/StoryList]]">retain story ordering -Basics/DefaultTiddlers/BottomHint: Use [[double square brackets]] for titles with spaces. Or you can choose to {{retain story ordering||$:/snippets/retain-story-ordering-button}} Basics/DefaultTiddlers/Prompt: Domyślnie otwarte tiddlery Basics/DefaultTiddlers/TopHint: Wybierz które tiddlery mają być widoczne przy uruchomieniu Basics/Language/Prompt: Cześć! Wybrany język to: From 586d44f6ce002c6baa66f7930e7c17995c05e24f Mon Sep 17 00:00:00 2001 From: "jeremy@jermolene.com" Date: Wed, 18 Jan 2023 16:50:58 +0000 Subject: [PATCH 16/34] Allow missing tiddlers to be deleted (ie closed) Fixes #7217 --- core/modules/widgets/navigator.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/core/modules/widgets/navigator.js b/core/modules/widgets/navigator.js index 3f1efbe7a..2e39fdd20 100755 --- a/core/modules/widgets/navigator.js +++ b/core/modules/widgets/navigator.js @@ -227,10 +227,7 @@ NavigatorWidget.prototype.handleDeleteTiddlerEvent = function(event) { originalTitle = tiddler ? tiddler.fields["draft.of"] : "", originalTiddler = originalTitle ? this.wiki.getTiddler(originalTitle) : undefined, confirmationTitle, - win = event.event && event.event.view ? event.event.view : window; - if(!tiddler) { - return false; - } + win = event.event && event.event.view ? event.event.view : window; // Check if the tiddler we're deleting is in draft mode if(originalTitle) { // If so, we'll prompt for confirmation referencing the original tiddler @@ -240,7 +237,7 @@ NavigatorWidget.prototype.handleDeleteTiddlerEvent = function(event) { confirmationTitle = title; } // Seek confirmation - if((this.wiki.getTiddler(originalTitle) || (tiddler.fields.text || "") !== "") && !win.confirm($tw.language.getString( + if(((originalTitle && this.wiki.getTiddler(originalTitle)) || (tiddler && ((tiddler.fields.text || "") !== ""))) && !win.confirm($tw.language.getString( "ConfirmDeleteTiddler", {variables: {title: confirmationTitle} @@ -257,8 +254,10 @@ NavigatorWidget.prototype.handleDeleteTiddlerEvent = function(event) { this.removeTitleFromStory(storyList,originalTitle); } // Invoke the hook function and delete this tiddler - $tw.hooks.invokeHook("th-deleting-tiddler",tiddler); - this.wiki.deleteTiddler(title); + if(tiddler) { + $tw.hooks.invokeHook("th-deleting-tiddler",tiddler); + this.wiki.deleteTiddler(title); + } // Remove the closed tiddler from the story this.removeTitleFromStory(storyList,title); this.saveStoryList(storyList); From 485bf19c3cbfb8c22cd34f26a6642598f2d99630 Mon Sep 17 00:00:00 2001 From: "jeremy@jermolene.com" Date: Thu, 19 Jan 2023 16:43:48 +0000 Subject: [PATCH 17/34] Remove docs references to Beaker Browser now it is archived See https://github.com/beakerbrowser/beaker/blob/master/archive-notice.md --- .../saving/Saving on Beaker Browser.tid | 35 ------------------- .../tiddlers/platforms/Beaker_Browser.tid | 21 ----------- .../saving/Saving on Beaker Browser.tid | 34 ------------------ 3 files changed, 90 deletions(-) delete mode 100644 editions/fr-FR/tiddlers/saving/Saving on Beaker Browser.tid delete mode 100644 editions/tw5.com/tiddlers/platforms/Beaker_Browser.tid delete mode 100644 editions/tw5.com/tiddlers/saving/Saving on Beaker Browser.tid diff --git a/editions/fr-FR/tiddlers/saving/Saving on Beaker Browser.tid b/editions/fr-FR/tiddlers/saving/Saving on Beaker Browser.tid deleted file mode 100644 index a1541c9bf..000000000 --- a/editions/fr-FR/tiddlers/saving/Saving on Beaker Browser.tid +++ /dev/null @@ -1,35 +0,0 @@ -caption: Beaker Browser -color: #FF8A65 -created: 20161229121316912 -delivery: App -description: Nouveau navigateur puissant pour Mac, Windows et Linux -fr-title: Enregistrer avec Beaker Browser -method: save -modified: 20220402105820520 -tags: Saving Windows Linux Mac -title: Saving on Beaker Browser -type: text/vnd.tiddlywiki - -<<.from-version "5.1.14">> <> intègre un module qui lui permet d'enregistrer les modifications directement avec [[Beaker Browser]], un navigateur internet en peer-to-peer expérimental. - -! Instructions - -# Téléchargez et installez Beaker Browser depuis https://beakerbrowser.com/ -# Lancez Beaker et si nécessaire ouvrez un onglet vers l'adresse `beaker:start` -# Cliquez sur le bouton <> en haut à gauche de la page -# Saisissez les détails sur votre site -# Cliquez sur le lien <> et sélectionnez le fichier `index.html` de votre <> -# Naviguez sur votre site en cliquant sur le lien vers `index.html`<<;>> il devrait s'ouvrir dans un nouvel onglet -# Essayez de créer des tiddlers et d'enregistrer les modifications - -Jusque là, le wiki est entièrement privé et les autres utilisateurs ne peuvent pas en voir le contenu, même en connaissant l'URL. Pour le partager avec d'autres utilisateurs<<:>> - -# Publiez vos modifications -## Visitez la page <> à l'aide du menu <> de Beaker Browser -## Sélectionnez votre site dans la liste -## Recherchez un encart <>. S'il n'est pas présent, passez au point suivant -## Cliquez sur le bouton <> -## Cliquez sur le bouton <> -# Partagez l'URL `dat:` -## Copiez l'URL de votre site à partir de la barre d'adresse et partagez-la avec d'autres utilisateurs -## Les autres utilisateurs devraient pouvoir accéder à votre site mais ils ne pourront pas le modifier avant d'en avoir fait leur propre clone diff --git a/editions/tw5.com/tiddlers/platforms/Beaker_Browser.tid b/editions/tw5.com/tiddlers/platforms/Beaker_Browser.tid deleted file mode 100644 index 1d43928aa..000000000 --- a/editions/tw5.com/tiddlers/platforms/Beaker_Browser.tid +++ /dev/null @@ -1,21 +0,0 @@ -created: 20161229113910984 -modified: 20171113110222980 -title: Beaker Browser -type: text/vnd.tiddlywiki - -From [[Beaker Browser website|https://beakerbrowser.com/]]: - -> Beaker is a Peer-to-Peer Web Browser, made for users to run applications independently of hosts. Using P2P Hypermedia, Beaker separates frontend apps from backend services, so that users are completely in control of their software and data. Read more. - -Beaker is a fork of the open source Chromium browser (which is the core engine powering Google's Chrome browser). - -Beaker adds the ability to host sites within the browser, and browse to those sites via the `dat://` protocol. The extraordinary thing is that if you are running Beaker then you can also browse to sites hosted by other users, without needing any server in between. - -Further, you can opt to host a site belonging to somebody else, forming part of a Bittorrent-like swarm of peers serving the content to other browsers. You can also //fork// a site, making your own copy that you can change as you need. - -The main disadvantage is that mainstream browsers cannot use `dat://` sites. - -Most of the magic is accomplished by the underlying [[Dat protocol|https://datproject.org/]]. - -<<.from-version "5.1.14">> TiddlyWiki incorporates a special saver module permitting changes to be saved directly from Beaker browser. See [[Saving on Beaker Browser]] for instructions. - diff --git a/editions/tw5.com/tiddlers/saving/Saving on Beaker Browser.tid b/editions/tw5.com/tiddlers/saving/Saving on Beaker Browser.tid deleted file mode 100644 index ea5777186..000000000 --- a/editions/tw5.com/tiddlers/saving/Saving on Beaker Browser.tid +++ /dev/null @@ -1,34 +0,0 @@ -caption: Beaker Browser -color: #FF8A65 -created: 20161229121316912 -delivery: App -description: Powerful new browser for Mac, Windows and Linux -method: save -modified: 20200507104016915 -tags: Saving Windows Linux Mac -title: Saving on Beaker Browser -type: text/vnd.tiddlywiki - -<<.from-version "5.1.14">> TiddlyWiki incorporates a saver module that allows it to save changes directly with the [[Beaker Browser]], an experimental peer-to-peer browser. - -! Instructions - -# Download and install the Beaker Browser from https://beakerbrowser.com/ -# Run Beaker, and if necessary open a tab to beaker:start -# Click the "New site" button at the top left of the page -# Enter the details of your site -# Click the link “Add files” and upload your TiddlyWiki index.html file -# View the site by clicking on the link to index.html; it should open in a new tab -# Try out creating tiddlers, and saving changes - -At this point, the wiki is entirely private, and other users cannot see the content even if they have the URL. To share the wiki with other users: - -# Publish your changes -## Visit the "Library" page in Beaker Browser via the system menu -## Select your site in the list -## Look for a box mentioning "n unpublished changes". If not present, skip to the next step -## Click the "Review changes" button -## Click the "Publish" button -# Share the dat: URL -## Copy the URL of your site from the address bar and share it with other users -## Other users should be able to access your site but they won't be able to make changes unless they fork their own copy From 5d650e87dd6ba66829c7e29b39b1eb3069a78ebf Mon Sep 17 00:00:00 2001 From: "jeremy@jermolene.com" Date: Thu, 19 Jan 2023 16:45:30 +0000 Subject: [PATCH 18/34] Remove savers for Beaker Browser now it is archived See https://github.com/beakerbrowser/beaker/blob/master/archive-notice.md --- core/modules/savers/beaker.js | 64 ------------------------------- core/modules/savers/hyperdrive.js | 64 ------------------------------- 2 files changed, 128 deletions(-) delete mode 100644 core/modules/savers/beaker.js delete mode 100644 core/modules/savers/hyperdrive.js diff --git a/core/modules/savers/beaker.js b/core/modules/savers/beaker.js deleted file mode 100644 index dc24ef67f..000000000 --- a/core/modules/savers/beaker.js +++ /dev/null @@ -1,64 +0,0 @@ -/*\ -title: $:/core/modules/savers/beaker.js -type: application/javascript -module-type: saver - -Saves files using the Beaker browser's (https://beakerbrowser.com) Dat protocol (https://datproject.org/) -Compatible with beaker >= V0.7.2 - -\*/ -(function(){ - -/*jslint node: true, browser: true */ -/*global $tw: false */ -"use strict"; - -/* -Set up the saver -*/ -var BeakerSaver = function(wiki) { - this.wiki = wiki; -}; - -BeakerSaver.prototype.save = function(text,method,callback) { - var dat = new DatArchive("" + window.location), - pathname = ("" + window.location.pathname).split("#")[0]; - dat.stat(pathname).then(function(value) { - if(value.isDirectory()) { - pathname = pathname + "/index.html"; - } - dat.writeFile(pathname,text,"utf8").then(function(value) { - callback(null); - },function(reason) { - callback("Beaker Saver Write Error: " + reason); - }); - },function(reason) { - callback("Beaker Saver Stat Error: " + reason); - }); - return true; -}; - -/* -Information about this saver -*/ -BeakerSaver.prototype.info = { - name: "beaker", - priority: 3000, - capabilities: ["save", "autosave"] -}; - -/* -Static method that returns true if this saver is capable of working -*/ -exports.canSave = function(wiki) { - return !!window.DatArchive && location.protocol==="dat:"; -}; - -/* -Create an instance of this saver -*/ -exports.create = function(wiki) { - return new BeakerSaver(wiki); -}; - -})(); diff --git a/core/modules/savers/hyperdrive.js b/core/modules/savers/hyperdrive.js deleted file mode 100644 index 232392672..000000000 --- a/core/modules/savers/hyperdrive.js +++ /dev/null @@ -1,64 +0,0 @@ -/*\ -title: $:/core/modules/savers/hyperdrive.js -type: application/javascript -module-type: saver - -Saves files using the Hyperdrive Protocol (https://hypercore-protocol.org/#hyperdrive) Beaker browser beta-1.0 and later (https://beakerbrowser.com) -Compatible with beaker >= V1.0.0 - -\*/ -(function(){ - -/*jslint node: true, browser: true */ -/*global $tw: false */ -"use strict"; - -/* -Set up the saver -*/ -var HyperdriveSaver = function(wiki) { - this.wiki = wiki; -}; - -HyperdriveSaver.prototype.save = function(text,method,callback) { - var dat = beaker.hyperdrive.drive("" + window.location), - pathname = ("" + window.location.pathname).split("#")[0]; - dat.stat(pathname).then(function(value) { - if(value.isDirectory()) { - pathname = pathname + "/index.html"; - } - dat.writeFile(pathname,text,"utf8").then(function(value) { - callback(null); - },function(reason) { - callback("Hyperdrive Saver Write Error: " + reason); - }); - },function(reason) { - callback("Hyperdrive Saver Stat Error: " + reason); - }); - return true; -}; - -/* -Information about this saver -*/ -HyperdriveSaver.prototype.info = { - name: "beaker-1.x", - priority: 3000, - capabilities: ["save", "autosave"] -}; - -/* -Static method that returns true if this saver is capable of working -*/ -exports.canSave = function(wiki) { - return !!window.beaker && !!beaker.hyperdrive && location.protocol==="hyper:"; -}; - -/* -Create an instance of this saver -*/ -exports.create = function(wiki) { - return new HyperdriveSaver(wiki); -}; - -})(); From aa8f7f77d69301f65380378d2a41841af53b1b48 Mon Sep 17 00:00:00 2001 From: cdruan <80615570+cdruan@users.noreply.github.com> Date: Thu, 19 Jan 2023 08:52:12 -0800 Subject: [PATCH 19/34] External.js: Allow boot code to remain as tiddlers in tiddlywikicore.js (#7210) * Allow boot code to remain as tiddlers * Sync up with tiddlywiki5.html * Add \whitespace trim * Add download-full-wiki button * Simplify ExportTiddlyWikiCore code No longer needs the if-boot-code-is-missing part of the code. * Replace space btw icon and button text with CSS --- .../external-js/save-all-external-js.tid | 1 + .../external-js/save-offline-external-js.tid | 1 + .../external-js/tiddlywiki.js.load.tid | 3 + core/templates/external-js/tiddlywiki.js.tid | 55 +++++++++++++++---- .../tiddlywiki5-external-js.html.tid | 36 ++++++------ core/ui/DownloadFullWiki.tid | 18 ++++++ core/ui/ExportTiddlyWikiCore.tid | 16 +----- 7 files changed, 89 insertions(+), 41 deletions(-) create mode 100644 core/templates/external-js/tiddlywiki.js.load.tid create mode 100644 core/ui/DownloadFullWiki.tid diff --git a/core/templates/external-js/save-all-external-js.tid b/core/templates/external-js/save-all-external-js.tid index cd15cedc3..2616fed20 100644 --- a/core/templates/external-js/save-all-external-js.tid +++ b/core/templates/external-js/save-all-external-js.tid @@ -1,5 +1,6 @@ title: $:/core/save/all-external-js +\whitespace trim \import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]] \define saveTiddlerFilter() [is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/core]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$ diff --git a/core/templates/external-js/save-offline-external-js.tid b/core/templates/external-js/save-offline-external-js.tid index 2dfca5d52..01ae88aa0 100644 --- a/core/templates/external-js/save-offline-external-js.tid +++ b/core/templates/external-js/save-offline-external-js.tid @@ -1,5 +1,6 @@ title: $:/core/save/offline-external-js +\whitespace trim \import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]] \define saveTiddlerFilter() [is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/core]] -[[$:/plugins/tiddlywiki/filesystem]] -[[$:/plugins/tiddlywiki/tiddlyweb]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$ diff --git a/core/templates/external-js/tiddlywiki.js.load.tid b/core/templates/external-js/tiddlywiki.js.load.tid new file mode 100644 index 000000000..496d6ed04 --- /dev/null +++ b/core/templates/external-js/tiddlywiki.js.load.tid @@ -0,0 +1,3 @@ +title: $:/core/templates/tiddlywiki.js/load-tiddler + +_load(window,<$macrocall $name="jsontiddler" $output="text/raw"/>); \ No newline at end of file diff --git a/core/templates/external-js/tiddlywiki.js.tid b/core/templates/external-js/tiddlywiki.js.tid index a8170663f..f962569a2 100644 --- a/core/templates/external-js/tiddlywiki.js.tid +++ b/core/templates/external-js/tiddlywiki.js.tid @@ -1,15 +1,48 @@ + title: $:/core/templates/tiddlywiki5.js \rules only filteredtranscludeinline transcludeinline codeinline -/* -{{ $:/core/copyright.txt ||$:/core/templates/plain-text-tiddler}} -`*/ -` -{{{ [is[system]type[application/javascript]library[yes]] ||$:/core/templates/plain-text-tiddler}}} - -{{ $:/boot/bootprefix.js ||$:/core/templates/plain-text-tiddler}} - -{{$:/core/templates/tiddlywiki5.js/tiddlers}} - -{{ $:/boot/boot.js ||$:/core/templates/plain-text-tiddler}} +`/* +`{{ $:/core/copyright.txt ||$:/core/templates/plain-text-tiddler}}` +*/ + +$tw = (typeof $tw === 'undefined') ? Object.create(null) : $tw; + +$tw.preloadTiddlers = $tw.preloadTiddlers || []; + +_load = function(window,tiddler) { + "use strict"; + var f; + $tw.preloadTiddlers.push(tiddler); + if(tiddler.library === "yes") { + var module = { exports:{} }; + var moduleName = function moduleName(path) { + var word = path.split("/").pop(); + word = word.substring(0,word.indexOf(".")) || word; + return word; + } + f = new Function("module",tiddler.text); + f(module); + window[moduleName(tiddler.title)] = module.exports; + } else { + f = new Function("window",tiddler.text); + f(window); + } +} + +/* ~~ Library modules ~~ */ + +`{{{ [is[system]type[application/javascript]library[yes]] ||$:/core/templates/tiddlywiki.js/load-tiddler}}}` + +/* ~~ Boot kernel prologue ~~ */ + +`{{ $:/boot/bootprefix.js ||$:/core/templates/tiddlywiki.js/load-tiddler}}` + +/* ~~ Core tiddlers ~~ */ + +`{{$:/core/templates/tiddlywiki5.js/tiddlers}}` + +/* ~~ Boot kernel ~~ */ + +`{{ $:/boot/boot.js ||$:/core/templates/tiddlywiki.js/load-tiddler}}` diff --git a/core/templates/external-js/tiddlywiki5-external-js.html.tid b/core/templates/external-js/tiddlywiki5-external-js.html.tid index 6a5c4c1bb..b161584d7 100644 --- a/core/templates/external-js/tiddlywiki5-external-js.html.tid +++ b/core/templates/external-js/tiddlywiki5-external-js.html.tid @@ -1,48 +1,50 @@ title: $:/core/templates/tiddlywiki5-external-js.html -\rules only filteredtranscludeinline transcludeinline - -{{$:/core/templates/MOTW.html}} +<$set name="saveTiddlerAndShadowsFilter" filter="[subfilter] [subfilterplugintiddlers[]]"> +` +`{{$:/core/templates/MOTW.html}}` -{{{ [all[shadows+tiddlers]tag[$:/tags/RawMarkupWikified/TopHead]] ||$:/core/templates/raw-static-tiddler}}} +`{{{ [enlisttag[$:/tags/RawMarkupWikified/TopHead]] ||$:/core/templates/raw-static-tiddler}}}` - + - + -{{$:/core/wiki/title}} +`{{$:/core/wiki/title}}` -{{{ [all[shadows+tiddlers]tag[$:/core/wiki/rawmarkup]] [all[shadows+tiddlers]tag[$:/tags/RawMarkup]] ||$:/core/templates/plain-text-tiddler}}} -{{{ [all[shadows+tiddlers]tag[$:/tags/RawMarkupWikified]] ||$:/core/templates/raw-static-tiddler}}} +`{{{ [enlisttag[$:/core/wiki/rawmarkup]] ||$:/core/templates/plain-text-tiddler}}}` +`{{{ [enlisttag[$:/tags/RawMarkup]] ||$:/core/templates/plain-text-tiddler}}}` +`{{{ [enlisttag[$:/tags/RawMarkupWikified]] ||$:/core/templates/raw-static-tiddler}}}` -{{{ [all[shadows+tiddlers]tag[$:/tags/RawMarkupWikified/TopBody]] ||$:/core/templates/raw-static-tiddler}}} +`{{{ [enlisttag[$:/tags/RawMarkupWikified/TopBody]] ||$:/core/templates/raw-static-tiddler}}}`
-{{$:/boot/boot.css||$:/core/templates/css-tiddler}} +`{{$:/boot/boot.css||$:/core/templates/css-tiddler}}`
-{{$:/core/templates/store.area.template.html}} +`{{$:/core/templates/store.area.template.html}}` -{{{ [all[shadows+tiddlers]tag[$:/tags/RawMarkupWikified/BottomBody]] ||$:/core/templates/raw-static-tiddler}}} +`{{{ [enlisttag[$:/tags/RawMarkupWikified/BottomBody]] ||$:/core/templates/raw-static-tiddler}}}` + + - - - +` + \ No newline at end of file diff --git a/core/ui/DownloadFullWiki.tid b/core/ui/DownloadFullWiki.tid new file mode 100644 index 000000000..bfae2ceb6 --- /dev/null +++ b/core/ui/DownloadFullWiki.tid @@ -0,0 +1,18 @@ +title: $:/core/ui/DownloadFullWiki + +\whitespace trim +\rules except wikilink + +To download the standard single-file version of your wiki: + +<$wikify name="site-title" text={{$:/config/SaveWikiButton/Filename}}> +<$let publishFilter="""-[[$:/config/SaveWikiButton/Template]] -[[$:/plugins/tiddlywiki/filesystem]] -[[$:/plugins/tiddlywiki/tiddlyweb]]"""> +<$button tooltip="Download fully standalone wiki" aria-label="download full wiki" class="tc-btn-big-green"> +<$action-sendmessage $message="tm-download-file" $param="$:/core/save/all" publishFilter=<> filename=<>/> +{{$:/core/images/download-button}} + +Download full wiki + + + + \ No newline at end of file diff --git a/core/ui/ExportTiddlyWikiCore.tid b/core/ui/ExportTiddlyWikiCore.tid index 8c85c87a4..4b913a020 100644 --- a/core/ui/ExportTiddlyWikiCore.tid +++ b/core/ui/ExportTiddlyWikiCore.tid @@ -1,11 +1,6 @@ title: $:/core/ui/ExportTiddlyWikiCore \define jsFileName() tiddlywikicore-$(version)$.js -\define noExportMsg() -It appears that you have a wiki with an external ~TiddlyWiki core. The export action cannot be performed. -

You will need to view the page source in your browser. Then go to the very bottom the the source, find the last `` \ No newline at end of file +-->`` data-tiddler-revision="`<>`" data-tiddler-bag="default" type="text/javascript">`<$view field="text" format="text" />`` \ No newline at end of file From c20c35c0a65f20c7c362fba39d62832b10261b58 Mon Sep 17 00:00:00 2001 From: Cameron Fischer Date: Thu, 19 Jan 2023 12:48:23 -0500 Subject: [PATCH 24/34] Fully committing core to the $genesis widget (#7129) --- core/wiki/macros/list.tid | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/core/wiki/macros/list.tid b/core/wiki/macros/list.tid index 2d82b601a..5464ecad1 100644 --- a/core/wiki/macros/list.tid +++ b/core/wiki/macros/list.tid @@ -26,7 +26,7 @@ tags: $:/tags/Macro \whitespace trim <$vars targetTiddler="""$tiddler$""" targetField="""$field$"""> -<$type$ class="$class$"> +<$genesis $type=<<__type__>> class="$class$"> <$list filter="[list[$tiddler$!!$field$]]" emptyMessage=<<__emptyMessage__>>> <$droppable actions=<> tag="""$subtype$""" enable=<>>

@@ -51,7 +51,7 @@ tags: $:/tags/Macro
- + \end @@ -84,24 +84,24 @@ tags: $:/tags/Macro <$set name="tag" value=<<__tag__>>> <$list filter="[<__tag__>tagging[]$subFilter$]" emptyMessage=<<__emptyMessage__>> storyview=<<__storyview__>>> -<$elementTag$ class="tc-menu-list-item"> +<$genesis $type=<<__elementTag__>> class="tc-menu-list-item"> <$droppable actions="""<$macrocall $name="list-tagged-draggable-drop-actions" tag=<<__tag__>>/>""" enable=<>> -<$elementTag$ class="tc-droppable-placeholder"/> -<$elementTag$> +<$genesis $type=<<__elementTag__>> class="tc-droppable-placeholder"/> +<$genesis $type=<<__elementTag__>>> <$transclude tiddler="""$itemTemplate$"""> <$link to={{!!title}}> <$view field="title"/> - + - + <$tiddler tiddler=""> <$droppable actions="""<$macrocall $name="list-tagged-draggable-drop-actions" tag=<<__tag__>>/>""" enable=<>> -<$elementTag$ class="tc-droppable-placeholder"/> -<$elementTag$ style="height:0.5em;"> - +<$genesis $type=<<__elementTag__>> class="tc-droppable-placeholder"/> +<$genesis $type=<<__elementTag__>> style="height:0.5em;"> + From e6189078ffa8d4026eb18e88e93c0e29d854fdf1 Mon Sep 17 00:00:00 2001 From: Mario Pietsch Date: Thu, 19 Jan 2023 21:44:00 +0100 Subject: [PATCH 25/34] Make tag-picker and keyboard-driven-input macros human readable (#7118) * make tag-picker and keyboard-driven-input macros human readable * fix indentation as requested --- core/wiki/macros/keyboard-driven-input.tid | 125 +++++++------ core/wiki/macros/tag-picker.tid | 203 ++++++++++++++------- 2 files changed, 208 insertions(+), 120 deletions(-) diff --git a/core/wiki/macros/keyboard-driven-input.tid b/core/wiki/macros/keyboard-driven-input.tid index f7563996a..7983ea9f0 100644 --- a/core/wiki/macros/keyboard-driven-input.tid +++ b/core/wiki/macros/keyboard-driven-input.tid @@ -4,76 +4,85 @@ tags: $:/tags/Macro \define change-input-tab(stateTitle,tag,beforeafter,defaultState,actions) \whitespace trim <$set name="tabsList" filter="[all[shadows+tiddlers]tag<__tag__>!has[draft.of]]"> -<$let - currentState={{{ [<__stateTitle__>!is[missing]get[text]] ~[<__defaultState__>] }}} - firstTab={{{ [enlistnth[1]] }}} - lastTab={{{ [enlistlast[]] }}} - nextTab={{{ [all[shadows+tiddlers]tag<__tag__>!has[draft.of]$beforeafter$] ~[[$beforeafter$]removeprefix[after]suffix[]addprefix] ~[[$beforeafter$]removeprefix[before]suffix[]addprefix] }}}> -<$action-setfield $tiddler=<<__stateTitle__>> text=<>/> -$actions$ - + <$let + currentState={{{ [<__stateTitle__>!is[missing]get[text]] ~[<__defaultState__>] }}} + firstTab={{{ [enlistnth[1]] }}} + lastTab={{{ [enlistlast[]] }}} + nextTab={{{ [all[shadows+tiddlers]tag<__tag__>!has[draft.of]$beforeafter$] ~[[$beforeafter$]removeprefix[after]suffix[]addprefix] ~[[$beforeafter$]removeprefix[before]suffix[]addprefix] }}} + > + <$action-setfield $tiddler=<<__stateTitle__>> text=<>/> + $actions$ + \end \define keyboard-input-actions() \whitespace trim <$list filter="[<__index__>match[]]"> -<$action-setfield $tiddler=<<__storeTitle__>> text={{{ [<__tiddler__>get<__field__>] }}}/> + <$action-setfield $tiddler=<<__storeTitle__>> text={{{ [<__tiddler__>get<__field__>] }}}/> <$list filter="[<__index__>!match[]]"> -<$action-setfield $tiddler=<<__storeTitle__>> text={{{ [<__tiddler__>getindex<__index__>] }}}/> + <$action-setfield $tiddler=<<__storeTitle__>> text={{{ [<__tiddler__>getindex<__index__>] }}}/> \end \define input-next-actions-inner() \whitespace trim <$list filter="[minlength[1]]" variable="ignore"> -<$action-setfield $tiddler=<<__selectionStateTitle__>> text=<>/> -<$list filter="[<__index__>match[]]"> -<$action-setfield $tiddler=<<__tiddler__>> $field=<<__field__>> $value={{{ [] +[splitregexp[(?:.(?!-))+$]] }}}/> - -<$list filter="[<__index__>!match[]]"> -<$action-setfield $tiddler=<<__tiddler__>> $index=<<__index__>> $value={{{ [] +[splitregexp[(?:.(?!-))+$]] }}}/> - -<$action-setfield $tiddler=<<__refreshTitle__>> text="yes"/> + <$action-setfield $tiddler=<<__selectionStateTitle__>> text=<>/> + <$list filter="[<__index__>match[]]"> + <$action-setfield $tiddler=<<__tiddler__>> $field=<<__field__>> $value={{{ [] +[splitregexp[(?:.(?!-))+$]] }}}/> + + <$list filter="[<__index__>!match[]]"> + <$action-setfield $tiddler=<<__tiddler__>> $index=<<__index__>> $value={{{ [] +[splitregexp[(?:.(?!-))+$]] }}}/> + + <$action-setfield $tiddler=<<__refreshTitle__>> text="yes"/> \end \define input-next-actions(afterOrBefore:"after",reverse:"") \whitespace trim -<$list filter="[<__storeTitle__>get[text]minlength<__filterMinLength__>] [<__filterMinLength__>match[0]] +[limit[1]]" variable="ignore"> -<$let - userInput={{{ [<__storeTitle__>get[text]] }}} - selectedItem={{{ [<__selectionStateTitle__>get[text]] }}} - configTiddler={{{ [subfilter<__configTiddlerFilter__>] }}} - primaryListFilter={{{ [get<__firstSearchFilterField__>] }}} - secondaryListFilter={{{ [get<__secondSearchFilterField__>] }}}> -<$set name="filteredList" filter="[subfilteraddsuffix[-primaryList]] =[subfilteraddsuffix[-secondaryList]]"> -<$let - nextItem={{{ [enlist$afterOrBefore$] ~[enlist$reverse$nth[1]] }}} - firstItem={{{ [enlistnth[1]] }}} - lastItem={{{ [enlistlast[]] }}}> -<$list filter="[match!match]" variable="ignore"> -<$set name="nextItem" value={{{ [[$afterOrBefore$]match[before]thenaddsuffix[-userInput]] ~[] }}}> -<> - - -<$list filter="[match!match]" variable="ignore"> -<$set name="nextItem" value={{{ [[$afterOrBefore$]match[after]thenaddsuffix[-userInput]] ~[] }}}> -<> - - -<$list filter="[matchmatch]" variable="ignore"> -<$set name="nextItem" value={{{ [addsuffix[-userInput]] }}}> -<> - - -<$list filter="[!match!match]" variable="ignore"> -<> - - - - +<$list + filter="[<__storeTitle__>get[text]minlength<__filterMinLength__>] [<__filterMinLength__>match[0]] +[limit[1]]" + variable="ignore" +> + <$let + userInput={{{ [<__storeTitle__>get[text]] }}} + selectedItem={{{ [<__selectionStateTitle__>get[text]] }}} + configTiddler={{{ [subfilter<__configTiddlerFilter__>] }}} + primaryListFilter={{{ [get<__firstSearchFilterField__>] }}} + secondaryListFilter={{{ [get<__secondSearchFilterField__>] }}} + > + <$set + name="filteredList" + filter="[subfilteraddsuffix[-primaryList]] =[subfilteraddsuffix[-secondaryList]]" + > + <$let + nextItem={{{ [enlist$afterOrBefore$] ~[enlist$reverse$nth[1]] }}} + firstItem={{{ [enlistnth[1]] }}} + lastItem={{{ [enlistlast[]] }}} + > + <$list filter="[match!match]" variable="ignore"> + <$set name="nextItem" value={{{ [[$afterOrBefore$]match[before]thenaddsuffix[-userInput]] ~[] }}}> + <> + + + <$list filter="[match!match]" variable="ignore"> + <$set name="nextItem" value={{{ [[$afterOrBefore$]match[after]thenaddsuffix[-userInput]] ~[] }}}> + <> + + + <$list filter="[matchmatch]" variable="ignore"> + <$set name="nextItem" value={{{ [addsuffix[-userInput]] }}}> + <> + + + <$list filter="[!match!match]" variable="ignore"> + <> + + + + \end @@ -84,12 +93,14 @@ $actions$ <$keyboard key="((input-up))" actions=<>> <$keyboard key="((input-down))" actions=<>> <$keyboard key="((input-cancel))" actions=<<__inputCancelActions__>>> -<$edit-text tiddler=<<__tiddler__>> field=<<__field__>> index=<<__index__>> - inputActions=<> tag=<<__tag__>> class=<<__class__>> - placeholder=<<__placeholder__>> default=<<__default__>> focusPopup=<<__focusPopup__>> - focus=<<__focus__>> type=<<__type__>> rows=<<__rows__>> minHeight=<<__minHeight__>> - tabindex=<<__tabindex__>> size=<<__size__>> autoHeight=<<__autoHeight__>> - refreshTitle=<<__refreshTitle__>> cancelPopups=<<__cancelPopups__>>/> + <$edit-text + tiddler=<<__tiddler__>> field=<<__field__>> index=<<__index__>> + inputActions=<> tag=<<__tag__>> class=<<__class__>> + placeholder=<<__placeholder__>> default=<<__default__>> focusPopup=<<__focusPopup__>> + focus=<<__focus__>> type=<<__type__>> rows=<<__rows__>> minHeight=<<__minHeight__>> + tabindex=<<__tabindex__>> size=<<__size__>> autoHeight=<<__autoHeight__>> + refreshTitle=<<__refreshTitle__>> cancelPopups=<<__cancelPopups__>> + /> diff --git a/core/wiki/macros/tag-picker.tid b/core/wiki/macros/tag-picker.tid index 92982a656..e1b1a7139 100644 --- a/core/wiki/macros/tag-picker.tid +++ b/core/wiki/macros/tag-picker.tid @@ -10,10 +10,14 @@ second-search-filter: [tags[]is[system]search:titlesort[]] \define add-tag-actions(actions,tagField:"tags") \whitespace trim <$set name="tag" value={{{ [<__tiddler__>get[text]] }}}> -<$list filter="[!contains:$tagField$!match[]]" variable="ignore" emptyMessage="<$action-listops $tiddler=<> $field=<<__tagField__>> $subfilter='-[]'/>"> -<$action-listops $tiddler=<> $field=<<__tagField__>> $subfilter="[trim[]]"/> -$actions$ - + <$list + filter="[!contains:$tagField$!match[]]" + variable="ignore" + emptyMessage="<$action-listops $tiddler=<> $field=<<__tagField__>> $subfilter='-[]'/>" + > + <$action-listops $tiddler=<> $field=<<__tagField__>> $subfilter="[trim[]]"/> + $actions$ + <> <$action-setfield $tiddler=<> text="yes"/> @@ -21,80 +25,153 @@ $actions$ \define clear-tags-actions-inner() \whitespace trim -<$list filter="[has[text]] [has[text]]" variable="ignore" emptyMessage="<>"> -<> +<$list + filter="[has[text]] [has[text]]" + variable="ignore" + emptyMessage="<>" +> + <> \end \define clear-tags-actions() \whitespace trim <$set name="userInput" value={{{ [get[text]] }}}> -<$list filter="[get[text]!match]" emptyMessage="<>"> -<$action-setfield $tiddler=<> text=<>/><$action-setfield $tiddler=<> text="yes"/> - + <$list filter="[get[text]!match]" emptyMessage="<>"> + <$action-setfield $tiddler=<> text=<>/><$action-setfield $tiddler=<> text="yes"/> + \end \define tag-picker-inner(actions,tagField:"tags") \whitespace trim -<$vars newTagNameInputTiddlerQualified=<> newTagNameSelectionTiddlerQualified=<> fallbackTarget={{$(palette)$##tag-background}} colourA={{$(palette)$##foreground}} colourB={{$(palette)$##background}}> -<$vars storeTitle={{{ [!match[]] ~[] }}} tagSelectionState={{{ [!match[]] ~[] }}}> -<$vars refreshTitle=<> nonSystemTagsFilter="[tags[]!is[system]search:titlesort[]]" systemTagsFilter="[tags[]is[system]search:titlesort[]]"> -
-
- -<$macrocall $name="keyboard-driven-input" tiddler=<> storeTitle=<> refreshTitle=<> - selectionStateTitle=<> inputAcceptActions="<$macrocall $name='add-tag-actions' actions=<<__actions__>> tagField=<<__tagField__>>/>" - inputCancelActions=<> tag="input" placeholder={{$:/language/EditTemplate/Tags/Add/Placeholder}} - focusPopup=<> class="tc-edit-texteditor tc-popup-handle" tabindex=<> - focus={{{ [{$:/config/AutoFocus}match[tags]then[true]] ~[[false]] }}} filterMinLength={{$:/config/Tags/MinLength}} - cancelPopups=<> configTiddlerFilter="[[$:/core/macros/tag-picker]]"/> -<$button popup=<> class="tc-btn-invisible tc-btn-dropdown" tooltip={{$:/language/EditTemplate/Tags/Dropdown/Hint}} aria-label={{$:/language/EditTemplate/Tags/Dropdown/Caption}}>{{$:/core/images/down-arrow}}<$reveal state=<> type="nomatch" text=""><$button class="tc-btn-invisible tc-small-gap tc-btn-dropdown" tooltip={{$:/language/EditTemplate/Tags/ClearInput/Hint}} aria-label={{$:/language/EditTemplate/Tags/ClearInput/Caption}}>{{$:/core/images/close-button}}<> -<$set name="tag" value={{{ [get[text]] }}}> -<$button set=<> setTo="" class=""> -<$action-listops $tiddler=<> $field=<<__tagField__>> $subfilter="[trim[]]"/> -$actions$ -<$set name="currentTiddlerCSSEscaped" value={{{ [escapecss[]] }}}> -<><$action-sendmessage $message="tm-focus-selector" $param=<>/> - -{{$:/language/EditTemplate/Tags/Add/Button}} - - - -
-
-<$reveal state=<> type="nomatch" text="" default=""> -
-<$set name="userInput" value={{{ [get[text]] }}}> -<$list filter="[minlength{$:/config/Tags/MinLength}limit[1]]" emptyMessage="
{{$:/language/Search/Search/TooShort}}
" variable="listItem"> -<$list filter=<> variable="tag"> -<$list filter="[addsuffix[-primaryList]] -[get[text]]" emptyMessage="<$vars button-classes='tc-btn-invisible tc-tag-button-selected' actions=<<__actions__>> tagField=<<__tagField__>> currentTiddler=<>>{{||$:/core/ui/TagPickerTagTemplate}}"> -<$vars button-classes="tc-btn-invisible" actions=<<__actions__>> tagField=<<__tagField__>> currentTiddler=<>>{{||$:/core/ui/TagPickerTagTemplate}} - - -
-<$list filter="[minlength{$:/config/Tags/MinLength}limit[1]]" emptyMessage="
{{$:/language/Search/Search/TooShort}}
" variable="listItem"> -<$list filter=<> variable="tag"> -<$list filter="[addsuffix[-secondaryList]] -[get[text]]" emptyMessage="<$vars button-classes='tc-btn-invisible tc-tag-button-selected' actions=<<__actions__>> tagField=<<__tagField__>> currentTiddler=<>>{{||$:/core/ui/TagPickerTagTemplate}}"> -<$vars button-classes="tc-btn-invisible" actions=<<__actions__>> tagField=<<__tagField__>> currentTiddler=<>>{{||$:/core/ui/TagPickerTagTemplate}} - - - -
- -
-
- - +<$vars + newTagNameInputTiddlerQualified=<> + newTagNameSelectionTiddlerQualified=<> + fallbackTarget={{$(palette)$##tag-background}} + colourA={{$(palette)$##foreground}} + colourB={{$(palette)$##background}} +> + <$vars + storeTitle={{{ [!match[]] ~[] }}} + tagSelectionState={{{ [!match[]] ~[] }}} + > + <$vars + refreshTitle=<> + nonSystemTagsFilter="[tags[]!is[system]search:titlesort[]]" + systemTagsFilter="[tags[]is[system]search:titlesort[]]" + > +
+
+ + <$macrocall + $name="keyboard-driven-input" + tiddler=<> + storeTitle=<> + refreshTitle=<> + selectionStateTitle=<> + inputAcceptActions="<$macrocall $name='add-tag-actions' actions=<<__actions__>> tagField=<<__tagField__>>/>" + inputCancelActions=<> + tag="input" + placeholder={{$:/language/EditTemplate/Tags/Add/Placeholder}} + focusPopup=<> + class="tc-edit-texteditor tc-popup-handle" + tabindex=<> + focus={{{ [{$:/config/AutoFocus}match[tags]then[true]] ~[[false]] }}} + filterMinLength={{$:/config/Tags/MinLength}} + cancelPopups=<> + configTiddlerFilter="[[$:/core/macros/tag-picker]]" + /> + + <$button popup=<> + class="tc-btn-invisible tc-btn-dropdown" + tooltip={{$:/language/EditTemplate/Tags/Dropdown/Hint}} + aria-label={{$:/language/EditTemplate/Tags/Dropdown/Caption}} + > + {{$:/core/images/down-arrow}} + + <$reveal state=<> type="nomatch" text=""> + <$button class="tc-btn-invisible tc-small-gap tc-btn-dropdown" + tooltip={{$:/language/EditTemplate/Tags/ClearInput/Hint}} + aria-label={{$:/language/EditTemplate/Tags/ClearInput/Caption}} + > + {{$:/core/images/close-button}}<> + + + + <$set name="tag" value={{{ [get[text]] }}}> + <$button set=<> setTo="" class=""> + <$action-listops $tiddler=<> $field=<<__tagField__>> $subfilter="[trim[]]"/> + $actions$ + <$set name="currentTiddlerCSSEscaped" value={{{ [escapecss[]] }}}> + <><$action-sendmessage $message="tm-focus-selector" $param=<>/> + + {{$:/language/EditTemplate/Tags/Add/Button}} + + + +
+
+ <$reveal state=<> type="nomatch" text="" default=""> +
+ <$set name="userInput" value={{{ [get[text]] }}}> + <$list + filter="[minlength{$:/config/Tags/MinLength}limit[1]]" + emptyMessage="
+ {{$:/language/Search/Search/TooShort}}
" variable="listItem"> + <$list filter=<> variable="tag"> + <$list + filter="[addsuffix[-primaryList]] -[get[text]]" + emptyMessage="<$vars button-classes='tc-btn-invisible tc-tag-button-selected' actions=<<__actions__>> tagField=<<__tagField__>> currentTiddler=<>>{{||$:/core/ui/TagPickerTagTemplate}}" + > + <$vars button-classes="tc-btn-invisible" + actions=<<__actions__>> + tagField=<<__tagField__>> + currentTiddler=<> + > + {{||$:/core/ui/TagPickerTagTemplate}} + + + + +
+ <$list filter="[minlength{$:/config/Tags/MinLength}limit[1]]" emptyMessage="
+ {{$:/language/Search/Search/TooShort}}
" variable="listItem"> + <$list filter=<> variable="tag"> + <$list filter="[addsuffix[-secondaryList]] -[get[text]]" + emptyMessage="<$vars button-classes='tc-btn-invisible tc-tag-button-selected' actions=<<__actions__>> tagField=<<__tagField__>> currentTiddler=<>>{{||$:/core/ui/TagPickerTagTemplate}}" + > + <$vars button-classes="tc-btn-invisible" + actions=<<__actions__>> + tagField=<<__tagField__>> + currentTiddler=<> + > + {{||$:/core/ui/TagPickerTagTemplate}} + + + + + +
+ +
+
+ + \end + \define tag-picker(actions,tagField:"tags") \whitespace trim <$vars saveTiddler=<> palette={{$:/palette}}> -<$list filter="[match[]]" emptyMessage="<$macrocall $name='tag-picker-inner' actions=<<__actions__>> tagField=<<__tagField__>>/>"> -<$set name="newTagNameTiddler" value=<>> -<$macrocall $name="tag-picker-inner" actions=<<__actions__>> tagField=<<__tagField__>>/> - - + <$list + filter="[match[]]" + emptyMessage="<$macrocall $name='tag-picker-inner' actions=<<__actions__>> tagField=<<__tagField__>>/>" + > + <$set name="newTagNameTiddler" value=<>> + <$macrocall $name="tag-picker-inner" actions=<<__actions__>> tagField=<<__tagField__>>/> + + \end From 8ef6d78beffb6496fe5daa2c81a529a79046ba3c Mon Sep 17 00:00:00 2001 From: "jeremy@jermolene.com" Date: Thu, 19 Jan 2023 21:16:46 +0000 Subject: [PATCH 26/34] Filesystemadaptor: Use json format for tiddlers with fieldnames containing hash Fixes #7144 --- core/modules/utils/filesystem.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/modules/utils/filesystem.js b/core/modules/utils/filesystem.js index dd2672ceb..cb542493f 100644 --- a/core/modules/utils/filesystem.js +++ b/core/modules/utils/filesystem.js @@ -228,7 +228,7 @@ exports.generateTiddlerFileInfo = function(tiddler,options) { hasUnsafeFields = hasUnsafeFields || /[\x00-\x1F]/mg.test(value); hasUnsafeFields = hasUnsafeFields || ($tw.utils.trim(value) !== value); } - hasUnsafeFields = hasUnsafeFields || /:/mg.test(fieldName); + hasUnsafeFields = hasUnsafeFields || /:|#/mg.test(fieldName); }); // Check for field values if(hasUnsafeFields) { From 6718f82b4cbb9b73772ff371bcca0baf16e5c2f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=A9lumire?= <31185220+Telumire@users.noreply.github.com> Date: Fri, 20 Jan 2023 11:15:35 +0100 Subject: [PATCH 27/34] Small gap fix for the updated toc macro (alternative to tc-tiny-gap-left) (#7219) --- core/wiki/macros/toc.tid | 2 +- themes/tiddlywiki/vanilla/base.tid | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/core/wiki/macros/toc.tid b/core/wiki/macros/toc.tid index c26351385..6b8a83295 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"/> diff --git a/themes/tiddlywiki/vanilla/base.tid b/themes/tiddlywiki/vanilla/base.tid index 027541cc7..9b7104cbd 100644 --- a/themes/tiddlywiki/vanilla/base.tid +++ b/themes/tiddlywiki/vanilla/base.tid @@ -2774,6 +2774,11 @@ input.tc-palette-manager-colour-input { color: <>; } +button + .tc-toc-caption, +button > .tc-toc-caption{ + margin-left: .25em; +} + .tc-table-of-contents svg { width: 0.7em; height: 0.7em; From 194df33de3d590b5ba52166bf18af013f12bbd27 Mon Sep 17 00:00:00 2001 From: "jeremy@jermolene.com" Date: Sat, 21 Jan 2023 13:57:14 +0000 Subject: [PATCH 28/34] Update release note --- .../prerelease/tiddlers/Release 5.2.6.tid | 42 +++++++++++++++---- 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/editions/prerelease/tiddlers/Release 5.2.6.tid b/editions/prerelease/tiddlers/Release 5.2.6.tid index d1b1343bc..d4bde1632 100644 --- a/editions/prerelease/tiddlers/Release 5.2.6.tid +++ b/editions/prerelease/tiddlers/Release 5.2.6.tid @@ -1,6 +1,6 @@ caption: 5.2.6 -created: 20221219172444961 -modified: 20221219172444961 +created: 20230119221001957 +modified: 20230119221001957 tags: ReleaseNotes title: Release 5.2.6 type: text/vnd.tiddlywiki @@ -13,11 +13,21 @@ type: text/vnd.tiddlywiki Improvements to the following translations: -* +* Chinese +* Italian + +! Plugin Improvements + +* <<.link-badge-updated "https://github.com/Jermolene/TiddlyWiki5/pull/6528">> the [[Markdown Plugin]] to use the newer and better maintained [[markdown-it|https://github.com/markdown-it/markdown-it]] library. The previous Markdown plugin remains available as "markdown-legacy" +* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7176">> [[Innerwiki Plugin]] to allow the `<$data>` widget to override existing tiddler fields +* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7207">>, <<.link-badge-here "https://github.com/Jermolene/TiddlyWiki5/commit/c39ef398bffae12c0ed7324d9b6d9d29f0f2f9ff">> and <<.link-badge-here "https://github.com/Jermolene/TiddlyWiki5/commit/8f7441f296351a4dd0852c3c782f8874d398e052">> problem preventing [[Share Plugin]] from working properly + ! Usability Improvements -* +* <<.link-badge-improved "https://github.com/Jermolene/TiddlyWiki5/pull/7217">> consistency of tiddler deletion by allowing missing tiddlers to be 'deleted', which just results in them being closed +* <<.link-badge-improved "https://github.com/Jermolene/TiddlyWiki5/commit/34643a42790777f1b235f57b5093bb29bd0b3a14">> layout switcher to include an optional icon for each layout +* <<.link-badge-removed "https://github.com/Jermolene/TiddlyWiki5/commit/c0615e20ecf7d5d5e66d8a2acd28b80e8d59688d">> [[improvements to table layout|https://github.com/Jermolene/TiddlyWiki5/pull/7010]] from v5.2.5 that have proved to not be backwards compatible ! Widget Improvements @@ -25,19 +35,35 @@ Improvements to the following translations: ! Filter improvements -* +* <<.link-badge-extended "https://github.com/Jermolene/TiddlyWiki5/pull/7121">> [[encodeuricomponent Operator]] to encode characters such as `*` that are illegal in Windows filenames ! Hackability Improvements -* +* <<.link-badge-extended "https://github.com/Jermolene/TiddlyWiki5/pull/7185">> the [[pragma|Pragma]] syntax to allow them to be indented with whitespace +* <<.link-badge-improved "https://github.com/Jermolene/TiddlyWiki5/pull/7118">> readability of [[tag-picker Macro]] and [[keyboard-driven-input Macro]] +* <<.link-badge-improved "https://github.com/Jermolene/TiddlyWiki5/pull/7129">> reliability of [[list-links-draggable Macro]] and [[list-tagged-draggable Macro]] by using the new GenesisWidget instead of textual substitution +* <<.link-badge-improved "https://github.com/Jermolene/TiddlyWiki5/pull/7210">> [[external JavaScript core support|Using the external JavaScript template]] to make it possible to save an external JS wiki as a standard single file wiki ! Bug Fixes -* +* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/6622">> bug with the DropzoneWidget that prevented all the available formats being pasted +* <<.link-badge-updated "https://github.com/Jermolene/TiddlyWiki5/pull/7102">> PDF rendering to use an `