@pie-lib/editable-html 11.4.0 → 11.5.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 +13 -65
- package/package.json +8 -7
- package/src/editor.jsx +2 -2
- package/src/plugins/media/media-dialog.js +1 -1
- package/src/plugins/respArea/drag-in-the-blank/choice.jsx +1 -1
- package/src/plugins/toolbar/editor-and-toolbar.jsx +1 -1
- package/lib/block-tags.js +0 -25
- package/lib/block-tags.js.map +0 -1
- package/lib/constants.js +0 -16
- package/lib/constants.js.map +0 -1
- package/lib/editor.js +0 -1355
- package/lib/editor.js.map +0 -1
- package/lib/index.js +0 -269
- package/lib/index.js.map +0 -1
- package/lib/parse-html.js +0 -16
- package/lib/parse-html.js.map +0 -1
- package/lib/plugins/characters/custom-popper.js +0 -73
- package/lib/plugins/characters/custom-popper.js.map +0 -1
- package/lib/plugins/characters/index.js +0 -305
- package/lib/plugins/characters/index.js.map +0 -1
- package/lib/plugins/characters/utils.js +0 -381
- package/lib/plugins/characters/utils.js.map +0 -1
- package/lib/plugins/css/icons/index.js +0 -37
- package/lib/plugins/css/icons/index.js.map +0 -1
- package/lib/plugins/css/index.js +0 -397
- package/lib/plugins/css/index.js.map +0 -1
- package/lib/plugins/customPlugin/index.js +0 -114
- package/lib/plugins/customPlugin/index.js.map +0 -1
- package/lib/plugins/html/icons/index.js +0 -38
- package/lib/plugins/html/icons/index.js.map +0 -1
- package/lib/plugins/html/index.js +0 -80
- package/lib/plugins/html/index.js.map +0 -1
- package/lib/plugins/image/alt-dialog.js +0 -129
- package/lib/plugins/image/alt-dialog.js.map +0 -1
- package/lib/plugins/image/component.js +0 -419
- package/lib/plugins/image/component.js.map +0 -1
- package/lib/plugins/image/image-toolbar.js +0 -177
- package/lib/plugins/image/image-toolbar.js.map +0 -1
- package/lib/plugins/image/index.js +0 -263
- package/lib/plugins/image/index.js.map +0 -1
- package/lib/plugins/image/insert-image-handler.js +0 -161
- package/lib/plugins/image/insert-image-handler.js.map +0 -1
- package/lib/plugins/index.js +0 -402
- package/lib/plugins/index.js.map +0 -1
- package/lib/plugins/list/index.js +0 -334
- package/lib/plugins/list/index.js.map +0 -1
- package/lib/plugins/math/index.js +0 -454
- package/lib/plugins/math/index.js.map +0 -1
- package/lib/plugins/media/index.js +0 -387
- package/lib/plugins/media/index.js.map +0 -1
- package/lib/plugins/media/media-dialog.js +0 -709
- package/lib/plugins/media/media-dialog.js.map +0 -1
- package/lib/plugins/media/media-toolbar.js +0 -101
- package/lib/plugins/media/media-toolbar.js.map +0 -1
- package/lib/plugins/media/media-wrapper.js +0 -93
- package/lib/plugins/media/media-wrapper.js.map +0 -1
- package/lib/plugins/rendering/index.js +0 -46
- package/lib/plugins/rendering/index.js.map +0 -1
- package/lib/plugins/respArea/drag-in-the-blank/choice.js +0 -254
- package/lib/plugins/respArea/drag-in-the-blank/choice.js.map +0 -1
- package/lib/plugins/respArea/drag-in-the-blank/index.js +0 -97
- package/lib/plugins/respArea/drag-in-the-blank/index.js.map +0 -1
- package/lib/plugins/respArea/explicit-constructed-response/index.js +0 -57
- package/lib/plugins/respArea/explicit-constructed-response/index.js.map +0 -1
- package/lib/plugins/respArea/icons/index.js +0 -95
- package/lib/plugins/respArea/icons/index.js.map +0 -1
- package/lib/plugins/respArea/index.js +0 -341
- package/lib/plugins/respArea/index.js.map +0 -1
- package/lib/plugins/respArea/inline-dropdown/index.js +0 -75
- package/lib/plugins/respArea/inline-dropdown/index.js.map +0 -1
- package/lib/plugins/respArea/math-templated/index.js +0 -130
- package/lib/plugins/respArea/math-templated/index.js.map +0 -1
- package/lib/plugins/respArea/utils.js +0 -125
- package/lib/plugins/respArea/utils.js.map +0 -1
- package/lib/plugins/table/CustomTablePlugin.js +0 -133
- package/lib/plugins/table/CustomTablePlugin.js.map +0 -1
- package/lib/plugins/table/icons/index.js +0 -69
- package/lib/plugins/table/icons/index.js.map +0 -1
- package/lib/plugins/table/index.js +0 -483
- package/lib/plugins/table/index.js.map +0 -1
- package/lib/plugins/table/table-toolbar.js +0 -187
- package/lib/plugins/table/table-toolbar.js.map +0 -1
- package/lib/plugins/textAlign/icons/index.js +0 -226
- package/lib/plugins/textAlign/icons/index.js.map +0 -1
- package/lib/plugins/textAlign/index.js +0 -34
- package/lib/plugins/textAlign/index.js.map +0 -1
- package/lib/plugins/toolbar/default-toolbar.js +0 -229
- package/lib/plugins/toolbar/default-toolbar.js.map +0 -1
- package/lib/plugins/toolbar/done-button.js +0 -53
- package/lib/plugins/toolbar/done-button.js.map +0 -1
- package/lib/plugins/toolbar/editor-and-toolbar.js +0 -286
- package/lib/plugins/toolbar/editor-and-toolbar.js.map +0 -1
- package/lib/plugins/toolbar/index.js +0 -34
- package/lib/plugins/toolbar/index.js.map +0 -1
- package/lib/plugins/toolbar/toolbar-buttons.js +0 -194
- package/lib/plugins/toolbar/toolbar-buttons.js.map +0 -1
- package/lib/plugins/toolbar/toolbar.js +0 -376
- package/lib/plugins/toolbar/toolbar.js.map +0 -1
- package/lib/plugins/utils.js +0 -62
- package/lib/plugins/utils.js.map +0 -1
- package/lib/serialization.js +0 -677
- package/lib/serialization.js.map +0 -1
- package/lib/shared/alert-dialog.js +0 -75
- package/lib/shared/index.js +0 -136
- package/lib/theme.js +0 -9
- package/lib/theme.js.map +0 -1
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = ToolbarPlugin;
|
|
9
|
-
|
|
10
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
|
|
12
|
-
var _react = _interopRequireDefault(require("react"));
|
|
13
|
-
|
|
14
|
-
var _editorAndToolbar = _interopRequireDefault(require("./editor-and-toolbar"));
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Adds a toolbar which is shown when the editor is focused.
|
|
18
|
-
* @param {*} opts
|
|
19
|
-
*/
|
|
20
|
-
function ToolbarPlugin(opts) {
|
|
21
|
-
return {
|
|
22
|
-
/* eslint-disable-next-line */
|
|
23
|
-
renderEditor: function renderEditor(props) {
|
|
24
|
-
return /*#__PURE__*/_react["default"].createElement(_editorAndToolbar["default"], (0, _extends2["default"])({}, props, {
|
|
25
|
-
mainEditorRef: opts.mainEditorRef,
|
|
26
|
-
disableScrollbar: opts.disableScrollbar,
|
|
27
|
-
disableUnderline: opts.disableUnderline,
|
|
28
|
-
autoWidth: opts.autoWidth,
|
|
29
|
-
onDone: opts.onDone
|
|
30
|
-
}));
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/plugins/toolbar/index.jsx"],"names":["ToolbarPlugin","opts","renderEditor","props","mainEditorRef","disableScrollbar","disableUnderline","autoWidth","onDone"],"mappings":";;;;;;;;;;;AAAA;;AAEA;;AAEA;AACA;AACA;AACA;AACe,SAASA,aAAT,CAAuBC,IAAvB,EAA6B;AAC1C,SAAO;AACL;AACAC,IAAAA,YAAY,EAAE,sBAACC,KAAD;AAAA,0BACZ,gCAAC,4BAAD,gCACMA,KADN;AAEE,QAAA,aAAa,EAAEF,IAAI,CAACG,aAFtB;AAGE,QAAA,gBAAgB,EAAEH,IAAI,CAACI,gBAHzB;AAIE,QAAA,gBAAgB,EAAEJ,IAAI,CAACK,gBAJzB;AAKE,QAAA,SAAS,EAAEL,IAAI,CAACM,SALlB;AAME,QAAA,MAAM,EAAEN,IAAI,CAACO;AANf,SADY;AAAA;AAFT,GAAP;AAaD","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"],"file":"index.js"}
|
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.RawMarkButton = exports.RawButton = exports.MarkButton = exports.Button = void 0;
|
|
9
|
-
|
|
10
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
|
|
12
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
|
|
14
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
15
|
-
|
|
16
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
-
|
|
18
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
19
|
-
|
|
20
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
21
|
-
|
|
22
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
23
|
-
|
|
24
|
-
var _react = _interopRequireDefault(require("react"));
|
|
25
|
-
|
|
26
|
-
var _debug = _interopRequireDefault(require("debug"));
|
|
27
|
-
|
|
28
|
-
var _styles = require("@material-ui/core/styles");
|
|
29
|
-
|
|
30
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
31
|
-
|
|
32
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
33
|
-
|
|
34
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
35
|
-
|
|
36
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
37
|
-
|
|
38
|
-
var styles = function styles(theme) {
|
|
39
|
-
return {
|
|
40
|
-
button: {
|
|
41
|
-
color: 'grey',
|
|
42
|
-
display: 'inline-flex',
|
|
43
|
-
padding: '2px',
|
|
44
|
-
background: 'none',
|
|
45
|
-
border: 'none',
|
|
46
|
-
cursor: 'pointer',
|
|
47
|
-
'&:hover': {
|
|
48
|
-
color: 'black'
|
|
49
|
-
},
|
|
50
|
-
'&:focus': {
|
|
51
|
-
outline: "2px solid ".concat(theme.palette.grey[700])
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
active: {
|
|
55
|
-
color: 'black'
|
|
56
|
-
},
|
|
57
|
-
disabled: {
|
|
58
|
-
opacity: 0.7,
|
|
59
|
-
cursor: 'not-allowed',
|
|
60
|
-
'& :hover': {
|
|
61
|
-
color: 'grey'
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
var log = (0, _debug["default"])('pie-elements:editable-html:raw-button');
|
|
68
|
-
|
|
69
|
-
var RawButton = /*#__PURE__*/function (_React$Component) {
|
|
70
|
-
(0, _inherits2["default"])(RawButton, _React$Component);
|
|
71
|
-
|
|
72
|
-
var _super = _createSuper(RawButton);
|
|
73
|
-
|
|
74
|
-
function RawButton(props) {
|
|
75
|
-
var _this;
|
|
76
|
-
|
|
77
|
-
(0, _classCallCheck2["default"])(this, RawButton);
|
|
78
|
-
_this = _super.call(this, props);
|
|
79
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onClick", function (e) {
|
|
80
|
-
log('[onClick]');
|
|
81
|
-
e.preventDefault();
|
|
82
|
-
var onClick = _this.props.onClick;
|
|
83
|
-
onClick(e);
|
|
84
|
-
});
|
|
85
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onKeyDown", function (e) {
|
|
86
|
-
if (e.key === 'Enter' || e.key === ' ') {
|
|
87
|
-
log('[onKeyDown]');
|
|
88
|
-
e.preventDefault();
|
|
89
|
-
var onClick = _this.props.onClick;
|
|
90
|
-
onClick(e);
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
return _this;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
(0, _createClass2["default"])(RawButton, [{
|
|
97
|
-
key: "render",
|
|
98
|
-
value: function render() {
|
|
99
|
-
var _classNames;
|
|
100
|
-
|
|
101
|
-
var _this$props = this.props,
|
|
102
|
-
active = _this$props.active,
|
|
103
|
-
classes = _this$props.classes,
|
|
104
|
-
children = _this$props.children,
|
|
105
|
-
disabled = _this$props.disabled,
|
|
106
|
-
extraStyles = _this$props.extraStyles,
|
|
107
|
-
ariaLabel = _this$props.ariaLabel;
|
|
108
|
-
var names = (0, _classnames["default"])(classes.button, (_classNames = {}, (0, _defineProperty2["default"])(_classNames, classes.active, active), (0, _defineProperty2["default"])(_classNames, classes.disabled, disabled), _classNames));
|
|
109
|
-
return /*#__PURE__*/_react["default"].createElement("button", {
|
|
110
|
-
style: extraStyles,
|
|
111
|
-
className: names,
|
|
112
|
-
onMouseDown: this.onClick,
|
|
113
|
-
onKeyDown: this.onKeyDown,
|
|
114
|
-
disabled: disabled,
|
|
115
|
-
"aria-label": ariaLabel,
|
|
116
|
-
"aria-pressed": active,
|
|
117
|
-
tabIndex: 0
|
|
118
|
-
}, children);
|
|
119
|
-
}
|
|
120
|
-
}]);
|
|
121
|
-
return RawButton;
|
|
122
|
-
}(_react["default"].Component);
|
|
123
|
-
|
|
124
|
-
exports.RawButton = RawButton;
|
|
125
|
-
(0, _defineProperty2["default"])(RawButton, "propTypes", {
|
|
126
|
-
onClick: _propTypes["default"].func.isRequired,
|
|
127
|
-
classes: _propTypes["default"].object.isRequired,
|
|
128
|
-
children: _propTypes["default"].oneOfType([_propTypes["default"].arrayOf(_propTypes["default"].node), _propTypes["default"].node]).isRequired,
|
|
129
|
-
active: _propTypes["default"].bool,
|
|
130
|
-
disabled: _propTypes["default"].bool,
|
|
131
|
-
extraStyles: _propTypes["default"].object
|
|
132
|
-
});
|
|
133
|
-
var Button = (0, _styles.withStyles)(styles)(RawButton);
|
|
134
|
-
exports.Button = Button;
|
|
135
|
-
|
|
136
|
-
var RawMarkButton = /*#__PURE__*/function (_React$Component2) {
|
|
137
|
-
(0, _inherits2["default"])(RawMarkButton, _React$Component2);
|
|
138
|
-
|
|
139
|
-
var _super2 = _createSuper(RawMarkButton);
|
|
140
|
-
|
|
141
|
-
function RawMarkButton(props) {
|
|
142
|
-
var _this2;
|
|
143
|
-
|
|
144
|
-
(0, _classCallCheck2["default"])(this, RawMarkButton);
|
|
145
|
-
_this2 = _super2.call(this, props);
|
|
146
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "onToggle", function (e) {
|
|
147
|
-
e.preventDefault();
|
|
148
|
-
|
|
149
|
-
_this2.props.onToggle(_this2.props.mark);
|
|
150
|
-
});
|
|
151
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "onKeyDown", function (e) {
|
|
152
|
-
if (e.key === 'Enter' || e.key === ' ') {
|
|
153
|
-
e.preventDefault();
|
|
154
|
-
|
|
155
|
-
_this2.props.onToggle(_this2.props.mark);
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
return _this2;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
(0, _createClass2["default"])(RawMarkButton, [{
|
|
162
|
-
key: "render",
|
|
163
|
-
value: function render() {
|
|
164
|
-
var _this$props2 = this.props,
|
|
165
|
-
classes = _this$props2.classes,
|
|
166
|
-
children = _this$props2.children,
|
|
167
|
-
active = _this$props2.active,
|
|
168
|
-
label = _this$props2.label;
|
|
169
|
-
var names = (0, _classnames["default"])(classes.button, active && classes.active);
|
|
170
|
-
return /*#__PURE__*/_react["default"].createElement("button", {
|
|
171
|
-
className: names,
|
|
172
|
-
onMouseDown: this.onToggle,
|
|
173
|
-
"aria-pressed": active,
|
|
174
|
-
onKeyDown: this.onKeyDown,
|
|
175
|
-
"aria-label": label,
|
|
176
|
-
tabIndex: 0
|
|
177
|
-
}, children);
|
|
178
|
-
}
|
|
179
|
-
}]);
|
|
180
|
-
return RawMarkButton;
|
|
181
|
-
}(_react["default"].Component);
|
|
182
|
-
|
|
183
|
-
exports.RawMarkButton = RawMarkButton;
|
|
184
|
-
(0, _defineProperty2["default"])(RawMarkButton, "propTypes", {
|
|
185
|
-
onToggle: _propTypes["default"].func.isRequired,
|
|
186
|
-
mark: _propTypes["default"].string,
|
|
187
|
-
label: _propTypes["default"].string.isRequired,
|
|
188
|
-
children: _propTypes["default"].oneOfType([_propTypes["default"].arrayOf(_propTypes["default"].node), _propTypes["default"].node]).isRequired,
|
|
189
|
-
classes: _propTypes["default"].object.isRequired,
|
|
190
|
-
active: _propTypes["default"].bool
|
|
191
|
-
});
|
|
192
|
-
var MarkButton = (0, _styles.withStyles)(styles)(RawMarkButton);
|
|
193
|
-
exports.MarkButton = MarkButton;
|
|
194
|
-
//# sourceMappingURL=toolbar-buttons.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/plugins/toolbar/toolbar-buttons.jsx"],"names":["styles","theme","button","color","display","padding","background","border","cursor","outline","palette","grey","active","disabled","opacity","log","RawButton","props","e","preventDefault","onClick","key","classes","children","extraStyles","ariaLabel","names","onKeyDown","React","Component","PropTypes","func","isRequired","object","oneOfType","arrayOf","node","bool","Button","RawMarkButton","onToggle","mark","label","string","MarkButton"],"mappings":"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","sourcesContent":["import React from 'react';\nimport debug from 'debug';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport PropTypes from 'prop-types';\n\nconst styles = (theme) => ({\n button: {\n color: 'grey',\n display: 'inline-flex',\n padding: '2px',\n background: 'none',\n border: 'none',\n cursor: 'pointer',\n '&:hover': {\n color: 'black',\n },\n '&:focus': {\n outline: `2px solid ${theme.palette.grey[700]}`,\n },\n },\n active: {\n color: 'black',\n },\n disabled: {\n opacity: 0.7,\n cursor: 'not-allowed',\n '& :hover': {\n color: 'grey',\n },\n },\n});\n\nconst log = debug('pie-elements:editable-html:raw-button');\n\nexport class RawButton extends React.Component {\n static propTypes = {\n onClick: PropTypes.func.isRequired,\n classes: PropTypes.object.isRequired,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,\n active: PropTypes.bool,\n disabled: PropTypes.bool,\n extraStyles: PropTypes.object,\n };\n\n constructor(props) {\n super(props);\n }\n\n onClick = (e) => {\n log('[onClick]');\n e.preventDefault();\n const { onClick } = this.props;\n onClick(e);\n };\n\n onKeyDown = (e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n log('[onKeyDown]');\n e.preventDefault();\n const { onClick } = this.props;\n onClick(e);\n }\n };\n\n render() {\n const { active, classes, children, disabled, extraStyles, ariaLabel } = this.props;\n\n const names = classNames(classes.button, {\n [classes.active]: active,\n [classes.disabled]: disabled,\n });\n\n return (\n <button\n style={extraStyles}\n className={names}\n onMouseDown={this.onClick}\n onKeyDown={this.onKeyDown}\n disabled={disabled}\n aria-label={ariaLabel}\n aria-pressed={active}\n tabIndex={0}\n >\n {children}\n </button>\n );\n }\n}\n\nexport const Button = withStyles(styles)(RawButton);\n\nexport class RawMarkButton extends React.Component {\n static propTypes = {\n onToggle: PropTypes.func.isRequired,\n mark: PropTypes.string,\n label: PropTypes.string.isRequired,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,\n classes: PropTypes.object.isRequired,\n active: PropTypes.bool,\n };\n\n constructor(props) {\n super(props);\n }\n\n onToggle = (e) => {\n e.preventDefault();\n this.props.onToggle(this.props.mark);\n };\n\n onKeyDown = (e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n this.props.onToggle(this.props.mark);\n }\n };\n\n render() {\n const { classes, children, active, label } = this.props;\n\n const names = classNames(classes.button, active && classes.active);\n return (\n <button\n className={names}\n onMouseDown={this.onToggle}\n aria-pressed={active}\n onKeyDown={this.onKeyDown}\n aria-label={label}\n tabIndex={0}\n >\n {children}\n </button>\n );\n }\n}\n\nexport const MarkButton = withStyles(styles)(RawMarkButton);\n"],"file":"toolbar-buttons.js"}
|
|
@@ -1,376 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = exports.Toolbar = void 0;
|
|
9
|
-
|
|
10
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
|
|
12
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
|
|
14
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
15
|
-
|
|
16
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
-
|
|
18
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
19
|
-
|
|
20
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
21
|
-
|
|
22
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
23
|
-
|
|
24
|
-
var _react = _interopRequireDefault(require("react"));
|
|
25
|
-
|
|
26
|
-
var _slate = require("slate");
|
|
27
|
-
|
|
28
|
-
var _Delete = _interopRequireDefault(require("@material-ui/icons/Delete"));
|
|
29
|
-
|
|
30
|
-
var _IconButton = _interopRequireDefault(require("@material-ui/core/IconButton"));
|
|
31
|
-
|
|
32
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
33
|
-
|
|
34
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
35
|
-
|
|
36
|
-
var _debug = _interopRequireDefault(require("debug"));
|
|
37
|
-
|
|
38
|
-
var _slatePropTypes = _interopRequireDefault(require("slate-prop-types"));
|
|
39
|
-
|
|
40
|
-
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
41
|
-
|
|
42
|
-
var _doneButton = require("./done-button");
|
|
43
|
-
|
|
44
|
-
var _utils = require("../utils");
|
|
45
|
-
|
|
46
|
-
var _styles = require("@material-ui/core/styles");
|
|
47
|
-
|
|
48
|
-
var _defaultToolbar = _interopRequireDefault(require("./default-toolbar"));
|
|
49
|
-
|
|
50
|
-
var _characters = require("../characters");
|
|
51
|
-
|
|
52
|
-
var _constants = require("../../constants");
|
|
53
|
-
|
|
54
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
55
|
-
|
|
56
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
57
|
-
|
|
58
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
59
|
-
|
|
60
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
61
|
-
|
|
62
|
-
var log = (0, _debug["default"])('@pie-lib:editable-html:plugins:toolbar');
|
|
63
|
-
|
|
64
|
-
var getCustomToolbar = function getCustomToolbar(plugin, node, value, handleDone, getFocusedValue, onDataChange) {
|
|
65
|
-
if (!plugin) {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if (!plugin.toolbar) {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (plugin.toolbar.CustomToolbarComp) {
|
|
74
|
-
/**
|
|
75
|
-
* Using a pre-defined Component should be preferred
|
|
76
|
-
* as the rendering of it (and it's children) can be optimized by React.
|
|
77
|
-
* If you keep re-defining the comp with an inline function
|
|
78
|
-
* then react will have to re-render.
|
|
79
|
-
*/
|
|
80
|
-
return plugin.toolbar.CustomToolbarComp;
|
|
81
|
-
} else if (typeof plugin.toolbar.customToolbar === 'function') {
|
|
82
|
-
log('deprecated - use CustomToolbarComp');
|
|
83
|
-
return plugin.toolbar.customToolbar(node, value, handleDone, getFocusedValue, onDataChange);
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
88
|
-
(0, _inherits2["default"])(Toolbar, _React$Component);
|
|
89
|
-
|
|
90
|
-
var _super = _createSuper(Toolbar);
|
|
91
|
-
|
|
92
|
-
function Toolbar(props) {
|
|
93
|
-
var _this;
|
|
94
|
-
|
|
95
|
-
(0, _classCallCheck2["default"])(this, Toolbar);
|
|
96
|
-
_this = _super.call(this, props);
|
|
97
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "hasMark", function (type) {
|
|
98
|
-
var value = _this.props.value;
|
|
99
|
-
return value.marks.some(function (mark) {
|
|
100
|
-
return mark.type == type;
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "hasBlock", function (type) {
|
|
104
|
-
var value = _this.props.value;
|
|
105
|
-
return value.blocks.some(function (node) {
|
|
106
|
-
return node.type == type;
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onToggle", function (plugin) {
|
|
110
|
-
var _this$props = _this.props,
|
|
111
|
-
value = _this$props.value,
|
|
112
|
-
onChange = _this$props.onChange;
|
|
113
|
-
if (!plugin.onToggle) return;
|
|
114
|
-
var change = plugin.onToggle(value.change());
|
|
115
|
-
onChange(change);
|
|
116
|
-
});
|
|
117
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onClick", function (e) {
|
|
118
|
-
log('[onClick]');
|
|
119
|
-
e.preventDefault();
|
|
120
|
-
});
|
|
121
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onButtonClick", function (fn) {
|
|
122
|
-
return function (e) {
|
|
123
|
-
e.preventDefault();
|
|
124
|
-
fn();
|
|
125
|
-
};
|
|
126
|
-
});
|
|
127
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onToolbarDone", function (change, finishEditing) {
|
|
128
|
-
log('[onToolbarDone] change: ', change, 'finishEditing: ', finishEditing);
|
|
129
|
-
var _this$props2 = _this.props,
|
|
130
|
-
onChange = _this$props2.onChange,
|
|
131
|
-
onDone = _this$props2.onDone; // use handler only if this is an actual Slate Change
|
|
132
|
-
|
|
133
|
-
if (change instanceof _slate.Change) {
|
|
134
|
-
onChange(change, function () {
|
|
135
|
-
if (finishEditing) {
|
|
136
|
-
onDone();
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
} else {
|
|
140
|
-
if (finishEditing) {
|
|
141
|
-
log('[onToolbarChange] call onDone');
|
|
142
|
-
onDone();
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onDeleteClick", (0, _debounce["default"])(function (e, plugin, node, value, onChange) {
|
|
147
|
-
return plugin.deleteNode(e, node, value, onChange);
|
|
148
|
-
}, 500));
|
|
149
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onDeleteMouseDown", function (e, plugin, node, value, onChange) {
|
|
150
|
-
e.persist();
|
|
151
|
-
|
|
152
|
-
_this.onDeleteClick(e, plugin, node, value, onChange);
|
|
153
|
-
});
|
|
154
|
-
_this.state = {
|
|
155
|
-
change: null
|
|
156
|
-
};
|
|
157
|
-
return _this;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
(0, _createClass2["default"])(Toolbar, [{
|
|
161
|
-
key: "componentWillUnmount",
|
|
162
|
-
value: function componentWillUnmount() {
|
|
163
|
-
(0, _characters.removeDialogs)();
|
|
164
|
-
}
|
|
165
|
-
}, {
|
|
166
|
-
key: "render",
|
|
167
|
-
value: function render() {
|
|
168
|
-
var _this2 = this,
|
|
169
|
-
_classNames;
|
|
170
|
-
|
|
171
|
-
var _this$props3 = this.props,
|
|
172
|
-
classes = _this$props3.classes,
|
|
173
|
-
plugins = _this$props3.plugins,
|
|
174
|
-
pluginProps = _this$props3.pluginProps,
|
|
175
|
-
toolbarOpts = _this$props3.toolbarOpts,
|
|
176
|
-
value = _this$props3.value,
|
|
177
|
-
autoWidth = _this$props3.autoWidth,
|
|
178
|
-
onChange = _this$props3.onChange,
|
|
179
|
-
getFocusedValue = _this$props3.getFocusedValue,
|
|
180
|
-
isFocused = _this$props3.isFocused,
|
|
181
|
-
onDone = _this$props3.onDone,
|
|
182
|
-
toolbarRef = _this$props3.toolbarRef,
|
|
183
|
-
doneButtonRef = _this$props3.doneButtonRef,
|
|
184
|
-
onBlur = _this$props3.onBlur,
|
|
185
|
-
onFocus = _this$props3.onFocus;
|
|
186
|
-
var node = (0, _utils.findSingleNode)(value);
|
|
187
|
-
var parentNode = (0, _utils.findParentNode)(value, node);
|
|
188
|
-
log(' --------------> [render] node: ', node);
|
|
189
|
-
log('[render] node: ', node);
|
|
190
|
-
var plugin = plugins.find(function (p) {
|
|
191
|
-
if (!node) {
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
if (p.toolbar) {
|
|
196
|
-
return p.toolbar.supports && p.toolbar.supports(node, value);
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
var parentPlugin = plugins.find(function (p) {
|
|
200
|
-
if (!parentNode) {
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
if (p.toolbar) {
|
|
205
|
-
return p.toolbar.supports && p.toolbar.supports(parentNode, value);
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
log('[render] plugin: ', plugin);
|
|
209
|
-
|
|
210
|
-
var handleDone = function handleDone(change, done) {
|
|
211
|
-
var handler = onDone;
|
|
212
|
-
|
|
213
|
-
if (plugin && plugin.toolbar && plugin.toolbar.customToolbar) {
|
|
214
|
-
handler = _this2.onToolbarDone;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
handler(change, done);
|
|
218
|
-
|
|
219
|
-
if (parentPlugin && parentPlugin.handleDone) {
|
|
220
|
-
parentPlugin.handleDone(value, node, plugin, onChange);
|
|
221
|
-
}
|
|
222
|
-
};
|
|
223
|
-
|
|
224
|
-
var handleDataChange = function handleDataChange(key, data) {
|
|
225
|
-
_this2.props.onDataChange(key, data);
|
|
226
|
-
};
|
|
227
|
-
|
|
228
|
-
var CustomToolbar = getCustomToolbar(plugin, node, value, handleDone, getFocusedValue, this.props.onDataChange);
|
|
229
|
-
var filteredPlugins = plugin && plugin.filterPlugins ? plugin.filterPlugins(node, plugins) : plugins;
|
|
230
|
-
log('[render] CustomToolbar: ', CustomToolbar);
|
|
231
|
-
var parentExtraStyles = parentPlugin && parentPlugin.pluginStyles ? parentPlugin.pluginStyles(node, parentNode, plugin) : {};
|
|
232
|
-
var pluginExtraStyles = plugin && plugin.pluginStyles ? plugin.pluginStyles(node, parentNode, plugin) : {};
|
|
233
|
-
|
|
234
|
-
var extraStyles = _objectSpread(_objectSpread({}, pluginExtraStyles), parentExtraStyles);
|
|
235
|
-
|
|
236
|
-
var deletable = node && plugin && plugin.deleteNode;
|
|
237
|
-
var customToolbarShowDone = node && plugin && plugin.toolbar && plugin.toolbar.showDone && !toolbarOpts.alwaysVisible; // If there is a toolbarOpts we check if the showDone is not equal to false
|
|
238
|
-
|
|
239
|
-
var defaultToolbarShowDone = !toolbarOpts || toolbarOpts.showDone !== false;
|
|
240
|
-
var hasDoneButton = defaultToolbarShowDone || customToolbarShowDone;
|
|
241
|
-
var names = (0, _classnames["default"])(classes.toolbar, _constants.PIE_TOOLBAR__CLASS, (_classNames = {}, (0, _defineProperty2["default"])(_classNames, classes.toolbarWithNoDone, !hasDoneButton), (0, _defineProperty2["default"])(_classNames, classes.toolbarTop, toolbarOpts.position === 'top'), (0, _defineProperty2["default"])(_classNames, classes.toolbarRight, toolbarOpts.alignment === 'right'), (0, _defineProperty2["default"])(_classNames, classes.focused, toolbarOpts.alwaysVisible || isFocused), (0, _defineProperty2["default"])(_classNames, classes.autoWidth, autoWidth), (0, _defineProperty2["default"])(_classNames, classes.fullWidth, !autoWidth), (0, _defineProperty2["default"])(_classNames, classes.hidden, toolbarOpts.isHidden === true), _classNames));
|
|
242
|
-
var customStyles = toolbarOpts.minWidth !== undefined ? {
|
|
243
|
-
minWidth: toolbarOpts.minWidth
|
|
244
|
-
} : {};
|
|
245
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
246
|
-
className: names,
|
|
247
|
-
style: _objectSpread(_objectSpread({}, extraStyles), customStyles),
|
|
248
|
-
onClick: this.onClick,
|
|
249
|
-
ref: toolbarRef
|
|
250
|
-
}, CustomToolbar ? /*#__PURE__*/_react["default"].createElement(CustomToolbar, {
|
|
251
|
-
node: node,
|
|
252
|
-
value: value,
|
|
253
|
-
getFocusedValue: getFocusedValue,
|
|
254
|
-
onToolbarDone: this.onToolbarDone,
|
|
255
|
-
onDataChange: handleDataChange,
|
|
256
|
-
pluginProps: pluginProps
|
|
257
|
-
}) : /*#__PURE__*/_react["default"].createElement(_defaultToolbar["default"], {
|
|
258
|
-
plugins: filteredPlugins,
|
|
259
|
-
pluginProps: pluginProps,
|
|
260
|
-
value: value,
|
|
261
|
-
onChange: onChange,
|
|
262
|
-
getFocusedValue: getFocusedValue,
|
|
263
|
-
showDone: defaultToolbarShowDone,
|
|
264
|
-
onDone: handleDone,
|
|
265
|
-
deletable: deletable,
|
|
266
|
-
isHtmlMode: toolbarOpts.isHtmlMode,
|
|
267
|
-
onFocus: onFocus,
|
|
268
|
-
doneButtonRef: doneButtonRef,
|
|
269
|
-
onBlur: onBlur
|
|
270
|
-
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
271
|
-
className: classes.shared
|
|
272
|
-
}, deletable && /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
|
|
273
|
-
"aria-label": "Delete",
|
|
274
|
-
className: classes.iconRoot,
|
|
275
|
-
onMouseDown: function onMouseDown(e) {
|
|
276
|
-
return _this2.onDeleteMouseDown(e, plugin, node, value, onChange);
|
|
277
|
-
},
|
|
278
|
-
classes: {
|
|
279
|
-
root: classes.iconRoot
|
|
280
|
-
}
|
|
281
|
-
}, /*#__PURE__*/_react["default"].createElement(_Delete["default"], null)), customToolbarShowDone && /*#__PURE__*/_react["default"].createElement(_doneButton.DoneButton, {
|
|
282
|
-
doneButtonRef: doneButtonRef,
|
|
283
|
-
onClick: handleDone
|
|
284
|
-
})));
|
|
285
|
-
}
|
|
286
|
-
}]);
|
|
287
|
-
return Toolbar;
|
|
288
|
-
}(_react["default"].Component);
|
|
289
|
-
|
|
290
|
-
exports.Toolbar = Toolbar;
|
|
291
|
-
(0, _defineProperty2["default"])(Toolbar, "propTypes", {
|
|
292
|
-
zIndex: _propTypes["default"].number,
|
|
293
|
-
value: _slatePropTypes["default"].value.isRequired,
|
|
294
|
-
plugins: _propTypes["default"].array,
|
|
295
|
-
plugin: _propTypes["default"].object,
|
|
296
|
-
onImageClick: _propTypes["default"].func,
|
|
297
|
-
onDone: _propTypes["default"].func.isRequired,
|
|
298
|
-
toolbarRef: _propTypes["default"].func.isRequired,
|
|
299
|
-
classes: _propTypes["default"].object.isRequired,
|
|
300
|
-
isFocused: _propTypes["default"].bool,
|
|
301
|
-
autoWidth: _propTypes["default"].bool,
|
|
302
|
-
onChange: _propTypes["default"].func.isRequired,
|
|
303
|
-
getFocusedValue: _propTypes["default"].func.isRequired,
|
|
304
|
-
pluginProps: _propTypes["default"].object,
|
|
305
|
-
toolbarOpts: _propTypes["default"].shape({
|
|
306
|
-
position: _propTypes["default"].oneOf(['bottom', 'top']),
|
|
307
|
-
alignment: _propTypes["default"].oneOf(['left', 'right']),
|
|
308
|
-
alwaysVisible: _propTypes["default"].bool,
|
|
309
|
-
ref: _propTypes["default"].func,
|
|
310
|
-
showDone: _propTypes["default"].bool,
|
|
311
|
-
minWidth: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
|
|
312
|
-
isHidden: _propTypes["default"].bool
|
|
313
|
-
}),
|
|
314
|
-
onDataChange: _propTypes["default"].func,
|
|
315
|
-
doneButtonRef: _propTypes["default"].func,
|
|
316
|
-
onBlur: _propTypes["default"].func,
|
|
317
|
-
onFocus: _propTypes["default"].func
|
|
318
|
-
});
|
|
319
|
-
var style = {
|
|
320
|
-
toolbar: {
|
|
321
|
-
position: 'absolute',
|
|
322
|
-
zIndex: 10,
|
|
323
|
-
cursor: 'pointer',
|
|
324
|
-
justifyContent: 'space-between',
|
|
325
|
-
background: 'var(--editable-html-toolbar-bg, #efefef)',
|
|
326
|
-
minWidth: '280px',
|
|
327
|
-
margin: '5px 0 0 0',
|
|
328
|
-
padding: '2px',
|
|
329
|
-
boxShadow: '0px 1px 5px 0px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 3px 1px -2px rgba(0, 0, 0, 0.12)',
|
|
330
|
-
boxSizing: 'border-box',
|
|
331
|
-
display: 'flex',
|
|
332
|
-
opacity: 0,
|
|
333
|
-
pointerEvents: 'none'
|
|
334
|
-
},
|
|
335
|
-
toolbarWithNoDone: {
|
|
336
|
-
minWidth: '265px'
|
|
337
|
-
},
|
|
338
|
-
toolbarTop: {
|
|
339
|
-
top: '-45px'
|
|
340
|
-
},
|
|
341
|
-
toolbarRight: {
|
|
342
|
-
right: 0
|
|
343
|
-
},
|
|
344
|
-
fullWidth: {
|
|
345
|
-
width: '100%'
|
|
346
|
-
},
|
|
347
|
-
hidden: {
|
|
348
|
-
visibility: 'hidden'
|
|
349
|
-
},
|
|
350
|
-
autoWidth: {
|
|
351
|
-
width: 'auto'
|
|
352
|
-
},
|
|
353
|
-
focused: {
|
|
354
|
-
opacity: 1,
|
|
355
|
-
pointerEvents: 'auto'
|
|
356
|
-
},
|
|
357
|
-
iconRoot: {
|
|
358
|
-
width: '28px',
|
|
359
|
-
height: '28px',
|
|
360
|
-
padding: '4px',
|
|
361
|
-
verticalAlign: 'top'
|
|
362
|
-
},
|
|
363
|
-
label: {
|
|
364
|
-
color: 'var(--editable-html-toolbar-check, #00bb00)'
|
|
365
|
-
},
|
|
366
|
-
shared: {
|
|
367
|
-
display: 'flex'
|
|
368
|
-
}
|
|
369
|
-
};
|
|
370
|
-
|
|
371
|
-
var _default = (0, _styles.withStyles)(style, {
|
|
372
|
-
index: 1000
|
|
373
|
-
})(Toolbar);
|
|
374
|
-
|
|
375
|
-
exports["default"] = _default;
|
|
376
|
-
//# sourceMappingURL=toolbar.js.map
|