All Projects → cloudcmd → dword

cloudcmd / dword

Licence: MIT license
Web editor based on CodeMirror

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to dword

deepword
Web editor based on Monaco
Stars: ✭ 25 (-32.43%)
Mutual labels:  expressjs, cloudcmd
http-server-pwa
👾 http-server alike but for serving and rendering PWA: pwa-server
Stars: ✭ 14 (-62.16%)
Mutual labels:  expressjs
Express App Example
How I structure Express Apps (example repo)
Stars: ✭ 222 (+500%)
Mutual labels:  expressjs
kirby-markdown-field
Super-sophisticated markdown editor for Kirby 3, community built.
Stars: ✭ 143 (+286.49%)
Mutual labels:  codemirror
Awesome Express
这个仓库主要是收集 Express 好用的中间件、新闻资讯、网站等,这是我在基于Express开发web应用过程中搜集到的一些插件和看到的一些好的内容。
Stars: ✭ 241 (+551.35%)
Mutual labels:  expressjs
caucus
Realtime Collaborate Editor with Embedded Compiler
Stars: ✭ 278 (+651.35%)
Mutual labels:  codemirror
Graphql Rest Proxy
Turn your REST API into GraphQL - A Proxy Server that pipes request from GraphQL to REST with GraphQL DSL, performant nested children, mutations, input types, and more.
Stars: ✭ 218 (+489.19%)
Mutual labels:  expressjs
nodejs-scaffolding
A node.js sample application that demonstrates an architecture for building a complete production API with Node.JS, Express.JS and MongoDB
Stars: ✭ 33 (-10.81%)
Mutual labels:  expressjs
TW5-codemirror-plus
An attempt to make a better writing experience for TW using codemirror.
Stars: ✭ 26 (-29.73%)
Mutual labels:  codemirror
wc-codemirror
CodeMirror as a vanilla web component
Stars: ✭ 31 (-16.22%)
Mutual labels:  codemirror
Nodebestpractices
✅ The Node.js best practices list (December 2021)
Stars: ✭ 72,734 (+196478.38%)
Mutual labels:  expressjs
Generator Api
🚀 Yeoman generator for creating RESTful NodeJS APIs, using ES6, Mongoose and Express
Stars: ✭ 247 (+567.57%)
Mutual labels:  expressjs
Bilibili-Column-Helper
bilibili专栏助手,已Archive,后续可能port到vscode插件。
Stars: ✭ 26 (-29.73%)
Mutual labels:  codemirror
Node Decorators
node-decorators
Stars: ✭ 230 (+521.62%)
Mutual labels:  expressjs
express-firebase
🔥 Express starter for your Firebase applications
Stars: ✭ 60 (+62.16%)
Mutual labels:  expressjs
Bookmarks.dev
Bookmarks and Code Snippets Manager for Developers & Co
Stars: ✭ 218 (+489.19%)
Mutual labels:  expressjs
Nest Mean
NestJS Tutorial Repository
Stars: ✭ 250 (+575.68%)
Mutual labels:  expressjs
console-io
Web console
Stars: ✭ 55 (+48.65%)
Mutual labels:  cloudcmd
Express-Boilerplate-MVC
Express boilerplate using ES6 and MVC pattern
Stars: ✭ 14 (-62.16%)
Mutual labels:  expressjs
expressive
A NodeJS API framework built on ExpressJs bootstrapped with conventions to minimize code. (Includes Typescript Support ⭐️)
Stars: ✭ 28 (-24.32%)
Mutual labels:  expressjs

Dword License NPM version

Web editor based on CodeMirror. Fork of edward.

dword

Features

  • Syntax highlighting based on extension of file for over 90 languages.
  • Built-in emmet (for html files)
  • Drag n drop (drag file from desktop to editor).
  • Configurable options (json/edit.json could be overriden by ~/.dword.json)

Install

npm i dword -g

NPM_INFO

Command line parameters

Usage: dword [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 + e evaluate (JavaScript only supported)

API

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

Server

dword(options)

Middleware of dword. Options could be omitted.

const dword = require('dword');
const express = require('express');
const app = express();

app.use(dword({
    root: '/', // default
    online: true, // default
    diff: true, // default
    zip: true, // default
    dropbox: false, // optional
    dropboxToken: 'token', //  optional
}));

app.listen(31_337);

dword.listen(socket)

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

const io = require('socket.io');
const socket = io.listen(server);

dword.listen(socket, {
    prefixSocket: '/dword', // optional
    auth: (accept, reject) => (username, password) => { // optional
        accept();
    },
});

Client

Dword uses codemirror 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="/dword/dword.js"></script>

Minimal css:

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

Minimal js:

dword('[data-name="js-edit"]', (editor) => {
    editor.setValue('hello dword');
    console.log('dword is ready');
});

Client API

dword(selector, callback)
  • selector: string
  • callback: EditorCallback

Initialize new instance

editor.setValue(value)
  • value: string

Set value to editor.

editor.getValue()
  • returns: string

Get value from editor.

Types
interface Editor {
    setValue: (value: string) => void;
    getValue: () => string;
}

type EditorCallback = (editor: Editor) => void;
type Dword = (selector: string, callback: EditorCallback) => void;

For more information you could always look around client/dword.js directory.

Related

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].