Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: open EML attachments in a new tab #310

Merged
merged 28 commits into from
Feb 28, 2023
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
4ec33d5
chore: first draft
gnekoz Jan 23, 2023
3767f6d
chore: restored original API call and enabled download of files
gnekoz Jan 23, 2023
2cfba0a
chore: new window wrapper
gnekoz Jan 24, 2023
f267433
chore: progress save
gnekoz Feb 1, 2023
e7efbc3
chore: progress save
gnekoz Feb 2, 2023
ea4cb55
Merge remote-tracking branch 'origin' into PROTOTYPE-new-window
gnekoz Feb 2, 2023
1dadc6f
fix: enable the invocation of onBlock callback
gnekoz Feb 3, 2023
dd96529
chore: updated package-lock
gnekoz Feb 3, 2023
2e08ceb
chore: remove unused import
gnekoz Feb 3, 2023
85b0d6e
fix: fix the syncronization of the windows list state
gnekoz Feb 3, 2023
e8ca7e6
fix: fix the syncronization of the windows list state
gnekoz Feb 3, 2023
aa7b235
feat: the alert message about a blocked window is shown on the curren…
gnekoz Feb 8, 2023
e1f2332
refactor: code splitting
gnekoz Feb 9, 2023
2fd7c7c
refactor: code splitting
gnekoz Feb 9, 2023
ad0d672
feat: popup blocked opening message
gnekoz Feb 14, 2023
daf3c8e
refactor: add dynamic styles synchronization between parent's and new…
gnekoz Feb 14, 2023
8f693f9
refactor: disable Files attachment's upload from new windows
gnekoz Feb 14, 2023
f887e8d
Merge remote-tracking branch 'origin' into PROTOTYPE-new-window
gnekoz Feb 14, 2023
b62eaf9
chore: progress save
gnekoz Feb 20, 2023
e84314e
chore: added an observer for child window's dom additions
gnekoz Feb 23, 2023
1075217
chore: added mail preview disclaimer
gnekoz Feb 24, 2023
cc71c0d
Merge remote-tracking branch 'origin' into PROTOTYPE-new-window
gnekoz Feb 24, 2023
6e3e697
chore: progress save
gnekoz Feb 27, 2023
4668886
chore: component's alignment and padding fixed
gnekoz Feb 27, 2023
ae8d253
Merge remote-tracking branch 'origin' into PROTOTYPE-new-window
gnekoz Feb 27, 2023
b40c628
chore: fixed wrong translation texts, added comments and removed usel…
gnekoz Feb 27, 2023
8082d4f
chore: dependencies updated
gnekoz Feb 28, 2023
59a68d9
chore: merge from devel
gnekoz Feb 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { MAILS_ROUTE, MAIL_APP_ID } from './constants';
import { getSettingsSubSections } from './views/settings/subsections';
import { StoreProvider } from './store/redux';
import { ParticipantRole } from './carbonio-ui-commons/constants/participants';
import { ExtraWindowsManager } from './views/app/extra-windows/extra-window-manager';

const LazyAppView = lazy(() =>
import(/* webpackChunkName: "mails-folder-panel-view" */ './views/app-view')
Expand All @@ -49,7 +50,9 @@ const LazySidebarView = lazy(() =>
const AppView = () => (
<Suspense fallback={<Spinner />}>
<StoreProvider>
<LazyAppView />
<ExtraWindowsManager>
<LazyAppView />
</ExtraWindowsManager>
</StoreProvider>
</Suspense>
);
Expand Down
2 changes: 1 addition & 1 deletion src/carbonio-ui-commons
2 changes: 1 addition & 1 deletion src/commons/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import moment from 'moment';
import { find, isArray } from 'lodash';
import { Account, t } from '@zextras/carbonio-shell-ui';
import { Participant } from '../types/participant';
import { Participant } from '../types';

export const getTimeLabel = (date: number): string => {
const momentDate = moment(date);
Expand Down
10 changes: 10 additions & 0 deletions src/types/details-pannel/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/

import { MailMessage } from '../messages';

type OpenEmlPreviewType = (
parentMessageId: string,
attachmentName: string,
emlMessage: MailMessage
) => void;

export type MailEditHeaderType = {
folderId: string | number;
header: string | undefined;
Expand All @@ -20,9 +28,11 @@ export type AttachmentType = {
link: string;
downloadlink: string;
message: MailMessage;
isExternalMessage?: boolean;
part: string;
iconColors: IconColors;
att: EditorAttachmentFiles;
openEmlPreview?: OpenEmlPreviewType;
};

export type PreviewPanelActionsType = {
Expand Down
111 changes: 111 additions & 0 deletions src/types/extra-windows/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
/*
* SPDX-FileCopyrightText: 2023 Zextras <https://www.zextras.com>
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import React from 'react';

/**
* Descriptor of the new window/tab characteristics.
* @see Window.open
*/
export type ExtraWindowFeatures = {
popup?: boolean;
width?: number;
height?: number;
left?: number;
top?: number;
noopener?: boolean;
noreferrer?: boolean;
};

export type EventHandler = () => void;

export type OpenEventHandler = (window: Window) => void;

export type ExtraWindowCreationParams = {
/**
* Children to render in the new window.
*/
children?: React.ReactNode;

/**
* If set to true, the extra window component will be returned
* instead of being rendered in a generic container
*/
returnComponent: boolean;

/**
* The URL to open, if specified any children will be overridden.
*/
url?: string;

/**
* The name of the window.
*/
name?: string;

/**
* The title of the new window document.
*/
title?: string;

/**
* The set of window features.
*/
features?: ExtraWindowFeatures;

/**
* A function to be triggered before the new window unload.
*/
onBlock?: EventHandler | null;

/**
* A function to be triggered when the new window could not be opened.
*/
onUnload?: EventHandler | null;

/**
* A function to be triggered when the new window opened.
*/
onOpen?: OpenEventHandler | null;

/**
* Indicate how to center the new window.
*/
center?: 'parent' | 'screen';

/**
* If specified, copy styles from parent window's document.
*/
copyStyles?: boolean;

/**
* If specified, close the window when the component is unmounted
*/
closeOnUnmount: boolean;
};

export type ExtraWindowProps = ExtraWindowCreationParams & { id: string };

export type ExtraWindowContextType = {
windowId: string | undefined;
};

export type ExtraWindowsContextType = {
createWindow?: (props: ExtraWindowCreationParams) => ExtraWindowsCreationResult;
closeWindow?: (windowId: string) => void;
listWindows?: () => Array<ExtraWindowsCreationResult>;
getWindow?: (criteria: {
windowId?: string;
windowName?: string;
}) => ExtraWindowsCreationResult | undefined;
getFocusedWindow?: () => ExtraWindowsCreationResult | undefined;
};

export type ExtraWindowsCreationResult = {
id: string;
windowProps?: ExtraWindowProps;
window?: Window;
component?: React.ReactElement;
};
3 changes: 2 additions & 1 deletion src/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/*
* SPDX-FileCopyrightText: 2021 Zextras <https://www.zextras.com>
* SPDX-FileCopyrightText: 2023 Zextras <https://www.zextras.com>
*
* SPDX-License-Identifier: AGPL-3.0-only
*/

export * from './actions';
export * from './conversations';
export * from './editor';
export * from './extra-windows';
export * from './filters';
export * from './folder';
export * from './messages';
Expand Down
1 change: 1 addition & 0 deletions src/types/soap/get-msg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { ZimbraRequest } from './zimbra-request';
export type GetMsgRequest = ZimbraRequest & {
m: {
id: string;
part?: string;
html: 0 | 1;
needExp: 0 | 1;
};
Expand Down
3 changes: 1 addition & 2 deletions src/ui-actions/message-actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,7 @@ export function printMsg({
}
})
.catch(() => {
const errorContent = errorPage;
if (printWindow) printWindow.document.write(errorContent);
if (printWindow) printWindow.document.write(errorPage);
});
}
};
Expand Down
2 changes: 2 additions & 0 deletions src/views/app/detail-panel/edit/edit-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,8 @@ const EditView: FC<EditViewPropType> = ({ setHeader }) => {
[action, editor?.attach?.mp?.length, editor?.original]
);

// const showAttachments = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this sneaky comment made it to the pr :)


const context: EditViewContextType = useMemo(
() => ({
editor,
Expand Down
Loading