@eigenpal/docx-js-editor 0.0.32 → 0.0.33
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 +10 -2
- package/dist/FindReplaceDialog-KNJETYJX.js +1 -0
- package/dist/{FindReplaceDialog-N4J5OB7O.mjs → FindReplaceDialog-YW3R4FHM.mjs} +1 -1
- package/dist/FootnotePropertiesDialog-7QX54WQT.js +1 -0
- package/dist/FootnotePropertiesDialog-LNFJXQUG.mjs +1 -0
- package/dist/HyperlinkDialog-GBAYMTUE.js +1 -0
- package/dist/{HyperlinkDialog-YQSQFHOP.mjs → HyperlinkDialog-HNYTXDCB.mjs} +1 -1
- package/dist/ImagePositionDialog-B4RLP2W5.mjs +1 -0
- package/dist/ImagePositionDialog-M65BYQQE.js +1 -0
- package/dist/ImagePropertiesDialog-JOGW3WDU.mjs +1 -0
- package/dist/ImagePropertiesDialog-O4WQSF5M.js +1 -0
- package/dist/PageSetupDialog-2GIBTKMJ.js +1 -0
- package/dist/PageSetupDialog-Q7SHEZIJ.mjs +1 -0
- package/dist/TablePropertiesDialog-LMXWX3FI.mjs +1 -0
- package/dist/TablePropertiesDialog-WOZ4ES3H.js +1 -0
- package/dist/chunk-377ZVTSE.js +2 -0
- package/dist/chunk-3OKYQQQ5.js +111 -0
- package/dist/chunk-AU5NVRHP.js +2 -0
- package/dist/chunk-DC65PJYE.js +4 -0
- package/dist/chunk-FW5LYOOZ.mjs +111 -0
- package/dist/chunk-GZOCOWWB.mjs +2 -0
- package/dist/chunk-N6RUBUT2.js +261 -0
- package/dist/chunk-QSUPYUOP.js +2 -0
- package/dist/chunk-SZHPMPSO.mjs +261 -0
- package/dist/chunk-X5A54T6S.mjs +4 -0
- package/dist/chunk-YKBSKEBS.mjs +2 -0
- package/dist/chunk-Z26WOH6R.mjs +2 -0
- package/dist/clipboard-Cu80iVDh.d.ts +1181 -0
- package/dist/clipboard-dFROLI95.d.mts +1181 -0
- package/dist/index.css +1 -1
- package/dist/index.d.mts +15 -5
- package/dist/index.d.ts +15 -5
- package/dist/index.js +9 -9
- package/dist/index.mjs +9 -9
- package/dist/{react-CAc4htNH.d.ts → react-1nBq3zH9.d.ts} +3 -1
- package/dist/{react-B2h6vE3D.d.mts → react-Dr8Nm-0u.d.mts} +3 -1
- package/dist/react.css +1 -1
- package/dist/react.d.mts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +1 -1
- package/dist/react.mjs +1 -1
- package/dist/ui.d.mts +22 -20
- package/dist/ui.d.ts +22 -20
- package/dist/ui.js +1 -1
- package/dist/ui.mjs +1 -1
- package/i18n/de.json +745 -0
- package/i18n/en.json +745 -0
- package/i18n/pl.json +745 -0
- package/package.json +5 -3
- package/dist/FindReplaceDialog-AQFR4OCT.js +0 -1
- package/dist/FootnotePropertiesDialog-UFUIHLDW.mjs +0 -1
- package/dist/FootnotePropertiesDialog-YYIZU5U6.js +0 -1
- package/dist/HyperlinkDialog-HGZ2S37Z.js +0 -1
- package/dist/ImagePositionDialog-DQ4JWS4F.js +0 -1
- package/dist/ImagePositionDialog-HT6J2SHV.mjs +0 -1
- package/dist/ImagePropertiesDialog-3VK2S2AF.mjs +0 -1
- package/dist/ImagePropertiesDialog-GJMGLM6G.js +0 -1
- package/dist/PageSetupDialog-2SKHDRTF.js +0 -1
- package/dist/PageSetupDialog-SMQJXEBL.mjs +0 -1
- package/dist/TablePropertiesDialog-FI5E3RCB.mjs +0 -1
- package/dist/TablePropertiesDialog-STZOGHJB.js +0 -1
- package/dist/chunk-6AJI5NPH.mjs +0 -111
- package/dist/chunk-AZRYS2WF.mjs +0 -2
- package/dist/chunk-CTYOM6BE.js +0 -2
- package/dist/chunk-EEV6TUOX.mjs +0 -261
- package/dist/chunk-EF3LLEN7.js +0 -4
- package/dist/chunk-HWWZOJMR.mjs +0 -4
- package/dist/chunk-PJVI53AH.js +0 -2
- package/dist/chunk-UMDJQ3Q4.js +0 -111
- package/dist/chunk-WH2EK2HU.js +0 -261
- package/dist/chunk-XWBCP563.mjs +0 -2
- package/dist/clipboard-B7N7Kx2X.d.ts +0 -386
- package/dist/clipboard-BkM7Zvgs.d.mts +0 -386
package/dist/chunk-XWBCP563.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {useState,useCallback,useRef,useEffect}from'react';import {jsx,jsxs,Fragment}from'react/jsx-runtime';function _(){return {matchCase:false,matchWholeWord:false,useRegex:false}}function H(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function X(e,n){if(!e)return null;try{let t;n.useRegex?t=e:t=H(e),n.matchWholeWord&&(t=`\\b${t}\\b`);let c=n.matchCase?"g":"gi";return new RegExp(t,c)}catch{return null}}function D(e,n,t){if(!e||!n)return [];let c=[],i=n;t.matchCase||(i=n.toLowerCase());let f=v=>v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),d;t.matchWholeWord?d=`\\b${f(i)}\\b`:d=f(i);let s=t.matchCase?"g":"gi",p=new RegExp(d,s),h;for(;(h=p.exec(e))!==null;)c.push({start:h.index,end:h.index+h[0].length}),h[0].length===0&&p.lastIndex++;return c}function me(e,n,t,c){let i=X(n,c);return i?e.replace(i,t):e}function be(e,n,t,c,i=0){let f=D(e,n,c),d=f.find(p=>p.start>=i)||f[0];return d?{content:e.substring(0,d.start)+t+e.substring(d.end),replaced:true,matchStart:d.start,matchEnd:d.start+t.length}:{content:e,replaced:false,matchStart:-1,matchEnd:-1}}function Se(e){return e?e.totalCount===0?"No results":e.totalCount===1?"1 match":`${e.currentIndex+1} of ${e.totalCount} matches`:""}function ye(e){return !e||e.trim()===""}function Ce(){return {currentMatchColor:"#FFFF00",otherMatchColor:"#FFFFAA"}}function k(e){if(!e||!e.content)return "";let n="";for(let t of e.content)t.type==="text"?n+=t.text||"":t.type==="tab"?n+=" ":t.type==="break"&&t.breakType==="textWrapping"&&(n+=`
|
|
2
|
-
`);return n}function Fe(e){if(!e||!e.content)return "";let n="";for(let t of e.content)if(t.type==="run")n+=k(t);else if(t.type==="hyperlink")for(let c of t.children||[])c.type==="run"&&(n+=k(c));return n}function Re(e,n,t){if(!e||!n)return [];let c=[],i=e.package?.document||e.package?.document;if(!i||!i.content)return c;let f=0;for(let d of i.content)if(d.type==="paragraph"){let s=q(d,n,t,f);c.push(...s),f++;}else if(d.type==="table")for(let s of d.rows||[])for(let p of s.cells||[])for(let h of p.content||[])h.type;return c}function q(e,n,t,c){let i=[],f=Fe(e);if(!f)return i;let d=D(f,n,t);for(let s of d){let p=Te(e,s.start);i.push({paragraphIndex:c,contentIndex:p.contentIndex,startOffset:p.offsetInContent,endOffset:p.offsetInContent+(s.end-s.start),text:f.substring(s.start,s.end)});}return i}function Te(e,n){if(!e||!e.content)return {contentIndex:0,runIndex:0,offsetInContent:n};let t=0,c=0;for(let i of e.content){let f="";if(i.type==="run")f=k(i);else if(i.type==="hyperlink")for(let s of i.children||[])s.type==="run"&&(f+=k(s));let d=f.length;if(t+d>n)return {contentIndex:c,runIndex:c,offsetInContent:n-t};t+=d,c++;}return {contentIndex:Math.max(0,e.content.length-1),runIndex:Math.max(0,e.content.length-1),offsetInContent:0}}function Ie(e,n){if(!e||!n)return;let t=e.querySelector(`[data-paragraph-index="${n.paragraphIndex}"]`);t&&t.scrollIntoView({behavior:"smooth",block:"center"});}function Ee(e){let[n,t]=useState({isOpen:false,searchText:"",replaceText:"",options:_(),matches:[],currentIndex:0,replaceMode:e?.initialReplaceMode??false}),c=useCallback(o=>{t(r=>({...r,isOpen:true,replaceMode:false,searchText:o||r.searchText,matches:[],currentIndex:0}));},[]),i=useCallback(o=>{t(r=>({...r,isOpen:true,replaceMode:true,searchText:o||r.searchText,matches:[],currentIndex:0}));},[]),f=useCallback(()=>{t(o=>({...o,isOpen:false}));},[]),d=useCallback(()=>{t(o=>({...o,isOpen:!o.isOpen}));},[]),s=useCallback(o=>{t(r=>({...r,searchText:o}));},[]),p=useCallback(o=>{t(r=>({...r,replaceText:o}));},[]),h=useCallback(o=>{t(r=>({...r,options:{...r.options,...o}}));},[]),v=useCallback((o,r=0)=>{let E=Math.max(0,Math.min(r,o.length-1));t(L=>({...L,matches:o,currentIndex:o.length>0?E:0})),e?.onMatchesChange?.(o),o.length>0?e?.onCurrentMatchChange?.(o[E],E):e?.onCurrentMatchChange?.(null,-1);},[e]),M=useCallback(()=>{let o=0;return t(r=>r.matches.length===0?r:(o=(r.currentIndex+1)%r.matches.length,{...r,currentIndex:o})),o},[]),N=useCallback(()=>{let o=0;return t(r=>r.matches.length===0?r:(o=r.currentIndex===0?r.matches.length-1:r.currentIndex-1,{...r,currentIndex:o})),o},[]),w=useCallback(o=>{t(r=>r.matches.length===0||o<0||o>=r.matches.length?r:{...r,currentIndex:o});},[]),x=useCallback(()=>n.matches.length===0?null:n.matches[n.currentIndex]||null,[n.matches,n.currentIndex]),O=useCallback(()=>n.matches.length>0,[n.matches.length]);return {state:n,openFind:c,openReplace:i,close:f,toggle:d,setSearchText:s,setReplaceText:p,setOptions:h,setMatches:v,goToNextMatch:M,goToPreviousMatch:N,goToMatch:w,getCurrentMatch:x,hasMatches:O}}var Me={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"transparent",display:"flex",alignItems:"flex-start",justifyContent:"flex-end",zIndex:1e4,pointerEvents:"none"},Oe={backgroundColor:"white",borderRadius:"4px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.2)",minWidth:"360px",maxWidth:"440px",width:"100%",margin:"60px 20px 20px 20px",pointerEvents:"auto"},Le={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"12px 16px",borderBottom:"1px solid var(--doc-border)",backgroundColor:"var(--doc-bg-subtle)",borderTopLeftRadius:"4px",borderTopRightRadius:"4px"},ke={margin:0,fontSize:"14px",fontWeight:600,color:"var(--doc-text)"},Ne={background:"none",border:"none",fontSize:"18px",cursor:"pointer",color:"var(--doc-text-muted)",padding:"2px 6px",lineHeight:1},we={padding:"16px"},Q={display:"flex",alignItems:"center",gap:"8px",marginBottom:"12px"},Z={width:"60px",fontSize:"13px",color:"var(--doc-text)",flexShrink:0},Y={flex:1,padding:"8px 10px",border:"1px solid var(--doc-border-input)",borderRadius:"3px",fontSize:"13px",boxSizing:"border-box",outline:"none"},ee={...Y,borderColor:"var(--doc-link)",boxShadow:"0 0 0 2px rgba(5, 99, 193, 0.1)"},Pe={display:"flex",flexDirection:"column",gap:"6px",marginLeft:"8px"},B={padding:"6px 12px",borderRadius:"3px",fontSize:"12px",fontWeight:500,cursor:"pointer",border:"1px solid var(--doc-border-input)",backgroundColor:"var(--doc-bg-input)",color:"var(--doc-text)",minWidth:"80px",textAlign:"center"},te={...B,backgroundColor:"var(--doc-bg-hover)",color:"var(--doc-text-placeholder)",cursor:"not-allowed"},U={padding:"6px 10px",borderRadius:"3px",fontSize:"14px",cursor:"pointer",border:"1px solid var(--doc-border-input)",backgroundColor:"var(--doc-bg-input)",color:"var(--doc-text)"},ne={...U,color:"var(--doc-border-input)",cursor:"not-allowed"},_e={display:"flex",gap:"16px",marginTop:"4px",marginLeft:"68px"},W={display:"flex",alignItems:"center",gap:"6px",fontSize:"12px",color:"var(--doc-text-muted)",cursor:"pointer"},oe={width:"14px",height:"14px",cursor:"pointer"},re={marginLeft:"68px",fontSize:"12px",color:"var(--doc-text-muted)",marginBottom:"8px"},De={...re,color:"var(--doc-error)"},Ae=({style:e})=>jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:e,children:jsx("polyline",{points:"18 15 12 9 6 15"})}),We=({style:e})=>jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:e,children:jsx("polyline",{points:"6 9 12 15 18 9"})});function Ye({isOpen:e,onClose:n,onFind:t,onFindNext:c,onFindPrevious:i,onReplace:f,onReplaceAll:d,onHighlightMatches:s,onClearHighlights:p,initialSearchText:h="",replaceMode:v=false,currentResult:M,className:N,style:w}){let[x,O]=useState(""),[o,r]=useState(""),[E,L]=useState(v),[C,ae]=useState(false),[F,ce]=useState(false),[l,R]=useState(null),[ie,K]=useState(false),[se,z]=useState(false),P=useRef(null),$=useRef(null);useEffect(()=>{M!==void 0&&R(M);},[M]),useEffect(()=>{if(e){if(O(h),r(""),L(v),R(null),setTimeout(()=>{P.current?.focus(),P.current?.select();},100),h){let a=t(h,{matchCase:C,matchWholeWord:F});R(a),a?.matches&&s&&s(a.matches);}}else p&&p();},[e,h,v]);let S=useCallback(()=>{if(!x.trim()){R(null),p&&p();return}let a=t(x,{matchCase:C,matchWholeWord:F});R(a),a?.matches&&s?s(a.matches):p&&p();},[x,C,F,t,s,p]);useEffect(()=>{e&&x.trim()&&S();},[C,F]);let le=useCallback(a=>{O(a.target.value);},[]),de=useCallback(a=>{a.key==="Enter"?(a.preventDefault(),a.shiftKey?V():l?G():S()):a.key==="Escape"&&n();},[l,S,n]),pe=useCallback(a=>{a.key==="Enter"?(a.preventDefault(),j()):a.key==="Escape"&&n();},[n]),G=useCallback(()=>{if(!x.trim()){S();return}if(!l){S();return}if(c()&&l){let y=(l.currentIndex+1)%l.totalCount;R({...l,currentIndex:y});}},[x,l,S,c]),V=useCallback(()=>{if(!x.trim()){S();return}if(!l){S();return}if(i()&&l){let y=l.currentIndex===0?l.totalCount-1:l.currentIndex-1;R({...l,currentIndex:y});}},[x,l,S,i]),j=useCallback(()=>{if(!l||l.totalCount===0)return;if(f(o)){let y=t(x,{matchCase:C,matchWholeWord:F});R(y),y?.matches&&s&&s(y.matches);}},[l,o,x,C,F,f,t,s]),ue=useCallback(()=>{if(!x.trim())return;d(x,o,{matchCase:C,matchWholeWord:F})>0&&(R({matches:[],totalCount:0,currentIndex:-1}),p&&p());},[x,o,C,F,d,p]),fe=useCallback(()=>{L(a=>{let y=!a;return y&&setTimeout(()=>$.current?.focus(),100),y});},[]),xe=useCallback(a=>{a.target,a.currentTarget;},[]),he=useCallback(a=>{a.key==="Escape"&&n();},[n]);if(!e)return null;let T=l&&l.totalCount>0,ge=l&&l.totalCount===0&&x.trim();return jsx("div",{className:`docx-find-replace-dialog-overlay ${N||""}`,style:{...Me,...w},onClick:xe,onKeyDown:he,children:jsxs("div",{className:"docx-find-replace-dialog","data-testid":"find-replace-dialog",style:Oe,role:"dialog","aria-modal":"false","aria-labelledby":"find-replace-dialog-title",children:[jsxs("div",{className:"docx-find-replace-dialog-header",style:Le,children:[jsx("h2",{id:"find-replace-dialog-title",style:ke,children:E?"Find and Replace":"Find"}),jsx("button",{type:"button",className:"docx-find-replace-dialog-close",style:Ne,onClick:n,"aria-label":"Close dialog",children:"\xD7"})]}),jsxs("div",{className:"docx-find-replace-dialog-body",style:we,children:[jsxs("div",{className:"docx-find-replace-dialog-row",style:Q,children:[jsx("label",{htmlFor:"find-text",style:Z,children:"Find:"}),jsx("input",{ref:P,id:"find-text",type:"text",className:"docx-find-replace-dialog-input",style:ie?ee:Y,value:x,onChange:le,onKeyDown:de,onFocus:()=>K(true),onBlur:()=>{K(false),x.trim()&&!l&&S();},placeholder:"Enter text to find...","aria-label":"Find text"}),jsxs("div",{style:{display:"flex",gap:"4px"},children:[jsx("button",{type:"button",className:"docx-find-replace-dialog-nav",style:T?U:ne,onClick:V,disabled:!T,"aria-label":"Find previous",title:"Find Previous (Shift+Enter)",children:jsx(Ae,{})}),jsx("button",{type:"button",className:"docx-find-replace-dialog-nav",style:T?U:ne,onClick:G,disabled:!T,"aria-label":"Find next",title:"Find Next (Enter)",children:jsx(We,{})})]})]}),T&&jsxs("div",{className:"docx-find-replace-dialog-status",style:re,children:[l.currentIndex+1," of ",l.totalCount," matches"]}),ge&&jsx("div",{className:"docx-find-replace-dialog-status",style:De,children:"No results found"}),E&&jsx(Fragment,{children:jsxs("div",{className:"docx-find-replace-dialog-row",style:Q,children:[jsx("label",{htmlFor:"replace-text",style:Z,children:"Replace:"}),jsx("input",{ref:$,id:"replace-text",type:"text",className:"docx-find-replace-dialog-input",style:se?ee:Y,value:o,onChange:a=>r(a.target.value),onKeyDown:pe,onFocus:()=>z(true),onBlur:()=>z(false),placeholder:"Enter replacement text...","aria-label":"Replace text"}),jsxs("div",{style:Pe,children:[jsx("button",{type:"button",className:"docx-find-replace-dialog-button",style:T?B:te,onClick:j,disabled:!T,title:"Replace current match",children:"Replace"}),jsx("button",{type:"button",className:"docx-find-replace-dialog-button",style:T?B:te,onClick:ue,disabled:!T,title:"Replace all matches",children:"Replace All"})]})]})}),jsxs("div",{className:"docx-find-replace-dialog-options",style:_e,children:[jsxs("label",{className:"docx-find-replace-dialog-option",style:W,children:[jsx("input",{type:"checkbox",style:oe,checked:C,onChange:a=>ae(a.target.checked)}),"Match case"]}),jsxs("label",{className:"docx-find-replace-dialog-option",style:W,children:[jsx("input",{type:"checkbox",style:oe,checked:F,onChange:a=>ce(a.target.checked)}),"Whole words"]}),!E&&jsx("button",{type:"button",style:{...W,background:"none",border:"none",cursor:"pointer",color:"var(--doc-link)",padding:0},onClick:fe,children:"+ Replace"})]})]})]})})}var je=Ye;export{_ as a,H as b,X as c,D as d,me as e,be as f,Se as g,ye as h,Ce as i,Re as j,q as k,Ie as l,Ee as m,Ye as n,je as o};
|
|
@@ -1,386 +0,0 @@
|
|
|
1
|
-
import React__default, { CSSProperties, ReactNode } from 'react';
|
|
2
|
-
import { e as Table, a0 as TableCell, b as Run, a as Paragraph } from './agentApi-BVHzyk2l.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Print Utilities
|
|
6
|
-
*
|
|
7
|
-
* Provides print functionality with:
|
|
8
|
-
* - Print button component for toolbar
|
|
9
|
-
* - Print-specific CSS styles
|
|
10
|
-
* - Browser print dialog trigger
|
|
11
|
-
* - Page range utilities
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Print options
|
|
16
|
-
*/
|
|
17
|
-
interface PrintOptions {
|
|
18
|
-
/** Whether to include headers */
|
|
19
|
-
includeHeaders?: boolean;
|
|
20
|
-
/** Whether to include footers */
|
|
21
|
-
includeFooters?: boolean;
|
|
22
|
-
/** Whether to include page numbers */
|
|
23
|
-
includePageNumbers?: boolean;
|
|
24
|
-
/** Page range to print (null = all) */
|
|
25
|
-
pageRange?: {
|
|
26
|
-
start: number;
|
|
27
|
-
end: number;
|
|
28
|
-
} | null;
|
|
29
|
-
/** Scale factor for printing (1.0 = 100%) */
|
|
30
|
-
scale?: number;
|
|
31
|
-
/** Whether to show background colors */
|
|
32
|
-
printBackground?: boolean;
|
|
33
|
-
/** Margins mode */
|
|
34
|
-
margins?: 'default' | 'none' | 'minimum';
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* PrintButton props
|
|
38
|
-
*/
|
|
39
|
-
interface PrintButtonProps {
|
|
40
|
-
/** Callback when print is triggered */
|
|
41
|
-
onPrint: () => void;
|
|
42
|
-
/** Whether the button is disabled */
|
|
43
|
-
disabled?: boolean;
|
|
44
|
-
/** Button label */
|
|
45
|
-
label?: string;
|
|
46
|
-
/** Additional CSS class */
|
|
47
|
-
className?: string;
|
|
48
|
-
/** Additional inline styles */
|
|
49
|
-
style?: CSSProperties;
|
|
50
|
-
/** Show icon */
|
|
51
|
-
showIcon?: boolean;
|
|
52
|
-
/** Compact mode */
|
|
53
|
-
compact?: boolean;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* PrintButton - Standalone print button for toolbar
|
|
57
|
-
*/
|
|
58
|
-
declare function PrintButton({ onPrint, disabled, label, className, style, showIcon, compact, }: PrintButtonProps): React__default.ReactElement;
|
|
59
|
-
/**
|
|
60
|
-
* PrintStyles - Injects print-specific CSS
|
|
61
|
-
*/
|
|
62
|
-
declare function PrintStyles(): React__default.ReactElement;
|
|
63
|
-
/**
|
|
64
|
-
* Trigger browser print dialog for the current document
|
|
65
|
-
*/
|
|
66
|
-
declare function triggerPrint(): void;
|
|
67
|
-
/**
|
|
68
|
-
* Create print-optimized document view in a new window
|
|
69
|
-
*/
|
|
70
|
-
declare function openPrintWindow(title: string | undefined, content: string): Window | null;
|
|
71
|
-
/**
|
|
72
|
-
* Get default print options
|
|
73
|
-
*/
|
|
74
|
-
declare function getDefaultPrintOptions(): PrintOptions;
|
|
75
|
-
/**
|
|
76
|
-
* Create page range from string (e.g., "1-5", "3", "1,3,5")
|
|
77
|
-
*/
|
|
78
|
-
declare function parsePageRange(input: string, maxPages: number): {
|
|
79
|
-
start: number;
|
|
80
|
-
end: number;
|
|
81
|
-
} | null;
|
|
82
|
-
/**
|
|
83
|
-
* Format page range for display
|
|
84
|
-
*/
|
|
85
|
-
declare function formatPageRange(range: {
|
|
86
|
-
start: number;
|
|
87
|
-
end: number;
|
|
88
|
-
} | null, totalPages: number): string;
|
|
89
|
-
/**
|
|
90
|
-
* Check if browser supports good print functionality
|
|
91
|
-
*/
|
|
92
|
-
declare function isPrintSupported(): boolean;
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* TableToolbar Component
|
|
96
|
-
*
|
|
97
|
-
* Provides controls for editing tables:
|
|
98
|
-
* - Add row above/below
|
|
99
|
-
* - Add column left/right
|
|
100
|
-
* - Delete row/column
|
|
101
|
-
* - Merge cells
|
|
102
|
-
* - Split cell
|
|
103
|
-
*
|
|
104
|
-
* Shows when cursor is in a table.
|
|
105
|
-
*/
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Table editing action types
|
|
109
|
-
*/
|
|
110
|
-
type TableAction = 'addRowAbove' | 'addRowBelow' | 'addColumnLeft' | 'addColumnRight' | 'deleteRow' | 'deleteColumn' | 'mergeCells' | 'splitCell' | 'deleteTable' | 'selectTable' | 'selectRow' | 'selectColumn' | 'borderAll' | 'borderOutside' | 'borderInside' | 'borderNone' | 'borderTop' | 'borderBottom' | 'borderLeft' | 'borderRight' | {
|
|
111
|
-
type: 'cellFillColor';
|
|
112
|
-
color: string | null;
|
|
113
|
-
} | {
|
|
114
|
-
type: 'borderColor';
|
|
115
|
-
color: string;
|
|
116
|
-
} | {
|
|
117
|
-
type: 'borderWidth';
|
|
118
|
-
size: number;
|
|
119
|
-
} | {
|
|
120
|
-
type: 'cellBorder';
|
|
121
|
-
side: 'top' | 'bottom' | 'left' | 'right' | 'all';
|
|
122
|
-
style: string;
|
|
123
|
-
size: number;
|
|
124
|
-
color: string;
|
|
125
|
-
} | {
|
|
126
|
-
type: 'cellVerticalAlign';
|
|
127
|
-
align: 'top' | 'center' | 'bottom';
|
|
128
|
-
} | {
|
|
129
|
-
type: 'cellMargins';
|
|
130
|
-
margins: {
|
|
131
|
-
top?: number;
|
|
132
|
-
bottom?: number;
|
|
133
|
-
left?: number;
|
|
134
|
-
right?: number;
|
|
135
|
-
};
|
|
136
|
-
} | {
|
|
137
|
-
type: 'cellTextDirection';
|
|
138
|
-
direction: string | null;
|
|
139
|
-
} | {
|
|
140
|
-
type: 'toggleNoWrap';
|
|
141
|
-
} | {
|
|
142
|
-
type: 'rowHeight';
|
|
143
|
-
height: number | null;
|
|
144
|
-
rule?: 'auto' | 'atLeast' | 'exact';
|
|
145
|
-
} | {
|
|
146
|
-
type: 'toggleHeaderRow';
|
|
147
|
-
} | {
|
|
148
|
-
type: 'distributeColumns';
|
|
149
|
-
} | {
|
|
150
|
-
type: 'autoFitContents';
|
|
151
|
-
} | {
|
|
152
|
-
type: 'tableProperties';
|
|
153
|
-
props: {
|
|
154
|
-
width?: number | null;
|
|
155
|
-
widthType?: string | null;
|
|
156
|
-
justification?: 'left' | 'center' | 'right' | null;
|
|
157
|
-
};
|
|
158
|
-
} | {
|
|
159
|
-
type: 'openTableProperties';
|
|
160
|
-
} | {
|
|
161
|
-
type: 'applyTableStyle';
|
|
162
|
-
styleId: string;
|
|
163
|
-
};
|
|
164
|
-
/**
|
|
165
|
-
* Selection within a table
|
|
166
|
-
*/
|
|
167
|
-
interface TableSelection {
|
|
168
|
-
/** Index of the table in the document */
|
|
169
|
-
tableIndex: number;
|
|
170
|
-
/** Row index (0-indexed) */
|
|
171
|
-
rowIndex: number;
|
|
172
|
-
/** Column index (0-indexed) */
|
|
173
|
-
columnIndex: number;
|
|
174
|
-
/** Selected cell range for multi-cell selection */
|
|
175
|
-
selectedCells?: {
|
|
176
|
-
startRow: number;
|
|
177
|
-
startCol: number;
|
|
178
|
-
endRow: number;
|
|
179
|
-
endCol: number;
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Context for table operations
|
|
184
|
-
*/
|
|
185
|
-
interface TableContext {
|
|
186
|
-
/** The table being edited */
|
|
187
|
-
table: Table;
|
|
188
|
-
/** Current selection within the table */
|
|
189
|
-
selection: TableSelection;
|
|
190
|
-
/** Whether multiple cells are selected (for merge) */
|
|
191
|
-
hasMultiCellSelection: boolean;
|
|
192
|
-
/** Whether current cell can be split */
|
|
193
|
-
canSplitCell: boolean;
|
|
194
|
-
/** Total number of rows */
|
|
195
|
-
rowCount: number;
|
|
196
|
-
/** Total number of columns */
|
|
197
|
-
columnCount: number;
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* Props for TableToolbar component
|
|
201
|
-
*/
|
|
202
|
-
interface TableToolbarProps {
|
|
203
|
-
/** Current table context (null if cursor not in table) */
|
|
204
|
-
context: TableContext | null;
|
|
205
|
-
/** Callback when a table action is triggered */
|
|
206
|
-
onAction?: (action: TableAction, context: TableContext) => void;
|
|
207
|
-
/** Whether the toolbar is disabled */
|
|
208
|
-
disabled?: boolean;
|
|
209
|
-
/** Additional CSS class name */
|
|
210
|
-
className?: string;
|
|
211
|
-
/** Additional inline styles */
|
|
212
|
-
style?: CSSProperties;
|
|
213
|
-
/** Show labels next to icons */
|
|
214
|
-
showLabels?: boolean;
|
|
215
|
-
/** Compact mode */
|
|
216
|
-
compact?: boolean;
|
|
217
|
-
/** Position of the toolbar */
|
|
218
|
-
position?: 'top' | 'floating';
|
|
219
|
-
/** Custom render for additional buttons */
|
|
220
|
-
children?: ReactNode;
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* TableToolbar - Shows table manipulation controls when cursor is in a table
|
|
224
|
-
*/
|
|
225
|
-
declare function TableToolbar({ context, onAction, disabled, className, style, showLabels, compact, position, children, }: TableToolbarProps): React__default.ReactElement | null;
|
|
226
|
-
/**
|
|
227
|
-
* Create a table context from a table and selection
|
|
228
|
-
*/
|
|
229
|
-
declare function createTableContext(table: Table, selection: TableSelection): TableContext;
|
|
230
|
-
/**
|
|
231
|
-
* Get column count from a table
|
|
232
|
-
*/
|
|
233
|
-
declare function getColumnCount(table: Table): number;
|
|
234
|
-
/**
|
|
235
|
-
* Get cell at specific row and column index
|
|
236
|
-
*/
|
|
237
|
-
declare function getCellAt(table: Table, rowIndex: number, columnIndex: number): TableCell | null;
|
|
238
|
-
/**
|
|
239
|
-
* Add a row to a table at the specified index
|
|
240
|
-
*/
|
|
241
|
-
declare function addRow(table: Table, atIndex: number, position?: 'before' | 'after'): Table;
|
|
242
|
-
/**
|
|
243
|
-
* Delete a row from a table
|
|
244
|
-
*/
|
|
245
|
-
declare function deleteRow(table: Table, rowIndex: number): Table;
|
|
246
|
-
/**
|
|
247
|
-
* Add a column to a table at the specified index
|
|
248
|
-
*/
|
|
249
|
-
declare function addColumn(table: Table, atIndex: number, position?: 'before' | 'after'): Table;
|
|
250
|
-
/**
|
|
251
|
-
* Delete a column from a table
|
|
252
|
-
*/
|
|
253
|
-
declare function deleteColumn(table: Table, columnIndex: number): Table;
|
|
254
|
-
/**
|
|
255
|
-
* Merge cells in a selection
|
|
256
|
-
*/
|
|
257
|
-
declare function mergeCells(table: Table, selection: TableSelection): Table;
|
|
258
|
-
/**
|
|
259
|
-
* Split a merged cell
|
|
260
|
-
*/
|
|
261
|
-
declare function splitCell(table: Table, rowIndex: number, columnIndex: number): Table;
|
|
262
|
-
|
|
263
|
-
/**
|
|
264
|
-
* Clipboard utilities for copy/paste with formatting
|
|
265
|
-
*
|
|
266
|
-
* Handles:
|
|
267
|
-
* - Copy: puts formatted HTML and plain text on clipboard
|
|
268
|
-
* - Paste: reads HTML clipboard, converts to runs with formatting
|
|
269
|
-
* - Handles paste from Word (cleans up Word HTML)
|
|
270
|
-
* - Ctrl+C, Ctrl+V, Ctrl+X keyboard shortcuts
|
|
271
|
-
*/
|
|
272
|
-
|
|
273
|
-
/**
|
|
274
|
-
* Clipboard content format
|
|
275
|
-
*/
|
|
276
|
-
interface ClipboardContent {
|
|
277
|
-
/** Plain text representation */
|
|
278
|
-
plainText: string;
|
|
279
|
-
/** HTML representation */
|
|
280
|
-
html: string;
|
|
281
|
-
/** Internal format (JSON) for preserving full formatting */
|
|
282
|
-
internal?: string;
|
|
283
|
-
}
|
|
284
|
-
/**
|
|
285
|
-
* Parsed clipboard content
|
|
286
|
-
*/
|
|
287
|
-
interface ParsedClipboardContent {
|
|
288
|
-
/** Runs parsed from clipboard */
|
|
289
|
-
runs: Run[];
|
|
290
|
-
/** Whether content came from Word */
|
|
291
|
-
fromWord: boolean;
|
|
292
|
-
/** Whether content came from our editor */
|
|
293
|
-
fromEditor: boolean;
|
|
294
|
-
/** Original plain text */
|
|
295
|
-
plainText: string;
|
|
296
|
-
}
|
|
297
|
-
/**
|
|
298
|
-
* Options for clipboard operations
|
|
299
|
-
*/
|
|
300
|
-
interface ClipboardOptions {
|
|
301
|
-
/** Whether to include formatting in copy */
|
|
302
|
-
includeFormatting?: boolean;
|
|
303
|
-
/** Whether to clean Word-specific formatting */
|
|
304
|
-
cleanWordFormatting?: boolean;
|
|
305
|
-
/** Callback for handling errors */
|
|
306
|
-
onError?: (error: Error) => void;
|
|
307
|
-
}
|
|
308
|
-
/**
|
|
309
|
-
* Custom MIME type for internal clipboard format
|
|
310
|
-
*/
|
|
311
|
-
declare const INTERNAL_CLIPBOARD_TYPE = "application/x-docx-editor";
|
|
312
|
-
/**
|
|
313
|
-
* Standard clipboard MIME types
|
|
314
|
-
*/
|
|
315
|
-
declare const CLIPBOARD_TYPES: {
|
|
316
|
-
readonly HTML: "text/html";
|
|
317
|
-
readonly PLAIN: "text/plain";
|
|
318
|
-
};
|
|
319
|
-
/**
|
|
320
|
-
* Copy runs to clipboard with formatting
|
|
321
|
-
*/
|
|
322
|
-
declare function copyRuns(runs: Run[], options?: ClipboardOptions): Promise<boolean>;
|
|
323
|
-
/**
|
|
324
|
-
* Copy paragraphs to clipboard with formatting
|
|
325
|
-
*/
|
|
326
|
-
declare function copyParagraphs(paragraphs: Paragraph[], options?: ClipboardOptions): Promise<boolean>;
|
|
327
|
-
/**
|
|
328
|
-
* Convert runs to clipboard content (HTML and plain text)
|
|
329
|
-
*/
|
|
330
|
-
declare function runsToClipboardContent(runs: Run[], includeFormatting?: boolean): ClipboardContent;
|
|
331
|
-
/**
|
|
332
|
-
* Convert paragraphs to clipboard content
|
|
333
|
-
*/
|
|
334
|
-
declare function paragraphsToClipboardContent(paragraphs: Paragraph[], includeFormatting?: boolean): ClipboardContent;
|
|
335
|
-
/**
|
|
336
|
-
* Write content to clipboard
|
|
337
|
-
*/
|
|
338
|
-
declare function writeToClipboard(content: ClipboardContent): Promise<boolean>;
|
|
339
|
-
/**
|
|
340
|
-
* Read content from clipboard
|
|
341
|
-
*/
|
|
342
|
-
declare function readFromClipboard(options?: ClipboardOptions): Promise<ParsedClipboardContent | null>;
|
|
343
|
-
/**
|
|
344
|
-
* Handle paste event
|
|
345
|
-
*/
|
|
346
|
-
declare function handlePasteEvent(event: ClipboardEvent, options?: ClipboardOptions): ParsedClipboardContent | null;
|
|
347
|
-
/**
|
|
348
|
-
* Parse HTML from clipboard
|
|
349
|
-
*/
|
|
350
|
-
declare function parseClipboardHtml(html: string, plainText: string, cleanWordFormatting?: boolean): ParsedClipboardContent;
|
|
351
|
-
/**
|
|
352
|
-
* Check if HTML is from Microsoft Word
|
|
353
|
-
*/
|
|
354
|
-
declare function isWordHtml(html: string): boolean;
|
|
355
|
-
/**
|
|
356
|
-
* Check if HTML is from our editor
|
|
357
|
-
*/
|
|
358
|
-
declare function isEditorHtml(html: string): boolean;
|
|
359
|
-
/**
|
|
360
|
-
* Clean Microsoft Word HTML
|
|
361
|
-
*/
|
|
362
|
-
declare function cleanWordHtml(html: string): string;
|
|
363
|
-
/**
|
|
364
|
-
* Convert HTML to runs
|
|
365
|
-
*/
|
|
366
|
-
declare function htmlToRuns(html: string, plainTextFallback: string): Run[];
|
|
367
|
-
/**
|
|
368
|
-
* Create clipboard keyboard handlers for an editor
|
|
369
|
-
*/
|
|
370
|
-
declare function createClipboardHandlers(options: {
|
|
371
|
-
onCopy?: () => {
|
|
372
|
-
runs: Run[];
|
|
373
|
-
} | null;
|
|
374
|
-
onCut?: () => {
|
|
375
|
-
runs: Run[];
|
|
376
|
-
} | null;
|
|
377
|
-
onPaste?: (content: ParsedClipboardContent) => void;
|
|
378
|
-
clipboardOptions?: ClipboardOptions;
|
|
379
|
-
}): {
|
|
380
|
-
handleCopy: (event: ClipboardEvent) => Promise<void>;
|
|
381
|
-
handleCut: (event: ClipboardEvent) => Promise<void>;
|
|
382
|
-
handlePaste: (event: ClipboardEvent) => void;
|
|
383
|
-
handleKeyDown: (event: KeyboardEvent) => Promise<void>;
|
|
384
|
-
};
|
|
385
|
-
|
|
386
|
-
export { isPrintSupported as A, isWordHtml as B, CLIPBOARD_TYPES as C, mergeCells as D, openPrintWindow as E, paragraphsToClipboardContent as F, parseClipboardHtml as G, parsePageRange as H, INTERNAL_CLIPBOARD_TYPE as I, readFromClipboard as J, runsToClipboardContent as K, splitCell as L, triggerPrint as M, writeToClipboard as N, type ParsedClipboardContent as P, type TableAction as T, type ClipboardContent as a, type ClipboardOptions as b, PrintButton as c, type PrintButtonProps as d, type PrintOptions as e, PrintStyles as f, type TableContext as g, type TableSelection as h, TableToolbar as i, type TableToolbarProps as j, addColumn as k, addRow as l, cleanWordHtml as m, copyParagraphs as n, copyRuns as o, createClipboardHandlers as p, createTableContext as q, deleteColumn as r, deleteRow as s, formatPageRange as t, getCellAt as u, getColumnCount as v, getDefaultPrintOptions as w, handlePasteEvent as x, htmlToRuns as y, isEditorHtml as z };
|