@eigenpal/docx-editor-core 1.3.0 → 1.3.2
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/chunk-2LEFMTNZ.mjs +1 -0
- package/dist/chunk-4MYKVWNF.js +1 -0
- package/dist/chunk-4PANZ3VU.js +1 -0
- package/dist/{chunk-Q5B5GKXD.mjs → chunk-55XWETY4.mjs} +1 -1
- package/dist/chunk-6WZW3NSJ.js +1 -0
- package/dist/chunk-HKN2NKOG.mjs +1 -0
- package/dist/chunk-HPJBZL37.mjs +1 -0
- package/dist/{chunk-TURYWKNS.js → chunk-J3YFJDZD.js} +1 -1
- package/dist/chunk-JHTURDPX.mjs +1 -0
- package/dist/chunk-KKXCBWVG.mjs +1 -0
- package/dist/chunk-LJE7HQEJ.mjs +1 -0
- package/dist/chunk-LX35TFGF.mjs +1 -0
- package/dist/chunk-NRWQ65NX.js +1 -0
- package/dist/chunk-PFMM7QON.js +1 -0
- package/dist/chunk-PMSGJXOE.mjs +1 -0
- package/dist/chunk-QVRNNRG5.js +1 -0
- package/dist/chunk-RSU4HTC6.js +1 -0
- package/dist/{chunk-L6YTCHOQ.mjs → chunk-UEPLDKKM.mjs} +1 -1
- package/dist/chunk-YPQACU4A.js +1 -0
- package/dist/{chunk-TJRROR6U.js → chunk-ZAZWHK4J.js} +1 -1
- package/dist/core.d.mts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/editor/index.d.mts +128 -0
- package/dist/editor/index.d.ts +128 -0
- package/dist/editor/index.js +1 -0
- package/dist/editor/index.mjs +1 -0
- package/dist/{footnotes-BtVc6VFl.d.mts → footnotes-BZ24OTAT.d.mts} +11 -1
- package/dist/{footnotes-DcUMWXul.d.ts → footnotes-DMsicPGd.d.ts} +11 -1
- package/dist/{headerFooterLayout-4E-S4Aay.d.ts → headerFooterLayout-AtAOhM8E.d.ts} +18 -2
- package/dist/{headerFooterLayout-DlJLWmpR.d.mts → headerFooterLayout-CU6hvszp.d.mts} +18 -2
- package/dist/layout-bridge/clickToPositionDom.js +1 -1
- package/dist/layout-bridge/clickToPositionDom.mjs +1 -1
- package/dist/layout-bridge/index.d.mts +109 -5
- package/dist/layout-bridge/index.d.ts +109 -5
- package/dist/layout-bridge/index.js +1 -1
- package/dist/layout-bridge/index.mjs +1 -1
- package/dist/layout-bridge/measuring/index.d.mts +5 -95
- package/dist/layout-bridge/measuring/index.d.ts +5 -95
- package/dist/layout-bridge/measuring/index.js +1 -1
- package/dist/layout-bridge/measuring/index.mjs +1 -1
- package/dist/layout-bridge/tableInsertHover.js +1 -1
- package/dist/layout-bridge/tableInsertHover.mjs +1 -1
- package/dist/layout-bridge/toFlowBlocks.js +1 -1
- package/dist/layout-bridge/toFlowBlocks.mjs +1 -1
- package/dist/layout-engine/index.js +1 -1
- package/dist/layout-engine/index.mjs +1 -1
- package/dist/layout-painter/index.d.mts +2 -2
- package/dist/layout-painter/index.d.ts +2 -2
- package/dist/layout-painter/index.js +1 -1
- package/dist/layout-painter/index.mjs +1 -1
- package/dist/layout-painter/renderPage.d.mts +8 -3
- package/dist/layout-painter/renderPage.d.ts +8 -3
- package/dist/layout-painter/renderPage.js +1 -1
- package/dist/layout-painter/renderPage.mjs +1 -1
- package/dist/measureBlocksPipeline-BMqbRFQB.d.mts +96 -0
- package/dist/measureBlocksPipeline-iYNzAH-o.d.ts +96 -0
- package/dist/prosemirror/applyFormatting.d.mts +67 -0
- package/dist/prosemirror/applyFormatting.d.ts +67 -0
- package/dist/prosemirror/applyFormatting.js +1 -0
- package/dist/prosemirror/applyFormatting.mjs +1 -0
- package/dist/prosemirror/commentIdAllocator.d.mts +50 -0
- package/dist/prosemirror/commentIdAllocator.d.ts +50 -0
- package/dist/prosemirror/commentIdAllocator.js +1 -0
- package/dist/prosemirror/commentIdAllocator.mjs +1 -0
- package/dist/prosemirror/commentOps.d.mts +46 -0
- package/dist/prosemirror/commentOps.d.ts +46 -0
- package/dist/prosemirror/commentOps.js +1 -0
- package/dist/prosemirror/commentOps.mjs +1 -0
- package/dist/prosemirror/conversion/index.js +1 -1
- package/dist/prosemirror/conversion/index.mjs +1 -1
- package/dist/prosemirror/imageCommit.d.mts +35 -0
- package/dist/prosemirror/imageCommit.d.ts +35 -0
- package/dist/prosemirror/imageCommit.js +1 -0
- package/dist/prosemirror/imageCommit.mjs +1 -0
- package/dist/prosemirror/index.js +2 -2
- package/dist/prosemirror/index.mjs +1 -1
- package/dist/prosemirror/paraText.d.mts +52 -0
- package/dist/prosemirror/paraText.d.ts +52 -0
- package/dist/prosemirror/paraText.js +1 -0
- package/dist/prosemirror/paraText.mjs +1 -0
- package/dist/prosemirror/queries.d.mts +65 -0
- package/dist/prosemirror/queries.d.ts +65 -0
- package/dist/prosemirror/queries.js +2 -0
- package/dist/prosemirror/queries.mjs +2 -0
- package/dist/prosemirror/tableResize.d.mts +58 -0
- package/dist/prosemirror/tableResize.d.ts +58 -0
- package/dist/prosemirror/tableResize.js +1 -0
- package/dist/prosemirror/tableResize.mjs +1 -0
- package/dist/utils/autoScroll.d.mts +24 -0
- package/dist/utils/autoScroll.d.ts +24 -0
- package/dist/utils/autoScroll.js +1 -0
- package/dist/utils/autoScroll.mjs +1 -0
- package/package.json +73 -1
- package/dist/chunk-72KLR6TJ.mjs +0 -1
- package/dist/chunk-7JQVKJRN.mjs +0 -1
- package/dist/chunk-7WGN2OBZ.js +0 -1
- package/dist/chunk-B46V5G46.mjs +0 -1
- package/dist/chunk-BUCOTKYY.js +0 -1
- package/dist/chunk-FQS436KN.js +0 -1
- package/dist/chunk-IUVQJ6PX.mjs +0 -1
- package/dist/chunk-JUMHC5Z6.mjs +0 -1
- package/dist/chunk-MEVZCB56.mjs +0 -1
- package/dist/chunk-T4RYVPAB.js +0 -1
- package/dist/chunk-WDBZ3QVB.js +0 -1
- package/dist/chunk-XWC67YLW.js +0 -1
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { WrapTextDirection, FlowBlock, Measure } from './layout-engine/types.js';
|
|
2
|
+
import { P as PageGeometry } from './anchoredObjectPosition-CS-8BfhO.js';
|
|
3
|
+
|
|
4
|
+
interface FloatingExclusionRect {
|
|
5
|
+
/** Which side the object is on for simple one-sided wrapping. */
|
|
6
|
+
side: 'left' | 'right';
|
|
7
|
+
/** X position relative to the content area. */
|
|
8
|
+
x: number;
|
|
9
|
+
/** Y position relative to the content area. */
|
|
10
|
+
y: number;
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
distTop: number;
|
|
14
|
+
distBottom: number;
|
|
15
|
+
distLeft: number;
|
|
16
|
+
distRight: number;
|
|
17
|
+
wrapText?: WrapTextDirection;
|
|
18
|
+
wrapType?: string;
|
|
19
|
+
}
|
|
20
|
+
interface FloatingImageZone {
|
|
21
|
+
leftMargin: number;
|
|
22
|
+
rightMargin: number;
|
|
23
|
+
topY: number;
|
|
24
|
+
bottomY: number;
|
|
25
|
+
segments?: FloatingLineSegmentZone[];
|
|
26
|
+
/**
|
|
27
|
+
* Full-width vertical band (OOXML `topAndBottom` wrap): no text fits beside
|
|
28
|
+
* it, so any line overlapping `[topY, bottomY]` is pushed below the band.
|
|
29
|
+
*/
|
|
30
|
+
fullWidthBlock?: boolean;
|
|
31
|
+
}
|
|
32
|
+
interface FloatingLineSegmentZone {
|
|
33
|
+
leftOffset: number;
|
|
34
|
+
availableWidth: number;
|
|
35
|
+
}
|
|
36
|
+
interface FloatingLineMargins {
|
|
37
|
+
leftMargin: number;
|
|
38
|
+
rightMargin: number;
|
|
39
|
+
segments?: FloatingLineSegmentZone[];
|
|
40
|
+
}
|
|
41
|
+
declare function rectsToFloatingZones(rects: FloatingExclusionRect[], contentWidth: number): FloatingImageZone[];
|
|
42
|
+
declare function getFloatingMargins(lineY: number, lineHeight: number, zones: FloatingImageZone[] | undefined, paragraphYOffset: number): FloatingLineMargins;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Floating-aware block measurement pipeline.
|
|
46
|
+
*
|
|
47
|
+
* Pre-scans a block list to extract exclusion zones from anchored images,
|
|
48
|
+
* floating tables, and floating text boxes; groups co-located floats so
|
|
49
|
+
* their combined exclusion applies starting from the earliest anchor; then
|
|
50
|
+
* walks the blocks calling the caller-supplied `measureBlock` with the
|
|
51
|
+
* active zones and cumulative Y at each step.
|
|
52
|
+
*
|
|
53
|
+
* Adapters (React, Vue) provide their own `measureBlock` so they can
|
|
54
|
+
* decide e.g. whether to cache paragraph measures. The orchestration,
|
|
55
|
+
* extraction, and grouping live here so both adapters stay in lockstep.
|
|
56
|
+
*
|
|
57
|
+
* @packageDocumentation
|
|
58
|
+
* @public
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Block-measurement callback shape passed to {@link measureBlocksWithFloats}.
|
|
63
|
+
* Adapters (React, Vue) supply this so they can decide platform-specific
|
|
64
|
+
* concerns (e.g. paragraph-measure caching, per-section width) while
|
|
65
|
+
* sharing the floating-zone orchestration. This is adapter-author API,
|
|
66
|
+
* not end-consumer API.
|
|
67
|
+
*
|
|
68
|
+
* @public
|
|
69
|
+
*/
|
|
70
|
+
type MeasureBlockFn = (block: FlowBlock, contentWidth: number, floatingZones?: FloatingImageZone[], cumulativeY?: number) => Measure;
|
|
71
|
+
/**
|
|
72
|
+
* Page geometry (CSS px) used to resolve page/margin-relative anchored objects
|
|
73
|
+
* into content-area coordinates — currently the vertical anchor of a top-pinned
|
|
74
|
+
* `topAndBottom` band. Same shape the painter uses (see `pageGeometryFromPage`),
|
|
75
|
+
* so both paths resolve to identical positions.
|
|
76
|
+
*
|
|
77
|
+
* @public
|
|
78
|
+
*/
|
|
79
|
+
type FloatPageGeometry = PageGeometry;
|
|
80
|
+
/**
|
|
81
|
+
* Walk `blocks` and produce one `Measure` per block. Before measuring, this
|
|
82
|
+
* extracts floating exclusion zones (images / floating tables / floating
|
|
83
|
+
* textboxes), groups overlapping co-located floats, and threads the active
|
|
84
|
+
* zones plus cumulative Y into each `measureBlock` call.
|
|
85
|
+
*
|
|
86
|
+
* Pass `pageGeometry` whenever the document may contain page/margin-anchored
|
|
87
|
+
* `topAndBottom` text boxes (e.g. a title banner pinned to the page top):
|
|
88
|
+
* without it their reserved band falls back to flow-relative Y and the band
|
|
89
|
+
* won't line up with where the painter places the box. Build it with the
|
|
90
|
+
* shared `pageGeometryFromPage` helper.
|
|
91
|
+
*
|
|
92
|
+
* @public
|
|
93
|
+
*/
|
|
94
|
+
declare function measureBlocksWithFloats(blocks: FlowBlock[], contentWidth: number | number[], measureBlock: MeasureBlockFn, pageGeometry?: FloatPageGeometry): Measure[];
|
|
95
|
+
|
|
96
|
+
export { type FloatPageGeometry as F, type MeasureBlockFn as M, type FloatingExclusionRect as a, type FloatingImageZone as b, type FloatingLineSegmentZone as c, getFloatingMargins as g, measureBlocksWithFloats as m, rectsToFloatingZones as r };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { EditorView } from 'prosemirror-view';
|
|
2
|
+
import { StyleResolver } from './styles/index.mjs';
|
|
3
|
+
import '../formatting-BH4hcZiq.mjs';
|
|
4
|
+
import '../colors-C3vA7HUU.mjs';
|
|
5
|
+
import '../styles-BOJ93SAm.mjs';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Agent-facing formatting operations shared by the React and Vue adapters.
|
|
9
|
+
*
|
|
10
|
+
* `applyFormatting` maps a mark-toggle request (bold/italic/underline/strike/
|
|
11
|
+
* color/highlight/fontSize/fontFamily) onto a PM transaction over a paragraph
|
|
12
|
+
* range located by `paraId` (+ optional `search`). `setParagraphStyle` applies
|
|
13
|
+
* a named paragraph style to that range.
|
|
14
|
+
*
|
|
15
|
+
* Both take the `EditorView` as a parameter. `setParagraphStyle` takes the
|
|
16
|
+
* style resolver as an injected dependency so each adapter keeps its own
|
|
17
|
+
* resolver-sourcing strategy (React caches per styles object; Vue rebuilds).
|
|
18
|
+
*
|
|
19
|
+
* Previously duplicated byte-for-byte at
|
|
20
|
+
* `packages/react/.../useDocxEditorRefApi.ts` and
|
|
21
|
+
* `packages/vue/.../useFormattingActions.ts`.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
interface ApplyFormattingOptions {
|
|
25
|
+
paraId: string;
|
|
26
|
+
search?: string;
|
|
27
|
+
marks: {
|
|
28
|
+
bold?: boolean;
|
|
29
|
+
italic?: boolean;
|
|
30
|
+
underline?: boolean | {
|
|
31
|
+
style?: string;
|
|
32
|
+
};
|
|
33
|
+
strike?: boolean;
|
|
34
|
+
color?: {
|
|
35
|
+
rgb?: string;
|
|
36
|
+
themeColor?: string;
|
|
37
|
+
};
|
|
38
|
+
highlight?: string;
|
|
39
|
+
fontSize?: number;
|
|
40
|
+
fontFamily?: {
|
|
41
|
+
ascii?: string;
|
|
42
|
+
hAnsi?: string;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Apply mark toggles to a paragraph range. Returns false when the paraId /
|
|
48
|
+
* search can't be resolved; true (a no-op) when the resolved range is empty.
|
|
49
|
+
*/
|
|
50
|
+
declare function applyFormatting(view: EditorView, options: ApplyFormattingOptions): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Apply a named paragraph style to the paragraph identified by `paraId`.
|
|
53
|
+
*
|
|
54
|
+
* The style resolver is injected: when present, unknown styleIds are rejected
|
|
55
|
+
* (the agent gets a clear error instead of a silently-broken `<w:pStyle>`), and
|
|
56
|
+
* the resolved paragraph/run formatting is threaded into `applyStyle`. Without
|
|
57
|
+
* a resolver (no styles loaded) the styleId is applied as-is. Returns false
|
|
58
|
+
* when the paraId can't be resolved or the styleId is unknown.
|
|
59
|
+
*/
|
|
60
|
+
declare function setParagraphStyle(view: EditorView, options: {
|
|
61
|
+
paraId: string;
|
|
62
|
+
styleId: string;
|
|
63
|
+
}, deps: {
|
|
64
|
+
styleResolver: StyleResolver | null;
|
|
65
|
+
}): boolean;
|
|
66
|
+
|
|
67
|
+
export { type ApplyFormattingOptions, applyFormatting, setParagraphStyle };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { EditorView } from 'prosemirror-view';
|
|
2
|
+
import { StyleResolver } from './styles/index.js';
|
|
3
|
+
import '../formatting-_OXU8gLB.js';
|
|
4
|
+
import '../colors-C3vA7HUU.js';
|
|
5
|
+
import '../styles-BWqX2AS-.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Agent-facing formatting operations shared by the React and Vue adapters.
|
|
9
|
+
*
|
|
10
|
+
* `applyFormatting` maps a mark-toggle request (bold/italic/underline/strike/
|
|
11
|
+
* color/highlight/fontSize/fontFamily) onto a PM transaction over a paragraph
|
|
12
|
+
* range located by `paraId` (+ optional `search`). `setParagraphStyle` applies
|
|
13
|
+
* a named paragraph style to that range.
|
|
14
|
+
*
|
|
15
|
+
* Both take the `EditorView` as a parameter. `setParagraphStyle` takes the
|
|
16
|
+
* style resolver as an injected dependency so each adapter keeps its own
|
|
17
|
+
* resolver-sourcing strategy (React caches per styles object; Vue rebuilds).
|
|
18
|
+
*
|
|
19
|
+
* Previously duplicated byte-for-byte at
|
|
20
|
+
* `packages/react/.../useDocxEditorRefApi.ts` and
|
|
21
|
+
* `packages/vue/.../useFormattingActions.ts`.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
interface ApplyFormattingOptions {
|
|
25
|
+
paraId: string;
|
|
26
|
+
search?: string;
|
|
27
|
+
marks: {
|
|
28
|
+
bold?: boolean;
|
|
29
|
+
italic?: boolean;
|
|
30
|
+
underline?: boolean | {
|
|
31
|
+
style?: string;
|
|
32
|
+
};
|
|
33
|
+
strike?: boolean;
|
|
34
|
+
color?: {
|
|
35
|
+
rgb?: string;
|
|
36
|
+
themeColor?: string;
|
|
37
|
+
};
|
|
38
|
+
highlight?: string;
|
|
39
|
+
fontSize?: number;
|
|
40
|
+
fontFamily?: {
|
|
41
|
+
ascii?: string;
|
|
42
|
+
hAnsi?: string;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Apply mark toggles to a paragraph range. Returns false when the paraId /
|
|
48
|
+
* search can't be resolved; true (a no-op) when the resolved range is empty.
|
|
49
|
+
*/
|
|
50
|
+
declare function applyFormatting(view: EditorView, options: ApplyFormattingOptions): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Apply a named paragraph style to the paragraph identified by `paraId`.
|
|
53
|
+
*
|
|
54
|
+
* The style resolver is injected: when present, unknown styleIds are rejected
|
|
55
|
+
* (the agent gets a clear error instead of a silently-broken `<w:pStyle>`), and
|
|
56
|
+
* the resolved paragraph/run formatting is threaded into `applyStyle`. Without
|
|
57
|
+
* a resolver (no styles loaded) the styleId is applied as-is. Returns false
|
|
58
|
+
* when the paraId can't be resolved or the styleId is unknown.
|
|
59
|
+
*/
|
|
60
|
+
declare function setParagraphStyle(view: EditorView, options: {
|
|
61
|
+
paraId: string;
|
|
62
|
+
styleId: string;
|
|
63
|
+
}, deps: {
|
|
64
|
+
styleResolver: StyleResolver | null;
|
|
65
|
+
}): boolean;
|
|
66
|
+
|
|
67
|
+
export { type ApplyFormattingOptions, applyFormatting, setParagraphStyle };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkNRWQ65NX_js=require('../chunk-NRWQ65NX.js'),chunkQEACB5VG_js=require('../chunk-QEACB5VG.js'),chunkAPNMO5JT_js=require('../chunk-APNMO5JT.js');require('../chunk-WWBNJ7KF.js'),require('../chunk-4RTVLMRZ.js'),require('../chunk-BHBOAP6Z.js'),require('../chunk-MZ7LW5CH.js'),require('../chunk-N3Y5BUKV.js'),require('../chunk-WVERBZZU.js'),require('../chunk-6LVPRTB6.js'),require('../chunk-LWH66Q7Q.js'),require('../chunk-TUIEV7Q7.js'),require('../chunk-7HANRHHL.js'),require('../chunk-MJ5FQX7Q.js'),require('../chunk-C2BAPYGJ.js');var chunk4Q2IP5FW_js=require('../chunk-4Q2IP5FW.js');require('../chunk-GSKMHXHG.js'),require('../chunk-DC7S76ZX.js');var prosemirrorState=require('prosemirror-state');function I(i,l){let s=chunkNRWQ65NX_js.a(i.state.doc,l.paraId);if(!s)return false;let o=s.from+1,a=s.to-1;if(l.search){let n=chunkNRWQ65NX_js.d(i.state.doc,s.from,s.to,l.search);if(!n)return false;o=n.from,a=n.to;}if(o>=a)return true;let{schema:t}=i.state,e=l.marks,r=i.state.tr;if(e.bold!==void 0&&t.marks.bold&&(r=e.bold?r.addMark(o,a,t.marks.bold.create()):r.removeMark(o,a,t.marks.bold)),e.italic!==void 0&&t.marks.italic&&(r=e.italic?r.addMark(o,a,t.marks.italic.create()):r.removeMark(o,a,t.marks.italic)),e.underline!==void 0&&t.marks.underline)if(e.underline){let n=typeof e.underline=="object"?e.underline.style:void 0;r=r.addMark(o,a,t.marks.underline.create({style:n??"single"}));}else r=r.removeMark(o,a,t.marks.underline);if(e.strike!==void 0&&t.marks.strike&&(r=e.strike?r.addMark(o,a,t.marks.strike.create()):r.removeMark(o,a,t.marks.strike)),e.color!==void 0&&t.marks.textColor&&(e.color&&(e.color.rgb||e.color.themeColor)?r=r.addMark(o,a,t.marks.textColor.create({rgb:e.color.rgb??null,themeColor:e.color.themeColor??null})):r=r.removeMark(o,a,t.marks.textColor)),e.highlight!==void 0&&t.marks.highlight)if(e.highlight){let n=chunkQEACB5VG_js.b(e.highlight);r=r.addMark(o,a,t.marks.highlight.create({color:n||e.highlight}));}else r=r.removeMark(o,a,t.marks.highlight);return e.fontSize!==void 0&&t.marks.fontSize&&(e.fontSize>0?r=r.addMark(o,a,t.marks.fontSize.create({size:chunk4Q2IP5FW_js.l(e.fontSize)})):r=r.removeMark(o,a,t.marks.fontSize)),e.fontFamily!==void 0&&t.marks.fontFamily&&(e.fontFamily&&(e.fontFamily.ascii||e.fontFamily.hAnsi)?r=r.addMark(o,a,t.marks.fontFamily.create({ascii:e.fontFamily.ascii??null,hAnsi:e.fontFamily.hAnsi??e.fontFamily.ascii??null})):r=r.removeMark(o,a,t.marks.fontFamily)),i.dispatch(r),true}function x(i,l,s){let o=chunkNRWQ65NX_js.a(i.state.doc,l.paraId);if(!o)return false;let{styleResolver:a}=s;if(a&&!a.hasParagraphStyle(l.styleId))return false;let t=i.state.doc.resolve(o.from+1),e=i.state.doc.resolve(o.to-1),r=prosemirrorState.TextSelection.between(t,e),n=i.state.apply(i.state.tr.setSelection(r)),p=a?(()=>{let m=a.resolveParagraphStyle(l.styleId);return chunkAPNMO5JT_js.v(l.styleId,{paragraphFormatting:m.paragraphFormatting,runFormatting:m.runFormatting})})():chunkAPNMO5JT_js.v(l.styleId),c=false;return p(n,m=>{c=true,m.setSelection(i.state.selection.map(m.doc,m.mapping)),i.dispatch(m);}),c}exports.applyFormatting=I;exports.setParagraphStyle=x;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a,d}from'../chunk-HPJBZL37.mjs';import {b}from'../chunk-XPV6VILW.mjs';import {v}from'../chunk-LAJPGQEE.mjs';import'../chunk-4GFTMGSV.mjs';import'../chunk-SWBLJF6R.mjs';import'../chunk-MOKKS75W.mjs';import'../chunk-OZMNIX6U.mjs';import'../chunk-AMENZY5F.mjs';import'../chunk-U67MWOPZ.mjs';import'../chunk-BGY3CB37.mjs';import'../chunk-2XP6GLA4.mjs';import'../chunk-ZX26QZJ5.mjs';import'../chunk-MJ6XZFVD.mjs';import'../chunk-67LVRQIR.mjs';import'../chunk-LE67NTCN.mjs';import {l}from'../chunk-VW22RZ6C.mjs';import'../chunk-DI6CRWSW.mjs';import'../chunk-QYUPLKLP.mjs';import {TextSelection}from'prosemirror-state';function I(i,l$1){let s=a(i.state.doc,l$1.paraId);if(!s)return false;let o=s.from+1,a$1=s.to-1;if(l$1.search){let n=d(i.state.doc,s.from,s.to,l$1.search);if(!n)return false;o=n.from,a$1=n.to;}if(o>=a$1)return true;let{schema:t}=i.state,e=l$1.marks,r=i.state.tr;if(e.bold!==void 0&&t.marks.bold&&(r=e.bold?r.addMark(o,a$1,t.marks.bold.create()):r.removeMark(o,a$1,t.marks.bold)),e.italic!==void 0&&t.marks.italic&&(r=e.italic?r.addMark(o,a$1,t.marks.italic.create()):r.removeMark(o,a$1,t.marks.italic)),e.underline!==void 0&&t.marks.underline)if(e.underline){let n=typeof e.underline=="object"?e.underline.style:void 0;r=r.addMark(o,a$1,t.marks.underline.create({style:n??"single"}));}else r=r.removeMark(o,a$1,t.marks.underline);if(e.strike!==void 0&&t.marks.strike&&(r=e.strike?r.addMark(o,a$1,t.marks.strike.create()):r.removeMark(o,a$1,t.marks.strike)),e.color!==void 0&&t.marks.textColor&&(e.color&&(e.color.rgb||e.color.themeColor)?r=r.addMark(o,a$1,t.marks.textColor.create({rgb:e.color.rgb??null,themeColor:e.color.themeColor??null})):r=r.removeMark(o,a$1,t.marks.textColor)),e.highlight!==void 0&&t.marks.highlight)if(e.highlight){let n=b(e.highlight);r=r.addMark(o,a$1,t.marks.highlight.create({color:n||e.highlight}));}else r=r.removeMark(o,a$1,t.marks.highlight);return e.fontSize!==void 0&&t.marks.fontSize&&(e.fontSize>0?r=r.addMark(o,a$1,t.marks.fontSize.create({size:l(e.fontSize)})):r=r.removeMark(o,a$1,t.marks.fontSize)),e.fontFamily!==void 0&&t.marks.fontFamily&&(e.fontFamily&&(e.fontFamily.ascii||e.fontFamily.hAnsi)?r=r.addMark(o,a$1,t.marks.fontFamily.create({ascii:e.fontFamily.ascii??null,hAnsi:e.fontFamily.hAnsi??e.fontFamily.ascii??null})):r=r.removeMark(o,a$1,t.marks.fontFamily)),i.dispatch(r),true}function x(i,l,s){let o=a(i.state.doc,l.paraId);if(!o)return false;let{styleResolver:a$1}=s;if(a$1&&!a$1.hasParagraphStyle(l.styleId))return false;let t=i.state.doc.resolve(o.from+1),e=i.state.doc.resolve(o.to-1),r=TextSelection.between(t,e),n=i.state.apply(i.state.tr.setSelection(r)),p=a$1?(()=>{let m=a$1.resolveParagraphStyle(l.styleId);return v(l.styleId,{paragraphFormatting:m.paragraphFormatting,runFormatting:m.runFormatting})})():v(l.styleId),c=false;return p(n,m=>{c=true,m.setSelection(i.state.selection.map(m.doc,m.mapping)),i.dispatch(m);}),c}export{I as applyFormatting,x as setParagraphStyle};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { EditorView } from 'prosemirror-view';
|
|
2
|
+
import { e as Comment } from '../content-3xF4WDE8.mjs';
|
|
3
|
+
import '../formatting-BH4hcZiq.mjs';
|
|
4
|
+
import '../colors-C3vA7HUU.mjs';
|
|
5
|
+
import '../docx/wrapTypes.mjs';
|
|
6
|
+
import '../watermark-DAcnAs_J.mjs';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Comment + tracked-change ID allocation.
|
|
10
|
+
*
|
|
11
|
+
* Comments (`w:comment` ids) and tracked changes (`w:ins`/`w:del` revision ids)
|
|
12
|
+
* share a single OOXML ID space — a duplicate ID between the two corrupts the
|
|
13
|
+
* round-trip. Allocation is therefore one monotonic, no-reuse counter, exposed
|
|
14
|
+
* as an **instance-scoped** factory rather than module-global state so two
|
|
15
|
+
* editor instances on one page never share (or collide on) a counter.
|
|
16
|
+
*
|
|
17
|
+
* Kept separate from the comment/tracked-change transaction builders
|
|
18
|
+
* (`commentOps.ts`) so the allocator can be owned independently — the editor
|
|
19
|
+
* engine seeds and threads it without dragging in the PM-text-lookup graph.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/** Sentinel ID for a comment that hasn't been persisted yet (anchored to selection). */
|
|
23
|
+
declare const PENDING_COMMENT_ID = -1;
|
|
24
|
+
interface CommentIdAllocator {
|
|
25
|
+
/** Allocate the next ID and advance the counter. */
|
|
26
|
+
next(): number;
|
|
27
|
+
/**
|
|
28
|
+
* On document load, bump the counter above the highest ID found in the
|
|
29
|
+
* loaded comments and tracked-change marks so subsequent allocations don't
|
|
30
|
+
* collide with already-present IDs.
|
|
31
|
+
*/
|
|
32
|
+
seedAbove(maxId: number): void;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Create an instance-scoped monotonic comment/revision ID allocator. IDs are
|
|
36
|
+
* never reused (deleting a comment does not free its ID), and the counter is
|
|
37
|
+
* private to this allocator — multiple editors get independent ID spaces.
|
|
38
|
+
*/
|
|
39
|
+
declare function createCommentIdAllocator(): CommentIdAllocator;
|
|
40
|
+
/**
|
|
41
|
+
* Seed an allocator above every comment/revision ID currently in the document
|
|
42
|
+
* — comment objects (including replies, which carry no mark) plus
|
|
43
|
+
* tracked-change `revisionId` marks. Because `seedAbove` only ever raises the
|
|
44
|
+
* counter, this is safe to call on load (React) or before each allocation
|
|
45
|
+
* (Vue): new IDs never collide with or reuse an existing one, and the comment
|
|
46
|
+
* and revision ID spaces stay unified.
|
|
47
|
+
*/
|
|
48
|
+
declare function seedCommentAllocator(allocator: CommentIdAllocator, comments: Comment[] | undefined, view: EditorView | null): void;
|
|
49
|
+
|
|
50
|
+
export { type CommentIdAllocator, PENDING_COMMENT_ID, createCommentIdAllocator, seedCommentAllocator };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { EditorView } from 'prosemirror-view';
|
|
2
|
+
import { e as Comment } from '../content-C8fc_tL6.js';
|
|
3
|
+
import '../formatting-_OXU8gLB.js';
|
|
4
|
+
import '../colors-C3vA7HUU.js';
|
|
5
|
+
import '../docx/wrapTypes.js';
|
|
6
|
+
import '../watermark-DAcnAs_J.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Comment + tracked-change ID allocation.
|
|
10
|
+
*
|
|
11
|
+
* Comments (`w:comment` ids) and tracked changes (`w:ins`/`w:del` revision ids)
|
|
12
|
+
* share a single OOXML ID space — a duplicate ID between the two corrupts the
|
|
13
|
+
* round-trip. Allocation is therefore one monotonic, no-reuse counter, exposed
|
|
14
|
+
* as an **instance-scoped** factory rather than module-global state so two
|
|
15
|
+
* editor instances on one page never share (or collide on) a counter.
|
|
16
|
+
*
|
|
17
|
+
* Kept separate from the comment/tracked-change transaction builders
|
|
18
|
+
* (`commentOps.ts`) so the allocator can be owned independently — the editor
|
|
19
|
+
* engine seeds and threads it without dragging in the PM-text-lookup graph.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/** Sentinel ID for a comment that hasn't been persisted yet (anchored to selection). */
|
|
23
|
+
declare const PENDING_COMMENT_ID = -1;
|
|
24
|
+
interface CommentIdAllocator {
|
|
25
|
+
/** Allocate the next ID and advance the counter. */
|
|
26
|
+
next(): number;
|
|
27
|
+
/**
|
|
28
|
+
* On document load, bump the counter above the highest ID found in the
|
|
29
|
+
* loaded comments and tracked-change marks so subsequent allocations don't
|
|
30
|
+
* collide with already-present IDs.
|
|
31
|
+
*/
|
|
32
|
+
seedAbove(maxId: number): void;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Create an instance-scoped monotonic comment/revision ID allocator. IDs are
|
|
36
|
+
* never reused (deleting a comment does not free its ID), and the counter is
|
|
37
|
+
* private to this allocator — multiple editors get independent ID spaces.
|
|
38
|
+
*/
|
|
39
|
+
declare function createCommentIdAllocator(): CommentIdAllocator;
|
|
40
|
+
/**
|
|
41
|
+
* Seed an allocator above every comment/revision ID currently in the document
|
|
42
|
+
* — comment objects (including replies, which carry no mark) plus
|
|
43
|
+
* tracked-change `revisionId` marks. Because `seedAbove` only ever raises the
|
|
44
|
+
* counter, this is safe to call on load (React) or before each allocation
|
|
45
|
+
* (Vue): new IDs never collide with or reuse an existing one, and the comment
|
|
46
|
+
* and revision ID spaces stay unified.
|
|
47
|
+
*/
|
|
48
|
+
declare function seedCommentAllocator(allocator: CommentIdAllocator, comments: Comment[] | undefined, view: EditorView | null): void;
|
|
49
|
+
|
|
50
|
+
export { type CommentIdAllocator, PENDING_COMMENT_ID, createCommentIdAllocator, seedCommentAllocator };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';require('../chunk-DC7S76ZX.js');var d=-1;function i(){let e=1;return {next:()=>e++,seedAbove(t){t>=e&&(e=t+1);}}}function a(e,t,n){let o=0;for(let r of t??[])o=Math.max(o,r.id);n&&n.state.doc.descendants(r=>{for(let m of r.marks)m.attrs.revisionId!=null&&(o=Math.max(o,m.attrs.revisionId));}),e.seedAbove(o);}exports.PENDING_COMMENT_ID=d;exports.createCommentIdAllocator=i;exports.seedCommentAllocator=a;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import'../chunk-QYUPLKLP.mjs';var d=-1;function i(){let e=1;return {next:()=>e++,seedAbove(t){t>=e&&(e=t+1);}}}function a(e,t,n){let o=0;for(let r of t??[])o=Math.max(o,r.id);n&&n.state.doc.descendants(r=>{for(let m of r.marks)m.attrs.revisionId!=null&&(o=Math.max(o,m.attrs.revisionId));}),e.seedAbove(o);}export{d as PENDING_COMMENT_ID,i as createCommentIdAllocator,a as seedCommentAllocator};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { EditorView } from 'prosemirror-view';
|
|
2
|
+
import { e as Comment } from '../content-3xF4WDE8.mjs';
|
|
3
|
+
import { CommentIdAllocator } from './commentIdAllocator.mjs';
|
|
4
|
+
import '../formatting-BH4hcZiq.mjs';
|
|
5
|
+
import '../colors-C3vA7HUU.mjs';
|
|
6
|
+
import '../docx/wrapTypes.mjs';
|
|
7
|
+
import '../watermark-DAcnAs_J.mjs';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Comment + tracked-change (proposeChange) PM transaction builders shared by
|
|
11
|
+
* the React and Vue adapters. They locate the target range, apply the mark(s),
|
|
12
|
+
* dispatch, and return a result. ID allocation lives in `commentIdAllocator.ts`
|
|
13
|
+
* and is injected. Adapter-specific state mutation, event emission, and sidebar
|
|
14
|
+
* UI stay in each adapter.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/** Build a Comment object with a freshly-allocated ID. */
|
|
18
|
+
declare function createComment(allocator: CommentIdAllocator, text: string, authorName: string, parentId?: number): Comment;
|
|
19
|
+
interface AddCommentOptions {
|
|
20
|
+
paraId: string;
|
|
21
|
+
text: string;
|
|
22
|
+
author: string;
|
|
23
|
+
search?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Locate the comment range (paragraph, narrowed by `search`), add the comment
|
|
27
|
+
* mark, dispatch, and return the created Comment. Returns null when the schema
|
|
28
|
+
* lacks a comment mark or the range can't be resolved. The caller owns adding
|
|
29
|
+
* the comment to its own state and showing the sidebar.
|
|
30
|
+
*/
|
|
31
|
+
declare function addCommentToRange(view: EditorView, options: AddCommentOptions, allocator: CommentIdAllocator): Comment | null;
|
|
32
|
+
interface ProposeChangeOptions {
|
|
33
|
+
paraId: string;
|
|
34
|
+
search: string;
|
|
35
|
+
replaceWith: string;
|
|
36
|
+
author: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Apply a tracked change (insertion / deletion / replace) to the located range.
|
|
40
|
+
* `search === ''` means a pure insertion at the paragraph end; `replaceWith ===
|
|
41
|
+
* ''` means a pure deletion. Refuses to layer onto an existing tracked change.
|
|
42
|
+
* Returns true when a change was dispatched, false otherwise.
|
|
43
|
+
*/
|
|
44
|
+
declare function applyProposedChange(view: EditorView, options: ProposeChangeOptions, allocator: CommentIdAllocator): boolean;
|
|
45
|
+
|
|
46
|
+
export { type AddCommentOptions, type ProposeChangeOptions, addCommentToRange, applyProposedChange, createComment };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { EditorView } from 'prosemirror-view';
|
|
2
|
+
import { e as Comment } from '../content-C8fc_tL6.js';
|
|
3
|
+
import { CommentIdAllocator } from './commentIdAllocator.js';
|
|
4
|
+
import '../formatting-_OXU8gLB.js';
|
|
5
|
+
import '../colors-C3vA7HUU.js';
|
|
6
|
+
import '../docx/wrapTypes.js';
|
|
7
|
+
import '../watermark-DAcnAs_J.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Comment + tracked-change (proposeChange) PM transaction builders shared by
|
|
11
|
+
* the React and Vue adapters. They locate the target range, apply the mark(s),
|
|
12
|
+
* dispatch, and return a result. ID allocation lives in `commentIdAllocator.ts`
|
|
13
|
+
* and is injected. Adapter-specific state mutation, event emission, and sidebar
|
|
14
|
+
* UI stay in each adapter.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/** Build a Comment object with a freshly-allocated ID. */
|
|
18
|
+
declare function createComment(allocator: CommentIdAllocator, text: string, authorName: string, parentId?: number): Comment;
|
|
19
|
+
interface AddCommentOptions {
|
|
20
|
+
paraId: string;
|
|
21
|
+
text: string;
|
|
22
|
+
author: string;
|
|
23
|
+
search?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Locate the comment range (paragraph, narrowed by `search`), add the comment
|
|
27
|
+
* mark, dispatch, and return the created Comment. Returns null when the schema
|
|
28
|
+
* lacks a comment mark or the range can't be resolved. The caller owns adding
|
|
29
|
+
* the comment to its own state and showing the sidebar.
|
|
30
|
+
*/
|
|
31
|
+
declare function addCommentToRange(view: EditorView, options: AddCommentOptions, allocator: CommentIdAllocator): Comment | null;
|
|
32
|
+
interface ProposeChangeOptions {
|
|
33
|
+
paraId: string;
|
|
34
|
+
search: string;
|
|
35
|
+
replaceWith: string;
|
|
36
|
+
author: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Apply a tracked change (insertion / deletion / replace) to the located range.
|
|
40
|
+
* `search === ''` means a pure insertion at the paragraph end; `replaceWith ===
|
|
41
|
+
* ''` means a pure deletion. Refuses to layer onto an existing tracked change.
|
|
42
|
+
* Returns true when a change was dispatched, false otherwise.
|
|
43
|
+
*/
|
|
44
|
+
declare function applyProposedChange(view: EditorView, options: ProposeChangeOptions, allocator: CommentIdAllocator): boolean;
|
|
45
|
+
|
|
46
|
+
export { type AddCommentOptions, type ProposeChangeOptions, addCommentToRange, applyProposedChange, createComment };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkNRWQ65NX_js=require('../chunk-NRWQ65NX.js');require('../chunk-DC7S76ZX.js');function C(e,t,c,r){return {id:e.next(),author:c,date:new Date().toISOString(),content:[{type:"paragraph",formatting:{},content:[{type:"run",formatting:{},content:[{type:"text",text:t}]}]}],...r!==void 0&&{parentId:r}}}function y(e,t,c){let{schema:r}=e.state;if(!r.marks.comment)return null;let n=chunkNRWQ65NX_js.a(e.state.doc,t.paraId);if(!n)return null;let s=n.from+1,m=n.to-1;if(t.search){let o=chunkNRWQ65NX_js.d(e.state.doc,n.from,n.to,t.search);if(!o)return null;s=o.from,m=o.to;}if(s>=m)return null;let a=C(c,t.text,t.author);return e.dispatch(e.state.tr.addMark(s,m,r.marks.comment.create({commentId:a.id}))),a}function A(e,t,c){let{schema:r}=e.state;if(!r.marks.deletion||!r.marks.insertion)return false;let n=chunkNRWQ65NX_js.a(e.state.doc,t.paraId);if(!n)return false;let s=t.search==="",m=t.replaceWith==="";if(s&&m)return false;let a,o;if(s)a=n.to-1,o=n.to-1;else {let i=chunkNRWQ65NX_js.d(e.state.doc,n.from,n.to,t.search);if(!i)return false;a=i.from,o=i.to;}if(a<o){let i=false;if(e.state.doc.nodesBetween(a,o,I=>{for(let h of I.marks)if(h.type===r.marks.insertion||h.type===r.marks.deletion)return i=true,false;return true}),i)return false}let u=c.next(),p=new Date().toISOString(),g=r.marks.deletion.create({revisionId:u,author:t.author,date:p}),x=r.marks.insertion.create({revisionId:u,author:t.author,date:p}),d=e.state.tr;return s||(d=d.addMark(a,o,g)),m||(d=d.insert(o,r.text(t.replaceWith,[x]))),e.dispatch(d),true}exports.addCommentToRange=y;exports.applyProposedChange=A;exports.createComment=C;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a,d}from'../chunk-HPJBZL37.mjs';import'../chunk-QYUPLKLP.mjs';function C(e,t,c,r){return {id:e.next(),author:c,date:new Date().toISOString(),content:[{type:"paragraph",formatting:{},content:[{type:"run",formatting:{},content:[{type:"text",text:t}]}]}],...r!==void 0&&{parentId:r}}}function y(e,t,c){let{schema:r}=e.state;if(!r.marks.comment)return null;let n=a(e.state.doc,t.paraId);if(!n)return null;let s=n.from+1,m=n.to-1;if(t.search){let o=d(e.state.doc,n.from,n.to,t.search);if(!o)return null;s=o.from,m=o.to;}if(s>=m)return null;let a$1=C(c,t.text,t.author);return e.dispatch(e.state.tr.addMark(s,m,r.marks.comment.create({commentId:a$1.id}))),a$1}function A(e,t,c){let{schema:r}=e.state;if(!r.marks.deletion||!r.marks.insertion)return false;let n=a(e.state.doc,t.paraId);if(!n)return false;let s=t.search==="",m=t.replaceWith==="";if(s&&m)return false;let a$1,o;if(s)a$1=n.to-1,o=n.to-1;else {let i=d(e.state.doc,n.from,n.to,t.search);if(!i)return false;a$1=i.from,o=i.to;}if(a$1<o){let i=false;if(e.state.doc.nodesBetween(a$1,o,I=>{for(let h of I.marks)if(h.type===r.marks.insertion||h.type===r.marks.deletion)return i=true,false;return true}),i)return false}let u=c.next(),p=new Date().toISOString(),g=r.marks.deletion.create({revisionId:u,author:t.author,date:p}),x=r.marks.insertion.create({revisionId:u,author:t.author,date:p}),d$1=e.state.tr;return s||(d$1=d$1.addMark(a$1,o,g)),m||(d$1=d$1.insert(o,r.text(t.replaceWith,[x]))),e.dispatch(d$1),true}export{y as addCommentToRange,A as applyProposedChange,C as createComment};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';require('../../chunk-UQ6WNWXX.js');var chunkINDYZOOS_js=require('../../chunk-INDYZOOS.js'),
|
|
1
|
+
'use strict';require('../../chunk-UQ6WNWXX.js');var chunkINDYZOOS_js=require('../../chunk-INDYZOOS.js'),chunkQVRNNRG5_js=require('../../chunk-QVRNNRG5.js');require('../../chunk-C45EFOVP.js'),require('../../chunk-ISKTBM4L.js'),require('../../chunk-JFZIXFRC.js'),require('../../chunk-RQVHKDXK.js'),require('../../chunk-SCK6ZM5V.js'),require('../../chunk-Z3LGMBJC.js'),require('../../chunk-3R7QHNI5.js'),require('../../chunk-WWBNJ7KF.js'),require('../../chunk-4RTVLMRZ.js'),require('../../chunk-BHBOAP6Z.js'),require('../../chunk-MZ7LW5CH.js'),require('../../chunk-N3Y5BUKV.js'),require('../../chunk-WVERBZZU.js'),require('../../chunk-6LVPRTB6.js'),require('../../chunk-LWH66Q7Q.js'),require('../../chunk-TUIEV7Q7.js'),require('../../chunk-7HANRHHL.js'),require('../../chunk-MJ5FQX7Q.js'),require('../../chunk-C2BAPYGJ.js'),require('../../chunk-4Q2IP5FW.js'),require('../../chunk-GSKMHXHG.js'),require('../../chunk-DC7S76ZX.js');Object.defineProperty(exports,"fromProseDoc",{enumerable:true,get:function(){return chunkINDYZOOS_js.a}});Object.defineProperty(exports,"proseDocToBlocks",{enumerable:true,get:function(){return chunkINDYZOOS_js.c}});Object.defineProperty(exports,"updateDocumentContent",{enumerable:true,get:function(){return chunkINDYZOOS_js.b}});Object.defineProperty(exports,"createEmptyDoc",{enumerable:true,get:function(){return chunkQVRNNRG5_js.d}});Object.defineProperty(exports,"footnoteToProseDoc",{enumerable:true,get:function(){return chunkQVRNNRG5_js.c}});Object.defineProperty(exports,"headerFooterToProseDoc",{enumerable:true,get:function(){return chunkQVRNNRG5_js.b}});Object.defineProperty(exports,"toProseDoc",{enumerable:true,get:function(){return chunkQVRNNRG5_js.a}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import'../../chunk-RNOXNNSD.mjs';export{a as fromProseDoc,c as proseDocToBlocks,b as updateDocumentContent}from'../../chunk-D3PRIF3Y.mjs';export{d as createEmptyDoc,c as footnoteToProseDoc,b as headerFooterToProseDoc,a as toProseDoc}from'../../chunk-
|
|
1
|
+
import'../../chunk-RNOXNNSD.mjs';export{a as fromProseDoc,c as proseDocToBlocks,b as updateDocumentContent}from'../../chunk-D3PRIF3Y.mjs';export{d as createEmptyDoc,c as footnoteToProseDoc,b as headerFooterToProseDoc,a as toProseDoc}from'../../chunk-LJE7HQEJ.mjs';import'../../chunk-7OW3VCZE.mjs';import'../../chunk-LK6I3HMH.mjs';import'../../chunk-QPFJJPIC.mjs';import'../../chunk-GYWTUUXX.mjs';import'../../chunk-7CZEZ3UL.mjs';import'../../chunk-W77JXDEV.mjs';import'../../chunk-3ANZ3252.mjs';import'../../chunk-4GFTMGSV.mjs';import'../../chunk-SWBLJF6R.mjs';import'../../chunk-MOKKS75W.mjs';import'../../chunk-OZMNIX6U.mjs';import'../../chunk-AMENZY5F.mjs';import'../../chunk-U67MWOPZ.mjs';import'../../chunk-BGY3CB37.mjs';import'../../chunk-2XP6GLA4.mjs';import'../../chunk-ZX26QZJ5.mjs';import'../../chunk-MJ6XZFVD.mjs';import'../../chunk-67LVRQIR.mjs';import'../../chunk-LE67NTCN.mjs';import'../../chunk-VW22RZ6C.mjs';import'../../chunk-DI6CRWSW.mjs';import'../../chunk-QYUPLKLP.mjs';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Node } from 'prosemirror-model';
|
|
2
|
+
import { EditorView } from 'prosemirror-view';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Image resize / drag-move PM commits shared by the React and Vue adapters.
|
|
6
|
+
*
|
|
7
|
+
* The float-vs-inline fork is identical across adapters; only the DOM lookups
|
|
8
|
+
* differ (which `.layout-page-content` the drop landed in; how the inline drop
|
|
9
|
+
* position is hit-tested). Those stay in each adapter, which passes the
|
|
10
|
+
* resolved EMU offsets (float) or drop position (inline) into the pure commits
|
|
11
|
+
* here. Each commit dispatches and returns the PM position the caller should
|
|
12
|
+
* re-select as a NodeSelection (or null on no-op / failure).
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/** True when the image is floating (anchored) rather than inline. */
|
|
16
|
+
declare function isFloatingImage(node: Node): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Resize commit: set the image node's `width`/`height`. Returns `pmPos` to
|
|
19
|
+
* re-select, or null if the position no longer holds an image.
|
|
20
|
+
*/
|
|
21
|
+
declare function commitImageResize(view: EditorView, pmPos: number, newWidth: number, newHeight: number): number | null;
|
|
22
|
+
/**
|
|
23
|
+
* Floating drag commit: rewrite the anchor's margin-relative `position`
|
|
24
|
+
* offsets (in EMU) so the image lands at the drop point while staying
|
|
25
|
+
* floating. Returns `pmPos` to re-select, or null on no-op / failure.
|
|
26
|
+
*/
|
|
27
|
+
declare function commitImageFloatMove(view: EditorView, pmPos: number, hOffsetEmu: number, vOffsetEmu: number): number | null;
|
|
28
|
+
/**
|
|
29
|
+
* Inline drag commit: move the image node to `dropPos` via a delete + insert
|
|
30
|
+
* pair. Returns the PM position to re-select, or null when the drop is a
|
|
31
|
+
* no-op (same slot) or fails.
|
|
32
|
+
*/
|
|
33
|
+
declare function commitImageInlineMove(view: EditorView, pmPos: number, dropPos: number): number | null;
|
|
34
|
+
|
|
35
|
+
export { commitImageFloatMove, commitImageInlineMove, commitImageResize, isFloatingImage };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Node } from 'prosemirror-model';
|
|
2
|
+
import { EditorView } from 'prosemirror-view';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Image resize / drag-move PM commits shared by the React and Vue adapters.
|
|
6
|
+
*
|
|
7
|
+
* The float-vs-inline fork is identical across adapters; only the DOM lookups
|
|
8
|
+
* differ (which `.layout-page-content` the drop landed in; how the inline drop
|
|
9
|
+
* position is hit-tested). Those stay in each adapter, which passes the
|
|
10
|
+
* resolved EMU offsets (float) or drop position (inline) into the pure commits
|
|
11
|
+
* here. Each commit dispatches and returns the PM position the caller should
|
|
12
|
+
* re-select as a NodeSelection (or null on no-op / failure).
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/** True when the image is floating (anchored) rather than inline. */
|
|
16
|
+
declare function isFloatingImage(node: Node): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Resize commit: set the image node's `width`/`height`. Returns `pmPos` to
|
|
19
|
+
* re-select, or null if the position no longer holds an image.
|
|
20
|
+
*/
|
|
21
|
+
declare function commitImageResize(view: EditorView, pmPos: number, newWidth: number, newHeight: number): number | null;
|
|
22
|
+
/**
|
|
23
|
+
* Floating drag commit: rewrite the anchor's margin-relative `position`
|
|
24
|
+
* offsets (in EMU) so the image lands at the drop point while staying
|
|
25
|
+
* floating. Returns `pmPos` to re-select, or null on no-op / failure.
|
|
26
|
+
*/
|
|
27
|
+
declare function commitImageFloatMove(view: EditorView, pmPos: number, hOffsetEmu: number, vOffsetEmu: number): number | null;
|
|
28
|
+
/**
|
|
29
|
+
* Inline drag commit: move the image node to `dropPos` via a delete + insert
|
|
30
|
+
* pair. Returns the PM position to re-select, or null when the drop is a
|
|
31
|
+
* no-op (same slot) or fails.
|
|
32
|
+
*/
|
|
33
|
+
declare function commitImageInlineMove(view: EditorView, pmPos: number, dropPos: number): number | null;
|
|
34
|
+
|
|
35
|
+
export { commitImageFloatMove, commitImageInlineMove, commitImageResize, isFloatingImage };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';require('../chunk-DC7S76ZX.js');function a(e){let t=e.attrs.wrapType;return e.attrs.displayMode==="float"||(t?["square","tight","through"].includes(t):false)}function o(e,t){let r=e.state.doc.nodeAt(t);return !r||r.type.name!=="image"?null:r}function l(e,t,r,i){try{let n=o(e,t);return n?(e.dispatch(e.state.tr.setNodeMarkup(t,void 0,{...n.attrs,width:r,height:i})),t):null}catch{return null}}function d(e,t,r,i){try{let n=o(e,t);if(!n)return null;let u={horizontal:{posOffset:r,relativeTo:"margin"},vertical:{posOffset:i,relativeTo:"margin"}};return e.dispatch(e.state.tr.setNodeMarkup(t,void 0,{...n.attrs,position:u})),t}catch{return null}}function c(e,t,r){try{let i=o(e,t);if(!i||r===t||r===t+1)return null;let n=e.state.tr;if(r<=t)return n=n.delete(t,t+i.nodeSize),n=n.insert(r,i),e.dispatch(n),r;n=n.delete(t,t+i.nodeSize);let u=Math.min(r-i.nodeSize,n.doc.content.size);return n=n.insert(u,i),e.dispatch(n),Math.min(u,e.state.doc.content.size-1)}catch{return null}}exports.commitImageFloatMove=d;exports.commitImageInlineMove=c;exports.commitImageResize=l;exports.isFloatingImage=a;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import'../chunk-QYUPLKLP.mjs';function a(e){let t=e.attrs.wrapType;return e.attrs.displayMode==="float"||(t?["square","tight","through"].includes(t):false)}function o(e,t){let r=e.state.doc.nodeAt(t);return !r||r.type.name!=="image"?null:r}function l(e,t,r,i){try{let n=o(e,t);return n?(e.dispatch(e.state.tr.setNodeMarkup(t,void 0,{...n.attrs,width:r,height:i})),t):null}catch{return null}}function d(e,t,r,i){try{let n=o(e,t);if(!n)return null;let u={horizontal:{posOffset:r,relativeTo:"margin"},vertical:{posOffset:i,relativeTo:"margin"}};return e.dispatch(e.state.tr.setNodeMarkup(t,void 0,{...n.attrs,position:u})),t}catch{return null}}function c(e,t,r){try{let i=o(e,t);if(!i||r===t||r===t+1)return null;let n=e.state.tr;if(r<=t)return n=n.delete(t,t+i.nodeSize),n=n.insert(r,i),e.dispatch(n),r;n=n.delete(t,t+i.nodeSize);let u=Math.min(r-i.nodeSize,n.doc.content.size);return n=n.insert(u,i),e.dispatch(n),Math.min(u,e.state.doc.content.size-1)}catch{return null}}export{d as commitImageFloatMove,c as commitImageInlineMove,l as commitImageResize,a as isFloatingImage};
|