capacitor-sora-editor 1.8.1 → 1.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +36 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -199,5 +199,41 @@ The Android source is located in `android/src/main/java/com/abc15018045126/capac
199
199
  | `cursorWidth` | `number` | `2.0` | Width of the cursor caret in px |
200
200
  | `horizontalPadding` | `number` | `12` | Left/right editor padding |
201
201
 
202
+ ## 6. Android Content URI & Permissions Guide
203
+
204
+ If you are using this plugin on Android 11+ (SDK level 30+) and want to edit files outside of your app's scoped storage (e.g., in `Documents/Repo`), you must handle two critical things:
205
+
206
+ ### 1. File Access Permissions
207
+ To access absolute paths (e.g., `/storage/emulated/0/...`), your app likely needs the `MANAGE_EXTERNAL_STORAGE` permission. Standard broad filesystem access is restricted on modern Android.
208
+
209
+ **Step 1:** Add permission to `AndroidManifest.xml`:
210
+ ```xml
211
+ <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
212
+ ```
213
+
214
+ **Step 2:** Request permission at runtime. Capacitor's built-in `Filesystem` plugin only requests scoped storage permissions. You may need a custom plugin or simple native code to trigger `Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION`.
215
+
216
+ ### 2. Resolving Content URIs
217
+ When using the system file picker (like `@capawesome/capacitor-file-picker`), Android returns `content://` URIs (e.g., `content://com.android.providers.media.documents/document/document%3A1234`).
218
+ **Sora Editor cannot always open `content://` URIs directly.** It strongly prefers `file://` URIs or absolute paths for optimal performance and file system access.
219
+
220
+ **You must resolve `content://` URIs to absolute paths before passing them to `openEditor`.**
221
+
222
+ #### Example Solution
223
+ Do not pass the raw result from a Content URI based file picker directly unless you are sure it resolves to a file descriptor we can use. For best results with `MANAGE_EXTERNAL_STORAGE`:
224
+
225
+ ```typescript
226
+ // BAD (Might fail if the editor expects a File object)
227
+ await SoraEditor.openEditor({ filePath: 'content://com.android...' });
228
+
229
+ // GOOD
230
+ const absolutePath = '/storage/emulated/0/MyFolder/MyFile.txt';
231
+ await SoraEditor.openEditor({
232
+ filePath: 'file://' + absolutePath
233
+ });
234
+ ```
235
+
236
+ *Note: You will need to implement the URI-to-Path resolution in your native Android code, as JavaScript cannot directly access the mapping between Content IDs and file paths.*
237
+
202
238
  ## License
203
239
  MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "capacitor-sora-editor",
3
- "version": "1.8.1",
3
+ "version": "1.8.2",
4
4
  "description": "SoraEditor plugin for Capacitor",
5
5
  "main": "dist/plugin.js",
6
6
  "module": "dist/esm/index.js",