EmbedPress – Embed Google Docs, YouTube, Maps, Vimeo, Wistia Videos & Upload PDF, PPT in Gutenberg & Elementor - Version 1.6.2

Version Description

Release Date: 2017-03-13

  • Fixed Issue embeds making them responsive
  • Fixed pasted text with wrappers
  • Fixed issue with doubled content on paste
  • Fixed issue when pasting formated text, it was loosing the formatation
Download this release

Release Info

Developer pressshack
Plugin Icon wp plugin EmbedPress – Embed Google Docs, YouTube, Maps, Vimeo, Wistia Videos & Upload PDF, PPT in Gutenberg & Elementor
Version 1.6.2
Comparing to
See all releases

Code changes from version 1.6.1 to 1.6.2

EmbedPress/Core.php CHANGED
@@ -135,6 +135,7 @@ class Core
135
  add_action('admin_enqueue_scripts', array('\EmbedPress\Ends\Back\Handler', 'enqueueStyles'));
136
 
137
  add_action('init', array('\EmbedPress\Disabler', 'run'), 1);
 
138
 
139
  $plgHandlerAdminInstance = new EndHandlerAdmin($this->getPluginName(), $this->getPluginVersion());
140
 
@@ -225,7 +226,7 @@ class Core
225
  */
226
  public static function canServiceProviderBeResponsive($serviceProviderAlias)
227
  {
228
- return in_array($serviceProviderAlias, array("dailymotion", "kickstarter", "rutube", "ted", "vimeo", "youtube", "ustream", "google-docs", "animatron", "amcharts", "on-aol-com", "animoto", "videojug"));
229
  }
230
 
231
  /**
@@ -342,4 +343,34 @@ class Core
342
 
343
  return $isAllowed;
344
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
345
  }
135
  add_action('admin_enqueue_scripts', array('\EmbedPress\Ends\Back\Handler', 'enqueueStyles'));
136
 
137
  add_action('init', array('\EmbedPress\Disabler', 'run'), 1);
138
+ add_action('init', array($this, 'configureTinyMCE'), 1);
139
 
140
  $plgHandlerAdminInstance = new EndHandlerAdmin($this->getPluginName(), $this->getPluginVersion());
141
 
226
  */
227
  public static function canServiceProviderBeResponsive($serviceProviderAlias)
228
  {
229
+ return in_array($serviceProviderAlias, array("dailymotion", "kickstarter", "rutube", "ted", "vimeo", "youtube", "ustream", "google-docs", "animatron", "amcharts", "on-aol-com", "animoto", "videojug", 'issuu'));
230
  }
231
 
232
  /**
343
 
344
  return $isAllowed;
345
  }
346
+
347
+ /**
348
+ * Add filters to configure the TinyMCE editor.
349
+ *
350
+ * @since 1.6.2
351
+ */
352
+ public function configureTinyMCE()
353
+ {
354
+ add_filter('teeny_mce_before_init', array($this, 'hookOnPaste'));
355
+ add_filter('tiny_mce_before_init', array($this, 'hookOnPaste'));
356
+ }
357
+
358
+ /**
359
+ * Hook the onPaste methof to the paste_preprocess config in the editor.
360
+ *
361
+ * @since 1.6.2
362
+ *
363
+ * @param array $mceInit
364
+ *
365
+ * @return array
366
+ */
367
+ public function hookOnPaste($mceInit)
368
+ {
369
+ // We hook here because the onPaste is sometimes called after the content was already added to the editor.
370
+ // If you copy text from the editor and paste there, it will give no way to use a normal onPaste event hook
371
+ // to modify the input since it was already injected.
372
+ $mceInit['paste_preprocess'] = 'function (plugin, args) {EmbedPress.onPaste(plugin, args);}';
373
+
374
+ return $mceInit;
375
+ }
376
  }
assets/css/embedpress.css CHANGED
@@ -19,7 +19,8 @@
19
  .ose-on-aol-com.responsive,
20
  .ose-animoto.responsive,
21
  .ose-soundcloud.responsive,
