| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('submitStyle', this.getStyle) |
| | | MKEmitter.addListener('submitSearch', this.getSearch) |
| | | MKEmitter.addListener('tabsChange', this.handleTabsChange) |
| | | MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) |
| | |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('submitStyle', this.getStyle) |
| | | MKEmitter.removeListener('submitSearch', this.getSearch) |
| | | MKEmitter.removeListener('tabsChange', this.handleTabsChange) |
| | | MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) |
| | |
| | | changeStyle = () => { |
| | | const { tabs } = this.state |
| | | |
| | | MKEmitter.emit('changeStyle', [tabs.uuid], ['background', 'border', 'padding', 'margin', 'shadow'], tabs.style) |
| | | MKEmitter.emit('changeStyle', ['background', 'border', 'padding', 'margin', 'shadow'], tabs.style, this.getStyle) |
| | | } |
| | | |
| | | changeTabStyle = () => { |
| | | const { tabs } = this.state |
| | | |
| | | MKEmitter.emit('changeStyle', [tabs.uuid, 'tab'], ['font', 'padding'], tabs.tabStyle || {}) |
| | | MKEmitter.emit('changeStyle', ['font', 'padding'], tabs.tabStyle || {}, this.getTabStyle) |
| | | } |
| | | |
| | | getStyle = (comIds, style) => { |
| | | const { tabs } = this.state |
| | | getStyle = (style) => { |
| | | let _card = {...this.state.tabs, style} |
| | | |
| | | if (comIds[0] !== tabs.uuid) return |
| | | this.setState({ |
| | | tabs: _card |
| | | }) |
| | | |
| | | this.props.updateConfig(_card) |
| | | } |
| | | |
| | | if (comIds.length === 1) { |
| | | let _card = {...tabs, style} |
| | | getTabStyle = (style) => { |
| | | let _card = {...this.state.tabs, tabStyle: style} |
| | | |
| | | this.setState({ |
| | | tabs: _card |
| | | }) |
| | | |
| | | this.props.updateConfig(_card) |
| | | } else if (comIds[1] === 'tab') { |
| | | let _card = {...tabs, tabStyle: style} |
| | | |
| | | this.setState({ |
| | | tabs: _card |
| | | }) |
| | | |
| | | this.props.updateConfig(_card) |
| | | } |
| | | this.setState({ |
| | | tabs: _card |
| | | }) |
| | | |
| | | this.props.updateConfig(_card) |
| | | } |
| | | |
| | | handleTabsChange = (parentId) => { |