@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
@@ -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 React, { useEffect, useState } from "react";
|
3
2
|
import { useSlateStatic, useSelected, useFocused, ReactEditor } from "slate-react";
|
4
3
|
import { Node, Transforms } from "slate";
|
5
4
|
import Icon from "../../common/Icon";
|
6
5
|
import useResize from "../../utils/customHooks/useResize";
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
7
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
7
8
|
const Image = ({
|
8
9
|
attributes,
|
9
10
|
element,
|
@@ -37,34 +38,39 @@ const Image = ({
|
|
37
38
|
});
|
38
39
|
}
|
39
40
|
}, [resizing]);
|
40
|
-
return /*#__PURE__*/
|
41
|
+
return /*#__PURE__*/_jsxs("div", {
|
42
|
+
...attributes,
|
41
43
|
className: "embed",
|
42
44
|
style: {
|
43
45
|
display: "flex",
|
44
46
|
width: "100%",
|
45
47
|
maxWidth: "100%",
|
46
48
|
boxShadow: selected && focused && "0 0 3px 3px lightgray"
|
47
|
-
}
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
49
|
+
},
|
50
|
+
...element.attr,
|
51
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
52
|
+
contentEditable: false,
|
53
|
+
style: {
|
54
|
+
position: "relative",
|
55
|
+
width: size.widthInPercent ? `${size.widthInPercent}%` : `${size.width}px`,
|
56
|
+
height: `${size.height}px`
|
57
|
+
},
|
58
|
+
children: [/*#__PURE__*/_jsx("img", {
|
59
|
+
alt: alt,
|
60
|
+
src: url
|
61
|
+
}), selected && /*#__PURE__*/_jsx("button", {
|
62
|
+
onPointerDown: onMouseDown,
|
63
|
+
style: {
|
64
|
+
width: "15px",
|
65
|
+
height: "15px",
|
66
|
+
opacity: 1,
|
67
|
+
background: "transparent"
|
68
|
+
},
|
69
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
70
|
+
icon: "resize"
|
71
|
+
})
|
72
|
+
})]
|
73
|
+
}), children]
|
74
|
+
});
|
69
75
|
};
|
70
76
|
export default Image;
|
@@ -1,8 +1,9 @@
|
|
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 from "react";
|
3
2
|
import { useSelected, useFocused } from "slate-react";
|
4
3
|
import Icon from "../../common/Icon";
|
5
4
|
import useResize from "../../utils/customHooks/useResize";
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
6
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
6
7
|
const Video = ({
|
7
8
|
attributes,
|
8
9
|
element,
|
@@ -15,46 +16,52 @@ const Video = ({
|
|
15
16
|
const [size, onMouseDown, resizing] = useResize();
|
16
17
|
const selected = useSelected();
|
17
18
|
const focused = useFocused();
|
18
|
-
return /*#__PURE__*/
|
19
|
+
return /*#__PURE__*/_jsxs("div", {
|
20
|
+
...attributes,
|
19
21
|
className: "embed",
|
20
22
|
style: {
|
21
23
|
display: "flex",
|
22
24
|
boxShadow: selected && focused && "0 0 3px 3px lightgray"
|
23
|
-
}
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
25
|
+
},
|
26
|
+
...element.attr,
|
27
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
28
|
+
contentEditable: false,
|
29
|
+
style: {
|
30
|
+
width: `${size.width}px`,
|
31
|
+
height: `${size.height}px`
|
32
|
+
},
|
33
|
+
children: [
|
34
|
+
// The iframe reloads on each re-render and hence it stutters and the document doesn't detect mouse-up event leading to unwanted behaviour
|
35
|
+
// So during resize replace the iframe with a simple div
|
36
|
+
resizing ? /*#__PURE__*/_jsx("div", {
|
37
|
+
style: {
|
38
|
+
width: "100%",
|
39
|
+
height: "100%",
|
40
|
+
border: "2px dashed black",
|
41
|
+
display: "flex",
|
42
|
+
justifyContent: "center",
|
43
|
+
alignItems: "center"
|
44
|
+
},
|
45
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
46
|
+
icon: "videoPlayer"
|
47
|
+
})
|
48
|
+
}) : /*#__PURE__*/_jsx("iframe", {
|
49
|
+
src: url,
|
50
|
+
frameBorder: "0",
|
51
|
+
title: alt
|
52
|
+
}), selected && /*#__PURE__*/_jsx("button", {
|
53
|
+
onMouseDown: onMouseDown,
|
54
|
+
style: {
|
55
|
+
width: "15px",
|
56
|
+
height: "15px",
|
57
|
+
opacity: 1,
|
58
|
+
background: "transparent"
|
59
|
+
},
|
60
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
61
|
+
icon: "resize"
|
62
|
+
})
|
63
|
+
})]
|
64
|
+
}), children]
|
65
|
+
});
|
59
66
|
};
|
60
67
|
export default Video;
|
@@ -1,7 +1,8 @@
|
|
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 from "react";
|
3
2
|
import { InlineMath, BlockMath } from "react-katex";
|
4
3
|
import "./styles.css";
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
5
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
5
6
|
const Equation = ({
|
6
7
|
attributes,
|
7
8
|
element,
|
@@ -11,14 +12,20 @@ const Equation = ({
|
|
11
12
|
inline,
|
12
13
|
math
|
13
14
|
} = element;
|
14
|
-
return /*#__PURE__*/
|
15
|
-
className: inline ? "equation-inline" : ""
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
15
|
+
return /*#__PURE__*/_jsx("div", {
|
16
|
+
className: inline ? "equation-inline" : "",
|
17
|
+
children: /*#__PURE__*/_jsxs("span", {
|
18
|
+
...attributes,
|
19
|
+
...element.attr,
|
20
|
+
children: [/*#__PURE__*/_jsx("span", {
|
21
|
+
contentEditable: false,
|
22
|
+
children: inline ? /*#__PURE__*/_jsx(InlineMath, {
|
23
|
+
math: math
|
24
|
+
}) : /*#__PURE__*/_jsx(BlockMath, {
|
25
|
+
math: math
|
26
|
+
})
|
27
|
+
}), children]
|
28
|
+
})
|
29
|
+
});
|
23
30
|
};
|
24
31
|
export default Equation;
|
@@ -4,6 +4,8 @@ import Icon from '../../common/Icon';
|
|
4
4
|
import usePopup from '../../utils/customHooks/usePopup';
|
5
5
|
import { insertEquation } from '../../utils/equation';
|
6
6
|
import { Transforms } from 'slate';
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
8
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
7
9
|
const EquationButton = ({
|
8
10
|
editor
|
9
11
|
}) => {
|
@@ -33,34 +35,41 @@ const EquationButton = ({
|
|
33
35
|
console.log('btn click');
|
34
36
|
setShowInput(false);
|
35
37
|
};
|
36
|
-
return /*#__PURE__*/
|
38
|
+
return /*#__PURE__*/_jsxs("div", {
|
37
39
|
ref: equationInputRef,
|
38
|
-
className: "popup-wrapper"
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
40
|
+
className: "popup-wrapper",
|
41
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
42
|
+
format: "equation",
|
43
|
+
onClick: toggleButton,
|
44
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
45
|
+
icon: "equation"
|
46
|
+
})
|
47
|
+
}), showInput && /*#__PURE__*/_jsxs("div", {
|
48
|
+
className: "popup",
|
49
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
50
|
+
style: {
|
51
|
+
display: 'flex',
|
52
|
+
gap: '5px'
|
53
|
+
},
|
54
|
+
children: [/*#__PURE__*/_jsx("input", {
|
55
|
+
type: "text",
|
56
|
+
value: math,
|
57
|
+
onChange: handleInputChange,
|
58
|
+
placeholder: "Enter formula"
|
59
|
+
}), /*#__PURE__*/_jsx("div", {
|
60
|
+
onClick: handleAddEquation,
|
61
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
62
|
+
icon: "add"
|
63
|
+
})
|
64
|
+
})]
|
65
|
+
}), /*#__PURE__*/_jsxs("label", {
|
66
|
+
children: [/*#__PURE__*/_jsx("input", {
|
67
|
+
type: "checkbox",
|
68
|
+
checked: displayInline,
|
69
|
+
onChange: handleInputChange
|
70
|
+
}), "Inline Equation"]
|
71
|
+
})]
|
72
|
+
})]
|
73
|
+
});
|
65
74
|
};
|
66
75
|
export default EquationButton;
|
@@ -1,8 +1,9 @@
|
|
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 from "react";
|
3
2
|
import { Transforms, Path } from "slate";
|
4
3
|
import { useSelected, useSlateStatic } from "slate-react";
|
5
4
|
import { gridItem } from "../../utils/gridItem";
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
6
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
6
7
|
const Grid = props => {
|
7
8
|
const {
|
8
9
|
attributes,
|
@@ -39,15 +40,19 @@ const Grid = props => {
|
|
39
40
|
}
|
40
41
|
};
|
41
42
|
const GridToolBar = () => {
|
42
|
-
return selected ? /*#__PURE__*/
|
43
|
+
return selected ? /*#__PURE__*/_jsx("div", {
|
43
44
|
className: "grid-container-toolbar",
|
44
|
-
contentEditable: false
|
45
|
-
|
46
|
-
|
47
|
-
|
45
|
+
contentEditable: false,
|
46
|
+
children: /*#__PURE__*/_jsx("button", {
|
47
|
+
onClick: onAddGridItem,
|
48
|
+
children: "+ Add Item"
|
49
|
+
})
|
50
|
+
}) : null;
|
48
51
|
};
|
49
|
-
return /*#__PURE__*/
|
50
|
-
className: `grid-container ${grid}
|
51
|
-
|
52
|
+
return /*#__PURE__*/_jsxs("div", {
|
53
|
+
className: `grid-container ${grid}`,
|
54
|
+
...attributes,
|
55
|
+
children: [/*#__PURE__*/_jsx(GridToolBar, {}), children]
|
56
|
+
});
|
52
57
|
};
|
53
58
|
export default Grid;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import ViewComfyIcon from "@mui/icons-material/ViewComfy";
|
3
3
|
import { insertGrid } from "../../utils/grid";
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
4
5
|
const GridButton = props => {
|
5
6
|
const {
|
6
7
|
editor
|
@@ -8,12 +9,13 @@ const GridButton = props => {
|
|
8
9
|
const handleInsertGrid = () => {
|
9
10
|
insertGrid(editor);
|
10
11
|
};
|
11
|
-
return /*#__PURE__*/
|
12
|
+
return /*#__PURE__*/_jsx("button", {
|
12
13
|
onClick: handleInsertGrid,
|
13
14
|
title: "Layout",
|
14
15
|
style: {
|
15
16
|
marginLeft: "8px"
|
16
|
-
}
|
17
|
-
|
17
|
+
},
|
18
|
+
children: /*#__PURE__*/_jsx(ViewComfyIcon, {})
|
19
|
+
});
|
18
20
|
};
|
19
21
|
export default GridButton;
|
@@ -1,7 +1,8 @@
|
|
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 from "react";
|
3
2
|
import { Transforms, Element } from "slate";
|
4
3
|
import { useSelected, useSlateStatic } from "slate-react";
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
5
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
5
6
|
const GridItem = props => {
|
6
7
|
const {
|
7
8
|
attributes,
|
@@ -33,21 +34,25 @@ const GridItem = props => {
|
|
33
34
|
});
|
34
35
|
};
|
35
36
|
const GridItemToolbar = () => {
|
36
|
-
return selected ? /*#__PURE__*/
|
37
|
+
return selected ? /*#__PURE__*/_jsxs("div", {
|
37
38
|
contentEditable: false,
|
38
|
-
className: "grid-item-toolbar"
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
39
|
+
className: "grid-item-toolbar",
|
40
|
+
children: [/*#__PURE__*/_jsx("button", {
|
41
|
+
onClick: onItemSizeDecrease,
|
42
|
+
children: "-"
|
43
|
+
}), /*#__PURE__*/_jsx("button", {
|
44
|
+
onClick: onItemSizeIncrease,
|
45
|
+
children: "+"
|
46
|
+
})]
|
47
|
+
}) : null;
|
44
48
|
};
|
45
|
-
return /*#__PURE__*/
|
46
|
-
className: `grid-item xs-${grid}
|
47
|
-
|
49
|
+
return /*#__PURE__*/_jsxs("div", {
|
50
|
+
className: `grid-item xs-${grid}`,
|
51
|
+
...attributes,
|
48
52
|
style: {
|
49
53
|
width: `${itemWidth}%`
|
50
|
-
}
|
51
|
-
|
54
|
+
},
|
55
|
+
children: [children, /*#__PURE__*/_jsx(GridItemToolbar, {})]
|
56
|
+
});
|
52
57
|
};
|
53
58
|
export default GridItem;
|
@@ -3,6 +3,8 @@ import React, { useRef, useState } from "react";
|
|
3
3
|
import Button from "../../common/Button";
|
4
4
|
import Icon from "../../common/Icon";
|
5
5
|
import usePopup from "../../utils/customHooks/usePopup";
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
7
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
6
8
|
const Id = ({
|
7
9
|
editor
|
8
10
|
}) => {
|
@@ -27,30 +29,34 @@ const Id = ({
|
|
27
29
|
setShowInput(false);
|
28
30
|
setId("");
|
29
31
|
};
|
30
|
-
return /*#__PURE__*/
|
32
|
+
return /*#__PURE__*/_jsxs("div", {
|
31
33
|
className: "popup-wrapper",
|
32
|
-
ref: idInputRef
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
34
|
+
ref: idInputRef,
|
35
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
36
|
+
className: showInput ? "clicked" : "",
|
37
|
+
format: "add Id",
|
38
|
+
onClick: toggleId,
|
39
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
40
|
+
icon: "addId"
|
41
|
+
})
|
42
|
+
}), showInput && /*#__PURE__*/_jsxs("div", {
|
43
|
+
className: "popup",
|
44
|
+
style: {
|
45
|
+
display: "flex",
|
46
|
+
gap: "4px"
|
47
|
+
},
|
48
|
+
children: [/*#__PURE__*/_jsx("input", {
|
49
|
+
type: "text",
|
50
|
+
placeholder: "Enter an unique ID",
|
51
|
+
value: id,
|
52
|
+
onChange: e => setId(e.target.value)
|
53
|
+
}), /*#__PURE__*/_jsx("div", {
|
54
|
+
onClick: handleId,
|
55
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
56
|
+
icon: "add"
|
57
|
+
})
|
58
|
+
})]
|
59
|
+
})]
|
60
|
+
});
|
55
61
|
};
|
56
62
|
export default Id;
|
@@ -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 React from 'react';
|
3
2
|
import { useFocused, useSelected, useSlateStatic } from 'slate-react';
|
4
3
|
import { removeLink } from '../../utils/link';
|
5
4
|
import unlink from '../../Toolbar/toolbarIcons/unlink.svg';
|
6
5
|
import './styles.css';
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
7
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
7
8
|
const Link = ({
|
8
9
|
attributes,
|
9
10
|
element,
|
@@ -12,23 +13,29 @@ const Link = ({
|
|
12
13
|
const editor = useSlateStatic();
|
13
14
|
const selected = useSelected();
|
14
15
|
const focused = useFocused();
|
15
|
-
return /*#__PURE__*/
|
16
|
-
className: "link"
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
16
|
+
return /*#__PURE__*/_jsxs("div", {
|
17
|
+
className: "link",
|
18
|
+
children: [/*#__PURE__*/_jsx("a", {
|
19
|
+
href: element.href,
|
20
|
+
...attributes,
|
21
|
+
...element.attr,
|
22
|
+
target: element.target,
|
23
|
+
children: children
|
24
|
+
}), selected && focused && /*#__PURE__*/_jsxs("div", {
|
25
|
+
className: "link-popup",
|
26
|
+
contentEditable: false,
|
27
|
+
children: [/*#__PURE__*/_jsx("a", {
|
28
|
+
href: element.href,
|
29
|
+
target: element.target,
|
30
|
+
children: element.href
|
31
|
+
}), /*#__PURE__*/_jsx("button", {
|
32
|
+
onClick: () => removeLink(editor),
|
33
|
+
children: /*#__PURE__*/_jsx("img", {
|
34
|
+
src: unlink,
|
35
|
+
alt: ""
|
36
|
+
})
|
37
|
+
})]
|
38
|
+
})]
|
39
|
+
});
|
33
40
|
};
|
34
41
|
export default Link;
|
@@ -5,6 +5,8 @@ import Icon from "../../common/Icon";
|
|
5
5
|
import { isBlockActive } from "../../utils/SlateUtilityFunctions";
|
6
6
|
import usePopup from "../../utils/customHooks/usePopup";
|
7
7
|
import { Transforms } from "slate";
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
9
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
8
10
|
const LinkButton = props => {
|
9
11
|
const {
|
10
12
|
editor
|
@@ -37,41 +39,49 @@ const LinkButton = props => {
|
|
37
39
|
setUrl(target.value);
|
38
40
|
}
|
39
41
|
};
|
40
|
-
return /*#__PURE__*/
|
42
|
+
return /*#__PURE__*/_jsxs("div", {
|
41
43
|
ref: linkInputRef,
|
42
|
-
className: "popup-wrapper"
|
43
|
-
|
44
|
-
|
45
|
-
|
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
|
-
|
44
|
+
className: "popup-wrapper",
|
45
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
46
|
+
className: showInput ? "clicked" : "",
|
47
|
+
active: isBlockActive(editor, "link"),
|
48
|
+
format: "link",
|
49
|
+
onClick: toggleLink,
|
50
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
51
|
+
icon: "link"
|
52
|
+
})
|
53
|
+
}), showInput && /*#__PURE__*/_jsxs("div", {
|
54
|
+
className: "popup",
|
55
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
56
|
+
style: {
|
57
|
+
display: "flex",
|
58
|
+
gap: "4px",
|
59
|
+
margin: "5px 2px"
|
60
|
+
},
|
61
|
+
children: [/*#__PURE__*/_jsx("input", {
|
62
|
+
type: "text",
|
63
|
+
placeholder: "https://google.com",
|
64
|
+
value: url,
|
65
|
+
onChange: handleInputChange
|
66
|
+
}), /*#__PURE__*/_jsx("div", {
|
67
|
+
onClick: handleInsertLink,
|
68
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
69
|
+
icon: "add"
|
70
|
+
})
|
71
|
+
})]
|
72
|
+
}), /*#__PURE__*/_jsxs("label", {
|
73
|
+
children: [/*#__PURE__*/_jsx("input", {
|
74
|
+
type: "checkbox",
|
75
|
+
checked: showInNewTab,
|
76
|
+
onChange: handleInputChange
|
77
|
+
}), /*#__PURE__*/_jsx("span", {
|
78
|
+
style: {
|
79
|
+
fontSize: "0.8em"
|
80
|
+
},
|
81
|
+
children: "Open in new tab"
|
82
|
+
})]
|
83
|
+
})]
|
84
|
+
})]
|
85
|
+
});
|
76
86
|
};
|
77
87
|
export default LinkButton;
|