feat: Allow host app to update title of drawing (#3273)
* Allow updating name on updateScene * Revert "Allow updating name on updateScene" This reverts commit 4e07a608d38a585e0f3c04e26b9f5e0e404824b1. * Make requested changes * Make requested changes * Remove customName from state * Remove redundant if statement * Add tests, update changelog and minor fixes * remove eempty lines * minor fixes * no border and on hover no background change * Give preference to name prop when initialData.appState.name is present and update specs * minor fix * Fix name input style in dark mode Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com>
This commit is contained in:
@ -18,11 +18,12 @@ export const actionChangeProjectName = register({
|
||||
trackEvent("change", "title");
|
||||
return { appState: { ...appState, name: value }, commitToHistory: false };
|
||||
},
|
||||
PanelComponent: ({ appState, updateData }) => (
|
||||
PanelComponent: ({ appState, updateData, appProps }) => (
|
||||
<ProjectName
|
||||
label={t("labels.fileTitle")}
|
||||
value={appState.name || "Unnamed"}
|
||||
onChange={(name: string) => updateData(name)}
|
||||
isNameEditable={typeof appProps.name === "undefined"}
|
||||
/>
|
||||
),
|
||||
});
|
||||
|
@ -122,6 +122,7 @@ export class ActionManager implements ActionsManagerInterface {
|
||||
appState={this.getAppState()}
|
||||
updateData={updateData}
|
||||
id={id}
|
||||
appProps={this.app.props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React from "react";
|
||||
import { ExcalidrawElement } from "../element/types";
|
||||
import { AppState } from "../types";
|
||||
import { AppState, ExcalidrawProps } from "../types";
|
||||
|
||||
/** if false, the action should be prevented */
|
||||
export type ActionResult =
|
||||
@ -94,6 +94,7 @@ export interface Action {
|
||||
elements: readonly ExcalidrawElement[];
|
||||
appState: AppState;
|
||||
updateData: (formData?: any) => void;
|
||||
appProps: ExcalidrawProps;
|
||||
id?: string;
|
||||
}>;
|
||||
perform: ActionFn;
|
||||
|
Reference in New Issue
Block a user