Skip to content

Commit

Permalink
quote initial
Browse files Browse the repository at this point in the history
Co-Authored-By: George Berezhnoy <[email protected]>
  • Loading branch information
talyguryn and gohabereg committed Jul 31, 2018
1 parent 922fe2a commit a3f001c
Show file tree
Hide file tree
Showing 10 changed files with 5,808 additions and 2 deletions.
2 changes: 0 additions & 2 deletions .gitattributes

This file was deleted.

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules/*
npm-debug.log
.idea/
.DS_Store
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 CodeX

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
99 changes: 99 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
![](https://badgen.net/badge/CodeX%20Editor/v2.0/blue)

# Quote Tool

Provides Quote Blocks for the [CodeX Editor](https://ifmo.su/editor).

![](https://capella.pics/017dca46-6869-40cb-93a0-994416576e33.jpg)

## Installation

### Install via NPM

Get the package

```shell
npm i --save-dev codex.editor.quote
```

Include module at your application

```javascript
const Quote = require('codex.editor.quote');
```

### Download to your project's source dir

1. Upload folder `dist` from repository
2. Add `dist/bundle.js` file to your page.

### Load from CDN

Get newest bundle path from [RawGit](https://rawgit.com) — open site and paste link to JS bundle in repository.

`https://github.com/codex-editor/quote/blob/master/dist/bundle.js`

> Note: use `production` link with commit hash to avoid issues with caching.
Then require this script on page with CodeX Editor.

```html
<script src="..."></script>
```

## Usage

Add a new Tool to the `tools` property of the CodeX Editor initial config.

```javascript
var editor = CodexEditor({
...

tools: {
...
quote: {
class: Quote,
inlineToolbar: true,
config: {
quotePlaceholder: 'Enter a quote',
captionPlaceholder: 'Quote\'s author',
},
},
},

...
});
```

## Config Params

| Field | Type | Description |
| ------------------ | -------- | --------------------------- |
| quotePlaceholder | `string` | header's placeholder string |
| captionPlaceholder | `string` | header's placeholder string |

## Tool's settings

![](https://capella.pics/0db5d4de-c431-4cc2-90bf-bb1f4feec5df.jpg)

You can choose alignment for the quote. It takes no effect while editing, but saved the «alignment» param.

## Output data

| Field | Type | Description |
| --------- | -------- | -------------------- |
| quote | `string` | quote's text |
| caption | `string` | caption or an author |
| alignment | `string` | `left` or `center` |


```json
{
"type" : "quote",
"data" : {
"quote" : "The unexamined life is not worth living.",
"caption" : "Socrates",
"alignment" : "left"
}
}
```
1 change: 1 addition & 0 deletions dist/bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a3f001c

Please sign in to comment.