@flozy/editor 3.9.4 → 3.9.5
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/ChatEditor.js +65 -44
- package/dist/Editor/CommonEditor.js +3 -2
- package/dist/Editor/Editor.css +12 -1
- package/dist/Editor/Elements/Accordion/Accordion.js +75 -8
- package/dist/Editor/Elements/Accordion/AccordionBtnPopup.js +3 -2
- package/dist/Editor/Elements/Accordion/AccordionSummary.js +24 -64
- package/dist/Editor/Elements/Embed/Image.js +27 -19
- package/dist/Editor/Elements/Embed/Video.js +14 -10
- package/dist/Editor/Elements/Emoji/EmojiPicker.js +4 -2
- package/dist/Editor/Elements/Form/Form.js +1 -1
- package/dist/Editor/Elements/List/CheckList.js +2 -1
- package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +5 -1
- package/dist/Editor/Elements/Table/Table.js +1 -1
- package/dist/Editor/Elements/Table/TableCell.js +1 -1
- package/dist/Editor/Toolbar/Mini/MiniToolbar.js +25 -1
- package/dist/Editor/common/ColorPickerButton.js +12 -4
- package/dist/Editor/common/EditorCmds.js +35 -0
- package/dist/Editor/common/MentionsPopup/MentionsListCard.js +6 -1
- package/dist/Editor/common/MentionsPopup/Styles.js +5 -2
- package/dist/Editor/common/StyleBuilder/accordionTitleBtnStyle.js +9 -8
- package/dist/Editor/common/StyleBuilder/accordionTitleStyle.js +16 -16
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +26 -20
- package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +18 -16
- package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +6 -4
- package/dist/Editor/common/StyleBuilder/fieldTypes/selectBox.js +14 -3
- package/dist/Editor/helper/deserialize/index.js +14 -9
- package/dist/Editor/helper/index.js +22 -0
- package/dist/Editor/helper/theme.js +2 -1
- package/dist/Editor/hooks/useMouseMove.js +0 -1
- package/dist/Editor/plugins/withHTML.js +46 -4
- package/dist/Editor/plugins/withLayout.js +15 -10
- package/dist/Editor/plugins/withTable.js +1 -1
- package/dist/Editor/utils/SlateUtilityFunctions.js +2 -8
- package/dist/Editor/utils/draftToSlate.js +1 -1
- package/dist/Editor/utils/events.js +11 -4
- package/dist/Editor/utils/helper.js +43 -12
- package/package.json +1 -1
@@ -3,6 +3,7 @@ import { toggleBlock } from "./SlateUtilityFunctions";
|
|
3
3
|
import insertNewLine from "./insertNewLine";
|
4
4
|
import { insertAccordion } from "./accordion";
|
5
5
|
import { isListItem } from "./helper";
|
6
|
+
import EDITORCMDS from "../common/EditorCmds";
|
6
7
|
const HOTKEYS = {
|
7
8
|
b: "bold",
|
8
9
|
i: "italic",
|
@@ -63,7 +64,8 @@ export const commands = props => {
|
|
63
64
|
try {
|
64
65
|
const {
|
65
66
|
event,
|
66
|
-
editor
|
67
|
+
editor,
|
68
|
+
needLayout
|
67
69
|
} = props;
|
68
70
|
if (HOTKEYS[event.key]) {
|
69
71
|
event.preventDefault();
|
@@ -73,6 +75,11 @@ export const commands = props => {
|
|
73
75
|
} else {
|
74
76
|
Editor.addMark(editor, HOTKEYS[event.key], true);
|
75
77
|
}
|
78
|
+
} else if (EDITORCMDS[event.key]) {
|
79
|
+
EDITORCMDS[event.key](event, {
|
80
|
+
editor,
|
81
|
+
needLayout
|
82
|
+
});
|
76
83
|
}
|
77
84
|
} catch (err) {
|
78
85
|
console.log(err);
|
@@ -96,7 +103,7 @@ export const indentation = props => {
|
|
96
103
|
Transforms.wrapNodes(editor, {
|
97
104
|
type: listItem.type,
|
98
105
|
children: [{
|
99
|
-
text:
|
106
|
+
text: ""
|
100
107
|
}]
|
101
108
|
});
|
102
109
|
} else {
|
@@ -153,7 +160,7 @@ const checkListEnterEvent = (editor, type) => {
|
|
153
160
|
Transforms.insertNodes(editor, {
|
154
161
|
type: "check-list-item",
|
155
162
|
children: [{
|
156
|
-
text:
|
163
|
+
text: ""
|
157
164
|
}]
|
158
165
|
}, {
|
159
166
|
at: newPath
|
@@ -162,7 +169,7 @@ const checkListEnterEvent = (editor, type) => {
|
|
162
169
|
// focus on the end of the line
|
163
170
|
Transforms.move(editor, {
|
164
171
|
distance: 1,
|
165
|
-
unit:
|
172
|
+
unit: "line"
|
166
173
|
});
|
167
174
|
} else {
|
168
175
|
toggleBlock(editor, type);
|
@@ -216,6 +216,17 @@ const getScrollElement = () => {
|
|
216
216
|
const scrollFrom = isSlateWrapperScroll ? slateWrapper : window;
|
217
217
|
return scrollFrom;
|
218
218
|
};
|
219
|
+
const handleLinkBtnClick = (e, props) => {
|
220
|
+
if (e) {
|
221
|
+
e.preventDefault();
|
222
|
+
e.stopPropagation();
|
223
|
+
}
|
224
|
+
if (props.target) {
|
225
|
+
window.open(props.href);
|
226
|
+
} else {
|
227
|
+
window.location.href = props.href;
|
228
|
+
}
|
229
|
+
};
|
219
230
|
export const handleLinkType = (url, linkType, readOnly, openInNewTab, onClick = () => {}) => {
|
220
231
|
const props = {};
|
221
232
|
if (!readOnly) {
|
@@ -306,23 +317,22 @@ export const handleLinkType = (url, linkType, readOnly, openInNewTab, onClick =
|
|
306
317
|
|
307
318
|
// for iphone fix
|
308
319
|
if (props.component === "a" && props.href) {
|
309
|
-
|
320
|
+
const isMobile = getDevice(window.innerWidth) === "xs";
|
321
|
+
if (isMobile) {
|
310
322
|
props.component = "button"; // iphone is opening two tabs, on open in new tab because of a tag.
|
311
323
|
}
|
312
324
|
|
325
|
+
let touchEndClicked = false;
|
313
326
|
props.onTouchEnd = e => {
|
314
|
-
|
315
|
-
|
316
|
-
e.preventDefault();
|
317
|
-
e.stopPropagation();
|
318
|
-
}
|
319
|
-
if (props.target) {
|
320
|
-
window.open(props.href);
|
321
|
-
} else {
|
322
|
-
window.location.href = props.href;
|
323
|
-
}
|
327
|
+
touchEndClicked = true;
|
328
|
+
handleLinkBtnClick(e, props);
|
324
329
|
};
|
325
|
-
props.onClick =
|
330
|
+
props.onClick = e => {
|
331
|
+
// This condition is used for mobile preview in the page editor.
|
332
|
+
// 'touchEnd' will not work in the mobile page preview.
|
333
|
+
if (!touchEndClicked && isMobile) {
|
334
|
+
handleLinkBtnClick(e, props);
|
335
|
+
}
|
326
336
|
return false;
|
327
337
|
};
|
328
338
|
}
|
@@ -367,4 +377,25 @@ export const decodeString = str => {
|
|
367
377
|
} catch (err) {
|
368
378
|
console.log(err);
|
369
379
|
}
|
380
|
+
};
|
381
|
+
export const onDeleteKey = (event, {
|
382
|
+
editor
|
383
|
+
}) => {
|
384
|
+
try {
|
385
|
+
const {
|
386
|
+
selection
|
387
|
+
} = editor;
|
388
|
+
if (selection) {
|
389
|
+
// If text is selected, delete the selection
|
390
|
+
Transforms.delete(editor);
|
391
|
+
} else {
|
392
|
+
// If no text is selected, handle deleting the next character/element
|
393
|
+
Transforms.delete(editor, {
|
394
|
+
unit: "character",
|
395
|
+
reverse: false
|
396
|
+
});
|
397
|
+
}
|
398
|
+
} catch (err) {
|
399
|
+
console.log(err);
|
400
|
+
}
|
370
401
|
};
|