2020-09-15 15:01:07 +02:00
|
|
|
import * as React from 'react';
|
|
|
|
import styles_ from './styles';
|
2020-11-07 17:59:37 +02:00
|
|
|
import { ToolbarButtonInfo } from '@joplin/lib/services/commands/ToolbarButtonUtils';
|
2020-09-15 15:01:07 +02:00
|
|
|
|
|
|
|
export enum Value {
|
|
|
|
Markdown = 'markdown',
|
|
|
|
RichText = 'richText',
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface Props {
|
2020-11-12 21:29:22 +02:00
|
|
|
themeId: number;
|
|
|
|
value: Value;
|
|
|
|
toolbarButtonInfo: ToolbarButtonInfo;
|
2020-09-15 15:01:07 +02:00
|
|
|
}
|
|
|
|
|
2020-11-12 21:13:28 +02:00
|
|
|
export default function ToggleEditorsButton(props: Props) {
|
2020-09-15 15:01:07 +02:00
|
|
|
const style = styles_(props);
|
|
|
|
|
|
|
|
return (
|
2021-05-17 20:33:44 +02:00
|
|
|
<button
|
|
|
|
style={style.button}
|
|
|
|
disabled={!props.toolbarButtonInfo.enabled}
|
|
|
|
aria-label={props.toolbarButtonInfo.tooltip}
|
|
|
|
title={props.toolbarButtonInfo.tooltip}
|
|
|
|
type="button"
|
|
|
|
className={`tox-tbtn ${props.value}-active`}
|
|
|
|
aria-pressed="false"
|
|
|
|
onClick={props.toolbarButtonInfo.onClick}
|
|
|
|
>
|
2020-09-15 15:01:07 +02:00
|
|
|
<div style={style.leftInnerButton}>
|
|
|
|
<i style={style.leftIcon} className="fab fa-markdown"></i>
|
|
|
|
</div>
|
|
|
|
<div style={style.rightInnerButton}>
|
|
|
|
<i style={style.rightIcon} className="fas fa-edit"></i>
|
|
|
|
</div>
|
|
|
|
</button>
|
|
|
|
);
|
|
|
|
}
|