@bigbinary/neeto-molecules 1.17.2 → 1.17.4

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.
@@ -5,7 +5,7 @@ import { Typography } from '@bigbinary/neetoui';
5
5
  import { Link } from 'react-router-dom';
6
6
  import { n } from './inject-css-c86de496.js';
7
7
 
8
- var css = ".neeto-molecules-breadcrumb{align-items:center;display:flex;flex-direction:row;justify-content:flex-start;line-height:1}.neeto-molecules-breadcrumb a{text-decoration:none;transition:all .3s ease-in-out}.neeto-molecules-breadcrumb a:focus-visible{border-radius:var(--neeto-ui-rounded-sm);outline:3px solid rgba(var(--neeto-ui-primary-500),50%)}.neeto-molecules-breadcrumb-separator{font-size:12px;line-height:16px;margin:0 12px}.neeto-molecules-breadcrumbs-wrap{display:flex;margin:0 0 40px}@media screen and (max-width:768px){.neeto-molecules-breadcrumbs-wrap{margin:0 0 16px}}";
8
+ var css = ".neeto-molecules-breadcrumb{align-items:center;display:flex;flex-direction:row;justify-content:flex-start;line-height:1}.neeto-molecules-breadcrumb a{text-decoration:none;transition:all .3s ease-in-out}.neeto-molecules-breadcrumb a:focus-visible{border-radius:var(--neeto-ui-rounded-sm);outline:3px solid rgba(var(--neeto-ui-primary-500),50%)}.neeto-molecules-breadcrumb-separator{font-size:12px;line-height:16px;margin:0 12px}.neeto-molecules-breadcrumbs-wrap{display:flex;flex-wrap:wrap;gap:6px 0;margin:0 0 40px}@media screen and (max-width:768px){.neeto-molecules-breadcrumbs-wrap{margin:0 0 16px}}";
9
9
  n(css,{});
10
10
 
