();
componentDidMount() {
if (this.divRef.current) {
shortcutsToolbarRegistry.registerShortcutsToolbar(
this.divRef.current,
this.props.appStore.shortcutsStore
);
}
}
componentWillUnmount() {
if (this.divRef.current) {
shortcutsToolbarRegistry.unregisterShortcutsToolbar(
this.divRef.current
);
}
}
get shortcuts() {
return Array.from(
this.props.appStore.shortcutsStore.instrumentShortcuts
.get()
.values()
)
.filter(s => s.showInToolbar)
.sort((s1, s2) => {
if (s1.toolbarButtonPosition < s2.toolbarButtonPosition) {
return -1;
}
if (s1.toolbarButtonPosition > s2.toolbarButtonPosition) {
return 1;
}
let name1 = s1.name.toLocaleLowerCase();
let name2 = s2.name.toLocaleLowerCase();
return name1 < name2 ? -1 : name1 > name2 ? 1 : 0;
});
}
render() {
if (this.shortcuts.length === 0) {
return null;
}
return (
{this.shortcuts.map(shortcut => (
this.props.executeShortcut(shortcut)
}
isActive={
this.divRef.current ==
shortcutsToolbarRegistry.activeShortcutsToolbar &&
this.divRef.current
? true
: false
}
/>
))}
{this.props.appStore.shortcutsStore
.isAnyMissingShortcuts && (
)}
);
}
}
);