React-ace: Proposal. Ace input validation callback

Created on 11 Aug 2017  路  4Comments  路  Source: securingsincity/react-ace

Hi, everyone.

We need small validation in ReactAce. We don't want to allow users submit code event with any kind of warnings. ReactAce show that warnings (like missing semicolon). As I know, there is no standard way to get the results of validation. (Issue #144) Am I right?

If so, I suggest to add a new callback prop onValidate. We can add listener on change annotations and invoke that callback. For example:

editor.getSession().on('changeAnnotation', function() {
  const annotations = editor.getSession().getAnnotations();
  onValidate(annotations);
});

If that functionality make sense, I could work on PR. What do you think?

enhancement

Most helpful comment

This will be live in 5.2.0 which is going live now.

All 4 comments

@tsmirnov I think that sounds good. I would like to see a PR.

This will be live in 5.2.0 which is going live now.

Any documentation for this? I don't want to allow the user to submit if there are errors. @securingsincity

Was able to find it, I added a ref then this.editorRef.current.editor.session.$annotations was the path towards it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

levi0913 picture levi0913  路  7Comments

avalkowsky picture avalkowsky  路  6Comments

BenBrewerBowman picture BenBrewerBowman  路  5Comments

Yuanye picture Yuanye  路  7Comments

anderoonies picture anderoonies  路  5Comments