11
11
  var Breadcrumbs = function Breadcrumbs(_ref) {
@@ -1,9 +1,9 @@
1
1
  import { _ as _extends } from './extends-093996c9.js';
2
2
  import { _ as _defineProperty } from './defineProperty-549061a7.js';
3
3
  import { _ as _slicedToArray } from './slicedToArray-b4278ecd.js';
4
- import React__default, { useRef, useState } from 'react';
4
+ import React__default, { useRef, useState, useCallback } from 'react';
5
5
  import classnames from 'classnames';
6
- import { noop } from '@bigbinary/neeto-cist';
6
+ import { isPresent, noop } from '@bigbinary/neeto-cist';
7
7
  import { FormikEditor } from '@bigbinary/neeto-editor';
8
8
  import { Typography } from '@bigbinary/neetoui';
9
9
  import { Textarea } from '@bigbinary/neetoui/formik';
@@ -29,7 +29,8 @@ var useEditor = function useEditor(_ref) {
29
29
  onAttachmentChange = _ref.onAttachmentChange,
30
30
  onTitleChange = _ref.onTitleChange,
31
31
  titleFieldName = _ref.titleFieldName,
32
- editorRef = _ref.editorRef;
32
+ editorRef = _ref.editorRef,
33
+ titleRef = _ref.titleRef;
33
34
  var _useFormikContext = useFormikContext(),
34
35
  setFieldValue = _useFormikContext.setFieldValue,
35
36
  errors = _useFormikContext.errors;
@@ -47,16 +48,31 @@ var useEditor = function useEditor(_ref) {
47
48
  setFieldValue(titleFieldName, title);
48
49
  onTitleChange === null || onTitleChange === void 0 ? void 0 : onTitleChange(title);
49
50
  };
51
+ var handleEditorBackspaceKeypress = function handleEditorBackspaceKeypress() {
52
+ var _editorRef$current, _editor$state;
53
+ var editor = (_editorRef$current = editorRef.current) === null || _editorRef$current === void 0 ? void 0 : _editorRef$current.editor;
54
+ var selection = editor === null || editor === void 0 ? void 0 : (_editor$state = editor.state) === null || _editor$state === void 0 ? void 0 : _editor$state.selection;
55
+ if (editor !== null && editor !== void 0 && editor.isFocused && isPresent(titleRef.current) && (selection === null || selection === void 0 ? void 0 : selection.anchor) === 1) {
56
+ var title = titleRef.current.value;
57
+ titleRef.current.focus();
58
+ titleRef.current.setSelectionRange(title === null || title === void 0 ? void 0 : title.length, title === null || title === void 0 ? void 0 : title.length);
59
+ }
60
+ };
50
61
  var titleHotkeyRef = useHotkeys("return", function () {
51
- var _editorRef$current, _editorRef$current$ed, _editorRef$current$ed2;
52
- return (_editorRef$current = editorRef.current) === null || _editorRef$current === void 0 ? void 0 : (_editorRef$current$ed = _editorRef$current.editor) === null || _editorRef$current$ed === void 0 ? void 0 : (_editorRef$current$ed2 = _editorRef$current$ed.commands) === null || _editorRef$current$ed2 === void 0 ? void 0 : _editorRef$current$ed2.focus();
62
+ var _editorRef$current2, _editorRef$current2$e, _editorRef$current2$e2, _editorRef$current3, _editorRef$current3$e, _editorRef$current3$e2;
63
+ (_editorRef$current2 = editorRef.current) === null || _editorRef$current2 === void 0 ? void 0 : (_editorRef$current2$e = _editorRef$current2.editor) === null || _editorRef$current2$e === void 0 ? void 0 : (_editorRef$current2$e2 = _editorRef$current2$e.commands) === null || _editorRef$current2$e2 === void 0 ? void 0 : _editorRef$current2$e2.insertContentAt(0, "<p />");
64
+ (_editorRef$current3 = editorRef.current) === null || _editorRef$current3 === void 0 ? void 0 : (_editorRef$current3$e = _editorRef$current3.editor) === null || _editorRef$current3$e === void 0 ? void 0 : (_editorRef$current3$e2 = _editorRef$current3$e.commands) === null || _editorRef$current3$e2 === void 0 ? void 0 : _editorRef$current3$e2.focus("start");
53
65
  }, {
54
66
  mode: "scoped"
55
67
  });
68
+ var editorHotkeyRef = useHotkeys("backspace", handleEditorBackspaceKeypress, {
69
+ mode: "scoped"
70
+ });
56
71
  return {
57
72
  handleContentChange: handleContentChange,
58
73
  handleAttachmentChange: handleAttachmentChange,
59
74
  handleTitleChange: handleTitleChange,
75
+ editorHotkeyRef: editorHotkeyRef,
60
76
  titleHotkeyRef: titleHotkeyRef,
61
77
  errors: errors
62
78
  };
@@ -108,11 +124,13 @@ var Editor = function Editor(_ref) {
108
124
  onAttachmentChange: onAttachmentChange,
109
125
  onTitleChange: onTitleChange,
110
126
  titleFieldName: titleFieldName,
111
- editorRef: editorRef
127
+ editorRef: editorRef,
128
+ titleRef: titleRef
112
129
  }),
113
130
  handleContentChange = _useEditor.handleContentChange,
114
131
  handleAttachmentChange = _useEditor.handleAttachmentChange,
115
132
  handleTitleChange = _useEditor.handleTitleChange,
133
+ editorHotkeyRef = _useEditor.editorHotkeyRef,
116
134
  titleHotkeyRef = _useEditor.titleHotkeyRef,
117
135
  errors = _useEditor.errors;
118
136
  var setTitleRef = function setTitleRef(node) {
@@ -120,13 +138,14 @@ var Editor = function Editor(_ref) {
120
138
  getTitleRef(node);
121
139
  titleRef.current = node;
122
140
  };
123
- var setEditorRef = function setEditorRef(node) {
124
- getEditorRef(node);
141
+ var setEditorRef = useCallback(function (node) {
125
142
  editorRef.current = node;
126
- };
143
+ getEditorRef(node);
144
+ }, []);
127
145
  return /*#__PURE__*/React__default.createElement("div", {
128
146
  className: "neeto-molecules-document__wrapper",
129
- "data-testid": "document-editor-container"
147
+ "data-testid": "document-editor-container",
148
+ ref: editorHotkeyRef
130
149
  }, /*#__PURE__*/React__default.createElement(FormikEditor, _extends({
131
150
  attachmentsClassName: "editor-content-attachments",
132
151
  className: "h-full w-full",
@@ -1 +1 @@
1
- {"version":3,"file":"DocumentEditor.js","sources":["../src/components/DocumentEditor/constants.js","../src/components/DocumentEditor/hooks/useEditor.js","../src/components/DocumentEditor/utils.js","../src/components/DocumentEditor/index.jsx"],"sourcesContent":["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];\n\nexport const DEFAULT_EDITOR_PROPS = {\n isCharacterCountActive: true,\n isMenuIndependent: true,\n addons: [],\n};\n","import { useFormikContext } from \"formik\";\nimport useHotkeys from \"neetohotkeys\";\n\nconst useEditor = ({\n onContentChange,\n editorContentFieldName,\n setAttachments,\n onAttachmentChange,\n onTitleChange,\n titleFieldName,\n editorRef,\n}) => {\n const { setFieldValue, errors } = useFormikContext();\n\n const handleContentChange = content => {\n setFieldValue(editorContentFieldName, content);\n onContentChange?.(content);\n };\n\n const handleAttachmentChange = attachments => {\n setAttachments(attachments);\n setFieldValue(\"attachments\", attachments);\n onAttachmentChange?.(attachments);\n };\n\n const handleTitleChange = event => {\n const title = event.target.value;\n setFieldValue(titleFieldName, title);\n onTitleChange?.(title);\n };\n\n const titleHotkeyRef = useHotkeys(\n \"return\",\n () => editorRef.current?.editor?.commands?.focus(),\n { mode: \"scoped\" }\n );\n\n return {\n handleContentChange,\n handleAttachmentChange,\n handleTitleChange,\n titleHotkeyRef,\n errors,\n };\n};\n\nexport default useEditor;\n","export const getUniqueAttachments = attachments => {\n const uniqueAttachments = attachments?.reduce(\n (uniqueAttachments, attachment) => ({\n ...uniqueAttachments,\n [attachment.signedId]: attachment,\n }),\n {}\n );\n\n return Object.values(uniqueAttachments || {});\n};\n","import React, { useRef, useState } from \"react\";\n\nimport classNames from \"classnames\";\nimport { noop } from \"neetocist\";\nimport { FormikEditor } from \"neetoeditor\";\nimport { Typography } from \"neetoui\";\nimport { Textarea } from \"neetoui/formik\";\nimport PropTypes from \"prop-types\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { DEFAULT_EDITOR_PROPS, EDITOR_ADDONS } from \"./constants\";\nimport \"./editor.scss\";\nimport useEditor from \"./hooks/useEditor\";\nimport { getUniqueAttachments } from \"./utils\";\n\nconst Editor = ({\n attachments: initialAttachments,\n onContentChange,\n onAttachmentChange,\n onTitleChange,\n getTitleRef = noop,\n getEditorRef = noop,\n menuClassName,\n editorContentFieldName = \"htmlContent\",\n titleFieldName = \"title\",\n editorProps = DEFAULT_EDITOR_PROPS,\n titleProps = {},\n}) => {\n const { t } = useTranslation();\n\n const titleRef = useRef();\n const editorRef = useRef();\n\n const [attachments, setAttachments] = useState(() =>\n getUniqueAttachments(initialAttachments)\n );\n\n const {\n handleContentChange,\n handleAttachmentChange,\n handleTitleChange,\n titleHotkeyRef,\n errors,\n } = useEditor({\n onContentChange,\n editorContentFieldName,\n setAttachments,\n onAttachmentChange,\n onTitleChange,\n titleFieldName,\n editorRef,\n });\n\n const setTitleRef = node => {\n titleHotkeyRef.current = node;\n getTitleRef(node);\n titleRef.current = node;\n };\n\n const setEditorRef = node => {\n getEditorRef(node);\n editorRef.current = node;\n };\n\n return (\n <div\n className=\"neeto-molecules-document__wrapper\"\n data-testid=\"document-editor-container\"\n >\n <FormikEditor\n attachmentsClassName=\"editor-content-attachments\"\n className=\"h-full w-full\"\n contentClassName=\"editor-content__wrapper neeto-molecules-document__container\"\n data-cy=\"neeto-molecules-document-content-text-area\"\n error={undefined}\n name={editorContentFieldName}\n ref={setEditorRef}\n menuClassName={classNames(\n \"neeto-molecules-document-editor__menubar\",\n menuClassName\n )}\n {...{ attachments, ...editorProps }}\n addons={EDITOR_ADDONS.concat(editorProps.addons || [])}\n onChange={handleContentChange}\n onChangeAttachments={handleAttachmentChange}\n >\n <div className=\"neeto-molecules-document__container px-4\">\n <Textarea\n nakedTextarea\n className=\"neeto-molecules-document__title\"\n data-cy=\"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 onKeyDown={e =>\n e.key === \"Enter\" && !e.shiftKey && e.preventDefault()\n }\n {...titleProps}\n />\n {errors[editorContentFieldName] && (\n <Typography\n className=\"neeto-ui-input__error neeto-molecules-editor-content__error\"\n data-cy=\"articles-content-input-error\"\n style=\"body3\"\n >\n {errors[editorContentFieldName]}\n </Typography>\n )}\n </div>\n </FormikEditor>\n </div>\n );\n};\n\nEditor.propTypes = {\n /**\n * List of initial attachments.\n */\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 /**\n * Callback that will be triggered when the editor content changes.\n * This function is not throttled.\n */\n onContentChange: PropTypes.func,\n /**\n * Callback that will be triggered when the attachments changes.\n */\n onAttachmentChange: PropTypes.func,\n /**\n * Callback that will be triggered when the article title changes.\n */\n onTitleChange: PropTypes.func,\n /**\n * This function will be called with the title node reference.\n */\n getTitleRef: PropTypes.func,\n /**\n * This function will be called with editor reference.\n */\n getEditorRef: PropTypes.func,\n /**\n * Formik field name of the editor. The default value is `htmlContent`.\n */\n editorContentFieldName: PropTypes.string,\n /**\n * Formik field name of the title. The default value is `title`.\n */\n titleFieldName: PropTypes.string,\n /**\n * These props will be passed down to the editor component.\n */\n editorProps: PropTypes.object,\n /**\n * These props will be passed down to the title text area component.\n */\n titleProps: PropTypes.object,\n /**\n * A prop to pass class names to the editor menubar.\n */\n menuClassName: PropTypes.string,\n};\n\nexport default Editor;\n"],"names":["EDITOR_ADDONS","DEFAULT_EDITOR_PROPS","isCharacterCountActive","isMenuIndependent","addons","useEditor","_ref","onContentChange","editorContentFieldName","setAttachments","onAttachmentChange","onTitleChange","titleFieldName","editorRef","_useFormikContext","useFormikContext","setFieldValue","errors","handleContentChange","content","handleAttachmentChange","attachments","handleTitleChange","event","title","target","value","titleHotkeyRef","useHotkeys","_editorRef$current","_editorRef$current$ed","_editorRef$current$ed2","current","editor","commands","focus","mode","getUniqueAttachments","uniqueAttachments","reduce","attachment","_objectSpread","_defineProperty","signedId","Object","values","Editor","initialAttachments","_ref$getTitleRef","getTitleRef","noop","_ref$getEditorRef","getEditorRef","menuClassName","_ref$editorContentFie","_ref$titleFieldName","_ref$editorProps","editorProps","_ref$titleProps","titleProps","_useTranslation","useTranslation","t","titleRef","useRef","_useState","useState","_useState2","_slicedToArray","_useEditor","setTitleRef","node","setEditorRef","React","createElement","className","FormikEditor","_extends","attachmentsClassName","contentClassName","error","undefined","name","ref","classNames","concat","onChange","onChangeAttachments","Textarea","nakedTextarea","rows","placeholder","onKeyDown","e","key","shiftKey","preventDefault","Typography","style"],"mappings":";;;;;;;;;;;;;;AAAO,IAAMA,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,CACR,CAAA;AAEM,IAAMC,oBAAoB,GAAG;AAClCC,EAAAA,sBAAsB,EAAE,IAAI;AAC5BC,EAAAA,iBAAiB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,IAAA;AACbd,IAAAA,SAAS,EAAC,iCAAiC;AAC3C,IAAA,SAAA,EAAQ,2CAA2C;AACnDO,IAAAA,IAAI,EAAEtE,cAAe;AACrBuE,IAAAA,GAAG,EAAEb,WAAY;AACjBoB,IAAAA,IAAI,EAAE,CAAE;IACRC,WAAW,EACThC,UAAU,CAACgC,WAAW,IAAI7B,CAAC,CAAC,qCAAqC,CAClE;AACDwB,IAAAA,QAAQ,EAAEhE,iBAAkB;IAC5BsE,SAAS,EAAE,SAAAA,SAAAA,CAAAC,CAAC,EAAA;AAAA,MAAA,OACVA,CAAC,CAACC,GAAG,KAAK,OAAO,IAAI,CAACD,CAAC,CAACE,QAAQ,IAAIF,CAAC,CAACG,cAAc,EAAE,CAAA;AAAA,KAAA;AACvD,GAAA,EACGrC,UAAU,CACf,CAAC,EACD1C,MAAM,CAACT,sBAAsB,CAAC,iBAC7BiE,cAAA,CAAAC,aAAA,CAACuB,UAAU,EAAA;AACTtB,IAAAA,SAAS,EAAC,6DAA6D;AACvE,IAAA,SAAA,EAAQ,8BAA8B;AACtCuB,IAAAA,KAAK,EAAC,OAAA;AAAO,GAAA,EAEZjF,MAAM,CAACT,sBAAsB,CACpB,CAEX,CACO,CACX,CAAC,CAAA;AAEV;;;;"}
1
+ {"version":3,"file":"DocumentEditor.js","sources":["../src/components/DocumentEditor/constants.js","../src/components/DocumentEditor/hooks/useEditor.js","../src/components/DocumentEditor/utils.js","../src/components/DocumentEditor/index.jsx"],"sourcesContent":["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];\n\nexport const DEFAULT_EDITOR_PROPS = {\n isCharacterCountActive: true,\n isMenuIndependent: true,\n addons: [],\n};\n","import { useFormikContext } from \"formik\";\nimport { isPresent } from \"neetocist\";\nimport useHotkeys from \"neetohotkeys\";\n\nconst useEditor = ({\n onContentChange,\n editorContentFieldName,\n setAttachments,\n onAttachmentChange,\n onTitleChange,\n titleFieldName,\n editorRef,\n titleRef,\n}) => {\n const { setFieldValue, errors } = useFormikContext();\n\n const handleContentChange = content => {\n setFieldValue(editorContentFieldName, content);\n onContentChange?.(content);\n };\n\n const handleAttachmentChange = attachments => {\n setAttachments(attachments);\n setFieldValue(\"attachments\", attachments);\n onAttachmentChange?.(attachments);\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 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 editorHotkeyRef,\n titleHotkeyRef,\n errors,\n };\n};\n\nexport default useEditor;\n","export const getUniqueAttachments = attachments => {\n const uniqueAttachments = attachments?.reduce(\n (uniqueAttachments, attachment) => ({\n ...uniqueAttachments,\n [attachment.signedId]: attachment,\n }),\n {}\n );\n\n return Object.values(uniqueAttachments || {});\n};\n","import React, { useCallback, useRef, useState } from \"react\";\n\nimport classNames from \"classnames\";\nimport { noop } from \"neetocist\";\nimport { FormikEditor } from \"neetoeditor\";\nimport { Typography } from \"neetoui\";\nimport { Textarea } from \"neetoui/formik\";\nimport PropTypes from \"prop-types\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { DEFAULT_EDITOR_PROPS, EDITOR_ADDONS } from \"./constants\";\nimport \"./editor.scss\";\nimport useEditor from \"./hooks/useEditor\";\nimport { getUniqueAttachments } from \"./utils\";\n\nconst Editor = ({\n attachments: initialAttachments,\n onContentChange,\n onAttachmentChange,\n onTitleChange,\n getTitleRef = noop,\n getEditorRef = noop,\n menuClassName,\n editorContentFieldName = \"htmlContent\",\n titleFieldName = \"title\",\n editorProps = DEFAULT_EDITOR_PROPS,\n titleProps = {},\n}) => {\n const { t } = useTranslation();\n\n const titleRef = useRef();\n const editorRef = useRef();\n\n const [attachments, setAttachments] = useState(() =>\n getUniqueAttachments(initialAttachments)\n );\n\n const {\n handleContentChange,\n handleAttachmentChange,\n handleTitleChange,\n editorHotkeyRef,\n titleHotkeyRef,\n errors,\n } = useEditor({\n onContentChange,\n editorContentFieldName,\n setAttachments,\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 return (\n <div\n className=\"neeto-molecules-document__wrapper\"\n data-testid=\"document-editor-container\"\n ref={editorHotkeyRef}\n >\n <FormikEditor\n attachmentsClassName=\"editor-content-attachments\"\n className=\"h-full w-full\"\n contentClassName=\"editor-content__wrapper neeto-molecules-document__container\"\n data-cy=\"neeto-molecules-document-content-text-area\"\n error={undefined}\n name={editorContentFieldName}\n ref={setEditorRef}\n menuClassName={classNames(\n \"neeto-molecules-document-editor__menubar\",\n menuClassName\n )}\n {...{ attachments, ...editorProps }}\n addons={EDITOR_ADDONS.concat(editorProps.addons || [])}\n onChange={handleContentChange}\n onChangeAttachments={handleAttachmentChange}\n >\n <div className=\"neeto-molecules-document__container px-4\">\n <Textarea\n nakedTextarea\n className=\"neeto-molecules-document__title\"\n data-cy=\"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 onKeyDown={e =>\n e.key === \"Enter\" && !e.shiftKey && e.preventDefault()\n }\n {...titleProps}\n />\n {errors[editorContentFieldName] && (\n <Typography\n className=\"neeto-ui-input__error neeto-molecules-editor-content__error\"\n data-cy=\"articles-content-input-error\"\n style=\"body3\"\n >\n {errors[editorContentFieldName]}\n </Typography>\n )}\n </div>\n </FormikEditor>\n </div>\n );\n};\n\nEditor.propTypes = {\n /**\n * List of initial attachments.\n */\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 /**\n * Callback that will be triggered when the editor content changes.\n * This function is not throttled.\n */\n onContentChange: PropTypes.func,\n /**\n * Callback that will be triggered when the attachments changes.\n */\n onAttachmentChange: PropTypes.func,\n /**\n * Callback that will be triggered when the article title changes.\n */\n onTitleChange: PropTypes.func,\n /**\n * This function will be called with the title node reference.\n */\n getTitleRef: PropTypes.func,\n /**\n * This function will be called with editor reference.\n */\n getEditorRef: PropTypes.func,\n /**\n * Formik field name of the editor. The default value is `htmlContent`.\n */\n editorContentFieldName: PropTypes.string,\n /**\n * Formik field name of the title. The default value is `title`.\n */\n titleFieldName: PropTypes.string,\n /**\n * These props will be passed down to the editor component.\n */\n editorProps: PropTypes.object,\n /**\n * These props will be passed down to the title text area component.\n */\n titleProps: PropTypes.object,\n /**\n * A prop to pass class names to the editor menubar.\n */\n menuClassName: PropTypes.string,\n};\n\nexport default Editor;\n"],"names":["EDITOR_ADDONS","DEFAULT_EDITOR_PROPS","isCharacterCountActive","isMenuIndependent","addons","useEditor","_ref","onContentChange","editorContentFieldName","setAttachments","onAttachmentChange","onTitleChange","titleFieldName","editorRef","titleRef","_useFormikContext","useFormikContext","setFieldValue","errors","handleContentChange","content","handleAttachmentChange","attachments","handleTitleChange","event","title","target","value","handleEditorBackspaceKeypress","_editorRef$current","_editor$state","editor","current","selection","state","isFocused","isPresent","anchor","focus","setSelectionRange","length","titleHotkeyRef","useHotkeys","_editorRef$current2","_editorRef$current2$e","_editorRef$current2$e2","_editorRef$current3","_editorRef$current3$e","_editorRef$current3$e2","commands","insertContentAt","mode","editorHotkeyRef","getUniqueAttachments","uniqueAttachments","reduce","attachment","_objectSpread","_defineProperty","signedId","Object","values","Editor","initialAttachments","_ref$getTitleRef","getTitleRef","noop","_ref$getEditorRef","getEditorRef","menuClassName","_ref$editorContentFie","_ref$titleFieldName","_ref$editorProps","editorProps","_ref$titleProps","titleProps","_useTranslation","useTranslation","t","useRef","_useState","useState","_useState2","_slicedToArray","_useEditor","setTitleRef","node","setEditorRef","useCallback","React","createElement","className","ref","FormikEditor","_extends","attachmentsClassName","contentClassName","error","undefined","name","classNames","concat","onChange","onChangeAttachments","Textarea","nakedTextarea","rows","placeholder","onKeyDown","e","key","shiftKey","preventDefault","Typography","style"],"mappings":";;;;;;;;;;;;;;AAAO,IAAMA,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,CACR,CAAA;AAEM,IAAMC,oBAAoB,GAAG;AAClCC,EAAAA,sBAAsB,EAAE,IAAI;AAC5BC,EAAAA,iBAAiB,EAAE,IAAI;AACvBC,EAAAA,MAAM,EAAE,EAAA;AACV,CAAC;;;;;ACfD,IAAMC,SAAS,GAAG,SAAZA,SAASA,CAAAC,IAAA,EAST;AAAA,EAAA,IARJC,eAAe,GAAAD,IAAA,CAAfC,eAAe;IACfC,sBAAsB,GAAAF,IAAA,CAAtBE,sBAAsB;IACtBC,cAAc,GAAAH,IAAA,CAAdG,cAAc;IACdC,kBAAkB,GAAAJ,IAAA,CAAlBI,kBAAkB;IAClBC,aAAa,GAAAL,IAAA,CAAbK,aAAa;IACbC,cAAc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ACjCrE,MAAM,EAAEJ,aAAa,CAACqG,MAAM,CAAC5B,WAAW,CAACrE,MAAM,IAAI,EAAE,CAAE;AACvDkG,IAAAA,QAAQ,EAAEnF,mBAAoB;AAC9BoF,IAAAA,mBAAmB,EAAElF,sBAAAA;GAErBoE,CAAAA,eAAAA,cAAA,CAAAC,aAAA,CAAA,KAAA,EAAA;AAAKC,IAAAA,SAAS,EAAC,0CAAA;AAA0C,GAAA,eACvDF,cAAA,CAAAC,aAAA,CAACc,QAAQ,EAAAV,QAAA,CAAA;IACPW,aAAa,EAAA,IAAA;AACbd,IAAAA,SAAS,EAAC,iCAAiC;AAC3C,IAAA,SAAA,EAAQ,2CAA2C;AACnDQ,IAAAA,IAAI,EAAEvF,cAAe;AACrBgF,IAAAA,GAAG,EAAEP,WAAY;AACjBqB,IAAAA,IAAI,EAAE,CAAE;IACRC,WAAW,EACThC,UAAU,CAACgC,WAAW,IAAI7B,CAAC,CAAC,qCAAqC,CAClE;AACDwB,IAAAA,QAAQ,EAAE/E,iBAAkB;IAC5BqF,SAAS,EAAE,SAAAA,SAAAA,CAAAC,CAAC,EAAA;AAAA,MAAA,OACVA,CAAC,CAACC,GAAG,KAAK,OAAO,IAAI,CAACD,CAAC,CAACE,QAAQ,IAAIF,CAAC,CAACG,cAAc,EAAE,CAAA;AAAA,KAAA;AACvD,GAAA,EACGrC,UAAU,CACf,CAAC,EACDzD,MAAM,CAACV,sBAAsB,CAAC,iBAC7BiF,cAAA,CAAAC,aAAA,CAACuB,UAAU,EAAA;AACTtB,IAAAA,SAAS,EAAC,6DAA6D;AACvE,IAAA,SAAA,EAAQ,8BAA8B;AACtCuB,IAAAA,KAAK,EAAC,OAAA;AAAO,GAAA,EAEZhG,MAAM,CAACV,sBAAsB,CACpB,CAEX,CACO,CACX,CAAC,CAAA;AAEV;;;;"}
@@ -12,7 +12,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
12
12
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
13
13
  var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
14
14
 
15
- var css = ".neeto-molecules-breadcrumb{align-items:center;display:flex;flex-direction:row;justify-content:flex-start;line-height:1}.neeto-molecules-breadcrumb a{text-decoration:none;transition:all .3s ease-in-out}.neeto-molecules-breadcrumb a:focus-visible{border-radius:var(--neeto-ui-rounded-sm);outline:3px solid rgba(var(--neeto-ui-primary-500),50%)}.neeto-molecules-breadcrumb-separator{font-size:12px;line-height:16px;margin:0 12px}.neeto-molecules-breadcrumbs-wrap{display:flex;margin:0 0 40px}@media screen and (max-width:768px){.neeto-molecules-breadcrumbs-wrap{margin:0 0 16px}}";
15
+ var css = ".neeto-molecules-breadcrumb{align-items:center;display:flex;flex-direction:row;justify-content:flex-start;line-height:1}.neeto-molecules-breadcrumb a{text-decoration:none;transition:all .3s ease-in-out}.neeto-molecules-breadcrumb a:focus-visible{border-radius:var(--neeto-ui-rounded-sm);outline:3px solid rgba(var(--neeto-ui-primary-500),50%)}.neeto-molecules-breadcrumb-separator{font-size:12px;line-height:16px;margin:0 12px}.neeto-molecules-breadcrumbs-wrap{display:flex;flex-wrap:wrap;gap:6px 0;margin:0 0 40px}@media screen and (max-width:768px){.neeto-molecules-breadcrumbs-wrap{margin:0 0 16px}}";
16
16
  injectCss.n(css,{});
17
17
 
18
18
  var Breadcrumbs = function Breadcrumbs(_ref) {
@@ -37,7 +37,8 @@ var useEditor = function useEditor(_ref) {
37
37
  onAttachmentChange = _ref.onAttachmentChange,
38
38
  onTitleChange = _ref.onTitleChange,
39
39
  titleFieldName = _ref.titleFieldName,
40
- editorRef = _ref.editorRef;
40
+ editorRef = _ref.editorRef,
41
+ titleRef = _ref.titleRef;
41
42
  var _useFormikContext = formik.useFormikContext(),
42
43
  setFieldValue = _useFormikContext.setFieldValue,
43
44
  errors = _useFormikContext.errors;
@@ -55,16 +56,31 @@ var useEditor = function useEditor(_ref) {
55
56
  setFieldValue(titleFieldName, title);
56
57
  onTitleChange === null || onTitleChange === void 0 ? void 0 : onTitleChange(title);
57
58
  };
59
+ var handleEditorBackspaceKeypress = function handleEditorBackspaceKeypress() {
60
+ var _editorRef$current, _editor$state;
61
+ var editor = (_editorRef$current = editorRef.current) === null || _editorRef$current === void 0 ? void 0 : _editorRef$current.editor;
62
+ var selection = editor === null || editor === void 0 ? void 0 : (_editor$state = editor.state) === null || _editor$state === void 0 ? void 0 : _editor$state.selection;
63
+ if (editor !== null && editor !== void 0 && editor.isFocused && neetoCist.isPresent(titleRef.current) && (selection === null || selection === void 0 ? void 0 : selection.anchor) === 1) {
64
+ var title = titleRef.current.value;
65
+ titleRef.current.focus();
66
+ titleRef.current.setSelectionRange(title === null || title === void 0 ? void 0 : title.length, title === null || title === void 0 ? void 0 : title.length);
67
+ }
68
+ };
58
69
  var titleHotkeyRef = useHotkeys__default["default"]("return", function () {
59
- var _editorRef$current, _editorRef$current$ed, _editorRef$current$ed2;
60
- return (_editorRef$current = editorRef.current) === null || _editorRef$current === void 0 ? void 0 : (_editorRef$current$ed = _editorRef$current.editor) === null || _editorRef$current$ed === void 0 ? void 0 : (_editorRef$current$ed2 = _editorRef$current$ed.commands) === null || _editorRef$current$ed2 === void 0 ? void 0 : _editorRef$current$ed2.focus();
70
+ var _editorRef$current2, _editorRef$current2$e, _editorRef$current2$e2, _editorRef$current3, _editorRef$current3$e, _editorRef$current3$e2;
71
+ (_editorRef$current2 = editorRef.current) === null || _editorRef$current2 === void 0 ? void 0 : (_editorRef$current2$e = _editorRef$current2.editor) === null || _editorRef$current2$e === void 0 ? void 0 : (_editorRef$current2$e2 = _editorRef$current2$e.commands) === null || _editorRef$current2$e2 === void 0 ? void 0 : _editorRef$current2$e2.insertContentAt(0, "<p />");
72
+ (_editorRef$current3 = editorRef.current) === null || _editorRef$current3 === void 0 ? void 0 : (_editorRef$current3$e = _editorRef$current3.editor) === null || _editorRef$current3$e === void 0 ? void 0 : (_editorRef$current3$e2 = _editorRef$current3$e.commands) === null || _editorRef$current3$e2 === void 0 ? void 0 : _editorRef$current3$e2.focus("start");
61
73
  }, {
62
74
  mode: "scoped"
63
75
  });
76
+ var editorHotkeyRef = useHotkeys__default["default"]("backspace", handleEditorBackspaceKeypress, {
77
+ mode: "scoped"
78
+ });
64
79
  return {
65
80
  handleContentChange: handleContentChange,
66
81
  handleAttachmentChange: handleAttachmentChange,
67
82
  handleTitleChange: handleTitleChange,
83
+ editorHotkeyRef: editorHotkeyRef,
68
84
  titleHotkeyRef: titleHotkeyRef,
69
85
  errors: errors
70
86
  };
@@ -116,11 +132,13 @@ var Editor = function Editor(_ref) {
116
132
  onAttachmentChange: onAttachmentChange,
117
133
  onTitleChange: onTitleChange,
118
134
  titleFieldName: titleFieldName,
119
- editorRef: editorRef
135
+ editorRef: editorRef,
136
+ titleRef: titleRef
120
137
  }),
121
138
  handleContentChange = _useEditor.handleContentChange,
122
139
  handleAttachmentChange = _useEditor.handleAttachmentChange,
123
140
  handleTitleChange = _useEditor.handleTitleChange,
141
+ editorHotkeyRef = _useEditor.editorHotkeyRef,
124
142
  titleHotkeyRef = _useEditor.titleHotkeyRef,
125
143
  errors = _useEditor.errors;
126
144
  var setTitleRef = function setTitleRef(node) {
@@ -128,13 +146,14 @@ var Editor = function Editor(_ref) {
128
146
  getTitleRef(node);
129
147
  titleRef.current = node;
130
148
  };
131
- var setEditorRef = function setEditorRef(node) {
132
- getEditorRef(node);
149
+ var setEditorRef = React.useCallback(function (node) {
133
150
  editorRef.current = node;
134
- };
151
+ getEditorRef(node);
152
+ }, []);
135
153
  return /*#__PURE__*/React__default["default"].createElement("div", {
136
154
  className: "neeto-molecules-document__wrapper",
137
- "data-testid": "document-editor-container"
155
+ "data-testid": "document-editor-container",
156
+ ref: editorHotkeyRef
138
157
  }, /*#__PURE__*/React__default["default"].createElement(neetoEditor.FormikEditor, _extends._extends({
139
158
  attachmentsClassName: "editor-content-attachments",
140
159
  className: "h-full w-full",
@@ -1 +1 @@
1
- {"version":3,"file":"DocumentEditor.js","sources":["../../src/components/DocumentEditor/constants.js","../../src/components/DocumentEditor/hooks/useEditor.js","../../src/components/DocumentEditor/utils.js","../../src/components/DocumentEditor/index.jsx"],"sourcesContent":["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];\n\nexport const DEFAULT_EDITOR_PROPS = {\n isCharacterCountActive: true,\n isMenuIndependent: true,\n addons: [],\n};\n","import { useFormikContext } from \"formik\";\nimport useHotkeys from \"neetohotkeys\";\n\nconst useEditor = ({\n onContentChange,\n editorContentFieldName,\n setAttachments,\n onAttachmentChange,\n onTitleChange,\n titleFieldName,\n editorRef,\n}) => {\n const { setFieldValue, errors } = useFormikContext();\n\n const handleContentChange = content => {\n setFieldValue(editorContentFieldName, content);\n onContentChange?.(content);\n };\n\n const handleAttachmentChange = attachments => {\n setAttachments(attachments);\n setFieldValue(\"attachments\", attachments);\n onAttachmentChange?.(attachments);\n };\n\n const handleTitleChange = event => {\n const title = event.target.value;\n setFieldValue(titleFieldName, title);\n onTitleChange?.(title);\n };\n\n const titleHotkeyRef = useHotkeys(\n \"return\",\n () => editorRef.current?.editor?.commands?.focus(),\n { mode: \"scoped\" }\n );\n\n return {\n handleContentChange,\n handleAttachmentChange,\n handleTitleChange,\n titleHotkeyRef,\n errors,\n };\n};\n\nexport default useEditor;\n","export const getUniqueAttachments = attachments => {\n const uniqueAttachments = attachments?.reduce(\n (uniqueAttachments, attachment) => ({\n ...uniqueAttachments,\n [attachment.signedId]: attachment,\n }),\n {}\n );\n\n return Object.values(uniqueAttachments || {});\n};\n","import React, { useRef, useState } from \"react\";\n\nimport classNames from \"classnames\";\nimport { noop } from \"neetocist\";\nimport { FormikEditor } from \"neetoeditor\";\nimport { Typography } from \"neetoui\";\nimport { Textarea } from \"neetoui/formik\";\nimport PropTypes from \"prop-types\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { DEFAULT_EDITOR_PROPS, EDITOR_ADDONS } from \"./constants\";\nimport \"./editor.scss\";\nimport useEditor from \"./hooks/useEditor\";\nimport { getUniqueAttachments } from \"./utils\";\n\nconst Editor = ({\n attachments: initialAttachments,\n onContentChange,\n onAttachmentChange,\n onTitleChange,\n getTitleRef = noop,\n getEditorRef = noop,\n menuClassName,\n editorContentFieldName = \"htmlContent\",\n titleFieldName = \"title\",\n editorProps = DEFAULT_EDITOR_PROPS,\n titleProps = {},\n}) => {\n const { t } = useTranslation();\n\n const titleRef = useRef();\n const editorRef = useRef();\n\n const [attachments, setAttachments] = useState(() =>\n getUniqueAttachments(initialAttachments)\n );\n\n const {\n handleContentChange,\n handleAttachmentChange,\n handleTitleChange,\n titleHotkeyRef,\n errors,\n } = useEditor({\n onContentChange,\n editorContentFieldName,\n setAttachments,\n onAttachmentChange,\n onTitleChange,\n titleFieldName,\n editorRef,\n });\n\n const setTitleRef = node => {\n titleHotkeyRef.current = node;\n getTitleRef(node);\n titleRef.current = node;\n };\n\n const setEditorRef = node => {\n getEditorRef(node);\n editorRef.current = node;\n };\n\n return (\n <div\n className=\"neeto-molecules-document__wrapper\"\n data-testid=\"document-editor-container\"\n >\n <FormikEditor\n attachmentsClassName=\"editor-content-attachments\"\n className=\"h-full w-full\"\n contentClassName=\"editor-content__wrapper neeto-molecules-document__container\"\n data-cy=\"neeto-molecules-document-content-text-area\"\n error={undefined}\n name={editorContentFieldName}\n ref={setEditorRef}\n menuClassName={classNames(\n \"neeto-molecules-document-editor__menubar\",\n menuClassName\n )}\n {...{ attachments, ...editorProps }}\n addons={EDITOR_ADDONS.concat(editorProps.addons || [])}\n onChange={handleContentChange}\n onChangeAttachments={handleAttachmentChange}\n >\n <div className=\"neeto-molecules-document__container px-4\">\n <Textarea\n nakedTextarea\n className=\"neeto-molecules-document__title\"\n data-cy=\"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 onKeyDown={e =>\n e.key === \"Enter\" && !e.shiftKey && e.preventDefault()\n }\n {...titleProps}\n />\n {errors[editorContentFieldName] && (\n <Typography\n className=\"neeto-ui-input__error neeto-molecules-editor-content__error\"\n data-cy=\"articles-content-input-error\"\n style=\"body3\"\n >\n {errors[editorContentFieldName]}\n </Typography>\n )}\n </div>\n </FormikEditor>\n </div>\n );\n};\n\nEditor.propTypes = {\n /**\n * List of initial attachments.\n */\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 /**\n * Callback that will be triggered when the editor content changes.\n * This function is not throttled.\n */\n onContentChange: PropTypes.func,\n /**\n * Callback that will be triggered when the attachments changes.\n */\n onAttachmentChange: PropTypes.func,\n /**\n * Callback that will be triggered when the article title changes.\n */\n onTitleChange: PropTypes.func,\n /**\n * This function will be called with the title node reference.\n */\n getTitleRef: PropTypes.func,\n /**\n * This function will be called with editor reference.\n */\n getEditorRef: PropTypes.func,\n /**\n * Formik field name of the editor. The default value is `htmlContent`.\n */\n editorContentFieldName: PropTypes.string,\n /**\n * Formik field name of the title. The default value is `title`.\n */\n titleFieldName: PropTypes.string,\n /**\n * These props will be passed down to the editor component.\n */\n editorProps: PropTypes.object,\n /**\n * These props will be passed down to the title text area component.\n */\n titleProps: PropTypes.object,\n /**\n * A prop to pass class names to the editor menubar.\n */\n menuClassName: PropTypes.string,\n};\n\nexport default Editor;\n"],"names":["EDITOR_ADDONS","DEFAULT_EDITOR_PROPS","isCharacterCountActive","isMenuIndependent","addons","useEditor","_ref","onContentChange","editorContentFieldName","setAttachments","onAttachmentChange","onTitleChange","titleFieldName","editorRef","_useFormikContext","useFormikContext","setFieldValue","errors","handleContentChange","content","handleAttachmentChange","attachments","handleTitleChange","event","title","target","value","titleHotkeyRef","useHotkeys","_editorRef$current","_editorRef$current$ed","_editorRef$current$ed2","current","editor","commands","focus","mode","getUniqueAttachments","uniqueAttachments","reduce","attachment","_objectSpread","_defineProperty","signedId","Object","values","Editor","initialAttachments","_ref$getTitleRef","getTitleRef","noop","_ref$getEditorRef","getEditorRef","menuClassName","_ref$editorContentFie","_ref$titleFieldName","_ref$editorProps","editorProps","_ref$titleProps","titleProps","_useTranslation","useTranslation","t","titleRef","useRef","_useState","useState","_useState2","_slicedToArray","_useEditor","setTitleRef","node","setEditorRef","React","createElement","className","FormikEditor","_extends","attachmentsClassName","contentClassName","error","undefined","name","ref","classNames","concat","onChange","onChangeAttachments","Textarea","nakedTextarea","rows","placeholder","onKeyDown","e","key","shiftKey","preventDefault","Typography","style"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAO,IAAMA,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,CACR,CAAA;AAEM,IAAMC,oBAAoB,GAAG;AAClCC,EAAAA,sBAAsB,EAAE,IAAI;AAC5BC,EAAAA,iBAAiB,EAAE,IAAI;AACvBC,EAAAA,MAAM,EAAE,EAAA;AACV,CAAC;;;;;AChBD,IAAMC,SAAS,GAAG,SAAZA,SAASA,CAAAC,IAAA,EAQT;AAAA,EAAA,IAPJC,eAAe,GAAAD,IAAA,CAAfC,eAAe;IACfC,sBAAsB,GAAAF,IAAA,CAAtBE,sBAAsB;IACtBC,cAAc,GAAAH,IAAA,CAAdG,cAAc;IACdC,kBAAkB,GAAAJ,IAAA,CAAlBI,kBAAkB;IAClBC,aAAa,GAAAL,IAAA,CAAbK,aAAa;IACbC,cAAc,GAAAN,IAAA,CAAdM,cAAc;IACdC,SAAS,GAAAP,IAAA,CAATO,SAAS,CAAA;AAET,EAAA,IAAAC,iBAAA,GAAkCC,uBAAgB,EAAE;IAA5CC,aAAa,G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AA;AACvD,GAAA,EACGrC,UAAU,CACf,CAAC,EACD1C,MAAM,CAACT,sBAAsB,CAAC,iBAC7BiE,yBAAA,CAAAC,aAAA,CAACuB,kBAAU,EAAA;AACTtB,IAAAA,SAAS,EAAC,6DAA6D;AACvE,IAAA,SAAA,EAAQ,8BAA8B;AACtCuB,IAAAA,KAAK,EAAC,OAAA;AAAO,GAAA,EAEZjF,MAAM,CAACT,sBAAsB,CACpB,CAEX,CACO,CACX,CAAC,CAAA;AAEV;;;;"}
1
+ {"version":3,"file":"DocumentEditor.js","sources":["../../src/components/DocumentEditor/constants.js","../../src/components/DocumentEditor/hooks/useEditor.js","../../src/components/DocumentEditor/utils.js","../../src/components/DocumentEditor/index.jsx"],"sourcesContent":["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];\n\nexport const DEFAULT_EDITOR_PROPS = {\n isCharacterCountActive: true,\n isMenuIndependent: true,\n addons: [],\n};\n","import { useFormikContext } from \"formik\";\nimport { isPresent } from \"neetocist\";\nimport useHotkeys from \"neetohotkeys\";\n\nconst useEditor = ({\n onContentChange,\n editorContentFieldName,\n setAttachments,\n onAttachmentChange,\n onTitleChange,\n titleFieldName,\n editorRef,\n titleRef,\n}) => {\n const { setFieldValue, errors } = useFormikContext();\n\n const handleContentChange = content => {\n setFieldValue(editorContentFieldName, content);\n onContentChange?.(content);\n };\n\n const handleAttachmentChange = attachments => {\n setAttachments(attachments);\n setFieldValue(\"attachments\", attachments);\n onAttachmentChange?.(attachments);\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 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 editorHotkeyRef,\n titleHotkeyRef,\n errors,\n };\n};\n\nexport default useEditor;\n","export const getUniqueAttachments = attachments => {\n const uniqueAttachments = attachments?.reduce(\n (uniqueAttachments, attachment) => ({\n ...uniqueAttachments,\n [attachment.signedId]: attachment,\n }),\n {}\n );\n\n return Object.values(uniqueAttachments || {});\n};\n","import React, { useCallback, useRef, useState } from \"react\";\n\nimport classNames from \"classnames\";\nimport { noop } from \"neetocist\";\nimport { FormikEditor } from \"neetoeditor\";\nimport { Typography } from \"neetoui\";\nimport { Textarea } from \"neetoui/formik\";\nimport PropTypes from \"prop-types\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { DEFAULT_EDITOR_PROPS, EDITOR_ADDONS } from \"./constants\";\nimport \"./editor.scss\";\nimport useEditor from \"./hooks/useEditor\";\nimport { getUniqueAttachments } from \"./utils\";\n\nconst Editor = ({\n attachments: initialAttachments,\n onContentChange,\n onAttachmentChange,\n onTitleChange,\n getTitleRef = noop,\n getEditorRef = noop,\n menuClassName,\n editorContentFieldName = \"htmlContent\",\n titleFieldName = \"title\",\n editorProps = DEFAULT_EDITOR_PROPS,\n titleProps = {},\n}) => {\n const { t } = useTranslation();\n\n const titleRef = useRef();\n const editorRef = useRef();\n\n const [attachments, setAttachments] = useState(() =>\n getUniqueAttachments(initialAttachments)\n );\n\n const {\n handleContentChange,\n handleAttachmentChange,\n handleTitleChange,\n editorHotkeyRef,\n titleHotkeyRef,\n errors,\n } = useEditor({\n onContentChange,\n editorContentFieldName,\n setAttachments,\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 return (\n <div\n className=\"neeto-molecules-document__wrapper\"\n data-testid=\"document-editor-container\"\n ref={editorHotkeyRef}\n >\n <FormikEditor\n attachmentsClassName=\"editor-content-attachments\"\n className=\"h-full w-full\"\n contentClassName=\"editor-content__wrapper neeto-molecules-document__container\"\n data-cy=\"neeto-molecules-document-content-text-area\"\n error={undefined}\n name={editorContentFieldName}\n ref={setEditorRef}\n menuClassName={classNames(\n \"neeto-molecules-document-editor__menubar\",\n menuClassName\n )}\n {...{ attachments, ...editorProps }}\n addons={EDITOR_ADDONS.concat(editorProps.addons || [])}\n onChange={handleContentChange}\n onChangeAttachments={handleAttachmentChange}\n >\n <div className=\"neeto-molecules-document__container px-4\">\n <Textarea\n nakedTextarea\n className=\"neeto-molecules-document__title\"\n data-cy=\"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 onKeyDown={e =>\n e.key === \"Enter\" && !e.shiftKey && e.preventDefault()\n }\n {...titleProps}\n />\n {errors[editorContentFieldName] && (\n <Typography\n className=\"neeto-ui-input__error neeto-molecules-editor-content__error\"\n data-cy=\"articles-content-input-error\"\n style=\"body3\"\n >\n {errors[editorContentFieldName]}\n </Typography>\n )}\n </div>\n </FormikEditor>\n </div>\n );\n};\n\nEditor.propTypes = {\n /**\n * List of initial attachments.\n */\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 /**\n * Callback that will be triggered when the editor content changes.\n * This function is not throttled.\n */\n onContentChange: PropTypes.func,\n /**\n * Callback that will be triggered when the attachments changes.\n */\n onAttachmentChange: PropTypes.func,\n /**\n * Callback that will be triggered when the article title changes.\n */\n onTitleChange: PropTypes.func,\n /**\n * This function will be called with the title node reference.\n */\n getTitleRef: PropTypes.func,\n /**\n * This function will be called with editor reference.\n */\n getEditorRef: PropTypes.func,\n /**\n * Formik field name of the editor. The default value is `htmlContent`.\n */\n editorContentFieldName: PropTypes.string,\n /**\n * Formik field name of the title. The default value is `title`.\n */\n titleFieldName: PropTypes.string,\n /**\n * These props will be passed down to the editor component.\n */\n editorProps: PropTypes.object,\n /**\n * These props will be passed down to the title text area component.\n */\n titleProps: PropTypes.object,\n /**\n * A prop to pass class names to the editor menubar.\n */\n menuClassName: PropTypes.string,\n};\n\nexport default Editor;\n"],"names":["EDITOR_ADDONS","DEFAULT_EDITOR_PROPS","isCharacterCountActive","isMenuIndependent","addons","useEditor","_ref","onContentChange","editorContentFieldName","setAttachments","onAttachmentChange","onTitleChange","titleFieldName","editorRef","titleRef","_useFormikContext","useFormikContext","setFieldValue","errors","handleContentChange","content","handleAttachmentChange","attachments","handleTitleChange","event","title","target","value","handleEditorBackspaceKeypress","_editorRef$current","_editor$state","editor","current","selection","state","isFocused","isPresent","anchor","focus","setSelectionRange","length","titleHotkeyRef","useHotkeys","_editorRef$current2","_editorRef$current2$e","_editorRef$current2$e2","_editorRef$current3","_editorRef$current3$e","_editorRef$current3$e2","commands","insertContentAt","mode","editorHotkeyRef","getUniqueAttachments","uniqueAttachments","reduce","attachment","_objectSpread","_defineProperty","signedId","Object","values","Editor","initialAttachments","_ref$getTitleRef","getTitleRef","noop","_ref$getEditorRef","getEditorRef","menuClassName","_ref$editorContentFie","_ref$titleFieldName","_ref$editorProps","editorProps","_ref$titleProps","titleProps","_useTranslation","useTranslation","t","useRef","_useState","useState","_useState2","_slicedToArray","_useEditor","setTitleRef","node","setEditorRef","useCallback","React","createElement","className","ref","FormikEditor","_extends","attachmentsClassName","contentClassName","error","undefined","name","classNames","concat","onChange","onChangeAttachments","Textarea","nakedTextarea","rows","placeholder","onKeyDown","e","key","shiftKey","preventDefault","Typography","style"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAO,IAAMA,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,CACR,CAAA;AAEM,IAAMC,oBAAoB,GAAG;AAClCC,EAAAA,sBAAsB,EAAE,IAAI;AAC5BC,EAAAA,iBAAiB,EAAE,IAAI;AACvBC,EAAAA,MAAM,EAAE,EAAA;AACV,CAAC;;;;;ACfD,IAAMC,SAAS,GAAG,SAAZA,SAASA,CAAAC,IAAA,EAST;AAAA,EAAA,IARJC,eAAe,GAAAD,IAAA,CAAfC,eAAe;IACfC,sBAAsB,GAAAF,IAAA,CAAtBE,sBAAsB;IACtBC,cAAc,GAAAH,IAAA,CAAdG,cAAc;IACdC,kBAAkB,GAAAJ,IAAA,CAAlBI,kBAAkB;IAClBC,aAAa,GAAAL,IAAA,CAAbK,aAAa;IACbC,cAAc,GAAAN,IAAA,CAAdM,cAAc;IACdC,SAAS,GAAAP,IAAA,CAATO,SAAS;IACTC,QAAQ,GAAAR,IAAA,CAARQ,QAAQ,CAAA;AAER,EAAA,IAAAC,iBAAA,GAAkCC,uBAAgB,EAAE;IAA5CC,aAAa,GAAAF,iBAAA,CAAbE,aAAa;IAAEC,MAAM,GAAAH,iBAAA,CAANG,MAAM,CAAA;AAE7B,EAAA,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAGC,OAAO,EAAI;AACrCH,IAAAA,aAAa,CAACT,sBAAsB,EAAEY,OAAO,CAAC,CAAA;AAC9Cb,IAAAA,eAAe,aAAfA,eAAe,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,G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IAAAA,IAAI,EAAEvF,cAAe;AACrBgF,IAAAA,GAAG,EAAEP,WAAY;AACjBqB,IAAAA,IAAI,EAAE,CAAE;IACRC,WAAW,EACThC,UAAU,CAACgC,WAAW,IAAI7B,CAAC,CAAC,qCAAqC,CAClE;AACDwB,IAAAA,QAAQ,EAAE/E,iBAAkB;IAC5BqF,SAAS,EAAE,SAAAA,SAAAA,CAAAC,CAAC,EAAA;AAAA,MAAA,OACVA,CAAC,CAACC,GAAG,KAAK,OAAO,IAAI,CAACD,CAAC,CAACE,QAAQ,IAAIF,CAAC,CAACG,cAAc,EAAE,CAAA;AAAA,KAAA;AACvD,GAAA,EACGrC,UAAU,CACf,CAAC,EACDzD,MAAM,CAACV,sBAAsB,CAAC,iBAC7BiF,yBAAA,CAAAC,aAAA,CAACuB,kBAAU,EAAA;AACTtB,IAAAA,SAAS,EAAC,6DAA6D;AACvE,IAAA,SAAA,EAAQ,8BAA8B;AACtCuB,IAAAA,KAAK,EAAC,OAAA;AAAO,GAAA,EAEZhG,MAAM,CAACV,sBAAsB,CACpB,CAEX,CACO,CACX,CAAC,CAAA;AAEV;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/neeto-molecules",
3
- "version": "1.17.2",
3
+ "version": "1.17.4",
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>",