From 3afa26b9a318d913ba162d93a63036cb4a94be59 Mon Sep 17 00:00:00 2001 From: Jermolene Date: Sat, 12 Apr 2014 14:15:49 +0100 Subject: [PATCH 1/8] Require confirmation before abandoning edits Fixes #544 --- core/language/en-GB/Misc.multids | 1 + core/modules/widgets/navigator.js | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/core/language/en-GB/Misc.multids b/core/language/en-GB/Misc.multids index 0d41e89a3..e7dfd68c3 100644 --- a/core/language/en-GB/Misc.multids +++ b/core/language/en-GB/Misc.multids @@ -3,6 +3,7 @@ title: $:/language/ ClassicWarning/Hint: This tiddler is written in TiddlyWiki Classic wiki text format, which is not fully compatible with TiddlyWiki version 5. See http://tiddlywiki.com/static/Upgrading.html for more details. ClassicWarning/Upgrade/Caption: upgrade CloseAll/Button: close all +ConfirmCancelTiddler: Do you wish to discard changes to the tiddler "<$text text=<>/>"? ConfirmDeleteTiddler: Do you wish to delete the tiddler "<$text text=<<title>>/>"? ConfirmOverwriteTiddler: Do you wish to overwrite the tiddler "<$text text=<<title>>/>"? InvalidFieldName: Illegal characters in field name "<$text text=<<fieldName>>/>". Fields can only contain lowercase letters and the characters underscore (`_`), hyphen (`-`) and period (`.`) diff --git a/core/modules/widgets/navigator.js b/core/modules/widgets/navigator.js index 21fc35c73..c58caa2e3 100755 --- a/core/modules/widgets/navigator.js +++ b/core/modules/widgets/navigator.js @@ -333,11 +333,23 @@ NavigatorWidget.prototype.handleCancelTiddlerEvent = function(event) { originalTitle = draftTiddler.fields["draft.of"], storyList = this.getStoryList(); if(draftTiddler && originalTitle) { + // Ask for confirmation if the tiddler text has changed + var isConfirmed = true; + if(this.wiki.getTiddlerText(draftTitle) !== this.wiki.getTiddlerText(originalTitle)) { + isConfirmed = confirm($tw.language.getString( + "ConfirmCancelTiddler", + {variables: + {title: draftTitle} + } + )); + } // Remove the draft tiddler - this.wiki.deleteTiddler(draftTitle); - this.replaceFirstTitleInStory(storyList,draftTitle,originalTitle); - this.addToHistory(originalTitle,event.navigateFromClientRect); - this.saveStoryList(storyList); + if(isConfirmed) { + this.wiki.deleteTiddler(draftTitle); + this.replaceFirstTitleInStory(storyList,draftTitle,originalTitle); + this.addToHistory(originalTitle,event.navigateFromClientRect); + this.saveStoryList(storyList); + } } return false; }; From be7822281a9126d9cb556767e2284484a1264b1e Mon Sep 17 00:00:00 2001 From: Jermolene <jeremy@osmosoft.com> Date: Sat, 12 Apr 2014 16:32:58 +0100 Subject: [PATCH 2/8] Release note updates --- editions/tw5.com/tiddlers/Release 5.0.9beta.tid | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/editions/tw5.com/tiddlers/Release 5.0.9beta.tid b/editions/tw5.com/tiddlers/Release 5.0.9beta.tid index 50aa2494d..fa179d767 100644 --- a/editions/tw5.com/tiddlers/Release 5.0.9beta.tid +++ b/editions/tw5.com/tiddlers/Release 5.0.9beta.tid @@ -12,7 +12,6 @@ type: text/vnd.tiddlywiki * New ''Filter'' tab in [[$:/AdvancedSearch]] * Initial implementation of CecilyView * Overhaul of inconsistencies in TiddlerFilters (see [[Changes to filters in 5.0.9-beta]]) -* !! Documentation Improvements @@ -32,10 +31,7 @@ type: text/vnd.tiddlywiki * [[Enhance|https://github.com/Jermolene/TiddlyWiki5/commit/f48701544eda4f79af86b1ad44340e7182bcf024]] viewing of system tiddlers by fading down the `$:/` prefix * [[Extend|https://github.com/Jermolene/TiddlyWiki5/commit/dd3ee2a603cba35770a8f109e070f271d72861f8]] [[$:/TagManager]] to allow icons to be assigned to tags * [[Added|https://github.com/Jermolene/TiddlyWiki5/commit/87c4839fed789b80e0942014c05175e36aacc157]] support for `list-before` and `list-after` fields for controlling tag ordering (see TiddlerTags for details) - -!! Scalability Improvements - -* +* [[Added|https://github.com/Jermolene/TiddlyWiki5/commit/3afa26b9a318d913ba162d93a63036cb4a94be59]] request for confirmation before abandoning edits to a tiddler !! Hackability Improvements From be5f6f6700cc96a6b5edf8cdebb55a59d6c8a93b Mon Sep 17 00:00:00 2001 From: Jermolene <jeremy@osmosoft.com> Date: Sat, 12 Apr 2014 17:14:09 +0100 Subject: [PATCH 3/8] Allow spaces in property names in text references --- core/modules/utils/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/modules/utils/utils.js b/core/modules/utils/utils.js index b98a9d224..7848c4e94 100644 --- a/core/modules/utils/utils.js +++ b/core/modules/utils/utils.js @@ -379,7 +379,7 @@ Returns an object with the following fields, all optional: */ exports.parseTextReference = function(textRef) { // Separate out the title, field name and/or JSON indices - var reTextRef = /^\s*([^!#]+)?(?:(?:!!([^\s]+))|(?:##([^\s]+)))?\s*/mg, + var reTextRef = /^\s*([^!#]+)?(?:(?:!!([^\s]+))|(?:##(.+)))?\s*/mg, match = reTextRef.exec(textRef); if(match && reTextRef.lastIndex === textRef.length) { // Return the parts From ee2cd2056ced1cf99f3e427ca9d015dfcb8f0d59 Mon Sep 17 00:00:00 2001 From: Jermolene <jeremy@osmosoft.com> Date: Sat, 12 Apr 2014 17:14:27 +0100 Subject: [PATCH 4/8] Make tiddler width fluid when sidebar hidden --- themes/tiddlywiki/vanilla/base.tid | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/themes/tiddlywiki/vanilla/base.tid b/themes/tiddlywiki/vanilla/base.tid index e7a77a295..446a56caa 100644 --- a/themes/tiddlywiki/vanilla/base.tid +++ b/themes/tiddlywiki/vanilla/base.tid @@ -1,6 +1,9 @@ title: $:/themes/tiddlywiki/vanilla/base tags: [[$:/tags/stylesheet]] +\define if-no-sidebar(text) +<$reveal state="$:/state/sidebar" type="nomatch" text="yes" default="yes">$text$</$reveal> +\end \rules only filteredtranscludeinline transcludeinline macrodef macrocallinline /* ** Start with the normalize CSS reset, and then belay some of its effects @@ -463,6 +466,17 @@ a.tw-tiddlylink-external:hover { width: {{$:/themes/tiddlywiki/vanilla/metrics##storywidth}}; padding: 42px 42px 42px 42px; } + + + +<<if-no-sidebar " + + .story-river { + width: auto; + } + +">> + } @media print { @@ -526,6 +540,14 @@ a.tw-tiddlylink-external:hover { width: {{$:/themes/tiddlywiki/vanilla/metrics##tiddlerwidth}}; } +<<if-no-sidebar " + + .tw-tiddler-frame { + width: auto; + } + +">> + .tw-tiddler-info { margin: 0 -42px 0 -42px; } From 4f4b743d9ca546a4e7ccffa969bf36269c0c4e02 Mon Sep 17 00:00:00 2001 From: Jermolene <jeremy@osmosoft.com> Date: Sat, 12 Apr 2014 18:24:39 +0100 Subject: [PATCH 5/8] Fix Cecily tiddler width for when sidebar hidden --- plugins/tiddlywiki/cecily/cecily.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/tiddlywiki/cecily/cecily.js b/plugins/tiddlywiki/cecily/cecily.js index 84c331182..37a30f371 100644 --- a/plugins/tiddlywiki/cecily/cecily.js +++ b/plugins/tiddlywiki/cecily/cecily.js @@ -84,7 +84,8 @@ Load the current map CecilyStoryView.prototype.loadMap = function() { this.map = this.listWidget.wiki.getTiddlerData(this.getMapTiddlerTitle(),{ positions: {}, - newTiddlerPosition: {x: 0, y: 0} + newTiddlerPosition: {x: 0, y: 0}, + width: 600 }); }; @@ -99,6 +100,7 @@ CecilyStoryView.prototype.positionTiddler = function(title,domNode) { var pos = this.lookupTiddlerInMap(title,domNode), scale = pos.w/domNode.offsetWidth; $tw.utils.setStyle(domNode,[ + {width: this.map.width + "px"}, {transformOrigin: "0% 0%"}, {transform: "translateX(" + pos.x + "px) translateY(" + pos.y + "px) scale(" + scale + ")"} ]); From d9b87055bf55b31adc1d98d59116c0f7cd05996a Mon Sep 17 00:00:00 2001 From: Bram Chen <bram.chen@gmail.com> Date: Sun, 13 Apr 2014 14:34:17 +0800 Subject: [PATCH 6/8] Add chinese translations of confirmation for cancelling edits --- languages/zh-Hans/Misc.multids | 5 +++-- languages/zh-Hant/Misc.multids | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/languages/zh-Hans/Misc.multids b/languages/zh-Hans/Misc.multids index 40f0483ae..33726e749 100644 --- a/languages/zh-Hans/Misc.multids +++ b/languages/zh-Hans/Misc.multids @@ -3,8 +3,9 @@ title: $:/language/ ClassicWarning/Hint: 此条目以经典版 TiddlyWiki 标记格式撰写,不完全相容新版 TiddlyWiki 的格式,详细信息请参阅:http://tiddlywiki.com/static/Upgrading。 ClassicWarning/Upgrade/Caption: 升级 CloseAll/Button: 全部关闭 -ConfirmDeleteTiddler: 您确定要删除条目 "<$text text=<<title>>/>" ? -ConfirmOverwriteTiddler: 您确定要覆写条目 "<$text text=<<title>>/>" ? +ConfirmCancelTiddler: 您确定要放弃对条目 "<$text text=<<title>>/>" 的更改? +ConfirmDeleteTiddler: 您确定要删除条目 "<$text text=<<title>>/>"? +ConfirmOverwriteTiddler: 您确定要覆写条目 "<$text text=<<title>>/>"? InvalidFieldName: 栏位名称 "<$text text=<<fieldName>>/>" 包含无效字符,栏位名称只能包含小写字母和底线 (`_`)、 连字号 (`-`) 和小数点 (`.`) MissingTiddler/Hint: 佚失条目 "<$text text=<<currentTiddler>>/>" - 点击 {{$:/core/images/edit-button}} 可创建此条目 RecentChanges/DateFormat: YYYY年0MM月0DD日 diff --git a/languages/zh-Hant/Misc.multids b/languages/zh-Hant/Misc.multids index 1789bfe85..c553c6a69 100644 --- a/languages/zh-Hant/Misc.multids +++ b/languages/zh-Hant/Misc.multids @@ -3,8 +3,9 @@ title: $:/language/ ClassicWarning/Hint: 此條目以經典版 TiddlyWiki 標記格式撰寫,不完全相容新版 TiddlyWiki 的格式,詳細資訊請參閱:http://tiddlywiki.com/static/Upgrading。 ClassicWarning/Upgrade/Caption: 升級 CloseAll/Button: 全部關閉 -ConfirmDeleteTiddler: 您確定要刪除條目 "<$text text=<<title>>/>" ? -ConfirmOverwriteTiddler: 您確定要覆寫條目 "<$text text=<<title>>/>" ? +ConfirmCancelTiddler: 您確定要放棄對條目 "<$text text=<<title>>/>" 的更改? +ConfirmDeleteTiddler: 您確定要刪除條目 "<$text text=<<title>>/>"? +ConfirmOverwriteTiddler: 您確定要覆寫條目 "<$text text=<<title>>/>"? InvalidFieldName: 欄位名稱 "<$text text=<<fieldName>>/>" 包含無效字元,欄位名稱只能包含小寫字母和底線 (`_`)、 連接號 (`-`) 和小數點 (`.`) MissingTiddler/Hint: 佚失條目 "<$text text=<<currentTiddler>>/>" - 點擊 {{$:/core/images/edit-button}} 可建立此條目 RecentChanges/DateFormat: YYYY年0MM月0DD日 From 260d3ad8c0d5d20b7a2b22b83a16d7916052849f Mon Sep 17 00:00:00 2001 From: Jermolene <jeremy@osmosoft.com> Date: Sun, 13 Apr 2014 09:23:57 +0100 Subject: [PATCH 7/8] Docs typo --- editions/tw5.com/tiddlers/widgets/ListWidget.tid | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editions/tw5.com/tiddlers/widgets/ListWidget.tid b/editions/tw5.com/tiddlers/widgets/ListWidget.tid index 1e2ec848d..08b69e2c5 100644 --- a/editions/tw5.com/tiddlers/widgets/ListWidget.tid +++ b/editions/tw5.com/tiddlers/widgets/ListWidget.tid @@ -33,7 +33,7 @@ The `<$list>` widget can optionally render draft tiddlers through a different te !! `storyview` attribute -The `storyview` attribute gives the specifies the name of an optional module that can animate changes to the list (including navigation). The core ships with the following storyview modules: +The `storyview` attribute specifies the name of an optional module that can animate changes to the list (including navigation). The core ships with the following storyview modules: * `classic`: renders the list as an ordered sequence of tiddlers * `zoomin`: just renders the current tiddler from the list, with a zoom animation for navigating between tiddlers From 46969fbd3e26daa54c2d8c595dcd7b27f3c28cae Mon Sep 17 00:00:00 2001 From: Jermolene <jeremy@osmosoft.com> Date: Sun, 13 Apr 2014 09:24:06 +0100 Subject: [PATCH 8/8] Adjust Cecily tiddler width --- plugins/tiddlywiki/cecily/cecily.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/tiddlywiki/cecily/cecily.js b/plugins/tiddlywiki/cecily/cecily.js index 37a30f371..e24977325 100644 --- a/plugins/tiddlywiki/cecily/cecily.js +++ b/plugins/tiddlywiki/cecily/cecily.js @@ -85,7 +85,7 @@ CecilyStoryView.prototype.loadMap = function() { this.map = this.listWidget.wiki.getTiddlerData(this.getMapTiddlerTitle(),{ positions: {}, newTiddlerPosition: {x: 0, y: 0}, - width: 600 + width: 660 }); };