@pnkx-lib/ui 1.9.361 → 1.9.363

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.
@@ -1282,7 +1282,7 @@ var eventPropTypes = {
1282
1282
  onScriptsLoad: propTypesExports.func,
1283
1283
  onScriptsLoadError: propTypesExports.func,
1284
1284
  };
1285
- var EditorPropTypes = __assign$2({ apiKey: propTypesExports.string, licenseKey: propTypesExports.string, id: propTypesExports.string, inline: propTypesExports.bool, init: propTypesExports.object, initialValue: propTypesExports.string, onEditorChange: propTypesExports.func, value: propTypesExports.string, tagName: propTypesExports.string, tabIndex: propTypesExports.number, cloudChannel: propTypesExports.string, plugins: propTypesExports.oneOfType([propTypesExports.string, propTypesExports.array]), toolbar: propTypesExports.oneOfType([propTypesExports.string, propTypesExports.array]), disabled: propTypesExports.bool, textareaName: propTypesExports.string, tinymceScriptSrc: propTypesExports.oneOfType([
1285
+ var EditorPropTypes = __assign$2({ apiKey: propTypesExports.string, licenseKey: propTypesExports.string, id: propTypesExports.string, inline: propTypesExports.bool, init: propTypesExports.object, initialValue: propTypesExports.string, onEditorChange: propTypesExports.func, value: propTypesExports.string, tagName: propTypesExports.string, tabIndex: propTypesExports.number, cloudChannel: propTypesExports.string, plugins: propTypesExports.oneOfType([propTypesExports.string, propTypesExports.array]), toolbar: propTypesExports.oneOfType([propTypesExports.string, propTypesExports.array]), disabled: propTypesExports.bool, readonly: propTypesExports.bool, textareaName: propTypesExports.string, tinymceScriptSrc: propTypesExports.oneOfType([
1286
1286
  propTypesExports.string,
1287
1287
  propTypesExports.arrayOf(propTypesExports.string),
1288
1288
  propTypesExports.arrayOf(propTypesExports.shape({
@@ -1296,6 +1296,11 @@ var EditorPropTypes = __assign$2({ apiKey: propTypesExports.string, licenseKey:
1296
1296
  delay: propTypesExports.number
1297
1297
  }) }, eventPropTypes);
1298
1298
 
1299
+ var getTinymce = function (view) {
1300
+ var global = view;
1301
+ return global && global.tinymce ? global.tinymce : null;
1302
+ };
1303
+
1299
1304
  var isFunction = function (x) { return typeof x === 'function'; };
1300
1305
  var isEventProp = function (name) { return name in eventPropTypes; };
1301
1306
  var eventAttrToEventName = function (attrName) { return attrName.substr(2); };
@@ -1365,6 +1370,14 @@ var setMode = function (editor, mode) {
1365
1370
  }
1366
1371
  }
1367
1372
  };
1373
+ var getTinymceOrError = function (view) {
1374
+ var tinymce = getTinymce(view);
1375
+ if (!tinymce) {
1376
+ throw new Error('tinymce should have been loaded into global scope');
1377
+ }
1378
+ return tinymce;
1379
+ };
1380
+ var isDisabledOptionSupported = function (editor) { return editor.options && editor.options.isRegistered('disabled'); };
1368
1381
 
1369
1382
  var __assign$1 = (undefined && undefined.__assign) || function () {
1370
1383
  __assign$1 = Object.assign || function(t) {
@@ -1509,11 +1522,6 @@ var createScriptLoader = function () {
1509
1522
  };
1510
1523
  var ScriptLoader = createScriptLoader();
1511
1524
 
1512
- var getTinymce = function (view) {
1513
- var global = view;
1514
- return global && global.tinymce ? global.tinymce : null;
1515
- };
1516
-
1517
1525
  var __extends = (undefined && undefined.__extends) || (function () {
1518
1526
  var extendStatics = function (d, b) {
1519
1527
  extendStatics = Object.setPrototypeOf ||
@@ -1634,11 +1642,8 @@ var Editor = /** @class */ (function (_super) {
1634
1642
  }
1635
1643
  return;
1636
1644
  }
1637
- var tinymce = getTinymce(_this.view);
1638
- if (!tinymce) {
1639
- throw new Error('tinymce should have been loaded into global scope');
1640
- }
1641
- var finalInit = __assign(__assign(__assign(__assign({}, _this.props.init), { selector: undefined, target: target, readonly: _this.props.disabled, inline: _this.inline, plugins: mergePlugins((_a = _this.props.init) === null || _a === void 0 ? void 0 : _a.plugins, _this.props.plugins), toolbar: (_b = _this.props.toolbar) !== null && _b !== void 0 ? _b : (_c = _this.props.init) === null || _c === void 0 ? void 0 : _c.toolbar }), (_this.props.licenseKey ? { license_key: _this.props.licenseKey } : {})), { setup: function (editor) {
1645
+ var tinymce = getTinymceOrError(_this.view);
1646
+ var finalInit = __assign(__assign(__assign(__assign({}, _this.props.init), { selector: undefined, target: target, disabled: _this.props.disabled, readonly: _this.props.readonly, inline: _this.inline, plugins: mergePlugins((_a = _this.props.init) === null || _a === void 0 ? void 0 : _a.plugins, _this.props.plugins), toolbar: (_b = _this.props.toolbar) !== null && _b !== void 0 ? _b : (_c = _this.props.init) === null || _c === void 0 ? void 0 : _c.toolbar }), (_this.props.licenseKey ? { license_key: _this.props.licenseKey } : {})), { setup: function (editor) {
1642
1647
  _this.editor = editor;
1643
1648
  _this.bindHandlers({});
1644
1649
  // When running in inline mode the editor gets the initial value
@@ -1655,8 +1660,16 @@ var Editor = /** @class */ (function (_super) {
1655
1660
  if (_this.props.init && isFunction(_this.props.init.setup)) {
1656
1661
  _this.props.init.setup(editor);
1657
1662
  }
1663
+ if (_this.props.disabled) {
1664
+ if (isDisabledOptionSupported(_this.editor)) {
1665
+ _this.editor.options.set('disabled', _this.props.disabled);
1666
+ }
1667
+ else {
1668
+ _this.editor.mode.set('readonly');
1669
+ }
1670
+ }
1658
1671
  }, init_instance_callback: function (editor) {
1659
- var _a, _b;
1672
+ var _a;
1660
1673
  // check for changes that happened since tinymce.init() was called
1661
1674
  var initialValue = _this.getInitialValue();
1662
1675
  _this.currentContent = (_a = _this.currentContent) !== null && _a !== void 0 ? _a : editor.getContent();
@@ -1668,8 +1681,6 @@ var Editor = /** @class */ (function (_super) {
1668
1681
  editor.undoManager.add();
1669
1682
  editor.setDirty(false);
1670
1683
  }
1671
- var disabled = (_b = _this.props.disabled) !== null && _b !== void 0 ? _b : false;
1672
- setMode(_this.editor, disabled ? 'readonly' : 'design');
1673
1684
  // ensure existing init_instance_callback is called
1674
1685
  if (_this.props.init && isFunction(_this.props.init.init_instance_callback)) {
1675
1686
  _this.props.init.init_instance_callback(editor);
@@ -1747,9 +1758,17 @@ var Editor = /** @class */ (function (_super) {
1747
1758
  }
1748
1759
  });
1749
1760
  }
1761
+ if (this.props.readonly !== prevProps.readonly) {
1762
+ var readonly = (_b = this.props.readonly) !== null && _b !== void 0 ? _b : false;
1763
+ setMode(this.editor, readonly ? 'readonly' : 'design');
1764
+ }
1750
1765
  if (this.props.disabled !== prevProps.disabled) {
1751
- var disabled = (_b = this.props.disabled) !== null && _b !== void 0 ? _b : false;
1752
- setMode(this.editor, disabled ? 'readonly' : 'design');
1766
+ if (isDisabledOptionSupported(this.editor)) {
1767
+ this.editor.options.set('disabled', this.props.disabled);
1768
+ }
1769
+ else {
1770
+ setMode(this.editor, this.props.disabled ? 'readonly' : 'design');
1771
+ }
1753
1772
  }
1754
1773
  }
1755
1774
  }
package/es/ui/Button.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { Button as Button$1 } from 'antd';
3
- import { t as twMerge } from '../chunks/bundle-mjs-BBFHkixS.js';
3
+ import { t as twMerge } from '../chunks/bundle-mjs-BME7zF0Z.js';
4
4
 
5
5
  const Button = (props) => {
6
6
  const { onClick, ...restProps } = props;
package/es/ui/Cascader.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { Cascader } from 'antd';
3
- import { t as twMerge } from '../chunks/bundle-mjs-BBFHkixS.js';
3
+ import { t as twMerge } from '../chunks/bundle-mjs-BME7zF0Z.js';
4
4
 
5
5
  const CascaderField = (props) => {
6
6
  const {
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { t as twMerge } from '../chunks/bundle-mjs-BBFHkixS.js';
2
+ import { t as twMerge } from '../chunks/bundle-mjs-BME7zF0Z.js';
3
3
 
4
4
  var CATEGORY_LIST_ENUM = /* @__PURE__ */ ((CATEGORY_LIST_ENUM2) => {
5
5
  CATEGORY_LIST_ENUM2[CATEGORY_LIST_ENUM2["DRAFT"] = 0] = "DRAFT";
@@ -1,5 +1,5 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import { t as twMerge } from '../chunks/bundle-mjs-BBFHkixS.js';
2
+ import { t as twMerge } from '../chunks/bundle-mjs-BME7zF0Z.js';
3
3
 
4
4
  const Container = ({
5
5
  children,
package/es/ui/Label.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { t as twMerge } from '../chunks/bundle-mjs-BBFHkixS.js';
2
+ import { t as twMerge } from '../chunks/bundle-mjs-BME7zF0Z.js';
3
3
  import { Typography } from './Typography.js';
4
4
 
5
5
  const Label = ({ label, required, classNameLabel }) => {
package/es/ui/Layout.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import { S as SiderContext, a as Sider, C as Content, F as Footer, H as Header, L as Layout$1 } from '../chunks/layout-C0dbwkpb.js';
2
+ import { S as SiderContext, a as Sider, C as Content, F as Footer, H as Header, L as Layout$1 } from '../chunks/layout-2jUdRxjk.js';
3
3
 
4
4
  const LayoutComponent = ({
5
5
  layoutClassName,
package/es/ui/Modal.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { Modal as Modal$1 } from 'antd';
3
- import { t as twMerge } from '../chunks/bundle-mjs-BBFHkixS.js';
3
+ import { t as twMerge } from '../chunks/bundle-mjs-BME7zF0Z.js';
4
4
 
5
5
  const widthMap = {
6
6
  xs: 400,
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { u as useForm } from '../chunks/index.esm-o4O8pXMN.js';
2
+ import { u as useForm } from '../chunks/index.esm-AaUjBMaK.js';
3
3
  import { Button } from './Button.js';
4
4
  import { I as Icon, _ as _extends } from '../chunks/AntdIcon-gUuMvf83.js';
5
5
  import * as React from 'react';