Skip to content

Commit

Permalink
fix: hoverbar misalignment when scroll is set to false
Browse files Browse the repository at this point in the history
  • Loading branch information
cycleccc committed Jul 21, 2024
1 parent d0ed194 commit 7761c86
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
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

0 comments on commit 7761c86

Please sign in to comment.