-
Notifications
You must be signed in to change notification settings - Fork 67
Description
This update introduces a new openFile hook to the AttachesTool config.
It allows custom file-opening logic beyond the default browser behavior.
This is especially useful for:
- WebView environments (Android/iOS apps)
- Desktop applications that embed Editor.js
- Custom file viewers / sandboxed environments
When the hook is present, openFile(fileData) is executed instead of opening file.url in a new tab.
If the hook is missing or throws an error — the fallback browser action is triggered.
📌 Why this is useful
✔ Works in Android WebView
Browser links (target=_blank) do not work in WebView — but you can call the Android method.
🧩 Short PR Example Description
Added a new config option openFile to AttachesTool.
If provided, it overrides the default action when the user clicks the file icon.
Useful for WebView apps (Android/iOS), desktop clients, and custom environments where
opening external URLs is restricted. Falls back to the standard browser behavior
when not defined.