feat: support renderTopRightUI in mobile (#4065)
This commit is contained in:
parent
ff29780760
commit
c6ffc06541
@ -65,7 +65,10 @@ interface LayerUIProps {
|
|||||||
toggleZenMode: () => void;
|
toggleZenMode: () => void;
|
||||||
langCode: Language["code"];
|
langCode: Language["code"];
|
||||||
isCollaborating: boolean;
|
isCollaborating: boolean;
|
||||||
renderTopRightUI?: (isMobile: boolean, appState: AppState) => JSX.Element;
|
renderTopRightUI?: (
|
||||||
|
isMobile: boolean,
|
||||||
|
appState: AppState,
|
||||||
|
) => JSX.Element | null;
|
||||||
renderCustomFooter?: (isMobile: boolean, appState: AppState) => JSX.Element;
|
renderCustomFooter?: (isMobile: boolean, appState: AppState) => JSX.Element;
|
||||||
viewModeEnabled: boolean;
|
viewModeEnabled: boolean;
|
||||||
libraryReturnUrl: ExcalidrawProps["libraryReturnUrl"];
|
libraryReturnUrl: ExcalidrawProps["libraryReturnUrl"];
|
||||||
@ -761,6 +764,7 @@ const LayerUI = ({
|
|||||||
renderCustomFooter={renderCustomFooter}
|
renderCustomFooter={renderCustomFooter}
|
||||||
viewModeEnabled={viewModeEnabled}
|
viewModeEnabled={viewModeEnabled}
|
||||||
showThemeBtn={showThemeBtn}
|
showThemeBtn={showThemeBtn}
|
||||||
|
renderTopRightUI={renderTopRightUI}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
|
@ -33,6 +33,10 @@ type MobileMenuProps = {
|
|||||||
renderCustomFooter?: (isMobile: boolean, appState: AppState) => JSX.Element;
|
renderCustomFooter?: (isMobile: boolean, appState: AppState) => JSX.Element;
|
||||||
viewModeEnabled: boolean;
|
viewModeEnabled: boolean;
|
||||||
showThemeBtn: boolean;
|
showThemeBtn: boolean;
|
||||||
|
renderTopRightUI?: (
|
||||||
|
isMobile: boolean,
|
||||||
|
appState: AppState,
|
||||||
|
) => JSX.Element | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const MobileMenu = ({
|
export const MobileMenu = ({
|
||||||
@ -50,6 +54,7 @@ export const MobileMenu = ({
|
|||||||
renderCustomFooter,
|
renderCustomFooter,
|
||||||
viewModeEnabled,
|
viewModeEnabled,
|
||||||
showThemeBtn,
|
showThemeBtn,
|
||||||
|
renderTopRightUI,
|
||||||
}: MobileMenuProps) => {
|
}: MobileMenuProps) => {
|
||||||
const renderToolbar = () => {
|
const renderToolbar = () => {
|
||||||
return (
|
return (
|
||||||
@ -68,6 +73,7 @@ export const MobileMenu = ({
|
|||||||
/>
|
/>
|
||||||
</Stack.Row>
|
</Stack.Row>
|
||||||
</Island>
|
</Island>
|
||||||
|
{renderTopRightUI && renderTopRightUI(true, appState)}
|
||||||
<LockButton
|
<LockButton
|
||||||
checked={appState.elementLocked}
|
checked={appState.elementLocked}
|
||||||
onChange={onLockToggle}
|
onChange={onLockToggle}
|
||||||
|
@ -307,6 +307,9 @@ const ExcalidrawWrapper = () => {
|
|||||||
|
|
||||||
const renderTopRightUI = useCallback(
|
const renderTopRightUI = useCallback(
|
||||||
(isMobile: boolean, appState: AppState) => {
|
(isMobile: boolean, appState: AppState) => {
|
||||||
|
if (isMobile) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
|
@ -17,7 +17,9 @@ Please add the latest change on the top under the correct section.
|
|||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
- Export `THEME` constant from the package so host can use this when passing the theme
|
- Support [`renderTopRightUI`](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#renderTopRightUI) in mobile UI.
|
||||||
|
|
||||||
|
- Export `THEME` constant from the package so host can use this when passing the theme.
|
||||||
|
|
||||||
#### BREAKING CHANGE
|
#### BREAKING CHANGE
|
||||||
|
|
||||||
|
@ -186,7 +186,10 @@ export interface ExcalidrawProps {
|
|||||||
data: ClipboardData,
|
data: ClipboardData,
|
||||||
event: ClipboardEvent | null,
|
event: ClipboardEvent | null,
|
||||||
) => Promise<boolean> | boolean;
|
) => Promise<boolean> | boolean;
|
||||||
renderTopRightUI?: (isMobile: boolean, appState: AppState) => JSX.Element;
|
renderTopRightUI?: (
|
||||||
|
isMobile: boolean,
|
||||||
|
appState: AppState,
|
||||||
|
) => JSX.Element | null;
|
||||||
renderFooter?: (isMobile: boolean, appState: AppState) => JSX.Element;
|
renderFooter?: (isMobile: boolean, appState: AppState) => JSX.Element;
|
||||||
langCode?: Language["code"];
|
langCode?: Language["code"];
|
||||||
viewModeEnabled?: boolean;
|
viewModeEnabled?: boolean;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user