From 4c39abf07fbd31a74dae07be3c5c639bced7053a Mon Sep 17 00:00:00 2001 From: zsviczian Date: Fri, 4 Nov 2022 19:57:22 +0100 Subject: [PATCH] languageList moved out of canvasActions and renamed to showLanguageList --- src/components/LayerUI.tsx | 2 +- src/constants.ts | 1 - src/packages/excalidraw/README.md | 7 +++++-- src/types.ts | 3 ++- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/components/LayerUI.tsx b/src/components/LayerUI.tsx index 8544bfe061..cf47f7338f 100644 --- a/src/components/LayerUI.tsx +++ b/src/components/LayerUI.tsx @@ -262,7 +262,7 @@ const LayerUI = ({ }} >
{actionManager.renderAction("toggleTheme")}
- {UIOptions.canvasActions.languageList !== false && ( + {UIOptions.showLanguageList !== false && (
diff --git a/src/constants.ts b/src/constants.ts index ca24012e87..dab82771fd 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -155,7 +155,6 @@ export const DEFAULT_UI_OPTIONS: AppProps["UIOptions"] = { saveToActiveFile: true, toggleTheme: null, saveAsImage: true, - languageList: true, }, }; diff --git a/src/packages/excalidraw/README.md b/src/packages/excalidraw/README.md index e1d04618df..435900ffa7 100644 --- a/src/packages/excalidraw/README.md +++ b/src/packages/excalidraw/README.md @@ -703,7 +703,7 @@ This prop sets the name of the drawing which will be used when exporting the dra #### `UIOptions` -This prop can be used to customise UI of Excalidraw. Currently we support customising [`canvasActions`](#canvasActions) and [`dockedSidebarBreakpoint`](dockedSidebarBreakpoint). It accepts the below parameters +This prop can be used to customise UI of Excalidraw. Currently we support customising [`canvasActions`](#canvasActions), [`dockedSidebarBreakpoint`](dockedSidebarBreakpoint), and ['showLanguageList`](showLanguageList). It accepts the below parameters
 { canvasActions:  CanvasActions }
@@ -720,7 +720,6 @@ This prop can be used to customise UI of Excalidraw. Currently we support custom
 | `saveToActiveFile` | boolean | true | Implies whether to show `Save button` to save to current file |
 | `toggleTheme` | boolean | null | null | Implies whether to show `Theme toggle`. When defined as `boolean`, takes precedence over [`props.theme`](#theme) to show `Theme toggle` |
 | `saveAsImage` | boolean | true | Implies whether to show `Save as image button` |
-| `languageList` | boolean | true | Implies whether to show the `Language Selector Dropdown list` |
 
 ##### `dockedSidebarBreakpoint`
 
@@ -728,6 +727,10 @@ This prop indicates at what point should we break to a docked, permanent sidebar
 
 ![image](https://user-images.githubusercontent.com/11256141/174664866-c698c3fa-197b-43ff-956c-d79852c7b326.png)
 
+### `showLanguageList`
+
+Boolean prop. If set to `true` the `language selector dropdown list` will be hidden in the app menu. If `false` or `undefined` the language dropdown will be rendered.
+
 #### `exportOpts`
 
 The below attributes can be set in `UIOptions.canvasActions.export` to customize the export dialog. If `UIOptions.canvasActions.export` is `false` the export button will not be rendered.
diff --git a/src/types.ts b/src/types.ts
index cbab0f0b46..ef90390771 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -303,6 +303,7 @@ export interface ExcalidrawProps {
   UIOptions?: {
     dockedSidebarBreakpoint?: number;
     canvasActions?: CanvasActions;
+    showLanguageList?: boolean;
   };
   detectScroll?: boolean;
   handleKeyboardGlobally?: boolean;
@@ -367,7 +368,6 @@ type CanvasActions = {
   saveToActiveFile?: boolean;
   toggleTheme?: boolean | null;
   saveAsImage?: boolean;
-  languageList?: boolean;
 };
 
 export type AppProps = Merge<
@@ -376,6 +376,7 @@ export type AppProps = Merge<
     UIOptions: {
       canvasActions: Required & { export: ExportOpts };
       dockedSidebarBreakpoint?: number;
+      showLanguageList?: boolean;
     };
     detectScroll: boolean;
     handleKeyboardGlobally: boolean;