@pie-lib/editable-html 11.18.6-esmbeta.0 → 11.19.0-mui-update.0
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/CHANGELOG.md +37 -0
- package/lib/block-tags.js +2 -3
- package/lib/block-tags.js.map +1 -1
- package/lib/constants.js +3 -6
- package/lib/constants.js.map +1 -1
- package/lib/editor.js +302 -450
- package/lib/editor.js.map +1 -1
- package/lib/index.js +19 -77
- package/lib/index.js.map +1 -1
- package/lib/parse-html.js +7 -7
- package/lib/parse-html.js.map +1 -1
- package/lib/plugins/characters/custom-popper.js +24 -44
- package/lib/plugins/characters/custom-popper.js.map +1 -1
- package/lib/plugins/characters/index.js +9 -60
- package/lib/plugins/characters/index.js.map +1 -1
- package/lib/plugins/characters/utils.js +3 -6
- package/lib/plugins/characters/utils.js.map +1 -1
- package/lib/plugins/css/icons/index.js +13 -25
- package/lib/plugins/css/icons/index.js.map +1 -1
- package/lib/plugins/css/index.js +22 -88
- package/lib/plugins/css/index.js.map +1 -1
- package/lib/plugins/customPlugin/index.js +10 -26
- package/lib/plugins/customPlugin/index.js.map +1 -1
- package/lib/plugins/html/icons/index.js +14 -26
- package/lib/plugins/html/icons/index.js.map +1 -1
- package/lib/plugins/html/index.js +4 -13
- package/lib/plugins/html/index.js.map +1 -1
- package/lib/plugins/image/alt-dialog.js +20 -49
- package/lib/plugins/image/alt-dialog.js.map +1 -1
- package/lib/plugins/image/component.js +119 -190
- package/lib/plugins/image/component.js.map +1 -1
- package/lib/plugins/image/image-toolbar.js +44 -86
- package/lib/plugins/image/image-toolbar.js.map +1 -1
- package/lib/plugins/image/index.js +6 -46
- package/lib/plugins/image/index.js.map +1 -1
- package/lib/plugins/image/insert-image-handler.js +10 -31
- package/lib/plugins/image/insert-image-handler.js.map +1 -1
- package/lib/plugins/index.js +44 -106
- package/lib/plugins/index.js.map +1 -1
- package/lib/plugins/list/index.js +27 -73
- package/lib/plugins/list/index.js.map +1 -1
- package/lib/plugins/math/index.js +64 -116
- package/lib/plugins/math/index.js.map +1 -1
- package/lib/plugins/media/index.js +23 -81
- package/lib/plugins/media/index.js.map +1 -1
- package/lib/plugins/media/media-dialog.js +192 -307
- package/lib/plugins/media/media-dialog.js.map +1 -1
- package/lib/plugins/media/media-toolbar.js +40 -65
- package/lib/plugins/media/media-toolbar.js.map +1 -1
- package/lib/plugins/media/media-wrapper.js +20 -49
- package/lib/plugins/media/media-wrapper.js.map +1 -1
- package/lib/plugins/rendering/index.js +5 -15
- package/lib/plugins/rendering/index.js.map +1 -1
- package/lib/plugins/respArea/drag-in-the-blank/choice.js +175 -249
- package/lib/plugins/respArea/drag-in-the-blank/choice.js.map +1 -1
- package/lib/plugins/respArea/drag-in-the-blank/index.js +39 -29
- package/lib/plugins/respArea/drag-in-the-blank/index.js.map +1 -1
- package/lib/plugins/respArea/explicit-constructed-response/index.js +3 -10
- package/lib/plugins/respArea/explicit-constructed-response/index.js.map +1 -1
- package/lib/plugins/respArea/icons/index.js +22 -45
- package/lib/plugins/respArea/icons/index.js.map +1 -1
- package/lib/plugins/respArea/index.js +5 -59
- package/lib/plugins/respArea/index.js.map +1 -1
- package/lib/plugins/respArea/inline-dropdown/index.js +2 -10
- package/lib/plugins/respArea/inline-dropdown/index.js.map +1 -1
- package/lib/plugins/respArea/math-templated/index.js +92 -109
- package/lib/plugins/respArea/math-templated/index.js.map +1 -1
- package/lib/plugins/respArea/utils.js +8 -40
- package/lib/plugins/respArea/utils.js.map +1 -1
- package/lib/plugins/table/CustomTablePlugin.js +24 -41
- package/lib/plugins/table/CustomTablePlugin.js.map +1 -1
- package/lib/plugins/table/icons/index.js +19 -35
- package/lib/plugins/table/icons/index.js.map +1 -1
- package/lib/plugins/table/index.js +41 -118
- package/lib/plugins/table/index.js.map +1 -1
- package/lib/plugins/table/table-toolbar.js +37 -87
- package/lib/plugins/table/table-toolbar.js.map +1 -1
- package/lib/plugins/textAlign/icons/index.js +18 -64
- package/lib/plugins/textAlign/icons/index.js.map +1 -1
- package/lib/plugins/textAlign/index.js +1 -6
- package/lib/plugins/textAlign/index.js.map +1 -1
- package/lib/plugins/toolbar/default-toolbar.js +30 -79
- package/lib/plugins/toolbar/default-toolbar.js.map +1 -1
- package/lib/plugins/toolbar/done-button.js +16 -34
- package/lib/plugins/toolbar/done-button.js.map +1 -1
- package/lib/plugins/toolbar/editor-and-toolbar.js +174 -201
- package/lib/plugins/toolbar/editor-and-toolbar.js.map +1 -1
- package/lib/plugins/toolbar/index.js +0 -5
- package/lib/plugins/toolbar/index.js.map +1 -1
- package/lib/plugins/toolbar/toolbar-buttons.js +57 -107
- package/lib/plugins/toolbar/toolbar-buttons.js.map +1 -1
- package/lib/plugins/toolbar/toolbar.js +95 -161
- package/lib/plugins/toolbar/toolbar.js.map +1 -1
- package/lib/plugins/utils.js +5 -25
- package/lib/plugins/utils.js.map +1 -1
- package/lib/serialization.js +44 -150
- package/lib/serialization.js.map +1 -1
- package/lib/shared/alert-dialog.js +23 -42
- package/lib/theme.js +1 -2
- package/lib/theme.js.map +1 -1
- package/package.json +15 -21
- package/src/__tests__/utils.js +1 -1
- package/src/editor.jsx +110 -108
- package/src/plugins/characters/custom-popper.js +20 -25
- package/src/plugins/css/icons/index.jsx +11 -13
- package/src/plugins/css/index.jsx +3 -5
- package/src/plugins/html/icons/index.jsx +12 -14
- package/src/plugins/image/alt-dialog.jsx +9 -8
- package/src/plugins/image/component.jsx +67 -87
- package/src/plugins/image/image-toolbar.jsx +26 -26
- package/src/plugins/image/index.jsx +1 -1
- package/src/plugins/index.jsx +10 -10
- package/src/plugins/math/index.jsx +1 -1
- package/src/plugins/media/index.jsx +2 -2
- package/src/plugins/media/media-dialog.js +65 -76
- package/src/plugins/media/media-toolbar.jsx +32 -33
- package/src/plugins/media/media-wrapper.jsx +10 -13
- package/src/plugins/respArea/drag-in-the-blank/choice.jsx +193 -180
- package/src/plugins/respArea/drag-in-the-blank/index.jsx +58 -22
- package/src/plugins/respArea/icons/index.jsx +16 -16
- package/src/plugins/respArea/math-templated/index.jsx +88 -89
- package/src/plugins/respArea/utils.jsx +1 -1
- package/src/plugins/table/icons/index.jsx +14 -16
- package/src/plugins/table/index.jsx +27 -19
- package/src/plugins/table/table-toolbar.jsx +17 -19
- package/src/plugins/textAlign/icons/index.jsx +3 -3
- package/src/plugins/toolbar/__tests__/default-toolbar.test.jsx +1 -1
- package/src/plugins/toolbar/__tests__/toolbar.test.jsx +1 -1
- package/src/plugins/toolbar/default-toolbar.jsx +18 -21
- package/src/plugins/toolbar/done-button.jsx +16 -22
- package/src/plugins/toolbar/editor-and-toolbar.jsx +134 -157
- package/src/plugins/toolbar/toolbar-buttons.jsx +29 -46
- package/src/plugins/toolbar/toolbar.jsx +60 -78
- package/esm/index.js +0 -111560
- package/esm/index.js.map +0 -1
- package/esm/package.json +0 -1
|
@@ -1,90 +1,195 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports["default"] = exports.EditorAndToolbar = void 0;
|
|
9
|
-
|
|
10
8
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
|
|
12
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
|
|
14
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
|
-
|
|
16
10
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
17
|
-
|
|
18
11
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
19
|
-
|
|
12
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
20
13
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
21
|
-
|
|
22
14
|
var _react = _interopRequireDefault(require("react"));
|
|
23
|
-
|
|
24
15
|
var _toolbar = _interopRequireDefault(require("./toolbar"));
|
|
25
|
-
|
|
26
16
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
27
|
-
|
|
28
17
|
var _debug = _interopRequireDefault(require("debug"));
|
|
29
|
-
|
|
30
18
|
var _theme = require("../../theme");
|
|
31
|
-
|
|
32
|
-
var _styles = require("@material-ui/core/styles");
|
|
33
|
-
|
|
19
|
+
var _styles = require("@mui/material/styles");
|
|
34
20
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
35
|
-
|
|
36
21
|
var _slatePropTypes = _interopRequireDefault(require("slate-prop-types"));
|
|
37
|
-
|
|
38
22
|
var _renderUi = require("@pie-lib/render-ui");
|
|
39
|
-
|
|
40
|
-
function
|
|
41
|
-
|
|
42
|
-
function
|
|
43
|
-
|
|
23
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
24
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
25
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
26
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
44
27
|
var log = (0, _debug["default"])('@pie-lib:editable-html:plugins:toolbar:editor-and-toolbar');
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
28
|
+
var Root = (0, _styles.styled)('div', {
|
|
29
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
30
|
+
return !['noBorder', 'error'].includes(prop);
|
|
31
|
+
}
|
|
32
|
+
})(function (_ref) {
|
|
33
|
+
var theme = _ref.theme,
|
|
34
|
+
noBorder = _ref.noBorder,
|
|
35
|
+
error = _ref.error;
|
|
36
|
+
return {
|
|
37
|
+
position: 'relative',
|
|
38
|
+
padding: '0px',
|
|
39
|
+
border: noBorder ? 'none' : '1px solid #ccc',
|
|
40
|
+
borderRadius: '4px',
|
|
41
|
+
cursor: 'text',
|
|
42
|
+
borderColor: error ? "".concat(theme.palette.error.main, " !important") : undefined,
|
|
43
|
+
borderWidth: error ? '2px !important' : undefined,
|
|
44
|
+
'& [data-slate-editor="true"]': {
|
|
45
|
+
wordBreak: 'break-word',
|
|
46
|
+
overflow: 'visible',
|
|
47
|
+
maxHeight: '500px',
|
|
48
|
+
// needed in order to be able to put the focus before a void element when it is the first one in the editor
|
|
49
|
+
padding: '5px'
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
var EditorHolder = (0, _styles.styled)('div', {
|
|
54
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
55
|
+
return !['inFocus', 'readOnly', 'disableUnderline', 'disableScrollbar'].includes(prop);
|
|
56
|
+
}
|
|
57
|
+
})(function (_ref2) {
|
|
58
|
+
var theme = _ref2.theme,
|
|
59
|
+
inFocus = _ref2.inFocus,
|
|
60
|
+
readOnly = _ref2.readOnly,
|
|
61
|
+
disableUnderline = _ref2.disableUnderline,
|
|
62
|
+
disableScrollbar = _ref2.disableScrollbar;
|
|
63
|
+
return _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
64
|
+
position: 'relative',
|
|
65
|
+
padding: '0px',
|
|
66
|
+
overflowY: 'auto',
|
|
67
|
+
color: _renderUi.color.text(),
|
|
68
|
+
backgroundColor: _renderUi.color.background()
|
|
69
|
+
}, disableScrollbar && {
|
|
70
|
+
'&::-webkit-scrollbar': {
|
|
71
|
+
display: 'none'
|
|
72
|
+
},
|
|
73
|
+
scrollbarWidth: 'none',
|
|
74
|
+
'-ms-overflow-style': 'none'
|
|
75
|
+
}), !disableUnderline && {
|
|
76
|
+
'&::before': {
|
|
77
|
+
left: '0',
|
|
78
|
+
right: '0',
|
|
79
|
+
bottom: '0',
|
|
80
|
+
height: '1px',
|
|
81
|
+
content: '""',
|
|
82
|
+
position: 'absolute',
|
|
83
|
+
transition: 'background-color 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms',
|
|
84
|
+
pointerEvents: 'none',
|
|
85
|
+
backgroundColor: 'rgba(0, 0, 0, 0.42)'
|
|
86
|
+
},
|
|
87
|
+
'&::after': {
|
|
88
|
+
left: '0',
|
|
89
|
+
right: '0',
|
|
90
|
+
bottom: '0',
|
|
91
|
+
height: '1px',
|
|
92
|
+
content: '""',
|
|
93
|
+
position: 'absolute',
|
|
94
|
+
transform: 'scaleX(0)',
|
|
95
|
+
transition: 'transform 200ms cubic-bezier(0.0, 0.0, 0.2, 1) 0ms, background-color 200ms linear',
|
|
96
|
+
backgroundColor: 'rgba(0, 0, 0, 0.42)'
|
|
97
|
+
},
|
|
98
|
+
'&:focus': {
|
|
99
|
+
'&::after': {
|
|
100
|
+
transform: 'scaleX(1)',
|
|
101
|
+
backgroundColor: _theme.primary,
|
|
102
|
+
height: '2px'
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
'&:hover': {
|
|
106
|
+
'&::after': {
|
|
107
|
+
transform: 'scaleX(1)',
|
|
108
|
+
backgroundColor: theme.palette.common.black,
|
|
109
|
+
height: '2px'
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}), readOnly && {
|
|
113
|
+
'&::before': {
|
|
114
|
+
background: 'transparent',
|
|
115
|
+
backgroundSize: '5px 1px',
|
|
116
|
+
backgroundImage: 'linear-gradient(to right, rgba(0, 0, 0, 0.42) 33%, transparent 0%)',
|
|
117
|
+
backgroundRepeat: 'repeat-x',
|
|
118
|
+
backgroundPosition: 'left top'
|
|
119
|
+
},
|
|
120
|
+
'&::after': {
|
|
121
|
+
left: '0',
|
|
122
|
+
right: '0',
|
|
123
|
+
bottom: '0',
|
|
124
|
+
height: '1px',
|
|
125
|
+
content: '""',
|
|
126
|
+
position: 'absolute',
|
|
127
|
+
transform: 'scaleX(0)',
|
|
128
|
+
transition: 'transform 200ms cubic-bezier(0.0, 0.0, 0.2, 1) 0ms, background-color 0ms linear',
|
|
129
|
+
backgroundColor: 'rgba(0, 0, 0, 0)'
|
|
130
|
+
},
|
|
131
|
+
'&:hover': {
|
|
132
|
+
'&::after': {
|
|
133
|
+
transform: 'scaleX(0)',
|
|
134
|
+
backgroundColor: theme.palette.common.black,
|
|
135
|
+
height: '2px'
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}), inFocus && {
|
|
139
|
+
'&::after': {
|
|
140
|
+
transform: 'scaleX(1)',
|
|
141
|
+
backgroundColor: _theme.primary,
|
|
142
|
+
height: '2px'
|
|
143
|
+
},
|
|
144
|
+
'&:hover': {
|
|
145
|
+
'&::after': {
|
|
146
|
+
backgroundColor: _theme.primary
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
var ChildrenContainer = (0, _styles.styled)('div', {
|
|
152
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
153
|
+
return !['noPadding'].includes(prop);
|
|
154
|
+
}
|
|
155
|
+
})(function (_ref3) {
|
|
156
|
+
var noPadding = _ref3.noPadding;
|
|
157
|
+
return {
|
|
158
|
+
padding: noPadding ? 0 : '10px 16px'
|
|
159
|
+
};
|
|
160
|
+
});
|
|
161
|
+
var EditorAndToolbar = exports.EditorAndToolbar = /*#__PURE__*/function (_React$Component) {
|
|
51
162
|
function EditorAndToolbar() {
|
|
52
163
|
(0, _classCallCheck2["default"])(this, EditorAndToolbar);
|
|
53
|
-
return
|
|
164
|
+
return _callSuper(this, EditorAndToolbar, arguments);
|
|
54
165
|
}
|
|
55
|
-
|
|
56
|
-
(0, _createClass2["default"])(EditorAndToolbar, [{
|
|
166
|
+
(0, _inherits2["default"])(EditorAndToolbar, _React$Component);
|
|
167
|
+
return (0, _createClass2["default"])(EditorAndToolbar, [{
|
|
57
168
|
key: "render",
|
|
58
169
|
value: function render() {
|
|
59
|
-
var
|
|
60
|
-
_this = this,
|
|
61
|
-
_classNames2;
|
|
62
|
-
|
|
170
|
+
var _this = this;
|
|
63
171
|
var _this$props = this.props,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
onToolbarBlur = _this$props.onToolbarBlur;
|
|
172
|
+
children = _this$props.children,
|
|
173
|
+
value = _this$props.value,
|
|
174
|
+
plugins = _this$props.plugins,
|
|
175
|
+
onChange = _this$props.onChange,
|
|
176
|
+
getFocusedValue = _this$props.getFocusedValue,
|
|
177
|
+
onDone = _this$props.onDone,
|
|
178
|
+
focusedNode = _this$props.focusedNode,
|
|
179
|
+
autoWidth = _this$props.autoWidth,
|
|
180
|
+
readOnly = _this$props.readOnly,
|
|
181
|
+
disableScrollbar = _this$props.disableScrollbar,
|
|
182
|
+
disableUnderline = _this$props.disableUnderline,
|
|
183
|
+
pluginProps = _this$props.pluginProps,
|
|
184
|
+
toolbarOpts = _this$props.toolbarOpts,
|
|
185
|
+
onDataChange = _this$props.onDataChange,
|
|
186
|
+
toolbarRef = _this$props.toolbarRef,
|
|
187
|
+
doneButtonRef = _this$props.doneButtonRef,
|
|
188
|
+
focusToolbar = _this$props.focusToolbar,
|
|
189
|
+
onToolbarFocus = _this$props.onToolbarFocus,
|
|
190
|
+
onToolbarBlur = _this$props.onToolbarBlur;
|
|
84
191
|
var inFocus = value.isFocused || focusedNode !== null && focusedNode !== undefined || focusToolbar;
|
|
85
|
-
var holderNames = (0, _classnames["default"])(classes.editorHolder, (_classNames = {}, (0, _defineProperty2["default"])(_classNames, classes.editorInFocus, inFocus), (0, _defineProperty2["default"])(_classNames, classes.readOnly, readOnly), (0, _defineProperty2["default"])(_classNames, classes.disabledUnderline, disableUnderline), (0, _defineProperty2["default"])(_classNames, classes.disabledScrollbar, disableScrollbar), _classNames));
|
|
86
192
|
var clonedChildren = children;
|
|
87
|
-
|
|
88
193
|
if (typeof children !== 'string') {
|
|
89
194
|
clonedChildren = /*#__PURE__*/_react["default"].cloneElement(children, {
|
|
90
195
|
ref: function ref(el) {
|
|
@@ -92,14 +197,17 @@ var EditorAndToolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
92
197
|
}
|
|
93
198
|
});
|
|
94
199
|
}
|
|
95
|
-
|
|
96
200
|
log('[render] inFocus: ', inFocus, 'value.isFocused:', value.isFocused, 'focused node: ', focusedNode);
|
|
97
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
201
|
+
return /*#__PURE__*/_react["default"].createElement(Root, {
|
|
202
|
+
noBorder: toolbarOpts && toolbarOpts.noBorder,
|
|
203
|
+
error: toolbarOpts && toolbarOpts.error
|
|
204
|
+
}, /*#__PURE__*/_react["default"].createElement(EditorHolder, {
|
|
205
|
+
inFocus: inFocus,
|
|
206
|
+
readOnly: readOnly,
|
|
207
|
+
disableUnderline: disableUnderline,
|
|
208
|
+
disableScrollbar: disableScrollbar
|
|
209
|
+
}, /*#__PURE__*/_react["default"].createElement(ChildrenContainer, {
|
|
210
|
+
noPadding: toolbarOpts && toolbarOpts.noPadding
|
|
103
211
|
}, clonedChildren)), /*#__PURE__*/_react["default"].createElement(_toolbar["default"], {
|
|
104
212
|
autoWidth: autoWidth,
|
|
105
213
|
plugins: plugins,
|
|
@@ -119,10 +227,7 @@ var EditorAndToolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
119
227
|
}));
|
|
120
228
|
}
|
|
121
229
|
}]);
|
|
122
|
-
return EditorAndToolbar;
|
|
123
230
|
}(_react["default"].Component);
|
|
124
|
-
|
|
125
|
-
exports.EditorAndToolbar = EditorAndToolbar;
|
|
126
231
|
(0, _defineProperty2["default"])(EditorAndToolbar, "propTypes", {
|
|
127
232
|
children: _propTypes["default"].oneOfType([_propTypes["default"].arrayOf(_propTypes["default"].node), _propTypes["default"].node]).isRequired,
|
|
128
233
|
value: _slatePropTypes["default"].value.isRequired,
|
|
@@ -137,7 +242,6 @@ exports.EditorAndToolbar = EditorAndToolbar;
|
|
|
137
242
|
disableScrollbar: _propTypes["default"].bool,
|
|
138
243
|
disableUnderline: _propTypes["default"].bool,
|
|
139
244
|
autoWidth: _propTypes["default"].bool,
|
|
140
|
-
classes: _propTypes["default"].object.isRequired,
|
|
141
245
|
pluginProps: _propTypes["default"].object,
|
|
142
246
|
toolbarOpts: _propTypes["default"].shape({
|
|
143
247
|
position: _propTypes["default"].oneOf(['bottom', 'top']),
|
|
@@ -151,136 +255,5 @@ exports.EditorAndToolbar = EditorAndToolbar;
|
|
|
151
255
|
onToolbarBlur: _propTypes["default"].func.isRequired,
|
|
152
256
|
doneButtonRef: _propTypes["default"].func
|
|
153
257
|
});
|
|
154
|
-
|
|
155
|
-
var style = function style(theme) {
|
|
156
|
-
return {
|
|
157
|
-
root: {
|
|
158
|
-
position: 'relative',
|
|
159
|
-
padding: '0px',
|
|
160
|
-
border: '1px solid #ccc',
|
|
161
|
-
borderRadius: '4px',
|
|
162
|
-
cursor: 'text',
|
|
163
|
-
'& [data-slate-editor="true"]': {
|
|
164
|
-
wordBreak: 'break-word',
|
|
165
|
-
overflow: 'visible',
|
|
166
|
-
maxHeight: '500px',
|
|
167
|
-
// needed in order to be able to put the focus before a void element when it is the first one in the editor
|
|
168
|
-
padding: '5px'
|
|
169
|
-
}
|
|
170
|
-
},
|
|
171
|
-
children: {
|
|
172
|
-
padding: '10px 16px'
|
|
173
|
-
},
|
|
174
|
-
editorHolder: {
|
|
175
|
-
position: 'relative',
|
|
176
|
-
padding: '0px',
|
|
177
|
-
overflowY: 'auto',
|
|
178
|
-
color: _renderUi.color.text(),
|
|
179
|
-
backgroundColor: _renderUi.color.background(),
|
|
180
|
-
'&::before': {
|
|
181
|
-
left: '0',
|
|
182
|
-
right: '0',
|
|
183
|
-
bottom: '0',
|
|
184
|
-
height: '1px',
|
|
185
|
-
content: '""',
|
|
186
|
-
position: 'absolute',
|
|
187
|
-
transition: 'background-color 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms',
|
|
188
|
-
pointerEvents: 'none',
|
|
189
|
-
backgroundColor: 'rgba(0, 0, 0, 0.42)'
|
|
190
|
-
},
|
|
191
|
-
'&::after': {
|
|
192
|
-
left: '0',
|
|
193
|
-
right: '0',
|
|
194
|
-
bottom: '0',
|
|
195
|
-
height: '1px',
|
|
196
|
-
content: '""',
|
|
197
|
-
position: 'absolute',
|
|
198
|
-
transform: 'scaleX(0)',
|
|
199
|
-
transition: 'transform 200ms cubic-bezier(0.0, 0.0, 0.2, 1) 0ms, background-color 200ms linear',
|
|
200
|
-
backgroundColor: 'rgba(0, 0, 0, 0.42)'
|
|
201
|
-
},
|
|
202
|
-
'&:focus': {
|
|
203
|
-
'&::after': {
|
|
204
|
-
transform: 'scaleX(1)',
|
|
205
|
-
backgroundColor: _theme.primary,
|
|
206
|
-
height: '2px'
|
|
207
|
-
}
|
|
208
|
-
},
|
|
209
|
-
'&:hover': {
|
|
210
|
-
'&::after': {
|
|
211
|
-
transform: 'scaleX(1)',
|
|
212
|
-
backgroundColor: theme.palette.common.black,
|
|
213
|
-
height: '2px'
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
},
|
|
217
|
-
disabledUnderline: {
|
|
218
|
-
'&::before': {
|
|
219
|
-
display: 'none'
|
|
220
|
-
},
|
|
221
|
-
'&::after': {
|
|
222
|
-
display: 'none'
|
|
223
|
-
}
|
|
224
|
-
},
|
|
225
|
-
disabledScrollbar: {
|
|
226
|
-
'&::-webkit-scrollbar': {
|
|
227
|
-
display: 'none'
|
|
228
|
-
},
|
|
229
|
-
scrollbarWidth: 'none',
|
|
230
|
-
'-ms-overflow-style': 'none'
|
|
231
|
-
},
|
|
232
|
-
readOnly: {
|
|
233
|
-
'&::before': {
|
|
234
|
-
background: 'transparent',
|
|
235
|
-
backgroundSize: '5px 1px',
|
|
236
|
-
backgroundImage: 'linear-gradient(to right, rgba(0, 0, 0, 0.42) 33%, transparent 0%)',
|
|
237
|
-
backgroundRepeat: 'repeat-x',
|
|
238
|
-
backgroundPosition: 'left top'
|
|
239
|
-
},
|
|
240
|
-
'&::after': {
|
|
241
|
-
left: '0',
|
|
242
|
-
right: '0',
|
|
243
|
-
bottom: '0',
|
|
244
|
-
height: '1px',
|
|
245
|
-
content: '""',
|
|
246
|
-
position: 'absolute',
|
|
247
|
-
transform: 'scaleX(0)',
|
|
248
|
-
transition: 'transform 200ms cubic-bezier(0.0, 0.0, 0.2, 1) 0ms, background-color 0ms linear',
|
|
249
|
-
backgroundColor: 'rgba(0, 0, 0, 0)'
|
|
250
|
-
},
|
|
251
|
-
'&:hover': {
|
|
252
|
-
'&::after': {
|
|
253
|
-
transform: 'scaleX(0)',
|
|
254
|
-
backgroundColor: theme.palette.common.black,
|
|
255
|
-
height: '2px'
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
},
|
|
259
|
-
editorInFocus: {
|
|
260
|
-
'&::after': {
|
|
261
|
-
transform: 'scaleX(1)',
|
|
262
|
-
backgroundColor: _theme.primary,
|
|
263
|
-
height: '2px'
|
|
264
|
-
},
|
|
265
|
-
'&:hover': {
|
|
266
|
-
'&::after': {
|
|
267
|
-
backgroundColor: _theme.primary
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
},
|
|
271
|
-
error: {
|
|
272
|
-
border: "2px solid ".concat(theme.palette.error.main, " !important")
|
|
273
|
-
},
|
|
274
|
-
noBorder: {
|
|
275
|
-
border: 'none'
|
|
276
|
-
},
|
|
277
|
-
noPadding: {
|
|
278
|
-
padding: 0
|
|
279
|
-
}
|
|
280
|
-
};
|
|
281
|
-
};
|
|
282
|
-
|
|
283
|
-
var _default = (0, _styles.withStyles)(style)(EditorAndToolbar);
|
|
284
|
-
|
|
285
|
-
exports["default"] = _default;
|
|
258
|
+
var _default = exports["default"] = EditorAndToolbar;
|
|
286
259
|
//# sourceMappingURL=editor-and-toolbar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/plugins/toolbar/editor-and-toolbar.jsx"],"names":["log","EditorAndToolbar","props","classes","children","value","plugins","onChange","getFocusedValue","onDone","focusedNode","autoWidth","readOnly","disableScrollbar","disableUnderline","pluginProps","toolbarOpts","onDataChange","toolbarRef","doneButtonRef","focusToolbar","onToolbarFocus","onToolbarBlur","inFocus","isFocused","undefined","holderNames","editorHolder","editorInFocus","disabledUnderline","disabledScrollbar","clonedChildren","React","cloneElement","ref","el","editorRef","noBorder","error","root","noPadding","Component","PropTypes","oneOfType","arrayOf","node","isRequired","SlatePropTypes","array","func","bool","object","shape","position","oneOf","alwaysVisible","string","any","style","theme","padding","border","borderRadius","cursor","wordBreak","overflow","maxHeight","overflowY","color","text","backgroundColor","background","left","right","bottom","height","content","transition","pointerEvents","transform","primary","palette","common","black","display","scrollbarWidth","backgroundSize","backgroundImage","backgroundRepeat","backgroundPosition","main"],"mappings":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AAKXC,QAAAA,kBAAkB,EAAE;AALT,OADL;AAQR,kBAAY;AACVjB,QAAAA,IAAI,EAAE,GADI;AAEVC,QAAAA,KAAK,EAAE,GAFG;AAGVC,QAAAA,MAAM,EAAE,GAHE;AAIVC,QAAAA,MAAM,EAAE,KAJE;AAKVC,QAAAA,OAAO,EAAE,IALC;AAMVvB,QAAAA,QAAQ,EAAE,UANA;AAOV0B,QAAAA,SAAS,EAAE,WAPD;AAQVF,QAAAA,UAAU,EAAE,iFARF;AASVP,QAAAA,eAAe,EAAE;AATP,OARJ;AAmBR,iBAAW;AACT,oBAAY;AACVS,UAAAA,SAAS,EAAE,WADD;AAEVT,UAAAA,eAAe,EAAEX,KAAK,CAACsB,OAAN,CAAcC,MAAd,CAAqBC,KAF5B;AAGVR,UAAAA,MAAM,EAAE;AAHE;AADH;AAnBH,KA5Ec;AAuGxB/C,IAAAA,aAAa,EAAE;AACb,kBAAY;AACVmD,QAAAA,SAAS,EAAE,WADD;AAEVT,QAAAA,eAAe,EAAEU,cAFP;AAGVL,QAAAA,MAAM,EAAE;AAHE,OADC;AAMb,iBAAW;AACT,oBAAY;AACVL,UAAAA,eAAe,EAAEU;AADP;AADH;AANE,KAvGS;AAmHxB1C,IAAAA,KAAK,EAAE;AACLuB,MAAAA,MAAM,sBAAeF,KAAK,CAACsB,OAAN,CAAc3C,KAAd,CAAoBoD,IAAnC;AADD,KAnHiB;AAsHxBrD,IAAAA,QAAQ,EAAE;AACRwB,MAAAA,MAAM,EAAE;AADA,KAtHc;AAyHxBrB,IAAAA,SAAS,EAAE;AACToB,MAAAA,OAAO,EAAE;AADA;AAzHa,GAAZ;AAAA,CAAd;;eA8He,wBAAWF,KAAX,EAAkBzD,gBAAlB,C","sourcesContent":["import React from 'react';\nimport Toolbar from './toolbar';\nimport classNames from 'classnames';\nimport debug from 'debug';\nimport { primary } from '../../theme';\nimport { withStyles } from '@material-ui/core/styles';\nimport PropTypes from 'prop-types';\nimport SlatePropTypes from 'slate-prop-types';\nimport { color } from '@pie-lib/render-ui';\n\nconst log = debug('@pie-lib:editable-html:plugins:toolbar:editor-and-toolbar');\n\nexport class EditorAndToolbar extends React.Component {\n static propTypes = {\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,\n value: SlatePropTypes.value.isRequired,\n plugins: PropTypes.array.isRequired,\n onChange: PropTypes.func.isRequired,\n getFocusedValue: PropTypes.func.isRequired,\n onDone: PropTypes.func.isRequired,\n onDataChange: PropTypes.func,\n toolbarRef: PropTypes.func,\n focusedNode: SlatePropTypes.node,\n readOnly: PropTypes.bool,\n disableScrollbar: PropTypes.bool,\n disableUnderline: PropTypes.bool,\n autoWidth: PropTypes.bool,\n classes: PropTypes.object.isRequired,\n pluginProps: PropTypes.object,\n toolbarOpts: PropTypes.shape({\n position: PropTypes.oneOf(['bottom', 'top']),\n alwaysVisible: PropTypes.bool,\n error: PropTypes.string,\n noBorder: PropTypes.any,\n noPadding: PropTypes.any,\n }),\n focusToolbar: PropTypes.bool.isRequired,\n onToolbarFocus: PropTypes.func.isRequired,\n onToolbarBlur: PropTypes.func.isRequired,\n doneButtonRef: PropTypes.func,\n };\n\n render() {\n const {\n classes,\n children,\n value,\n plugins,\n onChange,\n getFocusedValue,\n onDone,\n focusedNode,\n autoWidth,\n readOnly,\n disableScrollbar,\n disableUnderline,\n pluginProps,\n toolbarOpts,\n onDataChange,\n toolbarRef,\n doneButtonRef,\n focusToolbar,\n onToolbarFocus,\n onToolbarBlur,\n } = this.props;\n\n let inFocus = value.isFocused || (focusedNode !== null && focusedNode !== undefined) || focusToolbar;\n\n const holderNames = classNames(classes.editorHolder, {\n [classes.editorInFocus]: inFocus,\n [classes.readOnly]: readOnly,\n [classes.disabledUnderline]: disableUnderline,\n [classes.disabledScrollbar]: disableScrollbar,\n });\n\n let clonedChildren = children;\n\n if (typeof children !== 'string') {\n clonedChildren = React.cloneElement(children, {\n ref: (el) => (this.editorRef = el),\n });\n }\n\n log('[render] inFocus: ', inFocus, 'value.isFocused:', value.isFocused, 'focused node: ', focusedNode);\n\n return (\n <div\n className={classNames(\n {\n [classes.noBorder]: toolbarOpts && toolbarOpts.noBorder,\n [classes.error]: toolbarOpts && toolbarOpts.error,\n },\n classes.root,\n )}\n >\n <div className={holderNames}>\n <div\n className={classNames(\n {\n [classes.noPadding]: toolbarOpts && toolbarOpts.noPadding,\n },\n classes.children,\n )}\n >\n {clonedChildren}\n </div>\n </div>\n\n <Toolbar\n autoWidth={autoWidth}\n plugins={plugins}\n focusedNode={focusedNode}\n value={value}\n isFocused={inFocus}\n onBlur={onToolbarBlur}\n onFocus={onToolbarFocus}\n onChange={onChange}\n getFocusedValue={getFocusedValue}\n onDone={onDone}\n onDataChange={onDataChange}\n toolbarRef={toolbarRef}\n doneButtonRef={doneButtonRef}\n pluginProps={pluginProps}\n toolbarOpts={toolbarOpts}\n />\n </div>\n );\n }\n}\n\nconst style = (theme) => ({\n root: {\n position: 'relative',\n padding: '0px',\n border: '1px solid #ccc',\n borderRadius: '4px',\n cursor: 'text',\n '& [data-slate-editor=\"true\"]': {\n wordBreak: 'break-word',\n overflow: 'visible',\n maxHeight: '500px',\n // needed in order to be able to put the focus before a void element when it is the first one in the editor\n padding: '5px',\n },\n },\n children: {\n padding: '10px 16px',\n },\n editorHolder: {\n position: 'relative',\n padding: '0px',\n overflowY: 'auto',\n color: color.text(),\n backgroundColor: color.background(),\n '&::before': {\n left: '0',\n right: '0',\n bottom: '0',\n height: '1px',\n content: '\"\"',\n position: 'absolute',\n transition: 'background-color 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms',\n pointerEvents: 'none',\n backgroundColor: 'rgba(0, 0, 0, 0.42)',\n },\n '&::after': {\n left: '0',\n right: '0',\n bottom: '0',\n height: '1px',\n content: '\"\"',\n position: 'absolute',\n transform: 'scaleX(0)',\n transition: 'transform 200ms cubic-bezier(0.0, 0.0, 0.2, 1) 0ms, background-color 200ms linear',\n backgroundColor: 'rgba(0, 0, 0, 0.42)',\n },\n '&:focus': {\n '&::after': {\n transform: 'scaleX(1)',\n backgroundColor: primary,\n height: '2px',\n },\n },\n '&:hover': {\n '&::after': {\n transform: 'scaleX(1)',\n backgroundColor: theme.palette.common.black,\n height: '2px',\n },\n },\n },\n disabledUnderline: {\n '&::before': {\n display: 'none',\n },\n '&::after': {\n display: 'none',\n },\n },\n disabledScrollbar: {\n '&::-webkit-scrollbar': {\n display: 'none',\n },\n scrollbarWidth: 'none',\n '-ms-overflow-style': 'none',\n },\n readOnly: {\n '&::before': {\n background: 'transparent',\n backgroundSize: '5px 1px',\n backgroundImage: 'linear-gradient(to right, rgba(0, 0, 0, 0.42) 33%, transparent 0%)',\n backgroundRepeat: 'repeat-x',\n backgroundPosition: 'left top',\n },\n '&::after': {\n left: '0',\n right: '0',\n bottom: '0',\n height: '1px',\n content: '\"\"',\n position: 'absolute',\n transform: 'scaleX(0)',\n transition: 'transform 200ms cubic-bezier(0.0, 0.0, 0.2, 1) 0ms, background-color 0ms linear',\n backgroundColor: 'rgba(0, 0, 0, 0)',\n },\n '&:hover': {\n '&::after': {\n transform: 'scaleX(0)',\n backgroundColor: theme.palette.common.black,\n height: '2px',\n },\n },\n },\n editorInFocus: {\n '&::after': {\n transform: 'scaleX(1)',\n backgroundColor: primary,\n height: '2px',\n },\n '&:hover': {\n '&::after': {\n backgroundColor: primary,\n },\n },\n },\n error: {\n border: `2px solid ${theme.palette.error.main} !important`,\n },\n noBorder: {\n border: 'none',\n },\n noPadding: {\n padding: 0,\n },\n});\n\nexport default withStyles(style)(EditorAndToolbar);\n"],"file":"editor-and-toolbar.js"}
|
|
1
|
+
{"version":3,"file":"editor-and-toolbar.js","names":["_react","_interopRequireDefault","require","_toolbar","_classnames","_debug","_theme","_styles","_propTypes","_slatePropTypes","_renderUi","_callSuper","t","o","e","_getPrototypeOf2","_possibleConstructorReturn2","_isNativeReflectConstruct","Reflect","construct","constructor","apply","Boolean","prototype","valueOf","call","ownKeys","r","Object","keys","getOwnPropertySymbols","filter","getOwnPropertyDescriptor","enumerable","push","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","log","debug","Root","styled","shouldForwardProp","prop","includes","_ref","theme","noBorder","error","position","padding","border","borderRadius","cursor","borderColor","concat","palette","main","undefined","borderWidth","wordBreak","overflow","maxHeight","EditorHolder","_ref2","inFocus","readOnly","disableUnderline","disableScrollbar","overflowY","color","text","backgroundColor","background","display","scrollbarWidth","left","right","bottom","height","content","transition","pointerEvents","transform","primary","common","black","backgroundSize","backgroundImage","backgroundRepeat","backgroundPosition","ChildrenContainer","_ref3","noPadding","EditorAndToolbar","exports","_React$Component","_classCallCheck2","_inherits2","_createClass2","key","value","render","_this","_this$props","props","children","plugins","onChange","getFocusedValue","onDone","focusedNode","autoWidth","pluginProps","toolbarOpts","onDataChange","toolbarRef","doneButtonRef","focusToolbar","onToolbarFocus","onToolbarBlur","isFocused","clonedChildren","React","cloneElement","ref","el","editorRef","createElement","onBlur","onFocus","Component","PropTypes","oneOfType","arrayOf","node","isRequired","SlatePropTypes","array","func","bool","object","shape","oneOf","alwaysVisible","string","any","_default"],"sources":["../../../src/plugins/toolbar/editor-and-toolbar.jsx"],"sourcesContent":["import React from 'react';\nimport Toolbar from './toolbar';\nimport classNames from 'classnames';\nimport debug from 'debug';\nimport { primary } from '../../theme';\nimport { styled } from '@mui/material/styles';\nimport PropTypes from 'prop-types';\nimport SlatePropTypes from 'slate-prop-types';\nimport { color } from '@pie-lib/render-ui';\n\nconst log = debug('@pie-lib:editable-html:plugins:toolbar:editor-and-toolbar');\n\nconst Root = styled('div', {\n shouldForwardProp: (prop) => !['noBorder', 'error'].includes(prop),\n})(({ theme, noBorder, error }) => ({\n position: 'relative',\n padding: '0px',\n border: noBorder ? 'none' : '1px solid #ccc',\n borderRadius: '4px',\n cursor: 'text',\n borderColor: error ? `${theme.palette.error.main} !important` : undefined,\n borderWidth: error ? '2px !important' : undefined,\n '& [data-slate-editor=\"true\"]': {\n wordBreak: 'break-word',\n overflow: 'visible',\n maxHeight: '500px',\n // needed in order to be able to put the focus before a void element when it is the first one in the editor\n padding: '5px',\n },\n}));\n\nconst EditorHolder = styled('div', {\n shouldForwardProp: (prop) => !['inFocus', 'readOnly', 'disableUnderline', 'disableScrollbar'].includes(prop),\n})(({ theme, inFocus, readOnly, disableUnderline, disableScrollbar }) => ({\n position: 'relative',\n padding: '0px',\n overflowY: 'auto',\n color: color.text(),\n backgroundColor: color.background(),\n ...(disableScrollbar && {\n '&::-webkit-scrollbar': {\n display: 'none',\n },\n scrollbarWidth: 'none',\n '-ms-overflow-style': 'none',\n }),\n ...(!disableUnderline && {\n '&::before': {\n left: '0',\n right: '0',\n bottom: '0',\n height: '1px',\n content: '\"\"',\n position: 'absolute',\n transition: 'background-color 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms',\n pointerEvents: 'none',\n backgroundColor: 'rgba(0, 0, 0, 0.42)',\n },\n '&::after': {\n left: '0',\n right: '0',\n bottom: '0',\n height: '1px',\n content: '\"\"',\n position: 'absolute',\n transform: 'scaleX(0)',\n transition: 'transform 200ms cubic-bezier(0.0, 0.0, 0.2, 1) 0ms, background-color 200ms linear',\n backgroundColor: 'rgba(0, 0, 0, 0.42)',\n },\n '&:focus': {\n '&::after': {\n transform: 'scaleX(1)',\n backgroundColor: primary,\n height: '2px',\n },\n },\n '&:hover': {\n '&::after': {\n transform: 'scaleX(1)',\n backgroundColor: theme.palette.common.black,\n height: '2px',\n },\n },\n }),\n ...(readOnly && {\n '&::before': {\n background: 'transparent',\n backgroundSize: '5px 1px',\n backgroundImage: 'linear-gradient(to right, rgba(0, 0, 0, 0.42) 33%, transparent 0%)',\n backgroundRepeat: 'repeat-x',\n backgroundPosition: 'left top',\n },\n '&::after': {\n left: '0',\n right: '0',\n bottom: '0',\n height: '1px',\n content: '\"\"',\n position: 'absolute',\n transform: 'scaleX(0)',\n transition: 'transform 200ms cubic-bezier(0.0, 0.0, 0.2, 1) 0ms, background-color 0ms linear',\n backgroundColor: 'rgba(0, 0, 0, 0)',\n },\n '&:hover': {\n '&::after': {\n transform: 'scaleX(0)',\n backgroundColor: theme.palette.common.black,\n height: '2px',\n },\n },\n }),\n ...(inFocus && {\n '&::after': {\n transform: 'scaleX(1)',\n backgroundColor: primary,\n height: '2px',\n },\n '&:hover': {\n '&::after': {\n backgroundColor: primary,\n },\n },\n }),\n}));\n\nconst ChildrenContainer = styled('div', {\n shouldForwardProp: (prop) => !['noPadding'].includes(prop),\n})(({ noPadding }) => ({\n padding: noPadding ? 0 : '10px 16px',\n}));\n\nexport class EditorAndToolbar extends React.Component {\n static propTypes = {\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,\n value: SlatePropTypes.value.isRequired,\n plugins: PropTypes.array.isRequired,\n onChange: PropTypes.func.isRequired,\n getFocusedValue: PropTypes.func.isRequired,\n onDone: PropTypes.func.isRequired,\n onDataChange: PropTypes.func,\n toolbarRef: PropTypes.func,\n focusedNode: SlatePropTypes.node,\n readOnly: PropTypes.bool,\n disableScrollbar: PropTypes.bool,\n disableUnderline: PropTypes.bool,\n autoWidth: PropTypes.bool,\n pluginProps: PropTypes.object,\n toolbarOpts: PropTypes.shape({\n position: PropTypes.oneOf(['bottom', 'top']),\n alwaysVisible: PropTypes.bool,\n error: PropTypes.string,\n noBorder: PropTypes.any,\n noPadding: PropTypes.any,\n }),\n focusToolbar: PropTypes.bool.isRequired,\n onToolbarFocus: PropTypes.func.isRequired,\n onToolbarBlur: PropTypes.func.isRequired,\n doneButtonRef: PropTypes.func,\n };\n\n render() {\n const {\n children,\n value,\n plugins,\n onChange,\n getFocusedValue,\n onDone,\n focusedNode,\n autoWidth,\n readOnly,\n disableScrollbar,\n disableUnderline,\n pluginProps,\n toolbarOpts,\n onDataChange,\n toolbarRef,\n doneButtonRef,\n focusToolbar,\n onToolbarFocus,\n onToolbarBlur,\n } = this.props;\n\n let inFocus = value.isFocused || (focusedNode !== null && focusedNode !== undefined) || focusToolbar;\n\n let clonedChildren = children;\n\n if (typeof children !== 'string') {\n clonedChildren = React.cloneElement(children, {\n ref: (el) => (this.editorRef = el),\n });\n }\n\n log('[render] inFocus: ', inFocus, 'value.isFocused:', value.isFocused, 'focused node: ', focusedNode);\n\n return (\n <Root\n noBorder={toolbarOpts && toolbarOpts.noBorder}\n error={toolbarOpts && toolbarOpts.error}\n >\n <EditorHolder\n inFocus={inFocus}\n readOnly={readOnly}\n disableUnderline={disableUnderline}\n disableScrollbar={disableScrollbar}\n >\n <ChildrenContainer noPadding={toolbarOpts && toolbarOpts.noPadding}>\n {clonedChildren}\n </ChildrenContainer>\n </EditorHolder>\n\n <Toolbar\n autoWidth={autoWidth}\n plugins={plugins}\n focusedNode={focusedNode}\n value={value}\n isFocused={inFocus}\n onBlur={onToolbarBlur}\n onFocus={onToolbarFocus}\n onChange={onChange}\n getFocusedValue={getFocusedValue}\n onDone={onDone}\n onDataChange={onDataChange}\n toolbarRef={toolbarRef}\n doneButtonRef={doneButtonRef}\n pluginProps={pluginProps}\n toolbarOpts={toolbarOpts}\n />\n </Root>\n );\n }\n}\n\nexport default EditorAndToolbar;\n"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,WAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,MAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,eAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AAA2C,SAAAS,WAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,WAAAD,CAAA,OAAAE,gBAAA,aAAAF,CAAA,OAAAG,2BAAA,aAA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AACW,KAAK,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAC5CC,aAAa,EAAEZ,qBAAS,CAACQ,IAAI;IAC7B5F,KAAK,EAAEoF,qBAAS,CAACa,MAAM;IACvBlG,QAAQ,EAAEqF,qBAAS,CAACc,GAAG;IACvBrD,SAAS,EAAEuC,qBAAS,CAACc;EACvB,CAAC,CAAC;EACF5B,YAAY,EAAEc,qBAAS,CAACQ,IAAI,CAACJ,UAAU;EACvCjB,cAAc,EAAEa,qBAAS,CAACO,IAAI,CAACH,UAAU;EACzChB,aAAa,EAAEY,qBAAS,CAACO,IAAI,CAACH,UAAU;EACxCnB,aAAa,EAAEe,qBAAS,CAACO;AAC3B,CAAC;AAAA,IAAAQ,QAAA,GAAApD,OAAA,cA2EYD,gBAAgB","ignoreList":[]}
|
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports["default"] = ToolbarPlugin;
|
|
9
|
-
|
|
10
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
|
|
12
9
|
var _react = _interopRequireDefault(require("react"));
|
|
13
|
-
|
|
14
10
|
var _editorAndToolbar = _interopRequireDefault(require("./editor-and-toolbar"));
|
|
15
|
-
|
|
16
11
|
/**
|
|
17
12
|
* Adds a toolbar which is shown when the editor is focused.
|
|
18
13
|
* @param {*} opts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","names":["_react","_interopRequireDefault","require","_editorAndToolbar","ToolbarPlugin","opts","renderEditor","props","createElement","_extends2","mainEditorRef","disableScrollbar","disableUnderline","autoWidth","onDone"],"sources":["../../../src/plugins/toolbar/index.jsx"],"sourcesContent":["import React from 'react';\n\nimport EditorAndToolbar from './editor-and-toolbar';\n\n/**\n * Adds a toolbar which is shown when the editor is focused.\n * @param {*} opts\n */\nexport default function ToolbarPlugin(opts) {\n return {\n /* eslint-disable-next-line */\n renderEditor: (props) => (\n <EditorAndToolbar\n {...props}\n mainEditorRef={opts.mainEditorRef}\n disableScrollbar={opts.disableScrollbar}\n disableUnderline={opts.disableUnderline}\n autoWidth={opts.autoWidth}\n onDone={opts.onDone}\n />\n ),\n };\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,iBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA;AACA;AACA;AACA;AACe,SAASE,aAAaA,CAACC,IAAI,EAAE;EAC1C,OAAO;IACL;IACAC,YAAY,EAAE,SAAdA,YAAYA,CAAGC,KAAK;MAAA,oBAClBP,MAAA,YAAAQ,aAAA,CAACL,iBAAA,WAAgB,MAAAM,SAAA,iBACXF,KAAK;QACTG,aAAa,EAAEL,IAAI,CAACK,aAAc;QAClCC,gBAAgB,EAAEN,IAAI,CAACM,gBAAiB;QACxCC,gBAAgB,EAAEP,IAAI,CAACO,gBAAiB;QACxCC,SAAS,EAAER,IAAI,CAACQ,SAAU;QAC1BC,MAAM,EAAET,IAAI,CAACS;MAAO,EACrB,CAAC;IAAA;EAEN,CAAC;AACH","ignoreList":[]}
|