Skip to content

Commit

Permalink
Fix for issue #976
Browse files Browse the repository at this point in the history
  • Loading branch information
dmx-patrick committed Jul 20, 2017
1 parent 20dc823 commit 3a9ee74
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions spec/util.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,9 +389,10 @@ describe('MediumEditor.util', function () {

it('should execute indent command when called with blockquote when isIE is true', function () {
var origIsIE = MediumEditor.util.isIE,
el = this.createElement('div', '', '<p>Some <b>Text</b></p>');
el = this.createElement('div', 'editable', '<p>Some <b>Text</b></p>');
this.newMediumEditor('.editable');
MediumEditor.util.isIE = true;
el.setAttribute('contenteditable', true);
//el.setAttribute('contenteditable', true);
selectElementContents(el.querySelector('b'));
spyOn(document, 'execCommand');

Expand Down Expand Up @@ -579,9 +580,9 @@ describe('MediumEditor.util', function () {

describe('getTopBlockContainer', function () {
it('should return the highest level block container', function () {
var el = this.createElement('div', '', '<blockquote><p>paragraph</p><ul><li><span>list item</span></li></ul></blockquote>'),
span = el.querySelector('span'),
container = MediumEditor.util.getTopBlockContainer(span);
var el = this.createElement('div', 'editable', '<blockquote><p>paragraph</p><ul><li><span>list item</span></li></ul></blockquote>');
this.newMediumEditor('.editable');
var container = MediumEditor.util.getTopBlockContainer(el.querySelector('span'));
expect(container).toBe(el.querySelector('blockquote'));
});

Expand Down
4 changes: 2 additions & 2 deletions src/js/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
// all other known block elements
'address', 'article', 'aside', 'audio', 'canvas', 'dd', 'dl', 'dt', 'fieldset',
'figcaption', 'figure', 'footer', 'form', 'header', 'hgroup', 'main', 'nav',
'noscript', 'output', 'section', 'video',
'noscript', 'output', 'section', 'video', 'div',
'table', 'thead', 'tbody', 'tfoot', 'tr', 'th', 'td'
],

Expand Down Expand Up @@ -926,7 +926,7 @@
},

isBlockContainer: function (element) {
return element && element.nodeType !== 3 && Util.blockContainerElementNames.indexOf(element.nodeName.toLowerCase()) !== -1;
return element && element.nodeType !== 3 && !Util.isMediumEditorElement(element) && Util.blockContainerElementNames.indexOf(element.nodeName.toLowerCase()) !== -1;
},

/* Finds the closest ancestor which is a block container element
Expand Down

0 comments on commit 3a9ee74

Please sign in to comment.