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

Improve how we detect that a post has been edited #266

Open
Tug opened this issue Nov 21, 2018 · 4 comments
Open

Improve how we detect that a post has been edited #266

Tug opened this issue Nov 21, 2018 · 4 comments
Assignees
Labels
[Status] Needs Discussion [Type] Enhancement Improves a current area of the editor

Comments

@Tug
Copy link
Contributor

Tug commented Nov 21, 2018

Currently we detect if a post is modified by checking if the resulting html changed:

See:
#225
#242
#264

We'd like to improve on that logic and reuse the isEditedPostDirty selector from the gutenberg store.

However there are a few road blocks along the way:

  • parse and serialize of blocks isn't always symmetric. For instance:
> serialize( parse( `<!-- wp:heading {"align":"center"} -->
<h2 style="text-align:center;">Welcome to Gutenberg!</h2>
<!-- /wp:heading -->` ) )
`<!-- wp:heading {"align":"center"} -->
<h2 style="text-align:center">Welcome to Gutenberg!</h2>
<!-- /wp:heading -->`

(notice the ; at the end of text-align:center)

  • Some blocks are updated when the post loads. For instance paragraph and heading both use the RichText component and modify the attributes in onContentSizeChange. But onContentSizeChange is called on load by RCTAztecView (RichText underline component).
@Tug Tug self-assigned this Nov 21, 2018
@hypest hypest added this to the Beta milestone Nov 21, 2018
@koke
Copy link
Member

koke commented Nov 27, 2018

Is this the same issue than #227?

@Tug
Copy link
Contributor Author

Tug commented Nov 27, 2018

Yes, it's very close. I suggest we close #227 though as we don't use a hash anymore to check that something has changed

@SergioEstevao
Copy link
Contributor

@Tug is this something that we still want to pursue?

@hypest
Copy link
Contributor

hypest commented Jun 9, 2020

We'd still want to have a performant way of checking for content dirtiness so, marking this as an enhancement and adding it to the Backlog.

@hypest hypest added the [Type] Enhancement Improves a current area of the editor label Jun 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] Needs Discussion [Type] Enhancement Improves a current area of the editor
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants