fix upload file for typescript issues

This commit is contained in:
vaidankarswapnil
2021-09-07 12:43:27 +05:30
parent 5cb8fc31f9
commit 4009a00979
4 changed files with 29654 additions and 29 deletions

29654
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -23,7 +23,7 @@ export const Upload: FunctionComponent<UploadProps> = ({
}: UploadProps) => {
const [selectedFilesTitle, setSelectedFilesTitle] = useState<string[]>([]);
const fileRef = useRef<HTMLInputElement>();
const fileRef = useRef<HTMLInputElement>() as React.MutableRefObject<HTMLInputElement>;
const onImportLinkKeyPress = (event: KeyboardEvent<HTMLAnchorElement>): void => {
if (event.keyCode === Constants.KeyCodes.Enter || event.keyCode === Constants.KeyCodes.Space) {
@@ -39,12 +39,14 @@ export const Upload: FunctionComponent<UploadProps> = ({
const { files } = event.target;
const newFileList = [];
for (let i = 0; i < files.length; i++) {
newFileList.push(files.item(i).name);
}
if (newFileList) {
setSelectedFilesTitle(newFileList);
props.onUpload(event);
if (files) {
for (let i = 0; i < files.length; i++) {
newFileList.push(files[i].name);
}
if (newFileList) {
setSelectedFilesTitle(newFileList);
props.onUpload(event);
}
}
};
const title = label + " to upload";

View File

@@ -220,13 +220,15 @@ const makeMapStateToProps = (_: AppState, ownProps: ComponentProps): ((state: Ap
const model = selectors.model(state, { contentRef: ownProps.contentRef });
const cellOrder = selectors.notebook.cellOrder(model as RecordOf<DocumentRecordProps>);
const cellIndex = cellOrder.indexOf(ownProps.id);
const cellIdAbove = cellIndex ? cellOrder.get(cellIndex - 1, undefined) : undefined;
const cellIdBelow = cellIndex !== undefined ? cellOrder.get(cellIndex + 1, undefined) : undefined;
const cellIdAbove = cellIndex ? cellOrder.get(cellIndex - 1, "") : "";
const cellIdBelow = cellIndex !== undefined ? cellOrder.get(cellIndex + 1, "") : "";
return {
cellType,
cellIdAbove: cellIdAbove ? cellIdAbove : "",
cellIdBelow: cellIdBelow ? cellIdBelow : "",
cellIdAbove,
cellIdBelow,
// cellIdAbove: cellIdAbove ? cellIdAbove : "",
// cellIdBelow: cellIdBelow ? cellIdBelow : "",
hasCodeOutput: cellType === "code" && NotebookUtil.hasCodeCellOutput(cell as ImmutableCodeCell),
isNotebookUntrusted: NotebookUtil.isNotebookUntrusted(state, ownProps.contentRef),
};

View File

@@ -141,7 +141,8 @@
"./src/Platform/Hosted/Components/SwitchAccount.tsx",
"./src/Platform/Hosted/Components/SwitchSubscription.tsx",
"./src/Explorer/Notebook/NotebookComponent/VirtualCommandBarComponent.tsx",
"./src/Explorer/Notebook/NotebookRenderer/Toolbar.tsx"
"./src/Explorer/Notebook/NotebookRenderer/Toolbar.tsx",
"./src/Common/Upload/Upload.tsx"
],
"include": [
"src/CellOutputViewer/transforms/**/*",