Skip to content

Commit

Permalink
Add documentation for getContent method
Browse files Browse the repository at this point in the history
  • Loading branch information
nmielnik committed May 31, 2016
1 parent bd8ff32 commit 09ff452
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
18 changes: 14 additions & 4 deletions API.md
Expand Up @@ -37,6 +37,7 @@
- [Helper Functions](#helper-functions)
- [`checkContentChanged(editable)`](#checkContentChangededitable)
- [`delay(fn)`](#delayfn)
- [`getContent(index)`](#getcontentindex)
- [`getExtensionByName(name)`](#getextensionbynamename)
- [`serialize()`](#serialize)
- [`setContent(html, index)`](#setcontenthtml-index)
Expand Down Expand Up @@ -438,6 +439,16 @@ Delay any function from being executed by the amount of time passed as the **del

* Function to delay execution for.

***
### `getContent(index)`

Returns the trimmed html content for the first editor **element**, or the **element** at `index`.

**Arguments**

1. _**index** (`integer`)_: _**OPTIONAL**_
* Index of the editor **element** to retrieve the content from. Defaults to 0 when not provided (returns content of the first editor **element**).

***
### `getExtensionByName(name)`

Expand All @@ -457,16 +468,15 @@ Returns a JSON object including the content of each of the **elements** inside t
***
### `setContent(html, index)`

Sets the innerHTML content for the element at `index`.
Trigger the `editableInput` event.
Sets the html content for the first editor **element**, or the **element** at `index`. Ensures the the `editableInput` event is triggered.

**Arguments**

1. _**html** (`string`)_:
* The content to set the element to

2. _**index** (`integer`)_:
* Index of the element to set the content on. Defaults to 0 when not provided.
2. _**index** (`integer`)_: _**OPTIONAL**_
* Index of the editor **element** to set the content of. Defaults to 0 when not provided (sets content of the first editor **element**).

***
## Static Functions/Properties
Expand Down
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -555,6 +555,7 @@ View the [MediumEditor Object API documentation](API.md) on the Wiki for details

### Helper Methods
* __.delay(fn)__: delay any function from being executed by the amount of time passed as the `delay` option
* __.getContent(index)__: gets the trimmed `innerHTML` of the element at `index`
* __.getExtensionByName(name)__: get a reference to an extension with the specified name
* __.serialize()__: returns a JSON object with elements contents
* __.setContent(html, index)__: sets the `innerHTML` to `html` of the element at `index`
Expand Down

0 comments on commit 09ff452

Please sign in to comment.