[IMP] mail: remove editabletext component

It was no longer used.

closes odoo/odoo#80063

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
This commit is contained in:
Alexandre Kühn
2021-11-18 18:45:39 +00:00
parent d2f30d1109
commit bfed30cba5
3 changed files with 0 additions and 97 deletions
@@ -1,86 +0,0 @@
/** @odoo-module **/
import { registerMessagingComponent } from '@mail/utils/messaging_component';
import { markEventHandled } from '@mail/utils/utils';
const { Component } = owl;
export class EditableText extends Component {
mounted() {
this.el.focus();
this.el.setSelectionRange(0, (this.el.value && this.el.value.length) || 0);
}
willUnmount() {
this.trigger('o-cancel');
}
//--------------------------------------------------------------------------
// Handlers
//--------------------------------------------------------------------------
/**
* @private
* @param {MouseEvent} ev
*/
_onBlur(ev) {
this.trigger('o-cancel');
}
/**
* @private
* @param {MouseEvent} ev
*/
_onClick(ev) {
markEventHandled(ev, 'EditableText.click');
this.trigger('o-clicked');
}
/**
* @private
* @param {KeyboardEvent} ev
*/
_onKeydown(ev) {
switch (ev.key) {
case 'Enter':
this._onKeydownEnter(ev);
break;
case 'Escape':
this.trigger('o-cancel');
break;
}
}
/**
* @private
* @param {KeyboardEvent} ev
*/
_onKeydownEnter(ev) {
if (!this.el) {
return;
}
const value = this.el.value;
const newName = value || this.props.placeholder;
if (this.props.value !== newName) {
this.trigger('o-validate', { newName });
} else {
this.trigger('o-cancel');
}
}
}
Object.assign(EditableText, {
defaultProps: {
placeholder: "",
value: "",
},
props: {
placeholder: String,
value: String,
},
template: 'mail.EditableText',
});
registerMessagingComponent(EditableText);
@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-name="mail.EditableText" owl="1">
<input class="o_EditableText" t-att-value="props.value" t-on-blur="_onBlur" t-on-click="_onClick" t-on-keydown="_onKeydown" t-att-placeholder="props.placeholder"/>
</t>
</templates>
@@ -133,9 +133,6 @@ function factory(dependencies) {
* @param {MouseEvent} ev
*/
onClick(ev) {
if (isEventHandled(ev, 'EditableText.click')) {
return;
}
this.channel.open();
}