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

Plugin: Deprecate window._wpLoadGutenbergEditor #13547

Merged
merged 1 commit into from
Jan 29, 2019

Conversation

aduth
Copy link
Member

@aduth aduth commented Jan 28, 2019

This pull request seeks to deprecate window._wpLoadGutenbergEditor in favor of the core-defined window._wpLoadBlockEditor. At this time, _wpLoadBlockEditor is in-fact defined by Gutenberg, but in subsequent revisions it will be dropped in favor of relying on the core behavior instead.

This is a private API and was not intended to be used by plugins, but is proposed to undergo the standard deprecation lifetime, since it's been seen to be used by plugins to act on the editor upon its being loaded.

Ideally a plugin should never use this promise, leveraging instead (depending on their use):

  • Nothing; just execute code when the script is loaded. This also assumes that the plugin defines their dependencies correctly, rather than incidentally relying on the editor's own dependencies (which is fragile to begin with)
  • Detect editor initialization by responding to changes in data state

Testing instructions:

Verify there are no regressions in the loading of the editor, and no console warnings by default.

Verify that by attempting to reference the _wpLoadGutenbergEditor global variable, it (a) logs to the console and (b) still works as intended.

window._wpLoadGutenbergEditor.then( () => console.log( 'Loaded' ) );

(Depending on your browser, the logging may occur without actually pressing Enter in your Developer Tools Console. For example, Chrome evaluates the variable before it's run, triggering the getter behavior to log the warning)

@aduth aduth added Gutenberg Plugin Issues or PRs related to Gutenberg Plugin management related efforts Good First Review A PR that's suitable for someone looking to contribute for the first time by reviewing code labels Jan 28, 2019
@youknowriad youknowriad added this to the 5.0 (Gutenberg) milestone Jan 29, 2019
@aduth aduth merged commit 4165bbd into master Jan 29, 2019
@aduth aduth deleted the deprecate/load-gutenberg-editor branch January 29, 2019 16:37
daniloercoli added a commit that referenced this pull request Jan 30, 2019
…rnmobile/372-use-RichText-on-Title-block

* 'master' of https://github.com/WordPress/gutenberg: (36 commits)
  Fixes plural messages POT generation. (#13577)
  Typo fix (#13595)
  REST API: Remove oEmbed proxy HTML filtering (#13575)
  Removed unnecessary className attribute. Fixes #11664 (#11831)
  Add changelog for RSS block (#13588)
  Components: Set type=button for TabPanel button elements. (#11944)
  Update util.js (#13582)
  Docs: Add accessbility specific page (#13169)
  Rnmobile/media methods refactor (#13554)
  chore(release): publish
  chore(release): publish
  Plugin: Deprecate gutenberg_get_script_polyfill (#13536)
  Block API: Parse entity only when valid character reference (#13512)
  RichText: List: fix indentation (#13563)
  Plugin: Deprecate window._wpLoadGutenbergEditor (#13547)
  Plugin: Avoid setting generic "Edit Post" title on load (#13552)
  Plugin: Populate demo content by default content filters (#13553)
  RichText: List: Fix getParentIndex (#13562)
  RichText: List: Fix outdent with children (#13559)
  Scripts: Remove npm run build from test-e2e default run (#13420)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good First Review A PR that's suitable for someone looking to contribute for the first time by reviewing code Gutenberg Plugin Issues or PRs related to Gutenberg Plugin management related efforts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants