yangtongfan
yangtongfan
  • 发布:2021-04-12 19:43
  • 更新:2024-04-17 23:49
  • 阅读:1188

【报Bug】小程序富文本编辑器editor.scrollIntoView 实际测试无法回到光标位置

分类:uni-app

产品分类: uniapp/小程序/微信

PC开发环境操作系统: Mac

PC开发环境操作系统版本号: 10.15.7

HBuilderX类型: 正式

HBuilderX版本号: 3.1.7

第三方开发者工具版本号: 1.05.2103190

基础库版本号: 2.16.0

项目创建方式: HBuilderX

示例代码:

onLoad() {
const platform = uni.getSystemInfoSync().platform
this.isIOS = platform === 'ios'
const that = this
this.updatePosition(0)
let keyboardHeight = 0
uni.onKeyboardHeightChange(res => {
if (res.height === keyboardHeight) return
const duration = res.height > 0 ? res.duration * 1000 : 0
keyboardHeight = res.height
setTimeout(() => {
uni.pageScrollTo({
scrollTop: 0,
success() {
that.updatePosition(keyboardHeight)
that.editorCtx.scrollIntoView()
}
})
}, duration)

})  

},
updatePosition(keyboardHeight) {
const toolbarHeight = 50
const { windowHeight, platform } = uni.getSystemInfoSync()
let editorHeight = keyboardHeight > 0 ? (windowHeight - keyboardHeight - toolbarHeight) : windowHeight
this.editorHeight = editorHeight
this.keyboardHeight = keyboardHeight
},
onEditorReady() {
const that = this
uni.createSelectorQuery().select('#editor').context(function (res) {
that.editorCtx = res.context
}).exec()
},

操作步骤:

按照官网文档提供的原生解决ios上移问题 按照代码方式可复现

预期结果:

预期与官方原生demo一致

实际结果:

无法回退到光标位置

bug描述:

小程序富文本编辑器editor.scrollIntoView 实际测试无法回到光标位置

根据小程序官方提供的解决iso键盘上弹导致的页面上移问题 按照uni-app的方法进行相同改动后 发现编辑器无法回退到光标位置 请查正

2021-04-12 19:43 负责人:无 分享
已邀请:
张西西

张西西 - 123

解决了吗

jimu

jimu

2022都要完了。 这个问题多久可以解决一下呢。

IM柳暗花明

IM柳暗花明

2024此问题,ios依然存在

要回复问题请先登录注册