@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,109 +4,80 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _prosemirrorState = require("prosemirror-state");
|
|
9
|
-
|
|
10
8
|
var _prosemirrorView = require("prosemirror-view");
|
|
11
|
-
|
|
12
9
|
var React = _interopRequireWildcard(require("react"));
|
|
13
|
-
|
|
14
10
|
var _findActionableCell = _interopRequireDefault(require("./findActionableCell"));
|
|
15
|
-
|
|
16
11
|
var _licitUiCommands = require("@modusoperandi/licit-ui-commands");
|
|
17
|
-
|
|
18
12
|
var _TableCellMenu = _interopRequireDefault(require("./ui/TableCellMenu"));
|
|
19
|
-
|
|
20
13
|
var _bindScrollHandler = _interopRequireDefault(require("./ui/bindScrollHandler"));
|
|
21
|
-
|
|
22
14
|
var _isElementFullyVisible = _interopRequireDefault(require("./ui/isElementFullyVisible"));
|
|
23
|
-
|
|
24
15
|
require("@modusoperandi/licit-ui-commands/dist/ui/czi-pop-up.css");
|
|
25
|
-
|
|
26
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
|
-
|
|
28
17
|
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); }
|
|
29
|
-
|
|
30
18
|
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; }
|
|
31
|
-
|
|
32
|
-
function
|
|
33
|
-
|
|
19
|
+
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; }
|
|
20
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
21
|
+
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); }
|
|
34
22
|
class TableCellTooltipView {
|
|
35
23
|
constructor(editorView) {
|
|
36
24
|
_defineProperty(this, "_cellElement", void 0);
|
|
37
|
-
|
|
38
25
|
_defineProperty(this, "_popUp", null);
|
|
39
|
-
|
|
40
26
|
_defineProperty(this, "_scrollHandle", null);
|
|
41
|
-
|
|
42
27
|
_defineProperty(this, "destroy", () => {
|
|
43
28
|
this._popUp && this._popUp.close();
|
|
44
29
|
this._popUp = null;
|
|
45
30
|
});
|
|
46
|
-
|
|
47
31
|
_defineProperty(this, "_onOpen", () => {
|
|
48
32
|
const cellEl = this._cellElement;
|
|
49
|
-
|
|
50
33
|
if (!cellEl) {
|
|
51
34
|
return;
|
|
52
35
|
}
|
|
53
|
-
|
|
54
36
|
this._scrollHandle = (0, _bindScrollHandler.default)(cellEl, this._onScroll);
|
|
55
37
|
});
|
|
56
|
-
|
|
57
38
|
_defineProperty(this, "_onClose", () => {
|
|
58
39
|
this._popUp = null;
|
|
59
40
|
this._scrollHandle && this._scrollHandle.dispose();
|
|
60
41
|
this._scrollHandle = null;
|
|
61
42
|
});
|
|
62
|
-
|
|
63
43
|
_defineProperty(this, "_onScroll", () => {
|
|
64
44
|
const popUp = this._popUp;
|
|
65
45
|
const cellEl = this._cellElement;
|
|
66
|
-
|
|
67
46
|
if (!popUp || !cellEl) {
|
|
68
47
|
return;
|
|
69
48
|
}
|
|
70
|
-
|
|
71
49
|
if (!(0, _isElementFullyVisible.default)(cellEl)) {
|
|
72
50
|
popUp.close();
|
|
73
51
|
}
|
|
74
52
|
});
|
|
75
|
-
|
|
76
53
|
this.update(editorView, null);
|
|
77
54
|
}
|
|
78
|
-
|
|
79
55
|
update(view, lastState) {
|
|
80
56
|
const {
|
|
81
57
|
state,
|
|
82
58
|
readOnly
|
|
83
59
|
} = view;
|
|
84
60
|
const result = (0, _findActionableCell.default)(state);
|
|
85
|
-
|
|
86
61
|
if (!result || readOnly) {
|
|
87
62
|
this.destroy();
|
|
88
63
|
return;
|
|
89
|
-
}
|
|
90
|
-
|
|
64
|
+
}
|
|
91
65
|
|
|
66
|
+
// These is screen coordinate.
|
|
92
67
|
const domFound = view.domAtPos(result.pos + 1);
|
|
93
|
-
|
|
94
68
|
if (!domFound) {
|
|
95
69
|
this.destroy();
|
|
96
70
|
return;
|
|
97
71
|
}
|
|
98
|
-
|
|
99
72
|
let cellEl = domFound.node;
|
|
100
73
|
const popUp = this._popUp;
|
|
101
74
|
const viewPops = {
|
|
102
75
|
editorState: state,
|
|
103
76
|
editorView: view
|
|
104
77
|
};
|
|
105
|
-
|
|
106
78
|
if (cellEl && !(0, _isElementFullyVisible.default)(cellEl)) {
|
|
107
79
|
cellEl = null;
|
|
108
80
|
}
|
|
109
|
-
|
|
110
81
|
if (!cellEl) {
|
|
111
82
|
// Closes the popup.
|
|
112
83
|
popUp && popUp.close();
|
|
@@ -117,9 +88,9 @@ class TableCellTooltipView {
|
|
|
117
88
|
} else {
|
|
118
89
|
// Creates a new popup.
|
|
119
90
|
popUp && popUp.close();
|
|
120
|
-
this._cellElement = cellEl;
|
|
91
|
+
this._cellElement = cellEl;
|
|
92
|
+
// [FS] IRAD-1009 2020-07-16
|
|
121
93
|
// Does not allow Table Menu Popuup button in disable mode
|
|
122
|
-
|
|
123
94
|
if (!view.disabled) {
|
|
124
95
|
this._popUp = (0, _licitUiCommands.createPopUp)(_TableCellMenu.default, viewPops, {
|
|
125
96
|
anchor: cellEl,
|
|
@@ -127,32 +98,25 @@ class TableCellTooltipView {
|
|
|
127
98
|
onClose: this._onClose,
|
|
128
99
|
position: _licitUiCommands.atAnchorTopRight
|
|
129
100
|
});
|
|
130
|
-
|
|
131
101
|
this._onOpen();
|
|
132
102
|
}
|
|
133
103
|
}
|
|
134
104
|
}
|
|
105
|
+
}
|
|
135
106
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
107
|
+
// https://prosemirror.net/examples/tooltip/
|
|
139
108
|
const SPEC = {
|
|
140
109
|
// [FS] IRAD-1005 2020-07-07
|
|
141
110
|
// Upgrade outdated packages.
|
|
142
111
|
key: new _prosemirrorState.PluginKey('TableCellMenuPlugin'),
|
|
143
|
-
|
|
144
112
|
view(editorView) {
|
|
145
113
|
return new TableCellTooltipView(editorView);
|
|
146
114
|
}
|
|
147
|
-
|
|
148
115
|
};
|
|
149
|
-
|
|
150
116
|
class TableCellMenuPlugin extends _prosemirrorState.Plugin {
|
|
151
117
|
constructor() {
|
|
152
118
|
super(SPEC);
|
|
153
119
|
}
|
|
154
|
-
|
|
155
120
|
}
|
|
156
|
-
|
|
157
121
|
var _default = TableCellMenuPlugin;
|
|
158
122
|
exports.default = _default;
|
|
@@ -4,83 +4,59 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _nullthrows = _interopRequireDefault(require("nullthrows"));
|
|
9
|
-
|
|
10
8
|
var _prosemirrorState = require("prosemirror-state");
|
|
11
|
-
|
|
12
9
|
var _prosemirrorTransform = require("prosemirror-transform");
|
|
13
|
-
|
|
14
10
|
var _prosemirrorView = require("prosemirror-view");
|
|
15
|
-
|
|
16
11
|
var _prosemirrorModel = require("prosemirror-model");
|
|
17
|
-
|
|
18
12
|
var _insertTable = _interopRequireDefault(require("./insertTable"));
|
|
19
|
-
|
|
20
13
|
var _licitUiCommands = require("@modusoperandi/licit-ui-commands");
|
|
21
|
-
|
|
22
14
|
var _TableGridSizeEditor = _interopRequireWildcard(require("./ui/TableGridSizeEditor"));
|
|
23
|
-
|
|
24
15
|
var _licitDocAttrsStep = require("@modusoperandi/licit-doc-attrs-step");
|
|
25
|
-
|
|
26
16
|
var _NodeNames = require("./NodeNames");
|
|
27
|
-
|
|
28
17
|
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); }
|
|
29
|
-
|
|
30
18
|
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; }
|
|
31
|
-
|
|
32
19
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
33
|
-
|
|
34
|
-
function
|
|
35
|
-
|
|
20
|
+
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; }
|
|
21
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
22
|
+
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); }
|
|
36
23
|
class TableInsertCommand extends _licitDocAttrsStep.UICommand {
|
|
37
24
|
constructor() {
|
|
38
25
|
super(...arguments);
|
|
39
|
-
|
|
40
26
|
_defineProperty(this, "_popUp", null);
|
|
41
|
-
|
|
42
27
|
_defineProperty(this, "shouldRespondToUIEvent", e => {
|
|
43
28
|
return e.type === _licitDocAttrsStep.UICommand.EventType.MOUSEENTER;
|
|
44
29
|
});
|
|
45
|
-
|
|
46
30
|
_defineProperty(this, "isEnabled", state => {
|
|
47
31
|
const tr = state;
|
|
48
32
|
let bOK = false;
|
|
49
33
|
const {
|
|
50
34
|
selection
|
|
51
35
|
} = tr;
|
|
52
|
-
|
|
53
36
|
if (selection instanceof _prosemirrorState.TextSelection) {
|
|
54
|
-
bOK = selection.from === selection.to;
|
|
37
|
+
bOK = selection.from === selection.to;
|
|
38
|
+
// [FS] IRAD-1065 2020-09-18
|
|
55
39
|
// Disable create table menu if the selection is inside a table.
|
|
56
|
-
|
|
57
40
|
if (bOK) {
|
|
58
41
|
const $head = selection.$head;
|
|
59
|
-
|
|
60
42
|
for (let d = $head.depth; d > 0; d--) {
|
|
61
43
|
if ($head.node(d).type.spec.tableRole == 'row') {
|
|
62
44
|
return false;
|
|
63
45
|
}
|
|
64
46
|
}
|
|
65
47
|
}
|
|
66
|
-
|
|
67
48
|
return bOK;
|
|
68
49
|
}
|
|
69
|
-
|
|
70
50
|
return bOK;
|
|
71
51
|
});
|
|
72
|
-
|
|
73
52
|
_defineProperty(this, "waitForUserInput", (state, dispatch, view, event) => {
|
|
74
53
|
if (this._popUp) {
|
|
75
54
|
return Promise.resolve(undefined);
|
|
76
55
|
}
|
|
77
|
-
|
|
78
56
|
const target = (0, _nullthrows.default)(event).currentTarget;
|
|
79
|
-
|
|
80
57
|
if (!(target instanceof HTMLElement)) {
|
|
81
58
|
return Promise.resolve(undefined);
|
|
82
59
|
}
|
|
83
|
-
|
|
84
60
|
const anchor = event ? event.currentTarget : null;
|
|
85
61
|
return new Promise(resolve => {
|
|
86
62
|
this._popUp = (0, _licitUiCommands.createPopUp)(_TableGridSizeEditor.default, null, {
|
|
@@ -95,7 +71,6 @@ class TableInsertCommand extends _licitDocAttrsStep.UICommand {
|
|
|
95
71
|
});
|
|
96
72
|
});
|
|
97
73
|
});
|
|
98
|
-
|
|
99
74
|
_defineProperty(this, "executeWithUserInput", (state, dispatch, view, inputs) => {
|
|
100
75
|
if (dispatch) {
|
|
101
76
|
const {
|
|
@@ -105,7 +80,6 @@ class TableInsertCommand extends _licitDocAttrsStep.UICommand {
|
|
|
105
80
|
let {
|
|
106
81
|
tr
|
|
107
82
|
} = state;
|
|
108
|
-
|
|
109
83
|
if (inputs) {
|
|
110
84
|
const {
|
|
111
85
|
rows,
|
|
@@ -115,19 +89,16 @@ class TableInsertCommand extends _licitDocAttrsStep.UICommand {
|
|
|
115
89
|
tr = (0, _insertTable.default)(tr, schema, rows, cols);
|
|
116
90
|
tr = insertParagraph(state, tr);
|
|
117
91
|
}
|
|
118
|
-
|
|
119
92
|
dispatch(tr);
|
|
120
93
|
}
|
|
121
|
-
|
|
122
94
|
return false;
|
|
123
95
|
});
|
|
124
96
|
}
|
|
97
|
+
}
|
|
125
98
|
|
|
126
|
-
|
|
99
|
+
// [FS] 2021-04-01
|
|
127
100
|
// Add empty line after table drop
|
|
128
101
|
// To make easier to enter a line after table
|
|
129
|
-
|
|
130
|
-
|
|
131
102
|
function insertParagraph(state, tr) {
|
|
132
103
|
const paragraph = state.schema.nodes[_NodeNames.PARAGRAPH];
|
|
133
104
|
const textNode = state.schema.text(' ');
|
|
@@ -135,15 +106,12 @@ function insertParagraph(state, tr) {
|
|
|
135
106
|
from,
|
|
136
107
|
to
|
|
137
108
|
} = tr.selection;
|
|
138
|
-
|
|
139
109
|
if (from !== to) {
|
|
140
110
|
return tr;
|
|
141
111
|
}
|
|
142
|
-
|
|
143
112
|
const paragraphNode = paragraph.create({}, textNode, null);
|
|
144
113
|
tr = tr.insert(from + tr.selection.$head.node(1).nodeSize - 4, _prosemirrorModel.Fragment.from(paragraphNode));
|
|
145
114
|
return tr;
|
|
146
115
|
}
|
|
147
|
-
|
|
148
116
|
var _default = TableInsertCommand;
|
|
149
117
|
exports.default = _default;
|
|
@@ -4,65 +4,48 @@ 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 _prosemirrorState = require("prosemirror-state");
|
|
11
|
-
|
|
12
9
|
var _prosemirrorTables = require("prosemirror-tables");
|
|
13
|
-
|
|
14
10
|
var _prosemirrorTransform = require("prosemirror-transform");
|
|
15
|
-
|
|
16
11
|
var _prosemirrorView = require("prosemirror-view");
|
|
17
|
-
|
|
18
12
|
var _NodeNames = require("./NodeNames");
|
|
19
|
-
|
|
20
13
|
var _licitDocAttrsStep = require("@modusoperandi/licit-doc-attrs-step");
|
|
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
|
function isBlankParagraphNode(node) {
|
|
25
18
|
if (!node) {
|
|
26
19
|
return false;
|
|
27
20
|
}
|
|
28
|
-
|
|
29
21
|
if (node.type.name !== _NodeNames.PARAGRAPH) {
|
|
30
22
|
return false;
|
|
31
23
|
}
|
|
32
|
-
|
|
33
24
|
const {
|
|
34
25
|
firstChild,
|
|
35
26
|
lastChild
|
|
36
27
|
} = node;
|
|
37
|
-
|
|
38
28
|
if (!firstChild) {
|
|
39
29
|
return true;
|
|
40
30
|
}
|
|
41
|
-
|
|
42
31
|
if (firstChild !== lastChild) {
|
|
43
32
|
return false;
|
|
44
33
|
}
|
|
45
|
-
|
|
46
34
|
return firstChild.type.name === _NodeNames.TEXT && firstChild.text === ' ';
|
|
47
35
|
}
|
|
48
|
-
|
|
49
36
|
function purgeConsecutiveBlankParagraphNodes(tr, schema) {
|
|
50
37
|
const paragraph = schema.nodes[_NodeNames.PARAGRAPH];
|
|
51
38
|
const cell = schema.nodes[_NodeNames.TABLE_CELL];
|
|
52
|
-
|
|
53
39
|
if (!paragraph || !cell) {
|
|
54
40
|
return tr;
|
|
55
41
|
}
|
|
56
|
-
|
|
57
42
|
const {
|
|
58
43
|
doc,
|
|
59
44
|
selection
|
|
60
45
|
} = tr;
|
|
61
|
-
|
|
62
46
|
if (!(selection instanceof _prosemirrorTables.CellSelection)) {
|
|
63
47
|
return tr;
|
|
64
48
|
}
|
|
65
|
-
|
|
66
49
|
const {
|
|
67
50
|
from,
|
|
68
51
|
to
|
|
@@ -72,12 +55,10 @@ function purgeConsecutiveBlankParagraphNodes(tr, schema) {
|
|
|
72
55
|
if (node.type === paragraph && parentNode.type === cell) {
|
|
73
56
|
if (isBlankParagraphNode(node)) {
|
|
74
57
|
const $pos = tr.doc.resolve(pos);
|
|
75
|
-
|
|
76
58
|
if (isBlankParagraphNode($pos.nodeBefore)) {
|
|
77
59
|
paragraphPoses.push(pos);
|
|
78
60
|
}
|
|
79
61
|
}
|
|
80
|
-
|
|
81
62
|
return false;
|
|
82
63
|
} else {
|
|
83
64
|
return true;
|
|
@@ -89,11 +70,9 @@ function purgeConsecutiveBlankParagraphNodes(tr, schema) {
|
|
|
89
70
|
});
|
|
90
71
|
return tr;
|
|
91
72
|
}
|
|
92
|
-
|
|
93
73
|
class TableMergeCellsCommand extends _licitDocAttrsStep.UICommand {
|
|
94
74
|
constructor() {
|
|
95
75
|
super(...arguments);
|
|
96
|
-
|
|
97
76
|
_defineProperty(this, "execute", (state, dispatch, view) => {
|
|
98
77
|
const {
|
|
99
78
|
tr,
|
|
@@ -101,22 +80,18 @@ class TableMergeCellsCommand extends _licitDocAttrsStep.UICommand {
|
|
|
101
80
|
selection
|
|
102
81
|
} = state;
|
|
103
82
|
let endTr = tr;
|
|
104
|
-
|
|
105
83
|
if (selection instanceof _prosemirrorTables.CellSelection) {
|
|
106
84
|
(0, _prosemirrorTables.mergeCells)(state, nextTr => {
|
|
107
85
|
endTr = nextTr;
|
|
108
|
-
}, view);
|
|
109
|
-
|
|
86
|
+
}, view);
|
|
87
|
+
// Also merge onsecutive blank paragraphs into one.
|
|
110
88
|
endTr = purgeConsecutiveBlankParagraphNodes(endTr, schema);
|
|
111
89
|
}
|
|
112
|
-
|
|
113
90
|
const changed = endTr.docChanged || endTr !== tr;
|
|
114
91
|
changed && dispatch && dispatch(endTr);
|
|
115
92
|
return changed;
|
|
116
93
|
});
|
|
117
94
|
}
|
|
118
|
-
|
|
119
95
|
}
|
|
120
|
-
|
|
121
96
|
var _default = TableMergeCellsCommand;
|
|
122
97
|
exports.default = _default;
|
package/dist/TableNodesSpecs.js
CHANGED
|
@@ -4,62 +4,51 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _toCSSColor = _interopRequireDefault(require("./ui/toCSSColor"));
|
|
9
|
-
|
|
10
8
|
var _prosemirrorModel = require("prosemirror-model");
|
|
11
|
-
|
|
12
9
|
var _prosemirrorTables = require("prosemirror-tables");
|
|
13
|
-
|
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
const NO_VISIBLE_BORDER_WIDTH = new Set(['0pt', '0px']);
|
|
15
12
|
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
// https://github.com/ProseMirror/prosemirror-tables/blob/master/demo.js
|
|
18
14
|
const TableNodesSpecs = (0, _prosemirrorTables.tableNodes)({
|
|
19
15
|
tableGroup: 'block',
|
|
20
16
|
cellContent: 'block+',
|
|
21
17
|
cellAttributes: {
|
|
22
18
|
borderColor: {
|
|
23
19
|
default: null,
|
|
24
|
-
|
|
25
20
|
getFromDOM(dom) {
|
|
26
21
|
const {
|
|
27
22
|
borderColor,
|
|
28
23
|
borderWidth
|
|
29
24
|
} = dom.style;
|
|
30
|
-
|
|
31
25
|
if (NO_VISIBLE_BORDER_WIDTH.has(borderWidth)) {
|
|
32
26
|
return 'transparent';
|
|
33
27
|
}
|
|
34
|
-
|
|
35
28
|
return borderColor && (0, _toCSSColor.default)(borderColor) || null;
|
|
36
29
|
},
|
|
37
|
-
|
|
38
30
|
setDOMAttr(value, attrs) {
|
|
39
31
|
if (value) {
|
|
40
32
|
attrs.style = (attrs.style || '') + `;border-color: ${value};`;
|
|
41
33
|
}
|
|
42
34
|
}
|
|
43
|
-
|
|
44
35
|
},
|
|
45
36
|
background: {
|
|
46
37
|
default: null,
|
|
47
|
-
|
|
48
38
|
// TODO: Move these to a table helper.
|
|
49
39
|
getFromDOM(dom) {
|
|
50
40
|
return dom.style.backgroundColor || null;
|
|
51
41
|
},
|
|
52
|
-
|
|
53
42
|
setDOMAttr(value, attrs) {
|
|
54
43
|
if (value) {
|
|
55
44
|
attrs.style = (attrs.style || '') + `;background-color: ${value};`;
|
|
56
45
|
}
|
|
57
46
|
}
|
|
58
|
-
|
|
59
47
|
}
|
|
60
48
|
}
|
|
61
|
-
});
|
|
49
|
+
});
|
|
62
50
|
|
|
51
|
+
// Override the default table node spec to support custom attributes.
|
|
63
52
|
const TableNodeSpec = Object.assign({}, TableNodesSpecs.table, {
|
|
64
53
|
attrs: {
|
|
65
54
|
marginLeft: {
|
|
@@ -68,23 +57,18 @@ const TableNodeSpec = Object.assign({}, TableNodesSpecs.table, {
|
|
|
68
57
|
},
|
|
69
58
|
parseDOM: [{
|
|
70
59
|
tag: 'table',
|
|
71
|
-
|
|
72
60
|
getAttrs(dom) {
|
|
73
61
|
const {
|
|
74
62
|
marginLeft
|
|
75
63
|
} = dom.style;
|
|
76
|
-
|
|
77
64
|
if (marginLeft && /\d+px/.test(marginLeft)) {
|
|
78
65
|
return {
|
|
79
66
|
marginLeft: parseFloat(marginLeft)
|
|
80
67
|
};
|
|
81
68
|
}
|
|
82
|
-
|
|
83
69
|
return null;
|
|
84
70
|
}
|
|
85
|
-
|
|
86
71
|
}],
|
|
87
|
-
|
|
88
72
|
toDOM(node) {
|
|
89
73
|
// Normally, the DOM structure of the table node is rendered by
|
|
90
74
|
// `TableNodeView`. This method is only called when user selects a
|
|
@@ -94,14 +78,11 @@ const TableNodeSpec = Object.assign({}, TableNodesSpecs.table, {
|
|
|
94
78
|
marginLeft
|
|
95
79
|
} = node.attrs;
|
|
96
80
|
const domAttrs = {};
|
|
97
|
-
|
|
98
81
|
if (marginLeft) {
|
|
99
82
|
domAttrs.style = `margin-left: ${marginLeft}px`;
|
|
100
83
|
}
|
|
101
|
-
|
|
102
84
|
return ['table', domAttrs, 0];
|
|
103
85
|
}
|
|
104
|
-
|
|
105
86
|
});
|
|
106
87
|
Object.assign(TableNodesSpecs, {
|
|
107
88
|
table: TableNodeSpec
|
package/dist/TablePlugins.js
CHANGED
|
@@ -4,15 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _prosemirrorTables = require("prosemirror-tables");
|
|
9
|
-
|
|
10
8
|
var _TableCellMenuPlugin = _interopRequireDefault(require("./TableCellMenuPlugin"));
|
|
11
|
-
|
|
12
9
|
var _TableResizePlugin = _interopRequireDefault(require("./TableResizePlugin"));
|
|
13
|
-
|
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
11
|
// Tables
|
|
17
12
|
// https://github.com/ProseMirror/prosemirror-tables/blob/master/demo.js
|
|
18
13
|
var _default = [new _TableCellMenuPlugin.default(), new _TableResizePlugin.default(), (0, _prosemirrorTables.tableEditing)()];
|