@flozy/editor 1.0.8 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/CollaborativeEditor.js +6 -4
- package/dist/Editor/CommonEditor.js +43 -31
- package/dist/Editor/Elements/CodeToText/CodeToText.js +44 -33
- package/dist/Editor/Elements/CodeToText/CodeToTextButton.js +13 -8
- package/dist/Editor/Elements/CodeToText/HtmlCode.js +13 -8
- package/dist/Editor/Elements/CodeToText/HtmlContextMenu.js +14 -8
- package/dist/Editor/Elements/Color Picker/ColorPicker.js +61 -53
- package/dist/Editor/Elements/Embed/Embed.js +62 -49
- package/dist/Editor/Elements/Embed/Image.js +30 -24
- package/dist/Editor/Elements/Embed/Video.js +45 -38
- package/dist/Editor/Elements/Equation/Equation.js +17 -10
- package/dist/Editor/Elements/Equation/EquationButton.js +37 -28
- package/dist/Editor/Elements/Grid/Grid.js +14 -9
- package/dist/Editor/Elements/Grid/GridButton.js +5 -3
- package/dist/Editor/Elements/Grid/GridItem.js +18 -13
- package/dist/Editor/Elements/ID/Id.js +30 -24
- package/dist/Editor/Elements/Link/Link.js +26 -19
- package/dist/Editor/Elements/Link/LinkButton.js +45 -35
- package/dist/Editor/Elements/Mentions/Mentions.js +6 -4
- package/dist/Editor/Elements/NewLine/NewLineButton.js +5 -3
- package/dist/Editor/Elements/Table/Table.js +10 -3
- package/dist/Editor/Elements/Table/TableSelector.js +41 -33
- package/dist/Editor/Elements/TableContextMenu/TableContextMenu.js +18 -13
- package/dist/Editor/RemoteCursorOverlay/Overlay.js +35 -31
- package/dist/Editor/Toolbar/Toolbar.js +90 -94
- package/dist/Editor/common/Button.js +7 -6
- package/dist/Editor/common/Icon.js +34 -33
- package/dist/Editor/common/MentionsPopup.js +20 -18
- package/dist/Editor/utils/SlateUtilityFunctions.js +132 -52
- package/package.json +4 -4
@@ -8,6 +8,7 @@ import { draftToSlate } from "./utils/draftToSlate";
|
|
8
8
|
import withCommon from "./hooks/withCommon";
|
9
9
|
import withCollaborative from "./hooks/withCollaborative";
|
10
10
|
import CommonEditor from "./CommonEditor";
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
11
12
|
const CollaborativeEditor = props => {
|
12
13
|
const {
|
13
14
|
id,
|
@@ -101,11 +102,12 @@ const CollaborativeEditor = props => {
|
|
101
102
|
setConnected(false);
|
102
103
|
});
|
103
104
|
if (authenticated.status === null || !connected === null || !editor) {
|
104
|
-
return /*#__PURE__*/
|
105
|
-
"data-status": connected
|
106
|
-
|
105
|
+
return /*#__PURE__*/_jsx("h1", {
|
106
|
+
"data-status": connected,
|
107
|
+
children: "Loading..."
|
108
|
+
});
|
107
109
|
}
|
108
|
-
return /*#__PURE__*/
|
110
|
+
return /*#__PURE__*/_jsx(CommonEditor, {
|
109
111
|
editor: editor,
|
110
112
|
id: id,
|
111
113
|
content: [],
|
@@ -1,4 +1,3 @@
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
2
1
|
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
3
2
|
import { Slate, Editable } from "slate-react";
|
4
3
|
import Toolbar from "./Toolbar/Toolbar";
|
@@ -12,6 +11,8 @@ import { RemoteCursorOverlay } from "./RemoteCursorOverlay/Overlay";
|
|
12
11
|
import { mentionsEvent, commands } from "./utils/events";
|
13
12
|
import withCommon from "./hooks/withCommon";
|
14
13
|
import { createEditor } from "slate";
|
14
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
15
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
15
16
|
const Element = props => {
|
16
17
|
return getBlock(props);
|
17
18
|
};
|
@@ -21,7 +22,10 @@ const Leaf = ({
|
|
21
22
|
leaf
|
22
23
|
}) => {
|
23
24
|
children = getMarked(leaf, children);
|
24
|
-
return /*#__PURE__*/
|
25
|
+
return /*#__PURE__*/_jsx("span", {
|
26
|
+
...attributes,
|
27
|
+
children: children
|
28
|
+
});
|
25
29
|
};
|
26
30
|
const CommonEditor = props => {
|
27
31
|
const {
|
@@ -68,9 +72,13 @@ const CommonEditor = props => {
|
|
68
72
|
onSave(JSON.stringify(value));
|
69
73
|
}
|
70
74
|
};
|
71
|
-
const renderElement = useCallback(props => /*#__PURE__*/
|
75
|
+
const renderElement = useCallback(props => /*#__PURE__*/_jsx(Element, {
|
76
|
+
...props
|
77
|
+
}), []);
|
72
78
|
const renderLeaf = useCallback(props => {
|
73
|
-
return /*#__PURE__*/
|
79
|
+
return /*#__PURE__*/_jsx(Leaf, {
|
80
|
+
...props
|
81
|
+
});
|
74
82
|
}, []);
|
75
83
|
const handleCodeToText = partialState => {
|
76
84
|
setHtmlAction(prev => ({
|
@@ -98,35 +106,39 @@ const CommonEditor = props => {
|
|
98
106
|
}, [chars, editor, target, mentions, setMentions]);
|
99
107
|
const isReadOnly = readOnly === "readonly";
|
100
108
|
const Overlay = collaborativeEditor && !isReadOnly ? RemoteCursorOverlay : React.Fragment;
|
101
|
-
return /*#__PURE__*/
|
102
|
-
key: id,
|
109
|
+
return /*#__PURE__*/_jsxs(Slate, {
|
103
110
|
editor: editor,
|
104
111
|
initialValue: value,
|
105
|
-
onChange: handleEditorChange
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
112
|
+
onChange: handleEditorChange,
|
113
|
+
children: [/*#__PURE__*/_jsxs(Overlay, {
|
114
|
+
children: [!isReadOnly ? /*#__PURE__*/_jsx(Toolbar, {
|
115
|
+
handleCodeToText: handleCodeToText
|
116
|
+
}) : null, /*#__PURE__*/_jsxs("div", {
|
117
|
+
className: "editor-wrapper",
|
118
|
+
style: {
|
119
|
+
border: "1px solid #f3f3f3",
|
120
|
+
padding: "0 10px"
|
121
|
+
},
|
122
|
+
children: [/*#__PURE__*/_jsx(Editable, {
|
123
|
+
readOnly: isReadOnly,
|
124
|
+
placeholder: "Write something",
|
125
|
+
renderElement: renderElement,
|
126
|
+
renderLeaf: renderLeaf,
|
127
|
+
onKeyDown: onKeyDown
|
128
|
+
}), /*#__PURE__*/_jsx(MentionsPopup, {
|
129
|
+
mentions: mentions,
|
130
|
+
setMentions: setMentions,
|
131
|
+
editor: editor,
|
132
|
+
target: target,
|
133
|
+
index: index,
|
134
|
+
chars: chars
|
135
|
+
})]
|
136
|
+
})]
|
137
|
+
}), htmlAction.showInput && /*#__PURE__*/_jsx(CodeToText, {
|
138
|
+
...htmlAction,
|
139
|
+
handleCodeToText: handleCodeToText
|
140
|
+
})]
|
141
|
+
}, id);
|
130
142
|
};
|
131
143
|
const CHARACTERS = ["Aayla Secura", "Adi Gallia", "Admiral Dodd Rancit", "Admiral Firmus Piett", "Admiral Gial Ackbar", "Admiral Ozzel", "Admiral Raddus", "Admiral Terrinald Screed", "Admiral Trench", "Admiral U.O. Statura", "Agen Kolar", "Agent Kallus", "Aiolin and Morit Astarte", "Aks Moe", "Almec", "Alton Kastle", "Amee", "AP-5", "Armitage Hux", "Artoo", "Arvel Crynyd", "Asajj Ventress", "Aurra Sing", "AZI-3", "Bala-Tik", "Barada", "Bargwill Tomder", "Baron Papanoida", "Barriss Offee", "Baze Malbus", "Bazine Netal", "BB-8", "BB-9E", "Ben Quadinaros", "Berch Teller", "Beru Lars", "Bib Fortuna", "Biggs Darklighter", "Black Krrsantan", "Bo-Katan Kryze", "Boba Fett", "Bobbajo", "Bodhi Rook", "Borvo the Hutt", "Boss Nass", "Bossk", "Breha Antilles-Organa", "Bren Derlin", "Brendol Hux", "BT-1", "C-3PO", "C1-10P", "Cad Bane", "Caluan Ematt", "Captain Gregor", "Captain Phasma", "Captain Quarsh Panaka", "Captain Rex", "Carlist Rieekan", "Casca Panzoro", "Cassian Andor", "Cassio Tagge", "Cham Syndulla", "Che Amanwe Papanoida", "Chewbacca", "Chi Eekway Papanoida", "Chief Chirpa", "Chirrut Îmwe", "Ciena Ree", "Cin Drallig", "Clegg Holdfast", "Cliegg Lars", "Coleman Kcaj", "Coleman Trebor", "Colonel Kaplan", "Commander Bly", "Commander Cody (CC-2224)", "Commander Fil (CC-3714)", "Commander Fox", "Commander Gree", "Commander Jet", "Commander Wolffe", "Conan Antonio Motti", "Conder Kyl", "Constable Zuvio", "Cordé", "Cpatain Typho", "Crix Madine", "Cut Lawquane", "Dak Ralter", "Dapp", "Darth Bane", "Darth Maul", "Darth Tyranus", "Daultay Dofine", "Del Meeko", "Delian Mors", "Dengar", "Depa Billaba", "Derek Klivian", "Dexter Jettster", "Dineé Ellberger", "DJ", "Doctor Aphra", "Doctor Evazan", "Dogma", "Dormé", "Dr. Cylo", "Droidbait", "Droopy McCool", "Dryden Vos", "Dud Bolt", "Ebe E. Endocott", "Echuu Shen-Jon", "Eeth Koth", "Eighth Brother", "Eirtaé", "Eli Vanto", "Ellé", "Ello Asty", "Embo", "Eneb Ray", "Enfys Nest", "EV-9D9", "Evaan Verlaine", "Even Piell", "Ezra Bridger", "Faro Argyus", "Feral", "Fifth Brother", "Finis Valorum", "Finn", "Fives", "FN-1824", "FN-2003", "Fodesinbeed Annodue", "Fulcrum", "FX-7", "GA-97", "Galen Erso", "Gallius Rax", 'Garazeb "Zeb" Orrelios', "Gardulla the Hutt", "Garrick Versio", "Garven Dreis", "Gavyn Sykes", "Gideon Hask", "Gizor Dellso", "Gonk droid", "Grand Inquisitor", "Greeata Jendowanian", "Greedo", "Greer Sonnel", "Grievous", "Grummgar", "Gungi", "Hammerhead", "Han Solo", "Harter Kalonia", "Has Obbit", "Hera Syndulla", "Hevy", "Hondo Ohnaka", "Huyang", "Iden Versio", "IG-88", "Ima-Gun Di", "Inquisitors", "Inspector Thanoth", "Jabba", "Jacen Syndulla", "Jan Dodonna", "Jango Fett", "Janus Greejatus", "Jar Jar Binks", "Jas Emari", "Jaxxon", "Jek Tono Porkins", "Jeremoch Colton", "Jira", "Jobal Naberrie", "Jocasta Nu", "Joclad Danva", "Joh Yowza", "Jom Barell", "Joph Seastriker", "Jova Tarkin", "Jubnuk", "Jyn Erso", "K-2SO", "Kanan Jarrus", "Karbin", "Karina the Great", "Kes Dameron", "Ketsu Onyo", "Ki-Adi-Mundi", "King Katuunko", "Kit Fisto", "Kitster Banai", "Klaatu", "Klik-Klak", "Korr Sella", "Kylo Ren", "L3-37", "Lama Su", "Lando Calrissian", "Lanever Villecham", "Leia Organa", "Letta Turmond", "Lieutenant Kaydel Ko Connix", "Lieutenant Thire", "Lobot", "Logray", "Lok Durd", "Longo Two-Guns", "Lor San Tekka", "Lorth Needa", "Lott Dod", "Luke Skywalker", "Lumat", "Luminara Unduli", "Lux Bonteri", "Lyn Me", "Lyra Erso", "Mace Windu", "Malakili", "Mama the Hutt", "Mars Guo", "Mas Amedda", "Mawhonic", "Max Rebo", "Maximilian Veers", "Maz Kanata", "ME-8D9", "Meena Tills", "Mercurial Swift", "Mina Bonteri", "Miraj Scintel", "Mister Bones", "Mod Terrik", "Moden Canady", "Mon Mothma", "Moradmin Bast", "Moralo Eval", "Morley", "Mother Talzin", "Nahdar Vebb", "Nahdonnis Praji", "Nien Nunb", "Niima the Hutt", "Nines", "Norra Wexley", "Nute Gunray", "Nuvo Vindi", "Obi-Wan Kenobi", "Odd Ball", "Ody Mandrell", "Omi", "Onaconda Farr", "Oola", "OOM-9", "Oppo Rancisis", "Orn Free Taa", "Oro Dassyne", "Orrimarko", "Osi Sobeck", "Owen Lars", "Pablo-Jill", "Padmé Amidala", "Pagetti Rook", "Paige Tico", "Paploo", "Petty Officer Thanisson", "Pharl McQuarrie", "Plo Koon", "Po Nudo", "Poe Dameron", "Poggle the Lesser", "Pong Krell", "Pooja Naberrie", "PZ-4CO", "Quarrie", "Quay Tolsite", "Queen Apailana", "Queen Jamillia", "Queen Neeyutnee", "Qui-Gon Jinn", "Quiggold", "Quinlan Vos", "R2-D2", "R2-KT", "R3-S6", "R4-P17", "R5-D4", "RA-7", "Rabé", "Rako Hardeen", "Ransolm Casterfo", "Rappertunie", "Ratts Tyerell", "Raymus Antilles", "Ree-Yees", "Reeve Panzoro", "Rey", "Ric Olié", "Riff Tamson", "Riley", "Rinnriyin Di", "Rio Durant", "Rogue Squadron", "Romba", "Roos Tarpals", "Rose Tico", "Rotta the Hutt", "Rukh", "Rune Haako", "Rush Clovis", "Ruwee Naberrie", "Ryoo Naberrie", "Sabé", "Sabine Wren", "Saché", "Saelt-Marae", "Saesee Tiin", "Salacious B. Crumb", "San Hill", "Sana Starros", "Sarco Plank", "Sarkli", "Satine Kryze", "Savage Opress", "Sebulba", "Senator Organa", "Sergeant Kreel", "Seventh Sister", "Shaak Ti", "Shara Bey", "Shmi Skywalker", "Shu Mai", "Sidon Ithano", "Sifo-Dyas", "Sim Aloo", "Siniir Rath Velus", "Sio Bibble", "Sixth Brother", "Slowen Lo", "Sly Moore", "Snaggletooth", "Snap Wexley", "Snoke", "Sola Naberrie", "Sora Bulq", "Strono Tuggs", "Sy Snootles", "Tallissan Lintra", "Tarfful", "Tasu Leech", "Taun We", "TC-14", "Tee Watt Kaa", "Teebo", "Teedo", "Teemto Pagalies", "Temiri Blagg", "Tessek", "Tey How", "Thane Kyrell", "The Bendu", "The Smuggler", "Thrawn", "Tiaan Jerjerrod", "Tion Medon", "Tobias Beckett", "Tulon Voidgazer", "Tup", "U9-C4", "Unkar Plutt", "Val Beckett", "Vanden Willard", "Vice Admiral Amilyn Holdo", "Vober Dand", "WAC-47", "Wag Too", "Wald", "Walrus Man", "Warok", "Wat Tambor", "Watto", "Wedge Antilles", "Wes Janson", "Wicket W. Warrick", "Wilhuff Tarkin", "Wollivan", "Wuher", "Wullf Yularen", "Xamuel Lennox", "Yaddle", "Yarael Poof", "Yoda", "Zam Wesell", "Zev Senesca", "Ziro the Hutt", "Zuckuss"];
|
132
144
|
export default CommonEditor;
|
@@ -4,6 +4,8 @@ import Icon from "../../common/Icon";
|
|
4
4
|
import { Interweave } from "interweave";
|
5
5
|
import { Transforms } from "slate";
|
6
6
|
import { useSlateStatic } from "slate-react";
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
8
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
7
9
|
const CodeToText = props => {
|
8
10
|
const {
|
9
11
|
html,
|
@@ -74,39 +76,48 @@ const CodeToText = props => {
|
|
74
76
|
html: ""
|
75
77
|
});
|
76
78
|
};
|
77
|
-
return /*#__PURE__*/
|
79
|
+
return /*#__PURE__*/_jsx("div", {
|
78
80
|
className: "code-wrapper",
|
79
|
-
ref: wrapperRef
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
81
|
+
ref: wrapperRef,
|
82
|
+
children: /*#__PURE__*/_jsxs("div", {
|
83
|
+
ref: codeToTextRef,
|
84
|
+
className: "codeToTextWrapper",
|
85
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
86
|
+
className: "codeToText",
|
87
|
+
children: [/*#__PURE__*/_jsx("textarea", {
|
88
|
+
name: "",
|
89
|
+
id: "",
|
90
|
+
value: html,
|
91
|
+
onChange: codeOnChange,
|
92
|
+
placeholder: "Write html here..."
|
93
|
+
}), /*#__PURE__*/_jsx("div", {
|
94
|
+
style: {
|
95
|
+
display: "flex",
|
96
|
+
alignItems: "center",
|
97
|
+
justifyContent: "center",
|
98
|
+
color: "white"
|
99
|
+
},
|
100
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
101
|
+
icon: "arrowRight"
|
102
|
+
})
|
103
|
+
}), /*#__PURE__*/_jsx("div", {
|
104
|
+
className: "textOutput",
|
105
|
+
children: /*#__PURE__*/_jsx(Interweave, {
|
106
|
+
content: html
|
107
|
+
})
|
108
|
+
})]
|
109
|
+
}), /*#__PURE__*/_jsxs("div", {
|
110
|
+
children: [/*#__PURE__*/_jsx("button", {
|
111
|
+
onClick: addHtml,
|
112
|
+
className: "done",
|
113
|
+
children: "Done"
|
114
|
+
}), /*#__PURE__*/_jsx("button", {
|
115
|
+
className: "clear",
|
116
|
+
onClick: clearHtml,
|
117
|
+
children: "Clear"
|
118
|
+
})]
|
119
|
+
})]
|
120
|
+
})
|
121
|
+
});
|
111
122
|
};
|
112
123
|
export default CodeToText;
|
@@ -1,18 +1,23 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import Button from '../../common/Button';
|
3
3
|
import Icon from '../../common/Icon';
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
5
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
4
6
|
const CodeToTextButton = props => {
|
5
7
|
const {
|
6
8
|
handleButtonClick
|
7
9
|
} = props;
|
8
|
-
return /*#__PURE__*/
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
11
|
+
children: /*#__PURE__*/_jsx(Button, {
|
12
|
+
format: "insert Html",
|
13
|
+
onClick: () => handleButtonClick({
|
14
|
+
showInput: true,
|
15
|
+
action: 'insert'
|
16
|
+
}),
|
17
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
18
|
+
icon: "insertHtml"
|
19
|
+
})
|
13
20
|
})
|
14
|
-
}
|
15
|
-
icon: "insertHtml"
|
16
|
-
})));
|
21
|
+
});
|
17
22
|
};
|
18
23
|
export default CodeToTextButton;
|
@@ -1,9 +1,10 @@
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
2
1
|
import { Interweave } from "interweave";
|
3
2
|
import React, { useEffect } from "react";
|
4
3
|
import { Transforms, Path } from "slate";
|
5
4
|
import { useSelected, useFocused, useSlateStatic } from "slate-react";
|
6
5
|
import useFormat from "../../utils/customHooks/useFormat";
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
7
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
7
8
|
const HtmlCode = props => {
|
8
9
|
const {
|
9
10
|
attributes,
|
@@ -40,15 +41,19 @@ const HtmlCode = props => {
|
|
40
41
|
document.removeEventListener("keyup", handleKeyUp);
|
41
42
|
};
|
42
43
|
}, [isHtmlEmbed]);
|
43
|
-
return /*#__PURE__*/
|
44
|
+
return /*#__PURE__*/_jsxs("div", {
|
45
|
+
...attributes,
|
46
|
+
...element.attr,
|
44
47
|
style: {
|
45
48
|
boxShadow: selected && focused && "0 0 3px 3px lightgray",
|
46
49
|
marginRight: "20px"
|
47
|
-
}
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
50
|
+
},
|
51
|
+
children: [/*#__PURE__*/_jsx("div", {
|
52
|
+
contentEditable: false,
|
53
|
+
children: /*#__PURE__*/_jsx(Interweave, {
|
54
|
+
content: element.html
|
55
|
+
})
|
56
|
+
}), children]
|
57
|
+
});
|
53
58
|
};
|
54
59
|
export default HtmlCode;
|
@@ -2,6 +2,8 @@ import React, { useState } from "react";
|
|
2
2
|
import useContextMenu from "../../utils/customHooks/useContextMenu.js";
|
3
3
|
import Icon from "../../common/Icon";
|
4
4
|
import { Transforms, Node, Path } from "slate";
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
6
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
5
7
|
const HtmlContextMenu = props => {
|
6
8
|
const {
|
7
9
|
editor,
|
@@ -23,17 +25,21 @@ const HtmlContextMenu = props => {
|
|
23
25
|
location: selection
|
24
26
|
});
|
25
27
|
};
|
26
|
-
return showMenu && /*#__PURE__*/
|
28
|
+
return showMenu && /*#__PURE__*/_jsx("div", {
|
27
29
|
className: "contextMenu",
|
28
30
|
style: {
|
29
31
|
top,
|
30
32
|
left
|
31
|
-
}
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
33
|
+
},
|
34
|
+
children: /*#__PURE__*/_jsxs("div", {
|
35
|
+
className: "menuOption",
|
36
|
+
onClick: handleEditHtml,
|
37
|
+
children: [/*#__PURE__*/_jsx(Icon, {
|
38
|
+
icon: "pen"
|
39
|
+
}), /*#__PURE__*/_jsx("span", {
|
40
|
+
children: "Edit HTML"
|
41
|
+
})]
|
42
|
+
})
|
43
|
+
});
|
38
44
|
};
|
39
45
|
export default HtmlContextMenu;
|
@@ -6,11 +6,13 @@ import { addMarkData, activeMark } from "../../utils/SlateUtilityFunctions";
|
|
6
6
|
import { Transforms } from "slate";
|
7
7
|
import usePopup from "../../utils/customHooks/usePopup";
|
8
8
|
import { ReactEditor } from "slate-react";
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
10
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
9
11
|
const logo = {
|
10
|
-
color: /*#__PURE__*/
|
12
|
+
color: /*#__PURE__*/_jsx(MdFormatColorText, {
|
11
13
|
size: 20
|
12
14
|
}),
|
13
|
-
bgColor: /*#__PURE__*/
|
15
|
+
bgColor: /*#__PURE__*/_jsx(MdFormatColorFill, {
|
14
16
|
size: 20
|
15
17
|
})
|
16
18
|
};
|
@@ -59,58 +61,64 @@ const ColorPicker = ({
|
|
59
61
|
setValidHex(isValideHexSix.test(newHex) || isValideHexThree.test(newHex));
|
60
62
|
setHexValue(newHex);
|
61
63
|
};
|
62
|
-
return /*#__PURE__*/
|
64
|
+
return /*#__PURE__*/_jsxs("div", {
|
63
65
|
className: "color-picker popup-wrapper",
|
64
|
-
ref: colorPickerRef
|
65
|
-
|
66
|
-
style: {
|
67
|
-
color: showOptions ? "black" : activeMark(editor, format),
|
68
|
-
opacity: "1"
|
69
|
-
},
|
70
|
-
className: showOptions ? "clicked" : "",
|
71
|
-
onClick: toggleOption
|
72
|
-
}, logo[format]), showOptions && /*#__PURE__*/React.createElement("div", {
|
73
|
-
className: "popup"
|
74
|
-
}, /*#__PURE__*/React.createElement("div", {
|
75
|
-
className: "color-options"
|
76
|
-
}, colors.map((color, index) => {
|
77
|
-
return /*#__PURE__*/React.createElement("div", {
|
78
|
-
key: index,
|
79
|
-
"data-value": color,
|
80
|
-
onClick: changeColor,
|
81
|
-
className: "option",
|
66
|
+
ref: colorPickerRef,
|
67
|
+
children: [/*#__PURE__*/_jsx("button", {
|
82
68
|
style: {
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
69
|
+
color: showOptions ? "black" : activeMark(editor, format),
|
70
|
+
opacity: "1"
|
71
|
+
},
|
72
|
+
className: showOptions ? "clicked" : "",
|
73
|
+
onClick: toggleOption,
|
74
|
+
children: logo[format]
|
75
|
+
}), showOptions && /*#__PURE__*/_jsxs("div", {
|
76
|
+
className: "popup",
|
77
|
+
children: [/*#__PURE__*/_jsx("div", {
|
78
|
+
className: "color-options",
|
79
|
+
children: colors.map((color, index) => {
|
80
|
+
return /*#__PURE__*/_jsx("div", {
|
81
|
+
"data-value": color,
|
82
|
+
onClick: changeColor,
|
83
|
+
className: "option",
|
84
|
+
style: {
|
85
|
+
background: color
|
86
|
+
}
|
87
|
+
}, index);
|
88
|
+
})
|
89
|
+
}), /*#__PURE__*/_jsx("p", {
|
90
|
+
style: {
|
91
|
+
textAlign: "center",
|
92
|
+
opacity: "0.7",
|
93
|
+
width: "100%"
|
94
|
+
},
|
95
|
+
children: "OR"
|
96
|
+
}), /*#__PURE__*/_jsxs("form", {
|
97
|
+
onSubmit: handleFormSubmit,
|
98
|
+
children: [/*#__PURE__*/_jsx("div", {
|
99
|
+
className: "hexPreview",
|
100
|
+
style: {
|
101
|
+
background: validHex ? hexValue : "#000000"
|
102
|
+
}
|
103
|
+
}), /*#__PURE__*/_jsx("input", {
|
104
|
+
type: "text",
|
105
|
+
placeholder: "#000000",
|
106
|
+
value: hexValue,
|
107
|
+
onChange: handleHexChange,
|
108
|
+
style: {
|
109
|
+
border: validHex === false ? "1px solid red" : "1px solid lightgray"
|
110
|
+
}
|
111
|
+
}), /*#__PURE__*/_jsx("button", {
|
112
|
+
style: {
|
113
|
+
color: validHex ? "green" : ""
|
114
|
+
},
|
115
|
+
type: "submit",
|
116
|
+
children: /*#__PURE__*/_jsx(MdCheck, {
|
117
|
+
size: 20
|
118
|
+
})
|
119
|
+
})]
|
120
|
+
})]
|
121
|
+
})]
|
122
|
+
});
|
115
123
|
};
|
116
124
|
export default ColorPicker;
|
@@ -7,6 +7,8 @@ import { insertEmbed } from '../../utils/embed';
|
|
7
7
|
import { Transforms } from 'slate';
|
8
8
|
import { ReactEditor } from 'slate-react';
|
9
9
|
import './Embed.css';
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
11
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
10
12
|
const Embed = ({
|
11
13
|
editor,
|
12
14
|
format
|
@@ -40,55 +42,66 @@ const Embed = ({
|
|
40
42
|
const handleImageUpload = () => {
|
41
43
|
setShowInput(false);
|
42
44
|
};
|
43
|
-
return /*#__PURE__*/
|
45
|
+
return /*#__PURE__*/_jsxs("div", {
|
44
46
|
ref: urlInputRef,
|
45
|
-
className: "popup-wrapper"
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
47
|
+
className: "popup-wrapper",
|
48
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
49
|
+
active: isBlockActive(editor, format),
|
50
|
+
style: {
|
51
|
+
border: showInput ? '1px solid lightgray' : '',
|
52
|
+
borderBottom: 'none'
|
53
|
+
},
|
54
|
+
format: format,
|
55
|
+
onClick: handleButtonClick,
|
56
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
57
|
+
icon: format
|
58
|
+
})
|
59
|
+
}), showInput && /*#__PURE__*/_jsxs("div", {
|
60
|
+
className: "popup",
|
61
|
+
children: [format === 'image' && /*#__PURE__*/_jsxs("div", {
|
62
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
63
|
+
style: {
|
64
|
+
display: 'flex',
|
65
|
+
gap: '10px'
|
66
|
+
},
|
67
|
+
onClick: handleImageUpload,
|
68
|
+
children: [/*#__PURE__*/_jsx(Icon, {
|
69
|
+
icon: "upload"
|
70
|
+
}), /*#__PURE__*/_jsx("span", {
|
71
|
+
children: "Upload"
|
72
|
+
})]
|
73
|
+
}), /*#__PURE__*/_jsx("p", {
|
74
|
+
style: {
|
75
|
+
textAlign: 'center',
|
76
|
+
opacity: '0.7',
|
77
|
+
width: '100%'
|
78
|
+
},
|
79
|
+
children: "OR"
|
80
|
+
})]
|
81
|
+
}), /*#__PURE__*/_jsxs("form", {
|
82
|
+
onSubmit: handleFormSubmit,
|
83
|
+
children: [/*#__PURE__*/_jsx("input", {
|
84
|
+
type: "text",
|
85
|
+
placeholder: "Enter url",
|
86
|
+
value: formData.url,
|
87
|
+
onChange: e => setFormData(prev => ({
|
88
|
+
...prev,
|
89
|
+
url: e.target.value
|
90
|
+
}))
|
91
|
+
}), /*#__PURE__*/_jsx("input", {
|
92
|
+
type: "text",
|
93
|
+
placeholder: "Enter alt",
|
94
|
+
value: formData.alt,
|
95
|
+
onChange: e => setFormData(prev => ({
|
96
|
+
...prev,
|
97
|
+
alt: e.target.value
|
98
|
+
}))
|
99
|
+
}), /*#__PURE__*/_jsx(Button, {
|
100
|
+
type: "submit",
|
101
|
+
children: "Save"
|
102
|
+
})]
|
103
|
+
})]
|
104
|
+
})]
|
105
|
+
});
|
93
106
|
};
|
94
107
|
export default Embed;
|