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

Cannot register a BlockBlot #1854

Closed
rick2ricks opened this issue May 16, 2024 · 5 comments
Closed

Cannot register a BlockBlot #1854

rick2ricks opened this issue May 16, 2024 · 5 comments

Comments

@rick2ricks
Copy link

rick2ricks commented May 16, 2024

Hi,

I am not sure if I am missing somthing, but the following shouldn't work?

//This returns unkown:
const Block = Quill.import('blots/block');

class DivBlot extends Block {
  static blotName = 'div';
  static tagName = 'div';
}

Quill.register(DivBlot);

How else should I extend and register a BlockBlot after upgrading to quill@2 and ngx-quill@25.

Thank you.

@KillerCodeMonkey
Copy link
Owner

KillerCodeMonkey commented May 17, 2024 via email

@rick2ricks
Copy link
Author

Thanks for the response, but the problem starts before the register, when trying to extend Block, because Quill.import('blots/block') returns unkown.

Also I could not find any references to extending a Blot or using Quill.register in any examples.

@KillerCodeMonkey
Copy link
Owner

KillerCodeMonkey commented May 17, 2024

just checked the quilljs repo and tried this:

import Block from 'quill/blots/block';

Block.tagName = "DIV";
Quill.register(Block, true);

it is working

Edit: committed it to the demo repo and deployed the new version

@rick2ricks
Copy link
Author

Don't know why I didn't find this import before.

import Block from 'quill/blots/block';"

Thank you.

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

No branches or pull requests

2 participants