@bigbinary/neeto-molecules 3.9.14 → 3.9.16

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.
@@ -1,6 +1,5 @@
1
1
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
- import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
3
- import { useCallback, memo, useRef, useState, useEffect, useMemo } from 'react';
2
+ import { useCallback, memo, useRef, useMemo } from 'react';
4
3
  import classnames from 'classnames';
5
4
  import { isPresent, noop } from '@bigbinary/neeto-cist';
6
5
  import FormikEditor from '@bigbinary/neeto-editor/FormikEditor';
@@ -27,7 +26,6 @@ n(css,{});
27
26
  var useEditor = function useEditor(_ref) {
28
27
  var onContentChange = _ref.onContentChange,
29
28
  editorContentFieldName = _ref.editorContentFieldName,
30
- setAttachments = _ref.setAttachments,
31
29
  onAttachmentChange = _ref.onAttachmentChange,
32
30
  onTitleChange = _ref.onTitleChange,
33
31
  titleFieldName = _ref.titleFieldName,
@@ -41,10 +39,9 @@ var useEditor = function useEditor(_ref) {
41
39
  onContentChange === null || onContentChange === void 0 ? void 0 : onContentChange(content);
42
40
  }, [editorContentFieldName, onContentChange, setFieldValue]);
43
41
  var handleAttachmentChange = useCallback(function (attachments) {
44
- setAttachments(attachments);
45
42
  setFieldValue("attachments", attachments);
46
43
  onAttachmentChange === null || onAttachmentChange === void 0 ? void 0 : onAttachmentChange(attachments);
47
- }, [onAttachmentChange, setAttachments, setFieldValue]);
44
+ }, [onAttachmentChange, setFieldValue]);
48
45
  var handleTitleChange = function handleTitleChange(event) {
49
46
  var title = event.target.value;
50
47
  setFieldValue(titleFieldName, title);
@@ -80,19 +77,10 @@ var useEditor = function useEditor(_ref) {
80
77
  };
81
78
  };
82
79
 
83
- function ownKeys$1(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; }
84
- function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
85
- var getUniqueAttachments = function getUniqueAttachments(attachments) {
86
- var uniqueAttachments = attachments === null || attachments === void 0 ? void 0 : attachments.reduce(function (uniqueAttachments, attachment) {
87
- return _objectSpread$1(_objectSpread$1({}, uniqueAttachments), {}, _defineProperty({}, attachment.signedId, attachment));
88
- }, {});
89
- return Object.values(uniqueAttachments || {});
90
- };
91
-
92
80
  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; }
