fable-editor 1.2.8 → 1.3.1

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.
@@ -260,6 +260,26 @@ export declare class FableEditor implements FableEditorApi {
260
260
  * so apps can route the file to S3 / Azure Blob / their own server. */
261
261
  private uploadImageFile;
262
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;
263
283
  private positionImgPhCtx;
264
284
  private pickVideo;
265
285
  private vidPhHTML;
@@ -377,6 +397,20 @@ export declare class FableEditor implements FableEditorApi {
377
397
  private refreshState;
378
398
  private countWords;
379
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;
380
414
  private initUI;
381
415
  }
382
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;