From 497aee3cd24b1a104d9b71753812b063476f5e21 Mon Sep 17 00:00:00 2001 From: Andy Chosak Date: Wed, 22 Feb 2023 10:49:53 -0500 Subject: [PATCH] Fix missing HR in command palette When the command palette is built without a prescribed list of commands, the horizontal rule is added to the list of entity types, if it is configured via enableHorizontalRule. If the command palette is built by passing a list of commands, though, enableHorizontalRule is ignored and the HR is not added to the list of entity types. This seems inadvertent and causes the HR to get dropped even if it has been configured. This seems to be the cause of https://github.com/wagtail/wagtail/issues/9707, unless I am misunderstanding how this code is supposed to work. --- src/api/behavior.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/api/behavior.ts b/src/api/behavior.ts index 3efa0cfc..703d9c4f 100644 --- a/src/api/behavior.ts +++ b/src/api/behavior.ts @@ -367,6 +367,16 @@ export default { ...t, category: "entityTypes", })); + + if (enableHorizontalRule) { + items.push({ + type: ENTITY_TYPE.HORIZONTAL_RULE, + ...(typeof enableHorizontalRule === "object" + ? enableHorizontalRule + : {}), + category: "entityTypes", + }); + } } return {