@scaleflex/widget-pdftron 4.1.0 → 4.4.0
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/CHANGELOG.md +24 -0
- package/package.json +3 -3
- package/lib/Pdftron.js +0 -66
- package/lib/index.js +0 -80
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,30 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [4.4.0](https://code.scaleflex.cloud/scaleflex/widget/compare/v4.1.0...v4.4.0) (2025-10-07)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @scaleflex/widget-pdftron
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [4.3.0](https://code.scaleflex.cloud/scaleflex/widget/compare/v4.1.0...v4.3.0) (2025-10-02)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @scaleflex/widget-pdftron
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# [4.2.0](https://code.scaleflex.cloud/scaleflex/widget/compare/v4.1.0...v4.2.0) (2025-10-02)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @scaleflex/widget-pdftron
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
6
30
|
# [4.1.0](https://code.scaleflex.cloud/scaleflex/widget/compare/v4.0.8...v4.1.0) (2025-10-02)
|
|
7
31
|
|
|
8
32
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scaleflex/widget-pdftron",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.0",
|
|
4
4
|
"description": "PDFTRON integration with Scaleflex",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"@pdftron/webviewer": "^10.1.1",
|
|
17
17
|
"@scaleflex/icons": "^3.0.0-beta.11",
|
|
18
18
|
"@scaleflex/ui": "^3.0.0-beta.11",
|
|
19
|
-
"@scaleflex/widget-common": "^4.
|
|
19
|
+
"@scaleflex/widget-common": "^4.4.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"react": "^19.0.0",
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"react": ">=19.0.0",
|
|
29
29
|
"react-dom": ">=19.0.0"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "04b8ec545c4f10be89f5a44eed954acf8433360c"
|
|
32
32
|
}
|
package/lib/Pdftron.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
2
|
-
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."); }
|
|
3
|
-
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
4
|
-
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
5
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
-
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
7
|
-
import { useDispatch } from 'react-redux';
|
|
8
|
-
import { useState, useRef, useEffect } from 'react';
|
|
9
|
-
import WebViewer from '@pdftron/webviewer';
|
|
10
|
-
import { BackButton, PC, Spinner } from '@scaleflex/widget-common';
|
|
11
|
-
import { useExplorer } from '@scaleflex/widget-explorer/lib/hooks';
|
|
12
|
-
import handleError from '@scaleflex/widget-utils/lib/handleError';
|
|
13
|
-
import { useTheme } from '@scaleflex/ui/theme/hooks';
|
|
14
|
-
import { pdfFilePreviewOpened } from '@scaleflex/widget-explorer/lib/slices/panels.slice';
|
|
15
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
16
|
-
var Pdftron = function Pdftron(_ref) {
|
|
17
|
-
var pdfFilePreview = _ref.pdfFilePreview,
|
|
18
|
-
pdftronStaticPath = _ref.pdftronStaticPath;
|
|
19
|
-
var dispatch = useDispatch();
|
|
20
|
-
var _useExplorer = useExplorer(),
|
|
21
|
-
info = _useExplorer.info;
|
|
22
|
-
var theme = useTheme();
|
|
23
|
-
var _useState = useState(false),
|
|
24
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
25
|
-
isLoadingUI = _useState2[0],
|
|
26
|
-
setIsLoadingUI = _useState2[1];
|
|
27
|
-
var viewer = useRef(null);
|
|
28
|
-
var iconPrimaryColor = theme.palette[PC.IconsPrimary];
|
|
29
|
-
var closePreview = function closePreview() {
|
|
30
|
-
return dispatch(pdfFilePreviewOpened(null));
|
|
31
|
-
};
|
|
32
|
-
useEffect(function () {
|
|
33
|
-
var _pdfFilePreview$url;
|
|
34
|
-
setIsLoadingUI(true);
|
|
35
|
-
WebViewer({
|
|
36
|
-
path: pdftronStaticPath,
|
|
37
|
-
initialDoc: pdfFilePreview === null || pdfFilePreview === void 0 ? void 0 : (_pdfFilePreview$url = pdfFilePreview.url) === null || _pdfFilePreview$url === void 0 ? void 0 : _pdfFilePreview$url.cdn
|
|
38
|
-
}, viewer.current).then(function () {
|
|
39
|
-
setIsLoadingUI(false);
|
|
40
|
-
})["catch"](function (error) {
|
|
41
|
-
return handleError(error, info);
|
|
42
|
-
});
|
|
43
|
-
}, []);
|
|
44
|
-
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
45
|
-
children: [/*#__PURE__*/_jsxs("div", {
|
|
46
|
-
className: "filerobot-Explorer-FilePreview-bar",
|
|
47
|
-
children: [/*#__PURE__*/_jsx(BackButton, {
|
|
48
|
-
onClick: closePreview,
|
|
49
|
-
iconPrimaryColor: iconPrimaryColor,
|
|
50
|
-
hideDivider: true
|
|
51
|
-
}), /*#__PURE__*/_jsx("div", {
|
|
52
|
-
className: "filerobot-Explorer-FilePreview-bar-imageName",
|
|
53
|
-
children: pdfFilePreview.name
|
|
54
|
-
})]
|
|
55
|
-
}), isLoadingUI && /*#__PURE__*/_jsx(Spinner, {
|
|
56
|
-
fillContainer: true
|
|
57
|
-
}), /*#__PURE__*/_jsx("div", {
|
|
58
|
-
className: "webviewer",
|
|
59
|
-
ref: viewer,
|
|
60
|
-
style: {
|
|
61
|
-
height: '93%'
|
|
62
|
-
}
|
|
63
|
-
})]
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
export default Pdftron;
|
package/lib/index.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
-
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
6
|
-
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
7
|
-
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
8
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
9
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
10
|
-
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
|
-
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
12
|
-
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
13
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
14
|
-
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
15
|
-
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
16
|
-
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
17
|
-
import { Plugin } from '@scaleflex/widget-core';
|
|
18
|
-
import Explorer from '@scaleflex/widget-explorer';
|
|
19
|
-
import Translator from '@scaleflex/widget-utils/lib/Translator';
|
|
20
|
-
import { PLUGINS_IDS } from '@scaleflex/widget-utils/lib/constants';
|
|
21
|
-
import PdftronUI from './Pdftron';
|
|
22
|
-
// TODO: find a way to show version of the current plugin
|
|
23
|
-
// why solution below isn't good?
|
|
24
|
-
// first import doesn't work with webpack 5 as it was deprecated
|
|
25
|
-
// second import fixes webpack 5 issue as it was mentioned in their docs
|
|
26
|
-
// but it exposes our package.json to the client and it is mentioned as security rist in mutiple places
|
|
27
|
-
// https://github.com/axelpale/genversion
|
|
28
|
-
// https://stackoverflow.com/questions/64993118/error-should-not-import-the-named-export-version-imported-as-version
|
|
29
|
-
// https://stackoverflow.com/questions/9153571/is-there-a-way-to-get-version-from-package-json-in-nodejs-code/10855054#10855054
|
|
30
|
-
// import { version } from '../package.json'
|
|
31
|
-
// import packageInfo from '../package.json'
|
|
32
|
-
var Pdftron = /*#__PURE__*/function (_Plugin) {
|
|
33
|
-
// static VERSION = packageInfo.version
|
|
34
|
-
|
|
35
|
-
function Pdftron(filerobot) {
|
|
36
|
-
var _this;
|
|
37
|
-
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
38
|
-
_classCallCheck(this, Pdftron);
|
|
39
|
-
_this = _callSuper(this, Pdftron, [filerobot, opts]);
|
|
40
|
-
_this.id = PLUGINS_IDS.PDFTRON;
|
|
41
|
-
_this.title = 'Pdftron';
|
|
42
|
-
_this.type = 'editor';
|
|
43
|
-
_this.opts = _objectSpread({
|
|
44
|
-
pdftronStaticPath: ''
|
|
45
|
-
}, opts);
|
|
46
|
-
_this.i18nInit();
|
|
47
|
-
return _this;
|
|
48
|
-
}
|
|
49
|
-
_inherits(Pdftron, _Plugin);
|
|
50
|
-
return _createClass(Pdftron, [{
|
|
51
|
-
key: "i18nInit",
|
|
52
|
-
value: function i18nInit() {
|
|
53
|
-
this.translator = new Translator([this.defaultLocale, this.filerobot.locale, this.opts.locale]);
|
|
54
|
-
this.i18n = this.translator.translate.bind(this.translator);
|
|
55
|
-
this.i18nArray = this.translator.translateArray.bind(this.translator);
|
|
56
|
-
}
|
|
57
|
-
}, {
|
|
58
|
-
key: "install",
|
|
59
|
-
value: function install() {
|
|
60
|
-
if (Explorer) {
|
|
61
|
-
this.mount(Explorer, this);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}, {
|
|
65
|
-
key: "uninstall",
|
|
66
|
-
value: function uninstall() {
|
|
67
|
-
this.unmount();
|
|
68
|
-
}
|
|
69
|
-
}, {
|
|
70
|
-
key: "render",
|
|
71
|
-
value: function render(_ref) {
|
|
72
|
-
var pdfFilePreview = _ref.pdfFilePreview;
|
|
73
|
-
return PdftronUI({
|
|
74
|
-
pdfFilePreview: pdfFilePreview,
|
|
75
|
-
pdftronStaticPath: this.opts.pdftronStaticPath
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
}]);
|
|
79
|
-
}(Plugin);
|
|
80
|
-
export default Pdftron;
|