Template for developing plugins for Acode editor.

Overview

acode-plugin

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.

Required Files

  • plugin.json - contains information about the plugin.

    • id - plugin should have unique id. E.g. com.example.my-plugin

    • name - plugin name.

    • version - plugin version, if changes an update notificaiton will be sent to users.

    • main - plugins main js file.

    • icon - plugin icon.

    • readme - readme file.

    • files - list of all files that are required by the plugin.

    • author - author of the plugin

      • name - name of the author
      • email - email of the author
      • github - github username of the author
  • icon.png - icon for the plugin

Transpile your javascript file using babel so that your plugin can work on older android devices. This template already has all the configuration that is required to tranpile your javascipt file and scss file. You need to run yarn build command to bundle your code. To build for production run yarn build --mode production.

Add your plugin to Acode

To add your plugin, fork this repository, clone it, add your plugin information to list.json and make a pull request.

To initialize your plugin, use acode.setPluginInit method. This method requires two arguments.

  • plugin id

  • callback funtion, callback function will receive three arguments.

    • baseUrl, it contains the location of the plugin files. To get plugin files from the device, concat baseUrl and file name. E.G. baseUrl + 'script.js'.

    • $page, a page that your plugin can use to show output if required.

    • cacheFile, an Object that contains url and fs for cacheFile

      • cachefile, use this write and read from cache file specially for this plugin.
      • cacheFileUrl, url of the cache file.

You also need to set an unmount function, this is called when user choose to uninstall the plugin. acode.setPluginUnmount method can be used to set unmount function. This method requires two arguments.

  • plugin id
  • callback function

Plugin Development

You can take reference from already available plugins acode-plugin-python and acode-plugin-prettier.

Testing

  1. To test your plugin clone Acode repository.

  2. Change your local IP in this file.

  3. Add your local plugin here.

  4. Run app using yarn start command.

  5. Add install your local plugin from Settings > Plugins > "Your plugin" > Install

Requirement

To test your plugin clone Acode repository. Add your local IPV4 to res/network_security_config.xml file. Use VS Code live server to serve your plugin files via localhost or use any other server to host your local plugin. Add your local plugin to src/pages/plugins/plugins.include.js file. This will load your local plugin in settings -> plugins.

Global API

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

editorManager

  • editor: AceAjax.Editor Ace editor

  • addNewFile(filename?:string, options?): void add a new file in workspace.

    • options: Object Optional object that you can pass.

      • text: string file content.
      • isUnsaved: boolean is file unsaved.
      • render: boolean switch to this file.
      • id: string unique id of tile.
      • uri: string file uri, location of file.
      • record: Record
      • deletedFile: boolean is file deleted.
      • readOnly: boolean is file readonly.
      • mode: string SAF (Storage access framework) mode, (TREE | SINGLE).
      • type: string file type, (regular | git | gist).
      • encoding: string file encoding.
      • onsave(): void callback function called when file is saved.
  • getFile(test: any, type: string) gets files from opened files.

    • test: any file id, uri, repo, gist to find the file.
    • type: string type of test (uri | id | name | git | gist).
  • switchFile(id: string): void switch tab to given file id.

  • activeFile: File current file.

  • hasUnsavedFiles(): number get the number of unsaved files.

  • files: Array<File> list of all files.

  • setSubText(file: File): void sets sub text of the header i.e. location of the file.

  • container: HTMLDivElement container of the editor.

  • state: string editor is blured or focused.

  • on(event: string, listener(): void): void adds a listener.

  • off(event: string, listener(): void): void removes a listener.

  • emit(event: string, ...args: ...any) emits an event.

    • List of events

      • switch-file
      • rename-file
      • save-file
      • file-content-changed
      • update

acode

  • exec(command: string, value: any)
  • setPluginInit(id: string, initfuntion(): void)
  • setPluginUnmount(id: string, unmountFunction(): void)
  • registerFormatter(id: string, externsions: Array<string>, format():Promise<void>)
  • fsOperation(file: string): FsOperation

actionStack

  • push(action: Object): void Pushes a callback function to actionStack. When use tap on physical/virtual back button, the given callback function is triggered.

    • action
      • id
      • action():void
  • pop(): Action pops top item from the stack

  • remove(id: string):void removes an item from stack

  • length: number length of the stack

  • setMark(): void sets a marker to current length of stack

  • clearfromMark(): void clears all the items from stack form the marker.

appSettings

  • value all settings.
  • on(event: string, listener(setting: any): void): void attaches event listener.
  • off(event: string, listener(setting: any): void): void removes event listener.
  • update(settings: Object, showToast: Boolean): void update settings.
  • reset(setting: Object): void reset settings.
  • get(setting: string): Object gets settings value.

Events

  • update:<setting name>

Show toast

Function window.toast(msg: string, milliSecond: number): void will show a toast message for specified time.

Data storage

