{"id":18483397,"url":"https://github.com/cloudcmd/dword","last_synced_at":"2025-04-07T12:09:13.632Z","repository":{"id":27537348,"uuid":"31018705","full_name":"cloudcmd/dword","owner":"cloudcmd","description":"Web editor based on CodeMirror","archived":false,"fork":false,"pushed_at":"2024-03-16T16:29:22.000Z","size":7225,"stargazers_count":39,"open_issues_count":1,"forks_count":7,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-31T10:10:01.779Z","etag":null,"topics":["cloudcmd","codemirror","editor","expressjs","middleware","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloudcmd.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-02-19T14:25:45.000Z","updated_at":"2024-07-18T05:01:40.000Z","dependencies_parsed_at":"2024-03-16T18:18:40.378Z","dependency_job_id":"47735c88-a16f-4c23-b16c-c027ba4957d8","html_url":"https://github.com/cloudcmd/dword","commit_stats":{"total_commits":1006,"total_committers":5,"mean_commits":201.2,"dds":0.441351888667992,"last_synced_commit":"705e13fd65a80d9bed9b421f310ff837c2cbfe78"},"previous_names":[],"tags_count":340,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudcmd%2Fdword","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudcmd%2Fdword/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudcmd%2Fdword/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudcmd%2Fdword/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudcmd","download_url":"https://codeload.github.com/cloudcmd/dword/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247648978,"owners_count":20972945,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloudcmd","codemirror","editor","expressjs","middleware","nodejs"],"created_at":"2024-11-06T12:35:34.515Z","updated_at":"2025-04-07T12:09:13.605Z","avatar_url":"https://github.com/cloudcmd.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dword [![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL]\n\n[NPMIMGURL]: https://img.shields.io/npm/v/dword.svg?style=flat\n[BuildStatusURL]: https://github.com/cloudcmd/dword/actions?query=workflow%3A%22Node+CI%22 \"Build Status\"\n[BuildStatusIMGURL]: https://github.com/cloudcmd/dword/workflows/Node%20CI/badge.svg\n[LicenseIMGURL]: https://img.shields.io/badge/license-MIT-317BF9.svg?style=flat\n[NPM_INFO_IMG]: https://nodei.co/npm/dword.png?downloads=true\u0026\u0026stars\u0026\u0026downloadRank \"npm install dword\"\n[NPMURL]: https://npmjs.org/package/dword \"npm\"\n[LicenseURL]: https://tldrlegal.com/license/mit-license \"MIT License\"\n[edit.json]: https://github.com/cloudcmd/dword/tree/master/json/edit.json \"edit.json\"\n\nWeb editor based on [CodeMirror](http://codemirror.net).\nFork of [edward](https://github.com/cloudcmd/edward \"Edward\").\n\n![dword](https://raw.githubusercontent.com/cloudcmd/dword/master/img/dword.png \"dword\")\n\n## Features\n\n- Syntax highlighting based on extension of file for over 90 languages.\n- Built-in `emmet` (for html files)\n- Drag n drop (drag file from desktop to editor).\n- Configurable options ([json/edit.json][edit.json] could be overriden by `~/.dword.json`)\n\n## Install\n\n```\nnpm i dword -g\n```\n\n![NPM\\_INFO][NPM_INFO_IMG]\n\n## Command line parameters\n\nUsage: `dword [filename]`\n\n|Parameter              |Operation\n|:----------------------|:--------------------------------------------\n| `-h, --help`          | display help and exit\n| `-v, --version`       | output version information and exit\n\n## Hot keys\n\n|Key                    |Operation\n|:----------------------|:--------------------------------------------\n| `Ctrl + s`            | save\n| `Ctrl + f`            | find\n| `Ctrl + h`            | replace\n| `Ctrl + g`            | go to line\n| `Ctrl + e`            | evaluate (JavaScript only supported)\n\n## API\n\ndword could be used as middleware for [express](http://expressjs.com \"Express\").\nFor this purpuse API could be used.\n\n### Server\n\n#### dword(options)\n\nMiddleware of `dword`. Options could be omitted.\n\n```js\nconst dword = require('dword');\nconst express = require('express');\nconst app = express();\n\napp.use(dword({\n    root: '/', // default\n    online: true, // default\n    diff: true, // default\n    zip: true, // default\n    dropbox: false, // optional\n    dropboxToken: 'token', //  optional\n}));\n\napp.listen(31_337);\n```\n\n#### dword.listen(socket)\n\nCould be used with [socket.io](http://socket.io \"Socket.io\") to handle editor events with.\n\n```js\nconst io = require('socket.io');\nconst socket = io.listen(server);\n\ndword.listen(socket, {\n    // optional\n    prefixSocket: '/dword',\n    // optional\n    auth: (accept, reject) =\u003e (username, password) =\u003e {\n        accept();\n    },\n});\n```\n\n### Client\n\nDword uses [codemirror](http://codemirror.net/ \"CodeMirror\") on client side, so API is similar.\nAll you need is put minimal `html`, `css`, and `js` into your page.\n\nMinimal html:\n\n```html\n\u003cdiv class=\"edit\" data-name=\"js-edit\"\u003e\u003c/div\u003e\n\u003cscript src=\"/dword/dword.js\"\u003e\u003c/script\u003e\n```\n\nMinimal css:\n\n```css\nhtml, body, .edit {\n    height: 100%;\n    margin: 0;\n}\n```\n\nMinimal js:\n\n```js\ndword('[data-name=\"js-edit\"]', (editor) =\u003e {\n    editor.setValue('hello dword');\n    console.log('dword is ready');\n});\n```\n\n#### Client API\n\n##### `dword(selector, callback)`\n\n- `selector`: **string**\n- `callback`: **EditorCallback**\n\nInitialize new instance\n\n###### `editor.setValue(value)`\n\n- `value`: **string**\n\nSet value to `editor`.\n\n###### `editor.getValue()`\n\n- `returns`: **string**\n\nGet value from editor.\n\n##### Types\n\n```ts\ninterface Editor {\n    setValue: (value: string) =\u003e void;\n    getValue: () =\u003e string;\n}\n\ntype EditorCallback = (editor: Editor) =\u003e void;\ntype Dword = (selector: string, callback: EditorCallback) =\u003e void;\n```\n\nFor more information you could always look around `client/dword.js` directory.\n\n## Related\n\n- [Edward](https://github.com/cloudcmd/edward \"Edwdard\") - web editor based on [Ace](https://ace.c9.io \"Ace\").\n- [Deepword](https://github.com/cloudcmd/deepword \"Deepword\") - web editor based on [Monaco](https://microsoft.github.io/monaco-editor/ \"Monaco\").\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudcmd%2Fdword","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudcmd%2Fdword","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudcmd%2Fdword/lists"}