From d8c19f150da741dc6b2c2b4736661f6ea97f7b1b Mon Sep 17 00:00:00 2001 From: Storm Date: Sun, 5 Oct 2025 15:15:56 +0300 Subject: [PATCH] fix(index.ts - ListTabulator): reninitializing the list instance after on paste to make sure new styles applies to the instance with the new data --- src/index.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 96435b35..4c4a2548 100644 --- a/src/index.ts +++ b/src/index.ts @@ -399,7 +399,16 @@ export default class EditorjsList { this.listStyle = 'unordered'; } - this.list!.onPaste(event); + // update the data first with the formatted list data from the paste handler + this.data = this.list!.pasteHandler(event.detail.data); + + // then make sure that the instance is re-instantiated to hold the new data with the new styles + this.changeTabulatorByStyle(); + + // create a replace the new rendered list element with the current one. + const newListElement = this.list!.render(); + this.listElement?.replaceWith(newListElement); + this.listElement = newListElement; } /**