react-reason-editor 1.0.180 → 1.0.182

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.
@@ -1,4 +1,4 @@
1
- import{i as e,o as t,t as n}from"./rolldown-runtime-Drgf5FY8.js";import{o as r}from"./dist-DmY5xFkC.js";import{i,n as s,r as o,t as a}from"./tooltip-G11f5UOp.js";import{n as c,o as l,t as h}from"./editorConfig-CDQ1cqBk.js";import{$ as d,A as u,B as f,C as g,D as p,E as m,F as y,G as b,H as w,I as v,J as _,K as k,L as C,M as S,N as E,O as A,P as T,Q as x,R,S as D,T as O,U as P,V as L,W as M,X as N,Y as I,Z as U,_ as j,a as F,at as B,b as W,c as H,ct as q,d as V,dt as z,et as $,f as Y,ft as J,g as Q,h as K,i as G,it as X,j as Z,k as ee,l as te,lt as ne,m as re,n as ie,nt as se,o as oe,p as ae,q as ce,r as le,rt as he,s as de,st as ue,t as fe,tt as ge,u as pe,ut as me,v as ye,w as be,x as we,y as ve,z as _e}from"./reason-toolbar-skin-B62eL3ng.js";import{a as ke,f as Ce,h as Se,m as Ee,o as Ae,p as Te,r as xe,s as Re,t as De,u as Oe}from"./dropdown-menu-tmQwCqOR.js";import{getTranscribeStorage as Pe,isTranscriptionSupported as Le,subscribeTranscribe as Me}from"./Transcribe.js";import{$ as Ne,A as Ie,At as Ue,B as je,Bt as Fe,C as Be,Ct as We,D as He,Dt as qe,E as Ve,Et as ze,F as $e,Ft as Ye,G as Je,Gt as Qe,H as Ke,Ht as Ge,I as Xe,It as Ze,J as et,K as tt,Kt as nt,L as rt,Lt as it,M as st,Mt as ot,N as at,Nt as ct,O as lt,Ot as ht,P as dt,Pt as ut,Q as ft,R as gt,Rt as pt,S as mt,St as yt,T as bt,Tt as wt,U as vt,Ut as _t,V as kt,Vt as Ct,W as St,Wt as Et,X as At,Y as Tt,Z as xt,_ as Rt,_t as Dt,at as Ot,b as Pt,bt as Lt,c as Mt,ct as Nt,d as It,dt as Ut,et as jt,f as Ft,ft as Bt,g as Wt,gt as Ht,h as qt,ht as Vt,i as zt,it as $t,j as Yt,jt as Jt,k as Qt,kt as Kt,l as Gt,lt as Xt,m as Zt,mt as en,nt as tn,o as nn,ot as rn,p as sn,pt as on,q as an,qt as cn,rt as ln,st as hn,t as dn,tt as un,u as fn,ut as gn,v as pn,vt as mn,w as yn,wt as bn,x as wn,xt as vn,y as _n,yt as kn,z as Cn,zt as Sn}from"./dist-kbEzWzhg.js";import*as En from"react";import{useCallback as An,useEffect as Tn,useLayoutEffect as xn,useMemo as Rn,useReducer as Dn,useRef as On,useState as Pn}from"react";import{Extension as Ln}from"@tiptap/core";import{Plugin as Mn,PluginKey as Nn}from"@tiptap/pm/state";import{Fragment as In,jsx as Un,jsxs as jn}from"react/jsx-runtime";import{AlignCenter as Fn,AlignJustify as Bn,AlignLeft as Wn,AlignRight as Hn,Baseline as qn,Bold as Vn,Braces as zn,Code as $n,Code2 as Yn,Columns2 as Jn,Eraser as Qn,FileText as Kn,Heading1 as Gn,Heading2 as Xn,Heading3 as Zn,Heading4 as er,Heading5 as tr,Heading6 as nr,Highlighter as rr,Image as ir,IndentDecrease as sr,IndentIncrease as or,Info as ar,Italic as cr,Link2 as lr,List as hr,ListChecks as dr,ListOrdered as ur,Mic as fr,Minus as gr,Pencil as pr,Pilcrow as mr,Plus as yr,Quote as br,Redo2 as wr,Rows3 as vr,Sigma as _r,Smile as kr,Strikethrough as Cr,Subscript as Sr,Superscript as Er,Table2 as Ar,Trash2 as Tr,Type as xr,Underline as Rr,Undo2 as Dr,Video as Or}from"lucide-react";import{useSyncExternalStore as Pr}from"use-sync-external-store/shim";import"use-sync-external-store/shim/with-selector";var Lr=class extends Ze{constructor(e){super(),this.doc=e,this.clientID=e.clientID,this.states=/* @__PURE__ */new Map,this.meta=/* @__PURE__ */new Map,this._checkInterval=setInterval(()=>{const e=At();null!==this.getLocalState()&&15e3<=e-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());const t=[];this.meta.forEach((n,r)=>{r!==this.clientID&&3e4<=e-n.lastUpdated&&this.states.has(r)&&t.push(r)}),t.length>0&&Mr(this,t,"timeout")},ot(3e3)),e.on("destroy",()=>{this.destroy()}),this.setLocalState({})}destroy(){this.emit("destroy",[this]),this.setLocalState(null),super.destroy(),clearInterval(this._checkInterval)}getLocalState(){return this.states.get(this.clientID)||null}setLocalState(e){const t=this.clientID,n=this.meta.get(t),r=void 0===n?0:n.clock+1,i=this.states.get(t);null===e?this.states.delete(t):this.states.set(t,e),this.meta.set(t,{clock:r,lastUpdated:At()});const s=[],o=[],a=[],c=[];null===e?c.push(t):null==i?null!=e&&s.push(t):(o.push(t),rt(i,e)||a.push(t)),(s.length>0||a.length>0||c.length>0)&&this.emit("change",[{added:s,updated:a,removed:c},"local"]),this.emit("update",[{added:s,updated:o,removed:c},"local"])}setLocalStateField(e,t){const n=this.getLocalState();null!==n&&this.setLocalState({...n,[e]:t})}getStates(){return this.states}},Mr=(e,t,n)=>{const r=[];for(let i=0;i<t.length;i++){const n=t[i];if(e.states.has(n)){if(e.states.delete(n),n===e.clientID){const t=e.meta.get(n);e.meta.set(n,{clock:t.clock+1,lastUpdated:At()})}r.push(n)}}r.length>0&&(e.emit("change",[{added:[],updated:[],removed:r},n]),e.emit("update",[{added:[],updated:[],removed:r},n]))},Nr=(e,t,n=e.states)=>{const r=t.length,i=Lt();ht(i,r);for(let s=0;s<r;s++){const r=t[s],o=n.get(r)||null,a=e.meta.get(r).clock;ht(i,r),ht(i,a),qe(i,JSON.stringify(o))}return yt(i)};function Ir(e){return{engine:e,execute(){},isActive:()=>!1,isEnabled:()=>!1,getValue(){},subscribe:()=>()=>{}}}var Ur=[{kind:"button",id:"undo",label:"Undo",icon:Dr,shortcut:"⌘Z"},{kind:"button",id:"redo",label:"Redo",icon:wr,shortcut:"⇧⌘Z"},{kind:"separator",id:"history-divider"},{kind:"button",id:"bold",label:"Bold",icon:Vn,shortcut:"⌘B"},{kind:"button",id:"italic",label:"Italic",icon:cr,shortcut:"⌘I"},{kind:"button",id:"underline",label:"Underline",icon:Rr,shortcut:"⌘U"},{kind:"button",id:"highlight",label:"Highlight",icon:rr,shortcut:"⌘⇧H"},{kind:"separator",id:"marks-divider"},{kind:"menu",id:"block-format",label:"Block Format",icon:vr,children:[{kind:"button",id:"paragraph",label:"Paragraph",icon:mr},{kind:"button",id:"heading-1",label:"Heading 1",icon:Gn,shortcut:"Ctrl+Alt+1"},{kind:"button",id:"heading-2",label:"Heading 2",icon:Xn,shortcut:"Ctrl+Alt+2"},{kind:"button",id:"heading-3",label:"Heading 3",icon:Zn,shortcut:"Ctrl+Alt+3"},{kind:"button",id:"heading-4",label:"Heading 4",icon:er,shortcut:"Ctrl+Alt+4"},{kind:"button",id:"heading-5",label:"Heading 5",icon:tr,shortcut:"Ctrl+Alt+5"},{kind:"button",id:"heading-6",label:"Heading 6",icon:nr,shortcut:"Ctrl+Alt+6"},{kind:"separator",id:"block-format-lists-divider"},{kind:"button",id:"bullet-list",label:"Bullet List",icon:hr,shortcut:"Ctrl+Shift+8"},{kind:"button",id:"ordered-list",label:"Ordered List",icon:ur,shortcut:"Ctrl+Shift+7"},{kind:"button",id:"task-list",label:"Check List",icon:dr,shortcut:"Ctrl+Shift+9"},{kind:"separator",id:"block-format-quote-divider"},{kind:"button",id:"blockquote",label:"Blockquote",icon:br,shortcut:"Ctrl+Shift+B"},{kind:"button",id:"code-block",label:"Code Block",icon:Yn,shortcut:"Ctrl+Alt+C"},{kind:"separator",id:"block-format-clear-divider"},{kind:"button",id:"clear-formatting",label:"Clear Format",icon:Qn}]},{kind:"menu",id:"text-styles",label:"Text Styles",icon:xr,children:[{kind:"group-label",id:"text-styles-label",label:"Text Styles"},{kind:"button",id:"strike",label:"Strikethrough",icon:Cr,shortcut:"Ctrl+Shift+S"},{kind:"button",id:"code",label:"Inline Code",icon:$n,shortcut:"Ctrl+E"},{kind:"button",id:"text-color",label:"Text Color",icon:qn,shortcut:"Alt+Shift+C"},{kind:"button",id:"superscript",label:"Superscript",icon:Er,shortcut:"Ctrl+."},{kind:"button",id:"subscript",label:"Subscript",icon:Sr,shortcut:"Ctrl+,"},{kind:"separator",id:"text-styles-indent-divider"},{kind:"button",id:"indent",label:"Indent",icon:or},{kind:"button",id:"outdent",label:"Outdent",icon:sr},{kind:"menu",id:"alignment",label:"Alignment",icon:Wn,children:[{kind:"button",id:"align-left",label:"Align Left",icon:Wn},{kind:"button",id:"align-center",label:"Align Center",icon:Fn},{kind:"button",id:"align-right",label:"Align Right",icon:Hn},{kind:"button",id:"align-justify",label:"Justify",icon:Bn}]}]},{kind:"menu",id:"insert",label:"Insert",icon:yr,children:[{kind:"group-label",id:"insert-label",label:"Insert"},{kind:"button",id:"link",label:"Link",icon:lr},{kind:"button",id:"emoji",label:"Emoji",icon:kr},{kind:"button",id:"table",label:"Table",icon:Ar},{kind:"button",id:"image",label:"Image",icon:ir},{kind:"button",id:"columns",label:"Columns",icon:Jn,shortcut:"Ctrl+Alt+G"},{kind:"button",id:"callout",label:"Callout",icon:ar},{kind:"button",id:"horizontal-rule",label:"Divider",icon:gr,shortcut:"Ctrl+Alt+S"},{kind:"button",id:"video",label:"Video",icon:Or},{kind:"button",id:"math",label:"Math",icon:_r}]},{kind:"separator",id:"voice-divider"},{kind:"button",id:"transcribe",label:"Dictate",icon:fr,shortcut:"Ctrl+Shift+D"},{kind:"menu",id:"table-tools",label:"Table",icon:Ar,visibleWhenActive:"table",children:[{kind:"group-label",id:"table-rows-label",label:"Rows"},{kind:"button",id:"table.add-row-before",label:"Insert Row Above",icon:vr},{kind:"button",id:"table.add-row-after",label:"Insert Row Below",icon:vr},{kind:"button",id:"table.delete-row",label:"Delete Row",icon:Tr},{kind:"separator",id:"table-columns-divider"},{kind:"group-label",id:"table-columns-label",label:"Columns"},{kind:"button",id:"table.add-column-before",label:"Insert Column Left",icon:Jn},{kind:"button",id:"table.add-column-after",label:"Insert Column Right",icon:Jn},{kind:"button",id:"table.delete-column",label:"Delete Column",icon:Tr},{kind:"separator",id:"table-cells-divider"},{kind:"group-label",id:"table-cells-label",label:"Cells"},{kind:"button",id:"table.merge-cells",label:"Merge Cells",icon:zn},{kind:"button",id:"table.split-cell",label:"Split Cell",icon:zn},{kind:"button",id:"table.toggle-header-row",label:"Toggle Header Row",icon:vr},{kind:"separator",id:"table-delete-divider"},{kind:"button",id:"table.delete",label:"Delete Table",icon:Tr}]}];function jr(e=Ur){const t=[];for(const n of e)"button"===n.kind&&t.push(n.id),"menu"===n.kind&&t.push(...jr(n.children));return t}var Fr="flex items-center justify-center rounded p-1.5 text-gray-600 transition-colors dark:text-gray-300 disabled:cursor-not-allowed disabled:opacity-40 hover:enabled:bg-gray-100 dark:hover:enabled:bg-slate-800",Br="bg-gray-200 text-gray-900 dark:bg-slate-700 dark:text-white",Wr="flex w-full cursor-pointer items-center gap-2 text-xs data-disabled:cursor-not-allowed data-disabled:opacity-40";function Hr({shortcut:e}){return e?/* @__PURE__ */Un("span",{className:"ml-auto pl-4 text-[10px] tracking-widest text-gray-400 dark:text-gray-500",children:e}):null}function qr({items:e,adapter:t}){/* @__PURE__ */
1
+ import{i as e,o as t,t as n}from"./rolldown-runtime-Drgf5FY8.js";import{o as r}from"./dist-DmY5xFkC.js";import{i,n as s,r as o,t as a}from"./tooltip-G11f5UOp.js";import{n as c,o as l,t as h}from"./editorConfig-CDQ1cqBk.js";import{$ as d,A as u,B as f,C as g,D as p,E as m,F as y,G as b,H as w,I as v,J as _,K as k,L as C,M as S,N as E,O as A,P as T,Q as x,R,S as D,T as O,U as P,V as L,W as M,X as N,Y as I,Z as U,_ as j,a as F,at as B,b as W,c as H,ct as q,d as V,dt as z,et as $,f as Y,ft as J,g as Q,h as K,i as G,it as X,j as Z,k as ee,l as te,lt as ne,m as re,n as ie,nt as se,o as oe,p as ae,q as ce,r as le,rt as he,s as de,st as ue,t as fe,tt as ge,u as pe,ut as me,v as ye,w as be,x as we,y as ve,z as _e}from"./reason-toolbar-skin-B5gdLvGB.js";import{a as ke,f as Ce,h as Se,m as Ee,o as Ae,p as Te,r as xe,s as Re,t as De,u as Oe}from"./dropdown-menu-tmQwCqOR.js";import{getTranscribeStorage as Pe,isTranscriptionSupported as Le,subscribeTranscribe as Me}from"./Transcribe.js";import{$ as Ne,A as Ie,At as Ue,B as je,Bt as Fe,C as Be,Ct as We,D as He,Dt as qe,E as Ve,Et as ze,F as $e,Ft as Ye,G as Je,Gt as Qe,H as Ke,Ht as Ge,I as Xe,It as Ze,J as et,K as tt,Kt as nt,L as rt,Lt as it,M as st,Mt as ot,N as at,Nt as ct,O as lt,Ot as ht,P as dt,Pt as ut,Q as ft,R as gt,Rt as pt,S as mt,St as yt,T as bt,Tt as wt,U as vt,Ut as _t,V as kt,Vt as Ct,W as St,Wt as Et,X as At,Y as Tt,Z as xt,_ as Rt,_t as Dt,at as Ot,b as Pt,bt as Lt,c as Mt,ct as Nt,d as It,dt as Ut,et as jt,f as Ft,ft as Bt,g as Wt,gt as Ht,h as qt,ht as Vt,i as zt,it as $t,j as Yt,jt as Jt,k as Qt,kt as Kt,l as Gt,lt as Xt,m as Zt,mt as en,nt as tn,o as nn,ot as rn,p as sn,pt as on,q as an,qt as cn,rt as ln,st as hn,t as dn,tt as un,u as fn,ut as gn,v as pn,vt as mn,w as yn,wt as bn,x as wn,xt as vn,y as _n,yt as kn,z as Cn,zt as Sn}from"./dist-kbEzWzhg.js";import*as En from"react";import{useCallback as An,useEffect as Tn,useLayoutEffect as xn,useMemo as Rn,useReducer as Dn,useRef as On,useState as Pn}from"react";import{Extension as Ln}from"@tiptap/core";import{Plugin as Mn,PluginKey as Nn}from"@tiptap/pm/state";import{Fragment as In,jsx as Un,jsxs as jn}from"react/jsx-runtime";import{AlignCenter as Fn,AlignJustify as Bn,AlignLeft as Wn,AlignRight as Hn,Baseline as qn,Bold as Vn,Braces as zn,Code as $n,Code2 as Yn,Columns2 as Jn,Eraser as Qn,FileText as Kn,Heading1 as Gn,Heading2 as Xn,Heading3 as Zn,Heading4 as er,Heading5 as tr,Heading6 as nr,Highlighter as rr,Image as ir,IndentDecrease as sr,IndentIncrease as or,Info as ar,Italic as cr,Link2 as lr,List as hr,ListChecks as dr,ListOrdered as ur,Mic as fr,Minus as gr,Pencil as pr,Pilcrow as mr,Plus as yr,Quote as br,Redo2 as wr,Rows3 as vr,Sigma as _r,Smile as kr,Strikethrough as Cr,Subscript as Sr,Superscript as Er,Table2 as Ar,Trash2 as Tr,Type as xr,Underline as Rr,Undo2 as Dr,Video as Or}from"lucide-react";import{useSyncExternalStore as Pr}from"use-sync-external-store/shim";import"use-sync-external-store/shim/with-selector";var Lr=class extends Ze{constructor(e){super(),this.doc=e,this.clientID=e.clientID,this.states=/* @__PURE__ */new Map,this.meta=/* @__PURE__ */new Map,this._checkInterval=setInterval(()=>{const e=At();null!==this.getLocalState()&&15e3<=e-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());const t=[];this.meta.forEach((n,r)=>{r!==this.clientID&&3e4<=e-n.lastUpdated&&this.states.has(r)&&t.push(r)}),t.length>0&&Mr(this,t,"timeout")},ot(3e3)),e.on("destroy",()=>{this.destroy()}),this.setLocalState({})}destroy(){this.emit("destroy",[this]),this.setLocalState(null),super.destroy(),clearInterval(this._checkInterval)}getLocalState(){return this.states.get(this.clientID)||null}setLocalState(e){const t=this.clientID,n=this.meta.get(t),r=void 0===n?0:n.clock+1,i=this.states.get(t);null===e?this.states.delete(t):this.states.set(t,e),this.meta.set(t,{clock:r,lastUpdated:At()});const s=[],o=[],a=[],c=[];null===e?c.push(t):null==i?null!=e&&s.push(t):(o.push(t),rt(i,e)||a.push(t)),(s.length>0||a.length>0||c.length>0)&&this.emit("change",[{added:s,updated:a,removed:c},"local"]),this.emit("update",[{added:s,updated:o,removed:c},"local"])}setLocalStateField(e,t){const n=this.getLocalState();null!==n&&this.setLocalState({...n,[e]:t})}getStates(){return this.states}},Mr=(e,t,n)=>{const r=[];for(let i=0;i<t.length;i++){const n=t[i];if(e.states.has(n)){if(e.states.delete(n),n===e.clientID){const t=e.meta.get(n);e.meta.set(n,{clock:t.clock+1,lastUpdated:At()})}r.push(n)}}r.length>0&&(e.emit("change",[{added:[],updated:[],removed:r},n]),e.emit("update",[{added:[],updated:[],removed:r},n]))},Nr=(e,t,n=e.states)=>{const r=t.length,i=Lt();ht(i,r);for(let s=0;s<r;s++){const r=t[s],o=n.get(r)||null,a=e.meta.get(r).clock;ht(i,r),ht(i,a),qe(i,JSON.stringify(o))}return yt(i)};function Ir(e){return{engine:e,execute(){},isActive:()=>!1,isEnabled:()=>!1,getValue(){},subscribe:()=>()=>{}}}var Ur=[{kind:"button",id:"undo",label:"Undo",icon:Dr,shortcut:"⌘Z"},{kind:"button",id:"redo",label:"Redo",icon:wr,shortcut:"⇧⌘Z"},{kind:"separator",id:"history-divider"},{kind:"button",id:"bold",label:"Bold",icon:Vn,shortcut:"⌘B"},{kind:"button",id:"italic",label:"Italic",icon:cr,shortcut:"⌘I"},{kind:"button",id:"underline",label:"Underline",icon:Rr,shortcut:"⌘U"},{kind:"button",id:"highlight",label:"Highlight",icon:rr,shortcut:"⌘⇧H"},{kind:"separator",id:"marks-divider"},{kind:"menu",id:"block-format",label:"Block Format",icon:vr,children:[{kind:"button",id:"paragraph",label:"Paragraph",icon:mr},{kind:"button",id:"heading-1",label:"Heading 1",icon:Gn,shortcut:"Ctrl+Alt+1"},{kind:"button",id:"heading-2",label:"Heading 2",icon:Xn,shortcut:"Ctrl+Alt+2"},{kind:"button",id:"heading-3",label:"Heading 3",icon:Zn,shortcut:"Ctrl+Alt+3"},{kind:"button",id:"heading-4",label:"Heading 4",icon:er,shortcut:"Ctrl+Alt+4"},{kind:"button",id:"heading-5",label:"Heading 5",icon:tr,shortcut:"Ctrl+Alt+5"},{kind:"button",id:"heading-6",label:"Heading 6",icon:nr,shortcut:"Ctrl+Alt+6"},{kind:"separator",id:"block-format-lists-divider"},{kind:"button",id:"bullet-list",label:"Bullet List",icon:hr,shortcut:"Ctrl+Shift+8"},{kind:"button",id:"ordered-list",label:"Ordered List",icon:ur,shortcut:"Ctrl+Shift+7"},{kind:"button",id:"task-list",label:"Check List",icon:dr,shortcut:"Ctrl+Shift+9"},{kind:"separator",id:"block-format-quote-divider"},{kind:"button",id:"blockquote",label:"Blockquote",icon:br,shortcut:"Ctrl+Shift+B"},{kind:"button",id:"code-block",label:"Code Block",icon:Yn,shortcut:"Ctrl+Alt+C"},{kind:"separator",id:"block-format-clear-divider"},{kind:"button",id:"clear-formatting",label:"Clear Format",icon:Qn}]},{kind:"menu",id:"text-styles",label:"Text Styles",icon:xr,children:[{kind:"group-label",id:"text-styles-label",label:"Text Styles"},{kind:"button",id:"strike",label:"Strikethrough",icon:Cr,shortcut:"Ctrl+Shift+S"},{kind:"button",id:"code",label:"Inline Code",icon:$n,shortcut:"Ctrl+E"},{kind:"button",id:"text-color",label:"Text Color",icon:qn,shortcut:"Alt+Shift+C"},{kind:"button",id:"superscript",label:"Superscript",icon:Er,shortcut:"Ctrl+."},{kind:"button",id:"subscript",label:"Subscript",icon:Sr,shortcut:"Ctrl+,"},{kind:"separator",id:"text-styles-indent-divider"},{kind:"button",id:"indent",label:"Indent",icon:or},{kind:"button",id:"outdent",label:"Outdent",icon:sr},{kind:"menu",id:"alignment",label:"Alignment",icon:Wn,children:[{kind:"button",id:"align-left",label:"Align Left",icon:Wn},{kind:"button",id:"align-center",label:"Align Center",icon:Fn},{kind:"button",id:"align-right",label:"Align Right",icon:Hn},{kind:"button",id:"align-justify",label:"Justify",icon:Bn}]}]},{kind:"menu",id:"insert",label:"Insert",icon:yr,children:[{kind:"group-label",id:"insert-label",label:"Insert"},{kind:"button",id:"link",label:"Link",icon:lr},{kind:"button",id:"emoji",label:"Emoji",icon:kr},{kind:"button",id:"table",label:"Table",icon:Ar},{kind:"button",id:"image",label:"Image",icon:ir},{kind:"button",id:"columns",label:"Columns",icon:Jn,shortcut:"Ctrl+Alt+G"},{kind:"button",id:"callout",label:"Callout",icon:ar},{kind:"button",id:"horizontal-rule",label:"Divider",icon:gr,shortcut:"Ctrl+Alt+S"},{kind:"button",id:"video",label:"Video",icon:Or},{kind:"button",id:"math",label:"Math",icon:_r}]},{kind:"separator",id:"voice-divider"},{kind:"button",id:"transcribe",label:"Dictate",icon:fr,shortcut:"Ctrl+Shift+D"},{kind:"menu",id:"table-tools",label:"Table",icon:Ar,visibleWhenActive:"table",children:[{kind:"group-label",id:"table-rows-label",label:"Rows"},{kind:"button",id:"table.add-row-before",label:"Insert Row Above",icon:vr},{kind:"button",id:"table.add-row-after",label:"Insert Row Below",icon:vr},{kind:"button",id:"table.delete-row",label:"Delete Row",icon:Tr},{kind:"separator",id:"table-columns-divider"},{kind:"group-label",id:"table-columns-label",label:"Columns"},{kind:"button",id:"table.add-column-before",label:"Insert Column Left",icon:Jn},{kind:"button",id:"table.add-column-after",label:"Insert Column Right",icon:Jn},{kind:"button",id:"table.delete-column",label:"Delete Column",icon:Tr},{kind:"separator",id:"table-cells-divider"},{kind:"group-label",id:"table-cells-label",label:"Cells"},{kind:"button",id:"table.merge-cells",label:"Merge Cells",icon:zn},{kind:"button",id:"table.split-cell",label:"Split Cell",icon:zn},{kind:"button",id:"table.toggle-header-row",label:"Toggle Header Row",icon:vr},{kind:"separator",id:"table-delete-divider"},{kind:"button",id:"table.delete",label:"Delete Table",icon:Tr}]}];function jr(e=Ur){const t=[];for(const n of e)"button"===n.kind&&t.push(n.id),"menu"===n.kind&&t.push(...jr(n.children));return t}var Fr="flex items-center justify-center rounded p-1.5 text-gray-600 transition-colors dark:text-gray-300 disabled:cursor-not-allowed disabled:opacity-40 hover:enabled:bg-gray-100 dark:hover:enabled:bg-slate-800",Br="bg-gray-200 text-gray-900 dark:bg-slate-700 dark:text-white",Wr="flex w-full cursor-pointer items-center gap-2 text-xs data-disabled:cursor-not-allowed data-disabled:opacity-40";function Hr({shortcut:e}){return e?/* @__PURE__ */Un("span",{className:"ml-auto pl-4 text-[10px] tracking-widest text-gray-400 dark:text-gray-500",children:e}):null}function qr({items:e,adapter:t}){/* @__PURE__ */
2
2
  return Un(In,{children:e.map(e=>{if("separator"===e.kind)/* @__PURE__ */return Un(Oe,{},e.id);if("group-label"===e.kind)/* @__PURE__ */return Un(Ae,{className:"px-2 py-1 text-[10px] font-semibold uppercase tracking-wide text-gray-400",children:e.label},e.id);if("menu"===e.kind){const n=e.icon;/* @__PURE__ */
3
3
  return jn(Ce,{children:[/* @__PURE__ */jn(Ee,{className:Wr,children:[/* @__PURE__ */Un(n,{className:"size-3.5 shrink-0 text-gray-500 dark:text-gray-400"}),e.label]}),/* @__PURE__ */Un(Re,{children:/* @__PURE__ */Un(Te,{className:"min-w-[200px]",children:/* @__PURE__ */Un(qr,{items:e.children,adapter:t})})})]},e.id)}const n=e.icon,i=t.isActive(e.id);/* @__PURE__ */
4
4
  return jn(ke,{"aria-pressed":i,className:r(Wr,i&&Br),"data-command":e.id,"data-state":i?"active":"inactive",disabled:!t.isEnabled(e.id),onSelect:()=>{t.execute(e.id)},children:[
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./rolldown-runtime-BeavJI0R.cjs");const e=require("./editorConfig-Nlnbb5zI.cjs"),o=require("./ReasonDocs-r0pgprAw.cjs"),r=require("./RichTextProvider-5tJ58Jd3.cjs"),t=require("./externalLibsMode-aLfijcGX.cjs");exports.NovelEditor=e.NovelEditor,exports.ReasonDocs=o.Index,exports.RichTextProvider=r.RichTextProvider,exports.externalLibsModeActions=t.externalLibsModeActions,exports.getExternalLibsMode=t.getExternalLibsMode,exports.useExternalLibsMode=t.useExternalLibsMode,exports.useNovelEditor=e.useNovelEditor;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./rolldown-runtime-BeavJI0R.cjs");const e=require("./editorConfig-Nlnbb5zI.cjs"),o=require("./ReasonDocs-COJDc7II.cjs"),r=require("./RichTextProvider-5tJ58Jd3.cjs"),t=require("./externalLibsMode-aLfijcGX.cjs");exports.NovelEditor=e.NovelEditor,exports.ReasonDocs=o.Index,exports.RichTextProvider=r.RichTextProvider,exports.externalLibsModeActions=t.externalLibsModeActions,exports.getExternalLibsMode=t.getExternalLibsMode,exports.useExternalLibsMode=t.useExternalLibsMode,exports.useNovelEditor=e.useNovelEditor;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{o,s}from"./editorConfig-CDQ1cqBk.js";import{t as r}from"./ReasonDocs-ttDK1H2U.js";import{t as a}from"./RichTextProvider-B9V-6yCh.js";import{n as t,r as e,t as i}from"./externalLibsMode-DEDBnK98.js";export{o as NovelEditor,r as ReasonDocs,a as RichTextProvider,i as externalLibsModeActions,t as getExternalLibsMode,e as useExternalLibsMode,s as useNovelEditor};
1
+ import{o,s}from"./editorConfig-CDQ1cqBk.js";import{t as r}from"./ReasonDocs-5KLjMhIP.js";import{t as a}from"./RichTextProvider-B9V-6yCh.js";import{n as t,r as e,t as i}from"./externalLibsMode-DEDBnK98.js";export{o as NovelEditor,r as ReasonDocs,a as RichTextProvider,i as externalLibsModeActions,t as getExternalLibsMode,e as useExternalLibsMode,s as useNovelEditor};
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./rolldown-runtime-BeavJI0R.cjs");const e=require("./ReasonDocs-r0pgprAw.cjs");exports.ReasonDocs=e.Index;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./rolldown-runtime-BeavJI0R.cjs");const e=require("./ReasonDocs-COJDc7II.cjs");exports.ReasonDocs=e.Index;
@@ -1 +1 @@
1
- import{t as o}from"./ReasonDocs-ttDK1H2U.js";export{o as ReasonDocs};
1
+ import{t as o}from"./ReasonDocs-5KLjMhIP.js";export{o as ReasonDocs};
@@ -456,7 +456,7 @@ return Ne(_Se,{...e,isHeader:!0})})],CSe=o("block h-auto w-full cursor-pointer t
456
456
  return Pe($w,{...e,className:"mb-1 p-0",children:[/* @__PURE__ */Ne("div",{children:n.length>0?n.map(e=>/* @__PURE__ */Ne(_,{variant:"ghost",className:CSe({depth:e.depth}),children:e.title},e.title)):/* @__PURE__ */Ne("div",{className:"text-gray-500 text-sm",children:"Create a heading to display the table of contents."})}),e.children]})})];var ASe=[UEe.withComponent(function(e){/* @__PURE__ */
457
457
  return Pe($w,{...e,className:"pl-6",children:[/* @__PURE__ */Ne("div",{className:"-left-0.5 absolute top-0 size-6 cursor-pointer select-none items-center justify-center rounded-md p-px text-muted-foreground transition-colors hover:bg-accent [&_svg]:size-4",contentEditable:!1,children:/* @__PURE__ */Ne(tt,{className:"rotate-0 transition-transform duration-75"})}),e.children]})})],zSe=[...rSe,...aSe,...vSe,...cSe,...mSe,...fSe,...tSe,...pSe,...hSe,...xSe,...bSe,...oSe,...uSe,...kSe,...ASe,...SSe,...wSe],FSe=o(a("group/editor","relative w-full cursor-text select-text overflow-x-hidden whitespace-break-spaces break-words","rounded-md ring-offset-background focus-visible:outline-none","placeholder:text-muted-foreground/80 **:data-slate-placeholder:top-[auto_!important] **:data-slate-placeholder:text-muted-foreground/80 **:data-slate-placeholder:opacity-100!","[&_strong]:font-bold"),{defaultVariants:{variant:"none"},variants:{disabled:{true:"cursor-not-allowed opacity-50"},focused:{true:"ring-2 ring-ring ring-offset-2"},variant:{ai:"w-full px-0 text-base md:text-sm",aiChat:"max-h-[min(70vh,320px)] w-full overflow-y-auto px-5 py-3 text-base md:text-sm",default:"size-full px-16 pt-4 pb-72 text-base sm:px-[max(64px,calc(50%-350px))]",demo:"size-full px-16 pt-4 pb-72 text-base sm:px-[max(64px,calc(50%-350px))]",fullWidth:"size-full px-16 pt-4 pb-72 text-base sm:px-24",none:"",select:"px-3 py-2 text-base data-readonly:w-fit"}}});function BSe({className:e,variant:t,...n}){/* @__PURE__ */
458
458
  return Ne(o_,{className:a(FSe({variant:t}),e),...n})}async function TSe(e){if(!e?.length)return"";const t=_w({plugins:zSe,value:e}),n=await c_(t,{editorComponent:BSe,stripClassNames:!0,stripDataAttributes:!0}),i=(e=>(new DOMParser).parseFromString(e,"text/html").querySelector('[data-slate-editor="true"]'))(n);return i?i.innerHTML:n}var OSe=o("relative w-full cursor-text select-text overflow-y-auto caret-primary selection:bg-brand/25 focus-visible:outline-none [&_.slate-selection-area]:z-50 [&_.slate-selection-area]:border [&_.slate-selection-area]:border-brand/25 [&_.slate-selection-area]:bg-brand/15",{defaultVariants:{variant:"default"},variants:{variant:{comment:a("flex flex-wrap justify-between gap-1 px-1 py-0.5 text-sm","rounded-md border-[1.5px] border-transparent bg-transparent","has-[[data-slate-editor]:focus]:border-brand/50 has-[[data-slate-editor]:focus]:ring-2 has-[[data-slate-editor]:focus]:ring-brand/30","has-aria-disabled:border-input has-aria-disabled:bg-muted"),default:"h-full",demo:"h-[650px]",select:a("group rounded-md border border-input ring-offset-background focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2","has-data-readonly:w-fit has-data-readonly:cursor-default has-data-readonly:border-transparent has-data-readonly:focus-within:[box-shadow:none]")}}});function NSe({className:e,variant:t,...n}){/* @__PURE__ */
459
- return Ne(mz,{className:a("ignore-click-outside/toolbar",OSe({variant:t}),e),...n})}var PSe=o(a("group/editor","relative w-full cursor-text select-text overflow-x-hidden whitespace-break-spaces break-words","rounded-md ring-offset-background focus-visible:outline-none","**:data-slate-placeholder:!top-1/2 **:data-slate-placeholder:-translate-y-1/2 placeholder:text-muted-foreground/80 **:data-slate-placeholder:text-muted-foreground/80 **:data-slate-placeholder:opacity-100!","[&_strong]:font-bold"),{defaultVariants:{variant:"default"},variants:{disabled:{true:"cursor-not-allowed opacity-50"},focused:{true:"ring-2 ring-ring ring-offset-2"},variant:{ai:"w-full px-0 text-base md:text-sm",aiChat:"max-h-[min(70vh,320px)] w-full overflow-y-auto px-3 py-2 text-base md:text-sm",comment:a("rounded-none border-none bg-transparent text-sm"),default:"size-full px-16 pt-4 pb-72 text-base sm:px-[max(64px,calc(50%-350px))]",demo:"size-full px-16 pt-4 pb-72 text-base sm:px-[max(64px,calc(50%-350px))]",fullWidth:"size-full px-16 pt-4 pb-72 text-base sm:px-24",none:"",select:"px-3 py-2 text-base data-readonly:w-fit"}}}),ISe=({className:e,disabled:t,focused:n,variant:i,ref:r,...o})=>/* @__PURE__ */Ne(vz,{ref:r,className:a(PSe({disabled:t,focused:n,variant:i}),e),disabled:t,disableDefaultStyles:!0,...o});function jSe({className:e,...t}){/* @__PURE__ */
459
+ return Ne(mz,{className:a("ignore-click-outside/toolbar",OSe({variant:t}),e),...n})}var PSe=o(a("group/editor","relative w-full cursor-text select-text overflow-x-hidden whitespace-break-spaces break-words","rounded-md ring-offset-background focus-visible:outline-none","**:data-slate-placeholder:!top-1/2 **:data-slate-placeholder:-translate-y-1/2 placeholder:text-muted-foreground/80 **:data-slate-placeholder:text-muted-foreground/80 **:data-slate-placeholder:opacity-100!","[&_strong]:font-bold"),{defaultVariants:{variant:"default"},variants:{disabled:{true:"cursor-not-allowed opacity-50"},focused:{true:"ring-2 ring-ring ring-offset-2"},variant:{ai:"w-full px-0 text-base md:text-sm",aiChat:"max-h-[min(70vh,320px)] w-full overflow-y-auto px-3 py-2 text-base md:text-sm",comment:a("rounded-none border-none bg-transparent text-sm"),default:"size-full px-8 pt-4 pb-72 text-base sm:px-[max(48px,calc(50%-350px))]",demo:"size-full px-16 pt-4 pb-72 text-base sm:px-[max(64px,calc(50%-350px))]",fullWidth:"size-full px-16 pt-4 pb-72 text-base sm:px-24",none:"",select:"px-3 py-2 text-base data-readonly:w-fit"}}}),ISe=({className:e,disabled:t,focused:n,variant:i,ref:r,...o})=>/* @__PURE__ */Ne(vz,{ref:r,className:a(PSe({disabled:t,focused:n,variant:i}),e),disabled:t,disableDefaultStyles:!0,...o});function jSe({className:e,...t}){/* @__PURE__ */
460
460
  return Ne(rN,{...t,className:a("scrollbar-hide sticky top-0 left-0 z-40 w-full justify-between overflow-x-auto border-b border-b-border bg-background/95 p-1 backdrop-blur-sm supports-backdrop-blur:bg-background/60",e)})}ISe.displayName="Editor";var RSe=[{icon:Re,value:"left"},{icon:Ie,value:"center"},{icon:Me,value:"right"},{icon:je,value:"justify"}];function MSe(e){const{editor:t,tf:n}=tz(PB),i=Sz({defaultValue:"start",getProp:e=>e.align})??"left",[r,a]=se.useState(!1),o=RSe.find(e=>e.value===i)?.icon??Re;/* @__PURE__ */
461
461
  return Pe(W,{open:r,onOpenChange:a,modal:!1,...e,children:[/* @__PURE__ */Ne(I,{asChild:!0,children:/* @__PURE__ */Ne(lN,{pressed:r,tooltip:"Align",isDropdown:!0,children:/* @__PURE__ */Ne(o,{})})}),/* @__PURE__ */Ne(H,{className:"min-w-0",align:"start",children:/* @__PURE__ */Ne(N,{value:i,onValueChange:e=>{n.textAlign.setNodes(e),t.tf.focus()},children:RSe.map(({icon:e,value:t})=>/* @__PURE__ */Ne(R,{className:"pl-2 data-[state=checked]:bg-accent *:first:[span]:hidden",value:t,children:/* @__PURE__ */Ne(e,{})},t))})})]})}function LSe(e){const t=ZA();/* @__PURE__ */
462
462
  return Ne(lN,{...e,onClick:()=>{a_e(t)},tooltip:"Mark as equation",children:/* @__PURE__ */Ne(rn,{})})}function qSe(e){const t=ZA(),[n,i]=se.useState(!1),r=se.useCallback(()=>t.getApi(rbe).markdown.serialize(),[t]);/* @__PURE__ */