diff --git a/src/blot/block.ts b/src/blot/block.ts index fae2cca..f6de902 100644 --- a/src/blot/block.ts +++ b/src/blot/block.ts @@ -14,7 +14,9 @@ class BlockBlot extends FormatBlot { } format(name: string, value: any) { - if (name === this.statics.blotName && !value) { + if (Registry.query(name, Registry.Scope.BLOCK) == null) { + return; + } else if (name === this.statics.blotName && !value) { this.replaceWith(BlockBlot.blotName); } else { super.format(name, value); diff --git a/test/unit/block.js b/test/unit/block.js index 3d84899..0eb323b 100644 --- a/test/unit/block.js +++ b/test/unit/block.js @@ -48,5 +48,15 @@ describe('Block', function() { expect(container.children.length).toBe(3); expect(container.children.head.next.statics.blotName).toBe('video'); }); + + it('ignore inline', function() { + let container = Registry.create('scroll'); + let block = Registry.create('header', 1); + container.appendChild(block); + block.format('bold', true); + expect(container.domNode.innerHTML).toBe('

'); + expect(container.children.head.statics.blotName).toBe('header'); + expect(container.children.head.formats()).toEqual({ header: 'h1' }); + }); }); });