@modusoperandi/licit 0.13.25 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +1 -1
- package/README.md +1 -0
- package/dist/BlockquoteInsertNewLineCommand.js +3 -23
- package/dist/BlockquoteNodeSpec.js +3 -13
- package/dist/BlockquoteToggleCommand.js +3 -16
- package/dist/BookmarkNodeSpec.js +0 -6
- package/dist/BulletListNodeSpec.js +2 -16
- package/dist/CZIProseMirror.js +3 -27
- package/dist/CodeBlockCommand.js +3 -19
- package/dist/CodeBlockNodeSpec.js +3 -4
- package/dist/CodeMarkSpec.js +0 -4
- package/dist/ContentPlaceholderPlugin.js +6 -58
- package/dist/CursorPlaceholderPlugin.js +2 -32
- package/dist/DocLayoutCommand.js +5 -28
- package/dist/DocNodeSpec.js +0 -9
- package/dist/EMMarkSpec.js +0 -4
- package/dist/EditorCommands.js +5 -33
- package/dist/EditorKeyMap.js +4 -18
- package/dist/EditorMarks.js +2 -26
- package/dist/EditorNodes.js +4 -22
- package/dist/EditorPageLayoutPlugin.js +3 -15
- package/dist/EditorPlugins.js +0 -4
- package/dist/EditorSchema.js +0 -5
- package/dist/EditorState.js +0 -2
- package/dist/FontSizeMarkSpec.js +0 -12
- package/dist/FontTypeMarkSpec.js +15 -19
- package/dist/HTMLMutator.js +5 -24
- package/dist/HardBreakNodeSpec.js +0 -2
- package/dist/HeadingNodeSpec.js +6 -15
- package/dist/HistoryRedoCommand.js +3 -11
- package/dist/HistoryUndoCommand.js +3 -11
- package/dist/HorizontalRuleCommand.js +3 -22
- package/dist/HorizontalRuleNodeSpec.js +0 -10
- package/dist/ImageFromURLCommand.js +0 -9
- package/dist/ImageNodeSpec.js +2 -14
- package/dist/ImageSourceCommand.js +3 -39
- package/dist/ImageUploadCommand.js +3 -21
- package/dist/ImageUploadPlaceholderPlugin.js +10 -48
- package/dist/LinkMarkSpec.js +0 -4
- package/dist/LinkSetURLCommand.js +3 -28
- package/dist/LinkTooltipPlugin.js +6 -52
- package/dist/ListItemInsertNewLineCommand.js +3 -23
- package/dist/ListItemMergeCommand.js +15 -66
- package/dist/ListItemNodeSpec.js +0 -11
- package/dist/ListSplitCommand.js +3 -14
- package/dist/ListToggleCommand.js +5 -26
- package/dist/MarksClearCommand.js +6 -17
- package/dist/MathEditCommand.js +3 -38
- package/dist/MathNodeSpec.js +0 -10
- package/dist/OrderedListNodeSpec.js +0 -24
- package/dist/ParagraphNodeSpec.js +5 -26
- package/dist/ParagraphSpacingCommand.js +3 -32
- package/dist/PrintCommand.js +3 -13
- package/dist/SelectionPlaceholderPlugin.js +2 -31
- package/dist/SpacerMarkSpec.js +2 -6
- package/dist/StrikeMarkSpec.js +0 -4
- package/dist/StrongMarkSpec.js +2 -5
- package/dist/StyleView.js +1 -7
- package/dist/TableBackgroundColorCommand.js +3 -24
- package/dist/TableBorderColorCommand.js +3 -24
- package/dist/TableCellColorCommand.js +3 -23
- package/dist/TableCellMenuPlugin.js +9 -45
- package/dist/TableInsertCommand.js +7 -39
- package/dist/TableMergeCellsCommand.js +5 -30
- package/dist/TableNodesSpecs.js +4 -23
- package/dist/TablePlugins.js +0 -5
- package/dist/TableResizePlugin.js +54 -138
- package/dist/TextColorMarkSpec.js +0 -9
- package/dist/TextHighlightMarkSpec.js +0 -8
- package/dist/TextInsertTabSpaceCommand.js +3 -28
- package/dist/TextNoWrapMarkSpec.js +0 -4
- package/dist/TextSelectionMarkSpec.js +0 -5
- package/dist/TextSubMarkSpec.js +0 -4
- package/dist/TextSuperMarkSpec.js +0 -4
- package/dist/TextUnderlineMarkSpec.js +0 -4
- package/dist/Types.js +0 -6
- package/dist/WebFontLoader.js +3 -8
- package/dist/blockQuoteInputRule.js +0 -13
- package/dist/bom.xml +1492 -1645
- package/dist/buildEditorPlugins.js +5 -27
- package/dist/buildInputRules.js +12 -24
- package/dist/client/CollabConnector.js +6 -30
- package/dist/client/EditorConnection.js +23 -69
- package/dist/client/Licit.js +79 -163
- package/dist/client/Licit.js.flow +16 -2
- package/dist/client/Licit.test.js +6 -13
- package/dist/client/Reporter.js +1 -8
- package/dist/client/SimpleConnector.js +6 -26
- package/dist/client/http.js +8 -15
- package/dist/client/throttle.js +0 -2
- package/dist/convertFromDOMElement.js +2 -10
- package/dist/convertFromHTML.js +0 -5
- package/dist/convertFromJSON.js +3 -13
- package/dist/convertToCSSPTValue.js +0 -6
- package/dist/convertToJSON.js +0 -2
- package/dist/createCommand.js +3 -11
- package/dist/createEditorKeyMap.js +0 -13
- package/dist/createEmptyEditorState.js +0 -7
- package/dist/createTableResizingPlugin.js +5 -16
- package/dist/findActionableCell.js +0 -19
- package/dist/findActiveMark.js +0 -11
- package/dist/hyphenize.js +2 -4
- package/dist/index.js +0 -9
- package/dist/insertTable.js +0 -16
- package/dist/isEditorStateEmpty.js +0 -6
- package/dist/isTableNode.js +0 -3
- package/dist/joinDown.js +0 -7
- package/dist/joinListNode.js +0 -15
- package/dist/joinUp.js +0 -9
- package/dist/keymaps.js +0 -15
- package/dist/lookUpElement.js +0 -3
- package/dist/nodeAt.js +0 -3
- package/dist/normalizeHTML.js +9 -25
- package/dist/patchAnchorElements.js +5 -12
- package/dist/patchBreakElements.js +0 -6
- package/dist/patchElementInlineStyles.js +5 -15
- package/dist/patchListElements.js +20 -54
- package/dist/patchMathElements.js +11 -21
- package/dist/patchParagraphElements.js +0 -5
- package/dist/patchStyleElements.js +12 -41
- package/dist/patchTableElements.js +9 -37
- package/dist/rebaseDocWithSteps.js +0 -6
- package/dist/sanitizeURL.js +0 -3
- package/dist/splitListItem.js +12 -43
- package/dist/toClosestFontPtSize.js +1 -5
- package/dist/toSafeHTMLDocument.js +0 -1
- package/dist/toggleBlockquote.js +2 -19
- package/dist/toggleCodeBlock.js +2 -22
- package/dist/ui/AlertInfo.js +6 -22
- package/dist/ui/BookmarkNodeView.js +7 -28
- package/dist/ui/CommandButton.js +3 -19
- package/dist/ui/CommandMenu.js +3 -25
- package/dist/ui/CommandMenuButton.js +3 -36
- package/dist/ui/CustomEditorView.js +3 -16
- package/dist/ui/CustomMenu.js +0 -8
- package/dist/ui/CustomMenuItem.js +4 -18
- package/dist/ui/CustomNodeView.js +21 -67
- package/dist/ui/CustomRadioButton.js +14 -33
- package/dist/ui/DocLayoutEditor.js +5 -27
- package/dist/ui/Editor.js +18 -79
- package/dist/ui/EditorFrameset.js +3 -18
- package/dist/ui/EditorToolbar.js +10 -46
- package/dist/ui/EditorToolbarConfig.js +10 -20
- package/dist/ui/FontSizeCommandMenuButton.js +5 -19
- package/dist/ui/FontTypeCommandMenuButton.js +5 -22
- package/dist/ui/Frag.js +0 -7
- package/dist/ui/Icon.js +5 -25
- package/dist/ui/ImageAlignEditor.js +3 -16
- package/dist/ui/ImageInlineEditor.js +3 -16
- package/dist/ui/ImageNodeView.js +20 -109
- package/dist/ui/ImageResizeBox.js +3 -53
- package/dist/ui/ImageURLEditor.js +3 -28
- package/dist/ui/ImageUploadEditor.js +3 -35
- package/dist/ui/LinkTooltip.js +5 -25
- package/dist/ui/LinkURLEditor.js +3 -29
- package/dist/ui/ListItemNodeView.js +15 -30
- package/dist/ui/ListTypeButton.js +5 -37
- package/dist/ui/ListTypeCommandButton.js +3 -19
- package/dist/ui/ListTypeMenu.js +4 -25
- package/dist/ui/LoadingIndicator.js +0 -7
- package/dist/ui/MathEditor.js +3 -24
- package/dist/ui/MathInlineEditor.js +3 -26
- package/dist/ui/MathNodeView.js +9 -59
- package/dist/ui/PasteMenu.js +4 -20
- package/dist/ui/ResizeObserver.js +0 -18
- package/dist/ui/RichTextEditor.js +5 -27
- package/dist/ui/SelectionObserver.js +3 -29
- package/dist/ui/TableCellMenu.js +3 -18
- package/dist/ui/TableGridSizeEditor.js +5 -51
- package/dist/ui/TableNodeView.js +0 -11
- package/dist/ui/bindScrollHandler.js +2 -9
- package/dist/ui/canUseCSSFont.js +2 -8
- package/dist/ui/czi-icon.css +4 -4
- package/dist/ui/findActiveFontSize.js +2 -18
- package/dist/ui/findActiveFontType.js +0 -12
- package/dist/ui/handleEditorDrop.js +0 -9
- package/dist/ui/handleEditorKeyDown.js +0 -7
- package/dist/ui/handleEditorPaste.js +0 -9
- package/dist/ui/htmlElementToRect.js +0 -4
- package/dist/ui/injectStyleSheet.js +0 -10
- package/dist/ui/isElementFullyVisible.js +2 -8
- package/dist/ui/isOffline.js +0 -2
- package/dist/ui/isReactClass.js +0 -4
- package/dist/ui/mathquill-editor/MathQuillEditor.js +9 -44
- package/dist/ui/mathquill-editor/MathQuillEditorSymbols.js +1 -3
- package/dist/ui/mathquill-editor/MathQuillEditorSymbolsPanel.js +3 -16
- package/dist/ui/mathquill-editor/mathquill-import-kludge.js +5 -7
- package/dist/ui/renderLaTeXAsHTML.js +2 -13
- package/dist/ui/resolveImage.js +7 -32
- package/dist/ui/toCSSColor.js +0 -14
- package/dist/ui/toCSSLineSpacing.js +10 -11
- package/dist/ui/toHexColor.js +0 -8
- package/dist/ui/uuid.js +0 -2
- package/dist/uuid.js +0 -2
- package/package-lock.json.old +32889 -0
- package/package.json +45 -69
- package/src/client/Licit.js +16 -2
- package/src/ui/czi-icon.css +4 -4
- package/utils/build_web_server.js +1 -7
- package/webpack.config.js +3 -3
|
@@ -4,43 +4,28 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var React = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
9
|
var _licitUiCommands = require("@modusoperandi/licit-ui-commands");
|
|
13
|
-
|
|
14
10
|
var _resolveImage = _interopRequireDefault(require("./resolveImage"));
|
|
15
|
-
|
|
16
11
|
require("./czi-form.css");
|
|
17
|
-
|
|
18
12
|
require("./czi-image-url-editor.css");
|
|
19
|
-
|
|
20
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
-
|
|
22
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
|
-
|
|
24
15
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
|
-
|
|
26
16
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
27
|
-
|
|
28
17
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
29
|
-
|
|
30
|
-
function
|
|
31
|
-
|
|
18
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
19
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
20
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
32
21
|
class ImageURLEditor extends React.PureComponent {
|
|
33
22
|
constructor() {
|
|
34
23
|
super(...arguments);
|
|
35
|
-
|
|
36
24
|
_defineProperty(this, "_img", null);
|
|
37
|
-
|
|
38
25
|
_defineProperty(this, "_unmounted", false);
|
|
39
|
-
|
|
40
26
|
_defineProperty(this, "state", _objectSpread(_objectSpread({}, this.props.initialValue || {}), {}, {
|
|
41
27
|
validValue: null
|
|
42
28
|
}));
|
|
43
|
-
|
|
44
29
|
_defineProperty(this, "_onSrcChange", e => {
|
|
45
30
|
const src = e.target.value;
|
|
46
31
|
this.setState({
|
|
@@ -48,7 +33,6 @@ class ImageURLEditor extends React.PureComponent {
|
|
|
48
33
|
validValue: null
|
|
49
34
|
}, this._didSrcChange);
|
|
50
35
|
});
|
|
51
|
-
|
|
52
36
|
_defineProperty(this, "_didSrcChange", () => {
|
|
53
37
|
(0, _resolveImage.default)(this.state.src).then(result => {
|
|
54
38
|
if (this.state.src === result.src && !this._unmounted) {
|
|
@@ -59,11 +43,9 @@ class ImageURLEditor extends React.PureComponent {
|
|
|
59
43
|
}
|
|
60
44
|
});
|
|
61
45
|
});
|
|
62
|
-
|
|
63
46
|
_defineProperty(this, "_cancel", () => {
|
|
64
47
|
this.props.close();
|
|
65
48
|
});
|
|
66
|
-
|
|
67
49
|
_defineProperty(this, "_insert", () => {
|
|
68
50
|
const {
|
|
69
51
|
validValue
|
|
@@ -71,11 +53,9 @@ class ImageURLEditor extends React.PureComponent {
|
|
|
71
53
|
this.props.close(validValue);
|
|
72
54
|
});
|
|
73
55
|
}
|
|
74
|
-
|
|
75
56
|
componentWillUnmount() {
|
|
76
57
|
this._unmounted = true;
|
|
77
58
|
}
|
|
78
|
-
|
|
79
59
|
render() {
|
|
80
60
|
const {
|
|
81
61
|
src,
|
|
@@ -113,21 +93,16 @@ class ImageURLEditor extends React.PureComponent {
|
|
|
113
93
|
onClick: this._insert
|
|
114
94
|
}))));
|
|
115
95
|
}
|
|
116
|
-
|
|
117
96
|
}
|
|
118
|
-
|
|
119
97
|
_defineProperty(ImageURLEditor, "propsTypes", {
|
|
120
98
|
initialValue: _propTypes.default.object,
|
|
121
99
|
close: function (props, propName) {
|
|
122
100
|
const fn = props[propName];
|
|
123
|
-
|
|
124
101
|
if (!fn.prototype || typeof fn.prototype.constructor !== 'function' && fn.prototype.constructor.length !== 1) {
|
|
125
102
|
return new Error(propName + 'must be a function with 1 arg of type ImageLike');
|
|
126
103
|
}
|
|
127
|
-
|
|
128
104
|
return null;
|
|
129
105
|
}
|
|
130
106
|
});
|
|
131
|
-
|
|
132
107
|
var _default = ImageURLEditor;
|
|
133
108
|
exports.default = _default;
|
|
@@ -4,75 +4,53 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
|
-
|
|
10
8
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var _licitUiCommands = require("@modusoperandi/licit-ui-commands");
|
|
13
|
-
|
|
14
10
|
var _LoadingIndicator = _interopRequireDefault(require("./LoadingIndicator"));
|
|
15
|
-
|
|
16
11
|
var _uuid = _interopRequireDefault(require("./uuid"));
|
|
17
|
-
|
|
18
12
|
require("./czi-form.css");
|
|
19
|
-
|
|
20
13
|
require("./czi-image-upload-editor.css");
|
|
21
|
-
|
|
22
14
|
var _Types = require("../Types");
|
|
23
|
-
|
|
24
15
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
25
|
-
|
|
26
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
|
-
|
|
28
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
|
-
|
|
30
|
-
function
|
|
31
|
-
|
|
18
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
19
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
20
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
32
21
|
class ImageUploadEditor extends React.PureComponent {
|
|
33
22
|
constructor() {
|
|
34
23
|
super(...arguments);
|
|
35
|
-
|
|
36
24
|
_defineProperty(this, "_img", null);
|
|
37
|
-
|
|
38
25
|
_defineProperty(this, "_unmounted", false);
|
|
39
|
-
|
|
40
26
|
_defineProperty(this, "props", void 0);
|
|
41
|
-
|
|
42
27
|
_defineProperty(this, "state", {
|
|
43
28
|
error: null,
|
|
44
29
|
id: (0, _uuid.default)(),
|
|
45
30
|
pending: false
|
|
46
31
|
});
|
|
47
|
-
|
|
48
32
|
_defineProperty(this, "_onSelectFile", event => {
|
|
49
33
|
const file = event.target.files && event.target.files[0];
|
|
50
|
-
|
|
51
34
|
if (file && typeof file === 'object') {
|
|
52
35
|
this._upload(file);
|
|
53
36
|
}
|
|
54
37
|
});
|
|
55
|
-
|
|
56
38
|
_defineProperty(this, "_onSuccess", image => {
|
|
57
39
|
if (this._unmounted) {
|
|
58
40
|
return;
|
|
59
41
|
}
|
|
60
|
-
|
|
61
42
|
this.props.close(image);
|
|
62
43
|
});
|
|
63
|
-
|
|
64
44
|
_defineProperty(this, "_onError", error => {
|
|
65
45
|
if (this._unmounted) {
|
|
66
46
|
return;
|
|
67
47
|
}
|
|
68
|
-
|
|
69
48
|
this.setState({
|
|
70
49
|
error,
|
|
71
50
|
id: (0, _uuid.default)(),
|
|
72
51
|
pending: false
|
|
73
52
|
});
|
|
74
53
|
});
|
|
75
|
-
|
|
76
54
|
_defineProperty(this, "_upload", async file => {
|
|
77
55
|
try {
|
|
78
56
|
const runtime = this.props.runtime || {};
|
|
@@ -80,32 +58,26 @@ class ImageUploadEditor extends React.PureComponent {
|
|
|
80
58
|
canUploadImage,
|
|
81
59
|
uploadImage
|
|
82
60
|
} = runtime;
|
|
83
|
-
|
|
84
61
|
if (!canUploadImage || !uploadImage || !canUploadImage()) {
|
|
85
62
|
throw new Error('feature is not available');
|
|
86
63
|
}
|
|
87
|
-
|
|
88
64
|
this.setState({
|
|
89
65
|
pending: true,
|
|
90
66
|
error: null
|
|
91
67
|
});
|
|
92
68
|
const image = await uploadImage(file);
|
|
93
|
-
|
|
94
69
|
this._onSuccess(image);
|
|
95
70
|
} catch (ex) {
|
|
96
71
|
this._onError(ex);
|
|
97
72
|
}
|
|
98
73
|
});
|
|
99
|
-
|
|
100
74
|
_defineProperty(this, "_cancel", () => {
|
|
101
75
|
this.props.close();
|
|
102
76
|
});
|
|
103
77
|
}
|
|
104
|
-
|
|
105
78
|
componentWillUnmount() {
|
|
106
79
|
this._unmounted = true;
|
|
107
80
|
}
|
|
108
|
-
|
|
109
81
|
render() {
|
|
110
82
|
const {
|
|
111
83
|
id,
|
|
@@ -117,13 +89,11 @@ class ImageUploadEditor extends React.PureComponent {
|
|
|
117
89
|
error
|
|
118
90
|
});
|
|
119
91
|
let label = 'Choose an image file...';
|
|
120
|
-
|
|
121
92
|
if (pending) {
|
|
122
93
|
label = /*#__PURE__*/React.createElement(_LoadingIndicator.default, null);
|
|
123
94
|
} else if (error) {
|
|
124
95
|
label = 'Something went wrong, please try again';
|
|
125
96
|
}
|
|
126
|
-
|
|
127
97
|
return /*#__PURE__*/React.createElement("div", {
|
|
128
98
|
className: className
|
|
129
99
|
}, /*#__PURE__*/React.createElement("form", {
|
|
@@ -148,8 +118,6 @@ class ImageUploadEditor extends React.PureComponent {
|
|
|
148
118
|
onClick: this._cancel
|
|
149
119
|
}))));
|
|
150
120
|
}
|
|
151
|
-
|
|
152
121
|
}
|
|
153
|
-
|
|
154
122
|
var _default = ImageUploadEditor;
|
|
155
123
|
exports.default = _default;
|
package/dist/ui/LinkTooltip.js
CHANGED
|
@@ -4,55 +4,39 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _prosemirrorView = require("prosemirror-view");
|
|
9
|
-
|
|
10
8
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var _smoothScrollIntoViewIfNeeded = _interopRequireDefault(require("smooth-scroll-into-view-if-needed"));
|
|
13
|
-
|
|
14
10
|
var _sanitizeURL = _interopRequireDefault(require("../sanitizeURL"));
|
|
15
|
-
|
|
16
11
|
var _licitUiCommands = require("@modusoperandi/licit-ui-commands");
|
|
17
|
-
|
|
18
12
|
require("./czi-link-tooltip.css");
|
|
19
|
-
|
|
20
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
-
|
|
22
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
|
-
|
|
24
15
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
|
-
|
|
26
|
-
function
|
|
27
|
-
|
|
16
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
17
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
18
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
28
19
|
function isBookMarkHref(href) {
|
|
29
20
|
return !!href && href.indexOf('#') === 0 && href.length >= 2;
|
|
30
21
|
}
|
|
31
|
-
|
|
32
22
|
class LinkTooltip extends React.PureComponent {
|
|
33
23
|
constructor() {
|
|
34
24
|
super(...arguments);
|
|
35
|
-
|
|
36
25
|
_defineProperty(this, "props", void 0);
|
|
37
|
-
|
|
38
26
|
_defineProperty(this, "_unmounted", false);
|
|
39
|
-
|
|
40
27
|
_defineProperty(this, "state", {
|
|
41
28
|
hidden: false
|
|
42
29
|
});
|
|
43
|
-
|
|
44
30
|
_defineProperty(this, "_openLink", href => {
|
|
45
31
|
if (isBookMarkHref(href)) {
|
|
46
32
|
const id = href.substr(1);
|
|
47
33
|
const el = document.getElementById(id);
|
|
48
|
-
|
|
49
34
|
if (el) {
|
|
50
35
|
const {
|
|
51
36
|
onCancel,
|
|
52
37
|
editorView
|
|
53
38
|
} = this.props;
|
|
54
39
|
onCancel(editorView);
|
|
55
|
-
|
|
56
40
|
(async () => {
|
|
57
41
|
// https://www.npmjs.com/package/smooth-scroll-into-view-if-needed
|
|
58
42
|
await (0, _smoothScrollIntoViewIfNeeded.default)(el, {
|
|
@@ -63,23 +47,21 @@ class LinkTooltip extends React.PureComponent {
|
|
|
63
47
|
});
|
|
64
48
|
})();
|
|
65
49
|
}
|
|
66
|
-
|
|
67
50
|
return;
|
|
68
51
|
}
|
|
69
|
-
|
|
70
52
|
if (href) {
|
|
71
53
|
window.open((0, _sanitizeURL.default)(href));
|
|
72
54
|
}
|
|
73
55
|
});
|
|
74
56
|
}
|
|
75
|
-
|
|
76
57
|
render() {
|
|
77
58
|
const {
|
|
78
59
|
href,
|
|
79
60
|
editorView,
|
|
80
61
|
onEdit,
|
|
81
62
|
onRemove
|
|
82
|
-
} = this.props;
|
|
63
|
+
} = this.props;
|
|
64
|
+
// [FS] IRAD-1013 2020-07-09
|
|
83
65
|
// Change button in "Apply Link" missing in LICIT.
|
|
84
66
|
|
|
85
67
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -105,8 +87,6 @@ class LinkTooltip extends React.PureComponent {
|
|
|
105
87
|
value: editorView
|
|
106
88
|
}))));
|
|
107
89
|
}
|
|
108
|
-
|
|
109
90
|
}
|
|
110
|
-
|
|
111
91
|
var _default = LinkTooltip;
|
|
112
92
|
exports.default = _default;
|
package/dist/ui/LinkURLEditor.js
CHANGED
|
@@ -4,69 +4,50 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var React = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
9
|
var _sanitizeURL = _interopRequireDefault(require("../sanitizeURL"));
|
|
13
|
-
|
|
14
10
|
var _licitUiCommands = require("@modusoperandi/licit-ui-commands");
|
|
15
|
-
|
|
16
11
|
var _KeyCodes = require("./KeyCodes");
|
|
17
|
-
|
|
18
12
|
require("./czi-form.css");
|
|
19
|
-
|
|
20
13
|
require("./czi-image-url-editor.css");
|
|
21
|
-
|
|
22
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
-
|
|
24
15
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
25
|
-
|
|
26
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
|
-
|
|
28
|
-
function
|
|
29
|
-
|
|
17
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
18
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
19
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
30
20
|
const BAD_CHARACTER_PATTER = /\s/;
|
|
31
|
-
|
|
32
21
|
class LinkURLEditor extends React.PureComponent {
|
|
33
22
|
constructor() {
|
|
34
23
|
super(...arguments);
|
|
35
|
-
|
|
36
24
|
_defineProperty(this, "state", {
|
|
37
25
|
url: this.props.href
|
|
38
26
|
});
|
|
39
|
-
|
|
40
27
|
_defineProperty(this, "_onKeyDown", e => {
|
|
41
28
|
if (e.keyCode === _KeyCodes.ENTER) {
|
|
42
29
|
e.preventDefault();
|
|
43
|
-
|
|
44
30
|
this._apply();
|
|
45
31
|
}
|
|
46
32
|
});
|
|
47
|
-
|
|
48
33
|
_defineProperty(this, "_onURLChange", e => {
|
|
49
34
|
const url = e.target.value;
|
|
50
35
|
this.setState({
|
|
51
36
|
url
|
|
52
37
|
});
|
|
53
38
|
});
|
|
54
|
-
|
|
55
39
|
_defineProperty(this, "_cancel", () => {
|
|
56
40
|
this.props.close();
|
|
57
41
|
});
|
|
58
|
-
|
|
59
42
|
_defineProperty(this, "_apply", () => {
|
|
60
43
|
const {
|
|
61
44
|
url
|
|
62
45
|
} = this.state;
|
|
63
|
-
|
|
64
46
|
if (url && !BAD_CHARACTER_PATTER.test(url)) {
|
|
65
47
|
this.props.close((0, _sanitizeURL.default)(url));
|
|
66
48
|
}
|
|
67
49
|
});
|
|
68
50
|
}
|
|
69
|
-
|
|
70
51
|
render() {
|
|
71
52
|
const {
|
|
72
53
|
href
|
|
@@ -77,14 +58,12 @@ class LinkURLEditor extends React.PureComponent {
|
|
|
77
58
|
const error = url ? BAD_CHARACTER_PATTER.test(url) : false;
|
|
78
59
|
let label = 'Apply';
|
|
79
60
|
let disabled = !!error;
|
|
80
|
-
|
|
81
61
|
if (href) {
|
|
82
62
|
label = url ? 'Apply' : 'Remove';
|
|
83
63
|
disabled = error;
|
|
84
64
|
} else {
|
|
85
65
|
disabled = error || !url;
|
|
86
66
|
}
|
|
87
|
-
|
|
88
67
|
return /*#__PURE__*/React.createElement("div", {
|
|
89
68
|
className: "czi-image-url-editor"
|
|
90
69
|
}, /*#__PURE__*/React.createElement("form", {
|
|
@@ -110,21 +89,16 @@ class LinkURLEditor extends React.PureComponent {
|
|
|
110
89
|
onClick: this._apply
|
|
111
90
|
}))));
|
|
112
91
|
}
|
|
113
|
-
|
|
114
92
|
}
|
|
115
|
-
|
|
116
93
|
_defineProperty(LinkURLEditor, "propsTypes", {
|
|
117
94
|
href: _propTypes.default.string,
|
|
118
95
|
close: function (props, propName) {
|
|
119
96
|
const fn = props[propName];
|
|
120
|
-
|
|
121
97
|
if (!fn.prototype || typeof fn.prototype.constructor !== 'function' && fn.prototype.constructor.length !== 1) {
|
|
122
98
|
return new Error(propName + 'must be a function with 1 arg of type string');
|
|
123
99
|
}
|
|
124
|
-
|
|
125
100
|
return null;
|
|
126
101
|
}
|
|
127
102
|
});
|
|
128
|
-
|
|
129
103
|
var _default = LinkURLEditor;
|
|
130
104
|
exports.default = _default;
|
|
@@ -4,105 +4,90 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _prosemirrorModel = require("prosemirror-model");
|
|
9
|
-
|
|
10
8
|
var _prosemirrorView = require("prosemirror-view");
|
|
11
|
-
|
|
12
9
|
var _MarkNames = require("../MarkNames");
|
|
13
|
-
|
|
14
|
-
function
|
|
15
|
-
|
|
10
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
12
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
16
13
|
// This implements the `NodeView` interface
|
|
17
14
|
// https://prosemirror.net/docs/ref/#view.NodeView
|
|
18
15
|
class ListItemNodeView {
|
|
19
16
|
// This implements the `NodeView` interface
|
|
20
17
|
// The outer DOM node that represents the list item element.
|
|
18
|
+
|
|
21
19
|
// This implements the `NodeView` interface.
|
|
22
20
|
// The DOM node that should hold the node's content.
|
|
21
|
+
|
|
23
22
|
constructor(node, editorView, getPos, decorations) {
|
|
24
23
|
_defineProperty(this, "dom", void 0);
|
|
25
|
-
|
|
26
24
|
_defineProperty(this, "contentDOM", void 0);
|
|
27
|
-
|
|
28
25
|
_defineProperty(this, "_nodeUpdated", void 0);
|
|
29
|
-
|
|
30
26
|
const dom = document.createElement('li');
|
|
31
27
|
this.dom = dom;
|
|
32
28
|
this.contentDOM = dom;
|
|
33
|
-
|
|
34
29
|
this._updateDOM(node);
|
|
35
|
-
}
|
|
36
|
-
|
|
30
|
+
}
|
|
37
31
|
|
|
32
|
+
// This implements the `NodeView` interface.
|
|
38
33
|
update(node, decorations) {
|
|
39
34
|
return this._updateDOM(node);
|
|
40
35
|
}
|
|
41
|
-
|
|
42
36
|
_updateDOM(node) {
|
|
43
37
|
if (this._nodeUpdated === node) {
|
|
44
38
|
return false;
|
|
45
39
|
}
|
|
46
|
-
|
|
47
40
|
this._nodeUpdated = node;
|
|
48
|
-
const dom = this.dom;
|
|
41
|
+
const dom = this.dom;
|
|
42
|
+
// According to `ListItemNodeSpec`, a valid list item has the following
|
|
49
43
|
// structure: `li > paragraph > text`.
|
|
50
|
-
|
|
51
44
|
const paragraph = node.firstChild;
|
|
52
|
-
const initialContent = paragraph ? paragraph.firstChild : null;
|
|
53
|
-
// first text node of the list item.
|
|
45
|
+
const initialContent = paragraph ? paragraph.firstChild : null;
|
|
54
46
|
|
|
47
|
+
// This resolves the styles for the counter by examines the marks for the
|
|
48
|
+
// first text node of the list item.
|
|
55
49
|
const marks = initialContent && initialContent.isText && initialContent.textContent ? initialContent.marks : null;
|
|
56
50
|
let cssColor;
|
|
57
51
|
let cssFontSize;
|
|
58
52
|
let cssText = '';
|
|
59
|
-
|
|
60
53
|
if (Array.isArray(marks)) {
|
|
61
54
|
marks.forEach(mark => {
|
|
62
55
|
const {
|
|
63
56
|
attrs,
|
|
64
57
|
type
|
|
65
58
|
} = mark;
|
|
66
|
-
|
|
67
59
|
switch (type.name) {
|
|
68
60
|
case _MarkNames.MARK_TEXT_COLOR:
|
|
69
61
|
cssColor = attrs.color;
|
|
70
62
|
break;
|
|
71
|
-
|
|
72
63
|
case _MarkNames.MARK_FONT_SIZE:
|
|
73
64
|
cssFontSize = attrs.pt;
|
|
74
65
|
break;
|
|
75
66
|
}
|
|
76
67
|
});
|
|
77
|
-
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// The counter of the list item is a pseudo-element that uses
|
|
78
71
|
// the CSS variables (e.g `--czi-list-style-color`) for styling.
|
|
79
72
|
// This defines the CSS variables scoped for the pseudo-element.
|
|
80
73
|
// See `src/ui/czi-list.css` for more details.
|
|
81
|
-
|
|
82
|
-
|
|
83
74
|
if (cssColor) {
|
|
84
75
|
cssText += `--czi-list-style-color: ${cssColor};`;
|
|
85
76
|
}
|
|
86
|
-
|
|
87
77
|
if (cssFontSize) {
|
|
88
78
|
cssText += `--czi-list-style-font-size: ${cssFontSize}pt;`;
|
|
89
79
|
}
|
|
90
|
-
|
|
91
80
|
dom.style.cssText = cssText;
|
|
92
81
|
const {
|
|
93
82
|
align
|
|
94
83
|
} = node.attrs;
|
|
95
|
-
|
|
96
84
|
if (align) {
|
|
97
85
|
dom.setAttribute('data-align', align);
|
|
98
86
|
} else {
|
|
99
87
|
dom.removeAttribute('data-align');
|
|
100
88
|
}
|
|
101
|
-
|
|
102
89
|
return true;
|
|
103
90
|
}
|
|
104
|
-
|
|
105
91
|
}
|
|
106
|
-
|
|
107
92
|
var _default = ListItemNodeView;
|
|
108
93
|
exports.default = _default;
|