@flozy/editor 3.9.3 → 3.9.4
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/ChatEditor.js +31 -57
- package/dist/Editor/CommonEditor.js +2 -3
- package/dist/Editor/Editor.css +1 -12
- package/dist/Editor/Elements/Accordion/Accordion.js +8 -75
- package/dist/Editor/Elements/Accordion/AccordionBtnPopup.js +2 -3
- package/dist/Editor/Elements/Accordion/AccordionSummary.js +64 -24
- package/dist/Editor/Elements/Embed/Image.js +19 -27
- package/dist/Editor/Elements/Embed/Video.js +10 -14
- package/dist/Editor/Elements/Emoji/EmojiPicker.js +2 -4
- package/dist/Editor/Elements/Form/Form.js +1 -1
- package/dist/Editor/Elements/List/CheckList.js +1 -2
- package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +1 -5
- 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 +1 -25
- package/dist/Editor/common/ColorPickerButton.js +4 -12
- package/dist/Editor/common/MentionsPopup/MentionsListCard.js +1 -6
- package/dist/Editor/common/MentionsPopup/Styles.js +2 -5
- package/dist/Editor/common/StyleBuilder/accordionTitleBtnStyle.js +8 -9
- package/dist/Editor/common/StyleBuilder/accordionTitleStyle.js +16 -16
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +20 -26
- package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +16 -18
- package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +4 -6
- package/dist/Editor/common/StyleBuilder/fieldTypes/selectBox.js +3 -14
- package/dist/Editor/helper/deserialize/index.js +9 -14
- package/dist/Editor/helper/index.js +0 -22
- package/dist/Editor/helper/theme.js +1 -2
- package/dist/Editor/hooks/useMouseMove.js +1 -0
- package/dist/Editor/plugins/withHTML.js +4 -46
- package/dist/Editor/plugins/withLayout.js +10 -15
- package/dist/Editor/plugins/withTable.js +1 -1
- package/dist/Editor/utils/SlateUtilityFunctions.js +8 -2
- package/dist/Editor/utils/draftToSlate.js +1 -1
- package/dist/Editor/utils/events.js +4 -11
- package/dist/Editor/utils/helper.js +12 -43
- package/package.json +1 -1
- package/dist/Editor/common/EditorCmds.js +0 -35
@@ -3,7 +3,6 @@ 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";
|
7
6
|
const HOTKEYS = {
|
8
7
|
b: "bold",
|
9
8
|
i: "italic",
|
@@ -64,8 +63,7 @@ export const commands = props => {
|
|
64
63
|
try {
|
65
64
|
const {
|
66
65
|
event,
|
67
|
-
editor
|
68
|
-
needLayout
|
66
|
+
editor
|
69
67
|
} = props;
|
70
68
|
if (HOTKEYS[event.key]) {
|
71
69
|
event.preventDefault();
|
@@ -75,11 +73,6 @@ export const commands = props => {
|
|
75
73
|
} else {
|
76
74
|
Editor.addMark(editor, HOTKEYS[event.key], true);
|
77
75
|
}
|
78
|
-
} else if (EDITORCMDS[event.key]) {
|
79
|
-
EDITORCMDS[event.key](event, {
|
80
|
-
editor,
|
81
|
-
needLayout
|
82
|
-
});
|
83
76
|
}
|
84
77
|
} catch (err) {
|
85
78
|
console.log(err);
|
@@ -103,7 +96,7 @@ export const indentation = props => {
|
|
103
96
|
Transforms.wrapNodes(editor, {
|
104
97
|
type: listItem.type,
|
105
98
|
children: [{
|
106
|
-
text:
|
99
|
+
text: ''
|
107
100
|
}]
|
108
101
|
});
|
109
102
|
} else {
|
@@ -160,7 +153,7 @@ const checkListEnterEvent = (editor, type) => {
|
|
160
153
|
Transforms.insertNodes(editor, {
|
161
154
|
type: "check-list-item",
|
162
155
|
children: [{
|
163
|
-
text:
|
156
|
+
text: ''
|
164
157
|
}]
|
165
158
|
}, {
|
166
159
|
at: newPath
|
@@ -169,7 +162,7 @@ const checkListEnterEvent = (editor, type) => {
|
|
169
162
|
// focus on the end of the line
|
170
163
|
Transforms.move(editor, {
|
171
164
|
distance: 1,
|
172
|
-
unit:
|
165
|
+
unit: 'line'
|
173
166
|
});
|
174
167
|
} else {
|
175
168
|
toggleBlock(editor, type);
|
@@ -216,17 +216,6 @@ 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
|
-
};
|
230
219
|
export const handleLinkType = (url, linkType, readOnly, openInNewTab, onClick = () => {}) => {
|
231
220
|
const props = {};
|
232
221
|
if (!readOnly) {
|
@@ -317,22 +306,23 @@ export const handleLinkType = (url, linkType, readOnly, openInNewTab, onClick =
|
|
317
306
|
|
318
307
|
// for iphone fix
|
319
308
|
if (props.component === "a" && props.href) {
|
320
|
-
|
321
|
-
if (isMobile) {
|
309
|
+
if (getDevice(window.innerWidth) === "xs") {
|
322
310
|
props.component = "button"; // iphone is opening two tabs, on open in new tab because of a tag.
|
323
311
|
}
|
324
312
|
|
325
|
-
let touchEndClicked = false;
|
326
313
|
props.onTouchEnd = e => {
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
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);
|
314
|
+
if (e) {
|
315
|
+
// onTouchEnd will get triggered on web, only for image element, for that case event is getting undefined.
|
316
|
+
e.preventDefault();
|
317
|
+
e.stopPropagation();
|
335
318
|
}
|
319
|
+
if (props.target) {
|
320
|
+
window.open(props.href);
|
321
|
+
} else {
|
322
|
+
window.location.href = props.href;
|
323
|
+
}
|
324
|
+
};
|
325
|
+
props.onClick = () => {
|
336
326
|
return false;
|
337
327
|
};
|
338
328
|
}
|
@@ -377,25 +367,4 @@ export const decodeString = str => {
|
|
377
367
|
} catch (err) {
|
378
368
|
console.log(err);
|
379
369
|
}
|
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
|
-
}
|
401
370
|
};
|
package/package.json
CHANGED
@@ -1,35 +0,0 @@
|
|
1
|
-
import { Editor, Transforms } from "slate";
|
2
|
-
const selectAll = (event, {
|
3
|
-
editor,
|
4
|
-
needLayout
|
5
|
-
}) => {
|
6
|
-
try {
|
7
|
-
if (needLayout) {
|
8
|
-
event.preventDefault();
|
9
|
-
// Select the entire document
|
10
|
-
const {
|
11
|
-
selection
|
12
|
-
} = editor;
|
13
|
-
const [firstNode] = Editor.nodes(editor, {
|
14
|
-
at: [0]
|
15
|
-
}); // First node
|
16
|
-
const [lastNode] = Editor.nodes(editor, {
|
17
|
-
at: [editor.children.length - 1]
|
18
|
-
}); // Last node
|
19
|
-
|
20
|
-
if (firstNode && lastNode) {
|
21
|
-
Transforms.select(editor, {
|
22
|
-
anchor: Editor.start(editor, [0]),
|
23
|
-
// Start at the first node
|
24
|
-
focus: Editor.end(editor, [editor.children.length - 1]) // End at the last node
|
25
|
-
});
|
26
|
-
}
|
27
|
-
}
|
28
|
-
} catch (err) {
|
29
|
-
console.log(err);
|
30
|
-
}
|
31
|
-
};
|
32
|
-
const EDITORCMDS = {
|
33
|
-
a: selectAll
|
34
|
-
};
|
35
|
-
export default EDITORCMDS;
|