react-pdf-editor-1 1.2.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +3 -0
- package/LICENSE +2 -0
- package/README.md +315 -0
- package/dist/index.js +526 -0
- package/package.json +33 -0
- package/public/01fd34b01abf8d0a1fdb3c10f95146cd.svg +7 -0
- package/public/025954f8cad47e40240e15487d1e396c.svg +17 -0
- package/public/105d10237b3dddb56304b2af06fab51c.svg +8 -0
- package/public/10879587954149cc5fd694c7785e9d3a.svg +8 -0
- package/public/15cba32d3c729060a92912d969d1cc2c.svg +17 -0
- package/public/1964539986cd6aea3baee0f32a61923e.svg +4 -0
- package/public/1c0b882b730b22fbd7d42b68bd0a970e.svg +2 -0
- package/public/1d66d40875fa58261ff4b850e8cba7cc.svg +5 -0
- package/public/22b31630cb8b4b2ad58da61bb133ab1f.svg +8 -0
- package/public/2d62d3d287fbc3c497dddab32168f325.svg +4 -0
- package/public/31f31a1074e7f19fde072c1158a8e6a0.svg +14 -0
- package/public/3659a716673b2dd214d961c5feb3caa6.svg +4 -0
- package/public/3bc689e0aff9db355266a7b3be92e9d0.svg +4 -0
- package/public/3eb1d80899f968c9398d1c08a5350b2d.svg +4 -0
- package/public/4c63cae958b5685dfd85cda1b06787fe.svg +17 -0
- package/public/50842dfca45fc95070e4fdd2259db45c.svg +4 -0
- package/public/536890911d2db783d87b77a39b74f396.svg +4 -0
- package/public/71edf29951e1e0d3b50d9562bc7a5049.svg +14 -0
- package/public/79ee5b45e590be841daeba9d60e7db6e.svg +5 -0
- package/public/839d642763fa2703bfa92fcdbaa0397c.svg +17 -0
- package/public/8639ab06d026e5d60849b007b6f432b6.svg +14 -0
- package/public/9209f692646c3a0d4fb372037a3d7237.svg +4 -0
- package/public/96ba4601cfdb560093692ac2d34260dd.svg +8 -0
- package/public/9c36754c195ca83d24a39e75ef3821c0.svg +4 -0
- package/public/9f41f6f39d1736d2782a934fea979c01.svg +4 -0
- package/public/a24af8321bcb23961c196b0b4fce89c7.svg +17 -0
- package/public/a3f2a45a2d94e515bc17ea9740631aa0.svg +6 -0
- package/public/a51521eadbd56edc63eb19bc5a41a598.svg +5 -0
- package/public/a7a14359ef6035eb03282f98500c02f3.svg +17 -0
- package/public/b4d7375b688647fc2e477f9d911f1e2e.svg +17 -0
- package/public/b947e1da1eac39e0ff7f9b7c1f944f52.svg +17 -0
- package/public/bundle.js +2 -0
- package/public/bundle.js.LICENSE.txt +32 -0
- package/public/c0ab9ce68d42392fb8fc13f7089c9518.svg +5 -0
- package/public/c69a80a1cc748b27d5ee83d3951bc956.svg +4 -0
- package/public/c6ac6e95ae6fe2f0391da8fa2e9c8554.svg +14 -0
- package/public/d538166f1033a89b5d2735aecea91c62.svg +5 -0
- package/public/d84737c082efeea55189a8196ac9236c.svg +17 -0
- package/public/e19e4765f223f61db42d28f92ddbcd4e.svg +5 -0
- package/public/e80893668bffe9e8e3c09306c073cf30.svg +2 -0
- package/public/eb7981a1b3a89b6cfce8722d72214fde.svg +17 -0
- package/public/eccb83ba375a1929a3f18ba30694c231.svg +5 -0
- package/public/ee12777ac448b2018f768c80fb248e9c.svg +4 -0
- package/public/f646afcaa121a7b8d388826e30f410c1.svg +4 -0
- package/public/ff2dfa442d903d9d5e30.gif +0 -0
- package/public/index.html +1 -0
- package/public/pdf-ui/033ea05cff39966fc00030593f62d81f.svg +5 -0
- package/public/pdf-ui/0353d3a6acc37ec6b16e6bf353926342.svg +15 -0
- package/public/pdf-ui/045352e9aa7d98994484ffb8ec3dbe38.svg +4 -0
- package/public/pdf-ui/067c6de2adec31f57b18.gif +1 -0
- package/public/pdf-ui/088c54c203716cb1be7190bb6075efb6.png +0 -0
- package/public/pdf-ui/0d18d81ca415c6007655b836f84e4219.svg +8 -0
- package/public/pdf-ui/15cba32d3c729060a92912d969d1cc2c.svg +17 -0
- package/public/pdf-ui/1c0b882b730b22fbd7d42b68bd0a970e.svg +2 -0
- package/public/pdf-ui/1c5917d73900d5039cd8.gif +1 -0
- package/public/pdf-ui/1d66d40875fa58261ff4b850e8cba7cc.svg +5 -0
- package/public/pdf-ui/1ec9099f99fb29fd2f6862878724a0a3.svg +5 -0
- package/public/pdf-ui/22b31630cb8b4b2ad58da61bb133ab1f.svg +8 -0
- package/public/pdf-ui/2a087ab7d6db0961c9a3.gif +1 -0
- package/public/pdf-ui/2c98033a3b632f65d3ec.wasm +0 -0
- package/public/pdf-ui/2d857cb345dc7c8dbece3d62a20f09bd.svg +5 -0
- package/public/pdf-ui/325f20a2786a21caee0f924078e07d71.svg +2 -0
- package/public/pdf-ui/35d6b608bc295d96f7fd45b93b27706c.svg +8 -0
- package/public/pdf-ui/3659a716673b2dd214d961c5feb3caa6.svg +4 -0
- package/public/pdf-ui/3bc689e0aff9db355266a7b3be92e9d0.svg +4 -0
- package/public/pdf-ui/3e8dbb8345f70b7b4c36bb1ad05dfe7e.svg +4 -0
- package/public/pdf-ui/3eb1d80899f968c9398d1c08a5350b2d.svg +4 -0
- package/public/pdf-ui/4ab3dd8677ef3699fc53c7328a3ae1c6.svg +2 -0
- package/public/pdf-ui/4c63cae958b5685dfd85cda1b06787fe.svg +17 -0
- package/public/pdf-ui/4dc3c7d029346b6ca3318f0e60ccfe87.svg +4 -0
- package/public/pdf-ui/4e9b9c2bcbd6c3737c340cd5bebefd8c.svg +6 -0
- package/public/pdf-ui/4ebd2633a2d5debf8a4e568b7985be7e.svg +4 -0
- package/public/pdf-ui/50842dfca45fc95070e4fdd2259db45c.svg +4 -0
- package/public/pdf-ui/5087ceef6868b5ab32a1.svg +1 -0
- package/public/pdf-ui/536890911d2db783d87b77a39b74f396.svg +4 -0
- package/public/pdf-ui/53f17281bc4dffa3a650442bfb07d321.svg +4 -0
- package/public/pdf-ui/586876b8baad663cfcb1.svg +1 -0
- package/public/pdf-ui/59fe962b3e6bd8bfdda7a104ebfba9e9.svg +3 -0
- package/public/pdf-ui/5a84e180ec596169981c831f0288374a.svg +19 -0
- package/public/pdf-ui/5e9941f27dabbef172bdaf2deccb70f6.svg +11 -0
- package/public/pdf-ui/5ea0869845becef03a065090fee2a9a5.svg +4 -0
- package/public/pdf-ui/6529e96a9906058150e3de021602f1d9.svg +4 -0
- package/public/pdf-ui/65c76ef6e36e34a13364a8127e57b18e.svg +4 -0
- package/public/pdf-ui/79edeed2414d6ac5ec44.svg +1 -0
- package/public/pdf-ui/79ee5b45e590be841daeba9d60e7db6e.svg +5 -0
- package/public/pdf-ui/80a30e134dde30c967de.svg +1 -0
- package/public/pdf-ui/854c025f76bbfdf1a6c3db5a8db6abb4.svg +11 -0
- package/public/pdf-ui/8be7b158d340ed4fd589.svg +1 -0
- package/public/pdf-ui/8d64a1271d5126b8cb78.svg +1 -0
- package/public/pdf-ui/9c36754c195ca83d24a39e75ef3821c0.svg +4 -0
- package/public/pdf-ui/9fb032a1799ca2a1c7518895c7533af2.svg +3 -0
- package/public/pdf-ui/a64081b14b23b34ed10bb1183be53747.png +0 -0
- package/public/pdf-ui/ac0f6afbea0be2b67f8b2dc2f40fdf4b.svg +4 -0
- package/public/pdf-ui/assets/blue-bg-5-2.png +0 -0
- package/public/pdf-ui/assets/blue-bg-500-150.png +0 -0
- package/public/pdf-ui/assets/color-wheel.png +0 -0
- package/public/pdf-ui/assets/signature-bg.png +0 -0
- package/public/pdf-ui/assets/signature-icon.png +0 -0
- package/public/pdf-ui/assets/yellow-bg-5-4.png +0 -0
- package/public/pdf-ui/assets/yellow-bg-500-150.png +0 -0
- package/public/pdf-ui/b1db19c0847c6c911193d6b9b48ae9df.svg +2 -0
- package/public/pdf-ui/b722fb1fa619a347bb3fe0e24b0c40cc.png +0 -0
- package/public/pdf-ui/bb72d81b39be40898db21e81272dbf39.svg +3 -0
- package/public/pdf-ui/bundle.js +3 -0
- package/public/pdf-ui/bundle.js.LICENSE.txt +74 -0
- package/public/pdf-ui/bundle.js.map +1 -0
- package/public/pdf-ui/c69a80a1cc748b27d5ee83d3951bc956.svg +4 -0
- package/public/pdf-ui/c6a3cd10a29122c87d0aff12229e1539.svg +4 -0
- package/public/pdf-ui/c6ac6e95ae6fe2f0391da8fa2e9c8554.svg +14 -0
- package/public/pdf-ui/c85c0ff9534eda6ec97b1f5c7c80d994.svg +4 -0
- package/public/pdf-ui/ccb5b2b4f2a6efbac0194acb7dd27875.svg +4 -0
- package/public/pdf-ui/d4a0946ca523e1a07119c30351cdc625.svg +8 -0
- package/public/pdf-ui/de62f36b83bb7ae79e7f4499387ee87e.svg +4 -0
- package/public/pdf-ui/e19e4765f223f61db42d28f92ddbcd4e.svg +5 -0
- package/public/pdf-ui/e80893668bffe9e8e3c09306c073cf30.svg +2 -0
- package/public/pdf-ui/f20333b6d7b1530454d1ea949f337c4d.svg +5 -0
- package/public/pdf-ui/f8f9feb56bfaf57527c21e854ad43533.svg +5 -0
- package/public/pdf-ui/ff2dfa442d903d9d5e30.gif +0 -0
- package/public/pdf-ui/ff2dfa442d903d9d5e303345b82e5415.gif +0 -0
- package/public/pdf-ui/index.html +1 -0
- package/public/pdf-ui/lib/pdf.worker.js +2 -0
- package/public/pdf-ui/lib/pdf.worker.js.LICENSE.txt +21 -0
- package/public/pdf-ui/lib/pdf_wasm_project.js +1 -0
- package/public/pdf-ui/lib/pdf_wasm_project_bg.wasm +0 -0
- package/public/pdf-ui/node_modules/alien35-pf/web/images/loading-icon.gif +0 -0
- package/public/pdf-ui/node_modules/pdfjs-dist/web/images/loading-icon.gif +0 -0
- package/src/index.d.ts +33 -0
- package/src/index.js +374 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,526 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useCreateIframeAndLoadViewer = void 0;
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
10
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
11
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
12
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
13
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
14
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
15
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
16
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
17
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
18
|
+
var useCreateIframeAndLoadViewer = function useCreateIframeAndLoadViewer(_ref) {
|
|
19
|
+
var files = _ref.files,
|
|
20
|
+
authInfo = _ref.authInfo,
|
|
21
|
+
fileName = _ref.fileName,
|
|
22
|
+
licenseKey = _ref.licenseKey,
|
|
23
|
+
customData = _ref.customData,
|
|
24
|
+
uuid = _ref.uuid,
|
|
25
|
+
tools = _ref.tools,
|
|
26
|
+
locale = _ref.locale,
|
|
27
|
+
mode = _ref.mode,
|
|
28
|
+
container = _ref.container,
|
|
29
|
+
iframeSrc = _ref.iframeSrc,
|
|
30
|
+
onFileFailed = _ref.onFileFailed,
|
|
31
|
+
defaultAnnotationEditorMode = _ref.defaultAnnotationEditorMode,
|
|
32
|
+
initialAnnotations = _ref.initialAnnotations,
|
|
33
|
+
initialSigners = _ref.initialSigners,
|
|
34
|
+
modifiedUiElements = _ref.modifiedUiElements;
|
|
35
|
+
var _useState = (0, _react.useState)(false),
|
|
36
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
37
|
+
internalIsReady = _useState2[0],
|
|
38
|
+
setInternalIsReady = _useState2[1]; // Add this state variable
|
|
39
|
+
var _useState3 = (0, _react.useState)([]),
|
|
40
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
41
|
+
selectedPages = _useState4[0],
|
|
42
|
+
setSelectedPages = _useState4[1];
|
|
43
|
+
var done = (0, _react.useRef)(false);
|
|
44
|
+
var iframeLoadedSuccessfully = (0, _react.useRef)(false); // Add this ref to keep track of iframe's load state
|
|
45
|
+
var _useState5 = (0, _react.useState)(null),
|
|
46
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
47
|
+
pagesLoaded = _useState6[0],
|
|
48
|
+
setPagesLoaded = _useState6[1];
|
|
49
|
+
var _useState7 = (0, _react.useState)([]),
|
|
50
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
51
|
+
annotations = _useState8[0],
|
|
52
|
+
setAnnotations = _useState8[1];
|
|
53
|
+
var _useState9 = (0, _react.useState)(null),
|
|
54
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
55
|
+
authTokens = _useState10[0],
|
|
56
|
+
setAuthTokens = _useState10[1];
|
|
57
|
+
var _useState11 = (0, _react.useState)(false),
|
|
58
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
59
|
+
signatureModalOpen = _useState12[0],
|
|
60
|
+
setSignatureModalOpen = _useState12[1];
|
|
61
|
+
var createIframe = function createIframe() {
|
|
62
|
+
var iframe = document.createElement('iframe');
|
|
63
|
+
iframe.src = iframeSrc || "/pdf-ui/index.html";
|
|
64
|
+
iframe.id = "webviewer-1";
|
|
65
|
+
iframe.title = "webviewer";
|
|
66
|
+
iframe.frameBorder = "0";
|
|
67
|
+
iframe.width = "100%";
|
|
68
|
+
iframe.height = "100%";
|
|
69
|
+
iframe.style.margin = "0px";
|
|
70
|
+
iframe.style.padding = "0px";
|
|
71
|
+
iframe.style.display = "block";
|
|
72
|
+
iframe.allowFullscreen = true;
|
|
73
|
+
// @ts-ignore
|
|
74
|
+
iframe["webkitallowfullscreen"] = true;
|
|
75
|
+
// @ts-ignore
|
|
76
|
+
iframe["mozallowfullscreen"] = true;
|
|
77
|
+
|
|
78
|
+
// When the iframe is loaded, post the file to it
|
|
79
|
+
iframe.onload = function () {
|
|
80
|
+
var targetOrigin = window.location.origin;
|
|
81
|
+
var message = {
|
|
82
|
+
files: files,
|
|
83
|
+
fileName: fileName,
|
|
84
|
+
tools: tools,
|
|
85
|
+
locale: locale,
|
|
86
|
+
licenseKey: licenseKey,
|
|
87
|
+
mode: mode,
|
|
88
|
+
uuid: uuid,
|
|
89
|
+
customData: customData,
|
|
90
|
+
initialAnnotations: initialAnnotations,
|
|
91
|
+
initialSigners: initialSigners,
|
|
92
|
+
modifiedUiElements: modifiedUiElements,
|
|
93
|
+
authInfo: authInfo,
|
|
94
|
+
defaultAnnotationEditorMode: defaultAnnotationEditorMode
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
// Set up a function to send the message
|
|
98
|
+
var sendMessage = function sendMessage() {
|
|
99
|
+
// @ts-ignore
|
|
100
|
+
iframe.contentWindow.postMessage(message, targetOrigin);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
// Call the function immediately to send the first message
|
|
104
|
+
sendMessage();
|
|
105
|
+
|
|
106
|
+
// Set up an interval to send the message every 1000ms (1 second)
|
|
107
|
+
var interval = setInterval(sendMessage, 200);
|
|
108
|
+
|
|
109
|
+
// Set up an event listener to listen for a response from the iframe
|
|
110
|
+
window.parent.addEventListener('message', function (event) {
|
|
111
|
+
if (event.data.type === 'file-received' && event.data.success) {
|
|
112
|
+
// If the message was received successfully, clear the interval
|
|
113
|
+
clearInterval(interval);
|
|
114
|
+
}
|
|
115
|
+
if (event.data.type === 'file-failed' && event.data.message) {
|
|
116
|
+
// If the message was received successfully, clear the interval
|
|
117
|
+
onFileFailed(event.data.message);
|
|
118
|
+
}
|
|
119
|
+
if (event.data.type === 'multi-page-selection-change' && Array.isArray(event.data.message)) {
|
|
120
|
+
setSelectedPages(event.data.message);
|
|
121
|
+
}
|
|
122
|
+
if (event.data.type === "pages-loaded") {
|
|
123
|
+
setPagesLoaded(event.data.message);
|
|
124
|
+
}
|
|
125
|
+
if (event.data.type === "annotations-change") {
|
|
126
|
+
setAnnotations(event.data.message);
|
|
127
|
+
}
|
|
128
|
+
if (event.data.type === "annotation-modal-open-change") {
|
|
129
|
+
setSignatureModalOpen(event.data.message);
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
container.current.appendChild(iframe);
|
|
134
|
+
};
|
|
135
|
+
var handleIframeLoaded = function handleIframeLoaded(event) {
|
|
136
|
+
if (event.data.type === 'iframe-loaded' && event.data.success) {
|
|
137
|
+
iframeLoadedSuccessfully.current = true;
|
|
138
|
+
setInternalIsReady(true);
|
|
139
|
+
}
|
|
140
|
+
// let's just lump more stuff in here
|
|
141
|
+
if (event.data.type === 'token-granted' && event.data.token) {
|
|
142
|
+
setAuthTokens(JSON.stringify({
|
|
143
|
+
token: event.data.token,
|
|
144
|
+
refreshToken: event.data.refreshToken
|
|
145
|
+
}));
|
|
146
|
+
}
|
|
147
|
+
if (event.data.type === 'token-removed') {
|
|
148
|
+
setAuthTokens(null);
|
|
149
|
+
}
|
|
150
|
+
if (event.data.type === 'request-token' && event.data.success) {
|
|
151
|
+
var iframeWin = document.getElementById('webviewer-1').contentWindow;
|
|
152
|
+
var parsedTokens = authTokens ? JSON.parse(authTokens) : null;
|
|
153
|
+
iframeWin === null || iframeWin === void 0 ? void 0 : iframeWin.postMessage({
|
|
154
|
+
authInfo: {
|
|
155
|
+
token: parsedTokens === null || parsedTokens === void 0 ? void 0 : parsedTokens.token,
|
|
156
|
+
refreshToken: parsedTokens === null || parsedTokens === void 0 ? void 0 : parsedTokens.refreshToken
|
|
157
|
+
}
|
|
158
|
+
}, '*');
|
|
159
|
+
// I believe this is only for the chrome extension tabs learning from each other.
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
(0, _react.useEffect)(function () {
|
|
164
|
+
window.parent.addEventListener('message', handleIframeLoaded);
|
|
165
|
+
return function () {
|
|
166
|
+
return window.parent.removeEventListener('message', handleIframeLoaded);
|
|
167
|
+
};
|
|
168
|
+
}, []);
|
|
169
|
+
var _useState13 = (0, _react.useState)(null),
|
|
170
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
171
|
+
clickedTag = _useState14[0],
|
|
172
|
+
setClickedTag = _useState14[1];
|
|
173
|
+
var handleTagClicked = function handleTagClicked(event) {
|
|
174
|
+
if (event.data.type === 'click-tag') {
|
|
175
|
+
setClickedTag(event.data);
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
(0, _react.useEffect)(function () {
|
|
179
|
+
window.parent.addEventListener('message', handleTagClicked);
|
|
180
|
+
return function () {
|
|
181
|
+
return window.parent.removeEventListener('message', handleTagClicked);
|
|
182
|
+
};
|
|
183
|
+
}, []);
|
|
184
|
+
var handleVisibilityChange = function handleVisibilityChange() {
|
|
185
|
+
if (!document.hidden && !iframeLoadedSuccessfully.current) {
|
|
186
|
+
var iframe = document.getElementById('webviewer-1');
|
|
187
|
+
if (iframe) {
|
|
188
|
+
iframe.remove();
|
|
189
|
+
}
|
|
190
|
+
createIframe();
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
(0, _react.useEffect)(function () {
|
|
194
|
+
if (!(container !== null && container !== void 0 && container.current)) {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
if (done.current) {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
done.current = true;
|
|
201
|
+
createIframe();
|
|
202
|
+
}, [container, files]);
|
|
203
|
+
(0, _react.useEffect)(function () {
|
|
204
|
+
document.addEventListener('click', function () {
|
|
205
|
+
// @ts-ignore
|
|
206
|
+
var iframeWin = document.getElementById('webviewer-1').contentWindow;
|
|
207
|
+
iframeWin.postMessage('clickedOutside', window.location.origin);
|
|
208
|
+
});
|
|
209
|
+
document.addEventListener('visibilitychange', handleVisibilityChange);
|
|
210
|
+
return function () {
|
|
211
|
+
document.removeEventListener('visibilitychange', handleVisibilityChange);
|
|
212
|
+
};
|
|
213
|
+
}, []);
|
|
214
|
+
var download = function download() {
|
|
215
|
+
var _document;
|
|
216
|
+
// @ts-ignore
|
|
217
|
+
var iframeWin = (_document = document) === null || _document === void 0 || (_document = _document.getElementById('webviewer-1')) === null || _document === void 0 ? void 0 : _document.contentWindow;
|
|
218
|
+
iframeWin.postMessage({
|
|
219
|
+
type: 'download'
|
|
220
|
+
}, window.location.origin);
|
|
221
|
+
};
|
|
222
|
+
var toggleFullScreenThumbnails = function toggleFullScreenThumbnails(enable) {
|
|
223
|
+
var _document2;
|
|
224
|
+
// @ts-ignore
|
|
225
|
+
var iframeWin = (_document2 = document) === null || _document2 === void 0 || (_document2 = _document2.getElementById('webviewer-1')) === null || _document2 === void 0 ? void 0 : _document2.contentWindow;
|
|
226
|
+
iframeWin.postMessage({
|
|
227
|
+
type: 'toggle-full-screen-thumbnails',
|
|
228
|
+
enable: enable
|
|
229
|
+
}, window.location.origin);
|
|
230
|
+
};
|
|
231
|
+
var toggleSearchbar = function toggleSearchbar(enable) {
|
|
232
|
+
var _document3;
|
|
233
|
+
// @ts-ignore
|
|
234
|
+
var iframeWin = (_document3 = document) === null || _document3 === void 0 || (_document3 = _document3.getElementById('webviewer-1')) === null || _document3 === void 0 ? void 0 : _document3.contentWindow;
|
|
235
|
+
iframeWin.postMessage({
|
|
236
|
+
type: 'toggle-searchbar',
|
|
237
|
+
enable: enable
|
|
238
|
+
}, window.location.origin);
|
|
239
|
+
};
|
|
240
|
+
var requestBuffer = /*#__PURE__*/function () {
|
|
241
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(value) {
|
|
242
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
243
|
+
while (1) switch (_context.prev = _context.next) {
|
|
244
|
+
case 0:
|
|
245
|
+
return _context.abrupt("return", new Promise(function (resolve, reject) {
|
|
246
|
+
var _document4;
|
|
247
|
+
var listener = function listener(event) {
|
|
248
|
+
if (event.data.type === 'request-buffer-completed') {
|
|
249
|
+
resolve(event.data.message); // Resolve the promise with the result
|
|
250
|
+
window.removeEventListener('message', listener); // Remove the listener to clean up
|
|
251
|
+
} else if (event.data.type === 'request-buffer-failed') {
|
|
252
|
+
reject(new Error(event.data.message)); // Reject the promise with the error message
|
|
253
|
+
window.removeEventListener('message', listener); // Remove the listener to clean up
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
// Adding the event listener before sending the postMessage
|
|
258
|
+
window.addEventListener('message', listener);
|
|
259
|
+
|
|
260
|
+
// @ts-ignore
|
|
261
|
+
var iframeWin = (_document4 = document) === null || _document4 === void 0 || (_document4 = _document4.getElementById('webviewer-1')) === null || _document4 === void 0 ? void 0 : _document4.contentWindow;
|
|
262
|
+
|
|
263
|
+
// Sending the extract-pages message to the iframe
|
|
264
|
+
iframeWin.postMessage({
|
|
265
|
+
type: 'request-buffer',
|
|
266
|
+
value: value
|
|
267
|
+
}, window.location.origin);
|
|
268
|
+
}));
|
|
269
|
+
case 1:
|
|
270
|
+
case "end":
|
|
271
|
+
return _context.stop();
|
|
272
|
+
}
|
|
273
|
+
}, _callee);
|
|
274
|
+
}));
|
|
275
|
+
return function requestBuffer(_x2) {
|
|
276
|
+
return _ref2.apply(this, arguments);
|
|
277
|
+
};
|
|
278
|
+
}();
|
|
279
|
+
var toggleSignatureModal = function toggleSignatureModal(enable) {
|
|
280
|
+
var _document5;
|
|
281
|
+
// @ts-ignore
|
|
282
|
+
var iframeWin = (_document5 = document) === null || _document5 === void 0 || (_document5 = _document5.getElementById('webviewer-1')) === null || _document5 === void 0 ? void 0 : _document5.contentWindow;
|
|
283
|
+
iframeWin.postMessage({
|
|
284
|
+
type: 'toggle-signature-modal',
|
|
285
|
+
enable: enable
|
|
286
|
+
}, window.location.origin);
|
|
287
|
+
};
|
|
288
|
+
var setThumbnailZoom = function setThumbnailZoom(value) {
|
|
289
|
+
var _document6;
|
|
290
|
+
// @ts-ignore
|
|
291
|
+
var iframeWin = (_document6 = document) === null || _document6 === void 0 || (_document6 = _document6.getElementById('webviewer-1')) === null || _document6 === void 0 ? void 0 : _document6.contentWindow;
|
|
292
|
+
iframeWin.postMessage({
|
|
293
|
+
type: 'set-thumbnail-zoom',
|
|
294
|
+
value: value
|
|
295
|
+
}, window.location.origin);
|
|
296
|
+
};
|
|
297
|
+
var setAuthInfo = function setAuthInfo(_ref3) {
|
|
298
|
+
var _document7;
|
|
299
|
+
var token = _ref3.token,
|
|
300
|
+
refreshToken = _ref3.refreshToken;
|
|
301
|
+
// @ts-ignore
|
|
302
|
+
var iframeWin = (_document7 = document) === null || _document7 === void 0 || (_document7 = _document7.getElementById('webviewer-1')) === null || _document7 === void 0 ? void 0 : _document7.contentWindow;
|
|
303
|
+
iframeWin === null || iframeWin === void 0 ? void 0 : iframeWin.postMessage({
|
|
304
|
+
type: 'set-auth-info',
|
|
305
|
+
authInfo: {
|
|
306
|
+
token: token,
|
|
307
|
+
refreshToken: refreshToken
|
|
308
|
+
}
|
|
309
|
+
}, window.location.origin);
|
|
310
|
+
};
|
|
311
|
+
var splitPages = /*#__PURE__*/function () {
|
|
312
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
313
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
314
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
315
|
+
case 0:
|
|
316
|
+
return _context2.abrupt("return", new Promise(function (resolve, reject) {
|
|
317
|
+
var _document8;
|
|
318
|
+
var listener = function listener(event) {
|
|
319
|
+
if (event.data.type === 'split-pages-completed' && event.data.success) {
|
|
320
|
+
resolve(event.data.message); // Resolve the promise with the result
|
|
321
|
+
window.removeEventListener('message', listener); // Remove the listener to clean up
|
|
322
|
+
} else if (event.data.type === 'split-pages-failed') {
|
|
323
|
+
reject(new Error(event.data.message)); // Reject the promise with the error message
|
|
324
|
+
window.removeEventListener('message', listener); // Remove the listener to clean up
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
// Adding the event listener before sending the postMessage
|
|
329
|
+
window.addEventListener('message', listener);
|
|
330
|
+
|
|
331
|
+
// @ts-ignore
|
|
332
|
+
var iframeWin = (_document8 = document) === null || _document8 === void 0 || (_document8 = _document8.getElementById('webviewer-1')) === null || _document8 === void 0 ? void 0 : _document8.contentWindow;
|
|
333
|
+
|
|
334
|
+
// Sending the extract-pages message to the iframe
|
|
335
|
+
iframeWin.postMessage({
|
|
336
|
+
type: 'split-pages'
|
|
337
|
+
}, window.location.origin);
|
|
338
|
+
}));
|
|
339
|
+
case 1:
|
|
340
|
+
case "end":
|
|
341
|
+
return _context2.stop();
|
|
342
|
+
}
|
|
343
|
+
}, _callee2);
|
|
344
|
+
}));
|
|
345
|
+
return function splitPages() {
|
|
346
|
+
return _ref4.apply(this, arguments);
|
|
347
|
+
};
|
|
348
|
+
}();
|
|
349
|
+
var mergeFiles = /*#__PURE__*/function () {
|
|
350
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(value) {
|
|
351
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
352
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
353
|
+
case 0:
|
|
354
|
+
return _context3.abrupt("return", new Promise(function (resolve, reject) {
|
|
355
|
+
var _document9;
|
|
356
|
+
var listener = function listener(event) {
|
|
357
|
+
if (event.data.type === 'merge-files-completed' && event.data.success) {
|
|
358
|
+
resolve(event.data.message); // Resolve the promise with the result
|
|
359
|
+
window.removeEventListener('message', listener); // Remove the listener to clean up
|
|
360
|
+
} else if (event.data.type === 'merge-files-failed') {
|
|
361
|
+
reject(new Error(event.data.message)); // Reject the promise with the error message
|
|
362
|
+
window.removeEventListener('message', listener); // Remove the listener to clean up
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
|
|
366
|
+
// Adding the event listener before sending the postMessage
|
|
367
|
+
window.addEventListener('message', listener);
|
|
368
|
+
|
|
369
|
+
// @ts-ignore
|
|
370
|
+
var iframeWin = (_document9 = document) === null || _document9 === void 0 || (_document9 = _document9.getElementById('webviewer-1')) === null || _document9 === void 0 ? void 0 : _document9.contentWindow;
|
|
371
|
+
|
|
372
|
+
// Sending the extract-pages message to the iframe
|
|
373
|
+
iframeWin.postMessage({
|
|
374
|
+
type: 'merge-files',
|
|
375
|
+
value: value
|
|
376
|
+
}, window.location.origin);
|
|
377
|
+
}));
|
|
378
|
+
case 1:
|
|
379
|
+
case "end":
|
|
380
|
+
return _context3.stop();
|
|
381
|
+
}
|
|
382
|
+
}, _callee3);
|
|
383
|
+
}));
|
|
384
|
+
return function mergeFiles(_x3) {
|
|
385
|
+
return _ref5.apply(this, arguments);
|
|
386
|
+
};
|
|
387
|
+
}();
|
|
388
|
+
var removeChatHistory = /*#__PURE__*/function () {
|
|
389
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
390
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
391
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
392
|
+
case 0:
|
|
393
|
+
return _context4.abrupt("return", new Promise(function (resolve, reject) {
|
|
394
|
+
var _document10;
|
|
395
|
+
var listener = function listener(event) {
|
|
396
|
+
if (event.data.type === 'remove-chat-history-completed' && event.data.success) {
|
|
397
|
+
resolve(event.data.message); // Resolve the promise with the result
|
|
398
|
+
window.removeEventListener('message', listener); // Remove the listener to clean up
|
|
399
|
+
} else if (event.data.type === 'remove-chat-history-failed') {
|
|
400
|
+
reject(new Error(event.data.message)); // Reject the promise with the error message
|
|
401
|
+
window.removeEventListener('message', listener); // Remove the listener to clean up
|
|
402
|
+
}
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
// Adding the event listener before sending the postMessage
|
|
406
|
+
window.addEventListener('message', listener);
|
|
407
|
+
|
|
408
|
+
// @ts-ignore
|
|
409
|
+
var iframeWin = (_document10 = document) === null || _document10 === void 0 || (_document10 = _document10.getElementById('webviewer-1')) === null || _document10 === void 0 ? void 0 : _document10.contentWindow;
|
|
410
|
+
|
|
411
|
+
// Sending the extract-pages message to the iframe
|
|
412
|
+
iframeWin.postMessage({
|
|
413
|
+
type: 'remove-chat-history'
|
|
414
|
+
}, window.location.origin);
|
|
415
|
+
}));
|
|
416
|
+
case 1:
|
|
417
|
+
case "end":
|
|
418
|
+
return _context4.stop();
|
|
419
|
+
}
|
|
420
|
+
}, _callee4);
|
|
421
|
+
}));
|
|
422
|
+
return function removeChatHistory() {
|
|
423
|
+
return _ref6.apply(this, arguments);
|
|
424
|
+
};
|
|
425
|
+
}();
|
|
426
|
+
var combineFiles = /*#__PURE__*/function () {
|
|
427
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(value) {
|
|
428
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
429
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
430
|
+
case 0:
|
|
431
|
+
return _context5.abrupt("return", new Promise(function (resolve, reject) {
|
|
432
|
+
var _document11;
|
|
433
|
+
var listener = function listener(event) {
|
|
434
|
+
if (event.data.type === 'combine-files-completed' && event.data.success) {
|
|
435
|
+
resolve(event.data.message); // Resolve the promise with the result
|
|
436
|
+
window.removeEventListener('message', listener); // Remove the listener to clean up
|
|
437
|
+
} else if (event.data.type === 'combine-files-failed') {
|
|
438
|
+
reject(new Error(event.data.message)); // Reject the promise with the error message
|
|
439
|
+
window.removeEventListener('message', listener); // Remove the listener to clean up
|
|
440
|
+
}
|
|
441
|
+
};
|
|
442
|
+
|
|
443
|
+
// Adding the event listener before sending the postMessage
|
|
444
|
+
window.addEventListener('message', listener);
|
|
445
|
+
|
|
446
|
+
// @ts-ignore
|
|
447
|
+
var iframeWin = (_document11 = document) === null || _document11 === void 0 || (_document11 = _document11.getElementById('webviewer-1')) === null || _document11 === void 0 ? void 0 : _document11.contentWindow;
|
|
448
|
+
|
|
449
|
+
// Sending the extract-pages message to the iframe
|
|
450
|
+
iframeWin.postMessage({
|
|
451
|
+
type: 'combine-files',
|
|
452
|
+
value: value
|
|
453
|
+
}, window.location.origin);
|
|
454
|
+
}));
|
|
455
|
+
case 1:
|
|
456
|
+
case "end":
|
|
457
|
+
return _context5.stop();
|
|
458
|
+
}
|
|
459
|
+
}, _callee5);
|
|
460
|
+
}));
|
|
461
|
+
return function combineFiles(_x4) {
|
|
462
|
+
return _ref7.apply(this, arguments);
|
|
463
|
+
};
|
|
464
|
+
}();
|
|
465
|
+
var extractPages = /*#__PURE__*/function () {
|
|
466
|
+
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(value) {
|
|
467
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
468
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
469
|
+
case 0:
|
|
470
|
+
return _context6.abrupt("return", new Promise(function (resolve, reject) {
|
|
471
|
+
var _document12;
|
|
472
|
+
var listener = function listener(event) {
|
|
473
|
+
if (event.data.type === 'extract-pages-completed' && event.data.success) {
|
|
474
|
+
resolve(event.data.result); // Resolve the promise with the result
|
|
475
|
+
window.removeEventListener('message', listener); // Remove the listener to clean up
|
|
476
|
+
} else if (event.data.type === 'extract-pages-failed') {
|
|
477
|
+
reject(new Error(event.data.message)); // Reject the promise with the error message
|
|
478
|
+
window.removeEventListener('message', listener); // Remove the listener to clean up
|
|
479
|
+
}
|
|
480
|
+
};
|
|
481
|
+
|
|
482
|
+
// Adding the event listener before sending the postMessage
|
|
483
|
+
window.addEventListener('message', listener);
|
|
484
|
+
|
|
485
|
+
// @ts-ignore
|
|
486
|
+
var iframeWin = (_document12 = document) === null || _document12 === void 0 || (_document12 = _document12.getElementById('webviewer-1')) === null || _document12 === void 0 ? void 0 : _document12.contentWindow;
|
|
487
|
+
|
|
488
|
+
// Sending the extract-pages message to the iframe
|
|
489
|
+
iframeWin.postMessage({
|
|
490
|
+
type: 'extract-pages',
|
|
491
|
+
value: value
|
|
492
|
+
}, window.location.origin);
|
|
493
|
+
}));
|
|
494
|
+
case 1:
|
|
495
|
+
case "end":
|
|
496
|
+
return _context6.stop();
|
|
497
|
+
}
|
|
498
|
+
}, _callee6);
|
|
499
|
+
}));
|
|
500
|
+
return function extractPages(_x5) {
|
|
501
|
+
return _ref8.apply(this, arguments);
|
|
502
|
+
};
|
|
503
|
+
}();
|
|
504
|
+
return {
|
|
505
|
+
requestBuffer: requestBuffer,
|
|
506
|
+
removeChatHistory: removeChatHistory,
|
|
507
|
+
setAuthInfo: setAuthInfo,
|
|
508
|
+
splitPages: splitPages,
|
|
509
|
+
combineFiles: combineFiles,
|
|
510
|
+
mergeFiles: mergeFiles,
|
|
511
|
+
pagesLoaded: pagesLoaded,
|
|
512
|
+
clickedTag: clickedTag,
|
|
513
|
+
extractPages: extractPages,
|
|
514
|
+
download: download,
|
|
515
|
+
toggleSearchbar: toggleSearchbar,
|
|
516
|
+
toggleSignatureModal: toggleSignatureModal,
|
|
517
|
+
toggleFullScreenThumbnails: toggleFullScreenThumbnails,
|
|
518
|
+
isReady: internalIsReady,
|
|
519
|
+
setThumbnailZoom: setThumbnailZoom,
|
|
520
|
+
selectedPages: selectedPages,
|
|
521
|
+
annotations: annotations,
|
|
522
|
+
authTokens: authTokens,
|
|
523
|
+
signatureModalOpen: signatureModalOpen
|
|
524
|
+
};
|
|
525
|
+
};
|
|
526
|
+
exports.useCreateIframeAndLoadViewer = useCreateIframeAndLoadViewer;
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-pdf-editor-1",
|
|
3
|
+
"version": "1.2.36",
|
|
4
|
+
"description": "## Core",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "babel src --out-dir dist",
|
|
8
|
+
"public-publish": "npm publish --access public"
|
|
9
|
+
},
|
|
10
|
+
"module": "src/index.js",
|
|
11
|
+
"types": "src/index.d.ts",
|
|
12
|
+
"keywords": [],
|
|
13
|
+
"author": "Alex Leon",
|
|
14
|
+
"license": "ISC",
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@babel/cli": "^7.22.9",
|
|
17
|
+
"@babel/core": "^7.22.9",
|
|
18
|
+
"@babel/preset-env": "^7.22.9",
|
|
19
|
+
"@babel/preset-react": "^7.22.5"
|
|
20
|
+
},
|
|
21
|
+
"peerDependencies": {
|
|
22
|
+
"react": ">=17.0.0"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {},
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "git+https://github.com/alien35/pdf-react-plugin.git"
|
|
28
|
+
},
|
|
29
|
+
"bugs": {
|
|
30
|
+
"url": "https://github.com/alien35/pdf-react-plugin/issues"
|
|
31
|
+
},
|
|
32
|
+
"homepage": "https://github.com/alien35/pdf-react-plugin#readme"
|
|
33
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
|
|
3
|
+
<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
4
|
+
<g id="Menu / Hamburger_MD">
|
|
5
|
+
<path id="Vector" d="M5 17H19M5 12H19M5 7H19" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
6
|
+
</g>
|
|
7
|
+
</svg>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
|
3
|
+
<svg width="800px" height="800px" viewBox="0 -5 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
|
|
4
|
+
|
|
5
|
+
<title>chevron-down</title>
|
|
6
|
+
<desc>Created with Sketch Beta.</desc>
|
|
7
|
+
<defs>
|
|
8
|
+
|
|
9
|
+
</defs>
|
|
10
|
+
<g id="Page-1" stroke="#000000" stroke-width="8" fill="none" fill-rule="evenodd" sketch:type="MSPage">
|
|
11
|
+
<g id="Icon-Set" sketch:type="MSLayerGroup" transform="translate(-572.000000, -1200.000000)" fill="#000000">
|
|
12
|
+
<path d="M595.688,1200.28 C595.295,1199.89 594.659,1199.89 594.268,1200.28 L583.984,1211.57 L573.702,1200.28 C573.31,1199.89 572.674,1199.89 572.282,1200.28 C571.89,1200.68 571.89,1201.32 572.282,1201.71 L583.225,1213.72 C583.434,1213.93 583.711,1214.02 583.984,1214 C584.258,1214.02 584.535,1213.93 584.745,1213.72 L595.688,1201.71 C596.079,1201.32 596.079,1200.68 595.688,1200.28" id="chevron-down" sketch:type="MSShapeGroup">
|
|
13
|
+
|
|
14
|
+
</path>
|
|
15
|
+
</g>
|
|
16
|
+
</g>
|
|
17
|
+
</svg>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
|
|
3
|
+
<svg fill="#000000" width="800px" height="800px" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
|
|
4
|
+
<g id="Group_32" data-name="Group 32" transform="translate(-166 -321.048)">
|
|
5
|
+
<path id="Path_313" data-name="Path 313" d="M178,345.048h16a4,4,0,0,0,4-4v-16a4,4,0,0,0-4-4H178a4,4,0,0,0-4,4v20Zm16-4H178v-16h16Z"/>
|
|
6
|
+
<path id="Path_314" data-name="Path 314" d="M186,349.048H170v-20a4,4,0,0,0-4,4v16a4,4,0,0,0,4,4h16a4,4,0,0,0,4-4"/>
|
|
7
|
+
</g>
|
|
8
|
+
</svg>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
|
|
3
|
+
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
|
4
|
+
<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
5
|
+
<g id="Menu / Hamburger_MD">
|
|
6
|
+
<path id="Vector" d="M5 17H19M5 12H19M5 7H19" stroke="#000000" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
7
|
+
</g>
|
|
8
|
+
</svg>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
|
3
|
+
<svg width="800px" height="800px" viewBox="-4 0 30 30" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
|
|
4
|
+
|
|
5
|
+
<title>bookmark</title>
|
|
6
|
+
<desc>Created with Sketch Beta.</desc>
|
|
7
|
+
<defs>
|
|
8
|
+
|
|
9
|
+
</defs>
|
|
10
|
+
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
|
|
11
|
+
<g id="Icon-Set-Filled" sketch:type="MSLayerGroup" transform="translate(-419.000000, -153.000000)" fill="#000000">
|
|
12
|
+
<path d="M437,153 L423,153 C420.791,153 419,154.791 419,157 L419,179 C419,181.209 420.791,183 423,183 L430,176 L437,183 C439.209,183 441,181.209 441,179 L441,157 C441,154.791 439.209,153 437,153" id="bookmark" sketch:type="MSShapeGroup">
|
|
13
|
+
|
|
14
|
+
</path>
|
|
15
|
+
</g>
|
|
16
|
+
</g>
|
|
17
|
+
</svg>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
|
2
|
+
<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.99996 2C9.44768 2 8.99996 2.44772 8.99996 3V4.58178C8.30471 4.86318 7.65844 5.23923 7.07704 5.69365L5.70573 4.90193C5.47605 4.76932 5.20309 4.73338 4.94691 4.80202C4.69073 4.87067 4.47232 5.03827 4.33971 5.26795L2.33971 8.73205C2.06357 9.21034 2.22744 9.82193 2.70573 10.0981L4.07654 10.8895C4.02603 11.2528 3.99997 11.6236 3.99997 12C3.99997 12.3764 4.02603 12.7471 4.07654 13.1105L2.70574 13.9019C2.47605 14.0345 2.30846 14.2529 2.23981 14.5091C2.17117 14.7653 2.2071 15.0382 2.33971 15.2679L4.33971 18.732C4.47232 18.9617 4.69074 19.1293 4.94692 19.198C5.2031 19.2666 5.47605 19.2307 5.70574 19.0981L7.07706 18.3063C7.65846 18.7607 8.30472 19.1368 8.99996 19.4182V21C8.99996 21.5523 9.44768 22 9.99996 22H14C14.5522 22 15 21.5523 15 21V19.4182C15.6952 19.1368 16.3415 18.7607 16.9229 18.3063L18.2942 19.0981C18.5239 19.2307 18.7968 19.2666 19.053 19.198C19.3092 19.1293 19.5276 18.9617 19.6602 18.7321L21.6602 15.268C21.7928 15.0383 21.8288 14.7653 21.7601 14.5091C21.6915 14.253 21.5239 14.0345 21.2942 13.9019L19.9234 13.1105C19.9739 12.7472 20 12.3764 20 12C20 11.6236 19.9739 11.2528 19.9234 10.8895L21.2942 10.0981C21.7725 9.82191 21.9364 9.21032 21.6602 8.73203L19.6602 5.26793C19.5276 5.03824 19.3092 4.87065 19.053 4.802C18.7968 4.73336 18.5239 4.76929 18.2942 4.9019L16.9229 5.69364C16.3415 5.23922 15.6952 4.86318 15 4.58178V3C15 2.44772 14.5522 2 14 2H9.99996ZM11 5.28986V4H13V5.28986C13 5.73228 13.2907 6.12211 13.7147 6.24831C14.6258 6.51947 15.4475 7.00198 16.1223 7.64029C16.4436 7.94424 16.9264 8.00099 17.3095 7.77984L18.4282 7.13395L19.4282 8.866L18.3109 9.51107C17.9281 9.73205 17.7358 10.1781 17.8379 10.6081C17.9437 11.0538 18 11.5197 18 12C18 12.4803 17.9437 12.9462 17.8379 13.3919C17.7358 13.8219 17.9281 14.2679 18.3109 14.4889L19.4282 15.134L18.4282 16.866L17.3094 16.2201C16.9264 15.999 16.4436 16.0557 16.1222 16.3597C15.4475 16.998 14.6258 17.4805 13.7147 17.7516C13.2907 17.8778 13 18.2677 13 18.7101V20H11V18.7101C11 18.2677 10.7092 17.8778 10.2852 17.7516C9.37409 17.4805 8.55246 16.998 7.87767 16.3597C7.55635 16.0557 7.07352 15.999 6.69048 16.2201L5.57176 16.866L4.57176 15.134L5.68905 14.4889C6.0718 14.2679 6.26409 13.8219 6.16201 13.3919C6.05621 12.9462 5.99997 12.4803 5.99997 12C5.99997 11.5197 6.0562 11.0538 6.16201 10.6081C6.26409 10.1781 6.07179 9.73207 5.68905 9.51109L4.57176 8.86603L5.57176 7.13398L6.69046 7.77986C7.07351 8.00101 7.55633 7.94425 7.87766 7.6403C8.55245 7.00199 9.37409 6.51948 10.2852 6.24831C10.7092 6.12211 11 5.73228 11 5.28986ZM9.99998 12C9.99998 10.8954 10.8954 10 12 10C13.1046 10 14 10.8954 14 12C14 13.1046 13.1046 14 12 14C10.8954 14 9.99998 13.1046 9.99998 12ZM12 8C9.79084 8 7.99998 9.79086 7.99998 12C7.99998 14.2091 9.79084 16 12 16C14.2091 16 16 14.2091 16 12C16 9.79086 14.2091 8 12 8Z" fill="#000000"/>
|
|
4
|
+
</svg>
|