svelte-rtf-editor 1.9.0 → 1.11.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 +135 -28
- package/dist/RtfViewer.svelte +7 -1
- package/dist/components/ImageOverlay.svelte +11 -3
- package/dist/components/ImageOverlay.svelte.d.ts +2 -0
- package/dist/components/InkEditor.svelte +683 -54
- package/dist/components/InkEditor.svelte.d.ts +16 -3
- package/dist/components/Modal.svelte +57 -3
- package/dist/components/Toolbar.svelte +44 -1
- package/dist/components/Toolbar.svelte.d.ts +5 -0
- package/dist/components/ToolbarButton.svelte +8 -2
- package/dist/components/ToolbarButton.svelte.d.ts +4 -0
- package/dist/images.d.ts +51 -5
- package/dist/images.js +242 -53
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/rtf-parser.js +666 -159
- package/dist/rtf-writer.d.ts +14 -6
- package/dist/rtf-writer.js +638 -183
- package/dist/sanitize.d.ts +99 -0
- package/dist/sanitize.js +789 -0
- package/dist/table-model.d.ts +10 -3
- package/dist/table-model.js +81 -17
- package/dist/utils.js +628 -169
- package/package.json +16 -12
package/dist/rtf-writer.d.ts
CHANGED
|
@@ -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 (
|
|
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:
|
|
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
|
-
/**
|
|
29
|
-
|
|
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
|
*
|