Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
b7cc241
Add PrePublish panel option to the general menu tools section
oandregal Sep 7, 2018
e3f0c24
Add data API
oandregal Sep 7, 2018
85edadc
Rename PublishPanel to PrePublishPanel
oandregal Sep 7, 2018
0488595
Implement core/edit-post actions and selector
oandregal Sep 10, 2018
14ea423
Rename pre-publish-panel-toggle to publish-sidebar-toggle
oandregal Sep 10, 2018
f4c237e
Connect the dots: publish toggles publish sidebar or publish directly
oandregal Sep 10, 2018
1a00c13
Update test for isPublishSidebarEnable preference
oandregal Sep 11, 2018
c659529
Expose dismissing option as a checkbox in the sidebar
oandregal Sep 11, 2018
e888220
Move publish sidebar logic to core/editor store
oandregal Sep 11, 2018
b3e9fa8
docs: tweak comment on isPublishSidebarEnabled
tofumatt Sep 11, 2018
f78a332
Use arrow function instead of traditional function
oandregal Sep 11, 2018
3e2877f
Fix linting issue that went undetected by eslint
oandregal Sep 11, 2018
dbd6090
Use english apostrophe, not single commas
oandregal Sep 11, 2018
ea5dc6a
Make enable/disable actions more obvious
oandregal Sep 11, 2018
afae18d
Inline PostPublish button / toggle logic
oandregal Sep 11, 2018
2f45e20
Add padding to align and give it space
oandregal Sep 11, 2018
7bfc2a5
Align to bottom
oandregal Sep 11, 2018
c65ea7c
Update wording
oandregal Sep 11, 2018
18036e2
Update copy
oandregal Sep 12, 2018
c37b6a8
Tweak microcopy for pre-publish checks.
sarahmonster Sep 12, 2018
d1c69c5
Remove outdated docs
oandregal Sep 13, 2018
1be0b54
Preventive measure
oandregal Sep 14, 2018
79ced01
Fix and add tests
oandregal Sep 14, 2018
78ebeec
Add e2e test
oandregal Sep 17, 2018
87b372d
Refactor code to avoid duplication
oandregal Sep 17, 2018
acffe70
chore: Tweak styles
tofumatt Sep 18, 2018
37900cc
Disable pre-publish checks after test
oandregal Sep 19, 2018
6637b7e
Add enable/disable functions
oandregal Sep 19, 2018
d7c7151
Use specific selector to target pre-publish checks menu item
oandregal Sep 19, 2018
b50ca1d
Do not make assumptions about previous states
oandregal Sep 19, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Connect the dots: publish toggles publish sidebar or publish directly
  • Loading branch information
oandregal committed Sep 17, 2018
commit f4c237e010a1b3792a2edc80f746b8d1e14b0b73
9 changes: 6 additions & 3 deletions edit-post/components/header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { IconButton } from '@wordpress/components';
import {
PostPreviewButton,
PostSavedState,
PostPublishPanelToggle,
} from '@wordpress/editor';
import { withDispatch, withSelect } from '@wordpress/data';
import { compose } from '@wordpress/compose';
Expand All @@ -19,13 +18,15 @@ import './style.scss';
import MoreMenu from './more-menu';
import HeaderToolbar from './header-toolbar';
import PinnedPlugins from './pinned-plugins';
import PublishButton from './publish-button';
import shortcuts from '../../keyboard-shortcuts';

function Header( {
isEditorSidebarOpened,
openGeneralSidebar,
closeGeneralSidebar,
isPublishSidebarOpened,
isPublishSidebarEnabled,
togglePublishSidebar,
hasActiveMetaboxes,
isSaving,
Expand All @@ -48,8 +49,9 @@ function Header( {
forceIsSaving={ isSaving }
/>
<PostPreviewButton />
<PostPublishPanelToggle
isOpen={ isPublishSidebarOpened }
<PublishButton
isSidebarOpen={ isPublishSidebarOpened }
isSidebarEnabled={ isPublishSidebarEnabled }
onToggle={ togglePublishSidebar }
forceIsDirty={ hasActiveMetaboxes }
forceIsSaving={ isSaving }
Expand Down Expand Up @@ -79,6 +81,7 @@ export default compose(
withSelect( ( select ) => ( {
isEditorSidebarOpened: select( 'core/edit-post' ).isEditorSidebarOpened(),
isPublishSidebarOpened: select( 'core/edit-post' ).isPublishSidebarOpened(),
isPublishSidebarEnabled: select( 'core/edit-post' ).isPublishSidebarEnabled(),
hasActiveMetaboxes: select( 'core/edit-post' ).hasMetaBoxes(),
isSaving: select( 'core/edit-post' ).isSavingMetaBoxes(),
hasBlockSelection: !! select( 'core/editor' ).getBlockSelectionStart(),
Expand Down
25 changes: 25 additions & 0 deletions edit-post/components/header/publish-button/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { PostPublishPanelToggle, PostPublishButton } from '@wordpress/editor';

const PublishButton = function( {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason for using function() { over () => {? We just tend toward fat-arrow functions in the codebase, so it stood out.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is now a button that turns into a panel? I'd sort of expect we'd have a button that toggled a panel on/off, not really one that changes from panel to button itself...

isSidebarOpen,
isSidebarEnabled,
onToggle,
forceIsDirty,
forceIsSaving } ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Odd that eslint didn't catch it, but I'd expect } ) { on a de-dented newline.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if ( isSidebarEnabled ) {
return (
<PostPublishPanelToggle
isSidebarOpen={ isSidebarOpen }
onToggle={ onToggle }
forceIsDirty={ forceIsDirty }
forceIsSaving={ forceIsSaving }
/>
);
}
return <PostPublishButton
forceIsDirty={ forceIsDirty }
forceIsSaving={ forceIsSaving }
/>;
};

export default PublishButton;