You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary:
**Summary**
Prettier can also be used to format more than just JS files, it can format Markdown files too. Instead of using Flow parser for all files in `prettier.config.js`, we can just limit Flow parser for JS files and let Prettier find the default parsers for the various file formats.
Hence I tweaked the Prettier config and added overrides for:
- JS format - Use Flow parser
- Markdown format - Restrict to 80 characters so that it's easier to read
I then ran Prettier on all the docs. I've added a `prettier:diff` command into the `lint-docs` step, ran alongside with Alex that will fail when there are unformatted docs. It's not part of the CI step as I think that might be a bit too strict given that some people (including myself) edit docs in the GitHub UI and that might cause formatting issues which can be fixed by running the `format-docs` command every now and then.
The formatting is only restricted to the docs now and not code as it's potentially dangerous to format code that gets synced with internal FB repos.
**Test Plan**
Load website.
Pull Request resolved: facebookarchive#2275
Reviewed By: mrkev
Differential Revision: D18807420
Pulled By: yangshun
fbshipit-source-id: b3f34282c2a2cad8e89cd90e8f3f6b3860b747fc
Note that ExampleTokenComponent will receive contentState as a prop.
90
83
91
-
Why does the 'contentState' get passed into the decorator strategy now? Because we may need it if our strategy is to find certain entities in the contentBlock:
84
+
Why does the 'contentState' get passed into the decorator strategy now? Because we may need it if our strategy is to find certain entities in the contentBlock:
Copy file name to clipboardExpand all lines: docs/APIReference-ContentBlock.md
+22-18Lines changed: 22 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,29 +7,29 @@ title: ContentBlock
7
7
[Record](http://facebook.github.io/immutable-js/docs/#/Record/Record) that
8
8
represents the full state of a single block of editor content, including:
9
9
10
-
- Plain text contents of the block
11
-
- Type, e.g. paragraph, header, list item
12
-
- Entity, inline style, and depth information
10
+
- Plain text contents of the block
11
+
- Type, e.g. paragraph, header, list item
12
+
- Entity, inline style, and depth information
13
13
14
14
A `ContentState` object contains an `OrderedMap` of these `ContentBlock` objects,
15
15
which together comprise the full contents of the editor.
16
16
17
17
`ContentBlock` objects are largely analogous to block-level HTML elements like
18
18
paragraphs and list items. The available types are:
19
19
20
-
- unstyled
21
-
- paragraph
22
-
- header-one
23
-
- header-two
24
-
- header-three
25
-
- header-four
26
-
- header-five
27
-
- header-six
28
-
- unordered-list-item
29
-
- ordered-list-item
30
-
- blockquote
31
-
- code-block
32
-
- atomic
20
+
- unstyled
21
+
- paragraph
22
+
- header-one
23
+
- header-two
24
+
- header-three
25
+
- header-four
26
+
- header-five
27
+
- header-six
28
+
- unordered-list-item
29
+
- ordered-list-item
30
+
- blockquote
31
+
- code-block
32
+
- atomic
33
33
34
34
New `ContentBlock` objects may be created directly using the constructor.
35
35
Expected Record values are detailed below.
@@ -54,7 +54,7 @@ supplied text.
54
54
55
55
## Overview
56
56
57
-
*Methods*
57
+
_Methods_
58
58
59
59
<ulclass="apiIndex">
60
60
<li>
@@ -114,7 +114,7 @@ supplied text.
114
114
</li>
115
115
</ul>
116
116
117
-
*Properties*
117
+
_Properties_
118
118
119
119
> Note
120
120
>
@@ -161,13 +161,15 @@ supplied text.
161
161
```js
162
162
getKey(): string
163
163
```
164
+
164
165
Returns the string key for this `ContentBlock`. Block keys are alphanumeric string. It is recommended to use `generateRandomKey` to generate block keys.
165
166
166
167
### `getType()`
167
168
168
169
```js
169
170
getType(): DraftBlockType
170
171
```
172
+
171
173
Returns the type for this `ContentBlock`. Type values are largely analogous to
172
174
block-level HTML elements.
173
175
@@ -176,6 +178,7 @@ block-level HTML elements.
176
178
```js
177
179
getText(): string
178
180
```
181
+
179
182
Returns the full plaintext for this `ContentBlock`. This value does not contain
180
183
any styling, decoration, or HTML information.
181
184
@@ -204,6 +207,7 @@ This value uses the standard JavaScript `length` property for the string, and is
204
207
```js
205
208
getDepth(): number
206
209
```
210
+
207
211
Returns the depth value for this block, if any. This is currently used only for list items.
Copy file name to clipboardExpand all lines: docs/APIReference-Editor.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ See [API Basics](/docs/quickstart-api-basics) for an introduction.
16
16
### `editorState`
17
17
18
18
```js
19
-
editorState: EditorState
19
+
editorState: EditorState;
20
20
```
21
21
22
22
The `EditorState` object to be rendered by the `Editor`.
@@ -84,6 +84,7 @@ Optionally set a function to define custom block rendering. See [Advanced Topics
84
84
```js
85
85
blockRendererMap?: DraftBlockRenderMap
86
86
```
87
+
87
88
Provide a map of block rendering configurations. Each block type maps to element tag and an optional react element wrapper. This configuration is used for both rendering and paste processing. See
88
89
[Advanced Topics: Custom Block Rendering](/docs/advanced-topics-custom-block-render-map) for details on usage.
89
90
@@ -248,7 +249,7 @@ handleBeforeInput?: (
248
249
Handle the characters to be inserted from a `beforeInput` event. Returning `'handled'`
249
250
causes the default behavior of the `beforeInput` event to be prevented (i.e. it is
250
251
the same as calling the `preventDefault` method on the event).
251
-
Example usage: After a user has typed `-` at the start of a new block, you might
252
+
Example usage: After a user has typed `-` at the start of a new block, you might
252
253
convert that `ContentBlock` into an `unordered-list-item`.
253
254
254
255
At Facebook, we also use this to convert typed ASCII quotes into "smart" quotes,
0 commit comments