leksy-editor 2.4.1 → 2.5.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 CHANGED
@@ -110,6 +110,7 @@ const app = createApp({
110
110
  | `showTabs` | Enables or disables the display of tabs. |
111
111
  | `enableFindAndReplace` | To enabled find and replace feature|
112
112
  | `customTooltip` | Customize tooltip according to your need, set using key-value pair|
113
+ | `customIcon` | Customize icon according to your need, set using key-value pair|
113
114
 
114
115
  ### CSS Customization
115
116
 
package/index.js CHANGED
@@ -32,7 +32,9 @@ class LeksyEditor {
32
32
  * @property {Boolean} disabled
33
33
  * @property {Function} onFullScreen
34
34
  * @property {Boolean} showTabs
35
- * @property {Boolean} enableFindAndReplace
35
+ * @property {Boolean} enableFindAndReplace
36
+ * @property {Array<Object>} customTooltip
37
+ * @property {Array<Object>} customIcon
36
38
  */
37
39
  /**
38
40
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leksy-editor",
3
- "version": "2.4.1",
3
+ "version": "2.5.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
@@ -204,6 +204,10 @@ const getTooltip = (plugin, options) => {
204
204
  return options?.customTooltip?.[plugin.pluginId] ?? plugin.title
205
205
  }
206
206
 
207
+ const getToolbarIcon = (plugin, options) => {
208
+ return options?.customIcon?.[plugin.pluginId] ?? plugin.icon
209
+ }
210
+
207
211
  const makeToolbarButton = (_plugin, options, core) => {
208
212
  const pluginButton = document.createElement('button');
209
213
  pluginButton.type = "button"
@@ -217,7 +221,7 @@ const makeToolbarButton = (_plugin, options, core) => {
217
221
  };
218
222
 
219
223
  const pluginIcon = document.createElement('div');
220
- pluginIcon.innerHTML = _plugin.icon;
224
+ pluginIcon.innerHTML = getToolbarIcon(_plugin, options);
221
225
  pluginButton.appendChild(pluginIcon)
222
226
  return pluginButton
223
227
  }
@@ -236,7 +240,7 @@ const makeToolbarButtonSelect = (_plugin, options, core) => {
236
240
  };
237
241
 
238
242
  const pluginIcon = document.createElement('div');
239
- pluginIcon.innerHTML = _plugin.icon;
243
+ pluginIcon.innerHTML = getToolbarIcon(_plugin, options);
240
244
  pluginButton.appendChild(pluginIcon)
241
245
  const pluginSelect = makeToolbarSelect({ ..._plugin, icon: '' }, options, core);
242
246
 
@@ -265,7 +269,7 @@ const makeToolbarColor = (_plugin, options, core) => {
265
269
  };
266
270
 
267
271
  const pluginIcon = document.createElement('div');
268
- pluginIcon.innerHTML = _plugin.icon;
272
+ pluginIcon.innerHTML = getToolbarIcon(_plugin, options);
269
273
  pluginIcon.onclick = () => pluginButton.click()
270
274
  pluginContainer.append(pluginButton, pluginIcon)
271
275
  return pluginContainer
@@ -348,7 +352,7 @@ const makeToolbarDropdown = (_plugin, options, core) => {
348
352
  dropdownButton.setAttribute('data-title', getTooltip(_plugin, options))
349
353
 
350
354
  const pluginIcon = document.createElement('div');
351
- pluginIcon.innerHTML = _plugin.icon;
355
+ pluginIcon.innerHTML = getToolbarIcon(_plugin, options);
352
356
  dropdownButton.appendChild(pluginIcon)
353
357
 
354
358
  const dropdownContent = document.createElement('div');
@@ -597,7 +601,7 @@ const makeToolbarSelect = (_plugin, options, core) => {
597
601
  pluginIcon.style.justifyContent = 'space-between'
598
602
 
599
603
  const iconName = document.createElement('span');
600
- iconName.innerHTML = _plugin.icon;
604
+ iconName.innerHTML = getToolbarIcon(_plugin, options);
601
605
 
602
606
  const arrow = document.createElement('span');
603
607
  if (_plugin.type == 'button-select') {