From f47d3ea6d439f2081e3c291e8105ad27674f1f9c Mon Sep 17 00:00:00 2001 From: dependentmadani Date: Wed, 3 Jul 2024 16:08:19 +0100 Subject: [PATCH 1/3] fix(data): handle the undefined data issue --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 433e263..8ab12f4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -152,7 +152,7 @@ export default class Header { } newData.text = data.text || ''; - newData.level = parseInt(data.level.toString()) || this.defaultLevel.number; + newData.level = data && data.level? parseInt(data.level.toString()) : this.defaultLevel.number; return newData; } From cc00cdca36a9dbe3a1d8fb00102c2300681dbe52 Mon Sep 17 00:00:00 2001 From: dependentmadani Date: Wed, 3 Jul 2024 18:10:33 +0100 Subject: [PATCH 2/3] fix(data): update data object content --- src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 8ab12f4..07be85f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -148,11 +148,11 @@ export default class Header { const newData: HeaderData = {text: '', level: this.defaultLevel.number }; if (typeof data !== 'object') { - data = {} as HeaderData; + data = {text: '', level: this.defaultLevel.number}; } newData.text = data.text || ''; - newData.level = data && data.level? parseInt(data.level.toString()) : this.defaultLevel.number; + newData.level = parseInt(data.level.toString()) || this.defaultLevel.number; return newData; } From 5b97965448c0fc73671e8065f137b2df53c76116 Mon Sep 17 00:00:00 2001 From: dependentmadani Date: Wed, 3 Jul 2024 18:38:37 +0100 Subject: [PATCH 3/3] update(version): increment patch version to 2.8.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 00c06a1..28a4480 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@editorjs/header", - "version": "2.8.3", + "version": "2.8.4", "keywords": [ "codex editor", "header",