fable-editor 1.2.7 → 1.3.0
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/angular/core/editor.d.ts +51 -1
- package/dist/angular/core/word-image-paste.d.ts +27 -0
- package/dist/angular/esm2022/core/editor.mjs +266 -20
- package/dist/angular/esm2022/core/word-image-paste.mjs +189 -0
- package/dist/angular/fesm2022/fable-editor.mjs +453 -19
- package/dist/angular/fesm2022/fable-editor.mjs.map +1 -1
- package/dist/core/editor.css +28 -1
- package/dist/core/editor.d.ts +51 -1
- package/dist/core/editor.d.ts.map +1 -1
- package/dist/core/index.cjs +4 -4
- package/dist/core/index.mjs +1008 -765
- package/dist/core/word-image-paste.d.ts +28 -0
- package/dist/core/word-image-paste.d.ts.map +1 -0
- package/dist/react/index.cjs +11 -11
- package/dist/react/index.mjs +1146 -903
- package/package.json +1 -1
- package/style.css +28 -1
|
@@ -17,7 +17,12 @@ export declare class FableEditor implements FableEditorApi {
|
|
|
17
17
|
private foreColor;
|
|
18
18
|
private backColor;
|
|
19
19
|
private openPop;
|
|
20
|
-
|
|
20
|
+
/** Stack of currently-open flyout submenus, shallowest first (e.g. for
|
|
21
|
+
* Table > Cell > Cell background: [Cell flyout, Cell background flyout]).
|
|
22
|
+
* A single slot isn't enough past one level deep - opening a 2nd-level
|
|
23
|
+
* flyout would remove the 1st-level one still needed to bridge visually
|
|
24
|
+
* back to the top-level popup, leaving a gap. */
|
|
25
|
+
private subStack;
|
|
21
26
|
private popAnchor;
|
|
22
27
|
private dlgOvl;
|
|
23
28
|
private tblActive;
|
|
@@ -118,6 +123,17 @@ export declare class FableEditor implements FableEditorApi {
|
|
|
118
123
|
private scheduleDraftSave;
|
|
119
124
|
private revisionDlg;
|
|
120
125
|
private closeSub;
|
|
126
|
+
/** Removes stacked flyouts from `level` (0 = shallowest) onward, keeping
|
|
127
|
+
* anything shallower - e.g. hovering a sibling item inside the "Cell"
|
|
128
|
+
* flyout should drop a deeper "Cell background" flyout but keep "Cell"
|
|
129
|
+
* itself and the top-level popup it bridges to. */
|
|
130
|
+
private closeSubFrom;
|
|
131
|
+
/** True if `node` is inside any currently-open flyout submenu (any depth). */
|
|
132
|
+
private subContains;
|
|
133
|
+
/** 0 for the top-level popup itself; otherwise this container's depth in
|
|
134
|
+
* the flyout stack + 1. Used to know how many deeper flyouts to close
|
|
135
|
+
* when opening or hovering within `container`. */
|
|
136
|
+
private subLevelOf;
|
|
121
137
|
private closePop;
|
|
122
138
|
private openSubFor;
|
|
123
139
|
private popup;
|
|
@@ -244,6 +260,26 @@ export declare class FableEditor implements FableEditorApi {
|
|
|
244
260
|
* so apps can route the file to S3 / Azure Blob / their own server. */
|
|
245
261
|
private uploadImageFile;
|
|
246
262
|
private replacePlaceholderWithImage;
|
|
263
|
+
/** Width of the editor's text column — the width `.earea img { max-width:100% }`
|
|
264
|
+
* clamps an oversized image to. */
|
|
265
|
+
private contentWidth;
|
|
266
|
+
/** Inserts an <img> through execCommand and stamps its size once it has decoded.
|
|
267
|
+
* A throwaway id is the only way to get a handle on what insertHTML created. */
|
|
268
|
+
private insertImageHTML;
|
|
269
|
+
/** Gives a newly inserted image an explicit size so it renders the same in the
|
|
270
|
+
* editor, in Preview and in a sent email. Without it the image only looks right
|
|
271
|
+
* inside `.earea`, whose `max-width:100%` rule exists nowhere else — which is why
|
|
272
|
+
* the same picture came out at a different size once the mail was sent.
|
|
273
|
+
* Leaves alone: images inside a template media slot (deliberately fluid) and any
|
|
274
|
+
* image that already carries a size from its source. */
|
|
275
|
+
private stampImageSize;
|
|
276
|
+
/** Sizes images in content that arrived from outside the editor — a document saved
|
|
277
|
+
* before the editor started recording image sizes. Without this such a document
|
|
278
|
+
* keeps rendering at one size here and another in a sent mail. Images that already
|
|
279
|
+
* carry a size, and template slots, are left alone, so content written by a
|
|
280
|
+
* current version passes through untouched. Emits one change after the images have
|
|
281
|
+
* settled rather than one per image, and none at all if nothing needed stamping. */
|
|
282
|
+
private stampExistingImages;
|
|
247
283
|
private positionImgPhCtx;
|
|
248
284
|
private pickVideo;
|
|
249
285
|
private vidPhHTML;
|
|
@@ -361,6 +397,20 @@ export declare class FableEditor implements FableEditorApi {
|
|
|
361
397
|
private refreshState;
|
|
362
398
|
private countWords;
|
|
363
399
|
private handlePaste;
|
|
400
|
+
/** Rich-HTML paste. Before the (untouched) paste engine runs, pictures Word left
|
|
401
|
+
* behind as unreadable file:// refs are pulled out of the clipboard's RTF flavor
|
|
402
|
+
* and inlined — the same pairing TinyMCE PowerPaste does for
|
|
403
|
+
* powerpaste_allow_local_images. Everything the engine already handled is
|
|
404
|
+
* unaffected: with no RTF, or no recoverable picture, the HTML reaches it
|
|
405
|
+
* byte-identical to before. */
|
|
406
|
+
private pasteRichHTML;
|
|
407
|
+
/** Hands recovered pictures to the host's imageUploadHandler when one is
|
|
408
|
+
* configured (PowerPaste's automatic_uploads equivalent), then inserts. Without a
|
|
409
|
+
* handler they stay inline base64, which is what PowerPaste does by default. */
|
|
410
|
+
private finishRichPaste;
|
|
411
|
+
/** `deferred` means the insert is happening after an async hop, so the caret the
|
|
412
|
+
* paste started from has to be put back first. */
|
|
413
|
+
private insertPastedHTML;
|
|
364
414
|
private initUI;
|
|
365
415
|
}
|
|
366
416
|
export default FableEditor;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** Decoded pictures in document order. A slot is null when the picture exists but
|
|
2
|
+
* cannot be turned into something the browser can show (a true vector metafile). */
|
|
3
|
+
export type RtfImages = (string | null)[];
|
|
4
|
+
/** Every picture in the RTF flavor, in document order. */
|
|
5
|
+
export declare function extractRtfImages(rtf: string): RtfImages;
|
|
6
|
+
export interface InjectResult {
|
|
7
|
+
html: string;
|
|
8
|
+
/** The data URIs this call put into the HTML, in the order they were used. Only
|
|
9
|
+
* these are candidates for the host's imageUploadHandler — data URIs that were
|
|
10
|
+
* already in the pasted HTML are left alone, so existing paste behaviour is
|
|
11
|
+
* unchanged. */
|
|
12
|
+
injected: string[];
|
|
13
|
+
}
|
|
14
|
+
/** Rewrites unusable <img src> values in raw pasted HTML with the pictures given, in
|
|
15
|
+
* document order. Images that already have a usable src are left alone and do not
|
|
16
|
+
* consume a slot, so a mixed paste (webmail image + Word image) stays aligned.
|
|
17
|
+
* Anything without a matching picture keeps its original tag. */
|
|
18
|
+
export declare function injectImages(html: string, imgs: RtfImages): InjectResult;
|
|
19
|
+
/** Pairs the HTML flavor of a Word paste with the pictures in its RTF flavor. */
|
|
20
|
+
export declare function injectRtfImages(html: string, rtf: string): InjectResult;
|
|
21
|
+
/** True when the cleaned HTML still holds images the engine could not resolve — used
|
|
22
|
+
* to decide whether a bitmap sitting in the clipboard is worth falling back to. */
|
|
23
|
+
export declare function countUnresolvedImages(html: string): number;
|
|
24
|
+
/** data: URI -> File, so recovered pictures can go through the host's
|
|
25
|
+
* imageUploadHandler exactly like a picked file does. `baseName` gets the extension
|
|
26
|
+
* that matches the URI's MIME type. */
|
|
27
|
+
export declare function dataUrlToFile(dataUrl: string, baseName: string): File | null;
|