@uxf/wysiwyg 14.0.0 → 14.1.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/hooks.js +21 -7
- package/package.json +8 -8
- package/plugins/link/floating-link-wrapper.js +111 -8
- package/plugins/link/hooks/use-floating-link-selectors.js +67 -7
- package/plugins/link/hooks/use-link-actions.js +127 -31
- package/plugins/link/hooks/use-link-submit-on-enter.js +58 -12
- package/ui/button/button-element.js +72 -48
- package/ui/button/insert-button-modal-content.js +183 -40
- package/ui/components/modal/modal-button-cancel.js +46 -44
- package/ui/floating-link.js +381 -46
- package/ui/image/image-element.js +72 -48
- package/ui/image/insert-image-modal-content.js +268 -45
- package/ui/toolbar/buttons/button-toolbar-button.js +37 -2
- package/ui/toolbar/buttons/element-toolbar-button.js +53 -8
- package/ui/toolbar/buttons/image-toolbar-button.js +37 -2
- package/ui/toolbar/buttons/link-toolbar-button.js +53 -9
- package/ui/toolbar/buttons/list-toolbar-button.js +50 -9
- package/ui/toolbar/buttons/mark-toolbar-button.js +49 -9
- package/ui/toolbar/buttons/toolbar-button.js +56 -14
- package/ui/toolbar/buttons/undo-redo-button-group.js +132 -58
- package/ui/toolbar/buttons/video-toolbar-button.js +37 -2
- package/ui/toolbar/toolbar.js +162 -38
- package/ui/video/insert-video-modal-content.js +160 -36
- package/ui/video/video-element.js +83 -48
- package/wysiwyg-editor.js +184 -36
- package/wysiwyg-editor.stories.js +288 -118
package/hooks.js
CHANGED
|
@@ -2,13 +2,21 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useSelected = exports.usePlateStore = exports.useUxfPlateStates = exports.useUxfPlateActions = exports.useUxfPlateSelectors = exports.useUxfPlateEditorState = exports.useUxfEditorState = exports.useUxfEditorRef = exports.useUxfPlateEditorRef = void 0;
|
|
4
4
|
const react_1 = require("platejs/react");
|
|
5
|
-
const useUxfPlateEditorRef =
|
|
5
|
+
const useUxfPlateEditorRef = id => {
|
|
6
|
+
return (0, react_1.useEditorRef)((0, react_1.useEventPlateId)(id));
|
|
7
|
+
};
|
|
6
8
|
exports.useUxfPlateEditorRef = useUxfPlateEditorRef;
|
|
7
|
-
const useUxfEditorRef = () =>
|
|
9
|
+
const useUxfEditorRef = () => {
|
|
10
|
+
return (0, react_1.useEditorRef)();
|
|
11
|
+
};
|
|
8
12
|
exports.useUxfEditorRef = useUxfEditorRef;
|
|
9
|
-
const useUxfEditorState = () =>
|
|
13
|
+
const useUxfEditorState = () => {
|
|
14
|
+
return (0, react_1.useEditorState)();
|
|
15
|
+
};
|
|
10
16
|
exports.useUxfEditorState = useUxfEditorState;
|
|
11
|
-
const useUxfPlateEditorState =
|
|
17
|
+
const useUxfPlateEditorState = id => {
|
|
18
|
+
return (0, react_1.useEditorState)((0, react_1.useEventPlateId)(id));
|
|
19
|
+
};
|
|
12
20
|
exports.useUxfPlateEditorState = useUxfPlateEditorState;
|
|
13
21
|
/**
|
|
14
22
|
* Plate 53 merged the split selectors/actions/states store into one, so these three cannot honour
|
|
@@ -16,11 +24,17 @@ exports.useUxfPlateEditorState = useUxfPlateEditorState;
|
|
|
16
24
|
* type would emit a `.d.ts` pointing into `@platejs/core/node_modules` (TS2883) – use the re-exported
|
|
17
25
|
* `usePlateStore` instead. Nothing in the monorepo consumes them.
|
|
18
26
|
*/
|
|
19
|
-
const useUxfPlateSelectors =
|
|
27
|
+
const useUxfPlateSelectors = id => {
|
|
28
|
+
return (0, react_1.usePlateStore)(id);
|
|
29
|
+
};
|
|
20
30
|
exports.useUxfPlateSelectors = useUxfPlateSelectors;
|
|
21
|
-
const useUxfPlateActions =
|
|
31
|
+
const useUxfPlateActions = id => {
|
|
32
|
+
return (0, react_1.usePlateStore)(id);
|
|
33
|
+
};
|
|
22
34
|
exports.useUxfPlateActions = useUxfPlateActions;
|
|
23
|
-
const useUxfPlateStates =
|
|
35
|
+
const useUxfPlateStates = id => {
|
|
36
|
+
return (0, react_1.usePlateStore)(id);
|
|
37
|
+
};
|
|
24
38
|
exports.useUxfPlateStates = useUxfPlateStates;
|
|
25
39
|
var react_2 = require("platejs/react");
|
|
26
40
|
Object.defineProperty(exports, "usePlateStore", { enumerable: true, get: function () { return react_2.usePlateStore; } });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uxf/wysiwyg",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.1.0",
|
|
4
4
|
"description": "UXF Wysiwyg editor",
|
|
5
5
|
"author": "Robin Dvorak <dvorak@uxf.cz>",
|
|
6
6
|
"homepage": "https://gitlab.com/uxf-npm/wysiwyg",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"access": "public"
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
|
-
"build": "tsc -P tsconfig.json",
|
|
12
|
+
"build": "tsc -P tsconfig.json && node ../../scripts/build-react-package.mjs",
|
|
13
13
|
"typecheck": "tsc --noEmit"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"@platejs/link": "53.3.5",
|
|
19
19
|
"@platejs/list-classic": "53.0.0",
|
|
20
20
|
"@platejs/media": "53.1.4",
|
|
21
|
-
"@uxf/core": "14.
|
|
22
|
-
"@uxf/core-react": "14.
|
|
23
|
-
"@uxf/ui": "14.
|
|
21
|
+
"@uxf/core": "14.1.0",
|
|
22
|
+
"@uxf/core-react": "14.1.0",
|
|
23
|
+
"@uxf/ui": "14.1.0",
|
|
24
24
|
"platejs": "53.3.15",
|
|
25
25
|
"react": "^19.3.0",
|
|
26
26
|
"react-dom": "^19.3.0"
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"@platejs/media": "53.1.4",
|
|
34
34
|
"@types/react": "19.3.0",
|
|
35
35
|
"@types/react-dom": "19.3.0",
|
|
36
|
-
"@uxf/core": "14.
|
|
37
|
-
"@uxf/core-react": "14.
|
|
38
|
-
"@uxf/ui": "14.
|
|
36
|
+
"@uxf/core": "14.1.0",
|
|
37
|
+
"@uxf/core-react": "14.1.0",
|
|
38
|
+
"@uxf/ui": "14.1.0",
|
|
39
39
|
"platejs": "53.3.15",
|
|
40
40
|
"react": "19.3.0",
|
|
41
41
|
"react-dom": "19.3.0"
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.FloatingLinkWrapper = void 0;
|
|
7
7
|
exports.FloatingLinkInsertRoot = FloatingLinkInsertRoot;
|
|
8
8
|
exports.FloatingLinkEditRoot = FloatingLinkEditRoot;
|
|
9
|
+
const compiler_runtime_1 = require("react/compiler-runtime");
|
|
9
10
|
const floating_1 = require("@platejs/floating");
|
|
10
11
|
const react_1 = require("@platejs/link/react");
|
|
11
12
|
const tw_z_index_1 = require("@uxf/ui/tw-tokens/tw-z-index");
|
|
@@ -17,12 +18,16 @@ const react_2 = __importDefault(require("react"));
|
|
|
17
18
|
* Plate 20's verbatim.
|
|
18
19
|
*/
|
|
19
20
|
const FLOATING_DEFAULTS = {
|
|
20
|
-
middleware: [(0, floating_1.offset)(12), (0, floating_1.flip)({
|
|
21
|
-
|
|
21
|
+
middleware: [(0, floating_1.offset)(12), (0, floating_1.flip)({
|
|
22
|
+
padding: 96
|
|
23
|
+
})],
|
|
24
|
+
placement: "bottom-start"
|
|
22
25
|
};
|
|
23
26
|
/** `floatingOptions` is consumed by the hook and must not reach the DOM. */
|
|
24
27
|
function toDivProps(props) {
|
|
25
|
-
const divProps = {
|
|
28
|
+
const divProps = {
|
|
29
|
+
...props
|
|
30
|
+
};
|
|
26
31
|
delete divProps.floatingOptions;
|
|
27
32
|
return divProps;
|
|
28
33
|
}
|
|
@@ -34,22 +39,120 @@ function toDivProps(props) {
|
|
|
34
39
|
* The insert hook reports `hidden`; the edit hook does not, so it is derived from its state.
|
|
35
40
|
*/
|
|
36
41
|
function FloatingLinkInsertRoot(props) {
|
|
37
|
-
const
|
|
42
|
+
const $ = (0, compiler_runtime_1.c)(11);
|
|
43
|
+
let t0;
|
|
44
|
+
if ($[0] !== props.floatingOptions) {
|
|
45
|
+
t0 = {
|
|
46
|
+
floatingOptions: {
|
|
47
|
+
...FLOATING_DEFAULTS,
|
|
48
|
+
...props.floatingOptions
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
$[0] = props.floatingOptions;
|
|
52
|
+
$[1] = t0;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
t0 = $[1];
|
|
56
|
+
}
|
|
57
|
+
const state = (0, react_1.useFloatingLinkInsertState)(t0);
|
|
38
58
|
const root = (0, react_1.useFloatingLinkInsert)(state);
|
|
59
|
+
const { ref: rootRef } = root;
|
|
39
60
|
if (root.hidden) {
|
|
40
61
|
return null;
|
|
41
62
|
}
|
|
42
|
-
|
|
63
|
+
let t1;
|
|
64
|
+
if ($[2] !== props) {
|
|
65
|
+
t1 = toDivProps(props);
|
|
66
|
+
$[2] = props;
|
|
67
|
+
$[3] = t1;
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
t1 = $[3];
|
|
71
|
+
}
|
|
72
|
+
let t2;
|
|
73
|
+
if ($[4] !== root.props.style) {
|
|
74
|
+
t2 = {
|
|
75
|
+
...root.props.style,
|
|
76
|
+
zIndex: tw_z_index_1.twZIndex.modal
|
|
77
|
+
};
|
|
78
|
+
$[4] = root.props.style;
|
|
79
|
+
$[5] = t2;
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
t2 = $[5];
|
|
83
|
+
}
|
|
84
|
+
let t3;
|
|
85
|
+
if ($[6] !== root.props || $[7] !== rootRef || $[8] !== t1 || $[9] !== t2) {
|
|
86
|
+
t3 = react_2.default.createElement("div", { ...t1, ...root.props, ref: rootRef, style: t2 });
|
|
87
|
+
$[6] = root.props;
|
|
88
|
+
$[7] = rootRef;
|
|
89
|
+
$[8] = t1;
|
|
90
|
+
$[9] = t2;
|
|
91
|
+
$[10] = t3;
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
t3 = $[10];
|
|
95
|
+
}
|
|
96
|
+
return t3;
|
|
43
97
|
}
|
|
44
98
|
function FloatingLinkEditRoot(props) {
|
|
45
|
-
const
|
|
99
|
+
const $ = (0, compiler_runtime_1.c)(11);
|
|
100
|
+
let t0;
|
|
101
|
+
if ($[0] !== props.floatingOptions) {
|
|
102
|
+
t0 = {
|
|
103
|
+
floatingOptions: {
|
|
104
|
+
...FLOATING_DEFAULTS,
|
|
105
|
+
...props.floatingOptions
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
$[0] = props.floatingOptions;
|
|
109
|
+
$[1] = t0;
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
t0 = $[1];
|
|
113
|
+
}
|
|
114
|
+
const state = (0, react_1.useFloatingLinkEditState)(t0);
|
|
46
115
|
const root = (0, react_1.useFloatingLinkEdit)(state);
|
|
116
|
+
const { ref: rootRef } = root;
|
|
47
117
|
if (state.readOnly || !state.isOpen) {
|
|
48
118
|
return null;
|
|
49
119
|
}
|
|
50
|
-
|
|
120
|
+
let t1;
|
|
121
|
+
if ($[2] !== props) {
|
|
122
|
+
t1 = toDivProps(props);
|
|
123
|
+
$[2] = props;
|
|
124
|
+
$[3] = t1;
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
t1 = $[3];
|
|
128
|
+
}
|
|
129
|
+
let t2;
|
|
130
|
+
if ($[4] !== root.props.style) {
|
|
131
|
+
t2 = {
|
|
132
|
+
...root.props.style,
|
|
133
|
+
zIndex: tw_z_index_1.twZIndex.modal
|
|
134
|
+
};
|
|
135
|
+
$[4] = root.props.style;
|
|
136
|
+
$[5] = t2;
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
t2 = $[5];
|
|
140
|
+
}
|
|
141
|
+
let t3;
|
|
142
|
+
if ($[6] !== root.props || $[7] !== rootRef || $[8] !== t1 || $[9] !== t2) {
|
|
143
|
+
t3 = react_2.default.createElement("div", { ...t1, ...root.props, ref: rootRef, style: t2 });
|
|
144
|
+
$[6] = root.props;
|
|
145
|
+
$[7] = rootRef;
|
|
146
|
+
$[8] = t1;
|
|
147
|
+
$[9] = t2;
|
|
148
|
+
$[10] = t3;
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
t3 = $[10];
|
|
152
|
+
}
|
|
153
|
+
return t3;
|
|
51
154
|
}
|
|
52
155
|
exports.FloatingLinkWrapper = {
|
|
53
156
|
EditRoot: FloatingLinkEditRoot,
|
|
54
|
-
InsertRoot: FloatingLinkInsertRoot
|
|
157
|
+
InsertRoot: FloatingLinkInsertRoot
|
|
55
158
|
};
|
|
@@ -1,21 +1,81 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useFloatingLinkSelectors = void 0;
|
|
4
|
+
const compiler_runtime_1 = require("react/compiler-runtime");
|
|
4
5
|
const react_1 = require("@platejs/link/react");
|
|
5
6
|
const react_2 = require("platejs/react");
|
|
6
7
|
/** Shim over `LinkPlugin` options, so the three call sites keep the Plate 20 getter-bundle shape. */
|
|
7
8
|
const useFloatingLinkSelectors = () => {
|
|
9
|
+
const $ = (0, compiler_runtime_1.c)(16);
|
|
8
10
|
const isEditing = (0, react_2.usePluginOption)(react_1.LinkPlugin, "isEditing");
|
|
9
11
|
const url = (0, react_2.usePluginOption)(react_1.LinkPlugin, "url");
|
|
10
12
|
const text = (0, react_2.usePluginOption)(react_1.LinkPlugin, "text");
|
|
11
13
|
const newTab = (0, react_2.usePluginOption)(react_1.LinkPlugin, "newTab");
|
|
12
14
|
const mode = (0, react_2.usePluginOption)(react_1.LinkPlugin, "mode");
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
let t0;
|
|
16
|
+
if ($[0] !== isEditing) {
|
|
17
|
+
t0 = () => isEditing;
|
|
18
|
+
$[0] = isEditing;
|
|
19
|
+
$[1] = t0;
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
t0 = $[1];
|
|
23
|
+
}
|
|
24
|
+
let t1;
|
|
25
|
+
if ($[2] !== mode) {
|
|
26
|
+
t1 = () => mode;
|
|
27
|
+
$[2] = mode;
|
|
28
|
+
$[3] = t1;
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
t1 = $[3];
|
|
32
|
+
}
|
|
33
|
+
let t2;
|
|
34
|
+
if ($[4] !== newTab) {
|
|
35
|
+
t2 = () => newTab;
|
|
36
|
+
$[4] = newTab;
|
|
37
|
+
$[5] = t2;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
t2 = $[5];
|
|
41
|
+
}
|
|
42
|
+
let t3;
|
|
43
|
+
if ($[6] !== text) {
|
|
44
|
+
t3 = () => text;
|
|
45
|
+
$[6] = text;
|
|
46
|
+
$[7] = t3;
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
t3 = $[7];
|
|
50
|
+
}
|
|
51
|
+
let t4;
|
|
52
|
+
if ($[8] !== url) {
|
|
53
|
+
t4 = () => url;
|
|
54
|
+
$[8] = url;
|
|
55
|
+
$[9] = t4;
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
t4 = $[9];
|
|
59
|
+
}
|
|
60
|
+
let t5;
|
|
61
|
+
if ($[10] !== t0 || $[11] !== t1 || $[12] !== t2 || $[13] !== t3 || $[14] !== t4) {
|
|
62
|
+
t5 = {
|
|
63
|
+
isEditing: t0,
|
|
64
|
+
mode: t1,
|
|
65
|
+
newTab: t2,
|
|
66
|
+
text: t3,
|
|
67
|
+
url: t4
|
|
68
|
+
};
|
|
69
|
+
$[10] = t0;
|
|
70
|
+
$[11] = t1;
|
|
71
|
+
$[12] = t2;
|
|
72
|
+
$[13] = t3;
|
|
73
|
+
$[14] = t4;
|
|
74
|
+
$[15] = t5;
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
t5 = $[15];
|
|
78
|
+
}
|
|
79
|
+
return t5;
|
|
20
80
|
};
|
|
21
81
|
exports.useFloatingLinkSelectors = useFloatingLinkSelectors;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useLinkActions = void 0;
|
|
4
|
+
const compiler_runtime_1 = require("react/compiler-runtime");
|
|
4
5
|
const react_1 = require("@platejs/link/react");
|
|
5
6
|
const hooks_1 = require("../../../hooks");
|
|
6
7
|
const get_active_link_1 = require("../transforms/get-active-link");
|
|
@@ -12,40 +13,135 @@ const use_link_submit_on_enter_1 = require("./use-link-submit-on-enter");
|
|
|
12
13
|
* `editor`, which used to be `editor.current` and so always `undefined`. Nothing reads it.
|
|
13
14
|
*/
|
|
14
15
|
const useLinkActions = () => {
|
|
16
|
+
const $ = (0, compiler_runtime_1.c)(30);
|
|
15
17
|
const editor = (0, hooks_1.useUxfEditorRef)();
|
|
16
18
|
(0, use_link_submit_on_enter_1.useLinkSubmitOnEnter)();
|
|
17
19
|
(0, use_link_cancel_on_escape_1.useLinkCancelOnEscape)();
|
|
18
20
|
const floatingLinkSelectors = (0, use_floating_link_selectors_1.useFloatingLinkSelectors)();
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
21
|
+
let t0;
|
|
22
|
+
if ($[0] !== editor) {
|
|
23
|
+
t0 = url => {
|
|
24
|
+
editor.setOption(react_1.LinkPlugin, "url", url);
|
|
25
|
+
editor.setOption(react_1.LinkPlugin, "isEditing", true);
|
|
26
|
+
};
|
|
27
|
+
$[0] = editor;
|
|
28
|
+
$[1] = t0;
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
t0 = $[1];
|
|
32
|
+
}
|
|
33
|
+
const setUrl = t0;
|
|
34
|
+
let t1;
|
|
35
|
+
if ($[2] !== editor) {
|
|
36
|
+
t1 = text => {
|
|
37
|
+
editor.setOption(react_1.LinkPlugin, "text", text);
|
|
38
|
+
editor.setOption(react_1.LinkPlugin, "isEditing", true);
|
|
39
|
+
};
|
|
40
|
+
$[2] = editor;
|
|
41
|
+
$[3] = t1;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
t1 = $[3];
|
|
45
|
+
}
|
|
46
|
+
const setText = t1;
|
|
47
|
+
let t2;
|
|
48
|
+
if ($[4] !== editor) {
|
|
49
|
+
t2 = target => {
|
|
50
|
+
editor.setOption(react_1.LinkPlugin, "newTab", target === "_blank");
|
|
51
|
+
editor.setOption(react_1.LinkPlugin, "isEditing", true);
|
|
52
|
+
};
|
|
53
|
+
$[4] = editor;
|
|
54
|
+
$[5] = t2;
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
t2 = $[5];
|
|
58
|
+
}
|
|
59
|
+
const setTarget = t2;
|
|
60
|
+
let t3;
|
|
61
|
+
if ($[6] !== editor || $[7] !== setTarget || $[8] !== setText || $[9] !== setUrl) {
|
|
62
|
+
t3 = (url_0, text_0, target_0) => {
|
|
63
|
+
setUrl(url_0);
|
|
64
|
+
setText(text_0);
|
|
65
|
+
setTarget(target_0);
|
|
66
|
+
editor.setOption(react_1.LinkPlugin, "isEditing", true);
|
|
67
|
+
};
|
|
68
|
+
$[6] = editor;
|
|
69
|
+
$[7] = setTarget;
|
|
70
|
+
$[8] = setText;
|
|
71
|
+
$[9] = setUrl;
|
|
72
|
+
$[10] = t3;
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
t3 = $[10];
|
|
76
|
+
}
|
|
77
|
+
const setAllValues = t3;
|
|
78
|
+
let t4;
|
|
79
|
+
if ($[11] !== editor) {
|
|
80
|
+
t4 = () => (0, get_active_link_1.getActiveLink)(editor);
|
|
81
|
+
$[11] = editor;
|
|
82
|
+
$[12] = t4;
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
t4 = $[12];
|
|
86
|
+
}
|
|
87
|
+
const getActiveLinkValue = t4;
|
|
88
|
+
const t5 = floatingLinkSelectors.newTab() ? "_blank" : "_self";
|
|
89
|
+
let t6;
|
|
90
|
+
if ($[13] !== floatingLinkSelectors) {
|
|
91
|
+
t6 = floatingLinkSelectors.text();
|
|
92
|
+
$[13] = floatingLinkSelectors;
|
|
93
|
+
$[14] = t6;
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
t6 = $[14];
|
|
97
|
+
}
|
|
98
|
+
let t7;
|
|
99
|
+
if ($[15] !== floatingLinkSelectors) {
|
|
100
|
+
t7 = floatingLinkSelectors.url();
|
|
101
|
+
$[15] = floatingLinkSelectors;
|
|
102
|
+
$[16] = t7;
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
t7 = $[16];
|
|
106
|
+
}
|
|
107
|
+
let t8;
|
|
108
|
+
if ($[17] !== floatingLinkSelectors) {
|
|
109
|
+
t8 = floatingLinkSelectors.isEditing();
|
|
110
|
+
$[17] = floatingLinkSelectors;
|
|
111
|
+
$[18] = t8;
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
t8 = $[18];
|
|
115
|
+
}
|
|
116
|
+
let t9;
|
|
117
|
+
if ($[19] !== editor || $[20] !== getActiveLinkValue || $[21] !== setAllValues || $[22] !== setTarget || $[23] !== setText || $[24] !== setUrl || $[25] !== t5 || $[26] !== t6 || $[27] !== t7 || $[28] !== t8) {
|
|
118
|
+
t9 = {
|
|
119
|
+
editor,
|
|
120
|
+
getActiveLinkValue,
|
|
121
|
+
getTarget: t5,
|
|
122
|
+
getText: t6,
|
|
123
|
+
getUrl: t7,
|
|
124
|
+
isEditing: t8,
|
|
125
|
+
setAllValues,
|
|
126
|
+
setTarget,
|
|
127
|
+
setText,
|
|
128
|
+
setUrl
|
|
129
|
+
};
|
|
130
|
+
$[19] = editor;
|
|
131
|
+
$[20] = getActiveLinkValue;
|
|
132
|
+
$[21] = setAllValues;
|
|
133
|
+
$[22] = setTarget;
|
|
134
|
+
$[23] = setText;
|
|
135
|
+
$[24] = setUrl;
|
|
136
|
+
$[25] = t5;
|
|
137
|
+
$[26] = t6;
|
|
138
|
+
$[27] = t7;
|
|
139
|
+
$[28] = t8;
|
|
140
|
+
$[29] = t9;
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
t9 = $[29];
|
|
144
|
+
}
|
|
145
|
+
return t9;
|
|
50
146
|
};
|
|
51
147
|
exports.useLinkActions = useLinkActions;
|
|
@@ -1,23 +1,69 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useLinkSubmitOnEnter = void 0;
|
|
4
|
+
const compiler_runtime_1 = require("react/compiler-runtime");
|
|
4
5
|
const react_1 = require("platejs/react");
|
|
5
6
|
const hooks_1 = require("../../../hooks");
|
|
6
7
|
const submit_link_1 = require("../transforms/submit-link");
|
|
7
8
|
const use_floating_link_selectors_1 = require("./use-floating-link-selectors");
|
|
8
9
|
const useLinkSubmitOnEnter = () => {
|
|
10
|
+
const $ = (0, compiler_runtime_1.c)(8);
|
|
9
11
|
const editor = (0, hooks_1.useUxfEditorRef)();
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
const t0 = (0, use_floating_link_selectors_1.useFloatingLinkSelectors)();
|
|
13
|
+
let t1;
|
|
14
|
+
if ($[0] !== t0) {
|
|
15
|
+
t1 = t0.isEditing();
|
|
16
|
+
$[0] = t0;
|
|
17
|
+
$[1] = t1;
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
t1 = $[1];
|
|
21
|
+
}
|
|
22
|
+
const open = t1;
|
|
23
|
+
let t2;
|
|
24
|
+
if ($[2] !== editor) {
|
|
25
|
+
t2 = e => {
|
|
26
|
+
if (e.key !== "Enter") {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
if ((0, submit_link_1.submitLink)(editor)) {
|
|
30
|
+
e.preventDefault();
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
$[2] = editor;
|
|
34
|
+
$[3] = t2;
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
t2 = $[3];
|
|
38
|
+
}
|
|
39
|
+
let t3;
|
|
40
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
41
|
+
t3 = ["INPUT"];
|
|
42
|
+
$[4] = t3;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
t3 = $[4];
|
|
46
|
+
}
|
|
47
|
+
let t4;
|
|
48
|
+
if ($[5] !== open) {
|
|
49
|
+
t4 = {
|
|
50
|
+
enableOnFormTags: t3,
|
|
51
|
+
enabled: open
|
|
52
|
+
};
|
|
53
|
+
$[5] = open;
|
|
54
|
+
$[6] = t4;
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
t4 = $[6];
|
|
58
|
+
}
|
|
59
|
+
let t5;
|
|
60
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
61
|
+
t5 = [];
|
|
62
|
+
$[7] = t5;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
t5 = $[7];
|
|
66
|
+
}
|
|
67
|
+
(0, react_1.useHotkeys)("*", t2, t4, t5);
|
|
22
68
|
};
|
|
23
69
|
exports.useLinkSubmitOnEnter = useLinkSubmitOnEnter;
|