()
| 85 | } |
| 86 | |
| 87 | constructor() { |
| 88 | this.register({ |
| 89 | id: 'zoomIn', |
| 90 | title: 'Zoom in', |
| 91 | content: Toolbar.icon('M9 5v4h-4v2h4v4h2v-4h4v-2h-4v-4z'), |
| 92 | onClick: this.getHandler((mm) => mm.rescale(1.25)), |
| 93 | }); |
| 94 | this.register({ |
| 95 | id: 'zoomOut', |
| 96 | title: 'Zoom out', |
| 97 | content: Toolbar.icon('M5 9h10v2h-10z'), |
| 98 | onClick: this.getHandler((mm) => mm.rescale(0.8)), |
| 99 | }); |
| 100 | this.register({ |
| 101 | id: 'fit', |
| 102 | title: 'Fit window size', |
| 103 | content: Toolbar.icon( |
| 104 | 'M4 7h2v-2h2v4h-4zM4 13h2v2h2v-4h-4zM16 7h-2v-2h-2v4h4zM16 13h-2v2h-2v-4h4z', |
| 105 | ), |
| 106 | onClick: this.getHandler((mm) => mm.fit()), |
| 107 | }); |
| 108 | this.register({ |
| 109 | id: 'recurse', |
| 110 | title: 'Toggle recursively', |
| 111 | content: Toolbar.icon('M16 4h-12v12h12v-8h-8v4h2v-2h4v4h-8v-8h10z'), |
| 112 | onClick: (e) => { |
| 113 | const button = (e.target as HTMLDivElement).closest<HTMLDivElement>( |
| 114 | `.${clsToolbarItem}`, |
| 115 | ); |
| 116 | const active = button?.classList.toggle(clsActive); |
| 117 | this.markmap?.setOptions({ |
| 118 | toggleRecursively: active, |
| 119 | }); |
| 120 | }, |
| 121 | }); |
| 122 | this.register({ |
| 123 | id: 'dark', |
| 124 | title: 'Toggle dark theme', |
| 125 | content: Toolbar.icon( |
| 126 | 'M10 4a6 6 0 0 0 0 12a6 6 0 0 0 0 -12v2a4 4 0 0 1 0 8z', |
| 127 | ), |
| 128 | onClick: () => { |
| 129 | document.documentElement.classList.toggle('markmap-dark'); |
| 130 | }, |
| 131 | }); |
| 132 | this.render(); |
| 133 | } |
| 134 | |
| 135 | /** @deprecated Set `showBrand` instead. */ |
| 136 | setBrand(show: boolean) { |
nothing calls this directly
no test coverage detected