93
81
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).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; }
94
82
  var Editor = function Editor(_ref) {
95
- var initialAttachments = _ref.attachments,
83
+ var attachments = _ref.attachments,
96
84
  onContentChange = _ref.onContentChange,
97
85
  onAttachmentChange = _ref.onAttachmentChange,
98
86
  onTitleChange = _ref.onTitleChange,
@@ -115,19 +103,9 @@ var Editor = function Editor(_ref) {
115
103
  var titleRef = useRef();
116
104
  var editorRef = useRef();
117
105
  var editorProps = mergeRight(DEFAULT_EDITOR_PROPS, customEditorProps);
118
- var _useState = useState(function () {
119
- return getUniqueAttachments(initialAttachments);
120
- }),
121
- _useState2 = _slicedToArray(_useState, 2),
122
- attachments = _useState2[0],
123
- setAttachments = _useState2[1];
124
- useEffect(function () {
125
- setAttachments(getUniqueAttachments(initialAttachments));
126
- }, [initialAttachments]);
127
106
  var _useEditor = useEditor({
128
107
  onContentChange: onContentChange,
129
108
  editorContentFieldName: editorContentFieldName,
130
- setAttachments: setAttachments,
131
109
  onAttachmentChange: onAttachmentChange,
132
110
  onTitleChange: onTitleChange,
133
111
  titleFieldName: titleFieldName,
@@ -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 size: \"medium\",\n};\n","import { useCallback } from \"react\";\n\nimport { 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 = useCallback(\n content => {\n setFieldValue(editorContentFieldName, content);\n onContentChange?.(content);\n },\n [editorContentFieldName, onContentChange, setFieldValue]\n );\n\n const handleAttachmentChange = useCallback(\n attachments => {\n setAttachments(attachments);\n setFieldValue(\"attachments\", attachments);\n onAttachmentChange?.(attachments);\n },\n [onAttachmentChange, setAttachments, 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 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 { memo, useCallback, useEffect, useMemo, 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 { mergeRight } from \"ramda\";\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: customEditorProps = {},\n titleProps = {},\n children,\n}) => {\n const { t } = useTranslation();\n\n const titleRef = useRef();\n const editorRef = useRef();\n\n const editorProps = mergeRight(DEFAULT_EDITOR_PROPS, customEditorProps);\n\n const [attachments, setAttachments] = useState(() =>\n getUniqueAttachments(initialAttachments)\n );\n\n useEffect(() => {\n setAttachments(getUniqueAttachments(initialAttachments));\n }, [initialAttachments]);\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 const addons = useMemo(\n () => EDITOR_ADDONS.concat(editorProps.addons || []),\n [editorProps.addons]\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 w-full flex-shrink-0\"\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 errorWrapperClassName=\"w-full min-h-full flex flex-col items-center\"\n name={editorContentFieldName}\n ref={setEditorRef}\n menuClassName={classNames(\n \"neeto-molecules-document-editor__menubar\",\n menuClassName\n )}\n {...{ attachments, ...editorProps, addons }}\n contentWrapperClassName=\"w-full flex flex-col flex-grow\"\n onChange={handleContentChange}\n onChangeAttachments={handleAttachmentChange}\n >\n {children}\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 * The children will be rendered above the title input field.\n */\n children: PropTypes.node,\n};\n\nEditor.displayName = \"DocumentEditor\";\n\nexport default memo(Editor);\n"],"names":["EDITOR_ADDONS","DEFAULT_EDITOR_PROPS","isCharacterCountActive","isMenuIndependent","addons","size","useEditor","_ref","onContentChange","editorContentFieldName","setAttachments","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","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","customEditorProps","_ref$titleProps","titleProps","children","_useTranslation","useTranslation","t","useRef","mergeRight","_useState","useState","_useState2","_slicedToArray","useEffect","_useEditor","setTitleRef","node","setEditorRef","useMemo","concat","_jsx","className","ref","_jsxs","FormikEditor","attachmentsClassName","contentClassName","error","undefined","errorWrapperClassName","name","classNames","contentWrapperClassName","onChange","onChangeAttachments","Textarea","nakedTextarea","rows","placeholder","onKeyDown","e","key","shiftKey","preventDefault","Typography","style","displayName","memo"],"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,EAAE;AACVC,EAAAA,IAAI,EAAE,QAAA;AACR,CAAC;;;;;ACdD,IAAMC,SAAS,GAAG,SAAZA,SAASA,CAAAC,IAAA,EAST;AAAA,EAAA,IARJC,eAAe,GAAAD,IAAA,CAAfC,eAAe;IACfC,sBAAsB,GAAAF,IAAA,CAAtBE,sBAAsB;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AA2C;AACnDS,UAAAA,IAAI,EAAE7F,cAAe;AACrBqF,UAAAA,GAAG,EAAEP,WAAY;AACjBsB,UAAAA,IAAI,EAAE,CAAE;UACRC,WAAW,EACTpC,UAAU,CAACoC,WAAW,IAAIhC,CAAC,CAAC,qCAAqC,CAClE;AACD2B,UAAAA,QAAQ,EAAEpF,iBAAkB;AAC5B0F,UAAAA,SAAS,EAAE,SAAXA,SAASA,CAAEC,CAAC,EAAA;AAAA,YAAA,OACVA,CAAC,CAACC,GAAG,KAAK,OAAO,IAAI,CAACD,CAAC,CAACE,QAAQ,IAAIF,CAAC,CAACG,cAAc,EAAE,CAAA;AAAA,WAAA;SAEpDzC,EAAAA,UAAU,CACf,CAAC,EACD3D,MAAM,CAACV,sBAAsB,CAAC,iBAC7BuF,GAAA,CAACwB,UAAU,EAAA;AACTvB,UAAAA,SAAS,EAAC,6DAA6D;AACvE,UAAA,SAAA,EAAQ,8BAA8B;AACtCwB,UAAAA,KAAK,EAAC,OAAO;UAAA1C,QAAA,EAEZ5D,MAAM,CAACV,sBAAsB,CAAA;AAAC,SACrB,CACb,CAAA;AAAA,OACE,CAAC,CAAA;KACM,CAAA,CAAA;AAAC,GACZ,CAAC,CAAA;AAEV,CAAC,CAAA;AA6DDuD,MAAM,CAAC0D,WAAW,GAAG,gBAAgB,CAAA;AAErC,YAAeC,aAAAA,IAAI,CAAC3D,MAAM,CAAC;;;;"}
1
+ {"version":3,"file":"DocumentEditor.js","sources":["../src/components/DocumentEditor/constants.js","../src/components/DocumentEditor/hooks/useEditor.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 size: \"medium\",\n};\n","import { useCallback } from \"react\";\n\nimport { useFormikContext } from \"formik\";\nimport { isPresent } from \"neetocist\";\nimport useHotkeys from \"neetohotkeys\";\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 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","import { memo, useCallback, useMemo, useRef } 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 { mergeRight } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { DEFAULT_EDITOR_PROPS, EDITOR_ADDONS } from \"./constants\";\nimport \"./editor.scss\";\nimport useEditor from \"./hooks/useEditor\";\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 children,\n}) => {\n const { t } = useTranslation();\n\n const titleRef = useRef();\n const editorRef = useRef();\n\n const editorProps = mergeRight(DEFAULT_EDITOR_PROPS, customEditorProps);\n\n const {\n handleContentChange,\n handleAttachmentChange,\n handleTitleChange,\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 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 w-full flex-shrink-0\"\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 errorWrapperClassName=\"w-full min-h-full flex flex-col items-center\"\n name={editorContentFieldName}\n ref={setEditorRef}\n menuClassName={classNames(\n \"neeto-molecules-document-editor__menubar\",\n menuClassName\n )}\n {...{ attachments, ...editorProps, addons }}\n contentWrapperClassName=\"w-full flex flex-col flex-grow\"\n onChange={handleContentChange}\n onChangeAttachments={handleAttachmentChange}\n >\n {children}\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 * The children will be rendered above the title input field.\n */\n children: PropTypes.node,\n};\n\nEditor.displayName = \"DocumentEditor\";\n\nexport default memo(Editor);\n"],"names":["EDITOR_ADDONS","DEFAULT_EDITOR_PROPS","isCharacterCountActive","isMenuIndependent","addons","size","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","titleHotkeyRef","useHotkeys","_editorRef$current2","_editorRef$current2$e","_editorRef$current2$e2","_editorRef$current3","_editorRef$current3$e","_editorRef$current3$e2","commands","insertContentAt","mode","editorHotkeyRef","Editor","_ref$getTitleRef","getTitleRef","noop","_ref$getEditorRef","getEditorRef","menuClassName","_ref$editorContentFie","_ref$titleFieldName","_ref$editorProps","editorProps","customEditorProps","_ref$titleProps","titleProps","children","_useTranslation","useTranslation","t","useRef","mergeRight","_useEditor","setTitleRef","node","setEditorRef","useMemo","concat","_jsx","className","ref","_jsxs","FormikEditor","_objectSpread","attachmentsClassName","contentClassName","error","undefined","errorWrapperClassName","name","classNames","contentWrapperClassName","onChange","onChangeAttachments","Textarea","nakedTextarea","rows","placeholder","onKeyDown","e","key","shiftKey","preventDefault","Typography","style","displayName","memo"],"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,EAAE;AACVC,EAAAA,IAAI,EAAE,QAAA;AACR,CAAC;;;;;ACdD,IAAMC,SAAS,GAAG,SAAZA,SAASA,CAAAC,IAAA,EAQT;AAAA,EAAA,IAPJC,eAAe,GAAAD,IAAA,CAAfC,eA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,SAAS,EAAC,0CAA0C;AAAAb,QAAAA,QAAA,EACvDY,cAAAA,GAAA,CAACgB,QAAQ,EAAAX,aAAA,CAAA;UACPY,aAAa,EAAA,IAAA;AACbhB,UAAAA,SAAS,EAAC,iCAAiC;AAC3C,UAAA,SAAA,EAAQ,2CAA2C;AACnDU,UAAAA,IAAI,EAAE/E,cAAe;AACrBsE,UAAAA,GAAG,EAAEP,WAAY;AACjBuB,UAAAA,IAAI,EAAE,CAAE;UACRC,WAAW,EACThC,UAAU,CAACgC,WAAW,IAAI5B,CAAC,CAAC,qCAAqC,CAClE;AACDuB,UAAAA,QAAQ,EAAEtE,iBAAkB;AAC5B4E,UAAAA,SAAS,EAAE,SAAXA,SAASA,CAAEC,CAAC,EAAA;AAAA,YAAA,OACVA,CAAC,CAACC,GAAG,KAAK,OAAO,IAAI,CAACD,CAAC,CAACE,QAAQ,IAAIF,CAAC,CAACG,cAAc,EAAE,CAAA;AAAA,WAAA;SAEpDrC,EAAAA,UAAU,CACf,CAAC,EACDjD,MAAM,CAACT,sBAAsB,CAAC,iBAC7BuE,GAAA,CAACyB,UAAU,EAAA;AACTxB,UAAAA,SAAS,EAAC,6DAA6D;AACvE,UAAA,SAAA,EAAQ,8BAA8B;AACtCyB,UAAAA,KAAK,EAAC,OAAO;UAAAtC,QAAA,EAEZlD,MAAM,CAACT,sBAAsB,CAAA;AAAC,SACrB,CACb,CAAA;AAAA,OACE,CAAC,CAAA;KACM,CAAA,CAAA;AAAC,GACZ,CAAC,CAAA;AAEV,CAAC,CAAA;AA6DD6C,MAAM,CAACqD,WAAW,GAAG,gBAAgB,CAAA;AAErC,YAAeC,aAAAA,IAAI,CAACtD,MAAM,CAAC;;;;"}
@@ -1,7 +1,6 @@
1
1
  'use strict';
2
2
 
3
3
  var _defineProperty = require('@babel/runtime/helpers/defineProperty');
4
- var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
5
4
  var React = require('react');
6
5
  var classnames = require('classnames');
7
6
  var neetoCist = require('@bigbinary/neeto-cist');
@@ -29,7 +28,6 @@ injectCss.n(css,{});
29
28
  var useEditor = function useEditor(_ref) {
30
29
  var onContentChange = _ref.onContentChange,
31
30
  editorContentFieldName = _ref.editorContentFieldName,
32
- setAttachments = _ref.setAttachments,
33
31
  onAttachmentChange = _ref.onAttachmentChange,
34
32
  onTitleChange = _ref.onTitleChange,
35
33
  titleFieldName = _ref.titleFieldName,
@@ -43,10 +41,9 @@ var useEditor = function useEditor(_ref) {
43
41
  onContentChange === null || onContentChange === void 0 ? void 0 : onContentChange(content);
44
42
  }, [editorContentFieldName, onContentChange, setFieldValue]);
45
43
  var handleAttachmentChange = React.useCallback(function (attachments) {
46
- setAttachments(attachments);
47
44
  setFieldValue("attachments", attachments);
48
45
  onAttachmentChange === null || onAttachmentChange === void 0 ? void 0 : onAttachmentChange(attachments);
49
- }, [onAttachmentChange, setAttachments, setFieldValue]);
46
+ }, [onAttachmentChange, setFieldValue]);
50
47
  var handleTitleChange = function handleTitleChange(event) {
51
48
  var title = event.target.value;
52
49
  setFieldValue(titleFieldName, title);
@@ -82,19 +79,10 @@ var useEditor = function useEditor(_ref) {
82
79
  };
83
80
  };
