angular-highlightjs icon indicating copy to clipboard operation
angular-highlightjs copied to clipboard

angular-highlightjs editable with binding

Open GuillaumeUnice opened this issue 8 years ago • 6 comments

Hi every,

I would like to be able to edit content for that I just add property : contentEditable="true"

However, when there is no binding with the $scope so the content update it's not catch in $scope variable...

So it's possible to edit the the text with a data-binding?

Thanks for all

GuillaumeUnice avatar Jun 07 '16 11:06 GuillaumeUnice

Hi @GuillaumeUnice ,

Can you present a simple example of your current progress?

pc035860 avatar Jun 07 '16 13:06 pc035860

Yes of course,

<div hljs hljs-source="explorer.fileContent" contentEditable="true"></div>

Currently I just make that but the variable scope"explorer.fileContent " it's not update when I change the content. Because "hljs-source" it's one-way binding if I understand :D

GuillaumeUnice avatar Jun 07 '16 14:06 GuillaumeUnice

Have you tried UI.CodeMirror? http://angular-ui.github.io/ui-codemirror/

It seems more suitable for you needs?

pc035860 avatar Jun 07 '16 14:06 pc035860

The problem with this module we have to define the language use it's not automatically detect like your module highlightjs.

GuillaumeUnice avatar Jun 07 '16 14:06 GuillaumeUnice

Indeed it didn't work I have test but there is lot of problems like highlight format to be specified.

I think it's possible to change scope with watch in hljs?

GuillaumeUnice avatar Jun 07 '16 14:06 GuillaumeUnice

Maybe with hljs-onhighlight it's possible? I don't understand what make exactly onhighlight If i could have a callback after update that's good too :D

GuillaumeUnice avatar Jun 08 '16 08:06 GuillaumeUnice