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

External highlighter and omit initial callbacks #110

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

wellenvogel
Copy link

I'm trying to use codeflask in my avnav project.
There were 2 drawbacks:

  1. when using the editor initially it always calls the update callback. This makes it slightly complicated to find out if there really was a change. So I introduced a parameter on updateCode and an option "noInitialCallback" to prevent those calls if you intend
  2. I found no easy way to add more languages to prism in a webpack/ES6 environment. I ended up with importing prism by my own again and adding the language to codeflask from the prism instance. But this way we end up having 2 instances of prism - not very nice - and giving some error on startup.
    So I introduced an option for the highlighter function: highLighter. If you omit it, there is no highlighter at all. This way I could completely remove prism (of I guess it is needed for test - I was not really able to run them).
    The initial call looks like
    var editor=new Flask('editor',{ language:'js', highLighter:Prism.highlightElement, noInitialCallback:true}

Maybe you would be interested in considering this PR - or some similar solution.

Best regards
Andreas

@kazzkiq
Copy link
Owner

kazzkiq commented Jun 4, 2020

This is an interesting feature, but would lead to breaks in current API and thus should be released in the next Major version.

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

Successfully merging this pull request may close these issues.

None yet

2 participants