Skip to content
This repository has been archived by the owner on Jul 19, 2021. It is now read-only.

Commit

Permalink
refactor: add parameters to rte wrapping methods
Browse files Browse the repository at this point in the history
Instead of hard-coding strings directly in the div-wrapping rte methods,
we allow parameters to be passed to improve scalability
and reusability of these methods throughout themes.
  • Loading branch information
Maxime Vaillancourt committed Sep 15, 2017
1 parent 65974cf commit a0c574b
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions packages/slate-theme/src/scripts/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,23 @@ $(document).ready(function() {
slate.a11y.pageLinkFocus($(evt.currentTarget.hash));
});

// Wrap videos in div to force responsive layout.
slate.rte.wrapTable();
slate.rte.iframeReset();
// Target tables to make them scrollable
var tableSelectors = '.rte table';

slate.rte.wrapTable({
$tables: $(tableSelectors),
tableWrapperClass: 'rte__table-wrapper',
});

// Target iframes to make them responsive
var iframeSelectors =
'.rte iframe[src*="youtube.com/embed"],' +
'.rte iframe[src*="player.vimeo"]';

slate.rte.wrapIframe({
$iframes: $(iframeSelectors),
iframeWrapperClass: 'rte__video-wrapper'
});

// Apply a specific class to the html element for browser support of cookies.
if (slate.cart.cookiesEnabled()) {
Expand Down

0 comments on commit a0c574b

Please sign in to comment.