Skip to content

issue #7549 : content editor toolbar/context menu (help for #7550)#7576

Merged
hansva merged 5 commits into
apache:mainfrom
mattcasters:help-7550-content-editor
Jul 20, 2026
Merged

issue #7549 : content editor toolbar/context menu (help for #7550)#7576
hansva merged 5 commits into
apache:mainfrom
mattcasters:help-7550-content-editor

Conversation

@mattcasters

Copy link
Copy Markdown
Contributor

Summary

Helps unblock @nadment's #7550 / #7549.

Includes Nicolas's original change (shared content-editor toolbar + context menu on RCP, cut/paste capabilities on text file types) plus fixes for the three gaps he called out:

  1. RAP compileIContentEditorWidget.getLanguage() implemented on Monaco and fallback RAP widgets (CI was failing on hop-ui-rap).
  2. Shared toolbar on hop-web — RAP builds ContentEditor-Toolbar so plugin actions (Markdown preview) show in web, not only desktop.
  3. Markdown preview listenerBaseGuiWidgets resolves static toolbar methods with assignable parameter types (interface/facade), so previewMarkdown(IContentEditorWidget) works when the registered instance is ContentEditorWidget or a RAP widget. Preview is restored as that static method.

Also dedupes content-editor i18n keys and adds a small unit test for static listener resolution.

Nicolas: if you prefer to keep ownership on #7550, you can cherry-pick d221789455 (or merge this branch) into 7549 and close this PR.

Test plan

  • ./mvnw -pl ui,rcp,rap,plugins/transforms/textfile -am install -DskipTests (includes hop-ui-rap)
  • ./mvnw -pl ui test -Dtest=BaseGuiWidgetsStaticListenerTest
  • ./mvnw -pl plugins/transforms/textfile,rcp test
  • Manual RCP: open .md → shared toolbar Preview works; cut/copy/paste/context menu on text
  • Manual hop-web: open .md → Preview button visible and works

nadment and others added 2 commits July 19, 2026 16:22
…review

Unblock PR apache#7550 by addressing the three gaps Nicolas hit:

- RAP implements getLanguage() and builds the shared ContentEditor
  toolbar so plugin actions (Markdown preview) appear in hop-web.
- BaseGuiWidgets resolves static toolbar listeners with assignable
  parameter types (interface/facade), so previewMarkdown(IContentEditorWidget)
  works when the registered instance is ContentEditorWidget or RAP widgets.
- Markdown preview is a static listener taking IContentEditorWidget;
  dedupe content-editor i18n keys.
@nadment

nadment commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

For the RCP client, it works like a charm: you're a genius and so fast!
We'll keep your PR, and I'll close my old one.

@mattcasters

Copy link
Copy Markdown
Contributor Author

I don't know. I'm still seeing issues but perhaps I need to rebuild my Hop Web container.

@mattcasters

Copy link
Copy Markdown
Contributor Author

you're a genius

Flattering always works but to be completely fair it's Grok Build 4.5 doing the heavy lifting.

@nadment nadment linked an issue Jul 19, 2026 that may be closed by this pull request
Move ContentEditor-Toolbar @GuiToolbarElement handlers to a ui-module
GuiPlugin (ContentEditorActions) so Hop Web registers undo/copy/etc.
without loading hop-ui-rcp.

- Extend IContentEditorWidget with cut/paste/undo/redo
- RCP ContentEditorWidget keeps context menu + keyboard shortcuts
- RAP implements new ops (Text cut/paste; Monaco no-ops for now)
- Exclude hop-ui-rcp from Hop Web image (fixes Tomcat 404 startup)
- Skip ContentEditorWidget GuiPlugin scan on web as defense in depth
…alog

Temp file:// URLs open on the client browser, so server-side temp HTML
never displays in Hop Web. Use ShowBrowserDialog for the RAP case;
desktop keeps the system browser + temp file path.

Also surface InvocationTargetException from static toolbar listeners
instead of silently falling through to a failed instance-method path.
@mattcasters

Copy link
Copy Markdown
Contributor Author

Pushed additional commits after Hop Web validation:

  • Exclude hop-ui-rcp from Hop Web packaging (fixes context startup / 404)
  • Shared ContentEditorActions GuiPlugin for content-editor toolbar on desktop + web
  • Markdown preview on Hop Web via in-app ShowBrowserDialog (file:// temp files do not work for RAP clients)

Verified locally: toolbars above text editors, Preview only for Markdown, Preview dialog works in Hop Web.

Pass PropsUi dark mode into the Monaco remote widget as theme vs-dark
or vs (same pattern as canvas themeId). monaco-editor.js honors the
theme property on create and via setTheme.
@mattcasters

Copy link
Copy Markdown
Contributor Author

Pushed: Monaco dark theme for Hop Web content editors.

When the session is dark (PropsUi.isDarkMode() / /ui-dark), Monaco is created with theme vs-dark; light sessions use vs. Same idea as canvas themeId.

Try: http://localhost:8080/ui-dark → open a text/markdown file → editor background should match the dark UI.

@mattcasters

Copy link
Copy Markdown
Contributor Author
image

@hansva
hansva merged commit 6dbab9a into apache:main Jul 20, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a context menu and missing capability to the text editor

3 participants