diff --git a/package.json b/package.json index 6af1c09a..916df9b2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@editorjs/list", - "version": "1.6.2", + "version": "1.6.2-smb.1", "keywords": [ "codex editor", "list", diff --git a/src/index.js b/src/index.js index 04ab8a18..3f652b08 100644 --- a/src/index.js +++ b/src/index.js @@ -110,7 +110,11 @@ class List { // fill with data if (this._data.items.length) { - this._data.items.forEach((item) => { + this._data.items.forEach((item, idx) => { + if (this.mergePoint !== undefined && this.mergePoint === idx) { + this._elements.wrapper.appendChild(this._make('span', 'cdx-shadow-caret')); + this.mergePoint = undefined; + } this._elements.wrapper.appendChild(this._make('li', this.CSS.item, { innerHTML: item, })); @@ -388,6 +392,18 @@ class List { return this._data; } + merge(data) { + this.mergePoint = this.data.items.length; + + this.data = { + ...this.data, + items: [ + ...this.data.items, + ...data.items, + ], + }; + } + /** * Helper for making Elements with attributes *