mirror of
https://github.com/discourse/discourse.git
synced 2025-03-01 12:36:44 +08:00
DEV: applyBehaviorTransformer for composer-position editTouchMove (#30811)
In a theme or plugin, if you have a scrollable mobile composer, you may want to allow scrolling events on the composer editor.. this allows for it!
This commit is contained in:
parent
72f4588d3b
commit
e6272e0497
@ -1,4 +1,5 @@
|
||||
import { later } from "@ember/runloop";
|
||||
import { applyBehaviorTransformer } from "discourse/lib/transformer";
|
||||
|
||||
export function setupComposerPosition(editor) {
|
||||
// This component contains two composer positioning adjustments
|
||||
@ -10,11 +11,13 @@ export function setupComposerPosition(editor) {
|
||||
// This is an alternative to locking up the body
|
||||
// It stops scrolling in the given element from bubbling up to the body
|
||||
// when the editor does not have any content to scroll
|
||||
const notScrollable = editor.scrollHeight <= editor.clientHeight;
|
||||
if (notScrollable) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}
|
||||
applyBehaviorTransformer("composer-position:editor-touch-move", () => {
|
||||
const notScrollable = editor.scrollHeight <= editor.clientHeight;
|
||||
if (notScrollable) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (
|
||||
|
@ -1,5 +1,6 @@
|
||||
export const BEHAVIOR_TRANSFORMERS = Object.freeze([
|
||||
// use only lowercase names
|
||||
"composer-position:editor-touch-move",
|
||||
"discovery-topic-list-load-more",
|
||||
"full-page-search-load-more",
|
||||
]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user