diff --git a/examples/sites/src/App.vue b/examples/sites/src/App.vue index 38383728e..efc20b12d 100644 --- a/examples/sites/src/App.vue +++ b/examples/sites/src/App.vue @@ -136,6 +136,7 @@ const handleShowTinyRobot = () => { padding: 34px 0 0; } } + .right-panel:not(.collapsed) { :deep(.tr-container) { z-index: 9999; diff --git a/packages/renderless/src/input/index.ts b/packages/renderless/src/input/index.ts index 33a33c8a2..af9d5bc9f 100644 --- a/packages/renderless/src/input/index.ts +++ b/packages/renderless/src/input/index.ts @@ -124,7 +124,9 @@ export const calcTextareaHeight = const { paddingSize, borderSize, boxSizing, contextStyle } = api.calculateNodeStyling(targetElement) hiddenTextarea.setAttribute('style', `${contextStyle};${HIDDEN_STYLE}`) - hiddenTextarea.value = targetElement.value || targetElement.placeholder || '' + // 多行placeholder只计算单行高度防止撑高scrollHeight + const safePlaceholder = targetElement.placeholder ? targetElement.placeholder.trim().split('\n')[0] : '' + hiddenTextarea.value = targetElement.value || safePlaceholder || '' let height = hiddenTextarea.scrollHeight const textareaStyle: { @@ -161,11 +163,7 @@ export const calcTextareaHeight = minHeight = props.height } if (!state.isDisplayOnly) { - if (props.autosize) { - height = Math.max(minHeight, height) - } else { - height = Math.min(minHeight, height) - } + height = Math.max(minHeight, height) textareaStyle.minHeight = `${Math.floor(minHeight)}px` } else { textareaStyle.minHeight = `0px`