mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-15 09:04:04 +02:00
51732a5adb
Squashed commit of the following: commit 5fde36f5c3fa7c7efbce6d81f48fe841c823e88c Author: Laurent Cozic <laurent@cozic.net> Date: Sun May 3 18:43:20 2020 +0100 Cannot fix for now commit 251284db3c8b7da6db83f3e06fd19bfdc8b8dd3f Author: Laurent Cozic <laurent@cozic.net> Date: Sun May 3 18:31:08 2020 +0100 Fixed print to multiple PDFs logic commit 00d9557996fb984b400fe650594150ae2681e03f Author: Laurent Cozic <laurent@cozic.net> Date: Sun May 3 17:49:20 2020 +0100 Fixed local search in TinyMCE commit 46778bf0a79f3bba9ddbc27389fadce4f8944507 Author: Laurent Cozic <laurent@cozic.net> Date: Sun May 3 17:37:31 2020 +0100 Restored note toolbar buttons commit 3e623c98f0a1cf08bf7d0136f0c8982c5e1ddcd8 Author: Laurent Cozic <laurent@cozic.net> Date: Sun May 3 12:30:57 2020 +0100 Various fixes and moved note toolbar to left of title commit 790262fe9df5b08d4a619e5244d2906047b39855 Author: Laurent Cozic <laurent@cozic.net> Date: Sun May 3 11:21:11 2020 +0100 Clean up commit cea30f42e69014ecabda6fa5083199a1ba7b7510 Author: Laurent Cozic <laurent@cozic.net> Date: Sun May 3 11:08:23 2020 +0100 Fixed note loading in TinyMCE
167 lines
2.9 KiB
TypeScript
167 lines
2.9 KiB
TypeScript
import * as React from 'react';
|
|
|
|
const ToolbarBase = require('../../../Toolbar.min.js');
|
|
const { _ } = require('lib/locale');
|
|
const { buildStyle } = require('../../../../theme.js');
|
|
|
|
interface ToolbarProps {
|
|
theme: number,
|
|
dispatch: Function,
|
|
}
|
|
|
|
function styles_(props:ToolbarProps) {
|
|
return buildStyle('AceEditorToolbar', props.theme, (/* theme:any*/) => {
|
|
return {
|
|
root: {
|
|
flex: 1,
|
|
marginBottom: 0,
|
|
},
|
|
};
|
|
});
|
|
}
|
|
|
|
export default function Toolbar(props:ToolbarProps) {
|
|
const styles = styles_(props);
|
|
|
|
function createToolbarItems() {
|
|
const toolbarItems = [];
|
|
|
|
toolbarItems.push({
|
|
tooltip: _('Bold'),
|
|
iconName: 'fa-bold',
|
|
onClick: () => {
|
|
props.dispatch({
|
|
type: 'WINDOW_COMMAND',
|
|
name: 'textBold',
|
|
});
|
|
},
|
|
});
|
|
|
|
toolbarItems.push({
|
|
tooltip: _('Italic'),
|
|
iconName: 'fa-italic',
|
|
onClick: () => {
|
|
props.dispatch({
|
|
type: 'WINDOW_COMMAND',
|
|
name: 'textItalic',
|
|
});
|
|
},
|
|
});
|
|
|
|
toolbarItems.push({
|
|
type: 'separator',
|
|
});
|
|
|
|
toolbarItems.push({
|
|
tooltip: _('Hyperlink'),
|
|
iconName: 'fa-link',
|
|
onClick: () => {
|
|
props.dispatch({
|
|
type: 'WINDOW_COMMAND',
|
|
name: 'textLink',
|
|
});
|
|
},
|
|
});
|
|
|
|
toolbarItems.push({
|
|
tooltip: _('Code'),
|
|
iconName: 'fa-code',
|
|
onClick: () => {
|
|
props.dispatch({
|
|
type: 'WINDOW_COMMAND',
|
|
name: 'textCode',
|
|
});
|
|
},
|
|
});
|
|
|
|
toolbarItems.push({
|
|
tooltip: _('Attach file'),
|
|
iconName: 'fa-paperclip',
|
|
onClick: () => {
|
|
props.dispatch({
|
|
type: 'WINDOW_COMMAND',
|
|
name: 'attachFile',
|
|
});
|
|
},
|
|
});
|
|
|
|
toolbarItems.push({
|
|
type: 'separator',
|
|
});
|
|
|
|
toolbarItems.push({
|
|
tooltip: _('Numbered List'),
|
|
iconName: 'fa-list-ol',
|
|
onClick: () => {
|
|
props.dispatch({
|
|
type: 'WINDOW_COMMAND',
|
|
name: 'textNumberedList',
|
|
});
|
|
},
|
|
});
|
|
|
|
toolbarItems.push({
|
|
tooltip: _('Bulleted List'),
|
|
iconName: 'fa-list-ul',
|
|
onClick: () => {
|
|
props.dispatch({
|
|
type: 'WINDOW_COMMAND',
|
|
name: 'textBulletedList',
|
|
});
|
|
},
|
|
});
|
|
|
|
toolbarItems.push({
|
|
tooltip: _('Checkbox'),
|
|
iconName: 'fa-check-square',
|
|
onClick: () => {
|
|
props.dispatch({
|
|
type: 'WINDOW_COMMAND',
|
|
name: 'textCheckbox',
|
|
});
|
|
},
|
|
});
|
|
|
|
toolbarItems.push({
|
|
tooltip: _('Heading'),
|
|
iconName: 'fa-header',
|
|
onClick: () => {
|
|
props.dispatch({
|
|
type: 'WINDOW_COMMAND',
|
|
name: 'textHeading',
|
|
});
|
|
},
|
|
});
|
|
|
|
toolbarItems.push({
|
|
tooltip: _('Horizontal Rule'),
|
|
iconName: 'fa-ellipsis-h',
|
|
onClick: () => {
|
|
props.dispatch({
|
|
type: 'WINDOW_COMMAND',
|
|
name: 'textHorizontalRule',
|
|
});
|
|
},
|
|
});
|
|
|
|
toolbarItems.push({
|
|
tooltip: _('Insert Date Time'),
|
|
iconName: 'fa-calendar-plus-o',
|
|
onClick: () => {
|
|
props.dispatch({
|
|
type: 'WINDOW_COMMAND',
|
|
name: 'insertDateTime',
|
|
});
|
|
},
|
|
});
|
|
|
|
toolbarItems.push({
|
|
type: 'separator',
|
|
});
|
|
|
|
return toolbarItems;
|
|
}
|
|
|
|
return <ToolbarBase style={styles.root} items={createToolbarItems()} />;
|
|
}
|