-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Integrate editor at https://github.com/naseer/mermaid-webapp #110
Comments
@naseer, you should take a look at the new api for validating text. I had this kind of editor in mind when writing it. Error handling When the parser encounters invalid syntax the mermaid.parseError function is called. It is possible to override this function in order to handle the error in an application specific way. Parsing text without rendering It is also possible to validate the syntax before rendering in order to streamline the user experience. The function mermaid.parse(txt) takes a text string as an argument and returns true if the text is syntactically correct and false if it is not. The parseError function will be called when the parse function returns false. The code-example below in meta code illustrates how this could work: mermaid.parseError = function(err,hash){
displayErrorInGui(err);
};
var textFieldUpdated = function(){
var textStr = getTextFromFormField('code');
if(mermaid.parse(textStr)){
reRender(textStr)
}
};
bindEventHandler('change', 'code', textFieldUpdated); |
Thanks @knsv, this will help a lot and avoid the need for mermaid.init all the time |
@knsv - is there something to re-render without calling mermaid.init ? |
No I think mermaid.init is the way to go! |
@knsv - can this be closed now? |
Yes! Closing! Thanks! |
Creating to address the discussion at #106 to integrate the editor at https://github.com/naseer/mermaid-webapp
The text was updated successfully, but these errors were encountered: