1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6167],{26167:function(t,e,o){"use strict";o.r(e),o.d(e,{default:function(){return RichTextEditor}});var n=o(57437),l=o(2265);function RichTextEditor(t){let{value:e,onChange:o,placeholder:r="Write your content here..."}=t,i=(0,l.useRef)(null),[a,c]=(0,l.useState)(!1),[s,d]=(0,l.useState)({bold:!1,italic:!1,underline:!1,h2:!1,h3:!1,h4:!1});(0,l.useEffect)(()=>{i.current&&e!==i.current.innerHTML&&(i.current.innerHTML=e||"")},[e]);let updateFormatState=()=>{let t=window.getSelection();if(!t.rangeCount)return;let e={bold:document.queryCommandState("bold"),italic:document.queryCommandState("italic"),underline:document.queryCommandState("underline"),h2:"h2"===document.queryCommandValue("formatBlock"),h3:"h3"===document.queryCommandValue("formatBlock"),h4:"h4"===document.queryCommandValue("formatBlock")};d(e)},handleInput=()=>{i.current&&o(i.current.innerHTML),updateFormatState()},execCommand=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;document.execCommand(t,!1,e),i.current.focus(),handleInput()},formatBlock=t=>{let e=window.getSelection();if(!e.rangeCount)return;let o=e.getRangeAt(0),n=o.toString();if(n.trim())execCommand("formatBlock",t);else{let n=document.createElement(t);n.textContent="New Heading",n.className="editor-".concat(t),o.deleteContents(),o.insertNode(n);let l=document.createRange();l.setStart(n,0),l.collapse(!0),e.removeAllRanges(),e.addRange(l)}handleInput(),updateFormatState()},insertList=t=>{execCommand(t)};return(0,n.jsxs)("div",{className:"rich-text-editor",children:[(0,n.jsxs)("div",{className:"editor-toolbar",children:[(0,n.jsxs)("div",{className:"toolbar-group",children:[(0,n.jsx)("button",{type:"button",className:"toolbar-btn ".concat(s.bold?"active":""),onClick:()=>execCommand("bold"),title:"Bold (Ctrl+B)",children:(0,n.jsx)("strong",{children:"B"})}),(0,n.jsx)("button",{type:"button",className:"toolbar-btn ".concat(s.italic?"active":""),onClick:()=>execCommand("italic"),title:"Italic (Ctrl+I)",children:(0,n.jsx)("em",{children:"I"})}),(0,n.jsx)("button",{type:"button",className:"toolbar-btn ".concat(s.underline?"active":""),onClick:()=>execCommand("underline"),title:"Underline (Ctrl+U)",children:(0,n.jsx)("u",{children:"U"})}),(0,n.jsx)("button",{type:"button",className:"toolbar-btn",onClick:()=>{execCommand("removeFormat")},title:"Clear Formatting",children:(0,n.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,n.jsx)("path",{d:"M3 6h18M9 6v12m6-12v12M6 18h12"})})})]}),(0,n.jsx)("div",{className:"toolbar-divider"}),(0,n.jsxs)("div",{className:"toolbar-group",children:[(0,n.jsx)("button",{type:"button",className:"toolbar-btn ".concat(s.h2?"active":""),onClick:()=>formatBlock("h2"),title:"Heading 2",children:"H2"}),(0,n.jsx)("button",{type:"button",className:"toolbar-btn ".concat(s.h3?"active":""),onClick:()=>formatBlock("h3"),title:"Heading 3",children:"H3"}),(0,n.jsx)("button",{type:"button",className:"toolbar-btn ".concat(s.h4?"active":""),onClick:()=>formatBlock("h4"),title:"Heading 4",children:"H4"}),(0,n.jsx)("button",{type:"button",className:"toolbar-btn",onClick:()=>formatBlock("p"),title:"Paragraph",children:"P"})]}),(0,n.jsx)("div",{className:"toolbar-divider"}),(0,n.jsxs)("div",{className:"toolbar-group",children:[(0,n.jsx)("button",{type:"button",className:"toolbar-btn",onClick:()=>insertList("insertUnorderedList"),title:"Bullet List",children:(0,n.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,n.jsx)("circle",{cx:"6",cy:"12",r:"2",fill:"currentColor"}),(0,n.jsx)("path",{d:"M12 12h8M12 18h8M12 6h8"})]})}),(0,n.jsx)("button",{type:"button",className:"toolbar-btn",onClick:()=>insertList("insertOrderedList"),title:"Numbered List",children:(0,n.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,n.jsx)("path",{d:"M6 6v12M10 6h8M10 12h8M10 18h8"}),(0,n.jsx)("circle",{cx:"4",cy:"6",r:"1.5",fill:"currentColor"}),(0,n.jsx)("circle",{cx:"4",cy:"12",r:"1.5",fill:"currentColor"}),(0,n.jsx)("circle",{cx:"4",cy:"18",r:"1.5",fill:"currentColor"})]})})]}),(0,n.jsx)("div",{className:"toolbar-divider"}),(0,n.jsxs)("div",{className:"toolbar-group",children:[(0,n.jsx)("button",{type:"button",className:"toolbar-btn",onClick:()=>execCommand("justifyLeft"),title:"Align Left",children:(0,n.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,n.jsx)("path",{d:"M3 6h18M3 12h12M3 18h18"})})}),(0,n.jsx)("button",{type:"button",className:"toolbar-btn",onClick:()=>execCommand("justifyCenter"),title:"Align Center",children:(0,n.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,n.jsx)("path",{d:"M3 6h18M6 12h12M3 18h18"})})}),(0,n.jsx)("button",{type:"button",className:"toolbar-btn",onClick:()=>execCommand("justifyRight"),title:"Align Right",children:(0,n.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,n.jsx)("path",{d:"M3 6h18M9 12h12M3 18h18"})})})]}),(0,n.jsx)("div",{className:"toolbar-divider"}),(0,n.jsxs)("div",{className:"toolbar-group",children:[(0,n.jsx)("button",{type:"button",className:"toolbar-btn",onClick:()=>{let t=prompt("Enter URL:","https://");if(t){let e=window.getSelection();if(e.toString())execCommand("createLink",t);else{let e=prompt("Enter link text:","Click here");if(e){let o='<a href="'.concat(t,'" target="_blank" rel="noopener noreferrer">').concat(e,"</a>");document.execCommand("insertHTML",!1,o)}}}handleInput()},title:"Insert Link",children:(0,n.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,n.jsx)("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),(0,n.jsx)("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}),(0,n.jsx)("button",{type:"button",className:"toolbar-btn",onClick:()=>{let t=prompt("Enter image URL:","https://");if(t){let e='<img src="'.concat(t,'" alt="Image" style="max-width: 100%; height: auto;" />');document.execCommand("insertHTML",!1,e)}handleInput()},title:"Insert Image",children:(0,n.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,n.jsx)("rect",{x:"2",y:"2",width:"20",height:"20",rx:"2",ry:"2"}),(0,n.jsx)("circle",{cx:"8.5",cy:"8.5",r:"1.5",fill:"currentColor"}),(0,n.jsx)("polyline",{points:"21 15 16 10 5 21"})]})}),(0,n.jsx)("button",{type:"button",className:"toolbar-btn",onClick:()=>{execCommand("insertHorizontalRule")},title:"Horizontal Rule",children:(0,n.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,n.jsx)("path",{d:"M3 12h18"})})})]}),(0,n.jsx)("div",{className:"toolbar-divider"}),(0,n.jsxs)("div",{className:"toolbar-group",children:[(0,n.jsx)("button",{type:"button",className:"toolbar-btn",onClick:()=>execCommand("undo"),title:"Undo (Ctrl+Z)",children:(0,n.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,n.jsx)("path",{d:"M3 7v6h6"}),(0,n.jsx)("path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"})]})}),(0,n.jsx)("button",{type:"button",className:"toolbar-btn",onClick:()=>execCommand("redo"),title:"Redo (Ctrl+Y)",children:(0,n.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,n.jsx)("path",{d:"M21 7v6h-6"}),(0,n.jsx)("path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3L21 13"})]})})]})]}),(0,n.jsx)("div",{ref:i,className:"editor-content",contentEditable:"true",onInput:handleInput,onKeyUp:()=>{updateFormatState()},onMouseUp:()=>{updateFormatState()},onFocus:()=>c(!0),onBlur:()=>c(!1),onPaste:t=>{t.preventDefault();let e=t.clipboardData.getData("text/plain");document.execCommand("insertText",!1,e)},onDragOver:t=>{t.preventDefault()},onDrop:t=>{t.preventDefault();let e=t.dataTransfer.files;e.length>0&&alert("Image upload via drag & drop will be implemented soon")},"data-placeholder":r,style:{minHeight:"400px",maxHeight:"600px",overflowY:"auto",backgroundColor:"#fff",outline:"none",padding:"1rem",lineHeight:"1.6"}})]})}o(67809)},67809:function(){}}]);
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.