-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WP.com block editor: Exclude features from Jetpack sites (#38248)
We shouldn't expose all the common features from `wpcom-block-editor` to Jetpack sites, since some of them are intended specifically for WP.com users such as: - Unregister experimental blocks. - Reorder CoBlocks blocks. This PR seeks to fix that by splitting the `common` features into 2 new bundles: - `default`: loaded on all sites. - `wpcom`: loaded only on WP.com sites. The `common` bundle is no longer maintained and it is replaced by the `default` bundle. Note that the `common` build needs to keep being served on `widgets.wp.com` since it will be still used by Jetpack and Atomic sites running Jetpack 8.0 or earlier.
- Loading branch information
Showing
28 changed files
with
306 additions
and
206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import './features/iframe-bridge-server'; | ||
|
||
/** | ||
* Style dependencies | ||
*/ | ||
import './editor.scss'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@import './features/iframe-bridge-server'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
|
||
/** | ||
* External dependencies | ||
*/ | ||
import tinymce from 'tinymce/tinymce'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { inIframe, sendMessage } from '../utils'; | ||
|
||
function replaceMediaModalOnClassicBlocks() { | ||
if ( ! inIframe() ) { | ||
return; | ||
} | ||
|
||
tinymce.PluginManager.add( 'gutenberg-wpcom-iframe-media-modal', editor => { | ||
editor.addCommand( 'WP_Medialib', () => { | ||
sendMessage( { | ||
action: 'classicBlockOpenMediaModal', | ||
editorId: editor.id, | ||
} ); | ||
} ); | ||
|
||
editor.buttons.wp_img_edit.onclick = () => { | ||
const img = editor.selection.getNode(); | ||
const imageId = img.className.match( /wp-image-(\d+)/ )[ 1 ]; | ||
sendMessage( { | ||
action: 'classicBlockOpenMediaModal', | ||
editorId: editor.id, | ||
imageId: imageId, | ||
} ); | ||
}; | ||
} ); | ||
} | ||
|
||
replaceMediaModalOnClassicBlocks(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,4 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import tinymce from 'tinymce/tinymce'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { inIframe, sendMessage } from './utils'; | ||
|
||
function replaceMediaModalOnClassicBlocks() { | ||
if ( ! inIframe() ) { | ||
return; | ||
} | ||
|
||
tinymce.PluginManager.add( 'gutenberg-wpcom-iframe-media-modal', editor => { | ||
editor.addCommand( 'WP_Medialib', () => { | ||
sendMessage( { | ||
action: 'classicBlockOpenMediaModal', | ||
editorId: editor.id, | ||
} ); | ||
} ); | ||
|
||
editor.buttons.wp_img_edit.onclick = () => { | ||
const img = editor.selection.getNode(); | ||
const imageId = img.className.match( /wp-image-(\d+)/ )[ 1 ]; | ||
sendMessage( { | ||
action: 'classicBlockOpenMediaModal', | ||
editorId: editor.id, | ||
imageId: imageId, | ||
} ); | ||
}; | ||
} ); | ||
} | ||
|
||
replaceMediaModalOnClassicBlocks(); | ||
import './features/tinymce'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
40 changes: 0 additions & 40 deletions
40
apps/wpcom-block-editor/src/common/fix-block-invalidation-errors.js
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.