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]每一次调用setMarkdown或者setValue,光标都被重置到最前面了,对于封装成v-model形式的vue组件非常不友好 #70

Closed
StrongerLph opened this issue Dec 23, 2021 · 7 comments · Fixed by #106
Labels
enhancement New feature or request

Comments

@StrongerLph
Copy link

Describe the bug
每一次调用setMarkdown或者setValue,光标都被重置到最前面了,对于封装成v-model形式的vue组件非常不友好
image

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • OS: [e.g. Windows/macOS]
  • Browser [e.g. Chrome, Safari]
  • Version [e.g. 0.5.14]

Additional context
Add any other context about the problem here.

@sunsonliu
Copy link
Collaborator

有道理,我们给setMarkdown和setValue增加第二个参数吧,autoRestoreCursor = true 会尝试保持之前的光标位置。
这里逻辑比较复杂,尤其是在光标之前变动内容的时候,盲目按照偏移量恢复光标不符合预期,比如原始内容是 ABC光标DEF,当内容变成AABCDEF的时候,光标会出现在AAB光标CDEF,这是不符合预期的,所以需要对setValue前后的内容进行一次diff,然后计算出光标变更偏移量,最终实现光标出现在AABC光标DEF,这块有些开发工作量,我们排期搞下哈

@power721
Copy link

vue组件多次创建Cherry实例怎么办?
Cherry没有destroy()方法

@sunsonliu
Copy link
Collaborator

vue组件多次创建Cherry实例怎么办? Cherry没有destroy()方法

我新建了一个issue #140 来跟进没有destory的问题哈

@sunsonliu
Copy link
Collaborator

@SKHon
Copy link

SKHon commented Nov 15, 2023

@sunsonliu 如何destroy啊?有办法吗

@sunsonliu
Copy link
Collaborator

@sunsonliu 如何destroy啊?有办法吗

还没实现这个api,如果急用,可以先 cherry.wrapperDom.remove();。。。

@gspgsp
Copy link

gspgsp commented Nov 25, 2023

@sunsonliu 还没实现这个api,如果急用,可以先 cherry.wrapperDom.remove();。。。

这个确实有用,我是在nuxt下使用的,希望有个destroy方法

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

Successfully merging a pull request may close this issue.

5 participants