Skip to content
This repository has been archived by the owner on Dec 14, 2021. It is now read-only.

Commit

Permalink
Merge tag '0.9.2' into develop
Browse files Browse the repository at this point in the history
0.9.2
  • Loading branch information
marjinal1st committed May 7, 2014
2 parents 56db2d8 + 094c6bf commit a9fe34d
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 14 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@

#### [Current]
* [1338bb4](../../commit/1338bb4) - __(Ahmet Sezgin Duran)__ Update Medium Editor files

#### 0.9.1
* [20ecac5](../../commit/20ecac5) - __(Ahmet Sezgin Duran)__ Bump versions 0.9.1 and 1.8.6
* [f4f2a29](../../commit/f4f2a29) - __(Ahmet Sezgin Duran)__ Update Medium Editor files

#### 0.9.0
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This gem integrates [Medium Editor](https://github.com/daviferreira/medium-edito

## Version

The latest version of Medium Editor bundled by this gem is [1.8.6](https://github.com/daviferreira/medium-editor/releases)
The latest version of Medium Editor bundled by this gem is [1.8.8](https://github.com/daviferreira/medium-editor/releases)

## Installation

Expand Down
4 changes: 2 additions & 2 deletions lib/medium-editor-rails/version.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module MediumEditorRails
module Rails
VERSION = '0.9.1'
MEDIUM_EDITOR_VERSION = '1.8.6'
VERSION = '0.9.2'
MEDIUM_EDITOR_VERSION = '1.8.8'
end
end
45 changes: 39 additions & 6 deletions vendor/assets/javascripts/medium-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,17 @@ if (typeof module === 'object') {

bindParagraphCreation: function (index) {
var self = this;
this.elements[index].addEventListener('keypress', function (e) {
var node = getSelectionStart(),
tagName;
if (e.which === 32) {
tagName = node.tagName.toLowerCase();
if (tagName === 'a') {
document.execCommand('unlink', false, null);
}
}
});

this.elements[index].addEventListener('keyup', function (e) {
var node = getSelectionStart(),
tagName;
Expand Down Expand Up @@ -596,10 +607,7 @@ if (typeof module === 'object') {

checkActiveButtons: function () {
var elements = Array.prototype.slice.call(this.elements),
parentNode = this.selection.anchorNode;
if (!parentNode.tagName) {
parentNode = this.selection.anchorNode.parentNode;
}
parentNode = this.getSelectedParentElement();
while (parentNode.tagName !== undefined && this.parentElements.indexOf(parentNode.tagName.toLowerCase) === -1) {
this.activateButton(parentNode.tagName.toLowerCase());
this.callExtensions('checkState', parentNode);
Expand Down Expand Up @@ -668,8 +676,31 @@ if (typeof module === 'object') {
}
},

// http://stackoverflow.com/questions/15867542/range-object-get-selection-parent-node-chrome-vs-firefox
rangeSelectsSingleNode: function (range) {
var startNode = range.startContainer;
return startNode === range.endContainer &&
startNode.hasChildNodes() &&
range.endOffset === range.startOffset + 1;
},

getSelectedParentElement: function () {
var selectedParentElement = null,
range = this.selectionRange;
if (this.rangeSelectsSingleNode(range)) {
selectedParentElement = range.startContainer.childNodes[range.startOffset];
} else if (range.startContainer.nodeType === 3) {
selectedParentElement = range.startContainer.parentNode;
} else {
selectedParentElement = range.startContainer;
}
return selectedParentElement;
},

triggerAnchorAction: function () {
if (this.selection.anchorNode.parentNode.tagName.toLowerCase() === 'a') {
var selectedParentElement = this.getSelectedParentElement();
if (selectedParentElement.tagName &&
selectedParentElement.tagName.toLowerCase() === 'a') {
document.execCommand('unlink', false, null);
} else {
if (this.anchorForm.style.display === 'block') {
Expand Down Expand Up @@ -1000,6 +1031,7 @@ if (typeof module === 'object') {
if (this.options.targetBlank) {
this.setTargetBlank();
}
this.checkSelection();
this.showToolbarActions();
input.value = '';
},
Expand Down Expand Up @@ -1106,7 +1138,8 @@ if (typeof module === 'object') {
setPlaceholders: function () {
var i,
activatePlaceholder = function (el) {
if (el.textContent.replace(/^\s+|\s+$/g, '') === '') {
if (!(el.querySelector('img')) &&
el.textContent.replace(/^\s+|\s+$/g, '') === '') {
el.classList.add('medium-editor-placeholder');
}
},
Expand Down
5 changes: 0 additions & 5 deletions vendor/assets/stylesheets/medium-editor/medium-editor.css
Original file line number Diff line number Diff line change
Expand Up @@ -35,31 +35,26 @@
@keyframes pop-upwards {
0% {
-webkit-transform: matrix(0.97, 0, 0, 1, 0, 12);
-ms-transform: matrix(0.97, 0, 0, 1, 0, 12);
transform: matrix(0.97, 0, 0, 1, 0, 12);
opacity: 0; }

20% {
-webkit-transform: matrix(0.99, 0, 0, 1, 0, 2);
-ms-transform: matrix(0.99, 0, 0, 1, 0, 2);
transform: matrix(0.99, 0, 0, 1, 0, 2);
opacity: 0.7; }

40% {
-webkit-transform: matrix(1, 0, 0, 1, 0, -1);
-ms-transform: matrix(1, 0, 0, 1, 0, -1);
transform: matrix(1, 0, 0, 1, 0, -1);
opacity: 1; }

70% {
-webkit-transform: matrix(1, 0, 0, 1, 0, 0);
-ms-transform: matrix(1, 0, 0, 1, 0, 0);
transform: matrix(1, 0, 0, 1, 0, 0);
opacity: 1; }

100% {
-webkit-transform: matrix(1, 0, 0, 1, 0, 0);
-ms-transform: matrix(1, 0, 0, 1, 0, 0);
transform: matrix(1, 0, 0, 1, 0, 0);
opacity: 1; } }

Expand Down

0 comments on commit a9fe34d

Please sign in to comment.