Skip to content

Commit

Permalink
client: Fix classic editor on mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
eliandoran committed Nov 7, 2024
1 parent 47baa02 commit 35fe584
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/public/app/layouts/mobile_layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import LauncherContainer from "../widgets/containers/launcher_container.js";
import RootContainer from "../widgets/containers/root_container.js";
import SharedInfoWidget from "../widgets/shared_info.js";
import PromotedAttributesWidget from "../widgets/ribbon_widgets/promoted_attributes.js";
import ClassicEditorToolbar from "../widgets/ribbon_widgets/classic_editor_toolbar.js";

const MOBILE_CSS = `
<style>
Expand Down Expand Up @@ -167,6 +168,7 @@ export default class MobileLayout {
.child(new NoteListWidget())
.child(new FilePropertiesWidget().css('font-size','smaller'))
)
.child(new ClassicEditorToolbar())
)
.child(new ProtectedSessionPasswordDialog())
.child(new ConfirmDialog())
Expand Down
10 changes: 8 additions & 2 deletions src/public/app/widgets/type_widgets/editable_text.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,14 @@ export default class EditableTextTypeWidget extends AbstractTextTypeWidget {
await initSyntaxHighlighting(editor);

if (isClassicEditor) {
const $parentSplit = this.$widget.parents(".note-split.type-text");
const $classicToolbarWidget = $parentSplit.find("> .ribbon-container .classic-toolbar-widget");
let $classicToolbarWidget;
if (!utils.isMobile()) {
const $parentSplit = this.$widget.parents(".note-split.type-text");
$classicToolbarWidget = $parentSplit.find("> .ribbon-container .classic-toolbar-widget");
} else {
$classicToolbarWidget = $("body").find(".classic-toolbar-widget");
}

$classicToolbarWidget.empty();
$classicToolbarWidget[0].appendChild(editor.ui.view.toolbar.element);
}
Expand Down

0 comments on commit 35fe584

Please sign in to comment.