refactor: rename UIOptions.canvasActions.saveScene to UIOptions.canvasActions.saveToActiveFile (#3657)
* refactor rename action saveScene to saveFileToDisk * docs * fix * fix
This commit is contained in:
parent
99a22e8445
commit
bc0b6e1888
@ -71,8 +71,8 @@ export const actionChangeExportEmbedScene = register({
|
|||||||
),
|
),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const actionSaveScene = register({
|
export const actionSaveToActiveFile = register({
|
||||||
name: "saveScene",
|
name: "saveToActiveFile",
|
||||||
perform: async (elements, appState, value) => {
|
perform: async (elements, appState, value) => {
|
||||||
const fileHandleExists = !!appState.fileHandle;
|
const fileHandleExists = !!appState.fileHandle;
|
||||||
try {
|
try {
|
||||||
|
@ -34,7 +34,7 @@ export { actionFinalize } from "./actionFinalize";
|
|||||||
export {
|
export {
|
||||||
actionChangeProjectName,
|
actionChangeProjectName,
|
||||||
actionChangeExportBackground,
|
actionChangeExportBackground,
|
||||||
actionSaveScene,
|
actionSaveToActiveFile,
|
||||||
actionSaveAsScene,
|
actionSaveAsScene,
|
||||||
actionLoadScene,
|
actionLoadScene,
|
||||||
} from "./actionExport";
|
} from "./actionExport";
|
||||||
|
@ -66,7 +66,7 @@ export type ActionName =
|
|||||||
| "changeProjectName"
|
| "changeProjectName"
|
||||||
| "changeExportBackground"
|
| "changeExportBackground"
|
||||||
| "changeExportEmbedScene"
|
| "changeExportEmbedScene"
|
||||||
| "saveScene"
|
| "saveToActiveFile"
|
||||||
| "saveAsScene"
|
| "saveAsScene"
|
||||||
| "loadScene"
|
| "loadScene"
|
||||||
| "duplicateSelection"
|
| "duplicateSelection"
|
||||||
|
@ -18,7 +18,7 @@ export const BackgroundPickerAndDarkModeToggle = ({
|
|||||||
{showThemeBtn && actionManager.renderAction("toggleTheme")}
|
{showThemeBtn && actionManager.renderAction("toggleTheme")}
|
||||||
{appState.fileHandle && (
|
{appState.fileHandle && (
|
||||||
<div style={{ marginInlineStart: "0.25rem" }}>
|
<div style={{ marginInlineStart: "0.25rem" }}>
|
||||||
{actionManager.renderAction("saveScene")}
|
{actionManager.renderAction("saveToActiveFile")}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
@ -134,7 +134,7 @@ export const DEFAULT_UI_OPTIONS: AppProps["UIOptions"] = {
|
|||||||
export: true,
|
export: true,
|
||||||
loadScene: true,
|
loadScene: true,
|
||||||
saveAsScene: true,
|
saveAsScene: true,
|
||||||
saveScene: true,
|
saveToActiveFile: true,
|
||||||
theme: true,
|
theme: true,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -17,10 +17,10 @@ Please add the latest change on the top under the correct section.
|
|||||||
|
|
||||||
### Refactor
|
### Refactor
|
||||||
|
|
||||||
#### BREAKING CHANGE
|
- #### BREAKING CHANGE
|
||||||
|
- Rename `UIOptions.canvasActions.saveScene` to `UIOptions.canvasActions.saveToActiveFile`[#3657](https://github.com/excalidraw/excalidraw/pull/3657).
|
||||||
- Removed `shouldAddWatermark: boolean` attribute from options for [export](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#export-utilities) APIs [#3639](https://github.com/excalidraw/excalidraw/pull/3639).
|
- Removed `shouldAddWatermark: boolean` attribute from options for [export](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#export-utilities) APIs [#3639](https://github.com/excalidraw/excalidraw/pull/3639).
|
||||||
- Removed `appState.shouldAddWatermark` so in case you were passing `shouldAddWatermark` in [initialData.AppState](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L42) it will not work anymore.
|
- Removed `appState.shouldAddWatermark` so in case you were passing `shouldAddWatermark` in [initialData.AppState](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L42) it will not work anymore.
|
||||||
|
|
||||||
## 0.8.0 (2021-05-15)
|
## 0.8.0 (2021-05-15)
|
||||||
|
|
||||||
|
@ -574,7 +574,7 @@ This prop can be used to customise UI of Excalidraw. Currently we support custom
|
|||||||
| `export` | boolean | true | Implies whether to show `Export button` |
|
| `export` | boolean | true | Implies whether to show `Export button` |
|
||||||
| `loadScene` | boolean | true | Implies whether to show `Load button` |
|
| `loadScene` | boolean | true | Implies whether to show `Load button` |
|
||||||
| `saveAsScene` | boolean | true | Implies whether to show `Save as button` |
|
| `saveAsScene` | boolean | true | Implies whether to show `Save as button` |
|
||||||
| `saveScene` | boolean | true | Implies whether to show `Save button` |
|
| `saveToActiveFile` | boolean | true | Implies whether to show `Save button` to save to current file |
|
||||||
| `theme` | boolean | true | Implies whether to show `Theme toggle` |
|
| `theme` | boolean | true | Implies whether to show `Theme toggle` |
|
||||||
|
|
||||||
#### `onPaste`
|
#### `onPaste`
|
||||||
|
@ -186,9 +186,11 @@ describe("<Excalidraw/>", () => {
|
|||||||
expect(queryByTestId(container, "save-as-button")).toBeNull();
|
expect(queryByTestId(container, "save-as-button")).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should hide save button when saveScene is false", async () => {
|
it("should hide save button when saveToActiveFile is false", async () => {
|
||||||
const { container } = await render(
|
const { container } = await render(
|
||||||
<Excalidraw UIOptions={{ canvasActions: { saveScene: false } }} />,
|
<Excalidraw
|
||||||
|
UIOptions={{ canvasActions: { saveToActiveFile: false } }}
|
||||||
|
/>,
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(queryByTestId(container, "save-button")).toBeNull();
|
expect(queryByTestId(container, "save-button")).toBeNull();
|
||||||
|
@ -219,7 +219,7 @@ type CanvasActions = {
|
|||||||
export?: boolean;
|
export?: boolean;
|
||||||
loadScene?: boolean;
|
loadScene?: boolean;
|
||||||
saveAsScene?: boolean;
|
saveAsScene?: boolean;
|
||||||
saveScene?: boolean;
|
saveToActiveFile?: boolean;
|
||||||
theme?: boolean;
|
theme?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user