OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
_backup
/
tinymce
/
tinymce
/
src
/
themes
/
silver
/
main
/
ts
/
ui
/
dialog
/
imagetools
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
02/20/2020 06:40:38 AM
rwxr-xr-x
📄
CropRect.ts
7.1 KB
02/20/2020 06:40:41 AM
rw-r--r--
📄
DragHelper.ts
3.43 KB
02/20/2020 06:40:41 AM
rw-r--r--
📄
EditPanel.ts
15.6 KB
02/20/2020 06:40:42 AM
rw-r--r--
📄
Errors.ts
2.39 KB
02/20/2020 06:40:42 AM
rw-r--r--
📄
ImagePanel.ts
6.88 KB
02/20/2020 06:40:43 AM
rw-r--r--
📄
ImageTools.ts
7.94 KB
02/20/2020 06:40:43 AM
rw-r--r--
📄
ImageToolsEvents.ts
1.17 KB
02/20/2020 06:40:44 AM
rw-r--r--
📄
SideBar.ts
2.62 KB
02/20/2020 06:40:44 AM
rw-r--r--
📄
UndoStack.ts
842 bytes
02/20/2020 06:40:45 AM
rw-r--r--
📄
Utils.ts
1.8 KB
02/20/2020 06:40:45 AM
rw-r--r--
📁
state
-
02/20/2020 06:42:44 AM
rwxr-xr-x
Editing: Utils.ts
Close
/** * Copyright (c) Tiny Technologies, Inc. All rights reserved. * Licensed under the LGPL or a commercial license. * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ */ import { FileReader, XMLHttpRequest } from '@ephox/sand'; import Promise from 'tinymce/core/api/util/Promise'; import Tools from 'tinymce/core/api/util/Tools'; import { Blob } from '@ephox/dom-globals'; const isValue = function (obj) { return obj !== null && obj !== undefined; }; const traverse = function (json, path) { let value; value = path.reduce(function (result, key) { return isValue(result) ? result[key] : undefined; }, json); return isValue(value) ? value : null; }; const requestUrlAsBlob = function (url: string, headers: Record<string, string>, withCredentials: boolean) { return new Promise<{status: number, blob: Blob}>(function (resolve) { let xhr; xhr = XMLHttpRequest(); xhr.onreadystatechange = function () { if (xhr.readyState === 4) { resolve({ status: xhr.status, blob: this.response }); } }; xhr.open('GET', url, true); xhr.withCredentials = withCredentials; Tools.each(headers, function (value, key) { xhr.setRequestHeader(key, value); }); xhr.responseType = 'blob'; xhr.send(); }); }; const readBlob = function (blob) { return new Promise(function (resolve) { const fr = FileReader(); fr.onload = function (e) { const data = e.target; resolve(data.result); }; fr.readAsText(blob); }); }; const parseJson = function (text) { let json; try { json = JSON.parse(text); } catch (ex) { // Ignore } return json; }; export default { traverse, readBlob, requestUrlAsBlob, parseJson };