1
0

Styling improvements

This commit is contained in:
Zef Hemel 2022-03-04 17:04:26 +01:00
parent fd72374c7d
commit 19923a7881
6 changed files with 80 additions and 21 deletions

View File

@ -8,3 +8,5 @@ export const TaskTag = Tag.define();
export const TaskMarkerTag = Tag.define(); export const TaskMarkerTag = Tag.define();
export const CommentTag = Tag.define(); export const CommentTag = Tag.define();
export const CommentMarkerTag = Tag.define(); export const CommentMarkerTag = Tag.define();
export const BulletList = Tag.define();
export const OrderedList = Tag.define();

View File

@ -220,9 +220,12 @@ export class Editor implements AppEventDispatcher {
{ selector: "ATXHeading3", class: "line-h3" }, { selector: "ATXHeading3", class: "line-h3" },
{ selector: "ListItem", class: "line-li", nesting: true }, { selector: "ListItem", class: "line-li", nesting: true },
{ selector: "Blockquote", class: "line-blockquote" }, { selector: "Blockquote", class: "line-blockquote" },
{ selector: "Task", class: "line-task" },
{ selector: "CodeBlock", class: "line-code" }, { selector: "CodeBlock", class: "line-code" },
{ selector: "FencedCode", class: "line-fenced-code" }, { selector: "FencedCode", class: "line-fenced-code" },
{ selector: "Comment", class: "line-comment" }, { selector: "Comment", class: "line-comment" },
{ selector: "BulletList", class: "line-ul" },
{ selector: "OrderedList", class: "line-ol" },
]), ]),
keymap.of([ keymap.of([
...smartQuoteKeymap, ...smartQuoteKeymap,
@ -292,6 +295,17 @@ export class Editor implements AppEventDispatcher {
await this.dispatchAppEvent("page:click", clickEvent); await this.dispatchAppEvent("page:click", clickEvent);
}); });
}, },
// focus: (event: FocusEvent, view: EditorView) => {
// console.log("Got focus");
// document.body.classList.add("keyboard");
// },
// blur: (event: FocusEvent, view: EditorView) => {
// console.log("Lost focus");
// document.body.classList.remove("keyboard");
// },
// focusout: (event: FocusEvent, view: EditorView) => {
// window.scrollTo(0, 0);
// },
}), }),
markdown({ markdown({
base: customMarkDown, base: customMarkDown,

View File

@ -149,7 +149,6 @@ const WikiMarkdown = commonmark.configure([
TaskMarker: ct.TaskMarkerTag, TaskMarker: ct.TaskMarkerTag,
Url: t.url, Url: t.url,
Comment: ct.CommentTag, Comment: ct.CommentTag,
// CommentMarker: ct.CommentMarkerTag,
}), }),
], ],
}, },

View File

@ -109,29 +109,69 @@
background-color: #efefef; background-color: #efefef;
} }
.line-li-1 { // Indentation of follow-up lines
text-indent: -2ch; @mixin lineOverflow($baseIndent) {
padding-left: 2ch; text-indent: -1 * ($baseIndent + 2ch);
padding-left: $baseIndent + 2ch;
&.line-task {
text-indent: -1 * ($baseIndent + 6ch);
padding-left: $baseIndent + 6ch;
} }
.line-li-1.line-li-2 { &.line-blockquote {
text-indent: -4ch; text-indent: -1 * ($baseIndent + 4ch);
padding-left: 4ch; padding-left: $baseIndent + 4ch;
}
} }
.line-li-1.line-li-2.line-li-3 { .line-ul {
text-indent: -6ch; &.line-li-1 {
padding-left: 6ch; @include lineOverflow(0);
} }
.line-li-1.line-li-2.line-li-3.line-li-4 { &.line-li-1.line-li-2 {
text-indent: -8ch; @include lineOverflow(2);
padding-left: 8ch;
} }
.line-li-1.line-li-2.line-li-3.line-li-4.line-li-5 { &.line-li-1.line-li-2.line-li-3 {
text-indent: -10ch; @include lineOverflow(4);
padding-left: 10ch; }
&.line-li-1.line-li-2.line-li-3.line-li-4 {
@include lineOverflow(6);
}
&.line-li-1.line-li-2.line-li-3.line-li-4.line-li-5 {
@include lineOverflow(8);
}
}
.line-ol {
&.line-li-1 {
@include lineOverflow(1);
}
&.line-li-1.line-li-2 {
@include lineOverflow(2);
}
&.line-li-1.line-li-2.line-li-3 {
@include lineOverflow(4);
}
&.line-li-1.line-li-2.line-li-3.line-li-4 {
@include lineOverflow(6);
}
&.line-li-1.line-li-2.line-li-3.line-li-4.line-li-5 {
@include lineOverflow(8);
}
}
.line-comment {
text-indent: -1 * 3ch;
padding-left: 3ch;
} }
.task-marker { .task-marker {

View File

@ -2,7 +2,7 @@
position: absolute; position: absolute;
font-family: var(--ui-font); font-family: var(--ui-font);
margin: auto; margin: auto;
width: 500px; max-width: 500px;
height: 600px; height: 600px;
background-color: #fff; background-color: #fff;
left: 0; left: 0;

View File

@ -19,7 +19,7 @@ body {
#top { #top {
height: 55px; height: 55px;
position: absolute; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
right: 0; right: 0;
@ -46,7 +46,7 @@ body {
} }
#bottom { #bottom {
position: absolute; position: fixed;
bottom: 0; bottom: 0;
left: 0; left: 0;
right: 0; right: 0;
@ -61,6 +61,10 @@ body {
text-align: right; text-align: right;
} }
// body.keyboard #bottom {
// bottom: 250px;
// }
#editor { #editor {
position: absolute; position: absolute;
top: 55px; top: 55px;