@ -155,6 +155,14 @@ class DocumentScene extends React.Component<Props> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@keydown('meta+shift+p')
|
||||||
|
onPublish(ev) {
|
||||||
|
ev.preventDefault();
|
||||||
|
if (!this.document) return;
|
||||||
|
if (this.document.publishedAt) return;
|
||||||
|
this.onSave({ publish: true, done: true });
|
||||||
|
}
|
||||||
|
|
||||||
loadDocument = async props => {
|
loadDocument = async props => {
|
||||||
const { shareId, revisionId } = props.match.params;
|
const { shareId, revisionId } = props.match.params;
|
||||||
|
|
||||||
@ -409,6 +417,7 @@ class DocumentScene extends React.Component<Props> {
|
|||||||
onSearchLink={this.onSearchLink}
|
onSearchLink={this.onSearchLink}
|
||||||
onChange={this.onChange}
|
onChange={this.onChange}
|
||||||
onSave={this.onSave}
|
onSave={this.onSave}
|
||||||
|
onPublish={this.onPublish}
|
||||||
onCancel={this.onDiscard}
|
onCancel={this.onDiscard}
|
||||||
readOnly={!this.isEditing || document.isArchived}
|
readOnly={!this.isEditing || document.isArchived}
|
||||||
toc={!revision}
|
toc={!revision}
|
||||||
|
@ -189,6 +189,12 @@ class Header extends React.Component<Props> {
|
|||||||
{can.update &&
|
{can.update &&
|
||||||
isDraft && (
|
isDraft && (
|
||||||
<Action>
|
<Action>
|
||||||
|
<Tooltip
|
||||||
|
tooltip="Publish"
|
||||||
|
shortcut={`${meta}+shift+p`}
|
||||||
|
delay={500}
|
||||||
|
placement="bottom"
|
||||||
|
>
|
||||||
<Button
|
<Button
|
||||||
onClick={this.handlePublish}
|
onClick={this.handlePublish}
|
||||||
title="Publish document"
|
title="Publish document"
|
||||||
@ -197,6 +203,7 @@ class Header extends React.Component<Props> {
|
|||||||
>
|
>
|
||||||
{isPublishing ? 'Publishing…' : 'Publish'}
|
{isPublishing ? 'Publishing…' : 'Publish'}
|
||||||
</Button>
|
</Button>
|
||||||
|
</Tooltip>
|
||||||
</Action>
|
</Action>
|
||||||
)}
|
)}
|
||||||
{canEdit && (
|
{canEdit && (
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// @flow
|
// @flow
|
||||||
import { Node, Editor } from 'slate';
|
import { Node, Editor } from 'slate';
|
||||||
import Placeholder from 'rich-markdown-editor/lib/plugins/Placeholder';
|
import Placeholder from 'rich-markdown-editor/lib/plugins/Placeholder';
|
||||||
|
import isModKey from 'rich-markdown-editor/lib/lib/isModKey';
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
Placeholder({
|
Placeholder({
|
||||||
@ -25,4 +26,13 @@ export default [
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
{
|
||||||
|
onKeyDown(ev: SyntheticKeyboardEvent<>, editor: Editor, next: Function) {
|
||||||
|
if (ev.key === 'p' && ev.shiftKey && isModKey(ev)) {
|
||||||
|
return editor.props.onPublish(ev);
|
||||||
|
}
|
||||||
|
|
||||||
|
return next();
|
||||||
|
},
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
Reference in New Issue
Block a user