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

Update the way we determine how a post has been edited #252

Closed
wants to merge 2 commits into from
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
2 changes: 1 addition & 1 deletion gutenberg
Submodule gutenberg updated 379 files
9 changes: 7 additions & 2 deletions src/app/AppContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ import { compose } from '@wordpress/compose';
import RNReactNativeGutenbergBridge from 'react-native-gutenberg-bridge';

import MainApp from './MainApp';
import type { BlockType } from '../store/types';
import type { PostType, BlockType } from '../store/types';

type PropsType = {
rootClientId: ?string,
post: PostType,
isBlockSelected: string => boolean,
showHtml: boolean,
editedPostContent: string,
Expand All @@ -29,7 +30,6 @@ type PropsType = {
onAttributesUpdate: ( string, mixed ) => mixed,
initialHtml: string,
setupEditor: ( mixed, ?mixed ) => mixed,
clientId: string,
};

class AppContainer extends React.Component<PropsType> {
Expand Down Expand Up @@ -92,6 +92,9 @@ class AppContainer extends React.Component<PropsType> {

toggleHtmlModeAction = () => {
this.props.onToggleBlockMode( this.props.rootClientId );
// eslint-disable-next-line no-console
console.log( 'isEditedPostDirty', this.props.isEditedPostDirty );
RNReactNativeGutenbergBridge.provideToNative_Html( html, this.props.isEditedPostDirty );
};

mergeBlocksAction = ( blockOneClientId, blockTwoClientId ) => {
Expand Down Expand Up @@ -128,6 +131,7 @@ export default compose( [
isBlockSelected,
getBlockMode,
getEditedPostContent,
isEditedPostDirty,
} = select( 'core/editor' );
const selectedBlockClientId = getSelectedBlockClientId();

Expand All @@ -137,6 +141,7 @@ export default compose( [
blocks: getBlocks( rootClientId ),
showHtml: getBlockMode( rootClientId ) === 'html',
editedPostContent: getEditedPostContent(),
isEditedPostDirty: isEditedPostDirty(),
};
} ),
withDispatch( ( dispatch ) => {
Expand Down
8 changes: 8 additions & 0 deletions src/store/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,11 @@ export type StateType = {
refresh: boolean,
fullparse: boolean,
};

export type PostType = {
id: number,
content: {
raw: string,
},
type: string,
};