[IMP] mail: better typing for composer and use Ref typedef
This PR complete the type definition for the props of the composer and replace the custom Object by Ref type in the relevant place. closes odoo/odoo#119593 Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
This commit is contained in:
@@ -29,6 +29,15 @@ export const LONG_TYPING = 50000;
|
||||
* @typedef {Object} Props
|
||||
* @property {import("@mail/composer/composer_model").Composer} composer
|
||||
* @property {import("@mail/utils/hooks").MessageToReplyTo} messageToReplyTo
|
||||
* @property {import("@mail/utils/hooks").MessageEdition} [messageEdition]
|
||||
* @property {'compact'|'normal'|'extended'} [mode] default: 'normal'
|
||||
* @property {string} [placeholder]
|
||||
* @property {string} [className]
|
||||
* @property {function} [onDiscardCallback]
|
||||
* @property {function} [onPostCallback]
|
||||
* @property {Component} [messageComponent]
|
||||
* @property {number} [autofocus]
|
||||
* @property {import("@web/core/utils/hooks").Ref} [dropzoneRef]
|
||||
* @extends {Component<Props, Env>}
|
||||
*/
|
||||
export class Composer extends Component {
|
||||
@@ -41,7 +50,7 @@ export class Composer extends Component {
|
||||
static defaultProps = {
|
||||
mode: "normal",
|
||||
className: "",
|
||||
}; // mode = compact, normal, extended
|
||||
};
|
||||
static props = [
|
||||
"composer",
|
||||
"autofocus?",
|
||||
|
||||
@@ -22,7 +22,7 @@ import { escapeRegExp } from "@web/core/utils/strings";
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {{ el:HTMLElement }} [ref]
|
||||
* @param {import("@web/core/utils/hooks").Ref} [ref]
|
||||
* @param {Object} props
|
||||
* @param {import("@web/core/popover/popover_service").PopoverServiceAddOptions} [options]
|
||||
* @param {function} [props.onSelect]
|
||||
@@ -42,7 +42,7 @@ export function useEmojiPicker(ref, props, options = {}) {
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {{ el: HTMLElement }} ref
|
||||
* @param {import("@web/core/utils/hooks").Ref} ref
|
||||
*/
|
||||
function add(ref, onSelect, { show = false } = {}) {
|
||||
const toggler = () => toggle(ref, onSelect);
|
||||
|
||||
Reference in New Issue
Block a user