diff --git a/editions/share/tiddlywiki.info b/editions/share/tiddlywiki.info new file mode 100644 index 000000000..56c0ee84b --- /dev/null +++ b/editions/share/tiddlywiki.info @@ -0,0 +1,14 @@ +{ + "description": "Sharing tiddlers via URLs", + "plugins": [ + "tiddlywiki/share" + ], + "themes": [ + "tiddlywiki/vanilla", + "tiddlywiki/snowwhite" + ], + "build": { + "share": [ + "--rendertiddler","$:/core/save/all","share.html","text/plain"] + } +} diff --git a/plugins/tiddlywiki/share/DefaultTiddlers.tid b/plugins/tiddlywiki/share/DefaultTiddlers.tid new file mode 100644 index 000000000..614dde9d0 --- /dev/null +++ b/plugins/tiddlywiki/share/DefaultTiddlers.tid @@ -0,0 +1,3 @@ +title: $:/DefaultTiddlers + +[list[$:/StoryList]] \ No newline at end of file diff --git a/plugins/tiddlywiki/share/SiteSubtitle.tid b/plugins/tiddlywiki/share/SiteSubtitle.tid new file mode 100644 index 000000000..b7570f469 --- /dev/null +++ b/plugins/tiddlywiki/share/SiteSubtitle.tid @@ -0,0 +1,3 @@ +title: $:/SiteSubtitle + +tools to share tiddlers via URLs \ No newline at end of file diff --git a/plugins/tiddlywiki/share/SiteTitle.tid b/plugins/tiddlywiki/share/SiteTitle.tid new file mode 100644 index 000000000..79014b426 --- /dev/null +++ b/plugins/tiddlywiki/share/SiteTitle.tid @@ -0,0 +1,3 @@ +title: $:/SiteTitle + +Share \ No newline at end of file diff --git a/plugins/tiddlywiki/share/above-story.tid b/plugins/tiddlywiki/share/above-story.tid new file mode 100644 index 000000000..db3fb07bf --- /dev/null +++ b/plugins/tiddlywiki/share/above-story.tid @@ -0,0 +1,4 @@ +title: $:/plugins/tiddlywiki/share/above-story +tags: $:/tags/AboveStory + +<$transclude tiddler="$:/plugins/tiddlywiki/share/wizard" mode="block"/> diff --git a/plugins/tiddlywiki/share/base-url.tid b/plugins/tiddlywiki/share/base-url.tid new file mode 100644 index 000000000..5c363e05e --- /dev/null +++ b/plugins/tiddlywiki/share/base-url.tid @@ -0,0 +1,2 @@ +title: $:/config/plugins/share/base-url +text: diff --git a/plugins/tiddlywiki/share/exclusions.tid b/plugins/tiddlywiki/share/exclusions.tid new file mode 100644 index 000000000..d6f42f455 --- /dev/null +++ b/plugins/tiddlywiki/share/exclusions.tid @@ -0,0 +1,2 @@ +title: $:/config/plugins/share/exclusions +text: $:/library/sjcl.js $:/boot/bootprefix.js $:/boot/boot.js $:/boot/boot.css $:/core $:/isEncrypted $:/plugins/tiddlywiki/share $:/status/RequireReloadDueToPluginChange $:/temp/info-plugin $:/themes/tiddlywiki/snowwhite $:/themes/tiddlywiki/vanilla $:/HistoryList [prefix[$:/temp/]] diff --git a/plugins/tiddlywiki/share/filter.tid b/plugins/tiddlywiki/share/filter.tid new file mode 100644 index 000000000..85fb7c7b5 --- /dev/null +++ b/plugins/tiddlywiki/share/filter.tid @@ -0,0 +1,2 @@ +title: $:/config/plugins/share/filter +text: [all[tiddlers]] -[subfilter{$:/config/plugins/share/exclusions}] diff --git a/plugins/tiddlywiki/share/plugin.info b/plugins/tiddlywiki/share/plugin.info new file mode 100644 index 000000000..f2abe0929 --- /dev/null +++ b/plugins/tiddlywiki/share/plugin.info @@ -0,0 +1,6 @@ +{ + "title": "$:/plugins/tiddlywiki/share", + "name": "Share", + "description": "Sharing tiddlers via URLs", + "list": "readme wizard settings" +} diff --git a/plugins/tiddlywiki/share/pluginreloadwarning.tid b/plugins/tiddlywiki/share/pluginreloadwarning.tid new file mode 100644 index 000000000..f2c2c1f92 --- /dev/null +++ b/plugins/tiddlywiki/share/pluginreloadwarning.tid @@ -0,0 +1,3 @@ +title: $:/core/ui/PageTemplate/pluginreloadwarning + + diff --git a/plugins/tiddlywiki/share/rawmarkup.js b/plugins/tiddlywiki/share/rawmarkup.js new file mode 100644 index 000000000..b604e5c17 --- /dev/null +++ b/plugins/tiddlywiki/share/rawmarkup.js @@ -0,0 +1,35 @@ +/*\ +title: $:/plugins/tiddlywiki/share/rawmarkup.js +type: application/javascript +module-type: library + +Read tiddlers from the browser location hash + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +// Get the hash +var rawHash = document.location.hash.substring(1); +if(rawHash.charAt(0) === "#") { + var hash = decodeURIComponent(rawHash.substring(1)); + // Try to parse the hash as JSON + var tiddlers; + try { + tiddlers= JSON.parse(hash); + } catch(ex) { + } + if(tiddlers) { + // Need to initialise these because we run before bootprefix.js and boot.js + window.$tw = window.$tw || {}; + $tw.boot = $tw.boot || {}; + $tw.preloadTiddlers = $tw.preloadTiddlers || []; + // Load our tiddlers + $tw.preloadTiddlers = $tw.preloadTiddlers.concat(tiddlers); + } +} + +})(); diff --git a/plugins/tiddlywiki/share/rawmarkup.tid b/plugins/tiddlywiki/share/rawmarkup.tid new file mode 100644 index 000000000..8130757ad --- /dev/null +++ b/plugins/tiddlywiki/share/rawmarkup.tid @@ -0,0 +1,6 @@ +title: $:/plugins/tiddlywiki/share/rawmarkup +tags: $:/tags/RawMarkupWikified + +`` diff --git a/plugins/tiddlywiki/share/readme.tid b/plugins/tiddlywiki/share/readme.tid new file mode 100644 index 000000000..b5d9cc299 --- /dev/null +++ b/plugins/tiddlywiki/share/readme.tid @@ -0,0 +1,6 @@ +title: $:/plugins/tiddlywiki/share/readme + +This plugin provides tools to share tiddlers via URLs, comprising: + +* The ability to load a group of tiddlers from the browser location hash at startup +* Wizard and templates to create URLs from group of tiddlers diff --git a/plugins/tiddlywiki/share/settings.tid b/plugins/tiddlywiki/share/settings.tid new file mode 100644 index 000000000..9f3cc0e1b --- /dev/null +++ b/plugins/tiddlywiki/share/settings.tid @@ -0,0 +1,7 @@ +title: $:/plugins/tiddlywiki/share/settings + +!! Base sharing URL + +//Defaults to the current location// + +<$edit-text tiddler="$:/config/plugins/share/base-url" tag="input" class="tc-sharing-wizard-editor"/> diff --git a/plugins/tiddlywiki/share/styles.tid b/plugins/tiddlywiki/share/styles.tid new file mode 100644 index 000000000..a96da5d6d --- /dev/null +++ b/plugins/tiddlywiki/share/styles.tid @@ -0,0 +1,17 @@ +title: $:/plugins/tiddlywiki/share/styles +tags: [[$:/tags/Stylesheet]] + +\rules only filteredtranscludeinline transcludeinline macrodef macrocallinline + +.tc-sharing-wizard-wrapper { + width: 100%; + padding: 1em 1em; + margin-bottom: 1em; + border-radius: 4px; + background: <>; + <> +} + +input.tc-sharing-wizard-editor { + width: 100%; +} \ No newline at end of file diff --git a/plugins/tiddlywiki/share/wizard.tid b/plugins/tiddlywiki/share/wizard.tid new file mode 100644 index 000000000..ac90f0292 --- /dev/null +++ b/plugins/tiddlywiki/share/wizard.tid @@ -0,0 +1,71 @@ +title: $:/plugins/tiddlywiki/share/wizard + +\define generate-json() +<$text text=<>/> +\end + +\define inner-share-actions() +<$wikify name="json" text=<>> +<$action-sendmessage $message="tm-copy-to-clipboard" $param={{{ [encodeuricomponent[]addprefix[##]addprefix] }}}/> + +\end + +\define share-actions() +<$set name="base-url" value={{$:/config/plugins/share/base-url}} emptyValue={{$:/info/url/full}}> +<$set name="share-filter" value={{$:/config/plugins/share/filter}}> +<> + + +\end + + \ No newline at end of file