@wazobiatech/wazui 1.0.17 → 1.0.19
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.
- package/dist/{PictureBlot-QqbDlqEB.cjs → PictureBlot-C3zTKmbF.cjs} +2 -2
- package/dist/{PictureBlot-QqbDlqEB.cjs.map → PictureBlot-C3zTKmbF.cjs.map} +1 -1
- package/dist/{PictureBlot-Dpnfeyh1.js → PictureBlot-MSfDN8pZ.js} +2 -2
- package/dist/{PictureBlot-Dpnfeyh1.js.map → PictureBlot-MSfDN8pZ.js.map} +1 -1
- package/dist/components/wazui/WazUiGqlMediaLibrary/WazUiGqlLibraryEditMedia.d.ts.map +1 -1
- package/dist/{index-BCabOGpR.js → index-BRNhIADp.js} +86 -71
- package/dist/index-BRNhIADp.js.map +4 -0
- package/dist/{index-CcBBE5LY.cjs → index-rT8s8Gwo.cjs} +6 -6
- package/dist/index-rT8s8Gwo.cjs.map +4 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{quill-PvsOhjHv.cjs → quill-5Qs-5M5I.cjs} +2 -2
- package/dist/{quill-PvsOhjHv.cjs.map → quill-5Qs-5M5I.cjs.map} +1 -1
- package/dist/{quill-B03-p0rP.js → quill-Cf8RoCN5.js} +2 -2
- package/dist/{quill-B03-p0rP.js.map → quill-Cf8RoCN5.js.map} +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/index-BCabOGpR.js.map +0 -4
- package/dist/index-CcBBE5LY.cjs.map +0 -4
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";"use strict";var g=Object.defineProperty;var b=(d,a,s)=>a in d?g(d,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):d[a]=s;var y=(d,a,s)=>b(d,typeof a!="symbol"?a+"":a,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=async()=>{if(typeof window>"u")return null;try{const a=(await Promise.resolve().then(()=>require("./quill-
|
|
2
|
-
//# sourceMappingURL=PictureBlot-
|
|
1
|
+
"use client";"use strict";var g=Object.defineProperty;var b=(d,a,s)=>a in d?g(d,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):d[a]=s;var y=(d,a,s)=>b(d,typeof a!="symbol"?a+"":a,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=async()=>{if(typeof window>"u")return null;try{const a=(await Promise.resolve().then(()=>require("./quill-5Qs-5M5I.cjs"))).default.import("blots/block/embed");class s extends a{static create(r){const p=document.createElement("div");p.className="ql-picture-container",p.style.margin="1em 0";const o=document.createElement("picture");r.sources.forEach(e=>{const i=document.createElement("source");i.setAttribute("media",e.media),i.setAttribute("srcset",e.srcset),i.setAttribute("type",e.type),o.appendChild(i)});const l=document.createElement("img");l.setAttribute("src",r.fallbackSrc),l.setAttribute("alt",r.alt),l.setAttribute("loading","lazy"),l.style.maxWidth="100%",l.style.height="auto",o.appendChild(l);const u=document.createElement("div");u.className="ql-picture-caption-wrapper",u.style.position="relative";const t=document.createElement("div");t.className="ql-picture-caption",t.innerHTML=r.caption||"Click to edit caption...",t.style.fontStyle="italic",t.style.color=r.caption?"#666":"#999",t.style.fontSize="14px",t.style.marginTop="8px",t.style.textAlign="center",t.style.minHeight="1.2em",t.style.outline="none",t.style.padding="4px",t.style.borderRadius="4px",t.style.cursor="text",t.style.border="1px solid transparent",t.contentEditable="false",t.setAttribute("data-original-caption",r.caption||"");let c=!1;return t.addEventListener("click",e=>{e.stopPropagation(),e.preventDefault(),!c&&(c=!0,t.setAttribute("data-editing","true"),t.contentEditable="true",t.innerHTML==="Click to edit caption..."&&(t.innerHTML="",t.style.color="#666"),t.style.border="1px solid #ddd",setTimeout(()=>{var f;t.focus();const i=document.createRange(),n=window.getSelection();if(t.childNodes.length>0){const m=t.childNodes[t.childNodes.length-1];m&&m.nodeType===Node.TEXT_NODE?i.setStart(m,((f=m.textContent)==null?void 0:f.length)||0):m&&i.setStartAfter(m)}else i.setStart(t,0);i.collapse(!0),n==null||n.removeAllRanges(),n==null||n.addRange(i)},0))}),t.addEventListener("blur",()=>{setTimeout(()=>{if(c){c=!1,t.removeAttribute("data-editing"),t.contentEditable="false";const e=t.innerHTML.trim();(!e||e==="<br>")&&(t.innerHTML="Click to edit caption...",t.style.color="#999"),t.style.border="1px solid transparent"}},10)}),t.addEventListener("keydown",e=>{if(c){if(e.key==="Enter"||e.key==="Escape"){e.stopPropagation(),e.preventDefault(),t.blur();return}if(e.key==="Backspace"){const i=t.innerHTML.trim();if(!i||i==="<br>"||i==="Click to edit caption..."){e.stopPropagation(),e.preventDefault();const n=t.closest(".ql-picture-container");n&&n.parentNode&&(n.parentNode.removeChild(n),setTimeout(()=>{const f=document.querySelector(".ql-editor");f&&f.focus()},10));return}}e.stopPropagation()}}),t.addEventListener("input",e=>{c&&e.stopPropagation()}),t.addEventListener("mousedown",e=>{c&&e.stopPropagation()}),t.addEventListener("mouseup",e=>{c&&e.stopPropagation()}),t.addEventListener("paste",e=>{c&&e.stopPropagation()}),u.appendChild(t),p.appendChild(o),p.appendChild(u),p.contentEditable="false",p}static value(r){const p=Array.from(r.querySelectorAll("source")).map(t=>({media:t.getAttribute("media")||"",srcset:t.getAttribute("srcset")||"",type:t.getAttribute("type")||""})),o=r.querySelector("img"),l=r.querySelector(".ql-picture-caption");let u="";if(l){const t=l.innerHTML.trim();t&&t!=="Click to edit caption..."&&(u=t)}return{sources:p,fallbackSrc:(o==null?void 0:o.getAttribute("src"))||"",alt:(o==null?void 0:o.getAttribute("alt"))||"",caption:u}}}return y(s,"blotName","picture"),y(s,"tagName","div"),y(s,"className","ql-picture-container"),s}catch(d){return console.error("Failed to create PictureBlot:",d),null}};exports.default=E;
|
|
2
|
+
//# sourceMappingURL=PictureBlot-C3zTKmbF.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PictureBlot-QqbDlqEB.cjs","sources":["../src/components/wazui/WazUiWysiwygInput/blots/PictureBlot.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { PictureBlotReturnValue, PictureBlotValue, QuillBlockEmbedStatic } from './types';\n\nconst createPictureBlot = async () => {\n if (typeof window === 'undefined') return null;\n\n try {\n const Quill = (await import('quill')).default;\n const BlockEmbed = Quill.import('blots/block/embed') as QuillBlockEmbedStatic;\n\n class PictureBlot extends (BlockEmbed as any) {\n static blotName = 'picture';\n static tagName = 'div';\n static className = 'ql-picture-container';\n\n static create(value: PictureBlotValue): HTMLElement {\n const container = document.createElement('div');\n container.className = 'ql-picture-container';\n container.style.margin = '1em 0';\n\n const pictureElement = document.createElement('picture');\n\n // Create source elements\n value.sources.forEach(source => {\n const sourceElement = document.createElement('source');\n sourceElement.setAttribute('media', source.media);\n sourceElement.setAttribute('srcset', source.srcset);\n sourceElement.setAttribute('type', source.type);\n pictureElement.appendChild(sourceElement);\n });\n\n // Create fallback img element\n const imgElement = document.createElement('img');\n imgElement.setAttribute('src', value.fallbackSrc);\n imgElement.setAttribute('alt', value.alt);\n imgElement.setAttribute('loading', 'lazy');\n imgElement.style.maxWidth = '100%';\n imgElement.style.height = 'auto';\n pictureElement.appendChild(imgElement);\n\n // Create caption element\n const captionWrapper = document.createElement('div');\n captionWrapper.className = 'ql-picture-caption-wrapper';\n captionWrapper.style.position = 'relative';\n\n const captionElement = document.createElement('div');\n captionElement.className = 'ql-picture-caption';\n captionElement.innerHTML = value.caption || 'Click to edit caption...';\n captionElement.style.fontStyle = 'italic';\n captionElement.style.color = value.caption ? '#666' : '#999';\n captionElement.style.fontSize = '14px';\n captionElement.style.marginTop = '8px';\n captionElement.style.textAlign = 'center';\n captionElement.style.minHeight = '1.2em';\n captionElement.style.outline = 'none';\n captionElement.style.padding = '4px';\n captionElement.style.borderRadius = '4px';\n captionElement.style.cursor = 'text';\n captionElement.style.border = '1px solid transparent';\n\n // Make it NOT contenteditable initially to prevent interference\n captionElement.contentEditable = 'false';\n\n // Store original caption value\n captionElement.setAttribute('data-original-caption', value.caption || '');\n\n // Flag to track editing state\n let isEditingCaption = false;\n\n // Enhanced click handler with better focus management\n captionElement.addEventListener('click', e => {\n e.stopPropagation();\n e.preventDefault();\n\n if (isEditingCaption) return; // Already editing\n\n isEditingCaption = true;\n\n // Mark the caption as being edited (for Quill to ignore)\n captionElement.setAttribute('data-editing', 'true');\n\n // Enter edit mode\n captionElement.contentEditable = 'true';\n\n // Handle placeholder\n if (captionElement.innerHTML === 'Click to edit caption...') {\n captionElement.innerHTML = '';\n captionElement.style.color = '#666';\n }\n\n captionElement.style.border = '1px solid #ddd';\n\n // Focus with a slight delay to ensure DOM is ready\n setTimeout(() => {\n captionElement.focus();\n\n // Set cursor position at the end\n const range = document.createRange();\n const selection = window.getSelection();\n\n if (captionElement.childNodes.length > 0) {\n const lastNode = captionElement.childNodes[captionElement.childNodes.length - 1];\n if (lastNode && lastNode.nodeType === Node.TEXT_NODE) {\n range.setStart(lastNode, lastNode.textContent?.length || 0);\n } else if (lastNode) {\n range.setStartAfter(lastNode);\n }\n } else {\n range.setStart(captionElement, 0);\n }\n\n range.collapse(true);\n selection?.removeAllRanges();\n selection?.addRange(range);\n }, 0);\n });\n\n // Enhanced blur handler\n captionElement.addEventListener('blur', () => {\n // Small delay to prevent immediate re-blur from Quill interference\n setTimeout(() => {\n if (isEditingCaption) {\n isEditingCaption = false;\n captionElement.removeAttribute('data-editing');\n\n // Exit edit mode\n captionElement.contentEditable = 'false';\n const text = captionElement.innerHTML.trim();\n if (!text || text === '<br>') {\n captionElement.innerHTML = 'Click to edit caption...';\n captionElement.style.color = '#999';\n }\n captionElement.style.border = '1px solid transparent';\n }\n }, 10);\n });\n\n // Improved keydown handler\n captionElement.addEventListener('keydown', e => {\n if (!isEditingCaption) return;\n\n // Handle Enter and Escape to exit edit mode\n if (e.key === 'Enter' || e.key === 'Escape') {\n e.stopPropagation();\n e.preventDefault();\n captionElement.blur();\n return;\n }\n\n // Handle backspace when caption is empty - delete the entire image\n if (e.key === 'Backspace') {\n const text = captionElement.innerHTML.trim();\n if (!text || text === '<br>' || text === 'Click to edit caption...') {\n e.stopPropagation();\n e.preventDefault();\n\n // Delete the entire image container\n const imageContainer = captionElement.closest('.ql-picture-container');\n if (imageContainer && imageContainer.parentNode) {\n imageContainer.parentNode.removeChild(imageContainer);\n\n // Try to focus back to the editor\n setTimeout(() => {\n const quillEditor = document.querySelector('.ql-editor');\n if (quillEditor) {\n (quillEditor as HTMLElement).focus();\n }\n }, 10);\n }\n return;\n }\n }\n\n // Stop all other events from reaching Quill during caption editing\n e.stopPropagation();\n });\n\n // Stop input events from reaching Quill during editing\n captionElement.addEventListener('input', e => {\n if (isEditingCaption) {\n e.stopPropagation();\n }\n });\n\n // Prevent mouse events from reaching Quill during editing\n captionElement.addEventListener('mousedown', e => {\n if (isEditingCaption) {\n e.stopPropagation();\n }\n });\n\n captionElement.addEventListener('mouseup', e => {\n if (isEditingCaption) {\n e.stopPropagation();\n }\n });\n\n // Add paste event handler to prevent bubbling to main editor\n captionElement.addEventListener('paste', e => {\n if (isEditingCaption) {\n e.stopPropagation(); // Prevent bubbling to Quill's paste handler\n // Let the default paste behavior handle the text insertion into caption\n }\n });\n\n // Prevent mouse events from bubbling to Quill - REMOVE THESE\n // captionElement.addEventListener('mousedown', (e) => {\n // e.stopPropagation();\n // });\n\n // captionElement.addEventListener('click', (e) => {\n // e.stopPropagation();\n // captionElement.focus();\n // });\n\n captionWrapper.appendChild(captionElement);\n container.appendChild(pictureElement);\n container.appendChild(captionWrapper);\n\n // Make the container non-editable for Quill\n container.contentEditable = 'false';\n\n return container;\n }\n\n static value(node: HTMLElement): PictureBlotReturnValue {\n const sources = Array.from(node.querySelectorAll('source')).map(source => ({\n media: source.getAttribute('media') || '',\n srcset: source.getAttribute('srcset') || '',\n type: source.getAttribute('type') || '',\n }));\n\n const img = node.querySelector('img');\n const captionElement = node.querySelector('.ql-picture-caption');\n let caption = '';\n\n if (captionElement) {\n const text = captionElement.innerHTML.trim();\n if (text && text !== 'Click to edit caption...') {\n caption = text;\n }\n }\n\n return {\n sources,\n fallbackSrc: img?.getAttribute('src') || '',\n alt: img?.getAttribute('alt') || '',\n caption,\n };\n }\n }\n\n return PictureBlot;\n } catch (error) {\n console.error('Failed to create PictureBlot:', error);\n return null;\n }\n};\n\nexport default createPictureBlot;\n"],"names":["createPictureBlot","BlockEmbed","PictureBlot","value","container","pictureElement","source","sourceElement","imgElement","captionWrapper","captionElement","isEditingCaption","range","selection","lastNode","_a","text","imageContainer","quillEditor","node","sources","img","caption","__publicField","error"],"mappings":"iQAIA,MAAMA,EAAoB,SAAY,CACpC,GAAI,OAAO,OAAW,IAAa,OAAO,KAE1C,GAAI,CAEF,MAAMC,GADS,MAAM,QAAA,QAAA,EAAA,KAAA,IAAA,QAAO,sBAAO,CAAA,GAAG,QACb,OAAO,mBAAmB,EAEnD,MAAMC,UAAqBD,CAAmB,CAK5C,OAAO,OAAOE,EAAsC,CAClD,MAAMC,EAAY,SAAS,cAAc,KAAK,EAC9CA,EAAU,UAAY,uBACtBA,EAAU,MAAM,OAAS,QAEzB,MAAMC,EAAiB,SAAS,cAAc,SAAS,EAGvDF,EAAM,QAAQ,QAAQG,GAAU,CAC9B,MAAMC,EAAgB,SAAS,cAAc,QAAQ,EACrDA,EAAc,aAAa,QAASD,EAAO,KAAK,EAChDC,EAAc,aAAa,SAAUD,EAAO,MAAM,EAClDC,EAAc,aAAa,OAAQD,EAAO,IAAI,EAC9CD,EAAe,YAAYE,CAAa,CAC1C,CAAC,EAGD,MAAMC,EAAa,SAAS,cAAc,KAAK,EAC/CA,EAAW,aAAa,MAAOL,EAAM,WAAW,EAChDK,EAAW,aAAa,MAAOL,EAAM,GAAG,EACxCK,EAAW,aAAa,UAAW,MAAM,EACzCA,EAAW,MAAM,SAAW,OAC5BA,EAAW,MAAM,OAAS,OAC1BH,EAAe,YAAYG,CAAU,EAGrC,MAAMC,EAAiB,SAAS,cAAc,KAAK,EACnDA,EAAe,UAAY,6BAC3BA,EAAe,MAAM,SAAW,W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YAAYK,CAAc,EAGpCL,EAAU,gBAAkB,QAErBA,CACT,CAEA,OAAO,MAAMe,EAA2C,CACtD,MAAMC,EAAU,MAAM,KAAKD,EAAK,iBAAiB,QAAQ,CAAC,EAAE,IAAIb,IAAW,CACzE,MAAOA,EAAO,aAAa,OAAO,GAAK,GACvC,OAAQA,EAAO,aAAa,QAAQ,GAAK,GACzC,KAAMA,EAAO,aAAa,MAAM,GAAK,EAAA,EACrC,EAEIe,EAAMF,EAAK,cAAc,KAAK,EAC9BT,EAAiBS,EAAK,cAAc,qBAAqB,EAC/D,IAAIG,EAAU,GAEd,GAAIZ,EAAgB,CAClB,MAAMM,EAAON,EAAe,UAAU,KAAA,EAClCM,GAAQA,IAAS,6BACnBM,EAAUN,EAEd,CAEA,MAAO,CACL,QAAAI,EACA,aAAaC,GAAA,YAAAA,EAAK,aAAa,SAAU,GACzC,KAAKA,GAAA,YAAAA,EAAK,aAAa,SAAU,GACjC,QAAAC,CAAA,CAEJ,CAAA,CA9OA,OAAAC,EADIrB,EACG,WAAW,WAClBqB,EAFIrB,EAEG,UAAU,OACjBqB,EAHIrB,EAGG,YAAY,wBA+OdA,CACT,OAASsB,EAAO,CACd,eAAQ,MAAM,gCAAiCA,CAAK,EAC7C,IACT,CACF"}
|
|
1
|
+
{"version":3,"file":"PictureBlot-C3zTKmbF.cjs","sources":["../src/components/wazui/WazUiWysiwygInput/blots/PictureBlot.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { PictureBlotReturnValue, PictureBlotValue, QuillBlockEmbedStatic } from './types';\n\nconst createPictureBlot = async () => {\n if (typeof window === 'undefined') return null;\n\n try {\n const Quill = (await import('quill')).default;\n const BlockEmbed = Quill.import('blots/block/embed') as QuillBlockEmbedStatic;\n\n class PictureBlot extends (BlockEmbed as any) {\n static blotName = 'picture';\n static tagName = 'div';\n static className = 'ql-picture-container';\n\n static create(value: PictureBlotValue): HTMLElement {\n const container = document.createElement('div');\n container.className = 'ql-picture-container';\n container.style.margin = '1em 0';\n\n const pictureElement = document.createElement('picture');\n\n // Create source elements\n value.sources.forEach(source => {\n const sourceElement = document.createElement('source');\n sourceElement.setAttribute('media', source.media);\n sourceElement.setAttribute('srcset', source.srcset);\n sourceElement.setAttribute('type', source.type);\n pictureElement.appendChild(sourceElement);\n });\n\n // Create fallback img element\n const imgElement = document.createElement('img');\n imgElement.setAttribute('src', value.fallbackSrc);\n imgElement.setAttribute('alt', value.alt);\n imgElement.setAttribute('loading', 'lazy');\n imgElement.style.maxWidth = '100%';\n imgElement.style.height = 'auto';\n pictureElement.appendChild(imgElement);\n\n // Create caption element\n const captionWrapper = document.createElement('div');\n captionWrapper.className = 'ql-picture-caption-wrapper';\n captionWrapper.style.position = 'relative';\n\n const captionElement = document.createElement('div');\n captionElement.className = 'ql-picture-caption';\n captionElement.innerHTML = value.caption || 'Click to edit caption...';\n captionElement.style.fontStyle = 'italic';\n captionElement.style.color = value.caption ? '#666' : '#999';\n captionElement.style.fontSize = '14px';\n captionElement.style.marginTop = '8px';\n captionElement.style.textAlign = 'center';\n captionElement.style.minHeight = '1.2em';\n captionElement.style.outline = 'none';\n captionElement.style.padding = '4px';\n captionElement.style.borderRadius = '4px';\n captionElement.style.cursor = 'text';\n captionElement.style.border = '1px solid transparent';\n\n // Make it NOT contenteditable initially to prevent interference\n captionElement.contentEditable = 'false';\n\n // Store original caption value\n captionElement.setAttribute('data-original-caption', value.caption || '');\n\n // Flag to track editing state\n let isEditingCaption = false;\n\n // Enhanced click handler with better focus management\n captionElement.addEventListener('click', e => {\n e.stopPropagation();\n e.preventDefault();\n\n if (isEditingCaption) return; // Already editing\n\n isEditingCaption = true;\n\n // Mark the caption as being edited (for Quill to ignore)\n captionElement.setAttribute('data-editing', 'true');\n\n // Enter edit mode\n captionElement.contentEditable = 'true';\n\n // Handle placeholder\n if (captionElement.innerHTML === 'Click to edit caption...') {\n captionElement.innerHTML = '';\n captionElement.style.color = '#666';\n }\n\n captionElement.style.border = '1px solid #ddd';\n\n // Focus with a slight delay to ensure DOM is ready\n setTimeout(() => {\n captionElement.focus();\n\n // Set cursor position at the end\n const range = document.createRange();\n const selection = window.getSelection();\n\n if (captionElement.childNodes.length > 0) {\n const lastNode = captionElement.childNodes[captionElement.childNodes.length - 1];\n if (lastNode && lastNode.nodeType === Node.TEXT_NODE) {\n range.setStart(lastNode, lastNode.textContent?.length || 0);\n } else if (lastNode) {\n range.setStartAfter(lastNode);\n }\n } else {\n range.setStart(captionElement, 0);\n }\n\n range.collapse(true);\n selection?.removeAllRanges();\n selection?.addRange(range);\n }, 0);\n });\n\n // Enhanced blur handler\n captionElement.addEventListener('blur', () => {\n // Small delay to prevent immediate re-blur from Quill interference\n setTimeout(() => {\n if (isEditingCaption) {\n isEditingCaption = false;\n captionElement.removeAttribute('data-editing');\n\n // Exit edit mode\n captionElement.contentEditable = 'false';\n const text = captionElement.innerHTML.trim();\n if (!text || text === '<br>') {\n captionElement.innerHTML = 'Click to edit caption...';\n captionElement.style.color = '#999';\n }\n captionElement.style.border = '1px solid transparent';\n }\n }, 10);\n });\n\n // Improved keydown handler\n captionElement.addEventListener('keydown', e => {\n if (!isEditingCaption) return;\n\n // Handle Enter and Escape to exit edit mode\n if (e.key === 'Enter' || e.key === 'Escape') {\n e.stopPropagation();\n e.preventDefault();\n captionElement.blur();\n return;\n }\n\n // Handle backspace when caption is empty - delete the entire image\n if (e.key === 'Backspace') {\n const text = captionElement.innerHTML.trim();\n if (!text || text === '<br>' || text === 'Click to edit caption...') {\n e.stopPropagation();\n e.preventDefault();\n\n // Delete the entire image container\n const imageContainer = captionElement.closest('.ql-picture-container');\n if (imageContainer && imageContainer.parentNode) {\n imageContainer.parentNode.removeChild(imageContainer);\n\n // Try to focus back to the editor\n setTimeout(() => {\n const quillEditor = document.querySelector('.ql-editor');\n if (quillEditor) {\n (quillEditor as HTMLElement).focus();\n }\n }, 10);\n }\n return;\n }\n }\n\n // Stop all other events from reaching Quill during caption editing\n e.stopPropagation();\n });\n\n // Stop input events from reaching Quill during editing\n captionElement.addEventListener('input', e => {\n if (isEditingCaption) {\n e.stopPropagation();\n }\n });\n\n // Prevent mouse events from reaching Quill during editing\n captionElement.addEventListener('mousedown', e => {\n if (isEditingCaption) {\n e.stopPropagation();\n }\n });\n\n captionElement.addEventListener('mouseup', e => {\n if (isEditingCaption) {\n e.stopPropagation();\n }\n });\n\n // Add paste event handler to prevent bubbling to main editor\n captionElement.addEventListener('paste', e => {\n if (isEditingCaption) {\n e.stopPropagation(); // Prevent bubbling to Quill's paste handler\n // Let the default paste behavior handle the text insertion into caption\n }\n });\n\n // Prevent mouse events from bubbling to Quill - REMOVE THESE\n // captionElement.addEventListener('mousedown', (e) => {\n // e.stopPropagation();\n // });\n\n // captionElement.addEventListener('click', (e) => {\n // e.stopPropagation();\n // captionElement.focus();\n // });\n\n captionWrapper.appendChild(captionElement);\n container.appendChild(pictureElement);\n container.appendChild(captionWrapper);\n\n // Make the container non-editable for Quill\n container.contentEditable = 'false';\n\n return container;\n }\n\n static value(node: HTMLElement): PictureBlotReturnValue {\n const sources = Array.from(node.querySelectorAll('source')).map(source => ({\n media: source.getAttribute('media') || '',\n srcset: source.getAttribute('srcset') || '',\n type: source.getAttribute('type') || '',\n }));\n\n const img = node.querySelector('img');\n const captionElement = node.querySelector('.ql-picture-caption');\n let caption = '';\n\n if (captionElement) {\n const text = captionElement.innerHTML.trim();\n if (text && text !== 'Click to edit caption...') {\n caption = text;\n }\n }\n\n return {\n sources,\n fallbackSrc: img?.getAttribute('src') || '',\n alt: img?.getAttribute('alt') || '',\n caption,\n };\n }\n }\n\n return PictureBlot;\n } catch (error) {\n console.error('Failed to create PictureBlot:', error);\n return null;\n }\n};\n\nexport default createPictureBlot;\n"],"names":["createPictureBlot","BlockEmbed","PictureBlot","value","container","pictureElement","source","sourceElement","imgElement","captionWrapper","captionElement","isEditingCaption","range","selection","lastNode","_a","text","imageContainer","quillEditor","node","sources","img","caption","__publicField","error"],"mappings":"iQAIA,M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c,qBAAqB,EAC/D,IAAIG,EAAU,GAEd,GAAIZ,EAAgB,CAClB,MAAMM,EAAON,EAAe,UAAU,KAAA,EAClCM,GAAQA,IAAS,6BACnBM,EAAUN,EAEd,CAEA,MAAO,CACL,QAAAI,EACA,aAAaC,GAAA,YAAAA,EAAK,aAAa,SAAU,GACzC,KAAKA,GAAA,YAAAA,EAAK,aAAa,SAAU,GACjC,QAAAC,CAAA,CAEJ,CAAA,CA9OA,OAAAC,EADIrB,EACG,WAAW,WAClBqB,EAFIrB,EAEG,UAAU,OACjBqB,EAHIrB,EAGG,YAAY,wBA+OdA,CACT,OAASsB,EAAO,CACd,eAAQ,MAAM,gCAAiCA,CAAK,EAC7C,IACT,CACF"}
|
|
@@ -5,7 +5,7 @@ var y = (d, a, s) => b(d, typeof a != "symbol" ? a + "" : a, s);
|
|
|
5
5
|
const h = async () => {
|
|
6
6
|
if (typeof window > "u") return null;
|
|
7
7
|
try {
|
|
8
|
-
const a = (await import("./quill-
|
|
8
|
+
const a = (await import("./quill-Cf8RoCN5.js")).default.import("blots/block/embed");
|
|
9
9
|
class s extends a {
|
|
10
10
|
static create(r) {
|
|
11
11
|
const p = document.createElement("div");
|
|
@@ -99,4 +99,4 @@ const h = async () => {
|
|
|
99
99
|
export {
|
|
100
100
|
h as default
|
|
101
101
|
};
|
|
102
|
-
//# sourceMappingURL=PictureBlot-
|
|
102
|
+
//# sourceMappingURL=PictureBlot-MSfDN8pZ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PictureBlot-Dpnfeyh1.js","sources":["../src/components/wazui/WazUiWysiwygInput/blots/PictureBlot.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { PictureBlotReturnValue, PictureBlotValue, QuillBlockEmbedStatic } from './types';\n\nconst createPictureBlot = async () => {\n if (typeof window === 'undefined') return null;\n\n try {\n const Quill = (await import('quill')).default;\n const BlockEmbed = Quill.import('blots/block/embed') as QuillBlockEmbedStatic;\n\n class PictureBlot extends (BlockEmbed as any) {\n static blotName = 'picture';\n static tagName = 'div';\n static className = 'ql-picture-container';\n\n static create(value: PictureBlotValue): HTMLElement {\n const container = document.createElement('div');\n container.className = 'ql-picture-container';\n container.style.margin = '1em 0';\n\n const pictureElement = document.createElement('picture');\n\n // Create source elements\n value.sources.forEach(source => {\n const sourceElement = document.createElement('source');\n sourceElement.setAttribute('media', source.media);\n sourceElement.setAttribute('srcset', source.srcset);\n sourceElement.setAttribute('type', source.type);\n pictureElement.appendChild(sourceElement);\n });\n\n // Create fallback img element\n const imgElement = document.createElement('img');\n imgElement.setAttribute('src', value.fallbackSrc);\n imgElement.setAttribute('alt', value.alt);\n imgElement.setAttribute('loading', 'lazy');\n imgElement.style.maxWidth = '100%';\n imgElement.style.height = 'auto';\n pictureElement.appendChild(imgElement);\n\n // Create caption element\n const captionWrapper = document.createElement('div');\n captionWrapper.className = 'ql-picture-caption-wrapper';\n captionWrapper.style.position = 'relative';\n\n const captionElement = document.createElement('div');\n captionElement.className = 'ql-picture-caption';\n captionElement.innerHTML = value.caption || 'Click to edit caption...';\n captionElement.style.fontStyle = 'italic';\n captionElement.style.color = value.caption ? '#666' : '#999';\n captionElement.style.fontSize = '14px';\n captionElement.style.marginTop = '8px';\n captionElement.style.textAlign = 'center';\n captionElement.style.minHeight = '1.2em';\n captionElement.style.outline = 'none';\n captionElement.style.padding = '4px';\n captionElement.style.borderRadius = '4px';\n captionElement.style.cursor = 'text';\n captionElement.style.border = '1px solid transparent';\n\n // Make it NOT contenteditable initially to prevent interference\n captionElement.contentEditable = 'false';\n\n // Store original caption value\n captionElement.setAttribute('data-original-caption', value.caption || '');\n\n // Flag to track editing state\n let isEditingCaption = false;\n\n // Enhanced click handler with better focus management\n captionElement.addEventListener('click', e => {\n e.stopPropagation();\n e.preventDefault();\n\n if (isEditingCaption) return; // Already editing\n\n isEditingCaption = true;\n\n // Mark the caption as being edited (for Quill to ignore)\n captionElement.setAttribute('data-editing', 'true');\n\n // Enter edit mode\n captionElement.contentEditable = 'true';\n\n // Handle placeholder\n if (captionElement.innerHTML === 'Click to edit caption...') {\n captionElement.innerHTML = '';\n captionElement.style.color = '#666';\n }\n\n captionElement.style.border = '1px solid #ddd';\n\n // Focus with a slight delay to ensure DOM is ready\n setTimeout(() => {\n captionElement.focus();\n\n // Set cursor position at the end\n const range = document.createRange();\n const selection = window.getSelection();\n\n if (captionElement.childNodes.length > 0) {\n const lastNode = captionElement.childNodes[captionElement.childNodes.length - 1];\n if (lastNode && lastNode.nodeType === Node.TEXT_NODE) {\n range.setStart(lastNode, lastNode.textContent?.length || 0);\n } else if (lastNode) {\n range.setStartAfter(lastNode);\n }\n } else {\n range.setStart(captionElement, 0);\n }\n\n range.collapse(true);\n selection?.removeAllRanges();\n selection?.addRange(range);\n }, 0);\n });\n\n // Enhanced blur handler\n captionElement.addEventListener('blur', () => {\n // Small delay to prevent immediate re-blur from Quill interference\n setTimeout(() => {\n if (isEditingCaption) {\n isEditingCaption = false;\n captionElement.removeAttribute('data-editing');\n\n // Exit edit mode\n captionElement.contentEditable = 'false';\n const text = captionElement.innerHTML.trim();\n if (!text || text === '<br>') {\n captionElement.innerHTML = 'Click to edit caption...';\n captionElement.style.color = '#999';\n }\n captionElement.style.border = '1px solid transparent';\n }\n }, 10);\n });\n\n // Improved keydown handler\n captionElement.addEventListener('keydown', e => {\n if (!isEditingCaption) return;\n\n // Handle Enter and Escape to exit edit mode\n if (e.key === 'Enter' || e.key === 'Escape') {\n e.stopPropagation();\n e.preventDefault();\n captionElement.blur();\n return;\n }\n\n // Handle backspace when caption is empty - delete the entire image\n if (e.key === 'Backspace') {\n const text = captionElement.innerHTML.trim();\n if (!text || text === '<br>' || text === 'Click to edit caption...') {\n e.stopPropagation();\n e.preventDefault();\n\n // Delete the entire image container\n const imageContainer = captionElement.closest('.ql-picture-container');\n if (imageContainer && imageContainer.parentNode) {\n imageContainer.parentNode.removeChild(imageContainer);\n\n // Try to focus back to the editor\n setTimeout(() => {\n const quillEditor = document.querySelector('.ql-editor');\n if (quillEditor) {\n (quillEditor as HTMLElement).focus();\n }\n }, 10);\n }\n return;\n }\n }\n\n // Stop all other events from reaching Quill during caption editing\n e.stopPropagation();\n });\n\n // Stop input events from reaching Quill during editing\n captionElement.addEventListener('input', e => {\n if (isEditingCaption) {\n e.stopPropagation();\n }\n });\n\n // Prevent mouse events from reaching Quill during editing\n captionElement.addEventListener('mousedown', e => {\n if (isEditingCaption) {\n e.stopPropagation();\n }\n });\n\n captionElement.addEventListener('mouseup', e => {\n if (isEditingCaption) {\n e.stopPropagation();\n }\n });\n\n // Add paste event handler to prevent bubbling to main editor\n captionElement.addEventListener('paste', e => {\n if (isEditingCaption) {\n e.stopPropagation(); // Prevent bubbling to Quill's paste handler\n // Let the default paste behavior handle the text insertion into caption\n }\n });\n\n // Prevent mouse events from bubbling to Quill - REMOVE THESE\n // captionElement.addEventListener('mousedown', (e) => {\n // e.stopPropagation();\n // });\n\n // captionElement.addEventListener('click', (e) => {\n // e.stopPropagation();\n // captionElement.focus();\n // });\n\n captionWrapper.appendChild(captionElement);\n container.appendChild(pictureElement);\n container.appendChild(captionWrapper);\n\n // Make the container non-editable for Quill\n container.contentEditable = 'false';\n\n return container;\n }\n\n static value(node: HTMLElement): PictureBlotReturnValue {\n const sources = Array.from(node.querySelectorAll('source')).map(source => ({\n media: source.getAttribute('media') || '',\n srcset: source.getAttribute('srcset') || '',\n type: source.getAttribute('type') || '',\n }));\n\n const img = node.querySelector('img');\n const captionElement = node.querySelector('.ql-picture-caption');\n let caption = '';\n\n if (captionElement) {\n const text = captionElement.innerHTML.trim();\n if (text && text !== 'Click to edit caption...') {\n caption = text;\n }\n }\n\n return {\n sources,\n fallbackSrc: img?.getAttribute('src') || '',\n alt: img?.getAttribute('alt') || '',\n caption,\n };\n }\n }\n\n return PictureBlot;\n } catch (error) {\n console.error('Failed to create PictureBlot:', error);\n return null;\n }\n};\n\nexport default createPictureBlot;\n"],"names":["createPictureBlot","BlockEmbed","PictureBlot","value","container","pictureElement","source","sourceElement","imgElement","captionWrapper","captionElement","isEditingCaption","range","selection","lastNode","_a","text","imageContainer","quillEditor","node","sources","img","caption","__publicField","error"],"mappings":";;;;AAIA,MAAMA,IAAoB,YAAY;AACpC,MAAI,OAAO,SAAW,IAAa,QAAO;AAE1C,MAAI;AAEF,UAAMC,KADS,MAAM,OAAO,qBAAO,GAAG,QACb,OAAO,mBAAmB;AAAA,IAEnD,MAAMC,UAAqBD,EAAmB;AAAA,MAK5C,OAAO,OAAOE,GAAsC;AAClD,cAAMC,IAAY,SAAS,cAAc,KAAK;AAC9C,QAAAA,EAAU,YAAY,wBACtBA,EAAU,MAAM,SAAS;AAEzB,cAAMC,IAAiB,SAAS,cAAc,SAAS;AAGvD,QAAAF,EAAM,QAAQ,QAAQ,CAAAG,MAAU;AAC9B,gBAAMC,IAAgB,SAAS,cAAc,QAAQ;AACrD,UAAAA,EAAc,aAAa,SAASD,EAAO,KAAK,GAChDC,EAAc,aAAa,UAAUD,EAAO,MAAM,GAClDC,EAAc,aAAa,QAAQD,EAAO,IAAI,GAC9CD,EAAe,YAAYE,CAAa;AAAA,QAC1C,CAAC;AAGD,cAAMC,IAAa,SAAS,cAAc,KAAK;AAC/C,QAAAA,EAAW,aAAa,OAAOL,EAAM,WAAW,GAChDK,EAAW,aAAa,OAAOL,EAAM,GAAG,GACxCK,EAAW,aAAa,WAAW,MAAM,GACzCA,EAAW,MAAM,WAAW,QAC5BA,EAAW,MAAM,SAAS,QAC1BH,EAAe,YAAYG,CAAU;AAGrC,cAAMC,IAAiB,SAAS,cAAc,KAAK;AACnD,QAAAA,EAAe,YAAY,8BAC3BA,EAAe,MAAM,WAAW;AAEhC,cAAMC,IAAiB,SAAS,cAAc,KAAK;AACnD,QAAAA,EAAe,YAAY,sBAC3BA,EAAe,YAAYP,EAAM,WAAW,4BAC5CO,EAAe,MAAM,YAAY,UACjCA,EAAe,MAAM,QAAQP,EAAM,UAAU,SAAS,QACtDO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AC,GAYDF,EAAe,YAAYC,CAAc,GACzCN,EAAU,YAAYC,CAAc,GACpCD,EAAU,YAAYK,CAAc,GAGpCL,EAAU,kBAAkB,SAErBA;AAAA,MACT;AAAA,MAEA,OAAO,MAAMe,GAA2C;AACtD,cAAMC,IAAU,MAAM,KAAKD,EAAK,iBAAiB,QAAQ,CAAC,EAAE,IAAI,CAAAb,OAAW;AAAA,UACzE,OAAOA,EAAO,aAAa,OAAO,KAAK;AAAA,UACvC,QAAQA,EAAO,aAAa,QAAQ,KAAK;AAAA,UACzC,MAAMA,EAAO,aAAa,MAAM,KAAK;AAAA,QAAA,EACrC,GAEIe,IAAMF,EAAK,cAAc,KAAK,GAC9BT,IAAiBS,EAAK,cAAc,qBAAqB;AAC/D,YAAIG,IAAU;AAEd,YAAIZ,GAAgB;AAClB,gBAAMM,IAAON,EAAe,UAAU,KAAA;AACtC,UAAIM,KAAQA,MAAS,+BACnBM,IAAUN;AAAA,QAEd;AAEA,eAAO;AAAA,UACL,SAAAI;AAAA,UACA,cAAaC,KAAA,gBAAAA,EAAK,aAAa,WAAU;AAAA,UACzC,MAAKA,KAAA,gBAAAA,EAAK,aAAa,WAAU;AAAA,UACjC,SAAAC;AAAA,QAAA;AAAA,MAEJ;AAAA,IAAA;AA9OA,WAAAC,EADIrB,GACG,YAAW,YAClBqB,EAFIrB,GAEG,WAAU,QACjBqB,EAHIrB,GAGG,aAAY,yBA+OdA;AAAA,EACT,SAASsB,GAAO;AACd,mBAAQ,MAAM,iCAAiCA,CAAK,GAC7C;AAAA,EACT;AACF;"}
|
|
1
|
+
{"version":3,"file":"PictureBlot-MSfDN8pZ.js","sources":["../src/components/wazui/WazUiWysiwygInput/blots/PictureBlot.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { PictureBlotReturnValue, PictureBlotValue, QuillBlockEmbedStatic } from './types';\n\nconst createPictureBlot = async () => {\n if (typeof window === 'undefined') return null;\n\n try {\n const Quill = (await import('quill')).default;\n const BlockEmbed = Quill.import('blots/block/embed') as QuillBlockEmbedStatic;\n\n class PictureBlot extends (BlockEmbed as any) {\n static blotName = 'picture';\n static tagName = 'div';\n static className = 'ql-picture-container';\n\n static create(value: PictureBlotValue): HTMLElement {\n const container = document.createElement('div');\n container.className = 'ql-picture-container';\n container.style.margin = '1em 0';\n\n const pictureElement = document.createElement('picture');\n\n // Create source elements\n value.sources.forEach(source => {\n const sourceElement = document.createElement('source');\n sourceElement.setAttribute('media', source.media);\n sourceElement.setAttribute('srcset', source.srcset);\n sourceElement.setAttribute('type', source.type);\n pictureElement.appendChild(sourceElement);\n });\n\n // Create fallback img element\n const imgElement = document.createElement('img');\n imgElement.setAttribute('src', value.fallbackSrc);\n imgElement.setAttribute('alt', value.alt);\n imgElement.setAttribute('loading', 'lazy');\n imgElement.style.maxWidth = '100%';\n imgElement.style.height = 'auto';\n pictureElement.appendChild(imgElement);\n\n // Create caption element\n const captionWrapper = document.createElement('div');\n captionWrapper.className = 'ql-picture-caption-wrapper';\n captionWrapper.style.position = 'relative';\n\n const captionElement = document.createElement('div');\n captionElement.className = 'ql-picture-caption';\n captionElement.innerHTML = value.caption || 'Click to edit caption...';\n captionElement.style.fontStyle = 'italic';\n captionElement.style.color = value.caption ? '#666' : '#999';\n captionElement.style.fontSize = '14px';\n captionElement.style.marginTop = '8px';\n captionElement.style.textAlign = 'center';\n captionElement.style.minHeight = '1.2em';\n captionElement.style.outline = 'none';\n captionElement.style.padding = '4px';\n captionElement.style.borderRadius = '4px';\n captionElement.style.cursor = 'text';\n captionElement.style.border = '1px solid transparent';\n\n // Make it NOT contenteditable initially to prevent interference\n captionElement.contentEditable = 'false';\n\n // Store original caption value\n captionElement.setAttribute('data-original-caption', value.caption || '');\n\n // Flag to track editing state\n let isEditingCaption = false;\n\n // Enhanced click handler with better focus management\n captionElement.addEventListener('click', e => {\n e.stopPropagation();\n e.preventDefault();\n\n if (isEditingCaption) return; // Already editing\n\n isEditingCaption = true;\n\n // Mark the caption as being edited (for Quill to ignore)\n captionElement.setAttribute('data-editing', 'true');\n\n // Enter edit mode\n captionElement.contentEditable = 'true';\n\n // Handle placeholder\n if (captionElement.innerHTML === 'Click to edit caption...') {\n captionElement.innerHTML = '';\n captionElement.style.color = '#666';\n }\n\n captionElement.style.border = '1px solid #ddd';\n\n // Focus with a slight delay to ensure DOM is ready\n setTimeout(() => {\n captionElement.focus();\n\n // Set cursor position at the end\n const range = document.createRange();\n const selection = window.getSelection();\n\n if (captionElement.childNodes.length > 0) {\n const lastNode = captionElement.childNodes[captionElement.childNodes.length - 1];\n if (lastNode && lastNode.nodeType === Node.TEXT_NODE) {\n range.setStart(lastNode, lastNode.textContent?.length || 0);\n } else if (lastNode) {\n range.setStartAfter(lastNode);\n }\n } else {\n range.setStart(captionElement, 0);\n }\n\n range.collapse(true);\n selection?.removeAllRanges();\n selection?.addRange(range);\n }, 0);\n });\n\n // Enhanced blur handler\n captionElement.addEventListener('blur', () => {\n // Small delay to prevent immediate re-blur from Quill interference\n setTimeout(() => {\n if (isEditingCaption) {\n isEditingCaption = false;\n captionElement.removeAttribute('data-editing');\n\n // Exit edit mode\n captionElement.contentEditable = 'false';\n const text = captionElement.innerHTML.trim();\n if (!text || text === '<br>') {\n captionElement.innerHTML = 'Click to edit caption...';\n captionElement.style.color = '#999';\n }\n captionElement.style.border = '1px solid transparent';\n }\n }, 10);\n });\n\n // Improved keydown handler\n captionElement.addEventListener('keydown', e => {\n if (!isEditingCaption) return;\n\n // Handle Enter and Escape to exit edit mode\n if (e.key === 'Enter' || e.key === 'Escape') {\n e.stopPropagation();\n e.preventDefault();\n captionElement.blur();\n return;\n }\n\n // Handle backspace when caption is empty - delete the entire image\n if (e.key === 'Backspace') {\n const text = captionElement.innerHTML.trim();\n if (!text || text === '<br>' || text === 'Click to edit caption...') {\n e.stopPropagation();\n e.preventDefault();\n\n // Delete the entire image container\n const imageContainer = captionElement.closest('.ql-picture-container');\n if (imageContainer && imageContainer.parentNode) {\n imageContainer.parentNode.removeChild(imageContainer);\n\n // Try to focus back to the editor\n setTimeout(() => {\n const quillEditor = document.querySelector('.ql-editor');\n if (quillEditor) {\n (quillEditor as HTMLElement).focus();\n }\n }, 10);\n }\n return;\n }\n }\n\n // Stop all other events from reaching Quill during caption editing\n e.stopPropagation();\n });\n\n // Stop input events from reaching Quill during editing\n captionElement.addEventListener('input', e => {\n if (isEditingCaption) {\n e.stopPropagation();\n }\n });\n\n // Prevent mouse events from reaching Quill during editing\n captionElement.addEventListener('mousedown', e => {\n if (isEditingCaption) {\n e.stopPropagation();\n }\n });\n\n captionElement.addEventListener('mouseup', e => {\n if (isEditingCaption) {\n e.stopPropagation();\n }\n });\n\n // Add paste event handler to prevent bubbling to main editor\n captionElement.addEventListener('paste', e => {\n if (isEditingCaption) {\n e.stopPropagation(); // Prevent bubbling to Quill's paste handler\n // Let the default paste behavior handle the text insertion into caption\n }\n });\n\n // Prevent mouse events from bubbling to Quill - REMOVE THESE\n // captionElement.addEventListener('mousedown', (e) => {\n // e.stopPropagation();\n // });\n\n // captionElement.addEventListener('click', (e) => {\n // e.stopPropagation();\n // captionElement.focus();\n // });\n\n captionWrapper.appendChild(captionElement);\n container.appendChild(pictureElement);\n container.appendChild(captionWrapper);\n\n // Make the container non-editable for Quill\n container.contentEditable = 'false';\n\n return container;\n }\n\n static value(node: HTMLElement): PictureBlotReturnValue {\n const sources = Array.from(node.querySelectorAll('source')).map(source => ({\n media: source.getAttribute('media') || '',\n srcset: source.getAttribute('srcset') || '',\n type: source.getAttribute('type') || '',\n }));\n\n const img = node.querySelector('img');\n const captionElement = node.querySelector('.ql-picture-caption');\n let caption = '';\n\n if (captionElement) {\n const text = captionElement.innerHTML.trim();\n if (text && text !== 'Click to edit caption...') {\n caption = text;\n }\n }\n\n return {\n sources,\n fallbackSrc: img?.getAttribute('src') || '',\n alt: img?.getAttribute('alt') || '',\n caption,\n };\n }\n }\n\n return PictureBlot;\n } catch (error) {\n console.error('Failed to create PictureBlot:', error);\n return null;\n }\n};\n\nexport default createPictureBlot;\n"],"names":["createPictureBlot","BlockEmbed","PictureBlot","value","container","pictureElement","source","sourceElement","imgElement","captionWrapper","captionElement","isEditingCaption","range","selection","lastNode","_a","text","imageContainer","quillEditor","node","sources","img","caption","__publicField","error"],"mappings":";;;;AAIA,MAAMA,IAAoB,YAAY;AACpC,MAAI,OAAO,SAAW,IAAa,QAAO;AAE1C,MAAI;AAEF,UAAMC,KADS,MAAM,OAAO,qBAAO,GAAG,QACb,OAAO,mBAAmB;AAAA,IAEnD,MAAMC,UAAqBD,EAAmB;AAAA,MAK5C,OAAO,OAAOE,GAAsC;AAClD,cAAMC,IAAY,SAAS,cAAc,KAAK;AAC9C,QAAAA,EAAU,YAAY,wBACtBA,EAAU,MAAM,SAAS;AAEzB,cAAMC,IAAiB,SAAS,cAAc,SAAS;AAGvD,QAAAF,EAAM,QAAQ,QAAQ,CAAAG,MAAU;AAC9B,gBAAMC,IAAgB,SAAS,cAAc,QAAQ;AACrD,UAAAA,EAAc,aAAa,SAASD,EAAO,KAAK,GAChDC,EAAc,aAAa,UAAUD,EAAO,MAAM,GAClDC,EAAc,aAAa,QAAQD,EAAO,IAAI,GAC9CD,EAAe,YAAYE,CAAa;AAAA,QAC1C,CAAC;AAGD,cAAMC,IAAa,SAAS,cAAc,KAAK;AAC/C,QAAAA,EAAW,aAAa,OAAOL,EAAM,WAAW,GAChDK,EAAW,aAAa,OAAOL,EAAM,GAAG,GACxCK,EAAW,aAAa,WAAW,MAAM,GACzCA,EAAW,MAAM,WAAW,QAC5BA,EAAW,MAAM,SAAS,QAC1BH,EAAe,YAAYG,CAAU;AAGrC,cAAMC,IAAiB,SAAS,cAAc,KAAK;AACnD,QAAAA,EAAe,YAAY,8BAC3BA,EAAe,MAAM,WAAW;AAEhC,cAAMC,IAAiB,SAAS,cAAc,KAAK;AACnD,QAAAA,EAAe,YAAY,sBAC3BA,EAAe,YAAYP,EAAM,WAAW,4BAC5CO,EAAe,MAAM,YAAY,UACjCA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C5C,UAAIC,KACF,EAAE,gBAAA;AAAA,QAGN,CAAC,GAYDF,EAAe,YAAYC,CAAc,GACzCN,EAAU,YAAYC,CAAc,GACpCD,EAAU,YAAYK,CAAc,GAGpCL,EAAU,kBAAkB,SAErBA;AAAA,MACT;AAAA,MAEA,OAAO,MAAMe,GAA2C;AACtD,cAAMC,IAAU,MAAM,KAAKD,EAAK,iBAAiB,QAAQ,CAAC,EAAE,IAAI,CAAAb,OAAW;AAAA,UACzE,OAAOA,EAAO,aAAa,OAAO,KAAK;AAAA,UACvC,QAAQA,EAAO,aAAa,QAAQ,KAAK;AAAA,UACzC,MAAMA,EAAO,aAAa,MAAM,KAAK;AAAA,QAAA,EACrC,GAEIe,IAAMF,EAAK,cAAc,KAAK,GAC9BT,IAAiBS,EAAK,cAAc,qBAAqB;AAC/D,YAAIG,IAAU;AAEd,YAAIZ,GAAgB;AAClB,gBAAMM,IAAON,EAAe,UAAU,KAAA;AACtC,UAAIM,KAAQA,MAAS,+BACnBM,IAAUN;AAAA,QAEd;AAEA,eAAO;AAAA,UACL,SAAAI;AAAA,UACA,cAAaC,KAAA,gBAAAA,EAAK,aAAa,WAAU;AAAA,UACzC,MAAKA,KAAA,gBAAAA,EAAK,aAAa,WAAU;AAAA,UACjC,SAAAC;AAAA,QAAA;AAAA,MAEJ;AAAA,IAAA;AA9OA,WAAAC,EADIrB,GACG,YAAW,YAClBqB,EAFIrB,GAEG,WAAU,QACjBqB,EAHIrB,GAGG,aAAY,yBA+OdA;AAAA,EACT,SAASsB,GAAO;AACd,mBAAQ,MAAM,iCAAiCA,CAAK,GAC7C;AAAA,EACT;AACF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WazUiGqlLibraryEditMedia.d.ts","sourceRoot":"","sources":["../../../../src/components/wazui/WazUiGqlMediaLibrary/WazUiGqlLibraryEditMedia.tsx"],"names":[],"mappings":"AAsBA,eAAO,MAAM,wBAAwB,+
|
|
1
|
+
{"version":3,"file":"WazUiGqlLibraryEditMedia.d.ts","sourceRoot":"","sources":["../../../../src/components/wazui/WazUiGqlMediaLibrary/WazUiGqlLibraryEditMedia.tsx"],"names":[],"mappings":"AAsBA,eAAO,MAAM,wBAAwB,+CAqKpC,CAAC"}
|
|
@@ -37995,13 +37995,13 @@ function $K() {
|
|
|
37995
37995
|
NEXT_PUBLIC_DOLOS_TRANSFORMATION_ENDPOINT: "https://images.twistedfood.co.uk",
|
|
37996
37996
|
NEXT_PUBLIC_RECIPE_GRAPHQL_URL: "https://recipes-api.junglecreations.com/graphql",
|
|
37997
37997
|
NEXT_PUBLIC_PHOENIX_ENDPOINT: "http://51.38.80.88:8001/graphql",
|
|
37998
|
-
NEXT_PUBLIC_MERCURY_TOKEN_ENDPOINT: "https://mercury.
|
|
37999
|
-
NEXT_PUBLIC_MERCURY_GRAPHQL_URL: "https://mercury.
|
|
38000
|
-
NEXT_PUBLIC_ATHENS_APP_ID: "
|
|
38001
|
-
NEXT_PUBLIC_ATHENS_APP_SECRET: "
|
|
37998
|
+
NEXT_PUBLIC_MERCURY_TOKEN_ENDPOINT: "https://mercury.hivedeck.com/project/token",
|
|
37999
|
+
NEXT_PUBLIC_MERCURY_GRAPHQL_URL: "https://mercury.hivedeck.com/graphql",
|
|
38000
|
+
NEXT_PUBLIC_ATHENS_APP_ID: "app_3d7e343fff5fef896823b54e6510dca1",
|
|
38001
|
+
NEXT_PUBLIC_ATHENS_APP_SECRET: "0e023a846205864d4979dbf607248b61add945588919716281f776ede013693b",
|
|
38002
38002
|
NEXT_PUBLIC_REVALIDATION_TWISTEDFOOD_TOKEN: "token",
|
|
38003
38003
|
NEXT_PUBLIC_REVALIDATION_VT_TOKEN: "df870c4335ad9d4402dfccdf7000a3c9",
|
|
38004
|
-
NEXT_PUBLIC_MUSE_GRAPHQL_URL: "https://muse.
|
|
38004
|
+
NEXT_PUBLIC_MUSE_GRAPHQL_URL: "https://muse.hivedeck.com/graphql",
|
|
38005
38005
|
NEXT_PUBLIC_TWITTER_EMBED_ENDPOINT: "http://localhost:3000/api/twitter-embeds",
|
|
38006
38006
|
NEXT_PUBLIC_PROMETHEUS_GRAPHQL_ENDPOINT: "https://prometheus.tiadara.com/graphql"
|
|
38007
38007
|
};
|
|
@@ -45335,7 +45335,7 @@ const km = {
|
|
|
45335
45335
|
},
|
|
45336
45336
|
resizeCoordinates: v,
|
|
45337
45337
|
canvas: !0,
|
|
45338
|
-
className: "!h-[25rem] flex-1 w-md 3xl:w-160 relative bg-[red]",
|
|
45338
|
+
className: "!max-h-[25rem] flex-1 w-md 3xl:w-160 relative bg-[red]",
|
|
45339
45339
|
disabled: !v
|
|
45340
45340
|
}
|
|
45341
45341
|
),
|
|
@@ -45448,68 +45448,83 @@ const km = {
|
|
|
45448
45448
|
] }),
|
|
45449
45449
|
/* @__PURE__ */ c.jsxs("div", { className: " flex-1 h-0 w-full overflow-auto grid grid-cols-[2fr_1fr] gap-4", children: [
|
|
45450
45450
|
/* @__PURE__ */ c.jsx(TeA, {}),
|
|
45451
|
-
/* @__PURE__ */ c.jsxs(
|
|
45452
|
-
|
|
45453
|
-
|
|
45454
|
-
|
|
45455
|
-
|
|
45456
|
-
|
|
45457
|
-
|
|
45458
|
-
|
|
45459
|
-
|
|
45460
|
-
|
|
45461
|
-
|
|
45462
|
-
|
|
45463
|
-
|
|
45464
|
-
|
|
45465
|
-
|
|
45466
|
-
|
|
45467
|
-
|
|
45468
|
-
|
|
45469
|
-
|
|
45470
|
-
|
|
45471
|
-
|
|
45472
|
-
|
|
45473
|
-
|
|
45474
|
-
|
|
45475
|
-
|
|
45476
|
-
|
|
45477
|
-
|
|
45478
|
-
|
|
45479
|
-
|
|
45480
|
-
|
|
45481
|
-
|
|
45482
|
-
|
|
45483
|
-
|
|
45484
|
-
|
|
45485
|
-
|
|
45486
|
-
|
|
45487
|
-
|
|
45488
|
-
|
|
45489
|
-
|
|
45490
|
-
|
|
45491
|
-
|
|
45492
|
-
|
|
45493
|
-
|
|
45494
|
-
|
|
45495
|
-
|
|
45496
|
-
|
|
45497
|
-
|
|
45451
|
+
/* @__PURE__ */ c.jsxs(
|
|
45452
|
+
"form",
|
|
45453
|
+
{
|
|
45454
|
+
className: "max-w-full flex flex-col justify-between items-center gap-3",
|
|
45455
|
+
onSubmit: g,
|
|
45456
|
+
children: [
|
|
45457
|
+
/* @__PURE__ */ c.jsx("div", { className: "w-full justify-start h-fit bg-muted border text-base font-bold p-4 py-2 rounded", children: "Image Properties" }),
|
|
45458
|
+
/* @__PURE__ */ c.jsxs("div", { className: "space-y-3 w-full overflow-y-auto h-10 flex-1", children: [
|
|
45459
|
+
/* @__PURE__ */ c.jsx(
|
|
45460
|
+
st,
|
|
45461
|
+
{
|
|
45462
|
+
label: "Title",
|
|
45463
|
+
value: u.title,
|
|
45464
|
+
onChange: (v) => d("title", v),
|
|
45465
|
+
inputProps: {
|
|
45466
|
+
placeholder: "Type here"
|
|
45467
|
+
}
|
|
45468
|
+
}
|
|
45469
|
+
),
|
|
45470
|
+
/* @__PURE__ */ c.jsx(
|
|
45471
|
+
st,
|
|
45472
|
+
{
|
|
45473
|
+
label: /* @__PURE__ */ c.jsxs("span", { className: "flex justify-between gap-2", children: [
|
|
45474
|
+
"Alternative Text",
|
|
45475
|
+
/* @__PURE__ */ c.jsx(pc, { children: /* @__PURE__ */ c.jsxs(xa, { children: [
|
|
45476
|
+
/* @__PURE__ */ c.jsx(za, { asChild: !0, children: /* @__PURE__ */ c.jsx(t7, { className: "h-4 w-4 text-muted-foreground" }) }),
|
|
45477
|
+
/* @__PURE__ */ c.jsx(Da, { children: /* @__PURE__ */ c.jsx("p", { children: "Alternative text helps screen-reading tools describe images to visually impaired readers." }) })
|
|
45478
|
+
] }) })
|
|
45479
|
+
] }),
|
|
45480
|
+
value: u.alternative_text,
|
|
45481
|
+
onChange: (v) => d("alternative_text", v),
|
|
45482
|
+
inputProps: {
|
|
45483
|
+
placeholder: "Describe the image",
|
|
45484
|
+
minLength: 10,
|
|
45485
|
+
onInvalid: (v) => {
|
|
45486
|
+
const m = v.target;
|
|
45487
|
+
m.validity.tooShort && m.setCustomValidity("Alternative text must be at least 10 characters");
|
|
45488
|
+
},
|
|
45489
|
+
onInput: (v) => {
|
|
45490
|
+
v.target.setCustomValidity("");
|
|
45491
|
+
}
|
|
45492
|
+
}
|
|
45493
|
+
}
|
|
45494
|
+
),
|
|
45495
|
+
/* @__PURE__ */ c.jsx(
|
|
45496
|
+
st,
|
|
45497
|
+
{
|
|
45498
|
+
label: /* @__PURE__ */ c.jsxs("span", { className: "flex justify-between gap-2", children: [
|
|
45499
|
+
"Description",
|
|
45500
|
+
/* @__PURE__ */ c.jsx(pc, { children: /* @__PURE__ */ c.jsxs(xa, { children: [
|
|
45501
|
+
/* @__PURE__ */ c.jsx(za, { asChild: !0, children: /* @__PURE__ */ c.jsx(t7, { className: "h-4 w-4 text-muted-foreground" }) }),
|
|
45502
|
+
/* @__PURE__ */ c.jsx(Da, { children: /* @__PURE__ */ c.jsx("p", { className: "max-w-xs", children: "Add a caption to display below the image" }) })
|
|
45503
|
+
] }) })
|
|
45504
|
+
] }),
|
|
45505
|
+
type: "textarea",
|
|
45506
|
+
value: u.caption,
|
|
45507
|
+
onChange: (v) => d("caption", v),
|
|
45508
|
+
textareaProps: {
|
|
45509
|
+
placeholder: "Image caption",
|
|
45510
|
+
rows: 4
|
|
45511
|
+
}
|
|
45512
|
+
}
|
|
45513
|
+
)
|
|
45514
|
+
] }),
|
|
45515
|
+
/* @__PURE__ */ c.jsx(Hr, { className: "w-full items-center mt-auto mb-4", children: /* @__PURE__ */ c.jsx(
|
|
45516
|
+
ze,
|
|
45517
|
+
{
|
|
45518
|
+
type: "submit",
|
|
45519
|
+
isLoading: l,
|
|
45520
|
+
disabled: l,
|
|
45521
|
+
className: "w-full rounded capitalize",
|
|
45522
|
+
children: (t == null ? void 0 : t.media) instanceof File ? "Upload Image" : s.viewOnly || n != null && n.viewOnly ? "add image" : "Save Changes"
|
|
45498
45523
|
}
|
|
45499
|
-
}
|
|
45500
|
-
|
|
45501
|
-
|
|
45502
|
-
|
|
45503
|
-
ze,
|
|
45504
|
-
{
|
|
45505
|
-
onClick: g,
|
|
45506
|
-
isLoading: l,
|
|
45507
|
-
disabled: l,
|
|
45508
|
-
className: "w-full rounded capitalize",
|
|
45509
|
-
children: (t == null ? void 0 : t.media) instanceof File ? "Upload Image" : s.viewOnly || n != null && n.viewOnly ? "add image" : "Save Changes"
|
|
45510
|
-
}
|
|
45511
|
-
) })
|
|
45512
|
-
] })
|
|
45524
|
+
) })
|
|
45525
|
+
]
|
|
45526
|
+
}
|
|
45527
|
+
)
|
|
45513
45528
|
] })
|
|
45514
45529
|
] }) }) });
|
|
45515
45530
|
}, HeA = () => {
|
|
@@ -47250,7 +47265,7 @@ const ytA = ({ value: A, label: e, removeCaption: t }) => {
|
|
|
47250
47265
|
return (async () => {
|
|
47251
47266
|
if (!(typeof window > "u"))
|
|
47252
47267
|
try {
|
|
47253
|
-
const b = (await import("./quill-
|
|
47268
|
+
const b = (await import("./quill-Cf8RoCN5.js")).default, z = await (await import("./PictureBlot-MSfDN8pZ.js")).default();
|
|
47254
47269
|
z && b.register("formats/picture", z, !0), o.current && (h = new b(o.current, {
|
|
47255
47270
|
theme: "snow",
|
|
47256
47271
|
modules: { ...gtA, toolbar: { container: `#${u.toolbarId}` } },
|
|
@@ -66867,7 +66882,7 @@ const KlA = ({
|
|
|
66867
66882
|
},
|
|
66868
66883
|
imageGalleryConfig: {
|
|
66869
66884
|
...t,
|
|
66870
|
-
cropperAspectRatio: "
|
|
66885
|
+
cropperAspectRatio: "1:1",
|
|
66871
66886
|
type: "inline"
|
|
66872
66887
|
}
|
|
66873
66888
|
},
|
|
@@ -67382,7 +67397,7 @@ function ffA({
|
|
|
67382
67397
|
refetchOnWindowFocus: !1
|
|
67383
67398
|
});
|
|
67384
67399
|
}
|
|
67385
|
-
const Sy = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_ATHENS_APP_ID: "
|
|
67400
|
+
const Sy = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_ATHENS_APP_ID: "app_3d7e343fff5fef896823b54e6510dca1", VITE_ATHENS_APP_SECRET: "0e023a846205864d4979dbf607248b61add945588919716281f776ede013693b", VITE_DOLOS_TRANSFORMATION_ENDPOINT: "https://images.twistedfood.co.uk", VITE_DOLOS_URL: "https://dolos.tiadara.com/graphql", VITE_MERCURY_GRAPHQL_URL: "https://mercury.hivedeck.com/graphql", VITE_MERCURY_TOKEN_ENDPOINT: "https://mercury.hivedeck.com/project/token", VITE_MUSE_GRAPHQL_URL: "https://muse.hivedeck.com/graphql", VITE_PHOENIX_ENDPOINT: "http://51.38.80.88:8001/graphql", VITE_PROMETHEUS_GRAPHQL_ENDPOINT: "https://prometheus.tiadara.com/graphql", VITE_RECIPE_GRAPHQL_URL: "https://recipes-api.junglecreations.com/graphql", VITE_REVALIDATION_TWISTEDFOOD_TOKEN: "token", VITE_REVALIDATION_VT_TOKEN: "df870c4335ad9d4402dfccdf7000a3c9", VITE_TWITTER_EMBED_ENDPOINT: "http://localhost:3000/api/twitter-embeds" }, Bj = Ie({
|
|
67386
67401
|
NEXT_PUBLIC_DOLOS_URL: pA().default("https://localhost:3001"),
|
|
67387
67402
|
NEXT_PUBLIC_RECIPE_GRAPHQL_URL: pA().default("https://localhost:3002"),
|
|
67388
67403
|
NEXT_PUBLIC_PHOENIX_ENDPOINT: pA().default("https://localhost:3004"),
|
|
@@ -67701,4 +67716,4 @@ export {
|
|
|
67701
67716
|
UuA as y,
|
|
67702
67717
|
$uA as z
|
|
67703
67718
|
};
|
|
67704
|
-
//# sourceMappingURL=index-
|
|
67719
|
+
//# sourceMappingURL=index-BRNhIADp.js.map
|