()
| 159 | } |
| 160 | |
| 161 | render() { |
| 162 | const items = this.items |
| 163 | .map((item: string | IToolbarItem): IToolbarItem => { |
| 164 | if (typeof item === 'string') { |
| 165 | const data = this.registry[item]; |
| 166 | if (!data) console.warn(`[markmap-toolbar] ${item} not found`); |
| 167 | return data; |
| 168 | } |
| 169 | return item; |
| 170 | }) |
| 171 | .filter(Boolean); |
| 172 | while (this.el.firstChild) { |
| 173 | this.el.firstChild.remove(); |
| 174 | } |
| 175 | this.el.append( |
| 176 | mountDom( |
| 177 | <> |
| 178 | {this.showBrand && renderBrand()} |
| 179 | {items.map(renderItem)} |
| 180 | </>, |
| 181 | ), |
| 182 | ); |
| 183 | return this.el; |
| 184 | } |
| 185 | } |
no test coverage detected