window.DATA_STORAGE stores the url of data directory.

Cache storage

window.CACHE_STORAGE stores the url of cache storage.

Native APIs

To access native features and method of device use these plugins. For example to open a file using SAF

sdCard.openDocumentFile(async (uri) => {
  const fs = acode.fsOperation(uri);
  const stat = await fs.stat();
  const text = await fs.readFile('utf8');
  editorManager.addNewFile(stat.name, {
    uri,
    text,
    render: true
  });
})

To get more info api provided by these plugins see there js files in www directory.

FsOperation

  • lsDir(): Promise<Array<Entry>>
  • readFile(encoding: string | ArrayBuffer): Promise<string | ArrayBuffer>
  • createFile(name: string, content?: string): Promise<string>
  • writeFile(content: string | ArrayBuffer): Promise<void>
  • createDirectory(name: string): Promise<string>
  • delete(): Promise<void>
  • copyTo(destination: string): Promise<string>
  • moveTo(destination: string): Promise<string>
  • renameTo(newName: string): Promise<string>
  • exists(): Promise<Boolean>
  • stat(): Promise<Stat>

WcPage

See for more info.

  • show()
  • hide()
You might also like...

A base for developing Discord.js bots, written in TypeScript.

A base for developing Discord.js bots, written in TypeScript.

Nyx is a Discord bot template written in Typescript, supporting most of Discord.js' features alongside tools useful for bot development. 🇪🇸 README e

Dec 15, 2022

a quick start boilerplate for developing web3 apps and deploying smart contracts.

create-web3 A boilerplate for starting a web3 project. This boilerplate quickly creates a mono repo with 2 environments, a Next JS environment for fro

Dec 16, 2022

A simple project to learn more about developing smart contracts on polygon.

polygon-books-hardhat A simple project to learn more about developing smart contracts using Solidity. Local Development Environment Setup Install all

Jan 25, 2022

A javascript framework for developing pretty browser dialogs and notifications.

A javascript framework for developing pretty browser dialogs and notifications.

AlertifyJS AlertifyJS is a javascript framework for developing pretty browser dialogs and notifications. AlertifyJS is an extreme makeover of alertify

Jan 2, 2023

Progressive Web App (PWA) built in Node.js & Express that automatically reloads/refreshes your browser, web page, and app when developing.

Expresso ☕️ Checks for changes in your source and automatically reloads your browser, or web page, and app window. Makes development easier. Report Bu

Oct 6, 2022

SDK For developing 1Tool modules.

SDK For developing 1Tool modules.

1tool-module-skeleton SDK For developing 1Tool modules. Explore the API docs » 1Tool · Report Bug · Request Feature Table of Contents About The Projec

Jul 27, 2022

A hub for web developers that offers a variety of tools to help with any developing needs.

A hub for web developers that offers a variety of tools to help with any developing needs.

WebDevHub - A place for developers WebDevHub is designed to be one central place for developers, that offers a variety of tools to help with any devel

Dec 11, 2022

This is an app developed in the Microverse course, it is a simple app used for developing a task list, using JavaScript modules and webpack

TODO LIST This is an app developed in the microverse course, developing a task list, using Javascript modules and webpack A simple app to help you man

Jul 28, 2022

(Developing) Twitter Clone made with Remix, EdgeDB & UnoCSS.

Twitter Clone Twitter clone made with Remix, EdgeDB & UnoCSS. Demo: twitter-clone.poke.dev Features Signup/Login (With GitHub OAuth) Create tweets Fol

