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

[Bug report]点击画布外的区域没有取消文本编辑状态 #622

Closed
towersxu opened this issue May 22, 2022 · 2 comments
Closed

[Bug report]点击画布外的区域没有取消文本编辑状态 #622

towersxu opened this issue May 22, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@towersxu
Copy link
Collaborator

在一些场景下,在画布外也会存在一个文本输入框,用来输入画布中可编辑的文字。如果在画布文字编辑中状态下,在画布外输入框中输入内容,会出现输入框自动聚焦到画布中的输入框。
临时解决方法:

const isElementInGraph = (element) => {
  let isIn = false
  if (element.className === 'lf-graph') {
    isIn = true
  } else if (element.parentNode) {
    isIn = isElementInGraph(element.parentNode)
  }
  return isIn
}
document.body.addEventListener('click', (ev) => {
    // 如果画布中有正在编辑的元素,且点击不是画布触发
    if (this.lf.graphModel.textEditElement && !isElementInGraph(ev.target)) {
      this.lf.graphModel.textEditElement.setElementState(1)
    }
  })
@boyongjiong boyongjiong added the bug Something isn't working label Aug 8, 2023
@github-actions
Copy link

github-actions bot commented Aug 8, 2023

该 issue 作为 Bug Report 所提供信息的不充分,被暂时关闭了。请修改 issue 以提供最小可复现示例(可以通过以下方式:1. 在任意在线编码平台如 codesanbox 编写示例。将其保存到自己空间,然后贴上链接。2. 在自己 github 中创建一个最简单的示例,然后贴上 github 链接。3. 删除项目中的 node_modules 部分,打包项目,并拖拽到 issue 输入框中上传(或提供远程可下载地址))来重启 issue。

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 8, 2023
@boyongjiong boyongjiong reopened this Aug 8, 2023
@DymoneLewis DymoneLewis self-assigned this Mar 6, 2024
@DymoneLewis
Copy link
Collaborator

2.0版本已解决该问题🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

No branches or pull requests

3 participants