[TW5] selective per tiddler editor preview (5.1.11)

44 views
Skip to first unread message

wimm

unread,
Jun 1, 2016, 9:28:33 AM6/1/16
to tiddl...@googlegroups.com
When you press show preview or hide preview in a Draft tiddler then this affects all open Draft tiddlers. When tiddler above the current tiddler expand the tiddler is moved out of view. If you only want the preview of the current tiddler to be switched on or off (TW5.1.11) the current tiddler stays in view.
Edit the $:/core/ui/EditTemplate/body tiddler. In bold the changes compared to the original tiddler.
How it works: When you press show preview it creates an extra field in the current tiddler called editpreview and fills it with the value "yes" . When you press hide preview this extra field is deleted. Only if the field value = "yes" the preview is shown. In this way it also remembers if you want to view the preview.

---

\define lingo-base() $:/language/EditTemplate/Body/
<$list filter="[is[current]has[_canonical_uri]]">

<div class="tc-message-box">

<<lingo External/Hint>>

<a href={{!!_canonical_uri}}><$text text={{!!_canonical_uri}}/></a>

<$edit-text field="_canonical_uri" class="tc-edit-fields"></$edit-text>

</div>

</$list>

<$list filter="[is[current]!has[_canonical_uri]]">

<$reveal state="!!editpreview" type="match" text="yes">

<em class="tc-edit"><<lingo Hint>></em> <$button><$action-deletefield editpreview /><<lingo Preview/Button/Hide>></$button>

<div class="tc-tiddler-preview">
<div class="tc-tiddler-preview-preview">
<$set name="tv-tiddler-preview" value="yes">

<$transclude />

</$set>
</div>

<div class="tc-tiddler-preview-edit">
<$edit field="text" class="tc-edit-texteditor" placeholder={{$:/language/EditTemplate/Body/Placeholder}}/>

</div>

</div>

</$reveal>

<$reveal state="!!editpreview" type="nomatch" text="yes">

<em class="tc-edit"><<lingo Hint>></em> <$button type="set" set="!!editpreview" setTo="yes"><<lingo Preview/Button/Show>></$button>
<$edit field="text" class="tc-edit-texteditor" placeholder={{$:/language/EditTemplate/Body/Placeholder}}/>

</$reveal>

</$list>

----

On request (min 10 likes) I'll try to convert this into a widget. And I'll look into impact of tw 5.1.12.
Reply all
Reply to author
Forward
0 new messages