kopia lustrzana https://github.com/miklobit/TiddlyWiki5
				
				
				
			Add theme tweaks upgrader
							rodzic
							
								
									8612bc4006
								
							
						
					
					
						commit
						0cf63ab9f0
					
				|  | @ -9,3 +9,4 @@ Listing/Title/Caption: Title | ||||||
| Upgrader/Plugins/Suppressed: Suppressed plugin (due to incoming <<incoming>>  being older than existing <<existing>>) | Upgrader/Plugins/Suppressed: Suppressed plugin (due to incoming <<incoming>>  being older than existing <<existing>>) | ||||||
| Upgrader/Plugins/Upgraded: Upgraded plugin from <<incoming>> to <<upgraded>> | Upgrader/Plugins/Upgraded: Upgraded plugin from <<incoming>> to <<upgraded>> | ||||||
| Upgrader/System/Suppressed: Suppressed system tiddler | Upgrader/System/Suppressed: Suppressed system tiddler | ||||||
|  | Upgrader/ThemeTweaks/Created: Migrated theme tweak from <$text text=<<from>>/> | ||||||
|  |  | ||||||
|  | @ -0,0 +1,65 @@ | ||||||
|  | /*\ | ||||||
|  | title: $:/core/modules/upgraders/themetweaks.js | ||||||
|  | type: application/javascript | ||||||
|  | module-type: upgrader | ||||||
|  | 
 | ||||||
|  | Upgrader module that handles the change in theme tweak storage introduced in 5.0.14-beta. | ||||||
|  | 
 | ||||||
|  | Previously, theme tweaks were stored in two data tiddlers: | ||||||
|  | 
 | ||||||
|  | * $:/themes/tiddlywiki/vanilla/metrics | ||||||
|  | * $:/themes/tiddlywiki/vanilla/settings | ||||||
|  | 
 | ||||||
|  | Now, each tweak is stored in its own separate tiddler. | ||||||
|  | 
 | ||||||
|  | This upgrader copies any values from the old format to the new. The old data tiddlers are not deleted in case they have been used to store additional indexes. | ||||||
|  | 
 | ||||||
|  | \*/ | ||||||
|  | (function(){ | ||||||
|  | 
 | ||||||
|  | /*jslint node: true, browser: true */ | ||||||
|  | /*global $tw: false */ | ||||||
|  | "use strict"; | ||||||
|  | 
 | ||||||
|  | var MAPPINGS = { | ||||||
|  | 	"$:/themes/tiddlywiki/vanilla/metrics": { | ||||||
|  | 		"fontsize": "$:/themes/tiddlywiki/vanilla/metrics/fontsize", | ||||||
|  | 		"lineheight": "$:/themes/tiddlywiki/vanilla/metrics/lineheight", | ||||||
|  | 		"storyleft": "$:/themes/tiddlywiki/vanilla/metrics/storyleft", | ||||||
|  | 		"storytop": "$:/themes/tiddlywiki/vanilla/metrics/storytop", | ||||||
|  | 		"storyright": "$:/themes/tiddlywiki/vanilla/metrics/storyright", | ||||||
|  | 		"storywidth": "$:/themes/tiddlywiki/vanilla/metrics/storywidth", | ||||||
|  | 		"tiddlerwidth": "$:/themes/tiddlywiki/vanilla/metrics/tiddlerwidth" | ||||||
|  | 	}, | ||||||
|  | 	"$:/themes/tiddlywiki/vanilla/settings": { | ||||||
|  | 		"fontfamily": "$:/themes/tiddlywiki/vanilla/settings/fontfamily" | ||||||
|  | 	} | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | exports.upgrade = function(wiki,titles,tiddlers) { | ||||||
|  | 	var self = this, | ||||||
|  | 		messages = {}; | ||||||
|  | 	// Check for tiddlers on our list
 | ||||||
|  | 	$tw.utils.each(titles,function(title) { | ||||||
|  | 		var mapping = MAPPINGS[title]; | ||||||
|  | 		if(mapping) { | ||||||
|  | 			var tiddler = new $tw.Tiddler(tiddlers[title]), | ||||||
|  | 				tiddlerData = wiki.getTiddlerData(tiddler,{}); | ||||||
|  | 			for(var index in mapping) { | ||||||
|  | 				var mappedTitle = mapping[index]; | ||||||
|  | 				if(!tiddlers[mappedTitle] || tiddlers[mappedTitle].title !== mappedTitle) { | ||||||
|  | 					tiddlers[mappedTitle] = { | ||||||
|  | 						title: mappedTitle, | ||||||
|  | 						text: tiddlerData[index] | ||||||
|  | 					} | ||||||
|  | 					messages[mappedTitle] = $tw.language.getString("Import/Upgrader/ThemeTweaks/Created",{variables: { | ||||||
|  | 						from: title + "##" + index | ||||||
|  | 					}}) | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 	}); | ||||||
|  | 	return messages; | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | })(); | ||||||
|  | @ -31,12 +31,12 @@ selection-$(payloadTiddler)$ | ||||||
| <td> | <td> | ||||||
| <$reveal type="nomatch" state=<<previewPopupState>> text="yes"> | <$reveal type="nomatch" state=<<previewPopupState>> text="yes"> | ||||||
| <$button class="btn-invisible btn-dropdown" set=<<previewPopupState>> setTo="yes"> | <$button class="btn-invisible btn-dropdown" set=<<previewPopupState>> setTo="yes"> | ||||||
| {{$:/core/images/right-arrow}}<$text text=<<payloadTiddler>>/> | {{$:/core/images/right-arrow}} <$text text=<<payloadTiddler>>/> | ||||||
| </$button> | </$button> | ||||||
| </$reveal> | </$reveal> | ||||||
| <$reveal type="match" state=<<previewPopupState>> text="yes"> | <$reveal type="match" state=<<previewPopupState>> text="yes"> | ||||||
| <$button class="btn-invisible btn-dropdown" set=<<previewPopupState>> setTo="no"> | <$button class="btn-invisible btn-dropdown" set=<<previewPopupState>> setTo="no"> | ||||||
| {{$:/core/images/down-arrow}}<$text text=<<payloadTiddler>>/> | {{$:/core/images/down-arrow}} <$text text=<<payloadTiddler>>/> | ||||||
| </$button> | </$button> | ||||||
| </$reveal> | </$reveal> | ||||||
| </td> | </td> | ||||||
|  |  | ||||||
|  | @ -7,9 +7,19 @@ caption: 5.0.14-beta | ||||||
| 
 | 
 | ||||||
| //[[See GitHub for detailed change history of this release|https://github.com/Jermolene/TiddlyWiki5/compare/v5.0.13-beta...v5.0.14-beta]]// | //[[See GitHub for detailed change history of this release|https://github.com/Jermolene/TiddlyWiki5/compare/v5.0.13-beta...v5.0.14-beta]]// | ||||||
| 
 | 
 | ||||||
| !! Incompatible Changes | !! Major Changes | ||||||
| 
 | 
 | ||||||
| * Theme tweaks (in [[control panel|$:/ControlPanel]] under the ''Appearance'' tab) will not be upgraded from TiddlyWiki versions prior to 5.0.14-beta. You'll need to re-apply any customisations after upgrading | !!! Introduction of Upgrade Mechanism | ||||||
|  | 
 | ||||||
|  | There are two components: | ||||||
|  | 
 | ||||||
|  | * A more flexible ImportMechanism that: | ||||||
|  | ** Presents incoming tiddlers as a pending import list that allows the user to inspect them and, if necessary, explicitly deselect them from the actual import | ||||||
|  | ** Provides UpgraderModules with an opportunity to process each incoming tiddler | ||||||
|  | *** The [[plugin upgrader|$:/core/modules/upgraders/plugins.js]] module handles version checking of plugins and upgrading them from a special UpgradeLibrary plugin tiddler | ||||||
|  | *** The [[system upgrader|$:/core/modules/upgraders/system.js]] module is responsible for suppressing the importing of certain system tiddlers (currently [[$:/StoryList]] and [[$:/HistoryList]]) | ||||||
|  | *** The [[themetweak upgrader|$:/core/modules/upgraders/themetweaks.js]] module handles migrating theme tweaks from their pre-5.0.14-beta format (see below) | ||||||
|  | * An UpgradePlugin and associated edition that provides a custom, single-purpose user interface for upgrading standalone TiddlyWiki files | ||||||
| 
 | 
 | ||||||
| !! Accessibility Improvements | !! Accessibility Improvements | ||||||
| 
 | 
 | ||||||
|  | @ -17,18 +27,23 @@ caption: 5.0.14-beta | ||||||
| 
 | 
 | ||||||
| !! Usability Improvements | !! Usability Improvements | ||||||
| 
 | 
 | ||||||
| *  | * [[Refactored|https://github.com/Jermolene/TiddlyWiki5/commit/f43cd5ba9c6e5eda221ec738174e61e34fad2b8d]] (and [[here|https://github.com/Jermolene/TiddlyWiki5/commit/a3de93b4eb8b108239b2e4b496308026e9e9eef8]]) ReleaseHistory to place the releases into vertical tabs | ||||||
|  | * [[Stopped|https://github.com/Jermolene/TiddlyWiki5/commit/3ff7462afd5414b92680c6b6e67274be79233224]] saving [[$:/HistoryList]], thus avoiding it uncontrollably increasing in size | ||||||
| 
 | 
 | ||||||
| !! Hackability Improvements | !! Hackability Improvements | ||||||
| 
 | 
 | ||||||
| *  | * [[Refactored|https://github.com/Jermolene/TiddlyWiki5/commit/21c137a66c37f010b36697bb6bed5321138fbb9f]] [[control panel|$:/ControlPanel]] theme tweaks to be stored in individual tiddlers | ||||||
|  | * [[Extend|https://github.com/Jermolene/TiddlyWiki5/commit/e18d8a88661a1c2caa1b722841747c75ca6af437]] the TabsMacro to allow tabs to be templated | ||||||
| 
 | 
 | ||||||
| !! Bug Fixes | !! Bug Fixes | ||||||
| 
 | 
 | ||||||
| *  | * [[Fixed|https://github.com/Jermolene/TiddlyWiki5/commit/5b3b62f93da4b7b19e24ccf72d9ce20b9edce6d5]] bug with execution order of BuildCommand targets | ||||||
|  | * [[Fixed|https://github.com/Jermolene/TiddlyWiki5/commit/d93da81671a704377209fc1871425c3a7c5db35a]] bug with missing hover colours for external links | ||||||
|  | * [[Fixed|https://github.com/Jermolene/TiddlyWiki5/commit/465f4ac46903070759a572d183c498c5579cb922]] problem with refreshing modal dialogues | ||||||
|  | * [[Fixed|https://github.com/Jermolene/TiddlyWiki5/commit/3351ae7e29cbf3bed6fc1925ef33664bcc59fef5]] issue with cookies disabled on Firefox | ||||||
| 
 | 
 | ||||||
| !! Contributors | !! Contributors | ||||||
| 
 | 
 | ||||||
| [[@Jermolene|https://github.com/Jermolene]] would like to thank the contributors to this release who have generously given their time to help improve TiddlyWiki: | [[@Jermolene|https://github.com/Jermolene]] would like to thank the contributors to this release who have generously given their time to help improve TiddlyWiki: | ||||||
| 
 | 
 | ||||||
| *  | * [[@BramChen|https://github.com/BramChen]] | ||||||
|  |  | ||||||
|  | @ -6,7 +6,7 @@ You can tweak certain aspects of the ''Vanilla'' theme. | ||||||
| 
 | 
 | ||||||
| ! Settings | ! Settings | ||||||
| 
 | 
 | ||||||
| * Font family: <$edit-text tiddler="$:/themes/tiddlywiki/vanilla/settings/fontfamily" default="" tag="input"/> | * [[Font family|$:/themes/tiddlywiki/vanilla/settings/fontfamily]]: <$edit-text tiddler="$:/themes/tiddlywiki/vanilla/settings/fontfamily" default="" tag="input"/> | ||||||
| 
 | 
 | ||||||
| ! Sizes | ! Sizes | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Ładowanie…
	
		Reference in New Issue
	
	 Jermolene
						Jermolene