From 326c409e473e0c7b801781ac84df9d642eb2889e Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Thu, 10 Apr 2025 14:44:27 +0300 Subject: [PATCH] feat(mobile): reposition dropdowns to point up instead of down --- .../app/widgets/type_widgets/editable_text.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/public/app/widgets/type_widgets/editable_text.ts b/src/public/app/widgets/type_widgets/editable_text.ts index 7c8b807a0..b503dfbaf 100644 --- a/src/public/app/widgets/type_widgets/editable_text.ts +++ b/src/public/app/widgets/type_widgets/editable_text.ts @@ -252,6 +252,23 @@ export default class EditableTextTypeWidget extends AbstractTextTypeWidget { if (utils.isMobile()) { $classicToolbarWidget.addClass("visible"); + + // Reposition all dropdowns to point upwards instead of downwards. + // See https://ckeditor.com/docs/ckeditor5/latest/examples/framework/bottom-toolbar-editor.html for more info. + const toolbarView = editor.ui.view.toolbar; + for (const item of toolbarView.items) { + if (!("panelView" in item)) { + continue; + } + + item.on("change:isOpen", () => { + if ( !item.isOpen ) { + return; + } + + item.panelView.position = item.panelView.position.replace("s", "n"); + }); + } } }