@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
|
@@ -57,6 +57,7 @@ class Licit extends React.Component<any, any> {
|
|
|
57
57
|
_skipSCU: boolean; // Flag to decide whether to skip shouldComponentUpdate
|
|
58
58
|
_defaultEditorSchema: Schema;
|
|
59
59
|
_defaultEditorPlugins: Array<Plugin>;
|
|
60
|
+
_pasteJSONPlugin: Plugin;
|
|
60
61
|
_devTools: Promise<any>;
|
|
61
62
|
_applyDevTools: any;
|
|
62
63
|
|
|
@@ -118,6 +119,7 @@ class Licit extends React.Component<any, any> {
|
|
|
118
119
|
this._defaultEditorPlugins = new DefaultEditorPlugins(
|
|
119
120
|
this._defaultEditorSchema
|
|
120
121
|
).get();
|
|
122
|
+
this._pasteJSONPlugin = null;
|
|
121
123
|
|
|
122
124
|
const editorState = this.initEditorState(plugins, dataType, data);
|
|
123
125
|
data = editorState.doc;
|
|
@@ -175,6 +177,7 @@ class Licit extends React.Component<any, any> {
|
|
|
175
177
|
this._defaultEditorPlugins,
|
|
176
178
|
plugins
|
|
177
179
|
);
|
|
180
|
+
this._pasteJSONPlugin = effectivePlugins.pasteJSONPlugin;
|
|
178
181
|
if (DataType.JSON === dataType) {
|
|
179
182
|
editorState = convertFromJSON(
|
|
180
183
|
data,
|
|
@@ -208,8 +211,9 @@ class Licit extends React.Component<any, any> {
|
|
|
208
211
|
schema: Schema,
|
|
209
212
|
defaultPlugins: Array<Plugin>,
|
|
210
213
|
plugins: Array<Plugin>
|
|
211
|
-
): { plugins: Array<Plugin>, schema: Schema } {
|
|
214
|
+
): { plugins: Array<Plugin>, schema: Schema, pasteJSONPlugin: Plugin } {
|
|
212
215
|
const effectivePlugins = defaultPlugins;
|
|
216
|
+
let pasteJSONPlugin = null;
|
|
213
217
|
|
|
214
218
|
if (plugins) {
|
|
215
219
|
for (const p of plugins) {
|
|
@@ -222,10 +226,14 @@ class Licit extends React.Component<any, any> {
|
|
|
222
226
|
if (p.initKeyCommands) {
|
|
223
227
|
effectivePlugins.push(p.initKeyCommands());
|
|
224
228
|
}
|
|
229
|
+
|
|
230
|
+
if (p.insert) {
|
|
231
|
+
pasteJSONPlugin = p;
|
|
232
|
+
}
|
|
225
233
|
}
|
|
226
234
|
}
|
|
227
235
|
}
|
|
228
|
-
return { plugins: effectivePlugins, schema };
|
|
236
|
+
return { plugins: effectivePlugins, schema, pasteJSONPlugin };
|
|
229
237
|
}
|
|
230
238
|
|
|
231
239
|
// [FS] IRAD-1578 2021-09-27
|
|
@@ -337,6 +345,12 @@ class Licit extends React.Component<any, any> {
|
|
|
337
345
|
return document;
|
|
338
346
|
}
|
|
339
347
|
|
|
348
|
+
insertJSON = (json: { [key: string]: any }): void => {
|
|
349
|
+
if (this._pasteJSONPlugin && this._pasteJSONPlugin.insert) {
|
|
350
|
+
this._pasteJSONPlugin.insert(json, this._editorView);
|
|
351
|
+
}
|
|
352
|
+
};
|
|
353
|
+
|
|
340
354
|
setContent = (content: any = {}, dataType: DataType): void => {
|
|
341
355
|
this.skipDataTypeCheck = false;
|
|
342
356
|
// [FS] IRAD-1571 2021-09-27
|
|
@@ -1,23 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _react = _interopRequireDefault(require("react"));
|
|
4
|
-
|
|
5
4
|
var _enzyme = require("enzyme");
|
|
6
|
-
|
|
7
5
|
var _enzymeAdapterReact = _interopRequireDefault(require("@wojtekmaj/enzyme-adapter-react-17"));
|
|
8
|
-
|
|
9
6
|
var _Licit = _interopRequireWildcard(require("./Licit"));
|
|
10
|
-
|
|
11
7
|
var _RichTextEditor = _interopRequireDefault(require("../ui/RichTextEditor"));
|
|
12
|
-
|
|
13
8
|
var _licitUiCommands = require("@modusoperandi/licit-ui-commands");
|
|
14
|
-
|
|
15
9
|
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); }
|
|
16
|
-
|
|
17
10
|
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; }
|
|
18
|
-
|
|
19
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
|
-
|
|
21
12
|
/**
|
|
22
13
|
* Configure Jest to use react / enzyme
|
|
23
14
|
*/
|
|
@@ -26,8 +17,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
26
17
|
});
|
|
27
18
|
describe('<Licit />', () => {
|
|
28
19
|
let wrapper;
|
|
29
|
-
let licit;
|
|
20
|
+
let licit;
|
|
30
21
|
|
|
22
|
+
// provide an empty document just to shut up that warning
|
|
31
23
|
const data = {
|
|
32
24
|
type: 'doc',
|
|
33
25
|
content: [{
|
|
@@ -37,8 +29,9 @@ describe('<Licit />', () => {
|
|
|
37
29
|
text: ' '
|
|
38
30
|
}]
|
|
39
31
|
}]
|
|
40
|
-
};
|
|
32
|
+
};
|
|
41
33
|
|
|
34
|
+
// Mocking the functions used in _onReady
|
|
42
35
|
const fakeEditorView = {
|
|
43
36
|
focus: _licitUiCommands.noop,
|
|
44
37
|
dispatch: _licitUiCommands.noop,
|
|
@@ -76,9 +69,9 @@ describe('<Licit />', () => {
|
|
|
76
69
|
// Using shallow, the underlying RichTexEditor is never really created,
|
|
77
70
|
// and Licit's _onReady method is not called. Call it here with the fake
|
|
78
71
|
// view created above
|
|
79
|
-
licit._onReady(fakeEditorView);
|
|
80
|
-
|
|
72
|
+
licit._onReady(fakeEditorView);
|
|
81
73
|
|
|
74
|
+
// Verify that getter now returns the underlying view.
|
|
82
75
|
expect(licit.editorView).toBe(fakeEditorView);
|
|
83
76
|
});
|
|
84
77
|
});
|
package/dist/client/Reporter.js
CHANGED
|
@@ -4,40 +4,33 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
/* eslint-disable */
|
|
8
|
+
|
|
9
9
|
class Reporter {
|
|
10
10
|
constructor() {
|
|
11
11
|
this.setAt = 0;
|
|
12
12
|
}
|
|
13
|
-
|
|
14
13
|
clearState() {
|
|
15
14
|
if (this.state) {
|
|
16
15
|
this.state = this.node = null;
|
|
17
16
|
this.setAt = 0;
|
|
18
17
|
}
|
|
19
18
|
}
|
|
20
|
-
|
|
21
19
|
failure(err) {
|
|
22
20
|
console.error('fail', err.toString());
|
|
23
21
|
}
|
|
24
|
-
|
|
25
22
|
delay(err) {
|
|
26
23
|
if (this.state == 'fail') return;
|
|
27
24
|
console.info('delay', err.toString());
|
|
28
25
|
}
|
|
29
|
-
|
|
30
26
|
show(type, message) {
|
|
31
27
|
this.clearState();
|
|
32
28
|
this.state = type;
|
|
33
29
|
this.setAt = Date.now();
|
|
34
30
|
}
|
|
35
|
-
|
|
36
31
|
success() {
|
|
37
32
|
if (this.state == 'fail' && this.setAt > Date.now() - 1000 * 10) setTimeout(() => this.success(), 5000);else this.clearState();
|
|
38
33
|
}
|
|
39
|
-
|
|
40
34
|
}
|
|
41
|
-
|
|
42
35
|
var _default = Reporter;
|
|
43
36
|
exports.default = _default;
|
|
@@ -4,73 +4,53 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = exports.bpfrpt_proptype_SetStateCall = void 0;
|
|
7
|
-
|
|
8
7
|
var _prosemirrorState = require("prosemirror-state");
|
|
9
|
-
|
|
10
8
|
var _prosemirrorTransform = require("prosemirror-transform");
|
|
11
|
-
|
|
12
9
|
var _prosemirrorModel = require("prosemirror-model");
|
|
13
|
-
|
|
14
10
|
var _prosemirrorView = require("prosemirror-view");
|
|
15
|
-
|
|
16
11
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
17
|
-
|
|
18
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
19
|
-
|
|
20
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
-
|
|
22
|
-
function
|
|
23
|
-
|
|
14
|
+
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; }
|
|
15
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
16
|
+
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); }
|
|
24
17
|
var bpfrpt_proptype_SetStateCall = _propTypes.default.func;
|
|
25
18
|
exports.bpfrpt_proptype_SetStateCall = bpfrpt_proptype_SetStateCall;
|
|
26
|
-
|
|
27
19
|
class SimpleConnector {
|
|
28
20
|
// This flag is used to deteremine if data passed in or not
|
|
29
21
|
// If not passed in, use the data from collab server when in collab mode.
|
|
30
22
|
// else use empty content.
|
|
23
|
+
|
|
31
24
|
constructor(_editorState, setState) {
|
|
32
25
|
_defineProperty(this, "_setState", void 0);
|
|
33
|
-
|
|
34
26
|
_defineProperty(this, "_editorState", void 0);
|
|
35
|
-
|
|
36
27
|
_defineProperty(this, "_dataDefined", void 0);
|
|
37
|
-
|
|
38
28
|
_defineProperty(this, "onEdit", (transaction, view) => {
|
|
39
29
|
_reactDom.default.unstable_batchedUpdates(() => {
|
|
40
|
-
const editorState = this._editorState.apply(transaction);
|
|
30
|
+
const editorState = this._editorState.apply(transaction);
|
|
31
|
+
// [FS] IRAD-1236 2020-03-05
|
|
41
32
|
// The state property should not be directly mutated. Use the updateState method.
|
|
42
|
-
|
|
43
|
-
|
|
44
33
|
if (view) {
|
|
45
34
|
view.updateState(editorState);
|
|
46
35
|
}
|
|
47
|
-
|
|
48
36
|
const state = {
|
|
49
37
|
editorState,
|
|
50
38
|
data: transaction.doc.toJSON()
|
|
51
39
|
};
|
|
52
|
-
|
|
53
40
|
this._setState(state, () => {
|
|
54
41
|
this._editorState = editorState;
|
|
55
42
|
});
|
|
56
43
|
});
|
|
57
44
|
});
|
|
58
|
-
|
|
59
45
|
_defineProperty(this, "getState", () => {
|
|
60
46
|
return this._editorState;
|
|
61
47
|
});
|
|
62
|
-
|
|
63
48
|
_defineProperty(this, "updateSchema", (schema, data) => {});
|
|
64
|
-
|
|
65
49
|
_defineProperty(this, "updateContent", data => {});
|
|
66
|
-
|
|
67
50
|
_defineProperty(this, "cleanUp", () => {});
|
|
68
|
-
|
|
69
51
|
this._editorState = _editorState;
|
|
70
52
|
this._setState = setState;
|
|
71
53
|
}
|
|
72
|
-
|
|
73
54
|
}
|
|
74
|
-
|
|
75
55
|
var _default = SimpleConnector;
|
|
76
56
|
exports.default = _default;
|
package/dist/client/http.js
CHANGED
|
@@ -9,17 +9,16 @@ exports.PATCH = PATCH;
|
|
|
9
9
|
exports.POST = POST;
|
|
10
10
|
exports.PUT = PUT;
|
|
11
11
|
exports.req = req;
|
|
12
|
-
|
|
13
12
|
/* eslint-disable */
|
|
13
|
+
|
|
14
14
|
// A simple wrapper for XHR.
|
|
15
15
|
function req(conf) {
|
|
16
16
|
let req = new XMLHttpRequest(),
|
|
17
|
-
|
|
17
|
+
aborted = false;
|
|
18
18
|
let result = new Promise((success, failure) => {
|
|
19
19
|
req.open(conf.method, conf.url, true);
|
|
20
20
|
req.addEventListener('load', () => {
|
|
21
21
|
if (aborted) return;
|
|
22
|
-
|
|
23
22
|
if (req.status < 400) {
|
|
24
23
|
success(req.responseText);
|
|
25
24
|
} else {
|
|
@@ -36,30 +35,25 @@ function req(conf) {
|
|
|
36
35
|
if (conf.headers) for (let header in conf.headers) req.setRequestHeader(header, conf.headers[header]);
|
|
37
36
|
req.send(conf.body || null);
|
|
38
37
|
});
|
|
39
|
-
|
|
40
38
|
result.abort = () => {
|
|
41
39
|
if (!aborted) {
|
|
42
40
|
req.abort();
|
|
43
41
|
aborted = true;
|
|
44
42
|
}
|
|
45
43
|
};
|
|
46
|
-
|
|
47
44
|
return result;
|
|
48
45
|
}
|
|
49
|
-
|
|
50
46
|
function makePlain(html) {
|
|
51
47
|
var elt = document.createElement('div');
|
|
52
48
|
elt.innerHTML = html;
|
|
53
49
|
return elt.textContent.replace(/\n[^]*|\s+$/g, '');
|
|
54
50
|
}
|
|
55
|
-
|
|
56
51
|
function GET(url) {
|
|
57
52
|
return req({
|
|
58
53
|
url,
|
|
59
54
|
method: 'GET'
|
|
60
55
|
});
|
|
61
56
|
}
|
|
62
|
-
|
|
63
57
|
function POST(url, body, type) {
|
|
64
58
|
return req({
|
|
65
59
|
url,
|
|
@@ -70,7 +64,6 @@ function POST(url, body, type) {
|
|
|
70
64
|
}
|
|
71
65
|
});
|
|
72
66
|
}
|
|
73
|
-
|
|
74
67
|
function PUT(url, body, type) {
|
|
75
68
|
return req({
|
|
76
69
|
url,
|
|
@@ -80,10 +73,10 @@ function PUT(url, body, type) {
|
|
|
80
73
|
'Content-Type': type
|
|
81
74
|
}
|
|
82
75
|
});
|
|
83
|
-
}
|
|
84
|
-
// http DELETE request overrided
|
|
85
|
-
|
|
76
|
+
}
|
|
86
77
|
|
|
78
|
+
// [FS] IRAD-1128 2021-02-03
|
|
79
|
+
// http DELETE request overrided
|
|
87
80
|
function DELETE(url, type) {
|
|
88
81
|
return req({
|
|
89
82
|
url,
|
|
@@ -92,10 +85,10 @@ function DELETE(url, type) {
|
|
|
92
85
|
'Content-Type': type
|
|
93
86
|
}
|
|
94
87
|
});
|
|
95
|
-
}
|
|
96
|
-
// http PATCH request overrided
|
|
97
|
-
|
|
88
|
+
}
|
|
98
89
|
|
|
90
|
+
// [FS] IRAD-1128 2021-02-03
|
|
91
|
+
// http PATCH request overrided
|
|
99
92
|
function PATCH(url, body, type) {
|
|
100
93
|
return req({
|
|
101
94
|
url,
|
package/dist/client/throttle.js
CHANGED
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = throttle;
|
|
7
|
-
|
|
8
7
|
function throttle(fn, threshhold, context) {
|
|
9
8
|
let last;
|
|
10
9
|
let deferTimer;
|
|
@@ -12,7 +11,6 @@ function throttle(fn, threshhold, context) {
|
|
|
12
11
|
return function () {
|
|
13
12
|
const now = Date.now();
|
|
14
13
|
const args = Array.prototype.slice.call(arguments);
|
|
15
|
-
|
|
16
14
|
if (last && now < last + threshhold) {
|
|
17
15
|
// hold on to it
|
|
18
16
|
clearTimeout(deferTimer);
|
|
@@ -4,34 +4,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = convertFromDOMElement;
|
|
7
|
-
|
|
8
7
|
var _prosemirrorModel = require("prosemirror-model");
|
|
9
|
-
|
|
10
8
|
var _prosemirrorState = require("prosemirror-state");
|
|
11
|
-
|
|
12
9
|
var _DocNodeSpec = require("./DocNodeSpec");
|
|
13
|
-
|
|
14
10
|
var _EditorPlugins = _interopRequireDefault(require("./EditorPlugins"));
|
|
15
|
-
|
|
16
11
|
var _EditorSchema = _interopRequireDefault(require("./EditorSchema"));
|
|
17
|
-
|
|
18
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
|
|
20
13
|
function convertFromDOMElement(el, schema, plugins) {
|
|
21
14
|
const effectiveSchema = schema || _EditorSchema.default;
|
|
22
15
|
const effectivePlugins = plugins || _EditorPlugins.default;
|
|
23
|
-
const bodyEl = el.querySelector('body');
|
|
16
|
+
const bodyEl = el.querySelector('body');
|
|
24
17
|
|
|
18
|
+
// https://prosemirror.net/docs/ref/#model.ParseOptions.preserveWhitespace
|
|
25
19
|
const doc = _prosemirrorModel.DOMParser.fromSchema(effectiveSchema).parse(el, {
|
|
26
20
|
preserveWhitespace: true
|
|
27
21
|
});
|
|
28
|
-
|
|
29
22
|
if (bodyEl) {
|
|
30
23
|
// Unfortunately the root node `doc` does not supoort `parseDOM`, thus
|
|
31
24
|
// we'd have to assign its `attrs` manually.
|
|
32
25
|
doc.attrs = (0, _DocNodeSpec.getAttrs)(bodyEl);
|
|
33
26
|
}
|
|
34
|
-
|
|
35
27
|
return _prosemirrorState.EditorState.create({
|
|
36
28
|
doc,
|
|
37
29
|
plugins: effectivePlugins
|
package/dist/convertFromHTML.js
CHANGED
|
@@ -4,15 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = convertFromHTML;
|
|
7
|
-
|
|
8
7
|
var _prosemirrorModel = require("prosemirror-model");
|
|
9
|
-
|
|
10
8
|
var _prosemirrorState = require("prosemirror-state");
|
|
11
|
-
|
|
12
9
|
var _convertFromDOMElement = _interopRequireDefault(require("./convertFromDOMElement"));
|
|
13
|
-
|
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
11
|
function convertFromHTML(html, schema, plugins) {
|
|
17
12
|
const root = document.createElement('html');
|
|
18
13
|
root.innerHTML = html ? html : ' ';
|
package/dist/convertFromJSON.js
CHANGED
|
@@ -4,19 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = convertFromJSON;
|
|
7
|
-
|
|
8
7
|
var _prosemirrorModel = require("prosemirror-model");
|
|
9
|
-
|
|
10
8
|
var _prosemirrorState = require("prosemirror-state");
|
|
11
|
-
|
|
12
9
|
var _createEmptyEditorState = _interopRequireDefault(require("./createEmptyEditorState"));
|
|
13
|
-
|
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
11
|
function convertFromJSON(json, schema, defaultSchema, effectivePlugins) {
|
|
17
12
|
const editorSchema = schema || defaultSchema;
|
|
18
13
|
let error = false;
|
|
19
|
-
|
|
20
14
|
if (typeof json === 'string') {
|
|
21
15
|
try {
|
|
22
16
|
json = JSON.parse(json);
|
|
@@ -25,28 +19,24 @@ function convertFromJSON(json, schema, defaultSchema, effectivePlugins) {
|
|
|
25
19
|
error = true;
|
|
26
20
|
}
|
|
27
21
|
}
|
|
28
|
-
|
|
29
22
|
if (!json || typeof json !== 'object') {
|
|
30
23
|
console.error('convertFromJSON: invalid object', json);
|
|
31
24
|
error = true;
|
|
32
25
|
}
|
|
33
|
-
|
|
34
26
|
if (error) {
|
|
35
27
|
// [FS] IRAD-1455 2021-06-16
|
|
36
28
|
// Use the effectivePlugins, editor hangs, b'coz of missing default core plugins
|
|
37
29
|
return (0, _createEmptyEditorState.default)(schema, defaultSchema, effectivePlugins);
|
|
38
|
-
}
|
|
39
|
-
// Handle gracefully when error thrown on invalid json
|
|
40
|
-
|
|
30
|
+
}
|
|
41
31
|
|
|
32
|
+
// [FS] IRAD-1067 2020-09-19
|
|
33
|
+
// Handle gracefully when error thrown on invalid json
|
|
42
34
|
let doc = null;
|
|
43
|
-
|
|
44
35
|
try {
|
|
45
36
|
doc = editorSchema.nodeFromJSON(json);
|
|
46
37
|
} catch (error) {
|
|
47
38
|
return null;
|
|
48
39
|
}
|
|
49
|
-
|
|
50
40
|
return _prosemirrorState.EditorState.create({
|
|
51
41
|
doc: doc,
|
|
52
42
|
schema: editorSchema,
|
|
@@ -10,24 +10,18 @@ const PX_TO_PT_RATIO = 0.75292857;
|
|
|
10
10
|
exports.PX_TO_PT_RATIO = PX_TO_PT_RATIO;
|
|
11
11
|
const PT_TO_PX_RATIO = 1 / PX_TO_PT_RATIO;
|
|
12
12
|
exports.PT_TO_PX_RATIO = PT_TO_PX_RATIO;
|
|
13
|
-
|
|
14
13
|
function convertToCSSPTValue(styleValue) {
|
|
15
14
|
const matches = styleValue.match(SIZE_PATTERN);
|
|
16
|
-
|
|
17
15
|
if (!matches) {
|
|
18
16
|
return 0;
|
|
19
17
|
}
|
|
20
|
-
|
|
21
18
|
let value = parseFloat(matches[1]);
|
|
22
19
|
const unit = matches[2];
|
|
23
|
-
|
|
24
20
|
if (!value || !unit) {
|
|
25
21
|
return 0;
|
|
26
22
|
}
|
|
27
|
-
|
|
28
23
|
if (unit === 'px') {
|
|
29
24
|
value = PX_TO_PT_RATIO * value;
|
|
30
25
|
}
|
|
31
|
-
|
|
32
26
|
return value;
|
|
33
27
|
}
|
package/dist/convertToJSON.js
CHANGED
package/dist/createCommand.js
CHANGED
|
@@ -4,26 +4,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = createCommand;
|
|
7
|
-
|
|
8
7
|
var _prosemirrorState = require("prosemirror-state");
|
|
9
|
-
|
|
10
8
|
var _prosemirrorTransform = require("prosemirror-transform");
|
|
11
|
-
|
|
12
9
|
var _prosemirrorView = require("prosemirror-view");
|
|
13
|
-
|
|
14
10
|
var _licitDocAttrsStep = require("@modusoperandi/licit-doc-attrs-step");
|
|
15
|
-
|
|
16
|
-
function
|
|
17
|
-
|
|
11
|
+
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; }
|
|
12
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
13
|
+
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); }
|
|
18
14
|
function createCommand(execute) {
|
|
19
15
|
class CustomCommand extends _licitDocAttrsStep.UICommand {
|
|
20
16
|
constructor() {
|
|
21
17
|
super(...arguments);
|
|
22
|
-
|
|
23
18
|
_defineProperty(this, "isEnabled", state => {
|
|
24
19
|
return this.execute(state);
|
|
25
20
|
});
|
|
26
|
-
|
|
27
21
|
_defineProperty(this, "execute", (state, dispatch, view) => {
|
|
28
22
|
const tr = state.tr;
|
|
29
23
|
let endTr = tr;
|
|
@@ -34,8 +28,6 @@ function createCommand(execute) {
|
|
|
34
28
|
return endTr.docChanged || tr !== endTr;
|
|
35
29
|
});
|
|
36
30
|
}
|
|
37
|
-
|
|
38
31
|
}
|
|
39
|
-
|
|
40
32
|
return new CustomCommand();
|
|
41
33
|
}
|
|
@@ -4,23 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = createEditorKeyMap;
|
|
7
|
-
|
|
8
7
|
var _prosemirrorState = require("prosemirror-state");
|
|
9
|
-
|
|
10
8
|
var _prosemirrorTransform = require("prosemirror-transform");
|
|
11
|
-
|
|
12
9
|
var _prosemirrorView = require("prosemirror-view");
|
|
13
|
-
|
|
14
10
|
var EditorCommands = _interopRequireWildcard(require("./EditorCommands"));
|
|
15
|
-
|
|
16
11
|
var EditorKeyMap = _interopRequireWildcard(require("./EditorKeyMap"));
|
|
17
|
-
|
|
18
12
|
var _licitDocAttrsStep = require("@modusoperandi/licit-doc-attrs-step");
|
|
19
|
-
|
|
20
13
|
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); }
|
|
21
|
-
|
|
22
14
|
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; }
|
|
23
|
-
|
|
24
15
|
const {
|
|
25
16
|
KEY_BACK_DELETE,
|
|
26
17
|
KEY_FORWARD_DELETE,
|
|
@@ -54,24 +45,20 @@ const {
|
|
|
54
45
|
STRONG,
|
|
55
46
|
UNDERLINE
|
|
56
47
|
} = EditorCommands;
|
|
57
|
-
|
|
58
48
|
function bindCommands() {
|
|
59
49
|
for (var _len = arguments.length, commands = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
60
50
|
commands[_key] = arguments[_key];
|
|
61
51
|
}
|
|
62
|
-
|
|
63
52
|
return function (state, dispatch, view) {
|
|
64
53
|
return commands.some(cmd => {
|
|
65
54
|
if (cmd.isEnabled(state, view, '')) {
|
|
66
55
|
cmd.execute(state, dispatch, view);
|
|
67
56
|
return true;
|
|
68
57
|
}
|
|
69
|
-
|
|
70
58
|
return false;
|
|
71
59
|
});
|
|
72
60
|
};
|
|
73
61
|
}
|
|
74
|
-
|
|
75
62
|
function createEditorKeyMap() {
|
|
76
63
|
const result = {
|
|
77
64
|
[KEY_BACK_DELETE.common]: LIST_ITEM_MERGE_UP.execute,
|
|
@@ -5,17 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.EMPTY_DOC_JSON = void 0;
|
|
7
7
|
exports.default = createEmptyEditorState;
|
|
8
|
-
|
|
9
8
|
var _prosemirrorModel = require("prosemirror-model");
|
|
10
|
-
|
|
11
9
|
var _prosemirrorState = require("prosemirror-state");
|
|
12
|
-
|
|
13
10
|
var _convertFromJSON = _interopRequireDefault(require("./convertFromJSON"));
|
|
14
|
-
|
|
15
11
|
var _EditorSchema = _interopRequireDefault(require("./EditorSchema"));
|
|
16
|
-
|
|
17
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
-
|
|
19
13
|
const EMPTY_DOC_JSON = {
|
|
20
14
|
type: 'doc',
|
|
21
15
|
content: [{
|
|
@@ -24,7 +18,6 @@ const EMPTY_DOC_JSON = {
|
|
|
24
18
|
]
|
|
25
19
|
};
|
|
26
20
|
exports.EMPTY_DOC_JSON = EMPTY_DOC_JSON;
|
|
27
|
-
|
|
28
21
|
function createEmptyEditorState(schema, defaultSchema, plugins) {
|
|
29
22
|
// TODO: Check if schema support doc and paragraph nodes.
|
|
30
23
|
return (0, _convertFromJSON.default)(EMPTY_DOC_JSON, schema, defaultSchema ? defaultSchema : _EditorSchema.default, plugins);
|
|
@@ -4,28 +4,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = createTableResizingPlugin;
|
|
7
|
-
|
|
8
7
|
var _prosemirrorState = require("prosemirror-state");
|
|
9
|
-
|
|
10
8
|
var _prosemirrorTables = require("prosemirror-tables");
|
|
11
|
-
|
|
12
9
|
var _prosemirrorView = require("prosemirror-view");
|
|
13
|
-
|
|
14
10
|
const TABLE_HANDLE_WIDTH = 10;
|
|
15
11
|
const TABLE_CELL_MINWIDTH = 25;
|
|
16
12
|
const TABLE_VIEW = undefined;
|
|
17
13
|
const TABLE_LAST_COLUMN_RESIZABLE = false;
|
|
18
|
-
|
|
19
14
|
function lookUpTableWrapper(event) {
|
|
20
15
|
const target = event.target;
|
|
21
|
-
|
|
22
16
|
if (!target || !target.closest) {
|
|
23
17
|
return null;
|
|
24
18
|
}
|
|
25
|
-
|
|
26
19
|
return target.closest('.tableWrapper');
|
|
27
20
|
}
|
|
28
|
-
|
|
29
21
|
function dispatchMouseEvent(type, clientX) {
|
|
30
22
|
requestAnimationFrame(() => {
|
|
31
23
|
const event = new MouseEvent(type, {
|
|
@@ -37,7 +29,6 @@ function dispatchMouseEvent(type, clientX) {
|
|
|
37
29
|
window.dispatchEvent(event);
|
|
38
30
|
});
|
|
39
31
|
}
|
|
40
|
-
|
|
41
32
|
function calculateMaxClientX(event, targetTable) {
|
|
42
33
|
const {
|
|
43
34
|
clientX
|
|
@@ -52,12 +43,11 @@ function calculateMaxClientX(event, targetTable) {
|
|
|
52
43
|
const cx = width - offsetX - colsCount * TABLE_CELL_MINWIDTH;
|
|
53
44
|
return Math.round(clientX + Math.max(0, cx));
|
|
54
45
|
}
|
|
55
|
-
|
|
56
46
|
function createTableResizingPlugin() {
|
|
57
|
-
let maxClientX = 0;
|
|
47
|
+
let maxClientX = 0;
|
|
58
48
|
|
|
49
|
+
// https://github.com/ProseMirror/prosemirror-tables/blob/master/src/columnresizing.js
|
|
59
50
|
const plugin = (0, _prosemirrorTables.columnResizing)(TABLE_HANDLE_WIDTH, TABLE_CELL_MINWIDTH, TABLE_VIEW, TABLE_LAST_COLUMN_RESIZABLE);
|
|
60
|
-
|
|
61
51
|
const captureMouse = event => {
|
|
62
52
|
if (event.clientX > maxClientX) {
|
|
63
53
|
// Current mouse event will make table too wide. Stop it and
|
|
@@ -69,12 +59,12 @@ function createTableResizingPlugin() {
|
|
|
69
59
|
window.removeEventListener('mouseup', captureMouse, true);
|
|
70
60
|
}
|
|
71
61
|
};
|
|
72
|
-
|
|
73
62
|
const {
|
|
74
63
|
mousedown
|
|
75
|
-
} = plugin.props.handleDOMEvents;
|
|
76
|
-
// the table become too wide.
|
|
64
|
+
} = plugin.props.handleDOMEvents;
|
|
77
65
|
|
|
66
|
+
// This is a workaround to constraint the mousemove to prevent
|
|
67
|
+
// the table become too wide.
|
|
78
68
|
Object.assign(plugin.props.handleDOMEvents, {
|
|
79
69
|
mousedown(view, event) {
|
|
80
70
|
const targetTable = lookUpTableWrapper(event);
|
|
@@ -84,7 +74,6 @@ function createTableResizingPlugin() {
|
|
|
84
74
|
mousedown(view, event);
|
|
85
75
|
return false;
|
|
86
76
|
}
|
|
87
|
-
|
|
88
77
|
});
|
|
89
78
|
return plugin;
|
|
90
79
|
}
|