ajaxorg / ace

Ace (Ajax.org Cloud9 Editor)
https://ace.c9.io
Other
26.78k stars 5.29k forks source link

ace.require("ace/ext/themelist"); in angular12 gets only an undefined value! #4741

Closed myonara closed 1 year ago

myonara commented 3 years ago

ace.require("ace/ext/themelist"); in angular12 gets only an undefined value!

How to recreate and play with the issue:

git clone https://github.com/myonara/test-ace-primeng npm install ng serve open browser at http:/localhost:4200 open development tools => console press tiny button in the left top corner see the error with undefined reference the bug is fixed, when the drop down shows the list of themes!

Versions checked:

angular 12.2.1 primeng 12-1-0-rc.1 ace-build 1.4.12

code snippet:

    ace.config.set('basePath', 'https://unpkg.com/ace-builds@1.4.12/src-noconflict');
    ace.config.set("fontSize", "14px");
    if (typeof this.aceEditor === 'undefined' && typeof this.editor !== 'undefined') {
      this.aceEditor = ace.edit(this.editor.nativeElement);
    } else {
      return;
    }
    this.aceEditor.setAutoScrollEditorIntoView(true);
    this.aceEditor.setTheme('ace/theme/twilight');
    this.aceSession = new ace.EditSession(this._text);
    this.aceSession.setMode('ace/mode/text');
    this.aceEditor.setSession(this.aceSession);
    var themelist = ace.require("ace/ext/themelist"); // delivers undefined!!! <<<<<<<<<<<<<<<<<<<<<<<<<<<
    console.log("themelist",themelist);
    this.themes = [];
    var themeOb :any = themelist.themesByName // error reference undefined
    themeOb.keys().forEach((themeName: any) => {
      this.themes.push({name:themeName,code:themeName});
    })
github-actions[bot] commented 1 year ago

This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.