@pie-lib/editable-html-tip-tap 2.1.2-next.31 → 2.1.2-next.36
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.json +32 -0
- package/CHANGELOG.md +2532 -0
- package/LICENSE.md +5 -0
- package/lib/components/CharacterPicker.js +201 -0
- package/lib/components/CharacterPicker.js.map +1 -0
- package/lib/components/EditableHtml.js +376 -0
- package/lib/components/EditableHtml.js.map +1 -0
- package/lib/components/MenuBar.js +697 -0
- package/lib/components/MenuBar.js.map +1 -0
- package/lib/components/TiptapContainer.js +234 -0
- package/lib/components/TiptapContainer.js.map +1 -0
- package/lib/components/characters/characterUtils.js +378 -0
- package/lib/components/characters/characterUtils.js.map +1 -0
- package/lib/components/characters/custom-popper.js +44 -0
- package/lib/components/characters/custom-popper.js.map +1 -0
- package/lib/components/common/done-button.js +34 -0
- package/lib/components/common/done-button.js.map +1 -0
- package/lib/components/common/toolbar-buttons.js +144 -0
- package/lib/components/common/toolbar-buttons.js.map +1 -0
- package/lib/components/icons/CssIcon.js +25 -0
- package/lib/components/icons/CssIcon.js.map +1 -0
- package/lib/components/icons/RespArea.js +72 -0
- package/lib/components/icons/RespArea.js.map +1 -0
- package/lib/components/icons/TableIcons.js +53 -0
- package/lib/components/icons/TableIcons.js.map +1 -0
- package/lib/components/icons/TextAlign.js +157 -0
- package/lib/components/icons/TextAlign.js.map +1 -0
- package/lib/components/image/AltDialog.js +98 -0
- package/lib/components/image/AltDialog.js.map +1 -0
- package/lib/components/image/ImageToolbar.js +137 -0
- package/lib/components/image/ImageToolbar.js.map +1 -0
- package/lib/components/image/InsertImageHandler.js +135 -0
- package/lib/components/image/InsertImageHandler.js.map +1 -0
- package/lib/components/media/MediaDialog.js +594 -0
- package/lib/components/media/MediaDialog.js.map +1 -0
- package/lib/components/media/MediaToolbar.js +74 -0
- package/lib/components/media/MediaToolbar.js.map +1 -0
- package/lib/components/media/MediaWrapper.js +67 -0
- package/lib/components/media/MediaWrapper.js.map +1 -0
- package/lib/components/respArea/DragInTheBlank/DragInTheBlank.js +84 -0
- package/lib/components/respArea/DragInTheBlank/DragInTheBlank.js.map +1 -0
- package/lib/components/respArea/DragInTheBlank/choice.js +250 -0
- package/lib/components/respArea/DragInTheBlank/choice.js.map +1 -0
- package/lib/components/respArea/ExplicitConstructedResponse.js +137 -0
- package/lib/components/respArea/ExplicitConstructedResponse.js.map +1 -0
- package/lib/components/respArea/InlineDropdown.js +210 -0
- package/lib/components/respArea/InlineDropdown.js.map +1 -0
- package/lib/components/respArea/MathTemplated.js +130 -0
- package/lib/components/respArea/MathTemplated.js.map +1 -0
- package/lib/components/respArea/ToolbarIcon.js +81 -0
- package/lib/components/respArea/ToolbarIcon.js.map +1 -0
- package/lib/components/respArea/inlineDropdownUtils.js +67 -0
- package/lib/components/respArea/inlineDropdownUtils.js.map +1 -0
- package/lib/constants.js +11 -0
- package/lib/constants.js.map +1 -0
- package/lib/extensions/css.js +217 -0
- package/lib/extensions/css.js.map +1 -0
- package/lib/extensions/custom-toolbar-wrapper.js +92 -0
- package/lib/extensions/custom-toolbar-wrapper.js.map +1 -0
- package/lib/extensions/div-node.js +83 -0
- package/lib/extensions/div-node.js.map +1 -0
- package/lib/extensions/ensure-empty-root-div.js +48 -0
- package/lib/extensions/ensure-empty-root-div.js.map +1 -0
- package/lib/extensions/ensure-list-item-content-is-div.js +64 -0
- package/lib/extensions/ensure-list-item-content-is-div.js.map +1 -0
- package/lib/extensions/extended-list-item.js +15 -0
- package/lib/extensions/extended-list-item.js.map +1 -0
- package/lib/extensions/extended-table-cell.js +22 -0
- package/lib/extensions/extended-table-cell.js.map +1 -0
- package/lib/extensions/extended-table.js +75 -0
- package/lib/extensions/extended-table.js.map +1 -0
- package/lib/extensions/heading-paragraph.js +61 -0
- package/lib/extensions/heading-paragraph.js.map +1 -0
- package/lib/extensions/image-component.js +348 -0
- package/lib/extensions/image-component.js.map +1 -0
- package/lib/extensions/image.js +134 -0
- package/lib/extensions/image.js.map +1 -0
- package/lib/extensions/index.js +46 -0
- package/lib/extensions/index.js.map +1 -0
- package/lib/extensions/math.js +342 -0
- package/lib/extensions/math.js.map +1 -0
- package/lib/extensions/media.js +243 -0
- package/lib/extensions/media.js.map +1 -0
- package/lib/extensions/responseArea.js +446 -0
- package/lib/extensions/responseArea.js.map +1 -0
- package/lib/index.js +37 -0
- package/lib/index.js.map +1 -0
- package/lib/styles/editorContainerStyles.js +137 -0
- package/lib/styles/editorContainerStyles.js.map +1 -0
- package/lib/theme.js +8 -0
- package/lib/theme.js.map +1 -0
- package/lib/utils/helper.js +73 -0
- package/lib/utils/helper.js.map +1 -0
- package/lib/utils/size.js +26 -0
- package/lib/utils/size.js.map +1 -0
- package/lib/utils/toolbar.js +19 -0
- package/lib/utils/toolbar.js.map +1 -0
- package/package.json +24 -40
- package/src/__tests__/EditableHtml.test.jsx +554 -0
- package/src/__tests__/constants.test.js +19 -0
- package/src/__tests__/div-to-paragraph-conversion.test.jsx +125 -0
- package/src/__tests__/extensions.test.js +208 -0
- package/src/__tests__/index.test.jsx +154 -0
- package/src/__tests__/size-utils.test.js +64 -0
- package/src/__tests__/theme.test.js +17 -0
- package/src/components/CharacterPicker.jsx +207 -0
- package/src/components/EditableHtml.jsx +440 -0
- package/src/components/MenuBar.jsx +556 -0
- package/src/components/TiptapContainer.jsx +219 -0
- package/src/components/__tests__/AltDialog.test.jsx +147 -0
- package/src/components/__tests__/CharacterPicker.test.jsx +261 -0
- package/src/components/__tests__/CssIcon.test.jsx +46 -0
- package/src/components/__tests__/DragInTheBlank.test.jsx +255 -0
- package/src/components/__tests__/ExplicitConstructedResponse.test.jsx +209 -0
- package/src/components/__tests__/ImageToolbar.test.jsx +128 -0
- package/src/components/__tests__/InlineDropdown.test.jsx +393 -0
- package/src/components/__tests__/InsertImageHandler.test.js +161 -0
- package/src/components/__tests__/MediaDialog.test.jsx +293 -0
- package/src/components/__tests__/MediaToolbar.test.jsx +74 -0
- package/src/components/__tests__/MediaWrapper.test.jsx +81 -0
- package/src/components/__tests__/MenuBar.test.jsx +250 -0
- package/src/components/__tests__/RespArea.test.jsx +122 -0
- package/src/components/__tests__/TableIcons.test.jsx +149 -0
- package/src/components/__tests__/TextAlign.test.jsx +167 -0
- package/src/components/__tests__/TiptapContainer.test.jsx +138 -0
- package/src/components/__tests__/characterUtils.test.js +166 -0
- package/src/components/__tests__/choice.test.jsx +171 -0
- package/src/components/__tests__/custom-popper.test.jsx +82 -0
- package/src/components/__tests__/done-button.test.jsx +54 -0
- package/src/components/__tests__/toolbar-buttons.test.jsx +234 -0
- package/src/components/characters/characterUtils.js +447 -0
- package/src/components/characters/custom-popper.js +38 -0
- package/src/components/common/done-button.jsx +27 -0
- package/src/components/common/toolbar-buttons.jsx +122 -0
- package/src/components/icons/CssIcon.jsx +15 -0
- package/src/components/icons/RespArea.jsx +71 -0
- package/src/components/icons/TableIcons.jsx +52 -0
- package/src/components/icons/TextAlign.jsx +114 -0
- package/src/components/image/AltDialog.jsx +82 -0
- package/src/components/image/ImageToolbar.jsx +99 -0
- package/src/components/image/InsertImageHandler.js +107 -0
- package/src/components/media/MediaDialog.jsx +596 -0
- package/src/components/media/MediaToolbar.jsx +49 -0
- package/src/components/media/MediaWrapper.jsx +39 -0
- package/src/components/respArea/DragInTheBlank/DragInTheBlank.jsx +76 -0
- package/src/components/respArea/DragInTheBlank/choice.jsx +256 -0
- package/src/components/respArea/ExplicitConstructedResponse.jsx +136 -0
- package/src/components/respArea/InlineDropdown.jsx +221 -0
- package/src/components/respArea/MathTemplated.jsx +124 -0
- package/src/components/respArea/ToolbarIcon.jsx +66 -0
- package/src/components/respArea/__tests__/MathTemplated.test.jsx +210 -0
- package/src/components/respArea/inlineDropdownUtils.js +79 -0
- package/src/constants.js +5 -0
- package/src/extensions/__tests__/css.test.js +196 -0
- package/src/extensions/__tests__/custom-toolbar-wrapper.test.jsx +180 -0
- package/src/extensions/__tests__/divNode.test.js +87 -0
- package/src/extensions/__tests__/ensure-empty-root-div.test.js +57 -0
- package/src/extensions/__tests__/ensure-list-item-content-is-div.test.js +44 -0
- package/src/extensions/__tests__/extended-list-item.test.js +13 -0
- package/src/extensions/__tests__/extended-table-cell.test.js +22 -0
- package/src/extensions/__tests__/extended-table.test.js +183 -0
- package/src/extensions/__tests__/image-component.test.jsx +345 -0
- package/src/extensions/__tests__/image.test.js +237 -0
- package/src/extensions/__tests__/math.test.js +604 -0
- package/src/extensions/__tests__/media-node-view.test.jsx +298 -0
- package/src/extensions/__tests__/media.test.js +271 -0
- package/src/extensions/__tests__/responseArea.test.js +601 -0
- package/src/extensions/css.js +220 -0
- package/src/extensions/custom-toolbar-wrapper.jsx +78 -0
- package/src/extensions/div-node.js +86 -0
- package/src/extensions/ensure-empty-root-div.js +47 -0
- package/src/extensions/ensure-list-item-content-is-div.js +62 -0
- package/src/extensions/extended-list-item.js +10 -0
- package/src/extensions/extended-table-cell.js +19 -0
- package/src/extensions/extended-table.js +60 -0
- package/src/extensions/heading-paragraph.js +53 -0
- package/src/extensions/image-component.jsx +338 -0
- package/src/extensions/image.js +109 -0
- package/src/extensions/index.js +81 -0
- package/src/extensions/math.js +325 -0
- package/src/extensions/media.js +188 -0
- package/src/extensions/responseArea.js +401 -0
- package/src/index.jsx +5 -0
- package/src/styles/editorContainerStyles.js +145 -0
- package/src/theme.js +1 -0
- package/src/utils/__tests__/helper.test.js +126 -0
- package/src/utils/__tests__/toolbar.test.js +43 -0
- package/src/utils/helper.js +69 -0
- package/src/utils/size.js +32 -0
- package/src/utils/toolbar.js +15 -0
- package/dist/components/CharacterPicker.d.ts +0 -31
- package/dist/components/CharacterPicker.js +0 -131
- package/dist/components/EditableHtml.d.ts +0 -11
- package/dist/components/EditableHtml.js +0 -291
- package/dist/components/MenuBar.d.ts +0 -11
- package/dist/components/MenuBar.js +0 -462
- package/dist/components/TiptapContainer.d.ts +0 -11
- package/dist/components/TiptapContainer.js +0 -154
- package/dist/components/characters/characterUtils.d.ts +0 -35
- package/dist/components/characters/characterUtils.js +0 -465
- package/dist/components/characters/custom-popper.d.ts +0 -14
- package/dist/components/characters/custom-popper.js +0 -32
- package/dist/components/common/done-button.d.ts +0 -30
- package/dist/components/common/done-button.js +0 -26
- package/dist/components/common/toolbar-buttons.d.ts +0 -38
- package/dist/components/common/toolbar-buttons.js +0 -91
- package/dist/components/icons/CssIcon.d.ts +0 -11
- package/dist/components/icons/CssIcon.js +0 -14
- package/dist/components/icons/RespArea.d.ts +0 -26
- package/dist/components/icons/RespArea.js +0 -42
- package/dist/components/icons/TableIcons.d.ts +0 -14
- package/dist/components/icons/TableIcons.js +0 -32
- package/dist/components/icons/TextAlign.d.ts +0 -18
- package/dist/components/icons/TextAlign.js +0 -134
- package/dist/components/image/AltDialog.d.ts +0 -22
- package/dist/components/image/AltDialog.js +0 -61
- package/dist/components/image/ImageToolbar.d.ts +0 -24
- package/dist/components/image/ImageToolbar.js +0 -80
- package/dist/components/image/InsertImageHandler.d.ts +0 -32
- package/dist/components/image/InsertImageHandler.js +0 -53
- package/dist/components/media/MediaDialog.d.ts +0 -43
- package/dist/components/media/MediaDialog.js +0 -389
- package/dist/components/media/MediaToolbar.d.ts +0 -19
- package/dist/components/media/MediaToolbar.js +0 -41
- package/dist/components/media/MediaWrapper.d.ts +0 -19
- package/dist/components/respArea/DragInTheBlank/DragInTheBlank.d.ts +0 -23
- package/dist/components/respArea/DragInTheBlank/DragInTheBlank.js +0 -58
- package/dist/components/respArea/DragInTheBlank/choice.d.ts +0 -56
- package/dist/components/respArea/DragInTheBlank/choice.js +0 -156
- package/dist/components/respArea/ExplicitConstructedResponse.d.ts +0 -20
- package/dist/components/respArea/ExplicitConstructedResponse.js +0 -83
- package/dist/components/respArea/InlineDropdown.d.ts +0 -18
- package/dist/components/respArea/InlineDropdown.js +0 -119
- package/dist/components/respArea/MathTemplated.d.ts +0 -19
- package/dist/components/respArea/MathTemplated.js +0 -97
- package/dist/components/respArea/ToolbarIcon.d.ts +0 -14
- package/dist/components/respArea/ToolbarIcon.js +0 -17
- package/dist/components/respArea/inlineDropdownUtils.d.ts +0 -15
- package/dist/components/respArea/inlineDropdownUtils.js +0 -15
- package/dist/constants.d.ts +0 -13
- package/dist/constants.js +0 -4
- package/dist/extensions/css.d.ts +0 -11
- package/dist/extensions/css.js +0 -115
- package/dist/extensions/custom-toolbar-wrapper.d.ts +0 -11
- package/dist/extensions/custom-toolbar-wrapper.js +0 -61
- package/dist/extensions/div-node.d.ts +0 -10
- package/dist/extensions/div-node.js +0 -42
- package/dist/extensions/ensure-empty-root-div.d.ts +0 -14
- package/dist/extensions/ensure-empty-root-div.js +0 -24
- package/dist/extensions/ensure-list-item-content-is-div.d.ts +0 -15
- package/dist/extensions/ensure-list-item-content-is-div.js +0 -31
- package/dist/extensions/extended-list-item.d.ts +0 -13
- package/dist/extensions/extended-list-item.js +0 -5
- package/dist/extensions/extended-table-cell.d.ts +0 -10
- package/dist/extensions/extended-table-cell.js +0 -6
- package/dist/extensions/extended-table.d.ts +0 -17
- package/dist/extensions/extended-table.js +0 -34
- package/dist/extensions/heading-paragraph.d.ts +0 -17
- package/dist/extensions/heading-paragraph.js +0 -30
- package/dist/extensions/image-component.d.ts +0 -22
- package/dist/extensions/image-component.js +0 -220
- package/dist/extensions/image.d.ts +0 -10
- package/dist/extensions/image.js +0 -68
- package/dist/extensions/index.d.ts +0 -16
- package/dist/extensions/index.js +0 -64
- package/dist/extensions/math.d.ts +0 -15
- package/dist/extensions/math.js +0 -158
- package/dist/extensions/media.d.ts +0 -19
- package/dist/extensions/media.js +0 -149
- package/dist/extensions/responseArea.d.ts +0 -27
- package/dist/extensions/responseArea.js +0 -259
- package/dist/index.d.ts +0 -13
- package/dist/index.js +0 -7
- package/dist/node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js +0 -16
- package/dist/styles/editorContainerStyles.d.ts +0 -134
- package/dist/theme.d.ts +0 -9
- package/dist/utils/helper.d.ts +0 -9
- package/dist/utils/helper.js +0 -27
- package/dist/utils/size.d.ts +0 -9
- package/dist/utils/size.js +0 -14
|
@@ -0,0 +1,697 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
14
|
+
var _styles = require("@mui/material/styles");
|
|
15
|
+
var _prosemirrorState = require("prosemirror-state");
|
|
16
|
+
var _FormatBold = _interopRequireDefault(require("@mui/icons-material/FormatBold"));
|
|
17
|
+
var _FormatItalic = _interopRequireDefault(require("@mui/icons-material/FormatItalic"));
|
|
18
|
+
var _FormatStrikethrough = _interopRequireDefault(require("@mui/icons-material/FormatStrikethrough"));
|
|
19
|
+
var _Code = _interopRequireDefault(require("@mui/icons-material/Code"));
|
|
20
|
+
var _GridOn = _interopRequireDefault(require("@mui/icons-material/GridOn"));
|
|
21
|
+
var _FormatListBulleted = _interopRequireDefault(require("@mui/icons-material/FormatListBulleted"));
|
|
22
|
+
var _FormatListNumbered = _interopRequireDefault(require("@mui/icons-material/FormatListNumbered"));
|
|
23
|
+
var _FormatUnderlined = _interopRequireDefault(require("@mui/icons-material/FormatUnderlined"));
|
|
24
|
+
var _Functions = _interopRequireDefault(require("@mui/icons-material/Functions"));
|
|
25
|
+
var _Image = _interopRequireDefault(require("@mui/icons-material/Image"));
|
|
26
|
+
var _Redo = _interopRequireDefault(require("@mui/icons-material/Redo"));
|
|
27
|
+
var _Undo = _interopRequireDefault(require("@mui/icons-material/Undo"));
|
|
28
|
+
var _FormatQuote = _interopRequireDefault(require("@mui/icons-material/FormatQuote"));
|
|
29
|
+
var _Theaters = _interopRequireDefault(require("@mui/icons-material/Theaters"));
|
|
30
|
+
var _VolumeUp = _interopRequireDefault(require("@mui/icons-material/VolumeUp"));
|
|
31
|
+
var _BorderAll = _interopRequireDefault(require("@mui/icons-material/BorderAll"));
|
|
32
|
+
var _Delete = _interopRequireDefault(require("@mui/icons-material/Delete"));
|
|
33
|
+
var _react2 = require("@tiptap/react");
|
|
34
|
+
var _constants = require("../constants");
|
|
35
|
+
var _ToolbarIcon = require("./respArea/ToolbarIcon");
|
|
36
|
+
var _characterUtils = require("./characters/characterUtils");
|
|
37
|
+
var _TextAlign = _interopRequireDefault(require("./icons/TextAlign"));
|
|
38
|
+
var _CssIcon = _interopRequireDefault(require("./icons/CssIcon"));
|
|
39
|
+
var _TableIcons = require("./icons/TableIcons");
|
|
40
|
+
var _CharacterPicker = require("./CharacterPicker");
|
|
41
|
+
var _doneButton = require("./common/done-button");
|
|
42
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
43
|
+
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; }
|
|
44
|
+
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; }
|
|
45
|
+
var SuperscriptIcon = function SuperscriptIcon() {
|
|
46
|
+
return /*#__PURE__*/_react["default"].createElement("svg", {
|
|
47
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
48
|
+
height: "24px",
|
|
49
|
+
viewBox: "0 0 24 24",
|
|
50
|
+
width: "24px",
|
|
51
|
+
fill: "none"
|
|
52
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
53
|
+
d: "M22,7h-2v1h3v1h-4V7c0-0.55,0.45-1,1-1h2V5h-3V4h3c0.55,0,1,0.45,1,1v1C23,6.55,22.55,7,22,7z M5.88,20h2.66l3.4-5.42h0.12 l3.4,5.42h2.66l-4.65-7.27L17.81,6h-2.68l-3.07,4.99h-0.12L8.85,6H6.19l4.32,6.73L5.88,20z",
|
|
54
|
+
fill: "currentColor"
|
|
55
|
+
}));
|
|
56
|
+
};
|
|
57
|
+
var SubscriptIcon = function SubscriptIcon() {
|
|
58
|
+
return /*#__PURE__*/_react["default"].createElement("svg", {
|
|
59
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
60
|
+
height: "24px",
|
|
61
|
+
viewBox: "0 0 24 24",
|
|
62
|
+
width: "24px",
|
|
63
|
+
fill: "none"
|
|
64
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
65
|
+
d: "M22,18h-2v1h3v1h-4v-2c0-0.55,0.45-1,1-1h2v-1h-3v-1h3c0.55,0,1,0.45,1,1v1C23,17.55,22.55,18,22,18z M5.88,18h2.66 l3.4-5.42h0.12l3.4,5.42h2.66l-4.65-7.27L17.81,4h-2.68l-3.07,4.99h-0.12L8.85,4H6.19l4.32,6.73L5.88,18z",
|
|
66
|
+
fill: "currentColor"
|
|
67
|
+
}));
|
|
68
|
+
};
|
|
69
|
+
var HeadingIcon = function HeadingIcon() {
|
|
70
|
+
return /*#__PURE__*/_react["default"].createElement("svg", {
|
|
71
|
+
width: "30",
|
|
72
|
+
height: "28",
|
|
73
|
+
viewBox: "0 0 30 28",
|
|
74
|
+
fill: "none",
|
|
75
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
76
|
+
style: {
|
|
77
|
+
width: '20px',
|
|
78
|
+
height: '18px'
|
|
79
|
+
}
|
|
80
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
81
|
+
d: "M27 4V24H29C29.5 24 30 24.5 30 25V27C30 27.5625 29.5 28 29 28H19C18.4375 28 18 27.5625 18 27V25C18 24.5 18.4375 24 19 24H21V16H9V24H11C11.5 24 12 24.5 12 25V27C12 27.5625 11.5 28 11 28H1C0.4375 28 0 27.5625 0 27V25C0 24.5 0.4375 24 1 24H3V4H1C0.4375 4 0 3.5625 0 3V1C0 0.5 0.4375 0 1 0H11C11.5 0 12 0.5 12 1V3C12 3.5625 11.5 4 11 4H9V12H21V4H19C18.4375 4 18 3.5625 18 3V1C18 0.5 18.4375 0 19 0H29C29.5 0 30 0.5 30 1V3C30 3.5625 29.5 4 29 4H27Z",
|
|
82
|
+
fill: "currentColor"
|
|
83
|
+
}));
|
|
84
|
+
};
|
|
85
|
+
function MenuBar(_ref) {
|
|
86
|
+
var _editorState$currentN;
|
|
87
|
+
var editor = _ref.editor,
|
|
88
|
+
classes = _ref.classes,
|
|
89
|
+
activePlugins = _ref.activePlugins,
|
|
90
|
+
toolOpts = _ref.toolbarOpts,
|
|
91
|
+
responseAreaProps = _ref.responseAreaProps,
|
|
92
|
+
onChange = _ref.onChange,
|
|
93
|
+
autoWidthToolbar = _ref.autoWidthToolbar;
|
|
94
|
+
var _useState = (0, _react.useState)(false),
|
|
95
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
96
|
+
showPicker = _useState2[0],
|
|
97
|
+
setShowPicker = _useState2[1];
|
|
98
|
+
var toolbarOpts = toolOpts !== null && toolOpts !== void 0 ? toolOpts : {};
|
|
99
|
+
var editorState = (0, _react2.useEditorState)({
|
|
100
|
+
editor: editor,
|
|
101
|
+
selector: function selector(ctx) {
|
|
102
|
+
var _ctx$editor, _ctx$editor2, _ctx$editor3, _ctx$editor4, _ctx$editor5, _ctx$editor6, _ctx$editor7, _ctx$editor$_toolbarO, _ctx$editor8, _ctx$editor$isActive, _ctx$editor$can$chain, _ctx$editor$isActive2, _ref3, _ctx$editor$getAttrib, _ctx$editor$can$chain2, _ctx$editor$isActive3, _ctx$editor$can$chain3, _ctx$editor$isActive4, _ctx$editor$can$chain4, _ctx$editor$isActive5, _ctx$editor$can$chain5, _ctx$editor$can$chain6, _ctx$editor$isActive6, _ctx$editor$isActive7, _ctx$editor$isActive8, _ctx$editor$isActive9, _ctx$editor$isActive0, _ctx$editor$isActive1, _ctx$editor$isActive10, _ctx$editor$isActive11, _ctx$editor$isActive12, _ctx$editor$isActive13, _ctx$editor$isActive14, _ctx$editor$isActive15, _ctx$editor$isActive16, _ctx$editor$isActive17, _ctx$editor$isActive18, _ctx$editor$can$chain7, _ctx$editor$can$chain8;
|
|
103
|
+
var _ref2 = ((_ctx$editor = ctx.editor) === null || _ctx$editor === void 0 ? void 0 : _ctx$editor.state) || {},
|
|
104
|
+
selection = _ref2.selection;
|
|
105
|
+
var currentNode;
|
|
106
|
+
if (!((_ctx$editor2 = ctx.editor) !== null && _ctx$editor2 !== void 0 && _ctx$editor2.commandManager)) {
|
|
107
|
+
return {};
|
|
108
|
+
}
|
|
109
|
+
if (selection instanceof _prosemirrorState.NodeSelection) {
|
|
110
|
+
currentNode = selection.node; // the selected node
|
|
111
|
+
}
|
|
112
|
+
var hideDefaultToolbar = ((_ctx$editor3 = ctx.editor) === null || _ctx$editor3 === void 0 ? void 0 : _ctx$editor3.isActive('math')) || ((_ctx$editor4 = ctx.editor) === null || _ctx$editor4 === void 0 ? void 0 : _ctx$editor4.isActive('explicit_constructed_response')) || ((_ctx$editor5 = ctx.editor) === null || _ctx$editor5 === void 0 ? void 0 : _ctx$editor5.isActive('imageUploadNode')) || ((_ctx$editor6 = ctx.editor) === null || _ctx$editor6 === void 0 ? void 0 : _ctx$editor6.isActive('drag_in_the_blank'));
|
|
113
|
+
var hasTextSelectionInTable = selection && selection.empty === false && ctx.editor.isActive('table');
|
|
114
|
+
return {
|
|
115
|
+
currentNode: currentNode,
|
|
116
|
+
hideDefaultToolbar: hideDefaultToolbar,
|
|
117
|
+
hasTextSelectionInTable: hasTextSelectionInTable,
|
|
118
|
+
isFocused: (_ctx$editor7 = ctx.editor) === null || _ctx$editor7 === void 0 ? void 0 : _ctx$editor7.isFocused,
|
|
119
|
+
toolbarOpened: (_ctx$editor$_toolbarO = (_ctx$editor8 = ctx.editor) === null || _ctx$editor8 === void 0 ? void 0 : _ctx$editor8._toolbarOpened) !== null && _ctx$editor$_toolbarO !== void 0 ? _ctx$editor$_toolbarO : false,
|
|
120
|
+
isBold: (_ctx$editor$isActive = ctx.editor.isActive('bold')) !== null && _ctx$editor$isActive !== void 0 ? _ctx$editor$isActive : false,
|
|
121
|
+
canBold: (_ctx$editor$can$chain = ctx.editor.can().chain().toggleBold().run()) !== null && _ctx$editor$can$chain !== void 0 ? _ctx$editor$can$chain : false,
|
|
122
|
+
isTable: (_ctx$editor$isActive2 = ctx.editor.isActive('table')) !== null && _ctx$editor$isActive2 !== void 0 ? _ctx$editor$isActive2 : false,
|
|
123
|
+
tableHasBorder: (_ref3 = ((_ctx$editor$getAttrib = ctx.editor.getAttributes('table')) === null || _ctx$editor$getAttrib === void 0 ? void 0 : _ctx$editor$getAttrib.border) === '1') !== null && _ref3 !== void 0 ? _ref3 : false,
|
|
124
|
+
canTable: (_ctx$editor$can$chain2 = ctx.editor.can().chain().insertTable().run()) !== null && _ctx$editor$can$chain2 !== void 0 ? _ctx$editor$can$chain2 : false,
|
|
125
|
+
isItalic: (_ctx$editor$isActive3 = ctx.editor.isActive('italic')) !== null && _ctx$editor$isActive3 !== void 0 ? _ctx$editor$isActive3 : false,
|
|
126
|
+
canItalic: (_ctx$editor$can$chain3 = ctx.editor.can().chain().toggleItalic().run()) !== null && _ctx$editor$can$chain3 !== void 0 ? _ctx$editor$can$chain3 : false,
|
|
127
|
+
isStrike: (_ctx$editor$isActive4 = ctx.editor.isActive('strike')) !== null && _ctx$editor$isActive4 !== void 0 ? _ctx$editor$isActive4 : false,
|
|
128
|
+
canStrike: (_ctx$editor$can$chain4 = ctx.editor.can().chain().toggleStrike().run()) !== null && _ctx$editor$can$chain4 !== void 0 ? _ctx$editor$can$chain4 : false,
|
|
129
|
+
isCode: (_ctx$editor$isActive5 = ctx.editor.isActive('code')) !== null && _ctx$editor$isActive5 !== void 0 ? _ctx$editor$isActive5 : false,
|
|
130
|
+
canCode: (_ctx$editor$can$chain5 = ctx.editor.can().chain().toggleCode().run()) !== null && _ctx$editor$can$chain5 !== void 0 ? _ctx$editor$can$chain5 : false,
|
|
131
|
+
canClearMarks: (_ctx$editor$can$chain6 = ctx.editor.can().chain().unsetAllMarks().run()) !== null && _ctx$editor$can$chain6 !== void 0 ? _ctx$editor$can$chain6 : false,
|
|
132
|
+
isUnderline: (_ctx$editor$isActive6 = ctx.editor.isActive('underline')) !== null && _ctx$editor$isActive6 !== void 0 ? _ctx$editor$isActive6 : false,
|
|
133
|
+
isSubScript: (_ctx$editor$isActive7 = ctx.editor.isActive('subscript')) !== null && _ctx$editor$isActive7 !== void 0 ? _ctx$editor$isActive7 : false,
|
|
134
|
+
isSuperScript: (_ctx$editor$isActive8 = ctx.editor.isActive('superscript')) !== null && _ctx$editor$isActive8 !== void 0 ? _ctx$editor$isActive8 : false,
|
|
135
|
+
isParagraph: (_ctx$editor$isActive9 = ctx.editor.isActive('paragraph')) !== null && _ctx$editor$isActive9 !== void 0 ? _ctx$editor$isActive9 : false,
|
|
136
|
+
isHeading1: (_ctx$editor$isActive0 = ctx.editor.isActive('heading', {
|
|
137
|
+
level: 1
|
|
138
|
+
})) !== null && _ctx$editor$isActive0 !== void 0 ? _ctx$editor$isActive0 : false,
|
|
139
|
+
isHeading2: (_ctx$editor$isActive1 = ctx.editor.isActive('heading', {
|
|
140
|
+
level: 2
|
|
141
|
+
})) !== null && _ctx$editor$isActive1 !== void 0 ? _ctx$editor$isActive1 : false,
|
|
142
|
+
isHeading3: (_ctx$editor$isActive10 = ctx.editor.isActive('heading', {
|
|
143
|
+
level: 3
|
|
144
|
+
})) !== null && _ctx$editor$isActive10 !== void 0 ? _ctx$editor$isActive10 : false,
|
|
145
|
+
isHeadingParagraph: (_ctx$editor$isActive11 = ctx.editor.isActive('headingParagraph')) !== null && _ctx$editor$isActive11 !== void 0 ? _ctx$editor$isActive11 : false,
|
|
146
|
+
isHeading4: (_ctx$editor$isActive12 = ctx.editor.isActive('heading', {
|
|
147
|
+
level: 4
|
|
148
|
+
})) !== null && _ctx$editor$isActive12 !== void 0 ? _ctx$editor$isActive12 : false,
|
|
149
|
+
isHeading5: (_ctx$editor$isActive13 = ctx.editor.isActive('heading', {
|
|
150
|
+
level: 5
|
|
151
|
+
})) !== null && _ctx$editor$isActive13 !== void 0 ? _ctx$editor$isActive13 : false,
|
|
152
|
+
isHeading6: (_ctx$editor$isActive14 = ctx.editor.isActive('heading', {
|
|
153
|
+
level: 6
|
|
154
|
+
})) !== null && _ctx$editor$isActive14 !== void 0 ? _ctx$editor$isActive14 : false,
|
|
155
|
+
isBulletList: (_ctx$editor$isActive15 = ctx.editor.isActive('bulletList')) !== null && _ctx$editor$isActive15 !== void 0 ? _ctx$editor$isActive15 : false,
|
|
156
|
+
isOrderedList: (_ctx$editor$isActive16 = ctx.editor.isActive('orderedList')) !== null && _ctx$editor$isActive16 !== void 0 ? _ctx$editor$isActive16 : false,
|
|
157
|
+
isCodeBlock: (_ctx$editor$isActive17 = ctx.editor.isActive('codeBlock')) !== null && _ctx$editor$isActive17 !== void 0 ? _ctx$editor$isActive17 : false,
|
|
158
|
+
isBlockquote: (_ctx$editor$isActive18 = ctx.editor.isActive('blockquote')) !== null && _ctx$editor$isActive18 !== void 0 ? _ctx$editor$isActive18 : false,
|
|
159
|
+
canUndo: (_ctx$editor$can$chain7 = ctx.editor.can().chain().undo().run()) !== null && _ctx$editor$can$chain7 !== void 0 ? _ctx$editor$can$chain7 : false,
|
|
160
|
+
canRedo: (_ctx$editor$can$chain8 = ctx.editor.can().chain().redo().run()) !== null && _ctx$editor$can$chain8 !== void 0 ? _ctx$editor$can$chain8 : false
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
var hasDoneButton = false;
|
|
165
|
+
var autoWidth = !!autoWidthToolbar;
|
|
166
|
+
var names = (0, _classnames["default"])(classes.toolbar, _constants.PIE_TOOLBAR__CLASS, (0, _defineProperty2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])({}, classes.toolbarWithNoDone, !hasDoneButton), classes.toolbarTop, toolbarOpts.position === 'top'), classes.toolbarRight, toolbarOpts.alignment === 'right'), classes.focused, toolbarOpts.alwaysVisible || editorState.isFocused && !editorState.toolbarOpened && !editorState.hideDefaultToolbar), classes.autoWidth, autoWidth), classes.fullWidth, !autoWidth), classes.hidden, toolbarOpts.isHidden === true));
|
|
167
|
+
var customStyles = toolbarOpts.minWidth !== undefined ? {
|
|
168
|
+
minWidth: toolbarOpts.minWidth
|
|
169
|
+
} : {};
|
|
170
|
+
var handleMouseDown = function handleMouseDown(e) {
|
|
171
|
+
e.preventDefault();
|
|
172
|
+
};
|
|
173
|
+
var toolbarButtons = (0, _react.useMemo)(function () {
|
|
174
|
+
return [{
|
|
175
|
+
icon: /*#__PURE__*/_react["default"].createElement(_GridOn["default"], null),
|
|
176
|
+
onClick: function onClick(editor) {
|
|
177
|
+
return editor.chain().focus().insertTable({
|
|
178
|
+
rows: 2,
|
|
179
|
+
cols: 2,
|
|
180
|
+
withHeaderRow: false
|
|
181
|
+
}).run();
|
|
182
|
+
},
|
|
183
|
+
hidden: function hidden(state) {
|
|
184
|
+
return !(activePlugins !== null && activePlugins !== void 0 && activePlugins.includes('table')) || state.isTable;
|
|
185
|
+
},
|
|
186
|
+
isActive: function isActive(state) {
|
|
187
|
+
return state.isTable;
|
|
188
|
+
},
|
|
189
|
+
isDisabled: function isDisabled(state) {
|
|
190
|
+
return !state.canTable;
|
|
191
|
+
}
|
|
192
|
+
}, {
|
|
193
|
+
icon: /*#__PURE__*/_react["default"].createElement(_TableIcons.AddRow, null),
|
|
194
|
+
onClick: function onClick(editor) {
|
|
195
|
+
return editor.chain().focus().addRowAfter().run();
|
|
196
|
+
},
|
|
197
|
+
hidden: function hidden(state) {
|
|
198
|
+
return !(state.isTable && !state.hasTextSelectionInTable);
|
|
199
|
+
},
|
|
200
|
+
isActive: function isActive(state) {
|
|
201
|
+
return state.isTable;
|
|
202
|
+
},
|
|
203
|
+
isDisabled: function isDisabled(state) {
|
|
204
|
+
return !state.canTable;
|
|
205
|
+
}
|
|
206
|
+
}, {
|
|
207
|
+
icon: /*#__PURE__*/_react["default"].createElement(_TableIcons.RemoveRow, null),
|
|
208
|
+
onClick: function onClick(editor) {
|
|
209
|
+
return editor.chain().focus().deleteRow().run();
|
|
210
|
+
},
|
|
211
|
+
hidden: function hidden(state) {
|
|
212
|
+
return !(state.isTable && !state.hasTextSelectionInTable);
|
|
213
|
+
},
|
|
214
|
+
isActive: function isActive(state) {
|
|
215
|
+
return state.isTable;
|
|
216
|
+
},
|
|
217
|
+
isDisabled: function isDisabled(state) {
|
|
218
|
+
return !state.canTable;
|
|
219
|
+
}
|
|
220
|
+
}, {
|
|
221
|
+
icon: /*#__PURE__*/_react["default"].createElement(_TableIcons.AddColumn, null),
|
|
222
|
+
onClick: function onClick(editor) {
|
|
223
|
+
return editor.chain().focus().addColumnAfter().run();
|
|
224
|
+
},
|
|
225
|
+
hidden: function hidden(state) {
|
|
226
|
+
return !(state.isTable && !state.hasTextSelectionInTable);
|
|
227
|
+
},
|
|
228
|
+
isActive: function isActive(state) {
|
|
229
|
+
return state.isTable;
|
|
230
|
+
},
|
|
231
|
+
isDisabled: function isDisabled(state) {
|
|
232
|
+
return !state.canTable;
|
|
233
|
+
}
|
|
234
|
+
}, {
|
|
235
|
+
icon: /*#__PURE__*/_react["default"].createElement(_TableIcons.RemoveColumn, null),
|
|
236
|
+
onClick: function onClick(editor) {
|
|
237
|
+
return editor.chain().focus().deleteColumn().run();
|
|
238
|
+
},
|
|
239
|
+
hidden: function hidden(state) {
|
|
240
|
+
return !(state.isTable && !state.hasTextSelectionInTable);
|
|
241
|
+
},
|
|
242
|
+
isActive: function isActive(state) {
|
|
243
|
+
return state.isTable;
|
|
244
|
+
},
|
|
245
|
+
isDisabled: function isDisabled(state) {
|
|
246
|
+
return !state.canTable;
|
|
247
|
+
}
|
|
248
|
+
}, {
|
|
249
|
+
icon: /*#__PURE__*/_react["default"].createElement(_TableIcons.RemoveTable, null),
|
|
250
|
+
onClick: function onClick(editor) {
|
|
251
|
+
return editor.chain().focus().deleteTable().run();
|
|
252
|
+
},
|
|
253
|
+
hidden: function hidden(state) {
|
|
254
|
+
return !(state.isTable && !state.hasTextSelectionInTable);
|
|
255
|
+
},
|
|
256
|
+
isActive: function isActive(state) {
|
|
257
|
+
return state.isTable;
|
|
258
|
+
},
|
|
259
|
+
isDisabled: function isDisabled(state) {
|
|
260
|
+
return !state.canTable;
|
|
261
|
+
}
|
|
262
|
+
}, {
|
|
263
|
+
icon: /*#__PURE__*/_react["default"].createElement(_BorderAll["default"], null),
|
|
264
|
+
onClick: function onClick(editor) {
|
|
265
|
+
var tableAttrs = editor.getAttributes('table');
|
|
266
|
+
var update = _objectSpread(_objectSpread({}, tableAttrs), {}, {
|
|
267
|
+
border: tableAttrs.border !== '0' ? '0' : '1'
|
|
268
|
+
});
|
|
269
|
+
editor.commands.updateAttributes('table', update);
|
|
270
|
+
},
|
|
271
|
+
hidden: function hidden(state) {
|
|
272
|
+
return !(state.isTable && !state.hasTextSelectionInTable);
|
|
273
|
+
},
|
|
274
|
+
isActive: function isActive(state) {
|
|
275
|
+
return state.tableHasBorder;
|
|
276
|
+
},
|
|
277
|
+
isDisabled: function isDisabled(state) {
|
|
278
|
+
return !state.canTable;
|
|
279
|
+
}
|
|
280
|
+
}, {
|
|
281
|
+
icon: /*#__PURE__*/_react["default"].createElement(_FormatBold["default"], null),
|
|
282
|
+
onClick: function onClick(editor) {
|
|
283
|
+
return editor.chain().focus().toggleBold().run();
|
|
284
|
+
},
|
|
285
|
+
hidden: function hidden() {
|
|
286
|
+
return !(activePlugins !== null && activePlugins !== void 0 && activePlugins.includes('bold'));
|
|
287
|
+
},
|
|
288
|
+
isActive: function isActive(state) {
|
|
289
|
+
return state.isBold;
|
|
290
|
+
},
|
|
291
|
+
isDisabled: function isDisabled(state) {
|
|
292
|
+
return !state.canBold;
|
|
293
|
+
}
|
|
294
|
+
}, {
|
|
295
|
+
icon: /*#__PURE__*/_react["default"].createElement(_FormatItalic["default"], null),
|
|
296
|
+
onClick: function onClick(editor) {
|
|
297
|
+
return editor.chain().focus().toggleItalic().run();
|
|
298
|
+
},
|
|
299
|
+
hidden: function hidden() {
|
|
300
|
+
return !(activePlugins !== null && activePlugins !== void 0 && activePlugins.includes('italic'));
|
|
301
|
+
},
|
|
302
|
+
isActive: function isActive(state) {
|
|
303
|
+
return state.isItalic;
|
|
304
|
+
},
|
|
305
|
+
isDisabled: function isDisabled(state) {
|
|
306
|
+
return !state.canItalic;
|
|
307
|
+
}
|
|
308
|
+
}, {
|
|
309
|
+
icon: /*#__PURE__*/_react["default"].createElement(_FormatStrikethrough["default"], null),
|
|
310
|
+
onClick: function onClick(editor) {
|
|
311
|
+
return editor.chain().focus().toggleStrike().run();
|
|
312
|
+
},
|
|
313
|
+
hidden: function hidden() {
|
|
314
|
+
return !(activePlugins !== null && activePlugins !== void 0 && activePlugins.includes('strikethrough'));
|
|
315
|
+
},
|
|
316
|
+
isActive: function isActive(state) {
|
|
317
|
+
return state.isStrike;
|
|
318
|
+
},
|
|
319
|
+
isDisabled: function isDisabled(state) {
|
|
320
|
+
return !state.canStrike;
|
|
321
|
+
}
|
|
322
|
+
}, {
|
|
323
|
+
icon: /*#__PURE__*/_react["default"].createElement(_Code["default"], null),
|
|
324
|
+
onClick: function onClick(editor) {
|
|
325
|
+
return editor.chain().focus().toggleCode().run();
|
|
326
|
+
},
|
|
327
|
+
hidden: function hidden() {
|
|
328
|
+
return !(activePlugins !== null && activePlugins !== void 0 && activePlugins.includes('code'));
|
|
329
|
+
},
|
|
330
|
+
isActive: function isActive(state) {
|
|
331
|
+
return state.isCode;
|
|
332
|
+
},
|
|
333
|
+
isDisabled: function isDisabled(state) {
|
|
334
|
+
return !state.canCode;
|
|
335
|
+
}
|
|
336
|
+
}, {
|
|
337
|
+
icon: /*#__PURE__*/_react["default"].createElement(_FormatUnderlined["default"], null),
|
|
338
|
+
onClick: function onClick(editor) {
|
|
339
|
+
return editor.chain().focus().toggleUnderline().run();
|
|
340
|
+
},
|
|
341
|
+
hidden: function hidden() {
|
|
342
|
+
return !(activePlugins !== null && activePlugins !== void 0 && activePlugins.includes('underline'));
|
|
343
|
+
},
|
|
344
|
+
isActive: function isActive(state) {
|
|
345
|
+
return state.isUnderline;
|
|
346
|
+
}
|
|
347
|
+
}, {
|
|
348
|
+
icon: /*#__PURE__*/_react["default"].createElement(SubscriptIcon, null),
|
|
349
|
+
onClick: function onClick(editor) {
|
|
350
|
+
return editor.chain().focus().toggleSubscript().run();
|
|
351
|
+
},
|
|
352
|
+
hidden: function hidden() {
|
|
353
|
+
return !(activePlugins !== null && activePlugins !== void 0 && activePlugins.includes('subscript'));
|
|
354
|
+
},
|
|
355
|
+
isActive: function isActive(state) {
|
|
356
|
+
return state.isSubScript;
|
|
357
|
+
}
|
|
358
|
+
}, {
|
|
359
|
+
icon: /*#__PURE__*/_react["default"].createElement(SuperscriptIcon, null),
|
|
360
|
+
onClick: function onClick(editor) {
|
|
361
|
+
return editor.chain().focus().toggleSuperscript().run();
|
|
362
|
+
},
|
|
363
|
+
hidden: function hidden() {
|
|
364
|
+
return !(activePlugins !== null && activePlugins !== void 0 && activePlugins.includes('superscript'));
|
|
365
|
+
},
|
|
366
|
+
isActive: function isActive(state) {
|
|
367
|
+
return state.isSuperScript;
|
|
368
|
+
}
|
|
369
|
+
}, {
|
|
370
|
+
icon: /*#__PURE__*/_react["default"].createElement(_Image["default"], null),
|
|
371
|
+
hidden: function hidden() {
|
|
372
|
+
return !(activePlugins !== null && activePlugins !== void 0 && activePlugins.includes('image'));
|
|
373
|
+
},
|
|
374
|
+
onClick: function onClick(editor) {
|
|
375
|
+
return editor.chain().focus().setImageUploadNode().run();
|
|
376
|
+
}
|
|
377
|
+
}, {
|
|
378
|
+
icon: /*#__PURE__*/_react["default"].createElement(_Theaters["default"], null),
|
|
379
|
+
hidden: function hidden() {
|
|
380
|
+
return !(activePlugins !== null && activePlugins !== void 0 && activePlugins.includes('video'));
|
|
381
|
+
},
|
|
382
|
+
onClick: function onClick(editor) {
|
|
383
|
+
return editor.chain().focus().insertMedia({
|
|
384
|
+
type: 'video'
|
|
385
|
+
}).run();
|
|
386
|
+
}
|
|
387
|
+
}, {
|
|
388
|
+
icon: /*#__PURE__*/_react["default"].createElement(_VolumeUp["default"], null),
|
|
389
|
+
hidden: function hidden() {
|
|
390
|
+
return !(activePlugins !== null && activePlugins !== void 0 && activePlugins.includes('audio'));
|
|
391
|
+
},
|
|
392
|
+
onClick: function onClick(editor) {
|
|
393
|
+
return editor.chain().focus().insertMedia({
|
|
394
|
+
type: 'audio',
|
|
395
|
+
tag: 'audio'
|
|
396
|
+
}).run();
|
|
397
|
+
}
|
|
398
|
+
}, {
|
|
399
|
+
icon: /*#__PURE__*/_react["default"].createElement(_CssIcon["default"], null),
|
|
400
|
+
hidden: function hidden() {
|
|
401
|
+
return !(activePlugins !== null && activePlugins !== void 0 && activePlugins.includes('css'));
|
|
402
|
+
},
|
|
403
|
+
onClick: function onClick(editor) {
|
|
404
|
+
return editor.commands.openCSSClassDialog();
|
|
405
|
+
}
|
|
406
|
+
}, {
|
|
407
|
+
icon: /*#__PURE__*/_react["default"].createElement(_FormatQuote["default"], null),
|
|
408
|
+
hidden: function hidden() {
|
|
409
|
+
return !(activePlugins !== null && activePlugins !== void 0 && activePlugins.includes('blockquote'));
|
|
410
|
+
},
|
|
411
|
+
onClick: function onClick(editor) {
|
|
412
|
+
return editor.chain().focus().toggleBlockquote().run();
|
|
413
|
+
},
|
|
414
|
+
isActive: function isActive(state) {
|
|
415
|
+
return state.isBlockquote;
|
|
416
|
+
}
|
|
417
|
+
}, {
|
|
418
|
+
icon: /*#__PURE__*/_react["default"].createElement(HeadingIcon, null),
|
|
419
|
+
hidden: function hidden() {
|
|
420
|
+
return !(activePlugins !== null && activePlugins !== void 0 && activePlugins.includes('h3'));
|
|
421
|
+
},
|
|
422
|
+
onClick: function onClick(editor) {
|
|
423
|
+
return editor.chain().focus().toggleHeadingParagraph().run();
|
|
424
|
+
},
|
|
425
|
+
isActive: function isActive(state) {
|
|
426
|
+
return state.isHeadingParagraph;
|
|
427
|
+
}
|
|
428
|
+
}, {
|
|
429
|
+
icon: /*#__PURE__*/_react["default"].createElement(_Functions["default"], null),
|
|
430
|
+
hidden: function hidden() {
|
|
431
|
+
return !(activePlugins !== null && activePlugins !== void 0 && activePlugins.includes('math'));
|
|
432
|
+
},
|
|
433
|
+
onClick: function onClick(editor) {
|
|
434
|
+
return editor.chain().focus().insertMath('').run();
|
|
435
|
+
}
|
|
436
|
+
}, {
|
|
437
|
+
icon: /*#__PURE__*/_react["default"].createElement(_CharacterPicker.CharacterIcon, {
|
|
438
|
+
letter: "\xF1"
|
|
439
|
+
}),
|
|
440
|
+
hidden: function hidden() {
|
|
441
|
+
return !(activePlugins !== null && activePlugins !== void 0 && activePlugins.includes('languageCharacters'));
|
|
442
|
+
},
|
|
443
|
+
onClick: function onClick() {
|
|
444
|
+
return setShowPicker(_characterUtils.spanishConfig);
|
|
445
|
+
}
|
|
446
|
+
}, {
|
|
447
|
+
icon: /*#__PURE__*/_react["default"].createElement(_CharacterPicker.CharacterIcon, {
|
|
448
|
+
letter: "\u20AC"
|
|
449
|
+
}),
|
|
450
|
+
hidden: function hidden() {
|
|
451
|
+
return (activePlugins === null || activePlugins === void 0 ? void 0 : activePlugins.filter(function (p) {
|
|
452
|
+
return p === 'languageCharacters';
|
|
453
|
+
}).length) !== 2;
|
|
454
|
+
},
|
|
455
|
+
onClick: function onClick() {
|
|
456
|
+
return setShowPicker(_characterUtils.specialConfig);
|
|
457
|
+
}
|
|
458
|
+
}, {
|
|
459
|
+
icon: /*#__PURE__*/_react["default"].createElement(_TextAlign["default"], {
|
|
460
|
+
editor: editor
|
|
461
|
+
}),
|
|
462
|
+
hidden: function hidden() {
|
|
463
|
+
return !(activePlugins !== null && activePlugins !== void 0 && activePlugins.includes('text-align'));
|
|
464
|
+
},
|
|
465
|
+
onClick: function onClick() {}
|
|
466
|
+
}, {
|
|
467
|
+
icon: /*#__PURE__*/_react["default"].createElement(_FormatListBulleted["default"], null),
|
|
468
|
+
hidden: function hidden() {
|
|
469
|
+
return !(activePlugins !== null && activePlugins !== void 0 && activePlugins.includes('bulleted-list'));
|
|
470
|
+
},
|
|
471
|
+
onClick: function onClick(editor) {
|
|
472
|
+
return editor.chain().focus().toggleBulletList().run();
|
|
473
|
+
},
|
|
474
|
+
isActive: function isActive(state) {
|
|
475
|
+
return state.isBulletList;
|
|
476
|
+
}
|
|
477
|
+
}, {
|
|
478
|
+
icon: /*#__PURE__*/_react["default"].createElement(_FormatListNumbered["default"], null),
|
|
479
|
+
hidden: function hidden() {
|
|
480
|
+
return !(activePlugins !== null && activePlugins !== void 0 && activePlugins.includes('numbered-list'));
|
|
481
|
+
},
|
|
482
|
+
onClick: function onClick(editor) {
|
|
483
|
+
return editor.chain().focus().toggleOrderedList().run();
|
|
484
|
+
},
|
|
485
|
+
isActive: function isActive(state) {
|
|
486
|
+
return state.isOrderedList;
|
|
487
|
+
}
|
|
488
|
+
}, {
|
|
489
|
+
icon: /*#__PURE__*/_react["default"].createElement(_Undo["default"], null),
|
|
490
|
+
hidden: function hidden() {
|
|
491
|
+
return !(activePlugins !== null && activePlugins !== void 0 && activePlugins.includes('undo'));
|
|
492
|
+
},
|
|
493
|
+
onClick: function onClick(editor) {
|
|
494
|
+
return editor.chain().focus().undo().run();
|
|
495
|
+
},
|
|
496
|
+
isDisabled: function isDisabled(state) {
|
|
497
|
+
return !state.canUndo;
|
|
498
|
+
}
|
|
499
|
+
}, {
|
|
500
|
+
icon: /*#__PURE__*/_react["default"].createElement(_Redo["default"], null),
|
|
501
|
+
hidden: function hidden() {
|
|
502
|
+
return !(activePlugins !== null && activePlugins !== void 0 && activePlugins.includes('redo'));
|
|
503
|
+
},
|
|
504
|
+
onClick: function onClick(editor) {
|
|
505
|
+
return editor.chain().focus().redo().run();
|
|
506
|
+
},
|
|
507
|
+
isDisabled: function isDisabled(state) {
|
|
508
|
+
return !state.canRedo;
|
|
509
|
+
}
|
|
510
|
+
}];
|
|
511
|
+
}, [activePlugins, editor]);
|
|
512
|
+
var isDragInTheBlankSelected = editorState.hideDefaultToolbar && ((_editorState$currentN = editorState.currentNode) === null || _editorState$currentN === void 0 || (_editorState$currentN = _editorState$currentN.type) === null || _editorState$currentN === void 0 ? void 0 : _editorState$currentN.name) === 'drag_in_the_blank';
|
|
513
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
514
|
+
className: names,
|
|
515
|
+
style: _objectSpread({}, customStyles),
|
|
516
|
+
onMouseDown: handleMouseDown
|
|
517
|
+
}, isDragInTheBlankSelected && /*#__PURE__*/_react["default"].createElement("div", {
|
|
518
|
+
className: classes.defaultToolbar,
|
|
519
|
+
tabIndex: "1"
|
|
520
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
521
|
+
className: classes.buttonsContainer
|
|
522
|
+
}, /*#__PURE__*/_react["default"].createElement("button", {
|
|
523
|
+
type: "button",
|
|
524
|
+
className: classes.button,
|
|
525
|
+
onClick: function onClick(e) {
|
|
526
|
+
e.preventDefault();
|
|
527
|
+
editor.chain().focus().deleteSelection().run();
|
|
528
|
+
onChange === null || onChange === void 0 || onChange(editor.getHTML());
|
|
529
|
+
},
|
|
530
|
+
"aria-label": "Delete response area"
|
|
531
|
+
}, /*#__PURE__*/_react["default"].createElement(_Delete["default"], null)))), !editorState.hideDefaultToolbar && /*#__PURE__*/_react["default"].createElement("div", {
|
|
532
|
+
className: classes.defaultToolbar,
|
|
533
|
+
tabIndex: "1"
|
|
534
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
535
|
+
className: classes.buttonsContainer
|
|
536
|
+
}, toolbarButtons.filter(function (btn) {
|
|
537
|
+
var _btn$hidden;
|
|
538
|
+
return !((_btn$hidden = btn.hidden) !== null && _btn$hidden !== void 0 && _btn$hidden.call(btn, editorState));
|
|
539
|
+
}).map(function (btn, index) {
|
|
540
|
+
var _btn$isDisabled, _btn$isActive;
|
|
541
|
+
var disabled = (_btn$isDisabled = btn.isDisabled) === null || _btn$isDisabled === void 0 ? void 0 : _btn$isDisabled.call(btn, editorState);
|
|
542
|
+
var active = (_btn$isActive = btn.isActive) === null || _btn$isActive === void 0 ? void 0 : _btn$isActive.call(btn, editorState);
|
|
543
|
+
return /*#__PURE__*/_react["default"].createElement("button", {
|
|
544
|
+
key: index,
|
|
545
|
+
disabled: disabled,
|
|
546
|
+
onClick: function onClick(e) {
|
|
547
|
+
e.preventDefault();
|
|
548
|
+
btn.onClick(editor);
|
|
549
|
+
},
|
|
550
|
+
className: (0, _classnames["default"])(classes.button, (0, _defineProperty2["default"])({}, classes.active, active))
|
|
551
|
+
}, btn.icon);
|
|
552
|
+
})), (activePlugins === null || activePlugins === void 0 ? void 0 : activePlugins.includes('responseArea')) && /*#__PURE__*/_react["default"].createElement("button", {
|
|
553
|
+
onClick: function onClick() {
|
|
554
|
+
editor.chain().focus().insertResponseArea(responseAreaProps.type).run();
|
|
555
|
+
},
|
|
556
|
+
className: classes.button
|
|
557
|
+
}, /*#__PURE__*/_react["default"].createElement(_ToolbarIcon.ToolbarIcon, null)), toolbarOpts.showDone && /*#__PURE__*/_react["default"].createElement(_doneButton.DoneButton, {
|
|
558
|
+
onClick: function onClick() {
|
|
559
|
+
onChange === null || onChange === void 0 || onChange(editor.getHTML());
|
|
560
|
+
editor.commands.blur();
|
|
561
|
+
}
|
|
562
|
+
})), showPicker && /*#__PURE__*/_react["default"].createElement(_CharacterPicker.CharacterPicker, {
|
|
563
|
+
editor: editor,
|
|
564
|
+
opts: _objectSpread(_objectSpread({}, showPicker), {}, {
|
|
565
|
+
renderPopOver: function renderPopOver(ev, ch) {
|
|
566
|
+
return console.log('Show popover', ch);
|
|
567
|
+
},
|
|
568
|
+
closePopOver: function closePopOver() {
|
|
569
|
+
return console.log('Close popover');
|
|
570
|
+
}
|
|
571
|
+
}),
|
|
572
|
+
onClose: function onClose() {
|
|
573
|
+
return setShowPicker(false);
|
|
574
|
+
}
|
|
575
|
+
}));
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
// Wrapper component that provides classes object using styled API
|
|
579
|
+
var StyledMenuBar = function StyledMenuBar(props) {
|
|
580
|
+
var theme = (0, _styles.useTheme)();
|
|
581
|
+
var classes = {
|
|
582
|
+
defaultToolbar: 'defaultToolbar',
|
|
583
|
+
buttonsContainer: 'buttonsContainer',
|
|
584
|
+
button: 'toolbarButton',
|
|
585
|
+
active: 'active',
|
|
586
|
+
disabled: 'disabled',
|
|
587
|
+
isActive: 'isActive',
|
|
588
|
+
toolbar: 'toolbar',
|
|
589
|
+
toolbarWithNoDone: 'toolbarWithNoDone',
|
|
590
|
+
toolbarTop: 'toolbarTop',
|
|
591
|
+
toolbarRight: 'toolbarRight',
|
|
592
|
+
fullWidth: 'fullWidth',
|
|
593
|
+
hidden: 'hidden',
|
|
594
|
+
autoWidth: 'autoWidth',
|
|
595
|
+
focused: 'focused',
|
|
596
|
+
iconRoot: 'iconRoot',
|
|
597
|
+
label: 'label',
|
|
598
|
+
shared: 'shared'
|
|
599
|
+
};
|
|
600
|
+
return /*#__PURE__*/_react["default"].createElement(StyledMenuBarRoot, null, /*#__PURE__*/_react["default"].createElement(MenuBar, (0, _extends2["default"])({}, props, {
|
|
601
|
+
classes: classes
|
|
602
|
+
})));
|
|
603
|
+
};
|
|
604
|
+
var StyledMenuBarRoot = (0, _styles.styled)('div')(function (_ref4) {
|
|
605
|
+
var theme = _ref4.theme;
|
|
606
|
+
return {
|
|
607
|
+
'& .defaultToolbar': {
|
|
608
|
+
display: 'flex',
|
|
609
|
+
width: '100%',
|
|
610
|
+
justifyContent: 'space-between'
|
|
611
|
+
},
|
|
612
|
+
'& .buttonsContainer': {
|
|
613
|
+
alignItems: 'center',
|
|
614
|
+
display: 'flex',
|
|
615
|
+
width: '100%'
|
|
616
|
+
},
|
|
617
|
+
'& .toolbarButton': {
|
|
618
|
+
color: 'grey',
|
|
619
|
+
display: 'inline-flex',
|
|
620
|
+
padding: '2px',
|
|
621
|
+
background: 'none',
|
|
622
|
+
border: 'none',
|
|
623
|
+
cursor: 'pointer',
|
|
624
|
+
'&:hover': {
|
|
625
|
+
color: 'black'
|
|
626
|
+
},
|
|
627
|
+
'&:focus': {
|
|
628
|
+
outline: "2px solid ".concat(theme.palette.grey[700])
|
|
629
|
+
}
|
|
630
|
+
},
|
|
631
|
+
'& .active': {
|
|
632
|
+
color: 'black'
|
|
633
|
+
},
|
|
634
|
+
'& .disabled': {
|
|
635
|
+
opacity: 0.7,
|
|
636
|
+
cursor: 'not-allowed',
|
|
637
|
+
'& :hover': {
|
|
638
|
+
color: 'grey'
|
|
639
|
+
}
|
|
640
|
+
},
|
|
641
|
+
'& .isActive': {
|
|
642
|
+
background: 'var(--purple)',
|
|
643
|
+
color: 'var(--white)'
|
|
644
|
+
},
|
|
645
|
+
'& .toolbar': {
|
|
646
|
+
position: 'absolute',
|
|
647
|
+
zIndex: 20,
|
|
648
|
+
cursor: 'pointer',
|
|
649
|
+
justifyContent: 'space-between',
|
|
650
|
+
background: 'var(--editable-html-toolbar-bg, #efefef)',
|
|
651
|
+
minWidth: '280px',
|
|
652
|
+
margin: '5px 0 0 0',
|
|
653
|
+
padding: '2px',
|
|
654
|
+
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)',
|
|
655
|
+
boxSizing: 'border-box',
|
|
656
|
+
display: 'flex',
|
|
657
|
+
opacity: 0,
|
|
658
|
+
pointerEvents: 'none'
|
|
659
|
+
},
|
|
660
|
+
'& .toolbarWithNoDone': {
|
|
661
|
+
minWidth: '265px'
|
|
662
|
+
},
|
|
663
|
+
'& .toolbarTop': {
|
|
664
|
+
top: '-45px'
|
|
665
|
+
},
|
|
666
|
+
'& .toolbarRight': {
|
|
667
|
+
right: 0
|
|
668
|
+
},
|
|
669
|
+
'& .fullWidth': {
|
|
670
|
+
width: '100%'
|
|
671
|
+
},
|
|
672
|
+
'& .hidden': {
|
|
673
|
+
visibility: 'hidden'
|
|
674
|
+
},
|
|
675
|
+
'& .autoWidth': {
|
|
676
|
+
width: 'auto'
|
|
677
|
+
},
|
|
678
|
+
'& .focused': {
|
|
679
|
+
opacity: 1,
|
|
680
|
+
pointerEvents: 'auto'
|
|
681
|
+
},
|
|
682
|
+
'& .iconRoot': {
|
|
683
|
+
width: '28px',
|
|
684
|
+
height: '28px',
|
|
685
|
+
padding: '4px',
|
|
686
|
+
verticalAlign: 'top'
|
|
687
|
+
},
|
|
688
|
+
'& .label': {
|
|
689
|
+
color: 'var(--editable-html-toolbar-check, #00bb00)'
|
|
690
|
+
},
|
|
691
|
+
'& .shared': {
|
|
692
|
+
display: 'flex'
|
|
693
|
+
}
|
|
694
|
+
};
|
|
695
|
+
});
|
|
696
|
+
var _default = exports["default"] = StyledMenuBar;
|
|
697
|
+
//# sourceMappingURL=MenuBar.js.map
|