leksy-editor 2.2.3 → 2.2.4
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/package.json +1 -1
- package/utilities.js +11 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "leksy-editor",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.4",
|
|
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
|
@@ -3219,6 +3219,12 @@ const outdentListItem = (li, core) => {
|
|
|
3219
3219
|
}
|
|
3220
3220
|
};
|
|
3221
3221
|
|
|
3222
|
+
const isEmptyLi = (li) => {
|
|
3223
|
+
const text = li.textContent.replace(/\u200B/g, '').trim();
|
|
3224
|
+
const hasOnlySublist = li.children.length === 1 && li.querySelector('ul, ol');
|
|
3225
|
+
return text === '' && !hasOnlySublist;
|
|
3226
|
+
}
|
|
3227
|
+
|
|
3222
3228
|
const makeSublist = (event, core) => {
|
|
3223
3229
|
if (event.key !== 'Tab') return;
|
|
3224
3230
|
|
|
@@ -3247,6 +3253,11 @@ const makeSublist = (event, core) => {
|
|
|
3247
3253
|
|
|
3248
3254
|
if (!selectedLis.length) return;
|
|
3249
3255
|
|
|
3256
|
+
if (!event.shiftKey) {
|
|
3257
|
+
const hasContent = selectedLis.some(li => !isEmptyLi(li));
|
|
3258
|
+
if (hasContent) return;
|
|
3259
|
+
}
|
|
3260
|
+
|
|
3250
3261
|
event.preventDefault();
|
|
3251
3262
|
|
|
3252
3263
|
selectedLis.forEach(li => {
|