mirror of
https://github.com/flarum/core.git
synced 2025-08-02 14:37:49 +02:00
fix: errors with composer reuse (#42)
* fix: errors with composer reuse * fix: use arrow func
This commit is contained in:
@@ -40,8 +40,8 @@ export default function addComposerAutocomplete() {
|
|||||||
dropdown.hide();
|
dropdown.hide();
|
||||||
};
|
};
|
||||||
|
|
||||||
params.inputListeners.push(function (e) {
|
params.inputListeners.push(() => {
|
||||||
const selection = app.composer.editor.getSelectionRange();
|
const selection = this.attrs.composer.editor.getSelectionRange();
|
||||||
|
|
||||||
const cursor = selection[0];
|
const cursor = selection[0];
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ export default function addComposerAutocomplete() {
|
|||||||
// Search backwards from the cursor for an ':' symbol. If we find
|
// Search backwards from the cursor for an ':' symbol. If we find
|
||||||
// one and followed by a whitespace, we will want to show the
|
// one and followed by a whitespace, we will want to show the
|
||||||
// autocomplete dropdown!
|
// autocomplete dropdown!
|
||||||
const lastChunk = app.composer.editor.getLastNChars(15);
|
const lastChunk = this.attrs.composer.editor.getLastNChars(15);
|
||||||
absEmojiStart = 0;
|
absEmojiStart = 0;
|
||||||
for (let i = lastChunk.length - 1; i >= 0; i--) {
|
for (let i = lastChunk.length - 1; i >= 0; i--) {
|
||||||
const character = lastChunk.substr(i, 1);
|
const character = lastChunk.substr(i, 1);
|
||||||
@@ -134,7 +134,7 @@ export default function addComposerAutocomplete() {
|
|||||||
m.render($container[0], dropdown.render());
|
m.render($container[0], dropdown.render());
|
||||||
|
|
||||||
dropdown.show();
|
dropdown.show();
|
||||||
const coordinates = app.composer.editor.getCaretCoordinates(absEmojiStart);
|
const coordinates = this.attrs.composer.editor.getCaretCoordinates(absEmojiStart);
|
||||||
const width = dropdown.$().outerWidth();
|
const width = dropdown.$().outerWidth();
|
||||||
const height = dropdown.$().outerHeight();
|
const height = dropdown.$().outerHeight();
|
||||||
const parent = dropdown.$().offsetParent();
|
const parent = dropdown.$().offsetParent();
|
||||||
|
Reference in New Issue
Block a user