editium 1.0.1 → 1.1.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 +7 -4
- package/dist/Toolbar.d.ts +8 -0
- package/dist/docxUtils.d.ts +19 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +101015 -2844
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +101048 -2874
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +3 -1
- package/dist/utils.d.ts +1 -0
- package/package.json +110 -105
- package/vanilla/README.md +11 -9
- package/vanilla/build-bundle.js +2 -2
- package/vanilla/editium.bundle.js +32 -32
- package/vanilla/editium.css +22 -0
- package/vanilla/editium.js +842 -15
- package/vanilla/example/index.html +1 -0
- package/vanilla/node_modules/.package-lock.json +7 -0
- package/vanilla/package-lock.json +13 -0
- package/vanilla/package.json +1 -1
package/README.md
CHANGED
|
@@ -47,6 +47,8 @@ function App() {
|
|
|
47
47
|
}
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
+
**[See live demo →](https://editium.vercel.app/)**
|
|
51
|
+
|
|
50
52
|
### Vanilla JavaScript
|
|
51
53
|
|
|
52
54
|
**Single file - no build step required:**
|
|
@@ -55,7 +57,7 @@ function App() {
|
|
|
55
57
|
<!DOCTYPE html>
|
|
56
58
|
<html>
|
|
57
59
|
<head>
|
|
58
|
-
<script src="https://unpkg.com/editium
|
|
60
|
+
<script src="https://unpkg.com/editium/vanilla/editium.bundle.js"></script>
|
|
59
61
|
</head>
|
|
60
62
|
<body>
|
|
61
63
|
<div id="editor"></div>
|
|
@@ -71,7 +73,7 @@ function App() {
|
|
|
71
73
|
</html>
|
|
72
74
|
```
|
|
73
75
|
|
|
74
|
-
**[See live demo →](https://
|
|
76
|
+
**[See live demo →](https://codepen.io/nabarup-duplicate/pen/WbrKdpj)**
|
|
75
77
|
|
|
76
78
|
---
|
|
77
79
|
|
|
@@ -119,7 +121,7 @@ npm install react react-dom
|
|
|
119
121
|
|
|
120
122
|
**CDN (Vanilla JS):**
|
|
121
123
|
```html
|
|
122
|
-
<script src="https://unpkg.com/editium
|
|
124
|
+
<script src="https://unpkg.com/editium/vanilla/editium.bundle.js"></script>
|
|
123
125
|
```
|
|
124
126
|
|
|
125
127
|
---
|
|
@@ -179,7 +181,7 @@ function Editor() {
|
|
|
179
181
|
**CDN (Recommended)**
|
|
180
182
|
|
|
181
183
|
```html
|
|
182
|
-
<script src="https://unpkg.com/editium
|
|
184
|
+
<script src="https://unpkg.com/editium/vanilla/editium.bundle.js"></script>
|
|
183
185
|
|
|
184
186
|
<div id="editor"></div>
|
|
185
187
|
|
|
@@ -381,6 +383,7 @@ new Editium({
|
|
|
381
383
|
**Get Help**
|
|
382
384
|
- [GitHub Issues](https://github.com/NabarupDev/Editium/issues) - Bug reports and feature requests
|
|
383
385
|
- [GitHub Discussions](https://github.com/NabarupDev/Editium/discussions) - Questions and community support
|
|
386
|
+
- Security: See `SECURITY.md` for responsible disclosure and contact instructions
|
|
384
387
|
|
|
385
388
|
**Contributing**
|
|
386
389
|
|
package/dist/Toolbar.d.ts
CHANGED
|
@@ -26,6 +26,14 @@ interface ToolbarProps {
|
|
|
26
26
|
onCurrentMatchIndexChange?: (index: number) => void;
|
|
27
27
|
isFullscreen?: boolean;
|
|
28
28
|
onFullscreenToggle?: () => void;
|
|
29
|
+
onImportDocx?: (file: File) => void;
|
|
30
|
+
onExportDocx?: () => void;
|
|
31
|
+
onExportPdf?: () => void;
|
|
32
|
+
importStatus?: {
|
|
33
|
+
type: 'success' | 'error' | 'info';
|
|
34
|
+
message: string;
|
|
35
|
+
} | null;
|
|
36
|
+
onClearImportStatus?: () => void;
|
|
29
37
|
}
|
|
30
38
|
declare const Toolbar: React.FC<ToolbarProps>;
|
|
31
39
|
export default Toolbar;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CustomElement } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Import a .docx file and convert it to Slate nodes
|
|
4
|
+
* @param file - The .docx file to import
|
|
5
|
+
* @returns Promise resolving to an array of Slate CustomElements
|
|
6
|
+
*/
|
|
7
|
+
export declare const importFromDocx: (file: File) => Promise<CustomElement[]>;
|
|
8
|
+
/**
|
|
9
|
+
* Export Slate nodes to a .docx file
|
|
10
|
+
* @param nodes - Array of Slate CustomElements
|
|
11
|
+
* @param filename - The filename for the exported file (default: 'document.docx')
|
|
12
|
+
*/
|
|
13
|
+
export declare const exportToDocx: (nodes: CustomElement[], filename?: string) => Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Export Slate nodes to a PDF file
|
|
16
|
+
* @param nodes - Array of Slate CustomElements
|
|
17
|
+
* @param filename - The filename for the exported file (default: 'document.pdf')
|
|
18
|
+
*/
|
|
19
|
+
export declare const exportToPdf: (nodes: CustomElement[], filename?: string) => Promise<void>;
|
package/dist/index.d.ts
CHANGED
|
@@ -4,3 +4,4 @@ export { TableComponent, TableRowComponent, TableCellComponent } from './TableEl
|
|
|
4
4
|
export type { EditiumProps, CustomElement, CustomText, LinkElement, ImageElement, TableElement, TableRowElement, TableCellElement, FormatType, BlockType, ToolbarItem, } from './types';
|
|
5
5
|
export { ALL_TOOLBAR_ITEMS, } from './types';
|
|
6
6
|
export { serializeToHtml, defaultInitialValue, isMarkActive, isBlockActive, toggleMark, toggleBlock, insertLink, isLinkActive, insertTable, addTableRow, removeTableRow, addTableColumn, removeTableColumn, isInTable, setTableAlignment, findAllMatches, navigateToMatch, replaceMatch, replaceAllMatches, } from './utils';
|
|
7
|
+
export { importFromDocx, exportToDocx, exportToPdf, } from './docxUtils';
|