leksy-editor 2.5.0 → 2.6.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 +1 -0
- package/index.js +6 -0
- package/package.json +1 -1
- package/utilities.js +14 -14
package/README.md
CHANGED
|
@@ -183,6 +183,7 @@ Similarly, Pexels and Tenor can be integrated using `pexels` and `tenor` plugins
|
|
|
183
183
|
| `onChange(tabs)` | Triggered when content changes. |
|
|
184
184
|
| `onBlur(tabs)` | Triggered when the editor loses focus. |
|
|
185
185
|
| `onAttachment(files)` | Fires when files are attached. |
|
|
186
|
+
| `onLinkClick(href)` | To open custom link opener. |
|
|
186
187
|
| `manipulateImage()` | Custom function for manipulating images. |
|
|
187
188
|
| `handleFilePicker()` | Custom function for file upload, useful for Android and iOS file upload. |
|
|
188
189
|
| `uploadVideo(file)` | Handles video uploads, returns a promise with video URL. |
|
package/index.js
CHANGED
|
@@ -189,6 +189,9 @@ class LeksyEditor {
|
|
|
189
189
|
onAttachment: (files) => {
|
|
190
190
|
if (editorRef.onAttachment instanceof Function) editorRef.onAttachment(files)
|
|
191
191
|
},
|
|
192
|
+
onLinkClick: (href) => {
|
|
193
|
+
if (editorRef.onLinkClick instanceof Function) editorRef.onLinkClick(href)
|
|
194
|
+
},
|
|
192
195
|
manuplateImage: async (type, content) => {
|
|
193
196
|
if (editorRef.manuplateImage instanceof Function) {
|
|
194
197
|
core.changeStatus('Loading...')
|
|
@@ -301,6 +304,9 @@ class LeksyEditor {
|
|
|
301
304
|
onSave: () => { },
|
|
302
305
|
onBlur: () => { },
|
|
303
306
|
onAttachment: () => { },
|
|
307
|
+
onLinkClick: (href) => {
|
|
308
|
+
window.open(href, '_blank', 'noopener noreferrer')
|
|
309
|
+
},
|
|
304
310
|
manuplateImage: async () => { },
|
|
305
311
|
handleFilePicker: async () => { },
|
|
306
312
|
uploadVideo: async () => { },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "leksy-editor",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"description": "Leksy Editor is an alternative to traditional WYSIWYG editors, designed primarily for creating mail templates, blogs, and documents without any content manipulation.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"directories": {
|
package/utilities.js
CHANGED
|
@@ -2356,19 +2356,19 @@ const showAnchorPopover = (element, x, y, options, core) => {
|
|
|
2356
2356
|
popover.style.visibility = "hidden";
|
|
2357
2357
|
|
|
2358
2358
|
// Create clickable link
|
|
2359
|
-
let
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2359
|
+
let linkDiv = document.createElement("div");
|
|
2360
|
+
linkDiv.textContent = href;
|
|
2361
|
+
linkDiv.style.textDecoration = "none";
|
|
2362
|
+
linkDiv.style.color = "#007bff";
|
|
2363
|
+
linkDiv.style.padding = "5px";
|
|
2364
|
+
linkDiv.style.overflow = "hidden";
|
|
2365
|
+
linkDiv.style.textOverflow = "ellipsis";
|
|
2366
|
+
linkDiv.style.webkitBoxOrient = "vertical";
|
|
2367
|
+
linkDiv.style.webkitLineClamp = "1";
|
|
2368
|
+
linkDiv.style.maxWidth = "250px";
|
|
2369
|
+
linkDiv.style.wordBreak = "break-word";
|
|
2370
|
+
linkDiv.style.cursor = "pointer";
|
|
2371
|
+
linkDiv.onclick = () => core.onLinkClick(href);
|
|
2372
2372
|
|
|
2373
2373
|
// Create Edit button
|
|
2374
2374
|
let editButton = document.createElement("span");
|
|
@@ -2392,7 +2392,7 @@ const showAnchorPopover = (element, x, y, options, core) => {
|
|
|
2392
2392
|
deleteButton.onclick = (event) => removeAnchorTag(event, element, core);
|
|
2393
2393
|
|
|
2394
2394
|
// Append elements to popover
|
|
2395
|
-
popover.append(
|
|
2395
|
+
popover.append(linkDiv, copyButton, editButton, deleteButton);
|
|
2396
2396
|
|
|
2397
2397
|
let parent = core.elements.iframeWindow.body;
|
|
2398
2398
|
parent.appendChild(popover);
|