tenjin-ui-kit 0.3.53 → 0.3.54

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.
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
  var _rte = require("@mantine/rte");
10
- var _excluded = ["controls"];
10
+ var _excluded = ["controls", "readOnly"];
11
11
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
12
12
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
13
13
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
@@ -20,6 +20,8 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
20
20
  var RichTextEditorTest = function RichTextEditorTest(_ref) {
21
21
  var _ref$controls = _ref.controls,
22
22
  controls = _ref$controls === void 0 ? {} : _ref$controls,
23
+ _ref$readOnly = _ref.readOnly,
24
+ readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
23
25
  props = _objectWithoutProperties(_ref, _excluded);
24
26
  // By default everything is enabled
25
27
  var defaultControls = {
@@ -38,6 +40,9 @@ var RichTextEditorTest = function RichTextEditorTest(_ref) {
38
40
  alignRight: true
39
41
  };
40
42
  var editorControls = (0, _react.useMemo)(function () {
43
+ if (readOnly) {
44
+ return [];
45
+ }
41
46
  var finalControls = _objectSpread(_objectSpread({}, defaultControls), controls);
42
47
  return [["bold", "italic", "underline"].filter(function (c) {
43
48
  return finalControls[c];
@@ -52,7 +57,7 @@ var RichTextEditorTest = function RichTextEditorTest(_ref) {
52
57
  })].filter(function (group) {
53
58
  return group.length > 0;
54
59
  });
55
- }, [controls]);
60
+ }, [controls, readOnly]);
56
61
  var mentions = (0, _react.useMemo)(function () {
57
62
  return {
58
63
  allowedChars: /^[A-Za-z\sÅÄÖåäö]*$/,
@@ -70,7 +75,8 @@ var RichTextEditorTest = function RichTextEditorTest(_ref) {
70
75
  controls: editorControls,
71
76
  value: props.value,
72
77
  onChange: props.onChange,
73
- mentions: props.mentions && mentions
78
+ mentions: props.mentions && mentions,
79
+ readOnly: readOnly
74
80
  }));
75
81
  };
76
82
  var _default = RichTextEditorTest;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tenjin-ui-kit",
3
- "version": "0.3.53",
3
+ "version": "0.3.54",
4
4
  "repository": {
5
5
  "url": "https://gitlab.com/yethi/react/tenjin-ui-kit.git"
6
6
  },