1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-09-28 15:08:46 +00:00

Merge branch 'master' into geospatial-plugin

This commit is contained in:
Jeremy Ruston 2024-05-29 21:33:31 +01:00
commit bd2e3297aa
14 changed files with 67 additions and 32 deletions

View File

@ -1,7 +1,7 @@
title: $:/core/images/default-layout
title: $:/core/images/standard-layout
tags: $:/tags/Image
\parameters (size:"22pt")
<svg width=<<size>> height=<<size>> class="tc-image-default-layout tc-image-button" viewBox="0 0 128 128">
<svg width=<<size>> height=<<size>> class="tc-image-standard-layout tc-image-button" viewBox="0 0 128 128">
<path d="M71.93 72A8.07 8.07 0 0 1 80 80.07v7.86A8.071 8.071 0 0 1 71.93 96H8.07A8.067 8.067 0 0 1 0 87.93v-7.86A8.072 8.072 0 0 1 8.07 72h63.86Zm0 32a8.07 8.07 0 0 1 8.07 8.07v7.86a8.071 8.071 0 0 1-8.07 8.07H8.07A8.067 8.067 0 0 1 0 119.93v-7.86A8.072 8.072 0 0 1 8.07 104h63.86Zm0-104A8.068 8.068 0 0 1 80 8.07v47.86A8.073 8.073 0 0 1 71.93 64H8.07A8.07 8.07 0 0 1 0 55.93V8.07A8.072 8.072 0 0 1 8.07 0h63.86Zm48 0c2.14 0 4.193.85 5.706 2.364A8.067 8.067 0 0 1 128 8.07v111.86c0 2.14-.85 4.193-2.364 5.706A8.067 8.067 0 0 1 119.93 128H96.07c-2.14 0-4.193-.85-5.706-2.364A8.067 8.067 0 0 1 88 119.93V8.07c0-2.14.85-4.193 2.364-5.706A8.067 8.067 0 0 1 96.07 0h23.86ZM116 24h-16a3.995 3.995 0 0 0-2.828 1.172 3.995 3.995 0 0 0 0 5.656A3.995 3.995 0 0 0 100 32h16a3.995 3.995 0 0 0 2.828-1.172 3.995 3.995 0 0 0 0-5.656A3.995 3.995 0 0 0 116 24Z"/>
</svg>

View File

@ -70,7 +70,7 @@ No: No
OfficialPluginLibrary: Official ~TiddlyWiki Plugin Library
OfficialPluginLibrary/Hint: The official ~TiddlyWiki plugin library at tiddlywiki.com. Plugins, themes and language packs are maintained by the core team.
PageTemplate/Description: the default ~TiddlyWiki layout
PageTemplate/Name: Default ~PageTemplate
PageTemplate/Name: Standard Layout
PluginReloadWarning: Please save {{$:/core/ui/Buttons/save-wiki}} and reload {{$:/core/ui/Buttons/refresh}} to allow changes to ~JavaScript plugins to take effect
RecentChanges/DateFormat: DDth MMM YYYY
Shortcuts/Input/AdvancedSearch/Hint: Open the ~AdvancedSearch panel from within the sidebar search field

View File

