leksy-editor 1.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Meta Platforms, Inc. and affiliates.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,173 @@
1
+ # Leksy Editor
2
+
3
+ Leksy Editor is an alternative to traditional WYSIWYG editors, designed primarily for creating mail templates, blogs, and documents without any content manipulation.
4
+
5
+ ## Features
6
+ - Supports React, Vue, and Vanilla JavaScript applications.
7
+ - Rich plugin system for extended functionalities.
8
+ - Customizable CSS variables for multiple themes and modes.
9
+ - Mention system with category-based labels.
10
+
11
+ ## Installation
12
+
13
+ ```sh
14
+ npm install leksy-editor
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ ### React Example
20
+
21
+ ```jsx
22
+ import LeksyEditor from 'leksy-editor';
23
+ import { useEffect, useRef } from 'react';
24
+
25
+ function App() {
26
+ const editorRef = useRef(null);
27
+ const editor = useRef(null);
28
+
29
+ useEffect(() => {
30
+ editor.current = LeksyEditor.create(editorRef.current, {
31
+ plugins: [/* plugin list here */],
32
+ // Other options
33
+ });
34
+ }, []);
35
+
36
+ return <div ref={editorRef} />;
37
+ }
38
+ ```
39
+
40
+ ### Vue Example
41
+
42
+ ```js
43
+ import { createApp, ref, onMounted } from 'vue';
44
+ import LeksyEditor from 'leksy-editor';
45
+
46
+ const app = createApp({
47
+ setup() {
48
+ const editor = ref(null);
49
+
50
+ onMounted(() => {
51
+ const editorElement = document.getElementById('editor');
52
+ editor.value = LeksyEditor.create(editorElement, {
53
+ plugins: [/* plugin list here */],
54
+ // Other options
55
+ });
56
+ });
57
+
58
+ return { editor };
59
+ },
60
+ template: `<div id='editor'></div>`
61
+ });
62
+ ```
63
+
64
+ ## Plugins
65
+
66
+ | Plugin Group | Plugins |
67
+ |--------------------------------|---------|
68
+ | Basic Actions | `undo`, `redo` |
69
+ | Text Formatting | `bold`, `underline`, `italic`, `strike` |
70
+ | Font Styling | `font`, `font-size` |
71
+ | Subscript/Superscript | `subscript`, `superscript` |
72
+ | Colors | `font_color`, `highlight_color` |
73
+ | Alignment | `align_justify`, `align_left`, `align_center`, `align_right` |
74
+ | Lists | `ordered_list`, `unordered_list` |
75
+ | Media | `image`, `video`, `table`, `attachment` |
76
+ | Clipboard | `cut`, `copy`, `paste`, `select_all` |
77
+ | Links | `link`, `unlink`, `embed` |
78
+ | Text Styles | `format-block`, `text_style`, `line_height`, `paragraph_style` |
79
+ | Indentation & Formatting | `indent`, `outdent`, `horizontal_rule`, `remove_format` |
80
+ | Extras | `emoji`, `mention` |
81
+ | Third-Party Integrations | `pexels`, `giphy`, `tenor` |
82
+ | Utilities | `fullscreen`, `print`, `code_view` |
83
+
84
+ ## Configuration Options
85
+
86
+ | Option | Description |
87
+ |--------|-------------|
88
+ | `classPrefix` | Custom class prefix for styling. |
89
+ | `placeholder` | Placeholder text when the editor is empty. |
90
+ | `plugins` | List of enabled plugins. |
91
+ | `labels` | Labels for mentions and categories. |
92
+ | `customPlugins` | Additional custom plugins. |
93
+ | `spellcheck` | Enables/disables spellchecking. |
94
+ | `closePluginOnClick` | Closes plugins when clicking outside. |
95
+ | `value` | Initial value of the editor. |
96
+ | `hideNavigation` | Hides the navigation toolbar. |
97
+ | `giphyApiKey` | API key for Giphy integration. |
98
+ | `pexelsApiKey` | API key for Pexels integration. |
99
+ | `tenorApiKey` | API key for Tenor integration. |
100
+ | `cssVariables` | Custom CSS styling variables for multiple themes and modes. |
101
+
102
+ ### CSS Customization
103
+
104
+ ```js
105
+ cssVariables: {
106
+ primary: "hsl(12, 79.60%, 52.00%)",
107
+ midDarker: "hsl(103, 64.60%, 49.80%)",
108
+ baseWhite: "hsl(234, 70.90%, 61.00%)",
109
+ whiteDark: "hsl(223, 5%, 92%)",
110
+ resizer: "rgb(235, 28, 235)",
111
+ shadow: "rgba(20, 179, 54, 0.3)"
112
+ }
113
+ ```
114
+
115
+ ### Labels (Mentions Fields)
116
+
117
+ ```js
118
+ labels: [
119
+ {
120
+ name: 'Category 1',
121
+ category: 'CATEGORY_ONE',
122
+ fields: [
123
+ { value: 'CATEGORY_ONE.apple', name: 'Category 1 Apple' },
124
+ { value: 'CATEGORY_ONE.orange', name: 'Category 1 Orange' }
125
+ ]
126
+ },
127
+ {
128
+ name: 'Category 2',
129
+ category: 'CATEGORY_TWO',
130
+ fields: [
131
+ { value: 'CATEGORY_TWO.name', name: 'Category 2 Apple' },
132
+ { value: 'CATEGORY_TWO.firstName', name: 'Category 2 Orange' }
133
+ ]
134
+ }
135
+ ]
136
+ ```
137
+
138
+ ### Giphy Integration Example
139
+
140
+ Leksy Editor supports Giphy integration for inserting GIFs.
141
+
142
+ ```js
143
+ import LeksyEditor from 'leksy-editor';
144
+
145
+ const editor = LeksyEditor.create(document.getElementById('editor'), {
146
+ plugins: ['giphy'],
147
+ giphyApiKey: 'YOUR_GIPHY_API_KEY' // Replace with your actual API key
148
+ });
149
+ ```
150
+
151
+ Similarly, Pexels and Tenor can be integrated using `pexels` and `tenor` plugins along with their respective API keys.
152
+
153
+ ## Functions
154
+
155
+ | Function | Description |
156
+ |----------|-------------|
157
+ | `setContents(html)` | Sets the editor's content. |
158
+ | `getContents()` | Returns the current HTML content of the editor. |
159
+ | `onChange(html)` | Triggered when content changes. |
160
+ | `onBlur(html)` | Triggered when the editor loses focus. |
161
+ | `onAttachment(files)` | Fires when files are attached. |
162
+ | `manipulateImage()` | Custom function for manipulating images. |
163
+ | `uploadVideo(file)` | Handles video uploads, returns a promise with video URL. |
164
+ | `focus()` | Focuses the editor. |
165
+ | `getCore()` | Returns the core editor instance. |
166
+
167
+ ## License
168
+
169
+ MIT License. Free to use and modify.
170
+
171
+ ## Author
172
+
173
+ Leksy Editor is developed and maintained by **Agami Technologies**.