Virtual whiteboard for sketching hand-drawn like diagrams
feat: remove automatic frame naming (#8302)
David Luzare844580b1420
diff --git a/packages/excalidraw/components/App.tsx b/packages/excalidraw/components/App.tsxindex f198d3016a..f54ae3ac4c 100644--- a/packages/excalidraw/components/App.tsx+++ b/packages/excalidraw/components/App.tsx@@ -156,7 +156,6 @@ import {isLinearElement,isLinearElementType,isUsingAdaptiveRadius,- isFrameElement,isIframeElement,isIframeLikeElement,isMagicFrameElement,@@ -1288,15 +1287,7 @@ class App extends React.Component<AppProps, AppState> {const isDarkTheme = this.state.theme === THEME.DARK;- let frameIndex = 0;- let magicFrameIndex = 0;-return this.scene.getNonDeletedFramesLikes().map((f) => {- if (isFrameElement(f)) {- frameIndex++;- } else {- magicFrameIndex++;- }if (!isElementInViewport(f,@@ -1330,10 +1321,7 @@ class App extends React.Component<AppProps, AppState> {let frameNameJSX;- const frameName = getFrameLikeTitle(- f,- isFrameElement(f) ? frameIndex : magicFrameIndex,- );+ const frameName = getFrameLikeTitle(f);if (f.id === this.state.editingFrame) {const frameNameInEdit = frameName;diff --git a/packages/excalidraw/frame.ts b/packages/excalidraw/frame.tsindex f02ac521d4..469a360eab 100644--- a/packages/excalidraw/frame.ts+++ b/packages/excalidraw/frame.ts@@ -755,15 +755,12 @@ export const isElementInFrame = (return false;};-export const getFrameLikeTitle = (- element: ExcalidrawFrameLikeElement,- frameIdx: number,-) => {+export const getFrameLikeTitle = (element: ExcalidrawFrameLikeElement) => {// TODO name frames "AI" only if specific to AI framesreturn element.name === null? isFrameElement(element)- ? `Frame ${frameIdx}`- : `AI Frame $${frameIdx}`+ ? "Frame"+ : "AI Frame": element.name;};diff --git a/packages/excalidraw/scene/export.ts b/packages/excalidraw/scene/export.tsindex 4167c71f94..1f693e6449 100644--- a/packages/excalidraw/scene/export.ts+++ b/packages/excalidraw/scene/export.ts@@ -34,11 +34,7 @@ import {import { newTextElement } from "../element";import { type Mutable } from "../utility-types";import { newElementWith } from "../element/mutateElement";-import {- isFrameElement,- isFrameLikeElement,- isTextElement,-} from "../element/typeChecks";+import { isFrameLikeElement, isTextElement } from "../element/typeChecks";import type { RenderableElementsMap } from "./types";import { syncInvalidIndices } from "../fractionalIndex";import { renderStaticScene } from "../renderer/staticScene";@@ -88,15 +84,8 @@ const addFrameLabelsAsTextElements = (opts: Pick<AppState, "exportWithDarkMode">,) => {const nextElements: NonDeletedExcalidrawElement[] = [];- let frameIndex = 0;- let magicFrameIndex = 0;for (const element of elements) {if (isFrameLikeElement(element)) {- if (isFrameElement(element)) {- frameIndex++;- } else {- magicFrameIndex++;- }let textElement: Mutable<ExcalidrawTextElement> = newTextElement({x: element.x,y: element.y - FRAME_STYLE.nameOffsetY,@@ -107,10 +96,7 @@ const addFrameLabelsAsTextElements = (strokeColor: opts.exportWithDarkMode? FRAME_STYLE.nameColorDarkTheme: FRAME_STYLE.nameColorLightTheme,- text: getFrameLikeTitle(- element,- isFrameElement(element) ? frameIndex : magicFrameIndex,- ),+ text: getFrameLikeTitle(element),});textElement.y -= textElement.height;