Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add duplicate post action #60637

Merged
merged 6 commits into from
Apr 24, 2024
Merged
Changes from 1 commit
Commits
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
Add copy to title. Reorder actions
  • Loading branch information
jorgefilipecosta committed Apr 24, 2024
commit 6e2c256198d1f7466a97429c80c357d827665ecd
8 changes: 7 additions & 1 deletion packages/editor/src/components/post-actions/actions.js
Original file line number Diff line number Diff line change
@@ -509,7 +509,13 @@ export const duplicatePostAction = {
RenderModal: ( { items, closeModal, onActionPerformed } ) => {
const [ item ] = items;
const [ isCreatingPage, setIsCreatingPage ] = useState( false );
const [ title, setTitle ] = useState( getItemTitle( item ) );
const [ title, setTitle ] = useState(
sprintf(
/* translators: %s: Existing item title */
__( '%s (Copy)' ),
getItemTitle( item )
)
);

const { saveEntityRecord } = useDispatch( coreStore );
const { createErrorNotice, createSuccessNotice } =
2 changes: 1 addition & 1 deletion packages/editor/src/components/post-actions/index.js
Original file line number Diff line number Diff line change
@@ -34,9 +34,9 @@ const {
const POST_ACTIONS_WHILE_EDITING = [
'view-post',
'view-post-revisions',
'duplicate-post',
'rename-post',
'move-to-trash',
'duplicate-post',
];

export default function PostActions( { onActionPerformed, buttonProps } ) {