Skip to content

Instantly share code, notes, and snippets.

@saw
Last active December 6, 2018 09:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saw/1d4d76ec49c5ae0649d0063fca57c908 to your computer and use it in GitHub Desktop.
Save saw/1d4d76ec49c5ae0649d0063fca57c908 to your computer and use it in GitHub Desktop.
Blots to fix the IME issue
import Quill from 'quill';
let Text = Quill.import('blots/text');
class TextBlot extends Text {
static create(value) {
if (!value) {
value = '\u200B';
}
return document.createTextNode(value);
}
}
let Block = Quill.import('blots/block');
Block.defaultChild = 'text';
Quill.register('blots/text', Text);
Quill.register('blots/block', Block);
@xbinxu
Copy link

xbinxu commented May 16, 2017

Line 16 should be: Quill.register('blots/text', TextBlot);

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