From 1cae2ff0d86badf14b4a7ed31447231879c56f59 Mon Sep 17 00:00:00 2001 From: Emmanuel Lobo <76094069+UnschooledGamer@users.noreply.github.com> Date: Tue, 31 Mar 2026 13:26:35 +0530 Subject: [PATCH 1/5] Enhance Editor File API with pinned state features Added pinned state functionality and updated remove method options. --- docs/editor-components/editor-file.md | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/docs/editor-components/editor-file.md b/docs/editor-components/editor-file.md index f949508..216a467 100644 --- a/docs/editor-components/editor-file.md +++ b/docs/editor-components/editor-file.md @@ -3,7 +3,7 @@ The Editor File API provides functionality to create, manage, interact with files/tabs in the Acode editor. It handles file operations, state management, editor session control, custom editor tab, etc. ::: tip -This API is defined in the [Acode source code (src/lib/editorFile.js)](https://github.com/Acode-Foundation/Acode/blob/52bf3a59c4aebe422d8cfdecf5c85191ed6f6004/src/lib/editorFile.js). +This API is defined in the [Acode source code (src/lib/editorFile.js)](https://github.com/Acode-Foundation/Acode/blob/228a339296a3869fff7ff84e0898378a438931b8/src/lib/editorFile.js). ::: ## Import @@ -68,6 +68,7 @@ Both methods are equivalent and accept & return the same parameters. | uri | `string` | File location on the device | | eol | `'windows' \| 'unix'` | End of line character | | editable | `boolean` | Whether file can be edited | +| pinned | `boolean` | Whether the file is pinned | | isUnsaved | `boolean` | Whether file has unsaved changes | | name | `string` | File name (for plugin compatibility) | | cacheFile | `string` | Cache file URL | @@ -90,6 +91,7 @@ Both methods are equivalent and accept & return the same parameters. | uri | `string` | Set file location | | eol | `'windows' \| 'unix'` | Set end of line character | | editable | `boolean` | Set file editability | +| pinned | `boolean` | Set file pinned state | | readOnly | `boolean` | Set file readonly state | ## Methods @@ -110,11 +112,17 @@ Saves the file to a new location. await file.saveAs(); ``` -#### [remove(force = false)](#removeforce--false) +#### [remove(force = false, options = { ignorePinned = false, silentPinned = false })](#removeforce--false) Removes and closes the file. ```js await file.remove(true); // Force close without save prompt + +// Attempt to close a pinned tab, bypassing the pinned check +editorFile.remove(false, { ignorePinned: true }); + +// Attempt to close a pinned tab silently (toast suppressed) +editorFile.remove(false, { silentPinned: true }); ``` #### [makeActive()](#makeactive) @@ -131,6 +139,20 @@ Removes active state from the file. file.removeActive(); ``` +#### [setPinnedState(value: boolean, options = { reorder = false, emit = true })](#setPinnedState) +Updates Pinned State for the file, triggers reorder (if true), emits Events (editorManger `update` event with `pin-tab` as the first argument and affected File - second argument ) + +```js +file.setPinnedState(false, {}) + +editorManager.on("update", (action, file) => { + if(action === "pin-tab") doSomething(); +}); +``` + +#### [togglePinned()](#togglePinned) +Toggles the pinned State of the file + ### Editor Operations #### [setMode(mode)](#setmodemode) From 82797b03c017e597d820677455fa338e76acf9e2 Mon Sep 17 00:00:00 2001 From: Emmanuel Lobo <76094069+UnschooledGamer@users.noreply.github.com> Date: Tue, 31 Mar 2026 14:07:07 +0530 Subject: [PATCH 2/5] Update docs/editor-components/editor-file.md Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --- docs/editor-components/editor-file.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/editor-components/editor-file.md b/docs/editor-components/editor-file.md index 216a467..2c4654a 100644 --- a/docs/editor-components/editor-file.md +++ b/docs/editor-components/editor-file.md @@ -140,7 +140,7 @@ file.removeActive(); ``` #### [setPinnedState(value: boolean, options = { reorder = false, emit = true })](#setPinnedState) -Updates Pinned State for the file, triggers reorder (if true), emits Events (editorManger `update` event with `pin-tab` as the first argument and affected File - second argument ) +Updates Pinned State for the file, triggers reorder (if true), emits Events (editorManager `update` event with `pin-tab` as the first argument and affected File - second argument ) ```js file.setPinnedState(false, {}) From 644251de2067f19c3582f7d216d19f81ac54afa4 Mon Sep 17 00:00:00 2001 From: Emmanuel Lobo <76094069+UnschooledGamer@users.noreply.github.com> Date: Tue, 31 Mar 2026 14:07:31 +0530 Subject: [PATCH 3/5] Update docs/editor-components/editor-file.md Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --- docs/editor-components/editor-file.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/editor-components/editor-file.md b/docs/editor-components/editor-file.md index 2c4654a..2101579 100644 --- a/docs/editor-components/editor-file.md +++ b/docs/editor-components/editor-file.md @@ -119,10 +119,11 @@ Removes and closes the file. await file.remove(true); // Force close without save prompt // Attempt to close a pinned tab, bypassing the pinned check -editorFile.remove(false, { ignorePinned: true }); +// Attempt to close a pinned tab, bypassing the pinned check +await file.remove(false, { ignorePinned: true }); // Attempt to close a pinned tab silently (toast suppressed) -editorFile.remove(false, { silentPinned: true }); +await file.remove(false, { silentPinned: true }); ``` #### [makeActive()](#makeactive) From 9e6617c67690ad3091c04964211f6deea973881a Mon Sep 17 00:00:00 2001 From: Emmanuel Lobo <76094069+UnschooledGamer@users.noreply.github.com> Date: Tue, 31 Mar 2026 14:07:58 +0530 Subject: [PATCH 4/5] Update docs/editor-components/editor-file.md Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --- docs/editor-components/editor-file.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/editor-components/editor-file.md b/docs/editor-components/editor-file.md index 2101579..48ad95c 100644 --- a/docs/editor-components/editor-file.md +++ b/docs/editor-components/editor-file.md @@ -140,7 +140,7 @@ Removes active state from the file. file.removeActive(); ``` -#### [setPinnedState(value: boolean, options = { reorder = false, emit = true })](#setPinnedState) +#### [setPinnedState(value: boolean, options = { reorder = false, emit = true })](#setpinnedstate) Updates Pinned State for the file, triggers reorder (if true), emits Events (editorManager `update` event with `pin-tab` as the first argument and affected File - second argument ) ```js From d3c9c3dc8c35a197ac8d07000e81ccc14b42b245 Mon Sep 17 00:00:00 2001 From: Emmanuel Lobo <76094069+UnschooledGamer@users.noreply.github.com> Date: Tue, 31 Mar 2026 14:08:52 +0530 Subject: [PATCH 5/5] Update docs/editor-components/editor-file.md Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --- docs/editor-components/editor-file.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/editor-components/editor-file.md b/docs/editor-components/editor-file.md index 48ad95c..f858adf 100644 --- a/docs/editor-components/editor-file.md +++ b/docs/editor-components/editor-file.md @@ -151,9 +151,12 @@ editorManager.on("update", (action, file) => { }); ``` -#### [togglePinned()](#togglePinned) +#### [togglePinned()](#togglepinned) Toggles the pinned State of the file +```js +file.togglePinned(); + ### Editor Operations #### [setMode(mode)](#setmodemode)