@ -68,7 +68,10 @@ exports.startup = function() {
});
// Install the copy-to-clipboard mechanism
$tw.rootWidget.addEventListener("tm-copy-to-clipboard",function(event) {
$tw.utils.copyToClipboard(event.param);
$tw.utils.copyToClipboard(event.param,{
successNotification: event.paramObject.successNotification,
failureNotification: event.paramObject.failureNotification
});
});
// Install the tm-focus-selector message
$tw.rootWidget.addEventListener("tm-focus-selector",function(event) {

View File

@ -93,7 +93,9 @@ exports.startup = function() {
updateAddressBar: $tw.wiki.getTiddlerText(CONFIG_PERMALINKVIEW_UPDATE_ADDRESS_BAR,"yes").trim() === "yes" ? "permalink" : "none",
updateHistory: $tw.wiki.getTiddlerText(CONFIG_UPDATE_HISTORY,"no").trim(),
targetTiddler: event.param || event.tiddlerTitle,
copyToClipboard: $tw.wiki.getTiddlerText(CONFIG_PERMALINKVIEW_COPY_TO_CLIPBOARD,"yes").trim() === "yes" ? "permalink" : "none"
copyToClipboard: $tw.wiki.getTiddlerText(CONFIG_PERMALINKVIEW_COPY_TO_CLIPBOARD,"yes").trim() === "yes" ? "permalink" : "none",
successNotification: event.paramObject && event.paramObject.successNotification,
failureNotification: event.paramObject && event.paramObject.failureNotification
});
});
// Listen for the tm-permaview message
@ -102,7 +104,9 @@ exports.startup = function() {
updateAddressBar: $tw.wiki.getTiddlerText(CONFIG_PERMALINKVIEW_UPDATE_ADDRESS_BAR,"yes").trim() === "yes" ? "permaview" : "none",
updateHistory: $tw.wiki.getTiddlerText(CONFIG_UPDATE_HISTORY,"no").trim(),
targetTiddler: event.param || event.tiddlerTitle,
copyToClipboard: $tw.wiki.getTiddlerText(CONFIG_PERMALINKVIEW_COPY_TO_CLIPBOARD,"yes").trim() === "yes" ? "permaview" : "none"
copyToClipboard: $tw.wiki.getTiddlerText(CONFIG_PERMALINKVIEW_COPY_TO_CLIPBOARD,"yes").trim() === "yes" ? "permaview" : "none",
successNotification: event.paramObject && event.paramObject.successNotification,
failureNotification: event.paramObject && event.paramObject.failureNotification
});
});
}
@ -177,6 +181,8 @@ options.updateAddressBar: "permalink", "permaview" or "no" (defaults to "permavi
options.updateHistory: "yes" or "no" (defaults to "no")
options.copyToClipboard: "permalink", "permaview" or "no" (defaults to "no")
options.targetTiddler: optional title of target tiddler for permalink
options.successNotification: optional title of tiddler to use as the notification in case of success
options.failureNotification: optional title of tiddler to use as the notification in case of failure
*/
function updateLocationHash(options) {
// Get the story and the history stack
@ -205,14 +211,18 @@ function updateLocationHash(options) {
break;
}
// Copy URL to the clipboard
var url = "";
switch(options.copyToClipboard) {
case "permalink":
$tw.utils.copyToClipboard($tw.utils.getLocationPath() + "#" + encodeURIComponent(targetTiddler));
url = $tw.utils.getLocationPath() + "#" + encodeURIComponent(targetTiddler);
break;
case "permaview":
$tw.utils.copyToClipboard($tw.utils.getLocationPath() + "#" + encodeURIComponent(targetTiddler) + ":" + encodeURIComponent($tw.utils.stringifyList(storyList)));
url = $tw.utils.getLocationPath() + "#" + encodeURIComponent(targetTiddler) + ":" + encodeURIComponent($tw.utils.stringifyList(storyList));
break;
}
if(url) {
$tw.utils.copyToClipboard(url,{successNotification: options.successNotification, failureNotification: options.failureNotification});
}
// Only change the location hash if we must, thus avoiding unnecessary onhashchange events
if($tw.utils.getLocationHash() !== $tw.locationHash) {
if(options.updateHistory === "yes") {

View File

@ -292,7 +292,9 @@ exports.copyToClipboard = function(text,options) {
} catch (err) {
}
if(!options.doNotNotify) {
$tw.notifier.display(succeeded ? "$:/language/Notifications/CopiedToClipboard/Succeeded" : "$:/language/Notifications/CopiedToClipboard/Failed");
var successNotification = options.successNotification || "$:/language/Notifications/CopiedToClipboard/Succeeded",
failureNotification = options.failureNotification || "$:/language/Notifications/CopiedToClipboard/Failed"
$tw.notifier.display(succeeded ? successNotification : failureNotification);
}
document.body.removeChild(textArea);
};

View File

@ -1,7 +1,7 @@
title: $:/core/ui/PageTemplate
name: {{$:/language/PageTemplate/Name}}
description: {{$:/language/PageTemplate/Description}}
icon: $:/core/images/default-layout
icon: $:/core/images/standard-layout
code-body: yes
\whitespace trim

View File

@ -59,12 +59,14 @@ Improvements to the following translations:
! Usability Improvements
* <<.link-badge-added "https://github.com/Jermolene/TiddlyWiki5/issues/8121">> new keyboard shortcut for refreshing the page
* <<.link-badge-improved "https://github.com/Jermolene/TiddlyWiki5/commit/f3614c1e47e6ac5d5fec221b060699e975cd5ef6">> and simplified the splash screen for tiddlywiki.com. See [[Creating a splash screen]] for instructions on creating your own splash screen
! Hackability Improvements
* <<.link-badge-improved "https://github.com/Jermolene/TiddlyWiki5/pull/7882">> infinite recursion handling using a custom exception
* <<.link-badge-added "https://github.com/Jermolene/TiddlyWiki5/pull/7966">> button to the JavaScript error popup allowing tiddlers to be saved to a local JSON file
* <<.link-badge-updated "https://github.com/Jermolene/TiddlyWiki5/issues/8120">> to latest version of modern-normalize 2.0.0
* <<.link-badge-improved "https://github.com/Jermolene/TiddlyWiki5/pull/8211">> [[tm-permalink|WidgetMessage: tm-permalink]], [[tm-permaview|WidgetMessage: tm-permaview]] and [[tm-copy-to-clipboard|WidgetMessage: tm-copy-to-clipboard]] messages to allow the notification text to be customised
! Bug Fixes
@ -85,6 +87,7 @@ Improvements to the following translations:
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/commit/801ed0ea1164aab4f88547322f9d73704388143f">> crash with [[cycle Operator]] if the the step size is larger than the number of operands
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/issues/8095">> proper DOCTYPE for the open window template
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/issues/7945">> theme font size settings to open in new window CSS
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/8098">> backlink parser to prevent it parsing binary tiddlers
! Node.js Improvements
@ -99,6 +102,7 @@ Improvements to the following translations:
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/8195">> issue with fakedom TW_Node inheritence
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/8099">> SJCL library creating variables in global scope
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/8179">> fix `widget.getVariableInfo()` to always return a `params` property
! Infrastructure Improvements

View File

@ -22,22 +22,30 @@ if($tw.node) {
describe("every plugin should have the required standard fields", function() {
var titles = Object.keys(tiddlers);
$tw.utils.each(titles,function(title) {
it("plugin " + title + " should have the required standard fields",function() {
var fields = tiddlers[title];
expect(fields["plugin-type"]).toMatch(/^(?:plugin|language|theme)$/);
switch(fields["plugin-type"]) {
case "plugin":
expect(!!(fields.name && fields.description && fields.list)).toEqual(true);
expect(fields.stability).toMatch(/^(?:STABILITY_0_DEPRECATED|STABILITY_1_EXPERIMENTAL|STABILITY_2_STABLE|STABILITY_3_LEGACY)$/);
break;
case "language":
expect(!!(fields.name && fields.description)).toEqual(true);
break;
case "theme":
expect(!!(fields.name && fields.description)).toEqual(true);
break;
}
var fields = tiddlers[title];
it("plugin should have a recognised plugin-type field",function() {
expect(["plugin","language","theme"].indexOf(fields["plugin-type"]) !== -1).toEqual(true);
});
switch(fields["plugin-type"]) {
case "plugin":
it("plugin " + title + " should have name, description and list fields",function() {
expect(!!(fields.name && fields.description && fields.list)).toBe(true);
});
it("plugin " + title + " should have a valid stability field",function() {
expect(["STABILITY_0_DEPRECATED","STABILITY_1_EXPERIMENTAL","STABILITY_2_STABLE","STABILITY_3_LEGACY"].indexOf(fields.stability) !== -1).toBe(true);
});
break;
case "language":
it("language " + title + " should have name and description fields",function() {
expect(!!(fields.name && fields.description)).toEqual(true);
});
break;
case "theme":
it("theme " + title + " should have name and description fields",function() {
expect(!!(fields.name && fields.description)).toEqual(true);
});
break;
}
});
});
});

View File

@ -1,6 +1,6 @@
caption: tm-copy-to-clipboard
created: 20171215150056004
modified: 20171215150600888
modified: 20240523174013095
tags: Messages
title: WidgetMessage: tm-copy-to-clipboard
type: text/vnd.tiddlywiki
@ -11,6 +11,8 @@ It requires the following properties on the `event` object:
|!Name |!Description |
|param |Text to be copied to the clipboard |
|successNotification |<<.from-version "5.3.4">> Optional title of tiddler containing notification to be used if the operation succeeds |
|failureNotification |<<.from-version "5.3.4">> Optional title of tiddler containing notification to be used if the operation fails |
This message is usually generated with the ButtonWidget. It is handled by the TiddlyWiki core.

View File

@ -1,5 +1,5 @@
created: 20140723103751357
modified: 20140723103751357
modified: 20240523174013095
tags: Messages
title: WidgetMessage: tm-permalink
type: text/vnd.tiddlywiki
@ -12,5 +12,7 @@ The permalink message supports the following properties on the `event` object:
|!Name |!Description |
|param |Title of the tiddler to be permalinked |
|tiddlerTitle |The current tiddler (used by default if the tiddler title isn't specified in the `param`) |
|successNotification |<<.from-version "5.3.4">> Optional title of tiddler containing notification to be used if the operation succeeds |
|failureNotification |<<.from-version "5.3.4">> Optional title of tiddler containing notification to be used if the operation fails |
The permalink message can be generated by the ButtonWidget, and is handled by the story mechanism.

View File

@ -1,5 +1,5 @@
created: 20140723103751357
modified: 20140723103751357
modified: 20240523174013095
tags: Messages
title: WidgetMessage: tm-permaview
type: text/vnd.tiddlywiki
@ -12,5 +12,7 @@ The permaview message supports the following properties on the `event` object:
|!Name |!Description |
|param |Title of the tiddler to be navigated within the permaview |
|tiddlerTitle |The current tiddler (used by default if the tiddler title isn't specified in the `param`) |
|successNotification |<<.from-version "5.3.4">> Optional title of tiddler containing notification to be used if the operation succeeds |
|failureNotification |<<.from-version "5.3.4">> Optional title of tiddler containing notification to be used if the operation fails |
The permaview message can be generated by the ButtonWidget, and is handled by the story mechanism.

View File

@ -113,7 +113,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
</div>
<div class="tc-splash-text">
Please wait while {{$:/SiteTitle}} is loading
<strong>{{$:/SiteTitle}}</strong>
<br/>
is loading
</div>
<!-- Demonstrating how to embed a bitmap graphic -->

View File

@ -69,8 +69,8 @@ MissingTiddler/Hint: 佚失条目 "<$text text=<<currentTiddler>>/>" - 点击 {{
No: 否
OfficialPluginLibrary: ~TiddlyWiki 官方插件库
OfficialPluginLibrary/Hint: 此为在 tiddlywiki.com 的 ~TiddlyWiki 官方插件库。由核心团队维护的插件、主题和语言包。
PageTemplate/Description: 默认的 ~Tiddlywiki 布局
PageTemplate/Name: 默认的 ~PageTemplate
PageTemplate/Description: 默认的太微布局
PageTemplate/Name: 标准布局
PluginReloadWarning: 请保存 {{$:/core/ui/Buttons/save-wiki}} 并刷新页面 {{$:/core/ui/Buttons/refresh}} ,使 ~JavaScript 插件的更改生效
RecentChanges/DateFormat: YYYY年0MM月0DD日
Shortcuts/Input/Accept/Hint: 接受选取的项目

View File

@ -70,7 +70,7 @@ No: 否
OfficialPluginLibrary: ~TiddlyWiki 官方插件程式庫
OfficialPluginLibrary/Hint: 此為在 tiddlywiki.com 的 ~TiddlyWiki 官方插件程式庫。由核心團隊維護的插件、主題和語言包。
PageTemplate/Description: 預設的 ~Tiddlywiki 佈局
PageTemplate/Name: 預設的 ~PageTemplate
PageTemplate/Name: 標准佈局
PluginReloadWarning: 請儲存 {{$:/core/ui/Buttons/save-wiki}} 並刷新頁面 {{$:/core/ui/Buttons/refresh}} ,使 ~JavaScript 插件的更改生效
RecentChanges/DateFormat: YYYY年0MM月0DD日
Shortcuts/Input/Accept/Hint: 接受選取的項目