From 381f6e64e8050297e443a4f46b9045f1f2dec95b Mon Sep 17 00:00:00 2001 From: Renato Atilio Date: Mon, 14 Apr 2025 14:06:54 -0300 Subject: [PATCH] FIX: click handler position on rich editor details node (#32268) `pos` is the exact position of the click in the entire document `nodePos` is the position of the clicked node itself The idea is that we want the click to be the first position **within the node**. The previous code was checking for the first 2 positions of the entire document. I'd love to add a test for this, but it's very tricky. --- .../assets/javascripts/lib/rich-editor-extension.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/discourse-details/assets/javascripts/lib/rich-editor-extension.js b/plugins/discourse-details/assets/javascripts/lib/rich-editor-extension.js index 8da47ec2700..4b69d5a7279 100644 --- a/plugins/discourse-details/assets/javascripts/lib/rich-editor-extension.js +++ b/plugins/discourse-details/assets/javascripts/lib/rich-editor-extension.js @@ -69,7 +69,8 @@ const extension = { plugins: { props: { handleClickOn(view, pos, node, nodePos) { - if (pos > 2 || node.type.name !== "summary") { + // if the click position in the document is not the first within the summary node + if (pos > nodePos + 1 || node.type.name !== "summary") { return false; }