Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 配置scroll: false时,容器height: 100%不生效,样式设置,避免悬浮框位置出现错位问题 #5098

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/core/src/assets/textarea.less
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
height: 100%;
}

.no-scroll{
position: absolute;
width: 100%;
}

.w-e-text-container .w-e-scroll {
height: 100%;
// overflow-y: auto; // 在 js 中设置,根据 config 判断是否增加 scroll
Expand Down
7 changes: 6 additions & 1 deletion packages/core/src/text-area/TextArea.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,15 @@ class TextArea {
editor.on('change', this.changeViewState.bind(this))

// editor onchange 时触发用户配置的 onChange (需要在 changeViewState 后执行)
const { onChange } = editor.getConfig()
const { onChange, scroll } = editor.getConfig()
if (onChange) {
editor.on('change', () => onChange(editor))
}
// scroll: false时,容器height: 100%不生效,样式设置,避免悬浮框位置出现错位问题
if (!scroll) {
$box.css('position', 'relative')
$container.addClass('no-scroll')
}

// 监听 onfocus onblur
this.onFocusAndOnBlur()
Expand Down