From 713720d14db3a0ad0405bdf4b047018a7d6cf6c8 Mon Sep 17 00:00:00 2001 From: Vinicius Reis Date: Tue, 16 Aug 2022 16:11:43 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20(#107):=20calcule=20headers=20on?= =?UTF-8?q?=20creation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Vinicius Reis --- src/nodes/Heading/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/nodes/Heading/index.js b/src/nodes/Heading/index.js index 258b094fbc1..ce7e73e7862 100644 --- a/src/nodes/Heading/index.js +++ b/src/nodes/Heading/index.js @@ -31,6 +31,14 @@ const Heading = TipTapHeading.extend({ } }, + onCreate() { + extractHeadings(this.editor) + + if (this.parent) { + this.parent() + } + }, + onUpdate: debounce(function onUpdate({ editor }) { extractHeadings(editor) }, 900),