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
61 lines
1.4 KiB
JavaScript
61 lines
1.4 KiB
JavaScript
const React = require('react');
|
|
const { connect } = require('react-redux');
|
|
const { themeStyle } = require('../theme.js');
|
|
const ToolbarButton = require('./ToolbarButton.min.js');
|
|
const ToolbarSpace = require('./ToolbarSpace.min.js');
|
|
|
|
class ToolbarComponent extends React.Component {
|
|
render() {
|
|
const theme = themeStyle(this.props.theme);
|
|
|
|
const style = Object.assign({
|
|
height: theme.toolbarHeight,
|
|
display: 'flex',
|
|
flexDirection: 'row',
|
|
borderBottom: `1px solid ${theme.dividerColor}`,
|
|
boxSizing: 'border-box',
|
|
}, this.props.style);
|
|
|
|
const itemComps = [];
|
|
|
|
if (this.props.items) {
|
|
for (let i = 0; i < this.props.items.length; i++) {
|
|
const o = this.props.items[i];
|
|
let key = o.iconName ? o.iconName : '';
|
|
key += o.title ? o.title : '';
|
|
const itemType = !('type' in o) ? 'button' : o.type;
|
|
|
|
if (!key) key = `${o.type}_${i}`;
|
|
|
|
const props = Object.assign(
|
|
{
|
|
key: key,
|
|
theme: this.props.theme,
|
|
},
|
|
o
|
|
);
|
|
|
|
if (itemType === 'button') {
|
|
itemComps.push(<ToolbarButton {...props} />);
|
|
} else if (itemType === 'separator') {
|
|
itemComps.push(<ToolbarSpace {...props} />);
|
|
}
|
|
}
|
|
}
|
|
|
|
return (
|
|
<div className="editor-toolbar" style={style}>
|
|
{itemComps}
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
|
|
const mapStateToProps = state => {
|
|
return { theme: state.settings.theme };
|
|
};
|
|
|
|
const Toolbar = connect(mapStateToProps)(ToolbarComponent);
|
|
|
|
module.exports = Toolbar;
|