@pie-lib/editable-html-tip-tap 1.2.0-next.32 → 1.2.0-next.34

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.
Files changed (30) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/lib/components/EditableHtml.js +9 -4
  3. package/lib/components/EditableHtml.js.map +1 -1
  4. package/lib/components/image/InsertImageHandler.js +6 -13
  5. package/lib/components/image/InsertImageHandler.js.map +1 -1
  6. package/lib/extensions/div-node.js +11 -3
  7. package/lib/extensions/div-node.js.map +1 -1
  8. package/lib/extensions/ensure-list-item-content-is-div.js +64 -0
  9. package/lib/extensions/ensure-list-item-content-is-div.js.map +1 -0
  10. package/lib/extensions/extended-list-item.js +15 -0
  11. package/lib/extensions/extended-list-item.js.map +1 -0
  12. package/lib/extensions/image-component.js +40 -36
  13. package/lib/extensions/image-component.js.map +1 -1
  14. package/lib/extensions/image.js +11 -2
  15. package/lib/extensions/image.js.map +1 -1
  16. package/package.json +2 -2
  17. package/src/__tests__/EditableHtml.test.jsx +8 -0
  18. package/src/__tests__/index.test.jsx +2 -0
  19. package/src/components/EditableHtml.jsx +9 -3
  20. package/src/components/__tests__/InsertImageHandler.test.js +23 -21
  21. package/src/components/image/InsertImageHandler.js +4 -13
  22. package/src/extensions/__tests__/ensure-list-item-content-is-div.test.js +44 -0
  23. package/src/extensions/__tests__/extended-list-item.test.js +13 -0
  24. package/src/extensions/__tests__/image-component.test.jsx +23 -3
  25. package/src/extensions/__tests__/image.test.js +15 -10
  26. package/src/extensions/div-node.js +12 -2
  27. package/src/extensions/ensure-list-item-content-is-div.js +62 -0
  28. package/src/extensions/extended-list-item.js +10 -0
  29. package/src/extensions/image-component.jsx +38 -39
  30. package/src/extensions/image.js +5 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,24 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [1.2.0-next.34](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html-tip-tap@1.2.0-next.33...@pie-lib/editable-html-tip-tap@1.2.0-next.34) (2026-04-16)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **editable-html-tip-tap:** handle list item to avoid default paragraph wrapping PIE-46 ([9c37dac](https://github.com/pie-framework/pie-lib/commit/9c37dac9d10940f59930d21a135cd991f238d622))
11
+ - streamline beforeEach setup in image component tests ([3d0fc78](https://github.com/pie-framework/pie-lib/commit/3d0fc78b9ceda1664978378ace9f6c3bbd4a2269))
12
+ - tests ([4c96c88](https://github.com/pie-framework/pie-lib/commit/4c96c88b791b10d747453914577178b991753961))
13
+
14
+ ### Features
15
+
16
+ - **editable-html-tip-tap:** image -add unique nodeKey attribute for identification PIE-54 ([210c0d5](https://github.com/pie-framework/pie-lib/commit/210c0d5ffda0718b52845b3b4011b98f66b0b547))
17
+
18
+ # [1.2.0-next.33](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html-tip-tap@1.2.0-next.32...@pie-lib/editable-html-tip-tap@1.2.0-next.33) (2026-04-16)
19
+
20
+ ### Bug Fixes
21
+
22
+ - made sure correct reference is sent for insert image handler [PIE-1229][PIE-44] ([8db57c0](https://github.com/pie-framework/pie-lib/commit/8db57c035449b5c630a084211b506d2c85786772))
23
+
6
24
  # [1.2.0-next.32](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html-tip-tap@1.2.0-next.31...@pie-lib/editable-html-tip-tap@1.2.0-next.32) (2026-04-16)
7
25
 
8
26
  ### Bug Fixes
@@ -28,12 +28,14 @@ var _extendedTable = _interopRequireDefault(require("../extensions/extended-tabl
28
28
  var _extendedTableCell = require("../extensions/extended-table-cell");
29
29
  var _divNode = require("../extensions/div-node");
30
30
  var _ensureEmptyRootDiv = require("../extensions/ensure-empty-root-div");
31
+ var _ensureListItemContentIsDiv = require("../extensions/ensure-list-item-content-is-div");
31
32
  var _extensionTableRow = require("@tiptap/extension-table-row");
32
33
  var _responseArea = require("../extensions/responseArea");
33
34
  var _math = require("../extensions/math");
34
35
  var _image = require("../extensions/image");
35
36
  var _media = require("../extensions/media");
36
37
  var _css = require("../extensions/css");
38
+ var _extendedListItem = require("../extensions/extended-list-item");
37
39
  var _TiptapContainer = _interopRequireDefault(require("./TiptapContainer"));
38
40
  var _size = require("../utils/size");
39
41
  var _extensions = require("../extensions");
@@ -138,7 +140,7 @@ var EditableHtml = exports.EditableHtml = function EditableHtml(props) {
138
140
  node: 'paragraph',
139
141
  notAfter: ['paragraph', 'div']
140
142
  }
141
- }), _divNode.DivNode, _ensureEmptyRootDiv.EnsureEmptyRootIsDiv, _extensionPlaceholder["default"].configure({
143
+ }), _extendedListItem.ExtendedListItem, _divNode.DivNode, _ensureEmptyRootDiv.EnsureEmptyRootIsDiv, _ensureListItemContentIsDiv.EnsureListItemContentIsDiv, _extensionPlaceholder["default"].configure({
142
144
  placeholder: props.placeholder,
143
145
  // show placeholder even when editor is focused
144
146
  showOnlyWhenEditable: true,
@@ -162,7 +164,10 @@ var EditableHtml = exports.EditableHtml = function EditableHtml(props) {
162
164
  removePendingImage(node.pos);
163
165
  });
164
166
  },
165
- insertImageRequested: props.imageSupport && function (editor, addedImage, getHandler) {
167
+ insertImageRequested: props.imageSupport && function (editor, imageInfo, getHandler) {
168
+ var _imageInfo = (0, _slicedToArray2["default"])(imageInfo, 2),
169
+ addedImage = _imageInfo[0],
170
+ pos = _imageInfo[1];
166
171
  var onFinish = function onFinish(result) {
167
172
  var _cb;
168
173
  var cb;
@@ -170,7 +175,7 @@ var EditableHtml = exports.EditableHtml = function EditableHtml(props) {
170
175
  // finish editing only on success
171
176
  cb = props.onChange;
172
177
  }
173
- removePendingImage(addedImage.pos);
178
+ removePendingImage(pos);
174
179
  (_cb = cb) === null || _cb === void 0 || _cb(editor.getHTML());
175
180
  };
176
181
  var callback = function callback() {
@@ -190,7 +195,7 @@ var EditableHtml = exports.EditableHtml = function EditableHtml(props) {
190
195
  detach();
191
196
  return;
192
197
  }
193
- removePendingImage(addedImage.pos);
198
+ removePendingImage(pos);
194
199
  editor._insertingImage = false;
195
200
  detach();
196
201
  }, 500);
@@ -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","_extensionTableRow","_responseArea","_math","_image","_media","_css","_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","activePluginsToUse","useMemo","_ref3","_props$responseAreaPr","_ref2","customPlugins","otherPluginProps","_objectWithoutProperties2","filteredActivePlugins","activePlugins","pluginName","nameToUse","PLUGINS_MAP","pluginInfo","disabled","buildExtensions","math","textAlign","html","extraCSSRules","image","imageSupport","toolbar","table","responseArea","type","responseAreaProps","languageCharacters","languageCharactersProps","keyPadCharacterRef","setKeypadInteraction","media","extensions","TextAlign","configure","types","alignments","TextStyleKit","CharacterCount","limit","charactersLimit","StarterKit","trailingNode","node","notAfter","DivNode","EnsureEmptyRootIsDiv","Placeholder","placeholder","showOnlyWhenEditable","showOnlyCurrent","includeChildren","ExtendedTable","TableRow","ExtendedTableHeader","ExtendedTableCell","ResponseAreaExtension","ExplicitConstructedResponseNode","DragInTheBlankNode","InlineDropdownNode","MathTemplatedNode","MathNode","SubScript","SuperScript","Image","ImageUploadNode","imageHandling","disableImageAlignmentButtons","onDone","editor","_props$onDone","getHTML","onDelete","src","attrs","insertImageRequested","addedImage","getHandler","onFinish","result","_cb","cb","onChange","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","markup","onUpdate","_ref4","transaction","isDone","_props$onChange","onBlur","_ref5","otherToolbarOpened","_toolbarOpened","isActive","_props$onChange2","_props$onDone2","useEffect","editorRef","setEditable","nextMarkup","commands","setContent","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 { 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';\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 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: props.responseAreaProps?.type,\n },\n languageCharacters: props.languageCharactersProps,\n keyPadCharacterRef: {},\n setKeypadInteraction: {},\n media: {},\n });\n }, [props]);\n\n const extensions = [\n TextAlign.configure({\n types: ['heading', 'paragraph', 'div', '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 DivNode,\n EnsureEmptyRootIsDiv,\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(props.responseAreaProps),\n ExplicitConstructedResponseNode.configure(props.responseAreaProps),\n DragInTheBlankNode.configure(props.responseAreaProps),\n InlineDropdownNode.configure(props.responseAreaProps),\n MathTemplatedNode.configure(props.responseAreaProps),\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, addedImage, getHandler) => {\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(addedImage.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(addedImage.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: debounce(({ 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) {\n return;\n }\n\n if (props.markup !== editor.getHTML()) {\n props.onChange?.(editor.getHTML());\n }\n\n if (toolbarOptsToUse.doneOn === 'blur') {\n props.onDone?.(editor.getHTML());\n }\n }, 200),\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, 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 '& p.is-editor-empty, & div.is-editor-empty': {\n position: 'relative',\n },\n '& p.is-editor-empty::before, & div.is-editor-empty::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 '& > div:has(+ div)': {\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;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AA,IAAGP,aAAa,GAAAO,KAAA,CAAbP,aAAa;IAAEC,iBAAiB,GAAAM,KAAA,CAAjBN,iBAAiB;EAAA,OAAQ;IAC5CO,OAAO,EAAE,MAAM;IACfC,OAAO,EAAE,iBAAiB;IAC1B,gBAAgB,EAAAlN,aAAA,CAAAA,aAAA;MACdmN,IAAI,EAAE,CAAC;MACPC,OAAO,EAAE,KAAK;MACdhB,SAAS,EAAE,OAAO;MAClBc,OAAO,EAAE,iBAAiB;MAC1B1M,QAAQ,EAAE,SAAS;MAEnB;MACA,gBAAgB,EAAE;QAChB6M,MAAM,EAAE;MACV,CAAC;MAED;MACA,4CAA4C,EAAE;QAC5C7M,QAAQ,EAAE;MACZ,CAAC;MACD,4DAA4D,EAAE;QAC5DkJ,OAAO,EAAE,wBAAwB;QACjClJ,QAAQ,EAAE,UAAU;QACpB8M,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;QAChBvD,OAAO,EAAE,KAAK;QACdiE,QAAQ,EAAE,KAAK;QACfH,KAAK,EAAE;MACT;IACF,CAAC,GACGd,iBAAiB,IAAI;MACvB,oBAAoB,EAAE;QACpBkB,YAAY,EAAE;MAChB;IACF,CAAC;EAEL,CAAC;AAAA,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAzM,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","_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","activePluginsToUse","useMemo","_ref3","_props$responseAreaPr","_ref2","customPlugins","otherPluginProps","_objectWithoutProperties2","filteredActivePlugins","activePlugins","pluginName","nameToUse","PLUGINS_MAP","pluginInfo","disabled","buildExtensions","math","textAlign","html","extraCSSRules","image","imageSupport","toolbar","table","responseArea","type","responseAreaProps","languageCharacters","languageCharactersProps","keyPadCharacterRef","setKeypadInteraction","media","extensions","TextAlign","configure","types","alignments","TextStyleKit","CharacterCount","limit","charactersLimit","StarterKit","trailingNode","node","notAfter","ExtendedListItem","DivNode","EnsureEmptyRootIsDiv","EnsureListItemContentIsDiv","Placeholder","placeholder","showOnlyWhenEditable","showOnlyCurrent","includeChildren","ExtendedTable","TableRow","ExtendedTableHeader","ExtendedTableCell","ResponseAreaExtension","ExplicitConstructedResponseNode","DragInTheBlankNode","InlineDropdownNode","MathTemplatedNode","MathNode","SubScript","SuperScript","Image","ImageUploadNode","imageHandling","disableImageAlignmentButtons","onDone","editor","_props$onDone","getHTML","onDelete","src","attrs","insertImageRequested","imageInfo","getHandler","_imageInfo","addedImage","onFinish","result","_cb","cb","onChange","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","markup","onUpdate","_ref4","transaction","isDone","_props$onChange","onBlur","_ref5","otherToolbarOpened","_toolbarOpened","isActive","_props$onChange2","_props$onDone2","useEffect","editorRef","setEditable","nextMarkup","commands","setContent","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';\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 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: props.responseAreaProps?.type,\n },\n languageCharacters: props.languageCharactersProps,\n keyPadCharacterRef: {},\n setKeypadInteraction: {},\n media: {},\n });\n }, [props]);\n\n const extensions = [\n TextAlign.configure({\n types: ['heading', 'paragraph', 'div', '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 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(props.responseAreaProps),\n ExplicitConstructedResponseNode.configure(props.responseAreaProps),\n DragInTheBlankNode.configure(props.responseAreaProps),\n InlineDropdownNode.configure(props.responseAreaProps),\n MathTemplatedNode.configure(props.responseAreaProps),\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: debounce(({ 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) {\n return;\n }\n\n if (props.markup !== editor.getHTML()) {\n props.onChange?.(editor.getHTML());\n }\n\n if (toolbarOptsToUse.doneOn === 'blur') {\n props.onDone?.(editor.getHTML());\n }\n }, 200),\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, 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 '& p.is-editor-empty, & div.is-editor-empty': {\n position: 'relative',\n },\n '& p.is-editor-empty::before, & div.is-editor-empty::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 '& > div:has(+ div)': {\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,qBA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CAAC,CAAC,UAAAE,KAAA;EAAA,IAAGP,aAAa,GAAAO,KAAA,CAAbP,aAAa;IAAEC,iBAAiB,GAAAM,KAAA,CAAjBN,iBAAiB;EAAA,OAAQ;IAC5CO,OAAO,EAAE,MAAM;IACfC,OAAO,EAAE,iBAAiB;IAC1B,gBAAgB,EAAAtN,aAAA,CAAAA,aAAA;MACduN,IAAI,EAAE,CAAC;MACPC,OAAO,EAAE,KAAK;MACdhB,SAAS,EAAE,OAAO;MAClBc,OAAO,EAAE,iBAAiB;MAC1B9M,QAAQ,EAAE,SAAS;MAEnB;MACA,gBAAgB,EAAE;QAChBiN,MAAM,EAAE;MACV,CAAC;MAED;MACA,4CAA4C,EAAE;QAC5CjN,QAAQ,EAAE;MACZ,CAAC;MACD,4DAA4D,EAAE;QAC5DsJ,OAAO,EAAE,wBAAwB;QACjCtJ,QAAQ,EAAE,UAAU;QACpBkN,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;QAChBvD,OAAO,EAAE,KAAK;QACdiE,QAAQ,EAAE,KAAK;QACfH,KAAK,EAAE;MACT;IACF,CAAC,GACGd,iBAAiB,IAAI;MACvB,oBAAoB,EAAE;QACpBkB,YAAY,EAAE;MAChB;IACF,CAAC;EAEL,CAAC;AAAA,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAA7M,OAAA,cAEWD,YAAY","ignoreList":[]}
@@ -22,20 +22,13 @@ var log = (0, _debug["default"])('@pie-lib:editable-html:image:insert-image-hand
22
22
  * @param {Boolean} isPasted - a boolean that keeps track if the file is pasted
23
23
  */
24
24
  var InsertImageHandler = /*#__PURE__*/function () {
25
- function InsertImageHandler(editor, node, onFinish) {
26
- var _this = this;
25
+ function InsertImageHandler(editor, nodeInfo, onFinish) {
27
26
  var isPasted = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
28
27
  (0, _classCallCheck2["default"])(this, InsertImageHandler);
29
28
  this.editor = editor;
30
- this.node = node;
31
- var nodePos;
32
- editor.state.doc.descendants(function (node, pos) {
33
- if (node === _this.node) {
34
- nodePos = pos;
35
- return false;
36
- }
37
- });
38
- this.nodePos = nodePos;
29
+ this.nodeInfo = nodeInfo;
30
+ this.node = nodeInfo[0];
31
+ this.nodePos = nodeInfo[1];
39
32
  this.onFinish = onFinish;
40
33
  this.isPasted = isPasted;
41
34
  this.chosenFile = null;
@@ -103,7 +96,7 @@ var InsertImageHandler = /*#__PURE__*/function () {
103
96
  }, {
104
97
  key: "fileChosen",
105
98
  value: function fileChosen(file) {
106
- var _this2 = this;
99
+ var _this = this;
107
100
  if (!file) {
108
101
  return;
109
102
  }
@@ -115,7 +108,7 @@ var InsertImageHandler = /*#__PURE__*/function () {
115
108
  var reader = new FileReader();
116
109
  reader.onload = function () {
117
110
  var dataURL = reader.result;
118
- _this2.updateNode({
111
+ _this.updateNode({
119
112
  src: dataURL
120
113
  });
121
114
  };
@@ -1 +1 @@
1
- {"version":3,"file":"InsertImageHandler.js","names":["_debug","_interopRequireDefault","require","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","log","debug","InsertImageHandler","editor","node","onFinish","_this","isPasted","undefined","_classCallCheck2","nodePos","state","doc","descendants","pos","chosenFile","_createClass2","key","value","cancel","deleteNode","err","_insertingImage","updateNode","newAttrs","_this$editor","view","tr","nodeAt","transaction","setNodeMarkup","attrs","dispatch","_this$editor2","nodeSize","done","src","console","loaded","percent","fileChosen","file","_this2","reader","FileReader","onload","dataURL","result","readAsDataURL","progress","bytes","total","getChosenFile","_default","exports"],"sources":["../../../src/components/image/InsertImageHandler.js"],"sourcesContent":["import debug from 'debug';\n\nconst log = debug('@pie-lib:editable-html:image:insert-image-handler');\n\n/**\n * Handles user selection, insertion (or cancellation) of an image into the editor.\n * @param {Block} placeholderBlock - a block that has been added to the editor as a place holder for the image\n * @param {Function} onFinish - a function to call if uploading fails or succeeds\n * @param {Function} getValue - a function to return the value of the editor\n * @param {Function} onChange - callback to notify changes applied by the handler\n * @param {Boolean} isPasted - a boolean that keeps track if the file is pasted\n */\nclass InsertImageHandler {\n constructor(editor, node, onFinish, isPasted = false) {\n this.editor = editor;\n this.node = node;\n\n let nodePos;\n\n editor.state.doc.descendants((node, pos) => {\n if (node === this.node) {\n nodePos = pos;\n return false;\n }\n });\n\n this.nodePos = nodePos;\n this.onFinish = onFinish;\n this.isPasted = isPasted;\n this.chosenFile = null;\n }\n\n cancel() {\n log('insert cancelled');\n\n try {\n this.deleteNode();\n this.onFinish(false);\n } catch (err) {\n //\n } finally {\n this.editor._insertingImage = false;\n }\n }\n\n updateNode(newAttrs) {\n const { state, view } = this.editor;\n const { tr } = state;\n const node = state.doc.nodeAt(this.nodePos);\n\n if (node) {\n const transaction = tr.setNodeMarkup(this.nodePos, undefined, { ...node.attrs, ...newAttrs });\n\n view.dispatch(transaction);\n }\n }\n\n deleteNode() {\n const { state, view } = this.editor;\n const { tr } = state;\n\n const transaction = tr.delete(this.nodePos, this.nodePos + this.node.nodeSize);\n\n view.dispatch(transaction);\n }\n\n done(err, src) {\n log('done: err:', err);\n if (err) {\n //eslint-disable-next-line\n console.log(err);\n this.onFinish(false);\n } else {\n this.updateNode({ loaded: true, src, percent: 100 });\n this.onFinish(true);\n }\n\n this.editor._insertingImage = false;\n }\n\n /**\n * Notify handler that the user chose a file - will create a change with a preview in the editor.\n *\n * @param {File} file - the file that the user chose using a file input.\n */\n fileChosen(file) {\n if (!file) {\n return;\n }\n\n // Save the chosen file to this.chosenFile\n this.chosenFile = file;\n this.editor._insertingImage = false;\n\n log('[fileChosen] file: ', file);\n const reader = new FileReader();\n reader.onload = () => {\n const dataURL = reader.result;\n\n this.updateNode({ src: dataURL });\n };\n reader.readAsDataURL(file);\n }\n\n progress(percent, bytes, total) {\n log('progress: ', percent, bytes, total);\n this.updateNode({ percent });\n }\n\n // Add a getter method to retrieve the chosen file\n getChosenFile() {\n return this.chosenFile;\n }\n}\n\nexport default InsertImageHandler;\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA0B,SAAAC,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAAJ,CAAA;AAAA,SAAAU,cAAAZ,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAY,SAAA,CAAAC,MAAA,EAAAb,CAAA,UAAAC,CAAA,WAAAW,SAAA,CAAAZ,CAAA,IAAAY,SAAA,CAAAZ,CAAA,QAAAA,CAAA,OAAAF,OAAA,CAAAI,MAAA,CAAAD,CAAA,OAAAa,OAAA,WAAAd,CAAA,QAAAe,gBAAA,aAAAhB,CAAA,EAAAC,CAAA,EAAAC,CAAA,CAAAD,CAAA,SAAAE,MAAA,CAAAc,yBAAA,GAAAd,MAAA,CAAAe,gBAAA,CAAAlB,CAAA,EAAAG,MAAA,CAAAc,yBAAA,CAAAf,CAAA,KAAAH,OAAA,CAAAI,MAAA,CAAAD,CAAA,GAAAa,OAAA,WAAAd,CAAA,IAAAE,MAAA,CAAAgB,cAAA,CAAAnB,CAAA,EAAAC,CAAA,EAAAE,MAAA,CAAAK,wBAAA,CAAAN,CAA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"version":3,"file":"InsertImageHandler.js","names":["_debug","_interopRequireDefault","require","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","log","debug","InsertImageHandler","editor","nodeInfo","onFinish","isPasted","undefined","_classCallCheck2","node","nodePos","chosenFile","_createClass2","key","value","cancel","deleteNode","err","_insertingImage","updateNode","newAttrs","_this$editor","state","view","tr","doc","nodeAt","transaction","setNodeMarkup","attrs","dispatch","_this$editor2","nodeSize","done","src","console","loaded","percent","fileChosen","file","_this","reader","FileReader","onload","dataURL","result","readAsDataURL","progress","bytes","total","getChosenFile","_default","exports"],"sources":["../../../src/components/image/InsertImageHandler.js"],"sourcesContent":["import debug from 'debug';\n\nconst log = debug('@pie-lib:editable-html:image:insert-image-handler');\n\n/**\n * Handles user selection, insertion (or cancellation) of an image into the editor.\n * @param {Block} placeholderBlock - a block that has been added to the editor as a place holder for the image\n * @param {Function} onFinish - a function to call if uploading fails or succeeds\n * @param {Function} getValue - a function to return the value of the editor\n * @param {Function} onChange - callback to notify changes applied by the handler\n * @param {Boolean} isPasted - a boolean that keeps track if the file is pasted\n */\nclass InsertImageHandler {\n constructor(editor, nodeInfo, onFinish, isPasted = false) {\n this.editor = editor;\n this.nodeInfo = nodeInfo;\n this.node = nodeInfo[0];\n this.nodePos = nodeInfo[1];\n this.onFinish = onFinish;\n this.isPasted = isPasted;\n this.chosenFile = null;\n }\n\n cancel() {\n log('insert cancelled');\n\n try {\n this.deleteNode();\n this.onFinish(false);\n } catch (err) {\n //\n } finally {\n this.editor._insertingImage = false;\n }\n }\n\n updateNode(newAttrs) {\n const { state, view } = this.editor;\n const { tr } = state;\n const node = state.doc.nodeAt(this.nodePos);\n\n if (node) {\n const transaction = tr.setNodeMarkup(this.nodePos, undefined, { ...node.attrs, ...newAttrs });\n\n view.dispatch(transaction);\n }\n }\n\n deleteNode() {\n const { state, view } = this.editor;\n const { tr } = state;\n\n const transaction = tr.delete(this.nodePos, this.nodePos + this.node.nodeSize);\n\n view.dispatch(transaction);\n }\n\n done(err, src) {\n log('done: err:', err);\n if (err) {\n //eslint-disable-next-line\n console.log(err);\n this.onFinish(false);\n } else {\n this.updateNode({ loaded: true, src, percent: 100 });\n this.onFinish(true);\n }\n\n this.editor._insertingImage = false;\n }\n\n /**\n * Notify handler that the user chose a file - will create a change with a preview in the editor.\n *\n * @param {File} file - the file that the user chose using a file input.\n */\n fileChosen(file) {\n if (!file) {\n return;\n }\n\n // Save the chosen file to this.chosenFile\n this.chosenFile = file;\n this.editor._insertingImage = false;\n\n log('[fileChosen] file: ', file);\n const reader = new FileReader();\n reader.onload = () => {\n const dataURL = reader.result;\n\n this.updateNode({ src: dataURL });\n };\n reader.readAsDataURL(file);\n }\n\n progress(percent, bytes, total) {\n log('progress: ', percent, bytes, total);\n this.updateNode({ percent });\n }\n\n // Add a getter method to retrieve the chosen file\n getChosenFile() {\n return this.chosenFile;\n }\n}\n\nexport default InsertImageHandler;\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA0B,SAAAC,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAAJ,CAAA;AAAA,SAAAU,cAAAZ,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAY,SAAA,CAAAC,MAAA,EAAAb,CAAA,UAAAC,CAAA,W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,KAAK,CAAC;MACxC,IAAI,CAAC9B,UAAU,CAAC;QAAEkB,OAAO,EAAPA;MAAQ,CAAC,CAAC;IAC9B;;IAEA;EAAA;IAAAxB,GAAA;IAAAC,KAAA,EACA,SAAAoC,aAAaA,CAAA,EAAG;MACd,OAAO,IAAI,CAACvC,UAAU;IACxB;EAAC;AAAA;AAAA,IAAAwC,QAAA,GAAAC,OAAA,cAGYlD,kBAAkB","ignoreList":[]}
@@ -22,6 +22,14 @@ var DivNode = exports.DivNode = _core.Node.create({
22
22
  },
23
23
  addKeyboardShortcuts: function addKeyboardShortcuts() {
24
24
  var _this = this;
25
+ var isInsideListItem = function isInsideListItem($from) {
26
+ for (var depth = $from.depth; depth >= 0; depth -= 1) {
27
+ if ($from.node(depth).type.name === 'listItem') {
28
+ return true;
29
+ }
30
+ }
31
+ return false;
32
+ };
25
33
  return {
26
34
  Enter: function Enter() {
27
35
  var state = _this.editor.state;
@@ -29,6 +37,9 @@ var DivNode = exports.DivNode = _core.Node.create({
29
37
  if ($from.parent.type.name !== 'div') {
30
38
  return false;
31
39
  }
40
+ if (isInsideListItem($from)) {
41
+ return false;
42
+ }
32
43
  return _this.editor.chain().focus().setNode('paragraph') // current div becomes <p>
33
44
  .splitBlock() // create another <p>
34
45
  .run();
@@ -58,9 +69,6 @@ var DivNode = exports.DivNode = _core.Node.create({
58
69
  if (parentText.length === 0) {
59
70
  return state.doc.childCount === 1 ? true : false;
60
71
  }
61
-
62
- // one character left and cursor is after it — delete
63
- // only that character and stop, preventing the block-join that fires Enter.
64
72
  if (parentText.length === 1 && $from.parentOffset === 1) {
65
73
  var tr = state.tr;
66
74
  tr["delete"]($from.pos - 1, $from.pos);
@@ -1 +1 @@
1
- {"version":3,"file":"div-node.js","names":["_core","require","DivNode","exports","Node","create","name","group","content","parseHTML","tag","renderHTML","_ref","HTMLAttributes","addKeyboardShortcuts","_this","Enter","state","editor","$from","selection","parent","type","chain","focus","setNode","splitBlock","run","Backspace","_state$selection","selectionEmpty","empty","parentText","textContent","length","doc","childCount","parentOffset","tr","pos","view","dispatch"],"sources":["../../src/extensions/div-node.js"],"sourcesContent":["// DivNode.ts\nimport { Node } from '@tiptap/core';\n\nexport const DivNode = Node.create({\n name: 'div',\n group: 'block',\n content: 'inline*',\n\n parseHTML() {\n return [{ tag: 'div' }];\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['div', HTMLAttributes, 0];\n },\n\n addKeyboardShortcuts() {\n return {\n Enter: () => {\n const { state } = this.editor;\n const { $from } = state.selection;\n\n if ($from.parent.type.name !== 'div') {\n return false;\n }\n\n return this.editor\n .chain()\n .focus()\n .setNode('paragraph') // current div becomes <p>\n .splitBlock() // create another <p>\n .run();\n },\n\n // When the cursor is in a div and the user presses Backspace,\n // ProseMirror's default handler may try to join/delete the block node\n // once it becomes empty. That triggers the Enter shortcut above\n // (div → p conversion + split), making it look like a new line is\n // inserted instead of deleting.\n // We handle two cases explicitly:\n // 1. The div already IS empty → swallow the event (nothing to delete).\n // 2. The div has exactly ONE character left → delete just that character\n // using a precise transaction, then stop. This prevents ProseMirror\n // from following up with a block-join that triggers the Enter handler.\n Backspace: () => {\n const { state } = this.editor;\n const { $from, empty: selectionEmpty } = state.selection;\n\n if ($from.parent.type.name !== 'div') {\n return false;\n }\n\n if (!selectionEmpty) {\n return false;\n }\n\n const parentText = $from.parent.textContent;\n\n if (parentText.length === 0) {\n return state.doc.childCount === 1 ? true : false;\n }\n\n // one character left and cursor is after it — delete\n // only that character and stop, preventing the block-join that fires Enter.\n if (parentText.length === 1 && $from.parentOffset === 1) {\n const { tr } = state;\n tr.delete($from.pos - 1, $from.pos);\n this.editor.view.dispatch(tr);\n return true;\n }\n\n return false;\n },\n };\n },\n});\n"],"mappings":";;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AADA;;AAGO,IAAMC,OAAO,GAAAC,OAAA,CAAAD,OAAA,GAAGE,UAAI,CAACC,MAAM,CAAC;EACjCC,IAAI,EAAE,KAAK;EACXC,KAAK,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AAE;UACnB,OAAO,KAAK;QACd;QAEA,IAAME,UAAU,GAAGb,KAAK,CAACE,MAAM,CAACY,WAAW;QAE3C,IAAID,UAAU,CAACE,MAAM,KAAK,CAAC,EAAE;UAC3B,OAAOjB,KAAK,CAACkB,GAAG,CAACC,UAAU,KAAK,CAAC,GAAG,IAAI,GAAG,KAAK;QAClD;;QAEA;QACA;QACA,IAAIJ,UAAU,CAACE,MAAM,KAAK,CAAC,IAAIf,KAAK,CAACkB,YAAY,KAAK,CAAC,EAAE;UACvD,IAAQC,EAAE,GAAKrB,KAAK,CAAZqB,EAAE;UACVA,EAAE,UAAO,CAACnB,KAAK,CAACoB,GAAG,GAAG,CAAC,EAAEpB,KAAK,CAACoB,GAAG,CAAC;UACnCxB,KAAI,CAACG,MAAM,CAACsB,IAAI,CAACC,QAAQ,CAACH,EAAE,CAAC;UAC7B,OAAO,IAAI;QACb;QAEA,OAAO,KAAK;MACd;IACF,CAAC;EACH;AACF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"div-node.js","names":["_core","require","DivNode","exports","Node","create","name","group","content","parseHTML","tag","renderHTML","_ref","HTMLAttributes","addKeyboardShortcuts","_this","isInsideListItem","$from","depth","node","type","Enter","state","editor","selection","parent","chain","focus","setNode","splitBlock","run","Backspace","_state$selection","selectionEmpty","empty","parentText","textContent","length","doc","childCount","parentOffset","tr","pos","view","dispatch"],"sources":["../../src/extensions/div-node.js"],"sourcesContent":["// DivNode.ts\nimport { Node } from '@tiptap/core';\n\nexport const DivNode = Node.create({\n name: 'div',\n group: 'block',\n content: 'inline*',\n\n parseHTML() {\n return [{ tag: 'div' }];\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['div', HTMLAttributes, 0];\n },\n\n addKeyboardShortcuts() {\n const isInsideListItem = ($from) => {\n for (let depth = $from.depth; depth >= 0; depth -= 1) {\n if ($from.node(depth).type.name === 'listItem') {\n return true;\n }\n }\n return false;\n };\n\n return {\n Enter: () => {\n const { state } = this.editor;\n const { $from } = state.selection;\n\n if ($from.parent.type.name !== 'div') {\n return false;\n }\n if (isInsideListItem($from)) {\n return false;\n }\n\n return this.editor\n .chain()\n .focus()\n .setNode('paragraph') // current div becomes <p>\n .splitBlock() // create another <p>\n .run();\n },\n\n // When the cursor is in a div and the user presses Backspace,\n // ProseMirror's default handler may try to join/delete the block node\n // once it becomes empty. That triggers the Enter shortcut above\n // (div → p conversion + split), making it look like a new line is\n // inserted instead of deleting.\n // We handle two cases explicitly:\n // 1. The div already IS empty → swallow the event (nothing to delete).\n // 2. The div has exactly ONE character left → delete just that character\n // using a precise transaction, then stop. This prevents ProseMirror\n // from following up with a block-join that triggers the Enter handler.\n Backspace: () => {\n const { state } = this.editor;\n const { $from, empty: selectionEmpty } = state.selection;\n\n if ($from.parent.type.name !== 'div') {\n return false;\n }\n\n if (!selectionEmpty) {\n return false;\n }\n\n const parentText = $from.parent.textContent;\n\n if (parentText.length === 0) {\n return state.doc.childCount === 1 ? true : false;\n }\n\n if (parentText.length === 1 && $from.parentOffset === 1) {\n const { tr } = state;\n tr.delete($from.pos - 1, $from.pos);\n this.editor.view.dispatch(tr);\n return true;\n }\n\n return false;\n },\n };\n },\n});\n"],"mappings":";;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AADA;;AAGO,IAAMC,OAAO,GAAAC,OAAA,CAAAD,OAAA,GAAGE,UAAI,CAACC,MAAM,CAAC;EACjCC,IAAI,EAAE,KAAK;EACXC,KAAK,EAAE,OAAO;EACdC,OAAO,EAAE,SAAS;EAElBC,SAAS,WAATA,SAASA,CAAA,EAAG;IACV,OAAO,CAAC;MAAEC,GAAG,EAAE;IAAM,CAAC,CAAC;EACzB,CAAC;EAEDC,UAAU,WAAVA,UAAUA,CAAAC,IAAA,EAAqB;IAAA,IAAlBC,cAAc,GAAAD,IAAA,CAAdC,cAAc;IACzB,OAAO,CAAC,KAAK,EAAEA,cAAc,EAAE,CAAC,CAAC;EACnC,CAAC;EAEDC,oBAAoB,WAApBA,oBAAo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AK,EAAE;UACpC,OAAO,KAAK;QACd;QAEA,IAAI,CAAC2B,cAAc,EAAE;UACnB,OAAO,KAAK;QACd;QAEA,IAAME,UAAU,GAAGlB,KAAK,CAACQ,MAAM,CAACW,WAAW;QAE3C,IAAID,UAAU,CAACE,MAAM,KAAK,CAAC,EAAE;UAC3B,OAAOf,KAAK,CAACgB,GAAG,CAACC,UAAU,KAAK,CAAC,GAAG,IAAI,GAAG,KAAK;QAClD;QAEA,IAAIJ,UAAU,CAACE,MAAM,KAAK,CAAC,IAAIpB,KAAK,CAACuB,YAAY,KAAK,CAAC,EAAE;UACvD,IAAQC,EAAE,GAAKnB,KAAK,CAAZmB,EAAE;UACVA,EAAE,UAAO,CAACxB,KAAK,CAACyB,GAAG,GAAG,CAAC,EAAEzB,KAAK,CAACyB,GAAG,CAAC;UACnC3B,KAAI,CAACQ,MAAM,CAACoB,IAAI,CAACC,QAAQ,CAACH,EAAE,CAAC;UAC7B,OAAO,IAAI;QACb;QAEA,OAAO,KAAK;MACd;IACF,CAAC;EACH;AACF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.EnsureListItemContentIsDiv = void 0;
7
+ var _core = require("@tiptap/core");
8
+ var _state = require("@tiptap/pm/state");
9
+ /**
10
+ * Some list operations preserve/create `paragraph` children in `listItem`.
11
+ * Normalize direct `listItem > paragraph` children into `div` so list content
12
+ * stays consistent with DivNode-based editing.
13
+ */
14
+ var EnsureListItemContentIsDiv = exports.EnsureListItemContentIsDiv = _core.Extension.create({
15
+ name: 'ensureListItemContentIsDiv',
16
+ addProseMirrorPlugins: function addProseMirrorPlugins() {
17
+ var key = new _state.PluginKey(this.name);
18
+ return [new _state.Plugin({
19
+ key: key,
20
+ appendTransaction: function appendTransaction(transactions, _oldState, newState) {
21
+ if (!transactions.some(function (tr) {
22
+ return tr.docChanged;
23
+ })) {
24
+ return null;
25
+ }
26
+ var doc = newState.doc,
27
+ schema = newState.schema;
28
+ var divType = schema.nodes.div;
29
+ if (!divType) {
30
+ return null;
31
+ }
32
+ var positionsToConvert = [];
33
+ doc.descendants(function (node, pos) {
34
+ if (node.type.name !== 'listItem') {
35
+ return;
36
+ }
37
+ var childOffset = 1;
38
+ node.forEach(function (child) {
39
+ if (child.type.name === 'paragraph') {
40
+ positionsToConvert.push({
41
+ pos: pos + childOffset,
42
+ attrs: child.attrs
43
+ });
44
+ }
45
+ childOffset += child.nodeSize;
46
+ });
47
+ });
48
+ if (positionsToConvert.length === 0) {
49
+ return null;
50
+ }
51
+ var tr = newState.tr;
52
+ positionsToConvert.sort(function (a, b) {
53
+ return b.pos - a.pos;
54
+ }).forEach(function (_ref) {
55
+ var pos = _ref.pos,
56
+ attrs = _ref.attrs;
57
+ return tr.setNodeMarkup(pos, divType, attrs);
58
+ });
59
+ return tr;
60
+ }
61
+ })];
62
+ }
63
+ });
64
+ //# sourceMappingURL=ensure-list-item-content-is-div.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ensure-list-item-content-is-div.js","names":["_core","require","_state","EnsureListItemContentIsDiv","exports","Extension","create","name","addProseMirrorPlugins","key","PluginKey","Plugin","appendTransaction","transactions","_oldState","newState","some","tr","docChanged","doc","schema","divType","nodes","div","positionsToConvert","descendants","node","pos","type","childOffset","forEach","child","push","attrs","nodeSize","length","sort","a","b","_ref","setNodeMarkup"],"sources":["../../src/extensions/ensure-list-item-content-is-div.js"],"sourcesContent":["import { Extension } from '@tiptap/core';\nimport { Plugin, PluginKey } from '@tiptap/pm/state';\n\n/**\n * Some list operations preserve/create `paragraph` children in `listItem`.\n * Normalize direct `listItem > paragraph` children into `div` so list content\n * stays consistent with DivNode-based editing.\n */\nexport const EnsureListItemContentIsDiv = Extension.create({\n name: 'ensureListItemContentIsDiv',\n\n addProseMirrorPlugins() {\n const key = new PluginKey(this.name);\n\n return [\n new Plugin({\n key,\n appendTransaction(transactions, _oldState, newState) {\n if (!transactions.some((tr) => tr.docChanged)) {\n return null;\n }\n\n const { doc, schema } = newState;\n const divType = schema.nodes.div;\n if (!divType) {\n return null;\n }\n\n const positionsToConvert = [];\n\n doc.descendants((node, pos) => {\n if (node.type.name !== 'listItem') {\n return;\n }\n\n let childOffset = 1;\n node.forEach((child) => {\n if (child.type.name === 'paragraph') {\n positionsToConvert.push({\n pos: pos + childOffset,\n attrs: child.attrs,\n });\n }\n childOffset += child.nodeSize;\n });\n });\n\n if (positionsToConvert.length === 0) {\n return null;\n }\n\n const tr = newState.tr;\n positionsToConvert\n .sort((a, b) => b.pos - a.pos)\n .forEach(({ pos, attrs }) => tr.setNodeMarkup(pos, divType, attrs));\n\n return tr;\n },\n }),\n ];\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACA;AACO,IAAME,0BAA0B,GAAAC,OAAA,CAAAD,0BAAA,GAAGE,eAAS,CAACC,MAAM,CAAC;EACzDC,IAAI,EAAE,4BAA4B;EAElCC,qBAAqB,WAArBA,qBAAqBA,CAAA,EAAG;IACtB,IAAMC,GAAG,GAAG,IAAIC,gBAAS,CAAC,IAAI,CAACH,IAAI,CAAC;IAEpC,OAAO,CACL,IAAII,aAAM,CAAC;MACTF,GAAG,EAAHA,GAAG;MACHG,iBAAiB,WAAjBA,iBAAiBA,CAACC,YAAY,EAAEC,SAAS,EAAEC,QAAQ,EAAE;QACnD,IAAI,CAACF,YAAY,CAACG,IAAI,CAAC,UAACC,EAAE;UAAA,OAAKA,EAAE,CAACC,UAAU;QAAA,EAAC,EAAE;UAC7C,OAAO,IAAI;QACb;QAEA,IAAQC,GAAG,GAAaJ,QAAQ,CAAxBI,GAAG;UAAEC,MAAM,GAAKL,QAAQ,CAAnBK,MAAM;QACnB,IAAMC,OAAO,GAAGD,MAAM,CAACE,KAAK,CAACC,GAAG;QAChC,IAAI,CAACF,OAAO,EAAE;UACZ,OAAO,IAAI;QACb;QAEA,IAAMG,kBAAkB,GAAG,EAAE;QAE7BL,GAAG,CAACM,WAAW,CAAC,UAACC,IAAI,EAAEC,GAAG,EAAK;UAC7B,IAAID,IAAI,CAACE,IAAI,CAACrB,IAAI,KAAK,UAAU,EAAE;YACjC;UACF;UAEA,IAAIsB,WAAW,GAAG,CAAC;UACnBH,IAAI,CAACI,OAAO,CAAC,UAACC,KAAK,EAAK;YACtB,IAAIA,KAAK,CAACH,IAAI,CAACrB,IAAI,KAAK,WAAW,EAAE;cACnCiB,kBAAkB,CAACQ,IAAI,CAAC;gBACtBL,GAAG,EAAEA,GAAG,GAAGE,WAAW;gBACtBI,KAAK,EAAEF,KAAK,CAACE;cACf,CAAC,CAAC;YACJ;YACAJ,WAAW,IAAIE,KAAK,CAACG,QAAQ;UAC/B,CAAC,CAAC;QACJ,CAAC,CAAC;QAEF,IAAIV,kBAAkB,CAACW,MAAM,KAAK,CAAC,EAAE;UACnC,OAAO,IAAI;QACb;QAEA,IAAMlB,EAAE,GAAGF,QAAQ,CAACE,EAAE;QACtBO,kBAAkB,CACfY,IAAI,CAAC,UAACC,CAAC,EAAEC,CAAC;UAAA,OAAKA,CAAC,CAACX,GAAG,GAAGU,CAAC,CAACV,GAAG;QAAA,EAAC,CAC7BG,OAAO,CAAC,UAAAS,IAAA;UAAA,IAAGZ,GAAG,GAAAY,IAAA,CAAHZ,GAAG;YAAEM,KAAK,GAAAM,IAAA,CAALN,KAAK;UAAA,OAAOhB,EAAE,CAACuB,aAAa,CAACb,GAAG,EAAEN,OAAO,EAAEY,KAAK,CAAC;QAAA,EAAC;QAErE,OAAOhB,EAAE;MACX;IACF,CAAC,CAAC,CACH;EACH;AACF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ExtendedListItem = void 0;
7
+ var _extensionListItem = require("@tiptap/extension-list-item");
8
+ /**
9
+ * Default list items use `paragraph block*`, so empty/new items become `<p>`.
10
+ * Prefer `div` first to keep consistency with DivNode at root and table cells.
11
+ */
12
+ var ExtendedListItem = exports.ExtendedListItem = _extensionListItem.ListItem.extend({
13
+ content: '(div | paragraph | heading | bulletList | orderedList | blockquote | codeBlock | horizontalRule | image | imageUploadNode)+'
14
+ });
15
+ //# sourceMappingURL=extended-list-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extended-list-item.js","names":["_extensionListItem","require","ExtendedListItem","exports","ListItem","extend","content"],"sources":["../../src/extensions/extended-list-item.js"],"sourcesContent":["import { ListItem } from '@tiptap/extension-list-item';\n\n/**\n * Default list items use `paragraph block*`, so empty/new items become `<p>`.\n * Prefer `div` first to keep consistency with DivNode at root and table cells.\n */\nexport const ExtendedListItem = ListItem.extend({\n content:\n '(div | paragraph | heading | bulletList | orderedList | blockquote | codeBlock | horizontalRule | image | imageUploadNode)+',\n});\n"],"mappings":";;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACO,IAAMC,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAGE,2BAAQ,CAACC,MAAM,CAAC;EAC9CC,OAAO,EACL;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -123,15 +123,35 @@ function ImageComponent(props) {
123
123
  var floored = width / imgRef.current.naturalWidth * 4;
124
124
  return parseInt(floored.toFixed(0) * 25, 10);
125
125
  }, []);
126
+ var findNodePos = (0, _react.useCallback)(function () {
127
+ var key = latestNodeRef.current.attrs.nodeKey;
128
+ var found = null;
129
+ editor.state.doc.descendants(function (n, pos) {
130
+ if (found !== null) return false;
131
+ if (n.type.name === 'imageUploadNode' && n.attrs.nodeKey === key) {
132
+ found = pos;
133
+ return false;
134
+ }
135
+ });
136
+ return found;
137
+ }, [editor]);
138
+
139
+ // dispatch an attribute update targeted precisely at this node by nodeKey.
140
+ var updateThisNode = (0, _react.useCallback)(function (newAttrs) {
141
+ var nodePos = findNodePos();
142
+ if (nodePos === null) return;
143
+ var currentNode = editor.state.doc.nodeAt(nodePos);
144
+ if (!currentNode) return;
145
+ editor.view.dispatch(editor.state.tr.setNodeMarkup(nodePos, undefined, _objectSpread(_objectSpread({}, currentNode.attrs), newAttrs)));
146
+ }, [editor, findNodePos]);
126
147
  var applySizeData = (0, _react.useCallback)(function () {
127
148
  if (!node.attrs.width || !imgRef.current) return;
128
- var update = _objectSpread(_objectSpread({}, node.attrs), {}, {
129
- resizePercent: getPercentFromWidth(node.attrs.width)
149
+ var resizePercent = getPercentFromWidth(node.attrs.width);
150
+ if (node.attrs.resizePercent === resizePercent) return;
151
+ updateThisNode({
152
+ resizePercent: resizePercent
130
153
  });
131
- if (!(0, _isEqual["default"])(update, node.attrs)) {
132
- editor.commands.updateAttributes('imageUploadNode', update);
133
- }
134
- }, [editor, node.attrs, getPercentFromWidth]);
154
+ }, [node.attrs.width, node.attrs.resizePercent, getPercentFromWidth, updateThisNode]);
135
155
 
136
156
  // keep ref in sync with latest node
137
157
  (0, _react.useEffect)(function () {
@@ -149,8 +169,8 @@ function ImageComponent(props) {
149
169
  // would otherwise call insertImageRequested again and reopen the file modal.
150
170
  var hasImageSrc = String((_node$attrs$src = (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.src) !== null && _node$attrs$src !== void 0 ? _node$attrs$src : '').trim();
151
171
  if (!hasImageSrc && (_options$imageHandlin = options.imageHandling) !== null && _options$imageHandlin !== void 0 && _options$imageHandlin.insertImageRequested) {
152
- options.imageHandling.insertImageRequested(editor, latestNodeRef.current, function (finish) {
153
- return new _InsertImageHandler["default"](editor, latestNodeRef.current, finish);
172
+ options.imageHandling.insertImageRequested(editor, [node, pos], function (finish) {
173
+ return new _InsertImageHandler["default"](editor, [node, pos], finish);
154
174
  });
155
175
  }
156
176
  setShowToolbar(selected);
@@ -158,7 +178,7 @@ function ImageComponent(props) {
158
178
  } else {
159
179
  setShowToolbar(selected);
160
180
  }
161
- }, [editor, node, selected]);
181
+ }, [editor, node, pos, selected]);
162
182
  (0, _react.useEffect)(function () {
163
183
  applySizeData();
164
184
  var resizeHandle = resizeRef.current;
@@ -186,11 +206,14 @@ function ImageComponent(props) {
186
206
  width: w,
187
207
  height: h
188
208
  };
189
- if (!(0, _isEqual["default"])(update, node.attrs)) {
190
- editor.commands.updateAttributes('imageUploadNode', update);
209
+ if (!(0, _isEqual["default"])(update, {
210
+ width: node.attrs.width,
211
+ height: node.attrs.height
212
+ })) {
213
+ updateThisNode(update);
191
214
  }
192
215
  }
193
- }, [editor, node.attrs, maxImageWidth, maxImageHeight]);
216
+ }, [node.attrs.width, node.attrs.height, maxImageWidth, maxImageHeight, updateThisNode]);
194
217
  var updateAspect = function updateAspect(initial, next) {
195
218
  var keepAspect = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
196
219
  var resizeType = arguments.length > 3 ? arguments[3] : undefined;
@@ -222,34 +245,15 @@ function ImageComponent(props) {
222
245
  if (next.width > 50 && next.height > 50 && next.width <= 700 && next.height <= 900) {
223
246
  box.style.width = "".concat(next.width, "px");
224
247
  box.style.height = "".concat(next.height, "px");
225
- var update = {
248
+ updateThisNode({
226
249
  width: next.width,
227
250
  height: next.height
228
- };
229
- if (!(0, _isEqual["default"])(update, node.attrs)) {
230
- editor.commands.updateAttributes('imageUploadNode', update);
231
- }
251
+ });
232
252
  }
233
- }, [editor, node.attrs]);
234
-
235
- // Helper to find this node's current position in the doc.
236
- // We cannot use object identity (n === node) because ProseMirror replaces
237
- // node objects after every transaction — match by src instead.
238
- var findNodePos = (0, _react.useCallback)(function () {
239
- var found = null;
240
- var src = latestNodeRef.current.attrs.src;
241
- editor.state.doc.descendants(function (n, pos) {
242
- if (found !== null) return false;
243
- if (n.type.name === 'imageUploadNode' && n.attrs.src === src) {
244
- found = pos;
245
- return false;
246
- }
247
- });
248
- return found;
249
- }, [editor]);
253
+ }, [editor, updateThisNode]);
250
254
  var onChange = (0, _react.useCallback)(function (newValues) {
251
- editor.commands.updateAttributes('imageUploadNode', newValues);
252
- }, [editor]);
255
+ updateThisNode(newValues);
256
+ }, [editor, updateThisNode]);
253
257
  var stopResize = (0, _react.useCallback)(function () {
254
258
  window.removeEventListener('mousemove', startResize);
255
259
  window.removeEventListener('mouseup', stopResize);