leksy-editor 1.4.0 → 1.4.1
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/constant.js +4 -4
- package/index.js +1 -0
- package/package.json +1 -1
- package/plugin.js +4 -4
- package/utilities.js +4 -0
package/README.md
CHANGED
|
@@ -99,6 +99,7 @@ const app = createApp({
|
|
|
99
99
|
| `tenorApiKey` | API key for Tenor integration. |
|
|
100
100
|
| `cssVariables` | Custom CSS styling variables for multiple themes and modes. |
|
|
101
101
|
| `disablePastedColorStyles` | Remove color-related CSS while pasting. |
|
|
102
|
+
| `removeColorsWhilePasting` | Remove all color and bg color CSS while pasting. |
|
|
102
103
|
| `autoHeight` | Automatically adjusts height based on content. |
|
|
103
104
|
| `height` | Height for the editor. |
|
|
104
105
|
| `maxHeight` | Maximum height for the editor. |
|
package/constant.js
CHANGED
|
@@ -50,6 +50,9 @@ const CLASSES = {
|
|
|
50
50
|
PREVIEW_MODAL_CONTENT: '-preview-modal-content',
|
|
51
51
|
PREVIEW_MODAL_CLOSE: '-preview-modal-close',
|
|
52
52
|
PREVIEW_MODAL_BODY: '-preview-modal-body',
|
|
53
|
+
UPLOAD_IMG_BOX: '-upload-img-box',
|
|
54
|
+
UPLOAD_IMG_PREVIEW_BOX: '-upload-img-preview-box',
|
|
55
|
+
UPLOAD_IMG_PREVIEW: '-upload-img-preview',
|
|
53
56
|
}
|
|
54
57
|
|
|
55
58
|
const SVG = {
|
|
@@ -139,10 +142,8 @@ const SVG = {
|
|
|
139
142
|
FULLSCREEN_IMAGE: '<svg xmlns="http://www.w3.org/2000/svg" width="20px" viewBox="0 0 24 24" fill="currentColor"><path d="M8 3V5H4V9H2V3H8ZM2 21V15H4V19H8V21H2ZM22 21H16V19H20V15H22V21ZM22 9H20V5H16V3H22V9Z"></path></svg>',
|
|
140
143
|
CLOSE: '<svg xmlns="http://www.w3.org/2000/svg" width="16px" viewBox="0 0 24 24" fill="currentColor"><path d="M10.5859 12L2.79297 4.20706L4.20718 2.79285L12.0001 10.5857L19.793 2.79285L21.2072 4.20706L13.4143 12L21.2072 19.7928L19.793 21.2071L12.0001 13.4142L4.20718 21.2071L2.79297 19.7928L10.5859 12Z"></path></svg>',
|
|
141
144
|
SPINNER: '<svg class="leksy-editor-spinner" width="16" height="16" viewBox="0 0 50 50"><circle class="leksy-editor-path" cx="25" cy="25" r="20" fill="none" stroke-width="4"></circle></svg>',
|
|
142
|
-
|
|
143
145
|
}
|
|
144
146
|
|
|
145
|
-
|
|
146
147
|
const MIMETYPE = {
|
|
147
148
|
IMAGE: 'image/png,image/jpg,image/jpeg,image/webp',
|
|
148
149
|
VIDEO: 'video/mp4,video/quicktime',
|
|
@@ -150,7 +151,6 @@ const MIMETYPE = {
|
|
|
150
151
|
|
|
151
152
|
const SOCIAL_MEDIA_PATTERNS = {
|
|
152
153
|
YOUTUBE: /(?:youtube\.com\/(?:.*[?&]v=|embed\/|v\/|watch\?v=|live\/)|youtu\.be\/)([^"&?\/\s]{11})/,
|
|
153
|
-
// TWITTER: /(?:twitter\.com\/(?:#!\/)?(?:\w+)\/status\/|x\.com\/(?:#!\/)?(?:\w+)\/status\/)(\d+)/,
|
|
154
154
|
REDDIT: /(?:reddit\.com\/r\/[\w-]+\/comments\/|reddit\.com\/comments\/)([\w-]+)/,
|
|
155
155
|
INSTAGRAM: /(?:instagram\.com\/(?:p|reel|tv|stories\/[\w-]+|[\w-]+\/posts|share\/p)\/|instagr\.am\/p\/)([\w-]+)/,
|
|
156
156
|
THREADS: /(?:threads\.net\/@[\w-]+\/post\/)([\w-]+)/,
|
|
@@ -163,7 +163,6 @@ const SOCIAL_MEDIA_PATTERNS = {
|
|
|
163
163
|
|
|
164
164
|
const SOCIAL_MEDIA_BASEURLS = {
|
|
165
165
|
YOUTUBE: "https://www.youtube.com/embed/",
|
|
166
|
-
// TWITTER: "https://twitframe.com/show?url=https://twitter.com/user/status/",
|
|
167
166
|
INSTAGRAM: "https://www.instagram.com/p/",
|
|
168
167
|
REDDIT: "https://www.redditmedia.com/r/all/comments/",
|
|
169
168
|
PINTEREST: "https://assets.pinterest.com/ext/embed.html?id=",
|
|
@@ -173,6 +172,7 @@ const SOCIAL_MEDIA_BASEURLS = {
|
|
|
173
172
|
TWITCH_CHANNEL: 'https://player.twitch.tv/?channel=',
|
|
174
173
|
TIKTOK: 'https://www.tiktok.com/embed/',
|
|
175
174
|
};
|
|
175
|
+
|
|
176
176
|
const CSS_VARIABLES = {
|
|
177
177
|
primary: "hsl(160, 100%, 40%)",
|
|
178
178
|
midDarker: "hsl(223, 5%, 76%)",
|
package/index.js
CHANGED
|
@@ -21,6 +21,7 @@ class LeksyEditor {
|
|
|
21
21
|
* @property {String} tenorApiKey
|
|
22
22
|
* @property {Object} cssVariables
|
|
23
23
|
* @property {Boolean} disablePastedColorStyles
|
|
24
|
+
* @property {Boolean} removeColorsWhilePasting
|
|
24
25
|
* @property {Boolean} autoHeight
|
|
25
26
|
* @property {String} height
|
|
26
27
|
* @property {String} maxHeight
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "leksy-editor",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1",
|
|
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/plugin.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EMOJI_CATEGORIES, FONT_SIZE_OPTIONS, FONTS, FORMAT_OPTIONS, MIMETYPE, REGEX, SPECIAL_CHARACTERS, SVG, UNORDERED_LIST_OPTIONS, ORDERED_LIST_OPTIONS } from "./constant"
|
|
1
|
+
import { EMOJI_CATEGORIES, FONT_SIZE_OPTIONS, FONTS, FORMAT_OPTIONS, MIMETYPE, REGEX, SPECIAL_CHARACTERS, SVG, UNORDERED_LIST_OPTIONS, ORDERED_LIST_OPTIONS, CLASSES } from "./constant"
|
|
2
2
|
import { giphy, pexels, tenor } from "./gallery";
|
|
3
3
|
import { formatLink, changeAllToolbarState, changeToolbarHtmlByName, changeToolbarStateByName, changeToolbarValueByName, cleanHTML, constructEmbedUrl, extractSocialMediaId, isLinkValid, openModal, transformTextStyle } from "./utilities";
|
|
4
4
|
|
|
@@ -844,7 +844,7 @@ const PLUGINS = {
|
|
|
844
844
|
left.style.flex = '1';
|
|
845
845
|
|
|
846
846
|
const uploadBox = document.createElement('div');
|
|
847
|
-
uploadBox.className = `${options.classPrefix}
|
|
847
|
+
uploadBox.className = `${options.classPrefix}${CLASSES.UPLOAD_IMG_BOX}`;
|
|
848
848
|
uploadBox.innerHTML = `
|
|
849
849
|
<div style="text-align: center; color: #6b7280;">
|
|
850
850
|
<div style="font-size: 32px; font-weight: 500;">+</div>
|
|
@@ -867,10 +867,10 @@ const PLUGINS = {
|
|
|
867
867
|
right.style.flex = '1';
|
|
868
868
|
|
|
869
869
|
const previewBox = document.createElement('div');
|
|
870
|
-
previewBox.className = `${options.classPrefix}
|
|
870
|
+
previewBox.className = `${options.classPrefix}${CLASSES.UPLOAD_IMG_PREVIEW_BOX}`;
|
|
871
871
|
|
|
872
872
|
const imgPreview = document.createElement('img');
|
|
873
|
-
imgPreview.className = `${options.classPrefix}
|
|
873
|
+
imgPreview.className = `${options.classPrefix}${CLASSES.UPLOAD_IMG_PREVIEW}`;
|
|
874
874
|
imgPreview.style.display = 'none';
|
|
875
875
|
|
|
876
876
|
previewBox.append(imgPreview);
|
package/utilities.js
CHANGED
|
@@ -45,6 +45,10 @@ const traverseAndClean = (element, options, core) => {
|
|
|
45
45
|
if (bodyBg === bgColor) node.style.removeProperty('background-color');
|
|
46
46
|
if (bodyBg === textColor) node.style.removeProperty('color');
|
|
47
47
|
}
|
|
48
|
+
if (options?.removeColorsWhilePasting) {
|
|
49
|
+
node.style.removeProperty('background-color');
|
|
50
|
+
node.style.removeProperty('color');
|
|
51
|
+
}
|
|
48
52
|
attributesToRemove.forEach(attr => node.removeAttribute(attr));
|
|
49
53
|
|
|
50
54
|
// Process child nodes
|