Socket
Socket
Sign inDemoInstall

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.4 to 4.12.5

5

CHANGES.md

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

4.12.5 / 2015-06-16
==================
* Fix issue with restoring selection within nested block elements
4.12.4 / 2015-06-15

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

2

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

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

@@ -217,2 +217,17 @@ /*global MediumEditor, describe, it, expect, spyOn,

it('should import a position with the cursor after an empty block element when there are nested block elements', function () {
this.el.innerHTML = '<blockquote><p><span>www.google.com</span></p></blockquote><h1><br /></h1><h2><br /></h2><p>Whatever</p>';
var editor = this.newMediumEditor('.editor', {
buttons: ['italic', 'underline', 'strikethrough']
});
editor.importSelection({
'start': 14,
'end': 14,
'emptyBlocksIndex': 2
});
var startParagraph = Util.getClosestTag(window.getSelection().getRangeAt(0).startContainer, 'h2');
expect(startParagraph).toBe(editor.elements[0].querySelector('h2'), 'block element after empty block element');
});
it('should import a position with the cursor after an empty block element inside an element with various children', function () {

@@ -219,0 +234,0 @@ this.el.innerHTML = '<p><span>www.google.com</span></p><h1><br /></h1><h2><br /></h2><p><b><i>Whatever</i></b></p>';

@@ -8,3 +8,3 @@ /*global Util */

function filterOnlyParentElements(node) {
if (Util.parentElements.indexOf(node.nodeName.toLowerCase()) !== -1) {
if (Util.isBlockContainer(node)) {
return NodeFilter.FILTER_ACCEPT;

@@ -282,3 +282,3 @@ } else {

while (el && Util.parentElements.indexOf(tagName) === -1) {
while (el && !Util.isBlockContainer(el)) {
el = el.parentNode;

@@ -285,0 +285,0 @@ if (el && el.tagName) {

@@ -399,3 +399,3 @@ /*global NodeFilter, Selection*/

tagName = parentNode.tagName.toLowerCase();
while (this.parentElements.indexOf(tagName) === -1 && tagName !== 'div') {
while (!this.isBlockContainer(parentNode) && tagName !== 'div') {
if (tagName === 'li') {

@@ -656,4 +656,3 @@ return true;

sibling;
while (node.nodeType === 3 ||
(this.parentElements.indexOf(node.tagName.toLowerCase()) === -1 && !node.getAttribute('data-medium-element'))) { // TODO: Change this in v5.0.0
while (!this.isBlockContainer(node) && !this.isMediumEditorElement(node)) {
sibling = node;

@@ -671,5 +670,13 @@ while (sibling = sibling.previousSibling) {

isMediumEditorElement: function (element) {
return element && element.nodeType !== 3 && !!element.getAttribute('data-medium-element');
},
isBlockContainer: function (element) {
return element && element.nodeType !== 3 && this.parentElements.indexOf(element.nodeName.toLowerCase()) !== -1;
},
getBlockContainer: function (element) {
return this.traverseUp(element, function (el) {
return Util.parentElements.indexOf(el.tagName.toLowerCase()) !== -1;
return Util.isBlockContainer(el) && !Util.isBlockContainer(el.parentNode);
});

@@ -676,0 +683,0 @@ },

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

// grunt-bump looks for this:
'version': '4.12.4'
'version': '4.12.5'
}).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