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

CodeMirror 6: Fix header token position and image fade-in #59

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
8 changes: 6 additions & 2 deletions src/style/focus.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
div.CodeMirror .CodeMirror-line, div.CodeMirror img {
div.CodeMirror .CodeMirror-line,
div.cm-editor .cm-line,
div.CodeMirror img {
opacity: 0.4;
color: var(--joplin-color) !important;
transition: opacity 0.2s;
}

div.CodeMirror .CodeMirror-activeline .CodeMirror-line,
div.CodeMirror .CodeMirror-activeline img,
div.CodeMirror .CodeMirror-activeline.cm-line,
div.CodeMirror .CodeMirror-activeline img {
div.cm-editor .CodeMirror-activeline + .rich-markdown-resource.cm-line > img,
div.cm-editor .CodeMirror-activeline + .rich-markdown-resource.cm-line {
opacity: 1.0;
transition: opacity 0.4s;
}
Expand Down
24 changes: 16 additions & 8 deletions src/style/stylish.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ div.CodeMirror span.cm-hr {
/* END Horizontal Rule*/

/* Blockquotes */
pre.cm-rm-blockquote.CodeMirror-line {
pre.cm-rm-blockquote.CodeMirror-line,
pre.cm-rm-blockquote.cm-line {
border-left: 4px solid var(--joplin-code-border-color);
opacity: 0.7;
}
Expand Down Expand Up @@ -61,35 +62,42 @@ div.CodeMirror .cm-jn-code-block .cm-katex-marker-close {
/* END Fade tokens*/

/* Headers */
div.CodeMirror .cm-header.cm-rm-header-token:not(.cm-whitespace-a, .cm-whitespace-b) {
div.CodeMirror .cm-header.cm-rm-header-token:not(.cm-whitespace-a, .cm-whitespace-b),
div.cm-editor .cm-header > .cm-rm-header-token {
font-family: monospace;
font-size: 0.9em;
/* Add some spacing for breathing room */
margin-right: 0.3ex;
}
div.CodeMirror .cm-rm-header-token.cm-header-1:not(.cm-whitespace-a, .cm-whitespace-b) {
div.CodeMirror .cm-rm-header-token.cm-header-1:not(.cm-whitespace-a, .cm-whitespace-b),
div.cm-editor .cm-header.cm-h1 > .cm-rm-header-token {
/* 1ex is the height of a lowercase x, it's an approximation for width */
/* We need 2ex to account for the space character */
margin-left: -2ex;
}

div.CodeMirror .cm-rm-header-token.cm-header-2:not(.cm-whitespace-a, .cm-whitespace-b) {
div.CodeMirror .cm-rm-header-token.cm-header-2:not(.cm-whitespace-a, .cm-whitespace-b),
div.cm-editor .cm-header.cm-h2 > .cm-rm-header-token {
margin-left: -3ex;
}

div.CodeMirror .cm-rm-header-token.cm-header-3:not(.cm-whitespace-a, .cm-whitespace-b) {
div.CodeMirror .cm-rm-header-token.cm-header-3:not(.cm-whitespace-a, .cm-whitespace-b),
div.cm-editor .cm-header.cm-h3 > .cm-rm-header-token {
margin-left: -4ex;
}

div.CodeMirror .cm-rm-header-token.cm-header-4:not(.cm-whitespace-a, .cm-whitespace-b) {
div.CodeMirror .cm-rm-header-token.cm-header-4:not(.cm-whitespace-a, .cm-whitespace-b),
div.cm-editor .cm-header.cm-h4 > .cm-rm-header-token {
margin-left: -5ex;
}

div.CodeMirror .cm-rm-header-token.cm-header-5:not(.cm-whitespace-a, .cm-whitespace-b) {
div.CodeMirror .cm-rm-header-token.cm-header-5:not(.cm-whitespace-a, .cm-whitespace-b),
div.cm-editor .cm-header.cm-h5 > .cm-rm-header-token {
margin-left: -6ex;
}

div.CodeMirror .cm-rm-header-token.cm-header-6:not(.cm-whitespace-a, .cm-whitespace-b) {
div.CodeMirror .cm-rm-header-token.cm-header-6:not(.cm-whitespace-a, .cm-whitespace-b),
div.cm-editor .cm-header.cm-h6 > .cm-rm-header-token {
margin-left: -7ex;
}
/* END Headers */
Expand Down