@multiplatform.one/rich-text 7.4.0 → 7.5.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/dist/cjs/RichTextEditor/index.cjs +115 -50
- package/dist/cjs/RichTextEditor/index.native.js +119 -53
- package/dist/cjs/RichTextEditor/index.native.js.map +1 -1
- package/dist/cjs/toolbar/HeadingPicker.cjs +0 -7
- package/dist/cjs/toolbar/HeadingPicker.native.js +17 -13
- package/dist/cjs/toolbar/HeadingPicker.native.js.map +1 -1
- package/dist/cjs/toolbar/ListPicker.cjs +0 -7
- package/dist/cjs/toolbar/ListPicker.native.js +11 -12
- package/dist/cjs/toolbar/ListPicker.native.js.map +1 -1
- package/dist/cjs/toolbar/MoreDropdown.cjs +0 -7
- package/dist/cjs/toolbar/MoreDropdown.native.js +11 -12
- package/dist/cjs/toolbar/MoreDropdown.native.js.map +1 -1
- package/dist/esm/RichTextEditor/index.mjs +117 -53
- package/dist/esm/RichTextEditor/index.mjs.map +1 -1
- package/dist/esm/RichTextEditor/index.native.js +121 -56
- package/dist/esm/RichTextEditor/index.native.js.map +1 -1
- package/dist/esm/toolbar/HeadingPicker.mjs +0 -7
- package/dist/esm/toolbar/HeadingPicker.mjs.map +1 -1
- package/dist/esm/toolbar/HeadingPicker.native.js +17 -13
- package/dist/esm/toolbar/HeadingPicker.native.js.map +1 -1
- package/dist/esm/toolbar/ListPicker.mjs +0 -7
- package/dist/esm/toolbar/ListPicker.mjs.map +1 -1
- package/dist/esm/toolbar/ListPicker.native.js +11 -12
- package/dist/esm/toolbar/ListPicker.native.js.map +1 -1
- package/dist/esm/toolbar/MoreDropdown.mjs +0 -7
- package/dist/esm/toolbar/MoreDropdown.mjs.map +1 -1
- package/dist/esm/toolbar/MoreDropdown.native.js +11 -12
- package/dist/esm/toolbar/MoreDropdown.native.js.map +1 -1
- package/dist/jsx/RichTextEditor/index.mjs +117 -53
- package/dist/jsx/RichTextEditor/index.mjs.map +1 -1
- package/dist/jsx/RichTextEditor/index.native.js +119 -53
- package/dist/jsx/RichTextEditor/index.native.js.map +1 -1
- package/dist/jsx/toolbar/HeadingPicker.mjs +0 -7
- package/dist/jsx/toolbar/HeadingPicker.mjs.map +1 -1
- package/dist/jsx/toolbar/HeadingPicker.native.js +17 -13
- package/dist/jsx/toolbar/HeadingPicker.native.js.map +1 -1
- package/dist/jsx/toolbar/ListPicker.mjs +0 -7
- package/dist/jsx/toolbar/ListPicker.mjs.map +1 -1
- package/dist/jsx/toolbar/ListPicker.native.js +11 -12
- package/dist/jsx/toolbar/ListPicker.native.js.map +1 -1
- package/dist/jsx/toolbar/MoreDropdown.mjs +0 -7
- package/dist/jsx/toolbar/MoreDropdown.mjs.map +1 -1
- package/dist/jsx/toolbar/MoreDropdown.native.js +11 -12
- package/dist/jsx/toolbar/MoreDropdown.native.js.map +1 -1
- package/package.json +8 -8
- package/src/RichEditor.stories.tsx +36 -1
- package/src/RichTextEditor/index.tsx +134 -50
- package/src/RichTextEditor/richTextEditor.spec.tsx +141 -147
- package/src/toolbar/HeadingPicker.tsx +15 -14
- package/src/toolbar/ListPicker.tsx +9 -13
- package/src/toolbar/MoreDropdown.tsx +9 -13
- package/types/RichTextEditor/index.d.ts +6 -0
- package/types/RichTextEditor/index.d.ts.map +1 -1
- package/types/toolbar/HeadingPicker.d.ts.map +1 -1
- package/types/toolbar/ListPicker.d.ts.map +1 -1
- package/types/toolbar/MoreDropdown.d.ts.map +1 -1
|
@@ -22,7 +22,8 @@ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
|
22
22
|
}), mod);
|
|
23
23
|
var RichTextEditor_exports = {};
|
|
24
24
|
__export(RichTextEditor_exports, {
|
|
25
|
-
RichTextEditor: () => RichTextEditor
|
|
25
|
+
RichTextEditor: () => RichTextEditor,
|
|
26
|
+
richTextIsEmpty: () => richTextIsEmpty
|
|
26
27
|
});
|
|
27
28
|
module.exports = __toCommonJS(RichTextEditor_exports);
|
|
28
29
|
var import_react = require("react");
|
|
@@ -31,7 +32,63 @@ var import_forms = require("@multiplatform.one/forms");
|
|
|
31
32
|
var import_RichEditor = require("../RichEditor.cjs");
|
|
32
33
|
var import_t = require("../shared/t.cjs");
|
|
33
34
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
34
|
-
|
|
35
|
+
function richTextIsEmpty(v) {
|
|
36
|
+
return !v || v === "<p></p>" || v === "";
|
|
37
|
+
}
|
|
38
|
+
function applyExternalContent(editor, next, capabilities) {
|
|
39
|
+
if (!editor) return;
|
|
40
|
+
if (capabilities === "markdown") {
|
|
41
|
+
editor.setMarkdown(next);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
editor.setHTML(next);
|
|
45
|
+
}
|
|
46
|
+
function RichTextExternalValueSync({
|
|
47
|
+
value,
|
|
48
|
+
editorRef,
|
|
49
|
+
capabilities
|
|
50
|
+
}) {
|
|
51
|
+
const isFirst = (0, import_react.useRef)(true);
|
|
52
|
+
const lastPushed = (0, import_react.useRef)(value);
|
|
53
|
+
(0, import_react.useEffect)(() => {
|
|
54
|
+
if (isFirst.current) {
|
|
55
|
+
isFirst.current = false;
|
|
56
|
+
lastPushed.current = value;
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (value === lastPushed.current) return;
|
|
60
|
+
lastPushed.current = value;
|
|
61
|
+
applyExternalContent(editorRef.current, value, capabilities);
|
|
62
|
+
}, [value, editorRef, capabilities]);
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
function EditorFocusTarget({
|
|
66
|
+
id,
|
|
67
|
+
editorRef
|
|
68
|
+
}) {
|
|
69
|
+
if (!import_tamagui.isWeb) return null;
|
|
70
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)("textarea", {
|
|
71
|
+
id,
|
|
72
|
+
tabIndex: -1,
|
|
73
|
+
"aria-hidden": true,
|
|
74
|
+
readOnly: true,
|
|
75
|
+
value: "",
|
|
76
|
+
onFocus: event => {
|
|
77
|
+
event.currentTarget.blur();
|
|
78
|
+
editorRef.current?.focus();
|
|
79
|
+
},
|
|
80
|
+
style: {
|
|
81
|
+
position: "absolute",
|
|
82
|
+
width: 1,
|
|
83
|
+
height: 1,
|
|
84
|
+
padding: 0,
|
|
85
|
+
margin: 0,
|
|
86
|
+
border: 0,
|
|
87
|
+
opacity: 0,
|
|
88
|
+
overflow: "hidden"
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}
|
|
35
92
|
function RichTextEditor(props) {
|
|
36
93
|
const {
|
|
37
94
|
defaultValue = "",
|
|
@@ -51,6 +108,7 @@ function RichTextEditor(props) {
|
|
|
51
108
|
helperText,
|
|
52
109
|
required,
|
|
53
110
|
size,
|
|
111
|
+
id: idProp,
|
|
54
112
|
value: controlledValue,
|
|
55
113
|
onChange,
|
|
56
114
|
onBlur,
|
|
@@ -66,8 +124,7 @@ function RichTextEditor(props) {
|
|
|
66
124
|
inlineEditing,
|
|
67
125
|
onImageUpload,
|
|
68
126
|
onFileUpload,
|
|
69
|
-
mentions
|
|
70
|
-
..._restProps
|
|
127
|
+
mentions
|
|
71
128
|
} = props;
|
|
72
129
|
const placeholder = placeholderProp ?? (0, import_t.t)("Write something...");
|
|
73
130
|
const {
|
|
@@ -75,7 +132,9 @@ function RichTextEditor(props) {
|
|
|
75
132
|
knobProps,
|
|
76
133
|
id
|
|
77
134
|
} = (0, import_forms.useFormField)({
|
|
78
|
-
form
|
|
135
|
+
form,
|
|
136
|
+
id: idProp,
|
|
137
|
+
compact
|
|
79
138
|
});
|
|
80
139
|
const resolvedValidators = (0, import_forms.useResolvedValidators)(required, validators, label, name, richTextIsEmpty);
|
|
81
140
|
const editorRef = (0, import_react.useRef)(null);
|
|
@@ -85,56 +144,68 @@ function RichTextEditor(props) {
|
|
|
85
144
|
setInternalValue(html);
|
|
86
145
|
onChange?.(html);
|
|
87
146
|
}, [onChange]);
|
|
147
|
+
const layoutBind = {
|
|
148
|
+
id,
|
|
149
|
+
label,
|
|
150
|
+
labelProps,
|
|
151
|
+
helperText,
|
|
152
|
+
required,
|
|
153
|
+
size,
|
|
154
|
+
knobProps,
|
|
155
|
+
disabled,
|
|
156
|
+
purpose: "description",
|
|
157
|
+
placeholder
|
|
158
|
+
};
|
|
88
159
|
if (skeleton) {
|
|
89
|
-
return /* @__PURE__ */(0, import_jsx_runtime.
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
width: "30%",
|
|
94
|
-
height: 14
|
|
95
|
-
}), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_forms.Skeleton, {
|
|
160
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_forms.FieldLayout, {
|
|
161
|
+
...layoutBind,
|
|
162
|
+
error: errorProp,
|
|
163
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_forms.Skeleton, {
|
|
96
164
|
variant: "rounded",
|
|
97
165
|
width: "100%",
|
|
98
166
|
height: minHeight
|
|
99
|
-
})
|
|
167
|
+
})
|
|
100
168
|
});
|
|
101
169
|
}
|
|
102
170
|
const renderEditor = (currentValue, onValueChange, handleBlur, hasError) => {
|
|
103
|
-
return /* @__PURE__ */(0, import_jsx_runtime.
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
171
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
|
172
|
+
children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(RichTextExternalValueSync, {
|
|
173
|
+
value: currentValue,
|
|
174
|
+
editorRef,
|
|
175
|
+
capabilities
|
|
176
|
+
}), /* @__PURE__ */(0, import_jsx_runtime.jsx)(EditorFocusTarget, {
|
|
177
|
+
id,
|
|
178
|
+
editorRef
|
|
179
|
+
}), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_RichEditor.RichEditor, {
|
|
180
|
+
ref: editorRef,
|
|
181
|
+
initialContent: currentValue,
|
|
182
|
+
onChange: html => onValueChange(html),
|
|
183
|
+
onBlur: handleBlur,
|
|
184
|
+
placeholder,
|
|
185
|
+
editable: !disabled && !readOnly,
|
|
186
|
+
minHeight,
|
|
187
|
+
maxHeight,
|
|
188
|
+
showToolbar,
|
|
189
|
+
showBubbleToolbar,
|
|
190
|
+
sections,
|
|
191
|
+
capabilities,
|
|
192
|
+
hasError,
|
|
193
|
+
size,
|
|
194
|
+
compact,
|
|
195
|
+
fullscreen,
|
|
196
|
+
defaultFullscreen,
|
|
197
|
+
onFullscreenChange,
|
|
198
|
+
inlineEditing,
|
|
199
|
+
onImageUpload,
|
|
200
|
+
onFileUpload,
|
|
201
|
+
mentions
|
|
202
|
+
})]
|
|
126
203
|
});
|
|
127
204
|
};
|
|
128
205
|
if (!resolvedForm || !name) {
|
|
129
206
|
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_forms.FieldLayout, {
|
|
130
|
-
|
|
131
|
-
label,
|
|
132
|
-
labelProps,
|
|
207
|
+
...layoutBind,
|
|
133
208
|
error: errorProp,
|
|
134
|
-
helperText,
|
|
135
|
-
required,
|
|
136
|
-
size,
|
|
137
|
-
knobProps,
|
|
138
209
|
onBlur,
|
|
139
210
|
children: renderEditor(value, handleChange, onBlur, !!errorProp)
|
|
140
211
|
});
|
|
@@ -150,14 +221,8 @@ function RichTextEditor(props) {
|
|
|
150
221
|
const resolvedError = (0, import_forms.getFieldError)(field, errorProp);
|
|
151
222
|
const fieldValue = field.state.value ?? "";
|
|
152
223
|
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_forms.FieldLayout, {
|
|
153
|
-
|
|
154
|
-
label,
|
|
155
|
-
labelProps,
|
|
224
|
+
...layoutBind,
|
|
156
225
|
error: resolvedError,
|
|
157
|
-
helperText,
|
|
158
|
-
required,
|
|
159
|
-
size,
|
|
160
|
-
knobProps,
|
|
161
226
|
onBlur: (0, import_forms.mergeFieldHandler)(field, "handleBlur", onBlur),
|
|
162
227
|
children: renderEditor(fieldValue, v => field.handleChange(v), () => field.handleBlur(), !!resolvedError)
|
|
163
228
|
});
|
|
@@ -24,7 +24,8 @@ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
|
24
24
|
}), mod);
|
|
25
25
|
var RichTextEditor_exports = {};
|
|
26
26
|
__export(RichTextEditor_exports, {
|
|
27
|
-
RichTextEditor: () => RichTextEditor
|
|
27
|
+
RichTextEditor: () => RichTextEditor,
|
|
28
|
+
richTextIsEmpty: () => richTextIsEmpty
|
|
28
29
|
});
|
|
29
30
|
module.exports = __toCommonJS(RichTextEditor_exports);
|
|
30
31
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -33,9 +34,66 @@ var import_tamagui = require("tamagui");
|
|
|
33
34
|
var import_forms = require("@multiplatform.one/forms");
|
|
34
35
|
var import_RichEditor = require("../RichEditor.native.js");
|
|
35
36
|
var import_t = require("../shared/t.native.js");
|
|
36
|
-
|
|
37
|
+
function richTextIsEmpty(v) {
|
|
37
38
|
return !v || v === "<p></p>" || v === "";
|
|
38
|
-
}
|
|
39
|
+
}
|
|
40
|
+
function applyExternalContent(editor, next, capabilities) {
|
|
41
|
+
if (!editor) return;
|
|
42
|
+
if (capabilities === "markdown") {
|
|
43
|
+
editor.setMarkdown(next);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
editor.setHTML(next);
|
|
47
|
+
}
|
|
48
|
+
function RichTextExternalValueSync(param) {
|
|
49
|
+
var {
|
|
50
|
+
value,
|
|
51
|
+
editorRef,
|
|
52
|
+
capabilities
|
|
53
|
+
} = param;
|
|
54
|
+
var isFirst = (0, import_react.useRef)(true);
|
|
55
|
+
var lastPushed = (0, import_react.useRef)(value);
|
|
56
|
+
(0, import_react.useEffect)(function () {
|
|
57
|
+
if (isFirst.current) {
|
|
58
|
+
isFirst.current = false;
|
|
59
|
+
lastPushed.current = value;
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (value === lastPushed.current) return;
|
|
63
|
+
lastPushed.current = value;
|
|
64
|
+
applyExternalContent(editorRef.current, value, capabilities);
|
|
65
|
+
}, [value, editorRef, capabilities]);
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
function EditorFocusTarget(param) {
|
|
69
|
+
var {
|
|
70
|
+
id,
|
|
71
|
+
editorRef
|
|
72
|
+
} = param;
|
|
73
|
+
if (!import_tamagui.isWeb) return null;
|
|
74
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)("textarea", {
|
|
75
|
+
id,
|
|
76
|
+
tabIndex: -1,
|
|
77
|
+
"aria-hidden": true,
|
|
78
|
+
readOnly: true,
|
|
79
|
+
value: "",
|
|
80
|
+
onFocus: function onFocus(event) {
|
|
81
|
+
var _editorRef_current;
|
|
82
|
+
event.currentTarget.blur();
|
|
83
|
+
(_editorRef_current = editorRef.current) === null || _editorRef_current === void 0 ? void 0 : _editorRef_current.focus();
|
|
84
|
+
},
|
|
85
|
+
style: {
|
|
86
|
+
position: "absolute",
|
|
87
|
+
width: 1,
|
|
88
|
+
height: 1,
|
|
89
|
+
padding: 0,
|
|
90
|
+
margin: 0,
|
|
91
|
+
border: 0,
|
|
92
|
+
opacity: 0,
|
|
93
|
+
overflow: "hidden"
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
39
97
|
function RichTextEditor(props) {
|
|
40
98
|
var {
|
|
41
99
|
defaultValue = "",
|
|
@@ -55,6 +113,7 @@ function RichTextEditor(props) {
|
|
|
55
113
|
helperText,
|
|
56
114
|
required,
|
|
57
115
|
size,
|
|
116
|
+
id: idProp,
|
|
58
117
|
value: controlledValue,
|
|
59
118
|
onChange,
|
|
60
119
|
onBlur,
|
|
@@ -70,8 +129,7 @@ function RichTextEditor(props) {
|
|
|
70
129
|
inlineEditing,
|
|
71
130
|
onImageUpload,
|
|
72
131
|
onFileUpload,
|
|
73
|
-
mentions
|
|
74
|
-
..._restProps
|
|
132
|
+
mentions
|
|
75
133
|
} = props;
|
|
76
134
|
var placeholder = placeholderProp !== null && placeholderProp !== void 0 ? placeholderProp : (0, import_t.t)("Write something...");
|
|
77
135
|
var {
|
|
@@ -79,7 +137,9 @@ function RichTextEditor(props) {
|
|
|
79
137
|
knobProps,
|
|
80
138
|
id
|
|
81
139
|
} = (0, import_forms.useFormField)({
|
|
82
|
-
form
|
|
140
|
+
form,
|
|
141
|
+
id: idProp,
|
|
142
|
+
compact
|
|
83
143
|
});
|
|
84
144
|
var resolvedValidators = (0, import_forms.useResolvedValidators)(required, validators, label, name, richTextIsEmpty);
|
|
85
145
|
var editorRef = (0, import_react.useRef)(null);
|
|
@@ -89,58 +149,70 @@ function RichTextEditor(props) {
|
|
|
89
149
|
setInternalValue(html);
|
|
90
150
|
onChange === null || onChange === void 0 ? void 0 : onChange(html);
|
|
91
151
|
}, [onChange]);
|
|
152
|
+
var layoutBind = {
|
|
153
|
+
id,
|
|
154
|
+
label,
|
|
155
|
+
labelProps,
|
|
156
|
+
helperText,
|
|
157
|
+
required,
|
|
158
|
+
size,
|
|
159
|
+
knobProps,
|
|
160
|
+
disabled,
|
|
161
|
+
purpose: "description",
|
|
162
|
+
placeholder
|
|
163
|
+
};
|
|
92
164
|
if (skeleton) {
|
|
93
|
-
return /* @__PURE__ */(0, import_jsx_runtime.
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
width: "30%",
|
|
98
|
-
height: 14
|
|
99
|
-
}), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_forms.Skeleton, {
|
|
165
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_forms.FieldLayout, {
|
|
166
|
+
...layoutBind,
|
|
167
|
+
error: errorProp,
|
|
168
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_forms.Skeleton, {
|
|
100
169
|
variant: "rounded",
|
|
101
170
|
width: "100%",
|
|
102
171
|
height: minHeight
|
|
103
|
-
})
|
|
172
|
+
})
|
|
104
173
|
});
|
|
105
174
|
}
|
|
106
175
|
var renderEditor = function renderEditor2(currentValue, onValueChange, handleBlur, hasError) {
|
|
107
|
-
return /* @__PURE__ */(0, import_jsx_runtime.
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
},
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
176
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
|
177
|
+
children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(RichTextExternalValueSync, {
|
|
178
|
+
value: currentValue,
|
|
179
|
+
editorRef,
|
|
180
|
+
capabilities
|
|
181
|
+
}), /* @__PURE__ */(0, import_jsx_runtime.jsx)(EditorFocusTarget, {
|
|
182
|
+
id,
|
|
183
|
+
editorRef
|
|
184
|
+
}), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_RichEditor.RichEditor, {
|
|
185
|
+
ref: editorRef,
|
|
186
|
+
initialContent: currentValue,
|
|
187
|
+
onChange: function onChange2(html) {
|
|
188
|
+
return onValueChange(html);
|
|
189
|
+
},
|
|
190
|
+
onBlur: handleBlur,
|
|
191
|
+
placeholder,
|
|
192
|
+
editable: !disabled && !readOnly,
|
|
193
|
+
minHeight,
|
|
194
|
+
maxHeight,
|
|
195
|
+
showToolbar,
|
|
196
|
+
showBubbleToolbar,
|
|
197
|
+
sections,
|
|
198
|
+
capabilities,
|
|
199
|
+
hasError,
|
|
200
|
+
size,
|
|
201
|
+
compact,
|
|
202
|
+
fullscreen,
|
|
203
|
+
defaultFullscreen,
|
|
204
|
+
onFullscreenChange,
|
|
205
|
+
inlineEditing,
|
|
206
|
+
onImageUpload,
|
|
207
|
+
onFileUpload,
|
|
208
|
+
mentions
|
|
209
|
+
})]
|
|
132
210
|
});
|
|
133
211
|
};
|
|
134
212
|
if (!resolvedForm || !name) {
|
|
135
213
|
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_forms.FieldLayout, {
|
|
136
|
-
|
|
137
|
-
label,
|
|
138
|
-
labelProps,
|
|
214
|
+
...layoutBind,
|
|
139
215
|
error: errorProp,
|
|
140
|
-
helperText,
|
|
141
|
-
required,
|
|
142
|
-
size,
|
|
143
|
-
knobProps,
|
|
144
216
|
onBlur,
|
|
145
217
|
children: renderEditor(value, handleChange, onBlur, !!errorProp)
|
|
146
218
|
});
|
|
@@ -157,14 +229,8 @@ function RichTextEditor(props) {
|
|
|
157
229
|
var resolvedError = (0, import_forms.getFieldError)(field, errorProp);
|
|
158
230
|
var fieldValue = (_field_state_value = field.state.value) !== null && _field_state_value !== void 0 ? _field_state_value : "";
|
|
159
231
|
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_forms.FieldLayout, {
|
|
160
|
-
|
|
161
|
-
label,
|
|
162
|
-
labelProps,
|
|
232
|
+
...layoutBind,
|
|
163
233
|
error: resolvedError,
|
|
164
|
-
helperText,
|
|
165
|
-
required,
|
|
166
|
-
size,
|
|
167
|
-
knobProps,
|
|
168
234
|
onBlur: (0, import_forms.mergeFieldHandler)(field, "handleBlur", onBlur),
|
|
169
235
|
children: renderEditor(fieldValue, function (v) {
|
|
170
236
|
return field.handleChange(v);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","RichTextEditor_exports","__export","RichTextEditor","module","exports","import_jsx_runtime","require","import_react","import_tamagui","import_forms","import_RichEditor","import_t","
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","RichTextEditor_exports","__export","RichTextEditor","richTextIsEmpty","module","exports","import_jsx_runtime","require","import_react","import_tamagui","import_forms","import_RichEditor","import_t","v","applyExternalContent","editor","next","capabilities","setMarkdown","setHTML","RichTextExternalValueSync","param","editorRef","isFirst","useRef","lastPushed","useEffect","current","EditorFocusTarget","id","isWeb","jsx","tabIndex","readOnly","onFocus","event","_editorRef_current","currentTarget","blur","focus","style","position","width","height","padding","margin","border","opacity","overflow","props","defaultValue","form","placeholder","placeholderProp","disabled","minHeight","maxHeight","mode","name","preserveValue","validators","label","labelProps","error","errorProp","helperText","required","size","idProp","controlledValue","onChange","onBlur","showToolbar","compact","showBubbleToolbar","sections","skeleton","fullscreen","defaultFullscreen","onFullscreenChange","inlineEditing","onImageUpload","onFileUpload","mentions","t","resolvedForm","knobProps","useFormField","resolvedValidators","useResolvedValidators","internalValue","setInternalValue","useState","handleChange","useCallback","html","layoutBind","purpose","FieldLayout","children","Skeleton","variant","renderEditor","renderEditor2","currentValue","onValueChange","handleBlur","hasError","jsxs","Fragment","RichEditor","ref","initialContent","onChange2","editable","Field","field","_field_state_value","resolvedError","getFieldError","fieldValue","state","mergeFieldHandler"],"sources":["../../../src/RichTextEditor/index.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,sBAAA;AAAAC,QAAA,CAAAD,sBAAA;EAAAE,cAAA,EAAAA,CAAA,KAAAA,cAAA;EAAAC,eAAA,EAAAA,CAAA,KAAAA;AAAA;AAcAC,MAAA,CAAAC,OAAA,GAAAV,YAAyD,CAAAK,sBAAA;AAEzD,IAAAM,kBAAsB,GAAAC,OAAA;AAEtB,IAAAC,YAAA,GAWOD,OAAA;AAOP,IAAAE,cAAA,GAAAF,OAA2B;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AAuD,aAAA;QAAA/C,MACA,MAAA7D,YAAA,CAAAgH,iBAAA,EAAAN,KAAA,gBAAA7C,MAAA;QAAA4B,QACA,EAAAG,YAAA,CAAAkB,UAAA,YAAA3G,CAAA;UACA,OAAAuG,KAAA,CAAAvB,YAAA,CAAAhF,CAAA;QAAA,GACA;UACA,OAAAuG,KAAA,CAAAV,UAAA;QAAA,KAAAY,aAAA;MACF;IAAA;EAGN;AAGA","ignoreList":[]}
|
|
@@ -118,13 +118,6 @@ function HeadingPicker({
|
|
|
118
118
|
})
|
|
119
119
|
}), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_components.DropdownMenu.Content, {
|
|
120
120
|
minWidth: 200,
|
|
121
|
-
onCloseAutoFocus: event => {
|
|
122
|
-
event.preventDefault();
|
|
123
|
-
if (selectedRef.current) {
|
|
124
|
-
selectedRef.current = false;
|
|
125
|
-
editorRef.current?.focus();
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
121
|
children: HEADING_OPTIONS.map(option => {
|
|
129
122
|
const description = option.description();
|
|
130
123
|
return /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_components.DropdownMenu.Item, {
|
|
@@ -135,20 +135,24 @@ function HeadingPicker(param) {
|
|
|
135
135
|
children: getActiveHeadingLabel(state)
|
|
136
136
|
})
|
|
137
137
|
})
|
|
138
|
-
}),
|
|
138
|
+
}),
|
|
139
|
+
/*
|
|
140
|
+
* MPO-85: no onCloseAutoFocus. DropdownMenuContentProps used to extend
|
|
141
|
+
* PopoverContentProps and DropdownMenuContent used to spread `...props`,
|
|
142
|
+
* so this handler reached the overlay. The DropdownMenu rewrite dropped
|
|
143
|
+
* both: the interface now declares four props and the component reads
|
|
144
|
+
* only `children`, so the handler was already being discarded before it
|
|
145
|
+
* failed the build with TS2322.
|
|
146
|
+
*
|
|
147
|
+
* Restore the pass here in the same change that gives DropdownMenu.Content
|
|
148
|
+
* its prop pass-through back. Until then the intent is: toolbar menus must
|
|
149
|
+
* not steal focus back to the trigger on select-close, because the user
|
|
150
|
+
* expects to keep typing, so focus returns to the editor. Escape still
|
|
151
|
+
* restores the trigger via the menu's own close().
|
|
152
|
+
*/
|
|
153
|
+
/* @__PURE__ */
|
|
154
|
+
(0, import_jsx_runtime.jsx)(import_components.DropdownMenu.Content, {
|
|
139
155
|
minWidth: 200,
|
|
140
|
-
// Toolbar menus must not steal focus back to the trigger on
|
|
141
|
-
// select-close: the user expects to keep typing, so focus returns
|
|
142
|
-
// to the editor. Escape still restores the trigger via the menu's
|
|
143
|
-
// own close().
|
|
144
|
-
onCloseAutoFocus: function onCloseAutoFocus(event) {
|
|
145
|
-
event.preventDefault();
|
|
146
|
-
if (selectedRef.current) {
|
|
147
|
-
var _editorRef_current;
|
|
148
|
-
selectedRef.current = false;
|
|
149
|
-
(_editorRef_current = editorRef.current) === null || _editorRef_current === void 0 ? void 0 : _editorRef_current.focus();
|
|
150
|
-
}
|
|
151
|
-
},
|
|
152
156
|
children: HEADING_OPTIONS.map(function (option) {
|
|
153
157
|
var description8 = option.description();
|
|
154
158
|
return /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_components.DropdownMenu.Item, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","HeadingPicker_exports","__export","HeadingPicker","module","exports","import_jsx_runtime","require","import_react","import_components","import_tamagui","import_ToolbarButton","import_t","HEADING_OPTIONS","label","description","t","command","stateKey","fontSize","fontWeight","description2","description3","description4","description5","description6","description7","getActiveHeadingLabel","state","isHeading1","isHeading2","isHeading3","isHeading4","isHeading5","isHeading6","isAnyHeadingActive","param","editorRef","disabled","open","setOpen","useState","selectedRef","useRef","jsxs","DropdownMenu","onOpenChange","placement","children","jsx","Trigger","asChild","ToolbarDropdownButton","active","onPress","Text"
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","HeadingPicker_exports","__export","HeadingPicker","module","exports","import_jsx_runtime","require","import_react","import_components","import_tamagui","import_ToolbarButton","import_t","HEADING_OPTIONS","label","description","t","command","stateKey","fontSize","fontWeight","description2","description3","description4","description5","description6","description7","getActiveHeadingLabel","state","isHeading1","isHeading2","isHeading3","isHeading4","isHeading5","isHeading6","isAnyHeadingActive","param","editorRef","disabled","open","setOpen","useState","selectedRef","useRef","jsxs","DropdownMenu","onOpenChange","placement","children","jsx","Trigger","asChild","ToolbarDropdownButton","active","onPress","Text"],"sources":["../../../src/toolbar/HeadingPicker.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,qBAAA;AAAAC,QAAA,CAAAD,qBAAA;EAAAE,aAAA,EAAAA,CAAA,KAAAA;AAAA;AAIAC,MAAA,CAAAC,OAAA,GAAAT,YAAiC,CAAAK,qBAAA;AACjC,IAAAK,kBAAA,GAA6BC,OAAA;AAC7B,IAAAC,YAAA,GAAAD,OAAqB;AAErB,IAAAE,iBAAA,GAAAF,OAAsC;AACtC,IAAAG,cAAkB,GAAAH,OAAA;AA8HR,IAAAI,oBAAA,GAAAJ,OAAA;AAjGV,IAAAK,QAAM,GAAAL,OAAA,wBAAmC;AAAA,IACvCM,eAAA;EAEEC,KAAA;EACAC,WAAS,WAAAA,YAAA;IACT,QAAU,GAAAH,QAAA,CAAAI,CAAA;EACV;EACAC,OAAA,YAAY;EACdC,QAAA;EACAC,QAAA;EACEC,UAAO;AAAA,GACyB;EAEhCN,KAAA,MAAU;EACVC,WAAU,WAAAM,aAAA;IACV,WAAYT,QAAA,CAAAI,CAAA;EACd;EACAC,OAAA;EACEC,QAAO;EACPC,QAAA,MAAa;EACbC,UAAS;AAAA,GACC;EAEVN,KAAA;EACFC,WAAA,WAAAO,aAAA;IACA,WAAAV,QAAA,CAAAI,CAAA;EACE;EACAC,OAAA,YAAa;EACbC,QAAA,EAAS;EACTC,QAAA,E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hC,YAAa,CAAAiC,QAAA;EAAA,IAAAC,WAAb,OAAAlC,YAAA,CAAAmC,MAAA;EAAA,sBAEgB,IAAArC,kBAAA,CAAAsC,IAAA,EAAAnC,iBAAA,CAAAoC,YAAA;IAAAN,IAAA;IACuCO,YACtD,EAAAN,OAAY;IAAAO,SACZ,gBAAgB;IACdC,QAAA,GACA,eAAU,IAAA1C,kBAAS,CAAA2C,GAAe,EAAAxC,iBAAc,CAAAoC,YAAA,CAAAK,OAAA;MAChDC,OAAA,MAAQ;MAAKH,QACf,qBAAA1C,kBAAA,CAAA2C,GAAA,EAAAtC,oBAAA,CAAAyC,qBAAA;QAEAC,MAAA,EAAAlB,kBAAA,CAAAP,KAAA;QAAAU,QAAA;QAEAgB,OACA,WAAAA,QAAA;UAAuB,OAAAd,OAAA;QAAA;QAAE,YAAY,MAAA5B,QAAA,CAAAI,CAAA;QAAAgC,QAAA,qBAAA1C,kBAAA,CAAA2C,GAAA,EAAAvC,cAAA,CAAA6C,IAAA;UAAAnC,UAAA;UAbhC4B,QAAO,EAAArB,qBAAA,CAAAC,KAAA;QAcd;MAGN;IACF;IAEJ","ignoreList":[]}
|
|
@@ -78,13 +78,6 @@ function ListPicker({
|
|
|
78
78
|
})
|
|
79
79
|
}), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_components.DropdownMenu.Content, {
|
|
80
80
|
minWidth: 150,
|
|
81
|
-
onCloseAutoFocus: event => {
|
|
82
|
-
event.preventDefault();
|
|
83
|
-
if (selectedRef.current) {
|
|
84
|
-
selectedRef.current = false;
|
|
85
|
-
editorRef.current?.focus();
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
81
|
children: LIST_OPTIONS.map(option => {
|
|
89
82
|
const Icon = option.icon;
|
|
90
83
|
const label = option.label();
|
|
@@ -87,19 +87,18 @@ function ListPicker(param) {
|
|
|
87
87
|
"aria-label": (0, import_t.t)("Lists"),
|
|
88
88
|
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(ActiveIcon, {})
|
|
89
89
|
})
|
|
90
|
-
}),
|
|
90
|
+
}),
|
|
91
|
+
/*
|
|
92
|
+
* MPO-85: no onCloseAutoFocus — DropdownMenu.Content stopped accepting
|
|
93
|
+
* and forwarding it, so the handler was already discarded before it
|
|
94
|
+
* failed the build. Intent, to restore with the pass-through: toolbar
|
|
95
|
+
* menus must not steal focus back to the trigger on select-close, so
|
|
96
|
+
* focus returns to the editor and typing continues. Escape still
|
|
97
|
+
* restores the trigger via the menu's own close().
|
|
98
|
+
*/
|
|
99
|
+
/* @__PURE__ */
|
|
100
|
+
(0, import_jsx_runtime.jsx)(import_components.DropdownMenu.Content, {
|
|
91
101
|
minWidth: 150,
|
|
92
|
-
// Toolbar menus must not steal focus back to the trigger on
|
|
93
|
-
// select-close: focus returns to the editor so typing continues.
|
|
94
|
-
// Escape still restores the trigger via the menu's own close().
|
|
95
|
-
onCloseAutoFocus: function onCloseAutoFocus(event) {
|
|
96
|
-
event.preventDefault();
|
|
97
|
-
if (selectedRef.current) {
|
|
98
|
-
var _editorRef_current;
|
|
99
|
-
selectedRef.current = false;
|
|
100
|
-
(_editorRef_current = editorRef.current) === null || _editorRef_current === void 0 ? void 0 : _editorRef_current.focus();
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
102
|
children: LIST_OPTIONS.map(function (option) {
|
|
104
103
|
var Icon = option.icon;
|
|
105
104
|
var label4 = option.label();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","ListPicker_exports","__export","ListPicker","module","exports","import_jsx_runtime","require","import_react","import_components","import_ToolbarButton","import_icons","import_t","LIST_OPTIONS","label","t","command","stateKey","icon","BulletListIcon","label2","OrderedListIcon","label3","TaskListIcon","getActiveListIcon","state","isOrderedList","isTaskList","isAnyListActive","isBulletList","param","editorRef","disabled","open","setOpen","useState","selectedRef","useRef","ActiveIcon","jsxs","DropdownMenu","onOpenChange","placement","children","jsx","Trigger","asChild","ToolbarDropdownButton","active","onPress"
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","ListPicker_exports","__export","ListPicker","module","exports","import_jsx_runtime","require","import_react","import_components","import_ToolbarButton","import_icons","import_t","LIST_OPTIONS","label","t","command","stateKey","icon","BulletListIcon","label2","OrderedListIcon","label3","TaskListIcon","getActiveListIcon","state","isOrderedList","isTaskList","isAnyListActive","isBulletList","param","editorRef","disabled","open","setOpen","useState","selectedRef","useRef","ActiveIcon","jsxs","DropdownMenu","onOpenChange","placement","children","jsx","Trigger","asChild","ToolbarDropdownButton","active","onPress"],"sources":["../../../src/toolbar/ListPicker.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,kBAAA;AAAAC,QAAA,CAAAD,kBAAA;EAAAE,UAAA,EAAAA,CAAA,KAAAA;AAAA;AAIAC,MAAA,CAAAC,OAAA,GAAAT,YAAiC,CAAAK,kBAAA;AACjC,IAAAK,kBAAA,GAA6BC,OAAA;AAE7B,IAAAC,YAAA,GAAAD,OAAA,CAAsC;AACtC,IAAAE,iBAA8D,GAAAF,OAAA;AAC9D,IAAAG,oBAAkB,GAAAH,OAAA;AAoEd,IAAAI,YAAA,GAAAJ,OAAA;AAzCJ,IAAAK,QAAM,GAAAL,OAA6B;AAAA,IACjCM,YAAA;EAEEC,KAAA,WAASA,MAAA;IACT,QAAU,GAAAF,QAAA,CAAAG,CAAA;EACV;EACFC,OAAA;EACAC,QAAA;EACEC,IAAA,EAAAP,YAAa,CAAAQ;AAAgB,GACpB;EAETL,KAAA,EAAM,SAAAM,OAAA;IACR,WAAAR,QAAA,CAAAG,CAAA;EACA;EACEC,OAAO,eAAM;EACbC,QAAA,EAAS;EACTC,IAAA,EAAAP,YAAU,CAAAU;AAAA,GAEZ;EACFP,KAAA,WAAAQ,OAAA;IA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AEC;AAAA;AAXW;AAYd;AAGN;AAGN","ignoreList":[]}
|
|
@@ -133,13 +133,6 @@ function MoreDropdown({
|
|
|
133
133
|
})
|
|
134
134
|
}), /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_components.DropdownMenu.Content, {
|
|
135
135
|
minWidth: 200,
|
|
136
|
-
onCloseAutoFocus: event => {
|
|
137
|
-
event.preventDefault();
|
|
138
|
-
if (selectedRef.current) {
|
|
139
|
-
selectedRef.current = false;
|
|
140
|
-
editorRef.current?.focus();
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
136
|
children: [inlineItems.length > 0 && /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
|
144
137
|
children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(ItemSection, {
|
|
145
138
|
items: inlineItems,
|