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

Get editor upon component init #104

Open
crlsmsq opened this issue Jun 2, 2022 · 1 comment
Open

Get editor upon component init #104

crlsmsq opened this issue Jun 2, 2022 · 1 comment
Assignees

Comments

@crlsmsq
Copy link

crlsmsq commented Jun 2, 2022

Hi I would like to get the editor upon initialization. is there any way i could do this?

@jpakulski
Copy link

You can try the following.

In your template:

<jodit-editor #editor></jodit-editor>

in your component:

import { Component, OnInit, ViewChild } from '@angular/core';
import { JoditAngularComponent } from 'jodit-angular';

@Component({
  selector: 'app-foo',
  templateUrl: './foo.component.html',
  styleUrls: ['./foo.component.scss']
})
export class FooComponent implements OnInit {
  @ViewChild('editor', { static: true }) editor: JoditAngularComponent;

  ngOnInit(): void {
    this.editor.value = 'Hello from foo.';
  }
}

An editor loaded event with the editor as a param to the callback would be awesome, but I don't think it's implemented :(

Cheers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants