Skip to content

Commit

Permalink
5.14.3 🎉
Browse files Browse the repository at this point in the history
  • Loading branch information
Rishi Jain committed Feb 22, 2016
1 parent 1213b43 commit 0244a95
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 8 deletions.
7 changes: 7 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
5.14.3 / 2016-02-22
==================
* Fix behaviour of "Open in new window" checkbox for Firefox
* Added instruction to disable file dragging all together
* Fix issue with image dragging and dropping at end of target
* Fix issue with extra space when space already exists

5.14.2 / 2016-02-10
==================
* Support Microsoft Edge
Expand Down
32 changes: 29 additions & 3 deletions dist/js/medium-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,25 @@ MediumEditor.extensions = {};
}
},

/*
* this function is called to explicitly remove the target='_blank' as FF holds on to _blank value even
* after unchecking the checkbox on anchor form
*/
removeTargetBlank: function (el, anchorUrl) {
var i;
if (el.nodeName.toLowerCase() === 'a') {
el.removeAttribute('target');
} else {
el = el.getElementsByTagName('a');

for (i = 0; i < el.length; i += 1) {
if (anchorUrl === el[i].attributes.href.value) {
el[i].removeAttribute('target');
}
}
}
},

addClassToAnchors: function (el, buttonClass) {
var classes = buttonClass.split(' '),
i,
Expand Down Expand Up @@ -4327,7 +4346,12 @@ MediumEditor.extensions = {};
// Prevent file from opening in the current window
event.preventDefault();
event.stopPropagation();

// Select the dropping target, and set the selection to the end of the target
// https://github.com/yabwe/medium-editor/issues/980
this.base.selectElement(event.target);
var selection = this.base.exportSelection();
selection.start = selection.end;
this.base.importSelection(selection);
// IE9 does not support the File API, so prevent file from opening in the window
// but also don't try to actually get the file
if (event.dataTransfer.files) {
Expand Down Expand Up @@ -5939,7 +5963,7 @@ MediumEditor.extensions = {};
textContent = node.textContent,
caretPositions = MediumEditor.selection.getCaretOffsets(node);

if ((textContent[caretPositions.left - 1] === undefined) || (textContent[caretPositions.left - 1].trim() === '')) {
if ((textContent[caretPositions.left - 1] === undefined) || (textContent[caretPositions.left - 1].trim() === '') || (textContent[caretPositions.left] !== undefined && textContent[caretPositions.left].trim() === '')) {
event.preventDefault();
}
}
Expand Down Expand Up @@ -6976,6 +7000,8 @@ MediumEditor.extensions = {};

if (this.options.targetBlank || opts.target === '_blank') {
MediumEditor.util.setTargetBlank(MediumEditor.selection.getSelectionStart(this.options.ownerDocument), opts.url);
} else {
MediumEditor.util.removeTargetBlank(MediumEditor.selection.getSelectionStart(this.options.ownerDocument), opts.url);
}

if (opts.buttonClass) {
Expand Down Expand Up @@ -7056,7 +7082,7 @@ MediumEditor.parseVersionString = function (release) {

MediumEditor.version = MediumEditor.parseVersionString.call(this, ({
// grunt-bump looks for this:
'version': '5.14.2'
'version': '5.14.3'
}).version);

return MediumEditor;
Expand Down
6 changes: 3 additions & 3 deletions dist/js/medium-editor.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "medium-editor",
"version": "5.14.2",
"version": "5.14.3",
"author": "Davi Ferreira <[email protected]>",
"contributors": [
{
Expand Down
2 changes: 1 addition & 1 deletion src/js/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ MediumEditor.parseVersionString = function (release) {

MediumEditor.version = MediumEditor.parseVersionString.call(this, ({
// grunt-bump looks for this:
'version': '5.14.2'
'version': '5.14.3'
}).version);

0 comments on commit 0244a95

Please sign in to comment.