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/dist/types.d.ts CHANGED
@@ -2,7 +2,7 @@ import { BaseElement, BaseText } from 'slate';
2
2
  export type FormatType = 'bold' | 'italic' | 'underline' | 'code' | 'strikethrough' | 'superscript' | 'subscript';
3
3
  export type AlignmentType = 'left' | 'center' | 'right' | 'justify';
4
4
  export type BlockType = 'paragraph' | 'heading-one' | 'heading-two' | 'heading-three' | 'heading-four' | 'heading-five' | 'heading-six' | 'heading-seven' | 'heading-eight' | 'bulleted-list' | 'numbered-list' | 'list-item' | 'blockquote' | 'code-block' | 'horizontal-rule' | 'image' | 'table' | 'table-row' | 'table-cell';
5
- export type ToolbarItem = FormatType | BlockType | AlignmentType | 'link' | 'indent' | 'outdent' | 'undo' | 'redo' | 'separator' | 'view-output' | 'text-color' | 'bg-color' | 'table' | 'find-replace' | 'fullscreen';
5
+ export type ToolbarItem = FormatType | BlockType | AlignmentType | 'link' | 'indent' | 'outdent' | 'undo' | 'redo' | 'separator' | 'view-output' | 'text-color' | 'bg-color' | 'table' | 'find-replace' | 'fullscreen' | 'import-docx' | 'export-docx' | 'export-pdf' | 'emoji';
6
6
  export declare const ALL_TOOLBAR_ITEMS: ToolbarItem[];
