Skip to content

Commit 2956fa5

Browse files
committed
Scope Cmd+A selection to CSS output pane in WASM demo
1 parent cd61b9e commit 2956fa5

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

wasm-demo/index.html

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
.editor-wrap pre{z-index:1;pointer-events:none;background:transparent;color:var(--text)}
6464

6565
/* CSS output (read-only, no overlay needed) */
66-
.css-wrap{flex:1;min-height:0;overflow:auto;padding:12px;font-family:var(--mono);font-size:12px;line-height:1.6;white-space:pre;word-wrap:normal;color:var(--text)}
66+
.css-wrap{flex:1;min-height:0;overflow:auto;padding:12px;font-family:var(--mono);font-size:12px;line-height:1.6;white-space:pre;word-wrap:normal;color:var(--text);user-select:text}
6767

6868
/* Syntax highlighting colors */
6969
.hl-punct{color:#6272a4}
@@ -111,7 +111,7 @@ <h1>Tailwind <span>Compiler</span> &mdash; WASM Playground</h1>
111111
</div>
112112
<div class="panel">
113113
<div class="panel-header"><span>Generated CSS <span class="panel-stats" id="css-stats"></span></span><button class="expand-btn" title="Expand"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="15 3 21 3 21 9"/><polyline points="9 21 3 21 3 15"/><line x1="21" y1="3" x2="14" y2="10"/><line x1="3" y1="21" x2="10" y2="14"/></svg></button></div>
114-
<div class="css-wrap"><code id="css-output"></code></div>
114+
<div class="css-wrap" tabindex="0"><code id="css-output"></code></div>
115115
</div>
116116
<div class="panel">
117117
<div class="panel-header"><span>Preview</span><button class="expand-btn" title="Expand"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="15 3 21 3 21 9"/><polyline points="9 21 3 21 3 15"/><line x1="21" y1="3" x2="14" y2="10"/><line x1="3" y1="21" x2="10" y2="14"/></svg></button></div>
@@ -666,6 +666,18 @@ <h2 class="text-lg font-semibold text-base-content mb-4">Color Palette</h2>
666666
pre.scrollLeft = htmlInput.scrollLeft;
667667
});
668668

669+
// Scope Cmd+A / Ctrl+A to the CSS pane when it's focused
670+
cssWrap.addEventListener('keydown', (e) => {
671+
if ((e.metaKey || e.ctrlKey) && e.key === 'a') {
672+
e.preventDefault();
673+
const range = document.createRange();
674+
range.selectNodeContents(cssWrap);
675+
const sel = window.getSelection();
676+
sel.removeAllRanges();
677+
sel.addRange(range);
678+
}
679+
});
680+
669681
preflightCb.addEventListener('change', doCompile);
670682
minifyCb.addEventListener('change', doCompile);
671683

0 commit comments

Comments
 (0)