Skip to content

Commit

Permalink
5.19.1
Browse files Browse the repository at this point in the history
  • Loading branch information
nmielnik committed May 28, 2016
1 parent d106f36 commit 931a8ff
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 9 deletions.
7 changes: 7 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
5.19.1 / 2016-05-28
==================
* Add feature for toggling anchor preview for empty or # links
* Fix keyboard paste to properly fire editablePaste
* Standardize editablePaste to always fire with mock event object


5.18.0 / 2016-05-21
==================
* Add support calling document.execCommand with arbitrary argument from execAction
Expand Down
24 changes: 21 additions & 3 deletions dist/js/medium-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -2957,7 +2957,7 @@ MediumEditor.extensions = {};
},

handlePaste: function (event) {
this.triggerCustomEvent('editablePaste', event, event.currentTarget);
this.triggerCustomEvent('editablePaste', { currentTarget: event.currentTarget, target: event.target }, event.currentTarget);
},

handleKeydown: function (event) {
Expand Down Expand Up @@ -3948,6 +3948,11 @@ MediumEditor.extensions = {};
*/
showWhenToolbarIsVisible: false,

/* showOnEmptyLinks: [boolean]
* determines whether the anchor tag preview shows up on links with href="" or href="#something"
*/
showOnEmptyLinks: true,

init: function () {
this.anchorPreview = this.createPreview();

Expand Down Expand Up @@ -4106,7 +4111,8 @@ MediumEditor.extensions = {};
// Detect empty href attributes
// The browser will make href="" or href="#top"
// into absolute urls when accessed as event.target.href, so check the html
if (!/href=["']\S+["']/.test(target.outerHTML) || /href=["']#\S+["']/.test(target.outerHTML)) {
if (!this.showOnEmptyLinks &&
(!/href=["']\S+["']/.test(target.outerHTML) || /href=["']#\S+["']/.test(target.outerHTML))) {
return true;
}

Expand Down Expand Up @@ -5214,6 +5220,12 @@ MediumEditor.extensions = {};
event.preventDefault();
this.removePasteBin();
this.doPaste(pastedHTML, pastedPlain, editable);

// The event handling code listens for paste on the editable element
// in order to trigger the editablePaste event. Since this paste event
// is happening on the pastebin, the event handling code never knows about it
// So, we have to trigger editablePaste manually
this.trigger('editablePaste', { currentTarget: editable, target: editable }, editable);
return;
}

Expand All @@ -5231,6 +5243,12 @@ MediumEditor.extensions = {};

// Handle the paste with the html from the paste bin
this.doPaste(pastedHTML, pastedPlain, editable);

// The event handling code listens for paste on the editable element
// in order to trigger the editablePaste event. Since this paste event
// is happening on the pastebin, the event handling code never knows about it
// So, we have to trigger editablePaste manually
this.trigger('editablePaste', { currentTarget: editable, target: editable }, editable);
}.bind(this), 0);
},

Expand Down Expand Up @@ -7540,7 +7558,7 @@ MediumEditor.parseVersionString = function (release) {

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

return MediumEditor;
Expand Down
8 changes: 4 additions & 4 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.18.0",
"version": "5.19.1",
"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.18.0'
'version': '5.19.1'
}).version);

0 comments on commit 931a8ff

Please sign in to comment.