Markdown: link editor and preview block by block in split view
Editing a block highlights its rendered copy in the preview for a moment (and scrolls it into view); clicking a block in the preview puts the cursor at its source and briefly marks that source behind the editor. Top-level blocks and list items each map to their own source range. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
080fb451a6
commit
c652ca456b
2 changed files with 179 additions and 6 deletions
|
|
@ -183,8 +183,17 @@ textarea { tab-size: 4; }
|
|||
.json-workspace[data-mode='tree'] .json-text-pane { display: none; }
|
||||
|
||||
/* markdown */
|
||||
.md-edit-pane { display: flex; overflow: hidden; }
|
||||
.md-input { flex: 1; width: 100%; padding: 16px 18px; border: 0; outline: none; resize: none; background: var(--surface); line-height: 1.6; }
|
||||
.md-edit-pane { display: flex; overflow: hidden; position: relative; background: var(--surface); }
|
||||
.md-input { position: relative; flex: 1; width: 100%; padding: 16px 18px; border: 0; outline: none; resize: none; background: transparent; line-height: 1.6; }
|
||||
/* the clicked preview block's source, drawn behind the transparent editor */
|
||||
.md-backdrop { position: absolute; box-sizing: border-box; overflow: hidden; white-space: pre-wrap; overflow-wrap: break-word; color: transparent; pointer-events: none; }
|
||||
.md-backdrop mark { color: transparent; background: transparent; border-radius: 3px; transition: background-color 0.6s; }
|
||||
.md-backdrop mark.on { background: var(--sel); transition: none; }
|
||||
/* the block being edited, in the preview */
|
||||
.md-preview [data-md-unit] { border-radius: 4px; transition: background-color 0.6s, box-shadow 0.6s; }
|
||||
.md-preview .md-active { background-color: var(--accent-soft); box-shadow: 0 0 0 4px var(--accent-soft); transition: none; }
|
||||
.md-workspace[data-mode='split'] .md-preview [data-md-unit] { cursor: text; }
|
||||
.md-workspace[data-mode='split'] .md-preview :is(a, input, summary) { cursor: pointer; }
|
||||
.md-workspace[data-mode='edit'] .md-input { max-width: 900px; margin: 0 auto; }
|
||||
.md-preview { padding: 16px 24px 48px; }
|
||||
.md-workspace[data-mode='preview'] .md-preview { max-width: 820px; margin: 0 auto; padding: 32px 32px 80px; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue