ace-diff/ace-diff

How do I use public API for the AceInstance?

ajinkyasurya opened this issue · 1 comments

Hi,
I am kind of new to javascript.
I created a new acediff element with

this.aceDiffer = new AceDiff({
      element: '.acediff',
      left: {
        content: this.originalYaml,
        editable: false
      },
      right: {
        content: this.applicationYaml,
        copyLinkEnabled: false
      },
    });

Say I want to get content in right panel, how do I get it?

console.log('Right content: ' + JSON.stringify(this.aceDiffer.getEditors().right.content));

gives undefined.

Hey, the object that's exposed from this.aceDiffer.getEditors().right is an actual ACE Editor instance. To get its value use getValue():

- console.log('Right content: ' + JSON.stringify(this.aceDiffer.getEditors().right.content));
+ console.log('Right content: ' + JSON.stringify(this.aceDiffer.getEditors().right.getValue()));