mirror of
https://github.com/tulir/gomuks.git
synced 2025-04-20 10:33:41 -05:00
web/jsonview: fix extra newlines when copying json
This commit is contained in:
parent
219f92c222
commit
8ca664c745
3 changed files with 12 additions and 5 deletions
|
@ -153,7 +153,7 @@ input, textarea {
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
button, a.button {
|
button, a.button, span.button {
|
||||||
cursor: var(--clickable-cursor);
|
cursor: var(--clickable-cursor);
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
background: none;
|
background: none;
|
||||||
|
|
|
@ -15,9 +15,13 @@ pre.json-view {
|
||||||
user-select: none;
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
button {
|
span.button {
|
||||||
padding: 0 .25rem;
|
padding: 0 .25rem;
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
content: attr(data-symbol);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the screen is wide enough, make line-wrapped strings aligned after the object key */
|
/* If the screen is wide enough, make line-wrapped strings aligned after the object key */
|
||||||
|
|
|
@ -82,9 +82,12 @@ function JSONValueWithKey({ data, objectKey, trailingComma, noCollapse }: JSONVi
|
||||||
? <span className="json-object-comma p">,</span>
|
? <span className="json-object-comma p">,</span>
|
||||||
: null
|
: null
|
||||||
const collapseButton = noCollapse ? null :
|
const collapseButton = noCollapse ? null :
|
||||||
<button onClick={toggleCollapsed} title={collapsed ? "Expand" : "Collapse"}>
|
<span
|
||||||
{collapsed ? "+" : "-"}
|
className="button"
|
||||||
</button>
|
data-symbol={collapsed ? "+" : "-"}
|
||||||
|
onClick={toggleCollapsed}
|
||||||
|
title={collapsed ? "Expand" : "Collapse"}
|
||||||
|
/>
|
||||||
if (Array.isArray(data)) {
|
if (Array.isArray(data)) {
|
||||||
return <>
|
return <>
|
||||||
{renderedKey}
|
{renderedKey}
|
||||||
|
|
Loading…
Add table
Reference in a new issue