Skip to content

Commit

Permalink
Merge branch 'yacomink-master'
Browse files Browse the repository at this point in the history
Conflicts:
	dist/js/medium-editor.min.js
  • Loading branch information
daviferreira committed Feb 5, 2015
2 parents cbe698a + d60b6f1 commit ada0306
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 22 deletions.
35 changes: 25 additions & 10 deletions dist/js/medium-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -1204,15 +1204,7 @@ if (typeof module === 'object') {
}
},

findMatchingSelectionParent: function (testElementFunction) {
var selection = this.options.contentWindow.getSelection(), range, current;

if (selection.rangeCount === 0) {
return false;
}

range = selection.getRangeAt(0);
current = range.commonAncestorContainer;
traverseUp: function (current, testElementFunction) {

do {
if (current.nodeType === 1) {
Expand All @@ -1229,6 +1221,21 @@ if (typeof module === 'object') {
} while (current);

return false;

},

findMatchingSelectionParent: function (testElementFunction) {
var selection = this.options.contentWindow.getSelection(), range, current;

if (selection.rangeCount === 0) {
return false;
}

range = selection.getRangeAt(0);
current = range.commonAncestorContainer;

return this.traverseUp(current, testElementFunction);

},

getSelectionElement: function () {
Expand Down Expand Up @@ -2201,7 +2208,10 @@ if (typeof module === 'object') {
var i,
el,
new_el,
spans = container_el.querySelectorAll('.replace-with');
spans = container_el.querySelectorAll('.replace-with'),
isCEF = function (el) {
return (el && el.nodeName !== '#text' && el.getAttribute('contenteditable') === 'false');
};

for (i = 0; i < spans.length; i += 1) {

Expand All @@ -2227,6 +2237,11 @@ if (typeof module === 'object') {

el = spans[i];

// bail if span is in contenteditable = false
if (this.traverseUp(el, isCEF)) {
return false;
}

// remove empty spans, replace others with their contents
if (/^\s*$/.test()) {
el.parentNode.removeChild(el);
Expand Down
Loading

0 comments on commit ada0306

Please sign in to comment.