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

Access Quill API when using the editor #522

Closed
gatapia opened this issue Jun 28, 2016 · 7 comments
Closed

Access Quill API when using the editor #522

gatapia opened this issue Jun 28, 2016 · 7 comments
Assignees
Labels
Type: New Feature Issue contains a new feature or new component request
Milestone

Comments

@gatapia
Copy link
Contributor

gatapia commented Jun 28, 2016

It would be great if we could access the Quill api when using the Editor. This would allow adding custom commands to the quill toolbar (and other good things).

Perhaps a simple (oninit) event listener that gets the Quill instance?

@cagataycivici
Copy link
Member

I see but you can already customize toolbar;

<p-editor [(ngModel)]="text2" [style]="{'height':'320px'}">
        <header>
            <span class="ql-formats">
                <button class="ql-bold"></button>
                <button class="ql-italic"></button>
                <button class="ql-underline"></button>
            </span>
        </header>
    </p-editor>

@gatapia
Copy link
Contributor Author

gatapia commented Jun 28, 2016

It is very hard to customise the toolbar with the version of Quill being used. For instance; it is very hard to add the bullets (ql-list) button. As it uses SVG to render itself making for a very ugly template.

So if I wanted to keep the current toolbar + a save button the template would be huge. So I figured API access would be easier.

@krojew
Copy link

krojew commented Nov 9, 2016

Having access to the editor would be a nice addition. I would like to call its API, but now it's impossible.

@vg33
Copy link

vg33 commented Mar 25, 2017

It is possible to get a reference to the Editor component using @ViewChild and then access the quill property. For example:

private quill:any;

@ViewChild(Editor) editorComponent: Editor;

ngAfterViewInit() {
   this.quill = editorComponent.quill;
}

@cagataycivici cagataycivici changed the title [Enhancement] Access Quill API when using the editor Access Quill API when using the editor May 27, 2017
@cagataycivici
Copy link
Member

Added onInit that passes the quill instance and also getQuill method.

@cagataycivici cagataycivici self-assigned this May 27, 2017
@cagataycivici cagataycivici added the Type: New Feature Issue contains a new feature or new component request label May 27, 2017
@cagataycivici cagataycivici added this to the 4.0.2 milestone May 27, 2017
@JairDiaz23
Copy link

Has someone try to add the formula format when creating the editor with a custom toolbar?

@Klinton90
Copy link

@gatapia could you please give an example how do you register e.g. custom formats? Issue for me is that editor is already created at moment when onInit is called, so I calls to Quill.register() are ignored at this point... Is there any other way to update Quill context after it is created? As far as I can see, formats are stored on internal pearchment object, which we do not have access to...

atretyak1985 pushed a commit to Nanitor/primeng that referenced this issue Jul 18, 2020
Technical Policy Change Report - minor fixes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: New Feature Issue contains a new feature or new component request
Projects
None yet
Development

No branches or pull requests

6 participants