This repository has been archived by the owner on Jul 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 364
Add parameters to RTE wrapper methods #284
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
65974cf
refactor: add parameters to rte wrapping methods
a0c574b
refactor: add parameters to rte wrapping methods
9718335
docs: update responsive tables/videos js sample
7b9ddaa
docs: add a table to explain parameters for responsive tables and videos
6ca1eba
docs: fix a typo in the Responsive tables/iframes section
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,14 +52,30 @@ $('#CloseModal').on('click', function() { | |
|
||
Tables and video embeds do not natively scale well on smaller screens. Slate adds a wrapper class to tables and video embeds that are loaded in from a rich text editor. | ||
|
||
| Parameters | Type | Description | | ||
| :------------------- | :------------ | :------------ | | ||
| `$tables` | jQuery object | `<table>` elements to be made responsive | | ||
| `tableWrapperClass` | string | CSS class to apply on the `<div>` that will wrap each targetted `<table>` element | | ||
| `$iframes` | jQuery object | `<iframe>` elements to be made responsive | | ||
| `iframeWrapperClass` | string | CSS class to apply on the `<div>` that will wrap each targetted `<iframe>` element | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. targeted instead of targetted |
||
|
||
``` | ||
// Wrap RTE tables | ||
$('.rte table').wrap('<div class="rte__table-wrapper"></div>'); | ||
// Wrap RTE tables to make them scrollable | ||
var tableSelectors = '.rte table'; | ||
|
||
slate.rte.wrapTable({ | ||
$tables: $(tableSelectors), | ||
tableWrapperClass: 'rte__table-wrapper', | ||
}); | ||
|
||
// Wrap RTE videos to make them responsive | ||
var videoSelectors = | ||
'.rte iframe[src*="youtube.com/embed"],' + | ||
'.rte iframe[src*="player.vimeo"]'; | ||
|
||
// Wrap RTE videos | ||
var $iframeVideo = $('.rte iframe[src*="youtube.com/embed"], .rte iframe[src*="player.vimeo"]'); | ||
$iframeVideo.each(function() { | ||
$(this).wrap('<div class="rte__video-wrapper"></div>'); | ||
slate.rte.wrapIframe({ | ||
$iframes: $(videoSelectors), | ||
iframeWrapperClass: 'rte__video-wrapper' | ||
}); | ||
``` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
targeted instead of targetted