22
- .ose-videojug.responsive {
 
23
  overflow: hidden;
24
  position: relative;
25
  height: auto;
@@ -39,7 +40,8 @@
39
  .ose-on-aol-com.responsive iframe,
40
  .ose-animoto.responsive iframe,
41
  .ose-soundcloud.responsive iframe,
42
- .ose-videojug.responsive iframe {
 
43
  left: 0;
44
  top: 0;
45
  height: 100%;
@@ -89,3 +91,18 @@
89
  .ose-soundcloud.responsive {
90
  padding-bottom: 155px;
91
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  .ose-on-aol-com.responsive,
20
  .ose-animoto.responsive,
21
  .ose-soundcloud.responsive,
22
+ .ose-videojug.responsive,
23
+ .ose-issuu.responsive {
24
  overflow: hidden;
25
  position: relative;
26
  height: auto;
40
  .ose-on-aol-com.responsive iframe,
41
  .ose-animoto.responsive iframe,
42
  .ose-soundcloud.responsive iframe,
43
+ .ose-videojug.responsive iframe,
44
+ .ose-issuu.responsive iframe {
45
  left: 0;
46
  top: 0;
47
  height: 100%;
91
  .ose-soundcloud.responsive {
92
  padding-bottom: 155px;
93
  }
94
+
95
+ .ose-issuu.responsive iframe {
96
+ z-index: 2;
97
+ }
98
+
99
+ .ose-issuu.responsive {
100
+ padding-bottom: 31.25%;
101
+ }
102
+
103
+ .ose-issuu > div > div > div:last-child {
104
+ width: 100% !important;
105
+ z-index: 0;
106
+ position: absolute;
107
+ bottom: 0;
108
+ }
assets/css/preview.css CHANGED
@@ -148,4 +148,9 @@ span.hidden {
148
 
149
  .bootbox.modal {
150
  z-index: 100002;
 
 
 
 
 
151
  }
148
 
149
  .bootbox.modal {
150
  z-index: 100002;
151
+ }
152
+
153
+ /* Fix issuu preview */
154
+ .ose-issuu.responsive {
155
+ padding-bottom: 71.25% !important;
156
  }
assets/js/preview.js CHANGED
@@ -1072,9 +1072,6 @@
1072
  self.addStylesheet(PLG_SYSTEM_ASSETS_CSS_PATH + '/font.css?v=' + self.params.versionUID, editorInstance, editorInstance);
1073
  self.addStylesheet(PLG_SYSTEM_ASSETS_CSS_PATH + '/preview.css?v=' + self.params.versionUID, editorInstance, editorInstance);
1074
  self.addStylesheet(PLG_CONTENT_ASSETS_CSS_PATH + '/embedpress.css?v=' + self.params.versionUID, editorInstance, editorInstance);
1075
- self.addEvent('paste', editorInstance, function(a, b) {
1076
- self.onPaste(a, b, editorInstance);
1077
- });
1078
  self.addEvent('nodechange', editorInstance, self.onNodeChange);
1079
  self.addEvent('keydown', editorInstance, function(e) {
1080
  self.onKeyDown(e, editorInstance);
@@ -1148,9 +1145,11 @@
1148
  if (previewWrapperOlderSibling && previewWrapperOlderSibling.prop('tagName') && previewWrapperOlderSibling.prop('tagName').toUpperCase() === "P" && !previewWrapperOlderSibling.html().replace(/\&nbsp\;/i, '').length) {
1149
  previewWrapperOlderSibling.remove();
1150
  } else {
1151
- if (previewWrapperOlderSibling.html().match(/<[\/]?br>/)) {
1152
- if (!previewWrapperOlderSibling.prev().length) {
1153
- previewWrapperOlderSibling.remove();
 
 
1154
  }
1155
  }
1156
  }
@@ -1332,34 +1331,22 @@
1332
  };
1333
 
1334
  /**
1335
- * Callback triggered by paste events. Receives two arguments due to compatibility with JCE and TinyMCE that handles
1336
- * this event slightly different from each other.
 
1337
  *
1338
- * @param mixed - Can be either the Editor or Event
1339
- * @param mixed - Can be either the Editor or Event
1340
  *
1341
  * @return void
1342
  */
1343
 
1344
- self.onPaste = function(e, b, editorInstance) {
1345
  var urlPatternRegex = new RegExp(/(https?):\/\/([w]{3}\.)?.+?(?:\s|$)/i);
1346
-
1347
- var event = null;
1348
- if (e.preventDefault) {
1349
- event = e;
1350
- } else {
1351
- event = b;
1352
- }
1353
-
1354
- event.preventDefault();
1355
-
1356
  var urlPatternsList = self.getProvidersURLPatterns();
1357
-
1358
- // Check for clipboard data in various places for cross-browser compatibility an get its data as text.
1359
- var rawContent = ((e.originalEvent || e).clipboardData || window.clipboardData).getData('Text');
1360
-
1361
  // Split the pasted content into separated lines.
1362
- var contentLines = rawContent.split(/\n/g) || [];
1363
  contentLines = contentLines.map(function(line, itemIndex) {
1364
  // Check if there's a url into `line`.
1365
  if (line.match(urlPatternRegex)) {
@@ -1389,10 +1376,12 @@
1389
  return line;
1390
  });
1391
 
1392
- var content = '<p>'+ contentLines.join('') +'</p>';
 
1393
 
1394
- // Insert the new content into the editor.
1395
- editorInstance.execCommand('mceInsertContent', false, content);
 
1396
  };
1397
 
1398
  /**
1072
  self.addStylesheet(PLG_SYSTEM_ASSETS_CSS_PATH + '/font.css?v=' + self.params.versionUID, editorInstance, editorInstance);
1073
  self.addStylesheet(PLG_SYSTEM_ASSETS_CSS_PATH + '/preview.css?v=' + self.params.versionUID, editorInstance, editorInstance);
1074
  self.addStylesheet(PLG_CONTENT_ASSETS_CSS_PATH + '/embedpress.css?v=' + self.params.versionUID, editorInstance, editorInstance);
 
 
 
1075
  self.addEvent('nodechange', editorInstance, self.onNodeChange);
1076
  self.addEvent('keydown', editorInstance, function(e) {
1077
  self.onKeyDown(e, editorInstance);
1145
  if (previewWrapperOlderSibling && previewWrapperOlderSibling.prop('tagName') && previewWrapperOlderSibling.prop('tagName').toUpperCase() === "P" && !previewWrapperOlderSibling.html().replace(/\&nbsp\;/i, '').length) {
1146
  previewWrapperOlderSibling.remove();
1147
  } else {
1148
+ if (typeof previewWrapperOlderSibling.html() !== 'undefined') {
1149
+ if (previewWrapperOlderSibling.html().match(/<[\/]?br>/)) {
1150
+ if (!previewWrapperOlderSibling.prev().length) {
1151
+ previewWrapperOlderSibling.remove();
1152
+ }
1153
  }
1154
  }
1155
  }
1331
  };
1332
 
1333
  /**
1334
+ * Callback triggered by paste events. This should be hooked by TinyMCE's paste_preprocess
1335
+ * setting. A normal bind to the onPaste event doesn't work correctly all the times
1336
+ * (specially when you copy and paste content from the same editor).
1337
  *
1338
+ * @param mixed - plugin
1339
+ * @param mixed - args
1340
  *
1341
  * @return void
1342
  */
1343
 
1344
+ self.onPaste = function(plugin, args) {
1345
  var urlPatternRegex = new RegExp(/(https?):\/\/([w]{3}\.)?.+?(?:\s|$)/i);
 
 
 
 
 
 
 
 
 
 
1346
  var urlPatternsList = self.getProvidersURLPatterns();
1347
+
 
 
 
1348
  // Split the pasted content into separated lines.
1349
+ var contentLines = args.content.split(/\n/g) || [];
1350
  contentLines = contentLines.map(function(line, itemIndex) {
1351
  // Check if there's a url into `line`.
1352
  if (line.match(urlPatternRegex)) {
1376
  return line;
1377
  });
1378
 
1379
+ // Check if the text was transformed or not. If it was, add wrappers
1380
+ var content = contentLines.join('');
1381
 
1382
+ if (content.replace(/<br>$/, '') !== args.content) {
1383
+ args.content = '<p>'+ args.content +'</p>';
1384
+ }
1385
  };
1386
 
1387
  /**
changelog.txt CHANGED
@@ -1,5 +1,13 @@
1
  == Changelog ==
2
 
 
 
 
 
 
 
 
 
3
  = 1.6.1 =
4
  Release Date: 2017-03-07
5
 
1
  == Changelog ==
2
 
3
+ = 1.6.2 =
4
+ Release Date: 2017-03-13
5
+
6
+ * Fixed Issue embeds making them responsive
7
+ * Fixed pasted text with wrappers
8
+ * Fixed issue with doubled content on paste
9
+ * Fixed issue when pasting formated text, it was loosing the formatation
10
+
11
  = 1.6.1 =
12
  Release Date: 2017-03-07
13
 
embedpress.php CHANGED
@@ -12,7 +12,7 @@
12
  * @embedpress
13
  * Plugin Name: EmbedPress
14
  * Plugin URI: https://pressshack.com/embedpress/
15
- * Version: 1.6.1
16
  * Description: WordPress supports around 35 embed sources, but EmbedPress adds over 40 more, including Facebook, Google Maps, Google Docs, UStream! Just use the URL!
17
  * Author: PressShack
18
  * Author URI: http://pressshack.com
12
  * @embedpress
13
  * Plugin Name: EmbedPress
14
  * Plugin URI: https://pressshack.com/embedpress/
15
+ * Version: 1.6.2
16
  * Description: WordPress supports around 35 embed sources, but EmbedPress adds over 40 more, including Facebook, Google Maps, Google Docs, UStream! Just use the URL!
17
  * Author: PressShack
18
  * Author URI: http://pressshack.com
includes.php CHANGED
@@ -20,7 +20,7 @@ if (!defined('EMBEDPRESS_PLG_NAME')) {
20
  }
21
 
22
  if (!defined('EMBEDPRESS_PLG_VERSION')) {
23
- define('EMBEDPRESS_PLG_VERSION', "1.6.1");
24
  }
25
 
26
  if (!defined('EMBEDPRESS_PATH_BASE')) {
20
  }
21
 
22
  if (!defined('EMBEDPRESS_PLG_VERSION')) {
23
+ define('EMBEDPRESS_PLG_VERSION', "1.6.2");
24
  }
25
 
26
  if (!defined('EMBEDPRESS_PATH_BASE')) {
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: PressShack
3
  Tags: 23hq, amcharts, animoto, bambuser, cacoo, chartblocks, chirbit, circuitlab, cloudup, clyp, collegehumor, coub, crowd ranking, daily mile, dailymotion, devianart, dipity, dotsub, facebook, flickr, funnyordie, gettyimages, giphy, github gist, google docs, google drawings, google maps, google sheets, google slides, huffduffer, hulu, imgur, infogram, instagram, issuu, kickstarter, meetup, mixcloud, mobypicture, nfb, photobucket, polldaddy, porfolium, reddit, release wire, reverbnation, roomshare, rutube, sapo videos, scribd, shortnote, shoudio, sketchfab, slideshare, smugmug, soundcloud, speaker deck, spotify, ted, tumblr, twitter, ustream, viddler, videojug, videopress, vimeo, vine, wordpress tv, youtube, twitch tv
4
  Requires at least: 4.0
5
  Tested up to: 4.7
6
- Stable tag: 1.6.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -131,6 +131,14 @@ There're two ways to install EmbedPress plugin:
131
 
132
  == Changelog ==
133
 
 
 
 
 
 
 
 
 
134
  = 1.6.1 =
135
  Release Date: 2017-03-07
136
 
3
  Tags: 23hq, amcharts, animoto, bambuser, cacoo, chartblocks, chirbit, circuitlab, cloudup, clyp, collegehumor, coub, crowd ranking, daily mile, dailymotion, devianart, dipity, dotsub, facebook, flickr, funnyordie, gettyimages, giphy, github gist, google docs, google drawings, google maps, google sheets, google slides, huffduffer, hulu, imgur, infogram, instagram, issuu, kickstarter, meetup, mixcloud, mobypicture, nfb, photobucket, polldaddy, porfolium, reddit, release wire, reverbnation, roomshare, rutube, sapo videos, scribd, shortnote, shoudio, sketchfab, slideshare, smugmug, soundcloud, speaker deck, spotify, ted, tumblr, twitter, ustream, viddler, videojug, videopress, vimeo, vine, wordpress tv, youtube, twitch tv
4
  Requires at least: 4.0
5
  Tested up to: 4.7
6
+ Stable tag: 1.6.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
131
 
132
  == Changelog ==
133
 
134
+ = 1.6.2 =
135
+ Release Date: 2017-03-13
136
+
137
+ * Fixed Issue embeds making them responsive
138
+ * Fixed pasted text with wrappers
139
+ * Fixed issue with doubled content on paste
140
+ * Fixed issue when pasting formated text, it was loosing the formatation
141
+
142
  = 1.6.1 =
143
  Release Date: 2017-03-07
144