@pie-lib/editable-html-tip-tap 2.1.12-next.55 → 2.1.12-next.57

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.
@@ -78,13 +78,24 @@ var cssVariables = {
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
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) {
81
+ // Attributes PIE puts on the editor's contenteditable element.
82
+ //
83
+ // ProseMirror rebuilds the element's attribute set from editorProps.attributes on every view
84
+ // update and removes anything no longer listed, and Tiptap merges its own role="textbox" only in
85
+ // createView - not into editor.options, which is what setOptions re-pushes. So every attribute we
86
+ // want to survive has to be listed here. See PIE-1015.
87
+ var editorAttributes = function editorAttributes(spellCheckEnabled) {
84
88
  return {
85
- spellcheck: enabled ? 'true' : 'false',
86
- autocorrect: enabled ? 'on' : 'off',
87
- autocapitalize: enabled ? 'on' : 'off'
89
+ // Tiptap's own attribute, re-declared so it survives setOptions. setEditable alone re-pushes
90
+ // editorProps on every mount, which is what removed it in 2.1.17.
91
+ role: 'textbox',
92
+ // PIE-owned hook for external consumers - see PIE-1016. Query [data-pie-editor], or
93
+ // [data-pie-editor][contenteditable="true"] to skip read-only renders.
94
+ 'data-pie-editor': 'true',
95
+ // Without these the browser spellchecks the editor regardless of the spellCheck prop.
96
+ spellcheck: spellCheckEnabled ? 'true' : 'false',
97
+ autocorrect: spellCheckEnabled ? 'on' : 'off',
98
+ autocapitalize: spellCheckEnabled ? 'on' : 'off'
88
99
  };
89
100
  };
90
101
  var EditableHtml = exports.EditableHtml = function EditableHtml(props) {
@@ -260,7 +271,7 @@ var EditableHtml = exports.EditableHtml = function EditableHtml(props) {
260
271
  extensions: extensions,
261
272
  immediatelyRender: false,
262
273
  editorProps: {
263
- attributes: spellCheckAttributes(spellCheckEnabled),
274
+ attributes: editorAttributes(spellCheckEnabled),
264
275
  handleKeyDown: function handleKeyDown(view, event) {
265
276
  if (props.onKeyDown) {
266
277
  return props.onKeyDown(event);
@@ -300,15 +311,16 @@ var EditableHtml = exports.EditableHtml = function EditableHtml(props) {
300
311
 
301
312
  // useEditor only re-applies options on its own when it is called with an empty dependency
302
313
  // 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.
314
+ // editor has to be pushed in. The rest of editorProps stays as the editor already has it, and
315
+ // the attributes are merged rather than replaced so an attribute contributed by Tiptap or an
316
+ // extension can't be dropped the way role="textbox" was - see PIE-1015.
305
317
  (0, _react.useEffect)(function () {
306
318
  var _editor$options, _currentEditorProps$a;
307
319
  if (!editor) {
308
320
  return;
309
321
  }
310
322
  var currentEditorProps = (_editor$options = editor.options) === null || _editor$options === void 0 ? void 0 : _editor$options.editorProps;
311
- var attributes = spellCheckAttributes(spellCheckEnabled);
323
+ var attributes = _objectSpread(_objectSpread({}, currentEditorProps === null || currentEditorProps === void 0 ? void 0 : currentEditorProps.attributes), editorAttributes(spellCheckEnabled));
312
324
  if ((currentEditorProps === null || currentEditorProps === void 0 || (_currentEditorProps$a = currentEditorProps.attributes) === null || _currentEditorProps$a === void 0 ? void 0 : _currentEditorProps$a.spellcheck) === attributes.spellcheck) {
313
325
  return;
314
326
  }
@@ -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","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,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a,IAAI;MACnB,kDAAkD,EAAE;QAClDQ,OAAO,EAAE,OAAO;QAChB1D,OAAO,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":[]}
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","editorAttributes","spellCheckEnabled","role","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","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// Attributes PIE puts on the editor's contenteditable element.\n//\n// ProseMirror rebuilds the element's attribute set from editorProps.attributes on every view\n// update and removes anything no longer listed, and Tiptap merges its own role=\"textbox\" only in\n// createView - not into editor.options, which is what setOptions re-pushes. So every attribute we\n// want to survive has to be listed here. See PIE-1015.\nconst editorAttributes = (spellCheckEnabled) => ({\n // Tiptap's own attribute, re-declared so it survives setOptions. setEditable alone re-pushes\n // editorProps on every mount, which is what removed it in 2.1.17.\n role: 'textbox',\n // PIE-owned hook for external consumers - see PIE-1016. Query [data-pie-editor], or\n // [data-pie-editor][contenteditable=\"true\"] to skip read-only renders.\n 'data-pie-editor': 'true',\n // Without these the browser spellchecks the editor regardless of the spellCheck prop.\n spellcheck: spellCheckEnabled ? 'true' : 'false',\n autocorrect: spellCheckEnabled ? 'on' : 'off',\n autocapitalize: spellCheckEnabled ? '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: editorAttributes(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. The rest of editorProps stays as the editor already has it, and\n // the attributes are merged rather than replaced so an attribute contributed by Tiptap or an\n // extension can't be dropped the way role=\"textbox\" was - see PIE-1015.\n useEffect(() => {\n if (!editor) {\n return;\n }\n\n const currentEditorProps = editor.options?.editorProps;\n const attributes = { ...currentEditorProps?.attributes, ...editorAttributes(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,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,mBAAA,GAAAN,OAAA;AACA,IAAAO,wBAAA,GAAAP,OAAA;AACA,IAAAQ,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BC,UAAU,EAAE;MACd;IAAC,GAEGjB,aAAa,IAAI;MACnB,kDAAkD,EAAE;QAClDQ,OAAO,EAAE,OAAO;QAChB1D,OAAO,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,GAAA3N,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.55+ecaf0cda7",
6
+ "version": "2.1.12-next.57+7968661d1",
7
7
  "description": "",
8
8
  "license": "ISC",
9
9
  "main": "lib/index.js",
@@ -59,6 +59,6 @@
59
59
  "peerDependencies": {
60
60
  "react": "^18.2.0"
61
61
  },
62
- "gitHead": "ecaf0cda75094e67f8720d6605b300c665a04c7b",
62
+ "gitHead": "7968661d111c26a1e0f8810ba6b4a35e855a2a33",
63
63
  "scripts": {}
64
64
  }
@@ -602,6 +602,8 @@ describe('EditableHtml', () => {
602
602
  });
603
603
 
604
604
  expect(lastEditorAttributes()).toEqual({
605
+ role: 'textbox',
606
+ 'data-pie-editor': 'true',
605
607
  spellcheck: 'false',
606
608
  autocorrect: 'off',
607
609
  autocapitalize: 'off',
@@ -616,6 +618,8 @@ describe('EditableHtml', () => {
616
618
  });
617
619
 
618
620
  expect(lastEditorAttributes()).toEqual({
621
+ role: 'textbox',
622
+ 'data-pie-editor': 'true',
619
623
  spellcheck: 'true',
620
624
  autocorrect: 'on',
621
625
  autocapitalize: 'on',
@@ -650,7 +654,13 @@ describe('EditableHtml', () => {
650
654
 
651
655
  expect(editor.setOptions).toHaveBeenCalledWith({
652
656
  editorProps: expect.objectContaining({
653
- attributes: { spellcheck: 'false', autocorrect: 'off', autocapitalize: 'off' },
657
+ attributes: {
658
+ role: 'textbox',
659
+ 'data-pie-editor': 'true',
660
+ spellcheck: 'false',
661
+ autocorrect: 'off',
662
+ autocapitalize: 'off',
663
+ },
654
664
  }),
655
665
  });
656
666
  });
@@ -0,0 +1,77 @@
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>hello</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('contenteditable attributes', () => {
17
+ // PIE-1015: 2.1.17 lost role="textbox" on a plain mount, because setEditable re-pushes
18
+ // editorProps through setOptions and ProseMirror drops any attribute no longer listed.
19
+ it('announces the editor as a textbox on a plain mount', async () => {
20
+ const { container } = renderEditor();
21
+
22
+ await waitForEditor(container);
23
+
24
+ expect(prosemirror(container).getAttribute('role')).toBe('textbox');
25
+ });
26
+
27
+ // PIE-1016: a PIE-owned hook external consumers can target, unlike role or .tiptap.ProseMirror.
28
+ it('exposes the PIE-owned editor hook on a plain mount', async () => {
29
+ const { container } = renderEditor();
30
+
31
+ await waitForEditor(container);
32
+
33
+ expect(prosemirror(container).getAttribute('data-pie-editor')).toBe('true');
34
+ });
35
+
36
+ it('keeps both attributes when spellCheck changes on a mounted editor', async () => {
37
+ const { container, rerender } = renderEditor({ spellCheck: true });
38
+
39
+ await waitForEditor(container);
40
+
41
+ rerender(<EditableHtml markup="<p>hello</p>" onChange={() => {}} pluginProps={{}} spellCheck={false} />);
42
+
43
+ await waitFor(() => {
44
+ expect(prosemirror(container).getAttribute('spellcheck')).toBe('false');
45
+ });
46
+
47
+ expect(prosemirror(container).getAttribute('role')).toBe('textbox');
48
+ expect(prosemirror(container).getAttribute('data-pie-editor')).toBe('true');
49
+ });
50
+
51
+ it('keeps both attributes when the editor is disabled on a mounted editor', async () => {
52
+ const { container, rerender } = renderEditor();
53
+
54
+ await waitForEditor(container);
55
+
56
+ rerender(<EditableHtml markup="<p>hello</p>" onChange={() => {}} pluginProps={{}} disabled />);
57
+
58
+ await waitFor(() => {
59
+ expect(prosemirror(container).getAttribute('contenteditable')).toBe('false');
60
+ });
61
+
62
+ expect(prosemirror(container).getAttribute('role')).toBe('textbox');
63
+ expect(prosemirror(container).getAttribute('data-pie-editor')).toBe('true');
64
+ });
65
+
66
+ // Online Testing queries [data-pie-editor][contenteditable="true"] to attach its answer-save
67
+ // listener, so a read-only render has to carry the hook but not match that selector.
68
+ it('marks a read-only editor as not editable so the hook can be filtered on it', async () => {
69
+ const { container } = renderEditor({ disabled: true });
70
+
71
+ await waitForEditor(container);
72
+
73
+ expect(prosemirror(container).getAttribute('data-pie-editor')).toBe('true');
74
+ expect(prosemirror(container).getAttribute('contenteditable')).toBe('false');
75
+ expect(container.querySelector('[data-pie-editor][contenteditable="true"]')).toBeNull();
76
+ });
77
+ });
@@ -96,12 +96,23 @@ 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',
99
+ // Attributes PIE puts on the editor's contenteditable element.
100
+ //
101
+ // ProseMirror rebuilds the element's attribute set from editorProps.attributes on every view
102
+ // update and removes anything no longer listed, and Tiptap merges its own role="textbox" only in
103
+ // createView - not into editor.options, which is what setOptions re-pushes. So every attribute we
104
+ // want to survive has to be listed here. See PIE-1015.
105
+ const editorAttributes = (spellCheckEnabled) => ({
106
+ // Tiptap's own attribute, re-declared so it survives setOptions. setEditable alone re-pushes
107
+ // editorProps on every mount, which is what removed it in 2.1.17.
108
+ role: 'textbox',
109
+ // PIE-owned hook for external consumers - see PIE-1016. Query [data-pie-editor], or
110
+ // [data-pie-editor][contenteditable="true"] to skip read-only renders.
111
+ 'data-pie-editor': 'true',
112
+ // Without these the browser spellchecks the editor regardless of the spellCheck prop.
113
+ spellcheck: spellCheckEnabled ? 'true' : 'false',
114
+ autocorrect: spellCheckEnabled ? 'on' : 'off',
115
+ autocapitalize: spellCheckEnabled ? 'on' : 'off',
105
116
  });
106
117
 
107
118
  export const EditableHtml = (props) => {
@@ -320,7 +331,7 @@ export const EditableHtml = (props) => {
320
331
  extensions,
321
332
  immediatelyRender: false,
322
333
  editorProps: {
323
- attributes: spellCheckAttributes(spellCheckEnabled),
334
+ attributes: editorAttributes(spellCheckEnabled),
324
335
  handleKeyDown(view, event) {
325
336
  if (props.onKeyDown) {
326
337
  return props.onKeyDown(event);
@@ -366,15 +377,16 @@ export const EditableHtml = (props) => {
366
377
 
367
378
  // useEditor only re-applies options on its own when it is called with an empty dependency
368
379
  // 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.
380
+ // editor has to be pushed in. The rest of editorProps stays as the editor already has it, and
381
+ // the attributes are merged rather than replaced so an attribute contributed by Tiptap or an
382
+ // extension can't be dropped the way role="textbox" was - see PIE-1015.
371
383
  useEffect(() => {
372
384
  if (!editor) {
373
385
  return;
374
386
  }
375
387
 
376
388
  const currentEditorProps = editor.options?.editorProps;
377
- const attributes = spellCheckAttributes(spellCheckEnabled);
389
+ const attributes = { ...currentEditorProps?.attributes, ...editorAttributes(spellCheckEnabled) };
378
390
 
379
391
  if (currentEditorProps?.attributes?.spellcheck === attributes.spellcheck) {
380
392
  return;