Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge newest changes into our fork #2

Merged
merged 164 commits into from
Jul 9, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
164 commits
Select commit Hold shift + click to select a range
2ac7e84
First ugly draft
j0k3r Jun 19, 2015
9ff83e8
Log, log everything
j0k3r Jun 25, 2015
cf4e7e7
Revert change on dist file
j0k3r Feb 12, 2016
beaee64
Revert some unecessary code change
j0k3r Feb 12, 2016
7604d31
Fix jslint issues and errors thrown during tests
nmielnik Feb 13, 2016
4297b43
Get custom paste working for every paste
nmielnik Feb 13, 2016
a66fae7
Get rid of the console logs from paste extension
nmielnik Feb 26, 2016
1da1b73
paste-handling: remove some member variables from paste handler
nmielnik Feb 26, 2016
3cc4165
paste-handling: re-enable default paste handling + remove keyboard ti…
nmielnik Feb 26, 2016
d15e1b6
paste-handling: use clipboard helper for regular paste + remove hasCo…
nmielnik Feb 26, 2016
2b56591
paste-handling: revert demo
nmielnik Feb 26, 2016
0f35c34
paste-handling: Refactor handlePasteBinPaste to look similar to handl…
nmielnik Feb 26, 2016
2a4cc97
paste-handling: refactor and reduce two paste handling paths
nmielnik Feb 26, 2016
a994a1b
ignore .idea
Liu-Young Mar 23, 2016
65595eb
Prevent Firefox NS_ERROR_FAILURE: on keyup
nextend Mar 24, 2016
5fa8ddb
Update core.js
nextend Mar 24, 2016
119790d
paste-handling: convert trimHTML into replacements
nmielnik Mar 26, 2016
57b66b9
Reuse selectRange helper method in other places
nmielnik Mar 27, 2016
7f86599
paste-handling: extract methods that shouldn't be part of paste handl…
nmielnik Mar 27, 2016
6fbc62a
Convert spaces to %20 in links if linkValidation is true for the anch…
Mar 28, 2016
45103b7
Added separate test verification if linkValidation is false
Mar 28, 2016
792c06b
merge yabwe/medium-editor
Liu-Young Mar 28, 2016
109dadf
Merge pull request #1026 from Liu-Young/master
nmielnik Mar 28, 2016
5a9f383
Used encodeURI instead of replacing strings to catch other unwanted c…
Mar 29, 2016
87fcbee
Updated documentation for linkValidation encoding update
Mar 29, 2016
3336df0
Merge pull request #1025 from dyzhu12/spaces-in-linkvalidation
Mar 29, 2016
fe63999
Rename RELEASE-PROCESS.md
nmielnik Mar 29, 2016
fcd919a
Add instructions for running tests on external fork PRs in saucelabs
nmielnik Mar 29, 2016
09fac62
Updated test - Made the diff between input and validUrl only spaces
Mar 30, 2016
f34ec1d
Make correction to external fork steps
nmielnik Mar 30, 2016
2666a42
Merge pull request #1029 from yabwe/maintiner-docs
Mar 30, 2016
5701619
Fix anchor test failure due to cross-browser issues
nmielnik Mar 30, 2016
dd2a8a4
paste-handling: Add first test for paste-bin
nmielnik Mar 30, 2016
23f5999
Merge pull request #1033 from yabwe/integrate-1030
Mar 30, 2016
396d069
paste-handling: cleanup pasteBin and fix defaultPrevented check
nmielnik Mar 30, 2016
2c36447
paste-handling: Add some more core tests for keyboard paste
nmielnik Mar 30, 2016
4a49394
paste-handling: Add tests to fully cover new functionality
nmielnik Apr 1, 2016
59ff45c
Fix IE bugs
vansosnin Apr 5, 2016
d2fd976
5.15.1
linkesch Apr 5, 2016
5a1fe1e
make event functions chainable
linkesch Apr 8, 2016
94d923a
allow multiple targets in attachDOMEvent and detachDOMEvent
linkesch Apr 8, 2016
cb39b46
Merge pull request #1043 from vansosnin/fix-ie-css-bugs
nmielnik Apr 8, 2016
070f68a
update docs
linkesch Apr 8, 2016
d65496b
Merge pull request #1046 from yabwe/function-chaining
nmielnik Apr 8, 2016
2999aad
Merge remote-tracking branch 'nextend/patch-1' into integrate-1020
nmielnik Apr 10, 2016
77a80ce
Re-organize content.spec.js a bit
nmielnik Apr 10, 2016
e533593
Add Test and comment for fix for #994
nmielnik Apr 10, 2016
6d0f2e2
Merge pull request #1052 from yabwe/integrate-1020
nmielnik Apr 10, 2016
46660a0
Fix #1047 - Add 'positionedToolbar' custom event (#1050)
nmielnik Apr 12, 2016
55b7292
5.16.0
nmielnik Apr 12, 2016
23733da
replace break-all with break-word
linkesch Apr 13, 2016
b5bd1db
Merge pull request #1058 from yabwe/fix-1057
j0k3r Apr 14, 2016
5687829
5.16.1
linkesch Apr 14, 2016
4a39865
add issue and PR templates
linkesch Apr 15, 2016
911ba36
add jsbin and codepen to example link
linkesch Apr 17, 2016
64ce92b
Merge pull request #1062 from yabwe/add-issue-pr-templates
nmielnik Apr 18, 2016
38f3366
fix typo
gabefinch Apr 22, 2016
50500e4
Merge pull request #1070 from gabefinch/patch-3
nmielnik Apr 22, 2016
0007885
Fix #942 Add core checkContentChanged method and use it for button ex…
nmielnik May 5, 2016
a27fa81
Add tests for covering checkContentChanged
nmielnik May 5, 2016
c95a7a0
Merge pull request #973 from yabwe/firefox-paste
j0k3r May 7, 2016
008eb67
Merge pull request #1077 from yabwe/update-button-example
j0k3r May 7, 2016
09dbc35
Almost final attempt
rvetere Apr 1, 2016
82b3308
Get rid of reRunSetupListener and refactored setupListener's "editabl…
rvetere Apr 4, 2016
0435447
Update documentation for addElements and removeElements
nmielnik Apr 5, 2016
46504df
Standardize usage of array operation helpers for dyn-add-elements
nmielnik Apr 5, 2016
bafaf99
Add textarea tests for addElements
nmielnik Apr 5, 2016
6595b37
Convert elements into array for addElements and removeElements
nmielnik Apr 5, 2016
1c6a192
Refactor core internal helpers to not require 'this' references
nmielnik Apr 19, 2016
38ee22d
Add tests to cover destroy/setup bug with dynamic added/removed elements
nmielnik Apr 19, 2016
4e75f71
Support selector and nodelist for addElements + removeElements
nmielnik Apr 23, 2016
4216302
Don't worry about setup/destroy for add/removeElements just yet
nmielnik Apr 28, 2016
afda230
Add tests for calling removeElements with textareas
nmielnik Apr 29, 2016
ebcc14a
Make sure textareas are cleaned up correctly in removeElements
nmielnik Apr 29, 2016
46de61f
Add more add/remove elements examples to README
nmielnik Apr 29, 2016
8a5a1af
Add more add/remove elements tests, including event handlers
nmielnik Apr 29, 2016
9fffcfb
Add test for dynamically adding disable-return element
nmielnik May 6, 2016
8f146ac
Extract initElement helper from initElements
nmielnik May 6, 2016
94dc021
Move textarea initializing into initElement
nmielnik May 7, 2016
a82ac86
Move attaching existing events to elements into initElement
nmielnik May 7, 2016
5019322
Have setup use addElements to share common code path
nmielnik May 7, 2016
a51beaf
Rename events.attachAllEvents for consistency
nmielnik May 7, 2016
fcf7021
Remove unneeded addElement method
nmielnik May 7, 2016
a8784dc
execActionInternal should pass opt to document.execCommand if action …
May 13, 2016
a8ec5b7
Merge pull request #1038 from yabwe/dyn-add-elements
nmielnik May 16, 2016
15f11ce
Add test to verify fix for #869
nmielnik May 17, 2016
977e27c
Add regex to paste to remove supportLists comment from Word
nmielnik May 17, 2016
b5fbcd3
Merge pull request #1087 from yabwe/fix-869
j0k3r May 17, 2016
4017f64
5.17.0
nmielnik May 17, 2016
1f269d2
Fix null pointer during the cleanupElement event
lexderuijter May 18, 2016
7661a80
Update events.js
lexderuijter May 18, 2016
01be0ed
Update events.js
lexderuijter May 18, 2016
5af3bb9
Update events.js
lexderuijter May 18, 2016
2c6c610
Merge pull request #1089 from lexderuijter/patch-1
nmielnik May 18, 2016
50503d5
refactor MediumEditor.execAction to use opts.value as an argument pas…
May 20, 2016
c4c0dae
Merge pull request #1086 from Stackle/fix-execAction
nmielnik May 21, 2016
8ae5da9
Fix failures from new tests in IE & Edge
nmielnik May 21, 2016
87f2b83
Merge pull request #1095 from yabwe/fix-ie-test-failures
nmielnik May 21, 2016
6eb365a
Deprecate .url, .size, and .name for execAction
nmielnik May 21, 2016
858f45f
Update API.md with more details about arguments
nmielnik May 21, 2016
e23b635
Add test to ensure bc for .url option for createLink
nmielnik May 21, 2016
6cbe285
Merge pull request #1094 from yabwe/deprecate-execaction-opts
nmielnik May 21, 2016
e7b67c9
Merge pull request #1093 from yabwe/api-doc-updates
nmielnik May 21, 2016
0820080
5.18.0
nmielnik May 21, 2016
030bba5
Add test to ensure editablePaste is triggered on keyboard paste
nmielnik May 26, 2016
ba41d1d
Add test to verify editablePaste is triggered on normal paste
nmielnik May 26, 2016
9989601
Ensure editablePaste is triggered on keyboard paste
nmielnik May 26, 2016
8bd8f8f
Ensure editablePaste always gets consistent data when called
nmielnik May 26, 2016
9b50c78
Allow preview to be shown on empty links
May 26, 2016
f56f450
Merge pull request #1100 from Olgagr/show-preview-on-empty-links
nmielnik May 26, 2016
d106f36
Merge pull request #1099 from yabwe/editable-paste-fix
j0k3r May 27, 2016
931a8ff
5.19.1
nmielnik May 28, 2016
1b81e1a
Update tests to ensure unique ids when timestamp is same
nmielnik May 28, 2016
709136a
Remove broken code for adding index to textarea-div id
nmielnik May 28, 2016
e60e3c5
Add the id of the editor instance to each element
nmielnik May 28, 2016
1f6b988
Add tests for removing element attr on destroy
nmielnik May 29, 2016
ae97e82
Add getEditorFromElement static helper
nmielnik May 29, 2016
d16e3f8
Add getEditorByElement and version to API documentation
nmielnik May 29, 2016
cfc151f
Merge pull request #1102 from yabwe/editor-ids
nmielnik May 31, 2016
bd8ff32
Add getContent helper method
nmielnik May 30, 2016
09ff452
Add documentation for getContent method
nmielnik May 30, 2016
01ff0ec
Merge pull request #1103 from yabwe/get-content
j0k3r Jun 1, 2016
ea44e1d
documented the showOnEmptyLink option
Jun 1, 2016
36177f4
Merge pull request #1106 from yabwe/docEmptyLinks
nmielnik Jun 1, 2016
ee23d21
Add resetContent helper method
nmielnik May 31, 2016
84ca479
Add documentation for resetContent
nmielnik May 31, 2016
4a9e912
Respect form.reset for textareas
nmielnik May 31, 2016
4ec89df
Fix bug in resetContent logic
nmielnik May 31, 2016
1d15b51
Merge pull request #1104 from yabwe/reset-content
j0k3r Jun 1, 2016
4bbdf9d
Add grunt to local packages and create NPM build script
Jun 1, 2016
9075759
Add getInteractionElements to extension contract for preventing blur
nmielnik Jun 1, 2016
3475cea
Merge pull request #1107 from guidiego/grunt-to-local-packages
nmielnik Jun 1, 2016
8027d21
Add test failure for #1105
nmielnik Jun 2, 2016
a0c3e1c
Fix #1105
nmielnik Jun 2, 2016
bab8a7b
Merge pull request #1112 from yabwe/anchor-preview-fix
Jun 2, 2016
df7a633
Add documentation for getInteractionElements for extensions
nmielnik Jun 1, 2016
59c06de
Merge pull request #1108 from yabwe/interaction-elements
nmielnik Jun 2, 2016
d496a1c
5.20.0
nmielnik Jun 2, 2016
4a7c46e
Fix test failure in Chrome 51
nmielnik Jun 6, 2016
b1585f2
Use class selector instead attribute selector
nmielnik Jun 6, 2016
e2a79ae
Update tests to expect new medium-editor-element class
nmielnik Jun 6, 2016
3cf797e
Merge pull request #1114 from yabwe/chrome-test-fix
nmielnik Jun 6, 2016
a8d2932
Merge pull request #1115 from yabwe/css-lint-fix
j0k3r Jun 6, 2016
a1c2f80
Fix #234 - Cursor rendering incorrectly in firefox
nmielnik Jun 4, 2016
59f67a3
Improve documentation for toolbar.relativeContainer option
nmielnik Jun 14, 2016
5d0d522
Merge pull request #1122 from yabwe/docs-update
j0k3r Jun 14, 2016
95d9be8
Work around firefox test case failing in saucelabs only
nmielnik Jun 17, 2016
00183a5
Merge pull request #1113 from yabwe/fix-234
j0k3r Jun 17, 2016
a07ac0c
5.20.2
j0k3r Jun 17, 2016
2c8be4c
Add addElement custom event when elements are added
nmielnik Jun 18, 2016
5a6d79c
Add documentation for addElement custom event
nmielnik Jun 18, 2016
2eb96ee
Fix bug in paste handler introduced by 8bd8f8f007
nmielnik Jun 18, 2016
f749f0d
Expose removeElement custom event
nmielnik Jun 18, 2016
7930d1e
Ensure placeholder extension initializes dynamically added elements
nmielnik Jun 18, 2016
5b129be
Ensure placeholder extensions cleans up removed elements
nmielnik Jun 18, 2016
e37199d
Undo changes from 8bd8f8f
nmielnik Jun 18, 2016
57ce44e
#1123 Fixes issue with electron environment
Jun 20, 2016
ce7c0d7
1123, adds strict check for object
Jun 20, 2016
d71cf26
Merge pull request #1125 from sajus/master
j0k3r Jun 20, 2016
f8412b3
#1127 | Placeholder is visible when only empty table is in Editor.
Jun 20, 2016
258d1df
Merge pull request #1124 from yabwe/paste-handler-fix
nmielnik Jun 20, 2016
e39438a
#1127 | Add Test cases
Jun 21, 2016
78e42b1
Merge pull request #1128 from durgeshahire4/master
nmielnik Jun 21, 2016
d57e4b2
5.21.0
j0k3r Jun 21, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
### Description

