@pie-lib/editable-html-tip-tap 2.1.12-next.42 → 2.1.12-next.51

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.
@@ -77,6 +77,16 @@ var cssVariables = {
77
77
  '--red-light': '#ffebe5',
78
78
  '--shadow': "0px 12px 33px 0px rgba(0, 0, 0, .06),\n 0px 3.618px 9.949px 0px rgba(0, 0, 0, .04)"
79
79
  };
80
+
81
+ // ProseMirror puts these on the contenteditable element. Without them the browser
82
+ // spellchecks the editor regardless of the spellCheck prop.
83
+ var spellCheckAttributes = function spellCheckAttributes(enabled) {
84
+ return {
85
+ spellcheck: enabled ? 'true' : 'false',
86
+ autocorrect: enabled ? 'on' : 'off',
87
+ autocapitalize: enabled ? 'on' : 'off'
88
+ };
89
+ };
80
90
  var EditableHtml = exports.EditableHtml = function EditableHtml(props) {
81
91
  var _props$pluginProps;
82
92
  var _ref = props.pluginProps || {},
@@ -156,6 +166,13 @@ var EditableHtml = exports.EditableHtml = function EditableHtml(props) {
156
166
  trailingNode: {
157
167
  node: 'paragraph',
158
168
  notAfter: ['paragraph', 'div']
169
+ },
170
+ // StarterKit bundles the link extension, which turns anything that looks like a URL into
171
+ // a hyperlink as it is typed or pasted. See PIE-980 - we don't want that in any editor.
172
+ // The mark itself stays registered so links already in the markup keep round-tripping.
173
+ link: {
174
+ autolink: false,
175
+ linkOnPaste: false
159
176
  }
160
177
  }), _extendedListItem.ExtendedListItem, _divNode.DivNode, _headingParagraph.HeadingParagraph, _ensureEmptyRootDiv.EnsureEmptyRootIsDiv, _ensureListItemContentIsDiv.EnsureListItemContentIsDiv, _extensionPlaceholder["default"].configure({
161
178
  placeholder: props.placeholder,
@@ -234,10 +251,16 @@ var EditableHtml = exports.EditableHtml = function EditableHtml(props) {
234
251
  }), _css.CSSMark.configure({
235
252
  extraCSSRules: props.extraCSSRules
236
253
  })];
