mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-26 03:27:18 +00:00
Don't refresh the body editor when switching the preview on and off (#7747)
* Don't refresh the body editor when switching the preview on and off * Focus editor when switching the preview on or off
This commit is contained in:
parent
35e45f3b90
commit
327ecf8f66
@ -1,5 +1,9 @@
|
|||||||
title: $:/core/ui/EditTemplate/body/default
|
title: $:/core/ui/EditTemplate/body/default
|
||||||
|
|
||||||
|
\function edit-preview-state()
|
||||||
|
[{$:/config/ShowEditPreview/PerTiddler}!match[yes]then[$:/state/showeditpreview]] :else[<qualify "$:/state/showeditpreview">] +[get[text]] :else[[no]]
|
||||||
|
\end
|
||||||
|
|
||||||
\define config-visibility-title()
|
\define config-visibility-title()
|
||||||
$:/config/EditorToolbarButtons/Visibility/$(currentTiddler)$
|
$:/config/EditorToolbarButtons/Visibility/$(currentTiddler)$
|
||||||
\end
|
\end
|
||||||
@ -10,15 +14,16 @@ $:/config/EditorToolbarButtons/Visibility/$(currentTiddler)$
|
|||||||
|
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
<$let
|
<$let
|
||||||
edit-preview-state={{{ [{$:/config/ShowEditPreview/PerTiddler}!match[yes]then[$:/state/showeditpreview]] :else[<qualify "$:/state/showeditpreview">] }}}
|
|
||||||
importTitle=<<qualify $:/ImportImage>>
|
importTitle=<<qualify $:/ImportImage>>
|
||||||
importState=<<qualify $:/state/ImportImage>> >
|
importState=<<qualify $:/state/ImportImage>> >
|
||||||
<$dropzone importTitle=<<importTitle>> autoOpenOnImport="no" contentTypesFilter={{$:/config/Editor/ImportContentTypesFilter}} class="tc-dropzone-editor" enable={{{ [{$:/config/DragAndDrop/Enable}match[no]] :else[subfilter{$:/config/Editor/EnableImportFilter}then[yes]else[no]] }}} filesOnly="yes" actions=<<importFileActions>> >
|
<$dropzone importTitle=<<importTitle>> autoOpenOnImport="no" contentTypesFilter={{$:/config/Editor/ImportContentTypesFilter}} class="tc-dropzone-editor" enable={{{ [{$:/config/DragAndDrop/Enable}match[no]] :else[subfilter{$:/config/Editor/EnableImportFilter}then[yes]else[no]] }}} filesOnly="yes" actions=<<importFileActions>> >
|
||||||
<$reveal stateTitle=<<edit-preview-state>> type="match" text="yes" tag="div">
|
<div>
|
||||||
<div class="tc-tiddler-preview">
|
<div class={{{ [function[edit-preview-state]match[yes]then[tc-tiddler-preview]] +[join[ ]] }}}>
|
||||||
|
|
||||||
<$transclude tiddler="$:/core/ui/EditTemplate/body/editor" mode="inline"/>
|
<$transclude tiddler="$:/core/ui/EditTemplate/body/editor" mode="inline"/>
|
||||||
|
|
||||||
|
<$list filter="[function[edit-preview-state]match[yes]]" variable="ignore">
|
||||||
|
|
||||||
<div class="tc-tiddler-preview-preview" data-tiddler-title={{!!draft.title}} data-tags={{!!tags}}>
|
<div class="tc-tiddler-preview-preview" data-tiddler-title={{!!draft.title}} data-tags={{!!tags}}>
|
||||||
|
|
||||||
<$transclude tiddler={{$:/state/editpreviewtype}} mode="inline">
|
<$transclude tiddler={{$:/state/editpreviewtype}} mode="inline">
|
||||||
@ -29,13 +34,12 @@ $:/config/EditorToolbarButtons/Visibility/$(currentTiddler)$
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</$list>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</$reveal>
|
|
||||||
|
|
||||||
<$reveal stateTitle=<<edit-preview-state>> type="nomatch" text="yes" tag="div">
|
</div>
|
||||||
|
|
||||||
<$transclude tiddler="$:/core/ui/EditTemplate/body/editor" mode="inline"/>
|
|
||||||
|
|
||||||
</$reveal>
|
|
||||||
</$dropzone>
|
</$dropzone>
|
||||||
|
|
||||||
</$let>
|
</$let>
|
||||||
|
@ -9,11 +9,17 @@ button-classes: tc-text-editor-toolbar-item-start-group
|
|||||||
shortcuts: ((preview))
|
shortcuts: ((preview))
|
||||||
|
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
|
<$let
|
||||||
|
edit-preview-state={{{ [{$:/config/ShowEditPreview/PerTiddler}!match[yes]then[$:/state/showeditpreview]] :else[<qualify "$:/state/showeditpreview">] }}}
|
||||||
|
>
|
||||||
<$reveal state=<<edit-preview-state>> type="match" text="yes" tag="span">
|
<$reveal state=<<edit-preview-state>> type="match" text="yes" tag="span">
|
||||||
{{$:/core/images/preview-open}}
|
{{$:/core/images/preview-open}}
|
||||||
<$action-setfield $tiddler=<<edit-preview-state>> $value="no"/>
|
<$action-setfield $tiddler=<<edit-preview-state>> $value="no"/>
|
||||||
|
<$action-sendmessage $message="tm-edit-text-operation" $param="focus-editor"/>
|
||||||
</$reveal>
|
</$reveal>
|
||||||
<$reveal state=<<edit-preview-state>> type="nomatch" text="yes" tag="span">
|
<$reveal state=<<edit-preview-state>> type="nomatch" text="yes" tag="span">
|
||||||
{{$:/core/images/preview-closed}}
|
{{$:/core/images/preview-closed}}
|
||||||
<$action-setfield $tiddler=<<edit-preview-state>> $value="yes"/>
|
<$action-setfield $tiddler=<<edit-preview-state>> $value="yes"/>
|
||||||
|
<$action-sendmessage $message="tm-edit-text-operation" $param="focus-editor"/>
|
||||||
</$reveal>
|
</$reveal>
|
||||||
|
</$let>
|
||||||
|
Loading…
Reference in New Issue
Block a user