diff --git a/excalidraw-app/collab/Portal.tsx b/excalidraw-app/collab/Portal.tsx index e9a4b5bf00fcb..0a16f9584f91f 100644 --- a/excalidraw-app/collab/Portal.tsx +++ b/excalidraw-app/collab/Portal.tsx @@ -116,20 +116,26 @@ class Portal { } } - this.collab.excalidrawAPI.updateScene({ - elements: this.collab.excalidrawAPI - .getSceneElementsIncludingDeleted() - .map((element) => { - if (this.collab.fileManager.shouldUpdateImageElementStatus(element)) { - // this will signal collaborators to pull image data from server - // (using mutation instead of newElementWith otherwise it'd break - // in-progress dragging) - return newElementWith(element, { status: "saved" }); - } - return element; - }), - storeAction: StoreAction.UPDATE, - }); + let isChanged = false; + const newElements = this.collab.excalidrawAPI + .getSceneElementsIncludingDeleted() + .map((element) => { + if (this.collab.fileManager.shouldUpdateImageElementStatus(element)) { + isChanged = true; + // this will signal collaborators to pull image data from server + // (using mutation instead of newElementWith otherwise it'd break + // in-progress dragging) + return newElementWith(element, { status: "saved" }); + } + return element; + }); + + if (isChanged) { + this.collab.excalidrawAPI.updateScene({ + elements: newElements, + storeAction: StoreAction.UPDATE, + }); + } }, FILE_UPLOAD_TIMEOUT); broadcastScene = async ( diff --git a/packages/excalidraw/actions/actionFinalize.tsx b/packages/excalidraw/actions/actionFinalize.tsx index 0197fb7db0a64..95cc19c96fa77 100644 --- a/packages/excalidraw/actions/actionFinalize.tsx +++ b/packages/excalidraw/actions/actionFinalize.tsx @@ -50,7 +50,6 @@ export const actionFinalize = register({ ...appState, cursorButton: "up", editingLinearElement: null, - selectedLinearElement: null, }, storeAction: StoreAction.CAPTURE, }; @@ -179,7 +178,7 @@ export const actionFinalize = register({ newElement: null, selectionElement: null, multiElement: null, - editingElement: null, + editingTextElement: null, startBoundElement: null, suggestedBindings: [], selectedElementIds: diff --git a/packages/excalidraw/actions/actionHistory.tsx b/packages/excalidraw/actions/actionHistory.tsx index d860c4143bad5..c1e35674adc7c 100644 --- a/packages/excalidraw/actions/actionHistory.tsx +++ b/packages/excalidraw/actions/actionHistory.tsx @@ -21,7 +21,7 @@ const executeHistoryAction = ( if ( !appState.multiElement && !appState.resizingElement && - !appState.editingElement && + !appState.editingTextElement && !appState.newElement && !appState.selectedElementsAreBeingDragged && !appState.selectionElement && diff --git a/packages/excalidraw/actions/actionProperties.tsx b/packages/excalidraw/actions/actionProperties.tsx index f9c66e96f89fe..069cf84158a96 100644 --- a/packages/excalidraw/actions/actionProperties.tsx +++ b/packages/excalidraw/actions/actionProperties.tsx @@ -133,7 +133,7 @@ export const changeProperty = ( return elements.map((element) => { if ( selectedElementIds.get(element.id) || - element.id === appState.editingElement?.id + element.id === appState.editingTextElement?.id ) { return callback(element); } @@ -148,13 +148,13 @@ export const getFormValue = function ( isRelevantElement: true | ((element: ExcalidrawElement) => boolean), defaultValue: T | ((isSomeElementSelected: boolean) => T), ): T { - const editingElement = appState.editingElement; + const editingTextElement = appState.editingTextElement; const nonDeletedElements = getNonDeletedElements(elements); let ret: T | null = null; - if (editingElement) { - ret = getAttribute(editingElement); + if (editingTextElement) { + ret = getAttribute(editingTextElement); } if (!ret) { @@ -1076,19 +1076,20 @@ export const actionChangeFontFamily = register({ // open, populate the cache from scratch cachedElementsRef.current.clear(); - const { editingElement } = appState; + const { editingTextElement } = appState; - if (editingElement?.type === "text") { - // retrieve the latest version from the scene, as `editingElement` isn't mutated - const latestEditingElement = app.scene.getElement( - editingElement.id, + // still check type to be safe + if (editingTextElement?.type === "text") { + // retrieve the latest version from the scene, as `editingTextElement` isn't mutated + const latesteditingTextElement = app.scene.getElement( + editingTextElement.id, ); // inside the wysiwyg editor cachedElementsRef.current.set( - editingElement.id, + editingTextElement.id, newElementWith( - latestEditingElement || editingElement, + latesteditingTextElement || editingTextElement, {}, true, ), diff --git a/packages/excalidraw/appState.ts b/packages/excalidraw/appState.ts index 054a80f419d40..b5b4d2b238f19 100644 --- a/packages/excalidraw/appState.ts +++ b/packages/excalidraw/appState.ts @@ -45,7 +45,7 @@ export const getDefaultAppState = (): Omit< cursorButton: "up", activeEmbeddable: null, newElement: null, - editingElement: null, + editingTextElement: null, editingGroupId: null, editingLinearElement: null, activeTool: { @@ -166,7 +166,7 @@ const APP_STATE_STORAGE_CONF = (< cursorButton: { browser: true, export: false, server: false }, activeEmbeddable: { browser: false, export: false, server: false }, newElement: { browser: false, export: false, server: false }, - editingElement: { browser: false, export: false, server: false }, + editingTextElement: { browser: false, export: false, server: false }, editingGroupId: { browser: true, export: false, server: false }, editingLinearElement: { browser: false, export: false, server: false }, activeTool: { browser: true, export: false, server: false }, diff --git a/packages/excalidraw/components/Actions.tsx b/packages/excalidraw/components/Actions.tsx index 15bddefdd54cf..3673eafadcfdc 100644 --- a/packages/excalidraw/components/Actions.tsx +++ b/packages/excalidraw/components/Actions.tsx @@ -103,7 +103,9 @@ export const SelectedShapeActions = ({ ) { isSingleElementBoundContainer = true; } - const isEditing = Boolean(appState.editingElement); + const isEditingTextOrNewElement = Boolean( + appState.editingTextElement || appState.newElement, + ); const device = useDevice(); const isRTL = document.documentElement.getAttribute("dir") === "rtl"; @@ -233,7 +235,7 @@ export const SelectedShapeActions = ({ )} - {!isEditing && targetElements.length > 0 && ( + {!isEditingTextOrNewElement && targetElements.length > 0 && (
{t("labels.actions")}
diff --git a/packages/excalidraw/components/App.tsx b/packages/excalidraw/components/App.tsx index 06645c1406b79..2290f31aebfa9 100644 --- a/packages/excalidraw/components/App.tsx +++ b/packages/excalidraw/components/App.tsx @@ -433,6 +433,7 @@ import { getShortcutFromShortcutName } from "../actions/shortcuts"; import { actionTextAutoResize } from "../actions/actionTextAutoResize"; import { getVisibleSceneBounds } from "../element/bounds"; import { isMaybeMermaidDefinition } from "../mermaid"; +import NewElementCanvas from "./canvases/NewElementCanvas"; import { mutateElbowArrow } from "../element/routing"; import { FlowChartCreator, @@ -1474,25 +1475,21 @@ class App extends React.Component { scrollY: this.state.scrollY, height: this.state.height, width: this.state.width, - editingElement: this.state.editingElement, + editingTextElement: this.state.editingTextElement, + newElementId: this.state.newElement?.id, pendingImageElementId: this.state.pendingImageElementId, }); const allElementsMap = this.scene.getNonDeletedElementsMap(); const shouldBlockPointerEvents = - !( - this.state.editingElement && isLinearElement(this.state.editingElement) - ) && - (this.state.selectionElement || - this.state.newElement || - this.state.selectedElementsAreBeingDragged || - this.state.resizingElement || - (this.state.activeTool.type === "laser" && - // technically we can just test on this once we make it more safe - this.state.cursorButton === "down") || - (this.state.editingElement && - !isTextElement(this.state.editingElement))); + this.state.selectionElement || + this.state.newElement || + this.state.selectedElementsAreBeingDragged || + this.state.resizingElement || + (this.state.activeTool.type === "laser" && + // technically we can just test on this once we make it more safe + this.state.cursorButton === "down"); const firstSelectedElement = selectedElements[0]; @@ -1710,6 +1707,27 @@ class App extends React.Component { this.flowChartCreator.pendingNodes, }} /> + {this.state.newElement && ( + + )} { let didUpdate = false; - let editingElement: AppState["editingElement"] | null = null; + let editingTextElement: AppState["editingTextElement"] | null = null; if (actionResult.elements) { this.scene.replaceAllElements(actionResult.elements); didUpdate = true; @@ -2101,7 +2119,7 @@ class App extends React.Component { this.addNewImagesToImageCache(); } - if (actionResult.appState || editingElement || this.state.contextMenu) { + if (actionResult.appState || editingTextElement || this.state.contextMenu) { let viewModeEnabled = actionResult?.appState?.viewModeEnabled || false; let zenModeEnabled = actionResult?.appState?.zenModeEnabled || false; const theme = @@ -2117,23 +2135,24 @@ class App extends React.Component { zenModeEnabled = this.props.zenModeEnabled; } - editingElement = actionResult.appState?.editingElement || null; + editingTextElement = actionResult.appState?.editingTextElement || null; - // make sure editingElement points to latest element reference - if (actionResult.elements && editingElement) { + // make sure editingTextElement points to latest element reference + if (actionResult.elements && editingTextElement) { actionResult.elements.forEach((element) => { if ( - editingElement?.id === element.id && - editingElement !== element && - isNonDeletedElement(element) + editingTextElement?.id === element.id && + editingTextElement !== element && + isNonDeletedElement(element) && + isTextElement(element) ) { - editingElement = element; + editingTextElement = element; } }); } - if (editingElement?.isDeleted) { - editingElement = null; + if (editingTextElement?.isDeleted) { + editingTextElement = null; } this.setState((state) => { @@ -2145,7 +2164,7 @@ class App extends React.Component { // or programmatically from the host, so it will need to be // rewritten later contextMenu: null, - editingElement, + editingTextElement, viewModeEnabled, zenModeEnabled, theme, @@ -2772,9 +2791,9 @@ class App extends React.Component { } // failsafe in case the state is being updated in incorrect order resulting - // in the editingElement being now a deleted element - if (this.state.editingElement?.isDeleted) { - this.setState({ editingElement: null }); + // in the editingTextElement being now a deleted element + if (this.state.editingTextElement?.isDeleted) { + this.setState({ editingTextElement: null }); } if ( @@ -2830,7 +2849,7 @@ class App extends React.Component { } const scrolledOutside = // hide when editing text - isTextElement(this.state.editingElement) + this.state.editingTextElement ? false : !atLeastOneVisibleElement && elementsMap.size > 0; if (this.state.scrolledOutside !== scrolledOutside) { @@ -4730,7 +4749,7 @@ class App extends React.Component { this.setState({ newElement: null, - editingElement: null, + editingTextElement: null, }); if (this.state.activeTool.locked) { setCursorForShape(this.interactiveCanvas, this.state); @@ -5104,7 +5123,7 @@ class App extends React.Component { }), }); } - this.setState({ editingElement: element }); + this.setState({ editingTextElement: element }); if (!existingTextElement) { if (container && shouldBindToContainer) { @@ -5565,9 +5584,13 @@ class App extends React.Component { lastPoint[1], ) >= LINE_CONFIRM_THRESHOLD ) { - mutateElement(multiElement, { - points: [...points, [scenePointerX - rx, scenePointerY - ry]], - }); + mutateElement( + multiElement, + { + points: [...points, [scenePointerX - rx, scenePointerY - ry]], + }, + false, + ); } else { setCursor(this.interactiveCanvas, CURSOR_TYPE.POINTER); // in this branch, we're inside the commit zone, and no uncommitted @@ -5584,9 +5607,13 @@ class App extends React.Component { ) < LINE_CONFIRM_THRESHOLD ) { setCursor(this.interactiveCanvas, CURSOR_TYPE.POINTER); - mutateElement(multiElement, { - points: points.slice(0, -1), - }); + mutateElement( + multiElement, + { + points: points.slice(0, -1), + }, + false, + ); } else { const [gridX, gridY] = getGridPoint( scenePointerX, @@ -5632,20 +5659,30 @@ class App extends React.Component { undefined, { isDragging: true, + informMutation: false, }, ); } else { // update last uncommitted point - mutateElement(multiElement, { - points: [ - ...points.slice(0, -1), - [ - lastCommittedX + dxFromLastCommitted, - lastCommittedY + dyFromLastCommitted, + mutateElement( + multiElement, + { + points: [ + ...points.slice(0, -1), + [ + lastCommittedX + dxFromLastCommitted, + lastCommittedY + dyFromLastCommitted, + ], ], - ], - }); + }, + false, + ); } + + // in this path, we're mutating multiElement to reflect + // how it will be after adding pointer position as the next point + // trigger update here so that new element canvas renders again to reflect this + this.scene.triggerUpdate(false); } return; @@ -6048,7 +6085,7 @@ class App extends React.Component { : {}), appState: { newElement: null, - editingElement: null, + editingTextElement: null, startBoundElement: null, suggestedBindings: [], selectedElementIds: makeNextSelectedElementIds( @@ -6240,7 +6277,6 @@ class App extends React.Component { this.setState({ newElement: pendingImageElement as ExcalidrawNonSelectionElement, - editingElement: pendingImageElement, pendingImageElementId: null, multiElement: null, }); @@ -6446,7 +6482,7 @@ class App extends React.Component { isHandToolActive(this.state) || this.state.viewModeEnabled) ) || - isTextElement(this.state.editingElement) + this.state.editingTextElement ) { return false; } @@ -6990,7 +7026,7 @@ class App extends React.Component { // if we're currently still editing text, clicking outside // should only finalize it, not create another (irrespective // of state.activeTool.locked) - if (isTextElement(this.state.editingElement)) { + if (this.state.editingTextElement) { return; } let sceneX = pointerDownState.origin.x; @@ -7075,17 +7111,21 @@ class App extends React.Component { ? element.pressures : [...element.pressures, event.pressure]; - mutateElement(element, { - points: [[0, 0]], - pressures, - }); + mutateElement( + element, + { + points: [[0, 0]], + pressures, + }, + false, + ); const boundElement = getHoveredElementForBinding( pointerDownState.origin, this.scene.getNonDeletedElements(), this.scene.getNonDeletedElementsMap(), ); - this.scene.insertElement(element); + this.scene.insertElement(element, false); this.setState({ newElement: element, startBoundElement: boundElement, @@ -7244,10 +7284,14 @@ class App extends React.Component { multiElement.type === "line" && isPathALoop(multiElement.points, this.state.zoom.value) ) { - mutateElement(multiElement, { - lastCommittedPoint: - multiElement.points[multiElement.points.length - 1], - }); + mutateElement( + multiElement, + { + lastCommittedPoint: + multiElement.points[multiElement.points.length - 1], + }, + false, + ); this.actionManager.executeAction(actionFinalize); return; } @@ -7291,9 +7335,14 @@ class App extends React.Component { })); // clicking outside commit zone → update reference for last committed // point - mutateElement(multiElement, { - lastCommittedPoint: multiElement.points[multiElement.points.length - 1], - }); + mutateElement( + multiElement, + { + lastCommittedPoint: + multiElement.points[multiElement.points.length - 1], + }, + false, + ); setCursor(this.interactiveCanvas, CURSOR_TYPE.POINTER); } else { const [gridX, gridY] = getGridPoint( @@ -7373,9 +7422,13 @@ class App extends React.Component { ), }; }); - mutateElement(element, { - points: [...element.points, [0, 0]], - }); + mutateElement( + element, + { + points: [...element.points, [0, 0]], + }, + false, + ); const boundElement = getHoveredElementForBinding( pointerDownState.origin, this.scene.getNonDeletedElements(), @@ -7383,10 +7436,9 @@ class App extends React.Component { isElbowArrow(element), ); - this.scene.insertElement(element); + this.scene.insertElement(element, false); this.setState({ newElement: element, - editingElement: element, startBoundElement: boundElement, suggestedBindings: [], }); @@ -7461,7 +7513,7 @@ class App extends React.Component { selectionElement: element, }); } else { - this.scene.insertElement(element); + this.scene.insertElement(element, false); this.setState({ multiElement: null, newElement: element, @@ -7778,11 +7830,11 @@ class App extends React.Component { // prevent dragging even if we're no longer holding cmd/ctrl otherwise // it would have weird results (stuff jumping all over the screen) - // Checking for editingElement to avoid jump while editing on mobile #6503 + // Checking for editingTextElement to avoid jump while editing on mobile #6503 if ( selectedElements.length > 0 && !pointerDownState.withCmdOrCtrl && - !this.state.editingElement && + !this.state.editingTextElement && this.state.activeEmbeddable?.state !== "active" ) { const dragOffset = { @@ -7977,9 +8029,17 @@ class App extends React.Component { ? newElement.pressures : [...newElement.pressures, event.pressure]; - mutateElement(newElement, { - points: [...points, [dx, dy]], - pressures, + mutateElement( + newElement, + { + points: [...points, [dx, dy]], + pressures, + }, + false, + ); + + this.setState({ + newElement, }); } } else if (isLinearElement(newElement)) { @@ -7998,9 +8058,13 @@ class App extends React.Component { } if (points.length === 1) { - mutateElement(newElement, { - points: [...points, [dx, dy]], - }); + mutateElement( + newElement, + { + points: [...points, [dx, dy]], + }, + false, + ); } else if (points.length > 1 && isElbowArrow(newElement)) { mutateElbowArrow( newElement, @@ -8010,14 +8074,23 @@ class App extends React.Component { undefined, { isDragging: true, + informMutation: false, }, ); } else if (points.length === 2) { - mutateElement(newElement, { - points: [...points.slice(0, -1), [dx, dy]], - }); + mutateElement( + newElement, + { + points: [...points.slice(0, -1), [dx, dy]], + }, + false, + ); } + this.setState({ + newElement, + }); + if (isBindingElement(newElement, false)) { // When creating a linear element by dragging this.maybeSuggestBindingsForLinearElementAtCoords( @@ -8029,7 +8102,7 @@ class App extends React.Component { } else { pointerDownState.lastCoords.x = pointerCoords.x; pointerDownState.lastCoords.y = pointerCoords.y; - this.maybeDragNewGenericElement(pointerDownState, event); + this.maybeDragNewGenericElement(pointerDownState, event, false); } } @@ -8187,12 +8260,6 @@ class App extends React.Component { frameToHighlight: null, elementsToHighlight: null, cursorButton: "up", - // text elements are reset on finalize, and resetting on pointerup - // may cause issues with double taps - editingElement: - multiElement || isTextElement(this.state.editingElement) - ? this.state.editingElement - : null, snapLines: updateStable(prevState.snapLines, []), originSnapOffset: null, })); @@ -8377,15 +8444,22 @@ class App extends React.Component { ); if (!pointerDownState.drag.hasOccurred && newElement && !multiElement) { - mutateElement(newElement, { - points: [ - ...newElement.points, - [pointerCoords.x - newElement.x, pointerCoords.y - newElement.y], - ], - }); + mutateElement( + newElement, + { + points: [ + ...newElement.points, + [ + pointerCoords.x - newElement.x, + pointerCoords.y - newElement.y, + ], + ], + }, + false, + ); this.setState({ multiElement: newElement, - editingElement: this.state.newElement, + newElement, }); } else if (pointerDownState.drag.hasOccurred && !multiElement) { if ( @@ -8422,6 +8496,8 @@ class App extends React.Component { newElement: null, })); } + // so that the scene gets rendered again to display the newly drawn linear as well + this.scene.triggerUpdate(); } return; } @@ -8486,6 +8562,8 @@ class App extends React.Component { if (newElement) { mutateElement(newElement, getNormalizedDimensions(newElement)); + // the above does not guarantee the scene to be rendered again, hence the trigger below + this.scene.triggerUpdate(); } if (pointerDownState.drag.hasOccurred) { @@ -9294,7 +9372,7 @@ class App extends React.Component { this.setState( { pendingImageElementId: null, - editingElement: null, + newElement: null, activeTool: updateActiveTool(this.state, { type: "selection" }), }, () => { @@ -9794,23 +9872,25 @@ class App extends React.Component { private maybeDragNewGenericElement = ( pointerDownState: PointerDownState, event: MouseEvent | KeyboardEvent, + informMutation = true, ): void => { const selectionElement = this.state.selectionElement; const pointerCoords = pointerDownState.lastCoords; if (selectionElement && this.state.activeTool.type !== "eraser") { - dragNewElement( - selectionElement, - this.state.activeTool.type, - pointerDownState.origin.x, - pointerDownState.origin.y, - pointerCoords.x, - pointerCoords.y, - distance(pointerDownState.origin.x, pointerCoords.x), - distance(pointerDownState.origin.y, pointerCoords.y), - shouldMaintainAspectRatio(event), - shouldResizeFromCenter(event), - this.state.zoom.value, - ); + dragNewElement({ + newElement: selectionElement, + elementType: this.state.activeTool.type, + originX: pointerDownState.origin.x, + originY: pointerDownState.origin.y, + x: pointerCoords.x, + y: pointerCoords.y, + width: distance(pointerDownState.origin.x, pointerCoords.x), + height: distance(pointerDownState.origin.y, pointerCoords.y), + shouldMaintainAspectRatio: shouldMaintainAspectRatio(event), + shouldResizeFromCenter: shouldResizeFromCenter(event), + zoom: this.state.zoom.value, + informMutation, + }); return; } @@ -9859,23 +9939,28 @@ class App extends React.Component { snapLines, }); - dragNewElement( + dragNewElement({ newElement, - this.state.activeTool.type, - pointerDownState.originInGrid.x, - pointerDownState.originInGrid.y, - gridX, - gridY, - distance(pointerDownState.originInGrid.x, gridX), - distance(pointerDownState.originInGrid.y, gridY), - isImageElement(newElement) + elementType: this.state.activeTool.type, + originX: pointerDownState.originInGrid.x, + originY: pointerDownState.originInGrid.y, + x: gridX, + y: gridY, + width: distance(pointerDownState.originInGrid.x, gridX), + height: distance(pointerDownState.originInGrid.y, gridY), + shouldMaintainAspectRatio: isImageElement(newElement) ? !shouldMaintainAspectRatio(event) : shouldMaintainAspectRatio(event), - shouldResizeFromCenter(event), - this.state.zoom.value, - aspectRatio, - this.state.originSnapOffset, - ); + shouldResizeFromCenter: shouldResizeFromCenter(event), + zoom: this.state.zoom.value, + widthAspectRatio: aspectRatio, + originOffset: this.state.originSnapOffset, + informMutation, + }); + + this.setState({ + newElement, + }); // highlight elements that are to be added to frames on frames creation if ( diff --git a/packages/excalidraw/components/HintViewer.tsx b/packages/excalidraw/components/HintViewer.tsx index e6411749f8e0a..ad0337de4c55b 100644 --- a/packages/excalidraw/components/HintViewer.tsx +++ b/packages/excalidraw/components/HintViewer.tsx @@ -87,7 +87,7 @@ const getHints = ({ return t("hints.text_selected"); } - if (appState.editingElement && isTextElement(appState.editingElement)) { + if (appState.editingTextElement) { return t("hints.text_editing"); } @@ -95,7 +95,7 @@ const getHints = ({ if ( appState.selectionElement && !selectedElements.length && - !appState.editingElement && + !appState.editingTextElement && !appState.editingLinearElement ) { return t("hints.deepBoxSelect"); diff --git a/packages/excalidraw/components/canvases/InteractiveCanvas.tsx b/packages/excalidraw/components/canvases/InteractiveCanvas.tsx index 2c14a6ab3a751..d546bc9d55c89 100644 --- a/packages/excalidraw/components/canvases/InteractiveCanvas.tsx +++ b/packages/excalidraw/components/canvases/InteractiveCanvas.tsx @@ -202,7 +202,7 @@ const getRelevantAppStateProps = ( activeEmbeddable: appState.activeEmbeddable, snapLines: appState.snapLines, zenModeEnabled: appState.zenModeEnabled, - editingElement: appState.editingElement, + editingTextElement: appState.editingTextElement, }); const areEqual = ( diff --git a/packages/excalidraw/components/canvases/NewElementCanvas.tsx b/packages/excalidraw/components/canvases/NewElementCanvas.tsx new file mode 100644 index 0000000000000..1815671107864 --- /dev/null +++ b/packages/excalidraw/components/canvases/NewElementCanvas.tsx @@ -0,0 +1,56 @@ +import { useEffect, useRef } from "react"; +import type { NonDeletedSceneElementsMap } from "../../element/types"; +import type { AppState } from "../../types"; +import type { + RenderableElementsMap, + StaticCanvasRenderConfig, +} from "../../scene/types"; +import type { RoughCanvas } from "roughjs/bin/canvas"; +import { renderNewElementScene } from "../../renderer/renderNewElementScene"; +import { isRenderThrottlingEnabled } from "../../reactUtils"; + +interface NewElementCanvasProps { + appState: AppState; + elementsMap: RenderableElementsMap; + allElementsMap: NonDeletedSceneElementsMap; + scale: number; + rc: RoughCanvas; + renderConfig: StaticCanvasRenderConfig; +} + +const NewElementCanvas = (props: NewElementCanvasProps) => { + const canvasRef = useRef(null); + useEffect(() => { + if (!canvasRef.current) { + return; + } + renderNewElementScene( + { + canvas: canvasRef.current, + scale: props.scale, + newElement: props.appState.newElement, + elementsMap: props.elementsMap, + allElementsMap: props.allElementsMap, + rc: props.rc, + renderConfig: props.renderConfig, + appState: props.appState, + }, + isRenderThrottlingEnabled(), + ); + }); + + return ( + + ); +}; + +export default NewElementCanvas; diff --git a/packages/excalidraw/data/reconcile.ts b/packages/excalidraw/data/reconcile.ts index 80b0470bb5885..fa4cff8d11b66 100644 --- a/packages/excalidraw/data/reconcile.ts +++ b/packages/excalidraw/data/reconcile.ts @@ -24,7 +24,7 @@ const shouldDiscardRemoteElement = ( if ( local && // local element is being edited - (local.id === localAppState.editingElement?.id || + (local.id === localAppState.editingTextElement?.id || local.id === localAppState.resizingElement?.id || local.id === localAppState.newElement?.id || // TODO: Is this still valid? As newElement is selection element, which is never part of the elements array // local element is newer diff --git a/packages/excalidraw/element/dragElements.ts b/packages/excalidraw/element/dragElements.ts index 2621e598aff61..02288a883d0ed 100644 --- a/packages/excalidraw/element/dragElements.ts +++ b/packages/excalidraw/element/dragElements.ts @@ -159,26 +159,42 @@ export const getDragOffsetXY = ( return [x - x1, y - y1]; }; -export const dragNewElement = ( - newElement: NonDeletedExcalidrawElement, - elementType: AppState["activeTool"]["type"], - originX: number, - originY: number, - x: number, - y: number, - width: number, - height: number, - shouldMaintainAspectRatio: boolean, - shouldResizeFromCenter: boolean, - zoom: NormalizedZoomValue, +export const dragNewElement = ({ + newElement, + elementType, + originX, + originY, + x, + y, + width, + height, + shouldMaintainAspectRatio, + shouldResizeFromCenter, + zoom, + widthAspectRatio = null, + originOffset = null, + informMutation = true, +}: { + newElement: NonDeletedExcalidrawElement; + elementType: AppState["activeTool"]["type"]; + originX: number; + originY: number; + x: number; + y: number; + width: number; + height: number; + shouldMaintainAspectRatio: boolean; + shouldResizeFromCenter: boolean; + zoom: NormalizedZoomValue; /** whether to keep given aspect ratio when `isResizeWithSidesSameLength` is true */ - widthAspectRatio?: number | null, - originOffset: { + widthAspectRatio?: number | null; + originOffset?: { x: number; y: number; - } | null = null, -) => { + } | null; + informMutation?: boolean; +}) => { if (shouldMaintainAspectRatio && newElement.type !== "selection") { if (widthAspectRatio) { height = width / widthAspectRatio; @@ -242,12 +258,16 @@ export const dragNewElement = ( } if (width !== 0 && height !== 0) { - mutateElement(newElement, { - x: newX + (originOffset?.x ?? 0), - y: newY + (originOffset?.y ?? 0), - width, - height, - ...textAutoResize, - }); + mutateElement( + newElement, + { + x: newX + (originOffset?.x ?? 0), + y: newY + (originOffset?.y ?? 0), + width, + height, + ...textAutoResize, + }, + informMutation, + ); } }; diff --git a/packages/excalidraw/element/showSelectedShapeActions.ts b/packages/excalidraw/element/showSelectedShapeActions.ts index c464e69cf3256..eea9336749246 100644 --- a/packages/excalidraw/element/showSelectedShapeActions.ts +++ b/packages/excalidraw/element/showSelectedShapeActions.ts @@ -9,7 +9,7 @@ export const showSelectedShapeActions = ( Boolean( !appState.viewModeEnabled && ((appState.activeTool.type !== "custom" && - (appState.editingElement || + (appState.editingTextElement || (appState.activeTool.type !== "selection" && appState.activeTool.type !== "eraser" && appState.activeTool.type !== "hand" && diff --git a/packages/excalidraw/element/textWysiwyg.test.tsx b/packages/excalidraw/element/textWysiwyg.test.tsx index 7b78f56677cd4..7c80e5b54af74 100644 --- a/packages/excalidraw/element/textWysiwyg.test.tsx +++ b/packages/excalidraw/element/textWysiwyg.test.tsx @@ -61,9 +61,9 @@ describe("textWysiwyg", () => { Keyboard.keyPress(KEYS.ENTER); - expect(h.state.editingElement?.id).toBe(text.id); + expect(h.state.editingTextElement?.id).toBe(text.id); expect( - (h.state.editingElement as ExcalidrawTextElement).containerId, + (h.state.editingTextElement as ExcalidrawTextElement).containerId, ).toBe(null); }); @@ -105,7 +105,7 @@ describe("textWysiwyg", () => { Keyboard.keyPress(KEYS.ENTER); - expect(h.state.editingElement?.id).toBe(boundText2.id); + expect(h.state.editingTextElement?.id).toBe(boundText2.id); }); it("should not create bound text on ENTER if text exists at container center", () => { @@ -133,7 +133,7 @@ describe("textWysiwyg", () => { Keyboard.keyPress(KEYS.ENTER); - expect(h.state.editingElement?.id).toBe(text.id); + expect(h.state.editingTextElement?.id).toBe(text.id); }); it("should edit existing bound text on ENTER even if higher z-index unbound text exists at container center", () => { @@ -174,7 +174,7 @@ describe("textWysiwyg", () => { Keyboard.keyPress(KEYS.ENTER); - expect(h.state.editingElement?.id).toBe(boundText.id); + expect(h.state.editingTextElement?.id).toBe(boundText.id); }); it("should edit text under cursor when clicked with text tool", async () => { @@ -195,7 +195,7 @@ describe("textWysiwyg", () => { const editor = await getTextEditor(textEditorSelector, false); expect(editor).not.toBe(null); - expect(h.state.editingElement?.id).toBe(text.id); + expect(h.state.editingTextElement?.id).toBe(text.id); expect(h.elements.length).toBe(1); }); @@ -217,7 +217,7 @@ describe("textWysiwyg", () => { const editor = await getTextEditor(textEditorSelector, false); expect(editor).not.toBe(null); - expect(h.state.editingElement?.id).toBe(text.id); + expect(h.state.editingTextElement?.id).toBe(text.id); expect(h.elements.length).toBe(1); }); @@ -286,7 +286,7 @@ describe("textWysiwyg", () => { mouse.doubleClickAt(text.x + text.width / 2, text.y + text.height / 2); const editor = await getTextEditor(textEditorSelector); expect(editor).not.toBe(null); - expect(h.state.editingElement?.id).toBe(text.id); + expect(h.state.editingTextElement?.id).toBe(text.id); expect(h.elements.length).toBe(1); const nextText = `${wrappedText} is great!`; @@ -881,7 +881,7 @@ describe("textWysiwyg", () => { expect(await getTextEditor(textEditorSelector, false)).toBe(null); - expect(h.state.editingElement).toBe(null); + expect(h.state.editingTextElement).toBe(null); expect(text.fontFamily).toEqual(FONT_FAMILY.Excalifont); diff --git a/packages/excalidraw/renderer/interactiveScene.ts b/packages/excalidraw/renderer/interactiveScene.ts index ab37a14256f51..597ab06961c8a 100644 --- a/packages/excalidraw/renderer/interactiveScene.ts +++ b/packages/excalidraw/renderer/interactiveScene.ts @@ -680,8 +680,11 @@ const _renderInteractiveScene = ({ } } - if (appState.editingElement && isTextElement(appState.editingElement)) { - const textElement = allElementsMap.get(appState.editingElement.id) as + if ( + appState.editingTextElement && + isTextElement(appState.editingTextElement) + ) { + const textElement = allElementsMap.get(appState.editingTextElement.id) as | ExcalidrawTextElement | undefined; if (textElement && !textElement.autoResize) { @@ -894,7 +897,7 @@ const _renderInteractiveScene = ({ !appState.viewModeEnabled && showBoundingBox && // do not show transform handles when text is being edited - !isTextElement(appState.editingElement) + !isTextElement(appState.editingTextElement) ) { renderTransformHandles( context, diff --git a/packages/excalidraw/renderer/renderNewElementScene.ts b/packages/excalidraw/renderer/renderNewElementScene.ts new file mode 100644 index 0000000000000..caa7f581c7d21 --- /dev/null +++ b/packages/excalidraw/renderer/renderNewElementScene.ts @@ -0,0 +1,66 @@ +import type { NewElementSceneRenderConfig } from "../scene/types"; +import { throttleRAF } from "../utils"; +import { bootstrapCanvas, getNormalizedCanvasDimensions } from "./helpers"; +import { renderElement } from "./renderElement"; + +const _renderNewElementScene = ({ + canvas, + rc, + newElement, + elementsMap, + allElementsMap, + scale, + appState, + renderConfig, +}: NewElementSceneRenderConfig) => { + if (canvas) { + const [normalizedWidth, normalizedHeight] = getNormalizedCanvasDimensions( + canvas, + scale, + ); + + const context = bootstrapCanvas({ + canvas, + scale, + normalizedWidth, + normalizedHeight, + }); + + // Apply zoom + context.save(); + context.scale(appState.zoom.value, appState.zoom.value); + + if (newElement && newElement.type !== "selection") { + renderElement( + newElement, + elementsMap, + allElementsMap, + rc, + context, + renderConfig, + appState, + ); + } else { + context.clearRect(0, 0, normalizedWidth, normalizedHeight); + } + } +}; + +export const renderNewElementSceneThrottled = throttleRAF( + (config: NewElementSceneRenderConfig) => { + _renderNewElementScene(config); + }, + { trailing: true }, +); + +export const renderNewElementScene = ( + renderConfig: NewElementSceneRenderConfig, + throttle?: boolean, +) => { + if (throttle) { + renderNewElementSceneThrottled(renderConfig); + return; + } + + _renderNewElementScene(renderConfig); +}; diff --git a/packages/excalidraw/scene/Renderer.ts b/packages/excalidraw/scene/Renderer.ts index 63b7e7da7d980..19240b9d16c8d 100644 --- a/packages/excalidraw/scene/Renderer.ts +++ b/packages/excalidraw/scene/Renderer.ts @@ -1,6 +1,7 @@ import { isElementInViewport } from "../element/sizeHelpers"; import { isImageElement } from "../element/typeChecks"; import type { + ExcalidrawElement, NonDeletedElementsMap, NonDeletedExcalidrawElement, } from "../element/types"; @@ -64,11 +65,13 @@ export class Renderer { const getRenderableElements = ({ elements, - editingElement, + editingTextElement, + newElementId, pendingImageElementId, }: { elements: readonly NonDeletedExcalidrawElement[]; - editingElement: AppState["editingElement"]; + editingTextElement: AppState["editingTextElement"]; + newElementId: ExcalidrawElement["id"] | undefined; pendingImageElementId: AppState["pendingImageElementId"]; }) => { const elementsMap = toBrandedType(new Map()); @@ -83,12 +86,16 @@ export class Renderer { } } + if (newElementId === element.id) { + continue; + } + // we don't want to render text element that's being currently edited // (it's rendered on remote only) if ( - !editingElement || - editingElement.type !== "text" || - element.id !== editingElement.id + !editingTextElement || + editingTextElement.type !== "text" || + element.id !== editingTextElement.id ) { elementsMap.set(element.id, element); } @@ -105,7 +112,8 @@ export class Renderer { scrollY, height, width, - editingElement, + editingTextElement, + newElementId, pendingImageElementId, // cache-invalidation nonce sceneNonce: _sceneNonce, @@ -117,7 +125,8 @@ export class Renderer { scrollY: AppState["scrollY"]; height: AppState["height"]; width: AppState["width"]; - editingElement: AppState["editingElement"]; + editingTextElement: AppState["editingTextElement"]; + newElementId: ExcalidrawElement["id"] | undefined; pendingImageElementId: AppState["pendingImageElementId"]; sceneNonce: ReturnType["getSceneNonce"]>; }) => { @@ -125,7 +134,8 @@ export class Renderer { const elementsMap = getRenderableElements({ elements, - editingElement, + editingTextElement, + newElementId, pendingImageElementId, }); diff --git a/packages/excalidraw/scene/Scene.ts b/packages/excalidraw/scene/Scene.ts index cac23f96dc571..603320a733b64 100644 --- a/packages/excalidraw/scene/Scene.ts +++ b/packages/excalidraw/scene/Scene.ts @@ -285,7 +285,10 @@ class Scene { return didChange; } - replaceAllElements(nextElements: ElementsMapOrArray) { + replaceAllElements( + nextElements: ElementsMapOrArray, + updateSceneNonce = true, + ) { const _nextElements = // ts doesn't like `Array.isArray` of `instanceof Map` nextElements instanceof Array @@ -311,11 +314,13 @@ class Scene { this.frames = nextFrameLikes; this.nonDeletedFramesLikes = getNonDeletedElements(this.frames).elements; - this.triggerUpdate(); + this.triggerUpdate(updateSceneNonce); } - triggerUpdate() { - this.sceneNonce = randomInteger(); + triggerUpdate(updateSceneNonce = true) { + if (updateSceneNonce) { + this.sceneNonce = randomInteger(); + } for (const callback of Array.from(this.callbacks)) { callback(); @@ -358,7 +363,11 @@ class Scene { this.callbacks.clear(); } - insertElementAtIndex(element: ExcalidrawElement, index: number) { + insertElementAtIndex( + element: ExcalidrawElement, + index: number, + updateSceneNonce = true, + ) { if (!Number.isFinite(index) || index < 0) { throw new Error( "insertElementAtIndex can only be called with index >= 0", @@ -373,14 +382,14 @@ class Scene { syncMovedIndices(nextElements, arrayToMap([element])); - this.replaceAllElements(nextElements); + this.replaceAllElements(nextElements, updateSceneNonce); } - insertElementsAtIndex(elements: ExcalidrawElement[], index: number) { - if (!elements.length) { - return; - } - + insertElementsAtIndex( + elements: ExcalidrawElement[], + index: number, + updateSceneNonce = true, + ) { if (!Number.isFinite(index) || index < 0) { throw new Error( "insertElementAtIndex can only be called with index >= 0", @@ -395,27 +404,23 @@ class Scene { syncMovedIndices(nextElements, arrayToMap(elements)); - this.replaceAllElements(nextElements); + this.replaceAllElements(nextElements, updateSceneNonce); } - insertElement = (element: ExcalidrawElement) => { + insertElement = (element: ExcalidrawElement, updateSceneNonce = true) => { const index = element.frameId ? this.getElementIndex(element.frameId) : this.elements.length; - this.insertElementAtIndex(element, index); + this.insertElementAtIndex(element, index, updateSceneNonce); }; - insertElements = (elements: ExcalidrawElement[]) => { - if (!elements.length) { - return; - } - - const index = elements[0]?.frameId + insertElements = (elements: ExcalidrawElement[], updateSceneNonce = true) => { + const index = elements[0].frameId ? this.getElementIndex(elements[0].frameId) : this.elements.length; - this.insertElementsAtIndex(elements, index); + this.insertElementsAtIndex(elements, index, updateSceneNonce); }; getElementIndex(elementId: string) { diff --git a/packages/excalidraw/scene/selection.ts b/packages/excalidraw/scene/selection.ts index 547416c72dfb5..06fb2c604a578 100644 --- a/packages/excalidraw/scene/selection.ts +++ b/packages/excalidraw/scene/selection.ts @@ -218,10 +218,15 @@ export const getSelectedElements = ( export const getTargetElements = ( elements: ElementsMapOrArray, - appState: Pick, + appState: Pick< + AppState, + "selectedElementIds" | "editingTextElement" | "newElement" + >, ) => - appState.editingElement - ? [appState.editingElement] + appState.editingTextElement + ? [appState.editingTextElement] + : appState.newElement + ? [appState.newElement] : getSelectedElements(elements, appState, { includeBoundTextElement: true, }); diff --git a/packages/excalidraw/scene/types.ts b/packages/excalidraw/scene/types.ts index f050d2fc85cfc..b3239cc358715 100644 --- a/packages/excalidraw/scene/types.ts +++ b/packages/excalidraw/scene/types.ts @@ -100,6 +100,17 @@ export type InteractiveSceneRenderConfig = { callback: (data: RenderInteractiveSceneCallback) => void; }; +export type NewElementSceneRenderConfig = { + canvas: HTMLCanvasElement | null; + rc: RoughCanvas; + newElement: ExcalidrawElement | null; + elementsMap: RenderableElementsMap; + allElementsMap: NonDeletedSceneElementsMap; + scale: number; + appState: AppState; + renderConfig: StaticCanvasRenderConfig; +}; + export type SceneScroll = { scrollX: number; scrollY: number; diff --git a/packages/excalidraw/tests/__snapshots__/contextmenu.test.tsx.snap b/packages/excalidraw/tests/__snapshots__/contextmenu.test.tsx.snap index a2b92bb11b160..ea3e251fd5300 100644 --- a/packages/excalidraw/tests/__snapshots__/contextmenu.test.tsx.snap +++ b/packages/excalidraw/tests/__snapshots__/contextmenu.test.tsx.snap @@ -812,10 +812,10 @@ exports[`contextMenu element > right-clicking on a group should select whole gro "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -1017,10 +1017,10 @@ exports[`contextMenu element > selecting 'Add to library' in context menu adds e "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -1127,7 +1127,7 @@ exports[`contextMenu element > selecting 'Add to library' in context menu adds e "type": "rectangle", "updated": 1, "version": 3, - "versionNonce": 1150084233, + "versionNonce": 2019559783, "width": 20, "x": -10, "y": 0, @@ -1201,7 +1201,7 @@ History { exports[`contextMenu element > selecting 'Add to library' in context menu adds element to library > [end of test] number of elements 1`] = `1`; -exports[`contextMenu element > selecting 'Add to library' in context menu adds element to library > [end of test] number of renders 1`] = `6`; +exports[`contextMenu element > selecting 'Add to library' in context menu adds element to library > [end of test] number of renders 1`] = `5`; exports[`contextMenu element > selecting 'Bring forward' in context menu brings element forward > [end of test] appState 1`] = ` { @@ -1232,10 +1232,10 @@ exports[`contextMenu element > selecting 'Bring forward' in context menu brings "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -1333,14 +1333,14 @@ exports[`contextMenu element > selecting 'Bring forward' in context menu brings "roundness": { "type": 3, }, - "seed": 1014066025, + "seed": 1116226695, "strokeColor": "#1e1e1e", "strokeStyle": "solid", "strokeWidth": 2, "type": "rectangle", "updated": 1, "version": 3, - "versionNonce": 1604849351, + "versionNonce": 238820263, "width": 20, "x": 20, "y": 30, @@ -1374,7 +1374,7 @@ exports[`contextMenu element > selecting 'Bring forward' in context menu brings "type": "rectangle", "updated": 1, "version": 4, - "versionNonce": 23633383, + "versionNonce": 1604849351, "width": 20, "x": -10, "y": 0, @@ -1531,7 +1531,7 @@ History { exports[`contextMenu element > selecting 'Bring forward' in context menu brings element forward > [end of test] number of elements 1`] = `2`; -exports[`contextMenu element > selecting 'Bring forward' in context menu brings element forward > [end of test] number of renders 1`] = `12`; +exports[`contextMenu element > selecting 'Bring forward' in context menu brings element forward > [end of test] number of renders 1`] = `10`; exports[`contextMenu element > selecting 'Bring to front' in context menu brings element to front > [end of test] appState 1`] = ` { @@ -1562,10 +1562,10 @@ exports[`contextMenu element > selecting 'Bring to front' in context menu brings "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -1663,14 +1663,14 @@ exports[`contextMenu element > selecting 'Bring to front' in context menu brings "roundness": { "type": 3, }, - "seed": 1014066025, + "seed": 1116226695, "strokeColor": "#1e1e1e", "strokeStyle": "solid", "strokeWidth": 2, "type": "rectangle", "updated": 1, "version": 3, - "versionNonce": 1604849351, + "versionNonce": 238820263, "width": 20, "x": 20, "y": 30, @@ -1704,7 +1704,7 @@ exports[`contextMenu element > selecting 'Bring to front' in context menu brings "type": "rectangle", "updated": 1, "version": 4, - "versionNonce": 23633383, + "versionNonce": 1604849351, "width": 20, "x": -10, "y": 0, @@ -1861,7 +1861,7 @@ History { exports[`contextMenu element > selecting 'Bring to front' in context menu brings element to front > [end of test] number of elements 1`] = `2`; -exports[`contextMenu element > selecting 'Bring to front' in context menu brings element to front > [end of test] number of renders 1`] = `12`; +exports[`contextMenu element > selecting 'Bring to front' in context menu brings element to front > [end of test] number of renders 1`] = `10`; exports[`contextMenu element > selecting 'Copy styles' in context menu copies styles > [end of test] appState 1`] = ` { @@ -1892,10 +1892,10 @@ exports[`contextMenu element > selecting 'Copy styles' in context menu copies st "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -2002,7 +2002,7 @@ exports[`contextMenu element > selecting 'Copy styles' in context menu copies st "type": "rectangle", "updated": 1, "version": 3, - "versionNonce": 1150084233, + "versionNonce": 2019559783, "width": 20, "x": -10, "y": 0, @@ -2076,7 +2076,7 @@ History { exports[`contextMenu element > selecting 'Copy styles' in context menu copies styles > [end of test] number of elements 1`] = `1`; -exports[`contextMenu element > selecting 'Copy styles' in context menu copies styles > [end of test] number of renders 1`] = `6`; +exports[`contextMenu element > selecting 'Copy styles' in context menu copies styles > [end of test] number of renders 1`] = `5`; exports[`contextMenu element > selecting 'Delete' in context menu deletes element > [end of test] appState 1`] = ` { @@ -2107,10 +2107,10 @@ exports[`contextMenu element > selecting 'Delete' in context menu deletes elemen "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -2213,7 +2213,7 @@ exports[`contextMenu element > selecting 'Delete' in context menu deletes elemen "type": "rectangle", "updated": 1, "version": 4, - "versionNonce": 1014066025, + "versionNonce": 1116226695, "width": 20, "x": -10, "y": 0, @@ -2315,7 +2315,7 @@ History { exports[`contextMenu element > selecting 'Delete' in context menu deletes element > [end of test] number of elements 1`] = `1`; -exports[`contextMenu element > selecting 'Delete' in context menu deletes element > [end of test] number of renders 1`] = `7`; +exports[`contextMenu element > selecting 'Delete' in context menu deletes element > [end of test] number of renders 1`] = `6`; exports[`contextMenu element > selecting 'Duplicate' in context menu duplicates element > [end of test] appState 1`] = ` { @@ -2346,10 +2346,10 @@ exports[`contextMenu element > selecting 'Duplicate' in context menu duplicates "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -2454,7 +2454,7 @@ exports[`contextMenu element > selecting 'Duplicate' in context menu duplicates "type": "rectangle", "updated": 1, "version": 3, - "versionNonce": 1150084233, + "versionNonce": 2019559783, "width": 20, "x": -10, "y": 0, @@ -2481,14 +2481,14 @@ exports[`contextMenu element > selecting 'Duplicate' in context menu duplicates "roundness": { "type": 3, }, - "seed": 1014066025, + "seed": 1116226695, "strokeColor": "#1e1e1e", "strokeStyle": "solid", "strokeWidth": 2, "type": "rectangle", "updated": 1, "version": 4, - "versionNonce": 238820263, + "versionNonce": 1014066025, "width": 20, "x": 0, "y": 10, @@ -2615,7 +2615,7 @@ History { exports[`contextMenu element > selecting 'Duplicate' in context menu duplicates element > [end of test] number of elements 1`] = `2`; -exports[`contextMenu element > selecting 'Duplicate' in context menu duplicates element > [end of test] number of renders 1`] = `7`; +exports[`contextMenu element > selecting 'Duplicate' in context menu duplicates element > [end of test] number of renders 1`] = `6`; exports[`contextMenu element > selecting 'Group selection' in context menu groups selected elements > [end of test] appState 1`] = ` { @@ -2646,10 +2646,10 @@ exports[`contextMenu element > selecting 'Group selection' in context menu group "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -2761,7 +2761,7 @@ exports[`contextMenu element > selecting 'Group selection' in context menu group "type": "rectangle", "updated": 1, "version": 4, - "versionNonce": 493213705, + "versionNonce": 1505387817, "width": 20, "x": -10, "y": 0, @@ -2790,14 +2790,14 @@ exports[`contextMenu element > selecting 'Group selection' in context menu group "roundness": { "type": 3, }, - "seed": 1014066025, + "seed": 1116226695, "strokeColor": "#1e1e1e", "strokeStyle": "solid", "strokeWidth": 2, "type": "rectangle", "updated": 1, "version": 4, - "versionNonce": 915032327, + "versionNonce": 23633383, "width": 20, "x": 20, "y": 30, @@ -2983,7 +2983,7 @@ History { exports[`contextMenu element > selecting 'Group selection' in context menu groups selected elements > [end of test] number of elements 1`] = `2`; -exports[`contextMenu element > selecting 'Group selection' in context menu groups selected elements > [end of test] number of renders 1`] = `12`; +exports[`contextMenu element > selecting 'Group selection' in context menu groups selected elements > [end of test] number of renders 1`] = `10`; exports[`contextMenu element > selecting 'Paste styles' in context menu pastes styles > [end of test] appState 1`] = ` { @@ -3014,10 +3014,10 @@ exports[`contextMenu element > selecting 'Paste styles' in context menu pastes s "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -3124,7 +3124,7 @@ exports[`contextMenu element > selecting 'Paste styles' in context menu pastes s "type": "rectangle", "updated": 1, "version": 4, - "versionNonce": 941653321, + "versionNonce": 640725609, "width": 20, "x": -10, "y": 0, @@ -3151,14 +3151,14 @@ exports[`contextMenu element > selecting 'Paste styles' in context menu pastes s "roundness": { "type": 3, }, - "seed": 289600103, + "seed": 760410951, "strokeColor": "#e03131", "strokeStyle": "dotted", "strokeWidth": 2, "type": "rectangle", "updated": 1, "version": 9, - "versionNonce": 640725609, + "versionNonce": 1315507081, "width": 20, "x": 20, "y": 30, @@ -3457,7 +3457,7 @@ History { exports[`contextMenu element > selecting 'Paste styles' in context menu pastes styles > [end of test] number of elements 1`] = `2`; -exports[`contextMenu element > selecting 'Paste styles' in context menu pastes styles > [end of test] number of renders 1`] = `18`; +exports[`contextMenu element > selecting 'Paste styles' in context menu pastes styles > [end of test] number of renders 1`] = `16`; exports[`contextMenu element > selecting 'Send backward' in context menu sends element backward > [end of test] appState 1`] = ` { @@ -3488,10 +3488,10 @@ exports[`contextMenu element > selecting 'Send backward' in context menu sends e "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -3589,14 +3589,14 @@ exports[`contextMenu element > selecting 'Send backward' in context menu sends e "roundness": { "type": 3, }, - "seed": 1014066025, + "seed": 1116226695, "strokeColor": "#1e1e1e", "strokeStyle": "solid", "strokeWidth": 2, "type": "rectangle", "updated": 1, "version": 4, - "versionNonce": 23633383, + "versionNonce": 1604849351, "width": 20, "x": 20, "y": 30, @@ -3630,7 +3630,7 @@ exports[`contextMenu element > selecting 'Send backward' in context menu sends e "type": "rectangle", "updated": 1, "version": 3, - "versionNonce": 1150084233, + "versionNonce": 2019559783, "width": 20, "x": -10, "y": 0, @@ -3779,7 +3779,7 @@ History { exports[`contextMenu element > selecting 'Send backward' in context menu sends element backward > [end of test] number of elements 1`] = `2`; -exports[`contextMenu element > selecting 'Send backward' in context menu sends element backward > [end of test] number of renders 1`] = `11`; +exports[`contextMenu element > selecting 'Send backward' in context menu sends element backward > [end of test] number of renders 1`] = `9`; exports[`contextMenu element > selecting 'Send to back' in context menu sends element to back > [end of test] appState 1`] = ` { @@ -3810,10 +3810,10 @@ exports[`contextMenu element > selecting 'Send to back' in context menu sends el "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -3911,14 +3911,14 @@ exports[`contextMenu element > selecting 'Send to back' in context menu sends el "roundness": { "type": 3, }, - "seed": 1014066025, + "seed": 1116226695, "strokeColor": "#1e1e1e", "strokeStyle": "solid", "strokeWidth": 2, "type": "rectangle", "updated": 1, "version": 4, - "versionNonce": 23633383, + "versionNonce": 1604849351, "width": 20, "x": 20, "y": 30, @@ -3952,7 +3952,7 @@ exports[`contextMenu element > selecting 'Send to back' in context menu sends el "type": "rectangle", "updated": 1, "version": 3, - "versionNonce": 1150084233, + "versionNonce": 2019559783, "width": 20, "x": -10, "y": 0, @@ -4101,7 +4101,7 @@ History { exports[`contextMenu element > selecting 'Send to back' in context menu sends element to back > [end of test] number of elements 1`] = `2`; -exports[`contextMenu element > selecting 'Send to back' in context menu sends element to back > [end of test] number of renders 1`] = `11`; +exports[`contextMenu element > selecting 'Send to back' in context menu sends element to back > [end of test] number of renders 1`] = `9`; exports[`contextMenu element > selecting 'Ungroup selection' in context menu ungroups selected group > [end of test] appState 1`] = ` { @@ -4132,10 +4132,10 @@ exports[`contextMenu element > selecting 'Ungroup selection' in context menu ung "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -4243,7 +4243,7 @@ exports[`contextMenu element > selecting 'Ungroup selection' in context menu ung "type": "rectangle", "updated": 1, "version": 5, - "versionNonce": 1723083209, + "versionNonce": 81784553, "width": 20, "x": -10, "y": 0, @@ -4270,14 +4270,14 @@ exports[`contextMenu element > selecting 'Ungroup selection' in context menu ung "roundness": { "type": 3, }, - "seed": 238820263, + "seed": 1014066025, "strokeColor": "#1e1e1e", "strokeStyle": "solid", "strokeWidth": 2, "type": "rectangle", "updated": 1, "version": 5, - "versionNonce": 760410951, + "versionNonce": 747212839, "width": 20, "x": 20, "y": 30, @@ -4503,7 +4503,7 @@ History { exports[`contextMenu element > selecting 'Ungroup selection' in context menu ungroups selected group > [end of test] number of elements 1`] = `2`; -exports[`contextMenu element > selecting 'Ungroup selection' in context menu ungroups selected group > [end of test] number of renders 1`] = `13`; +exports[`contextMenu element > selecting 'Ungroup selection' in context menu ungroups selected group > [end of test] number of renders 1`] = `11`; exports[`contextMenu element > shows 'Group selection' in context menu for multiple selected elements > [end of test] appState 1`] = ` { @@ -5317,10 +5317,10 @@ exports[`contextMenu element > shows 'Group selection' in context menu for multi "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -5428,7 +5428,7 @@ exports[`contextMenu element > shows 'Group selection' in context menu for multi "type": "rectangle", "updated": 1, "version": 3, - "versionNonce": 1014066025, + "versionNonce": 1116226695, "width": 10, "x": -10, "y": 0, @@ -5455,14 +5455,14 @@ exports[`contextMenu element > shows 'Group selection' in context menu for multi "roundness": { "type": 3, }, - "seed": 400692809, + "seed": 238820263, "strokeColor": "#1e1e1e", "strokeStyle": "solid", "strokeWidth": 2, "type": "rectangle", "updated": 1, "version": 3, - "versionNonce": 23633383, + "versionNonce": 1604849351, "width": 10, "x": 12, "y": 0, @@ -5629,7 +5629,7 @@ History { exports[`contextMenu element > shows 'Group selection' in context menu for multiple selected elements > [end of test] number of elements 1`] = `2`; -exports[`contextMenu element > shows 'Group selection' in context menu for multiple selected elements > [end of test] number of renders 1`] = `12`; +exports[`contextMenu element > shows 'Group selection' in context menu for multiple selected elements > [end of test] number of renders 1`] = `10`; exports[`contextMenu element > shows 'Ungroup selection' in context menu for group inside selected elements > [end of test] appState 1`] = ` { @@ -6443,10 +6443,10 @@ exports[`contextMenu element > shows 'Ungroup selection' in context menu for gro "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -6558,7 +6558,7 @@ exports[`contextMenu element > shows 'Ungroup selection' in context menu for gro "type": "rectangle", "updated": 1, "version": 4, - "versionNonce": 81784553, + "versionNonce": 493213705, "width": 10, "x": -10, "y": 0, @@ -6587,14 +6587,14 @@ exports[`contextMenu element > shows 'Ungroup selection' in context menu for gro "roundness": { "type": 3, }, - "seed": 238820263, + "seed": 1014066025, "strokeColor": "#1e1e1e", "strokeStyle": "solid", "strokeWidth": 2, "type": "rectangle", "updated": 1, "version": 4, - "versionNonce": 747212839, + "versionNonce": 915032327, "width": 10, "x": 12, "y": 0, @@ -6801,7 +6801,7 @@ History { exports[`contextMenu element > shows 'Ungroup selection' in context menu for group inside selected elements > [end of test] number of elements 1`] = `2`; -exports[`contextMenu element > shows 'Ungroup selection' in context menu for group inside selected elements > [end of test] number of renders 1`] = `13`; +exports[`contextMenu element > shows 'Ungroup selection' in context menu for group inside selected elements > [end of test] number of renders 1`] = `11`; exports[`contextMenu element > shows context menu for canvas > [end of test] appState 1`] = ` { @@ -7377,10 +7377,10 @@ exports[`contextMenu element > shows context menu for canvas > [end of test] app "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -8288,10 +8288,10 @@ exports[`contextMenu element > shows context menu for element > [end of test] ap "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -9181,10 +9181,10 @@ exports[`contextMenu element > shows context menu for element > [end of test] ap "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -9292,7 +9292,7 @@ exports[`contextMenu element > shows context menu for element > [end of test] el "type": "rectangle", "updated": 1, "version": 3, - "versionNonce": 1150084233, + "versionNonce": 2019559783, "width": 20, "x": -10, "y": 0, @@ -9449,6 +9449,6 @@ exports[`contextMenu element > shows context menu for element > [end of test] nu exports[`contextMenu element > shows context menu for element > [end of test] number of elements 2`] = `2`; -exports[`contextMenu element > shows context menu for element > [end of test] number of renders 1`] = `6`; +exports[`contextMenu element > shows context menu for element > [end of test] number of renders 1`] = `5`; exports[`contextMenu element > shows context menu for element > [end of test] number of renders 2`] = `6`; diff --git a/packages/excalidraw/tests/__snapshots__/dragCreate.test.tsx.snap b/packages/excalidraw/tests/__snapshots__/dragCreate.test.tsx.snap index 74330e6e5fc27..244e1f81b0fec 100644 --- a/packages/excalidraw/tests/__snapshots__/dragCreate.test.tsx.snap +++ b/packages/excalidraw/tests/__snapshots__/dragCreate.test.tsx.snap @@ -45,7 +45,7 @@ exports[`Test dragCreate > add element to the scene when pointer dragging long e "type": "arrow", "updated": 1, "version": 4, - "versionNonce": 2019559783, + "versionNonce": 401146281, "width": 30, "x": 30, "y": 20, @@ -81,7 +81,7 @@ exports[`Test dragCreate > add element to the scene when pointer dragging long e "type": "diamond", "updated": 1, "version": 3, - "versionNonce": 401146281, + "versionNonce": 453191, "width": 30, "x": 30, "y": 20, @@ -117,7 +117,7 @@ exports[`Test dragCreate > add element to the scene when pointer dragging long e "type": "ellipse", "updated": 1, "version": 3, - "versionNonce": 401146281, + "versionNonce": 453191, "width": 30, "x": 30, "y": 20, @@ -166,7 +166,7 @@ exports[`Test dragCreate > add element to the scene when pointer dragging long e "type": "line", "updated": 1, "version": 4, - "versionNonce": 2019559783, + "versionNonce": 401146281, "width": 30, "x": 30, "y": 20, @@ -202,7 +202,7 @@ exports[`Test dragCreate > add element to the scene when pointer dragging long e "type": "rectangle", "updated": 1, "version": 3, - "versionNonce": 401146281, + "versionNonce": 453191, "width": 30, "x": 30, "y": 20, diff --git a/packages/excalidraw/tests/__snapshots__/history.test.tsx.snap b/packages/excalidraw/tests/__snapshots__/history.test.tsx.snap index 07e69f2c38219..ef58b91075090 100644 --- a/packages/excalidraw/tests/__snapshots__/history.test.tsx.snap +++ b/packages/excalidraw/tests/__snapshots__/history.test.tsx.snap @@ -29,10 +29,10 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -599,7 +599,7 @@ History { exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should rebind bindings when both are updated through the history and the arrow got bound to a different element in the meantime > [end of test] number of elements 1`] = `4`; -exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should rebind bindings when both are updated through the history and the arrow got bound to a different element in the meantime > [end of test] number of renders 1`] = `22`; +exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should rebind bindings when both are updated through the history and the arrow got bound to a different element in the meantime > [end of test] number of renders 1`] = `21`; exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should rebind bindings when both are updated through the history and there are no conflicting updates in the meantime > [end of test] appState 1`] = ` { @@ -630,10 +630,10 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -1104,7 +1104,7 @@ History { exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should rebind bindings when both are updated through the history and there are no conflicting updates in the meantime > [end of test] number of elements 1`] = `3`; -exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should rebind bindings when both are updated through the history and there are no conflicting updates in the meantime > [end of test] number of renders 1`] = `24`; +exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should rebind bindings when both are updated through the history and there are no conflicting updates in the meantime > [end of test] number of renders 1`] = `23`; exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should rebind remotely added arrow when it's bindable elements are added through the history > [end of test] appState 1`] = ` { @@ -1135,10 +1135,10 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -1502,10 +1502,10 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -1870,10 +1870,10 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -2136,10 +2136,10 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -2544,7 +2544,7 @@ History { exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should update bound element points when rectangle was remotely moved and arrow is added back through the history > [end of test] number of elements 1`] = `3`; -exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should update bound element points when rectangle was remotely moved and arrow is added back through the history > [end of test] number of renders 1`] = `10`; +exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should update bound element points when rectangle was remotely moved and arrow is added back through the history > [end of test] number of renders 1`] = `9`; exports[`history > multiplayer undo/redo > conflicts in bound text elements and their containers > should preserve latest remotely added binding and unbind previous one when the container is added through the history > [end of test] appState 1`] = ` { @@ -2575,10 +2575,10 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -2873,10 +2873,10 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -3156,10 +3156,10 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -3449,10 +3449,10 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -3734,10 +3734,10 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -3968,10 +3968,10 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -4226,10 +4226,10 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -4498,10 +4498,10 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -4728,10 +4728,10 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -4958,10 +4958,10 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -5186,10 +5186,10 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -5414,10 +5414,10 @@ exports[`history > multiplayer undo/redo > conflicts in frames and their childre "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -5672,10 +5672,10 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -6002,10 +6002,10 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -6395,7 +6395,7 @@ History { exports[`history > multiplayer undo/redo > should iterate through the history when element changes relate only to remotely deleted elements > [end of test] number of elements 1`] = `3`; -exports[`history > multiplayer undo/redo > should iterate through the history when element changes relate only to remotely deleted elements > [end of test] number of renders 1`] = `20`; +exports[`history > multiplayer undo/redo > should iterate through the history when element changes relate only to remotely deleted elements > [end of test] number of renders 1`] = `17`; exports[`history > multiplayer undo/redo > should iterate through the history when selected elements relate only to remotely deleted elements > [end of test] appState 1`] = ` { @@ -6426,10 +6426,10 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -6803,10 +6803,10 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -7121,10 +7121,10 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -7170,7 +7170,9 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh "resizingElement": null, "scrollX": 0, "scrollY": 0, - "selectedElementIds": {}, + "selectedElementIds": { + "id113": true, + }, "selectedElementsAreBeingDragged": false, "selectedGroupIds": {}, "selectionElement": null, @@ -7241,7 +7243,7 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh "strokeWidth": 2, "type": "arrow", "updated": 1, - "version": 8, + "version": 7, "width": 10, "x": -10, "y": -10, @@ -7273,8 +7275,7 @@ History { }, "elementsChange": ElementsChange { "added": Map {}, - "removed": Map {}, - "updated": Map { + "removed": Map { "id113" => Delta { "deleted": { "angle": 0, @@ -7289,7 +7290,7 @@ History { "groupIds": [], "height": 10, "index": "a0", - "isDeleted": true, + "isDeleted": false, "lastCommittedPoint": [ 10, 10, @@ -7326,6 +7327,7 @@ History { }, }, }, + "updated": Map {}, }, }, HistoryEntry { @@ -7367,11 +7369,9 @@ History { "delta": Delta { "deleted": { "editingLinearElementId": null, - "selectedLinearElementId": null, }, "inserted": { "editingLinearElementId": "id113", - "selectedLinearElementId": "id113", }, }, }, @@ -7387,7 +7387,7 @@ History { exports[`history > multiplayer undo/redo > should iterate through the history when selected or editing linear element was remotely deleted > [end of test] number of elements 1`] = `1`; -exports[`history > multiplayer undo/redo > should iterate through the history when selected or editing linear element was remotely deleted > [end of test] number of renders 1`] = `11`; +exports[`history > multiplayer undo/redo > should iterate through the history when selected or editing linear element was remotely deleted > [end of test] number of renders 1`] = `9`; exports[`history > multiplayer undo/redo > should iterate through the history when when element change relates to remotely deleted element > [end of test] appState 1`] = ` { @@ -7418,10 +7418,10 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -7615,7 +7615,7 @@ History { exports[`history > multiplayer undo/redo > should iterate through the history when when element change relates to remotely deleted element > [end of test] number of elements 1`] = `1`; -exports[`history > multiplayer undo/redo > should iterate through the history when when element change relates to remotely deleted element > [end of test] number of renders 1`] = `10`; +exports[`history > multiplayer undo/redo > should iterate through the history when when element change relates to remotely deleted element > [end of test] number of renders 1`] = `9`; exports[`history > multiplayer undo/redo > should iterate through the history when z-index changes do not produce visible change and we synced all indices > [end of test] appState 1`] = ` { @@ -7646,10 +7646,10 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -8000,10 +8000,10 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -8354,10 +8354,10 @@ exports[`history > multiplayer undo/redo > should not let remote changes to inte "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -8726,7 +8726,7 @@ History { exports[`history > multiplayer undo/redo > should not let remote changes to interfere with in progress dragging > [end of test] number of elements 1`] = `3`; -exports[`history > multiplayer undo/redo > should not let remote changes to interfere with in progress dragging > [end of test] number of renders 1`] = `27`; +exports[`history > multiplayer undo/redo > should not let remote changes to interfere with in progress dragging > [end of test] number of renders 1`] = `25`; exports[`history > multiplayer undo/redo > should not let remote changes to interfere with in progress freedraw > [end of test] appState 1`] = ` { @@ -8757,10 +8757,10 @@ exports[`history > multiplayer undo/redo > should not let remote changes to inte "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -9012,7 +9012,7 @@ History { exports[`history > multiplayer undo/redo > should not let remote changes to interfere with in progress freedraw > [end of test] number of elements 1`] = `2`; -exports[`history > multiplayer undo/redo > should not let remote changes to interfere with in progress freedraw > [end of test] number of renders 1`] = `10`; +exports[`history > multiplayer undo/redo > should not let remote changes to interfere with in progress freedraw > [end of test] number of renders 1`] = `8`; exports[`history > multiplayer undo/redo > should not let remote changes to interfere with in progress resizing > [end of test] appState 1`] = ` { @@ -9043,10 +9043,10 @@ exports[`history > multiplayer undo/redo > should not let remote changes to inte "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -9276,7 +9276,7 @@ History { exports[`history > multiplayer undo/redo > should not let remote changes to interfere with in progress resizing > [end of test] number of elements 1`] = `2`; -exports[`history > multiplayer undo/redo > should not let remote changes to interfere with in progress resizing > [end of test] number of renders 1`] = `14`; +exports[`history > multiplayer undo/redo > should not let remote changes to interfere with in progress resizing > [end of test] number of renders 1`] = `13`; exports[`history > multiplayer undo/redo > should not override remote changes on different elements > [end of test] appState 1`] = ` { @@ -9307,10 +9307,10 @@ exports[`history > multiplayer undo/redo > should not override remote changes on "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -9539,7 +9539,7 @@ History { exports[`history > multiplayer undo/redo > should not override remote changes on different elements > [end of test] number of elements 1`] = `2`; -exports[`history > multiplayer undo/redo > should not override remote changes on different elements > [end of test] number of renders 1`] = `11`; +exports[`history > multiplayer undo/redo > should not override remote changes on different elements > [end of test] number of renders 1`] = `10`; exports[`history > multiplayer undo/redo > should not override remote changes on different properties > [end of test] appState 1`] = ` { @@ -9570,10 +9570,10 @@ exports[`history > multiplayer undo/redo > should not override remote changes on "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -9769,7 +9769,7 @@ History { exports[`history > multiplayer undo/redo > should not override remote changes on different properties > [end of test] number of elements 1`] = `1`; -exports[`history > multiplayer undo/redo > should not override remote changes on different properties > [end of test] number of renders 1`] = `10`; +exports[`history > multiplayer undo/redo > should not override remote changes on different properties > [end of test] number of renders 1`] = `9`; exports[`history > multiplayer undo/redo > should override remotely added groups on undo, but restore them on redo > [end of test] appState 1`] = ` { @@ -9800,10 +9800,10 @@ exports[`history > multiplayer undo/redo > should override remotely added groups "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -10100,10 +10100,10 @@ exports[`history > multiplayer undo/redo > should override remotely added points "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -10408,7 +10408,7 @@ History { exports[`history > multiplayer undo/redo > should override remotely added points on undo, but restore them on redo > [end of test] number of elements 1`] = `1`; -exports[`history > multiplayer undo/redo > should override remotely added points on undo, but restore them on redo > [end of test] number of renders 1`] = `17`; +exports[`history > multiplayer undo/redo > should override remotely added points on undo, but restore them on redo > [end of test] number of renders 1`] = `14`; exports[`history > multiplayer undo/redo > should redistribute deltas when element gets removed locally but is restored remotely > [end of test] appState 1`] = ` { @@ -10439,10 +10439,10 @@ exports[`history > multiplayer undo/redo > should redistribute deltas when eleme "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -10642,7 +10642,7 @@ History { exports[`history > multiplayer undo/redo > should redistribute deltas when element gets removed locally but is restored remotely > [end of test] number of elements 1`] = `1`; -exports[`history > multiplayer undo/redo > should redistribute deltas when element gets removed locally but is restored remotely > [end of test] number of renders 1`] = `12`; +exports[`history > multiplayer undo/redo > should redistribute deltas when element gets removed locally but is restored remotely > [end of test] number of renders 1`] = `11`; exports[`history > multiplayer undo/redo > should redraw arrows on undo > [end of test] appState 1`] = ` { @@ -10673,10 +10673,10 @@ exports[`history > multiplayer undo/redo > should redraw arrows on undo > [end o "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -11125,10 +11125,10 @@ exports[`history > multiplayer undo/redo > should update history entries after r "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -11347,7 +11347,7 @@ History { exports[`history > multiplayer undo/redo > should update history entries after remote changes on the same properties > [end of test] number of elements 1`] = `1`; -exports[`history > multiplayer undo/redo > should update history entries after remote changes on the same properties > [end of test] number of renders 1`] = `16`; +exports[`history > multiplayer undo/redo > should update history entries after remote changes on the same properties > [end of test] number of renders 1`] = `15`; exports[`history > singleplayer undo/redo > remounting undo/redo buttons should initialize undo/redo state correctly > [end of test] appState 1`] = ` { @@ -11378,10 +11378,10 @@ exports[`history > singleplayer undo/redo > remounting undo/redo buttons should "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -11585,7 +11585,7 @@ History { exports[`history > singleplayer undo/redo > remounting undo/redo buttons should initialize undo/redo state correctly > [end of test] number of elements 1`] = `2`; -exports[`history > singleplayer undo/redo > remounting undo/redo buttons should initialize undo/redo state correctly > [end of test] number of renders 1`] = `12`; +exports[`history > singleplayer undo/redo > remounting undo/redo buttons should initialize undo/redo state correctly > [end of test] number of renders 1`] = `11`; exports[`history > singleplayer undo/redo > should clear the redo stack on elements change > [end of test] appState 1`] = ` { @@ -11616,10 +11616,10 @@ exports[`history > singleplayer undo/redo > should clear the redo stack on eleme "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -11825,7 +11825,7 @@ History { exports[`history > singleplayer undo/redo > should clear the redo stack on elements change > [end of test] number of elements 1`] = `2`; -exports[`history > singleplayer undo/redo > should clear the redo stack on elements change > [end of test] number of renders 1`] = `10`; +exports[`history > singleplayer undo/redo > should clear the redo stack on elements change > [end of test] number of renders 1`] = `8`; exports[`history > singleplayer undo/redo > should create entry when selecting freedraw > [end of test] appState 1`] = ` { @@ -11856,10 +11856,10 @@ exports[`history > singleplayer undo/redo > should create entry when selecting f "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -12225,7 +12225,7 @@ History { exports[`history > singleplayer undo/redo > should create entry when selecting freedraw > [end of test] number of elements 1`] = `3`; -exports[`history > singleplayer undo/redo > should create entry when selecting freedraw > [end of test] number of renders 1`] = `15`; +exports[`history > singleplayer undo/redo > should create entry when selecting freedraw > [end of test] number of renders 1`] = `12`; exports[`history > singleplayer undo/redo > should create new history entry on scene import via drag&drop > [end of test] appState 1`] = ` { @@ -12256,10 +12256,10 @@ exports[`history > singleplayer undo/redo > should create new history entry on s "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -12502,10 +12502,10 @@ exports[`history > singleplayer undo/redo > should disable undo/redo buttons whe "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -12711,7 +12711,7 @@ History { exports[`history > singleplayer undo/redo > should disable undo/redo buttons when stacks empty > [end of test] number of elements 1`] = `2`; -exports[`history > singleplayer undo/redo > should disable undo/redo buttons when stacks empty > [end of test] number of renders 1`] = `8`; +exports[`history > singleplayer undo/redo > should disable undo/redo buttons when stacks empty > [end of test] number of renders 1`] = `7`; exports[`history > singleplayer undo/redo > should end up with no history entry after initializing scene > [end of test] appState 1`] = ` { @@ -12742,10 +12742,10 @@ exports[`history > singleplayer undo/redo > should end up with no history entry "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -12951,7 +12951,7 @@ History { exports[`history > singleplayer undo/redo > should end up with no history entry after initializing scene > [end of test] number of elements 1`] = `2`; -exports[`history > singleplayer undo/redo > should end up with no history entry after initializing scene > [end of test] number of renders 1`] = `8`; +exports[`history > singleplayer undo/redo > should end up with no history entry after initializing scene > [end of test] number of renders 1`] = `7`; exports[`history > singleplayer undo/redo > should iterate through the history when selection changes do not produce visible change > [end of test] appState 1`] = ` { @@ -12982,10 +12982,10 @@ exports[`history > singleplayer undo/redo > should iterate through the history w "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -13197,7 +13197,7 @@ History { exports[`history > singleplayer undo/redo > should iterate through the history when selection changes do not produce visible change > [end of test] number of elements 1`] = `1`; -exports[`history > singleplayer undo/redo > should iterate through the history when selection changes do not produce visible change > [end of test] number of renders 1`] = `14`; +exports[`history > singleplayer undo/redo > should iterate through the history when selection changes do not produce visible change > [end of test] number of renders 1`] = `13`; exports[`history > singleplayer undo/redo > should not clear the redo stack on standalone appstate change > [end of test] appState 1`] = ` { @@ -13228,10 +13228,10 @@ exports[`history > singleplayer undo/redo > should not clear the redo stack on s "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -13528,7 +13528,7 @@ History { exports[`history > singleplayer undo/redo > should not clear the redo stack on standalone appstate change > [end of test] number of elements 1`] = `2`; -exports[`history > singleplayer undo/redo > should not clear the redo stack on standalone appstate change > [end of test] number of renders 1`] = `14`; +exports[`history > singleplayer undo/redo > should not clear the redo stack on standalone appstate change > [end of test] number of renders 1`] = `12`; exports[`history > singleplayer undo/redo > should not collapse when applying corrupted history entry > [end of test] appState 1`] = ` { @@ -13559,10 +13559,10 @@ exports[`history > singleplayer undo/redo > should not collapse when applying co "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -13730,10 +13730,10 @@ exports[`history > singleplayer undo/redo > should not end up with history entry "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -14017,10 +14017,10 @@ exports[`history > singleplayer undo/redo > should not end up with history entry "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -14283,10 +14283,10 @@ exports[`history > singleplayer undo/redo > should not override appstate changes "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -14526,7 +14526,7 @@ History { exports[`history > singleplayer undo/redo > should not override appstate changes when redo stack is not cleared > [end of test] number of elements 1`] = `1`; -exports[`history > singleplayer undo/redo > should not override appstate changes when redo stack is not cleared > [end of test] number of renders 1`] = `16`; +exports[`history > singleplayer undo/redo > should not override appstate changes when redo stack is not cleared > [end of test] number of renders 1`] = `15`; exports[`history > singleplayer undo/redo > should support appstate name or viewBackgroundColor change > [end of test] appState 1`] = ` { @@ -14557,10 +14557,10 @@ exports[`history > singleplayer undo/redo > should support appstate name or view "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -14717,10 +14717,10 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -15381,7 +15381,7 @@ History { exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind arrow from non deleted bindable elements on deletion and rebind on undo > [end of test] number of elements 1`] = `4`; -exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind arrow from non deleted bindable elements on deletion and rebind on undo > [end of test] number of renders 1`] = `13`; +exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind arrow from non deleted bindable elements on deletion and rebind on undo > [end of test] number of renders 1`] = `12`; exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind arrow from non deleted bindable elements on undo and rebind on redo > [end of test] appState 1`] = ` { @@ -15412,10 +15412,10 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -16000,7 +16000,7 @@ History { exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind arrow from non deleted bindable elements on undo and rebind on redo > [end of test] number of elements 1`] = `4`; -exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind arrow from non deleted bindable elements on undo and rebind on redo > [end of test] number of renders 1`] = `13`; +exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind arrow from non deleted bindable elements on undo and rebind on redo > [end of test] number of renders 1`] = `12`; exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind everything from non deleted elements when iterating through the whole undo stack and vice versa rebind everything on redo > [end of test] appState 1`] = ` { @@ -16031,10 +16031,10 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -16619,7 +16619,7 @@ History { exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind everything from non deleted elements when iterating through the whole undo stack and vice versa rebind everything on redo > [end of test] number of elements 1`] = `4`; -exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind everything from non deleted elements when iterating through the whole undo stack and vice versa rebind everything on redo > [end of test] number of renders 1`] = `21`; +exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind everything from non deleted elements when iterating through the whole undo stack and vice versa rebind everything on redo > [end of test] number of renders 1`] = `20`; exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind rectangle from arrow on deletion and rebind on undo > [end of test] appState 1`] = ` { @@ -16650,10 +16650,10 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -17330,7 +17330,7 @@ History { exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind rectangle from arrow on deletion and rebind on undo > [end of test] number of elements 1`] = `4`; -exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind rectangle from arrow on deletion and rebind on undo > [end of test] number of renders 1`] = `15`; +exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind rectangle from arrow on deletion and rebind on undo > [end of test] number of renders 1`] = `14`; exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind rectangles from arrow on deletion and rebind on undo > [end of test] appState 1`] = ` { @@ -17361,10 +17361,10 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -18079,7 +18079,7 @@ History { exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind rectangles from arrow on deletion and rebind on undo > [end of test] number of elements 1`] = `4`; -exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind rectangles from arrow on deletion and rebind on undo > [end of test] number of renders 1`] = `16`; +exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind rectangles from arrow on deletion and rebind on undo > [end of test] number of renders 1`] = `15`; exports[`history > singleplayer undo/redo > should support changes in elements' order > [end of test] appState 1`] = ` { @@ -18110,10 +18110,10 @@ exports[`history > singleplayer undo/redo > should support changes in elements' "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -18552,7 +18552,7 @@ History { exports[`history > singleplayer undo/redo > should support changes in elements' order > [end of test] number of elements 1`] = `3`; -exports[`history > singleplayer undo/redo > should support changes in elements' order > [end of test] number of renders 1`] = `23`; +exports[`history > singleplayer undo/redo > should support changes in elements' order > [end of test] number of renders 1`] = `20`; exports[`history > singleplayer undo/redo > should support duplication of groups, appstate group selection and editing group > [end of test] appState 1`] = ` { @@ -18583,10 +18583,10 @@ exports[`history > singleplayer undo/redo > should support duplication of groups "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -19104,10 +19104,10 @@ exports[`history > singleplayer undo/redo > should support element creation, del "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -19528,7 +19528,7 @@ History { exports[`history > singleplayer undo/redo > should support element creation, deletion and appstate element selection change > [end of test] number of elements 1`] = `3`; -exports[`history > singleplayer undo/redo > should support element creation, deletion and appstate element selection change > [end of test] number of renders 1`] = `30`; +exports[`history > singleplayer undo/redo > should support element creation, deletion and appstate element selection change > [end of test] number of renders 1`] = `27`; exports[`history > singleplayer undo/redo > should support linear element creation and points manipulation through the editor > [end of test] appState 1`] = ` { @@ -19559,10 +19559,10 @@ exports[`history > singleplayer undo/redo > should support linear element creati "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -19917,11 +19917,9 @@ History { "delta": Delta { "deleted": { "editingLinearElementId": null, - "selectedLinearElementId": null, }, "inserted": { "editingLinearElementId": "id27", - "selectedLinearElementId": "id27", }, }, }, @@ -19937,4 +19935,4 @@ History { exports[`history > singleplayer undo/redo > should support linear element creation and points manipulation through the editor > [end of test] number of elements 1`] = `1`; -exports[`history > singleplayer undo/redo > should support linear element creation and points manipulation through the editor > [end of test] number of renders 1`] = `23`; +exports[`history > singleplayer undo/redo > should support linear element creation and points manipulation through the editor > [end of test] number of renders 1`] = `20`; diff --git a/packages/excalidraw/tests/__snapshots__/move.test.tsx.snap b/packages/excalidraw/tests/__snapshots__/move.test.tsx.snap index c6ea4b647342e..1eba8956760a4 100644 --- a/packages/excalidraw/tests/__snapshots__/move.test.tsx.snap +++ b/packages/excalidraw/tests/__snapshots__/move.test.tsx.snap @@ -20,14 +20,14 @@ exports[`duplicate element on move when ALT is clicked > rectangle 5`] = ` "roundness": { "type": 3, }, - "seed": 238820263, + "seed": 1014066025, "strokeColor": "#1e1e1e", "strokeStyle": "solid", "strokeWidth": 2, "type": "rectangle", "updated": 1, "version": 5, - "versionNonce": 400692809, + "versionNonce": 238820263, "width": 30, "x": 30, "y": 20, @@ -61,7 +61,7 @@ exports[`duplicate element on move when ALT is clicked > rectangle 6`] = ` "type": "rectangle", "updated": 1, "version": 6, - "versionNonce": 23633383, + "versionNonce": 1505387817, "width": 30, "x": -10, "y": 60, @@ -95,7 +95,7 @@ exports[`move element > rectangle 5`] = ` "type": "rectangle", "updated": 1, "version": 4, - "versionNonce": 1116226695, + "versionNonce": 1150084233, "width": 30, "x": 0, "y": 40, @@ -134,7 +134,7 @@ exports[`move element > rectangles with binding arrow 5`] = ` "type": "rectangle", "updated": 1, "version": 4, - "versionNonce": 760410951, + "versionNonce": 915032327, "width": 100, "x": 0, "y": 0, @@ -166,14 +166,14 @@ exports[`move element > rectangles with binding arrow 6`] = ` "roundness": { "type": 3, }, - "seed": 1150084233, + "seed": 2019559783, "strokeColor": "#1e1e1e", "strokeStyle": "solid", "strokeWidth": 2, "type": "rectangle", "updated": 1, "version": 7, - "versionNonce": 745419401, + "versionNonce": 927333447, "width": 300, "x": 201, "y": 2, @@ -219,7 +219,7 @@ exports[`move element > rectangles with binding arrow 7`] = ` "roundness": { "type": 2, }, - "seed": 1604849351, + "seed": 238820263, "startArrowhead": null, "startBinding": { "elementId": "id0", @@ -233,7 +233,7 @@ exports[`move element > rectangles with binding arrow 7`] = ` "type": "arrow", "updated": 1, "version": 11, - "versionNonce": 1996028265, + "versionNonce": 1508694887, "width": 81, "x": 110, "y": 50, diff --git a/packages/excalidraw/tests/__snapshots__/multiPointCreate.test.tsx.snap b/packages/excalidraw/tests/__snapshots__/multiPointCreate.test.tsx.snap index 05d6b9cddc11d..490bc91d223f4 100644 --- a/packages/excalidraw/tests/__snapshots__/multiPointCreate.test.tsx.snap +++ b/packages/excalidraw/tests/__snapshots__/multiPointCreate.test.tsx.snap @@ -50,7 +50,7 @@ exports[`multi point mode in linear elements > arrow 3`] = ` "type": "arrow", "updated": 1, "version": 8, - "versionNonce": 23633383, + "versionNonce": 1014066025, "width": 70, "x": 30, "y": 30, @@ -106,7 +106,7 @@ exports[`multi point mode in linear elements > line 3`] = ` "type": "line", "updated": 1, "version": 8, - "versionNonce": 23633383, + "versionNonce": 1014066025, "width": 70, "x": 30, "y": 30, diff --git a/packages/excalidraw/tests/__snapshots__/regressionTests.test.tsx.snap b/packages/excalidraw/tests/__snapshots__/regressionTests.test.tsx.snap index 67bf5d52af6be..a6e695c48ba03 100644 --- a/packages/excalidraw/tests/__snapshots__/regressionTests.test.tsx.snap +++ b/packages/excalidraw/tests/__snapshots__/regressionTests.test.tsx.snap @@ -29,10 +29,10 @@ exports[`given element A and group of elements B and given both are selected whe "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -409,7 +409,7 @@ History { exports[`given element A and group of elements B and given both are selected when user clicks on B, on pointer up only elements from B should be selected > [end of test] number of elements 1`] = `0`; -exports[`given element A and group of elements B and given both are selected when user clicks on B, on pointer up only elements from B should be selected > [end of test] number of renders 1`] = `21`; +exports[`given element A and group of elements B and given both are selected when user clicks on B, on pointer up only elements from B should be selected > [end of test] number of renders 1`] = `18`; exports[`given element A and group of elements B and given both are selected when user shift-clicks on B, on pointer up only element A should be selected > [end of test] appState 1`] = ` { @@ -440,10 +440,10 @@ exports[`given element A and group of elements B and given both are selected whe "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -811,7 +811,7 @@ History { exports[`given element A and group of elements B and given both are selected when user shift-clicks on B, on pointer up only element A should be selected > [end of test] number of elements 1`] = `0`; -exports[`given element A and group of elements B and given both are selected when user shift-clicks on B, on pointer up only element A should be selected > [end of test] number of renders 1`] = `19`; +exports[`given element A and group of elements B and given both are selected when user shift-clicks on B, on pointer up only element A should be selected > [end of test] number of renders 1`] = `16`; exports[`regression tests > Cmd/Ctrl-click exclusively select element under pointer > [end of test] appState 1`] = ` { @@ -842,10 +842,10 @@ exports[`regression tests > Cmd/Ctrl-click exclusively select element under poin "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": "id10", "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -1352,7 +1352,7 @@ History { exports[`regression tests > Cmd/Ctrl-click exclusively select element under pointer > [end of test] number of elements 1`] = `0`; -exports[`regression tests > Cmd/Ctrl-click exclusively select element under pointer > [end of test] number of renders 1`] = `29`; +exports[`regression tests > Cmd/Ctrl-click exclusively select element under pointer > [end of test] number of renders 1`] = `26`; exports[`regression tests > Drags selected element when hitting only bounding box and keeps element selected > [end of test] appState 1`] = ` { @@ -1383,10 +1383,10 @@ exports[`regression tests > Drags selected element when hitting only bounding bo "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -1552,7 +1552,7 @@ History { exports[`regression tests > Drags selected element when hitting only bounding box and keeps element selected > [end of test] number of elements 1`] = `0`; -exports[`regression tests > Drags selected element when hitting only bounding box and keeps element selected > [end of test] number of renders 1`] = `11`; +exports[`regression tests > Drags selected element when hitting only bounding box and keeps element selected > [end of test] number of renders 1`] = `10`; exports[`regression tests > adjusts z order when grouping > [end of test] appState 1`] = ` { @@ -1583,10 +1583,10 @@ exports[`regression tests > adjusts z order when grouping > [end of test] appSta "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -1923,7 +1923,7 @@ History { exports[`regression tests > adjusts z order when grouping > [end of test] number of elements 1`] = `0`; -exports[`regression tests > adjusts z order when grouping > [end of test] number of renders 1`] = `18`; +exports[`regression tests > adjusts z order when grouping > [end of test] number of renders 1`] = `15`; exports[`regression tests > alt-drag duplicates an element > [end of test] appState 1`] = ` { @@ -1954,10 +1954,10 @@ exports[`regression tests > alt-drag duplicates an element > [end of test] appSt "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -2159,7 +2159,7 @@ History { exports[`regression tests > alt-drag duplicates an element > [end of test] number of elements 1`] = `0`; -exports[`regression tests > alt-drag duplicates an element > [end of test] number of renders 1`] = `9`; +exports[`regression tests > alt-drag duplicates an element > [end of test] number of renders 1`] = `8`; exports[`regression tests > arrow keys > [end of test] appState 1`] = ` { @@ -2190,10 +2190,10 @@ exports[`regression tests > arrow keys > [end of test] appState 1`] = ` "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -2335,7 +2335,7 @@ History { exports[`regression tests > arrow keys > [end of test] number of elements 1`] = `0`; -exports[`regression tests > arrow keys > [end of test] number of renders 1`] = `13`; +exports[`regression tests > arrow keys > [end of test] number of renders 1`] = `12`; exports[`regression tests > can drag element that covers another element, while another elem is selected > [end of test] appState 1`] = ` { @@ -2366,10 +2366,10 @@ exports[`regression tests > can drag element that covers another element, while "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -2651,7 +2651,7 @@ History { exports[`regression tests > can drag element that covers another element, while another elem is selected > [end of test] number of elements 1`] = `0`; -exports[`regression tests > can drag element that covers another element, while another elem is selected > [end of test] number of renders 1`] = `18`; +exports[`regression tests > can drag element that covers another element, while another elem is selected > [end of test] number of renders 1`] = `15`; exports[`regression tests > change the properties of a shape > [end of test] appState 1`] = ` { @@ -2682,10 +2682,10 @@ exports[`regression tests > change the properties of a shape > [end of test] app "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -2893,7 +2893,7 @@ History { exports[`regression tests > change the properties of a shape > [end of test] number of elements 1`] = `0`; -exports[`regression tests > change the properties of a shape > [end of test] number of renders 1`] = `10`; +exports[`regression tests > change the properties of a shape > [end of test] number of renders 1`] = `9`; exports[`regression tests > click on an element and drag it > [dragged] appState 1`] = ` { @@ -2924,10 +2924,10 @@ exports[`regression tests > click on an element and drag it > [dragged] appState "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -3034,7 +3034,7 @@ exports[`regression tests > click on an element and drag it > [dragged] element "type": "rectangle", "updated": 1, "version": 4, - "versionNonce": 1116226695, + "versionNonce": 1150084233, "width": 10, "x": 20, "y": 20, @@ -3132,7 +3132,7 @@ History { exports[`regression tests > click on an element and drag it > [dragged] number of elements 1`] = `1`; -exports[`regression tests > click on an element and drag it > [dragged] number of renders 1`] = `9`; +exports[`regression tests > click on an element and drag it > [dragged] number of renders 1`] = `8`; exports[`regression tests > click on an element and drag it > [end of test] appState 1`] = ` { @@ -3163,10 +3163,10 @@ exports[`regression tests > click on an element and drag it > [end of test] appS "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -3358,7 +3358,7 @@ History { exports[`regression tests > click on an element and drag it > [end of test] number of elements 1`] = `0`; -exports[`regression tests > click on an element and drag it > [end of test] number of renders 1`] = `11`; +exports[`regression tests > click on an element and drag it > [end of test] number of renders 1`] = `10`; exports[`regression tests > click to select a shape > [end of test] appState 1`] = ` { @@ -3389,10 +3389,10 @@ exports[`regression tests > click to select a shape > [end of test] appState 1`] "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -3610,7 +3610,7 @@ History { exports[`regression tests > click to select a shape > [end of test] number of elements 1`] = `0`; -exports[`regression tests > click to select a shape > [end of test] number of renders 1`] = `12`; +exports[`regression tests > click to select a shape > [end of test] number of renders 1`] = `10`; exports[`regression tests > click-drag to select a group > [end of test] appState 1`] = ` { @@ -3641,10 +3641,10 @@ exports[`regression tests > click-drag to select a group > [end of test] appStat "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -3917,7 +3917,7 @@ History { exports[`regression tests > click-drag to select a group > [end of test] number of elements 1`] = `0`; -exports[`regression tests > click-drag to select a group > [end of test] number of renders 1`] = `17`; +exports[`regression tests > click-drag to select a group > [end of test] number of renders 1`] = `14`; exports[`regression tests > deleting last but one element in editing group should unselect the group > [end of test] appState 1`] = ` { @@ -3948,10 +3948,10 @@ exports[`regression tests > deleting last but one element in editing group shoul "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -4327,7 +4327,7 @@ History { exports[`regression tests > deleting last but one element in editing group should unselect the group > [end of test] number of elements 1`] = `0`; -exports[`regression tests > deleting last but one element in editing group should unselect the group > [end of test] number of renders 1`] = `19`; +exports[`regression tests > deleting last but one element in editing group should unselect the group > [end of test] number of renders 1`] = `17`; exports[`regression tests > deselects group of selected elements on pointer down when pointer doesn't hit any element > [end of test] appState 1`] = ` { @@ -4358,10 +4358,10 @@ exports[`regression tests > deselects group of selected elements on pointer down "currentItemTextAlign": "left", "cursorButton": "down", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -4435,7 +4435,7 @@ exports[`regression tests > deselects group of selected elements on pointer down "roundness": { "type": 2, }, - "seed": 1505387817, + "seed": 400692809, "strokeColor": "#1e1e1e", "strokeStyle": "solid", "strokeWidth": 2, @@ -4606,7 +4606,7 @@ History { exports[`regression tests > deselects group of selected elements on pointer down when pointer doesn't hit any element > [end of test] number of elements 1`] = `0`; -exports[`regression tests > deselects group of selected elements on pointer down when pointer doesn't hit any element > [end of test] number of renders 1`] = `13`; +exports[`regression tests > deselects group of selected elements on pointer down when pointer doesn't hit any element > [end of test] number of renders 1`] = `11`; exports[`regression tests > deselects group of selected elements on pointer up when pointer hits common bounding box without hitting any element > [end of test] appState 1`] = ` { @@ -4637,10 +4637,10 @@ exports[`regression tests > deselects group of selected elements on pointer up w "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -4855,7 +4855,7 @@ History { exports[`regression tests > deselects group of selected elements on pointer up when pointer hits common bounding box without hitting any element > [end of test] number of elements 1`] = `0`; -exports[`regression tests > deselects group of selected elements on pointer up when pointer hits common bounding box without hitting any element > [end of test] number of renders 1`] = `13`; +exports[`regression tests > deselects group of selected elements on pointer up when pointer hits common bounding box without hitting any element > [end of test] number of renders 1`] = `11`; exports[`regression tests > deselects selected element on pointer down when pointer doesn't hit any element > [end of test] appState 1`] = ` { @@ -4886,10 +4886,10 @@ exports[`regression tests > deselects selected element on pointer down when poin "currentItemTextAlign": "left", "cursorButton": "down", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -4962,7 +4962,7 @@ exports[`regression tests > deselects selected element on pointer down when poin "roundness": { "type": 2, }, - "seed": 1150084233, + "seed": 2019559783, "strokeColor": "#1e1e1e", "strokeStyle": "solid", "strokeWidth": 2, @@ -5061,7 +5061,7 @@ History { exports[`regression tests > deselects selected element on pointer down when pointer doesn't hit any element > [end of test] number of elements 1`] = `0`; -exports[`regression tests > deselects selected element on pointer down when pointer doesn't hit any element > [end of test] number of renders 1`] = `8`; +exports[`regression tests > deselects selected element on pointer down when pointer doesn't hit any element > [end of test] number of renders 1`] = `7`; exports[`regression tests > deselects selected element, on pointer up, when click hits element bounding box but doesn't hit the element > [end of test] appState 1`] = ` { @@ -5092,10 +5092,10 @@ exports[`regression tests > deselects selected element, on pointer up, when clic "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -5256,7 +5256,7 @@ History { exports[`regression tests > deselects selected element, on pointer up, when click hits element bounding box but doesn't hit the element > [end of test] number of elements 1`] = `0`; -exports[`regression tests > deselects selected element, on pointer up, when click hits element bounding box but doesn't hit the element > [end of test] number of renders 1`] = `8`; +exports[`regression tests > deselects selected element, on pointer up, when click hits element bounding box but doesn't hit the element > [end of test] number of renders 1`] = `7`; exports[`regression tests > double click to edit a group > [end of test] appState 1`] = ` { @@ -5287,10 +5287,10 @@ exports[`regression tests > double click to edit a group > [end of test] appStat "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": "id3", "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -5634,7 +5634,7 @@ History { exports[`regression tests > double click to edit a group > [end of test] number of elements 1`] = `0`; -exports[`regression tests > double click to edit a group > [end of test] number of renders 1`] = `18`; +exports[`regression tests > double click to edit a group > [end of test] number of renders 1`] = `15`; exports[`regression tests > drags selected elements from point inside common bounding box that doesn't hit any element and keeps elements selected after dragging > [end of test] appState 1`] = ` { @@ -5665,10 +5665,10 @@ exports[`regression tests > drags selected elements from point inside common bou "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -5920,7 +5920,7 @@ History { exports[`regression tests > drags selected elements from point inside common bounding box that doesn't hit any element and keeps elements selected after dragging > [end of test] number of elements 1`] = `0`; -exports[`regression tests > drags selected elements from point inside common bounding box that doesn't hit any element and keeps elements selected after dragging > [end of test] number of renders 1`] = `14`; +exports[`regression tests > drags selected elements from point inside common bounding box that doesn't hit any element and keeps elements selected after dragging > [end of test] number of renders 1`] = `12`; exports[`regression tests > draw every type of shape > [end of test] appState 1`] = ` { @@ -5951,10 +5951,10 @@ exports[`regression tests > draw every type of shape > [end of test] appState 1` "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -6724,7 +6724,7 @@ History { exports[`regression tests > draw every type of shape > [end of test] number of elements 1`] = `0`; -exports[`regression tests > draw every type of shape > [end of test] number of renders 1`] = `43`; +exports[`regression tests > draw every type of shape > [end of test] number of renders 1`] = `31`; exports[`regression tests > given a group of selected elements with an element that is not selected inside the group common bounding box when element that is not selected is clicked should switch selection to not selected element on pointer up > [end of test] appState 1`] = ` { @@ -6755,10 +6755,10 @@ exports[`regression tests > given a group of selected elements with an element t "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -7050,7 +7050,7 @@ History { exports[`regression tests > given a group of selected elements with an element that is not selected inside the group common bounding box when element that is not selected is clicked should switch selection to not selected element on pointer up > [end of test] number of elements 1`] = `0`; -exports[`regression tests > given a group of selected elements with an element that is not selected inside the group common bounding box when element that is not selected is clicked should switch selection to not selected element on pointer up > [end of test] number of renders 1`] = `17`; +exports[`regression tests > given a group of selected elements with an element that is not selected inside the group common bounding box when element that is not selected is clicked should switch selection to not selected element on pointer up > [end of test] number of renders 1`] = `14`; exports[`regression tests > given a selected element A and a not selected element B with higher z-index than A and given B partially overlaps A when there's a shift-click on the overlapped section B is added to the selection > [end of test] appState 1`] = ` { @@ -7081,10 +7081,10 @@ exports[`regression tests > given a selected element A and a not selected elemen "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -7322,7 +7322,7 @@ History { exports[`regression tests > given a selected element A and a not selected element B with higher z-index than A and given B partially overlaps A when there's a shift-click on the overlapped section B is added to the selection > [end of test] number of elements 1`] = `0`; -exports[`regression tests > given a selected element A and a not selected element B with higher z-index than A and given B partially overlaps A when there's a shift-click on the overlapped section B is added to the selection > [end of test] number of renders 1`] = `14`; +exports[`regression tests > given a selected element A and a not selected element B with higher z-index than A and given B partially overlaps A when there's a shift-click on the overlapped section B is added to the selection > [end of test] number of renders 1`] = `12`; exports[`regression tests > given selected element A with lower z-index than unselected element B and given B is partially over A when clicking intersection between A and B B should be selected on pointer up > [end of test] appState 1`] = ` { @@ -7353,10 +7353,10 @@ exports[`regression tests > given selected element A with lower z-index than uns "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -7583,10 +7583,10 @@ exports[`regression tests > given selected element A with lower z-index than uns "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -7816,10 +7816,10 @@ exports[`regression tests > key 2 selects rectangle tool > [end of test] appStat "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -7961,7 +7961,7 @@ History { exports[`regression tests > key 2 selects rectangle tool > [end of test] number of elements 1`] = `0`; -exports[`regression tests > key 2 selects rectangle tool > [end of test] number of renders 1`] = `7`; +exports[`regression tests > key 2 selects rectangle tool > [end of test] number of renders 1`] = `6`; exports[`regression tests > key 3 selects diamond tool > [end of test] appState 1`] = ` { @@ -7992,10 +7992,10 @@ exports[`regression tests > key 3 selects diamond tool > [end of test] appState "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -8137,7 +8137,7 @@ History { exports[`regression tests > key 3 selects diamond tool > [end of test] number of elements 1`] = `0`; -exports[`regression tests > key 3 selects diamond tool > [end of test] number of renders 1`] = `7`; +exports[`regression tests > key 3 selects diamond tool > [end of test] number of renders 1`] = `6`; exports[`regression tests > key 4 selects ellipse tool > [end of test] appState 1`] = ` { @@ -8168,10 +8168,10 @@ exports[`regression tests > key 4 selects ellipse tool > [end of test] appState "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -8313,7 +8313,7 @@ History { exports[`regression tests > key 4 selects ellipse tool > [end of test] number of elements 1`] = `0`; -exports[`regression tests > key 4 selects ellipse tool > [end of test] number of renders 1`] = `7`; +exports[`regression tests > key 4 selects ellipse tool > [end of test] number of renders 1`] = `6`; exports[`regression tests > key 5 selects arrow tool > [end of test] appState 1`] = ` { @@ -8344,10 +8344,10 @@ exports[`regression tests > key 5 selects arrow tool > [end of test] appState 1` "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -8531,7 +8531,7 @@ History { exports[`regression tests > key 5 selects arrow tool > [end of test] number of elements 1`] = `0`; -exports[`regression tests > key 5 selects arrow tool > [end of test] number of renders 1`] = `7`; +exports[`regression tests > key 5 selects arrow tool > [end of test] number of renders 1`] = `6`; exports[`regression tests > key 6 selects line tool > [end of test] appState 1`] = ` { @@ -8562,10 +8562,10 @@ exports[`regression tests > key 6 selects line tool > [end of test] appState 1`] "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -8748,7 +8748,7 @@ History { exports[`regression tests > key 6 selects line tool > [end of test] number of elements 1`] = `0`; -exports[`regression tests > key 6 selects line tool > [end of test] number of renders 1`] = `7`; +exports[`regression tests > key 6 selects line tool > [end of test] number of renders 1`] = `6`; exports[`regression tests > key 7 selects freedraw tool > [end of test] appState 1`] = ` { @@ -8779,10 +8779,10 @@ exports[`regression tests > key 7 selects freedraw tool > [end of test] appState "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -8938,7 +8938,7 @@ History { exports[`regression tests > key 7 selects freedraw tool > [end of test] number of elements 1`] = `0`; -exports[`regression tests > key 7 selects freedraw tool > [end of test] number of renders 1`] = `7`; +exports[`regression tests > key 7 selects freedraw tool > [end of test] number of renders 1`] = `6`; exports[`regression tests > key a selects arrow tool > [end of test] appState 1`] = ` { @@ -8969,10 +8969,10 @@ exports[`regression tests > key a selects arrow tool > [end of test] appState 1` "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -9156,7 +9156,7 @@ History { exports[`regression tests > key a selects arrow tool > [end of test] number of elements 1`] = `0`; -exports[`regression tests > key a selects arrow tool > [end of test] number of renders 1`] = `7`; +exports[`regression tests > key a selects arrow tool > [end of test] number of renders 1`] = `6`; exports[`regression tests > key d selects diamond tool > [end of test] appState 1`] = ` { @@ -9187,10 +9187,10 @@ exports[`regression tests > key d selects diamond tool > [end of test] appState "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -9332,7 +9332,7 @@ History { exports[`regression tests > key d selects diamond tool > [end of test] number of elements 1`] = `0`; -exports[`regression tests > key d selects diamond tool > [end of test] number of renders 1`] = `7`; +exports[`regression tests > key d selects diamond tool > [end of test] number of renders 1`] = `6`; exports[`regression tests > key l selects line tool > [end of test] appState 1`] = ` { @@ -9363,10 +9363,10 @@ exports[`regression tests > key l selects line tool > [end of test] appState 1`] "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -9549,7 +9549,7 @@ History { exports[`regression tests > key l selects line tool > [end of test] number of elements 1`] = `0`; -exports[`regression tests > key l selects line tool > [end of test] number of renders 1`] = `7`; +exports[`regression tests > key l selects line tool > [end of test] number of renders 1`] = `6`; exports[`regression tests > key o selects ellipse tool > [end of test] appState 1`] = ` { @@ -9580,10 +9580,10 @@ exports[`regression tests > key o selects ellipse tool > [end of test] appState "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -9725,7 +9725,7 @@ History { exports[`regression tests > key o selects ellipse tool > [end of test] number of elements 1`] = `0`; -exports[`regression tests > key o selects ellipse tool > [end of test] number of renders 1`] = `7`; +exports[`regression tests > key o selects ellipse tool > [end of test] number of renders 1`] = `6`; exports[`regression tests > key p selects freedraw tool > [end of test] appState 1`] = ` { @@ -9756,10 +9756,10 @@ exports[`regression tests > key p selects freedraw tool > [end of test] appState "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -9915,7 +9915,7 @@ History { exports[`regression tests > key p selects freedraw tool > [end of test] number of elements 1`] = `0`; -exports[`regression tests > key p selects freedraw tool > [end of test] number of renders 1`] = `7`; +exports[`regression tests > key p selects freedraw tool > [end of test] number of renders 1`] = `6`; exports[`regression tests > key r selects rectangle tool > [end of test] appState 1`] = ` { @@ -9946,10 +9946,10 @@ exports[`regression tests > key r selects rectangle tool > [end of test] appStat "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -10091,7 +10091,7 @@ History { exports[`regression tests > key r selects rectangle tool > [end of test] number of elements 1`] = `0`; -exports[`regression tests > key r selects rectangle tool > [end of test] number of renders 1`] = `7`; +exports[`regression tests > key r selects rectangle tool > [end of test] number of renders 1`] = `6`; exports[`regression tests > make a group and duplicate it > [end of test] appState 1`] = ` { @@ -10122,10 +10122,10 @@ exports[`regression tests > make a group and duplicate it > [end of test] appSta "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -10601,7 +10601,7 @@ History { exports[`regression tests > make a group and duplicate it > [end of test] number of elements 1`] = `0`; -exports[`regression tests > make a group and duplicate it > [end of test] number of renders 1`] = `20`; +exports[`regression tests > make a group and duplicate it > [end of test] number of renders 1`] = `17`; exports[`regression tests > noop interaction after undo shouldn't create history entry > [end of test] appState 1`] = ` { @@ -10632,10 +10632,10 @@ exports[`regression tests > noop interaction after undo shouldn't create history "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -10874,7 +10874,7 @@ History { exports[`regression tests > noop interaction after undo shouldn't create history entry > [end of test] number of elements 1`] = `0`; -exports[`regression tests > noop interaction after undo shouldn't create history entry > [end of test] number of renders 1`] = `16`; +exports[`regression tests > noop interaction after undo shouldn't create history entry > [end of test] number of renders 1`] = `14`; exports[`regression tests > pinch-to-zoom works > [end of test] appState 1`] = ` { @@ -10905,10 +10905,10 @@ exports[`regression tests > pinch-to-zoom works > [end of test] appState 1`] = ` "currentItemTextAlign": "left", "cursorButton": "down", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -11027,10 +11027,10 @@ exports[`regression tests > shift click on selected element should deselect it o "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -11191,7 +11191,7 @@ History { exports[`regression tests > shift click on selected element should deselect it on pointer up > [end of test] number of elements 1`] = `0`; -exports[`regression tests > shift click on selected element should deselect it on pointer up > [end of test] number of renders 1`] = `8`; +exports[`regression tests > shift click on selected element should deselect it on pointer up > [end of test] number of renders 1`] = `7`; exports[`regression tests > shift-click to multiselect, then drag > [end of test] appState 1`] = ` { @@ -11222,10 +11222,10 @@ exports[`regression tests > shift-click to multiselect, then drag > [end of test "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -11498,7 +11498,7 @@ History { exports[`regression tests > shift-click to multiselect, then drag > [end of test] number of elements 1`] = `0`; -exports[`regression tests > shift-click to multiselect, then drag > [end of test] number of renders 1`] = `15`; +exports[`regression tests > shift-click to multiselect, then drag > [end of test] number of renders 1`] = `13`; exports[`regression tests > should group elements and ungroup them > [end of test] appState 1`] = ` { @@ -11529,10 +11529,10 @@ exports[`regression tests > should group elements and ungroup them > [end of tes "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -11906,7 +11906,7 @@ History { exports[`regression tests > should group elements and ungroup them > [end of test] number of elements 1`] = `0`; -exports[`regression tests > should group elements and ungroup them > [end of test] number of renders 1`] = `21`; +exports[`regression tests > should group elements and ungroup them > [end of test] number of renders 1`] = `18`; exports[`regression tests > single-clicking on a subgroup of a selected group should not alter selection > [end of test] appState 1`] = ` { @@ -11937,10 +11937,10 @@ exports[`regression tests > single-clicking on a subgroup of a selected group sh "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -12515,7 +12515,7 @@ History { exports[`regression tests > single-clicking on a subgroup of a selected group should not alter selection > [end of test] number of elements 1`] = `0`; -exports[`regression tests > single-clicking on a subgroup of a selected group should not alter selection > [end of test] number of renders 1`] = `29`; +exports[`regression tests > single-clicking on a subgroup of a selected group should not alter selection > [end of test] number of renders 1`] = `25`; exports[`regression tests > spacebar + drag scrolls the canvas > [end of test] appState 1`] = ` { @@ -12546,10 +12546,10 @@ exports[`regression tests > spacebar + drag scrolls the canvas > [end of test] a "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -12671,10 +12671,10 @@ exports[`regression tests > supports nested groups > [end of test] appState 1`] "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": "id3", "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -13220,7 +13220,7 @@ History { exports[`regression tests > supports nested groups > [end of test] number of elements 1`] = `0`; -exports[`regression tests > supports nested groups > [end of test] number of renders 1`] = `26`; +exports[`regression tests > supports nested groups > [end of test] number of renders 1`] = `23`; exports[`regression tests > switches from group of selected elements to another element on pointer down > [end of test] appState 1`] = ` { @@ -13251,10 +13251,10 @@ exports[`regression tests > switches from group of selected elements to another "currentItemTextAlign": "left", "cursorButton": "down", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -13330,7 +13330,7 @@ exports[`regression tests > switches from group of selected elements to another "roundness": { "type": 2, }, - "seed": 1723083209, + "seed": 915032327, "strokeColor": "#1e1e1e", "strokeStyle": "solid", "strokeWidth": 2, @@ -13554,7 +13554,7 @@ History { exports[`regression tests > switches from group of selected elements to another element on pointer down > [end of test] number of elements 1`] = `0`; -exports[`regression tests > switches from group of selected elements to another element on pointer down > [end of test] number of renders 1`] = `17`; +exports[`regression tests > switches from group of selected elements to another element on pointer down > [end of test] number of renders 1`] = `14`; exports[`regression tests > switches selected element on pointer down > [end of test] appState 1`] = ` { @@ -13585,10 +13585,10 @@ exports[`regression tests > switches selected element on pointer down > [end of "currentItemTextAlign": "left", "cursorButton": "down", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -13663,7 +13663,7 @@ exports[`regression tests > switches selected element on pointer down > [end of "roundness": { "type": 2, }, - "seed": 1604849351, + "seed": 238820263, "strokeColor": "#1e1e1e", "strokeStyle": "solid", "strokeWidth": 2, @@ -13815,7 +13815,7 @@ History { exports[`regression tests > switches selected element on pointer down > [end of test] number of elements 1`] = `0`; -exports[`regression tests > switches selected element on pointer down > [end of test] number of renders 1`] = `12`; +exports[`regression tests > switches selected element on pointer down > [end of test] number of renders 1`] = `10`; exports[`regression tests > two-finger scroll works > [end of test] appState 1`] = ` { @@ -13846,10 +13846,10 @@ exports[`regression tests > two-finger scroll works > [end of test] appState 1`] "currentItemTextAlign": "left", "cursorButton": "down", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -13968,10 +13968,10 @@ exports[`regression tests > undo/redo drawing an element > [end of test] appStat "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -14312,7 +14312,7 @@ History { exports[`regression tests > undo/redo drawing an element > [end of test] number of elements 1`] = `0`; -exports[`regression tests > undo/redo drawing an element > [end of test] number of renders 1`] = `24`; +exports[`regression tests > undo/redo drawing an element > [end of test] number of renders 1`] = `19`; exports[`regression tests > updates fontSize & fontFamily appState > [end of test] appState 1`] = ` { @@ -14343,10 +14343,10 @@ exports[`regression tests > updates fontSize & fontFamily appState > [end of tes "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, @@ -14465,10 +14465,10 @@ exports[`regression tests > zoom hotkeys > [end of test] appState 1`] = ` "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true, diff --git a/packages/excalidraw/tests/__snapshots__/selection.test.tsx.snap b/packages/excalidraw/tests/__snapshots__/selection.test.tsx.snap index 2eea908425aeb..56375aa50822e 100644 --- a/packages/excalidraw/tests/__snapshots__/selection.test.tsx.snap +++ b/packages/excalidraw/tests/__snapshots__/selection.test.tsx.snap @@ -43,7 +43,7 @@ exports[`select single element on the scene > arrow 1`] = ` "type": "arrow", "updated": 1, "version": 4, - "versionNonce": 2019559783, + "versionNonce": 401146281, "width": 30, "x": 10, "y": 10, @@ -92,7 +92,7 @@ exports[`select single element on the scene > arrow escape 1`] = ` "type": "line", "updated": 1, "version": 4, - "versionNonce": 2019559783, + "versionNonce": 401146281, "width": 30, "x": 10, "y": 10, @@ -126,7 +126,7 @@ exports[`select single element on the scene > diamond 1`] = ` "type": "diamond", "updated": 1, "version": 3, - "versionNonce": 401146281, + "versionNonce": 453191, "width": 30, "x": 10, "y": 10, @@ -160,7 +160,7 @@ exports[`select single element on the scene > ellipse 1`] = ` "type": "ellipse", "updated": 1, "version": 3, - "versionNonce": 401146281, + "versionNonce": 453191, "width": 30, "x": 10, "y": 10, @@ -194,7 +194,7 @@ exports[`select single element on the scene > rectangle 1`] = ` "type": "rectangle", "updated": 1, "version": 3, - "versionNonce": 401146281, + "versionNonce": 453191, "width": 30, "x": 10, "y": 10, diff --git a/packages/excalidraw/tests/dragCreate.test.tsx b/packages/excalidraw/tests/dragCreate.test.tsx index 7d0bcb27757d9..760bf81e5dfe0 100644 --- a/packages/excalidraw/tests/dragCreate.test.tsx +++ b/packages/excalidraw/tests/dragCreate.test.tsx @@ -51,8 +51,8 @@ describe("Test dragCreate", () => { // finish (position does not matter) fireEvent.pointerUp(canvas); - expect(renderInteractiveScene).toHaveBeenCalledTimes(6); - expect(renderStaticScene).toHaveBeenCalledTimes(6); + expect(renderInteractiveScene).toHaveBeenCalledTimes(5); + expect(renderStaticScene).toHaveBeenCalledTimes(5); expect(h.state.selectionElement).toBeNull(); expect(h.elements.length).toEqual(1); @@ -83,8 +83,8 @@ describe("Test dragCreate", () => { // finish (position does not matter) fireEvent.pointerUp(canvas); - expect(renderInteractiveScene).toHaveBeenCalledTimes(6); - expect(renderStaticScene).toHaveBeenCalledTimes(6); + expect(renderInteractiveScene).toHaveBeenCalledTimes(5); + expect(renderStaticScene).toHaveBeenCalledTimes(5); expect(h.state.selectionElement).toBeNull(); @@ -116,8 +116,8 @@ describe("Test dragCreate", () => { // finish (position does not matter) fireEvent.pointerUp(canvas); - expect(renderInteractiveScene).toHaveBeenCalledTimes(6); - expect(renderStaticScene).toHaveBeenCalledTimes(6); + expect(renderInteractiveScene).toHaveBeenCalledTimes(5); + expect(renderStaticScene).toHaveBeenCalledTimes(5); expect(h.state.selectionElement).toBeNull(); expect(h.elements.length).toEqual(1); @@ -148,8 +148,8 @@ describe("Test dragCreate", () => { // finish (position does not matter) fireEvent.pointerUp(canvas); - expect(renderInteractiveScene).toHaveBeenCalledTimes(6); - expect(renderStaticScene).toHaveBeenCalledTimes(6); + expect(renderInteractiveScene).toHaveBeenCalledTimes(5); + expect(renderStaticScene).toHaveBeenCalledTimes(5); expect(h.state.selectionElement).toBeNull(); expect(h.elements.length).toEqual(1); @@ -184,8 +184,8 @@ describe("Test dragCreate", () => { // finish (position does not matter) fireEvent.pointerUp(canvas); - expect(renderInteractiveScene).toHaveBeenCalledTimes(6); - expect(renderStaticScene).toHaveBeenCalledTimes(6); + expect(renderInteractiveScene).toHaveBeenCalledTimes(5); + expect(renderStaticScene).toHaveBeenCalledTimes(5); expect(h.state.selectionElement).toBeNull(); expect(h.elements.length).toEqual(1); @@ -293,7 +293,7 @@ describe("Test dragCreate", () => { }); expect(renderInteractiveScene).toHaveBeenCalledTimes(6); - expect(renderStaticScene).toHaveBeenCalledTimes(6); + expect(renderStaticScene).toHaveBeenCalledTimes(5); expect(h.state.selectionElement).toBeNull(); expect(h.elements.length).toEqual(0); }); @@ -320,7 +320,7 @@ describe("Test dragCreate", () => { }); expect(renderInteractiveScene).toHaveBeenCalledTimes(6); - expect(renderStaticScene).toHaveBeenCalledTimes(6); + expect(renderStaticScene).toHaveBeenCalledTimes(5); expect(h.state.selectionElement).toBeNull(); expect(h.elements.length).toEqual(0); }); diff --git a/packages/excalidraw/tests/elementLocking.test.tsx b/packages/excalidraw/tests/elementLocking.test.tsx index ab096e53e8263..e469ca542c979 100644 --- a/packages/excalidraw/tests/elementLocking.test.tsx +++ b/packages/excalidraw/tests/elementLocking.test.tsx @@ -232,8 +232,8 @@ describe("element locking", () => { API.setElements([container, text]); API.setSelectedElements([container]); Keyboard.keyPress(KEYS.ENTER); - expect(h.state.editingElement?.id).not.toBe(text.id); - expect(h.state.editingElement?.id).toBe(h.elements[1].id); + expect(h.state.editingTextElement?.id).not.toBe(text.id); + expect(h.state.editingTextElement?.id).toBe(h.elements[1].id); }); it("should ignore locked text under cursor when clicked with text tool", () => { @@ -253,9 +253,9 @@ describe("element locking", () => { ".excalidraw-textEditorContainer > textarea", ) as HTMLTextAreaElement; expect(editor).not.toBe(null); - expect(h.state.editingElement?.id).not.toBe(text.id); + expect(h.state.editingTextElement?.id).not.toBe(text.id); expect(h.elements.length).toBe(2); - expect(h.state.editingElement?.id).toBe(h.elements[1].id); + expect(h.state.editingTextElement?.id).toBe(h.elements[1].id); }); it("should ignore text under cursor when double-clicked with selection tool", () => { @@ -275,9 +275,9 @@ describe("element locking", () => { ".excalidraw-textEditorContainer > textarea", ) as HTMLTextAreaElement; expect(editor).not.toBe(null); - expect(h.state.editingElement?.id).not.toBe(text.id); + expect(h.state.editingTextElement?.id).not.toBe(text.id); expect(h.elements.length).toBe(2); - expect(h.state.editingElement?.id).toBe(h.elements[1].id); + expect(h.state.editingTextElement?.id).toBe(h.elements[1].id); }); it("locking should include bound text", () => { @@ -348,9 +348,9 @@ describe("element locking", () => { ".excalidraw-textEditorContainer > textarea", ) as HTMLTextAreaElement; expect(editor).not.toBe(null); - expect(h.state.editingElement?.id).not.toBe(text.id); + expect(h.state.editingTextElement?.id).not.toBe(text.id); expect(h.elements.length).toBe(3); - expect(h.state.editingElement?.id).toBe(h.elements[2].id); + expect(h.state.editingTextElement?.id).toBe(h.elements[2].id); }); it("bound text shouldn't be editable via text tool", () => { @@ -382,8 +382,8 @@ describe("element locking", () => { ".excalidraw-textEditorContainer > textarea", ) as HTMLTextAreaElement; expect(editor).not.toBe(null); - expect(h.state.editingElement?.id).not.toBe(text.id); + expect(h.state.editingTextElement?.id).not.toBe(text.id); expect(h.elements.length).toBe(3); - expect(h.state.editingElement?.id).toBe(h.elements[2].id); + expect(h.state.editingTextElement?.id).toBe(h.elements[2].id); }); }); diff --git a/packages/excalidraw/tests/history.test.tsx b/packages/excalidraw/tests/history.test.tsx index c4c9b20d9c41d..70442a18f271d 100644 --- a/packages/excalidraw/tests/history.test.tsx +++ b/packages/excalidraw/tests/history.test.tsx @@ -757,7 +757,7 @@ describe("history", () => { expect(API.getRedoStack().length).toBe(0); expect(assertSelectedElements(h.elements[0])); expect(h.state.editingLinearElement).toBeNull(); - expect(h.state.selectedLinearElement).toBeNull(); + expect(h.state.selectedLinearElement).not.toBeNull(); expect(h.elements).toEqual([ expect.objectContaining({ isDeleted: false, @@ -965,7 +965,7 @@ describe("history", () => { expect(API.getRedoStack().length).toBe(0); expect(assertSelectedElements(h.elements[0])); expect(h.state.editingLinearElement).toBeNull(); - expect(h.state.selectedLinearElement).toBeNull(); + expect(h.state.selectedLinearElement).not.toBeNull(); expect(h.elements).toEqual([ expect.objectContaining({ isDeleted: false, @@ -2731,7 +2731,7 @@ describe("history", () => { expect(API.getUndoStack().length).toBe(4); expect(API.getRedoStack().length).toBe(0); expect(h.state.editingLinearElement).toBeNull(); - expect(h.state.selectedLinearElement).toBeNull(); + expect(h.state.selectedLinearElement).not.toBeNull(); // Simulate remote update API.updateScene({ @@ -2744,8 +2744,8 @@ describe("history", () => { }); Keyboard.undo(); - expect(API.getUndoStack().length).toBe(0); - expect(API.getRedoStack().length).toBe(4); + expect(API.getUndoStack().length).toBe(1); + expect(API.getRedoStack().length).toBe(3); expect(h.state.editingLinearElement).toBeNull(); expect(h.state.selectedLinearElement).toBeNull(); diff --git a/packages/excalidraw/tests/move.test.tsx b/packages/excalidraw/tests/move.test.tsx index c693c57b37447..9cc3e45075fb5 100644 --- a/packages/excalidraw/tests/move.test.tsx +++ b/packages/excalidraw/tests/move.test.tsx @@ -48,9 +48,9 @@ describe("move element", () => { fireEvent.pointerUp(canvas); expect(renderInteractiveScene.mock.calls.length).toMatchInlineSnapshot( - `6`, + `5`, ); - expect(renderStaticScene.mock.calls.length).toMatchInlineSnapshot(`6`); + expect(renderStaticScene.mock.calls.length).toMatchInlineSnapshot(`5`); expect(h.state.selectionElement).toBeNull(); expect(h.elements.length).toEqual(1); expect(h.state.selectedElementIds[h.elements[0].id]).toBeTruthy(); @@ -96,9 +96,9 @@ describe("move element", () => { new Pointer("mouse").clickOn(rectB); expect(renderInteractiveScene.mock.calls.length).toMatchInlineSnapshot( - `19`, + `17`, ); - expect(renderStaticScene.mock.calls.length).toMatchInlineSnapshot(`16`); + expect(renderStaticScene.mock.calls.length).toMatchInlineSnapshot(`13`); expect(h.state.selectionElement).toBeNull(); expect(h.elements.length).toEqual(3); expect(h.state.selectedElementIds[rectB.id]).toBeTruthy(); @@ -146,9 +146,9 @@ describe("duplicate element on move when ALT is clicked", () => { fireEvent.pointerUp(canvas); expect(renderInteractiveScene.mock.calls.length).toMatchInlineSnapshot( - `6`, + `5`, ); - expect(renderStaticScene.mock.calls.length).toMatchInlineSnapshot(`6`); + expect(renderStaticScene.mock.calls.length).toMatchInlineSnapshot(`5`); expect(h.state.selectionElement).toBeNull(); expect(h.elements.length).toEqual(1); expect(h.state.selectedElementIds[h.elements[0].id]).toBeTruthy(); diff --git a/packages/excalidraw/tests/multiPointCreate.test.tsx b/packages/excalidraw/tests/multiPointCreate.test.tsx index ecbc8344d2453..7435a5084cbe1 100644 --- a/packages/excalidraw/tests/multiPointCreate.test.tsx +++ b/packages/excalidraw/tests/multiPointCreate.test.tsx @@ -115,8 +115,8 @@ describe("multi point mode in linear elements", () => { key: KEYS.ENTER, }); - expect(renderInteractiveScene.mock.calls.length).toMatchInlineSnapshot(`9`); - expect(renderStaticScene.mock.calls.length).toMatchInlineSnapshot(`9`); + expect(renderInteractiveScene.mock.calls.length).toMatchInlineSnapshot(`7`); + expect(renderStaticScene.mock.calls.length).toMatchInlineSnapshot(`6`); expect(h.elements.length).toEqual(1); const element = h.elements[0] as ExcalidrawLinearElement; @@ -158,8 +158,8 @@ describe("multi point mode in linear elements", () => { fireEvent.keyDown(document, { key: KEYS.ENTER, }); - expect(renderInteractiveScene.mock.calls.length).toMatchInlineSnapshot(`9`); - expect(renderStaticScene.mock.calls.length).toMatchInlineSnapshot(`9`); + expect(renderInteractiveScene.mock.calls.length).toMatchInlineSnapshot(`7`); + expect(renderStaticScene.mock.calls.length).toMatchInlineSnapshot(`6`); expect(h.elements.length).toEqual(1); const element = h.elements[0] as ExcalidrawLinearElement; diff --git a/packages/excalidraw/tests/selection.test.tsx b/packages/excalidraw/tests/selection.test.tsx index d47f3037f7391..bffe375bf5d8c 100644 --- a/packages/excalidraw/tests/selection.test.tsx +++ b/packages/excalidraw/tests/selection.test.tsx @@ -314,8 +314,8 @@ describe("select single element on the scene", () => { fireEvent.pointerDown(canvas, { clientX: 45, clientY: 20 }); fireEvent.pointerUp(canvas); - expect(renderInteractiveScene).toHaveBeenCalledTimes(9); - expect(renderStaticScene).toHaveBeenCalledTimes(7); + expect(renderInteractiveScene).toHaveBeenCalledTimes(8); + expect(renderStaticScene).toHaveBeenCalledTimes(6); expect(h.state.selectionElement).toBeNull(); expect(h.elements.length).toEqual(1); expect(h.state.selectedElementIds[h.elements[0].id]).toBeTruthy(); @@ -346,8 +346,8 @@ describe("select single element on the scene", () => { fireEvent.pointerDown(canvas, { clientX: 45, clientY: 20 }); fireEvent.pointerUp(canvas); - expect(renderInteractiveScene).toHaveBeenCalledTimes(9); - expect(renderStaticScene).toHaveBeenCalledTimes(7); + expect(renderInteractiveScene).toHaveBeenCalledTimes(8); + expect(renderStaticScene).toHaveBeenCalledTimes(6); expect(h.state.selectionElement).toBeNull(); expect(h.elements.length).toEqual(1); expect(h.state.selectedElementIds[h.elements[0].id]).toBeTruthy(); @@ -378,8 +378,8 @@ describe("select single element on the scene", () => { fireEvent.pointerDown(canvas, { clientX: 45, clientY: 20 }); fireEvent.pointerUp(canvas); - expect(renderInteractiveScene).toHaveBeenCalledTimes(9); - expect(renderStaticScene).toHaveBeenCalledTimes(7); + expect(renderInteractiveScene).toHaveBeenCalledTimes(8); + expect(renderStaticScene).toHaveBeenCalledTimes(6); expect(h.state.selectionElement).toBeNull(); expect(h.elements.length).toEqual(1); expect(h.state.selectedElementIds[h.elements[0].id]).toBeTruthy(); @@ -423,8 +423,8 @@ describe("select single element on the scene", () => { fireEvent.pointerDown(canvas, { clientX: 40, clientY: 40 }); fireEvent.pointerUp(canvas); - expect(renderInteractiveScene).toHaveBeenCalledTimes(9); - expect(renderStaticScene).toHaveBeenCalledTimes(7); + expect(renderInteractiveScene).toHaveBeenCalledTimes(8); + expect(renderStaticScene).toHaveBeenCalledTimes(6); expect(h.state.selectionElement).toBeNull(); expect(h.elements.length).toEqual(1); expect(h.state.selectedElementIds[h.elements[0].id]).toBeTruthy(); @@ -467,8 +467,8 @@ describe("select single element on the scene", () => { fireEvent.pointerDown(canvas, { clientX: 40, clientY: 40 }); fireEvent.pointerUp(canvas); - expect(renderInteractiveScene).toHaveBeenCalledTimes(9); - expect(renderStaticScene).toHaveBeenCalledTimes(7); + expect(renderInteractiveScene).toHaveBeenCalledTimes(8); + expect(renderStaticScene).toHaveBeenCalledTimes(6); expect(h.state.selectionElement).toBeNull(); expect(h.elements.length).toEqual(1); expect(h.state.selectedElementIds[h.elements[0].id]).toBeTruthy(); diff --git a/packages/excalidraw/types.ts b/packages/excalidraw/types.ts index cd07d0cfc26e3..10466c97be05a 100644 --- a/packages/excalidraw/types.ts +++ b/packages/excalidraw/types.ts @@ -198,7 +198,7 @@ export type InteractiveCanvasAppState = Readonly< // SnapLines snapLines: AppState["snapLines"]; zenModeEnabled: AppState["zenModeEnabled"]; - editingElement: AppState["editingElement"]; + editingTextElement: AppState["editingTextElement"]; } >; @@ -266,13 +266,9 @@ export interface AppState { editingFrame: string | null; elementsToHighlight: NonDeleted[] | null; /** - * currently set for: - * - text elements while in wysiwyg - * - newly created linear elements while in line editor (not set for existing - * elements in line editor) - * - and new images while being placed on canvas + * set when a new text is created or when an existing text is being edited */ - editingElement: NonDeletedExcalidrawElement | null; + editingTextElement: NonDeletedExcalidrawElement | null; editingLinearElement: LinearElementEditor | null; activeTool: { /** diff --git a/packages/utils/__snapshots__/export.test.ts.snap b/packages/utils/__snapshots__/export.test.ts.snap index 2c98135d8010b..cf2b7f2338eb7 100644 --- a/packages/utils/__snapshots__/export.test.ts.snap +++ b/packages/utils/__snapshots__/export.test.ts.snap @@ -29,10 +29,10 @@ exports[`exportToSvg > with default arguments 1`] = ` "currentItemTextAlign": "left", "cursorButton": "up", "defaultSidebarDockedPreference": false, - "editingElement": null, "editingFrame": null, "editingGroupId": null, "editingLinearElement": null, + "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, "exportBackground": true,