open-text-editor-latest 1.0.1
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/README.md +16 -0
- package/dist/index.cjs.js +41 -0
- package/dist/index.es.js +1146 -0
- package/dist/index.umd.js +41 -0
- package/dist/vite.svg +1 -0
- package/docs/PUBLISH.md +27 -0
- package/docs/editor/developer.md +31 -0
- package/package.json +71 -0
- package/src/editor/OpenTextEditor.jsx +1021 -0
- package/src/editor/README.md +15 -0
- package/src/editor/assets/.gitkeep +0 -0
- package/src/editor/index.jsx +4 -0
- package/src/editor/plugins/formatting.js +10 -0
- package/src/editor/plugins/history.js +9 -0
- package/src/editor/plugins/image.js +9 -0
- package/src/editor/plugins/index.js +25 -0
- package/src/editor/plugins/table.js +9 -0
- package/src/editor/styles/editor.css +8 -0
- package/src/editor/tests/.gitkeep +0 -0
package/README.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# React + Vite
|
|
2
|
+
|
|
3
|
+
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
|
4
|
+
|
|
5
|
+
Currently, two official plugins are available:
|
|
6
|
+
|
|
7
|
+
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
|
|
8
|
+
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
|
9
|
+
|
|
10
|
+
## React Compiler
|
|
11
|
+
|
|
12
|
+
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
|
|
13
|
+
|
|
14
|
+
## Expanding the ESLint configuration
|
|
15
|
+
|
|
16
|
+
If you are developing a production application, we recommend using TypeScript with type-aware lint rules enabled. Check out the [TS template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts) for information on how to integrate TypeScript and [`typescript-eslint`](https://typescript-eslint.io) in your project.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";const i=require("react");var fe={exports:{}},te={};var Me;function Ye(){if(Me)return te;Me=1;var m=Symbol.for("react.transitional.element"),b=Symbol.for("react.fragment");function k(j,w,l){var S=null;if(l!==void 0&&(S=""+l),w.key!==void 0&&(S=""+w.key),"key"in w){l={};for(var N in w)N!=="key"&&(l[N]=w[N])}else l=w;return w=l.ref,{$$typeof:m,type:j,key:S,ref:w!==void 0?w:null,props:l}}return te.Fragment=b,te.jsx=k,te.jsxs=k,te}var re={};var Se;function Xe(){return Se||(Se=1,process.env.NODE_ENV!=="production"&&(function(){function m(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ie?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case q:return"Fragment";case ae:return"Profiler";case se:return"StrictMode";case F:return"Suspense";case ge:return"SuspenseList";case le:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case ne:return"Portal";case T:return e.displayName||"Context";case pe:return(e._context.displayName||"Context")+".Consumer";case he:var s=e.render;return e=e.displayName,e||(e=s.displayName||s.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case G:return s=e.displayName||null,s!==null?s:m(e.type)||"Memo";case B:s=e._payload,e=e._init;try{return m(e(s))}catch{}}return null}function b(e){return""+e}function k(e){try{b(e);var s=!1}catch{s=!0}if(s){s=console;var c=s.error,u=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return c.call(s,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",u),b(e)}}function j(e){if(e===q)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===B)return"<...>";try{var s=m(e);return s?"<"+s+">":"<...>"}catch{return"<...>"}}function w(){var e=J.A;return e===null?null:e.getOwner()}function l(){return Error("react-stack-top-frame")}function S(e){if(Q.call(e,"key")){var s=Object.getOwnPropertyDescriptor(e,"key").get;if(s&&s.isReactWarning)return!1}return e.key!==void 0}function N(e,s){function c(){U||(U=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",s))}c.isReactWarning=!0,Object.defineProperty(e,"key",{get:c,configurable:!0})}function I(){var e=m(this.type);return n[e]||(n[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function P(e,s,c,u,R,L){var v=c.ref;return e={$$typeof:X,type:e,key:s,props:c,_owner:u},(v!==void 0?v:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:I}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:R}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:L}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function E(e,s,c,u,R,L){var v=s.children;if(v!==void 0)if(u)if(be(v)){for(u=0;u<v.length;u++)C(v[u]);Object.freeze&&Object.freeze(v)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else C(v);if(Q.call(s,"key")){v=m(e);var _=Object.keys(s).filter(function(ce){return ce!=="key"});u=0<_.length?"{key: someKey, "+_.join(": ..., ")+": ...}":"{key: someKey}",A[v+u]||(_=0<_.length?"{"+_.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
|
+
let props = %s;
|
|
3
|
+
<%s {...props} />
|
|
4
|
+
React keys must be passed directly to JSX without using spread:
|
|
5
|
+
let props = %s;
|
|
6
|
+
<%s key={someKey} {...props} />`,u,v,_,v),A[v+u]=!0)}if(v=null,c!==void 0&&(k(c),v=""+c),S(s)&&(k(s.key),v=""+s.key),"key"in s){c={};for(var D in s)D!=="key"&&(c[D]=s[D])}else c=s;return v&&N(c,typeof e=="function"?e.displayName||e.name||"Unknown":e),P(e,v,c,w(),R,L)}function C(e){oe(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===B&&(e._payload.status==="fulfilled"?oe(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function oe(e){return typeof e=="object"&&e!==null&&e.$$typeof===X}var O=i,X=Symbol.for("react.transitional.element"),ne=Symbol.for("react.portal"),q=Symbol.for("react.fragment"),se=Symbol.for("react.strict_mode"),ae=Symbol.for("react.profiler"),pe=Symbol.for("react.consumer"),T=Symbol.for("react.context"),he=Symbol.for("react.forward_ref"),F=Symbol.for("react.suspense"),ge=Symbol.for("react.suspense_list"),G=Symbol.for("react.memo"),B=Symbol.for("react.lazy"),le=Symbol.for("react.activity"),ie=Symbol.for("react.client.reference"),J=O.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q=Object.prototype.hasOwnProperty,be=Array.isArray,Z=console.createTask?console.createTask:function(){return null};O={react_stack_bottom_frame:function(e){return e()}};var U,n={},K=O.react_stack_bottom_frame.bind(O,l)(),W=Z(j(l)),A={};re.Fragment=q,re.jsx=function(e,s,c){var u=1e4>J.recentlyCreatedOwnerStacks++;return E(e,s,c,!1,u?Error("react-stack-top-frame"):K,u?Z(j(e)):W)},re.jsxs=function(e,s,c){var u=1e4>J.recentlyCreatedOwnerStacks++;return E(e,s,c,!0,u?Error("react-stack-top-frame"):K,u?Z(j(e)):W)}})()),re}var Ee;function Ge(){return Ee||(Ee=1,process.env.NODE_ENV==="production"?fe.exports=Ye():fe.exports=Xe()),fe.exports}var r=Ge();const He=(...m)=>m.filter((b,k,j)=>!!b&&b.trim()!==""&&j.indexOf(b)===k).join(" ").trim();const Je=m=>m.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const Qe=m=>m.replace(/^([A-Z])|[\s-_]+(\w)/g,(b,k,j)=>j?j.toUpperCase():k.toLowerCase());const Te=m=>{const b=Qe(m);return b.charAt(0).toUpperCase()+b.slice(1)};var Ze={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const Ke=m=>{for(const b in m)if(b.startsWith("aria-")||b==="role"||b==="title")return!0;return!1};const et=i.forwardRef(({color:m="currentColor",size:b=24,strokeWidth:k=2,absoluteStrokeWidth:j,className:w="",children:l,iconNode:S,...N},I)=>i.createElement("svg",{ref:I,...Ze,width:b,height:b,stroke:m,strokeWidth:j?Number(k)*24/Number(b):k,className:He("lucide",w),...!l&&!Ke(N)&&{"aria-hidden":"true"},...N},[...S.map(([P,E])=>i.createElement(P,E)),...Array.isArray(l)?l:[l]]));const f=(m,b)=>{const k=i.forwardRef(({className:j,...w},l)=>i.createElement(et,{ref:l,iconNode:b,className:He(`lucide-${Je(Te(m))}`,`lucide-${m}`,j),...w}));return k.displayName=Te(m),k};const tt=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],rt=f("arrow-down",tt);const ot=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],nt=f("arrow-left",ot);const st=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],at=f("arrow-right",st);const lt=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],it=f("arrow-up",lt);const ct=[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]],dt=f("bold",ct);const ut=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],me=f("chevron-down",ut);const ft=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],mt=f("code",ft);const pt=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],ht=f("file-code",pt);const gt=[["path",{d:"m9 11-6 6v3h9l3-3",key:"1a3l36"}],["path",{d:"m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4",key:"14a9rk"}]],bt=f("highlighter",gt);const xt=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],yt=f("image",xt);const vt=[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]],kt=f("italic",vt);const wt=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],jt=f("link",wt);const Ct=[["path",{d:"M21 5H11",key:"us1j55"}],["path",{d:"M21 12H11",key:"wd7e0v"}],["path",{d:"M21 19H11",key:"saa85w"}],["path",{d:"m7 8-4 4 4 4",key:"o5hrat"}]],Nt=f("list-indent-decrease",Ct);const _t=[["path",{d:"M21 5H11",key:"us1j55"}],["path",{d:"M21 12H11",key:"wd7e0v"}],["path",{d:"M21 19H11",key:"saa85w"}],["path",{d:"m3 8 4 4-4 4",key:"1a3j6y"}]],Rt=f("list-indent-increase",_t);const Mt=[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]],St=f("list-ordered",Mt);const Et=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],Tt=f("list",Et);const At=[["path",{d:"M5 12h14",key:"1ays0h"}]],Lt=f("minus",At);const zt=[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]],Ht=f("quote",zt);const $t=[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]],Ot=f("redo",$t);const Dt=[["path",{d:"M4 7V4h16v3",key:"9msm58"}],["path",{d:"M5 20h6",key:"1h6pxn"}],["path",{d:"M13 4 8 20",key:"kqq6aj"}],["path",{d:"m15 15 5 5",key:"me55sn"}],["path",{d:"m20 15-5 5",key:"11p7ol"}]],It=f("remove-formatting",Dt);const Pt=[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]],qt=f("strikethrough",Pt);const Ft=[["path",{d:"m4 5 8 8",key:"1eunvl"}],["path",{d:"m12 5-8 8",key:"1ah0jp"}],["path",{d:"M20 19h-4c0-1.5.44-2 1.5-2.5S20 15.33 20 14c0-.47-.17-.93-.48-1.29a2.11 2.11 0 0 0-2.62-.44c-.42.24-.74.62-.9 1.07",key:"e8ta8j"}]],Bt=f("subscript",Ft);const Ut=[["path",{d:"m4 19 8-8",key:"hr47gm"}],["path",{d:"m12 19-8-8",key:"1dhhmo"}],["path",{d:"M20 12h-4c0-1.5.442-2 1.5-2.5S20 8.334 20 7.002c0-.472-.17-.93-.484-1.29a2.105 2.105 0 0 0-2.617-.436c-.42.239-.738.614-.899 1.06",key:"1dfcux"}]],Wt=f("superscript",Ut);const Vt=[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]],Yt=f("table",Vt);const Xt=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 19H5",key:"vjpgq2"}]],Ae=f("text-align-center",Xt);const Gt=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 19H7",key:"4cu937"}]],Le=f("text-align-end",Gt);const Jt=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]],ze=f("text-align-start",Jt);const Qt=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],ve=f("trash-2",Qt);const Zt=[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]],Kt=f("type",Zt);const er=[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]],tr=f("underline",er);const rr=[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]],or=f("undo",rr);const nr=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],sr=f("x",nr),ar="",lr=i.forwardRef(({initialValue:m=ar,onChange:b,className:k="w-full h-full",placeholder:j="Start typing..."},w)=>{const l=i.useRef(null),S=i.useRef(null),N=i.useRef(null),I=i.useRef(null),P=i.useRef(null),E=i.useRef(null),[C,oe]=i.useState({}),[O,X]=i.useState(!1),[ne,q]=i.useState(!1),[se,ae]=i.useState(!1),[pe,T]=i.useState("Normal"),[he,F]=i.useState("Sans Serif"),[ge,G]=i.useState("16px"),[B,le]=i.useState(!1),[ie,J]=i.useState(3),[Q,be]=i.useState(3),[Z,U]=i.useState(!0),[n,K]=i.useState(!1),[W,A]=i.useState(m||""),[e,s]=i.useState(null),[c,u]=i.useState(null),[R,L]=i.useState(null),[v,_]=i.useState([]),[D,ce]=i.useState(!1),[de,ke]=i.useState(!1),V=i.useRef({startX:0,startWidth:0,target:null}),Y=i.useRef({startX:0,startWidth:0,target:null}),ue=()=>{if(E.current){const t=window.getSelection();t.removeAllRanges(),t.addRange(E.current)}else l.current?.focus()};i.useImperativeHandle(w,()=>({focus:()=>l.current?.focus(),getHtml:()=>l.current?.innerHTML||"",setHtml:t=>{l.current&&(l.current.innerHTML=t,A(t),ee())},insertHtml:t=>{ue(),h("insertHTML",t)},execCommand:(t,o)=>{ue(),h(t,o)},insertTable:(t,o)=>{we(t,o)},tableAction:t=>{ue(),z(t)}})),i.useEffect(()=>{l.current&&!n&&(m&&m!==l.current.innerHTML?(l.current.innerHTML=m,A(m),U(!1)):!m&&!l.current.innerHTML&&(l.current.innerHTML="<p><br/></p>",A("<p><br/></p>"),U(!0)))},[m,n]);const ee=()=>{if(ye(),M(),l.current){const t=l.current.textContent;U(!t||t.trim()===""),b&&b(l.current.innerHTML)}},$e=t=>{const o=t.target.value;A(o),b&&b(o)},Oe=()=>{n?K(!1):(l.current&&(A(l.current.innerHTML),s(null),L(null),u(null),_([])),K(!0))};i.useEffect(()=>{!n&&l.current&&l.current.innerHTML!==W&&(l.current.innerHTML=W||"<p><br/></p>",ee())},[n]);const h=(t,o=null)=>{n||(document.execCommand(t,!1,o),ee(),l.current?.focus())},De=(t,o)=>{h("formatBlock",t),T(o),X(!1)},Ie=(t,o)=>{h("fontName",t),F(o),q(!1)},Pe=(t,o)=>{h("fontSize",t),G(o),ae(!1)},qe=t=>{const o=t.target.files[0];if(o){const a=new FileReader;a.onload=d=>{const p=`<img src="${d.target.result}" style="width: 300px; max-width: 100%; height: auto; border-radius: 4px; display: inline-block; cursor: pointer; border: 1px solid transparent;" draggable="true" />`;h("insertHTML",p)},a.readAsDataURL(o)}t.target.value=""},Fe=()=>{const t=prompt("Enter URL:");t&&h("createLink",t)},we=(t,o)=>{ue();const a=t!==void 0?t:ie,d=o!==void 0?o:Q,p=parseInt(a)||3,y=parseInt(d)||3,g=`
|
|
7
|
+
<table style="border-collapse: collapse; width: 100%; margin: 1em 0; border: 1px solid #e5e7eb; table-layout: fixed;">
|
|
8
|
+
<tbody>
|
|
9
|
+
${Array(p).fill(0).map(()=>`
|
|
10
|
+
<tr>
|
|
11
|
+
${Array(y).fill(0).map(()=>`
|
|
12
|
+
<td style="border: 1px solid #d1d5db; padding: 8px; min-width: 30px; position: relative; width: ${100/y}%;">
|
|
13
|
+
<br />
|
|
14
|
+
</td>
|
|
15
|
+
`).join("")}
|
|
16
|
+
</tr>
|
|
17
|
+
`).join("")}
|
|
18
|
+
</tbody>
|
|
19
|
+
</table>
|
|
20
|
+
<p><br/></p>
|
|
21
|
+
`;h("insertHTML",g),le(!1)},z=t=>{if(!c||!e||e.tagName!=="TABLE")return;const o=c.closest("tr");if(!o)return;const a=e,d=a.querySelector("tbody");o.rowIndex;const p=c.cellIndex;if(p===-1)return;const y=()=>{const g=document.createElement("td");return g.style.border="1px solid #d1d5db",g.style.padding="8px",g.style.minWidth="30px",g.innerHTML="<br>",g};if(t==="row-above"){const g=o.cloneNode(!1);Array.from(o.children).forEach(()=>g.appendChild(y())),d.insertBefore(g,o)}else if(t==="row-below"){const g=o.cloneNode(!1);Array.from(o.children).forEach(()=>g.appendChild(y())),d.insertBefore(g,o.nextSibling)}else t==="col-left"?Array.from(a.rows).forEach(g=>{const $=g.children[p];$&&g.insertBefore(y(),$)}):t==="col-right"?Array.from(a.rows).forEach(g=>{const $=g.children[p];$&&g.insertBefore(y(),$.nextSibling)}):t==="del-row"?(o.remove(),d.children.length===0?(a.remove(),s(null),u(null)):c.isConnected||u(null)):t==="del-col"?(Array.from(a.rows).forEach(g=>{g.children[p]&&g.children[p].remove()}),a.rows[0]&&a.rows[0].children.length===0?(a.remove(),s(null),u(null)):c.isConnected||u(null)):t==="del-table"&&(a.remove(),s(null),u(null));ee(),M()},M=i.useCallback(()=>{if(!l.current||n)return;if(e&&e.isConnected){const o=e.getBoundingClientRect(),a=l.current.getBoundingClientRect();L({top:o.top-a.top,left:o.left-a.left,width:o.width,height:o.height})}else L(null);const t=e?.tagName==="TABLE"?e:c?.closest("table");if(t&&t.isConnected){const o=t.getBoundingClientRect(),a=l.current.getBoundingClientRect(),d=[],p=t.rows[0];p&&Array.from(p.cells).forEach(y=>{const g=y.getBoundingClientRect();d.push({left:g.left-a.left+g.width,top:o.top-a.top,height:o.height,cell:y})}),_(d)}else _([])},[e,c,n]);i.useEffect(()=>{document.execCommand("enableObjectResizing",!1,"false");const t=()=>{M()},o=()=>{M()},a=l.current;return a&&a.addEventListener("scroll",t),window.addEventListener("resize",o),()=>{a&&a.removeEventListener("scroll",t),window.removeEventListener("resize",o)}},[M]);const Be=t=>{if(n)return;const o=t.target,a=o.closest("td")||o.closest("th"),d=o.closest("table"),p=o.tagName==="IMG"?o:o.closest("img");if(a){u(a);const y=a.closest("table");y&&e!==y&&s(y)}else de||u(null);if(p){e!==p&&s(p);return}if(d&&d!==l.current){e!==d&&s(d);return}!D&&!de&&e&&!d&&!p&&!a&&(s(null),L(null),u(null),_([])),ye()},Ue=t=>{if(n)return;const o=t.target,a=o.tagName==="IMG"?o:o.closest("img"),d=o.closest("td")||o.closest("th"),p=o.closest("table");if(a){t.preventDefault(),e!==a&&s(a),setTimeout(M,0);return}if(d||p){t.preventDefault();const y=p||(d?d.closest("table"):null);d&&u(d),y&&e!==y&&s(y),setTimeout(M,0)}},We=t=>{t.preventDefault(),t.stopPropagation(),e&&(ce(!0),V.current={startX:t.clientX,startWidth:e.offsetWidth,target:e},document.addEventListener("mousemove",je),document.addEventListener("mouseup",Ce))},je=t=>{if(!V.current.target)return;const o=t.clientX-V.current.startX,a=Math.max(50,V.current.startWidth+o);V.current.target.style.width=`${a}px`,M()},Ce=()=>{ce(!1),V.current={startX:0,startWidth:0,target:null},document.removeEventListener("mousemove",je),document.removeEventListener("mouseup",Ce)},Ve=(t,o)=>{t.preventDefault(),t.stopPropagation(),o&&(ke(!0),Y.current={startX:t.clientX,startWidth:o.offsetWidth,target:o},document.addEventListener("mousemove",Ne),document.addEventListener("mouseup",_e))},Ne=t=>{if(!Y.current.target)return;const o=t.clientX-Y.current.startX,a=Math.max(20,Y.current.startWidth+o);Y.current.target.style.width=`${a}px`,M()},_e=()=>{ke(!1),Y.current={startX:0,startWidth:0,target:null},document.removeEventListener("mousemove",Ne),document.removeEventListener("mouseup",_e)},xe=t=>{e&&(e.style.display="",e.style.float="",e.style.margin="",e.style.outline="none",t==="left"?(e.style.float="left",e.style.margin="0 1rem 1rem 0"):t==="right"?(e.style.float="right",e.style.margin="0 0 1rem 1rem"):t==="center"?(e.style.display="block",e.style.marginLeft="auto",e.style.marginRight="auto"):e.style.display="inline-block",setTimeout(M,0))},ye=()=>{if(!l.current||n)return;const t=window.getSelection();if(t.rangeCount>0){const a=t.getRangeAt(0);if(l.current.contains(a.commonAncestorContainer)){E.current=a.cloneRange();let d=a.commonAncestorContainer;d.nodeType===3&&(d=d.parentNode);const p=d.closest("td")||d.closest("th"),y=d.closest("table");p&&c!==p&&u(p),y?e!==y&&s(y):!D&&!de&&!d.closest("img")&&e&&e.tagName==="TABLE"&&(s(null),u(null));const g=document.queryCommandValue("fontSize"),$={1:"10px",2:"13px",3:"16px",4:"18px",5:"24px",6:"32px",7:"48px"};g&&$[g]?G($[g]):G("16px");const Re=document.queryCommandValue("fontName");Re.includes("Serif")?F("Serif"):Re.includes("Mono")?F("Monospace"):F("Sans Serif")}}const o={bold:document.queryCommandState("bold"),italic:document.queryCommandState("italic"),underline:document.queryCommandState("underline"),strikethrough:document.queryCommandState("strikethrough"),subscript:document.queryCommandState("subscript"),superscript:document.queryCommandState("superscript"),justifyLeft:document.queryCommandState("justifyLeft"),justifyCenter:document.queryCommandState("justifyCenter"),justifyRight:document.queryCommandState("justifyRight"),justifyFull:document.queryCommandState("justifyFull"),insertUnorderedList:document.queryCommandState("insertUnorderedList"),insertOrderedList:document.queryCommandState("insertOrderedList")};if(oe(o),t.rangeCount>0)try{const a=t.getRangeAt(0).commonAncestorContainer,p=(a.nodeType===3?a.parentNode:a)?.tagName?.toLowerCase();T(p==="h1"?"Heading 1":p==="h2"?"Heading 2":p==="h3"?"Heading 3":p==="blockquote"?"Quote":"Normal")}catch{}};i.useEffect(()=>{const t=()=>ye();return document.addEventListener("selectionchange",t),()=>document.removeEventListener("selectionchange",t)},[c,e,D,de,n]);const x=({onClick:t,isActive:o,icon:a,title:d,hasArrow:p=!1,disabled:y=!1})=>r.jsxs("button",{type:"button",onClick:t,disabled:y,title:d,className:`p-1.5 rounded-md transition-colors duration-150 flex items-center justify-center gap-1
|
|
22
|
+
${o?"bg-indigo-100 text-indigo-700":"text-gray-600 hover:bg-gray-100 hover:text-gray-900"}
|
|
23
|
+
${y?"opacity-30 cursor-not-allowed":""}
|
|
24
|
+
`,children:[r.jsx(a,{size:18,strokeWidth:2.5}),p&&r.jsx(me,{size:12,className:"opacity-50"})]}),H=()=>r.jsx("div",{className:"w-px h-6 bg-gray-300 mx-1 self-center"});return r.jsxs("div",{className:`bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden flex flex-col font-sans text-gray-800 min-h-[300px] ${k}`,children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 p-2 border-b border-gray-200 bg-white sticky top-0 z-20 select-none shadow-sm",children:[r.jsx(x,{onClick:Oe,isActive:n,icon:ht,title:n?"Switch to Visual Editor":"View Source / HTML"}),r.jsx(H,{}),r.jsxs("div",{className:"flex items-center",children:[r.jsx(x,{onClick:()=>h("undo"),icon:or,title:"Undo",disabled:n}),r.jsx(x,{onClick:()=>h("redo"),icon:Ot,title:"Redo",disabled:n})]}),r.jsx(H,{}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsxs("div",{className:"relative",children:[r.jsxs("button",{disabled:n,onClick:()=>X(!O),className:`flex items-center justify-between gap-2 px-2 py-1.5 text-sm font-medium rounded-md min-w-[100px] ${n?"text-gray-300 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:[r.jsx("span",{className:"truncate",children:pe}),r.jsx(me,{size:14})]}),O&&!n&&r.jsx("div",{className:"absolute top-full left-0 mt-1 w-40 bg-white border border-gray-200 rounded shadow-lg py-1 z-30",children:[{label:"Normal",tag:"P"},{label:"Heading 1",tag:"H1"},{label:"Heading 2",tag:"H2"},{label:"Heading 3",tag:"H3"},{label:"Quote",tag:"BLOCKQUOTE"}].map(t=>r.jsx("button",{onClick:()=>De(t.tag,t.label),className:"block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-50 hover:text-indigo-600",children:t.label},t.tag))})]}),r.jsxs("div",{className:"relative hidden md:block",children:[r.jsxs("button",{disabled:n,onClick:()=>q(!ne),className:`flex items-center justify-between gap-2 px-2 py-1.5 text-sm font-medium rounded-md min-w-[130px] ${n?"text-gray-300 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:[r.jsx("span",{className:"truncate",children:he}),r.jsx(me,{size:14})]}),ne&&!n&&r.jsx("div",{className:"absolute top-full left-0 mt-1 w-48 bg-white border border-gray-200 rounded shadow-lg py-1 z-30 max-h-60 overflow-y-auto",children:[{label:"Sans Serif",value:"ui-sans-serif, system-ui, sans-serif"},{label:"Serif",value:"ui-serif, Georgia, serif"},{label:"Monospace",value:"ui-monospace, monospace"},{label:"Arial",value:"Arial, Helvetica, sans-serif"},{label:"Arial Black",value:'"Arial Black", Gadget, sans-serif'},{label:"Comic Sans MS",value:'"Comic Sans MS", "Comic Sans", cursive'},{label:"Courier New",value:'"Courier New", Courier, monospace'},{label:"Georgia",value:"Georgia, serif"},{label:"Impact",value:"Impact, Charcoal, sans-serif"},{label:"Lucida Console",value:'"Lucida Console", Monaco, monospace'},{label:"Tahoma",value:"Tahoma, Geneva, sans-serif"},{label:"Times New Roman",value:'"Times New Roman", Times, serif'},{label:"Trebuchet MS",value:'"Trebuchet MS", Helvetica, sans-serif'},{label:"Verdana",value:"Verdana, Geneva, sans-serif"}].map(t=>r.jsx("button",{onClick:()=>Ie(t.value,t.label),className:"block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-50 hover:text-indigo-600",style:{fontFamily:t.value},children:t.label},t.value))})]}),r.jsxs("div",{className:"relative hidden md:block",children:[r.jsxs("button",{disabled:n,onClick:()=>ae(!se),className:`flex items-center justify-between gap-2 px-2 py-1.5 text-sm font-medium rounded-md min-w-[70px] ${n?"text-gray-300 cursor-not-allowed":"text-gray-700 hover:bg-gray-100"}`,children:[r.jsx("span",{className:"truncate",children:ge}),r.jsx(me,{size:14})]}),se&&!n&&r.jsx("div",{className:"absolute top-full left-0 mt-1 w-24 bg-white border border-gray-200 rounded shadow-lg py-1 z-30 max-h-60 overflow-y-auto",children:[{label:"10px",value:"1"},{label:"13px",value:"2"},{label:"16px",value:"3"},{label:"18px",value:"4"},{label:"24px",value:"5"},{label:"32px",value:"6"},{label:"48px",value:"7"}].map(t=>r.jsx("button",{onClick:()=>Pe(t.value,t.label),className:"block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-50 hover:text-indigo-600",children:t.label},t.value))})]})]}),r.jsx(H,{}),r.jsxs("div",{className:"flex items-center",children:[r.jsx(x,{onClick:()=>h("bold"),isActive:C.bold,icon:dt,title:"Bold",disabled:n}),r.jsx(x,{onClick:()=>h("italic"),isActive:C.italic,icon:kt,title:"Italic",disabled:n}),r.jsx(x,{onClick:()=>h("underline"),isActive:C.underline,icon:tr,title:"Underline",disabled:n}),r.jsx(x,{onClick:()=>h("strikethrough"),isActive:C.strikethrough,icon:qt,title:"Strikethrough",disabled:n})]}),r.jsx(H,{}),r.jsxs("div",{className:"flex items-center",children:[r.jsx(x,{onClick:()=>h("subscript"),isActive:C.subscript,icon:Bt,title:"Subscript",disabled:n}),r.jsx(x,{onClick:()=>h("superscript"),isActive:C.superscript,icon:Wt,title:"Superscript",disabled:n}),r.jsx(x,{onClick:()=>h("formatBlock","PRE"),icon:mt,title:"Code Block",disabled:n}),r.jsx(x,{onClick:()=>h("formatBlock","BLOCKQUOTE"),icon:Ht,title:"Blockquote",disabled:n})]}),r.jsx(H,{}),r.jsxs("div",{className:"flex items-center relative",children:[r.jsxs("div",{className:"relative",children:[r.jsx(x,{onClick:()=>I.current.click(),icon:Kt,title:"Text Color",disabled:n}),r.jsx("input",{type:"color",ref:I,disabled:n,className:"absolute inset-0 opacity-0 w-full h-full cursor-pointer",onChange:t=>h("foreColor",t.target.value)})]}),r.jsxs("div",{className:"relative",children:[r.jsx(x,{onClick:()=>P.current.click(),icon:bt,title:"Highlight Color",disabled:n}),r.jsx("input",{type:"color",ref:P,disabled:n,defaultValue:"#ffff00",className:"absolute inset-0 opacity-0 w-full h-full cursor-pointer",onChange:t=>h("hiliteColor",t.target.value)})]})]}),r.jsx(H,{}),r.jsxs("div",{className:"flex items-center",children:[r.jsx(x,{onClick:()=>h("justifyLeft"),isActive:C.justifyLeft,icon:ze,title:"Align Left",disabled:n}),r.jsx(x,{onClick:()=>h("justifyCenter"),isActive:C.justifyCenter,icon:Ae,title:"Align Center",disabled:n}),r.jsx(x,{onClick:()=>h("justifyRight"),isActive:C.justifyRight,icon:Le,title:"Align Right",disabled:n}),r.jsx("div",{className:"mx-1"}),r.jsx(x,{onClick:()=>h("insertUnorderedList"),isActive:C.insertUnorderedList,icon:Tt,title:"Bullet List",disabled:n}),r.jsx(x,{onClick:()=>h("insertOrderedList"),isActive:C.insertOrderedList,icon:St,title:"Numbered List",disabled:n})]}),r.jsx(H,{}),r.jsxs("div",{className:"flex items-center",children:[r.jsx(x,{onClick:()=>h("indent"),icon:Rt,title:"Indent",disabled:n}),r.jsx(x,{onClick:()=>h("outdent"),icon:Nt,title:"Outdent",disabled:n})]}),r.jsx(H,{}),r.jsxs("div",{className:"flex items-center",children:[r.jsx(x,{onClick:Fe,icon:jt,title:"Insert Link",disabled:n}),r.jsxs("div",{className:"relative",children:[r.jsx(x,{onClick:()=>N.current?.click(),icon:yt,title:"Upload Image",disabled:n}),r.jsx("input",{type:"file",accept:"image/*",ref:N,onChange:qe,className:"hidden",disabled:n})]}),r.jsx(x,{onClick:()=>h("insertHorizontalRule"),icon:Lt,title:"Horizontal Line",disabled:n}),r.jsxs("div",{className:"relative",children:[r.jsx(x,{onClick:()=>le(!B),icon:Yt,title:"Insert Table",disabled:n}),B&&!n&&r.jsxs("div",{className:"absolute top-full left-0 mt-2 p-3 bg-white border border-gray-200 shadow-xl rounded-lg z-30 w-48",onClick:t=>t.stopPropagation(),children:[r.jsx("h4",{className:"text-xs font-semibold text-gray-500 mb-2 uppercase tracking-wider",children:"Table Size"}),r.jsxs("div",{className:"flex flex-col gap-2 mb-3",children:[r.jsxs("label",{className:"text-sm flex justify-between",children:["Rows: ",r.jsx("input",{type:"number",min:"1",max:"10",value:ie,onChange:t=>J(t.target.value),className:"w-12 border border-gray-300 rounded px-1 text-right"})]}),r.jsxs("label",{className:"text-sm flex justify-between",children:["Cols: ",r.jsx("input",{type:"number",min:"1",max:"10",value:Q,onChange:t=>be(t.target.value),className:"w-12 border border-gray-300 rounded px-1 text-right"})]})]}),r.jsx("button",{onClick:()=>we(),className:"w-full bg-indigo-600 text-white text-xs font-bold py-1.5 rounded hover:bg-indigo-700 transition-colors",children:"Insert Table"})]})]})]}),r.jsx("div",{className:"flex-grow"}),r.jsxs("div",{className:"flex items-center border-l border-gray-200 pl-2",children:[r.jsx(x,{onClick:()=>h("removeFormat"),icon:It,title:"Clear Formatting",disabled:n}),r.jsx("div",{className:"ml-1 pl-1 border-l border-gray-200 hidden md:block",children:r.jsx(x,{onClick:()=>{},icon:sr,title:"Close"})})]})]}),r.jsx("div",{className:"flex-grow overflow-hidden flex flex-col relative",children:n?r.jsx("textarea",{ref:S,value:W,onChange:$e,className:"flex-grow p-4 w-full h-full resize-none font-mono text-sm bg-gray-50 text-gray-800 outline-none",spellCheck:"false"}):r.jsxs(r.Fragment,{children:[r.jsx("div",{ref:l,contentEditable:!0,suppressContentEditableWarning:!0,className:"flex-grow p-4 md:p-8 overflow-y-auto outline-none prose prose-indigo max-w-none prose-lg relative z-0",onInput:ee,onClick:Be,onContextMenu:Ue,onKeyDown:t=>{t.key==="Tab"&&(t.preventDefault(),h("insertHTML"," "))}}),Z&&r.jsx("div",{className:"absolute top-4 left-4 md:top-8 md:left-8 right-4 md:right-8 pointer-events-none",children:r.jsx("div",{className:"prose prose-indigo max-w-none prose-lg text-gray-400",children:r.jsx("p",{children:j})})}),e&&R&&r.jsxs("div",{className:"absolute pointer-events-none z-50",style:{top:R.top,left:R.left,width:R.width,height:R.height,border:"2px solid #3b82f6",boxSizing:"border-box"},children:[r.jsxs("div",{className:"absolute -top-10 left-1/2 transform -translate-x-1/2 bg-white shadow-lg border border-gray-200 rounded-md flex p-1 pointer-events-auto gap-1 whitespace-nowrap",children:[e.tagName==="IMG"&&r.jsxs(r.Fragment,{children:[r.jsx("button",{onMouseDown:t=>{t.preventDefault(),xe("left")},className:"p-1 hover:bg-gray-100 rounded text-gray-600",title:"Align Left",children:r.jsx(ze,{size:16})}),r.jsx("button",{onMouseDown:t=>{t.preventDefault(),xe("center")},className:"p-1 hover:bg-gray-100 rounded text-gray-600",title:"Align Center",children:r.jsx(Ae,{size:16})}),r.jsx("button",{onMouseDown:t=>{t.preventDefault(),xe("right")},className:"p-1 hover:bg-gray-100 rounded text-gray-600",title:"Align Right",children:r.jsx(Le,{size:16})})]}),e.tagName==="TABLE"&&c&&r.jsxs(r.Fragment,{children:[r.jsx("button",{onMouseDown:t=>{t.preventDefault(),z("row-above")},className:"p-1 hover:bg-gray-100 rounded text-gray-600",title:"Insert Row Above",children:r.jsx(it,{size:16})}),r.jsx("button",{onMouseDown:t=>{t.preventDefault(),z("row-below")},className:"p-1 hover:bg-gray-100 rounded text-gray-600",title:"Insert Row Below",children:r.jsx(rt,{size:16})}),r.jsx("div",{className:"w-px h-4 bg-gray-300 mx-1 self-center"}),r.jsx("button",{onMouseDown:t=>{t.preventDefault(),z("col-left")},className:"p-1 hover:bg-gray-100 rounded text-gray-600",title:"Insert Col Left",children:r.jsx(nt,{size:16})}),r.jsx("button",{onMouseDown:t=>{t.preventDefault(),z("col-right")},className:"p-1 hover:bg-gray-100 rounded text-gray-600",title:"Insert Col Right",children:r.jsx(at,{size:16})}),r.jsx("div",{className:"w-px h-4 bg-gray-300 mx-1 self-center"}),r.jsxs("button",{onMouseDown:t=>{t.preventDefault(),z("del-row")},className:"p-1 hover:bg-red-50 text-red-500 rounded font-xs flex items-center",title:"Delete Row",children:[r.jsx(ve,{size:14,className:"mr-0.5"}),"R"]}),r.jsxs("button",{onMouseDown:t=>{t.preventDefault(),z("del-col")},className:"p-1 hover:bg-red-50 text-red-500 rounded font-xs flex items-center",title:"Delete Column",children:[r.jsx(ve,{size:14,className:"mr-0.5"}),"C"]})]}),r.jsx("div",{className:"w-px h-4 bg-gray-300 mx-1 self-center"}),r.jsx("button",{onMouseDown:t=>{t.preventDefault(),e.tagName==="TABLE"?z("del-table"):e.remove(),s(null)},className:"p-1 hover:bg-red-50 text-red-500 rounded",title:e.tagName==="TABLE"?"Delete Table":"Delete",children:r.jsx(ve,{size:16})})]}),r.jsx("div",{className:"absolute bottom-1 right-1 w-4 h-4 bg-blue-500 rounded-full cursor-nwse-resize pointer-events-auto shadow-sm hover:scale-125 transition-transform border-2 border-white z-50",onMouseDown:We})]}),v.map((t,o)=>r.jsx("div",{className:"absolute z-50 cursor-col-resize flex items-center justify-center hover:bg-blue-400 hover:opacity-50 transition-colors",style:{top:t.top,left:t.left-4,width:"8px",height:t.height,pointerEvents:"auto"},onMouseDown:a=>Ve(a,t.cell),title:"Resize Column",children:r.jsx("div",{className:"w-0.5 h-full bg-blue-500 opacity-0 hover:opacity-100 transition-opacity"})},o))]})}),r.jsx("style",{children:`
|
|
25
|
+
.prose { display: flow-root; }
|
|
26
|
+
.prose p { display: flow-root; margin-top: 0.5em; margin-bottom: 0.5em; line-height: 1.4; }
|
|
27
|
+
.prose table { width: auto; max-width: 100%; table-layout: fixed; border-collapse: collapse; margin: 1em 0; }
|
|
28
|
+
.prose td, .prose th { border: 1px solid #d1d5db; padding: 0.75rem; vertical-align: top; position: relative; }
|
|
29
|
+
.prose th { background-color: #f3f4f6; font-weight: 600; }
|
|
30
|
+
.prose h1 { font-size: 2.25em; margin-top: 0.5em; margin-bottom: 0.5em; line-height: 1.1; font-weight: 800; color: #111827; }
|
|
31
|
+
.prose h2 { font-size: 1.75em; margin-top: 0.5em; margin-bottom: 0.5em; line-height: 1.2; font-weight: 700; color: #1f2937; }
|
|
32
|
+
.prose h3 { font-size: 1.5em; margin-top: 0.5em; margin-bottom: 0.5em; line-height: 1.3; font-weight: 600; color: #374151; }
|
|
33
|
+
.prose ul { list-style-type: disc; padding-left: 1.5em; margin: 0.5em 0; }
|
|
34
|
+
.prose ol { list-style-type: decimal; padding-left: 1.5em; margin: 0.5em 0; }
|
|
35
|
+
.prose li { margin: 0.5em 0; }
|
|
36
|
+
.prose blockquote { border-left: 4px solid #6366f1; padding-left: 1rem; margin: 1rem 0; font-style: italic; color: #4b5563; background: #f9fafb; padding: 1rem; border-radius: 0 0.5rem 0.5rem 0; }
|
|
37
|
+
.prose pre { background-color: #1e293b; color: #e2e8f0; padding: 1rem; border-radius: 0.5rem; overflow-x: auto; font-family: monospace; }
|
|
38
|
+
.prose img { border-radius: 0.5rem; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); }
|
|
39
|
+
.prose hr { border: 0; border-top: 1px solid #e5e7eb; margin: 2em 0; }
|
|
40
|
+
::selection { background-color: #c7d2fe; color: #1e1b4b; }
|
|
41
|
+
`})]})});module.exports=lr;
|