Jan 3, 2023
Comments
  • Bump loader-utils from 2.0.2 to 2.0.3

    Bump loader-utils from 2.0.2 to 2.0.3

    Bumps loader-utils from 2.0.2 to 2.0.3.

    Release notes

    Sourced from loader-utils's releases.

    v2.0.3

    2.0.3 (2022-10-20)

    Bug Fixes

    • security: prototype pollution exploit (#217) (a93cf6f)
    Changelog

    Sourced from loader-utils's changelog.

    2.0.3 (2022-10-20)

    Bug Fixes

    • security: prototype pollution exploit (#217) (a93cf6f)
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 1
  • Bump loader-utils from 2.0.2 to 2.0.4

    Bump loader-utils from 2.0.2 to 2.0.4

    Bumps loader-utils from 2.0.2 to 2.0.4.

    Release notes

    Sourced from loader-utils's releases.

    v2.0.4

    2.0.4 (2022-11-11)

    Bug Fixes

    v2.0.3

    2.0.3 (2022-10-20)

    Bug Fixes

    • security: prototype pollution exploit (#217) (a93cf6f)
    Changelog

    Sourced from loader-utils's changelog.

    2.0.4 (2022-11-11)

    Bug Fixes

    2.0.3 (2022-10-20)

    Bug Fixes

    • security: prototype pollution exploit (#217) (a93cf6f)
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump glob-parent from 3.1.0 to 6.0.2

    Bump glob-parent from 3.1.0 to 6.0.2

    Bumps glob-parent from 3.1.0 to 6.0.2.

    Release notes

    Sourced from glob-parent's releases.

    glob-parent v6.0.2

    Bug Fixes

    glob-parent v6.0.1

    Bug Fixes

    • Resolve ReDoS vulnerability from CVE-2021-35065 (#49) (3e9f04a)

    glob-parent v6.0.0

    ⚠ BREAKING CHANGES

    • Correct mishandled escaped path separators (#34)
    • upgrade scaffold, dropping node <10 support

    Bug Fixes

    • Correct mishandled escaped path separators (#34) (32f6d52), closes #32

    Miscellaneous Chores

    • upgrade scaffold, dropping node <10 support (e83d0c5)

    v5.1.2

    Bug Fixes

    v5.1.1

    Bug Fixes

    v5.1.0

    Features

    ... (truncated)

    Changelog

    Sourced from glob-parent's changelog.

    6.0.2 (2021-09-29)

    Bug Fixes

    6.0.1 (2021-07-20)

    Bug Fixes

    • Resolve ReDoS vulnerability from CVE-2021-35065 (#49) (3e9f04a)

    6.0.0 (2021-05-03)

    ⚠ BREAKING CHANGES

    • Correct mishandled escaped path separators (#34)
    • upgrade scaffold, dropping node <10 support

    Bug Fixes

    • Correct mishandled escaped path separators (#34) (32f6d52), closes #32

    Miscellaneous Chores

    • upgrade scaffold, dropping node <10 support (e83d0c5)

    5.1.1 (2021-01-27)

    Bug Fixes

    5.1.0 (2021-01-27)

    Features

    • add flipBackslashes option to disable auto conversion of slashes (closes #24) (#25) (eecf91d)

    5.0.0 (2021-01-27)

    ⚠ BREAKING CHANGES

    • Drop support for node <6 & bump dependencies

    Miscellaneous Chores

    • Drop support for node <6 & bump dependencies (896c0c0)

    4.0.0 (2021-01-27)

    ... (truncated)

    Commits
    Maintainer changes

    This version was pushed to npm by phated, a new releaser for glob-parent since your current version.


    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • ImportScripts needs more explanation

    ImportScripts needs more explanation

    Please,Could you explain more about how to do things like importing a plugins. The code in the worker.js for the already built plugins does not show how the importing works.

    opened by John4650-hub 0
Owner
Ajit Kumar
I am software developer, I design and develop web, desktop and mobile applications.
Ajit Kumar
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
Template to start developing a REST API with Node.js (Express), TypeScript, DDD, etc. 🔰🦸

Typescript DDD Boilerplate Plantilla para una API con Typescript basada en arquitectura DDD. En qué consiste este proyecto Este proyecto es un punto d

Bryan Herrera ~ ርᚱ1ናተᛰ ᚻህᚥተპᚱ 3 Nov 26, 2022
Powerful rich text editor using Vue.js and Quill. About @quilljs editor component for @vuejs

quill-vuejs Quill editor component for Vue. 基于 Quill、适用于 Vue 的富文本编辑器,支持服务端渲染和单页应用。 Preview Example CDN example page Component example page Install NPM

Chi Zhang 10 Aug 10, 2022
Triumph Tech’s Magnus Editor is a full-featured remote editor for Rock RMS.

Magnus Visual Studio Code Editor for Rock RMS Triumph Tech’s Magnus Editor is a full-featured remote editor for Rock RMS. Rock RMS is an open source R

Triumph Tech 8 Nov 23, 2022
A free book that talks about design patterns/techniques used while developing with React.

React in patterns ?? A free book that talks about design patterns/techniques used while developing with React. Book GitBook Web PDF Mobi ePub Translat

Krasimir Tsonev 12.2k Dec 30, 2022
AppRun is a JavaScript library for developing high-performance and reliable web applications using the elm inspired architecture, events and components.

AppRun AppRun is a JavaScript library for building reliable, high-performance web applications using the Elm-inspired architecture, events, and compon

Yiyi Sun 1.1k Dec 20, 2022
Providing a complete list of Kurdish (ckb) Alphabet for developing purposes

Providing complete information on Arabic-based Kurdish Alphabets (CKB) Kurdish Alphabet Arabic-based Kurdish Characters Character Unicode Code Point N

Dolan Hêriş 4 Aug 6, 2022
Been interested, studying, and developing blockchain security with a Zero Knowledge Proof (ZKP) and create a prototype on the current issue with Philippine's upcoming election. 📥

Implementation of Zero Knowledge Proofs in Cryptographic Voting ?? Reference: Cryptographic Voting – A Gentle Introduction Overview ????‍?? The main i

Karl Joseph Saycon 2 Apr 11, 2022