Skip to content

Commit bcdfcda

Browse files
authored
Move to typescript (codex-team#474)
* 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
1 parent 531f1d2 commit bcdfcda

File tree

106 files changed

+4495
-15841
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+4495
-15841
lines changed

.babelrc

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
2-
"presets": [
2+
"presets": [
33
["@babel/preset-env", {
4-
"modules": "umd"
4+
"modules": "umd",
5+
"useBuiltIns": "entry"
56
}]
67
],
78
"plugins": [

.eslintrc

+2
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@
8585
"$": true,
8686
"_": true,
8787
"setTimeout": true,
88+
"process": true,
89+
"__dirname": true,
8890
"Map": true
8991
}
9092
}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ Thumbs.db
88
node_modules/*
99

1010
npm-debug.log
11+
yarn-error.log

README.md

+16-16
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ Welcome to testing stage. Please, join a [public Telegram-chat](//t.me/codex_edi
1515
- `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).
1616
- `New` New Inline Tool example — [Marker](https://github.com/codex-editor/marker)
1717
- `New` New Inline Tool example — [Code](https://github.com/codex-editor/code)
18-
- `New` New [CodeX Editor PHP](http://github.com/codex-team/codex.editor.backend) — example of server-side implementation with HTML purifying and data validation.
19-
- `Improvements` - Improvements of Toolbar's position calculation.
18+
- `New` New [CodeX Editor PHP](http://github.com/codex-team/codex.editor.backend) — example of server-side implementation with HTML purifying and data validation.
19+
- `Improvements` - Improvements of Toolbar's position calculation.
2020
- `Improvements` — Improved zero-configuration initialization.
21-
- and many little improvements.
21+
- and many little improvements.
2222

2323
## Documentation
2424

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

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

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

3939
## Basics
4040

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

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

5151

5252
![](https://github.com/codex-editor/list/raw/master/assets/example.gif)
53-
53+
5454
- Select text fragment and apply a style or insert a link from the Inline Toolbar
5555

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

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

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

6363
## Shortcuts
6464

65-
We really appreciate shortcuts. So there are few presets.
65+
We really appreciate shortcuts. So there are few presets.
6666

67-
Action | Shortcut | Restrictions
67+
Shortcut | Action | Restrictions
6868
-- | -- | --
6969
`TAB` | Show/leaf a Toolbox. | On empty block
7070
`SHIFT+TAB` | Leaf back a Toolbox. | While Toolbox is opened
7171
`ENTER` | Create a Block | While Toolbox is opened and some Tool is selected
7272
`CMD+B` | Bold style | On selection
7373
`CMD+I` | Italic style | On selection
7474
`CMD+K` | Insert a link | On selection
75-
75+
7676
Also we support shortcuts on the all type of Tools. Specify a shortcut with the Tools configuration. For example:
7777

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

105105
## Load Editor's core
106106

107-
Firstly you need to get CodeX Editor itself. It is a [minified script](build/codex-editor.js) with minimal available
107+
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.
108108

109109
Choose the most usable method of getting Editor for you.
110110

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

123-
Include module at your application
123+
Include module in your application
124124

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

165165
## Create Editor instance
166166

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

169169
```html
170170
<div id="codex-editor"></div>
@@ -217,7 +217,7 @@ editor.saver.save()
217217
.then((savedData) => {
218218
console.log(savedData);
219219
});
220-
```
220+
```
221221

222222
## Example
223223

build/codex-editor.js

+137-137
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/codex-editor.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/installation.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Check [CodeX Editor's community](https://github.com/codex-editor) to see Tools e
6868

6969
## Create Editor instance
7070

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

7474
```html

docs/tools.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Each Tool's instance called with an params object.
1818
| config | `object` | Special configuration params passed in «config» |
1919
| data | `object` | Data to be rendered in this Tool |
2020

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

2323
#### Example
2424

example/tools/table

Submodule table updated from 040b082 to cfde1bc

0 commit comments

Comments
 (0)