kopia lustrzana https://github.com/miklobit/TiddlyWiki5
First attempt at sharing plugin/edition
rodzic
3df1f9c9d0
commit
005c584d85
|
@ -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"]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
title: $:/DefaultTiddlers
|
||||
|
||||
[list[$:/StoryList]]
|
|
@ -0,0 +1,3 @@
|
|||
title: $:/SiteSubtitle
|
||||
|
||||
tools to share tiddlers via URLs
|
|
@ -0,0 +1,3 @@
|
|||
title: $:/SiteTitle
|
||||
|
||||
Share
|
|
@ -0,0 +1,4 @@
|
|||
title: $:/plugins/tiddlywiki/share/above-story
|
||||
tags: $:/tags/AboveStory
|
||||
|
||||
<$transclude tiddler="$:/plugins/tiddlywiki/share/wizard" mode="block"/>
|
|
@ -0,0 +1,2 @@
|
|||
title: $:/config/plugins/share/base-url
|
||||
text:
|
|
@ -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/]]
|
|
@ -0,0 +1,2 @@
|
|||
title: $:/config/plugins/share/filter
|
||||
text: [all[tiddlers]] -[subfilter{$:/config/plugins/share/exclusions}]
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"title": "$:/plugins/tiddlywiki/share",
|
||||
"name": "Share",
|
||||
"description": "Sharing tiddlers via URLs",
|
||||
"list": "readme wizard settings"
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
title: $:/core/ui/PageTemplate/pluginreloadwarning
|
||||
|
||||
<!-- Disable plugin reload warnings -->
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
})();
|
|
@ -0,0 +1,6 @@
|
|||
title: $:/plugins/tiddlywiki/share/rawmarkup
|
||||
tags: $:/tags/RawMarkupWikified
|
||||
|
||||
`<script>`
|
||||
{{$:/plugins/tiddlywiki/share/rawmarkup.js}}
|
||||
`</script>`
|
|
@ -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
|
|
@ -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"/>
|
|
@ -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: <<colour background>>;
|
||||
<<box-shadow "inset 0px 2px 3px 2px rgba(0,0,0,0.4)">>
|
||||
}
|
||||
|
||||
input.tc-sharing-wizard-editor {
|
||||
width: 100%;
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
title: $:/plugins/tiddlywiki/share/wizard
|
||||
|
||||
\define generate-json()
|
||||
<$text text=<<jsontiddlers filter:"""$(share-filter)$""" spaces:"">>/>
|
||||
\end
|
||||
|
||||
\define inner-share-actions()
|
||||
<$wikify name="json" text=<<generate-json>>>
|
||||
<$action-sendmessage $message="tm-copy-to-clipboard" $param={{{ [<json>encodeuricomponent[]addprefix[##]addprefix<base-url>] }}}/>
|
||||
</$wikify>
|
||||
\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}}>
|
||||
<<inner-share-actions>>
|
||||
</$set>
|
||||
</$set>
|
||||
\end
|
||||
|
||||
<div class="tc-sharing-wizard-wrapper">
|
||||
|
||||
! Welcome to the sharing edition of ~TiddlyWiki
|
||||
|
||||
This edition of ~TiddlyWiki allows users to create links to wikis with the special capability of containing embedded tiddlers that are loaded into the target wiki at startup. Most browsers allow tens of kilobytes of data to be loaded in this way, making it possible to conveniently share groups of tiddlers as a fully functional wiki. See the [[readme|$:/plugins/tiddlywiki/share]] for more details.
|
||||
|
||||
!! 1 - Import or create the tiddlers that are to be shared
|
||||
|
||||
The first step to create a sharing URL is to import or otherwise create the tiddlers that are to be shared.
|
||||
|
||||
!! 2 - Check that the sharing filter is correct
|
||||
|
||||
The tiddlers that are included in the sharing URL are determined by the combination of two filters.
|
||||
|
||||
The sharing filter specifies the tiddlers to be shared:
|
||||
|
||||
<$edit-text tiddler="$:/config/plugins/share/filter" tag="input" class="tc-sharing-wizard-editor"/>
|
||||
|
||||
The exclusion subfilter is used to exclude the system tiddlers comprising this wiki:
|
||||
|
||||
<$edit-text tiddler="$:/config/plugins/share/exclusions" tag="input" class="tc-sharing-wizard-editor"/>
|
||||
|
||||
!! 3 - Review the tiddlers to be shared
|
||||
|
||||
Tiddlers to be shared (<$count filter={{$:/config/plugins/share/filter}}/>):
|
||||
|
||||
<ul>
|
||||
<$list filter={{$:/config/plugins/share/filter}}>
|
||||
<li>
|
||||
<$link>
|
||||
<$view field="title"/>
|
||||
</$link>
|
||||
</li>
|
||||
</$list>
|
||||
</ul>
|
||||
|
||||
!! 3 - Generate the sharing link
|
||||
|
||||
<$button>
|
||||
<<share-actions>>
|
||||
Generate sharing link
|
||||
</$button> (the link will be copied to the clipboard)
|
||||
|
||||
!! 5 - Export the shared tiddlers
|
||||
|
||||
<$button>
|
||||
<$action-sendmessage $message="tm-download-file" $param="$:/core/templates/exporters/JsonFile" exportFilter={{$:/config/plugins/share/filter}} filename="tiddlers.json"/>
|
||||
Export as JSON
|
||||
</$button>
|
||||
|
||||
</div>
|
Ładowanie…
Reference in New Issue