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

Initialize demo content only for new posts #2032

Merged
merged 1 commit into from
Jul 27, 2017
Merged

Conversation

aduth
Copy link
Member

@aduth aduth commented Jul 26, 2017

Related: #1929 (comment)
Related: #1984 (cc @westonruter)

This pull request seeks to resolve an issue where saving an edited Demo post and proceeding to refresh the page will not reflect edits made to the Demo.

The cause is two-fold:

  • We don't change the URL from ?page=gutenberg-demo to ?page=gutenberg when saving a demo post
  • We don't ensure that the demo initialization is not triggered when editing an existing post

The changes herein address the second of these two issues, which fixes the behavior. Ideally we should still seek to remedy the first of these points.

Testing instructions:

  1. Navigate to Gutenberg > Demo
  2. Edit the post (title or content)
  3. Save the post
  4. Refresh
  5. Note that edits are reflected

@@ -550,7 +551,7 @@ function gutenberg_editor_scripts_and_styles( $hook ) {
);

// Prepopulate with some test content in demo.
if ( $is_demo ) {
if ( $is_new_post && $is_demo ) {
Copy link
Member

Choose a reason for hiding this comment

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

It's kind of odd that demo is a new post and also a demo. But it may also be a way to initialize any post with existing content, which could be great for ready-made templates.

@aduth aduth merged commit 1f6397f into master Jul 27, 2017
@aduth aduth deleted the fix/demo-save-refresh branch July 27, 2017 18:23
ceyhun pushed a commit that referenced this pull request Apr 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants