mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 18:17:20 +00:00
Improvements to text-slicer plugin
1. Introduce template tiddlers for the document, each tiddler, and the tiddler toolbar 2. Move the text slicer toolbar button to the left of the edit button 3. Add a selectable toolbar, currently just containing the tiddler title
This commit is contained in:
parent
2e5c500300
commit
898e992694
@ -1,15 +1,11 @@
|
||||
title: $:/plugins/tiddlywiki/text-slicer/macros
|
||||
tags: $:/tags/Macro
|
||||
|
||||
\define display-tiddler()
|
||||
<$list filter="[draft.of<currentTiddler>limit[1]]" editTemplate="$:/core/ui/EditTemplate" emptyMessage="""<$transclude mode='block'/>"""/>
|
||||
\end
|
||||
|
||||
\define display-heading-tiddler(level:"h1")
|
||||
<$level$><$view field="title"/></$level$>
|
||||
<$list filter='[tag<currentTiddler>!has[draft.of]]'>
|
||||
<$tiddler>
|
||||
<<display-tiddler>>
|
||||
{{||$:/plugins/tiddlywiki/text-slicer/templates/display-tiddler}}
|
||||
</$tiddler>
|
||||
</$list>
|
||||
\end
|
||||
@ -19,7 +15,7 @@ tags: $:/tags/Macro
|
||||
<$list filter='[tag<currentTiddler>!has[draft.of]]'>
|
||||
<li>
|
||||
<$tiddler>
|
||||
<<display-tiddler>>
|
||||
{{||$:/plugins/tiddlywiki/text-slicer/templates/display-tiddler}}
|
||||
</$tiddler>
|
||||
</li>
|
||||
</$list>
|
||||
|
@ -1,5 +1,6 @@
|
||||
title: $:/plugins/tiddlywiki/text-slicer/ui/slice-button
|
||||
tags: $:/tags/ViewToolbar
|
||||
list-before: $:/core/ui/Buttons/edit
|
||||
caption: {{$:/plugins/tiddlywiki/text-slicer/text-slicer-icon}} Slice tiddler
|
||||
description: Slice this tiddler by headings and lists
|
||||
|
||||
|
@ -121,7 +121,7 @@ function sliceTiddler(title) {
|
||||
if(parser) {
|
||||
parentStack.push({type: "h0", title: addTiddler({
|
||||
title: "Sliced up " + title,
|
||||
text: "<div class='tc-table-of-contents'>\n\n<<toc-selective-expandable 'Sliced up " + title + "'>>\n\n</div>\n<<display-heading-tiddler level:'h1'>>",
|
||||
text: "{{||$:/plugins/tiddlywiki/text-slicer/templates/display-document}}",
|
||||
list: []
|
||||
})});
|
||||
processNodeList(parser.tree);
|
||||
|
21
plugins/tiddlywiki/text-slicer/template-display-document.tid
Normal file
21
plugins/tiddlywiki/text-slicer/template-display-document.tid
Normal file
@ -0,0 +1,21 @@
|
||||
title: $:/plugins/tiddlywiki/text-slicer/templates/display-document
|
||||
|
||||
\define config-show-toolbar()
|
||||
$:/plugins/tiddlywiki/text-slicer/config/show-toolbar/$(currentTiddler)$
|
||||
\end
|
||||
|
||||
\define display-tiddler()
|
||||
<$set name="tv-show-toolbar" value={{$(config-show-toolbar)$}}>
|
||||
<<display-heading-tiddler level:'h1'>>
|
||||
</$set>
|
||||
\end
|
||||
|
||||
<div class='tc-table-of-contents'>
|
||||
|
||||
<$macrocall $name="toc-selective-expandable" tag=<<currentTiddler>>/>
|
||||
|
||||
</div>
|
||||
|
||||
<$checkbox tiddler=<<config-show-toolbar>> field="text" checked="yes" unchecked="no" default="no"> Show toolbar</$checkbox>
|
||||
|
||||
<<display-tiddler>>
|
@ -0,0 +1,6 @@
|
||||
title: $:/plugins/tiddlywiki/text-slicer/templates/display-tiddler
|
||||
|
||||
<$list filter="[<tv-show-toolbar>prefix[yes]]" variable="hasToolbar">
|
||||
{{||$:/plugins/tiddlywiki/text-slicer/templates/tiddler-toolbar}}
|
||||
</$list>
|
||||
<$list filter="[draft.of<currentTiddler>limit[1]]" editTemplate="$:/core/ui/EditTemplate" emptyMessage="""<$transclude mode='block'/>"""/>
|
@ -0,0 +1,5 @@
|
||||
title: $:/plugins/tiddlywiki/text-slicer/templates/tiddler-toolbar
|
||||
|
||||
<div class="tc-slice-toolbar" style="background:#def;">
|
||||
<$link><$text text=<<currentTiddler>>/></$link>
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user