-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
MetaBoxes: Remove dirty-checking metaboxes state #4184
Conversation
86f442a
to
9eff87c
Compare
This allows some of my custom meta boxes that I've been testing to continue working as before. 👍 |
If that means it might happen to loose a ton of edited content by accident with one wrong click, i don't think that's an option. If it is not possible to detect a dirty state correctly, i would instead prefer to be always prompted, even if there is no change at all. |
That's how the current editor works, and it doesn't seem to bother anyone. The confirmation box is still enabled for changes to the post content and the post settings though. |
If so, that is bad and should be fixed.
Except all the users who lost their edits. Using ACF Pro, there is obviously an inconsistent behaviour, changes in most field types cause a prompt, It should at least be documented what plugin authors have to do to cause a prompt (something like a setDirty() call?) |
Sounds like a good idea to add an API like that. I think it's out of the scope of the current PR thought since this brings us to a similar behavior to the current Editor. |
Is it possible to check whether there are "unsaved" changes during the (I should perhaps note I don't have the clearest understanding of the meta boxes behaviors) That said, if it's prohibitively difficult, my preference would be toward resolving the bugs of #4183 and #3975 even if it means losing the dirtiness prompts. |
Good proposal, I might try it, it may be difficult to achieve though since the "state" of the metaboxes is dispatched through several areas and if the areas are not visible, the DOM is in a hidden node. But it has a downside. Some metaboxes come with default values, even if they do not have any change, they are still "dirty" (needs to be saved) |
I'd agree these are "dirty" only in that they need to be included in the save payload, but wouldn't agree that they'd need to stop the user from navigating away. If we're not already, couldn't we just send the entire metabox form of fields in the save request, whether or not any changes have been made? |
Yes, that's what I'm doing in this PR alongside the the removal of the dirty checking to prevent leaving the editor (which matchers the old editor's behavior). I'll try to update the PR to make it work similarily to what you propose. But the only way to make it behave properly is to avoid relying on the "onChange" event and check the state when the user wants to leave the page because we can't catch updates done programmatically with onChange events. |
39364a0
to
35276f0
Compare
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.
I don't love the DOM querying where we expect to know the class structure of meta box elements. The only idea I can think of as an alternative is a pattern similar to slots where dirtyable areas (components) can register themselves with UnsavedChangesWarning
, and the initial HTML is tracked when the (dirtyable) component first mounts. At this point there'd be no need for the Redux property tracking.
Can you explain what it is about the changes here that resolves #4183?
@@ -29,7 +31,10 @@ class UnsavedChangesWarning extends Component { | |||
} | |||
|
|||
warnIfUnsavedChanges( event ) { | |||
if ( this.props.isDirty ) { | |||
const areMetaBoxesDirty = some( this.props.metaBoxes, ( metaBoxe, location ) => { |
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.
Typo: I'd expect singular form of metaBoxes
to be metaBox
[ ...result, location ] : | ||
result; | ||
}, [] ); | ||
return some( getMetaBoxes( state ), ( metaBox ) => { |
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.
Minor: This can be simplified using Lodash property matchers:
return some( getMetaBoxes( state ), 'isActive' );
@@ -99,7 +99,6 @@ describe( 'selectors', () => { | |||
} ); | |||
|
|||
beforeEach( () => { | |||
getDirtyMetaBoxes.clear(); |
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.
We should clear the cache of isSavingMetaBoxes
before each test.
@@ -351,7 +354,7 @@ export function isCurrentPostPublished( state ) { | |||
*/ | |||
export function isEditedPostPublishable( state ) { | |||
const post = getCurrentPost( state ); | |||
return isEditedPostDirty( state ) || [ 'publish', 'private', 'future' ].indexOf( post.status ) === -1; | |||
return isEditedPostDirty( state ) || hasMetaBoxes( state ) || [ 'publish', 'private', 'future' ].indexOf( post.status ) === -1; |
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.
Might recommend splitting this long line:
return (
isEditedPostDirty( state ) ||
hasMetaBoxes( state ) ||
[ 'publish', 'private', 'future' ].indexOf( post.status ) === -1
);
Minor: I like semantic readability of Lodash's _.includes
:
return (
isEditedPostDirty( state ) ||
hasMetaBoxes( state ) ||
! includes( [ 'publish', 'private', 'future' ], post.status )
);
editor/store/test/selectors.js
Outdated
@@ -2086,6 +1996,21 @@ describe( 'selectors', () => { | |||
|
|||
expect( isSavingPost( state ) ).toBe( false ); | |||
} ); | |||
|
|||
it( 'should return true if the post is notcurrently being saved but meta boxes are saving', () => { |
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.
Minor: Typo: Needs space between "not" and "currently"
editor/store/selectors.js
Outdated
export const isMetaBoxStateDirty = ( state ) => getDirtyMetaBoxes( state ).length > 0; | ||
export const isSavingMetaBoxes = createSelector( | ||
( state ) => { | ||
return some( getMetaBoxes( state ), ( metaBox ) => { |
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.
Same note as previous.
editor/edit-post/meta-boxes.js
Outdated
return area.innerHTML; | ||
} | ||
|
||
return document.querySelector( '.metabox-location-' + location ).innerHTML; |
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.
When would we expect this line to be reached? (Can we add a comment explaining 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.
And if we're expecting the first query selector might return an empty result, is there any reason to think this one might as well?
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.
The metaboxes are rendered to an initial hidden dom node (the later here) but when their panel is visible (it's not always the case for the sidebar), they are moved to their new location and when closed moved back to the original location.
editor/store/reducer.js
Outdated
@@ -668,6 +668,7 @@ export function metaBoxes( state = defaultMetaBoxState, action ) { | |||
...state[ location ], | |||
isLoaded: false, | |||
isActive: action.metaBoxes[ location ], | |||
html: getLocationHtml( location ), |
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.
Rather than calling into DOM from the reducer:
- Could the
MetaBoxesArea
component dispatch a "set HTML" action when it mounts? - Should this at least be modeled as an effect? (Minding that with Framework: Bump refx to 3.x #3983 we should respect that effects occur after the original action)
const { loading } = this.state; | ||
const { isDirty, changedMetaBoxState, location } = this.props; | ||
|
||
const newIsDirty = ! isEqual( this.originalFormData, this.getFormData() ); |
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.
Seems this.originalFormData
is defunct now and can be removed, along with getFormData
.
My reading of #4183 is not related to the Save button being unavailable, but rather that the default values aren't included in the payload of the save request. |
@aduth I think the request for saving the metaboxes is not triggered at all because they are considered "non-dirty" |
cc96ae4
to
e6f799d
Compare
Ok, I think the PR is better now. I updated it. It still uses the DOM direct access. It's not great but since the metaboxes are kind of "weird chunk fo HTML" we have to deal with, it's acceptable IMO. Also,
What do y'all think? |
e6f799d
to
13f869e
Compare
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.
I'm generally fine with the direction here.
{ loading && <Spinner /> } | ||
<div ref={ this.bindNode } /> | ||
{ isSaving && <Spinner /> } | ||
<div className="editor-meta-boxes-area__container" ref={ this.bindNode } /> |
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.
Unrelated: When I see bindNode
, I assume it's assigning the ref
of the root return value, not a child of the element. A minor thing, but I think it can be nice to clarify in the function name, e.g. bindContainerNode
.
this.mounted = true; | ||
this.fetchMetaboxes(); | ||
this.form = document.querySelector( '.metabox-location-' + this.props.location ); | ||
this.node.appendChild( this.form ); |
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.
Not sure if we care to be guarded here, but if I pass an invalid location
prop, this will error.
editor/store/actions.js
Outdated
* | ||
* @param {Object} metaBoxes Whether meta box locations are active. | ||
* @param {Object} metaBoxes Whether meta box locations are active. |
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.
I think there was a faulty rebase here, I wouldn't expect these doc changes (i.e. we don't want the extra whitespace here, or in the @returns
below)
editor/store/actions.js
Outdated
*/ | ||
export function metaBoxStateChanged( location, hasChanged ) { | ||
export function metaBoxSetSavedData( dataPerLocation ) { |
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.
Unrelated: I prefer when the action creators are prefixed with the verb of what's happening, i.e. "set", setMetaBoxSavedData
editor/store/effects.js
Outdated
} | ||
return memo; | ||
}, {} ); | ||
store.dispatch( metaBoxSetSavedData( dataPerLocation ) ); |
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.
Could be DRY'd up a bit with the INITIALIZE_META_BOX_STATE
effect logic.
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.
Not so simple because the effect is triggering before the action. Didn't you make an update to refx
to update 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.
Not so simple because the effect is triggering before the action. Didn't you make an update to
refx
to update this?
Yes: #3983
editor/store/reducer.js
Outdated
* Reducer keeping track of the meta boxes saving state. | ||
* | ||
* @param {boolean} state Previous state. | ||
* @param {Object } action Action Object. |
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.
Extra space before the }
is unexpected (here and in the DocBlock below)
editor/store/reducer.js
Outdated
} | ||
|
||
/** | ||
* |
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.
This line is unnecessary.
editor/store/reducer.js
Outdated
}; | ||
|
||
return result; | ||
}, {} ); | ||
|
||
/** | ||
* Reducer keeping track of the meta boxes saving state. |
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.
Personally I don't find this comment to be particularly helpful beyond pointing out that it's a reducer, and would encourage elaborating on the purpose for why we track a meta box saving state.
lib/meta-box-partial-page.php
Outdated
} | ||
</div> | ||
</form> | ||
<?php } ?> |
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.
I don't see a rule for it, but I'd conventionally have expected if
and endif
statements for conditions / loops within a PHP template:
Note that requiring the use of braces just means that single-statement inline control structures are prohibited. You are free to use the alternative syntax for control structures (e.g. if/endif, while/endwhile)—especially in your templates where PHP code is embedded within HTML, for instance:
<?php if ( have_posts() ) : ?> <div class="hfeed"> <?php while ( have_posts() ) : the_post(); ?> <article id="post-<?php the_ID() ?>" class="<?php post_class() ?>"> <!-- ... --> </article> <?php endwhile; ?> </div> <?php endif; ?>
https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/#brace-style
743a361
to
3acae91
Compare
Hidden metaboxes (side) were not saved before
92aab50
to
7a7d61b
Compare
Any other concern here? |
Squashed commit of the following: commit 4e0358e Merge: 5f6e8c6 73612cb Author: Joen Asmussen <[email protected]> Date: Tue Jan 23 11:19:02 2018 +0100 Merge pull request #4631 from WordPress/try/new-mover-icons Try smaller up/down arrows, and focus management commit 73612cb Author: Joen Asmussen <[email protected]> Date: Tue Jan 23 10:28:59 2018 +0100 Adjust test to not look for the icon The icon is now an SVG passed on commit 5f6e8c6 Author: Herb Miller <[email protected]> Date: Tue Jan 23 04:06:21 2018 +0000 Fixes #4541 (#1) (#4542) * Fixes #4541 (#1) * Update ISSUE_TEMPLATE.md commit 25d90ca Author: Stephen Edgar <[email protected]> Date: Mon Jan 22 11:26:46 2018 +1100 Scrips: Update verbiage and comments in `install-node-nvm.sh` script (#4624) commit 456f28a Author: Andrew Duthie <[email protected]> Date: Sat Jan 20 17:13:37 2018 -0500 Components: Ensure isLoading set to false after request error (#4525) commit 5760b63 Author: Ramon <[email protected]> Date: Sat Jan 20 19:33:25 2018 -0200 Update "Edit Link" to "Insert/edit link" (#4471) commit d967017 Merge: 62a9e7b 9da45da Author: Miguel Fonseca <[email protected]> Date: Fri Jan 19 18:36:35 2018 +0000 Merge pull request #4349 from WordPress/fix/3839-undelayed-slot-prop-update fix/3839: Move slot.forceUpdate() to fill's render to fix prop propagation commit 9da45da Author: James Johnson <[email protected]> Date: Mon Jan 8 16:40:09 2018 +1000 Move slot.forceUpdate() call into componentWillUpdate - Fixes prop propagation across Slot boundary. commit 62a9e7b Author: Andrew Duthie <[email protected]> Date: Fri Jan 19 12:27:40 2018 -0500 Block List: Select block only if not already selected (#4586) commit 8d57578 Author: Andrew Duthie <[email protected]> Date: Fri Jan 19 12:24:29 2018 -0500 Block List: Start multi-selection tracking on mousemove (#4585) * Block List: Start multi-selection tracking on mousemove * State: Abort state update if multi-select action has no effect commit d591e58 Author: Ella Van Dorpe <[email protected]> Date: Fri Jan 19 18:00:06 2018 +0100 Add subhead block (#2091) commit 3568fc4 Author: Jorge <[email protected]> Date: Fri Jan 19 16:37:09 2018 +0000 Added text align feature to cover image. (#4066) commit 6dd01de Author: Riad Benguella <[email protected]> Date: Fri Jan 19 14:41:36 2018 +0100 MetaBoxes: Remove dirty-checking metaboxes state (#4184) * MetaBoxes: Remove dirty-checking metaboxes state * MetaBoxes: compare meta boxes HTML while leaving the editor to warn about unsaved changes * Meta Boxes: Changing the way we save metaboxes Hidden metaboxes (side) were not saved before commit 036f60a Author: Riad Benguella <[email protected]> Date: Fri Jan 19 14:34:17 2018 +0100 Blocks: Showing a preview of the block immediately after drag and drop (#4567) commit 060200c Merge: df24fd0 0e6fb4b Author: Miguel Fonseca <[email protected]> Date: Fri Jan 19 11:35:24 2018 +0000 Merge pull request #4549 from WordPress/add/copy-content-as-extension Refactor CopyContentButton as core extension commit df24fd0 Author: Ella Van Dorpe <[email protected]> Date: Fri Jan 19 11:57:40 2018 +0100 Add HTML handler to dropzone (#4577) * Add HTML handler to dropzone * Add HTML handler to image placeholder * Merge ifs commit 993561d Author: mac <[email protected]> Date: Thu Jan 18 09:29:19 2018 -0700 Image Block Link Label Copy Change commit 5ab37b7 Author: Ella Van Dorpe <[email protected]> Date: Fri Jan 19 11:12:51 2018 +0100 Remove "Open in new window" link option (#4583) Reverts #2628. commit 6ed1573 Author: Grzegorz (Greg) Ziółkowski <[email protected]> Date: Fri Jan 19 09:49:04 2018 +0100 Docs: Update title for the scaffolding blocks document (#4596) commit 91cb16c Author: Joen Asmussen <[email protected]> Date: Fri Jan 19 09:47:32 2018 +0100 Try new icons for movers These icons are smaller and less obtrusive, which makes them less heavy to look at. This PR also employs a workaround to achieve the effect that `:focusring` would, were it implemented (see https://www.youtube.com/watch?v=ilj2P5-5CjI). This is applied only to the mover icons. GIF: https://cldup.com/5lyhf0iSTp.gif commit f43140e Author: Riad Benguella <[email protected]> Date: Fri Jan 19 09:44:04 2018 +0100 Block versioning: Introduce a migration function (#3673) commit aa5e157 Author: Jason Caldwell <[email protected]> Date: Mon Jan 15 03:28:47 2018 -0900 Improve `useOnce` documentation. #3695 commit 85be4c7 Author: Gary Pendergast <[email protected]> Date: Fri Jan 19 14:40:26 2018 +1100 Use docker-compose for all Docker commands (#4592) commit a2d64e1 Author: Andrew Duthie <[email protected]> Date: Thu Jan 18 12:52:56 2018 -0500 Block: Move drag handling to instance-bound handler (#4582) commit 0e6fb4b Author: Miguel Fonseca <[email protected]> Date: Wed Jan 17 15:18:28 2018 +0000 Refactor CopyContentButton as core extension * Use withState & compose, drop class component * Cache CopyContentButton element for EditorActions filter commit 6c256dd Author: Jorge <[email protected]> Date: Tue Jan 16 21:00:01 2018 +0000 Don't persist mobile and publish sidebar to localStorage. Mobile and publish sidebars should when page reloads, even if they were open before. commit 4d6af27 Author: Jorge <[email protected]> Date: Tue Jan 16 20:58:46 2018 +0000 Implemented mechanism to allow reducers to customise what information gets serialised to localStorage; Changed mechanism to load defaults in loadAndPersist. commit 1fa9344 Author: Jorge <[email protected]> Date: Tue Jan 16 20:43:27 2018 +0000 Removed old mechanism to avoid mobile sidebar persistence. With the last code changes this mechanism is not being used anymore. commit e24460c Author: Grzegorz (Greg) Ziółkowski <[email protected]> Date: Thu Jan 18 12:37:14 2018 +0100 Docs: Add page explaining how to scaffold blocks (#4404) commit b866d21 Merge: 57280d0 d04b78d Author: Joen Asmussen <[email protected]> Date: Thu Jan 18 12:01:35 2018 +0100 Merge pull request #3996 from WordPress/try/gallery-markup-tweaks Try new gallery markup commit 57280d0 Merge: e97b65f eb954da Author: Stephen Edgar <[email protected]> Date: Thu Jan 18 21:41:59 2018 +1100 Merge pull request #4563 from WordPress/update/eslint-jsdoc JSDoc fixes commit d04b78d Author: Riad Benguella <[email protected]> Date: Thu Jan 18 11:38:04 2018 +0100 Gallery Block: Fix tests commit 91b2504 Author: Riad Benguella <[email protected]> Date: Thu Jan 18 11:26:34 2018 +0100 Gallery Block: Fix deprecated version commit 450f716 Author: Joen Asmussen <[email protected]> Date: Thu Jan 18 11:15:01 2018 +0100 Try adjusting deprecated attributes Also re-add the deprecated CSS class. commit e97b65f Merge: f9486f1 5d50586 Author: Joen Asmussen <[email protected]> Date: Thu Jan 18 11:13:11 2018 +0100 Merge pull request #4512 from WordPress/try/new-focus-outlines Try new button outline & focus styles commit 5d50586 Author: Joen Asmussen <[email protected]> Date: Thu Jan 18 10:59:27 2018 +0100 Tweak styles further from revert. commit eb954da Merge: 968e87f 48780ab Author: Stephen Edgar <[email protected]> Date: Thu Jan 18 20:55:46 2018 +1100 Merge branch 'update/eslint-jsdoc' of github.com:WordPress/gutenberg into update/eslint-jsdoc commit 968e87f Author: Stephen Edgar <[email protected]> Date: Thu Jan 18 20:54:39 2018 +1100 More JSDoc fixes commit 1cea78d Author: Joen Asmussen <[email protected]> Date: Thu Jan 18 10:53:27 2018 +0100 Revert tabindex fix, and reverse active & hover states. commit 48780ab Merge: 596ff36 f9486f1 Author: Stephen Edgar <[email protected]> Date: Thu Jan 18 20:24:59 2018 +1100 Merge branch 'master' into update/eslint-jsdoc commit 3da0798 Author: Joen Asmussen <[email protected]> Date: Thu Jan 18 09:49:39 2018 +0100 Replace all instances of blocks-gallery-image commit 4466445 Author: Joen Asmussen <[email protected]> Date: Thu Jan 18 09:29:05 2018 +0100 Address feedback - Move li outside of component - Fix CSS typo - Add deprecated section commit d8eaefb Author: Joen Asmussen <[email protected]> Date: Thu Dec 14 09:56:47 2017 +0100 Try new gallery markup This is a new version of the PR by #3441 by @samikeijonen. It's just basically "rebased". It seems to be working fine in practice, the chief purpose is to make the gallery be list based. I'm getting "modified externally" warnings, though. commit f9486f1 Author: Stephen Edgar <[email protected]> Date: Thu Jan 18 19:23:33 2018 +1100 chore: remove `eslines` (#4565) * chore: remove `eslines` * chore: remove `eslines` from `eslint` npm script * chore: remove JSON formatter from `eslint` npm script commit e9f38ae Author: Grzegorz (Greg) Ziółkowski <[email protected]> Date: Thu Jan 18 09:12:51 2018 +0100 Components: Force update when new filter added or removed when using withFilters HOC (#4428) commit cda269d Author: jaswrks <[email protected]> Date: Wed Jan 17 22:48:30 2018 -0900 Remove danger warning from plugin header (#4552) see: #4185 commit 596ff36 Author: Stephen Edgar <[email protected]> Date: Thu Jan 18 18:46:05 2018 +1100 JSDoc fixes commit e826be5 Author: Lara Schenck <[email protected]> Date: Wed Jan 17 23:33:35 2018 -0800 Add more context to Templates sample code (#4557) * Add function and add_action call to sample code * Better function name commit b8566d7 Merge: 64b6017 c442f0e Author: Robert Anderson <[email protected]> Date: Thu Jan 18 09:52:08 2018 +1100 Merge pull request #4497 from WordPress/update/move-logic-out-of-inserter Move data logic out of the inserter commit c442f0e Author: Robert Anderson <[email protected]> Date: Wed Jan 17 16:33:23 2018 +1100 Add a unique id to inserter items This lets the inserter do faster string comparison between inserter items rather than deep object comparison. commit 6759f55 Author: Robert Anderson <[email protected]> Date: Tue Jan 16 13:00:54 2018 +1100 Move data logic out of the inserter Moves the logic that determines which items should appear in the inserter into dedicated selector functions. This way, the logic is easier to test and can be re-used. commit 64b6017 Author: Ella Van Dorpe <[email protected]> Date: Wed Jan 17 17:18:25 2018 +0100 Ensure editor still exists after timeout (#4524) * Ensure editor still exists after timeout * Add doc for setSafeTimeout commit 0940478 Author: Ella Van Dorpe <[email protected]> Date: Wed Jan 17 15:24:32 2018 +0100 Allow copying text in block (non input) (#4531) commit 79e9552 Merge: add336f d129a6c Author: Joen Asmussen <[email protected]> Date: Wed Jan 17 12:51:28 2018 +0100 Merge pull request #4313 from WordPress/fix/blinking-focus-outline Fix issue where black rectangle would briefly blink on new paragraphs commit add336f Author: Riad Benguella <[email protected]> Date: Wed Jan 17 12:23:31 2018 +0100 Data Module: Expose state using selectors (#4105) commit 47c36a5 Author: Riad Benguella <[email protected]> Date: Fri Jan 12 14:41:18 2018 +0100 Meta Boxes: Allow collapsing/sorting the meta boxes panels commit 8d3a673 Author: Josh Pollock <[email protected]> Date: Sat Jan 13 15:30:08 2018 -0500 Add links to specific sections of Redux docs #4452 commit 6e2e944 Author: Robert Anderson <[email protected]> Date: Wed Jan 17 18:28:48 2018 +1100 Only minimize -rtl files in production (#4536) This improves incremental developmnet build performance by about 3.5x! commit 9d28bac Merge: acd3d22 d216fe1 Author: Robert Anderson <[email protected]> Date: Wed Jan 17 16:59:04 2018 +1100 Merge pull request #4538 from WordPress/fix/snapshot-tests Fix snapshot tests commit d216fe1 Author: Robert Anderson <[email protected]> Date: Wed Jan 17 16:51:01 2018 +1100 Fix snapshot tests commit acd3d22 Author: Walter Ebert <[email protected]> Date: Wed Jan 17 04:24:52 2018 +0100 Remove Vine embed (#4521) Vine is no longer a supported oembed provider since WordPress 4.9.0, it can be removed from Gutenberg to match. commit c433d76 Author: Gary Pendergast <[email protected]> Date: Wed Jan 17 13:54:24 2018 +1100 Improve the build scripts (#4465) There's a bunch of stuff that can be automated when setting up a local development environment. Here's some polish, etc. Notable changes: - Automatically check for and install NVM, update to the correct version of Node. - Add some extra information to Docker checks. - Add a check and fix for npm/npm#16938, which is super annoying. - Switch to using Docker for Composer scripts. - Defining the WordPress URL port in docker-compose.yml now defines it everywhere, including Cypress e2e tests. - Generally clean up and hide the spammy status messages that don't benefit anyone. - Add a welcome message at the end of the setup process. commit 7f7b607 Author: Helen Hou-Sandi <[email protected]> Date: Tue Jan 16 17:44:57 2018 -0500 Insert `@username` for user mention autocomplete (#4444) Rather than inserting a static link and the display name, both of which may change over time and lead to stale content, follow the pattern of existing user mentions in WordPress projects and insert a plaintext mention using the username. commit 2e276ad Author: Thorsten Frommen <[email protected]> Date: Tue Jan 16 22:27:50 2018 +0100 Simplify control flow. (#4458) commit 8cad9ae Author: Thorsten Frommen <[email protected]> Date: Tue Jan 16 22:25:59 2018 +0100 Remove stray word. (#4459) commit fdd1568 Author: Sören Wrede <[email protected]> Date: Tue Jan 16 22:04:58 2018 +0100 Remove colon from audio and video block placeholder. (#4431) commit 75d81e9 Author: Andrew Duthie <[email protected]> Date: Tue Jan 16 14:53:00 2018 -0500 Blocks: Reduce sibling inserter initial height (#4384) commit 3e08d83 Author: Riad Benguella <[email protected]> Date: Tue Jan 16 13:35:21 2018 +0100 Media: Refactor the MediaUploadButton to be agnostic to its rendered UI commit 8e87182 Author: Jason Caldwell <[email protected]> Date: Mon Jan 15 04:32:21 2018 -0900 fix: `applyOrUnset()` consistency. See: #3859 commit 8f0aab9 Author: Riad Benguella <[email protected]> Date: Tue Jan 16 14:30:50 2018 +0100 Documentation: change default post type term commit b86cbe2 Author: Riad Benguella <[email protected]> Date: Tue Jan 16 14:14:44 2018 +0100 Documentation: Clarifies how to assign a template to a default Post Type commit 513534d Author: Sören Wrede <[email protected]> Date: Tue Jan 16 14:19:33 2018 +0100 Update copyright year to 2018 in license.md (#4511) commit 14f76e5 Author: Jb Audras <[email protected]> Date: Tue Jan 16 14:01:42 2018 +0100 Add missing alt attribute to image (and gallery) blocks when alt return an empty value (#4363) commit 789f955 Author: Joen Asmussen <[email protected]> Date: Tue Jan 16 13:10:34 2018 +0100 Polish focus styles further commit 6c65025 Merge: 64a4cf7 8a12860 Author: Joen Asmussen <[email protected]> Date: Tue Jan 16 12:39:20 2018 +0100 Merge pull request #4508 from WordPress/update/theme-progress-bar Update theme progress color bar to match theme commit 64a4cf7 Author: Stephen Edgar <[email protected]> Date: Tue Jan 16 22:36:00 2018 +1100 Remove ESLint JSDoc checks, for now (#4510) commit 8a12860 Author: Joen Asmussen <[email protected]> Date: Tue Jan 16 12:01:15 2018 +0100 Update theme progress color bar to match theme This makes it so the animated updater matches the WordPress admin color scheme. commit 030dec3 Author: Joen Asmussen <[email protected]> Date: Tue Jan 16 11:38:58 2018 +0100 Fix focus issue with SVGs commit adbdbb7 Author: Joen Asmussen <[email protected]> Date: Tue Jan 16 11:35:57 2018 +0100 Try a different approach for styling movers commit db533fa Author: Joen Asmussen <[email protected]> Date: Tue Jan 16 11:12:39 2018 +0100 Try new focus styles commit f4fb4ad Author: Grzegorz (Greg) Ziółkowski <[email protected]> Date: Tue Jan 16 08:59:59 2018 +0100 Blocks: Add regression check for block edit using snapshot testing (#4399) commit 34930ca Merge: af74fa6 35b8e04 Author: Anton Timmermans <[email protected]> Date: Tue Jan 16 08:14:03 2018 +0100 Merge pull request #4493 from WordPress/update/jsdoc-returns-follow-up docs: add preceding line break and remove superfluous spacing in JSDoc `@returns` descriptions commit 35b8e04 Author: Stephen Edgar <[email protected]> Date: Tue Jan 16 09:34:20 2018 +1100 docs: add preceding line break and remove superfluous spacing in JSDoc `@returns` descriptions commit af74fa6 Merge: 3f54b38 a6b45ad Author: Robert Anderson <[email protected]> Date: Tue Jan 16 09:20:47 2018 +1100 Merge pull request #4395 from WordPress/fix/trigger-typing-mode-on-enter Trigger typing mode when ENTER is pressed commit 3f54b38 Author: Jorge <[email protected]> Date: Mon Jan 15 17:24:48 2018 +0000 Fixed erros when adding duplicate tags/flat terms. (#4487) If we get an error saying we have a duplicate tag/flat term (tag may have been added by other used since last time we fetched), we search the server for the new tag and we add it to our list. commit 2bdab14 Author: Tammie Lister <[email protected]> Date: Mon Jan 15 11:56:20 2018 +0000 Added in thrijith as contributor commit 79bb46e Author: Thrijith Thankachan <[email protected]> Date: Mon Jan 15 17:24:31 2018 +0530 Video Block: Change block description (#4448) commit ea36aa5 Author: Stephen Edgar <[email protected]> Date: Mon Jan 15 19:51:14 2018 +1100 chore: add `cypress.env.json` to `.gitignore` (#4466) commit a418f56 Merge: eb468a8 a2e070a Author: Joen Asmussen <[email protected]> Date: Mon Jan 15 09:21:44 2018 +0100 Merge pull request #4462 from rileybrook/update/conributing.md-workflow Update workflow steps in CONTRIBUTING.md documentation commit eb468a8 Author: Stephen Edgar <[email protected]> Date: Mon Jan 15 19:21:07 2018 +1100 chore: remove unused `react-markdown` npm module (#4461) commit 1e81e41 Author: Stephen Edgar <[email protected]> Date: Mon Jan 15 19:20:37 2018 +1100 docs: use `@returns` over `@return` JSDoc tag (#4464) Fixes per WordPress JavaScript Inline Coding Standards: • Use `@returns` over `@return` JSDoc tag fixing ESLint `jsdoc/check-tag-names` "Invalid JSDoc tag" warnings • Ensures there is a blank new line before the `@returns` JSDoc tag • Ensures the `@returns` JSDoc tag description ends with a period. See https://make.wordpress.org/core/handbook/best-practices/inline-documentation-standards/javascript/ commit a6b45ad Author: Robert Anderson <[email protected]> Date: Fri Jan 12 12:01:43 2018 +1100 Trigger typing mode when BACKSPACE is pressed commit 394c89b Author: Robert Anderson <[email protected]> Date: Thu Jan 11 15:50:22 2018 +1100 Trigger typing mode when ENTER is pressed Splitting a block or inserting a new paragraph block by pressing ENTER should engage typing mode. commit a2e070a Author: mac <[email protected]> Date: Sun Jan 14 19:41:18 2018 -0700 Update workflow steps in contributing.md documentation commit 38300ff Merge: 8ee2b1a 5d4e19d Author: Robert Anderson <[email protected]> Date: Mon Jan 15 10:53:43 2018 +1100 Merge pull request #4304 from WordPress/fix/content-sanitization Enable TinyMCE sanitization when setting HTML content commit 8ee2b1a Author: Gary Pendergast <[email protected]> Date: Mon Jan 15 09:04:18 2018 +1100 Force wp-api.js (via Backbone settings) to use HTTP/1.0 methods only. (#4396) commit 9fe1ddc Author: Gary Pendergast <[email protected]> Date: Mon Jan 15 09:00:10 2018 +1100 Build Tools: Add support for docker-compose.override.yml (#4457) As we don't actually use the `docker` directory to contain anything, the `docker-compose.yml` file has also been moved to the root directory. This tidies up a bunch of commands that used to have to refer to the special file location. commit ae9b07f Author: iseulde <[email protected]> Date: Fri Jan 12 17:16:05 2018 +0100 Remove BR logic from list block commit 8ac6cc8 Author: Riley Brook <[email protected]> Date: Fri Jan 12 09:37:26 2018 -0700 Size to Level (#4440) Changes copy from "Size" to Level" displayed within Heading block settings. commit 440d278 Merge: 66303b3 f0b7447 Author: Miguel Fonseca <[email protected]> Date: Fri Jan 12 13:32:04 2018 +0100 Merge pull request #4429 from WordPress/fix/gutenberg-activation-undefined-constant-warning Fix warning plugin activation commit f0b7447 Author: Miguel Fonseca <[email protected]> Date: Fri Jan 12 13:27:14 2018 +0100 Fix warning plugin activation Guard against undefined constant GUTENBERG_DEVELOPMENT_MODE. commit 66303b3 Author: Ella Van Dorpe <[email protected]> Date: Fri Jan 12 13:12:39 2018 +0100 Image: set width if aligned but unresized (#4356) commit cd7aa52 Author: Robert Anderson <[email protected]> Date: Fri Jan 12 23:09:18 2018 +1100 Fix the Custom Color button from appearing flat (#4392) This is a regression caused by #3958. commit 4d1ad21 Author: Matias Ventura <[email protected]> Date: Fri Jan 12 12:47:03 2018 +0100 Increase version to 2.0.0. (#4424) commit e495f6e Merge: d937d3a e81ab0a Author: Miguel Fonseca <[email protected]> Date: Fri Jan 12 12:16:25 2018 +0100 Merge pull request #4323 from WordPress/update/copy-from-ellipsis Ellipsis: Add button to copy entire document commit d937d3a Author: Riad Benguella <[email protected]> Date: Thu Jan 11 15:44:41 2018 +0100 Blocks: Style the "footer" in quotes to ensure backwards compatibility commit e81ab0a Author: Miguel Fonseca <[email protected]> Date: Thu Jan 4 19:58:52 2018 +0000 Ellipsis: Add button to copy entire document * Scrap `copyAll` shenanigan, use ClipboardButton * ClipboardButton: Accept additional onFinishCopy callback * Add component EditorActions below ModeSwitcher * Don't close menu on copy, show "Copied!" instead * MenuItems: Make it more reusable * Allow passing extra `classNames` to MenuItemsGroup, don't require a `label` * Change classes in MenuItemsToggle from `components-menu-items__toggle` to `components-menu-items__button is-toggle` * EllipsisMenu: Adopt areas Editor, Settings, Tools commit 27e6fa8 Author: Stephen Edgar <[email protected]> Date: Fri Jan 12 18:43:28 2018 +1100 Use tabs for indentation in build tools JSON files per WP Coding Standards (#4419) * chore: Update `.editorconfig` to match WordPress' upstream * chore: Use tabs for indentation in `package.json` and `package-lock.json` files * chore: Use tabs for indentation in `.eslines.json` file * chore: Use tabs for indentation in `composer.lock` file commit 9212841 Author: Grzegorz (Greg) Ziółkowski <[email protected]> Date: Fri Jan 12 08:18:57 2018 +0100 Docs: Update info about test fixtures (#4401) commit d129a6c Author: Joen Asmussen <[email protected]> Date: Fri Jan 5 11:21:41 2018 +0100 Fix issue where black rectangle would briefly blink on new paragraphs In master, if you press enter a lot and type a lot, a black rectangle sometimes briefly appears. This is the isEditing rectangle we use to indicate where the cursor is, if it's not in text, i.e. if you have a placeholder selected. This PR adds a teensy delay to this so it shouldn't show up. commit 5d4e19d Author: Robert Anderson <[email protected]> Date: Fri Jan 5 11:01:29 2018 +1100 Enable TinyMCE sanitization when setting HTML content We were previously disabling TinyMCE sanitization by calling setContent with `{ format: 'raw' }`. Doing so, however, causes issues when setContent is called with prettified HTML, e.g. when a list block is updated.
While using Contextual Related Posts plugin I've noted I was able to infinitely save unmodified posts & pages. After reporting them as a bug WebberZone/contextual-related-posts#205 they linked back to this issue. This feels bad for the UX / Workflow in my humble opinion. It gives me peace of mind when I see the button disabled. And the contrary creates me doubts, and insecurity on if I saved the last modification. I saw myself saving more than once, just in case...... This issue was from ~7 years ago. Many things may have changed around metaboxes / core. |
The best path forward for me is to move away from metaboxes. While we did ensure that metaboxes work in the block editor, they were and will never be first class citizen extensibility APIs. So I would recommend moving away from metaboxes in favor of regular block editor extensibility APIs. (for instance slots https://developer.wordpress.org/block-editor/reference-guides/slotfills/ ) and using the Data package to access and manipulate data. |
closes #4183 and closes #3975
Due to how MetaBoxes work it's not possible to dirty-check them properly. It's not possible to know if they contain default values as well. Thus, this PR removes the meta boxes dirty checking making Gutenberg work like the classic editor when there are active meta boxes which means: