Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Commit d02646e

Browse files
committed
v2.2.2
1 parent fe002ea commit d02646e

9 files changed

+37
-11
lines changed

CHANGES.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11

2+
2.2.2 / 2016-02-27
3+
==================
4+
5+
* Fix serializing html with embed codes containing scripts
6+
27
2.2.1 / 2016-02-05
38
==================
49

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "medium-editor-insert-plugin",
3-
"version": "2.2.1",
3+
"version": "2.2.2",
44
"description": "jQuery insert plugin for MediumEditor",
55
"main": [
66
"dist/js/medium-editor-insert-plugin.js",

dist/css/medium-editor-insert-plugin-frontend.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* medium-editor-insert-plugin v2.2.1 - jQuery insert plugin for MediumEditor
2+
* medium-editor-insert-plugin v2.2.2 - jQuery insert plugin for MediumEditor
33
*
44
* https://github.com/orthes/medium-editor-insert-plugin
55
*

dist/css/medium-editor-insert-plugin-frontend.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/css/medium-editor-insert-plugin.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* medium-editor-insert-plugin v2.2.1 - jQuery insert plugin for MediumEditor
2+
* medium-editor-insert-plugin v2.2.2 - jQuery insert plugin for MediumEditor
33
*
44
* https://github.com/orthes/medium-editor-insert-plugin
55
*

dist/css/medium-editor-insert-plugin.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js/medium-editor-insert-plugin.js

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* medium-editor-insert-plugin v2.2.1 - jQuery insert plugin for MediumEditor
2+
* medium-editor-insert-plugin v2.2.2 - jQuery insert plugin for MediumEditor
33
*
44
* https://github.com/orthes/medium-editor-insert-plugin
55
*
@@ -274,6 +274,12 @@ this["MediumInsert"]["Templates"]["src/js/templates/images-toolbar.hbs"] = Handl
274274

275275
$data.find('.medium-insert-buttons').remove();
276276

277+
// Restore original embed code from embed wrapper attribute value.
278+
$data.find('[data-embed-code]').each(function() {
279+
var $this = $(this);
280+
$this.html($this.attr('data-embed-code'));
281+
});
282+
277283
data[key].value = $data.html();
278284
});
279285

@@ -1063,10 +1069,25 @@ this["MediumInsert"]["Templates"]["src/js/templates/images-toolbar.hbs"] = Handl
10631069
success: function(data) {
10641070
var html = data && data.html;
10651071

1066-
if (data && !data.html && data.type === 'photo' && data.url) {
1072+
if (data && !html && data.type === 'photo' && data.url) {
10671073
html = '<img src="' + data.url + '" alt="">';
10681074
}
10691075

1076+
if (!html) {
1077+
// Prevent render empty embed.
1078+
$.proxy(that, 'convertBadEmbed', url)();
1079+
return;
1080+
}
1081+
1082+
if (html && html.indexOf('</script>') > -1) {
1083+
// Store embed code with <script> tag inside wrapper attribute value.
1084+
// Make nice attribute value escaping using jQuery.
1085+
var $div = $('<div>')
1086+
.attr('data-embed-code', html)
1087+
.html(html);
1088+
html = $('<div>').append($div).html();
1089+
}
1090+
10701091
$.proxy(that, 'embed', html)();
10711092
},
10721093
error: function(jqXHR, textStatus, errorThrown) {

dist/js/medium-editor-insert-plugin.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "medium-editor-insert-plugin",
3-
"version": "2.2.1",
3+
"version": "2.2.2",
44
"description": "jQuery insert plugin for MediumEditor",
55
"license": "MIT",
66
"homepage": "https://github.com/orthes/medium-editor-insert-plugin",

0 commit comments

Comments
 (0)