From 5df0225356ee734e5e847a86e186ecb203cd807f Mon Sep 17 00:00:00 2001 From: Simon Huber Date: Mon, 7 Dec 2020 11:22:02 +0100 Subject: [PATCH 01/10] Update Customising search results.tid (#5225) --- .../customising/Customising search results.tid | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/editions/tw5.com/tiddlers/customising/Customising search results.tid b/editions/tw5.com/tiddlers/customising/Customising search results.tid index b08500421..a1a64bae4 100644 --- a/editions/tw5.com/tiddlers/customising/Customising search results.tid +++ b/editions/tw5.com/tiddlers/customising/Customising search results.tid @@ -29,3 +29,21 @@ Here is an example of an alternative visualisation that displays results in reve <> ``` +<<.from-version 5.1.23>> The sidebar search introduces a more sophisticated search-mechanism which makes it possible to navigate the search results using the keyboard shortcuts <> and <>. To add that mechanism to your own custom search results follow these simple steps: + +# Your tiddler tagged <>is accessible through the <<.var configTiddler>> variable +# The user-input in the search field is accessible through the <<.var userInput>> variable +# Use the fields <<.field first-search-filter>> and <<.field second-search-filter>> to store the filters used for your search results. See the tiddler $:/core/ui/DefaultSearchResultList for details +# Use the following form so that navigated search-results are highlighted, modify it to match your needs: + +``` +<$list filter="[minlength[1]]" variable="ignore"> +<$list filter={{{ [get[first-search-filter]] }}}> +addsuffix[-primaryList]] -[get[text]] +[then[]else[tc-list-item-selected]] }}}> +<$transclude tiddler="$:/core/ui/ListItemTemplate"/> + + + +``` + +<$macrocall $name=".tip" _="Note that the <<.var searchTiddler>> variable still contains the name of the tiddler that is used for sorting the search results. The <<.var editTiddler>> variable contains the name of the tiddler that is being edited."/> From 90f05295a2c1db74665796926d8d3f21e968ffa1 Mon Sep 17 00:00:00 2001 From: Simon Huber Date: Mon, 7 Dec 2020 15:43:44 +0100 Subject: [PATCH 02/10] Add missing config options to ControlPanel->Settings->CodeMirror (#5229) * Create cursorBlinkRate.tid * Update config-language.multids * Create indentUnit.tid * Create indentWithTabs.tid * Create smartIndent.tid * Create tabSize.tid --- plugins/tiddlywiki/codemirror/config-language.multids | 9 ++++++++- .../tiddlywiki/codemirror/settings/cursorBlinkRate.tid | 7 +++++++ plugins/tiddlywiki/codemirror/settings/indentUnit.tid | 7 +++++++ .../tiddlywiki/codemirror/settings/indentWithTabs.tid | 8 ++++++++ plugins/tiddlywiki/codemirror/settings/smartIndent.tid | 8 ++++++++ plugins/tiddlywiki/codemirror/settings/tabSize.tid | 7 +++++++ 6 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 plugins/tiddlywiki/codemirror/settings/cursorBlinkRate.tid create mode 100644 plugins/tiddlywiki/codemirror/settings/indentUnit.tid create mode 100644 plugins/tiddlywiki/codemirror/settings/indentWithTabs.tid create mode 100644 plugins/tiddlywiki/codemirror/settings/smartIndent.tid create mode 100644 plugins/tiddlywiki/codemirror/settings/tabSize.tid diff --git a/plugins/tiddlywiki/codemirror/config-language.multids b/plugins/tiddlywiki/codemirror/config-language.multids index 13cd693d9..05a5e6854 100644 --- a/plugins/tiddlywiki/codemirror/config-language.multids +++ b/plugins/tiddlywiki/codemirror/config-language.multids @@ -4,10 +4,14 @@ homeUrl: http://codemirror.net addOnUrl: http://codemirror.net/doc/manual.html#addons configUrl: http://codemirror.net/doc/manual.html#config controlPanel/hint: These settings let you customise the behaviour of [[CodeMirror|$:/plugins/tiddlywiki/codemirror]]. +controlPanel/keyboard: Keyboard shortcuts controlPanel/usage: Usage information +cursorBlinkRate/hint: Cursor blink rate editorFont/hint: Editor font family editorFont/info: Set the font family for the ~CodeMirror text-editor -controlPanel/keyboard: Keyboard shortcuts +indentUnit/hint: How many spaces a block should be indented +indentWithTabs/hint: Enable indenting with tabs +indentWithTabs/info: Whether, when indenting, the first N*`tabSize` spaces should be replaced by N tabs. keyMap/hint: ~CodeMirror keymap keyMap/info: ~The Keyboard KeyMap used within the ~CodeMirror text-editor lineNumbers/hint: Enable line numbers @@ -16,7 +20,10 @@ lineWrapping/hint: Enable line wrapping lineWrapping/info: Whether CodeMirror should scroll or wrap for long lines. Defaults to `false` (scroll). showCursorWhenSelecting/hint: Show cursor, when selecting showCursorWhenSelecting/info: Whether the cursor should be drawn when a selection is active. +smartIndent/hint: Enable smart indent +smartIndent/info: Whether to use the context-sensitive indentation that the mode provides (or just indent the same as the line before). Defaults to `true`. styleActiveLine/hint: Highlight active line styleActiveLine/info: Whether or not to highlight the active text-editor line +tabSize/hint: Width of a tab character theme/hint: Select a theme theme/info: Choose between ~CodeMirror themes diff --git a/plugins/tiddlywiki/codemirror/settings/cursorBlinkRate.tid b/plugins/tiddlywiki/codemirror/settings/cursorBlinkRate.tid new file mode 100644 index 000000000..ba540ea4c --- /dev/null +++ b/plugins/tiddlywiki/codemirror/settings/cursorBlinkRate.tid @@ -0,0 +1,7 @@ +title: $:/core/ui/ControlPanel/Settings/codemirror/cursorBlinkRate +tags: $:/tags/ControlPanel/Settings/CodeMirror +caption: {{$:/language/codemirror/cursorBlinkRate/hint}} + +\define lingo-base() $:/language/codemirror/cursorBlinkRate/ + +|<$link to="$:/config/codemirror/cursorBlinkRate"><> |<$edit-text tiddler="$:/config/codemirror/cursorBlinkRate" default="" placeholder="cursorBlinkRate" tag="input"/> | diff --git a/plugins/tiddlywiki/codemirror/settings/indentUnit.tid b/plugins/tiddlywiki/codemirror/settings/indentUnit.tid new file mode 100644 index 000000000..b463f3e78 --- /dev/null +++ b/plugins/tiddlywiki/codemirror/settings/indentUnit.tid @@ -0,0 +1,7 @@ +title: $:/core/ui/ControlPanel/Settings/codemirror/indentUnit +tags: $:/tags/ControlPanel/Settings/CodeMirror +caption: {{$:/language/codemirror/indentUnit/hint}} + +\define lingo-base() $:/language/codemirror/indentUnit/ + +|<$link to="$:/config/codemirror/indentUnit"><> |<$edit-text tiddler="$:/config/codemirror/indentUnit" default="" placeholder="indentUnit" tag="input"/> | diff --git a/plugins/tiddlywiki/codemirror/settings/indentWithTabs.tid b/plugins/tiddlywiki/codemirror/settings/indentWithTabs.tid new file mode 100644 index 000000000..16c5c9bb6 --- /dev/null +++ b/plugins/tiddlywiki/codemirror/settings/indentWithTabs.tid @@ -0,0 +1,8 @@ +title: $:/core/ui/ControlPanel/Settings/codemirror/indentWithTabs +tags: $:/tags/ControlPanel/Settings/CodeMirror +caption: {{$:/language/codemirror/indentWithTabs/hint}} + +\define lingo-base() $:/language/codemirror/indentWithTabs/ +<> + +<$checkbox tiddler="$:/config/codemirror/indentWithTabs" field="text" checked="true" unchecked="false" default="true"> <$link to="$:/config/codemirror/indentWithTabs"><> diff --git a/plugins/tiddlywiki/codemirror/settings/smartIndent.tid b/plugins/tiddlywiki/codemirror/settings/smartIndent.tid new file mode 100644 index 000000000..3f59e38af --- /dev/null +++ b/plugins/tiddlywiki/codemirror/settings/smartIndent.tid @@ -0,0 +1,8 @@ +title: $:/core/ui/ControlPanel/Settings/codemirror/smartIndent +tags: $:/tags/ControlPanel/Settings/CodeMirror +caption: {{$:/language/codemirror/smartIndent/hint}} + +\define lingo-base() $:/language/codemirror/smartIndent/ +<> + +<$checkbox tiddler="$:/config/codemirror/smartIndent" field="text" checked="true" unchecked="false" default="true"> <$link to="$:/config/codemirror/smartIndent"><> diff --git a/plugins/tiddlywiki/codemirror/settings/tabSize.tid b/plugins/tiddlywiki/codemirror/settings/tabSize.tid new file mode 100644 index 000000000..1ca932b19 --- /dev/null +++ b/plugins/tiddlywiki/codemirror/settings/tabSize.tid @@ -0,0 +1,7 @@ +title: $:/core/ui/ControlPanel/Settings/codemirror/tabSize +tags: $:/tags/ControlPanel/Settings/CodeMirror +caption: {{$:/language/codemirror/tabSize/hint}} + +\define lingo-base() $:/language/codemirror/tabSize/ + +|<$link to="$:/config/codemirror/tabSize"><> |<$edit-text tiddler="$:/config/codemirror/tabSize" default="" placeholder="tabSize" tag="input"/> | From 2c76cfa67a65e062713618fb059baaaa2f58a980 Mon Sep 17 00:00:00 2001 From: Simon Huber Date: Mon, 7 Dec 2020 15:44:07 +0100 Subject: [PATCH 03/10] Use displayshortcuts macro for keyboard_driven_input_macro tiddler (#5226) * Update keyboard-driven-input_Macro.tid * Update keyboard-driven-input_Macro.tid --- .../tiddlers/macros/keyboard-driven-input_Macro.tid | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/editions/tw5.com/tiddlers/macros/keyboard-driven-input_Macro.tid b/editions/tw5.com/tiddlers/macros/keyboard-driven-input_Macro.tid index 849aa74bc..720e612d1 100644 --- a/editions/tw5.com/tiddlers/macros/keyboard-driven-input_Macro.tid +++ b/editions/tw5.com/tiddlers/macros/keyboard-driven-input_Macro.tid @@ -1,7 +1,7 @@ title: keyboard-driven-input Macro tags: Macros [[Core Macros]] -The <<.def keyboard-driven-input>> [[macro|Macros]] generates an input field or textarea that lets you cycle through a given list of entries with the up and down arrow keys. Doing so, an entry gets selected and can be processed with further actions +The <<.def keyboard-driven-input>> [[macro|Macros]] generates an input field or textarea that lets you cycle through a given list of entries with the <> and <> keys. Doing so, an entry gets selected and can be processed with further actions !! Parameters @@ -12,9 +12,9 @@ The additional parameters are: |parameter |purpose |h |storeTitle |the title of the tiddler that stores the user input | |selectionStateTitle |the title of the tiddler that stores the selected entry with a -primaryList or -secondaryList suffix to make it unique | -|inputAcceptActions |the actions that get processed when the user hits {{$:/config/shortcuts/input-accept}} | -|inputAcceptVariantActions |the actions that get processed when the user hits {{$:/config/shortcuts/input-accept-variant}} | -|inputCancelActions |the actions that get processed when the user hits {{$:/config/shortcuts/input-cancel}} | +|inputAcceptActions |the actions that get processed when the user hits <> | +|inputAcceptVariantActions |the actions that get processed when the user hits <> | +|inputCancelActions |the actions that get processed when the user hits <> | |configTiddlerFilter |a ''filter'' that specifies the tiddler that stores the first item-filter in its <<.field first-search-filter>> field and the second item-filter in its <<.field second-search-filter>> field | |firstSearchFilterField |the field of the configTiddler where the first search-filter is stored. Defaults to <<.field first-search-filter>> | |secondSearchFilterField |the field of the configTiddler where the second search-filter is stored. Defaults to <<.field second-search-filter>> | From ce5d20b8fc72056a4c18b09a1135a5634e63888c Mon Sep 17 00:00:00 2001 From: Saq Imtiaz Date: Mon, 7 Dec 2020 16:53:49 +0100 Subject: [PATCH 04/10] Logging widgets :Fixed issue on Firefox where logging does not work (#5223) * Fixed issue on Firefox where logging does not work properly due to column names * Remove second argument to utils.logTable --- core/modules/utils/utils.js | 4 ++-- core/modules/widgets/action-log.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/modules/utils/utils.js b/core/modules/utils/utils.js index 14d251f01..4c9c3e96d 100644 --- a/core/modules/utils/utils.js +++ b/core/modules/utils/utils.js @@ -56,9 +56,9 @@ exports.warning = function(text) { /* Log a table of name: value pairs */ -exports.logTable = function(data,columnNames) { +exports.logTable = function(data) { if(console.table) { - console.table(data,columnNames); + console.table(data); } else { $tw.utils.each(data,function(value,name) { console.log(name + ": " + value); diff --git a/core/modules/widgets/action-log.js b/core/modules/widgets/action-log.js index 216eb1167..eacef94bc 100644 --- a/core/modules/widgets/action-log.js +++ b/core/modules/widgets/action-log.js @@ -78,11 +78,11 @@ LogWidget.prototype.log = function() { console.group(this.message); if(dataCount > 0) { - $tw.utils.logTable(data,["name","value"]); + $tw.utils.logTable(data); } if(this.logAll || !dataCount) { console.groupCollapsed("All variables"); - $tw.utils.logTable(allVars,["name","value"]); + $tw.utils.logTable(allVars); console.groupEnd(); } console.groupEnd(); From 85ff47366c5d00836404ccfefc6bdf48cf50009a Mon Sep 17 00:00:00 2001 From: Joshua Fontany Date: Mon, 7 Dec 2020 07:58:28 -0800 Subject: [PATCH 05/10] fix viewtemplate quirks (#5224) --- core/ui/TiddlerInfo/Advanced.tid | 2 +- core/ui/ViewTemplate/plugin.tid | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/core/ui/TiddlerInfo/Advanced.tid b/core/ui/TiddlerInfo/Advanced.tid index d14144558..2742a8398 100644 --- a/core/ui/TiddlerInfo/Advanced.tid +++ b/core/ui/TiddlerInfo/Advanced.tid @@ -3,6 +3,6 @@ tags: $:/tags/TiddlerInfo caption: {{$:/language/TiddlerInfo/Advanced/Caption}} <$list filter="[all[shadows+tiddlers]tag[$:/tags/TiddlerInfo/Advanced]!has[draft.of]]" variable="listItem"> -<$transclude tiddler=<>/> +<$transclude tiddler=<> mode="block"/> diff --git a/core/ui/ViewTemplate/plugin.tid b/core/ui/ViewTemplate/plugin.tid index 07bb3b618..564b209b3 100644 --- a/core/ui/ViewTemplate/plugin.tid +++ b/core/ui/ViewTemplate/plugin.tid @@ -1,6 +1,8 @@ title: $:/core/ui/ViewTemplate/plugin tags: $:/tags/ViewTemplate +<$reveal tag="div" class="tc-tiddler-plugin-info" type="nomatch" stateTitle=<> text="hide" retain="yes" animate="yes"> + <$list filter="[all[current]has[plugin-type]] -[all[current]field:plugin-type[import]]"> <$set name="plugin-type" value={{!!plugin-type}}> <$set name="default-popup-state" value="yes"> @@ -10,3 +12,4 @@ tags: $:/tags/ViewTemplate + \ No newline at end of file From a878d82c7a943695bed8dd2ed9df3b73b5ee3497 Mon Sep 17 00:00:00 2001 From: Joshua Fontany Date: Mon, 7 Dec 2020 07:59:32 -0800 Subject: [PATCH 06/10] Ignore edition filters if not running on node (#5222) --- core/modules/filters/editiondescription.js | 18 ++++++++++-------- core/modules/filters/editions.js | 16 +++++++++------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/core/modules/filters/editiondescription.js b/core/modules/filters/editiondescription.js index bca03e9bc..ee3acd898 100644 --- a/core/modules/filters/editiondescription.js +++ b/core/modules/filters/editiondescription.js @@ -16,14 +16,16 @@ Filter operator for returning the descriptions of the specified edition names Export our filter function */ exports.editiondescription = function(source,operator,options) { - var results = [], - editionInfo = $tw.utils.getEditionInfo(); - if(editionInfo) { - source(function(tiddler,title) { - if($tw.utils.hop(editionInfo,title)) { - results.push(editionInfo[title].description || ""); - } - }); + var results = []; + if($tw.node) { + var editionInfo = $tw.utils.getEditionInfo(); + if(editionInfo) { + source(function(tiddler,title) { + if($tw.utils.hop(editionInfo,title)) { + results.push(editionInfo[title].description || ""); + } + }); + } } return results; }; diff --git a/core/modules/filters/editions.js b/core/modules/filters/editions.js index 36f1dc8fd..05ae57c31 100644 --- a/core/modules/filters/editions.js +++ b/core/modules/filters/editions.js @@ -16,14 +16,16 @@ Filter operator for returning the names of the available editions in this wiki Export our filter function */ exports.editions = function(source,operator,options) { - var results = [], - editionInfo = $tw.utils.getEditionInfo(); - if(editionInfo) { - $tw.utils.each(editionInfo,function(info,name) { - results.push(name); - }); + var results = []; + if($tw.node) { + var editionInfo = $tw.utils.getEditionInfo(); + if(editionInfo) { + $tw.utils.each(editionInfo,function(info,name) { + results.push(name); + }); + } + results.sort(); } - results.sort(); return results; }; From bb6d41f3dd20fca01621479e6f80844b3edc9820 Mon Sep 17 00:00:00 2001 From: "jeremy@jermolene.com" Date: Mon, 7 Dec 2020 16:05:34 +0000 Subject: [PATCH 07/10] Macrocall widget: ensure we separately cache inline vs block parse trees Fixes a bug in #5205 --- core/modules/widgets/macrocall.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core/modules/widgets/macrocall.js b/core/modules/widgets/macrocall.js index adf1f908c..2381d0360 100644 --- a/core/modules/widgets/macrocall.js +++ b/core/modules/widgets/macrocall.js @@ -56,14 +56,15 @@ MacroCallWidget.prototype.execute = function() { if(this.renderOutput === "text/html") { // If so we'll return the parsed macro // Check if we've already cached parsing this macro - var parser; - if(variableInfo.srcVariable && variableInfo.srcVariable.parser) { - parser = variableInfo.srcVariable.parser; + var mode = this.parseTreeNode.isBlock ? "blockParser" : "inlineParser", + parser; + if(variableInfo.srcVariable && variableInfo.srcVariable[mode]) { + parser = variableInfo.srcVariable[mode]; } else { parser = this.wiki.parseText(this.parseType,text, {parseAsInline: !this.parseTreeNode.isBlock}); if(variableInfo.isCacheable && variableInfo.srcVariable) { - variableInfo.srcVariable.parser = parser; + variableInfo.srcVariable[mode] = parser; } } var parseTreeNodes = parser ? parser.tree : []; From 4334de88a011cd8bef2292258f038a47429f7a12 Mon Sep 17 00:00:00 2001 From: Simon Huber Date: Mon, 7 Dec 2020 18:29:42 +0100 Subject: [PATCH 08/10] Make search-matches button discoverable on dark palettes (#5232) --- themes/tiddlywiki/vanilla/base.tid | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/themes/tiddlywiki/vanilla/base.tid b/themes/tiddlywiki/vanilla/base.tid index 2010b45e6..2f60c4537 100644 --- a/themes/tiddlywiki/vanilla/base.tid +++ b/themes/tiddlywiki/vanilla/base.tid @@ -598,6 +598,10 @@ html body.tc-body .tc-btn-rounded:hover svg { color: <>; } +.tc-sidebar-lists button small { + color: <>; +} + button svg.tc-image-button, button .tc-image-button img { height: 1em; width: 1em; From 1d7091e637462dcda8c28d660ca42c073f647043 Mon Sep 17 00:00:00 2001 From: "jeremy@jermolene.com" Date: Tue, 8 Dec 2020 17:48:58 +0000 Subject: [PATCH 09/10] Hide .tid exporter when more than one tiddler to export Fixes #5237 --- core/templates/exporters/TidFile.tid | 1 + core/wiki/macros/export.tid | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/core/templates/exporters/TidFile.tid b/core/templates/exporters/TidFile.tid index 1e964818d..1dbd3503b 100644 --- a/core/templates/exporters/TidFile.tid +++ b/core/templates/exporters/TidFile.tid @@ -2,6 +2,7 @@ title: $:/core/templates/exporters/TidFile tags: $:/tags/Exporter description: {{$:/language/Exporters/TidFile}} extension: .tid +condition: [compare:lte[1]] \define renderContent() {{{ $(exportFilter)$ +[limit[1]] ||$:/core/templates/tid-tiddler}}} diff --git a/core/wiki/macros/export.tid b/core/wiki/macros/export.tid index c55df3ecb..629333ff8 100644 --- a/core/wiki/macros/export.tid +++ b/core/wiki/macros/export.tid @@ -15,7 +15,9 @@ $baseFilename$$(extension)$ <$reveal state=<> type="popup" position="below" animate="yes">
+<$set name="count" value={{{ [subfilter<__exportFilter__>count[]] }}}> <$list filter="[all[shadows+tiddlers]tag[$:/tags/Exporter]]"> +<$list filter="[has[condition]subfilter{!!condition}limit[1]] ~[!has[condition]then[true]]" variable="ignore"> <$set name="extension" value={{!!extension}}> <$button class="tc-btn-invisible"> <$action-sendmessage $message="tm-download-file" $param=<> exportFilter=<<__exportFilter__>> filename=<>/> @@ -24,6 +26,8 @@ $baseFilename$$(extension)$ + +
\end From 1e1aeefd935a1013245ea71d12be635f0847558a Mon Sep 17 00:00:00 2001 From: "jeremy@jermolene.com" Date: Wed, 9 Dec 2020 09:07:48 +0000 Subject: [PATCH 10/10] Fix add plugins modal Fixes #5235 --- core/ui/ControlPanel/Modals/AddPlugins.tid | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/ui/ControlPanel/Modals/AddPlugins.tid b/core/ui/ControlPanel/Modals/AddPlugins.tid index 063ca02ad..a7fbec1dd 100644 --- a/core/ui/ControlPanel/Modals/AddPlugins.tid +++ b/core/ui/ControlPanel/Modals/AddPlugins.tid @@ -148,7 +148,7 @@ $:/state/add-plugin-info/$(connectionTiddler)$/$(assetInfo)$ <$set name="transclusion" value=<>> -<$macrocall $name="tabs" tabsList="[[$:/core/ui/ControlPanel/Plugins/Add/Updates]] [[$:/core/ui/ControlPanel/Plugins/Add/Plugins]] [[$:/core/ui/ControlPanel/Plugins/Add/Themes]] [[$:/core/ui/ControlPanel/Plugins/Add/Languages]]" default="$:/core/ui/ControlPanel/Plugins/Add/Plugins" explicitState="$:/state/addplugins/tab-1342078386"/> +<>