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

Rte helpers fallback class #294

Merged
merged 3 commits into from
Sep 27, 2017
Merged
Changes from all commits
Commits
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
8 changes: 6 additions & 2 deletions packages/slate-theme/src/scripts/slate/rte.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ slate.rte = {
* @param {string} options.tableWrapperClass - table wrapper class name
*/
wrapTable: function(options) {
options.$tables.wrap('<div class="' + options.tableWrapperClass + '"></div>');
var tableWrapperClass = typeof options.tableWrapperClass === "undefined" ? '' : options.tableWrapperClass;

options.$tables.wrap('<div class="' + tableWrapperClass + '"></div>');
},

/**
Expand All @@ -26,9 +28,11 @@ slate.rte = {
* @param {string} options.iframeWrapperClass - class name used on the wrapping div
*/
wrapIframe: function(options) {
var iframeWrapperClass = typeof options.iframeWrapperClass === "undefined" ? '' : options.iframeWrapperClass;

options.$iframes.each(function() {
// Add wrapper to make video responsive
$(this).wrap('<div class="' + options.iframeWrapperClass + '"></div>');
$(this).wrap('<div class="' + iframeWrapperClass + '"></div>');

// Re-set the src attribute on each iframe after page load
// for Chrome's "incorrect iFrame content on 'back'" bug.
Expand Down