Skip to content

Commit eabe3da

Browse files
committed
2 parents ee8a156 + 2b32b7a commit eabe3da

File tree

1 file changed

+47
-5
lines changed

1 file changed

+47
-5
lines changed

readme.md

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,39 @@
11
# acode-plugin
22

33
To create plugin for Acode editor use this template. To use this template create a github repository and add `https://github.com/deadlyjack/acode-plugin` as template.
4+
<details open>
5+
<summary><h2 style="display:inline;" id="toc">Table of Contents</h2></summary>
6+
7+
* [Required Files of a plugin](#required-files)
8+
* [How to add a plugin to Acode](#add-your-plugin-to-acode)
9+
* [Available plugin references](#plugin-development)
10+
* [How to test a plugin](#testing)
11+
- [Requirement](#requirement)
12+
* [Global APIs](#global-apis)
13+
- [editorManager](#editormanager)
14+
- [acode](#acode)
15+
- [actionStack](#actionstack)
16+
- [appSettings](#appsettings)
17+
- [Events](#events)
18+
- [Toast](#show-toast)
19+
- [Data Storage](#data-storage)
20+
- [Cache Storage](#cache-storage)
21+
* [Native APIs](#native-apis)
22+
- [FsOperation](#fsoperation)
23+
- [WcPage](#wcpage)
24+
25+
</details>
426

527
## Required Files
628

29+
[:arrow_up: TOC](#toc)
30+
731
- plugin.json - contains information about the plugin.
832

933
- id - plugin should have unique id. E.g. com.example.my-plugin
1034
- name - plugin name.
1135
- version - plugin version, if changes an update notificaiton will be sent to users.
12-
- main - plugins main js file.
36+
- main - path of plugin's main js file.
1337
- icon - plugin icon.
1438
- readme - readme file.
1539
- files - list of all files that are required by the plugin.
@@ -25,6 +49,8 @@ Transpile your javascript file using babel so that your plugin can work on older
2549

2650
## Add your plugin to Acode
2751

52+
[:arrow_up: TOC](#toc)
53+
2854
To add your plugin, fork [this](https://github.com/deadlyjack/acode-plugins) repository, clone it, add your plugin information to `list.json` and make a pull request.
2955

3056
To initialize your plugin, use `acode.setPluginInit` method. This method requires two arguments.
@@ -46,30 +72,36 @@ You also need to set an unmount function, this is called when user choose to uni
4672

4773
## Plugin Development
4874

49-
You can take reference from already available plugins [acode-plugin-python](https://github.com/deadlyjack/acode-plugin-python) and [acode-plugin-prettier](https://github.com/deadlyjack).
75+
You can take reference from already available plugins [acode-plugin-python](https://github.com/deadlyjack/acode-plugin-python), [acode-plugin-prettier](https://github.com/deadlyjack/acode-plugin-prettier) and [acode-plugin-snippets](https://github.com/deadlyjack/acode-plugin-snippets).
5076

5177
## Testing
5278

79+
[:arrow_up: TOC](#toc)
80+
5381
1. Open plugin project in VScode.
5482

5583
2. Install 'live server' extension. Enable 'https' for live server and start the server
5684

57-
3. Go to `settings > plugin > tap '+' icon in top right corner`.
85+
3. Open Acode and go to `settings > plugins > tap '+' icon in top right corner`.
5886

59-
4. Add plugin locaion, e.g. https: &frasl; &frasl; 192.168.1.100:500 and click on install.
87+
4. Add plugin locaion, e.g. `https://192.168.1.100:500` and click on install.
6088

6189
### Requirement
6290

6391
- [Nodejs](https://nodejs.org/en/)
6492
- Cordova
6593
- Android Studio
6694

67-
## Global API
95+
## Global APIs
96+
97+
[:arrow_up: TOC](#toc)
6898

6999
The global variables that you can use them directly in your plugin.
70100

71101
### editorManager
72102

103+
[:arrow_up: TOC](#toc)
104+
73105
- `editor: AceAjax.Editor` [Ace editor](https://ace.c9.io/#nav=api&api=editor)
74106
- `addNewFile(filename?:string, options?): void` add a new file in workspace.
75107

@@ -114,6 +146,8 @@ The global variables that you can use them directly in your plugin.
114146

115147
### acode
116148

149+
[:arrow_up: TOC](#toc)
150+
117151
- `exec(command: string, value: any)`
118152
- `setPluginInit(id: string, initfuntion(): void)`
119153
- `setPluginUnmount(id: string, unmountFunction(): void)`
@@ -122,6 +156,8 @@ The global variables that you can use them directly in your plugin.
122156

123157
### actionStack
124158

159+
[:arrow_up: TOC](#toc)
160+
125161
- `push(action: Object): void` Pushes a callback function to actionStack. When use tap on physical/virtual back button, the given callback function is triggered.
126162

127163
- action
@@ -136,6 +172,8 @@ The global variables that you can use them directly in your plugin.
136172

137173
### appSettings
138174

175+
[:arrow_up: TOC](#toc)
176+
139177
- `value` all settings.
140178
- `on(event: string, listener(setting: any): void): void` attaches event listener.
141179
- `off(event: string, listener(setting: any): void): void` removes event listener.
@@ -161,6 +199,8 @@ Function `window.toast(msg: string, milliSecond: number): void` will show a toas
161199

162200
## Native APIs
163201

202+
[:arrow_up: TOC](#toc)
203+
164204
To access native features and method of device use these [plugins](https://github.com/deadlyjack/Acode/tree/main/src/plugins). For example to open a file using SAF
165205

166206
```javascript
@@ -180,6 +220,8 @@ To get more info api provided by these plugins see there `js` files in `www` dir
180220

181221
### FsOperation
182222

223+
[:arrow_up: TOC](#toc)
224+
183225
- `lsDir(): Promise<Array<Entry>>`
184226
- `readFile(encoding: string | ArrayBuffer): Promise<string | ArrayBuffer>`
185227
- `createFile(name: string, content?: string): Promise<string>`

0 commit comments

Comments
 (0)