@modusoperandi/licit 1.0.5 → 1.0.7
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/BlockquoteInsertNewLineCommand.js +10 -11
- package/BlockquoteInsertNewLineCommand.js.flow +1 -2
- package/BlockquoteNodeSpec.js +2 -3
- package/BlockquoteNodeSpec.js.flow +1 -2
- package/BlockquoteToggleCommand.js +9 -9
- package/BookmarkNodeSpec.js +1 -1
- package/CodeBlockCommand.js +10 -10
- package/CodeBlockCommand.js.flow +1 -1
- package/ContentPlaceholderPlugin.js +17 -17
- package/ContentPlaceholderPlugin.js.flow +10 -12
- package/CursorPlaceholderPlugin.js +8 -8
- package/DocLayoutCommand.js +10 -12
- package/DocLayoutCommand.js.flow +1 -3
- package/EditorKeyMap.js +0 -1
- package/EditorKeyMap.js.flow +0 -2
- package/EditorMarks.js +1 -1
- package/EditorNodes.js +1 -2
- package/EditorNodes.js.flow +0 -1
- package/EditorPageLayoutPlugin.js +8 -8
- package/FontTypeMarkSpec.js +1 -1
- package/FontTypeMarkSpec.js.flow +1 -1
- package/HTMLMutator.js +4 -4
- package/HeadingNodeSpec.js +2 -12
- package/HeadingNodeSpec.js.flow +4 -14
- package/HistoryRedoCommand.js +9 -9
- package/HistoryUndoCommand.js +9 -9
- package/HorizontalRuleCommand.js +9 -9
- package/ImageUploadPlaceholderPlugin.js +13 -15
- package/ImageUploadPlaceholderPlugin.js.flow +5 -7
- package/LinkMarkSpec.js +6 -1
- package/LinkMarkSpec.js.flow +5 -0
- package/LinkSetURLCommand.js +126 -55
- package/LinkSetURLCommand.js.flow +61 -37
- package/LinkTooltipPlugin.js +119 -30
- package/LinkTooltipPlugin.js.flow +91 -20
- package/ListItemInsertNewLineCommand.js +10 -11
- package/ListItemInsertNewLineCommand.js.flow +1 -2
- package/ListItemMergeCommand.js +16 -15
- package/ListItemMergeCommand.js.flow +3 -4
- package/ListSplitCommand.js +9 -9
- package/ListToggleCommand.js +9 -9
- package/MarksClearCommand.js +9 -9
- package/MathEditCommand.js +10 -11
- package/MathEditCommand.js.flow +1 -2
- package/OrderedListNodeSpec.js +1 -1
- package/ParagraphNodeSpec.js +11 -2
- package/ParagraphNodeSpec.js.flow +9 -2
- package/ParagraphSpacingCommand.js +13 -14
- package/ParagraphSpacingCommand.js.flow +4 -9
- package/PrintCommand.js +9 -9
- package/SelectionPlaceholderPlugin.js +8 -8
- package/SpacerMarkSpec.js +1 -1
- package/StyleView.js +3 -4
- package/StyleView.js.flow +0 -1
- package/TableBackgroundColorCommand.js +12 -14
- package/TableBackgroundColorCommand.js.flow +2 -5
- package/TableBorderColorCommand.js +12 -14
- package/TableBorderColorCommand.js.flow +2 -7
- package/TableCellColorCommand.js +10 -11
- package/TableCellColorCommand.js.flow +1 -2
- package/TableCellMenuPlugin.js +16 -15
- package/TableCellMenuPlugin.js.flow +5 -7
- package/TableInsertCommand.js +11 -13
- package/TableInsertCommand.js.flow +2 -4
- package/TableMergeCellsCommand.js +13 -12
- package/TableMergeCellsCommand.js.flow +4 -3
- package/TableNodesSpecs.js +4 -2
- package/TableNodesSpecs.js.flow +4 -2
- package/TableResizePlugin.js +17 -16
- package/TableResizePlugin.js.flow +1 -1
- package/TextInsertTabSpaceCommand.js +9 -9
- package/Types.js +1 -0
- package/Types.js.flow +2 -5
- package/WebFontLoader.js +4 -4
- package/bom.xml +17623 -24512
- package/buildEditorPlugins.js +4 -4
- package/buildInputRules.js +8 -4
- package/buildInputRules.js.flow +8 -4
- package/client/CollabConnector.js +9 -9
- package/client/EditorConnection.js +8 -6
- package/client/EditorConnection.js.flow +3 -2
- package/client/Licit.js +22 -58
- package/client/Licit.js.flow +12 -44
- package/client/Licit.test.js +49 -39
- package/client/Licit.test.js.flow +40 -34
- package/client/Reporter.js +3 -3
- package/client/SimpleConnector.js +4 -4
- package/client/http.js +0 -6
- package/client/http.js.flow +0 -8
- package/client/throttle.js +8 -2
- package/client/throttle.js.flow +2 -2
- package/convertFromDOMElement.js +2 -4
- package/convertFromDOMElement.js.flow +2 -5
- package/convertFromHTML.js +2 -3
- package/convertFromHTML.js.flow +2 -4
- package/convertFromJSON.js +1 -2
- package/convertFromJSON.js.flow +1 -2
- package/convertToCSSPTValue.js +6 -10
- package/convertToCSSPTValue.js.flow +8 -11
- package/createCommand.js +9 -9
- package/createEditorKeyMap.js +1 -1
- package/createEmptyEditorState.js +2 -3
- package/createEmptyEditorState.js.flow +2 -4
- package/createTableResizingPlugin.js +6 -6
- package/createTableResizingPlugin.js.flow +1 -1
- package/findActiveMark.js +1 -1
- package/findActiveMark.js.flow +1 -1
- package/insertTable.js +0 -3
- package/insertTable.js.flow +0 -2
- package/joinDown.js +1 -3
- package/joinDown.js.flow +1 -3
- package/joinUp.js +1 -3
- package/joinUp.js.flow +1 -3
- package/lookUpElement.js +2 -1
- package/lookUpElement.js.flow +1 -1
- package/normalizeHTML.js +3 -1
- package/normalizeHTML.js.flow +3 -1
- package/package.json +21 -16
- package/patchAnchorElements.js +1 -1
- package/patchAnchorElements.js.flow +1 -1
- package/patchBreakElements.js +3 -2
- package/patchBreakElements.js.flow +2 -2
- package/patchElementInlineStyles.js +1 -1
- package/patchElementInlineStyles.js.flow +1 -1
- package/patchListElements.js +4 -4
- package/patchListElements.js.flow +5 -5
- package/patchMathElements.js +5 -7
- package/patchMathElements.js.flow +2 -4
- package/patchStyleElements.js +1 -1
- package/patchStyleElements.js.flow +7 -6
- package/patchTableElements.js +2 -3
- package/patchTableElements.js.flow +2 -3
- package/sanitizeURL.js +1 -1
- package/sanitizeURL.js.flow +1 -1
- package/splitListItem.js +2 -2
- package/splitListItem.js.flow +1 -1
- package/toggleBlockquote.js +4 -5
- package/toggleBlockquote.js.flow +5 -12
- package/toggleCodeBlock.js +6 -6
- package/toggleCodeBlock.js.flow +10 -10
- package/ui/AlertInfo.js +9 -9
- package/ui/BookmarkNodeView.js +13 -12
- package/ui/CommandButton.js +9 -9
- package/ui/CommandMenu.js +12 -12
- package/ui/CommandMenu.js.flow +1 -1
- package/ui/CommandMenuButton.js +11 -12
- package/ui/CommandMenuButton.js.flow +2 -3
- package/ui/CustomEditorView.js +13 -12
- package/ui/CustomEditorView.js.flow +1 -0
- package/ui/CustomMenu.js +8 -8
- package/ui/CustomMenuItem.js +10 -10
- package/ui/CustomNodeView.js +27 -16
- package/ui/CustomNodeView.js.flow +16 -9
- package/ui/CustomRadioButton.js +13 -15
- package/ui/CustomRadioButton.js.flow +2 -3
- package/ui/DocLayoutEditor.js +10 -11
- package/ui/DocLayoutEditor.js.flow +1 -2
- package/ui/Editor.js +16 -13
- package/ui/Editor.js.flow +7 -8
- package/ui/EditorFrameset.js +9 -9
- package/ui/EditorToolbar.js +24 -29
- package/ui/EditorToolbar.js.flow +22 -41
- package/ui/EditorToolbarConfig.js +5 -5
- package/ui/EditorToolbarConfig.js.flow +1 -1
- package/ui/FontSizeCommandMenuButton.js +10 -10
- package/ui/FontSizeCommandMenuButton.js.flow +1 -1
- package/ui/FontTypeCommandMenuButton.js +11 -12
- package/ui/FontTypeCommandMenuButton.js.flow +4 -5
- package/ui/Frag.js +8 -8
- package/ui/Icon.js +12 -12
- package/ui/ImageInlineEditor.js +9 -9
- package/ui/LinkTooltip.js +62 -27
- package/ui/LinkTooltip.js.flow +55 -22
- package/ui/LinkURLEditor.js +152 -34
- package/ui/LinkURLEditor.js.flow +177 -51
- package/ui/ListItemNodeView.js +4 -4
- package/ui/ListTypeButton.js +11 -14
- package/ui/ListTypeButton.js.flow +2 -5
- package/ui/ListTypeCommandButton.js +10 -10
- package/ui/ListTypeCommandButton.js.flow +1 -1
- package/ui/ListTypeMenu.js +11 -11
- package/ui/ListTypeMenu.js.flow +1 -1
- package/ui/LoadingIndicator.js +8 -8
- package/ui/MathEditor.js +10 -14
- package/ui/MathEditor.js.flow +1 -7
- package/ui/MathInlineEditor.js +13 -13
- package/ui/MathInlineEditor.js.flow +3 -4
- package/ui/MathNodeView.js +16 -15
- package/ui/MathNodeView.js.flow +10 -20
- package/ui/PasteMenu.js +11 -14
- package/ui/PasteMenu.js.flow +0 -4
- package/ui/ResizeObserver.js +1 -1
- package/ui/ResizeObserver.js.flow +1 -1
- package/ui/RichTextEditor.js +9 -9
- package/ui/SelectionObserver.js +6 -6
- package/ui/SelectionObserver.js.flow +2 -2
- package/ui/TableCellMenu.js +9 -9
- package/ui/TableGridSizeEditor.js +11 -12
- package/ui/TableGridSizeEditor.js.flow +6 -3
- package/ui/TableNodeView.js +15 -13
- package/ui/TableNodeView.js.flow +3 -3
- package/ui/bindScrollHandler.js +2 -1
- package/ui/bindScrollHandler.js.flow +1 -1
- package/ui/canUseCSSFont.js +5 -4
- package/ui/canUseCSSFont.js.flow +4 -5
- package/ui/czi-editor.css +1 -4
- package/ui/czi-form.css +102 -8
- package/ui/czi-image-view.css +1 -5
- package/ui/czi-link-tooltip.css +41 -0
- package/ui/czi-list.css +0 -4
- package/ui/czi-loading-indicator.css +1 -46
- package/ui/czi-table-cell-menu.css +3 -1
- package/ui/findActiveFontSize.js +2 -1
- package/ui/findActiveFontSize.js.flow +1 -4
- package/ui/findActiveFontType.js +4 -3
- package/ui/findActiveFontType.js.flow +3 -6
- package/ui/handleEditorDrop.js +1 -1
- package/ui/handleEditorDrop.js.flow +1 -1
- package/ui/handleEditorKeyDown.js +1 -1
- package/ui/handleEditorKeyDown.js.flow +1 -1
- package/ui/handleEditorPaste.js +1 -1
- package/ui/handleEditorPaste.js.flow +1 -1
- package/ui/injectStyleSheet.js +2 -2
- package/ui/injectStyleSheet.js.flow +2 -4
- package/ui/isElementFullyVisible.js +1 -10
- package/ui/isElementFullyVisible.js.flow +1 -13
- package/ui/mathquill-editor/MathQuillEditor.js +12 -13
- package/ui/mathquill-editor/MathQuillEditor.js.flow +0 -1
- package/ui/mathquill-editor/MathQuillEditorSymbolsPanel.js +9 -9
- package/ui/mathquill-editor/mathquill-import-kludge.js +1 -8
- package/ui/mathquill-editor/mathquill-import-kludge.js.flow +0 -7
- package/ui/renderLaTeXAsHTML.js +3 -3
- package/ui/resolveImage.js +4 -5
- package/ui/resolveImage.js.flow +3 -5
- package/ui/toCSSLineSpacing.js +2 -3
- package/ui/toCSSLineSpacing.js.flow +2 -4
package/ui/CustomRadioButton.js
CHANGED
|
@@ -1,28 +1,26 @@
|
|
|
1
1
|
var _excluded = ["title", "className", "checked", "label", "inline", "name", "onSelect", "disabled"];
|
|
2
2
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
4
|
-
function _objectWithoutProperties(
|
|
5
|
-
function _objectWithoutPropertiesLoose(
|
|
6
|
-
function _classCallCheck(
|
|
7
|
-
function _defineProperties(
|
|
8
|
-
function _createClass(
|
|
3
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
4
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
5
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
|
|
6
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
7
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
8
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
9
9
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
10
|
-
function _possibleConstructorReturn(
|
|
11
|
-
function _assertThisInitialized(
|
|
10
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
11
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
12
12
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
13
|
-
function _getPrototypeOf(
|
|
14
|
-
function _inherits(
|
|
15
|
-
function _setPrototypeOf(
|
|
16
|
-
function _defineProperty(
|
|
13
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
14
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
15
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
16
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
17
17
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
18
18
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
19
19
|
import './czi-custom-radio-button.css';
|
|
20
|
-
import { PointerSurface } from '@modusoperandi/licit-ui-commands';
|
|
20
|
+
import { PointerSurface, preventEventDefault } from '@modusoperandi/licit-ui-commands';
|
|
21
21
|
import * as React from 'react';
|
|
22
22
|
import cx from 'classnames';
|
|
23
23
|
import uuid from './uuid.js';
|
|
24
|
-
import { preventEventDefault } from '@modusoperandi/licit-ui-commands';
|
|
25
|
-
;
|
|
26
24
|
var CustomRadioButton = /*#__PURE__*/function (_React$PureComponent) {
|
|
27
25
|
function CustomRadioButton() {
|
|
28
26
|
var _this;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
|
|
3
3
|
import './czi-custom-radio-button.css';
|
|
4
|
-
import { PointerSurface } from '@modusoperandi/licit-ui-commands';
|
|
4
|
+
import { PointerSurface, preventEventDefault } from '@modusoperandi/licit-ui-commands';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import cx from 'classnames';
|
|
7
7
|
import uuid from './uuid.js';
|
|
8
|
-
import { preventEventDefault } from '@modusoperandi/licit-ui-commands';
|
|
9
8
|
|
|
10
|
-
import type { PointerSurfaceProps } from '@modusoperandi/licit-ui-commands'
|
|
9
|
+
import type { PointerSurfaceProps } from '@modusoperandi/licit-ui-commands';
|
|
11
10
|
|
|
12
11
|
class CustomRadioButton extends React.PureComponent<any, any> {
|
|
13
12
|
props: PointerSurfaceProps & {
|
package/ui/DocLayoutEditor.js
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
function _classCallCheck(
|
|
3
|
-
function _defineProperties(
|
|
4
|
-
function _createClass(
|
|
2
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
3
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
4
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
5
5
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
6
|
-
function _possibleConstructorReturn(
|
|
7
|
-
function _assertThisInitialized(
|
|
6
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
7
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
8
8
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
9
|
-
function _getPrototypeOf(
|
|
10
|
-
function _inherits(
|
|
11
|
-
function _setPrototypeOf(
|
|
12
|
-
function _defineProperty(
|
|
9
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
10
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
11
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
12
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
13
13
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
14
14
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
15
|
import * as React from 'react';
|
|
16
16
|
import { LAYOUT } from '../DocNodeSpec.js';
|
|
17
|
-
import { CustomButton } from '@modusoperandi/licit-ui-commands';
|
|
17
|
+
import { CustomButton, preventEventDefault } from '@modusoperandi/licit-ui-commands';
|
|
18
18
|
import CustomRadioButton from './CustomRadioButton.js';
|
|
19
|
-
import { preventEventDefault } from '@modusoperandi/licit-ui-commands';
|
|
20
19
|
import './czi-body-layout-editor.css';
|
|
21
20
|
import './czi-form.css';
|
|
22
21
|
var bpfrpt_proptype_DocLayoutEditorValue = {
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { LAYOUT } from '../DocNodeSpec.js';
|
|
5
|
-
import { CustomButton } from '@modusoperandi/licit-ui-commands';
|
|
5
|
+
import { CustomButton, preventEventDefault } from '@modusoperandi/licit-ui-commands';
|
|
6
6
|
import CustomRadioButton from './CustomRadioButton.js';
|
|
7
|
-
import { preventEventDefault } from '@modusoperandi/licit-ui-commands';
|
|
8
7
|
|
|
9
8
|
import './czi-body-layout-editor.css';
|
|
10
9
|
import './czi-form.css';
|
package/ui/Editor.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
function
|
|
3
|
-
function
|
|
4
|
-
function
|
|
2
|
+
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; }
|
|
3
|
+
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) { _defineProperty(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; }
|
|
4
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
5
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
6
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
5
7
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
6
|
-
function _possibleConstructorReturn(
|
|
7
|
-
function _assertThisInitialized(
|
|
8
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
9
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
8
10
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
9
|
-
function _getPrototypeOf(
|
|
10
|
-
function _inherits(
|
|
11
|
-
function _setPrototypeOf(
|
|
12
|
-
function _defineProperty(
|
|
11
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
12
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
13
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
14
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
13
15
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
14
16
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
17
|
import cx from 'classnames';
|
|
@@ -78,7 +80,7 @@ var EDITOR_EMPTY_STATE = Object.freeze(createEmptyEditorState());
|
|
|
78
80
|
// developer to explicitly use `scrollIntoView(true)` to enforce page scroll.
|
|
79
81
|
var scrollIntoView = Transaction.prototype.scrollIntoView;
|
|
80
82
|
var scrollIntoViewPatched = function scrollIntoViewPatched(forced) {
|
|
81
|
-
if (forced
|
|
83
|
+
if (forced && scrollIntoView) {
|
|
82
84
|
return scrollIntoView.call(this);
|
|
83
85
|
} else {
|
|
84
86
|
return this;
|
|
@@ -181,7 +183,7 @@ var Editor = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
181
183
|
transformPastedHTML = _this$props3.transformPastedHTML;
|
|
182
184
|
var editorNode = document.getElementById(this._id);
|
|
183
185
|
if (editorNode) {
|
|
184
|
-
var effectiveNodeViews =
|
|
186
|
+
var effectiveNodeViews = _objectSpread(_objectSpread({}, DEFAULT_NODE_VIEWS), nodeViews);
|
|
185
187
|
var boundNodeViews = {};
|
|
186
188
|
var schema = getSchema(editorState);
|
|
187
189
|
var nodes = schema.nodes;
|
|
@@ -218,7 +220,7 @@ var Editor = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
218
220
|
}, {
|
|
219
221
|
key: "onEditorReady",
|
|
220
222
|
value: function onEditorReady(view, onReady) {
|
|
221
|
-
onReady
|
|
223
|
+
onReady === null || onReady === void 0 || onReady(view);
|
|
222
224
|
this._autoFocusTimer && clearTimeout(this._autoFocusTimer);
|
|
223
225
|
this._autoFocusTimer = this.props.autoFocus ? setTimeout(this.focus, AUTO_FOCUS_DELAY) : 0;
|
|
224
226
|
}
|
|
@@ -254,8 +256,9 @@ var Editor = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
254
256
|
}, {
|
|
255
257
|
key: "componentWillUnmount",
|
|
256
258
|
value: function componentWillUnmount() {
|
|
259
|
+
var _this$_editorView;
|
|
257
260
|
this._autoFocusTimer && clearTimeout(this._autoFocusTimer);
|
|
258
|
-
|
|
261
|
+
(_this$_editorView = this._editorView) === null || _this$_editorView === void 0 || _this$_editorView.destroy();
|
|
259
262
|
this._editorView = null;
|
|
260
263
|
releaseEditorView(this._id);
|
|
261
264
|
window.removeEventListener('beforeprint', this._onPrintStart, false);
|
package/ui/Editor.js.flow
CHANGED
|
@@ -76,7 +76,7 @@ const EDITOR_EMPTY_STATE = Object.freeze(createEmptyEditorState());
|
|
|
76
76
|
// developer to explicitly use `scrollIntoView(true)` to enforce page scroll.
|
|
77
77
|
const scrollIntoView = Transaction.prototype.scrollIntoView;
|
|
78
78
|
const scrollIntoViewPatched = function (forced: boolean): Transaction {
|
|
79
|
-
if (forced
|
|
79
|
+
if (forced && scrollIntoView) {
|
|
80
80
|
return scrollIntoView.call(this);
|
|
81
81
|
} else {
|
|
82
82
|
return this;
|
|
@@ -137,11 +137,10 @@ class Editor extends React.PureComponent<any, any> {
|
|
|
137
137
|
|
|
138
138
|
const editorNode = document.getElementById(this._id);
|
|
139
139
|
if (editorNode) {
|
|
140
|
-
const effectiveNodeViews =
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
);
|
|
140
|
+
const effectiveNodeViews = {
|
|
141
|
+
...DEFAULT_NODE_VIEWS,
|
|
142
|
+
...nodeViews
|
|
143
|
+
};
|
|
145
144
|
const boundNodeViews = {};
|
|
146
145
|
const schema = getSchema(editorState);
|
|
147
146
|
const { nodes } = schema;
|
|
@@ -180,7 +179,7 @@ class Editor extends React.PureComponent<any, any> {
|
|
|
180
179
|
}
|
|
181
180
|
|
|
182
181
|
onEditorReady(view: EditorView, onReady: Function) {
|
|
183
|
-
onReady
|
|
182
|
+
onReady?.(view);
|
|
184
183
|
this._autoFocusTimer && clearTimeout(this._autoFocusTimer);
|
|
185
184
|
this._autoFocusTimer = this.props.autoFocus
|
|
186
185
|
? setTimeout(this.focus, AUTO_FOCUS_DELAY)
|
|
@@ -223,7 +222,7 @@ class Editor extends React.PureComponent<any, any> {
|
|
|
223
222
|
|
|
224
223
|
componentWillUnmount(): void {
|
|
225
224
|
this._autoFocusTimer && clearTimeout(this._autoFocusTimer);
|
|
226
|
-
this._editorView
|
|
225
|
+
this._editorView?.destroy();
|
|
227
226
|
this._editorView = null;
|
|
228
227
|
releaseEditorView(this._id);
|
|
229
228
|
window.removeEventListener('beforeprint', this._onPrintStart, false);
|
package/ui/EditorFrameset.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
function _classCallCheck(
|
|
3
|
-
function _defineProperties(
|
|
4
|
-
function _createClass(
|
|
2
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
3
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
4
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
5
5
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
6
|
-
function _possibleConstructorReturn(
|
|
7
|
-
function _assertThisInitialized(
|
|
6
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
7
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
8
8
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
9
|
-
function _getPrototypeOf(
|
|
10
|
-
function _inherits(
|
|
11
|
-
function _setPrototypeOf(
|
|
12
|
-
function _defineProperty(
|
|
9
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
10
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
11
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
12
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
13
13
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
14
14
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
15
|
import cx from 'classnames';
|
package/ui/EditorToolbar.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
function _classCallCheck(
|
|
3
|
-
function _defineProperties(
|
|
4
|
-
function _createClass(
|
|
2
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
3
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
4
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
5
5
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
6
|
-
function _possibleConstructorReturn(
|
|
7
|
-
function _assertThisInitialized(
|
|
6
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
7
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
8
8
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
9
|
-
function _getPrototypeOf(
|
|
10
|
-
function _inherits(
|
|
11
|
-
function _setPrototypeOf(
|
|
12
|
-
function _defineProperty(
|
|
9
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
10
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
11
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
12
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
13
13
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
14
14
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
15
|
import cx from 'classnames';
|
|
@@ -17,7 +17,6 @@ import { EditorState } from 'prosemirror-state';
|
|
|
17
17
|
import { Transform } from 'prosemirror-transform';
|
|
18
18
|
import { EditorView } from 'prosemirror-view';
|
|
19
19
|
import * as React from 'react';
|
|
20
|
-
import ReactDOM from 'react-dom';
|
|
21
20
|
import CommandButton from './CommandButton.js';
|
|
22
21
|
import CommandMenuButton from './CommandMenuButton.js';
|
|
23
22
|
import { CustomButton } from '@modusoperandi/licit-ui-commands';
|
|
@@ -116,29 +115,24 @@ var EditorToolbar = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
116
115
|
if (ref) {
|
|
117
116
|
_this._body = ref;
|
|
118
117
|
// Mounting
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
} else {
|
|
124
|
-
// Unmounting.
|
|
125
|
-
var _el = _this._body && ReactDOM.findDOMNode(_this._body);
|
|
126
|
-
if (_el instanceof HTMLElement) {
|
|
127
|
-
ResizeObserver.unobserve(_el);
|
|
128
|
-
}
|
|
118
|
+
ResizeObserver.observe(ref, _this._checkIfContentIsWrapped);
|
|
119
|
+
} else if (_this._body) {
|
|
120
|
+
// Unmounting
|
|
121
|
+
ResizeObserver.unobserve(_this._body);
|
|
129
122
|
_this._body = null;
|
|
130
123
|
}
|
|
131
124
|
});
|
|
132
125
|
_defineProperty(_this, "_checkIfContentIsWrapped", function () {
|
|
133
126
|
var ref = _this._body;
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
127
|
+
if (ref) {
|
|
128
|
+
var startAnchor = ref.firstChild;
|
|
129
|
+
var endAnchor = ref.lastChild;
|
|
130
|
+
if (startAnchor && endAnchor) {
|
|
131
|
+
var wrapped = startAnchor.offsetTop < endAnchor.offsetTop;
|
|
132
|
+
_this.setState({
|
|
133
|
+
wrapped: wrapped
|
|
134
|
+
});
|
|
135
|
+
}
|
|
142
136
|
}
|
|
143
137
|
});
|
|
144
138
|
_defineProperty(_this, "_toggleExpansion", function (expanded) {
|
|
@@ -177,7 +171,8 @@ var EditorToolbar = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
177
171
|
// but changing it now would mean finding every plugin that was
|
|
178
172
|
// implemented this way.
|
|
179
173
|
).map(function (p) {
|
|
180
|
-
|
|
174
|
+
var _p$initButtonCommands;
|
|
175
|
+
return (_p$initButtonCommands = p.initButtonCommands) === null || _p$initButtonCommands === void 0 ? void 0 : _p$initButtonCommands.call(p);
|
|
181
176
|
}).filter(Boolean)).map(this._renderButtonsGroup).filter(Boolean);
|
|
182
177
|
return /*#__PURE__*/React.createElement("div", {
|
|
183
178
|
className: className
|
package/ui/EditorToolbar.js.flow
CHANGED
|
@@ -5,22 +5,14 @@ import { EditorState } from 'prosemirror-state';
|
|
|
5
5
|
import { Transform } from 'prosemirror-transform';
|
|
6
6
|
import { EditorView } from 'prosemirror-view';
|
|
7
7
|
import * as React from 'react';
|
|
8
|
-
import ReactDOM from 'react-dom';
|
|
9
8
|
|
|
10
9
|
import CommandButton from './CommandButton.js';
|
|
11
10
|
import CommandMenuButton from './CommandMenuButton.js';
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
} from '@modusoperandi/licit-ui-commands';
|
|
15
|
-
import {
|
|
16
|
-
COMMAND_GROUPS,
|
|
17
|
-
parseLabel
|
|
18
|
-
} from './EditorToolbarConfig.js';
|
|
11
|
+
import { CustomButton } from '@modusoperandi/licit-ui-commands';
|
|
12
|
+
import { COMMAND_GROUPS, parseLabel } from './EditorToolbarConfig.js';
|
|
19
13
|
import Icon from './Icon.js';
|
|
20
14
|
import ResizeObserver from './ResizeObserver.js';
|
|
21
|
-
import {
|
|
22
|
-
UICommand
|
|
23
|
-
} from '@modusoperandi/licit-doc-attrs-step';
|
|
15
|
+
import { UICommand } from '@modusoperandi/licit-doc-attrs-step';
|
|
24
16
|
import isReactClass from './isReactClass.js';
|
|
25
17
|
|
|
26
18
|
import './czi-editor-toolbar.css';
|
|
@@ -65,7 +57,7 @@ class EditorToolbar extends React.PureComponent<any, any> {
|
|
|
65
57
|
// p => p.buttonGroup
|
|
66
58
|
// but changing it now would mean finding every plugin that was
|
|
67
59
|
// implemented this way.
|
|
68
|
-
.map((p) => p.initButtonCommands
|
|
60
|
+
.map((p) => p.initButtonCommands?.())
|
|
69
61
|
.filter(Boolean)
|
|
70
62
|
)
|
|
71
63
|
.map(this._renderButtonsGroup)
|
|
@@ -135,12 +127,8 @@ class EditorToolbar extends React.PureComponent<any, any> {
|
|
|
135
127
|
label: string,
|
|
136
128
|
commandGroups: Array<{ [string]: UICommand }>
|
|
137
129
|
): React.Element<any> => {
|
|
138
|
-
const {
|
|
139
|
-
|
|
140
|
-
editorView,
|
|
141
|
-
disabled,
|
|
142
|
-
dispatchTransaction,
|
|
143
|
-
} = this.props;
|
|
130
|
+
const { editorState, editorView, disabled, dispatchTransaction } =
|
|
131
|
+
this.props;
|
|
144
132
|
const { icon, title } = parseLabel(label);
|
|
145
133
|
return (
|
|
146
134
|
<CommandMenuButton
|
|
@@ -158,12 +146,8 @@ class EditorToolbar extends React.PureComponent<any, any> {
|
|
|
158
146
|
};
|
|
159
147
|
|
|
160
148
|
_renderButton = (label: string, command: UICommand): React.Element<any> => {
|
|
161
|
-
const {
|
|
162
|
-
|
|
163
|
-
editorState,
|
|
164
|
-
editorView,
|
|
165
|
-
dispatchTransaction,
|
|
166
|
-
} = this.props;
|
|
149
|
+
const { disabled, editorState, editorView, dispatchTransaction } =
|
|
150
|
+
this.props;
|
|
167
151
|
const { icon, title } = parseLabel(label);
|
|
168
152
|
|
|
169
153
|
return (
|
|
@@ -181,32 +165,29 @@ class EditorToolbar extends React.PureComponent<any, any> {
|
|
|
181
165
|
);
|
|
182
166
|
};
|
|
183
167
|
|
|
184
|
-
_onBodyRef = (ref:
|
|
168
|
+
_onBodyRef = (ref: HTMLElement): void => {
|
|
185
169
|
if (ref) {
|
|
186
170
|
this._body = ref;
|
|
187
171
|
// Mounting
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
} else {
|
|
193
|
-
// Unmounting.
|
|
194
|
-
const el = this._body && ReactDOM.findDOMNode(this._body);
|
|
195
|
-
if (el instanceof HTMLElement) {
|
|
196
|
-
ResizeObserver.unobserve(el);
|
|
197
|
-
}
|
|
172
|
+
ResizeObserver.observe(ref, this._checkIfContentIsWrapped);
|
|
173
|
+
} else if (this._body) {
|
|
174
|
+
// Unmounting
|
|
175
|
+
ResizeObserver.unobserve(this._body);
|
|
198
176
|
this._body = null;
|
|
199
177
|
}
|
|
200
178
|
};
|
|
201
179
|
|
|
202
180
|
_checkIfContentIsWrapped = (): void => {
|
|
203
181
|
const ref = this._body;
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
182
|
+
|
|
183
|
+
if (ref) {
|
|
184
|
+
const startAnchor = ref.firstChild;
|
|
185
|
+
const endAnchor = ref.lastChild;
|
|
186
|
+
|
|
187
|
+
if (startAnchor && endAnchor) {
|
|
188
|
+
const wrapped = startAnchor.offsetTop < endAnchor.offsetTop;
|
|
189
|
+
this.setState({ wrapped });
|
|
190
|
+
}
|
|
210
191
|
}
|
|
211
192
|
};
|
|
212
193
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
function _slicedToArray(
|
|
1
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
2
2
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
-
function _unsupportedIterableToArray(
|
|
4
|
-
function _arrayLikeToArray(
|
|
3
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
4
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
5
5
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
-
function _arrayWithHoles(
|
|
6
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
7
7
|
// eslint-disable-next-line no-unused-vars
|
|
8
8
|
import * as React from 'react';
|
|
9
9
|
import * as EditorCommands from '../EditorCommands.js';
|
|
@@ -13,7 +13,7 @@ import ListTypeCommandButton from './ListTypeCommandButton.js';
|
|
|
13
13
|
import Icon from './Icon.js';
|
|
14
14
|
var ICON_LABEL_PATTERN = /\[([A-Za-z_\d]+)\](.*)/;
|
|
15
15
|
export function parseLabel(input) {
|
|
16
|
-
var matched =
|
|
16
|
+
var matched = ICON_LABEL_PATTERN.exec(input);
|
|
17
17
|
if (matched) {
|
|
18
18
|
var _matched = _slicedToArray(matched, 3),
|
|
19
19
|
// eslint-disable-next-line no-unused-vars
|
|
@@ -12,7 +12,7 @@ import Icon from './Icon.js';
|
|
|
12
12
|
const ICON_LABEL_PATTERN = /\[([A-Za-z_\d]+)\](.*)/;
|
|
13
13
|
|
|
14
14
|
export function parseLabel(input: string): Object {
|
|
15
|
-
const matched =
|
|
15
|
+
const matched = ICON_LABEL_PATTERN.exec(input);
|
|
16
16
|
if (matched) {
|
|
17
17
|
const [
|
|
18
18
|
// eslint-disable-next-line no-unused-vars
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
function _classCallCheck(
|
|
3
|
-
function _defineProperties(
|
|
4
|
-
function _createClass(
|
|
2
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
3
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
4
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
5
5
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
6
|
-
function _possibleConstructorReturn(
|
|
7
|
-
function _assertThisInitialized(
|
|
6
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
7
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
8
8
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
9
|
-
function _getPrototypeOf(
|
|
10
|
-
function _inherits(
|
|
11
|
-
function _setPrototypeOf(
|
|
12
|
-
function _defineProperty(
|
|
9
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
10
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
11
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
12
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
13
13
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
14
14
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
15
|
import { EditorState } from 'prosemirror-state';
|
|
@@ -54,7 +54,7 @@ var FontSizeCommandMenuButton = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
54
54
|
// Disable font size menu on editor disable state
|
|
55
55
|
,
|
|
56
56
|
commandGroups: COMMAND_GROUPS,
|
|
57
|
-
disabled: editorView
|
|
57
|
+
disabled: editorView === null || editorView === void 0 ? void 0 : editorView.disabled,
|
|
58
58
|
dispatch: dispatch,
|
|
59
59
|
editorState: editorState,
|
|
60
60
|
editorView: editorView,
|
|
@@ -53,7 +53,7 @@ class FontSizeCommandMenuButton extends React.PureComponent<any, any> {
|
|
|
53
53
|
// [FS] IRAD-1008 2020-07-16
|
|
54
54
|
// Disable font size menu on editor disable state
|
|
55
55
|
commandGroups={COMMAND_GROUPS}
|
|
56
|
-
disabled={editorView
|
|
56
|
+
disabled={editorView?.disabled}
|
|
57
57
|
dispatch={dispatch}
|
|
58
58
|
editorState={editorState}
|
|
59
59
|
editorView={editorView}
|