svelte-rtf-editor 1.8.2 → 1.9.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/README.md +96 -7
- package/dist/RtfViewer.svelte +63 -7
- package/dist/RtfViewer.svelte.d.ts +2 -1
- package/dist/components/InkEditor.svelte +61 -2
- package/dist/components/InkEditor.svelte.d.ts +2 -0
- package/dist/images.d.ts +9 -2
- package/dist/images.js +27 -7
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/rtf-parser.d.ts +16 -3
- package/dist/rtf-parser.js +1100 -457
- package/dist/rtf-writer.d.ts +27 -4
- package/dist/rtf-writer.js +659 -298
- package/dist/table-model.d.ts +42 -0
- package/dist/table-model.js +139 -0
- package/dist/utils.js +160 -17
- package/package.json +1 -1
package/dist/rtf-writer.d.ts
CHANGED
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Walks a contenteditable DOM tree and produces a valid RTF 1.x string.
|
|
5
5
|
* Supports: a document font and body size (Arial 12 pt by default, set with
|
|
6
|
-
* RtfWriteOptions), bold, italic, underline, strikethrough, font sizes
|
|
7
|
-
* foreground colors (\cf), paragraphs
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* RtfWriteOptions), bold, italic, underline, strikethrough, font sizes, headings
|
|
7
|
+
* (h1–h6), foreground colors (\cf), paragraphs with their alignment and indents,
|
|
8
|
+
* bullet/numbered lists and lists inside them, blockquotes, code blocks,
|
|
9
|
+
* hyperlinks, tables with merged cells, images (embedded as \pict picture groups
|
|
10
|
+
* with their captions), horizontal rules, page breaks, line breaks, and Unicode
|
|
11
|
+
* characters.
|
|
10
12
|
*
|
|
11
13
|
* Background color is intentionally not written — RTF highlight support
|
|
12
14
|
* is inconsistent across viewers (TextEdit uses \AppleHighlight, not \highlight).
|
|
@@ -36,6 +38,21 @@ export declare const HEADING_SCALE: {
|
|
|
36
38
|
readonly h2: 1.5;
|
|
37
39
|
readonly h3: number;
|
|
38
40
|
};
|
|
41
|
+
/**
|
|
42
|
+
* Code blocks are set slightly smaller than the body: 10 pt at 12 pt. The parser reads a code
|
|
43
|
+
* block back by the same ratio.
|
|
44
|
+
*/
|
|
45
|
+
export declare const PRE_SCALE: number;
|
|
46
|
+
/**
|
|
47
|
+
* The color of link text. A document with a link carries it as the first entry of its color
|
|
48
|
+
* table, so a link can be told from underlined text; the parser drops it again inside a link,
|
|
49
|
+
* where the <a> already says it.
|
|
50
|
+
*/
|
|
51
|
+
export declare const LINK_COLOR: {
|
|
52
|
+
readonly r: 0;
|
|
53
|
+
readonly g: 0;
|
|
54
|
+
readonly b: 255;
|
|
55
|
+
};
|
|
39
56
|
/**
|
|
40
57
|
* Size htmlToRtf would produce, without doing the conversion.
|
|
41
58
|
*
|
|
@@ -63,6 +80,12 @@ export declare function estimateRtfBytes(editorEl: HTMLElement): number;
|
|
|
63
80
|
export declare function linkTarget(url: string): string | null;
|
|
64
81
|
/** Whether a link address is an absolute web, mail or phone address (see linkTarget). */
|
|
65
82
|
export declare function isSafeLinkUrl(url: string): boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Whether a font name is a monospace font's: Courier New, Consolas, Menlo, a "… Mono" family
|
|
85
|
+
* (Roboto Mono, DejaVu Sans Mono), and their PostScript names (CourierNewPSMT, SFMono-Regular).
|
|
86
|
+
* Monotype Corsiva is not one, and neither is American Typewriter, which is proportional.
|
|
87
|
+
*/
|
|
88
|
+
export declare function isMonospaceFontName(name: string): boolean;
|
|
66
89
|
/**
|
|
67
90
|
* CSS font-family value for a font name, with the generic fallback that
|
|
68
91
|
* matches it, e.g. "Arial", sans-serif.
|