254
+
255
+ // Callers that don't pass spellCheck keep the browser default (on), as they did with the
256
+ // slate-based editor. Players that have to default to off - extended-text-entry, see
257
+ // PIE-978 - resolve that in their controller and pass an explicit false.
258
+ var spellCheckEnabled = props.spellCheck !== false;
237
259
  var editor = (0, _react2.useEditor)({
238
260
  extensions: extensions,
239
261
  immediatelyRender: false,
240
262
  editorProps: {
263
+ attributes: spellCheckAttributes(spellCheckEnabled),
241
264
  handleKeyDown: function handleKeyDown(view, event) {
242
265
  if (props.onKeyDown) {
243
266
  return props.onKeyDown(event);
@@ -274,6 +297,27 @@ var EditableHtml = exports.EditableHtml = function EditableHtml(props) {
274
297
  (0, _react.useEffect)(function () {
275
298
  editor === null || editor === void 0 || editor.setEditable(!props.disabled);
276
299
  }, [props.disabled, editor]);
300
+
301
+ // useEditor only re-applies options on its own when it is called with an empty dependency
302
+ // array, and this call site depends on charactersLimit, so a spellCheck change on a mounted
303
+ // editor has to be pushed in. Only the attributes are replaced - the rest of editorProps
304
+ // stays as the editor already has it.
305
+ (0, _react.useEffect)(function () {
306
+ var _editor$options, _currentEditorProps$a;
307
+ if (!editor) {
308
+ return;
309
+ }
310
+ var currentEditorProps = (_editor$options = editor.options) === null || _editor$options === void 0 ? void 0 : _editor$options.editorProps;
311
+ var attributes = spellCheckAttributes(spellCheckEnabled);
312
+ if ((currentEditorProps === null || currentEditorProps === void 0 || (_currentEditorProps$a = currentEditorProps.attributes) === null || _currentEditorProps$a === void 0 ? void 0 : _currentEditorProps$a.spellcheck) === attributes.spellcheck) {
313
+ return;
314
+ }
315
+ editor.setOptions({
316
+ editorProps: _objectSpread(_objectSpread({}, currentEditorProps), {}, {
317
+ attributes: attributes
318
+ })
319
+ });
320
+ }, [spellCheckEnabled, editor]);
277
321
  (0, _react.useEffect)(function () {
278
322
  if (!editor) {
279
323
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"EditableHtml.js","names":["_react","_interopRequireWildcard","require","_debounce","_interopRequireDefault","_react2","_styles","_starterKit","_extensionTextStyle","_extensionCharacterCount","_extensionSuperscript","_extensionSubscript","_extensionTextAlign","_extensionImage","_extensionPlaceholder","_helper","_extendedTable","_extendedTableCell","_divNode","_ensureEmptyRootDiv","_ensureListItemContentIsDiv","_extensionTableRow","_responseArea","_math","_image","_media","_css","_extendedListItem","_headingParagraph","_TiptapContainer","_size","_extensions","_excluded","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ownKeys","keys","getOwnPropertySymbols","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defaultToolbarOpts","position","alignment","alwaysVisible","showDone","doneOn","defaultResponseAreaProps","options","respAreaToolbar","onHandleAreaChange","DEFAULT_ACTIVE_PLUGINS","cssVariables","EditableHtml","exports","props","_props$pluginProps","_ref","pluginProps","showParagraphs","separateParagraphs","_useState","useState","_useState2","_slicedToArray2","pendingImages","setPendingImages","_useState3","_useState4","scheduled","setScheduled","toolbarOpts","removePendingImage","useCallback","imagePos","prev","next","img","pos","toolbarOptsToUse","commitEditorContent","editor","html","getHTML","markup","_props$onChange","onChange","_props$onDone","onDone","responseAreaPropsToUse","useMemo","responseAreaProps","onInlineDropdownToolbarClose","activePluginsToUse","_ref3","_ref2","customPlugins","otherPluginProps","_objectWithoutProperties2","filteredActivePlugins","activePlugins","pluginName","nameToUse","PLUGINS_MAP","pluginInfo","disabled","buildExtensions","math","textAlign","extraCSSRules","image","imageSupport","toolbar","table","responseArea","type","languageCharacters","languageCharactersProps","keyPadCharacterRef","setKeypadInteraction","media","extensions","TextAlign","configure","types","alignments","TextStyleKit","CharacterCount","limit","charactersLimit","StarterKit","trailingNode","node","notAfter","ExtendedListItem","DivNode","HeadingParagraph","EnsureEmptyRootIsDiv","EnsureListItemContentIsDiv","Placeholder","placeholder","showOnlyWhenEditable","showOnlyCurrent","includeChildren","ExtendedTable","TableRow","ExtendedTableHeader","ExtendedTableCell","ResponseAreaExtension","ExplicitConstructedResponseNode","DragInTheBlankNode","InlineDropdownNode","MathTemplatedNode","MathNode","SubScript","SuperScript","Image","ImageUploadNode","imageHandling","disableImageAlignmentButtons","_props$onDone2","onDelete","src","attrs","insertImageRequested","imageInfo","getHandler","_imageInfo","addedImage","onFinish","result","_cb","cb","callback","handler","focusHandler","debounce","detach","window","removeEventListener","_insertingImage","addEventListener","add","concat","_toConsumableArray2","maxImageWidth","maxImageHeight","Media","uploadSoundSupport","CSSMark","useEditor","immediatelyRender","editorProps","handleKeyDown","view","event","onKeyDown","editable","content","normalizeInitialMarkup","onUpdate","_ref4","transaction","isDone","_props$onChange2","onBlur","_ref5","otherToolbarOpened","_toolbarOpened","isActive","schema","useEffect","editorRef","setEditable","nextMarkup","commands","setContent","emitUpdate","entries","_ref6","_ref7","key","value","document","documentElement","style","setProperty","editorState","useEditorState","selector","ctx","_ctx$editor","isFocused","sizeStyle","minWidth","width","maxWidth","minHeight","height","maxHeight","valueToSize","createElement","_extends2","StyledEditorContent","showParagraph","separateParagraph","styled","EditorContent","shouldForwardProp","prop","includes","_ref8","display","outline","flex","padding","margin","left","top","color","pointerEvents","whiteSpace","fontSize","marginBottom","_default"],"sources":["../../src/components/EditableHtml.jsx"],"sourcesContent":["import React, { useCallback, useEffect, useMemo, useState } from 'react';\nimport debounce from 'lodash-es/debounce';\nimport { EditorContent, useEditor, useEditorState } from '@tiptap/react';\nimport { styled } from '@mui/material/styles';\nimport StarterKit from '@tiptap/starter-kit';\nimport { TextStyleKit } from '@tiptap/extension-text-style';\nimport { CharacterCount } from '@tiptap/extension-character-count';\nimport SuperScript from '@tiptap/extension-superscript';\nimport SubScript from '@tiptap/extension-subscript';\nimport TextAlign from '@tiptap/extension-text-align';\nimport Image from '@tiptap/extension-image';\nimport Placeholder from '@tiptap/extension-placeholder';\nimport { normalizeInitialMarkup } from '../utils/helper';\n\nimport ExtendedTable from '../extensions/extended-table';\nimport { ExtendedTableCell, ExtendedTableHeader } from '../extensions/extended-table-cell';\nimport { DivNode } from '../extensions/div-node';\nimport { EnsureEmptyRootIsDiv } from '../extensions/ensure-empty-root-div';\nimport { EnsureListItemContentIsDiv } from '../extensions/ensure-list-item-content-is-div';\nimport { TableRow } from '@tiptap/extension-table-row';\nimport {\n DragInTheBlankNode,\n ExplicitConstructedResponseNode,\n InlineDropdownNode,\n MathTemplatedNode,\n ResponseAreaExtension,\n} from '../extensions/responseArea';\nimport { MathNode } from '../extensions/math';\nimport { ImageUploadNode } from '../extensions/image';\nimport { Media } from '../extensions/media';\nimport { CSSMark } from '../extensions/css';\nimport { ExtendedListItem } from '../extensions/extended-list-item';\nimport { HeadingParagraph } from '../extensions/heading-paragraph';\n\nimport EditorContainer from './TiptapContainer';\nimport { valueToSize } from '../utils/size';\nimport { buildExtensions, PLUGINS_MAP } from '../extensions';\n\nconst defaultToolbarOpts = {\n position: 'bottom',\n alignment: 'left',\n alwaysVisible: false,\n showDone: true,\n doneOn: 'blur',\n};\n\nconst defaultResponseAreaProps = {\n options: {},\n respAreaToolbar: () => {},\n onHandleAreaChange: () => {},\n};\n\nconst DEFAULT_ACTIVE_PLUGINS = [\n 'bold',\n 'italic',\n 'underline',\n 'strikethrough',\n 'code',\n 'bulleted-list',\n 'numbered-list',\n 'image',\n 'math',\n 'languageCharacters',\n 'text-align',\n 'table',\n 'video',\n 'audio',\n 'responseArea',\n 'superscript',\n 'subscript',\n 'css',\n 'h3',\n 'undo',\n 'redo',\n];\n\nconst cssVariables = {\n '--white': '#fff',\n '--black': '#2e2b29',\n '--black-contrast': '#110f0e',\n '--gray-1': 'rgba(61, 37, 20, .05)',\n '--gray-2': 'rgba(61, 37, 20, .08)',\n '--gray-3': 'rgba(61, 37, 20, .12)',\n '--gray-4': 'rgba(53, 38, 28, .3)',\n '--gray-5': 'rgba(28, 25, 23, .6)',\n '--green': '#22c55e',\n '--purple': '#6a00f5',\n '--purple-contrast': '#5800cc',\n '--purple-light': 'rgba(88, 5, 255, .05)',\n '--yellow-contrast': '#facc15',\n '--yellow': 'rgba(250, 204, 21, .4)',\n '--yellow-light': '#fffae5',\n '--red': '#ff5c33',\n '--red-light': '#ffebe5',\n '--shadow': `0px 12px 33px 0px rgba(0, 0, 0, .06),\n 0px 3.618px 9.949px 0px rgba(0, 0, 0, .04)`,\n};\n\nexport const EditableHtml = (props) => {\n const { showParagraphs, separateParagraphs } = props.pluginProps || {};\n const [pendingImages, setPendingImages] = useState([]);\n const [scheduled, setScheduled] = useState(false);\n const { toolbarOpts } = props;\n\n const removePendingImage = useCallback(\n (imagePos) => {\n setPendingImages((prev) => {\n const next = prev.filter((img) => img.pos !== imagePos);\n if (next.length === 0) {\n setScheduled(false);\n }\n return next;\n });\n },\n [setPendingImages],\n );\n\n const toolbarOptsToUse = {\n ...defaultToolbarOpts,\n ...toolbarOpts,\n };\n\n const commitEditorContent = useCallback(\n (editor) => {\n const html = editor.getHTML();\n\n if (props.markup !== html) {\n props.onChange?.(html);\n }\n\n if (toolbarOptsToUse.doneOn === 'blur') {\n props.onDone?.(html);\n }\n },\n [props.markup, props.onChange, props.onDone, toolbarOptsToUse.doneOn],\n );\n\n const responseAreaPropsToUse = useMemo(\n () => ({\n ...defaultResponseAreaProps,\n ...props.responseAreaProps,\n onInlineDropdownToolbarClose: commitEditorContent,\n }),\n [props.responseAreaProps, commitEditorContent],\n );\n\n const activePluginsToUse = useMemo(() => {\n let { customPlugins, ...otherPluginProps } = props.pluginProps || {};\n\n customPlugins = customPlugins || [];\n\n const filteredActivePlugins = (props.activePlugins || DEFAULT_ACTIVE_PLUGINS)?.filter((pluginName) => {\n const nameToUse = PLUGINS_MAP[pluginName] || pluginName;\n const pluginInfo = otherPluginProps[nameToUse] || {};\n\n return !pluginInfo || !pluginInfo.disabled;\n });\n\n return buildExtensions(filteredActivePlugins, customPlugins, {\n math: {},\n textAlign: props.textAlign,\n html: {},\n extraCSSRules: props.extraCSSRules || {},\n image: {\n ...props.imageSupport,\n },\n toolbar: {},\n table: {},\n responseArea: {\n type: responseAreaPropsToUse.type,\n },\n languageCharacters: props.languageCharactersProps,\n keyPadCharacterRef: {},\n setKeypadInteraction: {},\n media: {},\n });\n }, [props, responseAreaPropsToUse.type]);\n\n const extensions = [\n TextAlign.configure({\n types: ['heading', 'paragraph', 'div', 'headingParagraph', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'td', 'th'],\n alignments: ['left', 'right', 'center', 'justify'],\n }),\n TextStyleKit,\n CharacterCount.configure({\n limit: props.charactersLimit || 1000000,\n }),\n StarterKit.configure({\n trailingNode: {\n node: 'paragraph',\n notAfter: ['paragraph', 'div'],\n },\n }),\n ExtendedListItem,\n DivNode,\n HeadingParagraph,\n EnsureEmptyRootIsDiv,\n EnsureListItemContentIsDiv,\n Placeholder.configure({\n placeholder: props.placeholder,\n // show placeholder even when editor is focused\n showOnlyWhenEditable: true,\n showOnlyCurrent: false, // show on all empty nodes, not only the current one\n includeChildren: true,\n }),\n ExtendedTable,\n TableRow,\n ExtendedTableHeader,\n ExtendedTableCell,\n ResponseAreaExtension.configure(responseAreaPropsToUse),\n ExplicitConstructedResponseNode.configure(responseAreaPropsToUse),\n DragInTheBlankNode.configure(responseAreaPropsToUse),\n InlineDropdownNode.configure(responseAreaPropsToUse),\n MathTemplatedNode.configure(responseAreaPropsToUse),\n MathNode.configure({\n toolbarOpts: toolbarOptsToUse,\n math: props.pluginProps?.math || {},\n }),\n SubScript,\n SuperScript,\n Image,\n ImageUploadNode.configure({\n toolbarOpts: toolbarOptsToUse,\n imageHandling: {\n disableImageAlignmentButtons: props.disableImageAlignmentButtons,\n onDone: (editor) => props.onDone?.(editor.getHTML()),\n onDelete:\n props.imageSupport &&\n props.imageSupport.delete &&\n ((node) => {\n const { src } = node.attrs;\n\n props.imageSupport.delete(src, (e) => {\n removePendingImage(node.pos);\n });\n }),\n insertImageRequested:\n props.imageSupport &&\n ((editor, imageInfo, getHandler) => {\n const [addedImage, pos] = imageInfo;\n\n const onFinish = (result) => {\n let cb;\n\n if (scheduled && result) {\n // finish editing only on success\n cb = props.onChange;\n }\n\n removePendingImage(pos);\n cb?.(editor.getHTML());\n };\n\n const callback = () => {\n /**\n * The handler is the object through which the outer context\n * communicates file upload events like: fileChosen, cancel, progress\n */\n const handler = getHandler(onFinish);\n\n // If the user closes the file picker without choosing a file, the window regains\n // focus while _insertingImage is still true — drop the stale pending entry.\n const focusHandler = debounce(() => {\n const detach = () => window.removeEventListener('focus', focusHandler);\n\n if (!editor._insertingImage) {\n detach();\n return;\n }\n\n removePendingImage(pos);\n editor._insertingImage = false;\n detach();\n }, 500);\n\n window.addEventListener('focus', focusHandler);\n\n props.imageSupport.add(handler);\n };\n\n editor._insertingImage = true;\n setPendingImages((prev) => [...prev, addedImage]);\n callback();\n }),\n maxImageWidth: props.maxImageWidth,\n maxImageHeight: props.maxImageHeight,\n },\n limit: 3,\n }),\n Media.configure({\n uploadSoundSupport: props.uploadSoundSupport,\n }),\n CSSMark.configure({\n extraCSSRules: props.extraCSSRules,\n }),\n ];\n\n const editor = useEditor(\n {\n extensions,\n immediatelyRender: false,\n editorProps: {\n handleKeyDown(view, event) {\n if (props.onKeyDown) {\n return props.onKeyDown(event);\n }\n\n // Return false to let default behavior continue\n return false;\n },\n },\n editable: !props.disabled,\n content: normalizeInitialMarkup(props.markup),\n onUpdate: ({ editor, transaction }) => {\n if (transaction.isDone) {\n props.onChange?.(editor.getHTML());\n }\n },\n onBlur: ({ editor }) => {\n const otherToolbarOpened =\n editor._insertingImage ||\n editor._toolbarOpened ||\n editor.isActive('inline_dropdown') ||\n editor.isActive('explicit_constructed_response');\n\n if (otherToolbarOpened || !editor.schema) {\n return;\n }\n\n commitEditorContent(editor);\n },\n },\n [props.charactersLimit],\n );\n\n useEffect(() => {\n if (props.editorRef) {\n props.editorRef(editor);\n }\n }, [props.editorRef, editor]);\n\n useEffect(() => {\n editor?.setEditable(!props.disabled);\n }, [props.disabled, editor]);\n\n useEffect(() => {\n if (!editor) {\n return;\n }\n const nextMarkup = normalizeInitialMarkup(props.markup);\n\n if (nextMarkup !== editor.getHTML()) {\n editor.commands.setContent(nextMarkup, { emitUpdate: false });\n }\n }, [props.markup, editor]);\n\n useEffect(() => {\n Object.entries(cssVariables).forEach(([key, value]) => {\n document.documentElement.style.setProperty(key, value);\n });\n }, []);\n\n const editorState = useEditorState({\n editor,\n selector: (ctx) => ({\n isFocused: ctx.editor?.isFocused,\n }),\n });\n\n const sizeStyle = useMemo(() => {\n const { minWidth, width, maxWidth, minHeight, height, maxHeight } = props;\n\n return {\n width: valueToSize(width),\n minWidth: valueToSize(minWidth),\n maxWidth: valueToSize(maxWidth),\n height: valueToSize(height),\n minHeight: valueToSize(minHeight),\n maxHeight: valueToSize(maxHeight),\n };\n }, [props]);\n\n return (\n <EditorContainer\n {...{\n ...props,\n activePlugins: activePluginsToUse,\n toolbarOpts: toolbarOptsToUse,\n }}\n editorState={editorState}\n editor={editor}\n >\n {editor && (\n <StyledEditorContent\n style={{\n minHeight: sizeStyle.minHeight,\n height: sizeStyle.height,\n maxHeight: sizeStyle.maxHeight,\n }}\n showParagraph={showParagraphs && !showParagraphs.disabled}\n separateParagraph={separateParagraphs && !separateParagraphs.disabled}\n editor={editor}\n />\n )}\n </EditorContainer>\n );\n};\n\nconst StyledEditorContent = styled(EditorContent, {\n shouldForwardProp: (prop) => !['showParagraph', 'separateParagraph'].includes(prop),\n})(({ showParagraph, separateParagraph }) => ({\n display: 'flex',\n outline: 'none !important',\n '& .ProseMirror': {\n flex: 1,\n padding: '5px',\n maxHeight: '500px',\n outline: 'none !important',\n position: 'initial',\n\n // reset default margins for all block paragraphs/divs in the editor\n '& > p, & > div': {\n margin: '0',\n },\n\n // Out of flow so the caret stays at the start of the block; in-flow ::before pushes the caret after the hint text.\n // :only-child ensures the placeholder is hidden whenever the editor has other content (images, upload nodes, etc.)\n // and covers the type+backspace edge case where Tiptap only adds is-empty (not is-editor-empty).\n '& p[data-placeholder].is-empty:only-child, & div[data-placeholder].is-empty:only-child': {\n position: 'relative',\n },\n '& p[data-placeholder].is-empty:only-child::before, & div[data-placeholder].is-empty:only-child::before': {\n content: 'attr(data-placeholder)',\n position: 'absolute',\n left: 0,\n top: 0,\n color: '#9CA3AF',\n pointerEvents: 'none',\n whiteSpace: 'pre-wrap',\n },\n\n ...(showParagraph && {\n '& > p:has(+ p)::after, & > div:has(+ div)::after': {\n display: 'block',\n content: '\"¶\"',\n fontSize: '1em',\n color: '#146EB3',\n },\n }),\n ...(separateParagraph && {\n '& > p:has(+ p)': {\n marginBottom: '1em',\n },\n }),\n },\n}));\n\nexport default EditableHtml;\n"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,mBAAA,GAAAN,OAAA;AACA,IAAAO,wBAAA,GAAAP,OAAA;AACA,IAAAQ,qBAAA,GAAAN,sBAAA,CAAAF,OAAA;AACA,IAAAS,mBAAA,GAAAP,sBAAA,CAAAF,OAAA;AACA,IAAAU,mBAAA,GAAAR,sBAAA,CAAAF,OAAA;AACA,IAAAW,eAAA,GAAAT,sBAAA,CAAAF,OAAA;AACA,IAAAY,qBAAA,GAAAV,sBAAA,CAAAF,OAAA;AACA,IAAAa,OAAA,GAAAb,OAAA;AAEA,IAAAc,cAAA,GAAAZ,sBAAA,CAAAF,OAAA;AACA,IAAAe,kBAAA,GAAAf,OAAA;AACA,IAAAgB,QAAA,GAAAhB,OAAA;AACA,IAAAiB,mBAAA,GAAAjB,OAAA;AACA,IAAAkB,2BAAA,GAAAlB,OAAA;AACA,IAAAmB,kBAAA,GAAAnB,OAAA;AACA,IAAAoB,aAAA,GAAApB,OAAA;AAOA,IAAAqB,KAAA,GAAArB,OAAA;AACA,IAAAsB,MAAA,GAAAtB,OAAA;AACA,IAAAuB,MAAA,GAAAvB,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AAM;IACfC,OAAO,EAAE,iBAAiB;IAC1B,gBAAgB,EAAA3N,aAAA,CAAAA,aAAA;MACd4N,IAAI,EAAE,CAAC;MACPC,OAAO,EAAE,KAAK;MACdhB,SAAS,EAAE,OAAO;MAClBc,OAAO,EAAE,iBAAiB;MAC1BnN,QAAQ,EAAE,SAAS;MAEnB;MACA,gBAAgB,EAAE;QAChBsN,MAAM,EAAE;MACV,CAAC;MAED;MACA;MACA;MACA,wFAAwF,EAAE;QACxFtN,QAAQ,EAAE;MACZ,CAAC;MACD,wGAAwG,EAAE;QACxG4J,OAAO,EAAE,wBAAwB;QACjC5J,QAAQ,EAAE,UAAU;QACpBuN,IAAI,EAAE,CAAC;QACPC,GAAG,EAAE,CAAC;QACNC,KAAK,EAAE,SAAS;QAChBC,aAAa,EAAE,MAAM;QACrBC,UAAU,EAAE;MACd;IAAC,GAEGjB,aAAa,IAAI;MACnB,kDAAkD,EAAE;QAClDQ,OAAO,EAAE,OAAO;QAChBtD,OAAO,EAAE,KAAK;QACdgE,QAAQ,EAAE,KAAK;QACfH,KAAK,EAAE;MACT;IACF,CAAC,GACGd,iBAAiB,IAAI;MACvB,gBAAgB,EAAE;QAChBkB,YAAY,EAAE;MAChB;IACF,CAAC;EAEL,CAAC;AAAA,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAlN,OAAA,cAEWD,YAAY","ignoreList":[]}
1
+ {"version":3,"file":"EditableHtml.js","names":["_react","_interopRequireWildcard","require","_debounce","_interopRequireDefault","_react2","_styles","_starterKit","_extensionTextStyle","_extensionCharacterCount","_extensionSuperscript","_extensionSubscript","_extensionTextAlign","_extensionImage","_extensionPlaceholder","_helper","_extendedTable","_extendedTableCell","_divNode","_ensureEmptyRootDiv","_ensureListItemContentIsDiv","_extensionTableRow","_responseArea","_math","_image","_media","_css","_extendedListItem","_headingParagraph","_TiptapContainer","_size","_extensions","_excluded","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ownKeys","keys","getOwnPropertySymbols","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defaultToolbarOpts","position","alignment","alwaysVisible","showDone","doneOn","defaultResponseAreaProps","options","respAreaToolbar","onHandleAreaChange","DEFAULT_ACTIVE_PLUGINS","cssVariables","spellCheckAttributes","enabled","spellcheck","autocorrect","autocapitalize","EditableHtml","exports","props","_props$pluginProps","_ref","pluginProps","showParagraphs","separateParagraphs","_useState","useState","_useState2","_slicedToArray2","pendingImages","setPendingImages","_useState3","_useState4","scheduled","setScheduled","toolbarOpts","removePendingImage","useCallback","imagePos","prev","next","img","pos","toolbarOptsToUse","commitEditorContent","editor","html","getHTML","markup","_props$onChange","onChange","_props$onDone","onDone","responseAreaPropsToUse","useMemo","responseAreaProps","onInlineDropdownToolbarClose","activePluginsToUse","_ref3","_ref2","customPlugins","otherPluginProps","_objectWithoutProperties2","filteredActivePlugins","activePlugins","pluginName","nameToUse","PLUGINS_MAP","pluginInfo","disabled","buildExtensions","math","textAlign","extraCSSRules","image","imageSupport","toolbar","table","responseArea","type","languageCharacters","languageCharactersProps","keyPadCharacterRef","setKeypadInteraction","media","extensions","TextAlign","configure","types","alignments","TextStyleKit","CharacterCount","limit","charactersLimit","StarterKit","trailingNode","node","notAfter","link","autolink","linkOnPaste","ExtendedListItem","DivNode","HeadingParagraph","EnsureEmptyRootIsDiv","EnsureListItemContentIsDiv","Placeholder","placeholder","showOnlyWhenEditable","showOnlyCurrent","includeChildren","ExtendedTable","TableRow","ExtendedTableHeader","ExtendedTableCell","ResponseAreaExtension","ExplicitConstructedResponseNode","DragInTheBlankNode","InlineDropdownNode","MathTemplatedNode","MathNode","SubScript","SuperScript","Image","ImageUploadNode","imageHandling","disableImageAlignmentButtons","_props$onDone2","onDelete","src","attrs","insertImageRequested","imageInfo","getHandler","_imageInfo","addedImage","onFinish","result","_cb","cb","callback","handler","focusHandler","debounce","detach","window","removeEventListener","_insertingImage","addEventListener","add","concat","_toConsumableArray2","maxImageWidth","maxImageHeight","Media","uploadSoundSupport","CSSMark","spellCheckEnabled","spellCheck","useEditor","immediatelyRender","editorProps","attributes","handleKeyDown","view","event","onKeyDown","editable","content","normalizeInitialMarkup","onUpdate","_ref4","transaction","isDone","_props$onChange2","onBlur","_ref5","otherToolbarOpened","_toolbarOpened","isActive","schema","useEffect","editorRef","setEditable","_editor$options","_currentEditorProps$a","currentEditorProps","setOptions","nextMarkup","commands","setContent","emitUpdate","entries","_ref6","_ref7","key","value","document","documentElement","style","setProperty","editorState","useEditorState","selector","ctx","_ctx$editor","isFocused","sizeStyle","minWidth","width","maxWidth","minHeight","height","maxHeight","valueToSize","createElement","_extends2","StyledEditorContent","showParagraph","separateParagraph","styled","EditorContent","shouldForwardProp","prop","includes","_ref8","display","outline","flex","padding","margin","left","top","color","pointerEvents","whiteSpace","fontSize","marginBottom","_default"],"sources":["../../src/components/EditableHtml.jsx"],"sourcesContent":["import React, { useCallback, useEffect, useMemo, useState } from 'react';\nimport debounce from 'lodash-es/debounce';\nimport { EditorContent, useEditor, useEditorState } from '@tiptap/react';\nimport { styled } from '@mui/material/styles';\nimport StarterKit from '@tiptap/starter-kit';\nimport { TextStyleKit } from '@tiptap/extension-text-style';\nimport { CharacterCount } from '@tiptap/extension-character-count';\nimport SuperScript from '@tiptap/extension-superscript';\nimport SubScript from '@tiptap/extension-subscript';\nimport TextAlign from '@tiptap/extension-text-align';\nimport Image from '@tiptap/extension-image';\nimport Placeholder from '@tiptap/extension-placeholder';\nimport { normalizeInitialMarkup } from '../utils/helper';\n\nimport ExtendedTable from '../extensions/extended-table';\nimport { ExtendedTableCell, ExtendedTableHeader } from '../extensions/extended-table-cell';\nimport { DivNode } from '../extensions/div-node';\nimport { EnsureEmptyRootIsDiv } from '../extensions/ensure-empty-root-div';\nimport { EnsureListItemContentIsDiv } from '../extensions/ensure-list-item-content-is-div';\nimport { TableRow } from '@tiptap/extension-table-row';\nimport {\n DragInTheBlankNode,\n ExplicitConstructedResponseNode,\n InlineDropdownNode,\n MathTemplatedNode,\n ResponseAreaExtension,\n} from '../extensions/responseArea';\nimport { MathNode } from '../extensions/math';\nimport { ImageUploadNode } from '../extensions/image';\nimport { Media } from '../extensions/media';\nimport { CSSMark } from '../extensions/css';\nimport { ExtendedListItem } from '../extensions/extended-list-item';\nimport { HeadingParagraph } from '../extensions/heading-paragraph';\n\nimport EditorContainer from './TiptapContainer';\nimport { valueToSize } from '../utils/size';\nimport { buildExtensions, PLUGINS_MAP } from '../extensions';\n\nconst defaultToolbarOpts = {\n position: 'bottom',\n alignment: 'left',\n alwaysVisible: false,\n showDone: true,\n doneOn: 'blur',\n};\n\nconst defaultResponseAreaProps = {\n options: {},\n respAreaToolbar: () => {},\n onHandleAreaChange: () => {},\n};\n\nconst DEFAULT_ACTIVE_PLUGINS = [\n 'bold',\n 'italic',\n 'underline',\n 'strikethrough',\n 'code',\n 'bulleted-list',\n 'numbered-list',\n 'image',\n 'math',\n 'languageCharacters',\n 'text-align',\n 'table',\n 'video',\n 'audio',\n 'responseArea',\n 'superscript',\n 'subscript',\n 'css',\n 'h3',\n 'undo',\n 'redo',\n];\n\nconst cssVariables = {\n '--white': '#fff',\n '--black': '#2e2b29',\n '--black-contrast': '#110f0e',\n '--gray-1': 'rgba(61, 37, 20, .05)',\n '--gray-2': 'rgba(61, 37, 20, .08)',\n '--gray-3': 'rgba(61, 37, 20, .12)',\n '--gray-4': 'rgba(53, 38, 28, .3)',\n '--gray-5': 'rgba(28, 25, 23, .6)',\n '--green': '#22c55e',\n '--purple': '#6a00f5',\n '--purple-contrast': '#5800cc',\n '--purple-light': 'rgba(88, 5, 255, .05)',\n '--yellow-contrast': '#facc15',\n '--yellow': 'rgba(250, 204, 21, .4)',\n '--yellow-light': '#fffae5',\n '--red': '#ff5c33',\n '--red-light': '#ffebe5',\n '--shadow': `0px 12px 33px 0px rgba(0, 0, 0, .06),\n 0px 3.618px 9.949px 0px rgba(0, 0, 0, .04)`,\n};\n\n// ProseMirror puts these on the contenteditable element. Without them the browser\n// spellchecks the editor regardless of the spellCheck prop.\nconst spellCheckAttributes = (enabled) => ({\n spellcheck: enabled ? 'true' : 'false',\n autocorrect: enabled ? 'on' : 'off',\n autocapitalize: enabled ? 'on' : 'off',\n});\n\nexport const EditableHtml = (props) => {\n const { showParagraphs, separateParagraphs } = props.pluginProps || {};\n const [pendingImages, setPendingImages] = useState([]);\n const [scheduled, setScheduled] = useState(false);\n const { toolbarOpts } = props;\n\n const removePendingImage = useCallback(\n (imagePos) => {\n setPendingImages((prev) => {\n const next = prev.filter((img) => img.pos !== imagePos);\n if (next.length === 0) {\n setScheduled(false);\n }\n return next;\n });\n },\n [setPendingImages],\n );\n\n const toolbarOptsToUse = {\n ...defaultToolbarOpts,\n ...toolbarOpts,\n };\n\n const commitEditorContent = useCallback(\n (editor) => {\n const html = editor.getHTML();\n\n if (props.markup !== html) {\n props.onChange?.(html);\n }\n\n if (toolbarOptsToUse.doneOn === 'blur') {\n props.onDone?.(html);\n }\n },\n [props.markup, props.onChange, props.onDone, toolbarOptsToUse.doneOn],\n );\n\n const responseAreaPropsToUse = useMemo(\n () => ({\n ...defaultResponseAreaProps,\n ...props.responseAreaProps,\n onInlineDropdownToolbarClose: commitEditorContent,\n }),\n [props.responseAreaProps, commitEditorContent],\n );\n\n const activePluginsToUse = useMemo(() => {\n let { customPlugins, ...otherPluginProps } = props.pluginProps || {};\n\n customPlugins = customPlugins || [];\n\n const filteredActivePlugins = (props.activePlugins || DEFAULT_ACTIVE_PLUGINS)?.filter((pluginName) => {\n const nameToUse = PLUGINS_MAP[pluginName] || pluginName;\n const pluginInfo = otherPluginProps[nameToUse] || {};\n\n return !pluginInfo || !pluginInfo.disabled;\n });\n\n return buildExtensions(filteredActivePlugins, customPlugins, {\n math: {},\n textAlign: props.textAlign,\n html: {},\n extraCSSRules: props.extraCSSRules || {},\n image: {\n ...props.imageSupport,\n },\n toolbar: {},\n table: {},\n responseArea: {\n type: responseAreaPropsToUse.type,\n },\n languageCharacters: props.languageCharactersProps,\n keyPadCharacterRef: {},\n setKeypadInteraction: {},\n media: {},\n });\n }, [props, responseAreaPropsToUse.type]);\n\n const extensions = [\n TextAlign.configure({\n types: ['heading', 'paragraph', 'div', 'headingParagraph', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'td', 'th'],\n alignments: ['left', 'right', 'center', 'justify'],\n }),\n TextStyleKit,\n CharacterCount.configure({\n limit: props.charactersLimit || 1000000,\n }),\n StarterKit.configure({\n trailingNode: {\n node: 'paragraph',\n notAfter: ['paragraph', 'div'],\n },\n // StarterKit bundles the link extension, which turns anything that looks like a URL into\n // a hyperlink as it is typed or pasted. See PIE-980 - we don't want that in any editor.\n // The mark itself stays registered so links already in the markup keep round-tripping.\n link: {\n autolink: false,\n linkOnPaste: false,\n },\n }),\n ExtendedListItem,\n DivNode,\n HeadingParagraph,\n EnsureEmptyRootIsDiv,\n EnsureListItemContentIsDiv,\n Placeholder.configure({\n placeholder: props.placeholder,\n // show placeholder even when editor is focused\n showOnlyWhenEditable: true,\n showOnlyCurrent: false, // show on all empty nodes, not only the current one\n includeChildren: true,\n }),\n ExtendedTable,\n TableRow,\n ExtendedTableHeader,\n ExtendedTableCell,\n ResponseAreaExtension.configure(responseAreaPropsToUse),\n ExplicitConstructedResponseNode.configure(responseAreaPropsToUse),\n DragInTheBlankNode.configure(responseAreaPropsToUse),\n InlineDropdownNode.configure(responseAreaPropsToUse),\n MathTemplatedNode.configure(responseAreaPropsToUse),\n MathNode.configure({\n toolbarOpts: toolbarOptsToUse,\n math: props.pluginProps?.math || {},\n }),\n SubScript,\n SuperScript,\n Image,\n ImageUploadNode.configure({\n toolbarOpts: toolbarOptsToUse,\n imageHandling: {\n disableImageAlignmentButtons: props.disableImageAlignmentButtons,\n onDone: (editor) => props.onDone?.(editor.getHTML()),\n onDelete:\n props.imageSupport &&\n props.imageSupport.delete &&\n ((node) => {\n const { src } = node.attrs;\n\n props.imageSupport.delete(src, (e) => {\n removePendingImage(node.pos);\n });\n }),\n insertImageRequested:\n props.imageSupport &&\n ((editor, imageInfo, getHandler) => {\n const [addedImage, pos] = imageInfo;\n\n const onFinish = (result) => {\n let cb;\n\n if (scheduled && result) {\n // finish editing only on success\n cb = props.onChange;\n }\n\n removePendingImage(pos);\n cb?.(editor.getHTML());\n };\n\n const callback = () => {\n /**\n * The handler is the object through which the outer context\n * communicates file upload events like: fileChosen, cancel, progress\n */\n const handler = getHandler(onFinish);\n\n // If the user closes the file picker without choosing a file, the window regains\n // focus while _insertingImage is still true — drop the stale pending entry.\n const focusHandler = debounce(() => {\n const detach = () => window.removeEventListener('focus', focusHandler);\n\n if (!editor._insertingImage) {\n detach();\n return;\n }\n\n removePendingImage(pos);\n editor._insertingImage = false;\n detach();\n }, 500);\n\n window.addEventListener('focus', focusHandler);\n\n props.imageSupport.add(handler);\n };\n\n editor._insertingImage = true;\n setPendingImages((prev) => [...prev, addedImage]);\n callback();\n }),\n maxImageWidth: props.maxImageWidth,\n maxImageHeight: props.maxImageHeight,\n },\n limit: 3,\n }),\n Media.configure({\n uploadSoundSupport: props.uploadSoundSupport,\n }),\n CSSMark.configure({\n extraCSSRules: props.extraCSSRules,\n }),\n ];\n\n // Callers that don't pass spellCheck keep the browser default (on), as they did with the\n // slate-based editor. Players that have to default to off - extended-text-entry, see\n // PIE-978 - resolve that in their controller and pass an explicit false.\n const spellCheckEnabled = props.spellCheck !== false;\n\n const editor = useEditor(\n {\n extensions,\n immediatelyRender: false,\n editorProps: {\n attributes: spellCheckAttributes(spellCheckEnabled),\n handleKeyDown(view, event) {\n if (props.onKeyDown) {\n return props.onKeyDown(event);\n }\n\n // Return false to let default behavior continue\n return false;\n },\n },\n editable: !props.disabled,\n content: normalizeInitialMarkup(props.markup),\n onUpdate: ({ editor, transaction }) => {\n if (transaction.isDone) {\n props.onChange?.(editor.getHTML());\n }\n },\n onBlur: ({ editor }) => {\n const otherToolbarOpened =\n editor._insertingImage ||\n editor._toolbarOpened ||\n editor.isActive('inline_dropdown') ||\n editor.isActive('explicit_constructed_response');\n\n if (otherToolbarOpened || !editor.schema) {\n return;\n }\n\n commitEditorContent(editor);\n },\n },\n [props.charactersLimit],\n );\n\n useEffect(() => {\n if (props.editorRef) {\n props.editorRef(editor);\n }\n }, [props.editorRef, editor]);\n\n useEffect(() => {\n editor?.setEditable(!props.disabled);\n }, [props.disabled, editor]);\n\n // useEditor only re-applies options on its own when it is called with an empty dependency\n // array, and this call site depends on charactersLimit, so a spellCheck change on a mounted\n // editor has to be pushed in. Only the attributes are replaced - the rest of editorProps\n // stays as the editor already has it.\n useEffect(() => {\n if (!editor) {\n return;\n }\n\n const currentEditorProps = editor.options?.editorProps;\n const attributes = spellCheckAttributes(spellCheckEnabled);\n\n if (currentEditorProps?.attributes?.spellcheck === attributes.spellcheck) {\n return;\n }\n\n editor.setOptions({ editorProps: { ...currentEditorProps, attributes } });\n }, [spellCheckEnabled, editor]);\n\n useEffect(() => {\n if (!editor) {\n return;\n }\n const nextMarkup = normalizeInitialMarkup(props.markup);\n\n if (nextMarkup !== editor.getHTML()) {\n editor.commands.setContent(nextMarkup, { emitUpdate: false });\n }\n }, [props.markup, editor]);\n\n useEffect(() => {\n Object.entries(cssVariables).forEach(([key, value]) => {\n document.documentElement.style.setProperty(key, value);\n });\n }, []);\n\n const editorState = useEditorState({\n editor,\n selector: (ctx) => ({\n isFocused: ctx.editor?.isFocused,\n }),\n });\n\n const sizeStyle = useMemo(() => {\n const { minWidth, width, maxWidth, minHeight, height, maxHeight } = props;\n\n return {\n width: valueToSize(width),\n minWidth: valueToSize(minWidth),\n maxWidth: valueToSize(maxWidth),\n height: valueToSize(height),\n minHeight: valueToSize(minHeight),\n maxHeight: valueToSize(maxHeight),\n };\n }, [props]);\n\n return (\n <EditorContainer\n {...{\n ...props,\n activePlugins: activePluginsToUse,\n toolbarOpts: toolbarOptsToUse,\n }}\n editorState={editorState}\n editor={editor}\n >\n {editor && (\n <StyledEditorContent\n style={{\n minHeight: sizeStyle.minHeight,\n height: sizeStyle.height,\n maxHeight: sizeStyle.maxHeight,\n }}\n showParagraph={showParagraphs && !showParagraphs.disabled}\n separateParagraph={separateParagraphs && !separateParagraphs.disabled}\n editor={editor}\n />\n )}\n </EditorContainer>\n );\n};\n\nconst StyledEditorContent = styled(EditorContent, {\n shouldForwardProp: (prop) => !['showParagraph', 'separateParagraph'].includes(prop),\n})(({ showParagraph, separateParagraph }) => ({\n display: 'flex',\n outline: 'none !important',\n '& .ProseMirror': {\n flex: 1,\n padding: '5px',\n maxHeight: '500px',\n outline: 'none !important',\n position: 'initial',\n\n // reset default margins for all block paragraphs/divs in the editor\n '& > p, & > div': {\n margin: '0',\n },\n\n // Out of flow so the caret stays at the start of the block; in-flow ::before pushes the caret after the hint text.\n // :only-child ensures the placeholder is hidden whenever the editor has other content (images, upload nodes, etc.)\n // and covers the type+backspace edge case where Tiptap only adds is-empty (not is-editor-empty).\n '& p[data-placeholder].is-empty:only-child, & div[data-placeholder].is-empty:only-child': {\n position: 'relative',\n },\n '& p[data-placeholder].is-empty:only-child::before, & div[data-placeholder].is-empty:only-child::before': {\n content: 'attr(data-placeholder)',\n position: 'absolute',\n left: 0,\n top: 0,\n color: '#9CA3AF',\n pointerEvents: 'none',\n whiteSpace: 'pre-wrap',\n },\n\n ...(showParagraph && {\n '& > p:has(+ p)::after, & > div:has(+ div)::after': {\n display: 'block',\n content: '\"¶\"',\n fontSize: '1em',\n color: '#146EB3',\n },\n }),\n ...(separateParagraph && {\n '& > p:has(+ p)': {\n marginBottom: '1em',\n },\n }),\n },\n}));\n\nexport default EditableHtml;\n"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,G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AAO,EAAE,KAAK;QACdoE,QAAQ,EAAE,KAAK;QACfH,KAAK,EAAE;MACT;IACF,CAAC,GACGd,iBAAiB,IAAI;MACvB,gBAAgB,EAAE;QAChBkB,YAAY,EAAE;MAChB;IACF,CAAC;EAEL,CAAC;AAAA,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAA5N,OAAA,cAEWD,YAAY","ignoreList":[]}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "2.1.12-next.42+cfa076a8a",
6
+ "version": "2.1.12-next.51+b4ed5cf6a",
7
7
  "description": "",
8
8
  "license": "ISC",
9
9
  "main": "lib/index.js",
@@ -16,11 +16,11 @@
16
16
  "@dnd-kit/utilities": "3.2.2",
17
17
  "@mui/icons-material": "^7.3.4",
18
18
  "@mui/material": "^7.3.4",
19
- "@pie-lib/drag": "^4.0.7-next.65+cfa076a8a",
19
+ "@pie-lib/drag": "^4.0.6",
20
20
  "@pie-lib/math-input": "^8.1.1",
21
21
  "@pie-lib/math-rendering": "^5.1.0",
22
- "@pie-lib/math-toolbar": "^3.0.7-next.65+cfa076a8a",
23
- "@pie-lib/render-ui": "^6.1.4-next.65+cfa076a8a",
22
+ "@pie-lib/math-toolbar": "^3.0.6",
23
+ "@pie-lib/render-ui": "^6.1.3",
24
24
  "@tiptap/core": "3.20.0",
25
25
  "@tiptap/extension-character-count": "3.20.0",
26
26
  "@tiptap/extension-color": "3.20.0",
@@ -59,6 +59,6 @@
59
59
  "peerDependencies": {
60
60
  "react": "^18.2.0"
61
61
  },
62
- "gitHead": "cfa076a8a8c5b9528ad666b8e41e631e86e0df29",
62
+ "gitHead": "b4ed5cf6ab4dc6d9ff3005f7d501135a3261dac9",
63
63
  "scripts": {}
64
64
  }
@@ -11,6 +11,7 @@ jest.mock('@tiptap/react', () => ({
11
11
  const mockEditor = {
12
12
  getHTML: jest.fn(() => '<p>test content</p>'),
13
13
  setEditable: jest.fn(),
14
+ setOptions: jest.fn(),
14
15
  commands: {
15
16
  setContent: jest.fn(),
16
17
  },
@@ -585,4 +586,73 @@ describe('EditableHtml', () => {
585
586
  }).not.toThrow();
586
587
  });
587
588
  });
589
+
590
+ describe('spellCheck', () => {
591
+ const lastEditorAttributes = () => {
592
+ const editorConfig = useEditor.mock.calls[useEditor.mock.calls.length - 1][0];
593
+
594
+ return editorConfig.editorProps.attributes;
595
+ };
596
+
597
+ it('disables browser spellcheck on the contenteditable when spellCheck is false', async () => {
598
+ render(<EditableHtml {...defaultProps} spellCheck={false} />);
599
+
600
+ await waitFor(() => {
601
+ expect(useEditor).toHaveBeenCalled();
602
+ });
603
+
604
+ expect(lastEditorAttributes()).toEqual({
605
+ spellcheck: 'false',
606
+ autocorrect: 'off',
607
+ autocapitalize: 'off',
608
+ });
609
+ });
610
+
611
+ it('enables browser spellcheck when spellCheck is true', async () => {
612
+ render(<EditableHtml {...defaultProps} spellCheck={true} />);
613
+
614
+ await waitFor(() => {
615
+ expect(useEditor).toHaveBeenCalled();
616
+ });
617
+
618
+ expect(lastEditorAttributes()).toEqual({
619
+ spellcheck: 'true',
620
+ autocorrect: 'on',
621
+ autocapitalize: 'on',
622
+ });
623
+ });
624
+
625
+ it('keeps the browser default when spellCheck is not provided', async () => {
626
+ render(<EditableHtml {...defaultProps} />);
627
+
628
+ await waitFor(() => {
629
+ expect(useEditor).toHaveBeenCalled();
630
+ });
631
+
632
+ expect(lastEditorAttributes().spellcheck).toEqual('true');
633
+ });
634
+
635
+ it('pushes spellCheck changes onto an existing editor', async () => {
636
+ const editorRef = jest.fn();
637
+ const { rerender } = render(<EditableHtml {...defaultProps} spellCheck={true} editorRef={editorRef} />);
638
+
639
+ await waitFor(() => {
640
+ expect(editorRef).toHaveBeenCalled();
641
+ });
642
+
643
+ rerender(<EditableHtml {...defaultProps} spellCheck={false} editorRef={editorRef} />);
644
+
645
+ await waitFor(() => {
646
+ expect(lastEditorAttributes().spellcheck).toEqual('false');
647
+ });
648
+
649
+ const editor = editorRef.mock.calls[editorRef.mock.calls.length - 1][0];
650
+
651
+ expect(editor.setOptions).toHaveBeenCalledWith({
652
+ editorProps: expect.objectContaining({
653
+ attributes: { spellcheck: 'false', autocorrect: 'off', autocapitalize: 'off' },
654
+ }),
655
+ });
656
+ });
657
+ });
588
658
  });
@@ -0,0 +1,63 @@
1
+ import React from 'react';
2
+ import { render, waitFor } from '@testing-library/react';
3
+ import { EditableHtml } from '../components/EditableHtml';
4
+
5
+ const renderEditor = (props) =>
6
+ render(<EditableHtml markup="<p>teh</p>" onChange={() => {}} pluginProps={{}} {...props} />);
7
+
8
+ const prosemirror = (container) => container.querySelector('.ProseMirror');
9
+
10
+ const waitForEditor = async (container) => {
11
+ await waitFor(() => {
12
+ expect(prosemirror(container)).toBeInTheDocument();
13
+ });
14
+ };
15
+
16
+ describe('spellCheck', () => {
17
+ it('turns off browser spellcheck on the contenteditable when spellCheck is false', async () => {
18
+ const { container } = renderEditor({ spellCheck: false });
19
+
20
+ await waitForEditor(container);
21
+
22
+ expect(prosemirror(container).getAttribute('spellcheck')).toBe('false');
23
+ expect(prosemirror(container).getAttribute('autocorrect')).toBe('off');
24
+ expect(prosemirror(container).getAttribute('autocapitalize')).toBe('off');
25
+ });
26
+
27
+ it('leaves browser spellcheck on when spellCheck is true', async () => {
28
+ const { container } = renderEditor({ spellCheck: true });
29
+
30
+ await waitForEditor(container);
31
+
32
+ expect(prosemirror(container).getAttribute('spellcheck')).toBe('true');
33
+ });
34
+
35
+ it('keeps the browser default when spellCheck is not provided', async () => {
36
+ const { container } = renderEditor();
37
+
38
+ await waitForEditor(container);
39
+
40
+ expect(prosemirror(container).getAttribute('spellcheck')).toBe('true');
41
+ });
42
+
43
+ it('updates the contenteditable when spellCheck changes on an existing editor', async () => {
44
+ const { container, rerender } = renderEditor({ spellCheck: true });
45
+
46
+ await waitForEditor(container);
47
+ expect(prosemirror(container).getAttribute('spellcheck')).toBe('true');
48
+
49
+ rerender(<EditableHtml markup="<p>teh</p>" onChange={() => {}} pluginProps={{}} spellCheck={false} />);
50
+
51
+ await waitFor(() => {
52
+ expect(prosemirror(container).getAttribute('spellcheck')).toBe('false');
53
+ });
54
+ });
55
+
56
+ it('keeps spellcheck off for a disabled (read-only) editor', async () => {
57
+ const { container } = renderEditor({ spellCheck: false, disabled: true });
58
+
59
+ await waitForEditor(container);
60
+
61
+ expect(prosemirror(container).getAttribute('spellcheck')).toBe('false');
62
+ });
63
+ });
@@ -96,6 +96,14 @@ const cssVariables = {
96
96
  0px 3.618px 9.949px 0px rgba(0, 0, 0, .04)`,
97
97
  };
98
98
 
99
+ // ProseMirror puts these on the contenteditable element. Without them the browser
100
+ // spellchecks the editor regardless of the spellCheck prop.
101
+ const spellCheckAttributes = (enabled) => ({
102
+ spellcheck: enabled ? 'true' : 'false',
103
+ autocorrect: enabled ? 'on' : 'off',
104
+ autocapitalize: enabled ? 'on' : 'off',
105
+ });
106
+
99
107
  export const EditableHtml = (props) => {
100
108
  const { showParagraphs, separateParagraphs } = props.pluginProps || {};
101
109
  const [pendingImages, setPendingImages] = useState([]);
@@ -190,6 +198,13 @@ export const EditableHtml = (props) => {
190
198
  node: 'paragraph',
191
199
  notAfter: ['paragraph', 'div'],
192
200
  },
201
+ // StarterKit bundles the link extension, which turns anything that looks like a URL into
202
+ // a hyperlink as it is typed or pasted. See PIE-980 - we don't want that in any editor.
203
+ // The mark itself stays registered so links already in the markup keep round-tripping.
204
+ link: {
205
+ autolink: false,
206
+ linkOnPaste: false,
207
+ },
193
208
  }),
194
209
  ExtendedListItem,
195
210
  DivNode,
@@ -295,11 +310,17 @@ export const EditableHtml = (props) => {
295
310
  }),
296
311
  ];
297
312
 
313
+ // Callers that don't pass spellCheck keep the browser default (on), as they did with the
314
+ // slate-based editor. Players that have to default to off - extended-text-entry, see
315
+ // PIE-978 - resolve that in their controller and pass an explicit false.
316
+ const spellCheckEnabled = props.spellCheck !== false;
317
+
298
318
  const editor = useEditor(
299
319
  {
300
320
  extensions,
301
321
  immediatelyRender: false,
302
322
  editorProps: {
323
+ attributes: spellCheckAttributes(spellCheckEnabled),
303
324
  handleKeyDown(view, event) {
304
325
  if (props.onKeyDown) {
305
326
  return props.onKeyDown(event);
@@ -343,6 +364,25 @@ export const EditableHtml = (props) => {
343
364
  editor?.setEditable(!props.disabled);
344
365
  }, [props.disabled, editor]);
345
366
 
367
+ // useEditor only re-applies options on its own when it is called with an empty dependency
368
+ // array, and this call site depends on charactersLimit, so a spellCheck change on a mounted
369
+ // editor has to be pushed in. Only the attributes are replaced - the rest of editorProps
370
+ // stays as the editor already has it.
371
+ useEffect(() => {
372
+ if (!editor) {
373
+ return;
374
+ }
375
+
376
+ const currentEditorProps = editor.options?.editorProps;
377
+ const attributes = spellCheckAttributes(spellCheckEnabled);
378
+
379
+ if (currentEditorProps?.attributes?.spellcheck === attributes.spellcheck) {
380
+ return;
381
+ }
382
+
383
+ editor.setOptions({ editorProps: { ...currentEditorProps, attributes } });
384
+ }, [spellCheckEnabled, editor]);
385
+
346
386
  useEffect(() => {
347
387
  if (!editor) {
348
388
  return;