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

能否提供输入联想短语/关键字提醒插件? #4

Open
gmfu opened this issue Nov 7, 2023 · 1 comment
Open

能否提供输入联想短语/关键字提醒插件? #4

gmfu opened this issue Nov 7, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@gmfu
Copy link

gmfu commented Nov 7, 2023

效果图如下:

image image image
@Hufe921
Copy link
Owner

Hufe921 commented Nov 8, 2023

等待官方实现时间较长,且业务无法定制,可通过编辑器提供的api,自行扩展

instance.eventBus.on('contentChange', () => {
    const rangeContext = instance.command.getRangeContext()
    // 光标闭合
    if (rangeContext?.isCollapsed) {
      // 特殊符号
      if (rangeContext.startElement.value === '@') {
        // 弹出框显示
        const [{ x, y, height }] = rangeContext.rangeRects
        console.log('x, y, height: ', x, y, height)
      }
    }
  })

@Hufe921 Hufe921 added the enhancement New feature or request label Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants