Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

medium-editor

Package Overview
Dependencies
Maintainers
4
Versions
125
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

medium-editor - npm Package Compare versions

Comparing version 4.12.8 to 4.12.9

5

CHANGES.md

@@ -0,1 +1,6 @@

4.12.9 / 2015-08-12
==================
* Fix a regression in the paste extension related to `pasteHTML` function
4.12.8 / 2015-08-10

@@ -2,0 +7,0 @@ ==================

2

package.json
{
"name": "medium-editor",
"version": "4.12.8",
"version": "4.12.9",
"author": "Davi Ferreira <hi@daviferreira.com>",

@@ -5,0 +5,0 @@ "contributors": [

@@ -314,2 +314,19 @@ /*global MediumEditor, describe, it, expect, spyOn,

});
it('should cleanup only pasted element on multi-line when nothing is selected', function () {
var editor = this.newMediumEditor('.editor', {
paste: {
forcePlainText: false,
cleanPastedHTML: true
}
});
this.el.innerHTML = '<div><img src="http://0.0.0.0/ohyeah.png" /></div>';
selectElementContents(this.el.firstChild, { collapse: true });
editor.cleanPaste('<table><tr><td>test</td><td><br/></td></tr></table>');
expect(this.el.innerHTML).toContain('<img src="http://0.0.0.0/ohyeah.png"></div>');
});
});

@@ -325,2 +342,19 @@

it('should not remove node with "empty" content', function () {
var editor = this.newMediumEditor('.editor', {
paste: {
forcePlainText: false,
cleanPastedHTML: true
}
});
this.el.innerHTML = '<div>this is a div</div><figure id="editor-inner">and this is a figure</figure>.';
selectElementContents(this.el.firstChild);
editor.pasteHTML('<table><tr><td>test</td><td><br/></td></tr></table>');
expect(this.el.innerHTML).toContain('<table><tbody><tr><td>test</td><td><br></td></tr></tbody></table>');
});
it('should accept a list of attrs to clean up', function () {

@@ -327,0 +361,0 @@ var editor = this.newMediumEditor('.editor');

@@ -143,3 +143,3 @@ /*global Util, Extension */

cleanPaste: function (text) {
var i, elList,
var i, elList, tmp, workEl,
multiline = /<p|<br|<div/.test(text),

@@ -156,6 +156,30 @@ replacements = createReplacements().concat(this.cleanReplacements || []);

// create a temporary div to cleanup block elements
tmp = this.document.createElement('div');
// double br's aren't converted to p tags, but we want paragraphs.
elList = text.split('<br><br>');
tmp.innerHTML = '<p>' + text.split('<br><br>').join('</p><p>') + '</p>';
this.pasteHTML('<p>' + elList.join('</p><p>') + '</p>');
// block element cleanup
elList = tmp.querySelectorAll('a,p,div,br');
for (i = 0; i < elList.length; i += 1) {
workEl = elList[i];
// Microsoft Word replaces some spaces with newlines.
// While newlines between block elements are meaningless, newlines within
// elements are sometimes actually spaces.
workEl.innerHTML = workEl.innerHTML.replace(/\n/gi, ' ');
switch (workEl.nodeName.toLowerCase()) {
case 'p':
case 'div':
this.filterCommonBlocks(workEl);
break;
case 'br':
this.filterLineBreak(workEl);
break;
}
}
this.pasteHTML(tmp.innerHTML);
},

@@ -190,23 +214,2 @@

// block element cleanup
elList = fragmentBody.querySelectorAll('a,p,div,br');
for (i = 0; i < elList.length; i += 1) {
workEl = elList[i];
// Microsoft Word replaces some spaces with newlines.
// While newlines between block elements are meaningless, newlines within
// elements are sometimes actually spaces.
workEl.innerHTML = workEl.innerHTML.replace(/\n/gi, ' ');
switch (workEl.nodeName.toLowerCase()) {
case 'p':
case 'div':
this.filterCommonBlocks(workEl);
break;
case 'br':
this.filterLineBreak(workEl);
break;
}
}
Util.insertHTMLCommand(this.document, fragmentBody.innerHTML.replace(/&nbsp;/g, ' '));

@@ -213,0 +216,0 @@ },

@@ -14,3 +14,3 @@ /*global MediumEditor */

// grunt-bump looks for this:
'version': '4.12.8'
'version': '4.12.9'
}).version.split('.'));

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc