selection
getBounds
getBounds(index: Number, length: Number = 0):
{ left: Number, top: Number, height: Number, width: Number }quill.setText('Hello\nWorld\n');
quill.getBounds(7); // 返回值 { height: 15, width: 0, left: 27, top: 31 }getSelection
getSelection(focus = false): { index: Number, length: Number }var range = quill.getSelection();
if (range) {
if (range.length == 0) {
console.log('User cursor is at index', range.index);
} else {
var text = quill.getText(range.index, range.length);
console.log('User has highlighted: ', text);
}
} else {
console.log('User cursor is not in editor');
}setSelection
Last updated