FIX: Update preview when autocomplete is clicked (PR #10430)

d-editor observes value changing, and should update the preview.

This is happening when an autocomplete option is selected using the ENTER, but when you click an option, the value of the textarea is updated, but this observes does not pick up the change for some reason that I cannot see.

By manually resetting composer.reply (which is passed into d-editor here), the value in d-editor is set, and the observes catches the change, which updates the preview. It is not the slickest thing I’ve ever seen, but I can’t see why the textarea would be changing but the observes does not notice.


@markvanlan I think that’s OK.

This is actually what we do for emojis: as “value” is actually “composer.reply” as you can find out here:

Although you dont need the self = this and $input.val() something like this should do it:

        afterComplete: (value) => {
          this.composer.set("reply", value);

          // ensures textarea scroll position is correct
          schedule("afterRender", () => $input.blur().focus());

cf my comment

using value instead of $input.val() didn’t work ?

@jjaffeux Too focused on self being removed, I missed the rest of your recommendation.