Files
iD/modules/ui/tools/sidebar_toggle.js
Quincy Morgan 32f8274929 Make t function return a span element with a lang attribute unless html: false is specified in the options (re: #7963)
Update `text` functions to `html` to support inserting the `span` elements
Specify `html: false` for various instances where a `span` is not desired, e.g. `placeholder` and `title` attributes
2020-09-15 21:56:22 -04:00

30 lines
896 B
JavaScript

import { t, localizer } from '../../core/localizer';
import { svgIcon } from '../../svg';
import { uiTooltip } from '../tooltip';
export function uiToolSidebarToggle(context) {
var tool = {
id: 'sidebar_toggle',
label: t('toolbar.inspect')
};
tool.render = function(selection) {
selection
.append('button')
.attr('class', 'bar-button')
.on('click', function() {
context.ui().sidebar.toggle();
})
.call(uiTooltip()
.placement('bottom')
.title(t('sidebar.tooltip'))
.keys([t('sidebar.key', { html: false })])
.scrollContainer(context.container().select('.top-toolbar'))
)
.call(svgIcon('#iD-icon-sidebar-' + (localizer.textDirection() === 'rtl' ? 'right' : 'left')));
};
return tool;
}