Skip to content

Commit

Permalink
fix: reset to regular height
Browse files Browse the repository at this point in the history
  • Loading branch information
17Amir17 committed Dec 15, 2024
1 parent 88118cf commit 6eeaf12
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/webEditorUtils/useTenTap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,18 @@ export const useTenTap = (options?: useTenTapArgs) => {
contentHeightListener.connect(
document.querySelector('.ProseMirror')!,
(height) => {
// On android we first need to send the height of the document + paragraph height
// to avoid an issue where text jumps https://github.com/10play/10tap-editor/issues/236
if (window.platform === 'android') {
sendMessage({
type: CoreEditorActionType.DocumentHeight,
payload: height + paragraphHeight,
});
}
// document.body.style.overflow = 'hidden';
sendMessage({
type: CoreEditorActionType.DocumentHeight,
payload: height + paragraphHeight,
payload: height,
});
}
);
Expand All @@ -153,8 +162,6 @@ export const useTenTap = (options?: useTenTapArgs) => {
return editor;
};

// This is a utility to get the height of a paragraph element
// This is needed on android to avoid an issue where text jumps https://github.com/10play/10tap-editor/issues/236
const getParagraphHeight = () => {
if (window.platform !== 'android') return 0;
const tempParagraph = document.createElement('p');
Expand Down

0 comments on commit 6eeaf12

Please sign in to comment.