From 352d73a36a6954caa78be8d8ad713e6e50fbeb65 Mon Sep 17 00:00:00 2001 From: Siddharth Thevaril Date: Tue, 2 Jul 2024 13:32:06 +0530 Subject: [PATCH] code review changes --- assets/js/editor/editor.js | 10 ++++++++-- includes/ConvertToBlocks/MigrationAgent.php | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/assets/js/editor/editor.js b/assets/js/editor/editor.js index a483b83..bee0280 100644 --- a/assets/js/editor/editor.js +++ b/assets/js/editor/editor.js @@ -66,9 +66,15 @@ class ConvertToBlocksEditorSupport { return null; } - setTimeout(() => { + const saveDelay = config?.agent?.save_delay || 0; + + if (saveDelay > 0) { + setTimeout(() => { + client.save(); + }, saveDelay); + } else { client.save(); - }, config.agent.save_delay); + } return null; }, 500); diff --git a/includes/ConvertToBlocks/MigrationAgent.php b/includes/ConvertToBlocks/MigrationAgent.php index 1d2f1b6..a859a31 100644 --- a/includes/ConvertToBlocks/MigrationAgent.php +++ b/includes/ConvertToBlocks/MigrationAgent.php @@ -35,7 +35,7 @@ public function register() { [ 'agent' => [ 'next' => $this->next(), - 'save_delay' => apply_filters( 'convert_to_blocks_save_delay', 500, $post_id ) + 'save_delay' => apply_filters( 'convert_to_blocks_save_delay', 0, $post_id ) ], ] );