diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java index 71ef5830b394..744e3c07e942 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java @@ -1208,6 +1208,7 @@ public boolean onPrepareOptionsMenu(Menu menu) { MenuItem viewHtmlModeMenuItem = menu.findItem(R.id.menu_html_mode); MenuItem historyMenuItem = menu.findItem(R.id.menu_history); MenuItem settingsMenuItem = menu.findItem(R.id.menu_post_settings); + MenuItem helpMenuItem = menu.findItem(R.id.menu_editor_help); if (secondaryAction != null && mEditPostRepository.hasPost()) { secondaryAction.setVisible(showMenuItems && getSecondaryAction().isVisible()); @@ -1269,6 +1270,17 @@ public boolean onPrepareOptionsMenu(Menu menu) { contentInfo.setVisible(false); // only show the menu item when for Gutenberg } + if (helpMenuItem != null) { + if (mEditorFragment instanceof GutenbergEditorFragment + && BuildConfig.DEBUG + && showMenuItems + ) { + helpMenuItem.setVisible(true); + } else { + helpMenuItem.setVisible(false); + } + } + return super.onPrepareOptionsMenu(menu); } @@ -1452,6 +1464,11 @@ public boolean onOptionsItemSelected(final MenuItem item) { } else { logWrongMenuState("Wrong state in menu_switch_to_gutenberg: menu should not be visible."); } + } else if (itemId == R.id.menu_editor_help) { + // Display the editor help page -- option should only be available in the GutenbergEditor + if (mEditorFragment instanceof GutenbergEditorFragment) { + ((GutenbergEditorFragment) mEditorFragment).showEditorHelp(); + } } } return false; diff --git a/WordPress/src/main/res/menu/edit_post.xml b/WordPress/src/main/res/menu/edit_post.xml index 6d0d3e1e11c4..9bcedfe70bc6 100644 --- a/WordPress/src/main/res/menu/edit_post.xml +++ b/WordPress/src/main/res/menu/edit_post.xml @@ -48,5 +48,10 @@ android:title="@string/post_settings" > + + + diff --git a/build.gradle b/build.gradle index 887e452954e3..833f26a51ae2 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ buildscript { ext.wordPressUtilsVersion = 'develop-bb54ee34c5fec5fa7375ce90a356adb5adbdcae0' ext.wordPressLoginVersion = '0.0.2' ext.detektVersion = '1.15.0' - ext.gutenbergMobileVersion = 'develop-976e2830586f1679fabc297ebab5fac5b1f5fadf' + ext.gutenbergMobileVersion = 'v1.57.0-alpha2' repositories { maven { diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/AztecEditorFragment.java b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/AztecEditorFragment.java index b952aca208f7..50a985a1e482 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/AztecEditorFragment.java +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/AztecEditorFragment.java @@ -1662,6 +1662,9 @@ public void showNotice(String message) { ToastUtils.showToast(getActivity(), message).show(); } + @Override public void showEditorHelp() { + } + private void onMediaTapped(@NonNull final AztecAttributes attrs, int naturalWidth, int naturalHeight, final MediaType mediaType) { if (mediaType == null || !isAdded()) { diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/EditorFragmentAbstract.java b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/EditorFragmentAbstract.java index 51c713c0f88a..47ce195add7a 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/EditorFragmentAbstract.java +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/EditorFragmentAbstract.java @@ -47,6 +47,7 @@ public class EditorFragmentNotAddedException extends Exception { public abstract void removeMedia(String mediaId); // Called from EditPostActivity to let the block editor know when a media selection is cancelled public abstract void mediaSelectionCancelled(); + public abstract void showEditorHelp(); public enum MediaType { diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergContainerFragment.java b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergContainerFragment.java index aa34ad3cf1c2..46fdffe377fc 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergContainerFragment.java +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergContainerFragment.java @@ -226,6 +226,10 @@ public void showNotice(String message) { mWPAndroidGlueCode.showNotice(message); } + public void showEditorHelp() { + mWPAndroidGlueCode.showEditorHelp(); + } + public void updateCapabilities(GutenbergPropsBuilder gutenbergPropsBuilder) { // We want to make sure that activity isn't null // as it can make this crash to happen: https://github.com/wordpress-mobile/WordPress-Android/issues/13248 diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java index afa77f8e9c6a..8a98fb99389f 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java @@ -1397,6 +1397,11 @@ public void showNotice(String message) { getGutenbergContainerFragment().showNotice(message); } + @Override + public void showEditorHelp() { + getGutenbergContainerFragment().showEditorHelp(); + } + @Override public void onGutenbergDialogPositiveClicked(@NotNull String instanceTag, int mediaId) { switch (instanceTag) {