FIX: Prevent scroll when focus
This are fixes to make the widget embedable
This commit is contained in:
committed by
Nicolás Hatcher Andrés
parent
5744ae4d77
commit
97d3b04772
@@ -114,7 +114,7 @@ const Editor = (options: EditorOptions) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (type === cell.focus) {
|
if (type === cell.focus) {
|
||||||
textareaRef.current?.focus();
|
textareaRef.current?.focus({ preventScroll: true });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ const Workbook = (props: { model: Model; workbookState: WorkbookState }) => {
|
|||||||
);
|
);
|
||||||
const focusWorkbook = useCallback(() => {
|
const focusWorkbook = useCallback(() => {
|
||||||
if (rootRef.current) {
|
if (rootRef.current) {
|
||||||
rootRef.current.focus();
|
rootRef.current.focus({ preventScroll: true });
|
||||||
// HACK: We need to select something inside the root for onCopy to work
|
// HACK: We need to select something inside the root for onCopy to work
|
||||||
const selection = window.getSelection();
|
const selection = window.getSelection();
|
||||||
if (selection) {
|
if (selection) {
|
||||||
|
|||||||
Reference in New Issue
Block a user