дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-03 16:51:16 +02:00
⌘F in a Markdown file only decorated matches in the editor, so the rendered preview (Split and Preview Only) showed none, and selecting a word in the preview didn't highlight its other occurrences. The Markdown viewer now publishes the active Find query and current match, and the preview draws matches, the current match and selected-word occurrences with the CSS Custom Highlight API in the editor scheme's colours, scrolling the current match into view; a selection in the preview seeds Find, and closing Find in Preview Only returns focus to the preview. Matches are indexed once per render, not rescanned per keystroke. Co-authored-by: dengliu <[email protected]>
192 рядки
4.5 KiB
CSS
192 рядки
4.5 KiB
CSS
.split {
|
|
flex: 1;
|
|
min-height: 0;
|
|
min-width: 0;
|
|
display: flex;
|
|
position: relative;
|
|
}
|
|
.editor {
|
|
flex: 1 1 50%;
|
|
min-width: 0;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
.mode-preview .editor {
|
|
display: none;
|
|
}
|
|
.mode-split .editor {
|
|
border-right: 1px solid var(--border-editor-tabs, var(--border));
|
|
}
|
|
|
|
.layoutActions {
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
.layoutActions > button {
|
|
width: var(--h-floating-toolbar-button);
|
|
height: var(--h-floating-toolbar-button);
|
|
}
|
|
|
|
.preview {
|
|
flex: 1 1 50%;
|
|
min-width: 0;
|
|
position: relative;
|
|
overflow: auto;
|
|
padding: 16px 28px 40vh;
|
|
outline: none;
|
|
/* The preview sits on the editor background, so its text comes from the
|
|
editor scheme: with a light UI theme + dark editor scheme, the UI's
|
|
--fg would be black-on-black here. */
|
|
background: var(--bg-editor, var(--bg-app));
|
|
color: var(--fg-editor, var(--fg));
|
|
font-family: var(--font-ui);
|
|
font-size: calc(var(--markdown-preview-font-size, 14px) + var(--markdown-font-zoom, 0px));
|
|
line-height: 1.6;
|
|
overflow-wrap: break-word;
|
|
}
|
|
.preview :global(h1),
|
|
.preview :global(h2) {
|
|
padding-bottom: 0.3em;
|
|
border-bottom: 1px solid var(--border-strong);
|
|
}
|
|
.preview :global(h1),
|
|
.preview :global(h2),
|
|
.preview :global(h3),
|
|
.preview :global(h4),
|
|
.preview :global(h5),
|
|
.preview :global(h6) {
|
|
margin: 1.2em 0 0.6em;
|
|
color: var(--fg-editor, var(--fg-strong));
|
|
line-height: 1.25;
|
|
}
|
|
.preview :global(h1) {
|
|
font-size: 1.9em;
|
|
}
|
|
.preview :global(h2) {
|
|
font-size: 1.5em;
|
|
}
|
|
.preview :global(h3) {
|
|
font-size: 1.25em;
|
|
}
|
|
.preview > :global(div:first-child) > :first-child {
|
|
margin-top: 0;
|
|
}
|
|
.preview :global(p),
|
|
.preview :global(ul),
|
|
.preview :global(ol),
|
|
.preview :global(blockquote),
|
|
.preview :global(pre),
|
|
.preview :global(table) {
|
|
margin: 0 0 1em;
|
|
}
|
|
.preview :global(a) {
|
|
color: var(--link);
|
|
text-decoration: none;
|
|
cursor: pointer;
|
|
}
|
|
.preview :global(a:hover) {
|
|
color: var(--link-hover);
|
|
text-decoration: underline;
|
|
}
|
|
.preview :global(code) {
|
|
font-family: var(--font-mono);
|
|
font-size: 0.9em;
|
|
padding: 0.1em 0.35em;
|
|
border-radius: var(--radius-small);
|
|
background: var(--bg-editor-inline, var(--bg-elev));
|
|
}
|
|
.preview :global(pre) {
|
|
padding: 10px 12px;
|
|
border-radius: var(--radius-control);
|
|
background: var(--bg-editor-inline, var(--bg-elev));
|
|
overflow: auto;
|
|
line-height: 1.45;
|
|
}
|
|
.preview :global(pre code) {
|
|
padding: 0;
|
|
background: none;
|
|
font-size: 0.93em;
|
|
}
|
|
.preview :global(blockquote) {
|
|
padding: 0 1em;
|
|
border-left: 3px solid var(--border-strong);
|
|
color: var(--fg-editor, var(--fg-secondary));
|
|
opacity: 0.8;
|
|
}
|
|
.preview :global(table) {
|
|
border-collapse: collapse;
|
|
}
|
|
.preview :global(th),
|
|
.preview :global(td) {
|
|
padding: 4px 10px;
|
|
border: 1px solid var(--border-strong);
|
|
}
|
|
.preview :global(th) {
|
|
background: var(--bg-editor-inline, var(--bg-elev));
|
|
}
|
|
.preview :global(hr) {
|
|
border: none;
|
|
border-top: 1px solid var(--border-strong);
|
|
margin: 1.5em 0;
|
|
}
|
|
.preview :global(img) {
|
|
max-width: 100%;
|
|
}
|
|
.preview :global(ul.contains-task-list) {
|
|
list-style: none;
|
|
padding-left: 1.2em;
|
|
}
|
|
.blocked {
|
|
display: inline-block;
|
|
min-width: 16px;
|
|
min-height: 16px;
|
|
outline: 1px dashed var(--border-strong);
|
|
}
|
|
|
|
/* Mermaid diagrams: the source stays until the diagram is drawn, and next to an error. */
|
|
.preview :global([data-mermaid]) {
|
|
margin: 0 0 1em;
|
|
}
|
|
.preview :global([data-mermaid] > pre) {
|
|
margin: 0;
|
|
}
|
|
.preview :global([data-mermaid-state="ok"] > pre) {
|
|
display: none;
|
|
}
|
|
.preview :global(.mermaid-output) {
|
|
overflow: hidden;
|
|
text-align: center;
|
|
}
|
|
.preview :global(.mermaid-output[data-zoomed="true"]) {
|
|
cursor: grab;
|
|
touch-action: none;
|
|
user-select: none;
|
|
}
|
|
.preview :global(.mermaid-output[data-dragging="true"]) {
|
|
cursor: grabbing;
|
|
}
|
|
.preview :global([data-mermaid-state="error"] > .mermaid-output) {
|
|
margin-top: 6px;
|
|
padding: 6px 10px;
|
|
border-left: 3px solid var(--danger);
|
|
border-radius: var(--radius-small);
|
|
background: var(--bg-elev);
|
|
color: var(--danger);
|
|
font-family: var(--font-mono);
|
|
font-size: var(--fs-code);
|
|
text-align: left;
|
|
white-space: pre-wrap;
|
|
}
|
|
|
|
::highlight(markdown-selection-match) {
|
|
background-color: var(--bg-identifier-under-caret, color-mix(in srgb, var(--fg) 9%, transparent));
|
|
}
|
|
::highlight(markdown-find) {
|
|
background-color: var(--bg-search-match, color-mix(in srgb, var(--warning) 30%, transparent));
|
|
color: var(--fg-search-match, inherit);
|
|
}
|
|
::highlight(markdown-find-current) {
|
|
background-color: var(--bg-search-match-current, color-mix(in srgb, var(--warning) 48%, transparent));
|
|
color: var(--fg-search-match, inherit);
|
|
}
|