Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Commit

Permalink
Documentation updates
Browse files Browse the repository at this point in the history
Summary:Added some missing documentation.

I didn't really document `RichUtils`, I just added a placeholder so it's at least easy to find out which methods are available without having to resort to the source code (and the names should be self explanatory enough for it to be good for now).

Resolves #263
Closes #269

Differential Revision: D3139568

fb-gh-sync-id: 34cfa671c189b561c6a84c5ba991be224019dbe1
fbshipit-source-id: 34cfa671c189b561c6a84c5ba991be224019dbe1
  • Loading branch information
remko authored and Facebook Github Bot 2 committed Apr 5, 2016
1 parent 226d361 commit 8ac9cf3
Show file tree
Hide file tree
Showing 5 changed files with 146 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/APIReference-Data-Conversion.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ id: api-reference-data-conversion
title: Data Conversion
layout: docs
category: API Reference
next: api-reference-modifier
next: api-reference-rich-utils
permalink: docs/api-reference-data-conversion.html
---

Expand Down
19 changes: 19 additions & 0 deletions docs/APIReference-Editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,3 +211,22 @@ onUpArrow?: (e: SyntheticKeyboardEvent) => void
```
onDownArrow?: (e: SyntheticKeyboardEvent) => void
```


## Methods

#### focus

```
focus(): void
```

Force focus back onto the editor node.

#### blur

```
blur(): void
```

Remove focus from the editor node.
124 changes: 124 additions & 0 deletions docs/APIReference-RichUtils.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
---
id: api-reference-rich-utils
title: RichUtils
layout: docs
category: API Reference
next: api-reference-modifier
permalink: docs/api-reference-rich-utils.html
---

The `RichUtils` module is a static set of utility functions for rich text
editing.

In each case, these methods accept `EditorState` objects with relevant
parameters and return `EditorState` objects.

## Static Methods

### currentBlockContainsLink

```
currentBlockContainsLink(
editorState: EditorState
): boolean
```

### getCurrentBlockType

```
getCurrentBlockType(
editorState: EditorState
): string
```

### handleKeyCommand

```
handleKeyCommand(
editorState: EditorState,
command: string
): boolean
```

### insertSoftNewline

```
insertSoftNewline(
editorState: EditorState
): EditorState
```

### onBackspace

```
onBackspace(
editorState: EditorState
): EditorState?
```

### onDelete

```
onDelete(
editorState: EditorState
): EditorState?
```

### onTab

```
onTab(
event: SyntheticEvent,
editorState: EditorState,
maxDepth: integer
): EditorState
```

### toggleBlockType

```
toggleBlockType(
editorState: EditorState,
blockType: string
): EditorState
```

### toggleCode

```
toggleCode(
editorState: EditorState
): EditorState
```

### toggleInlineStyle

```
toggleInlineStyle(
editorState: EditorState,
inlineStyle: string
): EditorState
```

Toggle the specified inline style for the selection. If the
user's selection is collapsed, apply or remove the style for the
internal state. If it is not collapsed, apply the change directly
to the document state.

### toggleLink

```
toggleLink(
editorState: EditorState,
targetSelection: SelectionState,
entityKey: string
): EditorState
```

### tryToRemoveBlockStyle

```
tryToRemoveBlockStyle(
editorState: EditorState
): EditorState?
```
2 changes: 1 addition & 1 deletion docs/Advanced-Topics-Nested-Lists.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The Draft framework provides support for nested lists, as demonstrated in the
Facebook Notes editor. There, you can use `Tab` and `Shift+Tab` to add or remove
depth to a list item.

The `RichUtils` module provides a handy `onTab` method that manages this
The [`RichUtils`](/draft-js/docs/api-reference-rich-utils.html) module provides a handy `onTab` method that manages this
behavior, and should be sufficient for most nested list needs. You can use
the `onTab` prop on your `Editor` to make use of this utility.

Expand Down
2 changes: 1 addition & 1 deletion docs/QuickStart-Rich-Styling.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ However, since your top-level React component is responsible for maintaining the
state, you also have the freedom to apply changes to that `EditorState` object
in any way you see fit.

For inline and block style behavior, for example, the `RichUtils` module
For inline and block style behavior, for example, the [`RichUtils`](/draft-js/docs/api-reference-editor-state.html) module
provides a number of useful functions to help manipulate state.

Similarly, the [Modifier](/draft-js/docs/api-reference-modifier.html) module also provides a
Expand Down

0 comments on commit 8ac9cf3

Please sign in to comment.