mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-10 17:30:26 +00:00
77 lines
2.8 KiB
Plaintext
77 lines
2.8 KiB
Plaintext
title: $:/core/ui/EditTemplate/body/default
|
|
|
|
\function get.edit-preview-state()
|
|
[{$:/config/ShowEditPreview/PerTiddler}!match[yes]then[$:/state/showeditpreview]] :else[<qualified-preview-state>] +[get[text]] :else[[no]]
|
|
\end
|
|
|
|
\function get.tc-edit-texteditor.class() tc-edit-texteditor tc-edit-texteditor-body [<get.edit-preview-state>match[yes]then<identifier>addprefix[tc-edit-texteditor-identified-]] +[join[ ]]
|
|
|
|
\function get.preview.width() [<sidebarWidthTiddler>get[text]]
|
|
|
|
\function get.style.grid-template-columns()
|
|
[<get.edit-preview-state>!match[yes]then[1fr]]
|
|
:else[<sidebarWidthTiddler>!is[missing]then[calc(100% - ]addsuffix<get.preview.width>addsuffix[) ]addsuffix<get.preview.width>]
|
|
:else[[repeat(2, minmax(0px, 1fr))]]
|
|
\end
|
|
|
|
\function get.slider.condition() [<get.edit-preview-state>match[yes]] :else[[no]]
|
|
|
|
\define config-visibility-title()
|
|
$:/config/EditorToolbarButtons/Visibility/$(currentTiddler)$
|
|
\end
|
|
|
|
\define importFileActions()
|
|
<$action-popup $state=<<importState>> $coords="(0,0,0,0)" $floating="yes"/>
|
|
\end
|
|
|
|
\procedure tp-tiddler-editor-preview()
|
|
<div
|
|
class={{{ [<get.edit-preview-state>match[yes]then[tc-tiddler-preview]else[tc-tiddler-preview-hidden]] [[tc-tiddler-editor]] +[join[ ]] }}}
|
|
style.grid-template-columns=<<get.style.grid-template-columns>>>
|
|
|
|
<$transclude tiddler="$:/core/ui/EditTemplate/body/editor" mode="inline"/>
|
|
|
|
<$list filter="[<editPreviewStateTiddler>get[text]match[yes]]" variable="ignore">
|
|
|
|
<div class="tc-tiddler-preview-preview" data-tiddler-title={{!!draft.title}} data-tags={{!!tags}}>
|
|
|
|
<$transclude tiddler={{$:/state/editpreviewtype}} mode="inline">
|
|
|
|
<$transclude tiddler="$:/core/ui/EditTemplate/body/preview/output" mode="inline"/>
|
|
|
|
</$transclude>
|
|
|
|
</div>
|
|
|
|
</$list>
|
|
|
|
</div>
|
|
\end
|
|
|
|
\whitespace trim
|
|
<$let
|
|
qualified-preview-state=<<qualify "$:/state/showeditpreview">>
|
|
editPreviewStateTiddler={{{ [{$:/config/ShowEditPreview/PerTiddler}!match[yes]then[$:/state/showeditpreview]] :else[<qualified-preview-state>] }}}
|
|
importTitle=<<qualify $:/ImportImage>>
|
|
importState=<<qualify $:/state/ImportImage>>
|
|
identifier={{{ [<qualify>addsuffix[-]addsuffix<currentTiddler>sha256[]] }}}
|
|
sidebarWidthTiddler={{{ [<identifier>addprefix[$:/state/resizer/previewwidth-]] }}} >
|
|
<$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>> >
|
|
<div>
|
|
|
|
<$transclude
|
|
$variable="editor-preview-slider"
|
|
class="tc-edit-texteditor-slider"
|
|
template="tp-tiddler-editor-preview"
|
|
sliderCondition=<<get.slider.condition>>
|
|
mode="inline"
|
|
padding="0px"
|
|
sliderWidth="6px"
|
|
/>
|
|
|
|
</div>
|
|
|
|
</$dropzone>
|
|
|
|
</$let>
|