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

Easy-mde doesn't work well with inputStyle: 'contenteditable' #160

Closed
A-312 opened this issue Mar 2, 2020 · 2 comments · Fixed by #173
Closed

Easy-mde doesn't work well with inputStyle: 'contenteditable' #160

A-312 opened this issue Mar 2, 2020 · 2 comments · Fixed by #173
Labels

Comments

@A-312
Copy link

A-312 commented Mar 2, 2020

#143 Introduce inputStyle: 'contenteditable'

I experienced some weird bugs with easy-mde (getCursor and setCursor didn't work fine). I have figured out why: inputStyle: 'contenteditable' doesn't work as well than inputStyle: 'textarea'. https://discuss.codemirror.net/t/is-the-textarea-inputstyle-going-to-be-deprecated-in-the-future/1278

Work well with inputStyle: 'textarea'

image2 1

Don't work well with inputStyle: 'contenteditable'

image2 2

(don't work well because the mouse go on the begining after a click)

@mxgl
Copy link

mxgl commented Mar 6, 2020

I may be wrong here, but I've dealt with a similar issue trying to get zurb/tribute integrated with easyMDE.

It seems when anything not native to codemirror occurs, the cursor location isn't preserved.

I've had to do a getCursor, then do my action, followed by a setCursor. This has worked well enough, but is not perfect.

the issue is more with CodeMirror's cursor positioning in contenteditables.

@A-312
Copy link
Author

A-312 commented Mar 8, 2020

I made a fix on codemirror codemirror/codemirror5#6168 but I think we have to set options.forceFocus to true like this:

editor.setSelection({line:0, ch:2}, {line:0, ch:5}, {forceFocus:true}).

A-312 added a commit to A-312/easy-markdown-editor that referenced this issue Mar 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants