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(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.