A platform for community discussion. Free, open, simple.
DEV: Add value transformer to `post-text-selection` (#32023)
Keegan George4e918e1d3d21
diff --git a/app/assets/javascripts/discourse/app/components/post-text-selection.gjs b/app/assets/javascripts/discourse/app/components/post-text-selection.gjsindex e343086c42b..6dcaca3ad7c 100644--- a/app/assets/javascripts/discourse/app/components/post-text-selection.gjs+++ b/app/assets/javascripts/discourse/app/components/post-text-selection.gjs@@ -11,6 +11,7 @@ import { INPUT_DELAY } from "discourse/lib/environment";import escapeRegExp from "discourse/lib/escape-regexp";import isElementInViewport from "discourse/lib/is-element-in-viewport";import toMarkdown from "discourse/lib/to-markdown";+import { applyValueTransformer } from "discourse/lib/transformer";import {getElement,selectedNode,@@ -49,6 +50,10 @@ export default class PostTextSelection extends Component {@service menu;@tracked isSelecting = false;+ @tracked preventClose = applyValueTransformer(+ "post-text-selection-prevent-close",+ false+ );prevSelectedText;@@ -93,6 +98,9 @@ export default class PostTextSelection extends Component {@bindasync hideToolbar() {+ if (this.preventClose) {+ return;+ }this.args.quoteState.clear();await this.menuInstance?.close();}diff --git a/app/assets/javascripts/discourse/app/lib/transformer/registry.js b/app/assets/javascripts/discourse/app/lib/transformer/registry.jsindex 03fcb6c9a06..21803799820 100644--- a/app/assets/javascripts/discourse/app/lib/transformer/registry.js+++ b/app/assets/javascripts/discourse/app/lib/transformer/registry.js@@ -32,6 +32,7 @@ export const VALUE_TRANSFORMERS = Object.freeze(["parent-category-row-class-mobile","post-menu-buttons","post-menu-collapsed",+ "post-text-selection-prevent-close","small-user-attrs","tag-separator","topic-list-class",