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

medium-editor

Package Overview
Dependencies
Maintainers
6
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 5.14.4 to 5.15.0

9

CHANGES.md

@@ -0,1 +1,10 @@

5.15.0 / 2016-03-23
==================
* Use class instead of inline style for hiding/showing anchor form
* Add helpers for hiding/showing form into form extension base class
* Fix issue where auto-link extension re-enabled IE's built-in auto-link when other instances still existed
* Fix anchor form to display form before attempting to position correctly
* Add new selection.clearSelection() helper method for moving cursor to beginning/end of selection
5.14.4 / 2016-02-25

@@ -2,0 +11,0 @@ ==================

7

Gruntfile.js

@@ -66,3 +66,3 @@ /*global module, require, process*/

browserName: 'googlechrome',
platform: 'OS X 10.10'
platform: 'OS X 10.11'
}, {

@@ -76,6 +76,9 @@ browserName: 'firefox',

browserName: 'firefox',
platform: 'OS X 10.11'
}, {
browserName: 'safari',
platform: 'OS X 10.10'
}, {
browserName: 'safari',
platform: 'OS X 10.10'
platform: 'OS X 10.11'
}];

@@ -82,0 +85,0 @@

{
"name": "medium-editor",
"version": "5.14.4",
"version": "5.15.0",
"author": "Davi Ferreira <hi@daviferreira.com>",

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

@@ -17,2 +17,19 @@ /*global fireEvent, selectElementContents,

describe('Anchor Form', function () {
it('should add class for visible state and remove it for invisivble', function () {
var editor = this.newMediumEditor('.editor', {
buttonLabels: 'fontawesome'
}),
anchorExtension = editor.getExtensionByName('anchor'),
toolbar = editor.getExtensionByName('toolbar'),
activeClass = anchorExtension.activeClass;
selectElementContentsAndFire(editor.elements[0]);
var button = toolbar.getToolbarElement().querySelector('[data-action="createLink"]');
fireEvent(button, 'click');
expect(anchorExtension.getForm().classList.contains(activeClass)).toBe(true);
fireEvent(anchorExtension.getForm().querySelector('a.medium-editor-toolbar-save'), 'click');
expect(anchorExtension.getForm().classList.contains(activeClass)).toBe(false);
});
it('should not hide the toolbar when mouseup fires inside the anchor form', function () {

@@ -19,0 +36,0 @@ var editor = this.newMediumEditor('.editor', {

@@ -57,2 +57,35 @@ /*global fireEvent, selectElementContentsAndFire */

});
it('should not reset multiple browser auto-links (if supported) during destroy', function () {
var autoUrlDetectTurnedOn = true,
origExecCommand = document.execCommand,
origQCS = document.queryCommandSupported;
this.el = this.createElement('div', 'editor2', '');
spyOn(document, 'execCommand').and.callFake(function (command, showUi, val) {
if (command === 'AutoUrlDetect') {
autoUrlDetectTurnedOn = val;
}
return origExecCommand.apply(document, arguments);
});
spyOn(document, 'queryCommandSupported').and.callFake(function (command) {
if (command === 'AutoUrlDetect') {
return true;
}
return origQCS.apply(document, arguments);
});
var
editor = this.newMediumEditor('.editor', {
autoLink: true
}),
editor2 = this.newMediumEditor('.editor2', {
autoLink: true
});
expect(autoUrlDetectTurnedOn).toBe(false);
editor.destroy();
expect(autoUrlDetectTurnedOn).toBe(false);
editor2.destroy();
expect(autoUrlDetectTurnedOn).toBe(true);
});
});

@@ -59,0 +92,0 @@

@@ -486,2 +486,28 @@ /*global selectElementContents, placeCursorInsideElement, isSafari */

});
describe('clearSelection', function () {
it('should clear the selection and set the caret to the start of the prior range when specified', function () {
this.el.innerHTML = '<p>this is<span> </span>text</p>';
selectElementContents(this.el.querySelector('p'));
var selectionStart = document.getSelection().anchorOffset;
MediumEditor.selection.clearSelection(document, true);
expect(document.getSelection().focusOffset).toBe(selectionStart);
var newSelectionEnd = document.getSelection().focusOffset;
expect(newSelectionEnd).toBe(selectionStart);
});
it('should clear the selection and set the caret to the end of the prior range by default', function () {
this.el.innerHTML = '<p>this is<span> </span>text</p>';
selectElementContents(this.el.querySelector('p'));
var selectionEnd = document.getSelection().focusOffset;
MediumEditor.selection.clearSelection(document);
expect(document.getSelection().anchorOffset).toBe(selectionEnd);
var newSelectionStart = document.getSelection().anchorOffset;
expect(newSelectionStart).toBe(selectionEnd);
});
});
});

