Skip to content

Commit 56acee3

Browse files
committed
Add unwrap tags documentation to other places (API, OPTIONS, README)
1 parent f5d2163 commit 56acee3

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

API.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -399,12 +399,12 @@ _replace the current selection with html_
399399

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

402-
* 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.
402+
* Optional overrides for `cleanTags`, `unwrapTags`, and/or `cleanAttrs` for removing/unwrapping specific element types (`cleanTags`/`unwrapTags`), or removing specific attributes (`cleanAttrs`) from the inserted HTML. See [cleanTags](OPTIONS.md#cleantags), [unwrapTags](OPTIONS.md#unwraptags), and [cleanAttrs](OPTIONS.md#cleanattrs) in OPTIONS.md for more information.
403403

404404
##### Example
405405

406406
```js
407-
editor.pasteHTML('<p class="classy"><strong>Some Custom HTML</strong></p>', { cleanAttrs: ['class'], cleanTags: ['strong']});
407+
editor.pasteHTML('<p class="classy"><strong>Some Custom HTML</strong></p>', { cleanAttrs: ['class'], cleanTags: ['strong'], unwrapTags: ['em']});
408408
```
409409

410410
***

OPTIONS.md

+1
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,7 @@ List of element tag names to remove during paste when __cleanPastedHTML__ is `tr
532532

533533
List of element tag names to unwrap (remove the element tag but retain its child elements) during paste when __cleanPastedHTML__ is `true` or when calling `cleanPaste(text)` or `pasteHTML(html,options)` helper methods.
534534

535+
***
535536
### Disabling Paste Handling
536537

537538
To disable MediumEditor manipulating pasted content, set the both the `forcePlainText` and `cleanPastedHTML` options to `false`:

README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,8 @@ var editor = new MediumEditor('.editable', {
337337
cleanPastedHTML: false,
338338
cleanReplacements: [],
339339
cleanAttrs: ['class', 'style', 'dir'],
340-
cleanTags: ['meta']
340+
cleanTags: ['meta'],
341+
unwrapTags: []
341342
}
342343
});
343344
```
@@ -456,7 +457,8 @@ var editor = new MediumEditor('.editable', {
456457
paste: {
457458
cleanPastedHTML: true,
458459
cleanAttrs: ['style', 'dir'],
459-
cleanTags: ['label', 'meta']
460+
cleanTags: ['label', 'meta'],
461+
unwrapTags: ['sub', 'sup']
460462
},
461463
anchorPreview: {
462464
hideDelay: 300

0 commit comments

Comments
 (0)