1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-01-25 00:16:52 +00:00
This commit is contained in:
BurningTreeC 2024-11-01 07:29:32 +01:00
parent 324ead820f
commit e167eef53e
4 changed files with 86 additions and 57 deletions

View File

@ -6,6 +6,8 @@ title: $:/core/ui/EditTemplate/body/default
\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.tc-tiddler-preview-preview.class() tc-tiddler-preview-preview [<identifier>addprefix[tc-tiddler-preview-preview-identified-]] +[join[ ]]
\function get.preview.width() [<sidebarWidthTiddler>get[text]]
\function get.style.grid-template-columns()
@ -33,7 +35,7 @@ $:/config/EditorToolbarButtons/Visibility/$(currentTiddler)$
<$list filter="[<editPreviewStateTiddler>get[text]match[yes]]" variable="ignore">
<div class="tc-tiddler-preview-preview" data-tiddler-title={{!!draft.title}} data-tags={{!!tags}}>
<div class=<<get.tc-tiddler-preview-preview.class>> data-tiddler-title={{!!draft.title}} data-tags={{!!tags}}>
<$transclude tiddler={{$:/state/editpreviewtype}} mode="inline">

View File

@ -204,7 +204,8 @@ title: $:/core/procedures/sidebar-resizer
storyMinWidth={{{ [convert.to.pixels.locally<storyMinWidthValue>] }}}
sidebarMaxWidth={{{ [<widgetNodeWidth>subtract<storyLeft>subtract<storyMinWidth>] }}}
clampedDiff={{{ [<storyLeft>add<storyMinWidth>add<startSidebarWidth>subtract<widgetNodeWidth>compare:number:gt[0]] ~0 }}}
sidebarWidth={{{ [<sidebarWidth>subtract<clampedDiff>] }}}>
sliderWidth={{{ [convert.to.pixels.locally<get.resizer.style.width>] }}}
sidebarWidth={{{ [<sidebarWidth>subtract<clampedDiff>subtract<sliderWidth>] }}}>
<$let
sidebarWidthConverted={{{ [function[convert.to.result],<sidebarWidth>,<sidebarWidthMetric>] }}}
@ -303,6 +304,7 @@ title: $:/core/procedures/sidebar-resizer
\function get.template-right.style.flex-basis() [<sliderCondition>match[no]then[0%]] :else[[calc(]addsuffix<get.template-right.width>addsuffix[ - ]addsuffix<resizerWidthDivided>addsuffix[px)]]
\procedure sidebar-resizer(templateLeft:"",templateRight:"",mode:"block",sliderCondition:"yes",eventCatcherClass:"",zIndexLeft:"")
<$set name="resizerWidthDivided" value={{{ [<get.resizer.style.width>divide[2]] }}}>
<$eventcatcher
@ -409,73 +411,72 @@ title: $:/core/procedures/sidebar-resizer
</$eventcatcher>
</$set>
\end
\procedure editor-resizer(template:"",mode:"block",sliderCondition:"yes",eventCatcherClass:"")
<$set name="resizerWidthDivided" value={{{ [<get.resizer.style.width>divide[2]] }}}>
<$eventcatcher
tag="div"
class=<<get.active.class tc-sidebar-resizer-pointerdown-eventcatcher>>
selector=".tc-sidebar-resizer"
matchSelector=".tc-sidebar-resizer"
$pointerdown=<<get.sidebar-resizer.pointerdown.actions>>
$pointerup=<<sidebar-resizer-pointercancel-actions>>>
<$eventcatcher
tag="div"
class=<<get.active.class tc-sidebar-resizer-pointerdown-eventcatcher>>
selector=".tc-sidebar-resizer"
matchSelector=".tc-sidebar-resizer"
$pointerdown=<<get.sidebar-resizer.pointerdown.actions>>
$pointerup=<<sidebar-resizer-pointercancel-actions>>>
<%if [<resizer.state>!match[no]] %>
<%if [<resizer.state>!match[no]] %>
<$eventcatcher
tag="div"
class=<<get.active.class tc-sidebar-resizer-pointermove-eventcatcher-wrapper>>
selector=".tc-sidebar-resizer"
matchSelector=".tc-sidebar-resizer"
$pointerup={{{ [<get.resizer.state>is[tiddler]then<sidebar-resizer-pointercancel-actions>] }}}>
<$eventcatcher
tag="div"
class=<<get.active.class tc-sidebar-resizer-pointermove-eventcatcher-wrapper>>
selector=".tc-sidebar-resizer"
matchSelector=".tc-sidebar-resizer"
$pointerup={{{ [<get.resizer.state>is[tiddler]then<sidebar-resizer-pointercancel-actions>] }}}>
selector=".tc-sidebar-resizer-pointermove"
matchSelector=".tc-sidebar-resizer-pointermove"
class=<<get.active.class tc-sidebar-resizer-pointermove-eventcatcher>>
$pointerup=<<sidebar-resizer-pointercancel-actions>>
$pointerleave=<<sidebar-resizer-pointercancel-actions>>
$pointerout=<<sidebar-resizer-pointercancel-actions>>
$pointercancel=<<sidebar-resizer-pointercancel-actions>>
$pointerdown=<<sidebar-resizer-pointercancel-actions>>
$touchstart=<<sidebar-resizer-pointercancel-actions>>
$pointermove=<<sidebar-resizer-pointermove-actions>>
$contextmenu=<<sidebar-resizer-pointercancel-actions>>>
<$eventcatcher
tag="div"
selector=".tc-sidebar-resizer-pointermove"
matchSelector=".tc-sidebar-resizer-pointermove"
class=<<get.active.class tc-sidebar-resizer-pointermove-eventcatcher>>
$pointerup=<<sidebar-resizer-pointercancel-actions>>
$pointerleave=<<sidebar-resizer-pointercancel-actions>>
$pointerout=<<sidebar-resizer-pointercancel-actions>>
$pointercancel=<<sidebar-resizer-pointercancel-actions>>
$pointerdown=<<sidebar-resizer-pointercancel-actions>>
$touchstart=<<sidebar-resizer-pointercancel-actions>>
$pointermove=<<sidebar-resizer-pointermove-actions>>
$contextmenu=<<sidebar-resizer-pointercancel-actions>>>
<div class=<<get.active.class tc-sidebar-resizer-pointermove>>/>
</$eventcatcher>
<%if [<sliderCondition>match[yes]] %>
<div
class=<<get.resizer.class>>
style.position=<<get.resizer.style.position>>
style.left=<<get.resizer.style.left>>
style.width=<<get.resizer.style.width>>
/>
<% endif %>
<%if [<template>is[variable]] %>
<$transclude $variable=<<template>> mode=<<mode>>/>
<% else %>
<$transclude $tiddler=<<template>> mode=<<mode>>/>
<% endif %>
<div class=<<get.active.class tc-sidebar-resizer-pointermove>>/>
</$eventcatcher>
<% endif %>
<%if [<sliderCondition>match[yes]] %>
</$eventcatcher>
<div
class=<<get.resizer.class>>
style.position=<<get.resizer.style.position>>
style.left=<<get.resizer.style.left>>
style.width=<<get.resizer.style.width>>
/>
<% endif %>
<%if [<template>is[variable]] %>
<$transclude $variable=<<template>> mode=<<mode>>/>
<% else %>
<$transclude $tiddler=<<template>> mode=<<mode>>/>
<% endif %>
</$eventcatcher>
<% endif %>
</$eventcatcher>
</$set>
\end

