/**
 * Allow mentions on mobile phones.
 * Register a new event handler for the textarea InputEvent.
 * Note: The chatroom should already have an event for it.
 */
converse.plugins.add('sib-mention-mobile', {
  overrides: {
    ChatRoomView: {
      /**
       * @param {InputEvent} ev
       */
      inputChanged(ev) {
        this.__super__.inputChanged.apply(this, arguments);
        this.mention_auto_complete.onInput(ev);
      },
    },
    AutoComplete: {
      /**
       * @param {InputEvent} ev
       */
      onInput(ev) {
        if (this.ac_triggers.includes(ev.data)) {
          this.auto_completing = true;
        }
      },
    },
  },
});