From b5b6b24d74c0aab5660f790a6c9b519f8b1f2aa8 Mon Sep 17 00:00:00 2001 From: David Calhoun Date: Tue, 14 Jan 2025 12:16:17 -0500 Subject: [PATCH 1/6] feat: GutenbergKit text editor Allow editing post content with the code editor. --- .../java/org/wordpress/android/ui/posts/EditPostActivity.kt | 3 ++- .../android/editor/gutenberg/GutenbergKitEditorFragment.java | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.kt b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.kt index b621e192b331..5a91f0a86751 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.kt @@ -1430,7 +1430,8 @@ class EditPostActivity : AppCompatActivity(), EditorFragmentActivity, EditorImag if (viewHtmlModeMenuItem != null) { viewHtmlModeMenuItem.setVisible( (((editorFragment is AztecEditorFragment) - || (editorFragment is GutenbergEditorFragment))) && showMenuItems + || (editorFragment is GutenbergEditorFragment) + || (editorFragment is GutenbergKitEditorFragment))) && showMenuItems ) viewHtmlModeMenuItem.setTitle( if (htmlModeMenuStateOn) R.string.menu_visual_mode else R.string.menu_html_mode) diff --git a/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergKitEditorFragment.java b/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergKitEditorFragment.java index 14a8e9943eff..0e86c1c89391 100644 --- a/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergKitEditorFragment.java +++ b/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergKitEditorFragment.java @@ -306,6 +306,7 @@ private void toggleHtmlMode() { mHtmlModeEnabled = !mHtmlModeEnabled; mEditorFragmentListener.onTrackableEvent(TrackableEvent.HTML_BUTTON_TAPPED); mEditorFragmentListener.onHtmlModeToggledInToolbar(); + mGutenbergView.setTextEditorEnabled(mHtmlModeEnabled); } @Override From 19a6a64e7131486069bf616aa24d97eddaff8718 Mon Sep 17 00:00:00 2001 From: David Calhoun Date: Tue, 14 Jan 2025 12:17:56 -0500 Subject: [PATCH 2/6] refactor: Simplify HTML mode button visibility toggle The `editorFragment` check includes all possible fragment types, thus it is unnecessary. Android Studio recommends using the property access syntax rather than the setter method. --- .../java/org/wordpress/android/ui/posts/EditPostActivity.kt | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.kt b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.kt index 5a91f0a86751..02b723c5e2db 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.kt @@ -1428,11 +1428,7 @@ class EditPostActivity : AppCompatActivity(), EditorFragmentActivity, EditorImag } previewMenuItem?.setVisible(showMenuItems) if (viewHtmlModeMenuItem != null) { - viewHtmlModeMenuItem.setVisible( - (((editorFragment is AztecEditorFragment) - || (editorFragment is GutenbergEditorFragment) - || (editorFragment is GutenbergKitEditorFragment))) && showMenuItems - ) + viewHtmlModeMenuItem.isVisible = showMenuItems viewHtmlModeMenuItem.setTitle( if (htmlModeMenuStateOn) R.string.menu_visual_mode else R.string.menu_html_mode) } From 102d7ef3ec902d00e8ea25222df8f57f53eb8d0b Mon Sep 17 00:00:00 2001 From: David Calhoun Date: Tue, 14 Jan 2025 14:42:51 -0500 Subject: [PATCH 3/6] build: Update GutenbergKit ref --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 7970c150ae24..3782bf5d06d9 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -71,7 +71,7 @@ google-play-services-auth = '20.4.1' google-services = '4.4.2' gravatar = '2.2.0' greenrobot-eventbus = '3.3.1' -gutenberg-kit = '55-a490cd3d2d70ad4bba501655f83fdc42b404d502' +gutenberg-kit = '60-5157e3ef7eeebac4d316a20560c5cb2689d63e42' gutenberg-mobile = 'v1.121.0' indexos-media-for-mobile = '43a9026f0973a2f0a74fa813132f6a16f7499c3a' jackson-databind = '2.12.7.1' From c30876fa5c7822ad36bee8da352423a7bd281239 Mon Sep 17 00:00:00 2001 From: David Calhoun Date: Tue, 14 Jan 2025 14:47:04 -0500 Subject: [PATCH 4/6] docs: Add release note --- RELEASE-NOTES.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index 16686245f8e4..37fcff853c8a 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -3,6 +3,7 @@ 25.7 ----- * [**] Send feedback from within the experimental editor "more" options menu. [#21586] +* [**] Support accessing the code editor within the experimental editor. [#21582] 25.6 ----- From acb9203c00ec13e32e2d8b5436034d196c2e69df Mon Sep 17 00:00:00 2001 From: David Calhoun Date: Wed, 15 Jan 2025 10:47:31 -0500 Subject: [PATCH 5/6] build: Update GutenbergKit ref --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 3782bf5d06d9..3d34352acd27 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -71,7 +71,7 @@ google-play-services-auth = '20.4.1' google-services = '4.4.2' gravatar = '2.2.0' greenrobot-eventbus = '3.3.1' -gutenberg-kit = '60-5157e3ef7eeebac4d316a20560c5cb2689d63e42' +gutenberg-kit = '60-2128c9167eeb779ac05d64675a632b0e42b79cfb' gutenberg-mobile = 'v1.121.0' indexos-media-for-mobile = '43a9026f0973a2f0a74fa813132f6a16f7499c3a' jackson-databind = '2.12.7.1' From be0696d93eb2af18c2b749920c25d9cfe8f4d825 Mon Sep 17 00:00:00 2001 From: David Calhoun Date: Thu, 16 Jan 2025 14:01:07 -0500 Subject: [PATCH 6/6] build: Update GutenbergKit ref --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 3d34352acd27..d602d78347a1 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -71,7 +71,7 @@ google-play-services-auth = '20.4.1' google-services = '4.4.2' gravatar = '2.2.0' greenrobot-eventbus = '3.3.1' -gutenberg-kit = '60-2128c9167eeb779ac05d64675a632b0e42b79cfb' +gutenberg-kit = 'trunk-cc52214a50893b41898607ac0bff7f2787b085bb' gutenberg-mobile = 'v1.121.0' indexos-media-for-mobile = '43a9026f0973a2f0a74fa813132f6a16f7499c3a' jackson-databind = '2.12.7.1'