Files
talk/plugins/talk-plugin-rich-text/client/components/rte/buttons/Blockquote.js
T
2018-03-23 12:37:20 +01:00

28 lines
596 B
JavaScript

import createToggle from '../factories/createToggle';
import { hasAncestor } from '../utils';
import bowser from 'bowser';
const execCommand = () => {
if (hasAncestor('BLOCKQUOTE')) {
document.execCommand('outdent');
} else {
if (bowser.msie) {
document.execCommand('indent');
} else {
document.execCommand('formatBlock', false, 'blockquote');
}
}
};
const syncState = () => {
return hasAncestor('BLOCKQUOTE');
};
const Blockquote = createToggle(execCommand, syncState);
Blockquote.defaultProps = {
children: 'Blockquote',
};
export default Blockquote;