From c185e373c5f269baac0d88b33896f59b509c6864 Mon Sep 17 00:00:00 2001 From: Simon Huber Date: Tue, 17 Oct 2023 12:54:20 +0200 Subject: [PATCH] Use display: grid for editor toolbar, editor and preview (#7787) * make toolbar, editor and preview display: grid * correct display of bitmap editor * grid-area: toolbar not only when preview is shown * use dedicated classes and tc-grid and no brittle CSS selectors * no need for width: 100% * cleanup style definitions * use semantic classnames --- core/ui/EditTemplate/body/default.tid | 2 +- themes/tiddlywiki/vanilla/base.tid | 43 ++++++++++++++++++++++----- 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/core/ui/EditTemplate/body/default.tid b/core/ui/EditTemplate/body/default.tid index 68133d48e..31322f7fa 100644 --- a/core/ui/EditTemplate/body/default.tid +++ b/core/ui/EditTemplate/body/default.tid @@ -18,7 +18,7 @@ $:/config/EditorToolbarButtons/Visibility/$(currentTiddler)$ importState=<> > <$dropzone 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=<> >
-
+
<$transclude tiddler="$:/core/ui/EditTemplate/body/editor" mode="inline"/> diff --git a/themes/tiddlywiki/vanilla/base.tid b/themes/tiddlywiki/vanilla/base.tid index 031b849bf..214352b23 100644 --- a/themes/tiddlywiki/vanilla/base.tid +++ b/themes/tiddlywiki/vanilla/base.tid @@ -1365,6 +1365,11 @@ html body.tc-body.tc-single-tiddler-window { margin-top: 8px; } +.tc-tiddler-frame .tc-tiddler-editor.tc-tiddler-preview .tc-editor-toolbar, +.tc-tiddler-frame .tc-tiddler-editor.tc-tiddler-preview-hidden .tc-editor-toolbar { + grid-area: toolbar; +} + .tc-editor-toolbar button { vertical-align: middle; background-color: <>; @@ -1576,9 +1581,30 @@ html body.tc-body.tc-single-tiddler-window { overflow: auto; } -.tc-tiddler-preview-preview { - float: right; - width: 49%; +.tc-tiddler-editor { + display: grid; +} + +.tc-tiddler-frame .tc-tiddler-editor.tc-tiddler-preview { + grid-template-areas: + "toolbar toolbar" + "editor preview"; + grid-template-columns: 1fr 1fr; + grid-template-rows: auto 1fr; +} + +.tc-tiddler-frame .tc-tiddler-editor.tc-tiddler-preview-hidden { + grid-template-areas: + "toolbar" + "editor"; + grid-template-columns: 1fr; + grid-template-rows: auto 1fr; +} + +.tc-tiddler-frame .tc-tiddler-editor.tc-tiddler-preview .tc-tiddler-preview-preview { + grid-area: preview; + overflow-wrap: anywhere; + word-break: normal; border: 1px solid <>; margin: 4px 0 3px 3px; padding: 3px 3px 3px 3px; @@ -1593,12 +1619,15 @@ html body.tc-body.tc-single-tiddler-window { """>> -.tc-tiddler-frame .tc-tiddler-preview .tc-edit-texteditor { - width: 49%; +.tc-tiddler-frame .tc-tiddler-editor.tc-tiddler-preview .tc-edit-texteditor, +.tc-tiddler-frame .tc-tiddler-editor.tc-tiddler-preview-hidden .tc-edit-texteditor { + grid-area: editor; } -.tc-tiddler-frame .tc-tiddler-preview canvas.tc-edit-bitmapeditor { - max-width: 49%; +.tc-tiddler-frame .tc-tiddler-editor.tc-tiddler-preview canvas.tc-edit-bitmapeditor, +.tc-tiddler-frame .tc-tiddler-editor.tc-tiddler-preview-hidden canvas.tc-edit-bitmapeditor { + grid-area: editor; + max-width: 100%; } .tc-edit-fields {