PageSourceSearch

https://oimi.ai/_next/static/chunks/6361.e664328ff6e48a8c.js

js oimi.ai collected 2026-10-05 12:20:04 UTC 7,936 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6361],{25511:(e,r,n)=>{n.d(r,{b:()=>v,u:()=>h});var t=n(95155),a=n(81891),o=n(74979),l=n(11666),i=n(41864),d=n(12115),u=n(397),s=n(53999);let c=a.Ay.extend({addStorage:()=>({markdown:{serialize(e,r){let{src:n,alt:t,title:a}=r.attrs;e.write("![".concat(e.esc(t||""),"](").concat(n.replace(/[()]/g,"\\$&")).concat(a?' "'.concat(a.replace(/"/g,'\\"'),'"'):"",")")),r.isBlock&&e.closeBlock(r)}}})}),v=e=>{var r,n;return null!==(n=null===(r=e.storage.markdown)||void 0===r?void 0:r.getMarkdown())&&void 0!==n?n:e.getText()},h=(0,d.forwardRef)((e,r)=>{let{value:n="",onChange:a,placeholder:h,hidePlaceholder:p=!1,editable:m=!0,className:f,contentClassName:g,onBlur:b,onFocus:x}=e,k=(0,d.useRef)(n),w=(0,d.useRef)(h),y=(0,d.useRef)(p);w.current=h,y.current=p;let j=(0,l.hG)({extensions:[i.A.configure({heading:{levels:[1,2,3]}}),c.configure({allowBase64:!1}),u.o.configure({html:!1,transformPastedText:!0,transformCopiedText:!0}),o.A.configure({placeholder:()=>{var e;return y.current?"":null!==(e=w.current)&&void 0!==e?e:""},showOnlyWhenEditable:!1})],content:n,editable:m,immediatelyRender:!1,editorProps:{attributes:{class:(0,s.cn)("canvas-text-markdown max-w-none focus:outline-none",g)}},onUpdate:e=>{let{editor:r}=e,n=v(r);k.current!==n&&(k.current=n,null==a||a(n))},onBlur:()=>{null==b||b()},onFocus:()=>{null==x||x()}},[h,p]);return(0,d.useImperativeHandle)(r,()=>({editor:j}),[j]),(0,d.useEffect)(()=>{j&&void 0!==n&&n!==k.current&&n!==v(j)&&(k.current=n,j.commands.setContent(n))},[n,j]),(0,d.useEffect)(()=>{null==j||j.setEditable(m)},[m,j]),(0,d.useEffect)(()=>{j&&j.view.dispatch(j.state.tr)},[j,p,h]),(0,t.jsx)(l.$Z,{editor:j,className:(0,s.cn)("h-full w-full",f)})});h.displayName="TapMarkdownEditor"},36361:(e,r,n)=>{n.r(r),n.d(r,{BlogMarkdownEditor:()=>s});var t=n(95155),a=n(12115),o=n(88240),l=n(84823);function i(e){let{children:r}=e;return(0,t.jsx)("div",{className:"markdown-body blog-markdown min-w-0",children:(0,t.jsx)(o.oz,{remarkPlugins:[l.A],components:{input:e=>{let{node:r,...n}=e;return(0,t.jsx)("input",{...n,className:"task-list-item-checkbox"})}},children:r})})}var d=n(56671),u=n(25511);function s(e){let{value:r,onChange:n,templateId:o,disabled:l}=e,s=(0,a.useRef)(null),c=(0,a.useRef)(null),[v,h]=(0,a.useState)("markdown"),[p,m]=(0,a.useState)(!1),[f,g]=(0,a.useState)(""),[b,x]=(0,a.useState)(""),k="rounded border border-gray-300 px-2 py-1 text-sm hover:bg-gray-100 disabled:opacity-40 dark:border-zinc-700 dark:hover:bg-zinc-800",w=(e,r)=>{var n,t;if(!/^https?:\/\//i.test(e)){d.o.error("图片地址需要以 http:// 或 https:// 开头");return}null===(t=s.current)||void 0===t||null===(n=t.editor)||void 0===n||n.chain().focus().setImage({src:e,alt:r}).run(),g("")};return(0,t.jsxs)("div",{className:"admin-blog-editor space-y-3",children:[(0,t.jsx)("div",{className:"flex flex-wrap gap-2","aria-label":"编辑模式",children:[{key:"rich",label:"富文本"},{key:"markdown",label:"Markdown"},{key:"preview",label:"预览"}].map(e=>(0,t.jsx)("button",{type:"button",disabled:p,"aria-pressed":v===e.key,onClick:()=>h(e.key),className:"".concat(k," ").concat(v===e.key?"bg-blue-50 text-blue-700 dark:bg-blue-950":""),children:e.label},e.key))}),"rich"===v&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"flex flex-wrap gap-2","aria-label":"正文格式",children:[["正文",()=>{var e,r;return null===(r=s.current)||void 0===r?void 0:null===(e=r.editor)||void 0===e?void 0:e.chain().focus().setParagraph().run()}],["H2",()=>{var e,r;return null===(r=s.current)||void 0===r?void 0:null===(e=r.editor)||void 0===e?void 0:e.chain().focus().toggleHeading({level:2}).run()}],["H3",()=>{var e,r;return null===(r=s.current)||void 0===r?void 0:null===(e=r.editor)||void 0===e?void 0:e.chain().focus().toggleHeading({level:3}).run()}],["粗体",()=>{var e,r;return null===(r=s.current)||void 0===r?void 0:null===(e=r.editor)||void 0===e?void 0:e.chain().focus().toggleBold().run()}],["斜体",()=>{var e,r;return null===(r=s.current)||void 0===r?void 0:null===(e=r.editor)||void 0===e?void 0:e.chain().focus().toggleItalic().run()}],["列表",()=>{var e,r;return null===(r=s.current)||void 0===r?void 0:null===(e=r.editor)||void 0===e?void 0:e.chain().focus().toggleBulletList().run()}],["编号",()=>{var e,r;return null===(r=s.current)||void 0===r?void 0:null===(e=r.editor)||void 0===e?void 0:e.chain().focus().toggleOrderedList().run()}],["引用",()=>{var e,r;return null===(r=s.current)||void 0===r?void 0:null===(e=r.editor)||void 0===e?void 0:e.chain().focus().toggleBlockquote().run()}],["分隔线",()=>{var e,r;return null===(r=s.current)||void 0===r?void 0:null===(e=r.editor)||void 0===e?void 0:e.chain().focus().setHorizontalRule().run()}],["撤销",()=>{var e,r;return null===(r=s.current)||void 0===r?void 0:null===(e=r.editor)||void 0===e?void 0:e.chain().focus().und
1o().run()}],["重做",()=>{var e,r;return null===(r=s.current)||void 0===r?void 0:null===(e=r.editor)||void 0===e?void 0:e.chain().focus().redo().run()}]].map(e=>{let[r,n]=e;return(0,t.jsx)("button",{type:"button",disabled:l||p,onMouseDown:e=>e.preventDefault(),onClick:n,className:k,children:r},r)})}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)("input",{"aria-label":"图片说明",value:b,onChange:e=>x(e.target.value),placeholder:"图片说明",className:"min-w-0 flex-1 rounded border bg-transparent px-2 py-1 text-sm dark:border-zinc-700"}),(0,t.jsx)("input",{"aria-label":"图片地址",value:f,onChange:e=>g(e.target.value),placeholder:"https:// 图片地址",className:"min-w-0 flex-1 rounded border bg-transparent px-2 py-1 text-sm dark:border-zinc-700"}),(0,t.jsx)("button",{type:"button",disabled:l||p||!f.trim(),className:k,onClick:()=>w(f.trim(),b),children:"插入图片"}),(0,t.jsx)("button",{type:"button",disabled:l||p,className:k,onClick:()=>{var e;return null===(e=c.current)||void 0===e?void 0:e.click()},children:p?"上传中…":"上传图片"}),(0,t.jsx)("input",{ref:c,type:"file",className:"hidden",accept:"image/jpeg,image/png,image/webp,image/gif,image/avif",onChange:async e=>{var r;let n=null===(r=e.target.files)||void 0===r?void 0:r[0];if(e.target.value="",n){if(n.size>0xa00000){d.o.error("图片请控制在 10 MB 以内");return}m(!0);try{let e=await fetch("/api/canvas/templates/admin/".concat(encodeURIComponent(o),"/image-upload"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({fileName:n.name,contentType:n.type})}),r=await e.json();if(!e.ok)throw Error(r.error||"无法准备图片上传");if(!(await fetch(r.uploadUrl,{method:"PUT",headers:{"Content-Type":n.type},body:n})).ok)throw Error("图片上传失败");w(r.publicUrl,b||n.name),d.o.success("图片已插入,保存文章后生效")}catch(e){d.o.error(e instanceof Error?e.message:"上传失败")}finally{m(!1)}}}})]}),(0,t.jsx)(u.u,{ref:s,value:r,onChange:n,editable:!l&&!p,placeholder:"在这里写正文,也可以粘贴 Markdown…",className:"min-h-[28rem] max-h-[65vh] overflow-y-auto rounded border border-gray-300 p-4 dark:border-zinc-700",contentClassName:"min-h-[26rem] text-base leading-7"})]}),"markdown"===v&&(0,t.jsx)("textarea",{"aria-label":"Markdown 正文",value:r,onChange:e=>n(e.target.value),disabled:l,className:"h-[32rem] w-full rounded border border-gray-300 bg-transparent p-4 font-mono text-sm dark:border-zinc-700"}),"preview"===v&&(0,t.jsx)("div",{className:"min-h-[16rem] max-h-[65vh] overflow-y-auto p-4",children:r?(0,t.jsx)(i,{children:r}):(0,t.jsx)("p",{children:"暂无正文"})})]})}},53999:(e,r,n)=>{n.d(r,{cn:()=>o,iN:()=>l});var t=n(52596),a=n(39688);function o(){for(var e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n];return(0,a.QP)((0,t.$)(r))}let l=async()=>{let e=await fetch("/api/credits/check",{method:"GET",headers:{"Content-Type":"application/json"}});if(!e.ok)throw Error("Failed to check credits");return e.json()}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.