Skip to content
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

Ace editor options creates an exception #24

Open
Jiehong opened this issue Nov 29, 2018 · 4 comments
Open

Ace editor options creates an exception #24

Jiehong opened this issue Nov 29, 2018 · 4 comments
Labels
help wanted Extra attention is needed

Comments

@Jiehong
Copy link

Jiehong commented Nov 29, 2018

Hi,

I've been trying to use the example to alter the Ace Editor options with the following:

  ngAfterViewInit(): void {
    const aceEditor = (<any>window).ace.edit(document.querySelector('#a' + this.editor.id + '>div'));
    // custom your ace here
    aceEditor.setReadOnly(true);
    aceEditor.setFontSize('110pt');
    this.options.ace = aceEditor;
    this.editor.setOptions(this.options);
  }

However, when this is evaluated, I get the following error:

TypeError: undefined is not a function (evaluating '_ace.edit(this.editorDom)') (line 187) (so edit is not a defined function here it seems).

At first I thought it was because ngAfterViewInit would evaluate too early, so I tried with using a button to manually trigger this, but I get the same error.

This has been tested with:

"ang-jsoneditor": "1.6.1",
"jsoneditor": "5.19.2",
"@angular/xx": "6.1.1"

I suppose you could easily reproduce by calling the setAce function in the unit-test of https://github.com/mariohmol/ang-jsoneditor/blob/master/src/app/demo/demo.component.ts.

@mariohmol
Copy link
Owner

I think u have to include ace.. no?

<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.6/ace.js"></script>

@Jiehong
Copy link
Author

Jiehong commented Nov 29, 2018

ah, I didn't see this bit. I'd have expected it to be included in jsoneditor directly.

Let me try :D

@Jiehong
Copy link
Author

Jiehong commented Nov 29, 2018

Well, doesn't seem to work better, actually.

@mariohmol
Copy link
Owner

To be honest i could never get fully how this ace works with jsoneditor and how to customize this..

if you could help out..

@mariohmol mariohmol added the help wanted Extra attention is needed label Jan 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants