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

[RNMobile] create undo level less frequently #24116

Merged
merged 7 commits into from
Aug 11, 2020
Merged
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
2 changes: 2 additions & 0 deletions packages/editor/src/components/provider/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ const postTypeEntities = [
...postTypeEntity,
transientEdits: {
blocks: true,
selectionStart: true,
selectionEnd: true,
},
mergedEdits: {
meta: true,
Expand Down
6 changes: 3 additions & 3 deletions packages/rich-text/src/component/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import RCTAztecView from '@wordpress/react-native-aztec';
import { View, Platform } from 'react-native';
import { addMention } from '@wordpress/react-native-bridge';
import { get, pickBy } from 'lodash';
import { get, pickBy, debounce } from 'lodash';
import memize from 'memize';

/**
Expand Down Expand Up @@ -94,7 +94,7 @@ export class RichText extends Component {
this.formatToValue = memize( this.formatToValue.bind( this ), {
maxSize: 1,
} );

this.debounceCreateUndoLevel = debounce( this.onCreateUndoLevel, 1000 );
// This prevents a bug in Aztec which triggers onSelectionChange twice on format change
this.onSelectionChange = this.onSelectionChange.bind( this );
this.onSelectionChangeFromAztec = this.onSelectionChangeFromAztec.bind(
Expand Down Expand Up @@ -283,7 +283,7 @@ export class RichText extends Component {
const contentWithoutRootTag = this.removeRootTagsProduceByAztec(
unescapeSpaces( event.nativeEvent.text )
);

this.debounceCreateUndoLevel();
const refresh = this.value !== contentWithoutRootTag;
this.value = contentWithoutRootTag;

Expand Down