From c799883af7260c8ec12f95882315b1263c3e39fa Mon Sep 17 00:00:00 2001 From: David Calhoun Date: Wed, 8 Jan 2025 15:58:19 -0500 Subject: [PATCH] feat: Expose undo/redo actions to the Android host app Enable navigating editor history from the host app. --- .../java/org/wordpress/gutenberg/GutenbergView.kt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/android/Gutenberg/src/main/java/org/wordpress/gutenberg/GutenbergView.kt b/android/Gutenberg/src/main/java/org/wordpress/gutenberg/GutenbergView.kt index 62f3c59..8bc9190 100644 --- a/android/Gutenberg/src/main/java/org/wordpress/gutenberg/GutenbergView.kt +++ b/android/Gutenberg/src/main/java/org/wordpress/gutenberg/GutenbergView.kt @@ -310,6 +310,18 @@ class GutenbergView : WebView { } } + fun undo() { + handler.post { + this.evaluateJavascript("editor.undo();", null) + } + } + + fun redo() { + handler.post { + this.evaluateJavascript("editor.redo();", null) + } + } + @JavascriptInterface fun onEditorLoaded() { Log.i("GutenbergView", "EditorLoaded received in native code")