Skip to content

Commit

Permalink
Merge pull request #108 from MicroPad/next-dev
Browse files Browse the repository at this point in the history
v3.12.6
  • Loading branch information
NickGeek authored Jan 8, 2019
2 parents 6772372 + 0fee985 commit 083cfe6
Show file tree
Hide file tree
Showing 9 changed files with 194 additions and 147 deletions.
4 changes: 2 additions & 2 deletions app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "micropad",
"version": "3.12.5",
"version": "3.12.6",
"repository": {
"type": "git",
"url": "https://github.com/MicroPad/Web.git"
Expand Down Expand Up @@ -86,7 +86,7 @@
"redux-mock-store": "^1.5.3",
"sinon": "^5.0.7",
"tslint": "^5.11.0",
"typescript": "^2.8.3",
"typescript": "^3.2.2",
"workerize-loader": "^1.0.3"
},
"keywords": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export default class UploadNotepadsComponent extends React.Component<IUploadNote
const file = event.currentTarget.files![0];
const reader = new FileReader();

reader.onload = () => resolve(reader.result);
reader.onload = () => resolve(reader.result as ArrayBuffer);

reader.readAsArrayBuffer(file);
});
Expand Down
4 changes: 2 additions & 2 deletions app/src/components/note-viewer/NoteViewerComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,15 +218,15 @@ export default class NoteViewerComponent extends React.Component<INoteViewerComp
const x = event.clientX;
const y = event.clientY - FullScreenService.getOffset(isFullscreen);

if (!!event.dataTransfer.items) {
if (!!event.dataTransfer && !!event.dataTransfer.items) {
Array.from(event.dataTransfer.items)
.filter(item => item.kind === 'file')
.map(file => file.getAsFile())
.filter(Boolean)
.forEach((file: File) => this.insertFileFromDrag(file, x, y));

event.dataTransfer.items.clear();
} else {
} else if (!!event.dataTransfer && !!event.dataTransfer.files) {
Array.from(event.dataTransfer.files)
.forEach(file => this.insertFileFromDrag(file, x, y));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default class FileElementComponent extends React.Component<IFileElementCo
if (!file) reject();
const reader = new FileReader();

reader.onload = () => resolve([reader.result, file.name]);
reader.onload = () => resolve([reader.result as string, file.name as string]);

reader.readAsDataURL(file);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default class ImageElementComponent extends React.Component<INoteElementC
if (!file) reject();
const reader = new FileReader();

reader.onload = () => resolve(reader.result);
reader.onload = () => resolve(reader.result as string);

reader.readAsDataURL(file);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export default class NoteElementComponent extends React.Component<INoteElementCo
if (this.isDragging) event.preventDefault();
}

private handleDrag = (event: Event, data: DraggableData) => {
private handleDrag = (_: any, data: DraggableData) => {
const { element, updateElement } = this.props;
if (data.x < 0) data.x = 0;
if (data.y < 0) data.y = 0;
Expand Down
4 changes: 2 additions & 2 deletions app/src/epics/NotepadEpics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ const exportNotepad$ = (action$, store) =>
from(getNotepadXmlWithAssets(notepad.toNotepad()))
),
tap((exportedNotepad: IExportedNotepad) => {
const blob = new Blob([exportedNotepad.content], { type: 'text/xml;charset=utf-8' });
const blob = new Blob([exportedNotepad.content as BlobPart], { type: 'text/xml;charset=utf-8' });
saveAs(blob, `${fixFileName(exportedNotepad.title)}.npx`);
}),
filter(() => false)
Expand Down Expand Up @@ -181,7 +181,7 @@ const exportAll$ = (action$, store) =>
const zip: JSZip = new JSZip();

exportNotepads.forEach((exportedNotepad: IExportedNotepad) => {
const blob: Blob = new Blob([exportedNotepad.content], { type: 'text/xml;charset=utf-8' });
const blob: Blob = new Blob([exportedNotepad.content as string], { type: 'text/xml;charset=utf-8' });
zip.file(`${fixFileName(exportedNotepad.title)}.npx`, blob);
});

Expand Down
4 changes: 2 additions & 2 deletions app/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function readFileInputEventAsText(event: SyntheticEvent<HTMLInputElement>
const file = event.currentTarget.files![0];
const reader = new FileReader();

reader.onload = () => resolve(reader.result);
reader.onload = () => resolve(reader.result as string);

reader.readAsText(file);
});
Expand All @@ -45,7 +45,7 @@ export function getAsBase64(blob: Blob): Promise<string> {
return new Promise<string>(resolve => {
try {
const reader = new FileReader();
reader.onload = event => resolve(event.target!.result);
reader.onload = event => resolve((event.target as any).result);
reader.readAsDataURL(blob);
} catch (e) {
console.warn(e);
Expand Down
Loading

0 comments on commit 083cfe6

Please sign in to comment.