@@ -140,7 +140,7 @@ (function () {

isDisplayed: function () {
return this.getForm().style.display === 'block';
return MediumEditor.extensions.form.prototype.isDisplayed.apply(this);
},
hideForm: function () {
this.getForm().style.display = 'none';
MediumEditor.extensions.form.prototype.hideForm.apply(this);
this.getInput().value = '';

@@ -165,3 +165,3 @@ },

this.hideToolbarDefaultActions();
this.getForm().style.display = 'block';
MediumEditor.extensions.form.prototype.showForm.apply(this);
this.setToolbarPosition();

@@ -168,0 +168,0 @@

@@ -44,5 +44,16 @@ (function () {

isLastInstance: function () {
var activeInstances = 0;
for (var i = 0; i < this.window._mediumEditors.length; i++) {
var editor = this.window._mediumEditors[i];
if (editor !== null && editor.getExtensionByName('autoLink') !== undefined) {
activeInstances++;
}
}
return activeInstances === 1;
},
destroy: function () {
// Turn AutoUrlDetect back on
if (this.document.queryCommandSupported('AutoUrlDetect')) {
if (this.document.queryCommandSupported('AutoUrlDetect') && this.isLastInstance()) {
this.document.execCommand('AutoUrlDetect', false, true);

@@ -49,0 +60,0 @@ }

@@ -17,2 +17,7 @@ (function () {

/* activeClass: [string]
* set class which added to shown form
*/
activeClass: 'medium-editor-toolbar-form-active',
/* hasForm: [boolean]

@@ -40,10 +45,30 @@ *

*/
isDisplayed: function () {},
isDisplayed: function () {
if (this.hasForm) {
return this.getForm().classList.contains(this.activeClass);
}
return false;
},
/* hideForm: [function ()]
*
* This function should show the form element inside
* the toolbar container
*/
showForm: function () {
if (this.hasForm) {
this.getForm().classList.add(this.activeClass);
}
},
/* hideForm: [function ()]
*
* This function should hide the form element inside
* the toolbar container
*/
hideForm: function () {},
hideForm: function () {
if (this.hasForm) {
this.getForm().classList.remove(this.activeClass);
}
},

@@ -50,0 +75,0 @@ /************************ Helpers ************************

@@ -91,2 +91,4 @@ # Extensions

* A Medium Editor extension for adding custom 'mention' support, circa Medium 2.0.
* [MediumEditor AutoList](https://github.com/varun-raj/medium-editor-autolist)
* A Medium Editor extension for converting `1.` and `*` into ordered lists and unordered lists.

@@ -115,5 +117,9 @@

* [MediumEditor Custom HTML](https://github.com/jillix/medium-editor-custom-html)
* An extension that inserts custom HTML using a new button in the Medium Editor toolbar
* An extension that inserts custom HTML using a new button in the MediumEditor toolbar
* [MediumButton](https://github.com/arcs-/MediumButton)
* Extends your Medium Editor with the possibility add buttons.
* [MediumEditor Handsontable](https://github.com/asselinpaul/medium-editor-handsontable)
* Supports adding [handsontable](https://handsontable.com/) spreadsheets to MediumEditor.
* [MediumEditor Lists](https://github.com/mkawczynski07/medium-editor-list)
* Adds a "Add Paragraph" button which allows for inserting customized paragraphs to MediumEditor

@@ -120,0 +126,0 @@

@@ -633,2 +633,16 @@ (function () {

/**
* Clear the current highlighted selection and set the caret to the start or the end of that prior selection, defaults to end.
*
* @param {DomDocument} doc Current document
* @param {boolean} moveCursorToStart A boolean representing whether or not to set the caret to the beginning of the prior selection.
*/
clearSelection: function (doc, moveCursorToStart) {
if (moveCursorToStart) {
doc.getSelection().collapseToStart();
} else {
doc.getSelection().collapseToEnd();
}
},
/**
* Move cursor to the given node with the given offset.

@@ -635,0 +649,0 @@ *

@@ -18,3 +18,3 @@ MediumEditor.parseVersionString = function (release) {

// grunt-bump looks for this:
'version': '5.14.4'
'version': '5.15.0'
}).version);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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

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

Sorry, the diff of this file is not supported yet

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