zefoy / ngx-ace-wrapper

Angular wrapper library for Ace
MIT License
47 stars 16 forks source link

Creating custom modes #21

Open Ynhockey opened 4 years ago

Ynhockey commented 4 years ago

Hi, I have created a new mode for later customization, something like this (highlight rules also present):

ace.define('ace/mode/custom', ['require', 'exports', 'ace/lib/oop', 'ace/mode/text', 'ace/mode/custom_highlight_rules'], (acequire, exports) => {
    const oop = acequire('ace/lib/oop');
    const TextMode = acequire('ace/mode/text').Mode;
    const CustomHighlightRules = acequire('ace/mode/custom_highlight_rules').CustomHighlightRules;

    oop.inherits(Mode, TextMode);

    exports.Mode = Mode;
});

I have imported the custom mode file (it's not in the same dir as the other ones, which are under node_modules), and set Ace's mode to 'custom'. Unfortunately it doesn't work, and looks for the mode file somewhere else (in the project root, dist/mode-custom.js).

What is the correct way to use custom modes in the NGX wrapper?

Thanks!

tobiasschuerg commented 1 year ago

@Ynhockey did you find out how to do it?