@iobroker/adapter-react-v5 3.4.3 → 3.4.5

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.
@@ -200,40 +200,8 @@ declare class Utils {
200
200
  * @param {boolean} [noCommon]
201
201
  */
202
202
  static disableSmartName(obj: ioBroker.StateObject, instanceId: string, noCommon?: boolean): void;
203
- /**
204
- * MIT License
205
- *
206
- * Copyright (c) 2017 sudodoki <smd.deluzion@gmail.com>
207
- *
208
- * Permission is hereby granted, free of charge, to any person obtaining a copy
209
- * of this software and associated documentation files (the "Software"), to deal
210
- * in the Software without restriction, including without limitation the rights
211
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
212
- * copies of the Software, and to permit persons to whom the Software is
213
- * furnished to do so, subject to the following conditions:
214
- *
215
- * The above copyright notice and this permission notice shall be included in all
216
- * copies or substantial portions of the Software.
217
- *
218
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
219
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
220
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
221
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
222
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
223
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
224
- * SOFTWARE.
225
- */
226
- static _toggleSelection(): () => void;
227
- /**
228
- * MIT License
229
- *
230
- * Copyright (c) 2017 sudodoki <smd.deluzion@gmail.com>
231
- *
232
- * Text see above
233
- */
234
203
  /**
235
204
  * Copy text to the clipboard.
236
- * Coped from copy-to-clipboard module:
237
205
  * @param {string} text
238
206
  * @param {Event} [e]
239
207
  */
@@ -5,13 +5,13 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports["default"] = void 0;
8
- var _readOnlyError2 = _interopRequireDefault(require("@babel/runtime/helpers/readOnlyError"));
9
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
9
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
11
10
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
12
11
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
12
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
13
  var _react = _interopRequireDefault(require("react"));
14
+ var _copyToClipboard = _interopRequireDefault(require("./copy-to-clipboard"));
15
15
  var _i18n = _interopRequireDefault(require("../i18n"));
16
16
  /**
17
17
  * Copyright 2018-2022 bluefox <dogafox@gmail.com>
@@ -980,74 +980,8 @@ var Utils = /*#__PURE__*/function () {
980
980
  }
981
981
  }
982
982
 
983
- // copied from https://github.com/sudodoki/toggle-selection
984
- /**
985
- * MIT License
986
- *
987
- * Copyright (c) 2017 sudodoki <smd.deluzion@gmail.com>
988
- *
989
- * Permission is hereby granted, free of charge, to any person obtaining a copy
990
- * of this software and associated documentation files (the "Software"), to deal
991
- * in the Software without restriction, including without limitation the rights
992
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
993
- * copies of the Software, and to permit persons to whom the Software is
994
- * furnished to do so, subject to the following conditions:
995
- *
996
- * The above copyright notice and this permission notice shall be included in all
997
- * copies or substantial portions of the Software.
998
- *
999
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1000
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1001
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1002
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1003
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1004
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1005
- * SOFTWARE.
1006
- */
1007
- }, {
1008
- key: "_toggleSelection",
1009
- value: function _toggleSelection() {
1010
- var selection = document.getSelection();
1011
- if (!selection.rangeCount) {
1012
- return function () {};
1013
- }
1014
- var active = document.activeElement;
1015
- var ranges = [];
1016
- for (var i = 0; i < selection.rangeCount; i++) {
1017
- ranges.push(selection.getRangeAt(i));
1018
- }
1019
- switch (active.tagName.toUpperCase()) {
1020
- // .toUpperCase handles XHTML
1021
- case 'INPUT':
1022
- case 'TEXTAREA':
1023
- active.blur();
1024
- break;
1025
- default:
1026
- null, (0, _readOnlyError2["default"])("active");
1027
- break;
1028
- }
1029
- selection.removeAllRanges();
1030
- return function () {
1031
- selection.type === 'Caret' && selection.removeAllRanges();
1032
- if (!selection.rangeCount) {
1033
- ranges.forEach(function (range) {
1034
- return selection.addRange(range);
1035
- });
1036
- }
1037
- active && active.focus();
1038
- };
1039
- }
1040
-
1041
- /**
1042
- * MIT License
1043
- *
1044
- * Copyright (c) 2017 sudodoki <smd.deluzion@gmail.com>
1045
- *
1046
- * Text see above
1047
- */
1048
983
  /**
1049
984
  * Copy text to the clipboard.
1050
- * Coped from copy-to-clipboard module:
1051
985
  * @param {string} text
1052
986
  * @param {Event} [e]
1053
987
  */
@@ -1056,62 +990,7 @@ var Utils = /*#__PURE__*/function () {
1056
990
  value: function copyToClipboard(text, e) {
1057
991
  e && e.stopPropagation();
1058
992
  e && e.preventDefault();
1059
- var reselectPrevious;
1060
- var range;
1061
- var selection;
1062
- var mark;
1063
- var success = false;
1064
- try {
1065
- reselectPrevious = Utils._toggleSelection();
1066
- range = document.createRange();
1067
- selection = document.getSelection();
1068
- mark = document.createElement('span');
1069
- mark.textContent = text;
1070
- // avoid screen readers from reading out loud the text
1071
- mark.ariaHidden = 'true';
1072
- // reset user styles for span element
1073
- mark.style.all = 'unset';
1074
- // prevents scrolling to the end of the page
1075
- mark.style.position = 'fixed';
1076
- mark.style.top = 0;
1077
- mark.style.clip = 'rect(0, 0, 0, 0)';
1078
- // used to preserve spaces and line breaks
1079
- mark.style.whiteSpace = 'pre';
1080
- // do not inherit user-select (it may be `none`)
1081
- mark.style.webkitUserSelect = 'text';
1082
- mark.style.MozUserSelect = 'text';
1083
- mark.style.msUserSelect = 'text';
1084
- mark.style.userSelect = 'text';
1085
- mark.addEventListener('copy', function (e) {
1086
- return e.stopPropagation();
1087
- });
1088
- document.body.appendChild(mark);
1089
- range.selectNodeContents(mark);
1090
- selection.addRange(range);
1091
- var successful = document.execCommand('copy');
1092
- if (!successful) {
1093
- throw new Error('copy command was unsuccessful');
1094
- }
1095
- success = true;
1096
- } catch (err) {
1097
- try {
1098
- window.clipboardData.setData('text', text);
1099
- success = true;
1100
- } catch (err) {}
1101
- } finally {
1102
- if (selection) {
1103
- if (typeof selection.removeRange === 'function') {
1104
- selection.removeRange(range);
1105
- } else {
1106
- selection.removeAllRanges();
1107
- }
1108
- }
1109
- if (mark) {
1110
- document.body.removeChild(mark);
1111
- }
1112
- reselectPrevious();
1113
- }
1114
- return success;
993
+ return (0, _copyToClipboard["default"])(text);
1115
994
  }
1116
995
 
1117
996
  /**