svelte-rtf-editor 1.9.0 → 1.10.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.
@@ -2,8 +2,8 @@
2
2
  * HTML to RTF converter
3
3
  *
4
4
  * Walks a contenteditable DOM tree and produces a valid RTF 1.x string.
5
- * Supports: a document font and body size (Arial 12 pt by default, set with
6
- * RtfWriteOptions), bold, italic, underline, strikethrough, font sizes, headings
5
+ * Supports: a document font and body size (DEFAULT_FONT_FAMILY at DEFAULT_FONT_SIZE
6
+ * points by default, set with RtfWriteOptions), bold, italic, underline, strikethrough, font sizes, headings
7
7
  * (h1–h6), foreground colors (\cf), paragraphs with their alignment and indents,
8
8
  * bullet/numbered lists and lists inside them, blockquotes, code blocks,
9
9
  * hyperlinks, tables with merged cells, images (embedded as \pict picture groups
@@ -17,7 +17,7 @@
17
17
  export interface RtfWriteOptions {
18
18
  /**
19
19
  * Font for the whole document: body text, headings, lists and tables.
20
- * Code keeps a monospace font. Default: Arial.
20
+ * Code keeps a monospace font. Default: DEFAULT_FONT_FAMILY.
21
21
  */
22
22
  fontFamily?: string;
23
23
  /**
@@ -25,8 +25,13 @@ export interface RtfWriteOptions {
25
25
  */
26
26
  fontSize?: number;
27
27
  }
28
- /** Font used when no fontFamily is given. */
29
- export declare const DEFAULT_FONT_FAMILY = "Arial";
28
+ /**
29
+ * Font used when no fontFamily is given: what the editor and the viewer show, and what the RTF
30
+ * names. This is the one place the default is named; the size estimate, the components and the
31
+ * tests follow it. An application that wants another font does not change this: it passes
32
+ * `fontFamily` to the editor, to the viewer and to htmlToRtf.
33
+ */
34
+ export declare const DEFAULT_FONT_FAMILY = "Segoe UI";
30
35
  /** Body text size, in points, used when no fontSize is given. */
31
36
  export declare const DEFAULT_FONT_SIZE = 12;
32
37
  /**
@@ -65,8 +70,11 @@ export declare const LINK_COLOR: {
65
70
  * is negligible precisely when the number matters, and never more than a few
66
71
  * hundred bytes even when it does not. The output is ASCII, so bytes and
67
72
  * characters are the same number.
73
+ *
74
+ * Give it the options htmlToRtf is called with: a longer font name is part of the size, and so
75
+ * are the extra digits of a large body size.
68
76
  */
69
- export declare function estimateRtfBytes(editorEl: HTMLElement): number;
77
+ export declare function estimateRtfBytes(editorEl: HTMLElement, options?: RtfWriteOptions): number;
70
78
  /**
71
79
  * The address a link should carry in the RTF, or null if it should not be a link.
72
80
  *