pc035860 / angular-highlightjs

AngularJS directive for syntax highlighting with highlight.js
http://pc035860.github.io/angular-highlightjs/example/
MIT License
294 stars 54 forks source link

angular-highlightjs editable with binding #67

Open GuillaumeUnice opened 8 years ago

GuillaumeUnice commented 8 years ago

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

pc035860 commented 8 years ago

Hi @GuillaumeUnice ,

Can you present a simple example of your current progress?

GuillaumeUnice commented 8 years ago

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

pc035860 commented 8 years ago

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

It seems more suitable for you needs?

GuillaumeUnice commented 8 years ago

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

GuillaumeUnice commented 8 years ago

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 commented 8 years ago

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