Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript. Learn more »

deepword

5.1.4 • Public • Published

Deepword License NPM version Dependency Status Build Status Coverage Status

Web editor used in Cloud Commander based on Monaco.

Deepword

Features

Install

npm i deepword -g

NPM_INFO

Command line parameters

Usage: deepword [filename]

Parameter Operation
-h, --help display help and exit
-v, --version output version information and exit

Hot keys

Key Operation
Ctrl + s save
Ctrl + f find
Ctrl + h replace
Ctrl + g go to line
Ctrl + b beautify js, css or html
Ctrl + m minify js, css or html
Ctrl + e evaluate (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.

const deepword = require('deepword');
const express = require('express');
const app = express();
 
app.use(deepword({
    diff: true,             // default
    zip : true,             // default
    dropbox: false          // optional
    dropboxToken: 'token',  // optional
}));
 
app.listen(31337);

deepword.listen(socket)

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

const io = require('socket.io'),
const socket = io.listen(server);
 
deepword.listen(socket, {
    prefixSocket: '/deepword', // optional
    auth: (accept, reject) => (username, password) => { // optional
        accept();
    }
});

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:

<div class="edit" data-name="js-edit"></div>
<script src="/deepword/deepword.js"></script>

Minimal css:

htmlbody.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

install

npm i deepword

Downloadsweekly downloads

813

version

5.1.4

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability