react-reason-editor 1.0.218 → 1.0.219
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/{BubbleMenus-R5Y-9JWK.js → BubbleMenus-ZMPb9Od0.js} +1 -1
- package/dist/BubbleMenus-ZredOeYS.cjs +1 -0
- package/dist/ImportWord-BORiAJrS.js +1 -0
- package/dist/ImportWord.cjs +1 -1
- package/dist/ImportWord.js +1 -1
- package/dist/{ReasonDocs-BoQDZu4x.cjs → ReasonDocs-C1zz9xmB.cjs} +1 -1
- package/dist/{ReasonDocs-DtHAJ_OK.js → ReasonDocs-YkMuYR4D.js} +1 -1
- package/dist/{RichTextProvider-B9V-6yCh.js → RichTextProvider-CdeOWC8F.js} +1 -1
- package/dist/{RichTextProvider-5tJ58Jd3.cjs → RichTextProvider-QAfBo9eE.cjs} +1 -1
- package/dist/docs-agent.cjs +1 -1
- package/dist/docs-agent.js +1 -1
- package/dist/docx-to-html-B6AIGs_u.cjs +1 -0
- package/dist/docx-to-html-Bv2lR4Xz-CL6zpfFL.cjs +1 -0
- package/dist/docx-to-html-Bv2lR4Xz.js +1 -0
- package/dist/editor-kit.cjs +1 -1
- package/dist/editor-kit.js +1 -1
- package/dist/{editorConfig-CDQ1cqBk.js → editorConfig-BMRYlaWx.js} +1 -1
- package/dist/editorConfig-DkUDrWsV.cjs +1 -0
- package/dist/{html-to-docx.esm-BXXvDBHn-Ck2Lm2Rn.cjs → html-to-docx.esm-BXXvDBHn-DGAz8oTP.cjs} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/reason-docs.cjs +1 -1
- package/dist/reason-docs.js +1 -1
- package/dist/{reason-toolbar-skin-B5gdLvGB.js → reason-toolbar-skin-DaSuLMFL.js} +1 -1
- package/dist/{reason-toolbar-skin-O4Jwi3SZ.cjs → reason-toolbar-skin-HVXjepID.cjs} +1 -1
- package/package.json +2 -2
- package/dist/BubbleMenus-DqztkDbh.cjs +0 -1
- package/dist/ImportWord-DtON-y5N.js +0 -1
- package/dist/editorConfig-Nlnbb5zI.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as t}from"./toggle-BnR5VE66.js";import{n as o}from"./locales-rT_qjKW9.js";import{o as n,r as e}from"./ImageCropper-BKS8Wf7X.js";import{a as r,c as i,d as s,o as a,t as c}from"./useButtonProps-Codtb0k0.js";import{useRef as p,useState as l}from"react";import{Extension as m}from"@tiptap/core";import{Fragment as u,jsx as d,jsxs as f}from"react/jsx-runtime";function y(t,o){const n=atob(t.split(",")[1]),e=Array.from({length:n.length});for(let i=0;i<n.length;i++)e[i]=n.charCodeAt(i);const r=new Uint8Array(e);return new Blob([r],{type:o})}function g(t,o){return new File([t],o,{type:t.type})}function h(){const m=s(),h=c(b.name),{icon:v,tooltip:j,tooltipOptions:w={},isActive:x,limit:A,convert:C}=h?.componentProps??{},{editorDisabled:M}=i(x),T=a(b.name),{toast:H}=n(),{t:L}=o(),[P,O]=l(!1),W=p(null);async function z(t){const o=await async function(t){const o=(new DOMParser).parseFromString(t,"text/html"),n=o.querySelectorAll("img");if(0===n.length)return o.body.innerHTML;if(r(m,e.name)){const t=T?.options;if(t&&"function"==typeof t.upload){const e=[];for(const t of n){const o=g(y(t.getAttribute("src"),"image/jpeg"),"image.jpeg");e.push(o)}const r=await t.upload(e);for(const[t,o]of n.entries()){o.setAttribute("src",r[t].src);const n=o.parentElement;"P"===n?.tagName&&(n.insertAdjacentElement("beforebegin",o),n.hasChildNodes()||""!==n.textContent||n.remove())}return o.body.innerHTML}return o.body.innerHTML}return o.body.innerHTML}(t);m.chain().setContent(o,!0).run()}return h?/* @__PURE__ */f(u,{children:[/* @__PURE__ */d(t,{action:function(){W.current?.click()},disabled:M,icon:v,loading:P,tooltip:j,tooltipOptions:w}),/* @__PURE__ */d("input",{accept:".docx",onChange:function(t){const o=t.target.files[0];o&&(o.size>A?H({variant:"destructive",title:L("editor.importWord.limitSize")}):async function(t){O(!0);try{if(C)z(await C(t));else{const{convertDocxToHTML:o}=await(import("./docx-to-html-Bv2lR4Xz.js"));z(await o(t))}}finally{O(!1)}}(o))},ref:W,type:"file",style:{display:"none"}})]}):/* @__PURE__ */d(u,{})}var b=m.create({name:"importWord",addOptions(){return{...this.parent?.(),upload:void 0,convert:void 0,limit:10485760,button:({extension:t,t:o})=>{const{convert:n,limit:e}=t.options;return{componentProps:{convert:n,limit:e,icon:"Word",shortcutKeys:t.options.shortcutKeys,tooltip:o("editor.importWord.tooltip")}}}}}});export{h as n,b as t};
|