Skip to content

Commit

Permalink
Move to typescript (codex-team#474)
Browse files Browse the repository at this point in the history
* Move all modules to ts

* It works

* Update README.md

Co-Authored-By: gohabereg <[email protected]>

* Interfaces

* Interfaces

* Move depending interfaces to external types

* Update README.md

* update tools

* add some docs

* Add some fixes

* Add desctiprion for Block declaration and Core properties

* Fixes due comments
:

* Remove Block from external types

* Bump version

* Update src/components/modules/tools.ts

Co-Authored-By: gohabereg <[email protected]>

* Update src/components/core.ts

Co-Authored-By: gohabereg <[email protected]>

* Rename gteBlockHTMLByIndex to getBlockByIndex

* Remove unnecessary constructors

* Clean up bindEvents method

* Add InlineToolConstructable interface

* Delete legacy notifications class

* Fix zero-configuration bugs

* Update inline tools and block tunes constructors
  • Loading branch information
gohabereg authored Nov 23, 2018
1 parent 531f1d2 commit bcdfcda
Show file tree
Hide file tree
Showing 106 changed files with 4,495 additions and 15,841 deletions.
5 changes: 3 additions & 2 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"presets": [
"presets": [
["@babel/preset-env", {
"modules": "umd"
"modules": "umd",
"useBuiltIns": "entry"
}]
],
"plugins": [
Expand Down
2 changes: 2 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@
"$": true,
"_": true,
"setTimeout": true,
"process": true,
"__dirname": true,
"Map": true
}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ Thumbs.db
node_modules/*

npm-debug.log
yarn-error.log
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ Welcome to testing stage. Please, join a [public Telegram-chat](//t.me/codex_edi
- `New` Added `onChange`-callback, fired after any modifications at the Editor. See [documentation](https://github.com/codex-team/codex.editor/blob/master/docs/installation.md#features).
- `New` New Inline Tool example — [Marker](https://github.com/codex-editor/marker)
- `New` New Inline Tool example — [Code](https://github.com/codex-editor/code)
- `New` New [CodeX Editor PHP](http://github.com/codex-team/codex.editor.backend) — example of server-side implementation with HTML purifying and data validation.
- `Improvements` - Improvements of Toolbar's position calculation.
- `New` New [CodeX Editor PHP](http://github.com/codex-team/codex.editor.backend) — example of server-side implementation with HTML purifying and data validation.
- `Improvements` - Improvements of Toolbar's position calculation.
- `Improvements` — Improved zero-configuration initialization.
- and many little improvements.
- and many little improvements.

## Documentation

Expand All @@ -28,7 +28,7 @@ While we develop the new Documentation Site with all stuff, you can check some a
- [How to use](docs/usage.md)
- [How to create a Block Tool Plugin](docs/tools.md)
- [How to create an Inline Tool Plugin](docs/tools-inline.md)
- [API for Tools](src/components/interfaces/api.ts)
- [API for Tools](docs/api.md)

Sorry if we missed something. You can join a [Telegram-chat](//t.me/codex_editor) and ask a question.

Expand All @@ -38,8 +38,8 @@ Sorry if we missed something. You can join a [Telegram-chat](//t.me/codex_editor

## Basics

CodeX Editor is a Block-Styled editor. Blocks is a structural units, of which the Entry is composed.
For example, `Paragraph`, `Heading`, `Image`, `Video`, `List` are Blocks. Each Block is represented by a Plugin.
CodeX Editor is a Block-Styled editor. Blocks are structural units, of which the Entry is composed.
For example, `Paragraph`, `Heading`, `Image`, `Video`, `List` are Blocks. Each Block is represented by Plugin.
We have [many](http://github.com/codex-editor) ready-to-use Plugins and the [simple API](docs/tools.md) for creation new ones.

So how to use the Editor after [Installation](docs/installation.md).
Expand All @@ -50,29 +50,29 @@ So how to use the Editor after [Installation](docs/installation.md).


![](https://github.com/codex-editor/list/raw/master/assets/example.gif)

- Select text fragment and apply a style or insert a link from the Inline Toolbar

![](https://capella.pics/7ccbcfcd-1c49-4674-bea7-71021468a1bd.jpg)

- Use «three-dots» button on the right to open Block Settings. From here, you can move and delete a Block
- Use «three-dots» button on the right to open Block Settings. From here, you can move and delete a Block
or apply Tool's settings, if it provided. For example, set a Heading level or List style.

![](https://capella.pics/01a55381-46cd-47c7-b92e-34765434f2ca.jpg)
![](https://capella.pics/01a55381-46cd-47c7-b92e-34765434f2ca.jpg)

## Shortcuts

We really appreciate shortcuts. So there are few presets.
We really appreciate shortcuts. So there are few presets.

Action | Shortcut | Restrictions
Shortcut | Action | Restrictions
-- | -- | --
`TAB` | Show/leaf a Toolbox. | On empty block
`SHIFT+TAB` | Leaf back a Toolbox. | While Toolbox is opened
`ENTER` | Create a Block | While Toolbox is opened and some Tool is selected
`CMD+B` | Bold style | On selection
`CMD+I` | Italic style | On selection
`CMD+K` | Insert a link | On selection

Also we support shortcuts on the all type of Tools. Specify a shortcut with the Tools configuration. For example:

```js
Expand Down Expand Up @@ -104,7 +104,7 @@ There are few steps to run CodeX Editor on your site.

## Load Editor's core

Firstly you need to get CodeX Editor itself. It is a [minified script](build/codex-editor.js) with minimal available
Firstly you need to get CodeX Editor itself. It is a [minified script](build/codex-editor.js) with Editor's core and some default must-have tools.

Choose the most usable method of getting Editor for you.

Expand All @@ -120,7 +120,7 @@ Install the package via NPM or Yarn
npm i codex.editor --save-dev
```

Include module at your application
Include module in your application

```javascript
const CodexEditor = require('codex.editor');
Expand Down Expand Up @@ -164,7 +164,7 @@ Check [CodeX Editor's community](https://github.com/codex-editor) to see more re

## Create Editor instance

Create an instance of CodeX Editor and pass [Configuration Object](src/components/interfaces/editor-config.ts) with `holderId` and tools list.
Create an instance of CodeX Editor and pass [Configuration Object](types/configs/editor-config.d.ts) with `holderId` and tools list.

```html
<div id="codex-editor"></div>
Expand Down Expand Up @@ -217,7 +217,7 @@ editor.saver.save()
.then((savedData) => {
console.log(savedData);
});
```
```

## Example

Expand Down
274 changes: 137 additions & 137 deletions build/codex-editor.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/codex-editor.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Check [CodeX Editor's community](https://github.com/codex-editor) to see Tools e

## Create Editor instance

Create an instance of CodeX Editor and pass [Configuration Object](../src/components/interfaces/editor-config.ts).
Create an instance of CodeX Editor and pass [Configuration Object](../src/types-internal/editor-config.ts).
Minimal params is a `holderId`, `tools` list and `initialBlock` marker.

```html
Expand Down
2 changes: 1 addition & 1 deletion docs/tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Each Tool's instance called with an params object.
| config | `object` | Special configuration params passed in «config» |
| data | `object` | Data to be rendered in this Tool |

[iapi-link]: ../src/components/interfaces/api.ts
[iapi-link]: ../src/types-internal/api.ts

#### Example

Expand Down
2 changes: 1 addition & 1 deletion example/tools/table
Submodule table updated from 040b08 to cfde1b
Loading

0 comments on commit bcdfcda

Please sign in to comment.