View File

@ -2,7 +2,7 @@ title: $:/core/procedures/sliders
tags: $:/tags/Global
code-body: yes
\procedure editor-preview-slider(class:"",width:"100%",minHeight:"10px",template:"",mode:"block",sliderWidth:"12px",padding:"12px",sliderCondition:"yes",leftMinWidth:"0px",rightMinWidth:"0px")
\procedure editor-preview-slider(class:"",width:"100%",minHeight:"10px",template:"",mode:"block",sliderWidth:"12px",padding:"12px",sliderCondition:"yes",leftMinWidth:"0%",rightMinWidth:"0%")
\import $:/core/procedures/sidebar-resizer
\function get.resizer.style.position() absolute
\function get.template-right.width() [<sidebarWidthTiddler>get[text]] :else[[50%]]

View File

@ -178,4 +178,30 @@ code-body: yes
min-width: 0px;
}
<$list filter="[all[tiddlers]prefix[$:/state/resizer/previewwidth-]]" variable="previewWidthTiddler">
<$let
identifier={{{ [<previewWidthTiddler>removeprefix[$:/state/resizer/previewwidth-]] }}}
width={{{ [<previewWidthTiddler>get[text]] }}}>
<%if [<width>compare:number:lteq[1]] %>
.tc-tiddler-preview-preview-identified-<<identifier>> {
display: none;
}
<% endif %>
<%if [<width>compare:number:gteq[99]] %>
.tc-edit-texteditor-identified-<<identifier>> {
display: none;
}
<% endif %>
</$let>
</$list>
}