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

Use CodeMirror for the text compose area #3

Open
yuvipanda opened this issue Jul 21, 2013 · 4 comments
Open

Use CodeMirror for the text compose area #3

yuvipanda opened this issue Jul 21, 2013 · 4 comments

Comments

@yuvipanda
Copy link
Contributor

Would give us better tab handling (#2) and also optional markdown syntax highlighting.

@AlexTatiyants
Copy link
Owner

I considered using a WISYWIG editor, but chose against it because a custom implementation gave me the most flexibility to a handle a couple of tough edge cases.

@yuvipanda
Copy link
Contributor Author

CodeMirror not only would give us markdown syntax handling, it would also give us an optional vim mode. And it's purely a text editor, and not anywhere close to a WISYWIG. It might be harder to do the image drag and drop though :(

Can you tell me which edge cases using contentEditable handles?

@AlexTatiyants
Copy link
Owner

I ran into a complication with using contentEditable. I originally created a simple Angular directive to both annotate the control as being editable as well as publish an event in response to an edit (that directive is editable-text.js). I wanted this directive to be generic because I'm actually using it in a number of places.

This directive uses the inner text of the element for both rendering and reading the control. This works fine but only if you don't have and html formatting in the text control. However, for the main editor there is a lot of html formatting added by the browser. So I wrote another custom directive (editable-markdown.js), which uses html instead of inner text for rendering and reading, but also saves off the innerText property.

So, if CodeMirror could be integrated with this directive, that would be ideal. Otherwise, we'd need to figure out how to get the same behavior into it.

@yuvipanda
Copy link
Contributor Author

https://github.com/angular-ui/ui-codemirror should work nicely too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants