@wazobiatech/wazui 0.0.27 → 0.0.29

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.
@@ -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-BqTCuA9W.js")).default.import("blots/block/embed");
8
+ const a = (await import("./quill-CQDChP6W.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-BS0EubF_.js.map
102
+ //# sourceMappingURL=PictureBlot-CEhxd88Q.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PictureBlot-BS0EubF_.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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AAc,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-CEhxd88Q.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,KAA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A,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,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-DcnkxbvM.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-6ZrVhA1J.cjs.map
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-DMb8aHR7.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-DFjZUTxb.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"PictureBlot-6ZrVhA1J.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,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ygInput/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,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N,EAAU,YAAYC,CAAc,EACpCD,EAAU,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"}
@@ -9,35 +9,35 @@ declare const _default: [
9
9
  {
10
10
  "uuid": "a12366fe-8f46-41fa-956b-4303a0a6c007",
11
11
  "id": "109",
12
- "slug": "/news",
12
+ "slug": "",
13
13
  "name": "News",
14
14
  "subCategories": null
15
15
  },
16
16
  {
17
17
  "uuid": "59ce1934-cd3a-4c51-8d74-0c94f61921f9",
18
18
  "id": "110",
19
- "slug": "/opinion",
19
+ "slug": "",
20
20
  "name": "Opinion",
21
21
  "subCategories": []
22
22
  },
23
23
  {
24
24
  "uuid": "558b093b-b6ef-4a47-b2ed-a84ab4a932f3",
25
25
  "id": "112",
26
- "slug": "/features",
26
+ "slug": "",
27
27
  "name": "features",
28
28
  "subCategories": []
29
29
  },
30
30
  {
31
31
  "uuid": "3b18845f-a6e8-41da-a7b0-ad85d838cd89",
32
32
  "id": "113",
33
- "slug": "/interview",
33
+ "slug": "",
34
34
  "name": "Interview",
35
35
  "subCategories": []
36
36
  },
37
37
  {
38
38
  "uuid": "34b5c6c5-7827-495d-bfce-d38af9aeb9ed",
39
39
  "id": "118",
40
- "slug": "/trending",
40
+ "slug": "",
41
41
  "name": "Trending",
42
42
  "subCategories": []
43
43
  }
@@ -1 +1 @@
1
- {"version":3,"file":"RecipeContentComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/wazui/RecipeContentComponent/RecipeContentComponent.tsx"],"names":[],"mappings":"AACA,OAAO,KAAgC,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAgBtD,QAAA,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC,2BAA2B,CAiejE,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
1
+ {"version":3,"file":"RecipeContentComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/wazui/RecipeContentComponent/RecipeContentComponent.tsx"],"names":[],"mappings":"AACA,OAAO,KAAgC,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAgBtD,QAAA,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC,2BAA2B,CA6djE,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
@@ -23,7 +23,7 @@ export declare function useUpdatePost({ config, fetchConfig, postBaseUrl, baseUr
23
23
  user_config?: UserConfig;
24
24
  onSuccess?: (variables?: Record<string, FormValue>) => void;
25
25
  }): import('@tanstack/react-query').UseMutationResult<import("@apollo/client").ApolloClient.MutateResult<unknown> | undefined, Error, Record<string, FormValue>, unknown>;
26
- export declare const useRevalidateCache: (site_url: string, user_config?: UserConfig, base_url?: string) => ((slug: string, is_autosave?: boolean, updated_fields?: string, showSuccessModal?: boolean) => Promise<import('axios').AxiosResponse<any, any, {}>>) | undefined;
26
+ export declare const useRevalidateCache: (site_url: string, user_config?: UserConfig) => ((slug: string, is_autosave?: boolean, updated_fields?: string, showSuccessModal?: boolean) => Promise<import('axios').AxiosResponse<any, any, {}>>) | undefined;
27
27
  export declare const useAutosave: ({ storageKey, form, enabled, interval, onSave, onError, }: UseAutosaveOptions) => UseAutosaveReturn;
28
28
  export declare const initialState: BlogPostState;
29
29
  export declare const blogPostReducer: (state: BlogPostState, action: ActionType) => BlogPostState;
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../../src/components/wazui/WazUiCreateBlogContent/hooks.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D,OAAO,EACL,UAAU,EAEV,aAAa,EAIb,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAIjB,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAOxD,wBAAgB,WAAW,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,EAAE,MAAM,8DAsE9D;AAED,wBAAgB,aAAa,CAAC,EAC5B,MAAM,EACN,WAAW,EACX,OAAO,EACP,QAAQ,EACR,aAAa,EACb,eAAsB,EACtB,SAAS,GACV,EAAE;IACD,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,IAAI,CAAC,EAAE,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nE,MAAM,gBACE,OAAO,mBACJ,MAAM,qBACL,OAAO,sEAoD5B,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,2DAOzB,kBAAkB,KAAG,iBAiJvB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,aAM1B,CAAC;AAGF,eAAO,MAAM,eAAe,GAAI,OAAO,aAAa,EAAE,QAAQ,UAAU,KAAG,aA6B1E,CAAC"}
@@ -38209,7 +38209,7 @@ function $K() {
38209
38209
  const A = {
38210
38210
  NEXT_PUBLIC_DOLOS_URL: "https://dolos.hivedeck.com/graphql",
38211
38211
  NEXT_PUBLIC_DOLOS_TRANSFORMATION_ENDPOINT: "https://images.twistedfood.co.uk",
38212
- NEXT_PUBLIC_RECIPE_GRAPHQL_URL: void 0,
38212
+ NEXT_PUBLIC_RECIPE_GRAPHQL_URL: "https://recipes-api.junglecreations.com/graphql",
38213
38213
  NEXT_PUBLIC_PHOENIX_ENDPOINT: "http://51.38.80.88:8001/graphql",
38214
38214
  NEXT_PUBLIC_MERCURY_TOKEN_ENDPOINT: "https://mercury.tiadara.com/project/token",
38215
38215
  NEXT_PUBLIC_ATHENS_APP_ID: "app_73e74873521e90bac3165f6624fcc854",
@@ -47193,7 +47193,7 @@ const utA = ({ value: A, label: e, removeCaption: t }) => {
47193
47193
  return (async () => {
47194
47194
  if (!(typeof window > "u"))
47195
47195
  try {
47196
- const b = (await import("./quill-BqTCuA9W.js")).default, z = await (await import("./PictureBlot-BS0EubF_.js")).default();
47196
+ const b = (await import("./quill-CQDChP6W.js")).default, z = await (await import("./PictureBlot-CEhxd88Q.js")).default();
47197
47197
  z && b.register("formats/picture", z, !0), o.current && (h = new b(o.current, {
47198
47198
  theme: "snow",
47199
47199
  modules: { ...rtA, toolbar: { container: `#${u.toolbarId}` } },
@@ -53554,7 +53554,7 @@ function hsA({
53554
53554
  onSuccess: o,
53555
53555
  user_config: i
53556
53556
  }) {
53557
- const l = oa(), u = Qt(), f = A == null ? void 0 : A.query, { showSuccess: d, showError: g } = nn(), v = xC(t || "", i, n);
53557
+ const l = oa(), u = Qt(), f = A == null ? void 0 : A.query, { showSuccess: d, showError: g } = nn(), v = xC(t || "", i);
53558
53558
  return os({
53559
53559
  mutationFn: async (m) => {
53560
53560
  if (f)
@@ -53610,39 +53610,41 @@ function hsA({
53610
53610
  }
53611
53611
  });
53612
53612
  }
53613
- const xC = (A, e, t) => {
53614
- if (A != null && A.length)
53615
- try {
53616
- const a = new URL(A);
53617
- A = `${a.protocol}//${a.host}`;
53618
- } catch (a) {
53619
- console.log(a), A.endsWith("/") && (A = A.slice(0, -1));
53620
- }
53621
- const { showError: n, showSuccess: r } = nn(), s = async (a, o, i, l = !1) => {
53622
- let u = "/articles";
53623
- t && t.includes("recipe") && (u = "/recipes");
53624
- const f = A.includes("vt") ? `${a}` : `${a ? `${u}${a}` : "/"}`;
53625
- return await Ge.post(`${A}/api/revalidate`, {
53626
- slug: f.trim(),
53627
- username: `${e == null ? void 0 : e.name}${o ? "-autosave" : ""}`,
53613
+ const xC = (A, e) => {
53614
+ A.endsWith("/") && (A = A.slice(0, -1));
53615
+ const { showError: t, showSuccess: n } = nn(), r = async (s, a, o, i = !1) => {
53616
+ const l = new URL(A), u = l.hostname, f = l.pathname, d = f === "/" ? "" : f;
53617
+ console.log("Revalidating cache for:", {
53618
+ site_url: A,
53619
+ is_autosave: a,
53620
+ updated_fields: o,
53621
+ hostname: u,
53622
+ urlPrefix: d,
53623
+ endpoint: `${u}/api/revalidate`,
53624
+ slug: `${d}${s}`
53625
+ });
53626
+ const g = `${d}${s}`;
53627
+ return await Ge.post(`https://${u}/api/revalidate`, {
53628
+ slug: g.trim(),
53629
+ username: `${e == null ? void 0 : e.name}${a ? "-autosave" : ""}`,
53628
53630
  email: e == null ? void 0 : e.email,
53629
53631
  date: (/* @__PURE__ */ new Date()).toLocaleString(),
53630
- updated_fields: `${i}`.split(",").filter((d) => d),
53632
+ updated_fields: `${o}`.split(",").filter((v) => v),
53631
53633
  token: A.includes("vt") ? ge.NEXT_PUBLIC_REVALIDATION_VT_TOKEN : ge.NEXT_PUBLIC_REVALIDATION_TWISTEDFOOD_TOKEN
53632
- }).then((d) => (l && r("Cache cleared sucessfully", "", {
53634
+ }).then((v) => (i && n("Cache cleared sucessfully", "", {
53633
53635
  type: "action",
53634
53636
  confirmText: "View Page",
53635
53637
  cancelText: "Done",
53636
53638
  onAction: () => {
53637
- var g;
53638
- (g = window == null ? void 0 : window.open) == null || g.call(window, `${A}${f}`, "_blank");
53639
+ var m;
53640
+ (m = window == null ? void 0 : window.open) == null || m.call(window, `${A}${g}`, "_blank");
53639
53641
  }
53640
- }), d)).catch((d) => {
53641
- throw n("Failed to revalidate cache", d.message, {}), d;
53642
+ }), v)).catch((v) => {
53643
+ throw t("Failed to revalidate cache", v.message, {}), v;
53642
53644
  });
53643
53645
  };
53644
53646
  if (A)
53645
- return s;
53647
+ return r;
53646
53648
  }, wsA = ({
53647
53649
  storageKey: A,
53648
53650
  form: e,
@@ -59218,35 +59220,35 @@ const ij = [
59218
59220
  {
59219
59221
  uuid: "a12366fe-8f46-41fa-956b-4303a0a6c007",
59220
59222
  id: "109",
59221
- slug: "/news",
59223
+ slug: "",
59222
59224
  name: "News",
59223
59225
  subCategories: null
59224
59226
  },
59225
59227
  {
59226
59228
  uuid: "59ce1934-cd3a-4c51-8d74-0c94f61921f9",
59227
59229
  id: "110",
59228
- slug: "/opinion",
59230
+ slug: "",
59229
59231
  name: "Opinion",
59230
59232
  subCategories: []
59231
59233
  },
59232
59234
  {
59233
59235
  uuid: "558b093b-b6ef-4a47-b2ed-a84ab4a932f3",
59234
59236
  id: "112",
59235
- slug: "/features",
59237
+ slug: "",
59236
59238
  name: "features",
59237
59239
  subCategories: []
59238
59240
  },
59239
59241
  {
59240
59242
  uuid: "3b18845f-a6e8-41da-a7b0-ad85d838cd89",
59241
59243
  id: "113",
59242
- slug: "/interview",
59244
+ slug: "",
59243
59245
  name: "Interview",
59244
59246
  subCategories: []
59245
59247
  },
59246
59248
  {
59247
59249
  uuid: "34b5c6c5-7827-495d-bfce-d38af9aeb9ed",
59248
59250
  id: "118",
59249
- slug: "/trending",
59251
+ slug: "",
59250
59252
  name: "Trending",
59251
59253
  subCategories: []
59252
59254
  }
@@ -61254,7 +61256,6 @@ const niA = [
61254
61256
  user_config: o,
61255
61257
  className: i = ""
61256
61258
  }) => {
61257
- e = e.includes("/recipes") ? e.replace("/recipes", "") : e;
61258
61259
  const [l, u] = iA(!1), [f, d] = iA(!1), g = riA(), v = a == null ? void 0 : a.find((z) => (z == null ? void 0 : z.uuid) == (o == null ? void 0 : o.uuid)), m = (z) => {
61259
61260
  var C;
61260
61261
  const D = {}, M = {}, S = {}, { articleSlug: Z } = jb(z.slug);
@@ -61460,7 +61461,7 @@ const niA = [
61460
61461
  blog_uuid: n,
61461
61462
  image_library_uuid: s,
61462
61463
  images_url: r,
61463
- recipe_base_url: `${e}/recipes`,
61464
+ recipe_base_url: e,
61464
61465
  authors: a,
61465
61466
  isAutoRelatedEnabled: f
61466
61467
  }), b = /^[a-zA-Z0-9\-_~#[\]()]+$/, x = Xe({
@@ -66153,4 +66154,4 @@ export {
66153
66154
  uuA as y,
66154
66155
  duA as z
66155
66156
  };
66156
- //# sourceMappingURL=index-DJXi318c.js.map
66157
+ //# sourceMappingURL=index-AKD9iip8.js.map
@@ -0,0 +1,4 @@
1
+ [diffend] Oversized file quarantined before diffing.
2
+ name: package/dist/index-AKD9iip8.js.map
3
+ size: 35241515 bytes
4
+ sha256: a0d46660627be6fc403ff275020dba6c0697c593dcfe3be620261a3b8d0e38c8