@uxf/wysiwyg 11.128.0 → 11.128.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxf/wysiwyg",
3
- "version": "11.128.0",
3
+ "version": "11.128.2",
4
4
  "description": "UXF Wysiwyg editor",
5
5
  "author": "Robin Dvorak <dvorak@uxf.cz>",
6
6
  "homepage": "https://gitlab.com/uxf-npm/wysiwyg",
@@ -33,7 +33,7 @@
33
33
  "@udecode/slate-utils": "19.7.1",
34
34
  "@uxf/core": "11.128.0",
35
35
  "@uxf/core-react": "11.128.0",
36
- "@uxf/ui": "11.128.0",
36
+ "@uxf/ui": "11.128.1",
37
37
  "react": ">=18.2.0",
38
38
  "react-dom": ">=18.2.0",
39
39
  "slate": "0.90.0",
@@ -64,7 +64,7 @@
64
64
  "@udecode/slate-utils": "19.7.1",
65
65
  "@uxf/core": "11.128.0",
66
66
  "@uxf/core-react": "11.128.0",
67
- "@uxf/ui": "11.128.0",
67
+ "@uxf/ui": "11.128.1",
68
68
  "react": "18.3.1",
69
69
  "react-dom": "18.3.1",
70
70
  "slate": "0.90.0",
package/wysiwyg-editor.js CHANGED
@@ -77,8 +77,7 @@ const Editor = (props) => {
77
77
  spellCheck: false,
78
78
  ...props.editableProps,
79
79
  className: `${CLASS_NAME}__editable ${(_b = (_a = props.editableProps) === null || _a === void 0 ? void 0 : _a.className) !== null && _b !== void 0 ? _b : ""}`,
80
- }, id: props.plateId, normalizeInitialValue: true }),
81
- props.editorRef && react_1.default.createElement(EditorRefHandler, { ref: props.editorRef }))));
80
+ }, id: props.plateId, normalizeInitialValue: true }, props.editorRef && react_1.default.createElement(EditorRefHandler, { ref: props.editorRef })))));
82
81
  };
83
82
  const WysiwygEditor = (props) => {
84
83
  var _a, _b;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ const react_1 = require("@testing-library/react");
37
+ const context_1 = require("@uxf/ui/context");
38
+ const react_2 = __importStar(require("react"));
39
+ const create_all_plugins_with_ui_1 = require("./create-all-plugins-with-ui");
40
+ const create_plugins_with_ui_1 = require("./create-plugins-with-ui");
41
+ const wysiwyg_editor_1 = require("./wysiwyg-editor");
42
+ const UI_CONTEXT = {
43
+ colorScheme: {
44
+ defaultColorScheme: "light",
45
+ getUserSettings: () => "light",
46
+ respectSystemSetting: false,
47
+ respectUserSettings: false,
48
+ setUserSettings: () => undefined,
49
+ },
50
+ domain: "http://localhost",
51
+ icon: {
52
+ // Any name resolves, so the toolbar's icons do not warn no matter which plugins are enabled.
53
+ iconsConfig: new Proxy({}, { get: () => ({ h: 16, w: 16 }), has: () => true }),
54
+ spriteFilePath: "/sprite.svg",
55
+ },
56
+ localeConfig: { locale: "en" },
57
+ rasterImage: { breakpoints: {} },
58
+ translationFn: (key) => key,
59
+ };
60
+ const INITIAL_VALUE = [{ type: "paragraph", children: [{ text: "hello" }] }];
61
+ function renderEditor(editorRef) {
62
+ return (0, react_1.render)(react_2.default.createElement(context_1.UiContextProvider, { value: UI_CONTEXT },
63
+ react_2.default.createElement(wysiwyg_editor_1.WysiwygEditor, { editorRef: editorRef, id: "test-editor", initialValue: INITIAL_VALUE, onChange: () => undefined, plugins: (0, create_plugins_with_ui_1.createPluginsWithUi)([(0, create_all_plugins_with_ui_1.createBoldPluginWithUi)()]) })));
64
+ }
65
+ describe("WysiwygEditor", () => {
66
+ it("renders without an editorRef", () => {
67
+ const { container } = renderEditor();
68
+ expect(container.querySelector(".uxf-wysiwyg__editable")).not.toBeNull();
69
+ });
70
+ it("exposes focus() through editorRef", () => {
71
+ var _a;
72
+ const editorRef = (0, react_2.createRef)();
73
+ renderEditor(editorRef);
74
+ expect(typeof ((_a = editorRef.current) === null || _a === void 0 ? void 0 : _a.focus)).toBe("function");
75
+ });
76
+ });