-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
List blocks can now save changes to their content #598
Changes from 4 commits
e3072b2
c90d3d3
e14bd2a
7810edd
dc0c31e
7f361e9
b4b3c91
b23ac39
0a3cf93
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -284,6 +284,7 @@ export default class Editable extends wp.element.Component { | |
|
||
componentWillUpdate( nextProps ) { | ||
if ( this.editor && this.props.tagName !== nextProps.tagName ) { | ||
this.onChange(); | ||
this.editor.destroy(); | ||
} | ||
} | ||
|
@@ -349,6 +350,8 @@ export default class Editable extends wp.element.Component { | |
this.setState( { | ||
formats: merge( {}, this.state.formats, formats ) | ||
} ); | ||
|
||
this.editor.setDirty( true ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't see why is this needed. I dropped it and it works just as well. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On Chrome? I confirmed that it seems to work on Chrome too. I'm not sure why because if you throw a log statement in after all the formatting is set then this.editor.isDirty() is false which means in onChange it shouldn't save, however it is saving... One of the other developers here suggested that it might be picking up a node change event and setting the dirty flag later. On Firefox there are a few problems. Firstly it seems to always throw an IndexSizeError within the call to So the reason I put this.editor.setDirty(true) there is so that this will work when the Firefox IndexSizeError problem has been fixed. Still I suppose that really we just need to get it fixed in TinyMCE. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I decided to remove the setDirty call since it seems controversial. Note that applying formatting is very buggy/broken on Firefox but I don't know how to address that and it is not really anything to do with the list block. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had to re-add setDirty as it was not saving on Chrome after merging the latest changes from master without it.
|
||
} | ||
|
||
isAlignmentActive( align ) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this done automatically by the
formatter
calls? Sometimes calling a formatter doesn't change the content (end of text for example) and we may want to avoid this.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently it isn't. I inspected the dirty state before and after the formatter call and it wasn't being set. This is probably a bug in TinyMCE though.