Skip to content

Repository files navigation

Deepword LicenseNPM versionBuild StatusCoverage Status

Web editor used in Cloud Commander based on Monaco.

Deepword

Features

  • Syntax highlighting based on extension of file for over 30 languages.
  • Configurable options (edit.json could be overriden by ~/.deepword.json) according to monaco editor options

Install

npm i deepword -g

NPM_INFO

Command line parameters

Usage: deepword [filename]

ParameterOperation
-h, --helpdisplay help and exit
-v, --versionoutput version information and exit

Hot keys

KeyOperation
Ctrl + ssave
Ctrl + ffind
Ctrl + hreplace
Ctrl + ggo to line
Ctrl + eevaluate (JavaScript only supported)

For more details see Ace keyboard shortcuts.

Options

You can override monaco editor options in ~/.deepword.json.

Theme

To override theme use theme options in ~/.deepword.json. Themes can be:

  • vs
  • vs-dark

API

Deepword could be used as middleware for express. For this purpuse API could be used.

Server

deepword(options)

Middleware of deepword. Options could be omitted.

import{deepword}from'deepword';importexpressfrom'express';constapp=express();app.use(deepword({root: '/',// defaultdiff: true,// defaultzip: true,// defaultdropbox: false,// optionaldropboxToken: 'token',// optional}));app.listen(31_337);

deepword.listen(socket)

Could be used with socket.io to handle editor events with.

import{Server}from'socket.io';constsocket=newServer(server);deepword.listen(socket,{prefixSocket: '/deepword',// optionalauth: (accept,reject)=>(username,password)=>{// optionalaccept();},});

Client

Deepword uses Monaco on client side, so API is similar. All you need is put minimal html, css, and js into your page.

Minimal html:

<divclass="edit" data-name="js-edit"></div><scriptsrc="/deepword/deepword.js"></script>

Minimal css:

html,body, .edit {
height:100%;
width:100%;
}
body {
margin:0;
}
.edit {
overflow: hidden;
}

Minimal js:

deepword('[data-name="js-edit"]',(editor)=>{editor.setValue('Hello deepword!');});

For more information you could always look into html and bin directory.

Related

License

MIT

About

Web editor based on Monaco

Topics

Resources

Stars

32 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages