Skip to content

Commit 406e510

Browse files
committed
еще разок
1 parent 146dd07 commit 406e510

2 files changed

Lines changed: 27 additions & 32 deletions

File tree

src/components/fps/dataentry/input/input.module.css

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -331,29 +331,25 @@ a.checkbox_clearOption {
331331
opacity: 1;
332332
}
333333
.input_wrapper .json_toolbar {
334-
position: absolute;
335-
top: 6px;
336-
right: 6px;
337334
display: flex;
338-
gap: 2px;
339-
opacity: 0;
340-
transition: opacity 0.2s;
341-
}
342-
.input_wrapper .field_wrapper:hover .json_toolbar {
343-
opacity: 1;
335+
gap: 4px;
336+
padding: 4px 0 0 0;
337+
justify-content: flex-end;
344338
}
345339
.input_wrapper .json_toolbar_btn {
346340
cursor: pointer;
347-
opacity: 0.4;
348-
padding: 4px;
341+
opacity: 0.35;
342+
padding: 4px 6px;
349343
border-radius: var(--border-radius);
350-
font-size: var(--text-very-small-size);
351344
line-height: 1;
352345
user-select: none;
353346
transition: opacity 0.15s;
354347
}
348+
.input_wrapper .json_toolbar_btn:before {
349+
font-size: 20px;
350+
}
355351
.input_wrapper .json_toolbar_btn:hover {
356-
opacity: 0.9;
352+
opacity: 0.85;
357353
}
358354
:global .react-tooltip {
359355
z-index: 1000;

src/components/fps/dataentry/input/jsonInput.js

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ export default function JsonInput({
1919
const isFocused = useRef(false)
2020
const prevDefaultValue = useRef(defaultValue)
2121

22-
// --- Автовысота через scrollHeight ---
22+
// height: auto !important в CSS перебивает inline height, поэтому используем min-height
2323
const adjustHeight = useCallback(() => {
2424
const el = textareaRef.current
2525
if (!el || rows !== 'auto') return
26-
el.style.height = 'auto'
27-
el.style.height = el.scrollHeight + 'px'
26+
el.style.minHeight = '0'
27+
el.style.minHeight = el.scrollHeight + 'px'
2828
}, [rows])
2929

3030
useEffect(() => {
@@ -219,26 +219,25 @@ export default function JsonInput({
219219
value={value}
220220
placeholder={placeholder || ''}
221221
/>
222-
<div className={styles.json_toolbar}>
223-
{value && !disabled && !copy &&
224-
<div
225-
className={`${styles.json_toolbar_btn} icon icon-close`}
226-
title="Clear"
227-
onClick={handleClear}
228-
/>}
229-
{value && copy &&
230-
<div
231-
className={`${styles.json_toolbar_btn} icon icon-copy`}
232-
title="Copy"
233-
onClick={handleCopy}
234-
/>}
235-
{value && !disabled &&
222+
{value && !disabled &&
223+
<div className={styles.json_toolbar}>
236224
<div
237225
className={`${styles.json_toolbar_btn} icon icon-code`}
238226
title="Format JSON"
239227
onClick={handleFormat}
240-
/>}
241-
</div>
228+
/>
229+
{copy &&
230+
<div
231+
className={`${styles.json_toolbar_btn} icon icon-copy`}
232+
title="Copy"
233+
onClick={handleCopy}
234+
/>}
235+
<div
236+
className={`${styles.json_toolbar_btn} icon icon-close`}
237+
title="Clear"
238+
onClick={handleClear}
239+
/>
240+
</div>}
242241
{warningMsg.msg &&
243242
<div className={`${styles.status} ${styles[warningMsg.type]}`}>{warningMsg.msg}</div>}
244243
</div>

0 commit comments

Comments
 (0)