diff --git a/source/Editor.ts b/source/Editor.ts index 78a4ba8..927c214 100644 --- a/source/Editor.ts +++ b/source/Editor.ts @@ -2455,6 +2455,21 @@ class Squire { return frag; } + changeBlockType( + tag: string = this._config.blockTag, + attrs: Record | null = this._config.blockAttributes + ) { + return this.modifyBlocks((frag) => { + const walker = getBlockWalker(frag, this._root); + const output = document.createDocumentFragment(); + let node; + while ((node = walker.nextNode())) { + output.appendChild(createElement(tag, attrs, [empty(node)])); + } + return output; + }); + }; + makeUnorderedList(): Squire { this.modifyBlocks((frag) => this._makeList(frag, 'UL')); return this.focus();