You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Steps to reproduce: add mention or emoji.
The cursor should be placed right after the inserted mention/emoji, but unfortunately it is placed far from it. I suspect it has to do with Quill not counting characters in the same manner composer does.
The text was updated successfully, but these errors were encountered:
I was able to solve this for emojis by calling quill.setSelection(range.index + 1, 0), immediatly after insertion (see below). @julianlam is there a similar hook for mentions? There we have two issues, one related to the cursor jumping forward as was with emojis, and the second related to the insertion point that sometimes moves one line down.
$(window).on('action:composer.insertIntoTextarea', function (evt, data) {
let quill = $(data.textarea).parent().find('.ql-container').data('quill');
if(quill) {
let range = quill.getSelection();
//const text = `:${name}: `;
const text = `${data.value} `;
if (range) {
if (range.length === 0) {
//User cursor is at index
} else {
//User has highlighted text - deleting and replacing with emoji
quill.deleteText(range.index, range.length);
}
quill.clipboard.dangerouslyPasteHTML(range.index, text);
quill.setSelection(range.index + 1, 0);
}
}
data.preventDefault = true;
});
Steps to reproduce: add mention or emoji.
The cursor should be placed right after the inserted mention/emoji, but unfortunately it is placed far from it. I suspect it has to do with Quill not counting characters in the same manner composer does.
The text was updated successfully, but these errors were encountered: