Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

display: grid for editor toolbar, editor and preview #7787

Merged
merged 7 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/ui/EditTemplate/body/default.tid
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $:/config/EditorToolbarButtons/Visibility/$(currentTiddler)$
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>> >
<div>
<div class={{{ [function[edit-preview-state]match[yes]then[tc-tiddler-preview]] +[join[ ]] }}}>
<div class={{{ [function[edit-preview-state]match[yes]then[tc-tiddler-preview]else[tc-tiddler-preview-hidden]] [[tc-tiddler-editor]] +[join[ ]] }}}>

<$transclude tiddler="$:/core/ui/EditTemplate/body/editor" mode="inline"/>

Expand Down
43 changes: 36 additions & 7 deletions themes/tiddlywiki/vanilla/base.tid
Original file line number Diff line number Diff line change
Expand Up @@ -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: <<colour tiddler-controls-foreground>>;
Expand Down Expand Up @@ -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 <<colour tiddler-editor-border>>;
margin: 4px 0 3px 3px;
padding: 3px 3px 3px 3px;
Expand All @@ -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 {
Expand Down
Loading