@uxf/wysiwyg 11.6.0 → 11.7.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/README.md ADDED
@@ -0,0 +1,14 @@
1
+ # Wysiwyg
2
+
3
+ ## Installation
4
+
5
+ ```bash
6
+ yarn add @uxf/core @uxf/ui @uxf/wysiwyg
7
+ ```
8
+
9
+ ## CSS Dependencies
10
+
11
+ ```css
12
+ /** link plugin css */
13
+ @import url("@uxf/wysiwyg/styles/base.css");
14
+ ```
@@ -0,0 +1,7 @@
1
+ import * as wysiwygEditorStories from "./wysiwyg-editor.stories";
2
+ export declare const components: {
3
+ readonly "wysiwyg-editor": {
4
+ readonly title: "WysiwygEditor";
5
+ readonly stories: typeof wysiwygEditorStories;
6
+ };
7
+ };
package/components.js ADDED
@@ -0,0 +1,34 @@
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 (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.components = void 0;
27
+ // generated file
28
+ const wysiwygEditorStories = __importStar(require("./wysiwyg-editor.stories"));
29
+ exports.components = {
30
+ "wysiwyg-editor": {
31
+ title: "WysiwygEditor",
32
+ stories: wysiwygEditorStories
33
+ },
34
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxf/wysiwyg",
3
- "version": "11.6.0",
3
+ "version": "11.7.0",
4
4
  "description": "UXF Wysiwyg editor",
5
5
  "author": "Robin Dvorak <dvorak@uxf.cz>",
6
6
  "homepage": "https://gitlab.com/uxf-npm/wysiwyg",
@@ -28,7 +28,7 @@
28
28
  "@udecode/plate-select": "20.7.2",
29
29
  "@udecode/plate-trailing-block": "20.7.2",
30
30
  "@uxf/core": "10.0.0",
31
- "@uxf/ui": "11.6.0",
31
+ "@uxf/ui": "11.7.0",
32
32
  "slate": "0.90.0",
33
33
  "slate-history": "0.86.0",
34
34
  "slate-hyperscript": "0.77.0",
@@ -10,7 +10,7 @@ exports.FloatingLinkEditRoot = (0, plate_common_1.createComponentAs)((props) =>
10
10
  if (((_a = htmlProps.style) === null || _a === void 0 ? void 0 : _a.display) === "none") {
11
11
  return null;
12
12
  }
13
- return (0, plate_common_1.createElementAs)("div", { ...htmlProps, style: { ...htmlProps.style, zIndex: tw_z_index_1.twZIndex.fixed } });
13
+ return (0, plate_common_1.createElementAs)("div", { ...htmlProps, style: { ...htmlProps.style, zIndex: tw_z_index_1.twZIndex.modal } });
14
14
  });
15
15
  exports.FloatingLinkInsertRoot = (0, plate_common_1.createComponentAs)((props) => {
16
16
  var _a;
@@ -18,7 +18,7 @@ exports.FloatingLinkInsertRoot = (0, plate_common_1.createComponentAs)((props) =
18
18
  if (((_a = htmlProps.style) === null || _a === void 0 ? void 0 : _a.display) === "none") {
19
19
  return null;
20
20
  }
21
- return (0, plate_common_1.createElementAs)("div", { ...htmlProps, style: { ...htmlProps.style, zIndex: tw_z_index_1.twZIndex.fixed } });
21
+ return (0, plate_common_1.createElementAs)("div", { ...htmlProps, style: { ...htmlProps.style, zIndex: tw_z_index_1.twZIndex.modal } });
22
22
  });
23
23
  exports.FloatingLinkWrapper = {
24
24
  EditRoot: exports.FloatingLinkEditRoot,
@@ -0,0 +1,5 @@
1
+ import { WysiwygContent } from "@uxf/wysiwyg";
2
+ import React from "react";
3
+ export declare const initialValue: WysiwygContent;
4
+ export declare function Playground(): React.JSX.Element;
5
+ export declare function SelectedPlugins(): React.JSX.Element;
@@ -0,0 +1,190 @@
1
+ "use strict";
2
+ "use client";
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || function (mod) {
20
+ if (mod && mod.__esModule) return mod;
21
+ var result = {};
22
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
23
+ __setModuleDefault(result, mod);
24
+ return result;
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.SelectedPlugins = exports.Playground = exports.initialValue = void 0;
28
+ const wysiwyg_1 = require("@uxf/wysiwyg");
29
+ const dynamic_no_ssr_1 = require("next/dist/shared/lib/lazy-dynamic/dynamic-no-ssr");
30
+ const react_1 = __importStar(require("react"));
31
+ exports.initialValue = [
32
+ {
33
+ type: "h1",
34
+ id: "mnlt6",
35
+ children: [{ text: "Nadpis H1" }],
36
+ },
37
+ {
38
+ type: "h2",
39
+ id: "feu6s",
40
+ children: [{ text: "Nadpis H2" }],
41
+ },
42
+ {
43
+ type: "h3",
44
+ id: "i9cb4",
45
+ children: [{ text: "Nadpis H3" }],
46
+ },
47
+ {
48
+ type: "h4",
49
+ id: "967c7",
50
+ children: [{ text: "Nadpis H4" }],
51
+ },
52
+ {
53
+ type: "h5",
54
+ id: "4kyki",
55
+ children: [{ text: "Nadpis H5" }],
56
+ },
57
+ {
58
+ type: "h6",
59
+ id: "ximag",
60
+ children: [{ text: "Nadpis H6" }],
61
+ },
62
+ {
63
+ type: "paragraph",
64
+ id: "xnws3",
65
+ children: [
66
+ { text: "Toto je odstavec. " },
67
+ { type: "link", id: "j4bh1", url: "https://uxf.cz", target: "_blank", children: [{ text: "uxf.cz" }] },
68
+ { text: " " },
69
+ { text: "tučné ", bold: true },
70
+ { text: "kurzíva ", italic: true },
71
+ { text: "podtržení", underline: true },
72
+ { text: " kód", code: true },
73
+ { text: " " },
74
+ { text: "zvýraznění", highlight: true },
75
+ ],
76
+ },
77
+ {
78
+ type: "block-quote",
79
+ id: "imx33",
80
+ children: [{ text: "Toto je citace." }],
81
+ },
82
+ {
83
+ type: "ul",
84
+ id: "aq7rl",
85
+ children: [
86
+ {
87
+ type: "li",
88
+ id: "b8ljb",
89
+ children: [
90
+ {
91
+ type: "lic",
92
+ id: "az5v2",
93
+ children: [{ text: "Položka nečíslovaného seznamu" }],
94
+ },
95
+ ],
96
+ },
97
+ {
98
+ type: "li",
99
+ id: "nq1e3",
100
+ children: [{ type: "lic", id: "dp5er", children: [{ text: "Druhá položka" }] }],
101
+ },
102
+ ],
103
+ },
104
+ {
105
+ type: "ol",
106
+ id: "hioy1",
107
+ children: [
108
+ {
109
+ type: "li",
110
+ id: "wm2vd",
111
+ children: [{ type: "lic", id: "q5ynx", children: [{ text: "Položka číslovaného seznamu" }] }],
112
+ },
113
+ {
114
+ type: "li",
115
+ id: "5qjr0",
116
+ children: [{ type: "lic", id: "8u41x", children: [{ text: "Druhá položka" }] }],
117
+ },
118
+ ],
119
+ },
120
+ {
121
+ type: "paragraph",
122
+ id: "9013p",
123
+ children: [
124
+ {
125
+ text: "Pokud vypneš nějaký plugin, zobrazení je nefunkční, ale v JSONu pořád je, protože je v initial values.",
126
+ },
127
+ ],
128
+ },
129
+ ];
130
+ function Playground() {
131
+ const [value, setValue] = (0, react_1.useState)(exports.initialValue);
132
+ const plugins = (0, wysiwyg_1.createPluginsWithUi)([
133
+ (0, wysiwyg_1.createHeadingsPluginWithUi)({ disabledLevels: [1] }),
134
+ (0, wysiwyg_1.createBoldPluginWithUi)(),
135
+ (0, wysiwyg_1.createImagePluginWithUi)({
136
+ uploadImage: async (file) => ({
137
+ id: 1,
138
+ name: URL.createObjectURL(file),
139
+ extension: ".ext",
140
+ namespace: "wysiwyg",
141
+ uuid: "this-should-be-some-random-uuid",
142
+ }),
143
+ getImageUrl: (file) => file.name,
144
+ }),
145
+ (0, wysiwyg_1.createHighlightPluginWithUi)("red"),
146
+ ]);
147
+ return (react_1.default.createElement(react_1.default.Fragment, null,
148
+ react_1.default.createElement(wysiwyg_1.WysiwygEditor, { id: "editor", initialValue: exports.initialValue, onChange: setValue, plugins: plugins }),
149
+ react_1.default.createElement("div", { className: "relative mt-4" },
150
+ react_1.default.createElement("div", { className: "absolute inset-0 flex items-center", "aria-hidden": "true" },
151
+ react_1.default.createElement("div", { className: "w-full border-t border-gray-300" })),
152
+ react_1.default.createElement("div", { className: "relative flex justify-center" },
153
+ react_1.default.createElement("span", { className: "bg-white px-2 text-sm text-gray-500" }, "Value"))),
154
+ react_1.default.createElement(dynamic_no_ssr_1.NoSSR, null,
155
+ react_1.default.createElement("pre", null,
156
+ react_1.default.createElement("code", null, JSON.stringify(value, null, " "))))));
157
+ }
158
+ exports.Playground = Playground;
159
+ function SelectedPlugins() {
160
+ const _initialValues = [
161
+ { type: "paragraph", id: "mnlt6", children: [{ text: "Použití pouze vybraných pluginů" }] },
162
+ ];
163
+ const [value, setValue] = (0, react_1.useState)(_initialValues);
164
+ const plugins = (0, wysiwyg_1.createPluginsWithUi)([
165
+ (0, wysiwyg_1.createHeadingsPluginWithUi)({ disabledLevels: [1] }),
166
+ (0, wysiwyg_1.createBoldPluginWithUi)(),
167
+ (0, wysiwyg_1.createImagePluginWithUi)({
168
+ uploadImage: async (file) => ({
169
+ id: 1,
170
+ name: URL.createObjectURL(file),
171
+ extension: ".ext",
172
+ namespace: "wysiwyg",
173
+ uuid: "this-should-be-some-random-uuid",
174
+ }),
175
+ getImageUrl: (file) => file.name,
176
+ }),
177
+ (0, wysiwyg_1.createHighlightPluginWithUi)("red"),
178
+ ]);
179
+ return (react_1.default.createElement(react_1.default.Fragment, null,
180
+ react_1.default.createElement(wysiwyg_1.WysiwygEditor, { id: "editor", initialValue: _initialValues, onChange: setValue, plugins: plugins }),
181
+ react_1.default.createElement("div", { className: "relative mt-4" },
182
+ react_1.default.createElement("div", { className: "absolute inset-0 flex items-center", "aria-hidden": "true" },
183
+ react_1.default.createElement("div", { className: "w-full border-t border-gray-300" })),
184
+ react_1.default.createElement("div", { className: "relative flex justify-center" },
185
+ react_1.default.createElement("span", { className: "bg-white px-2 text-sm text-gray-500" }, "Value"))),
186
+ react_1.default.createElement(dynamic_no_ssr_1.NoSSR, null,
187
+ react_1.default.createElement("pre", null,
188
+ react_1.default.createElement("code", null, JSON.stringify(value, null, " "))))));
189
+ }
190
+ exports.SelectedPlugins = SelectedPlugins;