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

Highlight with two-way binding #46

Closed
aaron-bond opened this issue Aug 30, 2018 · 1 comment
Closed

Highlight with two-way binding #46

aaron-bond opened this issue Aug 30, 2018 · 1 comment

Comments

@aaron-bond
Copy link

aaron-bond commented Aug 30, 2018

Bug Report or Feature Request (mark with an x)

- [ ] bug report -> please search issues before submitting
- [ ] feature request
- [ x ] question

OS and Version?

Windows 10

Versions

Angular 6.0.0

Desired functionality

Is there any approach to two-way binding for the editors that works consistently? So far, I've implemented a content editable directive to get me part of the way, but having lots of trouble with carriage returns.

Has anyone had any luck doing the same?

Here's a stackblitz link to show how I have it working currently: https://stackblitz.com/edit/ngx-highlightjs-kjqjwf

EDIT: as it stands, I think I have this pretty close. I can write into the field and it'll update the content on the model. I still have some issues though.

On the directive, this function runs when I hit Enter after a space (seems intermittent): highlightTextContent(). When that runs, I find that the cursor jumps back to the top of the editable area (because the content has all totally changed). It's possible I could hook into this function (maybe) and reset the cursor after the redraw, but might need a bit of help getting the right properties exposed....

@MurhafSousli
Copy link
Owner

MurhafSousli commented Aug 30, 2018

I am not sure what you are trying to accomplish! you cannot make a code editor with this plugin. you should use or embed a code editor plugin instead.
However this is a fixed version stackblitz

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