84
81
 
85
- function ownKeys$1(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; }
86
- function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
87
- var getUniqueAttachments = function getUniqueAttachments(attachments) {
88
- var uniqueAttachments = attachments === null || attachments === void 0 ? void 0 : attachments.reduce(function (uniqueAttachments, attachment) {
89
- return _objectSpread$1(_objectSpread$1({}, uniqueAttachments), {}, _defineProperty({}, attachment.signedId, attachment));
90
- }, {});
91
- return Object.values(uniqueAttachments || {});
92
- };
93
-
94
82
  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; }
95
83
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).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; }
96
84
  var Editor = function Editor(_ref) {
97
- var initialAttachments = _ref.attachments,
85
+ var attachments = _ref.attachments,
98
86
  onContentChange = _ref.onContentChange,
99
87
  onAttachmentChange = _ref.onAttachmentChange,
100
88
  onTitleChange = _ref.onTitleChange,
@@ -117,19 +105,9 @@ var Editor = function Editor(_ref) {
117
105
  var titleRef = React.useRef();
118
106
  var editorRef = React.useRef();
119
107
  var editorProps = ramda.mergeRight(DEFAULT_EDITOR_PROPS, customEditorProps);
120
- var _useState = React.useState(function () {
121
- return getUniqueAttachments(initialAttachments);
122
- }),
123
- _useState2 = _slicedToArray(_useState, 2),
124
- attachments = _useState2[0],
125
- setAttachments = _useState2[1];
126
- React.useEffect(function () {
127
- setAttachments(getUniqueAttachments(initialAttachments));
128
- }, [initialAttachments]);
129
108
  var _useEditor = useEditor({
130
109
  onContentChange: onContentChange,
131
110
  editorContentFieldName: editorContentFieldName,
132
- setAttachments: setAttachments,
133
111
  onAttachmentChange: onAttachmentChange,
134
112
  onTitleChange: onTitleChange,
135
113
  titleFieldName: titleFieldName,
@@ -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 size: \"medium\",\n};\n","import { useCallback } from \"react\";\n\nimport { 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 = useCallback(\n content => {\n setFieldValue(editorContentFieldName, content);\n onContentChange?.(content);\n },\n [editorContentFieldName, onContentChange, setFieldValue]\n );\n\n const handleAttachmentChange = useCallback(\n attachments => {\n setAttachments(attachments);\n setFieldValue(\"attachments\", attachments);\n onAttachmentChange?.(attachments);\n },\n [onAttachmentChange, setAttachments, 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 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 { memo, useCallback, useEffect, useMemo, 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 { mergeRight } from \"ramda\";\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: customEditorProps = {},\n titleProps = {},\n children,\n}) => {\n const { t } = useTranslation();\n\n const titleRef = useRef();\n const editorRef = useRef();\n\n const editorProps = mergeRight(DEFAULT_EDITOR_PROPS, customEditorProps);\n\n const [attachments, setAttachments] = useState(() =>\n getUniqueAttachments(initialAttachments)\n );\n\n useEffect(() => {\n setAttachments(getUniqueAttachments(initialAttachments));\n }, [initialAttachments]);\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 const addons = useMemo(\n () => EDITOR_ADDONS.concat(editorProps.addons || []),\n [editorProps.addons]\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 w-full flex-shrink-0\"\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 errorWrapperClassName=\"w-full min-h-full flex flex-col items-center\"\n name={editorContentFieldName}\n ref={setEditorRef}\n menuClassName={classNames(\n \"neeto-molecules-document-editor__menubar\",\n menuClassName\n )}\n {...{ attachments, ...editorProps, addons }}\n contentWrapperClassName=\"w-full flex flex-col flex-grow\"\n onChange={handleContentChange}\n onChangeAttachments={handleAttachmentChange}\n >\n {children}\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 * The children will be rendered above the title input field.\n */\n children: PropTypes.node,\n};\n\nEditor.displayName = \"DocumentEditor\";\n\nexport default memo(Editor);\n"],"names":["EDITOR_ADDONS","DEFAULT_EDITOR_PROPS","isCharacterCountActive","isMenuIndependent","addons","size","useEditor","_ref","onContentChange","editorContentFieldName","setAttachments","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","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","customEditorProps","_ref$titleProps","titleProps","children","_useTranslation","useTranslation","t","useRef","mergeRight","_useState","useState","_useState2","_slicedToArray","useEffect","_useEditor","setTitleRef","node","setEditorRef","useMemo","concat","_jsx","className","ref","_jsxs","FormikEditor","attachmentsClassName","contentClassName","error","undefined","errorWrapperClassName","name","classNames","contentWrapperClassName","onChange","onChangeAttachments","Textarea","nakedTextarea","rows","placeholder","onKeyDown","e","key","shiftKey","preventDefault","Typography","style","displayName","memo"],"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,EAAE;AACVC,EAAAA,IAAI,EAAE,QAAA;AACR,CAAC;;;;;ACdD,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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CAAC,CAACE,QAAQ,IAAIF,CAAC,CAACG,cAAc,EAAE,CAAA;AAAA,WAAA;SAEpDzC,EAAAA,UAAU,CACf,CAAC,EACD3D,MAAM,CAACV,sBAAsB,CAAC,iBAC7BuF,cAAA,CAACwB,UAAU,EAAA;AACTvB,UAAAA,SAAS,EAAC,6DAA6D;AACvE,UAAA,SAAA,EAAQ,8BAA8B;AACtCwB,UAAAA,KAAK,EAAC,OAAO;UAAA1C,QAAA,EAEZ5D,MAAM,CAACV,sBAAsB,CAAA;AAAC,SACrB,CACb,CAAA;AAAA,OACE,CAAC,CAAA;KACM,CAAA,CAAA;AAAC,GACZ,CAAC,CAAA;AAEV,CAAC,CAAA;AA6DDuD,MAAM,CAAC0D,WAAW,GAAG,gBAAgB,CAAA;AAErC,YAAeC,aAAAA,UAAI,CAAC3D,MAAM,CAAC;;;;"}
1
+ {"version":3,"file":"DocumentEditor.js","sources":["../../src/components/DocumentEditor/constants.js","../../src/components/DocumentEditor/hooks/useEditor.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 size: \"medium\",\n};\n","import { useCallback } from \"react\";\n\nimport { useFormikContext } from \"formik\";\nimport { isPresent } from \"neetocist\";\nimport useHotkeys from \"neetohotkeys\";\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 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","import { memo, useCallback, useMemo, useRef } 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 { mergeRight } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { DEFAULT_EDITOR_PROPS, EDITOR_ADDONS } from \"./constants\";\nimport \"./editor.scss\";\nimport useEditor from \"./hooks/useEditor\";\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 children,\n}) => {\n const { t } = useTranslation();\n\n const titleRef = useRef();\n const editorRef = useRef();\n\n const editorProps = mergeRight(DEFAULT_EDITOR_PROPS, customEditorProps);\n\n const {\n handleContentChange,\n handleAttachmentChange,\n handleTitleChange,\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 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 w-full flex-shrink-0\"\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 errorWrapperClassName=\"w-full min-h-full flex flex-col items-center\"\n name={editorContentFieldName}\n ref={setEditorRef}\n menuClassName={classNames(\n \"neeto-molecules-document-editor__menubar\",\n menuClassName\n )}\n {...{ attachments, ...editorProps, addons }}\n contentWrapperClassName=\"w-full flex flex-col flex-grow\"\n onChange={handleContentChange}\n onChangeAttachments={handleAttachmentChange}\n >\n {children}\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 * The children will be rendered above the title input field.\n */\n children: PropTypes.node,\n};\n\nEditor.displayName = \"DocumentEditor\";\n\nexport default memo(Editor);\n"],"names":["EDITOR_ADDONS","DEFAULT_EDITOR_PROPS","isCharacterCountActive","isMenuIndependent","addons","size","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","titleHotkeyRef","useHotkeys","_editorRef$current2","_editorRef$current2$e","_editorRef$current2$e2","_editorRef$current3","_editorRef$current3$e","_editorRef$current3$e2","commands","insertContentAt","mode","editorHotkeyRef","Editor","_ref$getTitleRef","getTitleRef","noop","_ref$getEditorRef","getEditorRef","menuClassName","_ref$editorContentFie","_ref$titleFieldName","_ref$editorProps","editorProps","customEditorProps","_ref$titleProps","titleProps","children","_useTranslation","useTranslation","t","useRef","mergeRight","_useEditor","setTitleRef","node","setEditorRef","useMemo","concat","_jsx","className","ref","_jsxs","FormikEditor","_objectSpread","attachmentsClassName","contentClassName","error","undefined","errorWrapperClassName","name","classNames","contentWrapperClassName","onChange","onChangeAttachments","Textarea","nakedTextarea","rows","placeholder","onKeyDown","e","key","shiftKey","preventDefault","Typography","style","displayName","memo"],"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,EAAE;AACVC,EAAAA,IAAI,EAAE,QAAA;AACR,CAAC;;;;;ACdD,IAAMC,SAAS,GAAG,SAAZA,SAASA,CAAAC,IAAA,EAQT;AAAA,EAAA,IAPJC,eAAe,GAAAD,IAAA,CAAfC,eAAe;IACfC,sBAAsB,GAAAF,IAAA,CAAtBE,sBAAsB;IACtBC,kBAAkB,GAAAH,IAAA,CAAlBG,kBAAkB;IAClBC,aAAa,GAAAJ,IAAA,CAAbI,aAAa;IACbC,cAAc,GAAAL,IAAA,CAAdK,cAAc;IACdC,SAAS,GAAAN,IAAA,CAATM,SAAS;IACTC,QAAQ,GAAAP,IAAA,CAARO,QAAQ,CAAA;AAER,EAAA,IAAAC,iBAAA,GAAkCC,uBAAgB,EAAE;IAA5CC,aAAa,GAAAF,iBAAA,CAA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,IAAI5B,CAAC,CAAC,qCAAqC,CAClE;AACDuB,UAAAA,QAAQ,EAAEtE,iBAAkB;AAC5B4E,UAAAA,SAAS,EAAE,SAAXA,SAASA,CAAEC,CAAC,EAAA;AAAA,YAAA,OACVA,CAAC,CAACC,GAAG,KAAK,OAAO,IAAI,CAACD,CAAC,CAACE,QAAQ,IAAIF,CAAC,CAACG,cAAc,EAAE,CAAA;AAAA,WAAA;SAEpDrC,EAAAA,UAAU,CACf,CAAC,EACDjD,MAAM,CAACT,sBAAsB,CAAC,iBAC7BuE,cAAA,CAACyB,UAAU,EAAA;AACTxB,UAAAA,SAAS,EAAC,6DAA6D;AACvE,UAAA,SAAA,EAAQ,8BAA8B;AACtCyB,UAAAA,KAAK,EAAC,OAAO;UAAAtC,QAAA,EAEZlD,MAAM,CAACT,sBAAsB,CAAA;AAAC,SACrB,CACb,CAAA;AAAA,OACE,CAAC,CAAA;KACM,CAAA,CAAA;AAAC,GACZ,CAAC,CAAA;AAEV,CAAC,CAAA;AA6DD6C,MAAM,CAACqD,WAAW,GAAG,gBAAgB,CAAA;AAErC,YAAeC,aAAAA,UAAI,CAACtD,MAAM,CAAC;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/neeto-molecules",
3
- "version": "3.9.14",
3
+ "version": "3.9.16",
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>",
@@ -116,7 +116,7 @@
116
116
  "dark": "Dark"
117
117
  },
118
118
  "organizationSwitcher": {
119
- "label": "Organization switcher",
119
+ "label": "Workspace switcher",
120
120
  "addAccount": "Add another account"
121
121
  }
122
122
  },