erl-mathtextx-editor 0.2.4 → 0.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/CHANGELOG.md +61 -3
- package/README.md +90 -1
- package/dist/{CellPropertiesDialogImpl-CXCZM3NM.js → CellPropertiesDialogImpl-DroCD-qw.js} +1 -1
- package/dist/{ImageInsertDialog-bvVbmn5d.js → ImageInsertDialog-BprAxxIR.js} +1 -1
- package/dist/{InsertTableDialogImpl-DtB4WswI.js → InsertTableDialogImpl-U7g8UMBM.js} +1 -1
- package/dist/{LinkDialogImpl-JAK21VVR.js → LinkDialogImpl-Cs1v0Vgd.js} +1 -1
- package/dist/MathTextXEditor.d.ts +1 -1
- package/dist/{TablePropertiesDialogImpl-CS01MOsn.js → TablePropertiesDialogImpl-BmdThHz3.js} +1 -1
- package/dist/{TableTemplatesDialogImpl-Be0HjzRg.js → TableTemplatesDialogImpl-CglXYCPV.js} +1 -1
- package/dist/assets/erl-mathtextx-editor.css +1 -1
- package/dist/components/TableMenu.d.ts +6 -1
- package/dist/core/extensions.d.ts +2 -6
- package/dist/erl-mathtextx-editor.js +1 -1
- package/dist/{index-ABpo9sfg.js → index-7QYcLP1s.js} +2531 -2404
- package/dist/{index-Dfokkug6.js → index-Cv7EVaSA.js} +1 -1
- package/dist/{index-9ZbVThzh.js → index-DLjIKZ3J.js} +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/utils/pasteHandler.d.ts +33 -5
- package/package.json +1 -1
- package/dist/erl-mathtextx-editor.umd.cjs +0 -3748
package/dist/types/index.d.ts
CHANGED
|
@@ -43,6 +43,8 @@ export interface MathTextXEditorProps {
|
|
|
43
43
|
onImageUpload?: (file: File) => Promise<string>;
|
|
44
44
|
/** Transform HTML before pasting — e.g. re-upload images in pasted content */
|
|
45
45
|
onBeforePasteHTML?: (html: string) => Promise<string>;
|
|
46
|
+
/** Table styling mode: 'custom' uses mtx-table CSS themes, 'native' uses plain TipTap/ProseMirror table */
|
|
47
|
+
tableStyle?: 'custom' | 'native';
|
|
46
48
|
}
|
|
47
49
|
/** Toolbar button config */
|
|
48
50
|
export interface ToolbarButtonConfig {
|
|
@@ -1,8 +1,30 @@
|
|
|
1
1
|
import { Editor } from '@tiptap/react';
|
|
2
2
|
/**
|
|
3
|
-
* Clean Microsoft Office specific HTML content
|
|
3
|
+
* Clean Microsoft Office specific HTML content.
|
|
4
|
+
*
|
|
5
|
+
* Runs AFTER `cleanGeneralHTML` so document wrappers, comments, <style>,
|
|
6
|
+
* <meta>, <link>, <script>, and <html>/<head>/<body> are already gone.
|
|
7
|
+
*
|
|
8
|
+
* Handles:
|
|
9
|
+
* - XML namespace attributes (xmlns:w, xmlns:m, xmlns:o, xmlns:v, bare xmlns)
|
|
10
|
+
* - Office namespace tags (<o:…>, <w:…>, <v:…>, <m:…>)
|
|
11
|
+
* - Mso-* classes (comprehensive)
|
|
12
|
+
* - Mso-* inline style properties (in double AND single quotes)
|
|
13
|
+
* - mso-spacerun:yes empty spacer spans
|
|
14
|
+
* - lang="EN-US" / lang=EN-US
|
|
15
|
+
* - href/src with file:/// temp paths
|
|
16
|
+
* - Office numbered list styles
|
|
17
|
+
* - Empty paragraphs from Word
|
|
4
18
|
*/
|
|
5
19
|
export declare function cleanOfficeHTML(html: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* Clean general / unspecified HTML content — applies to pastes from
|
|
22
|
+
* regular websites and any other source that isn't Office or Google Docs.
|
|
23
|
+
*
|
|
24
|
+
* Strips document-level metadata, empty wrappers, and comments so the
|
|
25
|
+
* remaining content is as clean as possible before DOMPurify sanitization.
|
|
26
|
+
*/
|
|
27
|
+
export declare function cleanGeneralHTML(html: string): string;
|
|
6
28
|
/**
|
|
7
29
|
* Clean Google Docs specific HTML content.
|
|
8
30
|
*
|
|
@@ -15,11 +37,17 @@ export declare function cleanOfficeHTML(html: string): string;
|
|
|
15
37
|
*/
|
|
16
38
|
export declare function cleanGoogleDocsHTML(html: string): string;
|
|
17
39
|
/**
|
|
18
|
-
* Handle paste event
|
|
40
|
+
* Handle paste event — intercepts ALL HTML pastes for consistent cleaning,
|
|
41
|
+
* source-specific processing (Office / Google Docs), image re-upload, and
|
|
42
|
+
* XSS sanitization.
|
|
43
|
+
*
|
|
44
|
+
* Pipeline for every paste:
|
|
45
|
+
* 1. `cleanGeneralHTML` — strip wrappers, metadata, scripts, comments
|
|
46
|
+
* 2. Source-specific cleaning (Office or Google Docs)
|
|
47
|
+
* 3. `transformHTML` callback — e.g. re-upload base64/external images
|
|
48
|
+
* 4. DOMPurify sanitization (XSS prevention)
|
|
19
49
|
*
|
|
20
|
-
*
|
|
21
|
-
* the callback is invoked asynchronously to transform the HTML (e.g. re-upload
|
|
22
|
-
* images) before inserting into the editor.
|
|
50
|
+
* Plain text paste (no HTML) is left to ProseMirror's default handler.
|
|
23
51
|
*/
|
|
24
52
|
export declare function handlePaste(editor: Editor, event: ClipboardEvent, transformHTML?: (html: string) => Promise<string>): boolean;
|
|
25
53
|
/**
|
package/package.json
CHANGED