Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions packages/block-editor/src/components/rich-text/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,6 @@ function RichTextWrapper(
const hasPastedBlocks = pastedBlocks.length > 0;
let lastPastedBlockIndex = -1;

// Consider the after value to be the original it is not empty and
// the before value *is* empty.
const isAfterOriginal = isEmpty( before ) && ! isEmpty( after );

// Create a block with the content before the caret if there's no pasted
// blocks, or if there are pasted blocks and the value is not empty.
// We do not want a leading empty block on paste, but we do if split
Expand All @@ -321,8 +317,7 @@ function RichTextWrapper(
toHTMLString( {
value: before,
multilineTag,
} ),
! isAfterOriginal
} )
)
);
lastPastedBlockIndex += 1;
Expand All @@ -349,8 +344,7 @@ function RichTextWrapper(
toHTMLString( {
value: after,
multilineTag,
} ),
isAfterOriginal
} )
)
);
}
Expand Down
23 changes: 7 additions & 16 deletions packages/block-library/src/heading/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ function HeadingEdit( {
mergeBlocks,
onReplace,
mergedStyle,
clientId,
} ) {
const { textAlign, content, level, placeholder } = attributes;
const tagName = 'h' + level;
Expand Down Expand Up @@ -62,23 +61,15 @@ function HeadingEdit( {
value={ content }
onChange={ ( value ) => setAttributes( { content: value } ) }
onMerge={ mergeBlocks }
onSplit={ ( value, isOriginal ) => {
let block;

if ( isOriginal || value ) {
block = createBlock( 'core/heading', {
...attributes,
content: value,
} );
} else {
block = createBlock( 'core/paragraph' );
}

if ( isOriginal ) {
block.clientId = clientId;
onSplit={ ( value ) => {
if ( ! value ) {
return createBlock( 'core/paragraph' );
}

return block;
return createBlock( 'core/heading', {
...attributes,
content: value,
} );
} }
onReplace={ onReplace }
onRemove={ () => onReplace( [] ) }
Expand Down
23 changes: 7 additions & 16 deletions packages/block-library/src/paragraph/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ function ParagraphBlock( {
onReplace,
onRemove,
setAttributes,
clientId,
} ) {
const {
align,
Expand Down Expand Up @@ -149,23 +148,15 @@ function ParagraphBlock( {
onChange={ ( newContent ) =>
setAttributes( { content: newContent } )
}
onSplit={ ( value, isOriginal ) => {
let newAttributes;

if ( isOriginal || value ) {
newAttributes = {
...attributes,
content: value,
};
}

const block = createBlock( name, newAttributes );

if ( isOriginal ) {
block.clientId = clientId;
onSplit={ ( value ) => {
if ( ! value ) {
return createBlock( name );
}

return block;
return createBlock( name, {
...attributes,
content: value,
} );
} }
onMerge={ mergeBlocks }
onReplace={ onReplace }
Expand Down
23 changes: 7 additions & 16 deletions packages/block-library/src/paragraph/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ function ParagraphBlock( {
setAttributes,
mergedStyle,
style,
clientId,
} ) {
const isRTL = useSelect( ( select ) => {
return !! select( blockEditorStore ).getSettings().isRTL;
Expand Down Expand Up @@ -57,23 +56,15 @@ function ParagraphBlock( {
content: nextContent,
} );
} }
onSplit={ ( value, isOriginal ) => {
let newAttributes;

if ( isOriginal || value ) {
newAttributes = {
...attributes,
content: value,
};
onSplit={ ( value ) => {
if ( ! value ) {
return createBlock( name );
}

const block = createBlock( name, newAttributes );

if ( isOriginal ) {
block.clientId = clientId;
}

return block;
return createBlock( name, {
...attributes,
content: value,
} );
} }
onMerge={ mergeBlocks }
onReplace={ onReplace }
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-aztec/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wordpress/react-native-aztec",
"version": "1.47.0",
"version": "1.48.0",
"description": "Aztec view for react-native.",
"private": true,
"author": "The WordPress Contributors",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-bridge/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wordpress/react-native-bridge",
"version": "1.47.0",
"version": "1.48.0",
"description": "Native bridge library used to integrate the block editor into a native App.",
"private": true,
"author": "The WordPress Contributors",
Expand Down
3 changes: 3 additions & 0 deletions packages/react-native-editor/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ For each user feature we should also add a importance categorization label to i

## Unreleased

## 1.48.0
* [**] Buttons block: added width setting. [#28543]

## 1.47.0
* [**] Add support for setting Cover block focal point. [#25810]

Expand Down
8 changes: 4 additions & 4 deletions packages/react-native-editor/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ PODS:
- DoubleConversion
- glog
- glog (0.3.5)
- Gutenberg (1.47.0):
- Gutenberg (1.48.0):
- React-Core (= 0.61.5)
- React-CoreModules (= 0.61.5)
- React-RCTImage (= 0.61.5)
Expand Down Expand Up @@ -253,7 +253,7 @@ PODS:
- React-Core
- RNSVG (9.13.6-gb):
- React-Core
- RNTAztecView (1.47.0):
- RNTAztecView (1.48.0):
- React-Core
- WordPress-Aztec-iOS (~> 1.19.4)
- WordPress-Aztec-iOS (1.19.4)
Expand Down Expand Up @@ -402,7 +402,7 @@ SPEC CHECKSUMS:
FBReactNativeSpec: 118d0d177724c2d67f08a59136eb29ef5943ec75
Folly: 30e7936e1c45c08d884aa59369ed951a8e68cf51
glog: 1f3da668190260b06b429bb211bfbee5cd790c28
Gutenberg: 103a9ebea785a8e1dd4c8bd4378d4a8a70efa678
Gutenberg: 670f7b82bc18bde86a516834b72b7eeded1011e8
RCTRequired: b153add4da6e7dbc44aebf93f3cf4fcae392ddf1
RCTTypeSafety: 9aa1b91d7f9310fc6eadc3cf95126ffe818af320
React: b6a59ef847b2b40bb6e0180a97d0ca716969ac78
Expand Down Expand Up @@ -435,7 +435,7 @@ SPEC CHECKSUMS:
RNReanimated: f05baf4cd76b6eab2e4d7e2b244424960b968918
RNScreens: 953633729a42e23ad0c93574d676b361e3335e8b
RNSVG: 46c4b680fe18237fa01eb7d7b311d77618fde31f
RNTAztecView: b1dfb9116d5947d9740145d3620cec703b529203
RNTAztecView: 985f01fae9ea8ce9cb18a6f7af9b571084d7c9f9
WordPress-Aztec-iOS: 870c93297849072aadfc2223e284094e73023e82
Yoga: f2a7cd4280bfe2cca5a7aed98ba0eb3d1310f18b

Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-editor/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wordpress/react-native-editor",
"version": "1.47.0",
"version": "1.48.0",
"description": "Mobile WordPress gutenberg editor.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
Expand Down