@wazobiatech/wazui 1.1.4 → 1.1.5
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-BKJtxBtt.cjs → PictureBlot-CSXL52ep.cjs} +2 -2
- package/dist/{PictureBlot-BKJtxBtt.cjs.map → PictureBlot-CSXL52ep.cjs.map} +1 -1
- package/dist/{PictureBlot-PaeA_g_6.js → PictureBlot-n9DJ1y4e.js} +2 -2
- package/dist/{PictureBlot-PaeA_g_6.js.map → PictureBlot-n9DJ1y4e.js.map} +1 -1
- package/dist/{VideoBlot-DMpc2k-2.js → VideoBlot-BCqH6Tuv.js} +6 -3
- package/dist/VideoBlot-BCqH6Tuv.js.map +1 -0
- package/dist/{VideoBlot-C3Doc0pR.cjs → VideoBlot-HWxrW3WY.cjs} +2 -2
- package/dist/VideoBlot-HWxrW3WY.cjs.map +1 -0
- package/dist/components/wazui/WazUiGqlMediaLibrary/WazUiGqlLibraryEditMedia.d.ts.map +1 -1
- package/dist/components/wazui/WazUiGqlMediaLibrary/hooks.d.ts.map +1 -1
- package/dist/components/wazui/WazUiWysiwygInput/blots/VideoBlot.d.ts.map +1 -1
- package/dist/hooks/useSessionExpired.d.ts +2 -1
- package/dist/hooks/useSessionExpired.d.ts.map +1 -1
- package/dist/{index-sg0jndm7.js → index-BqlME1ql.js} +1741 -1724
- package/dist/index-BqlME1ql.js.map +4 -0
- package/dist/{index-DbfIn9kw.cjs → index-C_gdXf2i.cjs} +114 -114
- package/dist/index-C_gdXf2i.cjs.map +4 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{quill-CcRE1rfp.cjs → quill-Cb1P-QRW.cjs} +2 -2
- package/dist/{quill-CcRE1rfp.cjs.map → quill-Cb1P-QRW.cjs.map} +1 -1
- package/dist/{quill-8Sind98o.js → quill-DV4TTDmw.js} +2 -2
- package/dist/{quill-8Sind98o.js.map → quill-DV4TTDmw.js.map} +1 -1
- package/dist/utils/tokenRefresh.d.ts +1 -1
- package/dist/utils/tokenRefresh.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/VideoBlot-C3Doc0pR.cjs.map +0 -1
- package/dist/VideoBlot-DMpc2k-2.js.map +0 -1
- package/dist/index-DbfIn9kw.cjs.map +0 -4
- package/dist/index-sg0jndm7.js.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-Cb1P-QRW.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-CSXL52ep.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PictureBlot-BKJtxBtt.cjs","sources":["../src/components/wazui/WazUiWysiwygInput/blots/PictureBlot.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\r\n\r\nimport { PictureBlotReturnValue, PictureBlotValue, QuillBlockEmbedStatic } from './types';\r\n\r\nconst createPictureBlot = async () => {\r\n if (typeof window === 'undefined') return null;\r\n\r\n try {\r\n const Quill = (await import('quill')).default;\r\n const BlockEmbed = Quill.import('blots/block/embed') as QuillBlockEmbedStatic;\r\n\r\n class PictureBlot extends (BlockEmbed as any) {\r\n static blotName = 'picture';\r\n static tagName = 'div';\r\n static className = 'ql-picture-container';\r\n\r\n static create(value: PictureBlotValue): HTMLElement {\r\n const container = document.createElement('div');\r\n container.className = 'ql-picture-container';\r\n container.style.margin = '1em 0';\r\n\r\n const pictureElement = document.createElement('picture');\r\n\r\n // Create source elements\r\n value.sources.forEach(source => {\r\n const sourceElement = document.createElement('source');\r\n sourceElement.setAttribute('media', source.media);\r\n sourceElement.setAttribute('srcset', source.srcset);\r\n sourceElement.setAttribute('type', source.type);\r\n pictureElement.appendChild(sourceElement);\r\n });\r\n\r\n // Create fallback img element\r\n const imgElement = document.createElement('img');\r\n imgElement.setAttribute('src', value.fallbackSrc);\r\n imgElement.setAttribute('alt', value.alt);\r\n imgElement.setAttribute('loading', 'lazy');\r\n imgElement.style.maxWidth = '100%';\r\n imgElement.style.height = 'auto';\r\n pictureElement.appendChild(imgElement);\r\n\r\n // Create caption element\r\n const captionWrapper = document.createElement('div');\r\n captionWrapper.className = 'ql-picture-caption-wrapper';\r\n captionWrapper.style.position = 'relative';\r\n\r\n const captionElement = document.createElement('div');\r\n captionElement.className = 'ql-picture-caption';\r\n captionElement.innerHTML = value.caption || 'Click to edit caption...';\r\n captionElement.style.fontStyle = 'italic';\r\n captionElement.style.color = value.caption ? '#666' : '#999';\r\n captionElement.style.fontSize = '14px';\r\n captionElement.style.marginTop = '8px';\r\n captionElement.style.textAlign = 'center';\r\n captionElement.style.minHeight = '1.2em';\r\n captionElement.style.outline = 'none';\r\n captionElement.style.padding = '4px';\r\n captionElement.style.borderRadius = '4px';\r\n captionElement.style.cursor = 'text';\r\n captionElement.style.border = '1px solid transparent';\r\n\r\n // Make it NOT contenteditable initially to prevent interference\r\n captionElement.contentEditable = 'false';\r\n\r\n // Store original caption value\r\n captionElement.setAttribute('data-original-caption', value.caption || '');\r\n\r\n // Flag to track editing state\r\n let isEditingCaption = false;\r\n\r\n // Enhanced click handler with better focus management\r\n captionElement.addEventListener('click', e => {\r\n e.stopPropagation();\r\n e.preventDefault();\r\n\r\n if (isEditingCaption) return; // Already editing\r\n\r\n isEditingCaption = true;\r\n\r\n // Mark the caption as being edited (for Quill to ignore)\r\n captionElement.setAttribute('data-editing', 'true');\r\n\r\n // Enter edit mode\r\n captionElement.contentEditable = 'true';\r\n\r\n // Handle placeholder\r\n if (captionElement.innerHTML === 'Click to edit caption...') {\r\n captionElement.innerHTML = '';\r\n captionElement.style.color = '#666';\r\n }\r\n\r\n captionElement.style.border = '1px solid #ddd';\r\n\r\n // Focus with a slight delay to ensure DOM is ready\r\n setTimeout(() => {\r\n captionElement.focus();\r\n\r\n // Set cursor position at the end\r\n const range = document.createRange();\r\n const selection = window.getSelection();\r\n\r\n if (captionElement.childNodes.length > 0) {\r\n const lastNode = captionElement.childNodes[captionElement.childNodes.length - 1];\r\n if (lastNode && lastNode.nodeType === Node.TEXT_NODE) {\r\n range.setStart(lastNode, lastNode.textContent?.length || 0);\r\n } else if (lastNode) {\r\n range.setStartAfter(lastNode);\r\n }\r\n } else {\r\n range.setStart(captionElement, 0);\r\n }\r\n\r\n range.collapse(true);\r\n selection?.removeAllRanges();\r\n selection?.addRange(range);\r\n }, 0);\r\n });\r\n\r\n // Enhanced blur handler\r\n captionElement.addEventListener('blur', () => {\r\n // Small delay to prevent immediate re-blur from Quill interference\r\n setTimeout(() => {\r\n if (isEditingCaption) {\r\n isEditingCaption = false;\r\n captionElement.removeAttribute('data-editing');\r\n\r\n // Exit edit mode\r\n captionElement.contentEditable = 'false';\r\n const text = captionElement.innerHTML.trim();\r\n if (!text || text === '<br>') {\r\n captionElement.innerHTML = 'Click to edit caption...';\r\n captionElement.style.color = '#999';\r\n }\r\n captionElement.style.border = '1px solid transparent';\r\n }\r\n }, 10);\r\n });\r\n\r\n // Improved keydown handler\r\n captionElement.addEventListener('keydown', e => {\r\n if (!isEditingCaption) return;\r\n\r\n // Handle Enter and Escape to exit edit mode\r\n if (e.key === 'Enter' || e.key === 'Escape') {\r\n e.stopPropagation();\r\n e.preventDefault();\r\n captionElement.blur();\r\n return;\r\n }\r\n\r\n // Handle backspace when caption is empty - delete the entire image\r\n if (e.key === 'Backspace') {\r\n const text = captionElement.innerHTML.trim();\r\n if (!text || text === '<br>' || text === 'Click to edit caption...') {\r\n e.stopPropagation();\r\n e.preventDefault();\r\n\r\n // Delete the entire image container\r\n const imageContainer = captionElement.closest('.ql-picture-container');\r\n if (imageContainer && imageContainer.parentNode) {\r\n imageContainer.parentNode.removeChild(imageContainer);\r\n\r\n // Try to focus back to the editor\r\n setTimeout(() => {\r\n const quillEditor = document.querySelector('.ql-editor');\r\n if (quillEditor) {\r\n (quillEditor as HTMLElement).focus();\r\n }\r\n }, 10);\r\n }\r\n return;\r\n }\r\n }\r\n\r\n // Stop all other events from reaching Quill during caption editing\r\n e.stopPropagation();\r\n });\r\n\r\n // Stop input events from reaching Quill during editing\r\n captionElement.addEventListener('input', e => {\r\n if (isEditingCaption) {\r\n e.stopPropagation();\r\n }\r\n });\r\n\r\n // Prevent mouse events from reaching Quill during editing\r\n captionElement.addEventListener('mousedown', e => {\r\n if (isEditingCaption) {\r\n e.stopPropagation();\r\n }\r\n });\r\n\r\n captionElement.addEventListener('mouseup', e => {\r\n if (isEditingCaption) {\r\n e.stopPropagation();\r\n }\r\n });\r\n\r\n // Add paste event handler to prevent bubbling to main editor\r\n captionElement.addEventListener('paste', e => {\r\n if (isEditingCaption) {\r\n e.stopPropagation(); // Prevent bubbling to Quill's paste handler\r\n // Let the default paste behavior handle the text insertion into caption\r\n }\r\n });\r\n\r\n // Prevent mouse events from bubbling to Quill - REMOVE THESE\r\n // captionElement.addEventListener('mousedown', (e) => {\r\n // e.stopPropagation();\r\n // });\r\n\r\n // captionElement.addEventListener('click', (e) => {\r\n // e.stopPropagation();\r\n // captionElement.focus();\r\n // });\r\n\r\n captionWrapper.appendChild(captionElement);\r\n container.appendChild(pictureElement);\r\n container.appendChild(captionWrapper);\r\n\r\n // Make the container non-editable for Quill\r\n container.contentEditable = 'false';\r\n\r\n return container;\r\n }\r\n\r\n static value(node: HTMLElement): PictureBlotReturnValue {\r\n const sources = Array.from(node.querySelectorAll('source')).map(source => ({\r\n media: source.getAttribute('media') || '',\r\n srcset: source.getAttribute('srcset') || '',\r\n type: source.getAttribute('type') || '',\r\n }));\r\n\r\n const img = node.querySelector('img');\r\n const captionElement = node.querySelector('.ql-picture-caption');\r\n let caption = '';\r\n\r\n if (captionElement) {\r\n const text = captionElement.innerHTML.trim();\r\n if (text && text !== 'Click to edit caption...') {\r\n caption = text;\r\n }\r\n }\r\n\r\n return {\r\n sources,\r\n fallbackSrc: img?.getAttribute('src') || '',\r\n alt: img?.getAttribute('alt') || '',\r\n caption,\r\n };\r\n }\r\n }\r\n\r\n return PictureBlot;\r\n } catch (error) {\r\n console.error('Failed to create PictureBlot:', error);\r\n return null;\r\n }\r\n};\r\n\r\nexport default createPictureBlot;\r\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,WAEhC,MAAMC,EAAiB,SAAS,cAAc,KAAK,EACnDA,EAAe,UAAY,qBAC3BA,EAAe,UAAYP,EAAM,SAAW,2BAC5CO,EAAe,MA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K,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-CSXL52ep.cjs","sources":["../src/components/wazui/WazUiWysiwygInput/blots/PictureBlot.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\r\n\r\nimport { PictureBlotReturnValue, PictureBlotValue, QuillBlockEmbedStatic } from './types';\r\n\r\nconst createPictureBlot = async () => {\r\n if (typeof window === 'undefined') return null;\r\n\r\n try {\r\n const Quill = (await import('quill')).default;\r\n const BlockEmbed = Quill.import('blots/block/embed') as QuillBlockEmbedStatic;\r\n\r\n class PictureBlot extends (BlockEmbed as any) {\r\n static blotName = 'picture';\r\n static tagName = 'div';\r\n static className = 'ql-picture-container';\r\n\r\n static create(value: PictureBlotValue): HTMLElement {\r\n const container = document.createElement('div');\r\n container.className = 'ql-picture-container';\r\n container.style.margin = '1em 0';\r\n\r\n const pictureElement = document.createElement('picture');\r\n\r\n // Create source elements\r\n value.sources.forEach(source => {\r\n const sourceElement = document.createElement('source');\r\n sourceElement.setAttribute('media', source.media);\r\n sourceElement.setAttribute('srcset', source.srcset);\r\n sourceElement.setAttribute('type', source.type);\r\n pictureElement.appendChild(sourceElement);\r\n });\r\n\r\n // Create fallback img element\r\n const imgElement = document.createElement('img');\r\n imgElement.setAttribute('src', value.fallbackSrc);\r\n imgElement.setAttribute('alt', value.alt);\r\n imgElement.setAttribute('loading', 'lazy');\r\n imgElement.style.maxWidth = '100%';\r\n imgElement.style.height = 'auto';\r\n pictureElement.appendChild(imgElement);\r\n\r\n // Create caption element\r\n const captionWrapper = document.createElement('div');\r\n captionWrapper.className = 'ql-picture-caption-wrapper';\r\n captionWrapper.style.position = 'relative';\r\n\r\n const captionElement = document.createElement('div');\r\n captionElement.className = 'ql-picture-caption';\r\n captionElement.innerHTML = value.caption || 'Click to edit caption...';\r\n captionElement.style.fontStyle = 'italic';\r\n captionElement.style.color = value.caption ? '#666' : '#999';\r\n captionElement.style.fontSize = '14px';\r\n captionElement.style.marginTop = '8px';\r\n captionElement.style.textAlign = 'center';\r\n captionElement.style.minHeight = '1.2em';\r\n captionElement.style.outline = 'none';\r\n captionElement.style.padding = '4px';\r\n captionElement.style.borderRadius = '4px';\r\n captionElement.style.cursor = 'text';\r\n captionElement.style.border = '1px solid transparent';\r\n\r\n // Make it NOT contenteditable initially to prevent interference\r\n captionElement.contentEditable = 'false';\r\n\r\n // Store original caption value\r\n captionElement.setAttribute('data-original-caption', value.caption || '');\r\n\r\n // Flag to track editing state\r\n let isEditingCaption = false;\r\n\r\n // Enhanced click handler with better focus management\r\n captionElement.addEventListener('click', e => {\r\n e.stopPropagation();\r\n e.preventDefault();\r\n\r\n if (isEditingCaption) return; // Already editing\r\n\r\n isEditingCaption = true;\r\n\r\n // Mark the caption as being edited (for Quill to ignore)\r\n captionElement.setAttribute('data-editing', 'true');\r\n\r\n // Enter edit mode\r\n captionElement.contentEditable = 'true';\r\n\r\n // Handle placeholder\r\n if (captionElement.innerHTML === 'Click to edit caption...') {\r\n captionElement.innerHTML = '';\r\n captionElement.style.color = '#666';\r\n }\r\n\r\n captionElement.style.border = '1px solid #ddd';\r\n\r\n // Focus with a slight delay to ensure DOM is ready\r\n setTimeout(() => {\r\n captionElement.focus();\r\n\r\n // Set cursor position at the end\r\n const range = document.createRange();\r\n const selection = window.getSelection();\r\n\r\n if (captionElement.childNodes.length > 0) {\r\n const lastNode = captionElement.childNodes[captionElement.childNodes.length - 1];\r\n if (lastNode && lastNode.nodeType === Node.TEXT_NODE) {\r\n range.setStart(lastNode, lastNode.textContent?.length || 0);\r\n } else if (lastNode) {\r\n range.setStartAfter(lastNode);\r\n }\r\n } else {\r\n range.setStart(captionElement, 0);\r\n }\r\n\r\n range.collapse(true);\r\n selection?.removeAllRanges();\r\n selection?.addRange(range);\r\n }, 0);\r\n });\r\n\r\n // Enhanced blur handler\r\n captionElement.addEventListener('blur', () => {\r\n // Small delay to prevent immediate re-blur from Quill interference\r\n setTimeout(() => {\r\n if (isEditingCaption) {\r\n isEditingCaption = false;\r\n captionElement.removeAttribute('data-editing');\r\n\r\n // Exit edit mode\r\n captionElement.contentEditable = 'false';\r\n const text = captionElement.innerHTML.trim();\r\n if (!text || text === '<br>') {\r\n captionElement.innerHTML = 'Click to edit caption...';\r\n captionElement.style.color = '#999';\r\n }\r\n captionElement.style.border = '1px solid transparent';\r\n }\r\n }, 10);\r\n });\r\n\r\n // Improved keydown handler\r\n captionElement.addEventListener('keydown', e => {\r\n if (!isEditingCaption) return;\r\n\r\n // Handle Enter and Escape to exit edit mode\r\n if (e.key === 'Enter' || e.key === 'Escape') {\r\n e.stopPropagation();\r\n e.preventDefault();\r\n captionElement.blur();\r\n return;\r\n }\r\n\r\n // Handle backspace when caption is empty - delete the entire image\r\n if (e.key === 'Backspace') {\r\n const text = captionElement.innerHTML.trim();\r\n if (!text || text === '<br>' || text === 'Click to edit caption...') {\r\n e.stopPropagation();\r\n e.preventDefault();\r\n\r\n // Delete the entire image container\r\n const imageContainer = captionElement.closest('.ql-picture-container');\r\n if (imageContainer && imageContainer.parentNode) {\r\n imageContainer.parentNode.removeChild(imageContainer);\r\n\r\n // Try to focus back to the editor\r\n setTimeout(() => {\r\n const quillEditor = document.querySelector('.ql-editor');\r\n if (quillEditor) {\r\n (quillEditor as HTMLElement).focus();\r\n }\r\n }, 10);\r\n }\r\n return;\r\n }\r\n }\r\n\r\n // Stop all other events from reaching Quill during caption editing\r\n e.stopPropagation();\r\n });\r\n\r\n // Stop input events from reaching Quill during editing\r\n captionElement.addEventListener('input', e => {\r\n if (isEditingCaption) {\r\n e.stopPropagation();\r\n }\r\n });\r\n\r\n // Prevent mouse events from reaching Quill during editing\r\n captionElement.addEventListener('mousedown', e => {\r\n if (isEditingCaption) {\r\n e.stopPropagation();\r\n }\r\n });\r\n\r\n captionElement.addEventListener('mouseup', e => {\r\n if (isEditingCaption) {\r\n e.stopPropagation();\r\n }\r\n });\r\n\r\n // Add paste event handler to prevent bubbling to main editor\r\n captionElement.addEventListener('paste', e => {\r\n if (isEditingCaption) {\r\n e.stopPropagation(); // Prevent bubbling to Quill's paste handler\r\n // Let the default paste behavior handle the text insertion into caption\r\n }\r\n });\r\n\r\n // Prevent mouse events from bubbling to Quill - REMOVE THESE\r\n // captionElement.addEventListener('mousedown', (e) => {\r\n // e.stopPropagation();\r\n // });\r\n\r\n // captionElement.addEventListener('click', (e) => {\r\n // e.stopPropagation();\r\n // captionElement.focus();\r\n // });\r\n\r\n captionWrapper.appendChild(captionElement);\r\n container.appendChild(pictureElement);\r\n container.appendChild(captionWrapper);\r\n\r\n // Make the container non-editable for Quill\r\n container.contentEditable = 'false';\r\n\r\n return container;\r\n }\r\n\r\n static value(node: HTMLElement): PictureBlotReturnValue {\r\n const sources = Array.from(node.querySelectorAll('source')).map(source => ({\r\n media: source.getAttribute('media') || '',\r\n srcset: source.getAttribute('srcset') || '',\r\n type: source.getAttribute('type') || '',\r\n }));\r\n\r\n const img = node.querySelector('img');\r\n const captionElement = node.querySelector('.ql-picture-caption');\r\n let caption = '';\r\n\r\n if (captionElement) {\r\n const text = captionElement.innerHTML.trim();\r\n if (text && text !== 'Click to edit caption...') {\r\n caption = text;\r\n }\r\n }\r\n\r\n return {\r\n sources,\r\n fallbackSrc: img?.getAttribute('src') || '',\r\n alt: img?.getAttribute('alt') || '',\r\n caption,\r\n };\r\n }\r\n }\r\n\r\n return PictureBlot;\r\n } catch (error) {\r\n console.error('Failed to create PictureBlot:', error);\r\n return null;\r\n }\r\n};\r\n\r\nexport default createPictureBlot;\r\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,U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K,CAC1CC,GACF,EAAE,gBAAA,CAEN,CAAC,EAGDD,EAAe,iBAAiB,QAAS,GAAK,CACxCC,GACF,EAAE,gBAAA,CAGN,CAAC,EAYDF,EAAe,YAAYC,CAAc,EACzCN,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"}
|
|
@@ -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-DV4TTDmw.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-n9DJ1y4e.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PictureBlot-PaeA_g_6.js","sources":["../src/components/wazui/WazUiWysiwygInput/blots/PictureBlot.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\r\n\r\nimport { PictureBlotReturnValue, PictureBlotValue, QuillBlockEmbedStatic } from './types';\r\n\r\nconst createPictureBlot = async () => {\r\n if (typeof window === 'undefined') return null;\r\n\r\n try {\r\n const Quill = (await import('quill')).default;\r\n const BlockEmbed = Quill.import('blots/block/embed') as QuillBlockEmbedStatic;\r\n\r\n class PictureBlot extends (BlockEmbed as any) {\r\n static blotName = 'picture';\r\n static tagName = 'div';\r\n static className = 'ql-picture-container';\r\n\r\n static create(value: PictureBlotValue): HTMLElement {\r\n const container = document.createElement('div');\r\n container.className = 'ql-picture-container';\r\n container.style.margin = '1em 0';\r\n\r\n const pictureElement = document.createElement('picture');\r\n\r\n // Create source elements\r\n value.sources.forEach(source => {\r\n const sourceElement = document.createElement('source');\r\n sourceElement.setAttribute('media', source.media);\r\n sourceElement.setAttribute('srcset', source.srcset);\r\n sourceElement.setAttribute('type', source.type);\r\n pictureElement.appendChild(sourceElement);\r\n });\r\n\r\n // Create fallback img element\r\n const imgElement = document.createElement('img');\r\n imgElement.setAttribute('src', value.fallbackSrc);\r\n imgElement.setAttribute('alt', value.alt);\r\n imgElement.setAttribute('loading', 'lazy');\r\n imgElement.style.maxWidth = '100%';\r\n imgElement.style.height = 'auto';\r\n pictureElement.appendChild(imgElement);\r\n\r\n // Create caption element\r\n const captionWrapper = document.createElement('div');\r\n captionWrapper.className = 'ql-picture-caption-wrapper';\r\n captionWrapper.style.position = 'relative';\r\n\r\n const captionElement = document.createElement('div');\r\n captionElement.className = 'ql-picture-caption';\r\n captionElement.innerHTML = value.caption || 'Click to edit caption...';\r\n captionElement.style.fontStyle = 'italic';\r\n captionElement.style.color = value.caption ? '#666' : '#999';\r\n captionElement.style.fontSize = '14px';\r\n captionElement.style.marginTop = '8px';\r\n captionElement.style.textAlign = 'center';\r\n captionElement.style.minHeight = '1.2em';\r\n captionElement.style.outline = 'none';\r\n captionElement.style.padding = '4px';\r\n captionElement.style.borderRadius = '4px';\r\n captionElement.style.cursor = 'text';\r\n captionElement.style.border = '1px solid transparent';\r\n\r\n // Make it NOT contenteditable initially to prevent interference\r\n captionElement.contentEditable = 'false';\r\n\r\n // Store original caption value\r\n captionElement.setAttribute('data-original-caption', value.caption || '');\r\n\r\n // Flag to track editing state\r\n let isEditingCaption = false;\r\n\r\n // Enhanced click handler with better focus management\r\n captionElement.addEventListener('click', e => {\r\n e.stopPropagation();\r\n e.preventDefault();\r\n\r\n if (isEditingCaption) return; // Already editing\r\n\r\n isEditingCaption = true;\r\n\r\n // Mark the caption as being edited (for Quill to ignore)\r\n captionElement.setAttribute('data-editing', 'true');\r\n\r\n // Enter edit mode\r\n captionElement.contentEditable = 'true';\r\n\r\n // Handle placeholder\r\n if (captionElement.innerHTML === 'Click to edit caption...') {\r\n captionElement.innerHTML = '';\r\n captionElement.style.color = '#666';\r\n }\r\n\r\n captionElement.style.border = '1px solid #ddd';\r\n\r\n // Focus with a slight delay to ensure DOM is ready\r\n setTimeout(() => {\r\n captionElement.focus();\r\n\r\n // Set cursor position at the end\r\n const range = document.createRange();\r\n const selection = window.getSelection();\r\n\r\n if (captionElement.childNodes.length > 0) {\r\n const lastNode = captionElement.childNodes[captionElement.childNodes.length - 1];\r\n if (lastNode && lastNode.nodeType === Node.TEXT_NODE) {\r\n range.setStart(lastNode, lastNode.textContent?.length || 0);\r\n } else if (lastNode) {\r\n range.setStartAfter(lastNode);\r\n }\r\n } else {\r\n range.setStart(captionElement, 0);\r\n }\r\n\r\n range.collapse(true);\r\n selection?.removeAllRanges();\r\n selection?.addRange(range);\r\n }, 0);\r\n });\r\n\r\n // Enhanced blur handler\r\n captionElement.addEventListener('blur', () => {\r\n // Small delay to prevent immediate re-blur from Quill interference\r\n setTimeout(() => {\r\n if (isEditingCaption) {\r\n isEditingCaption = false;\r\n captionElement.removeAttribute('data-editing');\r\n\r\n // Exit edit mode\r\n captionElement.contentEditable = 'false';\r\n const text = captionElement.innerHTML.trim();\r\n if (!text || text === '<br>') {\r\n captionElement.innerHTML = 'Click to edit caption...';\r\n captionElement.style.color = '#999';\r\n }\r\n captionElement.style.border = '1px solid transparent';\r\n }\r\n }, 10);\r\n });\r\n\r\n // Improved keydown handler\r\n captionElement.addEventListener('keydown', e => {\r\n if (!isEditingCaption) return;\r\n\r\n // Handle Enter and Escape to exit edit mode\r\n if (e.key === 'Enter' || e.key === 'Escape') {\r\n e.stopPropagation();\r\n e.preventDefault();\r\n captionElement.blur();\r\n return;\r\n }\r\n\r\n // Handle backspace when caption is empty - delete the entire image\r\n if (e.key === 'Backspace') {\r\n const text = captionElement.innerHTML.trim();\r\n if (!text || text === '<br>' || text === 'Click to edit caption...') {\r\n e.stopPropagation();\r\n e.preventDefault();\r\n\r\n // Delete the entire image container\r\n const imageContainer = captionElement.closest('.ql-picture-container');\r\n if (imageContainer && imageContainer.parentNode) {\r\n imageContainer.parentNode.removeChild(imageContainer);\r\n\r\n // Try to focus back to the editor\r\n setTimeout(() => {\r\n const quillEditor = document.querySelector('.ql-editor');\r\n if (quillEditor) {\r\n (quillEditor as HTMLElement).focus();\r\n }\r\n }, 10);\r\n }\r\n return;\r\n }\r\n }\r\n\r\n // Stop all other events from reaching Quill during caption editing\r\n e.stopPropagation();\r\n });\r\n\r\n // Stop input events from reaching Quill during editing\r\n captionElement.addEventListener('input', e => {\r\n if (isEditingCaption) {\r\n e.stopPropagation();\r\n }\r\n });\r\n\r\n // Prevent mouse events from reaching Quill during editing\r\n captionElement.addEventListener('mousedown', e => {\r\n if (isEditingCaption) {\r\n e.stopPropagation();\r\n }\r\n });\r\n\r\n captionElement.addEventListener('mouseup', e => {\r\n if (isEditingCaption) {\r\n e.stopPropagation();\r\n }\r\n });\r\n\r\n // Add paste event handler to prevent bubbling to main editor\r\n captionElement.addEventListener('paste', e => {\r\n if (isEditingCaption) {\r\n e.stopPropagation(); // Prevent bubbling to Quill's paste handler\r\n // Let the default paste behavior handle the text insertion into caption\r\n }\r\n });\r\n\r\n // Prevent mouse events from bubbling to Quill - REMOVE THESE\r\n // captionElement.addEventListener('mousedown', (e) => {\r\n // e.stopPropagation();\r\n // });\r\n\r\n // captionElement.addEventListener('click', (e) => {\r\n // e.stopPropagation();\r\n // captionElement.focus();\r\n // });\r\n\r\n captionWrapper.appendChild(captionElement);\r\n container.appendChild(pictureElement);\r\n container.appendChild(captionWrapper);\r\n\r\n // Make the container non-editable for Quill\r\n container.contentEditable = 'false';\r\n\r\n return container;\r\n }\r\n\r\n static value(node: HTMLElement): PictureBlotReturnValue {\r\n const sources = Array.from(node.querySelectorAll('source')).map(source => ({\r\n media: source.getAttribute('media') || '',\r\n srcset: source.getAttribute('srcset') || '',\r\n type: source.getAttribute('type') || '',\r\n }));\r\n\r\n const img = node.querySelector('img');\r\n const captionElement = node.querySelector('.ql-picture-caption');\r\n let caption = '';\r\n\r\n if (captionElement) {\r\n const text = captionElement.innerHTML.trim();\r\n if (text && text !== 'Click to edit caption...') {\r\n caption = text;\r\n }\r\n }\r\n\r\n return {\r\n sources,\r\n fallbackSrc: img?.getAttribute('src') || '',\r\n alt: img?.getAttribute('alt') || '',\r\n caption,\r\n };\r\n }\r\n }\r\n\r\n return PictureBlot;\r\n } catch (error) {\r\n console.error('Failed to create PictureBlot:', error);\r\n return null;\r\n }\r\n};\r\n\r\nexport default createPictureBlot;\r\n"],"names":["createPictureBlot","BlockEmbed","PictureBlot","value","container","pictureElement","source","sourceElement","imgElement","captionWrapper","captionElement","isEditingCaption","range","selection","lastNode","_a","text","imageCont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,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-n9DJ1y4e.js","sources":["../src/components/wazui/WazUiWysiwygInput/blots/PictureBlot.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\r\n\r\nimport { PictureBlotReturnValue, PictureBlotValue, QuillBlockEmbedStatic } from './types';\r\n\r\nconst createPictureBlot = async () => {\r\n if (typeof window === 'undefined') return null;\r\n\r\n try {\r\n const Quill = (await import('quill')).default;\r\n const BlockEmbed = Quill.import('blots/block/embed') as QuillBlockEmbedStatic;\r\n\r\n class PictureBlot extends (BlockEmbed as any) {\r\n static blotName = 'picture';\r\n static tagName = 'div';\r\n static className = 'ql-picture-container';\r\n\r\n static create(value: PictureBlotValue): HTMLElement {\r\n const container = document.createElement('div');\r\n container.className = 'ql-picture-container';\r\n container.style.margin = '1em 0';\r\n\r\n const pictureElement = document.createElement('picture');\r\n\r\n // Create source elements\r\n value.sources.forEach(source => {\r\n const sourceElement = document.createElement('source');\r\n sourceElement.setAttribute('media', source.media);\r\n sourceElement.setAttribute('srcset', source.srcset);\r\n sourceElement.setAttribute('type', source.type);\r\n pictureElement.appendChild(sourceElement);\r\n });\r\n\r\n // Create fallback img element\r\n const imgElement = document.createElement('img');\r\n imgElement.setAttribute('src', value.fallbackSrc);\r\n imgElement.setAttribute('alt', value.alt);\r\n imgElement.setAttribute('loading', 'lazy');\r\n imgElement.style.maxWidth = '100%';\r\n imgElement.style.height = 'auto';\r\n pictureElement.appendChild(imgElement);\r\n\r\n // Create caption element\r\n const captionWrapper = document.createElement('div');\r\n captionWrapper.className = 'ql-picture-caption-wrapper';\r\n captionWrapper.style.position = 'relative';\r\n\r\n const captionElement = document.createElement('div');\r\n captionElement.className = 'ql-picture-caption';\r\n captionElement.innerHTML = value.caption || 'Click to edit caption...';\r\n captionElement.style.fontStyle = 'italic';\r\n captionElement.style.color = value.caption ? '#666' : '#999';\r\n captionElement.style.fontSize = '14px';\r\n captionElement.style.marginTop = '8px';\r\n captionElement.style.textAlign = 'center';\r\n captionElement.style.minHeight = '1.2em';\r\n captionElement.style.outline = 'none';\r\n captionElement.style.padding = '4px';\r\n captionElement.style.borderRadius = '4px';\r\n captionElement.style.cursor = 'text';\r\n captionElement.style.border = '1px solid transparent';\r\n\r\n // Make it NOT contenteditable initially to prevent interference\r\n captionElement.contentEditable = 'false';\r\n\r\n // Store original caption value\r\n captionElement.setAttribute('data-original-caption', value.caption || '');\r\n\r\n // Flag to track editing state\r\n let isEditingCaption = false;\r\n\r\n // Enhanced click handler with better focus management\r\n captionElement.addEventListener('click', e => {\r\n e.stopPropagation();\r\n e.preventDefault();\r\n\r\n if (isEditingCaption) return; // Already editing\r\n\r\n isEditingCaption = true;\r\n\r\n // Mark the caption as being edited (for Quill to ignore)\r\n captionElement.setAttribute('data-editing', 'true');\r\n\r\n // Enter edit mode\r\n captionElement.contentEditable = 'true';\r\n\r\n // Handle placeholder\r\n if (captionElement.innerHTML === 'Click to edit caption...') {\r\n captionElement.innerHTML = '';\r\n captionElement.style.color = '#666';\r\n }\r\n\r\n captionElement.style.border = '1px solid #ddd';\r\n\r\n // Focus with a slight delay to ensure DOM is ready\r\n setTimeout(() => {\r\n captionElement.focus();\r\n\r\n // Set cursor position at the end\r\n const range = document.createRange();\r\n const selection = window.getSelection();\r\n\r\n if (captionElement.childNodes.length > 0) {\r\n const lastNode = captionElement.childNodes[captionElement.childNodes.length - 1];\r\n if (lastNode && lastNode.nodeType === Node.TEXT_NODE) {\r\n range.setStart(lastNode, lastNode.textContent?.length || 0);\r\n } else if (lastNode) {\r\n range.setStartAfter(lastNode);\r\n }\r\n } else {\r\n range.setStart(captionElement, 0);\r\n }\r\n\r\n range.collapse(true);\r\n selection?.removeAllRanges();\r\n selection?.addRange(range);\r\n }, 0);\r\n });\r\n\r\n // Enhanced blur handler\r\n captionElement.addEventListener('blur', () => {\r\n // Small delay to prevent immediate re-blur from Quill interference\r\n setTimeout(() => {\r\n if (isEditingCaption) {\r\n isEditingCaption = false;\r\n captionElement.removeAttribute('data-editing');\r\n\r\n // Exit edit mode\r\n captionElement.contentEditable = 'false';\r\n const text = captionElement.innerHTML.trim();\r\n if (!text || text === '<br>') {\r\n captionElement.innerHTML = 'Click to edit caption...';\r\n captionElement.style.color = '#999';\r\n }\r\n captionElement.style.border = '1px solid transparent';\r\n }\r\n }, 10);\r\n });\r\n\r\n // Improved keydown handler\r\n captionElement.addEventListener('keydown', e => {\r\n if (!isEditingCaption) return;\r\n\r\n // Handle Enter and Escape to exit edit mode\r\n if (e.key === 'Enter' || e.key === 'Escape') {\r\n e.stopPropagation();\r\n e.preventDefault();\r\n captionElement.blur();\r\n return;\r\n }\r\n\r\n // Handle backspace when caption is empty - delete the entire image\r\n if (e.key === 'Backspace') {\r\n const text = captionElement.innerHTML.trim();\r\n if (!text || text === '<br>' || text === 'Click to edit caption...') {\r\n e.stopPropagation();\r\n e.preventDefault();\r\n\r\n // Delete the entire image container\r\n const imageContainer = captionElement.closest('.ql-picture-container');\r\n if (imageContainer && imageContainer.parentNode) {\r\n imageContainer.parentNode.removeChild(imageContainer);\r\n\r\n // Try to focus back to the editor\r\n setTimeout(() => {\r\n const quillEditor = document.querySelector('.ql-editor');\r\n if (quillEditor) {\r\n (quillEditor as HTMLElement).focus();\r\n }\r\n }, 10);\r\n }\r\n return;\r\n }\r\n }\r\n\r\n // Stop all other events from reaching Quill during caption editing\r\n e.stopPropagation();\r\n });\r\n\r\n // Stop input events from reaching Quill during editing\r\n captionElement.addEventListener('input', e => {\r\n if (isEditingCaption) {\r\n e.stopPropagation();\r\n }\r\n });\r\n\r\n // Prevent mouse events from reaching Quill during editing\r\n captionElement.addEventListener('mousedown', e => {\r\n if (isEditingCaption) {\r\n e.stopPropagation();\r\n }\r\n });\r\n\r\n captionElement.addEventListener('mouseup', e => {\r\n if (isEditingCaption) {\r\n e.stopPropagation();\r\n }\r\n });\r\n\r\n // Add paste event handler to prevent bubbling to main editor\r\n captionElement.addEventListener('paste', e => {\r\n if (isEditingCaption) {\r\n e.stopPropagation(); // Prevent bubbling to Quill's paste handler\r\n // Let the default paste behavior handle the text insertion into caption\r\n }\r\n });\r\n\r\n // Prevent mouse events from bubbling to Quill - REMOVE THESE\r\n // captionElement.addEventListener('mousedown', (e) => {\r\n // e.stopPropagation();\r\n // });\r\n\r\n // captionElement.addEventListener('click', (e) => {\r\n // e.stopPropagation();\r\n // captionElement.focus();\r\n // });\r\n\r\n captionWrapper.appendChild(captionElement);\r\n container.appendChild(pictureElement);\r\n container.appendChild(captionWrapper);\r\n\r\n // Make the container non-editable for Quill\r\n container.contentEditable = 'false';\r\n\r\n return container;\r\n }\r\n\r\n static value(node: HTMLElement): PictureBlotReturnValue {\r\n const sources = Array.from(node.querySelectorAll('source')).map(source => ({\r\n media: source.getAttribute('media') || '',\r\n srcset: source.getAttribute('srcset') || '',\r\n type: source.getAttribute('type') || '',\r\n }));\r\n\r\n const img = node.querySelector('img');\r\n const captionElement = node.querySelector('.ql-picture-caption');\r\n let caption = '';\r\n\r\n if (captionElement) {\r\n const text = captionElement.innerHTML.trim();\r\n if (text && text !== 'Click to edit caption...') {\r\n caption = text;\r\n }\r\n }\r\n\r\n return {\r\n sources,\r\n fallbackSrc: img?.getAttribute('src') || '',\r\n alt: img?.getAttribute('alt') || '',\r\n caption,\r\n };\r\n }\r\n }\r\n\r\n return PictureBlot;\r\n } catch (error) {\r\n console.error('Failed to create PictureBlot:', error);\r\n return null;\r\n }\r\n};\r\n\r\nexport default createPictureBlot;\r\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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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;"}
|
|
@@ -67,11 +67,14 @@ function L(n, o) {
|
|
|
67
67
|
const P = async () => {
|
|
68
68
|
if (typeof window > "u") return null;
|
|
69
69
|
try {
|
|
70
|
-
const o = (await import("./quill-
|
|
70
|
+
const o = (await import("./quill-DV4TTDmw.js")).default.import("blots/block/embed");
|
|
71
71
|
class d extends o {
|
|
72
72
|
static create(i) {
|
|
73
73
|
const r = x(i.embed), s = document.createElement("div");
|
|
74
|
-
s.className = "ql-cms-video-wrapper", s.contentEditable = "false", s.setAttribute(
|
|
74
|
+
s.className = "ql-cms-video-wrapper", s.contentEditable = "false", s.setAttribute(
|
|
75
|
+
"data-embed",
|
|
76
|
+
typeof i.embed == "string" ? i.embed : JSON.stringify(i.embed)
|
|
77
|
+
), i.thumbnailUrl && s.setAttribute("data-thumbnail-url", i.thumbnailUrl), i.url && s.setAttribute("data-video-url", i.url);
|
|
75
78
|
const p = /class=["']vsly-player["']/.test(r), f = !p && w(i.url), a = document.createElement("div");
|
|
76
79
|
if (a.className = "ql-cms-video-player", a.style.position = "relative", a.style.width = "100%", a.style.background = "#ddd", a.style.overflow = "hidden", p || (a.style.paddingTop = "56.25%"), r)
|
|
77
80
|
L(a, r);
|
|
@@ -173,4 +176,4 @@ const P = async () => {
|
|
|
173
176
|
export {
|
|
174
177
|
P as default
|
|
175
178
|
};
|
|
176
|
-
//# sourceMappingURL=VideoBlot-
|
|
179
|
+
//# sourceMappingURL=VideoBlot-BCqH6Tuv.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VideoBlot-BCqH6Tuv.js","sources":["../src/components/wazui/WazUiWysiwygInput/blots/VideoBlot.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { VideoBlotReturnValue, VideoBlotValue, QuillBlockEmbedStatic } from './types';\n\nconst PLACEHOLDER_CAPTION = 'Click to edit caption...';\n\nfunction parseEmbed(\n value: VideoBlotValue['embed']\n): { sdk?: string | null; [key: string]: unknown } | null {\n if (!value) return null;\n if (typeof value === 'string') {\n try {\n return JSON.parse(value) as { sdk?: string | null; [key: string]: unknown };\n } catch {\n return null;\n }\n }\n return value;\n}\n\nfunction getSdkHtml(value: VideoBlotValue['embed']): string {\n const embed = parseEmbed(value);\n return embed?.sdk || '';\n}\n\nfunction isSafeHttpUrl(url: string | undefined): url is string {\n if (!url) return false;\n try {\n const parsed = new URL(url);\n return parsed.protocol === 'https:' || parsed.protocol === 'http:';\n } catch {\n return false;\n }\n}\n\nconst ALLOWED_SDK_ORIGIN = 'https://cdn.viously.com';\n\nfunction isSafeSdkUrl(url: string): boolean {\n try {\n const parsed = new URL(url);\n return parsed.origin === ALLOWED_SDK_ORIGIN;\n } catch {\n return false;\n }\n}\n\n/**\n * Sanitize a style attribute by keeping only safe, layout-only declarations.\n * We allow only `padding-top` with a percentage value (used by Viously for\n * aspect ratio). Everything else is stripped to prevent CSS-based XSS such as\n * `background: url(javascript:...)`. */\nfunction sanitizeStyle(style: string | null): string | undefined {\n if (!style) return undefined;\n const allowed: string[] = [];\n for (const declaration of style.split(';')) {\n const colonIndex = declaration.indexOf(':');\n if (colonIndex === -1) continue;\n const property = declaration.slice(0, colonIndex).trim().toLowerCase();\n const value = declaration.slice(colonIndex + 1).trim();\n if (property === 'padding-top' && /^\\d+(\\.\\d+)?%$/.test(value)) {\n allowed.push(`${property}: ${value}`);\n }\n }\n return allowed.length ? allowed.join('; ') : undefined;\n}\n\n/**\n * Render Viously SDK markup without innerHTML to avoid stored XSS from\n * API-returned embed strings. Only the known Viously SDK shape is allowed:\n * a single .vsly-player div plus an optional script tag from cdn.viously.com.\n */\nfunction renderSdkSafely(container: HTMLElement, sdkHtml: string): void {\n const parser = new DOMParser();\n const doc = parser.parseFromString(sdkHtml, 'text/html');\n const body = doc.body;\n\n for (const child of Array.from(body.childNodes)) {\n if (!(child instanceof HTMLElement)) continue;\n\n if (child.tagName.toLowerCase() === 'div') {\n const div = document.createElement('div');\n const allowedAttributes = ['class', 'id', 'data-video-id'];\n for (const attr of allowedAttributes) {\n if (child.hasAttribute(attr)) {\n div.setAttribute(attr, child.getAttribute(attr)!);\n }\n }\n const safeStyle = sanitizeStyle(child.getAttribute('style'));\n if (safeStyle) {\n div.setAttribute('style', safeStyle);\n }\n container.appendChild(div);\n } else if (child.tagName.toLowerCase() === 'script') {\n const src = child.getAttribute('src');\n if (src && isSafeSdkUrl(src)) {\n const script = document.createElement('script');\n script.src = src;\n if (child.hasAttribute('async')) {\n script.async = true;\n }\n container.appendChild(script);\n }\n }\n }\n}\n\nconst createVideoBlot = 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 VideoBlot extends (BlockEmbed as any) {\n static blotName = 'cms-video';\n static tagName = 'div';\n static className = 'ql-cms-video-wrapper';\n\n static create(value: VideoBlotValue): HTMLElement {\n const sdkHtml = getSdkHtml(value.embed);\n\n // Wrap container + caption so Quill treats them as one block\n const wrapper = document.createElement('div');\n wrapper.className = 'ql-cms-video-wrapper';\n wrapper.contentEditable = 'false';\n wrapper.setAttribute(\n 'data-embed',\n typeof value.embed === 'string' ? value.embed : JSON.stringify(value.embed)\n );\n if (value.thumbnailUrl) {\n wrapper.setAttribute('data-thumbnail-url', value.thumbnailUrl);\n }\n if (value.url) {\n wrapper.setAttribute('data-video-url', value.url);\n }\n\n const isViouslySdk = /class=[\"']vsly-player[\"']/.test(sdkHtml);\n const isCmsVideo = !isViouslySdk && isSafeHttpUrl(value.url);\n\n // Player container: render the Viously SDK markup from the API\n const playerContainer = document.createElement('div');\n playerContainer.className = 'ql-cms-video-player';\n playerContainer.style.position = 'relative';\n playerContainer.style.width = '100%';\n playerContainer.style.background = '#ddd';\n playerContainer.style.overflow = 'hidden';\n // Only force a 16:9 aspect ratio when the SDK markup doesn't already\n // define its own (the Viously SDK includes its own padding-top wrapper).\n if (!isViouslySdk) {\n playerContainer.style.paddingTop = '56.25%';\n }\n\n if (sdkHtml) {\n renderSdkSafely(playerContainer, sdkHtml);\n } else if (isCmsVideo) {\n // CMS uploaded videos: render a plain <video> element using the direct URL.\n const video = document.createElement('video');\n video.src = value.url as string;\n video.setAttribute('preload', 'metadata');\n video.setAttribute('controls', '');\n video.setAttribute('muted', '');\n video.setAttribute('playsinline', '');\n video.style.position = 'absolute';\n video.style.inset = '0';\n video.style.width = '100%';\n video.style.height = '100%';\n video.style.objectFit = 'cover';\n playerContainer.appendChild(video);\n }\n\n // Only show the thumbnail preview inside the actual editor and only for\n // Viously, because the Viously SDK script doesn't run there. CMS videos\n // already show a frame via the <video> element itself.\n const isEditor =\n typeof window !== 'undefined' &&\n !!(window as unknown as Record<string, unknown>).__WAZUI_EDITOR_PREVIEW__;\n\n if (isSafeHttpUrl(value.thumbnailUrl) && isEditor && isViouslySdk) {\n const preview = document.createElement('div');\n preview.className = 'ql-cms-video-preview';\n preview.style.position = 'absolute';\n preview.style.inset = '0';\n preview.style.backgroundImage = `url(${value.thumbnailUrl})`;\n preview.style.backgroundSize = 'cover';\n preview.style.backgroundPosition = 'center';\n preview.style.display = 'flex';\n preview.style.alignItems = 'center';\n preview.style.justifyContent = 'center';\n preview.style.pointerEvents = 'none';\n\n const playIcon = document.createElement('div');\n playIcon.style.width = '64px';\n playIcon.style.height = '64px';\n playIcon.style.borderRadius = '50%';\n playIcon.style.background = 'rgba(0,0,0,0.6)';\n playIcon.style.display = 'flex';\n playIcon.style.alignItems = 'center';\n playIcon.style.justifyContent = 'center';\n\n const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n svg.setAttribute('width', '24');\n svg.setAttribute('height', '24');\n svg.setAttribute('viewBox', '0 0 24 24');\n svg.setAttribute('fill', 'white');\n const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');\n path.setAttribute('d', 'M8 5v14l11-7z');\n svg.appendChild(path);\n playIcon.appendChild(svg);\n\n preview.appendChild(playIcon);\n playerContainer.appendChild(preview);\n }\n\n wrapper.appendChild(playerContainer);\n\n // Create caption element\n const captionElement = document.createElement('div');\n captionElement.className = 'ql-cms-video-caption';\n captionElement.textContent = value.caption || PLACEHOLDER_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.contentEditable = 'false';\n captionElement.setAttribute('data-original-caption', value.caption || '');\n\n let isEditingCaption = false;\n\n captionElement.addEventListener('click', e => {\n e.stopPropagation();\n e.preventDefault();\n\n if (isEditingCaption) return;\n\n isEditingCaption = true;\n captionElement.setAttribute('data-editing', 'true');\n captionElement.contentEditable = 'true';\n\n if (captionElement.textContent === PLACEHOLDER_CAPTION) {\n captionElement.textContent = '';\n captionElement.style.color = '#666';\n }\n\n setTimeout(() => {\n captionElement.focus();\n const range = document.createRange();\n const selection = window.getSelection();\n range.selectNodeContents(captionElement);\n range.collapse(false);\n selection?.removeAllRanges();\n selection?.addRange(range);\n }, 0);\n });\n\n captionElement.addEventListener('blur', () => {\n setTimeout(() => {\n if (!captionElement.isConnected) return;\n if (isEditingCaption) {\n isEditingCaption = false;\n captionElement.removeAttribute('data-editing');\n captionElement.contentEditable = 'false';\n const text = captionElement.textContent?.trim() || '';\n if (!text) {\n captionElement.textContent = PLACEHOLDER_CAPTION;\n captionElement.style.color = '#999';\n }\n }\n }, 10);\n });\n\n captionElement.addEventListener('keydown', e => {\n if (!isEditingCaption) return;\n\n if (e.key === 'Enter' || e.key === 'Escape') {\n e.stopPropagation();\n e.preventDefault();\n captionElement.blur();\n return;\n }\n\n if (e.key === 'Backspace') {\n const text = captionElement.textContent?.trim() || '';\n if (!text || text === PLACEHOLDER_CAPTION) {\n e.stopPropagation();\n e.preventDefault();\n\n const videoContainer = captionElement.closest('.ql-cms-video-wrapper');\n if (videoContainer && videoContainer.parentNode) {\n videoContainer.parentNode.removeChild(videoContainer);\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 e.stopPropagation();\n });\n\n captionElement.addEventListener('input', e => {\n if (isEditingCaption) {\n e.stopPropagation();\n }\n });\n\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 captionElement.addEventListener('paste', e => {\n if (isEditingCaption) {\n e.stopPropagation();\n }\n });\n\n wrapper.appendChild(captionElement);\n\n return wrapper;\n }\n\n static value(node: HTMLElement): VideoBlotReturnValue {\n const captionElement = node.querySelector('.ql-cms-video-caption');\n const playerContainer = node.querySelector('.ql-cms-video-player');\n let caption = '';\n\n if (captionElement) {\n const text = captionElement.textContent?.trim() || '';\n if (text && text !== PLACEHOLDER_CAPTION) {\n caption = text;\n }\n }\n\n // Try to recover the original embed data from the rendered SDK markup.\n // If the wrapper was created from raw HTML (e.g. pasted), fall back to\n // serialising the current player container so the content is preserved.\n let embed: VideoBlotReturnValue['embed'] = '';\n const embedData = node.getAttribute('data-embed');\n if (embedData) {\n try {\n embed = JSON.parse(embedData) as VideoBlotReturnValue['embed'];\n } catch {\n embed = embedData;\n }\n } else if (playerContainer) {\n const vslyPlayer = playerContainer.querySelector('.vsly-player');\n if (vslyPlayer) {\n embed = { sdk: vslyPlayer.outerHTML };\n } else {\n embed = { sdk: playerContainer.innerHTML };\n }\n }\n\n const thumbnailUrl = node.getAttribute('data-thumbnail-url') || undefined;\n const url = node.getAttribute('data-video-url') || undefined;\n\n return {\n embed,\n caption,\n thumbnailUrl,\n url,\n };\n }\n }\n\n return VideoBlot;\n } catch (error) {\n console.error('Failed to create VideoBlot:', error);\n return null;\n }\n};\n\nexport default createVideoBlot;\n"],"names":["PLACEHOLDER_CAPTION","parseEmbed","value","getSdkHtml","embed","isSafeHttpUrl","url","parsed","ALLOWED_SDK_ORIGIN","isSafeSdkUrl","sanitizeStyle","style","allowed","declaration","colonIndex","property","renderSdkSafely","container","sdkHtml","body","child","div","allowedAttributes","attr","safeStyle","src","script","createVideoBlot","BlockEmbed","VideoBlot","wrapper","isViouslySdk","isCmsVideo","playerContainer","video","isEditor","preview","playIcon","svg","path","captionElement","isEditingCaption","e","range","selection","_a","text","videoContainer","quillEditor","node","caption","embedData","vslyPlayer","thumbnailUrl","__publicField","error"],"mappings":";;;;AAIA,MAAMA,IAAsB;AAE5B,SAASC,EACPC,GACwD;AACxD,MAAI,CAACA,EAAO,QAAO;AACnB,MAAI,OAAOA,KAAU;AACnB,QAAI;AACF,aAAO,KAAK,MAAMA,CAAK;AAAA,IACzB,QAAQ;AACN,aAAO;AAAA,IACT;AAEF,SAAOA;AACT;AAEA,SAASC,EAAWD,GAAwC;AAC1D,QAAME,IAAQH,EAAWC,CAAK;AAC9B,UAAOE,KAAA,gBAAAA,EAAO,QAAO;AACvB;AAEA,SAASC,EAAcC,GAAwC;AAC7D,MAAI,CAACA,EAAK,QAAO;AACjB,MAAI;AACF,UAAMC,IAAS,IAAI,IAAID,CAAG;AAC1B,WAAOC,EAAO,aAAa,YAAYA,EAAO,aAAa;AAAA,EAC7D,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,MAAMC,IAAqB;AAE3B,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n[o]=d;var g=(n,o,d)=>A(n,typeof o!="symbol"?o+"":o,d);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b="Click to edit caption...";function C(n){if(!n)return null;if(typeof n=="string")try{return JSON.parse(n)}catch{return null}return n}function x(n){const o=C(n);return(o==null?void 0:o.sdk)||""}function w(n){if(!n)return!1;try{const o=new URL(n);return o.protocol==="https:"||o.protocol==="http:"}catch{return!1}}const S="https://cdn.viously.com";function k(n){try{return new URL(n).origin===S}catch{return!1}}function N(n){if(!n)return;const o=[];for(const d of n.split(";")){const y=d.indexOf(":");if(y===-1)continue;const i=d.slice(0,y).trim().toLowerCase(),r=d.slice(y+1).trim();i==="padding-top"&&/^\d+(\.\d+)?%$/.test(r)&&o.push(`${i}: ${r}`)}return o.length?o.join("; "):void 0}function L(n,o){const i=new DOMParser().parseFromString(o,"text/html").body;for(const r of Array.from(i.childNodes))if(r instanceof HTMLElement){if(r.tagName.toLowerCase()==="div"){const s=document.createElement("div"),p=["class","id","data-video-id"];for(const a of p)r.hasAttribute(a)&&s.setAttribute(a,r.getAttribute(a));const f=N(r.getAttribute("style"));f&&s.setAttribute("style",f),n.appendChild(s)}else if(r.tagName.toLowerCase()==="script"){const s=r.getAttribute("src");if(s&&k(s)){const p=document.createElement("script");p.src=s,r.hasAttribute("async")&&(p.async=!0),n.appendChild(p)}}}}const P=async()=>{if(typeof window>"u")return null;try{const o=(await Promise.resolve().then(()=>require("./quill-
|
|
2
|
-
//# sourceMappingURL=VideoBlot-
|
|
1
|
+
"use client";"use strict";var E=Object.defineProperty;var A=(n,o,d)=>o in n?E(n,o,{enumerable:!0,configurable:!0,writable:!0,value:d}):n[o]=d;var g=(n,o,d)=>A(n,typeof o!="symbol"?o+"":o,d);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b="Click to edit caption...";function C(n){if(!n)return null;if(typeof n=="string")try{return JSON.parse(n)}catch{return null}return n}function x(n){const o=C(n);return(o==null?void 0:o.sdk)||""}function w(n){if(!n)return!1;try{const o=new URL(n);return o.protocol==="https:"||o.protocol==="http:"}catch{return!1}}const S="https://cdn.viously.com";function k(n){try{return new URL(n).origin===S}catch{return!1}}function N(n){if(!n)return;const o=[];for(const d of n.split(";")){const y=d.indexOf(":");if(y===-1)continue;const i=d.slice(0,y).trim().toLowerCase(),r=d.slice(y+1).trim();i==="padding-top"&&/^\d+(\.\d+)?%$/.test(r)&&o.push(`${i}: ${r}`)}return o.length?o.join("; "):void 0}function L(n,o){const i=new DOMParser().parseFromString(o,"text/html").body;for(const r of Array.from(i.childNodes))if(r instanceof HTMLElement){if(r.tagName.toLowerCase()==="div"){const s=document.createElement("div"),p=["class","id","data-video-id"];for(const a of p)r.hasAttribute(a)&&s.setAttribute(a,r.getAttribute(a));const f=N(r.getAttribute("style"));f&&s.setAttribute("style",f),n.appendChild(s)}else if(r.tagName.toLowerCase()==="script"){const s=r.getAttribute("src");if(s&&k(s)){const p=document.createElement("script");p.src=s,r.hasAttribute("async")&&(p.async=!0),n.appendChild(p)}}}}const P=async()=>{if(typeof window>"u")return null;try{const o=(await Promise.resolve().then(()=>require("./quill-Cb1P-QRW.cjs"))).default.import("blots/block/embed");class d extends o{static create(i){const r=x(i.embed),s=document.createElement("div");s.className="ql-cms-video-wrapper",s.contentEditable="false",s.setAttribute("data-embed",typeof i.embed=="string"?i.embed:JSON.stringify(i.embed)),i.thumbnailUrl&&s.setAttribute("data-thumbnail-url",i.thumbnailUrl),i.url&&s.setAttribute("data-video-url",i.url);const p=/class=["']vsly-player["']/.test(r),f=!p&&w(i.url),a=document.createElement("div");if(a.className="ql-cms-video-player",a.style.position="relative",a.style.width="100%",a.style.background="#ddd",a.style.overflow="hidden",p||(a.style.paddingTop="56.25%"),r)L(a,r);else if(f){const t=document.createElement("video");t.src=i.url,t.setAttribute("preload","metadata"),t.setAttribute("controls",""),t.setAttribute("muted",""),t.setAttribute("playsinline",""),t.style.position="absolute",t.style.inset="0",t.style.width="100%",t.style.height="100%",t.style.objectFit="cover",a.appendChild(t)}const h=typeof window<"u"&&!!window.__WAZUI_EDITOR_PREVIEW__;if(w(i.thumbnailUrl)&&h&&p){const t=document.createElement("div");t.className="ql-cms-video-preview",t.style.position="absolute",t.style.inset="0",t.style.backgroundImage=`url(${i.thumbnailUrl})`,t.style.backgroundSize="cover",t.style.backgroundPosition="center",t.style.display="flex",t.style.alignItems="center",t.style.justifyContent="center",t.style.pointerEvents="none";const l=document.createElement("div");l.style.width="64px",l.style.height="64px",l.style.borderRadius="50%",l.style.background="rgba(0,0,0,0.6)",l.style.display="flex",l.style.alignItems="center",l.style.justifyContent="center";const c=document.createElementNS("http://www.w3.org/2000/svg","svg");c.setAttribute("width","24"),c.setAttribute("height","24"),c.setAttribute("viewBox","0 0 24 24"),c.setAttribute("fill","white");const m=document.createElementNS("http://www.w3.org/2000/svg","path");m.setAttribute("d","M8 5v14l11-7z"),c.appendChild(m),l.appendChild(c),t.appendChild(l),a.appendChild(t)}s.appendChild(a);const e=document.createElement("div");e.className="ql-cms-video-caption",e.textContent=i.caption||b,e.style.fontStyle="italic",e.style.color=i.caption?"#666":"#999",e.style.fontSize="14px",e.style.marginTop="8px",e.style.textAlign="center",e.style.minHeight="1.2em",e.style.outline="none",e.style.padding="4px",e.style.borderRadius="4px",e.style.cursor="text",e.contentEditable="false",e.setAttribute("data-original-caption",i.caption||"");let u=!1;return e.addEventListener("click",t=>{t.stopPropagation(),t.preventDefault(),!u&&(u=!0,e.setAttribute("data-editing","true"),e.contentEditable="true",e.textContent===b&&(e.textContent="",e.style.color="#666"),setTimeout(()=>{e.focus();const l=document.createRange(),c=window.getSelection();l.selectNodeContents(e),l.collapse(!1),c==null||c.removeAllRanges(),c==null||c.addRange(l)},0))}),e.addEventListener("blur",()=>{setTimeout(()=>{var t;e.isConnected&&u&&(u=!1,e.removeAttribute("data-editing"),e.contentEditable="false",(t=e.textContent)!=null&&t.trim()||(e.textContent=b,e.style.color="#999"))},10)}),e.addEventListener("keydown",t=>{var l;if(u){if(t.key==="Enter"||t.key==="Escape"){t.stopPropagation(),t.preventDefault(),e.blur();return}if(t.key==="Backspace"){const c=((l=e.textContent)==null?void 0:l.trim())||"";if(!c||c===b){t.stopPropagation(),t.preventDefault();const m=e.closest(".ql-cms-video-wrapper");m&&m.parentNode&&(m.parentNode.removeChild(m),setTimeout(()=>{const v=document.querySelector(".ql-editor");v&&v.focus()},10));return}}t.stopPropagation()}}),e.addEventListener("input",t=>{u&&t.stopPropagation()}),e.addEventListener("mousedown",t=>{u&&t.stopPropagation()}),e.addEventListener("mouseup",t=>{u&&t.stopPropagation()}),e.addEventListener("paste",t=>{u&&t.stopPropagation()}),s.appendChild(e),s}static value(i){var u;const r=i.querySelector(".ql-cms-video-caption"),s=i.querySelector(".ql-cms-video-player");let p="";if(r){const t=((u=r.textContent)==null?void 0:u.trim())||"";t&&t!==b&&(p=t)}let f="";const a=i.getAttribute("data-embed");if(a)try{f=JSON.parse(a)}catch{f=a}else if(s){const t=s.querySelector(".vsly-player");t?f={sdk:t.outerHTML}:f={sdk:s.innerHTML}}const h=i.getAttribute("data-thumbnail-url")||void 0,e=i.getAttribute("data-video-url")||void 0;return{embed:f,caption:p,thumbnailUrl:h,url:e}}}return g(d,"blotName","cms-video"),g(d,"tagName","div"),g(d,"className","ql-cms-video-wrapper"),d}catch(n){return console.error("Failed to create VideoBlot:",n),null}};exports.default=P;
|
|
2
|
+
//# sourceMappingURL=VideoBlot-HWxrW3WY.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VideoBlot-HWxrW3WY.cjs","sources":["../src/components/wazui/WazUiWysiwygInput/blots/VideoBlot.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { VideoBlotReturnValue, VideoBlotValue, QuillBlockEmbedStatic } from './types';\n\nconst PLACEHOLDER_CAPTION = 'Click to edit caption...';\n\nfunction parseEmbed(\n value: VideoBlotValue['embed']\n): { sdk?: string | null; [key: string]: unknown } | null {\n if (!value) return null;\n if (typeof value === 'string') {\n try {\n return JSON.parse(value) as { sdk?: string | null; [key: string]: unknown };\n } catch {\n return null;\n }\n }\n return value;\n}\n\nfunction getSdkHtml(value: VideoBlotValue['embed']): string {\n const embed = parseEmbed(value);\n return embed?.sdk || '';\n}\n\nfunction isSafeHttpUrl(url: string | undefined): url is string {\n if (!url) return false;\n try {\n const parsed = new URL(url);\n return parsed.protocol === 'https:' || parsed.protocol === 'http:';\n } catch {\n return false;\n }\n}\n\nconst ALLOWED_SDK_ORIGIN = 'https://cdn.viously.com';\n\nfunction isSafeSdkUrl(url: string): boolean {\n try {\n const parsed = new URL(url);\n return parsed.origin === ALLOWED_SDK_ORIGIN;\n } catch {\n return false;\n }\n}\n\n/**\n * Sanitize a style attribute by keeping only safe, layout-only declarations.\n * We allow only `padding-top` with a percentage value (used by Viously for\n * aspect ratio). Everything else is stripped to prevent CSS-based XSS such as\n * `background: url(javascript:...)`. */\nfunction sanitizeStyle(style: string | null): string | undefined {\n if (!style) return undefined;\n const allowed: string[] = [];\n for (const declaration of style.split(';')) {\n const colonIndex = declaration.indexOf(':');\n if (colonIndex === -1) continue;\n const property = declaration.slice(0, colonIndex).trim().toLowerCase();\n const value = declaration.slice(colonIndex + 1).trim();\n if (property === 'padding-top' && /^\\d+(\\.\\d+)?%$/.test(value)) {\n allowed.push(`${property}: ${value}`);\n }\n }\n return allowed.length ? allowed.join('; ') : undefined;\n}\n\n/**\n * Render Viously SDK markup without innerHTML to avoid stored XSS from\n * API-returned embed strings. Only the known Viously SDK shape is allowed:\n * a single .vsly-player div plus an optional script tag from cdn.viously.com.\n */\nfunction renderSdkSafely(container: HTMLElement, sdkHtml: string): void {\n const parser = new DOMParser();\n const doc = parser.parseFromString(sdkHtml, 'text/html');\n const body = doc.body;\n\n for (const child of Array.from(body.childNodes)) {\n if (!(child instanceof HTMLElement)) continue;\n\n if (child.tagName.toLowerCase() === 'div') {\n const div = document.createElement('div');\n const allowedAttributes = ['class', 'id', 'data-video-id'];\n for (const attr of allowedAttributes) {\n if (child.hasAttribute(attr)) {\n div.setAttribute(attr, child.getAttribute(attr)!);\n }\n }\n const safeStyle = sanitizeStyle(child.getAttribute('style'));\n if (safeStyle) {\n div.setAttribute('style', safeStyle);\n }\n container.appendChild(div);\n } else if (child.tagName.toLowerCase() === 'script') {\n const src = child.getAttribute('src');\n if (src && isSafeSdkUrl(src)) {\n const script = document.createElement('script');\n script.src = src;\n if (child.hasAttribute('async')) {\n script.async = true;\n }\n container.appendChild(script);\n }\n }\n }\n}\n\nconst createVideoBlot = 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 VideoBlot extends (BlockEmbed as any) {\n static blotName = 'cms-video';\n static tagName = 'div';\n static className = 'ql-cms-video-wrapper';\n\n static create(value: VideoBlotValue): HTMLElement {\n const sdkHtml = getSdkHtml(value.embed);\n\n // Wrap container + caption so Quill treats them as one block\n const wrapper = document.createElement('div');\n wrapper.className = 'ql-cms-video-wrapper';\n wrapper.contentEditable = 'false';\n wrapper.setAttribute(\n 'data-embed',\n typeof value.embed === 'string' ? value.embed : JSON.stringify(value.embed)\n );\n if (value.thumbnailUrl) {\n wrapper.setAttribute('data-thumbnail-url', value.thumbnailUrl);\n }\n if (value.url) {\n wrapper.setAttribute('data-video-url', value.url);\n }\n\n const isViouslySdk = /class=[\"']vsly-player[\"']/.test(sdkHtml);\n const isCmsVideo = !isViouslySdk && isSafeHttpUrl(value.url);\n\n // Player container: render the Viously SDK markup from the API\n const playerContainer = document.createElement('div');\n playerContainer.className = 'ql-cms-video-player';\n playerContainer.style.position = 'relative';\n playerContainer.style.width = '100%';\n playerContainer.style.background = '#ddd';\n playerContainer.style.overflow = 'hidden';\n // Only force a 16:9 aspect ratio when the SDK markup doesn't already\n // define its own (the Viously SDK includes its own padding-top wrapper).\n if (!isViouslySdk) {\n playerContainer.style.paddingTop = '56.25%';\n }\n\n if (sdkHtml) {\n renderSdkSafely(playerContainer, sdkHtml);\n } else if (isCmsVideo) {\n // CMS uploaded videos: render a plain <video> element using the direct URL.\n const video = document.createElement('video');\n video.src = value.url as string;\n video.setAttribute('preload', 'metadata');\n video.setAttribute('controls', '');\n video.setAttribute('muted', '');\n video.setAttribute('playsinline', '');\n video.style.position = 'absolute';\n video.style.inset = '0';\n video.style.width = '100%';\n video.style.height = '100%';\n video.style.objectFit = 'cover';\n playerContainer.appendChild(video);\n }\n\n // Only show the thumbnail preview inside the actual editor and only for\n // Viously, because the Viously SDK script doesn't run there. CMS videos\n // already show a frame via the <video> element itself.\n const isEditor =\n typeof window !== 'undefined' &&\n !!(window as unknown as Record<string, unknown>).__WAZUI_EDITOR_PREVIEW__;\n\n if (isSafeHttpUrl(value.thumbnailUrl) && isEditor && isViouslySdk) {\n const preview = document.createElement('div');\n preview.className = 'ql-cms-video-preview';\n preview.style.position = 'absolute';\n preview.style.inset = '0';\n preview.style.backgroundImage = `url(${value.thumbnailUrl})`;\n preview.style.backgroundSize = 'cover';\n preview.style.backgroundPosition = 'center';\n preview.style.display = 'flex';\n preview.style.alignItems = 'center';\n preview.style.justifyContent = 'center';\n preview.style.pointerEvents = 'none';\n\n const playIcon = document.createElement('div');\n playIcon.style.width = '64px';\n playIcon.style.height = '64px';\n playIcon.style.borderRadius = '50%';\n playIcon.style.background = 'rgba(0,0,0,0.6)';\n playIcon.style.display = 'flex';\n playIcon.style.alignItems = 'center';\n playIcon.style.justifyContent = 'center';\n\n const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n svg.setAttribute('width', '24');\n svg.setAttribute('height', '24');\n svg.setAttribute('viewBox', '0 0 24 24');\n svg.setAttribute('fill', 'white');\n const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');\n path.setAttribute('d', 'M8 5v14l11-7z');\n svg.appendChild(path);\n playIcon.appendChild(svg);\n\n preview.appendChild(playIcon);\n playerContainer.appendChild(preview);\n }\n\n wrapper.appendChild(playerContainer);\n\n // Create caption element\n const captionElement = document.createElement('div');\n captionElement.className = 'ql-cms-video-caption';\n captionElement.textContent = value.caption || PLACEHOLDER_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.contentEditable = 'false';\n captionElement.setAttribute('data-original-caption', value.caption || '');\n\n let isEditingCaption = false;\n\n captionElement.addEventListener('click', e => {\n e.stopPropagation();\n e.preventDefault();\n\n if (isEditingCaption) return;\n\n isEditingCaption = true;\n captionElement.setAttribute('data-editing', 'true');\n captionElement.contentEditable = 'true';\n\n if (captionElement.textContent === PLACEHOLDER_CAPTION) {\n captionElement.textContent = '';\n captionElement.style.color = '#666';\n }\n\n setTimeout(() => {\n captionElement.focus();\n const range = document.createRange();\n const selection = window.getSelection();\n range.selectNodeContents(captionElement);\n range.collapse(false);\n selection?.removeAllRanges();\n selection?.addRange(range);\n }, 0);\n });\n\n captionElement.addEventListener('blur', () => {\n setTimeout(() => {\n if (!captionElement.isConnected) return;\n if (isEditingCaption) {\n isEditingCaption = false;\n captionElement.removeAttribute('data-editing');\n captionElement.contentEditable = 'false';\n const text = captionElement.textContent?.trim() || '';\n if (!text) {\n captionElement.textContent = PLACEHOLDER_CAPTION;\n captionElement.style.color = '#999';\n }\n }\n }, 10);\n });\n\n captionElement.addEventListener('keydown', e => {\n if (!isEditingCaption) return;\n\n if (e.key === 'Enter' || e.key === 'Escape') {\n e.stopPropagation();\n e.preventDefault();\n captionElement.blur();\n return;\n }\n\n if (e.key === 'Backspace') {\n const text = captionElement.textContent?.trim() || '';\n if (!text || text === PLACEHOLDER_CAPTION) {\n e.stopPropagation();\n e.preventDefault();\n\n const videoContainer = captionElement.closest('.ql-cms-video-wrapper');\n if (videoContainer && videoContainer.parentNode) {\n videoContainer.parentNode.removeChild(videoContainer);\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 e.stopPropagation();\n });\n\n captionElement.addEventListener('input', e => {\n if (isEditingCaption) {\n e.stopPropagation();\n }\n });\n\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 captionElement.addEventListener('paste', e => {\n if (isEditingCaption) {\n e.stopPropagation();\n }\n });\n\n wrapper.appendChild(captionElement);\n\n return wrapper;\n }\n\n static value(node: HTMLElement): VideoBlotReturnValue {\n const captionElement = node.querySelector('.ql-cms-video-caption');\n const playerContainer = node.querySelector('.ql-cms-video-player');\n let caption = '';\n\n if (captionElement) {\n const text = captionElement.textContent?.trim() || '';\n if (text && text !== PLACEHOLDER_CAPTION) {\n caption = text;\n }\n }\n\n // Try to recover the original embed data from the rendered SDK markup.\n // If the wrapper was created from raw HTML (e.g. pasted), fall back to\n // serialising the current player container so the content is preserved.\n let embed: VideoBlotReturnValue['embed'] = '';\n const embedData = node.getAttribute('data-embed');\n if (embedData) {\n try {\n embed = JSON.parse(embedData) as VideoBlotReturnValue['embed'];\n } catch {\n embed = embedData;\n }\n } else if (playerContainer) {\n const vslyPlayer = playerContainer.querySelector('.vsly-player');\n if (vslyPlayer) {\n embed = { sdk: vslyPlayer.outerHTML };\n } else {\n embed = { sdk: playerContainer.innerHTML };\n }\n }\n\n const thumbnailUrl = node.getAttribute('data-thumbnail-url') || undefined;\n const url = node.getAttribute('data-video-url') || undefined;\n\n return {\n embed,\n caption,\n thumbnailUrl,\n url,\n };\n }\n }\n\n return VideoBlot;\n } catch (error) {\n console.error('Failed to create VideoBlot:', error);\n return null;\n }\n};\n\nexport default createVideoBlot;\n"],"names":["PLACEHOLDER_CAPTION","parseEmbed","value","getSdkHtml","embed","isSafeHttpUrl","url","parsed","ALLOWED_SDK_ORIGIN","isSafeSdkUrl","sanitizeStyle","style","allowed","declaration","colonIndex","property","renderSdkSafely","container","sdkHtml","body","child","div","allowedAttributes","attr","safeStyle","src","script","createVideoBlot","BlockEmbed","VideoBlot","wrapper","isViouslySdk","isCmsVideo","playerContainer","video","isEditor","preview","playIcon","svg","path","captionElement","isEditingCaption","e","range","selection","_a","text","videoContainer","quillEditor","node","caption","embedData","vslyPlayer","thumbnailUrl","__publicField","error"],"mappings":"iQAIA,MAAMA,EAAsB,2BAE5B,SAASC,EACPC,EACwD,CACxD,GAAI,CAACA,EAAO,OAAO,KACnB,GAAI,OAAOA,GAAU,SACnB,GAAI,CACF,OAAO,KAAK,MAAMA,CAAK,CACzB,MAAQ,CACN,OAAO,IACT,CAEF,OAAOA,CACT,CAEA,SAASC,EAAWD,EAAwC,CAC1D,MAAME,EAAQH,EAAWC,CAAK,EAC9B,OAAOE,GAAA,YAAAA,EAAO,MAAO,EACvB,CAEA,SAASC,EAAcC,EAAwC,CAC7D,GAAI,CAACA,EAAK,MAAO,GACjB,GAAI,CACF,MAAMC,EAAS,IAAI,IAAID,CAAG,EAC1B,OAAOC,EAAO,WAAa,UAAYA,EAAO,WAAa,OAC7D,MAAQ,CACN,MAAO,EACT,CACF,CAEA,MAAMC,EAAqB,0BAE3B,SAASC,EAAaH,EAAsB,CAC1C,GAAI,CAEF,OADe,IAAI,IAAIA,CAAG,EACZ,SAAWE,CAC3B,MAAQ,CACN,MAAO,EACT,CACF,CAOA,SAASE,EAAcC,EAA0C,CAC/D,GAAI,CAACA,EAAO,OACZ,MAAMC,EAAoB,CAAA,EAC1B,UAAWC,KAAeF,EAAM,MAAM,GAAG,EAAG,CAC1C,MAAMG,EAAaD,EAAY,QAAQ,GAAG,EAC1C,GAAIC,IAAe,GAAI,SACvB,MAAMC,EAAWF,EAAY,MAAM,EAAGC,CAAU,EAA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AEnD,MAAO,CACL,MAAA7C,EACA,QAAA8C,EACA,aAAAG,EACA,IAAA/C,CAAA,CAEJ,CAAA,CAzQA,OAAAgD,EADIzB,EACG,WAAW,aAClByB,EAFIzB,EAEG,UAAU,OACjByB,EAHIzB,EAGG,YAAY,wBA0QdA,CACT,OAAS0B,EAAO,CACd,eAAQ,MAAM,8BAA+BA,CAAK,EAC3C,IACT,CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WazUiGqlLibraryEditMedia.d.ts","sourceRoot":"","sources":["../../../../src/components/wazui/WazUiGqlMediaLibrary/WazUiGqlLibraryEditMedia.tsx"],"names":[],"mappings":"AAwBA,eAAO,MAAM,wBAAwB,+
|
|
1
|
+
{"version":3,"file":"WazUiGqlLibraryEditMedia.d.ts","sourceRoot":"","sources":["../../../../src/components/wazui/WazUiGqlMediaLibrary/WazUiGqlLibraryEditMedia.tsx"],"names":[],"mappings":"AAwBA,eAAO,MAAM,wBAAwB,+CAuOpC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../../src/components/wazui/WazUiGqlMediaLibrary/hooks.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,oBAAoB,EACpB,cAAc,EACd,KAAK,EAEL,eAAe,EACf,eAAe,EACf,iBAAiB,EAClB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../../src/components/wazui/WazUiGqlMediaLibrary/hooks.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,oBAAoB,EACpB,cAAc,EACd,KAAK,EAEL,eAAe,EACf,eAAe,EACf,iBAAiB,EAClB,MAAM,SAAS,CAAC;AA4GjB,eAAO,MAAM,aAAa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AAC;AAEF,eAAO,MAAM,YAAY,EAAE,iBAQ1B,CAAC;AAGF,eAAO,MAAM,mBAAmB,GAC9B,OAAO,iBAAiB,EACxB,QAAQ,eAAe,KACtB,iBA6CF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VideoBlot.d.ts","sourceRoot":"","sources":["../../../../../src/components/wazui/WazUiWysiwygInput/blots/VideoBlot.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAyB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"VideoBlot.d.ts","sourceRoot":"","sources":["../../../../../src/components/wazui/WazUiWysiwygInput/blots/VideoBlot.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAyB,MAAM,SAAS,CAAC;AAwGtF,QAAA,MAAM,eAAe;;;;;;;;kBAYM,cAAc,GAAG,WAAW;gBA4N9B,WAAW,GAAG,oBAAoB;SAiD1D,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -11,7 +11,8 @@ export interface UseSessionExpiredOptions {
|
|
|
11
11
|
* takes no further action: the host is then responsible for any redirect to
|
|
12
12
|
* the login page.
|
|
13
13
|
* - Otherwise an error-styled modal dialog is shown explaining the situation,
|
|
14
|
-
* with a "Log in again" button that
|
|
14
|
+
* with a "Log in again" button that clears persisted session state and then
|
|
15
|
+
* redirects to `loginUrl`.
|
|
15
16
|
*
|
|
16
17
|
* The handler is safe to call from mutation error handlers, Apollo auth links,
|
|
17
18
|
* or proactive refresh hooks. It will only act the first time it is called
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSessionExpired.d.ts","sourceRoot":"","sources":["../../src/hooks/useSessionExpired.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useSessionExpired.d.ts","sourceRoot":"","sources":["../../src/hooks/useSessionExpired.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,wBAAwB;IACvC,gFAAgF;IAChF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qFAAqF;IACrF,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;CAC/B;AAwDD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,CAAC,EAAE,wBAAwB,GAAG,MAAM,IAAI,CAmChF"}
|