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 1 commit
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-no-tiddler-preview]] [[tc-grid]] +[join[ ]] }}}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We try to use semantic class names, and avoid functional names such as "tc-grid". I think it would be clearer to replace tc-no-tiddler-preview with tc-tiddler-preview-hidden, and to use tc-tiddler-preview-frame instead of tc-grid.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think tc-tiddler-preview-frame is way to specific. tc-grid only contains 1 setting to use grid. It can be reused that way.

tc-tiddler-preview-frame is completely misleading since it is not set to the preview-frame, but it's parent

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I want to define tc-grid to any other gird with a completely different context in the sidebar or control-panel tc-tiddler-preview-frame would be misleading. IMO it should be as generic as possible

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pmario if we use tc-grid and reuse it elsewhere then we'll be constrained that we can't change the styling of just the preview pane. As I said before, functional class names are an anti-pattern.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could use tc-tiddler-editor instead of tc-grid.


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

Expand Down
23 changes: 9 additions & 14 deletions themes/tiddlywiki/vanilla/base.tid
Original file line number Diff line number Diff line change
Expand Up @@ -1365,7 +1365,7 @@ html body.tc-body.tc-single-tiddler-window {
margin-top: 8px;
}

.tc-tiddler-edit-frame .tc-dropzone-editor > div > div > .tc-editor-toolbar {
.tc-tiddler-frame .tc-grid.tc-tiddler-preview .tc-editor-toolbar, .tc-tiddler-frame .tc-grid.tc-no-tiddler-preview .tc-editor-toolbar {
BurningTreeC marked this conversation as resolved.
Show resolved Hide resolved
grid-area: toolbar;
}

Expand Down Expand Up @@ -1580,29 +1580,24 @@ html body.tc-body.tc-single-tiddler-window {
overflow: auto;
}

.tc-tiddler-edit-frame .tc-dropzone-editor > div > div {
.tc-grid {
display: grid;
}

.tc-tiddler-edit-frame .tc-dropzone-editor > div > div.tc-tiddler-preview {
grid-template-areas:
"toolbar toolbar"
"editor preview";
.tc-tiddler-frame .tc-grid.tc-tiddler-preview {
grid-template-areas: "toolbar toolbar" "editor preview";
BurningTreeC marked this conversation as resolved.
Show resolved Hide resolved
grid-template-columns: 1fr 1fr;
grid-template-rows: auto 1fr;
}

.tc-tiddler-edit-frame .tc-dropzone-editor > div > div:not(.tc-tiddler-preview) {
grid-template-areas:
"toolbar"
"editor";
.tc-tiddler-frame .tc-grid.tc-no-tiddler-preview {
grid-template-areas: "toolbar" "editor";
BurningTreeC marked this conversation as resolved.
Show resolved Hide resolved
grid-template-columns: 1fr;
grid-template-rows: auto 1fr;
}

.tc-tiddler-edit-frame .tc-dropzone-editor > div > div.tc-tiddler-preview > .tc-tiddler-preview-preview {
.tc-tiddler-frame .tc-grid.tc-tiddler-preview .tc-tiddler-preview-preview {
grid-area: preview;
width: calc(100% - 3px);
overflow-wrap: anywhere;
word-break: normal;
border: 1px solid <<colour tiddler-editor-border>>;
Expand All @@ -1619,12 +1614,12 @@ html body.tc-body.tc-single-tiddler-window {

""">>

.tc-tiddler-edit-frame .tc-dropzone-editor > div > div > .tc-edit-texteditor {
.tc-tiddler-frame .tc-grid.tc-tiddler-preview .tc-edit-texteditor, .tc-tiddler-frame .tc-grid.tc-no-tiddler-preview .tc-edit-texteditor {
grid-area: editor;
width: 100%;
}

.tc-tiddler-frame .tc-tiddler-preview canvas.tc-edit-bitmapeditor {
.tc-tiddler-frame .tc-grid.tc-tiddler-preview canvas.tc-edit-bitmapeditor, .tc-tiddler-frame .tc-grid.tc-no-tiddler-preview canvas.tc-edit-bitmapeditor {
BurningTreeC marked this conversation as resolved.
Show resolved Hide resolved
grid-area: editor;
max-width: 100%;
}
Expand Down
Loading