Anubha Gupta
Anubha Gupta

Reputation: 189

How to write custom mode in ace editor?

I am working with Angular 1.7. I have ace-editor in my node_modules folder. Now I want to create custom mode in ace editor. Is it possible that I create a separate javascript file as mode-custom.js and add the code in that and then I imported that mode file in my application?

Upvotes: 2

Views: 2999

Answers (1)

YellowAfterlife
YellowAfterlife

Reputation: 3192

You can use define or ace.define (depending on whether you are using noconflict version or not) to define a mode at ace/mode/<name> path, and Ace will pick it up when the mode ID for the editor is set to that. See here for a relatively clean example.

Upvotes: 1

Related Questions