1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-01-08 16:30:26 +00:00

fix editor-preview button not focusing editor, two-cell-slider experiments

This commit is contained in:
BurningTreeC 2024-11-15 11:00:53 +01:00
parent 2e68b6f1a1
commit 40489a2fba
6 changed files with 34 additions and 24 deletions

View File

@ -106,6 +106,10 @@ function FramedEngine(options) {
this.iframeDoc.body.appendChild(this.domNode);
}
FramedEngine.prototype.assignDomNodeClasses = function() {
this.iframeNode.className = this.widget.getAttribute("class","");
};
/*
Copy styles from the dummy text area to the textarea in the iframe
*/

View File

@ -220,7 +220,7 @@ function editTextWidgetFactory(toolbarEngine,nonToolbarEngine) {
EditTextWidget.prototype.refresh = function(changedTiddlers) {
var changedAttributes = this.computeAttributes();
// Completely rerender if any of our attributes have changed
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes["default"] || changedAttributes["class"] || changedAttributes.placeholder || changedAttributes.size || changedAttributes.autoHeight || changedAttributes.minHeight || changedAttributes.focusPopup || changedAttributes.rows || changedAttributes.tabindex || changedAttributes.cancelPopups || changedAttributes.inputActions || changedAttributes.refreshTitle || changedAttributes.autocomplete || changedTiddlers[HEIGHT_MODE_TITLE] || changedTiddlers[ENABLE_TOOLBAR_TITLE] || changedTiddlers["$:/palette"] || changedAttributes.disabled || changedAttributes.fileDrop) {
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes["default"] || (changedAttributes["class"] && !this.engine.assignDomNodeClasses) || changedAttributes.placeholder || changedAttributes.size || changedAttributes.autoHeight || changedAttributes.minHeight || changedAttributes.focusPopup || changedAttributes.rows || changedAttributes.tabindex || changedAttributes.cancelPopups || changedAttributes.inputActions || changedAttributes.refreshTitle || changedAttributes.autocomplete || changedTiddlers[HEIGHT_MODE_TITLE] || changedTiddlers[ENABLE_TOOLBAR_TITLE] || changedTiddlers["$:/palette"] || changedAttributes.disabled || changedAttributes.fileDrop) {
this.refreshSelf();
return true;
} else if (changedTiddlers[this.editRefreshTitle]) {
@ -229,6 +229,9 @@ function editTextWidgetFactory(toolbarEngine,nonToolbarEngine) {
var editInfo = this.getEditInfo();
this.updateEditor(editInfo.value,editInfo.type);
}
if(changedAttributes["class"] && this.engine.assignDomNodeClasses) {
this.engine.assignDomNodeClasses();
}
this.engine.fixHeight();
if(this.editShowToolbar) {
return this.refreshChildren(changedTiddlers);

View File

@ -1,5 +1,7 @@
title: $:/core/ui/EditTemplate/body/default
\import $:/core/procedures/sliders
\function get.edit-preview-state()
[{$:/config/ShowEditPreview/PerTiddler}!match[yes]then[$:/state/showeditpreview]] :else[<qualified-preview-state>] +[get[text]] :else[[no]]
\end
@ -60,7 +62,6 @@ $:/config/EditorToolbarButtons/Visibility/$(currentTiddler)$
$variable="editor-preview-slider"
class="tc-edit-texteditor-slider"
template="tp-tiddler-editor-preview"
sliderCondition=<<get.slider.condition>>
mode="inline"
padding="0px"
sliderWidth=<<get.theme.metric previewsliderwidth>>

View File

@ -10,6 +10,7 @@ code-body: yes
\function resizer.class() tc-main-slider
\function set.throttling() yes
\function drag.direction.reverse() [<get.theme.option sidebarposition>match[left]then[yes]] :else[[no]]
\function get.slider.condition() [{$:/state/sidebar}!match[no]then[yes]]
\whitespace trim
<%if [<get.theme.explicit.option sidebarresizer>match[show]] %>

View File

@ -371,7 +371,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:"")
\procedure sidebar-resizer(templateLeft:"",templateRight:"",mode:"block",eventCatcherClass:"",zIndexLeft:"")
<$set name="resizerWidthDivided" value={{{ [<get.resizer.style.width>divide[2]] }}}>
@ -419,6 +419,7 @@ title: $:/core/procedures/sidebar-resizer
style.top="0"
style.left="0"
style.flex-basis=<<get.template-left.style.flex-basis>>
style.width=<<get.template-left.style.flex-basis>>
style.z-index=<<zIndexLeft>>
>
@ -436,7 +437,7 @@ title: $:/core/procedures/sidebar-resizer
<% endif %>
<%if [<sliderCondition>match[yes]] %>
<%if [<get.slider.condition>match[yes]] %>
<div
class=<<get.resizer.class>>
@ -456,6 +457,7 @@ title: $:/core/procedures/sidebar-resizer
style.top="0"
style.left=<<get.template-right.style.left>>
style.flex-basis=<<get.template-right.style.flex-basis>>
style.width=<<get.template-right.style.flex-basis>>
>
<%if [<templateRight>is[variable]] %>
@ -519,7 +521,7 @@ title: $:/core/procedures/sidebar-resizer
</$eventcatcher>
<%if [<sliderCondition>match[yes]] %>
<%if [<get.slider.condition>match[yes]] %>
<div
class=<<get.resizer.class>>

View File

@ -1,11 +1,10 @@
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",
padding:"12px",
leftMinWidth:"0%",rightMinWidth:"0%")
\import $:/core/procedures/sidebar-resizer
@ -35,7 +34,6 @@ leftMinWidth:"0%",rightMinWidth:"0%")
<$transclude
$variable="editor-resizer"
template=<<template>>
sliderCondition=<<sliderCondition>>
eventCatcherClass="tc-editor-preview-eventcatcher"
mode=<<mode>>
/>
@ -43,20 +41,22 @@ leftMinWidth:"0%",rightMinWidth:"0%")
</$let>
\end
\procedure two-cell-slider(width:"100%",minHeight:"10px",
\procedure two-cell-slider(
templateLeft:"",templateRight:"",
width:"100%",minHeight:"22px",
mode:"block",sliderWidth:"12px",
padding:"12px",sliderCondition:"yes",
leftMinWidth:"100px",rightMinWidth:"100px")
padding:"12px",leftMinWidth:"100px",
rightMinWidth:"100px",id:"1")
\import $:/core/procedures/sidebar-resizer
\function get.resizer.style.position() absolute
\function get.template-right.width() [<sidebarWidthTiddler>get[text]] :else[[50%]]
\function get.resizer.style.left() [[calc(100% - ]addsuffix<get.template-right.width>addsuffix[)]]
\function get.resizer.style.left() [[clamp(]addsuffix<leftMinWidth>addsuffix[,]addsuffix[calc(100% - ]addsuffix<get.template-right.width>addsuffix[),calc(100% - ]addsuffix<rightMinWidth>addsuffix[))]]
\function get.resizer.style.width() [<sliderWidth>]
\function set.throttling() no
\function get.left.minwidth() [<leftMinWidth>]
\function get.right.minwidth() [<rightMinWidth>]
\function get.modulo.minwidth(width) [<id>remainder[3]match[1]then<width>multiply[2]else<width>multiply[1]] :map[get.value.metric<width>addprefix<currentTiddler>]
\function get.left.minwidth() [get.modulo.minwidth<leftMinWidth>]
\function get.right.minwidth() [get.modulo.minwidth<rightMinWidth>]
\function drag.direction.reverse() no
\whitespace trim
@ -75,21 +75,20 @@ leftMinWidth:"100px",rightMinWidth:"100px")
tv-set-storywidth-storyright="no"
tv-set-sidebarwidth="yes"
tv-set-centralised="no"
storyLeftTiddler={{{ [<storyLeftTiddler>!is[blank]] :else[<qualify>addsuffix<currentTiddler>sha256[]addprefix[$:/state/resizer/storyleft-]] }}}
storyRightTiddler={{{ [<storyRightTiddler>!is[blank]] :else[<qualify>addsuffix<currentTiddler>sha256[]addprefix[$:/state/resizer/storyright-]] }}}
sidebarWidthTiddler={{{ [<sidebarWidthTiddler>!is[blank]] :else[<qualify>addsuffix<currentTiddler>sha256[]addprefix[$:/state/resizer/rightwidth-]] }}}
tiddlerWidthTiddler={{{ [<tiddlerWidthTiddler>!is[blank]] :else[<qualify>addsuffix<currentTiddler>sha256[]addprefix[$:/state/resizer/tiddlerwidth-]] }}}
storyWidthTiddler={{{ [<storyWidthTiddler>!is[blank]] :else[<qualify>addsuffix<currentTiddler>sha256[]addprefix[$:/state/resizer/storywidth-]] }}}
storyMinWidthTiddler={{{ [<storyMinWidthTiddler>!is[blank]] :else[<qualify>addsuffix<currentTiddler>sha256[]addprefix[$:/state/resizer/storywidth-]] }}}
sidebarMinWidthTiddler={{{ [<sidebarMinWidthTiddler>!is[blank]] :else[<qualify>addsuffix<currentTiddler>sha256[]addprefix[$:/state/resizer/storyminwidth-]] }}}
storyPaddingLeftTiddler={{{ [<storyPaddingLeftTiddler>!is[blank]] :else[<qualify>addsuffix<currentTiddler>sha256[]addprefix[$:/state/resizer/storypaddingleft-]] }}}
storyPaddingRightTiddler={{{ [<storyPaddingRightTiddler>!is[blank]] :else[<qualify>addsuffix<currentTiddler>sha256[]addprefix[$:/state/resizer/storypaddingright-]] }}}>
storyLeftTiddler={{{ [<qualify>addsuffix<currentTiddler>sha256[]addprefix[$:/state/resizer/storyleft-]addsuffix<id>] }}}
storyRightTiddler={{{ [<qualify>addsuffix<currentTiddler>sha256[]addprefix[$:/state/resizer/storyright-]addsuffix<id>] }}}
sidebarWidthTiddler={{{ [<qualify>addsuffix<currentTiddler>sha256[]addprefix[$:/state/resizer/rightwidth-]addsuffix<id>] }}}
tiddlerWidthTiddler={{{ [<qualify>addsuffix<currentTiddler>sha256[]addprefix[$:/state/resizer/tiddlerwidth-]addsuffix<id>] }}}
storyWidthTiddler={{{ [<qualify>addsuffix<currentTiddler>sha256[]addprefix[$:/state/resizer/storywidth-]addsuffix<id>] }}}
storyMinWidthTiddler={{{ [<qualify>addsuffix<currentTiddler>sha256[]addprefix[$:/state/resizer/storywidth-]addsuffix<id>] }}}
sidebarMinWidthTiddler={{{ [<qualify>addsuffix<currentTiddler>sha256[]addprefix[$:/state/resizer/storyminwidth-]addsuffix<id>] }}}
storyPaddingLeftTiddler={{{ [<qualify>addsuffix<currentTiddler>sha256[]addprefix[$:/state/resizer/storypaddingleft-]addsuffix<id>] }}}
storyPaddingRightTiddler={{{ [<qualify>addsuffix<currentTiddler>sha256[]addprefix[$:/state/resizer/storypaddingright-]addsuffix<id>] }}}>
<$transclude
$variable="sidebar-resizer"
templateLeft=<<templateLeft>>
templateRight=<<templateRight>>
sliderCondition=<<sliderCondition>>
mode=<<mode>>
/>