Skip to content

Commit

Permalink
Scroll editor into view on mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
mgmeyers committed Apr 17, 2024
1 parent 03d7c52 commit 19ed65e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
17 changes: 13 additions & 4 deletions src/components/Editor/MarkdownEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,11 @@ export function MarkdownEditor({
}
});
},
blur: (evt) => {
blur: () => {
this.app.workspace.activeEditor = null;
if (Platform.isMobile) {
view.contentEl.removeClass('is-mobile-editing');
evt.win.setTimeout(() => {
this.app.mobileToolbar.update();
});
this.app.mobileToolbar.update();
}
},
})
Expand Down Expand Up @@ -201,7 +199,18 @@ export function MarkdownEditor({
});
}

const onShow = () => {
elRef.current.scrollIntoView({ block: 'end' });
};

if (Platform.isMobile) {
window.addEventListener('keyboardDidShow', onShow);
}

return () => {
if (Platform.isMobile) {
window.removeEventListener('keyboardDidShow', onShow);
}
view.plugin.removeChild(editor);
internalRef.current = null;
if (editorRef) editorRef.current = null;
Expand Down
1 change: 1 addition & 0 deletions src/styles.less
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,7 @@ div.kanban-plugin__lane-title-count.wip-exceeded {
.kanban-plugin__item .kanban-plugin__item-prefix-button,
.kanban-plugin__item .kanban-plugin__item-postfix-button,
.kanban-plugin__lane .kanban-plugin__lane-settings-button {
--icon-stroke: 2.5px;
font-size: 13px;
line-height: 1;
color: var(--text-muted);
Expand Down
3 changes: 2 additions & 1 deletion styles.css

Large diffs are not rendered by default.

0 comments on commit 19ed65e

Please sign in to comment.