Uncaught TypeError: this.quill.scroll.query is not a function
See original GitHub issueI’m trying to edit the default keyboard shortcut 'list autofill'
so that it only works based on some condition. Here, though, I’ve just put the default definition of the 'list autofill'
shortcut handler, and it produces the following error:
Uncaught TypeError: this.quill.scroll.query is not a function
at Keyboard.handler (index.js:70)
at bindings.some.binding (keyboard.js:120)
at Array.some (<anonymous>)
at HTMLDivElement.quill.root.addEventListener.evt (keyboard.js:97)
handler @ index.js:70
bindings.some.binding @ keyboard.js:120
quill.root.addEventListener.evt @ keyboard.js:97
The error points to the line below the comment that can be found in the example below. The error does not occur if I comment out that line.
Was not able to provide a codepen because I couldn’t figure out how to access get ahold of the Delta class, which is used here.
import Quill from '~/lib/quill.js'
import Delta from 'quill-delta';
const quill = new Quill(document.querySelector('#note'), {
modules: {
keyboard: {
bindings: {
'list autofill': {
key: ' ',
shiftKey: null,
collapsed: true,
format: {
list: false,
'code-block': false,
blockquote: false,
header: false,
table: false,
},
prefix: /^\s*?(\d+\.|-|\*|\[ ?\]|\[x\])$/,
handler(range, context) {
// this is part of the default handler, but causes an error for some reason:
if (this.quill.scroll.query('list') == null) return true;
const { length } = context.prefix;
const [line, offset] = this.quill.getLine(range.index);
if (offset > length) return true;
let value;
switch (context.prefix.trim()) {
case '[]':
case '[ ]':
value = 'unchecked';
break;
case '[x]':
value = 'checked';
break;
case '-':
case '*':
value = 'bullet';
break;
default:
value = 'ordered';
}
this.quill.insertText(range.index, ' ', Quill.sources.USER);
this.quill.history.cutoff();
const delta = new Delta()
.retain(range.index - offset)
.delete(length + 1)
.retain(line.length() - 2 - offset)
.retain(1, { list: value });
this.quill.updateContents(delta, Quill.sources.USER);
this.quill.history.cutoff();
this.quill.setSelection(range.index - length, Quill.sources.SILENT);
return false;
},
},
},
}
},
theme: 'snow',
})
Platforms:
Chrome 70, macOS 10.13.6, Node.js 11.1.0
Version:
Quill 1.3.6
I apologize for this issue being pretty barebones.
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Quill insertText producing TypeError: n.appendChild is not a ...
I'm extending the text blot and attempting to use the documentation notes from here (copying the divider code) but the output ends up...
Read more >TypeError: getBoundingClientRect is not a function in JS
To solve the "getBoundingClientRect is not a function" error, make sure to only call the getBoundingClientRect method on valid DOM elements and place...
Read more >Keyboard Module - Quill Rich Text Editor
The Keyboard module enables custom behavior for keyboard events in particular contexts. Quill uses this to bind formatting hotkeys and prevent undesirable ...
Read more >Has anyone implemented custom mentions in LWC?
For the first issue, when Quill.getBounds function fails with error Uncaught TypeError: leaf.domNode.getBoundingClientRect is not a function ...
Read more >Error while loading loading map. - Esri Community
Basemap] #load() Failed to load basemap (title: 'Basemap', id: 'gray-vector') TypeError: t is not a constructor Zoom.js:5 Uncaught (in ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Please use StackOverflow for questions and project issues for bugs. Thanks.
have you fix this problem, i meet it too, when i just require core.js.