510 lines
9.7 KiB
CSS
510 lines
9.7 KiB
CSS
.milkdown-editor {
|
|
display: flex;
|
|
flex-direction: column;
|
|
flex: 1;
|
|
overflow: hidden;
|
|
height: 100%;
|
|
}
|
|
|
|
/* Toolbar */
|
|
.milkdown-toolbar {
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 8px 12px;
|
|
background-color: var(--vscode-sideBar-background);
|
|
border-bottom: 1px solid var(--vscode-panel-border);
|
|
flex-wrap: wrap;
|
|
gap: 4px;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.milkdown-toolbar .toolbar-group {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 2px;
|
|
}
|
|
|
|
.milkdown-toolbar .toolbar-divider {
|
|
width: 1px;
|
|
height: 20px;
|
|
background-color: var(--vscode-panel-border);
|
|
margin: 0 8px;
|
|
}
|
|
|
|
.milkdown-toolbar button {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
min-width: 28px;
|
|
height: 28px;
|
|
padding: 4px 8px;
|
|
background-color: transparent;
|
|
border: none;
|
|
border-radius: 4px;
|
|
color: var(--vscode-foreground);
|
|
font-size: 13px;
|
|
cursor: pointer;
|
|
transition: background-color 0.15s;
|
|
}
|
|
|
|
.milkdown-toolbar button:hover:not(:disabled) {
|
|
background-color: var(--vscode-toolbar-hoverBackground);
|
|
}
|
|
|
|
.milkdown-toolbar button.is-active {
|
|
background-color: var(--vscode-button-background);
|
|
color: var(--vscode-button-foreground);
|
|
}
|
|
|
|
.milkdown-toolbar button:disabled {
|
|
opacity: 0.4;
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
/* Editor Content */
|
|
.milkdown-content {
|
|
flex: 1;
|
|
padding: 16px;
|
|
overflow-y: auto;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
/* Milkdown Editor Styles */
|
|
.milkdown-content .milkdown {
|
|
outline: none;
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
.milkdown-content .milkdown .ProseMirror {
|
|
flex: 1;
|
|
outline: none;
|
|
color: var(--vscode-editor-foreground);
|
|
font-size: 15px;
|
|
line-height: 1.7;
|
|
}
|
|
|
|
.milkdown-content .milkdown .ProseMirror > * + * {
|
|
margin-top: 0.75em;
|
|
}
|
|
|
|
/* Placeholder */
|
|
.milkdown-content .milkdown .ProseMirror.ProseMirror-empty::before {
|
|
content: attr(data-placeholder);
|
|
color: var(--vscode-descriptionForeground);
|
|
pointer-events: none;
|
|
position: absolute;
|
|
}
|
|
|
|
.milkdown-content .milkdown .ProseMirror p.is-editor-empty:first-child::before {
|
|
content: attr(data-placeholder);
|
|
float: left;
|
|
color: var(--vscode-descriptionForeground);
|
|
pointer-events: none;
|
|
height: 0;
|
|
}
|
|
|
|
/* Typography */
|
|
.milkdown-content h1 {
|
|
font-size: 2em;
|
|
font-weight: 600;
|
|
margin-top: 1em;
|
|
margin-bottom: 0.5em;
|
|
color: var(--vscode-editor-foreground);
|
|
}
|
|
|
|
.milkdown-content h2 {
|
|
font-size: 1.5em;
|
|
font-weight: 600;
|
|
margin-top: 1em;
|
|
margin-bottom: 0.5em;
|
|
color: var(--vscode-editor-foreground);
|
|
}
|
|
|
|
.milkdown-content h3 {
|
|
font-size: 1.25em;
|
|
font-weight: 600;
|
|
margin-top: 1em;
|
|
margin-bottom: 0.5em;
|
|
color: var(--vscode-editor-foreground);
|
|
}
|
|
|
|
.milkdown-content h4,
|
|
.milkdown-content h5,
|
|
.milkdown-content h6 {
|
|
font-size: 1.1em;
|
|
font-weight: 600;
|
|
margin-top: 1em;
|
|
margin-bottom: 0.5em;
|
|
color: var(--vscode-editor-foreground);
|
|
}
|
|
|
|
.milkdown-content p {
|
|
margin: 0.5em 0;
|
|
}
|
|
|
|
.milkdown-content strong {
|
|
font-weight: 600;
|
|
}
|
|
|
|
.milkdown-content em {
|
|
font-style: italic;
|
|
}
|
|
|
|
.milkdown-content del,
|
|
.milkdown-content s {
|
|
text-decoration: line-through;
|
|
}
|
|
|
|
/* Links */
|
|
.milkdown-content a {
|
|
color: var(--vscode-textLink-foreground);
|
|
text-decoration: underline;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.milkdown-content a:hover {
|
|
color: var(--vscode-textLink-activeForeground);
|
|
}
|
|
|
|
/* Lists */
|
|
.milkdown-content ul,
|
|
.milkdown-content ol {
|
|
padding-left: 1.5em;
|
|
margin: 0.5em 0;
|
|
}
|
|
|
|
.milkdown-content li {
|
|
margin: 0.25em 0;
|
|
}
|
|
|
|
.milkdown-content ul {
|
|
list-style-type: disc;
|
|
}
|
|
|
|
.milkdown-content ol {
|
|
list-style-type: decimal;
|
|
}
|
|
|
|
/* Task List (GFM) */
|
|
.milkdown-content li[data-task-item] {
|
|
list-style: none;
|
|
position: relative;
|
|
margin-left: -1.5em;
|
|
padding-left: 1.5em;
|
|
}
|
|
|
|
.milkdown-content li[data-task-item] input[type="checkbox"] {
|
|
position: absolute;
|
|
left: 0;
|
|
top: 0.3em;
|
|
}
|
|
|
|
/* Blockquote */
|
|
.milkdown-content blockquote {
|
|
border-left: 3px solid var(--vscode-textBlockQuote-border);
|
|
padding-left: 1em;
|
|
margin: 1em 0;
|
|
color: var(--vscode-textBlockQuote-foreground);
|
|
font-style: italic;
|
|
}
|
|
|
|
/* Code */
|
|
.milkdown-content code {
|
|
background-color: var(--vscode-textCodeBlock-background);
|
|
padding: 2px 6px;
|
|
border-radius: 3px;
|
|
font-family: var(--vscode-editor-font-family);
|
|
font-size: 0.9em;
|
|
}
|
|
|
|
.milkdown-content pre {
|
|
background-color: var(--vscode-textCodeBlock-background);
|
|
padding: 12px 16px;
|
|
border-radius: 6px;
|
|
overflow-x: auto;
|
|
margin: 1em 0;
|
|
}
|
|
|
|
.milkdown-content pre code {
|
|
padding: 0;
|
|
background: none;
|
|
font-size: 0.9em;
|
|
line-height: 1.5;
|
|
}
|
|
|
|
/* Images */
|
|
.milkdown-content img {
|
|
max-width: 100%;
|
|
height: auto;
|
|
border-radius: 6px;
|
|
margin: 1em 0;
|
|
cursor: pointer;
|
|
transition: box-shadow 0.2s;
|
|
}
|
|
|
|
.milkdown-content img:hover {
|
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
|
|
}
|
|
|
|
/* Horizontal Rule */
|
|
.milkdown-content hr {
|
|
border: none;
|
|
border-top: 1px solid var(--vscode-panel-border);
|
|
margin: 2em 0;
|
|
}
|
|
|
|
/* Tables (GFM) */
|
|
.milkdown-content table {
|
|
border-collapse: collapse;
|
|
width: 100%;
|
|
margin: 1em 0;
|
|
}
|
|
|
|
.milkdown-content th,
|
|
.milkdown-content td {
|
|
border: 1px solid var(--vscode-panel-border);
|
|
padding: 8px 12px;
|
|
text-align: left;
|
|
}
|
|
|
|
.milkdown-content th {
|
|
background-color: var(--vscode-sideBar-background);
|
|
font-weight: 600;
|
|
}
|
|
|
|
.milkdown-content tr:nth-child(even) {
|
|
background-color: rgba(255, 255, 255, 0.02);
|
|
}
|
|
|
|
/* Selection */
|
|
.milkdown-content .ProseMirror-selectednode {
|
|
outline: 2px solid var(--vscode-focusBorder);
|
|
}
|
|
|
|
/* Block handle (from block plugin) */
|
|
.milkdown-content .block-handle {
|
|
position: absolute;
|
|
left: -24px;
|
|
width: 20px;
|
|
height: 20px;
|
|
cursor: grab;
|
|
opacity: 0;
|
|
transition: opacity 0.2s;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
color: var(--vscode-descriptionForeground);
|
|
}
|
|
|
|
.milkdown-content .block-handle:hover {
|
|
opacity: 1;
|
|
}
|
|
|
|
/* Cursor styles */
|
|
.milkdown-content .ProseMirror-gapcursor {
|
|
display: none;
|
|
pointer-events: none;
|
|
position: absolute;
|
|
}
|
|
|
|
.milkdown-content .ProseMirror-gapcursor:after {
|
|
content: "";
|
|
display: block;
|
|
position: absolute;
|
|
top: -2px;
|
|
width: 20px;
|
|
border-top: 1px solid var(--vscode-editor-foreground);
|
|
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
|
}
|
|
|
|
@keyframes ProseMirror-cursor-blink {
|
|
to {
|
|
visibility: hidden;
|
|
}
|
|
}
|
|
|
|
/* Focus ring */
|
|
.milkdown-content .ProseMirror:focus-visible {
|
|
outline: none;
|
|
}
|
|
|
|
/* =================================
|
|
Macro Styles
|
|
================================= */
|
|
|
|
/* Base macro inline element in editor */
|
|
.milkdown-macro {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
padding: 2px 8px;
|
|
margin: 0 2px;
|
|
border-radius: 4px;
|
|
font-family: var(--vscode-editor-font-family, monospace);
|
|
font-size: 0.9em;
|
|
line-height: 1.4;
|
|
vertical-align: baseline;
|
|
cursor: default;
|
|
user-select: none;
|
|
}
|
|
|
|
/* Known (registered) macro - teal/cyan shade */
|
|
.milkdown-macro.macro-known {
|
|
background-color: rgba(0, 150, 136, 0.15);
|
|
border: 1px solid rgba(0, 150, 136, 0.3);
|
|
color: var(--vscode-textLink-foreground, #3794ff);
|
|
}
|
|
|
|
/* Unknown macro - warning shade */
|
|
.milkdown-macro.macro-unknown {
|
|
background-color: rgba(255, 152, 0, 0.15);
|
|
border: 1px solid rgba(255, 152, 0, 0.3);
|
|
color: var(--vscode-editorWarning-foreground, #cca700);
|
|
}
|
|
|
|
/* Hover effect */
|
|
.milkdown-macro:hover {
|
|
filter: brightness(1.1);
|
|
}
|
|
|
|
/* Selected macro */
|
|
.milkdown-macro.ProseMirror-selectednode {
|
|
outline: 2px solid var(--vscode-focusBorder, #007acc);
|
|
outline-offset: 1px;
|
|
}
|
|
|
|
/* Macro icon prefix */
|
|
.milkdown-macro::before {
|
|
margin-right: 4px;
|
|
}
|
|
|
|
.milkdown-macro.macro-known::before {
|
|
content: "⬡";
|
|
}
|
|
|
|
.milkdown-macro.macro-unknown::before {
|
|
content: "⚠";
|
|
}
|
|
|
|
/* =================================
|
|
Rendered Macro Styles (Preview)
|
|
================================= */
|
|
|
|
/* Macro error display */
|
|
.macro-error {
|
|
display: inline-block;
|
|
padding: 2px 6px;
|
|
background-color: rgba(255, 0, 0, 0.1);
|
|
border: 1px dashed rgba(255, 0, 0, 0.5);
|
|
border-radius: 3px;
|
|
color: var(--vscode-errorForeground, #f44);
|
|
font-family: monospace;
|
|
font-size: 0.85em;
|
|
}
|
|
|
|
/* Gallery macro preview */
|
|
.macro-gallery {
|
|
margin: 1em 0;
|
|
border-radius: 8px;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.macro-gallery.gallery-preview {
|
|
background-color: rgba(0, 150, 136, 0.08);
|
|
border: 1px dashed rgba(0, 150, 136, 0.3);
|
|
padding: 16px;
|
|
}
|
|
|
|
.macro-gallery .gallery-placeholder {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
gap: 8px;
|
|
color: var(--vscode-descriptionForeground);
|
|
}
|
|
|
|
.macro-gallery .gallery-icon {
|
|
font-size: 2em;
|
|
}
|
|
|
|
.macro-gallery .gallery-info {
|
|
font-size: 0.9em;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.macro-gallery .gallery-caption {
|
|
font-size: 0.85em;
|
|
font-style: italic;
|
|
opacity: 0.8;
|
|
}
|
|
|
|
/* YouTube macro preview */
|
|
.macro-youtube {
|
|
margin: 1em 0;
|
|
border-radius: 8px;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.macro-youtube.youtube-preview .youtube-thumbnail {
|
|
position: relative;
|
|
width: 100%;
|
|
max-width: 480px;
|
|
aspect-ratio: 16 / 9;
|
|
background-size: cover;
|
|
background-position: center;
|
|
background-color: #000;
|
|
border-radius: 8px;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.macro-youtube .youtube-play-overlay {
|
|
position: absolute;
|
|
inset: 0;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
background-color: rgba(0, 0, 0, 0.3);
|
|
}
|
|
|
|
.macro-youtube .youtube-play-button {
|
|
width: 60px;
|
|
height: 42px;
|
|
background-color: rgba(255, 0, 0, 0.85);
|
|
border-radius: 8px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
color: white;
|
|
font-size: 1.5em;
|
|
}
|
|
|
|
.macro-youtube .youtube-title {
|
|
position: absolute;
|
|
bottom: 8px;
|
|
left: 8px;
|
|
right: 8px;
|
|
padding: 4px 8px;
|
|
background-color: rgba(0, 0, 0, 0.7);
|
|
color: white;
|
|
font-size: 0.85em;
|
|
border-radius: 4px;
|
|
}
|
|
|
|
/* YouTube iframe container */
|
|
.macro-youtube .youtube-container {
|
|
position: relative;
|
|
width: 100%;
|
|
padding-bottom: 56.25%; /* 16:9 aspect ratio */
|
|
}
|
|
|
|
.macro-youtube .youtube-container iframe {
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
border: none;
|
|
}
|