[Description of the bug or feature]

### Steps to reproduce

1. [First step]
2. [Second step]
3. [and so on...]

**Expected behavior:** [What you expected to happen]

**Actual behavior:** [What actually happened]

**Link to an example:** [If you're reporting a bug that's not reproducible on our [demo page](https://yabwe.github.io/medium-editor/demo.html), please try to reproduce it on [JSFiddle](https://jsfiddle.net/), [JS Bin](https://jsbin.com), [CodePen](http://codepen.io/) or a similar service and paste a link here]

### Versions

- medium-editor:
- browser:
- OS:
17 changes: 17 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
| Q | A
| ---------------- | ---
| Bug fix? | yes/no
| New feature? | yes/no
| BC breaks? | yes/no
| Deprecations? | yes/no
| New tests added? | yes/not needed
| Fixed tickets | comma-separated list of tickets fixed by the PR, if any
| License | MIT

### Description

[Description of the bug or feature]

--

#### Please, don't submit `/dist` files with your PR!
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ reports/
coverage/
._*

#PhpStorm IDE
.idea/
# IDE
.idea/
225 changes: 208 additions & 17 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
- [`MediumEditor(elements, options)`](#mediumeditorelements-options)
- [`destroy()`](#destroy)
- [`setup()`](#setup)
- [`addElements()`](#addelementselements)
- [`removeElements()`](#removeelementselements)
- [Event Functions](#event-functions)
- [`on(target, event, listener, useCapture)`](#ontarget-event-listener-usecapture)
- [`off(target, event, listener, useCapture)`](#offtarget-event-listener-usecapture)
- [`on(targets, event, listener, useCapture)`](#ontargets-event-listener-usecapture)
- [`off(targets, event, listener, useCapture)`](#offtargets-event-listener-usecapture)
- [`subscribe(name, listener)`](#subscribename-listener)
- [`unsubscribe(name, listener)`](#unsubscribename-listener)
- [`trigger(name, data, editable)`](#triggername-data-editable)
Expand All @@ -33,10 +35,16 @@
- [`pasteHTML(html, options)`](#pastehtmlhtml-options)
- [`queryCommandState(action)`](#querycommandstateaction)
- [Helper Functions](#helper-functions)
- [`checkContentChanged(editable)`](#checkContentChangededitable)
- [`delay(fn)`](#delayfn)
- [`getContent(index)`](#getcontentindex)
- [`getExtensionByName(name)`](#getextensionbynamename)
- [`resetContent(element)`](#resetcontentelement)
- [`serialize()`](#serialize)
- [`setContent(html, index)`](#setcontenthtml-index)
- [Static Functions/Properties](#static-functionsproperties)
- [`getEditorFromElement(element)`](#geteditorfromelementelement)
- [`version`](#version)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

Expand All @@ -46,14 +54,17 @@

Creating an instance of MediumEditor will:
* Convert all passed in elements into `contenteditable` elements.
* For any `<textarea>` elements, hide the `<textarea>`, create a new `<div contenteditable=true>` element, and ensure the 2 elements remain sync'd.
* For any `<textarea>` elements:
* Hide the `<textarea>`
* Create a new `<div contenteditable=true>` element and add it to the elements array.
* Ensure the 2 elements remain sync'd.
* Initialize any custom extensions or buttons passed in.
* Create any additional elements needed.
* Setup all event handling needed to monitor the editable elements.

**Arguments**

_**elements** (`String` | `HTMLElement` | `Array`)_:
_**elements** (`String` | `HTMLElement` | `Array` | `NodeList` | `HTMLCollection`)_:

1. `String`: If passed as a string, this is used as a selector in a call to `document.querySelectorAll()` to find elements on the page. All results are stored in the internal list of **elements**.

Expand All @@ -80,18 +91,67 @@ Tear down the editor if already setup by doing the following:

Initialize this instance of the editor if it has been destroyed. This will reuse the `elements` selector and `options` object passed in when the editor was instantiated.

***
### `addElements(elements)`

Dynamically add one or more elements to an already initialized instance of MediumEditor.

Passing an elements or array of elements to `addElements(elements)` will:
* Add the given element or array of elements to the editor **elements**
* Ensure the element(s) are initialized with the proper attributes and event handlers as if the element had been passed during instantiation of the editor
* For any `<textarea>` elements:
* Hide the `<textarea>`
* Create a new `<div contenteditable=true>` element and add it to the editor **elements**
* Ensure the 2 elements remain sync'd.
* Be intelligent enough to run the necessary code only once per element, no matter how often you will call it

So, every element you pass to `addElements` will turn into a fully supported contenteditable too - even earlier calls to `editor.subscribe(..)`
for custom events will work on the newly added element(s).

**Arguments**

_**elements** (`String` | `HTMLElement` | `Array` | `NodeList` | `HTMLCollection`)_:

1. `String`: If passed as a string, this is used as a selector in a call to `document.querySelectorAll()` to find elements on the page.

2. `HTMLElement`: If passed as a single element, this will be the only element added to the editor **elements**.

3. `Array` | `NodeList` | `HTMLCollection`: If passed as an `Array`-like collection of `HTMLElement`s, all of these elements will be added to the editor **elements**.

***
### `removeElements(elements)`

Remove one or more elements from an already initialized instance of MediumEditor.

Passing an elements or array of elements to `removeElements(elements)` will:
* Remove the given element or array of elements from the internal `this.elements` array.
* Remove any added event handlers or attributes (with the exception of `contenteditable`).
* Unhide any `<textarea>` elements and remove any created `<div>` elements created for `<textarea>` elements.

Each element itself will remain a contenteditable - it will just remove all event handlers and all references to it so you can safely remove it from DOM.

**Arguments**

_**elements** (`String` | `HTMLElement` | `Array` | `NodeList` | `HTMLCollection`)_:

1. `String`: If passed as a string, this is used as a selector in a call to `document.querySelectorAll()` to find elements on the page.

2. `HTMLElement`: If passed as a single element, this will be the only element removed from the editor **elements**.

3. `Array` | `NodeList` | `HTMLCollection`: If passed as an `Array`-like collection of `HTMLElement`s, all of these elements will be removed from the editor **elements**.

***
## Event Functions

### `on(target, event, listener, useCapture)`
### `on(targets, event, listener, useCapture)`

Attaches an event listener to specific element via the browser's built-in `addEventListener(type, listener, useCapture)` API. However, this helper method also ensures that when MediumEditor is destroyed, this event listener will be automatically be detached from the DOM.
Attaches an event listener to a specific element or elements via the browser's built-in `addEventListener(type, listener, useCapture)` API. However, this helper method also ensures that when MediumEditor is destroyed, this event listener will be automatically be detached from the DOM.

**Arguments**

1. _**target** (`HTMLElement`)_:
1. _**targets** (`HTMLElement` / `NodeList`)_:

* Element to attach listener to via `addEventListener(type, listener, useCapture)`
* Element or elements to attach listener to via `addEventListener(type, listener, useCapture)`

2. _**event** (`String`)_:

Expand All @@ -106,15 +166,15 @@ Attaches an event listener to specific element via the browser's built-in `addEv
* useCapture argument for `addEventListener(type, listener, useCapture)`

***
### `off(target, event, listener, useCapture)`
### `off(targets, event, listener, useCapture)`

Detach an event listener from a specific element via the browser's built-in `removeEventListener(type, listener, useCapture)` API.
Detach an event listener from a specific element or elements via the browser's built-in `removeEventListener(type, listener, useCapture)` API.

**Arguments**

1. _**target** (`HTMLElement`)_:
1. _**targets** (`HTMLElement` / `NodeList`)_:

* Element to detach listener from via `removeEventListener(type, listener, useCapture)`
* Element or elements to detach listener from via `removeEventListener(type, listener, useCapture)`

2. _**event** (`String`)_:

Expand Down Expand Up @@ -227,6 +287,12 @@ Returns a reference to the editor **element** that currently has focus (if the e

Returns a reference to the editor **element** that the user's selection is currently within.

**Arguments**

1. _**range** (`Range`)_: _**OPTIONAL**_
* The `Range` to find the selection parent element within
* If no element is provided, the editor will use the current range within the selection of the editor's `contentWindow`

***
### `restoreSelection()`

Expand Down Expand Up @@ -269,25 +335,101 @@ Enable the toolbar to start updating based on the user's selection, after a call
### `cleanPaste(text)`
_convert text to plaintext and replace current selection with result_

**Arguments**

1. _**text** (`String`)_:

* Content to be pasted at the location of the current selection/cursor

***
### `createLink(opts)`
_creates a link via the native `document.execCommand('createLink')` command_

**Arguments**

1. _**opts** (`Object`)_:

* Object containing additional properties needed for creating a link

**Properties of 'opts'**

1. _**value** (`String`)_ _**REQUIRED**_
* The url to set as the `href` of the created link. A non-empty value must be provided for the link to be created.
2. _**target** (`String`)_
* Attribute to set as the `target` attribute of the created link. Passing 'self' or not passing this option at all are equivalent in that they will just ensure that `target="_blank"` will NOT be present on the created link.
* **NOTE** If the `targetBlank` option on the editor is set to true, the `target` property of opts will be ignored and `target="_blank"` will be added to all created links.
3. _**buttonClass** (`String`)_
* Class (or classes) to append to the `class` attribute of the created link.

##### Example

```js
editor.createLink({ value: 'https://github.com/yabwe/medium-editor', target: '_blank', buttonClass: 'medium-link' });
```

***
### `execAction(action, opts)`
_executes an built-in action via document.execCommand_

**Arguments**

1. _**action** (`String`)_:

* Action to be passed as the 'command' argument to `document.execCommand(command, showDefaultUI, value)`

2. _**opts** (`Object`)_ _**OPTIONAL**_:

* Object containing additional properties for specific commands

**Properties of 'opts'**

1. _**value** (`String`)_
* The value to pass as the 'value' argument to `document.execCommand(command, showDefaultUI, value)`
2. For 'createLink', the `opts` are passed directly to [`.createLink(opts)`]((#createlinkopts)) so see that method for additional options for that command

***
### `pasteHTML(html, options)`
_replace the current selection with html_

**Arguments**

1. _**html** (`String`)_:

* Content to be pasted at the location of the current selection/cursor

2. _**options** (`Object`)_ _**OPTIONAL**_:

* Optional overrides for `cleanTags` and/or `cleanAttrs` for removing specific element types (`cleanTags`) or specific attributes (`cleanAttrs`) from the inserted HTML. See [cleanTags](OPTIONS.md#cleantags) and [cleanAttrs](OPTIONS.md#cleanattrs) in OPTIONS.md for more information.

##### Example

```js
editor.pasteHTML('<p class="classy"><strong>Some Custom HTML</strong></p>', { cleanAttrs: ['class'], cleanTags: ['strong']});
```

***
### `queryCommandState(action)`
_wrapper around the browser's built in `document.queryCommandState(action)` for checking whether a specific action has already been applied to the selection._
_wrapper around the browser's built in `document.queryCommandState(command)` for checking whether a specific action has already been applied to the selection._

**Arguments**

1. _**action** (`String`)_:

* Action to be passed as the 'command' argument to `document.queryCommandState(command)`

***
## Helper Functions

### `checkContentChanged(editable)`

Trigger the editor to check for updates to the html, and trigger the `editableInput` event if needed.

**Arguments**

1. _**editable** (`HTMLElement`)_: _**OPTIONAL**_
* The `<div contenteditable=true></div>` element that contains the html that may have changed.
* If no element is provided, the editor will check the currently 'active' editor element (the element with focus).

### `delay(fn)`

Delay any function from being executed by the amount of time passed as the **delay** option.
Expand All @@ -298,6 +440,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 @@ -309,6 +461,17 @@ Get a reference to an extension with the specified name.

* The name of the extension to retrieve (ie `toolbar`).

***
### `resetContent(element)`

Reset the content of all editor **elements** to their value at the time they were added to the editor. If a specific editor **element** is provided, only the content of that element will be reset.

**Arguments**

1. _**element** (`DOMElement`)_: _**OPTIONAL**_

* Specific editor **element** to reset the content of.

***
### `serialize()`

Expand All @@ -317,13 +480,41 @@ 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

### `getEditorFromElement(element)`

Given an editor **element**, retrieves the instance of MediumEditor which created/is monitoring the **element**

**Arguments**

1. _**element** (`DOMElement`)_:
* An editor **element** which is part of a MediumEditor instance

### `version`

Object containing data about the version of the current MediumEditor library

**Properties of 'version'**

1. _**major** (`Number`)_
* The major version number (ie the `3` in `"3.2.1"`)
2. _**minor** (`Number`)_
* The minor version number (ie the `2` in `"3.2.1"`)
3. _**revision** (`Number`)_
* The revision (aka "patch") version number (ie the `1` in `"3.2.1"`)
4. _**preRelease** (`String`)_
* The pre-release version tag (ie the `"rc.1"` in `"5.0.0-rc.1"`)
5. _**toString** (`Function`)_
* Returns the full version number as a string (ie `"5.0.0-rc.1"`)
Loading