Skip to content

Commit 3a6e4bc

Browse files
author
georgyb
committed
Update README
1 parent a535edb commit 3a6e4bc

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

README.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ Image Block for the [CodeX Editor](https://ifmo.su/editor).
1313
- Pasting images by drag-n-drop
1414
- Pasting files and screenshots from Clipboard
1515
- Allows to add border, background
16-
- Allows to stretch image to the container's full-width
16+
- Allows to stretch image to the container's full-width
1717

1818
**Note** This Tool requires server-side implementation for file uploading. See [backend response format](#server-format) for more details.
19-
19+
2020
## Installation
2121

2222
### Install via NPM
@@ -53,25 +53,25 @@ Add a new Tool to the `tools` property of the CodeX Editor initial config.
5353
```javascript
5454
var editor = CodexEditor({
5555
...
56-
56+
5757
tools: {
5858
...
5959
image: {
6060
class: ImageTool,
6161
config: {
6262
endpoints: {
63-
byFile: 'http://localhost:8008/uploadFile', // Your backend file uploader endpoint
64-
byUrl: 'http://localhost:8008/fetchUrl', // Your endpoint that provides uploading by Url
63+
byFile: 'http://localhost:8008/uploadFile', // Your backend file uploader endpoint
64+
byUrl: 'http://localhost:8008/fetchUrl', // Your endpoint that provides uploading by Url
6565
}
6666
}
6767
}
6868
}
69-
69+
7070
...
7171
});
7272
```
7373

74-
## Config Params
74+
## Config Params
7575

7676
Image Tool supports these configuration parameters:
7777

@@ -125,19 +125,19 @@ This Tool returns `data` with following format
125125

126126
## Backend response format <a name="server-format"></a>
127127

128-
This Tool works by one of following schemes:
128+
This Tool works by one of the following schemes:
129129

130130
1. Uploading files from the device
131131
2. Uploading by URL (handle image-like URL's pasting)
132-
3. Uploading by drag-n-drop file
133-
4. Uploading by pasting from Clipboard
132+
3. Uploading by drag-n-drop file
133+
4. Uploading by pasting from Clipboard
134134

135135
### Uploading files from device <a name="from-device"></a>
136136

137137
Scenario:
138138

139139
1. User select file from the device
140-
2. Tool sends it to **your** backend (on `config.endpoint.byFile` route)
140+
2. Tool sends it to **your** backend (on `config.endpoint.byFile` route)
141141
3. Your backend should save file and return file data with JSON at specified format.
142142
4. Image tool shows saved image and stores server answer
143143

@@ -158,24 +158,24 @@ Response of your uploader **should** cover following format:
158158

159159
**success** - uploading status. 1 for successful, 0 for failed
160160

161-
**file** - uploaded file data. **Must** contain an `url` field with full public path to the uploaded image.
162-
Also, can contain any additional fields you want to store. For example, width, height, id etc.
163-
All additional fields will be saved at the `file` object of output data.
161+
**file** - uploaded file data. **Must** contain an `url` field with full public path to the uploaded image.
162+
Also, can contain any additional fields you want to store. For example, width, height, id etc.
163+
All additional fields will be saved at the `file` object of output data.
164164

165165
### Uploading by pasted URL
166166

167167
Scenario:
168168

169-
1. User pastes and URL for image file to the Editor
169+
1. User pastes an URL of the image file to the Editor
170170
2. Editor pass pasted string to the Image Tool
171-
3. Tool sends it to **your** backend (on `config.endpoint.byUrl` route) via 'url' POST-parameter
171+
3. Tool sends it to **your** backend (on `config.endpoint.byUrl` route) via 'url' POST-parameter
172172
3. Your backend should accept URL, **download and save the original file by passed URL** and return file data with JSON at specified format.
173173
4. Image tool shows saved image and stores server answer
174174

175175
Response of your uploader should be at the same format as described at «[Uploading files from device](#from-device)» section
176-
177-
176+
177+
178178
### Uploading by drag-n-drop or from Clipboard
179179

180-
Your backend will accept file as FormData object in field name, specified by `config.field` (by default, «`image`»).
181-
You should save it and return the same response format as described above.
180+
Your backend will accept file as FormData object in field name, specified by `config.field` (by default, «`image`»).
181+
You should save it and return the same response format as described above.

0 commit comments

Comments
 (0)