mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: keyboard-zooming in wysiwyg should zoom canvas (#4676)
This commit is contained in:
parent
dcee594b66
commit
4b5270ab12
3 changed files with 46 additions and 5 deletions
|
@ -25,6 +25,7 @@ import {
|
|||
actionDecreaseFontSize,
|
||||
actionIncreaseFontSize,
|
||||
} from "../actions/actionProperties";
|
||||
import { actionZoomIn, actionZoomOut } from "../actions/actionCanvas";
|
||||
import App from "../components/App";
|
||||
|
||||
const normalizeText = (text: string) => {
|
||||
|
@ -60,7 +61,6 @@ const getTransform = (
|
|||
|
||||
export const textWysiwyg = ({
|
||||
id,
|
||||
appState,
|
||||
onChange,
|
||||
onSubmit,
|
||||
getViewportCoords,
|
||||
|
@ -70,7 +70,6 @@ export const textWysiwyg = ({
|
|||
app,
|
||||
}: {
|
||||
id: ExcalidrawElement["id"];
|
||||
appState: AppState;
|
||||
onChange?: (text: string) => void;
|
||||
onSubmit: (data: {
|
||||
text: string;
|
||||
|
@ -102,6 +101,7 @@ export const textWysiwyg = ({
|
|||
let originalContainerHeight: number;
|
||||
|
||||
const updateWysiwygStyle = () => {
|
||||
const appState = app.state;
|
||||
const updatedElement = Scene.getScene(element)?.getElement(
|
||||
id,
|
||||
) as ExcalidrawTextElement;
|
||||
|
@ -291,7 +291,15 @@ export const textWysiwyg = ({
|
|||
editable.onkeydown = (event) => {
|
||||
event.stopPropagation();
|
||||
|
||||
if (actionDecreaseFontSize.keyTest(event)) {
|
||||
if (actionZoomIn.keyTest(event)) {
|
||||
event.preventDefault();
|
||||
app.actionManager.executeAction(actionZoomIn);
|
||||
updateWysiwygStyle();
|
||||
} else if (actionZoomOut.keyTest(event)) {
|
||||
event.preventDefault();
|
||||
app.actionManager.executeAction(actionZoomOut);
|
||||
updateWysiwygStyle();
|
||||
} else if (actionDecreaseFontSize.keyTest(event)) {
|
||||
app.actionManager.executeAction(actionDecreaseFontSize);
|
||||
} else if (actionIncreaseFontSize.keyTest(event)) {
|
||||
app.actionManager.executeAction(actionIncreaseFontSize);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue