# CDTextEditor v0.1
***
## Description
**CDTextEditor** is a simple [Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) text editor for websites with some features such as highlighting, multi-language spell checking, predictive text and more.
***
## Documentation
* [Installation](#installation)
* [Usage](#usage)
* [UI](#ui)
* [Examples (demos)](#examples)
* [Related projects](#related-projects)
* [Notes](#notes)
* [License](#license)
***
## Installation
The project uses [grunt](https://gruntjs.com) for building.
1. Clone git repository:
`$ git clone https://github.com/CrazyPhD/CDTextEditor`
2. Install all dependencies using `npm`:
`$ npm install`
3. Build a project:
* Full build process: `$ grunt`
* Skip lint: `$ grunt build`
4. Place following strings before the closing `` tag:
```HTML
```
***
## Usage
### Create single editor
The simplest way to create ***single*** editor on the web-page:
1. Create a `
` element with specific id.
2. Place following code before the closing `
` as wrapper container. [[Live DEMO #1]](https://crazydoctor.ru/cdtexteditor/single.html)
CSS:
```CSS
html {
height: 100%;
}
body {
margin: 0;
padding: 0;
min-height: 100%;
}
```
HTML:
```HTML
```
JS:
```JS
let editor = new CDTextEditor("workbench").setup({
predictive: './dist/assets/dict/en_phrases.txt',
spellchecking: {
url: './dist/assets/dict/',
loc: ['en_US']
}
});
```
* Page with multiple editors. [[Live DEMO #2]](https://crazydoctor.ru/cdtexteditor/multiple.html)
HTML:
```HTML
```
JS:
```JS
CDTextEditor.create([
{
id: "workbench",
options: {
predictive: "./dist/assets/dict/en_phrases.txt",
flex: true,
spellchecking: {
url: "./dict/",
loc: ["en_US"]
}
}
},
{
id: "workbench1",
options: {
autoPreview: true,
predictive: "./dist/assets/dict/en_phrases.txt",
resizable: true,
flex: true,
maxSize: {
w: 900,
h: 500
},
spellchecking: {
url: "./dict/",
loc: [
"en_US",
"de_DE"
]
}
}
},
{
id: "workbench2",
options: {
draggable: true,
spellchecking: {
url: "./dict/",
loc: [
"de_DE"
]
}
}
}
]);
```
***
## Related projects
I would like to thank all the people involved in the following projects for their contributions both to the Open Source and to my project in particular:
* [CodeMirror](https://codemirror.net/) - a browser code editor library.
* [showdownjs/showdown](https://github.com/showdownjs/showdown/) - a Markdown to HTML converter.
* [cfinke/Typo.js](https://github.com/cfinke/Typo.js/) - a spellchecker that uses Hunspell-style dictionaries.
* [Project Gutenberg](https://www.gutenberg.org/) - an eBook library, where were found amazing book "Fifteen Thousand Useful Phrases" by Greenville Kleiser, where [almost 6000 phrases](https://github.com/CrazyPhD/CDTextEditor/blob/master/src/cdtexteditor/assets/dict/en_phrases.txt) were taken from.
* [wooorm/dictionaries](https://github.com/wooorm/dictionaries) - a huge collection of Hunspell-style dictionaries.
* [jQuery](https://jquery.com/) - a JavaScript library designed to simplify HTML DOM tree traversal and manipulation, as well as event handling, CSS animation, and Ajax.
* [jQueryUI](https://jqueryui.com/) - a set of user interface interactions, effects, widgets, and themes built on top of jQuery.
Thank you everybody!
***
## Notes
### jQuery/jQuery UI
jQuery and jQuery UI are not included in a project build due to their heaviness and relative prevalence.
Inclusion of them would lead to a significant weighting of built project and to redundancy on most modern Internet resources.
However, if you do not have them installed, CDTextEditor will do it for you with minimal investment of time and resources and only when necessary (if enabled any of following options: resizable, draggable, flex).
### License
[MIT](https://github.com/CrazyPhD/CDTextEditor/blob/master/license) (c) Oleg Karataev