addons/html_editor/static/src/others/qweb_picker.js
raw| 1 | import { Component, useState } from "@odoo/owl"; |
| 2 | |
| 3 | export class QWebPicker extends Component { |
| 4 | static template = "html_editor.QWebPicker"; |
| 5 | static props = ["groups", "select"]; |
| 6 | |
| 7 | setup() { |
| 8 | this.state = useState({ groups: this.props.groups }); |
| 9 | } |
| 10 | |
| 11 | onChange(ev) { |
| 12 | const [groupIndex, elementIndex] = ev.target.value.split(","); |
| 13 | this.props.select(this.state.groups[groupIndex][elementIndex].node); |
| 14 | } |
| 15 | } |