fika-editor 3.5.4 → 3.5.6
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/dist/embed/{4395.js → 7605.js} +7 -7
- package/dist/embed/agentic-manifest.json +2 -2
- package/dist/embed/chunks/9197.js +1 -0
- package/dist/embed/fika-embed.css +2 -2
- package/dist/embed/fika-embed.js +5 -5
- package/dist/types/components/MoveablePanel.d.ts +2 -1
- package/dist/types/components/Slider.d.ts +2 -0
- package/dist/types/configs/latex.d.ts +27 -0
- package/dist/types/hooks/useAddSlidesOrElements.d.ts +2 -1
- package/dist/types/hooks/useCopyAndPasteElement.d.ts +3 -3
- package/dist/types/hooks/useImageHandler.d.ts +1 -1
- package/dist/types/hooks/useLink.d.ts +1 -0
- package/dist/types/hooks/useSearch.d.ts +3 -0
- package/dist/types/hooks/useSlideHandler.d.ts +2 -2
- package/dist/types/i18n/i18n-types.d.ts +104 -0
- package/dist/types/store/slides.d.ts +9 -3
- package/dist/types/utils/clipboard.d.ts +2 -2
- package/dist/types/utils/elementOutline.d.ts +7 -1
- package/dist/types/utils/hotkeyTarget.d.ts +2 -0
- package/dist/types/utils/imageCrop.d.ts +8 -0
- package/dist/types/utils/liveElementSize.d.ts +2 -0
- package/dist/types/utils/nestedFrames.d.ts +1 -0
- package/dist/types/utils/pptxSourcePackage.d.ts +12 -1
- package/dist/types/utils/prosemirror/commitEditor.d.ts +5 -0
- package/dist/types/utils/prosemirror/index.d.ts +1 -1
- package/dist/types/utils/richTextFontSize.d.ts +1 -0
- package/dist/types/utils/searchText.d.ts +10 -0
- package/dist/types/utils/selection.d.ts +3 -0
- package/dist/types/utils/tableExport.d.ts +11 -0
- package/dist/types/utils/tableHiddenCells.d.ts +2 -0
- package/dist/types/utils/textContrast.d.ts +1 -0
- package/dist/types/utils/textFit.d.ts +7 -9
- package/dist/types/utils/textParser.d.ts +2 -0
- package/dist/types/views/Editor/Toolbar/common/useOutlineDrag.d.ts +8 -0
- package/dist/types/views/Myna/photoFrameUpload.d.ts +5 -0
- package/dist/types/views/components/element/ImageElement/ImageClipHandler.d.ts +2 -0
- package/dist/types/views/components/element/ProsemirrorEditor.d.ts +2 -0
- package/dist/types/views/components/element/TableElement/cellEdit.d.ts +8 -0
- package/dist/types/views/components/element/TableElement/useHideCells.d.ts +3 -2
- package/dist/types/views/components/element/hooks/useTextFit.d.ts +3 -4
- package/package.json +1 -1
- package/dist/embed/chunks/6144.js +0 -1
- /package/dist/embed/chunks/{6144.css → 9197.css} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CSSProperties, type ReactNode } from 'react';
|
|
1
|
+
import { type CSSProperties, type ReactNode, type KeyboardEventHandler } from 'react';
|
|
2
2
|
export type IMoveablePanelProps = {
|
|
3
3
|
width: number;
|
|
4
4
|
height: number;
|
|
@@ -14,6 +14,7 @@ export type IMoveablePanelProps = {
|
|
|
14
14
|
contentStyle?: CSSProperties;
|
|
15
15
|
className?: string;
|
|
16
16
|
onClose?: () => void;
|
|
17
|
+
onKeyDown?: KeyboardEventHandler<HTMLDivElement>;
|
|
17
18
|
children?: ReactNode;
|
|
18
19
|
};
|
|
19
20
|
declare const MoveablePanel: import("react").MemoExoticComponent<(vrProps: IMoveablePanelProps) => import("react").JSX.Element>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type FormulaKey = 'quadraticFormula' | 'differenceOfSquares' | 'perfectSquare' | 'trigPythagorean' | 'arithmeticSum' | 'geometricSum' | 'integrationByParts' | 'newtonSecondLaw' | 'kineticEnergy' | 'ohmLaw' | 'idealGas' | 'massEnergy' | 'gauss' | 'fourier' | 'taylor' | 'definiteIntegral' | 'trigIdentity1' | 'trigIdentity2' | 'binomialExpansion' | 'euler' | 'bernoulli' | 'totalDifferential' | 'nonHomogeneous' | 'cauchyMeanValue' | 'lagrangeMeanValue' | 'derivative' | 'trigIntegral' | 'quadricSurface' | 'secondOrderDifferential' | 'directionalDerivative';
|
|
2
|
+
export type SymbolCategoryKey = 'operators' | 'group' | 'verbatim' | 'greek';
|
|
3
|
+
/** Locale-free formula structure. Resolve labels via getFormulaList() or i18n. */
|
|
4
|
+
export declare const FORMULA_LIST: {
|
|
5
|
+
key: FormulaKey;
|
|
6
|
+
latex: string;
|
|
7
|
+
}[];
|
|
8
|
+
/** Locale-free symbol categories. Resolve labels via getSymbolList() or i18n. */
|
|
9
|
+
export declare const SYMBOL_LIST: {
|
|
10
|
+
type: SymbolCategoryKey;
|
|
11
|
+
children: {
|
|
12
|
+
latex: string;
|
|
13
|
+
}[];
|
|
14
|
+
}[];
|
|
15
|
+
/** Formula list with labels in the active locale. */
|
|
16
|
+
export declare function getFormulaList(): {
|
|
17
|
+
label: import("typesafe-i18n").LocalizedString;
|
|
18
|
+
latex: string;
|
|
19
|
+
}[];
|
|
20
|
+
/** Symbol categories with labels in the active locale. */
|
|
21
|
+
export declare function getSymbolList(): {
|
|
22
|
+
type: SymbolCategoryKey;
|
|
23
|
+
label: import("typesafe-i18n").LocalizedString;
|
|
24
|
+
children: {
|
|
25
|
+
latex: string;
|
|
26
|
+
}[];
|
|
27
|
+
}[];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { AddSlideOptions } from '../store/slides';
|
|
1
2
|
import type { PPTElement, Slide } from '../types/slides';
|
|
2
3
|
export default _default;
|
|
3
4
|
declare function _default(): {
|
|
4
5
|
addElementsFromData: (elements: PPTElement[]) => void;
|
|
5
|
-
addSlidesFromData: (slides: Slide[]) => void;
|
|
6
|
+
addSlidesFromData: (slides: Slide[], options?: AddSlideOptions) => void;
|
|
6
7
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export default _default;
|
|
2
2
|
declare function _default(): {
|
|
3
|
-
copyElement: () =>
|
|
4
|
-
cutElement: () => void
|
|
3
|
+
copyElement: () => Promise<boolean>;
|
|
4
|
+
cutElement: () => Promise<void>;
|
|
5
5
|
pasteElement: () => void;
|
|
6
|
-
quickCopyElement: () => void
|
|
6
|
+
quickCopyElement: () => Promise<void>;
|
|
7
7
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PPTElement, PPTElementLink } from '../types/slides';
|
|
2
|
+
export declare const canEditElementLink: (element: PPTElement) => boolean;
|
|
2
3
|
export default _default;
|
|
3
4
|
declare function _default(): {
|
|
4
5
|
setLink: (handleElement: PPTElement, link: PPTElementLink) => boolean;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
interface SearchTextResult {
|
|
2
2
|
elType: 'text' | 'shape';
|
|
3
|
+
offset: number;
|
|
3
4
|
slideId: string;
|
|
4
5
|
elId: string;
|
|
5
6
|
}
|
|
6
7
|
interface SearchTableResult {
|
|
7
8
|
elType: 'table';
|
|
9
|
+
offset: number;
|
|
8
10
|
slideId: string;
|
|
9
11
|
elId: string;
|
|
10
12
|
cellIndex: [number, number];
|
|
@@ -13,6 +15,7 @@ type SearchResult = SearchTextResult | SearchTableResult;
|
|
|
13
15
|
type Modifiers = 'g' | 'gi';
|
|
14
16
|
export default _default;
|
|
15
17
|
declare function _default(): {
|
|
18
|
+
canReplace: boolean;
|
|
16
19
|
searchWord: string;
|
|
17
20
|
setSearchWord: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
18
21
|
replaceWord: string;
|
|
@@ -3,13 +3,13 @@ export default _default;
|
|
|
3
3
|
declare function _default(): {
|
|
4
4
|
resetSlides: () => void;
|
|
5
5
|
updateSlideIndex: (command: string) => void;
|
|
6
|
-
copySlide: () =>
|
|
6
|
+
copySlide: () => Promise<boolean>;
|
|
7
7
|
pasteSlide: () => void;
|
|
8
8
|
createSlide: () => void;
|
|
9
9
|
createSlideByTemplate: (slide: Slide) => void;
|
|
10
10
|
copyAndPasteSlide: () => void;
|
|
11
11
|
deleteSlide: (targetSlidesId?: string[]) => void;
|
|
12
|
-
cutSlide: () => void
|
|
12
|
+
cutSlide: () => Promise<void>;
|
|
13
13
|
selectAllSlide: () => void;
|
|
14
14
|
sortSlides: (newIndex: number, oldIndex: number) => void;
|
|
15
15
|
isEmptySlide: boolean;
|
|
@@ -2713,7 +2713,59 @@ export type NamespaceConfigsTranslation = {
|
|
|
2713
2713
|
trapezoidReverse: string;
|
|
2714
2714
|
};
|
|
2715
2715
|
latex: {
|
|
2716
|
+
/**
|
|
2717
|
+
* Insert a formula preset
|
|
2718
|
+
*/
|
|
2719
|
+
presetLabel: string;
|
|
2716
2720
|
formulas: {
|
|
2721
|
+
/**
|
|
2722
|
+
* Quadratic formula (a ≠ 0)
|
|
2723
|
+
*/
|
|
2724
|
+
quadraticFormula: string;
|
|
2725
|
+
/**
|
|
2726
|
+
* Difference of squares
|
|
2727
|
+
*/
|
|
2728
|
+
differenceOfSquares: string;
|
|
2729
|
+
/**
|
|
2730
|
+
* Square of a sum
|
|
2731
|
+
*/
|
|
2732
|
+
perfectSquare: string;
|
|
2733
|
+
/**
|
|
2734
|
+
* Pythagorean trigonometric identity
|
|
2735
|
+
*/
|
|
2736
|
+
trigPythagorean: string;
|
|
2737
|
+
/**
|
|
2738
|
+
* Arithmetic series sum
|
|
2739
|
+
*/
|
|
2740
|
+
arithmeticSum: string;
|
|
2741
|
+
/**
|
|
2742
|
+
* Geometric series sum (q ≠ 1)
|
|
2743
|
+
*/
|
|
2744
|
+
geometricSum: string;
|
|
2745
|
+
/**
|
|
2746
|
+
* Integration by parts
|
|
2747
|
+
*/
|
|
2748
|
+
integrationByParts: string;
|
|
2749
|
+
/**
|
|
2750
|
+
* Newton’s second law
|
|
2751
|
+
*/
|
|
2752
|
+
newtonSecondLaw: string;
|
|
2753
|
+
/**
|
|
2754
|
+
* Kinetic energy
|
|
2755
|
+
*/
|
|
2756
|
+
kineticEnergy: string;
|
|
2757
|
+
/**
|
|
2758
|
+
* Ohm’s law
|
|
2759
|
+
*/
|
|
2760
|
+
ohmLaw: string;
|
|
2761
|
+
/**
|
|
2762
|
+
* Ideal gas law
|
|
2763
|
+
*/
|
|
2764
|
+
idealGas: string;
|
|
2765
|
+
/**
|
|
2766
|
+
* Mass–energy equivalence
|
|
2767
|
+
*/
|
|
2768
|
+
massEnergy: string;
|
|
2717
2769
|
/**
|
|
2718
2770
|
* Gauss theorem
|
|
2719
2771
|
*/
|
|
@@ -8739,7 +8791,59 @@ export type TranslationFunctions = {
|
|
|
8739
8791
|
trapezoidReverse: () => LocalizedString;
|
|
8740
8792
|
};
|
|
8741
8793
|
latex: {
|
|
8794
|
+
/**
|
|
8795
|
+
* Insert a formula preset
|
|
8796
|
+
*/
|
|
8797
|
+
presetLabel: () => LocalizedString;
|
|
8742
8798
|
formulas: {
|
|
8799
|
+
/**
|
|
8800
|
+
* Quadratic formula (a ≠ 0)
|
|
8801
|
+
*/
|
|
8802
|
+
quadraticFormula: () => LocalizedString;
|
|
8803
|
+
/**
|
|
8804
|
+
* Difference of squares
|
|
8805
|
+
*/
|
|
8806
|
+
differenceOfSquares: () => LocalizedString;
|
|
8807
|
+
/**
|
|
8808
|
+
* Square of a sum
|
|
8809
|
+
*/
|
|
8810
|
+
perfectSquare: () => LocalizedString;
|
|
8811
|
+
/**
|
|
8812
|
+
* Pythagorean trigonometric identity
|
|
8813
|
+
*/
|
|
8814
|
+
trigPythagorean: () => LocalizedString;
|
|
8815
|
+
/**
|
|
8816
|
+
* Arithmetic series sum
|
|
8817
|
+
*/
|
|
8818
|
+
arithmeticSum: () => LocalizedString;
|
|
8819
|
+
/**
|
|
8820
|
+
* Geometric series sum (q ≠ 1)
|
|
8821
|
+
*/
|
|
8822
|
+
geometricSum: () => LocalizedString;
|
|
8823
|
+
/**
|
|
8824
|
+
* Integration by parts
|
|
8825
|
+
*/
|
|
8826
|
+
integrationByParts: () => LocalizedString;
|
|
8827
|
+
/**
|
|
8828
|
+
* Newton’s second law
|
|
8829
|
+
*/
|
|
8830
|
+
newtonSecondLaw: () => LocalizedString;
|
|
8831
|
+
/**
|
|
8832
|
+
* Kinetic energy
|
|
8833
|
+
*/
|
|
8834
|
+
kineticEnergy: () => LocalizedString;
|
|
8835
|
+
/**
|
|
8836
|
+
* Ohm’s law
|
|
8837
|
+
*/
|
|
8838
|
+
ohmLaw: () => LocalizedString;
|
|
8839
|
+
/**
|
|
8840
|
+
* Ideal gas law
|
|
8841
|
+
*/
|
|
8842
|
+
idealGas: () => LocalizedString;
|
|
8843
|
+
/**
|
|
8844
|
+
* Mass–energy equivalence
|
|
8845
|
+
*/
|
|
8846
|
+
massEnergy: () => LocalizedString;
|
|
8743
8847
|
/**
|
|
8744
8848
|
* Gauss theorem
|
|
8745
8849
|
*/
|
|
@@ -64,7 +64,9 @@ export interface SlidesActions {
|
|
|
64
64
|
addElement: (element: PPTElement | PPTElement[]) => void;
|
|
65
65
|
deleteElement: (elementId: string | string[]) => void;
|
|
66
66
|
updateElement: (data: UpdateElementData) => void;
|
|
67
|
-
removeElementProps: (data: RemovePropData
|
|
67
|
+
removeElementProps: (data: RemovePropData & {
|
|
68
|
+
slideId?: string;
|
|
69
|
+
}) => void;
|
|
68
70
|
}
|
|
69
71
|
export type SlidesStore = SlidesState & SlidesActions;
|
|
70
72
|
export declare const selectCurrentSlide: (state: SlidesState) => Slide;
|
|
@@ -1826,7 +1828,9 @@ export declare const useSlidesStore: import("zustand").UseBoundStore<Omit<import
|
|
|
1826
1828
|
addElement: (element: PPTElement | PPTElement[]) => void;
|
|
1827
1829
|
deleteElement: (elementId: string | string[]) => void;
|
|
1828
1830
|
updateElement: (data: UpdateElementData) => void;
|
|
1829
|
-
removeElementProps: (data: RemovePropData
|
|
1831
|
+
removeElementProps: (data: RemovePropData & {
|
|
1832
|
+
slideId?: string;
|
|
1833
|
+
}) => void;
|
|
1830
1834
|
}) => void) | SlidesStore, shouldReplace?: false): void;
|
|
1831
1835
|
setState(nextStateOrUpdater: ((state: {
|
|
1832
1836
|
title: string;
|
|
@@ -3571,7 +3575,9 @@ export declare const useSlidesStore: import("zustand").UseBoundStore<Omit<import
|
|
|
3571
3575
|
addElement: (element: PPTElement | PPTElement[]) => void;
|
|
3572
3576
|
deleteElement: (elementId: string | string[]) => void;
|
|
3573
3577
|
updateElement: (data: UpdateElementData) => void;
|
|
3574
|
-
removeElementProps: (data: RemovePropData
|
|
3578
|
+
removeElementProps: (data: RemovePropData & {
|
|
3579
|
+
slideId?: string;
|
|
3580
|
+
}) => void;
|
|
3575
3581
|
}) => void) | SlidesStore, shouldReplace: true): void;
|
|
3576
3582
|
}>;
|
|
3577
3583
|
export {};
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Copy text to the clipboard.
|
|
3
3
|
* @param text Text to copy
|
|
4
4
|
*/
|
|
5
|
-
export declare const copyText: (text: string) => Promise<
|
|
5
|
+
export declare const copyText: (text: string) => Promise<void>;
|
|
6
6
|
export declare const readClipboard: () => Promise<string>;
|
|
7
7
|
export declare const pasteCustomClipboardString: (text: string) => any;
|
|
8
|
-
export declare const pasteExcelClipboardString: (text: string) => string[][] | null;
|
|
8
|
+
export declare const pasteExcelClipboardString: (text: string, allowSingleColumn?: boolean) => string[][] | null;
|
|
9
9
|
export declare const pasteHTMLTableClipboardString: (text: string) => string[][] | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type LineStyleType, type PPTElementOutline, type PPTShapeElement } from '../types/slides';
|
|
1
|
+
import { type LineStyleType, type PPTElement, type PPTElementOutline, type PPTShapeElement } from '../types/slides';
|
|
2
2
|
/** Clamp a resolved pixel corner radius to half the shorter box side. */
|
|
3
3
|
export declare const clampOutlineRadius: (radius: number, width: number, height: number) => number;
|
|
4
4
|
/** Pixel radius for paint/CSS. `radius` is 0–1 of max rounding, or legacy px when `> 1`. */
|
|
@@ -68,4 +68,10 @@ interface PptxOutlineSource {
|
|
|
68
68
|
export declare const importOutlineFromPptx: (el: PptxOutlineSource, ratio: number, options?: {
|
|
69
69
|
includeCornerRadius?: boolean;
|
|
70
70
|
}) => PPTElementOutline;
|
|
71
|
+
/** Capture only fields a border preview can change, including absent properties. */
|
|
72
|
+
export declare const captureOutlineRestore: (el: PPTElement) => {
|
|
73
|
+
id: string;
|
|
74
|
+
props: Partial<PPTElement>;
|
|
75
|
+
absent: string[];
|
|
76
|
+
};
|
|
71
77
|
export {};
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
/** True when canvas/element hotkeys must yield to a focused text field. */
|
|
2
2
|
export declare const isTypingTarget: (target: EventTarget | null) => boolean;
|
|
3
|
+
/** Controls own navigation and activation keys, even while the canvas retains selection. */
|
|
4
|
+
export declare const isInteractiveControlTarget: (target: EventTarget | null) => boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ImageClipDataRange, PPTImageElement } from '../types/slides';
|
|
2
|
+
/** Change the crop box while keeping the full bitmap fixed in slide coordinates. */
|
|
3
|
+
export declare const imageCropGeometry: (element: PPTImageElement, range: ImageClipDataRange) => {
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
left: number;
|
|
7
|
+
top: number;
|
|
8
|
+
};
|
|
@@ -40,6 +40,8 @@ export declare const autoHeightInsetSum: (el: {
|
|
|
40
40
|
inset?: readonly number[];
|
|
41
41
|
} | null;
|
|
42
42
|
}) => number | null;
|
|
43
|
+
/** Uniform table rows must remain tall enough for the content at live widths. */
|
|
44
|
+
export declare const measureLiveTableHeight: (id: string) => number | null;
|
|
43
45
|
/**
|
|
44
46
|
* Height the auto-height element's text actually needs at its CURRENT live
|
|
45
47
|
* width (call after the width has been painted). scrollHeight reports the
|
|
@@ -7,6 +7,7 @@ export declare const isFrame: (element: PPTElement) => element is PPTShapeElemen
|
|
|
7
7
|
export declare function frameAncestors(element: PPTElement, elements: readonly PPTElement[]): PPTShapeElement[];
|
|
8
8
|
export declare function frameDescendantIds(elements: readonly PPTElement[], ids: readonly string[]): string[];
|
|
9
9
|
export declare function frameCorners(element: PPTElement): FramePoint[];
|
|
10
|
+
export declare function intersectFramePolygons(subject: FramePoint[], clip: FramePoint[]): FramePoint[];
|
|
10
11
|
export declare function frameClipPolygon(element: PPTElement, elements: readonly PPTElement[]): FramePoint[] | null;
|
|
11
12
|
export declare function createFrameFromSelection(elements: readonly PPTElement[], ids: readonly string[], frameId: string, name: string): {
|
|
12
13
|
elements: PPTElement[];
|
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
* Enables future source-preserving writeback (Mona-style) without
|
|
4
4
|
* regenerating untouched OOXML parts.
|
|
5
5
|
*/
|
|
6
|
+
export interface SourcePackageDocument {
|
|
7
|
+
slides: readonly {
|
|
8
|
+
sourcePackageId?: string;
|
|
9
|
+
}[];
|
|
10
|
+
title: string;
|
|
11
|
+
theme: unknown;
|
|
12
|
+
viewportSize: number;
|
|
13
|
+
viewportRatio: number;
|
|
14
|
+
}
|
|
15
|
+
/** Certify only a fully applied import; retaining bytes alone is not sufficient. */
|
|
16
|
+
export declare function certifySourcePackageDocument(packageId: string, document: SourcePackageDocument): void;
|
|
6
17
|
export declare function retainSourcePackage(packageId: string, bytes: ArrayBuffer): void;
|
|
7
18
|
export declare function getSourcePackage(packageId: string): ArrayBuffer | undefined;
|
|
8
19
|
export declare function hasSourcePackage(packageId: string): boolean;
|
|
@@ -16,4 +27,4 @@ export declare function getActiveSourcePackageId(): string | null;
|
|
|
16
27
|
*/
|
|
17
28
|
export declare function tryGetCleanRetainedPackage(slides: Array<{
|
|
18
29
|
sourcePackageId?: string;
|
|
19
|
-
}>): ArrayBuffer | null;
|
|
30
|
+
}>, context?: Omit<SourcePackageDocument, 'slides'>): ArrayBuffer | null;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
import type { EditorView } from 'prosemirror-view';
|
|
1
2
|
import { editorHtmlLooksEmpty } from './commitPolicy';
|
|
2
3
|
export { editorHtmlLooksEmpty, shouldWriteEditorHtml } from './commitPolicy';
|
|
4
|
+
/** Exclude transient node-selection decorations from persisted rich text. */
|
|
5
|
+
export declare function cleanEditorHtml(dom: HTMLElement): string;
|
|
3
6
|
export declare const richTextHtmlLooksEmpty: typeof editorHtmlLooksEmpty;
|
|
4
7
|
export declare const storeHtmlForElement: (elementId: string) => string;
|
|
8
|
+
/** Remember which store content this view has actually synchronized. */
|
|
9
|
+
export declare function rememberEditorSource(view: EditorView, elementId: string): void;
|
|
5
10
|
/** Activity remounts must not rebuild an empty view over store-owned text. */
|
|
6
11
|
export declare const resolveEditorMountHtml: (elementId: string, value: string) => string;
|
|
7
12
|
/** Persist the live ProseMirror HTML. History is for explicit flushes, not every key. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type DirectEditorProps, EditorView } from 'prosemirror-view';
|
|
2
2
|
import { type PluginOptions } from './plugins/index';
|
|
3
|
-
export
|
|
3
|
+
export { normalizeFittedFontSizes } from '../richTextFontSize';
|
|
4
4
|
export declare const createDocument: (content: string) => import("prosemirror-model").Node;
|
|
5
5
|
/** Same HTML the live editor paints, so static → edit cannot shift glyphs. */
|
|
6
6
|
export declare const serializeRichTextHtml: (content: string) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const normalizeFittedFontSizes: (html: string) => string;
|
|
@@ -1 +1,4 @@
|
|
|
1
|
+
import type { PPTElement } from '../types/slides';
|
|
1
2
|
export declare const removeAllRanges: () => void;
|
|
3
|
+
/** Hidden or locked frames make their entire subtree unavailable for selection. */
|
|
4
|
+
export declare const isElementSelectable: (element: PPTElement, elements: readonly PPTElement[], hiddenIds: readonly string[]) => boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** PowerPoint cell alpha exposes the slide; themed tables paint over paper in the editor. */
|
|
2
|
+
export declare function tableCellExportFill(fill: {
|
|
3
|
+
color: string;
|
|
4
|
+
alpha: number;
|
|
5
|
+
}, themed: boolean): {
|
|
6
|
+
color: string;
|
|
7
|
+
transparency?: undefined;
|
|
8
|
+
} | {
|
|
9
|
+
color: string;
|
|
10
|
+
transparency: number;
|
|
11
|
+
};
|
|
@@ -145,6 +145,7 @@ export declare const resolveTextPaintSurfaces: (el: PPTTextElement | PPTShapeEle
|
|
|
145
145
|
export declare const resolveLiveTextPaint: (preferred: string | undefined, html: string, options?: LiveTextPaintOptions) => {
|
|
146
146
|
ink: string;
|
|
147
147
|
html: string;
|
|
148
|
+
defaultInk?: string;
|
|
148
149
|
};
|
|
149
150
|
/**
|
|
150
151
|
* Chart axis / legend / label ink. Same rules as text: default greys / black /
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
* callers wrap usage so a non-DOM context falls back gracefully.
|
|
12
12
|
*/
|
|
13
13
|
import { prepare as pretextPrepare } from '@chenglou/pretext';
|
|
14
|
+
import { type PreparedRichInline, type RichInlineLineRange } from '@chenglou/pretext/rich-inline';
|
|
15
|
+
import { normalizeFittedFontSizes } from './richTextFontSize';
|
|
14
16
|
/** ProseMirror's default text size (assets/styles/prosemirror.scss). */
|
|
15
17
|
export declare const DEFAULT_TEXT_FONT_SIZE = 16;
|
|
16
18
|
/**
|
|
@@ -163,6 +165,8 @@ export declare const MATH_PLACEHOLDER = "\uFFFC";
|
|
|
163
165
|
export declare const measureSpaceWidth: (font: string) => number;
|
|
164
166
|
export declare const breakSpacesWrapWidth: (width: number, spaceWidth: number) => number;
|
|
165
167
|
export declare const editorWrapWidth: (width: number, font: string) => number;
|
|
168
|
+
/** Match break-spaces without reserving a nonexistent space after the final line. */
|
|
169
|
+
export declare function walkEditorTextLines(prepared: PreparedRichInline, width: number, font: string, onLine: (line: RichInlineLineRange) => void): void;
|
|
166
170
|
export declare const richInlineFromRun: (run: TextFitRun, font: string, sizeScale: number, letterSpacing?: number) => {
|
|
167
171
|
text: string;
|
|
168
172
|
font: string;
|
|
@@ -222,9 +226,7 @@ export declare function createFitMeasureSession(html: string, options: {
|
|
|
222
226
|
/** Resize hot path: pure `layout()` over cached prepare handles. */
|
|
223
227
|
export declare function measureSessionHeight(session: FitMeasureSession, innerWidth: number, blockSpace?: number, bulletIndent?: number): number;
|
|
224
228
|
export declare function fitZoomScaleFromSession(session: FitMeasureSession, innerWidth: number, innerHeight: number, blockSpace?: number): number;
|
|
225
|
-
|
|
226
|
-
declare const stripFitScale: (html: string) => string;
|
|
227
|
-
export declare const stripFitScaleForProbe: typeof stripFitScale;
|
|
229
|
+
export declare const stripFitScaleForProbe: typeof normalizeFittedFontSizes;
|
|
228
230
|
type FitScaleOptions = {
|
|
229
231
|
innerWidth: number;
|
|
230
232
|
innerHeight: number;
|
|
@@ -237,12 +239,8 @@ type FitScaleOptions = {
|
|
|
237
239
|
/** Pre-extracted blocks (e.g. after MathLive refined math chip sizes). */
|
|
238
240
|
blocks?: TextFitBlock[];
|
|
239
241
|
};
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
* height and found the searched scale overflowing. Remembered so the rail,
|
|
243
|
-
* later applies, and export reuse the corrected value instead of re-overflow.
|
|
244
|
-
*/
|
|
245
|
-
export declare function rememberFitScale(html: string, options: FitScaleOptions, scale: number): void;
|
|
242
|
+
export declare function subscribeFitScaleChanges(listener: (elementId: string) => void): () => void;
|
|
243
|
+
export declare function rememberFitScale(html: string, options: FitScaleOptions, scale: number, elementId?: string): void;
|
|
246
244
|
/**
|
|
247
245
|
* One-shot locked-box scale for a rich-text HTML string. Editor resize keeps a
|
|
248
246
|
* cached session; preview/export call this so they shrink with the same math.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PPTElement } from '../../../../types/slides';
|
|
2
|
+
/** Roll back live border previews only while they still own the stored objects. */
|
|
3
|
+
export default function useOutlineDrag(): {
|
|
4
|
+
begin: (elements: PPTElement[], restoreUI?: () => void) => void;
|
|
5
|
+
track: () => void;
|
|
6
|
+
cancel: () => void;
|
|
7
|
+
finish: () => void;
|
|
8
|
+
};
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
export declare function cancelPhotoFrameReplacement(pageId: string, elementId: string): void;
|
|
2
|
+
export declare function beginPhotoFrameReplacement(pageId: string, elementId: string): {
|
|
3
|
+
isCurrent: () => boolean;
|
|
4
|
+
finish: () => void;
|
|
5
|
+
};
|
|
1
6
|
export declare function loadPhotoFrameImage(input: string | File): Promise<{
|
|
2
7
|
width: number;
|
|
3
8
|
height: number;
|
|
@@ -5,6 +5,7 @@ type HostFallthrough = Omit<HTMLAttributes<HTMLDivElement>, 'className' | 'onFoc
|
|
|
5
5
|
export type IProsemirrorEditorProps = {
|
|
6
6
|
elementId: string;
|
|
7
7
|
defaultColor: string;
|
|
8
|
+
paintDefaultInk?: string;
|
|
8
9
|
defaultFontName: string;
|
|
9
10
|
defaultFontSize?: string;
|
|
10
11
|
defaultAlign?: TextAlign;
|
|
@@ -35,6 +36,7 @@ export type ProsemirrorEditorHandle = {
|
|
|
35
36
|
declare const ProsemirrorEditor: import("react").ForwardRefExoticComponent<{
|
|
36
37
|
elementId: string;
|
|
37
38
|
defaultColor: string;
|
|
39
|
+
paintDefaultInk?: string;
|
|
38
40
|
defaultFontName: string;
|
|
39
41
|
defaultFontSize?: string;
|
|
40
42
|
defaultAlign?: TextAlign;
|
|
@@ -12,4 +12,12 @@ export declare const locateTableCell: (grid: TableCell[][], draft: Pick<TableCel
|
|
|
12
12
|
export declare const replaceTableCellText: (grid: TableCell[][], draft: TableCellDraft) => TableCell[][] | null;
|
|
13
13
|
export declare const growTable: (grid: TableCell[][], extraRows: number, extraCols: number, createCell: () => TableCell) => TableCell[][];
|
|
14
14
|
export declare const applyExcelPaste: (grid: TableCell[][], startRow: number, startCol: number, excel: string[][], createCell: () => TableCell) => TableCell[][];
|
|
15
|
+
export declare const insertRowIntoGrid: (grid: TableCell[][], rowIndex: number, createCell: () => TableCell) => TableCell[][];
|
|
15
16
|
export declare const insertColIntoGrid: (grid: TableCell[][], colIndex: number, createCell: () => TableCell) => TableCell[][];
|
|
17
|
+
export declare const deleteTableGridLine: (grid: TableCell[][], index: number, axis: 'row' | 'col') => TableCell[][];
|
|
18
|
+
export declare const tableSelectionBounds: (grid: TableCell[][], start: number[], end: number[]) => {
|
|
19
|
+
top: number;
|
|
20
|
+
left: number;
|
|
21
|
+
bottom: number;
|
|
22
|
+
right: number;
|
|
23
|
+
};
|
|
@@ -7,10 +7,9 @@ export default _default;
|
|
|
7
7
|
* Auto-fit a locked text box (fixed height or placeholder/title slot) so
|
|
8
8
|
* its content never overflows.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* / siblings do not re-render.
|
|
10
|
+
* Pretext supplies a cached estimate during resize. Settled geometry is
|
|
11
|
+
* refined against browser layout before paint, and the verified font scale
|
|
12
|
+
* is shared with the thumbnail painter. Authored font sizes stay unchanged.
|
|
14
13
|
*/
|
|
15
14
|
declare function _default(elementInfo: FitSource, liveContent?: LiveContentInput, hostEl?: {
|
|
16
15
|
readonly current: HTMLElement | null;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const __rspack_esm_id=6144;export const __rspack_esm_ids=[6144];export const __webpack_modules__={12115(e,t,l){l.d(t,{default:()=>m});var a=l(71178),i=l(2476),r=l(51649),s=l(70223),o=l(55104),n=l(58433),d=l(1449),c=l(98649);let u=(0,i.Q)({"latex-editor":"latex-editor-mnJArm",header:"header-XfWVan",title:"title-Ke9F2A",lede:"lede-hhKW7u","field-label":"field-label-GSgsEb",field:"field-tfm2EM",ready:"ready-AIjjie","field-skel":"field-skel-WHJApR","field-host":"field-host-VRmK45","field-hint":"field-hint-pJaAzp","kb-toggle":"kb-toggle-H7zJIx",active:"active-Uhi2eH","kb-icon":"kb-icon-Wc0ACj","tips-block":"tips-block-KmDH8o","tips-label":"tips-label-lVDrnK",tips:"tips-yjZQrc",tip:"tip-hpJ4LC",footer:"footer-EA_6l0",btn:"btn-yTLGMT",primary:"primary-RVhXDX"});function m(e){let{value:t="",onUpdate:l,onClose:i}=e,{LL:m}=(0,c.PO)(),h=!!t,p=h?m.components.latexEditor.editTitle():m.components.latexEditor.title(),f=(0,r.useRef)(null),b=(0,r.useRef)(null),x=(0,r.useRef)(null),y=(0,r.useRef)(""),[v,k]=(0,r.useState)(!1),[j,g]=(0,r.useState)(!t),[E,w]=(0,r.useState)(!!t),[_,C]=(0,r.useState)(!1),[N,M]=(0,r.useState)({left:"44px"}),A=()=>{let e=x.current;return e?((e.getValue?e.getValue("latex-without-placeholders"):e.value)||"").trim():""},L=(0,r.useCallback)(()=>{let e=x.current,t=f.current;if(!e||!t)return;let l=t.getBoundingClientRect(),a=e.shadowRoot,i=a?.querySelector(".ML__content"),r=a?.querySelector(".ML__caret, .ML__text-caret, .ML__latex-caret"),s=44;if(r){let e=parseFloat(getComputedStyle(r,"::after").borderRightWidth)||2,t=r.getBoundingClientRect();s=(t.height>0?t.left:i?.getBoundingClientRect().left??l.left+28)-l.left+e+14}else i&&(s=i.getBoundingClientRect().left-l.left+12);M({left:`${Math.max(36,Math.round(s))}px`})},[]),R=(0,r.useCallback)(()=>{C(!!window.mathVirtualKeyboard?.visible)},[]),V=(0,r.useCallback)(()=>{let e=!A();g(e),w(!e||!!y.current)},[]),K=(0,r.useCallback)(()=>{try{window.mathVirtualKeyboard?.hide({animate:!1})}catch{}document.body.style.removeProperty("padding-bottom"),C(!1)},[]),P=(0,r.useCallback)(()=>{K();let e=window.mathVirtualKeyboard;e&&e.removeEventListener("virtual-keyboard-toggle",R);let t=x.current;t&&(t.removeEventListener("input",V),t.removeEventListener("focus",L),t.parentElement&&t.parentElement.removeChild(t)),x.current=null},[K,R,V,L]);(0,r.useEffect)(()=>{let e=!1;return(async()=>{if(await (0,o.IM)(),(0,o.aX)(),await Promise.resolve(),e)return;let l=b.current;if(!l)return;P();let a=document.createElement("math-field");a.setAttribute("default-mode","math"),a.mathVirtualKeyboardPolicy="manual",t&&(a.value=t),a.addEventListener("input",V),a.addEventListener("focus",L),l.appendChild(a),x.current=a;let i=y.current;i&&(a.insert(i,{focus:!0,selectionMode:"placeholder"}),y.current=""),k(!0),V(),window.mathVirtualKeyboard?.addEventListener("virtual-keyboard-toggle",R),requestAnimationFrame(()=>{a.focus(),requestAnimationFrame(()=>L())})})(),()=>{e=!0,P()}},[P,V,L,R]),(0,r.useEffect)(()=>{j&&Promise.resolve().then(()=>L())},[j,L]);let S=e=>{let t=x.current;if(!t){y.current=e,g(!1),w(!0);return}t.focus(),t.insert(e,{focus:!0,selectionMode:"placeholder"}),y.current="",V()},q=async()=>{let e=A()||y.current;if(!e)return s.A.error(m.components.latexEditor.formulaEmpty());let t=160,a=64;try{let l=await Promise.race([(0,o.JX)(e),new Promise(e=>{setTimeout(()=>e({width:t,height:a}),280)})]);t=l.width,a=l.height}catch{}l?.({latex:e,path:"",w:t,h:a})};return(0,a.jsxs)("div",{className:u("latex-editor"),children:[(0,a.jsxs)("div",{className:u("header"),children:[(0,a.jsx)("div",{className:u("title"),children:p}),(0,a.jsx)("p",{className:u("lede"),children:m.components.latexEditor.description()})]}),(0,a.jsx)("label",{className:u("field-label"),children:m.components.latexEditor.fieldLabel()}),(0,a.jsxs)("div",{className:u("field",{ready:v}),ref:f,onClick:()=>void x.current?.focus(),children:[v?null:(0,a.jsx)(n.A,{className:u("field-skel")}),(0,a.jsx)("div",{className:u("field-host"),ref:b}),v&&j?(0,a.jsx)("div",{className:u("field-hint"),style:N,children:m.components.latexEditor.hint()}):null,v?(0,a.jsx)("button",{type:"button",className:u("kb-toggle",{active:_}),title:m.components.latexEditor.keyboardTooltip(),"aria-label":m.components.latexEditor.keyboardTooltip(),"aria-pressed":_,onClick:e=>{let t;e.stopPropagation(),x.current?.focus(),(0,o.aX)(),(t=window.mathVirtualKeyboard)&&(t.visible?(t.hide(),document.body.style.removeProperty("padding-bottom")):t.show(),R())},children:(0,a.jsxs)("svg",{className:u("kb-icon"),viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,a.jsx)("rect",{x:"2.75",y:"6.75",width:"18.5",height:"11.5",rx:"2.25"}),(0,a.jsx)("path",{d:"M6.25 10.25h1.5M10.25 10.25h1.5M14.25 10.25h1.5M17.25 10.25h1.5"}),(0,a.jsx)("path",{d:"M6.25 13h1.5M10.25 13h3.5M17.25 13h1.5"}),(0,a.jsx)("path",{d:"M8.5 15.75h7"})]})}):null]}),(0,a.jsxs)("div",{className:u("tips-block"),children:[(0,a.jsx)("div",{className:u("tips-label"),children:m.components.latexEditor.tipsLabel()}),(0,a.jsxs)("div",{className:u("tips"),children:[(0,a.jsxs)("button",{type:"button",className:u("tip"),"data-latex-tip":"frac",onClick:()=>S("\\frac{#?}{#?}"),children:[(0,a.jsx)("kbd",{children:"frac"})," ",m.components.latexEditor.tipFraction()]}),(0,a.jsxs)("button",{type:"button",className:u("tip"),"data-latex-tip":"power",onClick:()=>S("^{#?}"),children:[(0,a.jsx)("kbd",{children:"^"})," ",m.components.latexEditor.tipPower()]}),(0,a.jsxs)("button",{type:"button",className:u("tip"),"data-latex-tip":"sqrt",onClick:()=>S("\\sqrt{#?}"),children:[(0,a.jsx)("kbd",{children:"sqrt"})," ",m.components.latexEditor.tipRoot()]})]})]}),(0,a.jsxs)("div",{className:u("footer"),children:[(0,a.jsx)(d.A,{className:u("btn"),onClick:()=>i?.(),children:m.common.cancel()}),(0,a.jsx)(d.A,{className:u("btn"),type:"primary","data-editor-insert":"latex",disabled:!E,onClick:()=>{q()},children:h?m.common.save():m.components.latexEditor.insert()})]})]})}}};
|
|
File without changes
|