7
7
  export interface CustomElement extends BaseElement {
8
8
  type: BlockType;
@@ -84,6 +84,8 @@ export interface EditiumProps {
84
84
  currentMatchIndex?: number;
85
85
  /** Whether to show word count. Default: true */
86
86
  showWordCount?: boolean;
87
+ /** Whether to show .docx import/export buttons. Default: false */
88
+ showDocxImportExport?: boolean;
87
89
  /** Editor height. Default: '200px' */
88
90
  height?: string | number;
89
91
  /** Minimum editor height. Default: '150px' */
package/dist/utils.d.ts CHANGED
@@ -14,6 +14,7 @@ export declare const getActiveBackgroundColor: (editor: Editor) => string | null
14
14
  export declare const toggleBlock: (editor: Editor, format: BlockType) => void;
15
15
  export declare const insertHorizontalRule: (editor: Editor) => void;
16
16
  export declare const insertImage: (editor: Editor, url: string, alt?: string, width?: number) => void;
17
+ export declare const insertEmoji: (editor: Editor, emoji: string) => void;
17
18
  export declare const isValidImageUrl: (url: string) => boolean;
18
19
  export declare const insertLink: (editor: Editor, url: string, title?: string, target?: "_blank" | "_self") => void;
19
20
  export declare const isLinkActive: (editor: Editor) => boolean;
package/package.json CHANGED
@@ -1,105 +1,110 @@
1
- {
2
- "name": "editium",
3
- "version": "1.0.1",
4
- "type": "module",
5
- "description": "A powerful and feature-rich React rich text editor component built with Slate.js, featuring comprehensive formatting options, tables, images, find & replace, and more",
6
- "main": "dist/index.js",
7
- "module": "dist/index.esm.js",
8
- "types": "dist/index.d.ts",
9
- "files": [
10
- "dist",
11
- "vanilla",
12
- "README.md",
13
- "LICENSE"
14
- ],
15
- "scripts": {
16
- "build": "rollup -c",
17
- "build:watch": "rollup -c -w",
18
- "dev": "npm run build:watch",
19
- "example": "cd example && npm start",
20
- "prepublishOnly": "npm run build",
21
- "test": "vitest run",
22
- "test:watch": "vitest",
23
- "test:ui": "vitest --ui",
24
- "test:coverage": "vitest run --coverage",
25
- "semantic-release": "semantic-release"
26
- },
27
- "keywords": [
28
- "react",
29
- "editor",
30
- "rich-text",
31
- "slate",
32
- "wysiwyg",
33
- "text-editor",
34
- "contenteditable",
35
- "markdown",
36
- "formatting",
37
- "tables",
38
- "images",
39
- "find-replace",
40
- "fullscreen",
41
- "word-count",
42
- "character-count",
43
- "slate-editor",
44
- "react-editor",
45
- "text-formatting",
46
- "content-editor",
47
- "document-editor"
48
- ],
49
- "author": {
50
- "name": "NabarupDev",
51
- "url": "https://github.com/NabarupDev"
52
- },
53
- "repository": {
54
- "type": "git",
55
- "url": "https://github.com/NabarupDev/Editium.git"
56
- },
57
- "bugs": {
58
- "url": "https://github.com/NabarupDev/Editium/issues"
59
- },
60
- "homepage": "https://github.com/NabarupDev/Editium#readme",
61
- "license": "MIT",
62
- "peerDependencies": {
63
- "react": ">=16.8.0",
64
- "react-dom": ">=16.8.0"
65
- },
66
- "dependencies": {
67
- "@heroicons/react": "^2.2.0",
68
- "slate": "^0.103.0",
69
- "slate-history": "^0.100.0",
70
- "slate-react": "^0.108.0"
71
- },
72
- "devDependencies": {
73
- "@rollup/plugin-commonjs": "^25.0.7",
74
- "@rollup/plugin-node-resolve": "^15.2.3",
75
- "@rollup/plugin-typescript": "^11.1.5",
76
- "@semantic-release/changelog": "^6.0.3",
77
- "@semantic-release/git": "^10.0.1",
78
- "@semantic-release/github": "^11.0.6",
79
- "@testing-library/jest-dom": "^6.9.1",
80
- "@testing-library/react": "^16.3.0",
81
- "@testing-library/user-event": "^14.6.1",
82
- "@types/react": "^18.2.45",
83
- "@types/react-dom": "^18.2.18",
84
- "@vitejs/plugin-react": "^5.0.4",
85
- "@vitest/ui": "^3.2.4",
86
- "conventional-changelog-conventionalcommits": "^9.1.0",
87
- "jsdom": "^27.0.0",
88
- "react": "^18.2.0",
89
- "react-dom": "^18.2.0",
90
- "rollup": "^4.9.1",
91
- "rollup-plugin-peer-deps-external": "^2.2.4",
92
- "rollup-plugin-postcss": "^4.0.2",
93
- "semantic-release": "^24.2.9",
94
- "tslib": "^2.8.1",
95
- "typescript": "^5.3.3",
96
- "vitest": "^3.2.4"
97
- },
98
- "engines": {
99
- "node": ">=14.0.0",
100
- "npm": ">=6.0.0"
101
- },
102
- "publishConfig": {
103
- "access": "public"
104
- }
105
- }
1
+ {
2
+ "name": "editium",
3
+ "version": "1.1.0",
4
+ "type": "module",
5
+ "description": "A powerful and feature-rich React rich text editor component built with Slate.js, featuring comprehensive formatting options, tables, images, find & replace, and more",
6
+ "main": "dist/index.js",
7
+ "module": "dist/index.esm.js",
8
+ "types": "dist/index.d.ts",
9
+ "files": [
10
+ "dist",
11
+ "vanilla",
12
+ "README.md",
13
+ "LICENSE"
14
+ ],
15
+ "scripts": {
16
+ "build": "rollup -c",
17
+ "build:watch": "rollup -c -w",
18
+ "dev": "npm run build:watch",
19
+ "example": "cd example && npm start",
20
+ "prepublishOnly": "npm run build",
21
+ "test": "vitest run",
22
+ "test:watch": "vitest",
23
+ "test:ui": "vitest --ui",
24
+ "test:coverage": "vitest run --coverage",
25
+ "semantic-release": "semantic-release"
26
+ },
27
+ "keywords": [
28
+ "react",
29
+ "editor",
30
+ "rich-text",
31
+ "slate",
32
+ "wysiwyg",
33
+ "text-editor",
34
+ "contenteditable",
35
+ "markdown",
36
+ "formatting",
37
+ "tables",
38
+ "images",
39
+ "find-replace",
40
+ "fullscreen",
41
+ "word-count",
42
+ "character-count",
43
+ "slate-editor",
44
+ "react-editor",
45
+ "text-formatting",
46
+ "content-editor",
47
+ "document-editor"
48
+ ],
49
+ "author": {
50
+ "name": "NabarupDev",
51
+ "url": "https://github.com/NabarupDev"
52
+ },
53
+ "repository": {
54
+ "type": "git",
55
+ "url": "https://github.com/NabarupDev/Editium.git"
56
+ },
57
+ "bugs": {
58
+ "url": "https://github.com/NabarupDev/Editium/issues"
59
+ },
60
+ "homepage": "https://github.com/NabarupDev/Editium#readme",
61
+ "license": "MIT",
62
+ "peerDependencies": {
63
+ "react": ">=16.8.0",
64
+ "react-dom": ">=16.8.0"
65
+ },
66
+ "dependencies": {
67
+ "@heroicons/react": "^2.2.0",
68
+ "docx": "^9.5.1",
69
+ "emoji-picker-react": "^4.18.0",
70
+ "html2canvas": "^1.4.1",
71
+ "jspdf": "^3.0.3",
72
+ "mammoth": "^1.11.0",
73
+ "slate": "^0.103.0",
74
+ "slate-history": "^0.100.0",
75
+ "slate-react": "^0.108.0"
76
+ },
77
+ "devDependencies": {
78
+ "@rollup/plugin-commonjs": "^25.0.7",
79
+ "@rollup/plugin-node-resolve": "^15.2.3",
80
+ "@rollup/plugin-typescript": "^11.1.5",
81
+ "@semantic-release/changelog": "^6.0.3",
82
+ "@semantic-release/git": "^10.0.1",
83
+ "@semantic-release/github": "^11.0.6",
84
+ "@testing-library/jest-dom": "^6.9.1",
85
+ "@testing-library/react": "^16.3.0",
86
+ "@testing-library/user-event": "^14.6.1",
87
+ "@types/react": "^18.2.45",
88
+ "@types/react-dom": "^18.2.18",
89
+ "@vitejs/plugin-react": "^5.0.4",
90
+ "@vitest/ui": "^3.2.4",
91
+ "conventional-changelog-conventionalcommits": "^9.1.0",
92
+ "jsdom": "^27.0.0",
93
+ "react": "^18.2.0",
94
+ "react-dom": "^18.2.0",
95
+ "rollup": "^4.9.1",
96
+ "rollup-plugin-peer-deps-external": "^2.2.4",
97
+ "rollup-plugin-postcss": "^4.0.2",
98
+ "semantic-release": "^24.2.9",
99
+ "tslib": "^2.8.1",
100
+ "typescript": "^5.3.3",
101
+ "vitest": "^3.2.4"
102
+ },
103
+ "engines": {
104
+ "node": ">=14.0.0",
105
+ "npm": ">=6.0.0"
106
+ },
107
+ "publishConfig": {
108
+ "access": "public"
109
+ }
110
+ }
package/vanilla/README.md CHANGED
@@ -22,27 +22,29 @@ A lightweight, powerful rich text editor built with pure vanilla JavaScript. Zer
22
22
  **Single Bundle** - All-in-one file including JavaScript, CSS, and icons:
23
23
 
24
24
  ```html
25
- <script src="https://unpkg.com/editium@1.0.0/vanilla/editium.bundle.js"></script>
25
+ <script src="https://unpkg.com/editium/vanilla/editium.bundle.js"></script>
26
26
  ```
27
27
 
28
28
  **Alternative CDNs:**
29
29
  ```html
30
30
  <!-- jsDelivr -->
31
- <script src="https://cdn.jsdelivr.net/npm/editium@1.0.0/vanilla/editium.bundle.js"></script>
31
+ <script src="https://cdn.jsdelivr.net/npm/editium/vanilla/editium.bundle.js"></script>
32
32
  ```
33
33
 
34
34
  **Separate Files** - For more control:
35
35
 
36
36
  ```html
37
37
  <!-- unpkg -->
38
- <link rel="stylesheet" href="https://unpkg.com/editium@1.0.0/vanilla/editium.css">
38
+ <link rel="stylesheet" href="https://unpkg.com/editium/vanilla/editium.css">
39
39
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css">
40
- <script src="https://unpkg.com/editium@1.0.0/vanilla/editium.js"></script>
40
+ <script type="module" src="https://cdn.jsdelivr.net/npm/emoji-picker-element@^1/index.js"></script>
41
+ <script src="https://unpkg.com/editium/vanilla/editium.js"></script>
41
42
 
42
43
  <!-- jsDelivr -->
43
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/editium@1.0.0/vanilla/editium.css">
44
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/editium/vanilla/editium.css">
44
45
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css">
45
- <script src="https://cdn.jsdelivr.net/npm/editium@1.0.0/vanilla/editium.js"></script>
46
+ <script type="module" src="https://cdn.jsdelivr.net/npm/emoji-picker-element@^1/index.js"></script>
47
+ <script src="https://cdn.jsdelivr.net/npm/editium/vanilla/editium.js"></script>
46
48
  ```
47
49
 
48
50
  ### NPM
@@ -80,7 +82,7 @@ Download the files from the [GitHub repository](https://github.com/NabarupDev/Ed
80
82
  <meta charset="UTF-8">
81
83
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
82
84
  <title>Editium Editor</title>
83
- <script src="https://unpkg.com/editium@1.0.0/vanilla/editium.bundle.js"></script>
85
+ <script src="https://unpkg.com/editium/vanilla/editium.bundle.js"></script>
84
86
  </head>
85
87
  <body>
86
88
  <div id="editor"></div>
@@ -393,8 +395,8 @@ Custom styling example:
393
395
  - **NPM Package**: https://www.npmjs.com/package/editium
394
396
  - **GitHub Repository**: https://github.com/NabarupDev/Editium
395
397
  - **Issues**: https://github.com/NabarupDev/Editium/issues
396
- - **unpkg CDN**: https://unpkg.com/editium@1.0.0/vanilla/
397
- - **jsDelivr CDN**: https://cdn.jsdelivr.net/npm/editium@1.0.0/vanilla/
398
+ - **unpkg CDN**: https://unpkg.com/editium/vanilla/
399
+ - **jsDelivr CDN**: https://cdn.jsdelivr.net/npm/editium/vanilla/
398
400
 
399
401
  ## License
400
402
 
@@ -7,7 +7,7 @@ const fontAwesomeCSS = '@import url("https://cdnjs.cloudflare.com/ajax/libs/font
7
7
 
8
8
  const bundledContent = `/**
9
9
  * Editium - Vanilla JavaScript Rich Text Editor (Bundled Version)
10
- * Version: 1.0.0 | License: MIT
10
+ * Version: 1.0.1 | License: MIT
11
11
  * Single file bundle - includes CSS and Font Awesome icons
12
12
  */
13
13
 
@@ -19,7 +19,7 @@ const bundledContent = `/**
19
19
 
20
20
  const styleElement = document.createElement('style');
21
21
  styleElement.id = 'editium-styles';
22
- styleElement.textContent = \`${fontAwesomeCSS}\n\n${cssContent.replace(/`/g, '\\`').replace(/\$/g, '\\$')}\`;
22
+ styleElement.textContent = \`${fontAwesomeCSS}\n\n${cssContent.replace(/\\/g, '\\\\').replace(/`/g, '\\`').replace(/\$/g, '\\$')}\`;
23
23
  document.head.appendChild(styleElement);
24
24
  }
25
25
 
@@ -1,19 +1,19 @@
1
- /**
2
- * Editium - Vanilla JavaScript Rich Text Editor (Bundled Version)
3
- * Version: 1.0.0 | License: MIT
4
- * Single file bundle - includes CSS and Font Awesome icons
5
- */
6
-
7
- (function() {
8
- 'use strict';
9
-
10
- function injectStyles() {
11
- if (typeof document === 'undefined' || document.getElementById('editium-styles')) return;
12
-
13
- const styleElement = document.createElement('style');
14
- styleElement.id = 'editium-styles';
15
- styleElement.textContent = `@import url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css");
16
-
1
+ /**
2
+ * Editium - Vanilla JavaScript Rich Text Editor (Bundled Version)
3
+ * Version: 1.0.1 | License: MIT
4
+ * Single file bundle - includes CSS and Font Awesome icons
5
+ */
6
+
7
+ (function() {
8
+ 'use strict';
9
+
10
+ function injectStyles() {
11
+ if (typeof document === 'undefined' || document.getElementById('editium-styles')) return;
12
+
13
+ const styleElement = document.createElement('style');
14
+ styleElement.id = 'editium-styles';
15
+ styleElement.textContent = `@import url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css");
16
+
17
17
  /**
18
18
  * Editium - Vanilla JavaScript Rich Text Editor Styles
19
19
  * Matches the React version UI
@@ -786,16 +786,16 @@ body.editium-fullscreen-active {
786
786
  padding: 0;
787
787
  }
788
788
  }
789
- `;
790
- document.head.appendChild(styleElement);
791
- }
792
-
793
- if (document.readyState === 'loading') {
794
- document.addEventListener('DOMContentLoaded', injectStyles);
795
- } else {
796
- injectStyles();
797
- }
798
-
789
+ `;
790
+ document.head.appendChild(styleElement);
791
+ }
792
+
793
+ if (document.readyState === 'loading') {
794
+ document.addEventListener('DOMContentLoaded', injectStyles);
795
+ } else {
796
+ injectStyles();
797
+ }
798
+
799
799
  class Editium {
800
800
  constructor(options = {}) {
801
801
  this.container = options.container;
@@ -3249,9 +3249,9 @@ body.editium-fullscreen-active {
3249
3249
  if (typeof window !== 'undefined') {
3250
3250
  window.Editium = Editium;
3251
3251
  }
3252
-
3253
-
3254
- if (typeof module !== 'undefined' && module.exports) module.exports = Editium;
3255
- if (typeof window !== 'undefined') window.Editium = Editium;
3256
-
3257
- })();
3252
+
3253
+
3254
+ if (typeof module !== 'undefined' && module.exports) module.exports = Editium;
3255
+ if (typeof window !== 'undefined') window.Editium = Editium;
3256
+
3257
+ })();
@@ -770,3 +770,25 @@ body.editium-fullscreen-active {
770
770
  padding: 0;
771
771
  }
772
772
  }
773
+ /* Emoji Picker Styles */
774
+ .editium-emoji-picker {
775
+ width: 350px;
776
+ height: 420px;
777
+ }
778
+
779
+ .editium-emoji-picker emoji-picker {
780
+ width: 100%;
781
+ height: 100%;
782
+ --border-color: #e0e0e0;
783
+ --border-radius: 8px;
784
+ --background: #fff;
785
+ --category-font-size: 1rem;
786
+ --emoji-size: 1.4rem;
787
+ --indicator-color: #007bff;
788
+ --input-border-color: #ddd;
789
+ --input-border-radius: 6px;
790
+ --input-font-size: 13px;
791
+ --input-padding: 8px 10px;
792
+ --num-columns: 8;
793
+ --outline-color: #007bff;
794
+ }