@bigbinary/neeto-molecules 5.12.6 → 5.12.8
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.
|
@@ -48,8 +48,9 @@ var IMAGE_UPLOAD_CONFIG = {
|
|
|
48
48
|
"image/svg": [".svg"]
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
|
+
var DOCUMENT_TITLE_NODE_NAME = "documentTitle";
|
|
51
52
|
|
|
52
|
-
var css = ".nm-document-editor__wrapper{color:var(--foreground);height:100%}@media screen and (max-width:768px){.nm-document-editor__wrapper{width:100%}}.nm-document-editor__container{margin:0 auto;max-width:48rem!important;width:100%}.nm-document-editor__menubar{background-color:var(--background);position:sticky;top:0;width:100%;z-index:20}.nm-document-editor__menubar .neeto-editor-fixed-menu,.nm-document-editor__menubar.neeto-editor-fixed-menu{width:100%}.nm-document-editor__title{margin-top:1.5rem;width:100%}.nm-document-editor__title textarea{field-sizing:content!important;background-color:transparent;color:var(--foreground);font-size:2.625rem;font-weight:700;line-height:1.15;max-height:none;min-height:1lh!important;overflow:hidden!important;padding:0;resize:none}.nm-document-editor__title textarea,.nm-document-editor__title textarea:focus-visible,.nm-document-editor__title textarea[aria-invalid=true],.nm-document-editor__title textarea[aria-invalid=true]:focus-visible{border-color:transparent!important;box-shadow:none!important}.nm-document-editor__title textarea::-moz-placeholder{color:var(--muted-foreground);opacity:.5}.nm-document-editor__title textarea::placeholder{color:var(--muted-foreground);opacity:.5}@media screen and (max-width:1024px){.nm-document-editor__title textarea{font-size:2rem;line-height:1.25}}.nm-document-editor__error{margin:.75rem auto}.nm-document-editor__thumbnail{background-color:var(--muted);border-radius:.5rem;overflow:hidden;padding-bottom:56.25%;position:relative;width:100%}.nm-document-editor__thumbnail img{height:100%;inset-inline-start:0;-o-object-fit:cover;object-fit:cover;position:absolute;top:0;width:100%}.nm-document-editor__wrapper .neeto-editor-fixed-menu{border-inline-end:0!important;border-inline-start:0!important;border-radius:0!important}.nm-document-editor__wrapper .neeto-editor-fixed-menu__wrapper{margin:0 auto;max-width:46.875rem;padding-block:.375rem}.nm-document-editor__wrapper button.ne-toolbar-item{border-radius:.5rem!important}@media screen and (max-width:768px){.nm-document-editor__wrapper .neeto-editor-fixed-menu__wrapper{overflow-x:auto}}.nm-document-editor__wrapper .ProseMirror{flex-grow:1;height:auto;max-height:none;outline:none;overflow-y:hidden}.nm-document-editor__wrapper .ProseMirror p.is-editor-empty:first-child:before{color:var(--muted-foreground);content:attr(data-placeholder);float:left;height:0;opacity:.5;pointer-events:none}.nm-document-editor__wrapper .editor-content__wrapper{border:none!important;padding:.75rem 1.5rem 2rem!important;width:100%!important}.nm-document-editor__wrapper .editor-content-attachments{border:none;margin:.75rem auto 0;max-width:48rem!important;padding-inline-end:1rem;padding-inline-start:1rem}.nm-document-editor__wrapper .editor-content-attachments--no-attachments{display:none!important}.nm-document-editor__wrapper .neeto-editor-character-count{color:var(--muted-foreground);font-size:.75rem;margin:0 auto;max-width:48rem!important;padding-inline-end:1rem;padding-inline-start:1rem}.nm-document-editor__wrapper .ne-attachments__wrapper{width:100%}.nm-document-editor__wrapper ins{background-color:#c1f4cb!important;text-decoration:none!important}.nm-document-editor__wrapper del{background-color:#faa!important}";
|
|
53
|
+
var css = ".nm-document-editor__wrapper{color:var(--foreground);height:100%}@media screen and (max-width:768px){.nm-document-editor__wrapper{width:100%}}.nm-document-editor__container{margin:0 auto;max-width:48rem!important;width:100%}.nm-document-editor__menubar{background-color:var(--background);position:sticky;top:0;width:100%;z-index:20}.nm-document-editor__menubar .neeto-editor-fixed-menu,.nm-document-editor__menubar.neeto-editor-fixed-menu{width:100%}.nm-document-editor__title{margin-top:1.5rem;width:100%}.nm-document-editor__title textarea{field-sizing:content!important;background-color:transparent;color:var(--foreground);font-size:2.625rem;font-weight:700;line-height:1.15;max-height:none;min-height:1lh!important;overflow:hidden!important;padding:0;resize:none}.nm-document-editor__title textarea,.nm-document-editor__title textarea:focus-visible,.nm-document-editor__title textarea[aria-invalid=true],.nm-document-editor__title textarea[aria-invalid=true]:focus-visible{border-color:transparent!important;box-shadow:none!important}.nm-document-editor__wrapper .ProseMirror h1[data-document-title]{color:var(--foreground);font-size:2.625rem;font-weight:700;line-height:1.15;margin:1.5rem 0 .75rem}.nm-document-editor__wrapper .ProseMirror h1[data-document-title].is-empty:before{color:var(--muted-foreground);opacity:.5}.nm-document-editor__title textarea::-moz-placeholder{color:var(--muted-foreground);opacity:.5}.nm-document-editor__title textarea::placeholder{color:var(--muted-foreground);opacity:.5}@media screen and (max-width:1024px){.nm-document-editor__title textarea,.nm-document-editor__wrapper .ProseMirror h1[data-document-title]{font-size:2rem;line-height:1.25}}.nm-document-editor__error{margin:.75rem auto}.nm-document-editor__thumbnail{background-color:var(--muted);border-radius:.5rem;overflow:hidden;padding-bottom:56.25%;position:relative;width:100%}.nm-document-editor__thumbnail img{height:100%;inset-inline-start:0;-o-object-fit:cover;object-fit:cover;position:absolute;top:0;width:100%}.nm-document-editor__wrapper .neeto-editor-fixed-menu{border-inline-end:0!important;border-inline-start:0!important;border-radius:0!important}.nm-document-editor__wrapper .neeto-editor-fixed-menu__wrapper{margin:0 auto;max-width:46.875rem;padding-block:.375rem}.nm-document-editor__wrapper button.ne-toolbar-item{border-radius:.5rem!important}@media screen and (max-width:768px){.nm-document-editor__wrapper .neeto-editor-fixed-menu__wrapper{overflow-x:auto}}.nm-document-editor__wrapper .ProseMirror{flex-grow:1;height:auto;max-height:none;outline:none;overflow-y:hidden}.nm-document-editor__wrapper .ProseMirror p.is-editor-empty:first-child:before{color:var(--muted-foreground);content:attr(data-placeholder);float:left;height:0;opacity:.5;pointer-events:none}.nm-document-editor__wrapper .editor-content__wrapper{border:none!important;padding:.75rem 1.5rem 2rem!important;width:100%!important}.nm-document-editor__wrapper .editor-content-attachments{border:none;margin:.75rem auto 0;max-width:48rem!important;padding-inline-end:1rem;padding-inline-start:1rem}.nm-document-editor__wrapper .editor-content-attachments--no-attachments{display:none!important}.nm-document-editor__wrapper .neeto-editor-character-count{color:var(--muted-foreground);font-size:.75rem;margin:0 auto;max-width:48rem!important;padding-inline-end:1rem;padding-inline-start:1rem}.nm-document-editor__wrapper .ne-attachments__wrapper{width:100%}.nm-document-editor__wrapper ins{background-color:#c1f4cb!important;text-decoration:none!important}.nm-document-editor__wrapper del{background-color:#faa!important}";
|
|
53
54
|
injectCss.n(css,{});
|
|
54
55
|
|
|
55
56
|
var useEditor = function useEditor(_ref) {
|
|
@@ -188,6 +189,22 @@ var getThumbnailAddon = function getThumbnailAddon(command) {
|
|
|
188
189
|
};
|
|
189
190
|
};
|
|
190
191
|
|
|
192
|
+
// Stands in for the title textarea when the title lives inside the editor, so
|
|
193
|
+
// that getTitleRef consumers can keep focusing it and reading its value.
|
|
194
|
+
var createInlineTitleRef = function createInlineTitleRef(getEditor) {
|
|
195
|
+
return {
|
|
196
|
+
focus: function focus() {
|
|
197
|
+
var _getEditor, _getEditor$focusDocum;
|
|
198
|
+
return (_getEditor = getEditor()) === null || _getEditor === void 0 || (_getEditor = _getEditor.commands) === null || _getEditor === void 0 || (_getEditor$focusDocum = _getEditor.focusDocumentTitle) === null || _getEditor$focusDocum === void 0 ? void 0 : _getEditor$focusDocum.call(_getEditor);
|
|
199
|
+
},
|
|
200
|
+
get value() {
|
|
201
|
+
var _getEditor$state$doc$, _getEditor2;
|
|
202
|
+
return (_getEditor$state$doc$ = (_getEditor2 = getEditor()) === null || _getEditor2 === void 0 || (_getEditor2 = _getEditor2.state) === null || _getEditor2 === void 0 || (_getEditor2 = _getEditor2.doc) === null || _getEditor2 === void 0 || (_getEditor2 = _getEditor2.firstChild) === null || _getEditor2 === void 0 ? void 0 : _getEditor2.textContent) !== null && _getEditor$state$doc$ !== void 0 ? _getEditor$state$doc$ : "";
|
|
203
|
+
},
|
|
204
|
+
setSelectionRange: neetoCist.noop
|
|
205
|
+
};
|
|
206
|
+
};
|
|
207
|
+
|
|
191
208
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
192
209
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
193
210
|
var Editor = function Editor(_ref) {
|
|
@@ -210,14 +227,19 @@ var Editor = function Editor(_ref) {
|
|
|
210
227
|
titleProps = _ref$titleProps === void 0 ? {} : _ref$titleProps,
|
|
211
228
|
_ref$hasThumbnailImag = _ref.hasThumbnailImage,
|
|
212
229
|
hasThumbnailImage = _ref$hasThumbnailImag === void 0 ? false : _ref$hasThumbnailImag,
|
|
230
|
+
_ref$isTitleInline = _ref.isTitleInline,
|
|
231
|
+
isTitleInline = _ref$isTitleInline === void 0 ? false : _ref$isTitleInline,
|
|
213
232
|
children = _ref.children;
|
|
214
233
|
var _useTranslation = reactI18next.useTranslation(),
|
|
215
234
|
t = _useTranslation.t;
|
|
216
235
|
var _useFormikContext = formik.useFormikContext(),
|
|
217
236
|
values = _useFormikContext.values,
|
|
237
|
+
touched = _useFormikContext.touched,
|
|
218
238
|
setFieldValue = _useFormikContext.setFieldValue,
|
|
239
|
+
setFieldTouched = _useFormikContext.setFieldTouched,
|
|
219
240
|
submitForm = _useFormikContext.submitForm;
|
|
220
241
|
var thumbnailImageUrl = values.thumbnailImageUrl;
|
|
242
|
+
var titleValue = values[titleFieldName];
|
|
221
243
|
var titleRef = React.useRef();
|
|
222
244
|
var editorRef = React.useRef();
|
|
223
245
|
var _useState = React.useState(false),
|
|
@@ -251,6 +273,49 @@ var Editor = function Editor(_ref) {
|
|
|
251
273
|
editorHotkeyRef = _useEditor.editorHotkeyRef,
|
|
252
274
|
titleHotkeyRef = _useEditor.titleHotkeyRef,
|
|
253
275
|
errors = _useEditor.errors;
|
|
276
|
+
var lastInlineTitle = React.useRef(titleValue !== null && titleValue !== void 0 ? titleValue : "");
|
|
277
|
+
var onTitleChangeRef = React.useRef(onTitleChange);
|
|
278
|
+
onTitleChangeRef.current = onTitleChange;
|
|
279
|
+
|
|
280
|
+
// FormikEditor is a FastField, so this has to read the latest handler by ref.
|
|
281
|
+
var handleInlineTitleChange = React.useCallback(function (title) {
|
|
282
|
+
var _onTitleChangeRef$cur;
|
|
283
|
+
lastInlineTitle.current = title;
|
|
284
|
+
setFieldValue(titleFieldName, title);
|
|
285
|
+
(_onTitleChangeRef$cur = onTitleChangeRef.current) === null || _onTitleChangeRef$cur === void 0 || _onTitleChangeRef$cur.call(onTitleChangeRef, title);
|
|
286
|
+
}, [setFieldValue, titleFieldName]);
|
|
287
|
+
var inlineTitle = React.useMemo(function () {
|
|
288
|
+
return isTitleInline ? {
|
|
289
|
+
value: titleValue,
|
|
290
|
+
placeholder: titleProps.placeholder || t("neetoMolecules.documentEditor.title"),
|
|
291
|
+
dataTestId: titleProps["data-testid"],
|
|
292
|
+
autoFocus: titleProps.autoFocus,
|
|
293
|
+
onChange: handleInlineTitleChange
|
|
294
|
+
} : null;
|
|
295
|
+
}, [isTitleInline]);
|
|
296
|
+
|
|
297
|
+
// Picks up titles set from outside the editor, like a restored version.
|
|
298
|
+
React.useEffect(function () {
|
|
299
|
+
var _editorRef$current, _editorRef$current$se;
|
|
300
|
+
if (!isTitleInline) return;
|
|
301
|
+
var title = titleValue !== null && titleValue !== void 0 ? titleValue : "";
|
|
302
|
+
if (title === lastInlineTitle.current) return;
|
|
303
|
+
lastInlineTitle.current = title;
|
|
304
|
+
(_editorRef$current = editorRef.current) === null || _editorRef$current === void 0 || (_editorRef$current = _editorRef$current.editor) === null || _editorRef$current === void 0 || (_editorRef$current = _editorRef$current.commands) === null || _editorRef$current === void 0 || (_editorRef$current$se = _editorRef$current.setDocumentTitle) === null || _editorRef$current$se === void 0 || _editorRef$current$se.call(_editorRef$current, title);
|
|
305
|
+
}, [isTitleInline, titleValue]);
|
|
306
|
+
|
|
307
|
+
// FormikEditor only re-renders for its own field, and the title's error is
|
|
308
|
+
// rendered inside it.
|
|
309
|
+
var shouldUpdateEditor = function shouldUpdateEditor(prevProps, nextProps) {
|
|
310
|
+
var _editorProps$shouldUp;
|
|
311
|
+
return Boolean((_editorProps$shouldUp = editorProps.shouldUpdate) === null || _editorProps$shouldUp === void 0 ? void 0 : _editorProps$shouldUp.call(editorProps, prevProps, nextProps)) || isTitleInline && (prevProps.formik.errors[titleFieldName] !== nextProps.formik.errors[titleFieldName] || prevProps.formik.touched[titleFieldName] !== nextProps.formik.touched[titleFieldName]);
|
|
312
|
+
};
|
|
313
|
+
var handleEditorBlur = function handleEditorBlur(props) {
|
|
314
|
+
var _editorProps$onBlur;
|
|
315
|
+
var isCaretInTitle = props.editor.state.selection.$from.parent.type.name === DOCUMENT_TITLE_NODE_NAME;
|
|
316
|
+
isTitleInline && isCaretInTitle && setFieldTouched(titleFieldName, true);
|
|
317
|
+
(_editorProps$onBlur = editorProps.onBlur) === null || _editorProps$onBlur === void 0 || _editorProps$onBlur.call(editorProps, props);
|
|
318
|
+
};
|
|
254
319
|
var setTitleRef = function setTitleRef(node) {
|
|
255
320
|
titleHotkeyRef.current = node;
|
|
256
321
|
getTitleRef(node);
|
|
@@ -259,16 +324,21 @@ var Editor = function Editor(_ref) {
|
|
|
259
324
|
var setEditorRef = React.useCallback(function (node) {
|
|
260
325
|
editorRef.current = node;
|
|
261
326
|
getEditorRef(node);
|
|
327
|
+
if (!isTitleInline) return;
|
|
328
|
+
getTitleRef(node !== null && node !== void 0 && node.editor ? createInlineTitleRef(function () {
|
|
329
|
+
var _editorRef$current2;
|
|
330
|
+
return (_editorRef$current2 = editorRef.current) === null || _editorRef$current2 === void 0 ? void 0 : _editorRef$current2.editor;
|
|
331
|
+
}) : null);
|
|
262
332
|
}, []);
|
|
263
333
|
var addons = React.useMemo(function () {
|
|
264
334
|
return EDITOR_ADDONS.concat(editorProps.addons || []);
|
|
265
335
|
}, [editorProps.addons]);
|
|
266
336
|
var handleTab = function handleTab() {
|
|
267
|
-
var _editorRef$
|
|
268
|
-
var isListActive = ((_editorRef$
|
|
337
|
+
var _editorRef$current3, _editorRef$current4;
|
|
338
|
+
var isListActive = ((_editorRef$current3 = editorRef.current) === null || _editorRef$current3 === void 0 || (_editorRef$current3 = _editorRef$current3.editor) === null || _editorRef$current3 === void 0 ? void 0 : _editorRef$current3.isActive("orderedList")) || ((_editorRef$current4 = editorRef.current) === null || _editorRef$current4 === void 0 || (_editorRef$current4 = _editorRef$current4.editor) === null || _editorRef$current4 === void 0 ? void 0 : _editorRef$current4.isActive("bulletList"));
|
|
269
339
|
if (isListActive) {
|
|
270
|
-
var _editorRef$
|
|
271
|
-
(_editorRef$
|
|
340
|
+
var _editorRef$current5;
|
|
341
|
+
(_editorRef$current5 = editorRef.current) === null || _editorRef$current5 === void 0 || (_editorRef$current5 = _editorRef$current5.editor) === null || _editorRef$current5 === void 0 || (_editorRef$current5 = _editorRef$current5.commands) === null || _editorRef$current5 === void 0 || _editorRef$current5.sinkListItem("listItem");
|
|
272
342
|
return true;
|
|
273
343
|
}
|
|
274
344
|
return true;
|
|
@@ -294,20 +364,29 @@ var Editor = function Editor(_ref) {
|
|
|
294
364
|
name: editorContentFieldName,
|
|
295
365
|
ref: setEditorRef
|
|
296
366
|
}, _objectSpread(_objectSpread({
|
|
297
|
-
attachments: attachments
|
|
367
|
+
attachments: attachments,
|
|
368
|
+
inlineTitle: inlineTitle
|
|
298
369
|
}, editorProps), {}, {
|
|
299
370
|
addons: addons
|
|
300
371
|
})), {}, {
|
|
301
372
|
contentWrapperClassName: "w-full flex flex-col flex-grow",
|
|
373
|
+
shouldUpdate: shouldUpdateEditor,
|
|
302
374
|
keyboardShortcuts: _objectSpread({
|
|
303
375
|
Tab: handleTab,
|
|
304
376
|
ArrowUp: handleEditorArrowUp
|
|
305
377
|
}, editorProps.keyboardShortcuts),
|
|
378
|
+
onBlur: handleEditorBlur,
|
|
306
379
|
onChange: handleContentChange,
|
|
307
380
|
onChangeAttachments: handleAttachmentChange,
|
|
308
381
|
children: [children, /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
309
382
|
className: "nm-document-editor__container px-6",
|
|
310
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(
|
|
383
|
+
children: [isTitleInline ? touched[titleFieldName] && errors[titleFieldName] && /*#__PURE__*/jsxRuntime.jsx("p", {
|
|
384
|
+
className: "text-destructive nm-document-editor__error text-sm font-normal",
|
|
385
|
+
"data-slot": "field-error",
|
|
386
|
+
"data-testid": "document-title-input-error",
|
|
387
|
+
role: "alert",
|
|
388
|
+
children: errors[titleFieldName]
|
|
389
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(formik$1.Textarea, _objectSpread(_objectSpread({
|
|
311
390
|
nakedTextarea: true,
|
|
312
391
|
className: "nm-document-editor__title",
|
|
313
392
|
"data-testid": "neeto-molecules-document-title-text-field",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentEditor.js","sources":["../../../node_modules/lucide-react/dist/esm/icons/image.mjs","../../../src/v2/components/DocumentEditor/constants.js","../../../src/v2/components/DocumentEditor/hooks/useEditor.js","../../../src/v2/components/DocumentEditor/MediaUploader.jsx","../../../src/v2/components/DocumentEditor/utils.js","../../../src/v2/components/DocumentEditor/index.jsx"],"sourcesContent":["/**\n * @license lucide-react v1.24.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"rect\", { width: \"18\", height: \"18\", x: \"3\", y: \"3\", rx: \"2\", ry: \"2\", key: \"1m3agn\" }],\n [\"circle\", { cx: \"9\", cy: \"9\", r: \"2\", key: \"af1f0g\" }],\n [\"path\", { d: \"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21\", key: \"1xmnt7\" }]\n];\nconst Image = createLucideIcon(\"image\", __iconNode);\n\nexport { __iconNode, Image as default };\n//# sourceMappingURL=image.mjs.map\n","export const EDITOR_ADDONS = [\n \"highlight\",\n \"emoji\",\n \"video-upload\",\n \"code-block\",\n \"block-quote\",\n \"image-upload\",\n \"image-upload-unsplash\",\n \"divider\",\n \"video-embed\",\n \"undo\",\n \"redo\",\n \"table\",\n \"callout\",\n];\n\nexport const DEFAULT_EDITOR_PROPS = {\n isMenuIndependent: true,\n addons: [],\n size: \"medium\",\n};\n\nexport const IMAGE_UPLOAD_CONFIG = {\n maxImageSize: 1,\n allowedImageTypes: {\n \"image/jpg\": [\".jpg\", \".jpeg\"],\n \"image/png\": [\".png\"],\n \"image/svg\": [\".svg\"],\n },\n};\n","import { useCallback } from \"react\";\n\nimport { useFormikContext } from \"formik\";\nimport { isPresent } from \"neetocist\";\nimport useHotkeys from \"neetohotkeys\";\nimport { range } from \"ramda\";\n\nconst useEditor = ({\n onContentChange,\n editorContentFieldName,\n onAttachmentChange,\n onTitleChange,\n titleFieldName,\n editorRef,\n titleRef,\n}) => {\n const { setFieldValue, errors } = useFormikContext();\n\n const handleContentChange = useCallback(\n content => {\n setFieldValue(editorContentFieldName, content);\n onContentChange?.(content);\n },\n [editorContentFieldName, onContentChange, setFieldValue]\n );\n\n const handleAttachmentChange = useCallback(\n attachments => {\n setFieldValue(\"attachments\", attachments);\n onAttachmentChange?.(attachments);\n },\n [onAttachmentChange, setFieldValue]\n );\n\n const handleTitleChange = event => {\n const title = event.target.value;\n setFieldValue(titleFieldName, title);\n onTitleChange?.(title);\n };\n\n const handleEditorBackspaceKeypress = () => {\n const editor = editorRef.current?.editor;\n const selection = editor?.state?.selection;\n if (\n editor?.isFocused &&\n isPresent(titleRef.current) &&\n selection?.anchor === 1\n ) {\n const title = titleRef.current.value;\n titleRef.current.focus();\n titleRef.current.setSelectionRange(title?.length, title?.length);\n }\n };\n\n const isInFirstTextblock = $from =>\n range(0, $from.depth).every(depth => $from.index(depth) === 0);\n\n const handleEditorArrowUp = ({ editor }) => {\n const title = titleRef.current;\n const { selection } = editor.state;\n const isOnFirstLine =\n selection.empty &&\n isInFirstTextblock(selection.$from) &&\n editor.view.endOfTextblock(\"up\");\n\n if (!isOnFirstLine || !title || title.disabled) return false;\n\n title.focus();\n title.setSelectionRange(title.value.length, title.value.length);\n\n return true;\n };\n\n const handleTitleKeyDown = event => {\n if (event.defaultPrevented) return;\n\n const { key, shiftKey, altKey, metaKey, ctrlKey } = event;\n if (key === \"Enter\" && !shiftKey) {\n event.preventDefault();\n\n return;\n }\n\n if (key !== \"ArrowDown\" || shiftKey || altKey || metaKey || ctrlKey) {\n return;\n }\n\n // Let the caret move through a wrapped title first and jump to the\n // editor only once ArrowDown can no longer move it.\n const title = event.currentTarget;\n const { selectionStart, selectionEnd } = title;\n setTimeout(() => {\n const isCaretStuck =\n document.activeElement === title &&\n selectionStart === selectionEnd &&\n title.selectionStart === selectionStart &&\n title.selectionEnd === selectionEnd;\n\n isCaretStuck && editorRef.current?.editor?.commands?.focus(\"start\");\n });\n };\n\n const titleHotkeyRef = useHotkeys(\n \"return\",\n () => {\n editorRef.current?.editor?.commands?.insertContentAt(0, \"<p />\");\n editorRef.current?.editor?.commands?.focus(\"start\");\n },\n { mode: \"scoped\" }\n );\n\n const editorHotkeyRef = useHotkeys(\n \"backspace\",\n handleEditorBackspaceKeypress,\n { mode: \"scoped\" }\n );\n\n return {\n handleContentChange,\n handleAttachmentChange,\n handleTitleChange,\n handleEditorArrowUp,\n handleTitleKeyDown,\n editorHotkeyRef,\n titleHotkeyRef,\n errors,\n };\n};\n\nexport default useEditor;\n","import { Spinner } from \"@bigbinary/neeto-atoms\";\nimport { useFormikContext } from \"formik\";\nimport { ImageUploader } from \"neetoimageuploader/v2\";\nimport { isEmpty } from \"ramda\";\n\nimport { IMAGE_UPLOAD_CONFIG } from \"./constants\";\n\nconst MediaUploader = ({ setIsThumbnailImageModalOpen }) => {\n const {\n values: { thumbnailImageUrl },\n setFieldValue,\n initialValues,\n submitForm,\n } = useFormikContext();\n\n const handleUpload = file => {\n const { url, signedId } = file;\n setFieldValue(\"thumbnailImage\", signedId);\n setFieldValue(\"thumbnailImageUrl\", url);\n setTimeout(() => {\n setIsThumbnailImageModalOpen(false);\n submitForm();\n });\n };\n\n if (isEmpty(initialValues)) {\n return <Spinner />;\n }\n\n return (\n <ImageUploader\n className=\"h-auto w-full\"\n key={thumbnailImageUrl}\n src={thumbnailImageUrl}\n uploadConfig={IMAGE_UPLOAD_CONFIG}\n onUploadComplete={handleUpload}\n />\n );\n};\n\nexport default MediaUploader;\n","import { t } from \"i18next\";\nimport { Image } from \"lucide-react\";\n\nexport const getThumbnailAddon = command => ({\n label: t(\"neetoMolecules.documentEditor.thumbnailImage\"),\n optionName: \"thumbnail-image\",\n command,\n icon: Image,\n isEnabled: true,\n \"data-testid\": \"thumbnail-image-addon\",\n});\n","import { memo, useCallback, useMemo, useRef, useState } from \"react\";\n\nimport classNames from \"classnames\";\nimport { useFormikContext } from \"formik\";\nimport { Ellipsis } from \"lucide-react\";\nimport { Button, Dialog, DropdownMenu } from \"neetoatoms\";\nimport { Textarea as FormikTextarea } from \"neetoatoms/formik\";\nimport { noop } from \"neetocist\";\nimport { FormikEditor } from \"neetoeditor/v2\";\nimport PropTypes from \"prop-types\";\nimport { mergeRight } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { DEFAULT_EDITOR_PROPS, EDITOR_ADDONS } from \"./constants\";\nimport \"./editor.css\";\nimport useEditor from \"./hooks/useEditor\";\nimport MediaUploader from \"./MediaUploader\";\nimport { getThumbnailAddon } from \"./utils\";\n\nconst Editor = ({\n attachments,\n onContentChange,\n onAttachmentChange,\n onTitleChange,\n getTitleRef = noop,\n getEditorRef = noop,\n menuClassName,\n editorContentFieldName = \"htmlContent\",\n titleFieldName = \"title\",\n editorProps: customEditorProps = {},\n titleProps = {},\n hasThumbnailImage = false,\n children,\n}) => {\n const { t } = useTranslation();\n const { values, setFieldValue, submitForm } = useFormikContext();\n const { thumbnailImageUrl } = values;\n\n const titleRef = useRef();\n const editorRef = useRef();\n const [isThumbnailImageModalOpen, setIsThumbnailImageModalOpen] =\n useState(false);\n\n const editorProps = useMemo(() => {\n const baseProps = mergeRight(DEFAULT_EDITOR_PROPS, customEditorProps);\n\n if (!hasThumbnailImage) return baseProps;\n\n const thumbnailAddon = getThumbnailAddon(() =>\n setIsThumbnailImageModalOpen(true)\n );\n\n return mergeRight(baseProps, { addonCommands: [thumbnailAddon] });\n }, [customEditorProps, hasThumbnailImage]);\n\n const {\n handleContentChange,\n handleAttachmentChange,\n handleTitleChange,\n handleEditorArrowUp,\n handleTitleKeyDown,\n editorHotkeyRef,\n titleHotkeyRef,\n errors,\n } = useEditor({\n onContentChange,\n editorContentFieldName,\n onAttachmentChange,\n onTitleChange,\n titleFieldName,\n editorRef,\n titleRef,\n });\n\n const setTitleRef = node => {\n titleHotkeyRef.current = node;\n getTitleRef(node);\n titleRef.current = node;\n };\n\n const setEditorRef = useCallback(node => {\n editorRef.current = node;\n getEditorRef(node);\n }, []);\n\n const addons = useMemo(\n () => EDITOR_ADDONS.concat(editorProps.addons || []),\n [editorProps.addons]\n );\n\n const handleTab = () => {\n const isListActive =\n editorRef.current?.editor?.isActive(\"orderedList\") ||\n editorRef.current?.editor?.isActive(\"bulletList\");\n\n if (isListActive) {\n editorRef.current?.editor?.commands?.sinkListItem(\"listItem\");\n\n return true;\n }\n\n return true;\n };\n\n const handleDeleteThumbnail = () => {\n setFieldValue(\"thumbnailImage\", \"\");\n setFieldValue(\"thumbnailImageUrl\", \"\");\n setTimeout(submitForm);\n };\n\n return (\n <div\n className=\"nm-document-editor__wrapper\"\n data-testid=\"document-editor-container\"\n ref={editorHotkeyRef}\n >\n <FormikEditor\n attachmentsClassName=\"editor-content-attachments w-full flex-shrink-0\"\n className=\"h-full w-full\"\n contentClassName=\"editor-content__wrapper nm-document-editor__container\"\n data-testid=\"neeto-molecules-document-content-text-area\"\n error={undefined}\n errorWrapperClassName=\"w-full min-h-full flex flex-col items-center\"\n hideSlashCommands={false}\n menuClassName={classNames(\"nm-document-editor__menubar\", menuClassName)}\n name={editorContentFieldName}\n ref={setEditorRef}\n {...{ attachments, ...editorProps, addons }}\n contentWrapperClassName=\"w-full flex flex-col flex-grow\"\n keyboardShortcuts={{\n Tab: handleTab,\n ArrowUp: handleEditorArrowUp,\n ...editorProps.keyboardShortcuts,\n }}\n onChange={handleContentChange}\n onChangeAttachments={handleAttachmentChange}\n >\n {children}\n <div className=\"nm-document-editor__container px-6\">\n <FormikTextarea\n nakedTextarea\n className=\"nm-document-editor__title\"\n data-testid=\"neeto-molecules-document-title-text-field\"\n name={titleFieldName}\n ref={setTitleRef}\n rows={1}\n placeholder={\n titleProps.placeholder || t(\"neetoMolecules.documentEditor.title\")\n }\n onChange={handleTitleChange}\n {...titleProps}\n onKeyDown={event => {\n titleProps.onKeyDown?.(event);\n handleTitleKeyDown(event);\n }}\n />\n {thumbnailImageUrl && (\n <div className=\"group relative mt-4\">\n <div className=\"nm-document-editor__thumbnail\">\n <img alt=\"Cover\" src={thumbnailImageUrl} />\n </div>\n <div className=\"absolute end-2 top-2\">\n <DropdownMenu\n customTarget={\n <Button\n icon={Ellipsis}\n size=\"icon-sm\"\n variant=\"secondary\"\n aria-label={t(\n \"neetoMolecules.documentEditor.thumbnailOptions\"\n )}\n />\n }\n >\n <DropdownMenu.MenuItem onClick={handleDeleteThumbnail}>\n {t(\"neetoMolecules.documentEditor.delete\")}\n </DropdownMenu.MenuItem>\n </DropdownMenu>\n </div>\n </div>\n )}\n {errors[editorContentFieldName] && (\n <p\n className=\"text-destructive nm-document-editor__error text-sm font-normal\"\n data-slot=\"field-error\"\n data-testid=\"articles-content-input-error\"\n role=\"alert\"\n >\n {errors[editorContentFieldName]}\n </p>\n )}\n </div>\n </FormikEditor>\n <Dialog\n data-testid=\"thumbnail-image-modal\"\n isOpen={isThumbnailImageModalOpen}\n size=\"medium\"\n onClose={() => setIsThumbnailImageModalOpen(false)}\n >\n <Dialog.Header>\n <Dialog.Title>\n {t(\"neetoMolecules.documentEditor.uploadThumbnailImage\")}\n </Dialog.Title>\n </Dialog.Header>\n <Dialog.Body>\n <MediaUploader {...{ setIsThumbnailImageModalOpen }} />\n </Dialog.Body>\n </Dialog>\n </div>\n );\n};\n\nEditor.propTypes = {\n attachments: PropTypes.arrayOf(\n PropTypes.shape({\n contentType: PropTypes.string,\n filename: PropTypes.string,\n signedId: PropTypes.string,\n url: PropTypes.string,\n })\n ),\n onContentChange: PropTypes.func,\n onAttachmentChange: PropTypes.func,\n onTitleChange: PropTypes.func,\n getTitleRef: PropTypes.func,\n getEditorRef: PropTypes.func,\n editorContentFieldName: PropTypes.string,\n titleFieldName: PropTypes.string,\n editorProps: PropTypes.object,\n titleProps: PropTypes.object,\n menuClassName: PropTypes.string,\n children: PropTypes.node,\n hasThumbnailImage: PropTypes.bool,\n};\n\nEditor.displayName = \"DocumentEditor\";\n\nexport default memo(Editor);\n"],"names":["createLucideIcon","EDITOR_ADDONS","DEFAULT_EDITOR_PROPS","isMenuIndependent","addons","size","IMAGE_UPLOAD_CONFIG","maxImageSize","allowedImageTypes","useEditor","_ref","onContentChange","editorContentFieldName","onAttachmentChange","onTitleChange","titleFieldName","editorRef","titleRef","_useFormikContext","useFormikContext","setFieldValue","errors","handleContentChange","useCallback","content","handleAttachmentChange","attachments","handleTitleChange","event","title","target","value","handleEditorBackspaceKeypress","_editorRef$current","_editor$state","editor","current","selection","state","isFocused","isPresent","anchor","focus","setSelectionRange","length","isInFirstTextblock","$from","range","depth","every","index","handleEditorArrowUp","_ref2","isOnFirstLine","empty","view","endOfTextblock","disabled","handleTitleKeyDown","defaultPrevented","key","shiftKey","altKey","metaKey","ctrlKey","preventDefault","currentTarget","selectionStart","selectionEnd","setTimeout","_editorRef$current2","isCaretStuck","document","activeElement","commands","titleHotkeyRef","useHotkeys","_editorRef$current3","_editorRef$current4","insertContentAt","mode","editorHotkeyRef","MediaUploader","setIsThumbnailImageModalOpen","thumbnailImageUrl","values","initialValues","submitForm","handleUpload","file","url","signedId","isEmpty","_jsx","Spinner","ImageUploader","className","src","uploadConfig","onUploadComplete","getThumbnailAddon","command","label","t","optionName","icon","Image","isEnabled","Editor","_ref$getTitleRef","getTitleRef","noop","_ref$getEditorRef","getEditorRef","menuClassName","_ref$editorContentFie","_ref$titleFieldName","_ref$editorProps","editorProps","customEditorProps","_ref$titleProps","titleProps","_ref$hasThumbnailImag","hasThumbnailImage","children","_useTranslation","useTranslation","useRef","_useState","useState","_useState2","_slicedToArray","isThumbnailImageModalOpen","useMemo","baseProps","mergeRight","thumbnailAddon","addonCommands","_useEditor","setTitleRef","node","setEditorRef","concat","handleTab","isListActive","isActive","sinkListItem","handleDeleteThumbnail","_jsxs","ref","FormikEditor","_objectSpread","attachmentsClassName","contentClassName","error","undefined","errorWrapperClassName","hideSlashCommands","classNames","name","contentWrapperClassName","keyboardShortcuts","Tab","ArrowUp","onChange","onChangeAttachments","FormikTextarea","nakedTextarea","rows","placeholder","onKeyDown","_titleProps$onKeyDown","call","alt","DropdownMenu","customTarget","Button","Ellipsis","variant","MenuItem","onClick","role","Dialog","isOpen","onClose","Header","Title","Body","displayName","memo"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;;;AAIA,MAAM,UAAU,GAAG;AACnB,EAAE,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC;AAC1F,EAAE,CAAC,QAAQ,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,E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AAQrG,4BAA4B,CAAC,KAAK,CAAC;MAAA,CAAC;AAAAyC,MAAAA,QAAA,EAAA,cAEnD/B,cAAA,CAACyF,iBAAM,CAACG,MAAM,EAAA;AAAA7D,QAAAA,QAAA,eACZ/B,cAAA,CAACyF,iBAAM,CAACI,KAAK,EAAA;UAAA9D,QAAA,EACVrB,CAAC,CAAC,oDAAoD;SAC3C;AAAC,OACF,CAAC,eAChBV,cAAA,CAACyF,iBAAM,CAACK,IAAI,EAAA;QAAA/D,QAAA,eACV/B,cAAA,CAACX,aAAa,EAAA;AAAOC,UAAAA,4BAA4B,EAA5BA;SAAiC;AAAC,OAC5C,CAAC;AAAA,KACR,CAAC;AAAA,GACN,CAAC;AAEV,CAAC;AAyBDyB,MAAM,CAACgF,WAAW,GAAG,gBAAgB;AAErC,YAAA,aAAeC,UAAI,CAACjF,MAAM,CAAC;;;;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"DocumentEditor.js","sources":["../../../node_modules/lucide-react/dist/esm/icons/image.mjs","../../../src/v2/components/DocumentEditor/constants.js","../../../src/v2/components/DocumentEditor/hooks/useEditor.js","../../../src/v2/components/DocumentEditor/MediaUploader.jsx","../../../src/v2/components/DocumentEditor/utils.js","../../../src/v2/components/DocumentEditor/index.jsx"],"sourcesContent":["/**\n * @license lucide-react v1.24.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"rect\", { width: \"18\", height: \"18\", x: \"3\", y: \"3\", rx: \"2\", ry: \"2\", key: \"1m3agn\" }],\n [\"circle\", { cx: \"9\", cy: \"9\", r: \"2\", key: \"af1f0g\" }],\n [\"path\", { d: \"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21\", key: \"1xmnt7\" }]\n];\nconst Image = createLucideIcon(\"image\", __iconNode);\n\nexport { __iconNode, Image as default };\n//# sourceMappingURL=image.mjs.map\n","export const EDITOR_ADDONS = [\n \"highlight\",\n \"emoji\",\n \"video-upload\",\n \"code-block\",\n \"block-quote\",\n \"image-upload\",\n \"image-upload-unsplash\",\n \"divider\",\n \"video-embed\",\n \"undo\",\n \"redo\",\n \"table\",\n \"callout\",\n];\n\nexport const DEFAULT_EDITOR_PROPS = {\n isMenuIndependent: true,\n addons: [],\n size: \"medium\",\n};\n\nexport const IMAGE_UPLOAD_CONFIG = {\n maxImageSize: 1,\n allowedImageTypes: {\n \"image/jpg\": [\".jpg\", \".jpeg\"],\n \"image/png\": [\".png\"],\n \"image/svg\": [\".svg\"],\n },\n};\n\nexport const DOCUMENT_TITLE_NODE_NAME = \"documentTitle\";\n","import { useCallback } from \"react\";\n\nimport { useFormikContext } from \"formik\";\nimport { isPresent } from \"neetocist\";\nimport useHotkeys from \"neetohotkeys\";\nimport { range } from \"ramda\";\n\nconst useEditor = ({\n onContentChange,\n editorContentFieldName,\n onAttachmentChange,\n onTitleChange,\n titleFieldName,\n editorRef,\n titleRef,\n}) => {\n const { setFieldValue, errors } = useFormikContext();\n\n const handleContentChange = useCallback(\n content => {\n setFieldValue(editorContentFieldName, content);\n onContentChange?.(content);\n },\n [editorContentFieldName, onContentChange, setFieldValue]\n );\n\n const handleAttachmentChange = useCallback(\n attachments => {\n setFieldValue(\"attachments\", attachments);\n onAttachmentChange?.(attachments);\n },\n [onAttachmentChange, setFieldValue]\n );\n\n const handleTitleChange = event => {\n const title = event.target.value;\n setFieldValue(titleFieldName, title);\n onTitleChange?.(title);\n };\n\n const handleEditorBackspaceKeypress = () => {\n const editor = editorRef.current?.editor;\n const selection = editor?.state?.selection;\n if (\n editor?.isFocused &&\n isPresent(titleRef.current) &&\n selection?.anchor === 1\n ) {\n const title = titleRef.current.value;\n titleRef.current.focus();\n titleRef.current.setSelectionRange(title?.length, title?.length);\n }\n };\n\n const isInFirstTextblock = $from =>\n range(0, $from.depth).every(depth => $from.index(depth) === 0);\n\n const handleEditorArrowUp = ({ editor }) => {\n const title = titleRef.current;\n const { selection } = editor.state;\n const isOnFirstLine =\n selection.empty &&\n isInFirstTextblock(selection.$from) &&\n editor.view.endOfTextblock(\"up\");\n\n if (!isOnFirstLine || !title || title.disabled) return false;\n\n title.focus();\n title.setSelectionRange(title.value.length, title.value.length);\n\n return true;\n };\n\n const handleTitleKeyDown = event => {\n if (event.defaultPrevented) return;\n\n const { key, shiftKey, altKey, metaKey, ctrlKey } = event;\n if (key === \"Enter\" && !shiftKey) {\n event.preventDefault();\n\n return;\n }\n\n if (key !== \"ArrowDown\" || shiftKey || altKey || metaKey || ctrlKey) {\n return;\n }\n\n // Let the caret move through a wrapped title first and jump to the\n // editor only once ArrowDown can no longer move it.\n const title = event.currentTarget;\n const { selectionStart, selectionEnd } = title;\n setTimeout(() => {\n const isCaretStuck =\n document.activeElement === title &&\n selectionStart === selectionEnd &&\n title.selectionStart === selectionStart &&\n title.selectionEnd === selectionEnd;\n\n isCaretStuck && editorRef.current?.editor?.commands?.focus(\"start\");\n });\n };\n\n const titleHotkeyRef = useHotkeys(\n \"return\",\n () => {\n editorRef.current?.editor?.commands?.insertContentAt(0, \"<p />\");\n editorRef.current?.editor?.commands?.focus(\"start\");\n },\n { mode: \"scoped\" }\n );\n\n const editorHotkeyRef = useHotkeys(\n \"backspace\",\n handleEditorBackspaceKeypress,\n { mode: \"scoped\" }\n );\n\n return {\n handleContentChange,\n handleAttachmentChange,\n handleTitleChange,\n handleEditorArrowUp,\n handleTitleKeyDown,\n editorHotkeyRef,\n titleHotkeyRef,\n errors,\n };\n};\n\nexport default useEditor;\n","import { Spinner } from \"@bigbinary/neeto-atoms\";\nimport { useFormikContext } from \"formik\";\nimport { ImageUploader } from \"neetoimageuploader/v2\";\nimport { isEmpty } from \"ramda\";\n\nimport { IMAGE_UPLOAD_CONFIG } from \"./constants\";\n\nconst MediaUploader = ({ setIsThumbnailImageModalOpen }) => {\n const {\n values: { thumbnailImageUrl },\n setFieldValue,\n initialValues,\n submitForm,\n } = useFormikContext();\n\n const handleUpload = file => {\n const { url, signedId } = file;\n setFieldValue(\"thumbnailImage\", signedId);\n setFieldValue(\"thumbnailImageUrl\", url);\n setTimeout(() => {\n setIsThumbnailImageModalOpen(false);\n submitForm();\n });\n };\n\n if (isEmpty(initialValues)) {\n return <Spinner />;\n }\n\n return (\n <ImageUploader\n className=\"h-auto w-full\"\n key={thumbnailImageUrl}\n src={thumbnailImageUrl}\n uploadConfig={IMAGE_UPLOAD_CONFIG}\n onUploadComplete={handleUpload}\n />\n );\n};\n\nexport default MediaUploader;\n","import { t } from \"i18next\";\nimport { Image } from \"lucide-react\";\nimport { noop } from \"neetocist\";\n\nexport const getThumbnailAddon = command => ({\n label: t(\"neetoMolecules.documentEditor.thumbnailImage\"),\n optionName: \"thumbnail-image\",\n command,\n icon: Image,\n isEnabled: true,\n \"data-testid\": \"thumbnail-image-addon\",\n});\n\n// Stands in for the title textarea when the title lives inside the editor, so\n// that getTitleRef consumers can keep focusing it and reading its value.\nexport const createInlineTitleRef = getEditor => ({\n focus: () => getEditor()?.commands?.focusDocumentTitle?.(),\n get value() {\n return getEditor()?.state?.doc?.firstChild?.textContent ?? \"\";\n },\n setSelectionRange: noop,\n});\n","import { memo, useCallback, useEffect, useMemo, useRef, useState } from \"react\";\n\nimport classNames from \"classnames\";\nimport { useFormikContext } from \"formik\";\nimport { Ellipsis } from \"lucide-react\";\nimport { Button, Dialog, DropdownMenu } from \"neetoatoms\";\nimport { Textarea as FormikTextarea } from \"neetoatoms/formik\";\nimport { noop } from \"neetocist\";\nimport { FormikEditor } from \"neetoeditor/v2\";\nimport PropTypes from \"prop-types\";\nimport { mergeRight } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport {\n DEFAULT_EDITOR_PROPS,\n DOCUMENT_TITLE_NODE_NAME,\n EDITOR_ADDONS,\n} from \"./constants\";\nimport \"./editor.css\";\nimport useEditor from \"./hooks/useEditor\";\nimport MediaUploader from \"./MediaUploader\";\nimport { createInlineTitleRef, getThumbnailAddon } from \"./utils\";\n\nconst Editor = ({\n attachments,\n onContentChange,\n onAttachmentChange,\n onTitleChange,\n getTitleRef = noop,\n getEditorRef = noop,\n menuClassName,\n editorContentFieldName = \"htmlContent\",\n titleFieldName = \"title\",\n editorProps: customEditorProps = {},\n titleProps = {},\n hasThumbnailImage = false,\n isTitleInline = false,\n children,\n}) => {\n const { t } = useTranslation();\n const { values, touched, setFieldValue, setFieldTouched, submitForm } =\n useFormikContext();\n const { thumbnailImageUrl } = values;\n const titleValue = values[titleFieldName];\n\n const titleRef = useRef();\n const editorRef = useRef();\n const [isThumbnailImageModalOpen, setIsThumbnailImageModalOpen] =\n useState(false);\n\n const editorProps = useMemo(() => {\n const baseProps = mergeRight(DEFAULT_EDITOR_PROPS, customEditorProps);\n\n if (!hasThumbnailImage) return baseProps;\n\n const thumbnailAddon = getThumbnailAddon(() =>\n setIsThumbnailImageModalOpen(true)\n );\n\n return mergeRight(baseProps, { addonCommands: [thumbnailAddon] });\n }, [customEditorProps, hasThumbnailImage]);\n\n const {\n handleContentChange,\n handleAttachmentChange,\n handleTitleChange,\n handleEditorArrowUp,\n handleTitleKeyDown,\n editorHotkeyRef,\n titleHotkeyRef,\n errors,\n } = useEditor({\n onContentChange,\n editorContentFieldName,\n onAttachmentChange,\n onTitleChange,\n titleFieldName,\n editorRef,\n titleRef,\n });\n\n const lastInlineTitle = useRef(titleValue ?? \"\");\n const onTitleChangeRef = useRef(onTitleChange);\n onTitleChangeRef.current = onTitleChange;\n\n // FormikEditor is a FastField, so this has to read the latest handler by ref.\n const handleInlineTitleChange = useCallback(\n title => {\n lastInlineTitle.current = title;\n setFieldValue(titleFieldName, title);\n onTitleChangeRef.current?.(title);\n },\n [setFieldValue, titleFieldName]\n );\n\n const inlineTitle = useMemo(\n () =>\n isTitleInline\n ? {\n value: titleValue,\n placeholder:\n titleProps.placeholder ||\n t(\"neetoMolecules.documentEditor.title\"),\n dataTestId: titleProps[\"data-testid\"],\n autoFocus: titleProps.autoFocus,\n onChange: handleInlineTitleChange,\n }\n : null,\n [isTitleInline]\n );\n\n // Picks up titles set from outside the editor, like a restored version.\n useEffect(() => {\n if (!isTitleInline) return;\n\n const title = titleValue ?? \"\";\n if (title === lastInlineTitle.current) return;\n\n lastInlineTitle.current = title;\n editorRef.current?.editor?.commands?.setDocumentTitle?.(title);\n }, [isTitleInline, titleValue]);\n\n // FormikEditor only re-renders for its own field, and the title's error is\n // rendered inside it.\n const shouldUpdateEditor = (prevProps, nextProps) =>\n Boolean(editorProps.shouldUpdate?.(prevProps, nextProps)) ||\n (isTitleInline &&\n (prevProps.formik.errors[titleFieldName] !==\n nextProps.formik.errors[titleFieldName] ||\n prevProps.formik.touched[titleFieldName] !==\n nextProps.formik.touched[titleFieldName]));\n\n const handleEditorBlur = props => {\n const isCaretInTitle =\n props.editor.state.selection.$from.parent.type.name ===\n DOCUMENT_TITLE_NODE_NAME;\n\n isTitleInline && isCaretInTitle && setFieldTouched(titleFieldName, true);\n editorProps.onBlur?.(props);\n };\n\n const setTitleRef = node => {\n titleHotkeyRef.current = node;\n getTitleRef(node);\n titleRef.current = node;\n };\n\n const setEditorRef = useCallback(node => {\n editorRef.current = node;\n getEditorRef(node);\n\n if (!isTitleInline) return;\n\n getTitleRef(\n node?.editor\n ? createInlineTitleRef(() => editorRef.current?.editor)\n : null\n );\n }, []);\n\n const addons = useMemo(\n () => EDITOR_ADDONS.concat(editorProps.addons || []),\n [editorProps.addons]\n );\n\n const handleTab = () => {\n const isListActive =\n editorRef.current?.editor?.isActive(\"orderedList\") ||\n editorRef.current?.editor?.isActive(\"bulletList\");\n\n if (isListActive) {\n editorRef.current?.editor?.commands?.sinkListItem(\"listItem\");\n\n return true;\n }\n\n return true;\n };\n\n const handleDeleteThumbnail = () => {\n setFieldValue(\"thumbnailImage\", \"\");\n setFieldValue(\"thumbnailImageUrl\", \"\");\n setTimeout(submitForm);\n };\n\n return (\n <div\n className=\"nm-document-editor__wrapper\"\n data-testid=\"document-editor-container\"\n ref={editorHotkeyRef}\n >\n <FormikEditor\n attachmentsClassName=\"editor-content-attachments w-full flex-shrink-0\"\n className=\"h-full w-full\"\n contentClassName=\"editor-content__wrapper nm-document-editor__container\"\n data-testid=\"neeto-molecules-document-content-text-area\"\n error={undefined}\n errorWrapperClassName=\"w-full min-h-full flex flex-col items-center\"\n hideSlashCommands={false}\n menuClassName={classNames(\"nm-document-editor__menubar\", menuClassName)}\n name={editorContentFieldName}\n ref={setEditorRef}\n {...{ attachments, inlineTitle, ...editorProps, addons }}\n contentWrapperClassName=\"w-full flex flex-col flex-grow\"\n shouldUpdate={shouldUpdateEditor}\n keyboardShortcuts={{\n Tab: handleTab,\n ArrowUp: handleEditorArrowUp,\n ...editorProps.keyboardShortcuts,\n }}\n onBlur={handleEditorBlur}\n onChange={handleContentChange}\n onChangeAttachments={handleAttachmentChange}\n >\n {children}\n <div className=\"nm-document-editor__container px-6\">\n {isTitleInline ? (\n touched[titleFieldName] &&\n errors[titleFieldName] && (\n <p\n className=\"text-destructive nm-document-editor__error text-sm font-normal\"\n data-slot=\"field-error\"\n data-testid=\"document-title-input-error\"\n role=\"alert\"\n >\n {errors[titleFieldName]}\n </p>\n )\n ) : (\n <FormikTextarea\n nakedTextarea\n className=\"nm-document-editor__title\"\n data-testid=\"neeto-molecules-document-title-text-field\"\n name={titleFieldName}\n ref={setTitleRef}\n rows={1}\n placeholder={\n titleProps.placeholder ||\n t(\"neetoMolecules.documentEditor.title\")\n }\n onChange={handleTitleChange}\n {...titleProps}\n onKeyDown={event => {\n titleProps.onKeyDown?.(event);\n handleTitleKeyDown(event);\n }}\n />\n )}\n {thumbnailImageUrl && (\n <div className=\"group relative mt-4\">\n <div className=\"nm-document-editor__thumbnail\">\n <img alt=\"Cover\" src={thumbnailImageUrl} />\n </div>\n <div className=\"absolute end-2 top-2\">\n <DropdownMenu\n customTarget={\n <Button\n icon={Ellipsis}\n size=\"icon-sm\"\n variant=\"secondary\"\n aria-label={t(\n \"neetoMolecules.documentEditor.thumbnailOptions\"\n )}\n />\n }\n >\n <DropdownMenu.MenuItem onClick={handleDeleteThumbnail}>\n {t(\"neetoMolecules.documentEditor.delete\")}\n </DropdownMenu.MenuItem>\n </DropdownMenu>\n </div>\n </div>\n )}\n {errors[editorContentFieldName] && (\n <p\n className=\"text-destructive nm-document-editor__error text-sm font-normal\"\n data-slot=\"field-error\"\n data-testid=\"articles-content-input-error\"\n role=\"alert\"\n >\n {errors[editorContentFieldName]}\n </p>\n )}\n </div>\n </FormikEditor>\n <Dialog\n data-testid=\"thumbnail-image-modal\"\n isOpen={isThumbnailImageModalOpen}\n size=\"medium\"\n onClose={() => setIsThumbnailImageModalOpen(false)}\n >\n <Dialog.Header>\n <Dialog.Title>\n {t(\"neetoMolecules.documentEditor.uploadThumbnailImage\")}\n </Dialog.Title>\n </Dialog.Header>\n <Dialog.Body>\n <MediaUploader {...{ setIsThumbnailImageModalOpen }} />\n </Dialog.Body>\n </Dialog>\n </div>\n );\n};\n\nEditor.propTypes = {\n attachments: PropTypes.arrayOf(\n PropTypes.shape({\n contentType: PropTypes.string,\n filename: PropTypes.string,\n signedId: PropTypes.string,\n url: PropTypes.string,\n })\n ),\n onContentChange: PropTypes.func,\n onAttachmentChange: PropTypes.func,\n onTitleChange: PropTypes.func,\n getTitleRef: PropTypes.func,\n getEditorRef: PropTypes.func,\n editorContentFieldName: PropTypes.string,\n titleFieldName: PropTypes.string,\n editorProps: PropTypes.object,\n titleProps: PropTypes.object,\n menuClassName: PropTypes.string,\n children: PropTypes.node,\n hasThumbnailImage: PropTypes.bool,\n /**\n * Keeps the title inside the editor document, so that a selection can span\n * the title and the content. Needs neeto-editor-frontend 2.7.4 or later. With\n * `collaborationProvider`, it also needs an editor release that supports\n * `inlineTitle` with collaboration, or the title does not show.\n */\n isTitleInline: PropTypes.bool,\n};\n\nEditor.displayName = \"DocumentEditor\";\n\nexport default memo(Editor);\n"],"names":["createLucideIcon","EDITOR_ADDONS","DEFAULT_EDITOR_PROPS","isMenuIndependent","addons","size","IMAGE_UPLOAD_CONFIG","maxImageSize","allowedImageTypes","DOCUMENT_TITLE_NODE_NAME","useEditor","_ref","onContentChange","editorContentFieldName","onAttachmentChange","onTitleChange","titleFieldName","editorRef","titleRef","_useFormikContext","useFormikContext","setFieldValue","errors","handleContentChange","useCallback","content","handleAttachmentChange","attachments","handleTitleChange","event","title","target","value","handleEditorBackspaceKeypress","_editorRef$current","_editor$state","editor","current","selection","state","isFocused","isPresent","anchor","focus","setSelectionRange","length","isInFirstTextblock","$from","range","depth","every","index","handleEditorArrowUp","_ref2","isOnFirstLine","empty","view","endOfTextblock","disabled","handleTitleKeyDown","defaultPrevented","key","shiftKey","altKey","metaKey","ctrlKey","preventDefault","currentTarget","selectionStart","selectionEnd","setTimeout","_editorRef$current2","isCaretStuck","document","activeElement","commands","titleHotkeyRef","useHotkeys","_editorRef$current3","_editorRef$current4","insertContentAt","mode","editorHotkeyRef","MediaUploader","setIsThumbnailImageModalOpen","thumbnailImageUrl","values","initialValues","submitForm","handleUpload","file","url","signedId","isEmpty","_jsx","Spinner","ImageUploader","className","src","uploadConfig","onUploadComplete","getThumbnailAddon","command","label","t","optionName","icon","Image","isEnabled","createInlineTitleRef","getEditor","_getEditor","_getEditor$focusDocum","focusDocumentTitle","call","_getEditor$state$doc$","_getEditor2","doc","firstChild","textContent","noop","Editor","_ref$getTitleRef","getTitleRef","_ref$getEditorRef","getEditorRef","menuClassName","_ref$editorContentFie","_ref$titleFieldName","_ref$editorProps","editorProps","customEditorProps","_ref$titleProps","titleProps","_ref$hasThumbnailImag","hasThumbnailImage","_ref$isTitleInline","isTitleInline","children","_useTranslation","useTranslation","touched","setFieldTouched","titleValue","useRef","_useState","useState","_useState2","_slicedToArray","isThumbnailImageModalOpen","useMemo","baseProps","mergeRight","thumbnailAddon","addonCommands","_useEditor","lastInlineTitle","onTitleChangeRef","handleInlineTitleChange","_onTitleChangeRef$cur","inlineTitle","placeholder","dataTestId","autoFocus","onChange","useEffect","_editorRef$current$se","setDocumentTitle","shouldUpdateEditor","prevProps","nextProps","_editorProps$shouldUp","Boolean","shouldUpdate","formik","handleEditorBlur","props","_editorProps$onBlur","isCaretInTitle","parent","type","name","onBlur","setTitleRef","node","setEditorRef","concat","handleTab","isListActive","isActive","_editorRef$current5","sinkListItem","handleDeleteThumbnail","_jsxs","ref","FormikEditor","_objectSpread","attachmentsClassName","contentClassName","error","undefined","errorWrapperClassName","hideSlashCommands","classNames","contentWrapperClassName","keyboardShortcuts","Tab","ArrowUp","onChangeAttachments","role","FormikTextarea","nakedTextarea","rows","onKeyDown","_titleProps$onKeyDown","alt","DropdownMenu","customTarget","Button","Ellipsis","variant","MenuItem","onClick","Dialog","isOpen","onClose","Header","Title","Body","displayName","memo"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;;;AAIA,MAAM,UAAU,GAAG;AACnB,EAAE,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC;AAC1F,EAAE,CAAC,QAAQ,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC;AACzD,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,2CAA2C,EAAE,GAAG,EAAE,QAAQ,EAAE;AAC5E,CAAC;AACD,MAAM,KAAK,GAAGA,iCAAgB,CAAC,OAAO,EAAE,UAAU,CAAC;;ACd5C,IAAMC,aAAa,GAAG,CAC3B,WAAW,EACX,OAAO,EACP,cAAc,EACd,YAAY,EACZ,aAAa,EACb,cAAc,EACd,uBAAuB,EACvB,SAAS,EACT,aAAa,EACb,MAAM,EACN,MAAM,EACN,OAAO,EAC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A,CAACX,aAAa,EAAA;AAAOC,UAAAA,4BAA4B,EAA5BA;SAAiC;AAAC,OAC5C,CAAC;AAAA,KACR,CAAC;AAAA,GACN,CAAC;AAEV,CAAC;AAgCDqC,MAAM,CAAC4G,WAAW,GAAG,gBAAgB;AAErC,YAAA,aAAeC,UAAI,CAAC7G,MAAM,CAAC;;;;","x_google_ignoreList":[0]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
3
|
-
import { useCallback, memo, useRef, useState, useMemo } from 'react';
|
|
3
|
+
import { useCallback, memo, useRef, useState, useMemo, useEffect } from 'react';
|
|
4
4
|
import classnames from 'classnames';
|
|
5
5
|
import { useFormikContext } from 'formik';
|
|
6
6
|
import { Spinner, DropdownMenu, Button, Dialog } from '@bigbinary/neeto-atoms';
|
|
@@ -46,8 +46,9 @@ var IMAGE_UPLOAD_CONFIG = {
|
|
|
46
46
|
"image/svg": [".svg"]
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
+
var DOCUMENT_TITLE_NODE_NAME = "documentTitle";
|
|
49
50
|
|
|
50
|
-
var css = ".nm-document-editor__wrapper{color:var(--foreground);height:100%}@media screen and (max-width:768px){.nm-document-editor__wrapper{width:100%}}.nm-document-editor__container{margin:0 auto;max-width:48rem!important;width:100%}.nm-document-editor__menubar{background-color:var(--background);position:sticky;top:0;width:100%;z-index:20}.nm-document-editor__menubar .neeto-editor-fixed-menu,.nm-document-editor__menubar.neeto-editor-fixed-menu{width:100%}.nm-document-editor__title{margin-top:1.5rem;width:100%}.nm-document-editor__title textarea{field-sizing:content!important;background-color:transparent;color:var(--foreground);font-size:2.625rem;font-weight:700;line-height:1.15;max-height:none;min-height:1lh!important;overflow:hidden!important;padding:0;resize:none}.nm-document-editor__title textarea,.nm-document-editor__title textarea:focus-visible,.nm-document-editor__title textarea[aria-invalid=true],.nm-document-editor__title textarea[aria-invalid=true]:focus-visible{border-color:transparent!important;box-shadow:none!important}.nm-document-editor__title textarea::-moz-placeholder{color:var(--muted-foreground);opacity:.5}.nm-document-editor__title textarea::placeholder{color:var(--muted-foreground);opacity:.5}@media screen and (max-width:1024px){.nm-document-editor__title textarea{font-size:2rem;line-height:1.25}}.nm-document-editor__error{margin:.75rem auto}.nm-document-editor__thumbnail{background-color:var(--muted);border-radius:.5rem;overflow:hidden;padding-bottom:56.25%;position:relative;width:100%}.nm-document-editor__thumbnail img{height:100%;inset-inline-start:0;-o-object-fit:cover;object-fit:cover;position:absolute;top:0;width:100%}.nm-document-editor__wrapper .neeto-editor-fixed-menu{border-inline-end:0!important;border-inline-start:0!important;border-radius:0!important}.nm-document-editor__wrapper .neeto-editor-fixed-menu__wrapper{margin:0 auto;max-width:46.875rem;padding-block:.375rem}.nm-document-editor__wrapper button.ne-toolbar-item{border-radius:.5rem!important}@media screen and (max-width:768px){.nm-document-editor__wrapper .neeto-editor-fixed-menu__wrapper{overflow-x:auto}}.nm-document-editor__wrapper .ProseMirror{flex-grow:1;height:auto;max-height:none;outline:none;overflow-y:hidden}.nm-document-editor__wrapper .ProseMirror p.is-editor-empty:first-child:before{color:var(--muted-foreground);content:attr(data-placeholder);float:left;height:0;opacity:.5;pointer-events:none}.nm-document-editor__wrapper .editor-content__wrapper{border:none!important;padding:.75rem 1.5rem 2rem!important;width:100%!important}.nm-document-editor__wrapper .editor-content-attachments{border:none;margin:.75rem auto 0;max-width:48rem!important;padding-inline-end:1rem;padding-inline-start:1rem}.nm-document-editor__wrapper .editor-content-attachments--no-attachments{display:none!important}.nm-document-editor__wrapper .neeto-editor-character-count{color:var(--muted-foreground);font-size:.75rem;margin:0 auto;max-width:48rem!important;padding-inline-end:1rem;padding-inline-start:1rem}.nm-document-editor__wrapper .ne-attachments__wrapper{width:100%}.nm-document-editor__wrapper ins{background-color:#c1f4cb!important;text-decoration:none!important}.nm-document-editor__wrapper del{background-color:#faa!important}";
|
|
51
|
+
var css = ".nm-document-editor__wrapper{color:var(--foreground);height:100%}@media screen and (max-width:768px){.nm-document-editor__wrapper{width:100%}}.nm-document-editor__container{margin:0 auto;max-width:48rem!important;width:100%}.nm-document-editor__menubar{background-color:var(--background);position:sticky;top:0;width:100%;z-index:20}.nm-document-editor__menubar .neeto-editor-fixed-menu,.nm-document-editor__menubar.neeto-editor-fixed-menu{width:100%}.nm-document-editor__title{margin-top:1.5rem;width:100%}.nm-document-editor__title textarea{field-sizing:content!important;background-color:transparent;color:var(--foreground);font-size:2.625rem;font-weight:700;line-height:1.15;max-height:none;min-height:1lh!important;overflow:hidden!important;padding:0;resize:none}.nm-document-editor__title textarea,.nm-document-editor__title textarea:focus-visible,.nm-document-editor__title textarea[aria-invalid=true],.nm-document-editor__title textarea[aria-invalid=true]:focus-visible{border-color:transparent!important;box-shadow:none!important}.nm-document-editor__wrapper .ProseMirror h1[data-document-title]{color:var(--foreground);font-size:2.625rem;font-weight:700;line-height:1.15;margin:1.5rem 0 .75rem}.nm-document-editor__wrapper .ProseMirror h1[data-document-title].is-empty:before{color:var(--muted-foreground);opacity:.5}.nm-document-editor__title textarea::-moz-placeholder{color:var(--muted-foreground);opacity:.5}.nm-document-editor__title textarea::placeholder{color:var(--muted-foreground);opacity:.5}@media screen and (max-width:1024px){.nm-document-editor__title textarea,.nm-document-editor__wrapper .ProseMirror h1[data-document-title]{font-size:2rem;line-height:1.25}}.nm-document-editor__error{margin:.75rem auto}.nm-document-editor__thumbnail{background-color:var(--muted);border-radius:.5rem;overflow:hidden;padding-bottom:56.25%;position:relative;width:100%}.nm-document-editor__thumbnail img{height:100%;inset-inline-start:0;-o-object-fit:cover;object-fit:cover;position:absolute;top:0;width:100%}.nm-document-editor__wrapper .neeto-editor-fixed-menu{border-inline-end:0!important;border-inline-start:0!important;border-radius:0!important}.nm-document-editor__wrapper .neeto-editor-fixed-menu__wrapper{margin:0 auto;max-width:46.875rem;padding-block:.375rem}.nm-document-editor__wrapper button.ne-toolbar-item{border-radius:.5rem!important}@media screen and (max-width:768px){.nm-document-editor__wrapper .neeto-editor-fixed-menu__wrapper{overflow-x:auto}}.nm-document-editor__wrapper .ProseMirror{flex-grow:1;height:auto;max-height:none;outline:none;overflow-y:hidden}.nm-document-editor__wrapper .ProseMirror p.is-editor-empty:first-child:before{color:var(--muted-foreground);content:attr(data-placeholder);float:left;height:0;opacity:.5;pointer-events:none}.nm-document-editor__wrapper .editor-content__wrapper{border:none!important;padding:.75rem 1.5rem 2rem!important;width:100%!important}.nm-document-editor__wrapper .editor-content-attachments{border:none;margin:.75rem auto 0;max-width:48rem!important;padding-inline-end:1rem;padding-inline-start:1rem}.nm-document-editor__wrapper .editor-content-attachments--no-attachments{display:none!important}.nm-document-editor__wrapper .neeto-editor-character-count{color:var(--muted-foreground);font-size:.75rem;margin:0 auto;max-width:48rem!important;padding-inline-end:1rem;padding-inline-start:1rem}.nm-document-editor__wrapper .ne-attachments__wrapper{width:100%}.nm-document-editor__wrapper ins{background-color:#c1f4cb!important;text-decoration:none!important}.nm-document-editor__wrapper del{background-color:#faa!important}";
|
|
51
52
|
n(css,{});
|
|
52
53
|
|
|
53
54
|
var useEditor = function useEditor(_ref) {
|
|
@@ -186,6 +187,22 @@ var getThumbnailAddon = function getThumbnailAddon(command) {
|
|
|
186
187
|
};
|
|
187
188
|
};
|
|
188
189
|
|
|
190
|
+
// Stands in for the title textarea when the title lives inside the editor, so
|
|
191
|
+
// that getTitleRef consumers can keep focusing it and reading its value.
|
|
192
|
+
var createInlineTitleRef = function createInlineTitleRef(getEditor) {
|
|
193
|
+
return {
|
|
194
|
+
focus: function focus() {
|
|
195
|
+
var _getEditor, _getEditor$focusDocum;
|
|
196
|
+
return (_getEditor = getEditor()) === null || _getEditor === void 0 || (_getEditor = _getEditor.commands) === null || _getEditor === void 0 || (_getEditor$focusDocum = _getEditor.focusDocumentTitle) === null || _getEditor$focusDocum === void 0 ? void 0 : _getEditor$focusDocum.call(_getEditor);
|
|
197
|
+
},
|
|
198
|
+
get value() {
|
|
199
|
+
var _getEditor$state$doc$, _getEditor2;
|
|
200
|
+
return (_getEditor$state$doc$ = (_getEditor2 = getEditor()) === null || _getEditor2 === void 0 || (_getEditor2 = _getEditor2.state) === null || _getEditor2 === void 0 || (_getEditor2 = _getEditor2.doc) === null || _getEditor2 === void 0 || (_getEditor2 = _getEditor2.firstChild) === null || _getEditor2 === void 0 ? void 0 : _getEditor2.textContent) !== null && _getEditor$state$doc$ !== void 0 ? _getEditor$state$doc$ : "";
|
|
201
|
+
},
|
|
202
|
+
setSelectionRange: noop
|
|
203
|
+
};
|
|
204
|
+
};
|
|
205
|
+
|
|
189
206
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
190
207
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
191
208
|
var Editor = function Editor(_ref) {
|
|
@@ -208,14 +225,19 @@ var Editor = function Editor(_ref) {
|
|
|
208
225
|
titleProps = _ref$titleProps === void 0 ? {} : _ref$titleProps,
|
|
209
226
|
_ref$hasThumbnailImag = _ref.hasThumbnailImage,
|
|
210
227
|
hasThumbnailImage = _ref$hasThumbnailImag === void 0 ? false : _ref$hasThumbnailImag,
|
|
228
|
+
_ref$isTitleInline = _ref.isTitleInline,
|
|
229
|
+
isTitleInline = _ref$isTitleInline === void 0 ? false : _ref$isTitleInline,
|
|
211
230
|
children = _ref.children;
|
|
212
231
|
var _useTranslation = useTranslation(),
|
|
213
232
|
t = _useTranslation.t;
|
|
214
233
|
var _useFormikContext = useFormikContext(),
|
|
215
234
|
values = _useFormikContext.values,
|
|
235
|
+
touched = _useFormikContext.touched,
|
|
216
236
|
setFieldValue = _useFormikContext.setFieldValue,
|
|
237
|
+
setFieldTouched = _useFormikContext.setFieldTouched,
|
|
217
238
|
submitForm = _useFormikContext.submitForm;
|
|
218
239
|
var thumbnailImageUrl = values.thumbnailImageUrl;
|
|
240
|
+
var titleValue = values[titleFieldName];
|
|
219
241
|
var titleRef = useRef();
|
|
220
242
|
var editorRef = useRef();
|
|
221
243
|
var _useState = useState(false),
|
|
@@ -249,6 +271,49 @@ var Editor = function Editor(_ref) {
|
|
|
249
271
|
editorHotkeyRef = _useEditor.editorHotkeyRef,
|
|
250
272
|
titleHotkeyRef = _useEditor.titleHotkeyRef,
|
|
251
273
|
errors = _useEditor.errors;
|
|
274
|
+
var lastInlineTitle = useRef(titleValue !== null && titleValue !== void 0 ? titleValue : "");
|
|
275
|
+
var onTitleChangeRef = useRef(onTitleChange);
|
|
276
|
+
onTitleChangeRef.current = onTitleChange;
|
|
277
|
+
|
|
278
|
+
// FormikEditor is a FastField, so this has to read the latest handler by ref.
|
|
279
|
+
var handleInlineTitleChange = useCallback(function (title) {
|
|
280
|
+
var _onTitleChangeRef$cur;
|
|
281
|
+
lastInlineTitle.current = title;
|
|
282
|
+
setFieldValue(titleFieldName, title);
|
|
283
|
+
(_onTitleChangeRef$cur = onTitleChangeRef.current) === null || _onTitleChangeRef$cur === void 0 || _onTitleChangeRef$cur.call(onTitleChangeRef, title);
|
|
284
|
+
}, [setFieldValue, titleFieldName]);
|
|
285
|
+
var inlineTitle = useMemo(function () {
|
|
286
|
+
return isTitleInline ? {
|
|
287
|
+
value: titleValue,
|
|
288
|
+
placeholder: titleProps.placeholder || t("neetoMolecules.documentEditor.title"),
|
|
289
|
+
dataTestId: titleProps["data-testid"],
|
|
290
|
+
autoFocus: titleProps.autoFocus,
|
|
291
|
+
onChange: handleInlineTitleChange
|
|
292
|
+
} : null;
|
|
293
|
+
}, [isTitleInline]);
|
|
294
|
+
|
|
295
|
+
// Picks up titles set from outside the editor, like a restored version.
|
|
296
|
+
useEffect(function () {
|
|
297
|
+
var _editorRef$current, _editorRef$current$se;
|
|
298
|
+
if (!isTitleInline) return;
|
|
299
|
+
var title = titleValue !== null && titleValue !== void 0 ? titleValue : "";
|
|
300
|
+
if (title === lastInlineTitle.current) return;
|
|
301
|
+
lastInlineTitle.current = title;
|
|
302
|
+
(_editorRef$current = editorRef.current) === null || _editorRef$current === void 0 || (_editorRef$current = _editorRef$current.editor) === null || _editorRef$current === void 0 || (_editorRef$current = _editorRef$current.commands) === null || _editorRef$current === void 0 || (_editorRef$current$se = _editorRef$current.setDocumentTitle) === null || _editorRef$current$se === void 0 || _editorRef$current$se.call(_editorRef$current, title);
|
|
303
|
+
}, [isTitleInline, titleValue]);
|
|
304
|
+
|
|
305
|
+
// FormikEditor only re-renders for its own field, and the title's error is
|
|
306
|
+
// rendered inside it.
|
|
307
|
+
var shouldUpdateEditor = function shouldUpdateEditor(prevProps, nextProps) {
|
|
308
|
+
var _editorProps$shouldUp;
|
|
309
|
+
return Boolean((_editorProps$shouldUp = editorProps.shouldUpdate) === null || _editorProps$shouldUp === void 0 ? void 0 : _editorProps$shouldUp.call(editorProps, prevProps, nextProps)) || isTitleInline && (prevProps.formik.errors[titleFieldName] !== nextProps.formik.errors[titleFieldName] || prevProps.formik.touched[titleFieldName] !== nextProps.formik.touched[titleFieldName]);
|
|
310
|
+
};
|
|
311
|
+
var handleEditorBlur = function handleEditorBlur(props) {
|
|
312
|
+
var _editorProps$onBlur;
|
|
313
|
+
var isCaretInTitle = props.editor.state.selection.$from.parent.type.name === DOCUMENT_TITLE_NODE_NAME;
|
|
314
|
+
isTitleInline && isCaretInTitle && setFieldTouched(titleFieldName, true);
|
|
315
|
+
(_editorProps$onBlur = editorProps.onBlur) === null || _editorProps$onBlur === void 0 || _editorProps$onBlur.call(editorProps, props);
|
|
316
|
+
};
|
|
252
317
|
var setTitleRef = function setTitleRef(node) {
|
|
253
318
|
titleHotkeyRef.current = node;
|
|
254
319
|
getTitleRef(node);
|
|
@@ -257,16 +322,21 @@ var Editor = function Editor(_ref) {
|
|
|
257
322
|
var setEditorRef = useCallback(function (node) {
|
|
258
323
|
editorRef.current = node;
|
|
259
324
|
getEditorRef(node);
|
|
325
|
+
if (!isTitleInline) return;
|
|
326
|
+
getTitleRef(node !== null && node !== void 0 && node.editor ? createInlineTitleRef(function () {
|
|
327
|
+
var _editorRef$current2;
|
|
328
|
+
return (_editorRef$current2 = editorRef.current) === null || _editorRef$current2 === void 0 ? void 0 : _editorRef$current2.editor;
|
|
329
|
+
}) : null);
|
|
260
330
|
}, []);
|
|
261
331
|
var addons = useMemo(function () {
|
|
262
332
|
return EDITOR_ADDONS.concat(editorProps.addons || []);
|
|
263
333
|
}, [editorProps.addons]);
|
|
264
334
|
var handleTab = function handleTab() {
|
|
265
|
-
var _editorRef$
|
|
266
|
-
var isListActive = ((_editorRef$
|
|
335
|
+
var _editorRef$current3, _editorRef$current4;
|
|
336
|
+
var isListActive = ((_editorRef$current3 = editorRef.current) === null || _editorRef$current3 === void 0 || (_editorRef$current3 = _editorRef$current3.editor) === null || _editorRef$current3 === void 0 ? void 0 : _editorRef$current3.isActive("orderedList")) || ((_editorRef$current4 = editorRef.current) === null || _editorRef$current4 === void 0 || (_editorRef$current4 = _editorRef$current4.editor) === null || _editorRef$current4 === void 0 ? void 0 : _editorRef$current4.isActive("bulletList"));
|
|
267
337
|
if (isListActive) {
|
|
268
|
-
var _editorRef$
|
|
269
|
-
(_editorRef$
|
|
338
|
+
var _editorRef$current5;
|
|
339
|
+
(_editorRef$current5 = editorRef.current) === null || _editorRef$current5 === void 0 || (_editorRef$current5 = _editorRef$current5.editor) === null || _editorRef$current5 === void 0 || (_editorRef$current5 = _editorRef$current5.commands) === null || _editorRef$current5 === void 0 || _editorRef$current5.sinkListItem("listItem");
|
|
270
340
|
return true;
|
|
271
341
|
}
|
|
272
342
|
return true;
|
|
@@ -292,20 +362,29 @@ var Editor = function Editor(_ref) {
|
|
|
292
362
|
name: editorContentFieldName,
|
|
293
363
|
ref: setEditorRef
|
|
294
364
|
}, _objectSpread(_objectSpread({
|
|
295
|
-
attachments: attachments
|
|
365
|
+
attachments: attachments,
|
|
366
|
+
inlineTitle: inlineTitle
|
|
296
367
|
}, editorProps), {}, {
|
|
297
368
|
addons: addons
|
|
298
369
|
})), {}, {
|
|
299
370
|
contentWrapperClassName: "w-full flex flex-col flex-grow",
|
|
371
|
+
shouldUpdate: shouldUpdateEditor,
|
|
300
372
|
keyboardShortcuts: _objectSpread({
|
|
301
373
|
Tab: handleTab,
|
|
302
374
|
ArrowUp: handleEditorArrowUp
|
|
303
375
|
}, editorProps.keyboardShortcuts),
|
|
376
|
+
onBlur: handleEditorBlur,
|
|
304
377
|
onChange: handleContentChange,
|
|
305
378
|
onChangeAttachments: handleAttachmentChange,
|
|
306
379
|
children: [children, /*#__PURE__*/jsxs("div", {
|
|
307
380
|
className: "nm-document-editor__container px-6",
|
|
308
|
-
children: [/*#__PURE__*/jsx(
|
|
381
|
+
children: [isTitleInline ? touched[titleFieldName] && errors[titleFieldName] && /*#__PURE__*/jsx("p", {
|
|
382
|
+
className: "text-destructive nm-document-editor__error text-sm font-normal",
|
|
383
|
+
"data-slot": "field-error",
|
|
384
|
+
"data-testid": "document-title-input-error",
|
|
385
|
+
role: "alert",
|
|
386
|
+
children: errors[titleFieldName]
|
|
387
|
+
}) : /*#__PURE__*/jsx(Textarea, _objectSpread(_objectSpread({
|
|
309
388
|
nakedTextarea: true,
|
|
310
389
|
className: "nm-document-editor__title",
|
|
311
390
|
"data-testid": "neeto-molecules-document-title-text-field",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentEditor.js","sources":["../../node_modules/lucide-react/dist/esm/icons/image.mjs","../../src/v2/components/DocumentEditor/constants.js","../../src/v2/components/DocumentEditor/hooks/useEditor.js","../../src/v2/components/DocumentEditor/MediaUploader.jsx","../../src/v2/components/DocumentEditor/utils.js","../../src/v2/components/DocumentEditor/index.jsx"],"sourcesContent":["/**\n * @license lucide-react v1.24.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"rect\", { width: \"18\", height: \"18\", x: \"3\", y: \"3\", rx: \"2\", ry: \"2\", key: \"1m3agn\" }],\n [\"circle\", { cx: \"9\", cy: \"9\", r: \"2\", key: \"af1f0g\" }],\n [\"path\", { d: \"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21\", key: \"1xmnt7\" }]\n];\nconst Image = createLucideIcon(\"image\", __iconNode);\n\nexport { __iconNode, Image as default };\n//# sourceMappingURL=image.mjs.map\n","export const EDITOR_ADDONS = [\n \"highlight\",\n \"emoji\",\n \"video-upload\",\n \"code-block\",\n \"block-quote\",\n \"image-upload\",\n \"image-upload-unsplash\",\n \"divider\",\n \"video-embed\",\n \"undo\",\n \"redo\",\n \"table\",\n \"callout\",\n];\n\nexport const DEFAULT_EDITOR_PROPS = {\n isMenuIndependent: true,\n addons: [],\n size: \"medium\",\n};\n\nexport const IMAGE_UPLOAD_CONFIG = {\n maxImageSize: 1,\n allowedImageTypes: {\n \"image/jpg\": [\".jpg\", \".jpeg\"],\n \"image/png\": [\".png\"],\n \"image/svg\": [\".svg\"],\n },\n};\n","import { useCallback } from \"react\";\n\nimport { useFormikContext } from \"formik\";\nimport { isPresent } from \"neetocist\";\nimport useHotkeys from \"neetohotkeys\";\nimport { range } from \"ramda\";\n\nconst useEditor = ({\n onContentChange,\n editorContentFieldName,\n onAttachmentChange,\n onTitleChange,\n titleFieldName,\n editorRef,\n titleRef,\n}) => {\n const { setFieldValue, errors } = useFormikContext();\n\n const handleContentChange = useCallback(\n content => {\n setFieldValue(editorContentFieldName, content);\n onContentChange?.(content);\n },\n [editorContentFieldName, onContentChange, setFieldValue]\n );\n\n const handleAttachmentChange = useCallback(\n attachments => {\n setFieldValue(\"attachments\", attachments);\n onAttachmentChange?.(attachments);\n },\n [onAttachmentChange, setFieldValue]\n );\n\n const handleTitleChange = event => {\n const title = event.target.value;\n setFieldValue(titleFieldName, title);\n onTitleChange?.(title);\n };\n\n const handleEditorBackspaceKeypress = () => {\n const editor = editorRef.current?.editor;\n const selection = editor?.state?.selection;\n if (\n editor?.isFocused &&\n isPresent(titleRef.current) &&\n selection?.anchor === 1\n ) {\n const title = titleRef.current.value;\n titleRef.current.focus();\n titleRef.current.setSelectionRange(title?.length, title?.length);\n }\n };\n\n const isInFirstTextblock = $from =>\n range(0, $from.depth).every(depth => $from.index(depth) === 0);\n\n const handleEditorArrowUp = ({ editor }) => {\n const title = titleRef.current;\n const { selection } = editor.state;\n const isOnFirstLine =\n selection.empty &&\n isInFirstTextblock(selection.$from) &&\n editor.view.endOfTextblock(\"up\");\n\n if (!isOnFirstLine || !title || title.disabled) return false;\n\n title.focus();\n title.setSelectionRange(title.value.length, title.value.length);\n\n return true;\n };\n\n const handleTitleKeyDown = event => {\n if (event.defaultPrevented) return;\n\n const { key, shiftKey, altKey, metaKey, ctrlKey } = event;\n if (key === \"Enter\" && !shiftKey) {\n event.preventDefault();\n\n return;\n }\n\n if (key !== \"ArrowDown\" || shiftKey || altKey || metaKey || ctrlKey) {\n return;\n }\n\n // Let the caret move through a wrapped title first and jump to the\n // editor only once ArrowDown can no longer move it.\n const title = event.currentTarget;\n const { selectionStart, selectionEnd } = title;\n setTimeout(() => {\n const isCaretStuck =\n document.activeElement === title &&\n selectionStart === selectionEnd &&\n title.selectionStart === selectionStart &&\n title.selectionEnd === selectionEnd;\n\n isCaretStuck && editorRef.current?.editor?.commands?.focus(\"start\");\n });\n };\n\n const titleHotkeyRef = useHotkeys(\n \"return\",\n () => {\n editorRef.current?.editor?.commands?.insertContentAt(0, \"<p />\");\n editorRef.current?.editor?.commands?.focus(\"start\");\n },\n { mode: \"scoped\" }\n );\n\n const editorHotkeyRef = useHotkeys(\n \"backspace\",\n handleEditorBackspaceKeypress,\n { mode: \"scoped\" }\n );\n\n return {\n handleContentChange,\n handleAttachmentChange,\n handleTitleChange,\n handleEditorArrowUp,\n handleTitleKeyDown,\n editorHotkeyRef,\n titleHotkeyRef,\n errors,\n };\n};\n\nexport default useEditor;\n","import { Spinner } from \"@bigbinary/neeto-atoms\";\nimport { useFormikContext } from \"formik\";\nimport { ImageUploader } from \"neetoimageuploader/v2\";\nimport { isEmpty } from \"ramda\";\n\nimport { IMAGE_UPLOAD_CONFIG } from \"./constants\";\n\nconst MediaUploader = ({ setIsThumbnailImageModalOpen }) => {\n const {\n values: { thumbnailImageUrl },\n setFieldValue,\n initialValues,\n submitForm,\n } = useFormikContext();\n\n const handleUpload = file => {\n const { url, signedId } = file;\n setFieldValue(\"thumbnailImage\", signedId);\n setFieldValue(\"thumbnailImageUrl\", url);\n setTimeout(() => {\n setIsThumbnailImageModalOpen(false);\n submitForm();\n });\n };\n\n if (isEmpty(initialValues)) {\n return <Spinner />;\n }\n\n return (\n <ImageUploader\n className=\"h-auto w-full\"\n key={thumbnailImageUrl}\n src={thumbnailImageUrl}\n uploadConfig={IMAGE_UPLOAD_CONFIG}\n onUploadComplete={handleUpload}\n />\n );\n};\n\nexport default MediaUploader;\n","import { t } from \"i18next\";\nimport { Image } from \"lucide-react\";\n\nexport const getThumbnailAddon = command => ({\n label: t(\"neetoMolecules.documentEditor.thumbnailImage\"),\n optionName: \"thumbnail-image\",\n command,\n icon: Image,\n isEnabled: true,\n \"data-testid\": \"thumbnail-image-addon\",\n});\n","import { memo, useCallback, useMemo, useRef, useState } from \"react\";\n\nimport classNames from \"classnames\";\nimport { useFormikContext } from \"formik\";\nimport { Ellipsis } from \"lucide-react\";\nimport { Button, Dialog, DropdownMenu } from \"neetoatoms\";\nimport { Textarea as FormikTextarea } from \"neetoatoms/formik\";\nimport { noop } from \"neetocist\";\nimport { FormikEditor } from \"neetoeditor/v2\";\nimport PropTypes from \"prop-types\";\nimport { mergeRight } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { DEFAULT_EDITOR_PROPS, EDITOR_ADDONS } from \"./constants\";\nimport \"./editor.css\";\nimport useEditor from \"./hooks/useEditor\";\nimport MediaUploader from \"./MediaUploader\";\nimport { getThumbnailAddon } from \"./utils\";\n\nconst Editor = ({\n attachments,\n onContentChange,\n onAttachmentChange,\n onTitleChange,\n getTitleRef = noop,\n getEditorRef = noop,\n menuClassName,\n editorContentFieldName = \"htmlContent\",\n titleFieldName = \"title\",\n editorProps: customEditorProps = {},\n titleProps = {},\n hasThumbnailImage = false,\n children,\n}) => {\n const { t } = useTranslation();\n const { values, setFieldValue, submitForm } = useFormikContext();\n const { thumbnailImageUrl } = values;\n\n const titleRef = useRef();\n const editorRef = useRef();\n const [isThumbnailImageModalOpen, setIsThumbnailImageModalOpen] =\n useState(false);\n\n const editorProps = useMemo(() => {\n const baseProps = mergeRight(DEFAULT_EDITOR_PROPS, customEditorProps);\n\n if (!hasThumbnailImage) return baseProps;\n\n const thumbnailAddon = getThumbnailAddon(() =>\n setIsThumbnailImageModalOpen(true)\n );\n\n return mergeRight(baseProps, { addonCommands: [thumbnailAddon] });\n }, [customEditorProps, hasThumbnailImage]);\n\n const {\n handleContentChange,\n handleAttachmentChange,\n handleTitleChange,\n handleEditorArrowUp,\n handleTitleKeyDown,\n editorHotkeyRef,\n titleHotkeyRef,\n errors,\n } = useEditor({\n onContentChange,\n editorContentFieldName,\n onAttachmentChange,\n onTitleChange,\n titleFieldName,\n editorRef,\n titleRef,\n });\n\n const setTitleRef = node => {\n titleHotkeyRef.current = node;\n getTitleRef(node);\n titleRef.current = node;\n };\n\n const setEditorRef = useCallback(node => {\n editorRef.current = node;\n getEditorRef(node);\n }, []);\n\n const addons = useMemo(\n () => EDITOR_ADDONS.concat(editorProps.addons || []),\n [editorProps.addons]\n );\n\n const handleTab = () => {\n const isListActive =\n editorRef.current?.editor?.isActive(\"orderedList\") ||\n editorRef.current?.editor?.isActive(\"bulletList\");\n\n if (isListActive) {\n editorRef.current?.editor?.commands?.sinkListItem(\"listItem\");\n\n return true;\n }\n\n return true;\n };\n\n const handleDeleteThumbnail = () => {\n setFieldValue(\"thumbnailImage\", \"\");\n setFieldValue(\"thumbnailImageUrl\", \"\");\n setTimeout(submitForm);\n };\n\n return (\n <div\n className=\"nm-document-editor__wrapper\"\n data-testid=\"document-editor-container\"\n ref={editorHotkeyRef}\n >\n <FormikEditor\n attachmentsClassName=\"editor-content-attachments w-full flex-shrink-0\"\n className=\"h-full w-full\"\n contentClassName=\"editor-content__wrapper nm-document-editor__container\"\n data-testid=\"neeto-molecules-document-content-text-area\"\n error={undefined}\n errorWrapperClassName=\"w-full min-h-full flex flex-col items-center\"\n hideSlashCommands={false}\n menuClassName={classNames(\"nm-document-editor__menubar\", menuClassName)}\n name={editorContentFieldName}\n ref={setEditorRef}\n {...{ attachments, ...editorProps, addons }}\n contentWrapperClassName=\"w-full flex flex-col flex-grow\"\n keyboardShortcuts={{\n Tab: handleTab,\n ArrowUp: handleEditorArrowUp,\n ...editorProps.keyboardShortcuts,\n }}\n onChange={handleContentChange}\n onChangeAttachments={handleAttachmentChange}\n >\n {children}\n <div className=\"nm-document-editor__container px-6\">\n <FormikTextarea\n nakedTextarea\n className=\"nm-document-editor__title\"\n data-testid=\"neeto-molecules-document-title-text-field\"\n name={titleFieldName}\n ref={setTitleRef}\n rows={1}\n placeholder={\n titleProps.placeholder || t(\"neetoMolecules.documentEditor.title\")\n }\n onChange={handleTitleChange}\n {...titleProps}\n onKeyDown={event => {\n titleProps.onKeyDown?.(event);\n handleTitleKeyDown(event);\n }}\n />\n {thumbnailImageUrl && (\n <div className=\"group relative mt-4\">\n <div className=\"nm-document-editor__thumbnail\">\n <img alt=\"Cover\" src={thumbnailImageUrl} />\n </div>\n <div className=\"absolute end-2 top-2\">\n <DropdownMenu\n customTarget={\n <Button\n icon={Ellipsis}\n size=\"icon-sm\"\n variant=\"secondary\"\n aria-label={t(\n \"neetoMolecules.documentEditor.thumbnailOptions\"\n )}\n />\n }\n >\n <DropdownMenu.MenuItem onClick={handleDeleteThumbnail}>\n {t(\"neetoMolecules.documentEditor.delete\")}\n </DropdownMenu.MenuItem>\n </DropdownMenu>\n </div>\n </div>\n )}\n {errors[editorContentFieldName] && (\n <p\n className=\"text-destructive nm-document-editor__error text-sm font-normal\"\n data-slot=\"field-error\"\n data-testid=\"articles-content-input-error\"\n role=\"alert\"\n >\n {errors[editorContentFieldName]}\n </p>\n )}\n </div>\n </FormikEditor>\n <Dialog\n data-testid=\"thumbnail-image-modal\"\n isOpen={isThumbnailImageModalOpen}\n size=\"medium\"\n onClose={() => setIsThumbnailImageModalOpen(false)}\n >\n <Dialog.Header>\n <Dialog.Title>\n {t(\"neetoMolecules.documentEditor.uploadThumbnailImage\")}\n </Dialog.Title>\n </Dialog.Header>\n <Dialog.Body>\n <MediaUploader {...{ setIsThumbnailImageModalOpen }} />\n </Dialog.Body>\n </Dialog>\n </div>\n );\n};\n\nEditor.propTypes = {\n attachments: PropTypes.arrayOf(\n PropTypes.shape({\n contentType: PropTypes.string,\n filename: PropTypes.string,\n signedId: PropTypes.string,\n url: PropTypes.string,\n })\n ),\n onContentChange: PropTypes.func,\n onAttachmentChange: PropTypes.func,\n onTitleChange: PropTypes.func,\n getTitleRef: PropTypes.func,\n getEditorRef: PropTypes.func,\n editorContentFieldName: PropTypes.string,\n titleFieldName: PropTypes.string,\n editorProps: PropTypes.object,\n titleProps: PropTypes.object,\n menuClassName: PropTypes.string,\n children: PropTypes.node,\n hasThumbnailImage: PropTypes.bool,\n};\n\nEditor.displayName = \"DocumentEditor\";\n\nexport default memo(Editor);\n"],"names":["EDITOR_ADDONS","DEFAULT_EDITOR_PROPS","isMenuIndependent","addons","size","IMAGE_UPLOAD_CONFIG","maxImageSize","allowedImageTypes","useEditor","_ref","onContentChange","editorContentFieldName","onAttachmentChange","onTitleChange","titleFieldName","editorRef","titleRef","_useFormikContext","useFormikContext","setFieldValue","errors","handleContentChange","useCallback","content","handleAttachmentChange","attachments","handleTitleChange","event","title","target","value","handleEditorBackspaceKeypress","_editorRef$current","_editor$state","editor","current","selection","state","isFocused","isPresent","anchor","focus","setSelectionRange","length","isInFirstTextblock","$from","range","depth","every","index","handleEditorArrowUp","_ref2","isOnFirstLine","empty","view","endOfTextblock","disabled","handleTitleKeyDown","defaultPrevented","key","shiftKey","altKey","metaKey","ctrlKey","preventDefault","currentTarget","selectionStart","selectionEnd","setTimeout","_editorRef$current2","isCaretStuck","document","activeElement","commands","titleHotkeyRef","useHotkeys","_editorRef$current3","_editorRef$current4","insertContentAt","mode","editorHotkeyRef","MediaUploader","setIsThumbnailImageModalOpen","thumbnailImageUrl","values","initialValues","submitForm","handleUpload","file","url","signedId","isEmpty","_jsx","Spinner","ImageUploader","className","src","uploadConfig","onUploadComplete","getThumbnailAddon","command","label","t","optionName","icon","Image","isEnabled","Editor","_ref$getTitleRef","getTitleRef","noop","_ref$getEditorRef","getEditorRef","menuClassName","_ref$editorContentFie","_ref$titleFieldName","_ref$editorProps","editorProps","customEditorProps","_ref$titleProps","titleProps","_ref$hasThumbnailImag","hasThumbnailImage","children","_useTranslation","useTranslation","useRef","_useState","useState","_useState2","_slicedToArray","isThumbnailImageModalOpen","useMemo","baseProps","mergeRight","thumbnailAddon","addonCommands","_useEditor","setTitleRef","node","setEditorRef","concat","handleTab","isListActive","isActive","sinkListItem","handleDeleteThumbnail","_jsxs","ref","FormikEditor","_objectSpread","attachmentsClassName","contentClassName","error","undefined","errorWrapperClassName","hideSlashCommands","classNames","name","contentWrapperClassName","keyboardShortcuts","Tab","ArrowUp","onChange","onChangeAttachments","FormikTextarea","nakedTextarea","rows","placeholder","onKeyDown","_titleProps$onKeyDown","call","alt","DropdownMenu","customTarget","Button","Ellipsis","variant","MenuItem","onClick","role","Dialog","isOpen","onClose","Header","Title","Body","displayName","memo"],"mappings":";;;;;;;;;;;;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,8BAA8B;AAC1CqF,UAAAA,IAAI,EAAC,OAAO;UAAAzD,QAAA,EAEXvG,MAAM,CAACT,sBAAsB;AAAC,SAC9B,CACJ;AAAA,OACE,CAAC;AAAA,KAAA,CACM,CAAC,eACfwI,IAAA,CAACkC,MAAM,EAAA;AACL,MAAA,aAAA,EAAY,uBAAuB;AACnCC,MAAAA,MAAM,EAAEnD,yBAA0B;AAClC/H,MAAAA,IAAI,EAAC,QAAQ;MACbmL,OAAO,EAAE,SAATA,OAAOA,GAAA;QAAA,OAAQrG,4BAA4B,CAAC,KAAK,CAAC;MAAA,CAAC;AAAAyC,MAAAA,QAAA,EAAA,cAEnD/B,GAAA,CAACyF,MAAM,CAACG,MAAM,EAAA;AAAA7D,QAAAA,QAAA,eACZ/B,GAAA,CAACyF,MAAM,CAACI,KAAK,EAAA;UAAA9D,QAAA,EACVrB,CAAC,CAAC,oDAAoD;SAC3C;AAAC,OACF,CAAC,eAChBV,GAAA,CAACyF,MAAM,CAACK,IAAI,EAAA;QAAA/D,QAAA,eACV/B,GAAA,CAACX,aAAa,EAAA;AAAOC,UAAAA,4BAA4B,EAA5BA;SAAiC;AAAC,OAC5C,CAAC;AAAA,KACR,CAAC;AAAA,GACN,CAAC;AAEV,CAAC;AAyBDyB,MAAM,CAACgF,WAAW,GAAG,gBAAgB;AAErC,YAAA,aAAeC,IAAI,CAACjF,MAAM,CAAC;;;;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"DocumentEditor.js","sources":["../../node_modules/lucide-react/dist/esm/icons/image.mjs","../../src/v2/components/DocumentEditor/constants.js","../../src/v2/components/DocumentEditor/hooks/useEditor.js","../../src/v2/components/DocumentEditor/MediaUploader.jsx","../../src/v2/components/DocumentEditor/utils.js","../../src/v2/components/DocumentEditor/index.jsx"],"sourcesContent":["/**\n * @license lucide-react v1.24.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"rect\", { width: \"18\", height: \"18\", x: \"3\", y: \"3\", rx: \"2\", ry: \"2\", key: \"1m3agn\" }],\n [\"circle\", { cx: \"9\", cy: \"9\", r: \"2\", key: \"af1f0g\" }],\n [\"path\", { d: \"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21\", key: \"1xmnt7\" }]\n];\nconst Image = createLucideIcon(\"image\", __iconNode);\n\nexport { __iconNode, Image as default };\n//# sourceMappingURL=image.mjs.map\n","export const EDITOR_ADDONS = [\n \"highlight\",\n \"emoji\",\n \"video-upload\",\n \"code-block\",\n \"block-quote\",\n \"image-upload\",\n \"image-upload-unsplash\",\n \"divider\",\n \"video-embed\",\n \"undo\",\n \"redo\",\n \"table\",\n \"callout\",\n];\n\nexport const DEFAULT_EDITOR_PROPS = {\n isMenuIndependent: true,\n addons: [],\n size: \"medium\",\n};\n\nexport const IMAGE_UPLOAD_CONFIG = {\n maxImageSize: 1,\n allowedImageTypes: {\n \"image/jpg\": [\".jpg\", \".jpeg\"],\n \"image/png\": [\".png\"],\n \"image/svg\": [\".svg\"],\n },\n};\n\nexport const DOCUMENT_TITLE_NODE_NAME = \"documentTitle\";\n","import { useCallback } from \"react\";\n\nimport { useFormikContext } from \"formik\";\nimport { isPresent } from \"neetocist\";\nimport useHotkeys from \"neetohotkeys\";\nimport { range } from \"ramda\";\n\nconst useEditor = ({\n onContentChange,\n editorContentFieldName,\n onAttachmentChange,\n onTitleChange,\n titleFieldName,\n editorRef,\n titleRef,\n}) => {\n const { setFieldValue, errors } = useFormikContext();\n\n const handleContentChange = useCallback(\n content => {\n setFieldValue(editorContentFieldName, content);\n onContentChange?.(content);\n },\n [editorContentFieldName, onContentChange, setFieldValue]\n );\n\n const handleAttachmentChange = useCallback(\n attachments => {\n setFieldValue(\"attachments\", attachments);\n onAttachmentChange?.(attachments);\n },\n [onAttachmentChange, setFieldValue]\n );\n\n const handleTitleChange = event => {\n const title = event.target.value;\n setFieldValue(titleFieldName, title);\n onTitleChange?.(title);\n };\n\n const handleEditorBackspaceKeypress = () => {\n const editor = editorRef.current?.editor;\n const selection = editor?.state?.selection;\n if (\n editor?.isFocused &&\n isPresent(titleRef.current) &&\n selection?.anchor === 1\n ) {\n const title = titleRef.current.value;\n titleRef.current.focus();\n titleRef.current.setSelectionRange(title?.length, title?.length);\n }\n };\n\n const isInFirstTextblock = $from =>\n range(0, $from.depth).every(depth => $from.index(depth) === 0);\n\n const handleEditorArrowUp = ({ editor }) => {\n const title = titleRef.current;\n const { selection } = editor.state;\n const isOnFirstLine =\n selection.empty &&\n isInFirstTextblock(selection.$from) &&\n editor.view.endOfTextblock(\"up\");\n\n if (!isOnFirstLine || !title || title.disabled) return false;\n\n title.focus();\n title.setSelectionRange(title.value.length, title.value.length);\n\n return true;\n };\n\n const handleTitleKeyDown = event => {\n if (event.defaultPrevented) return;\n\n const { key, shiftKey, altKey, metaKey, ctrlKey } = event;\n if (key === \"Enter\" && !shiftKey) {\n event.preventDefault();\n\n return;\n }\n\n if (key !== \"ArrowDown\" || shiftKey || altKey || metaKey || ctrlKey) {\n return;\n }\n\n // Let the caret move through a wrapped title first and jump to the\n // editor only once ArrowDown can no longer move it.\n const title = event.currentTarget;\n const { selectionStart, selectionEnd } = title;\n setTimeout(() => {\n const isCaretStuck =\n document.activeElement === title &&\n selectionStart === selectionEnd &&\n title.selectionStart === selectionStart &&\n title.selectionEnd === selectionEnd;\n\n isCaretStuck && editorRef.current?.editor?.commands?.focus(\"start\");\n });\n };\n\n const titleHotkeyRef = useHotkeys(\n \"return\",\n () => {\n editorRef.current?.editor?.commands?.insertContentAt(0, \"<p />\");\n editorRef.current?.editor?.commands?.focus(\"start\");\n },\n { mode: \"scoped\" }\n );\n\n const editorHotkeyRef = useHotkeys(\n \"backspace\",\n handleEditorBackspaceKeypress,\n { mode: \"scoped\" }\n );\n\n return {\n handleContentChange,\n handleAttachmentChange,\n handleTitleChange,\n handleEditorArrowUp,\n handleTitleKeyDown,\n editorHotkeyRef,\n titleHotkeyRef,\n errors,\n };\n};\n\nexport default useEditor;\n","import { Spinner } from \"@bigbinary/neeto-atoms\";\nimport { useFormikContext } from \"formik\";\nimport { ImageUploader } from \"neetoimageuploader/v2\";\nimport { isEmpty } from \"ramda\";\n\nimport { IMAGE_UPLOAD_CONFIG } from \"./constants\";\n\nconst MediaUploader = ({ setIsThumbnailImageModalOpen }) => {\n const {\n values: { thumbnailImageUrl },\n setFieldValue,\n initialValues,\n submitForm,\n } = useFormikContext();\n\n const handleUpload = file => {\n const { url, signedId } = file;\n setFieldValue(\"thumbnailImage\", signedId);\n setFieldValue(\"thumbnailImageUrl\", url);\n setTimeout(() => {\n setIsThumbnailImageModalOpen(false);\n submitForm();\n });\n };\n\n if (isEmpty(initialValues)) {\n return <Spinner />;\n }\n\n return (\n <ImageUploader\n className=\"h-auto w-full\"\n key={thumbnailImageUrl}\n src={thumbnailImageUrl}\n uploadConfig={IMAGE_UPLOAD_CONFIG}\n onUploadComplete={handleUpload}\n />\n );\n};\n\nexport default MediaUploader;\n","import { t } from \"i18next\";\nimport { Image } from \"lucide-react\";\nimport { noop } from \"neetocist\";\n\nexport const getThumbnailAddon = command => ({\n label: t(\"neetoMolecules.documentEditor.thumbnailImage\"),\n optionName: \"thumbnail-image\",\n command,\n icon: Image,\n isEnabled: true,\n \"data-testid\": \"thumbnail-image-addon\",\n});\n\n// Stands in for the title textarea when the title lives inside the editor, so\n// that getTitleRef consumers can keep focusing it and reading its value.\nexport const createInlineTitleRef = getEditor => ({\n focus: () => getEditor()?.commands?.focusDocumentTitle?.(),\n get value() {\n return getEditor()?.state?.doc?.firstChild?.textContent ?? \"\";\n },\n setSelectionRange: noop,\n});\n","import { memo, useCallback, useEffect, useMemo, useRef, useState } from \"react\";\n\nimport classNames from \"classnames\";\nimport { useFormikContext } from \"formik\";\nimport { Ellipsis } from \"lucide-react\";\nimport { Button, Dialog, DropdownMenu } from \"neetoatoms\";\nimport { Textarea as FormikTextarea } from \"neetoatoms/formik\";\nimport { noop } from \"neetocist\";\nimport { FormikEditor } from \"neetoeditor/v2\";\nimport PropTypes from \"prop-types\";\nimport { mergeRight } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport {\n DEFAULT_EDITOR_PROPS,\n DOCUMENT_TITLE_NODE_NAME,\n EDITOR_ADDONS,\n} from \"./constants\";\nimport \"./editor.css\";\nimport useEditor from \"./hooks/useEditor\";\nimport MediaUploader from \"./MediaUploader\";\nimport { createInlineTitleRef, getThumbnailAddon } from \"./utils\";\n\nconst Editor = ({\n attachments,\n onContentChange,\n onAttachmentChange,\n onTitleChange,\n getTitleRef = noop,\n getEditorRef = noop,\n menuClassName,\n editorContentFieldName = \"htmlContent\",\n titleFieldName = \"title\",\n editorProps: customEditorProps = {},\n titleProps = {},\n hasThumbnailImage = false,\n isTitleInline = false,\n children,\n}) => {\n const { t } = useTranslation();\n const { values, touched, setFieldValue, setFieldTouched, submitForm } =\n useFormikContext();\n const { thumbnailImageUrl } = values;\n const titleValue = values[titleFieldName];\n\n const titleRef = useRef();\n const editorRef = useRef();\n const [isThumbnailImageModalOpen, setIsThumbnailImageModalOpen] =\n useState(false);\n\n const editorProps = useMemo(() => {\n const baseProps = mergeRight(DEFAULT_EDITOR_PROPS, customEditorProps);\n\n if (!hasThumbnailImage) return baseProps;\n\n const thumbnailAddon = getThumbnailAddon(() =>\n setIsThumbnailImageModalOpen(true)\n );\n\n return mergeRight(baseProps, { addonCommands: [thumbnailAddon] });\n }, [customEditorProps, hasThumbnailImage]);\n\n const {\n handleContentChange,\n handleAttachmentChange,\n handleTitleChange,\n handleEditorArrowUp,\n handleTitleKeyDown,\n editorHotkeyRef,\n titleHotkeyRef,\n errors,\n } = useEditor({\n onContentChange,\n editorContentFieldName,\n onAttachmentChange,\n onTitleChange,\n titleFieldName,\n editorRef,\n titleRef,\n });\n\n const lastInlineTitle = useRef(titleValue ?? \"\");\n const onTitleChangeRef = useRef(onTitleChange);\n onTitleChangeRef.current = onTitleChange;\n\n // FormikEditor is a FastField, so this has to read the latest handler by ref.\n const handleInlineTitleChange = useCallback(\n title => {\n lastInlineTitle.current = title;\n setFieldValue(titleFieldName, title);\n onTitleChangeRef.current?.(title);\n },\n [setFieldValue, titleFieldName]\n );\n\n const inlineTitle = useMemo(\n () =>\n isTitleInline\n ? {\n value: titleValue,\n placeholder:\n titleProps.placeholder ||\n t(\"neetoMolecules.documentEditor.title\"),\n dataTestId: titleProps[\"data-testid\"],\n autoFocus: titleProps.autoFocus,\n onChange: handleInlineTitleChange,\n }\n : null,\n [isTitleInline]\n );\n\n // Picks up titles set from outside the editor, like a restored version.\n useEffect(() => {\n if (!isTitleInline) return;\n\n const title = titleValue ?? \"\";\n if (title === lastInlineTitle.current) return;\n\n lastInlineTitle.current = title;\n editorRef.current?.editor?.commands?.setDocumentTitle?.(title);\n }, [isTitleInline, titleValue]);\n\n // FormikEditor only re-renders for its own field, and the title's error is\n // rendered inside it.\n const shouldUpdateEditor = (prevProps, nextProps) =>\n Boolean(editorProps.shouldUpdate?.(prevProps, nextProps)) ||\n (isTitleInline &&\n (prevProps.formik.errors[titleFieldName] !==\n nextProps.formik.errors[titleFieldName] ||\n prevProps.formik.touched[titleFieldName] !==\n nextProps.formik.touched[titleFieldName]));\n\n const handleEditorBlur = props => {\n const isCaretInTitle =\n props.editor.state.selection.$from.parent.type.name ===\n DOCUMENT_TITLE_NODE_NAME;\n\n isTitleInline && isCaretInTitle && setFieldTouched(titleFieldName, true);\n editorProps.onBlur?.(props);\n };\n\n const setTitleRef = node => {\n titleHotkeyRef.current = node;\n getTitleRef(node);\n titleRef.current = node;\n };\n\n const setEditorRef = useCallback(node => {\n editorRef.current = node;\n getEditorRef(node);\n\n if (!isTitleInline) return;\n\n getTitleRef(\n node?.editor\n ? createInlineTitleRef(() => editorRef.current?.editor)\n : null\n );\n }, []);\n\n const addons = useMemo(\n () => EDITOR_ADDONS.concat(editorProps.addons || []),\n [editorProps.addons]\n );\n\n const handleTab = () => {\n const isListActive =\n editorRef.current?.editor?.isActive(\"orderedList\") ||\n editorRef.current?.editor?.isActive(\"bulletList\");\n\n if (isListActive) {\n editorRef.current?.editor?.commands?.sinkListItem(\"listItem\");\n\n return true;\n }\n\n return true;\n };\n\n const handleDeleteThumbnail = () => {\n setFieldValue(\"thumbnailImage\", \"\");\n setFieldValue(\"thumbnailImageUrl\", \"\");\n setTimeout(submitForm);\n };\n\n return (\n <div\n className=\"nm-document-editor__wrapper\"\n data-testid=\"document-editor-container\"\n ref={editorHotkeyRef}\n >\n <FormikEditor\n attachmentsClassName=\"editor-content-attachments w-full flex-shrink-0\"\n className=\"h-full w-full\"\n contentClassName=\"editor-content__wrapper nm-document-editor__container\"\n data-testid=\"neeto-molecules-document-content-text-area\"\n error={undefined}\n errorWrapperClassName=\"w-full min-h-full flex flex-col items-center\"\n hideSlashCommands={false}\n menuClassName={classNames(\"nm-document-editor__menubar\", menuClassName)}\n name={editorContentFieldName}\n ref={setEditorRef}\n {...{ attachments, inlineTitle, ...editorProps, addons }}\n contentWrapperClassName=\"w-full flex flex-col flex-grow\"\n shouldUpdate={shouldUpdateEditor}\n keyboardShortcuts={{\n Tab: handleTab,\n ArrowUp: handleEditorArrowUp,\n ...editorProps.keyboardShortcuts,\n }}\n onBlur={handleEditorBlur}\n onChange={handleContentChange}\n onChangeAttachments={handleAttachmentChange}\n >\n {children}\n <div className=\"nm-document-editor__container px-6\">\n {isTitleInline ? (\n touched[titleFieldName] &&\n errors[titleFieldName] && (\n <p\n className=\"text-destructive nm-document-editor__error text-sm font-normal\"\n data-slot=\"field-error\"\n data-testid=\"document-title-input-error\"\n role=\"alert\"\n >\n {errors[titleFieldName]}\n </p>\n )\n ) : (\n <FormikTextarea\n nakedTextarea\n className=\"nm-document-editor__title\"\n data-testid=\"neeto-molecules-document-title-text-field\"\n name={titleFieldName}\n ref={setTitleRef}\n rows={1}\n placeholder={\n titleProps.placeholder ||\n t(\"neetoMolecules.documentEditor.title\")\n }\n onChange={handleTitleChange}\n {...titleProps}\n onKeyDown={event => {\n titleProps.onKeyDown?.(event);\n handleTitleKeyDown(event);\n }}\n />\n )}\n {thumbnailImageUrl && (\n <div className=\"group relative mt-4\">\n <div className=\"nm-document-editor__thumbnail\">\n <img alt=\"Cover\" src={thumbnailImageUrl} />\n </div>\n <div className=\"absolute end-2 top-2\">\n <DropdownMenu\n customTarget={\n <Button\n icon={Ellipsis}\n size=\"icon-sm\"\n variant=\"secondary\"\n aria-label={t(\n \"neetoMolecules.documentEditor.thumbnailOptions\"\n )}\n />\n }\n >\n <DropdownMenu.MenuItem onClick={handleDeleteThumbnail}>\n {t(\"neetoMolecules.documentEditor.delete\")}\n </DropdownMenu.MenuItem>\n </DropdownMenu>\n </div>\n </div>\n )}\n {errors[editorContentFieldName] && (\n <p\n className=\"text-destructive nm-document-editor__error text-sm font-normal\"\n data-slot=\"field-error\"\n data-testid=\"articles-content-input-error\"\n role=\"alert\"\n >\n {errors[editorContentFieldName]}\n </p>\n )}\n </div>\n </FormikEditor>\n <Dialog\n data-testid=\"thumbnail-image-modal\"\n isOpen={isThumbnailImageModalOpen}\n size=\"medium\"\n onClose={() => setIsThumbnailImageModalOpen(false)}\n >\n <Dialog.Header>\n <Dialog.Title>\n {t(\"neetoMolecules.documentEditor.uploadThumbnailImage\")}\n </Dialog.Title>\n </Dialog.Header>\n <Dialog.Body>\n <MediaUploader {...{ setIsThumbnailImageModalOpen }} />\n </Dialog.Body>\n </Dialog>\n </div>\n );\n};\n\nEditor.propTypes = {\n attachments: PropTypes.arrayOf(\n PropTypes.shape({\n contentType: PropTypes.string,\n filename: PropTypes.string,\n signedId: PropTypes.string,\n url: PropTypes.string,\n })\n ),\n onContentChange: PropTypes.func,\n onAttachmentChange: PropTypes.func,\n onTitleChange: PropTypes.func,\n getTitleRef: PropTypes.func,\n getEditorRef: PropTypes.func,\n editorContentFieldName: PropTypes.string,\n titleFieldName: PropTypes.string,\n editorProps: PropTypes.object,\n titleProps: PropTypes.object,\n menuClassName: PropTypes.string,\n children: PropTypes.node,\n hasThumbnailImage: PropTypes.bool,\n /**\n * Keeps the title inside the editor document, so that a selection can span\n * the title and the content. Needs neeto-editor-frontend 2.7.4 or later. With\n * `collaborationProvider`, it also needs an editor release that supports\n * `inlineTitle` with collaboration, or the title does not show.\n */\n isTitleInline: PropTypes.bool,\n};\n\nEditor.displayName = \"DocumentEditor\";\n\nexport default memo(Editor);\n"],"names":["EDITOR_ADDONS","DEFAULT_EDITOR_PROPS","isMenuIndependent","addons","size","IMAGE_UPLOAD_CONFIG","maxImageSize","allowedImageTypes","DOCUMENT_TITLE_NODE_NAME","useEditor","_ref","onContentChange","editorContentFieldName","onAttachmentChange","onTitleChange","titleFieldName","editorRef","titleRef","_useFormikContext","useFormikContext","setFieldValue","errors","handleContentChange","useCallback","content","handleAttachmentChange","attachments","handleTitleChange","event","title","target","value","handleEditorBackspaceKeypress","_editorRef$current","_editor$state","editor","current","selection","state","isFocused","isPresent","anchor","focus","setSelectionRange","length","isInFirstTextblock","$from","range","depth","every","index","handleEditorArrowUp","_ref2","isOnFirstLine","empty","view","endOfTextblock","disabled","handleTitleKeyDown","defaultPrevented","key","shiftKey","altKey","metaKey","ctrlKey","preventDefault","currentTarget","selectionStart","selectionEnd","setTimeout","_editorRef$current2","isCaretStuck","document","activeElement","commands","titleHotkeyRef","useHotkeys","_editorRef$current3","_editorRef$current4","insertContentAt","mode","editorHotkeyRef","MediaUploader","setIsThumbnailImageModalOpen","thumbnailImageUrl","values","initialValues","submitForm","handleUpload","file","url","signedId","isEmpty","_jsx","Spinner","ImageUploader","className","src","uploadConfig","onUploadComplete","getThumbnailAddon","command","label","t","optionName","icon","Image","isEnabled","createInlineTitleRef","getEditor","_getEditor","_getEditor$focusDocum","focusDocumentTitle","call","_getEditor$state$doc$","_getEditor2","doc","firstChild","textContent","noop","Editor","_ref$getTitleRef","getTitleRef","_ref$getEditorRef","getEditorRef","menuClassName","_ref$editorContentFie","_ref$titleFieldName","_ref$editorProps","editorProps","customEditorProps","_ref$titleProps","titleProps","_ref$hasThumbnailImag","hasThumbnailImage","_ref$isTitleInline","isTitleInline","children","_useTranslation","useTranslation","touched","setFieldTouched","titleValue","useRef","_useState","useState","_useState2","_slicedToArray","isThumbnailImageModalOpen","useMemo","baseProps","mergeRight","thumbnailAddon","addonCommands","_useEditor","lastInlineTitle","onTitleChangeRef","handleInlineTitleChange","_onTitleChangeRef$cur","inlineTitle","placeholder","dataTestId","autoFocus","onChange","useEffect","_editorRef$current$se","setDocumentTitle","shouldUpdateEditor","prevProps","nextProps","_editorProps$shouldUp","Boolean","shouldUpdate","formik","handleEditorBlur","props","_editorProps$onBlur","isCaretInTitle","parent","type","name","onBlur","setTitleRef","node","setEditorRef","concat","handleTab","isListActive","isActive","_editorRef$current5","sinkListItem","handleDeleteThumbnail","_jsxs","ref","FormikEditor","_objectSpread","attachmentsClassName","contentClassName","error","undefined","errorWrapperClassName","hideSlashCommands","classNames","contentWrapperClassName","keyboardShortcuts","Tab","ArrowUp","onChangeAttachments","role","FormikTextarea","nakedTextarea","rows","onKeyDown","_titleProps$onKeyDown","alt","DropdownMenu","customTarget","Button","Ellipsis","variant","MenuItem","onClick","Dialog","isOpen","onClose","Header","Title","Body","displayName","memo"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;;;AAIA,MAAM,UAAU,GAAG;AACnB,EAAE,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC;AAC1F,EAAE,CAAC,QAAQ,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC;AACzD,EAAE,CAAC,MAAM,E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AAC;AAAAsD,MAAAA,QAAA,EAAA,cAEnD5C,GAAA,CAACiI,MAAM,CAACG,MAAM,EAAA;AAAAxF,QAAAA,QAAA,eACZ5C,GAAA,CAACiI,MAAM,CAACI,KAAK,EAAA;UAAAzF,QAAA,EACVlC,CAAC,CAAC,oDAAoD;SAC3C;AAAC,OACF,CAAC,eAChBV,GAAA,CAACiI,MAAM,CAACK,IAAI,EAAA;QAAA1F,QAAA,eACV5C,GAAA,CAACX,aAAa,EAAA;AAAOC,UAAAA,4BAA4B,EAA5BA;SAAiC;AAAC,OAC5C,CAAC;AAAA,KACR,CAAC;AAAA,GACN,CAAC;AAEV,CAAC;AAgCDqC,MAAM,CAAC4G,WAAW,GAAG,gBAAgB;AAErC,YAAA,aAAeC,IAAI,CAAC7G,MAAM,CAAC;;;;","x_google_ignoreList":[0]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigbinary/neeto-molecules",
|
|
3
|
-
"version": "5.12.
|
|
3
|
+
"version": "5.12.8",
|
|
4
4
|
"description": "A package of reusable molecular components for neeto products.",
|
|
5
5
|
"repository": "git@github.com:bigbinary/neeto-molecules.git",
|
|
6
6
|
"author": "Amaljith K <amaljith.k@bigbinary.com>",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"@bigbinary/neeto-audit-frontend": "2.5.5",
|
|
64
64
|
"@bigbinary/neeto-cist": "1.0.17",
|
|
65
65
|
"@bigbinary/neeto-commons-frontend": "4.14.1",
|
|
66
|
-
"@bigbinary/neeto-editor-frontend": "2.
|
|
66
|
+
"@bigbinary/neeto-editor-frontend": "2.7.4",
|
|
67
67
|
"@bigbinary/neeto-filters-frontend": "4.5.1",
|
|
68
68
|
"@bigbinary/neeto-hotkeys": "1.0.9",
|
|
69
69
|
"@bigbinary/neeto-icons": "1.20.89",
|
|
@@ -235,7 +235,7 @@
|
|
|
235
235
|
"@bigbinary/neeto-atoms": "1.1.6",
|
|
236
236
|
"@bigbinary/neeto-cist": "1.0.17",
|
|
237
237
|
"@bigbinary/neeto-commons-frontend": "4.14.1",
|
|
238
|
-
"@bigbinary/neeto-editor-frontend": "2.
|
|
238
|
+
"@bigbinary/neeto-editor-frontend": "2.7.4",
|
|
239
239
|
"@bigbinary/neeto-filters-frontend": "4.5.1",
|
|
240
240
|
"@bigbinary/neeto-hotkeys": "1.0.9",
|
|
241
241
|
"@bigbinary/neeto-icons": "1.20.89",
|
|
@@ -4,20 +4,37 @@ import {
|
|
|
4
4
|
} from "@bigbinary/neeto-editor-frontend";
|
|
5
5
|
import { TextareaProps } from "@bigbinary/neeto-atoms";
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
7
|
+
export interface InlineTitleRef {
|
|
8
|
+
focus: () => void;
|
|
9
|
+
readonly value: string;
|
|
10
|
+
setSelectionRange: () => void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
type TitleRefProps =
|
|
14
|
+
| {
|
|
15
|
+
isTitleInline?: false;
|
|
16
|
+
getTitleRef?: (ref: HTMLTextAreaElement | null) => void;
|
|
17
|
+
}
|
|
18
|
+
| {
|
|
19
|
+
isTitleInline: true;
|
|
20
|
+
getTitleRef?: (ref: InlineTitleRef | null) => void;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const DocumentEditor: React.FC<
|
|
24
|
+
TitleRefProps & {
|
|
25
|
+
attachments?: attachment[];
|
|
26
|
+
onContentChange?: (content: string) => void;
|
|
27
|
+
onAttachmentChange?: (attachments: attachment[]) => void;
|
|
28
|
+
onTitleChange?: (title: string) => void;
|
|
29
|
+
getEditorRef?: (ref: any) => void;
|
|
30
|
+
editorContentFieldName?: string;
|
|
31
|
+
titleFieldName?: string;
|
|
32
|
+
editorProps?: FormikEditorProps;
|
|
33
|
+
titleProps?: TextareaProps;
|
|
34
|
+
menuClassName?: string;
|
|
35
|
+
children?: React.ReactNode;
|
|
36
|
+
hasThumbnailImage?: boolean;
|
|
37
|
+
}
|
|
38
|
+
>;
|
|
22
39
|
|
|
23
40
|
export default DocumentEditor;
|