@modusoperandi/licit 0.13.24 → 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 +1582 -1732
- 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 +23 -112
- package/dist/ui/ImageNodeView.js.flow +3 -3
- 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/licit/client/CustomLicitRuntime.js +30 -4
- package/package-lock.json.old +32889 -0
- package/package.json +45 -69
- package/src/client/Licit.js +16 -2
- package/src/ui/ImageNodeView.js +3 -3
- package/src/ui/czi-icon.css +4 -4
- package/utils/build_web_server.js +1 -7
- package/webpack.config.js +3 -3
|
@@ -4,40 +4,29 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = exports.bpfrpt_proptype_TableGridSizeEditorValue = void 0;
|
|
7
|
-
|
|
8
7
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
|
-
|
|
10
8
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
13
|
-
|
|
14
10
|
var _licitUiCommands = require("@modusoperandi/licit-ui-commands");
|
|
15
|
-
|
|
16
11
|
var _htmlElementToRect = _interopRequireDefault(require("./htmlElementToRect"));
|
|
17
|
-
|
|
18
12
|
require("./czi-table-grid-size-editor.css");
|
|
19
|
-
|
|
20
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
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
|
var bpfrpt_proptype_TableGridSizeEditorValue = {
|
|
31
21
|
"cols": _propTypes.default.number.isRequired,
|
|
32
22
|
"rows": _propTypes.default.number.isRequired
|
|
33
23
|
};
|
|
34
24
|
exports.bpfrpt_proptype_TableGridSizeEditorValue = bpfrpt_proptype_TableGridSizeEditorValue;
|
|
35
25
|
const GUTTER_SIZE = 5;
|
|
36
|
-
const CELL_SIZE = 16;
|
|
26
|
+
const CELL_SIZE = 16;
|
|
27
|
+
// [FS] IRAD-1012 2020-07-14
|
|
37
28
|
// Fix: Limited Table Grid size from 20 to 7
|
|
38
|
-
|
|
39
29
|
const MAX_SIZE = 7;
|
|
40
|
-
|
|
41
30
|
class GridCell extends React.PureComponent {
|
|
42
31
|
render() {
|
|
43
32
|
const {
|
|
@@ -59,41 +48,27 @@ class GridCell extends React.PureComponent {
|
|
|
59
48
|
style: style
|
|
60
49
|
});
|
|
61
50
|
}
|
|
62
|
-
|
|
63
51
|
}
|
|
64
|
-
|
|
65
52
|
class TableGridSizeEditor extends React.PureComponent {
|
|
66
53
|
constructor() {
|
|
67
54
|
super(...arguments);
|
|
68
|
-
|
|
69
55
|
_defineProperty(this, "_ex", 0);
|
|
70
|
-
|
|
71
56
|
_defineProperty(this, "_ey", 0);
|
|
72
|
-
|
|
73
57
|
_defineProperty(this, "_mx", 0);
|
|
74
|
-
|
|
75
58
|
_defineProperty(this, "_my", 0);
|
|
76
|
-
|
|
77
59
|
_defineProperty(this, "_rafID", 0);
|
|
78
|
-
|
|
79
60
|
_defineProperty(this, "_ref", null);
|
|
80
|
-
|
|
81
61
|
_defineProperty(this, "_entered", false);
|
|
82
|
-
|
|
83
62
|
_defineProperty(this, "props", void 0);
|
|
84
|
-
|
|
85
63
|
_defineProperty(this, "state", {
|
|
86
64
|
rows: 1,
|
|
87
65
|
cols: 1
|
|
88
66
|
});
|
|
89
|
-
|
|
90
67
|
_defineProperty(this, "_onRef", ref => {
|
|
91
68
|
this._ref = ref;
|
|
92
69
|
});
|
|
93
|
-
|
|
94
70
|
_defineProperty(this, "_onMouseEnter", e => {
|
|
95
71
|
const node = e.currentTarget;
|
|
96
|
-
|
|
97
72
|
if (node instanceof HTMLElement) {
|
|
98
73
|
const rect = (0, _licitUiCommands.fromHTMlElement)(node);
|
|
99
74
|
const mx = Math.round(e.clientX);
|
|
@@ -102,29 +77,23 @@ class TableGridSizeEditor extends React.PureComponent {
|
|
|
102
77
|
this._ey = rect.y;
|
|
103
78
|
this._mx = mx;
|
|
104
79
|
this._my = my;
|
|
105
|
-
|
|
106
80
|
if (!this._entered) {
|
|
107
81
|
this._entered = true;
|
|
108
82
|
document.addEventListener('mousemove', this._onMouseMove, true);
|
|
109
83
|
}
|
|
110
84
|
}
|
|
111
85
|
});
|
|
112
|
-
|
|
113
86
|
_defineProperty(this, "_onMouseMove", e => {
|
|
114
87
|
const el = this._ref && _reactDom.default.findDOMNode(this._ref);
|
|
115
|
-
|
|
116
88
|
const elRect = el ? (0, _htmlElementToRect.default)(el) : null;
|
|
117
89
|
const mouseRect = (0, _licitUiCommands.fromXY)(e.screenX, e.screenY, 10);
|
|
118
|
-
|
|
119
90
|
if (elRect && mouseRect && (0, _licitUiCommands.isIntersected)(elRect, mouseRect, 50)) {
|
|
120
91
|
// This prevents `PopUpManager` from collapsing the editor.
|
|
121
92
|
e.preventDefault();
|
|
122
93
|
e.stopImmediatePropagation();
|
|
123
94
|
}
|
|
124
|
-
|
|
125
95
|
const mx = Math.round(e.clientX);
|
|
126
96
|
const my = Math.round(e.clientY);
|
|
127
|
-
|
|
128
97
|
if (mx !== this._mx || my !== this._my) {
|
|
129
98
|
this._mx = mx;
|
|
130
99
|
this._my = my;
|
|
@@ -132,7 +101,6 @@ class TableGridSizeEditor extends React.PureComponent {
|
|
|
132
101
|
this._rafID = requestAnimationFrame(this._updateGridSize);
|
|
133
102
|
}
|
|
134
103
|
});
|
|
135
|
-
|
|
136
104
|
_defineProperty(this, "_updateGridSize", () => {
|
|
137
105
|
this._rafID = 0;
|
|
138
106
|
const mx = this._mx;
|
|
@@ -145,7 +113,6 @@ class TableGridSizeEditor extends React.PureComponent {
|
|
|
145
113
|
rows,
|
|
146
114
|
cols
|
|
147
115
|
} = this.state;
|
|
148
|
-
|
|
149
116
|
if (rows !== rr || cols !== cc) {
|
|
150
117
|
this.setState({
|
|
151
118
|
rows: rr,
|
|
@@ -153,21 +120,17 @@ class TableGridSizeEditor extends React.PureComponent {
|
|
|
153
120
|
});
|
|
154
121
|
}
|
|
155
122
|
});
|
|
156
|
-
|
|
157
123
|
_defineProperty(this, "_onMouseDown", e => {
|
|
158
124
|
e.preventDefault();
|
|
159
125
|
this.props.close(this.state);
|
|
160
126
|
});
|
|
161
127
|
}
|
|
162
|
-
|
|
163
128
|
componentWillUnmount() {
|
|
164
129
|
if (this._entered) {
|
|
165
130
|
document.removeEventListener('mousemove', this._onMouseMove, true);
|
|
166
131
|
}
|
|
167
|
-
|
|
168
132
|
this._rafID && cancelAnimationFrame(this._rafID);
|
|
169
133
|
}
|
|
170
|
-
|
|
171
134
|
render() {
|
|
172
135
|
const {
|
|
173
136
|
rows,
|
|
@@ -175,26 +138,21 @@ class TableGridSizeEditor extends React.PureComponent {
|
|
|
175
138
|
} = this.state;
|
|
176
139
|
let rr = Math.max(5, rows);
|
|
177
140
|
let cc = Math.max(5, cols);
|
|
178
|
-
|
|
179
141
|
if (rr === rows) {
|
|
180
142
|
rr = Math.min(MAX_SIZE, rr + 1);
|
|
181
143
|
}
|
|
182
|
-
|
|
183
144
|
if (cc === cols) {
|
|
184
145
|
cc = Math.min(MAX_SIZE, cc + 1);
|
|
185
146
|
}
|
|
186
|
-
|
|
187
147
|
const cells = [];
|
|
188
148
|
let ii = 0;
|
|
189
149
|
let y = 0;
|
|
190
150
|
let w = 0;
|
|
191
151
|
let h = 0;
|
|
192
|
-
|
|
193
152
|
while (ii < rr) {
|
|
194
153
|
y += GUTTER_SIZE;
|
|
195
154
|
let jj = 0;
|
|
196
155
|
let x = 0;
|
|
197
|
-
|
|
198
156
|
while (jj < cc) {
|
|
199
157
|
x += GUTTER_SIZE;
|
|
200
158
|
const selected = ii < rows && jj < cols;
|
|
@@ -208,12 +166,10 @@ class TableGridSizeEditor extends React.PureComponent {
|
|
|
208
166
|
w = x + GUTTER_SIZE;
|
|
209
167
|
jj++;
|
|
210
168
|
}
|
|
211
|
-
|
|
212
169
|
y += CELL_SIZE;
|
|
213
170
|
h = y + GUTTER_SIZE;
|
|
214
171
|
ii++;
|
|
215
172
|
}
|
|
216
|
-
|
|
217
173
|
const bodyStyle = {
|
|
218
174
|
width: w + 'px',
|
|
219
175
|
height: h + 'px'
|
|
@@ -230,8 +186,6 @@ class TableGridSizeEditor extends React.PureComponent {
|
|
|
230
186
|
className: "czi-table-grid-size-editor-footer"
|
|
231
187
|
}, rows, " X ", cols));
|
|
232
188
|
}
|
|
233
|
-
|
|
234
189
|
}
|
|
235
|
-
|
|
236
190
|
var _default = TableGridSizeEditor;
|
|
237
191
|
exports.default = _default;
|
package/dist/ui/TableNodeView.js
CHANGED
|
@@ -4,36 +4,25 @@ 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 _prosemirrorTables = require("prosemirror-tables");
|
|
13
|
-
|
|
14
10
|
// A custom table view that renders the margin-left style.
|
|
15
11
|
class TableNodeView extends _prosemirrorTables.TableView {
|
|
16
12
|
constructor(node, colMinWidth, view) {
|
|
17
13
|
super(node, colMinWidth, view);
|
|
18
|
-
|
|
19
14
|
this._updateMargin(node);
|
|
20
15
|
}
|
|
21
|
-
|
|
22
16
|
update(node) {
|
|
23
17
|
const updated = super.update(node);
|
|
24
|
-
|
|
25
18
|
if (updated) {
|
|
26
19
|
this._updateMargin(node);
|
|
27
20
|
}
|
|
28
|
-
|
|
29
21
|
return updated;
|
|
30
22
|
}
|
|
31
|
-
|
|
32
23
|
_updateMargin(node) {
|
|
33
24
|
const marginLeft = node.attrs && node.attrs.marginLeft || 0;
|
|
34
25
|
this.table.style.marginLeft = marginLeft ? `${marginLeft}px` : '';
|
|
35
26
|
}
|
|
36
|
-
|
|
37
27
|
}
|
|
38
|
-
|
|
39
28
|
exports.default = TableNodeView;
|
|
@@ -4,43 +4,36 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = bindScrollHandler;
|
|
7
|
-
|
|
8
7
|
function bindScrollHandler(target, callback) {
|
|
9
8
|
const defaultView = target.ownerDocument.defaultView;
|
|
10
9
|
const els = [];
|
|
11
10
|
let rid = 0;
|
|
12
|
-
|
|
13
11
|
let onScroll = () => {
|
|
14
12
|
// Debounce the scroll handler.
|
|
15
13
|
rid && cancelAnimationFrame(rid);
|
|
16
14
|
rid = requestAnimationFrame(callback);
|
|
17
15
|
};
|
|
16
|
+
let el = target;
|
|
18
17
|
|
|
19
|
-
|
|
18
|
+
// Scroll event does not bubble, so we need to look up all the scrollable
|
|
20
19
|
// elements.
|
|
21
|
-
|
|
22
20
|
while (el) {
|
|
23
21
|
const overflow = defaultView.getComputedStyle(el).overflow;
|
|
24
|
-
|
|
25
22
|
if (onScroll && overflow === 'auto' || overflow === 'scroll') {
|
|
26
23
|
el.addEventListener('scroll', onScroll, false);
|
|
27
24
|
els.push(el);
|
|
28
25
|
}
|
|
29
|
-
|
|
30
26
|
el = el.parentElement;
|
|
31
27
|
}
|
|
32
|
-
|
|
33
28
|
return {
|
|
34
29
|
dispose() {
|
|
35
30
|
while (onScroll && els.length) {
|
|
36
31
|
el = els.pop();
|
|
37
32
|
el && el.removeEventListener('scroll', onScroll, false);
|
|
38
33
|
}
|
|
39
|
-
|
|
40
34
|
onScroll = null;
|
|
41
35
|
rid && window.cancelAnimationFrame(rid);
|
|
42
36
|
rid = 0;
|
|
43
37
|
}
|
|
44
|
-
|
|
45
38
|
};
|
|
46
39
|
}
|
package/dist/ui/canUseCSSFont.js
CHANGED
|
@@ -5,14 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = canUseCSSFont;
|
|
7
7
|
const cached = {};
|
|
8
|
-
|
|
9
8
|
function canUseCSSFont(fontName) {
|
|
10
9
|
const doc = document;
|
|
11
|
-
|
|
12
10
|
if (cached.hasOwnProperty(fontName)) {
|
|
13
11
|
return Promise.resolve(cached[fontName]);
|
|
14
12
|
}
|
|
15
|
-
|
|
16
13
|
if (!doc.fonts || !doc.fonts.check || !doc.fonts.ready || !doc.fonts.status || !doc.fonts.values) {
|
|
17
14
|
// Feature is not supported, install the CSS anyway
|
|
18
15
|
// https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet/check#Browser_compatibility
|
|
@@ -20,7 +17,6 @@ function canUseCSSFont(fontName) {
|
|
|
20
17
|
console.log('FontFaceSet is not supported');
|
|
21
18
|
return Promise.resolve(false);
|
|
22
19
|
}
|
|
23
|
-
|
|
24
20
|
return new Promise(resolve => {
|
|
25
21
|
// https://stackoverflow.com/questions/5680013/how-to-be-notified-once-a-web-font-has-loaded
|
|
26
22
|
// All fonts in use by visible text have loaded.
|
|
@@ -28,16 +24,14 @@ function canUseCSSFont(fontName) {
|
|
|
28
24
|
if (doc.fonts.status !== 'loaded') {
|
|
29
25
|
setTimeout(check, 350);
|
|
30
26
|
return;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
}
|
|
28
|
+
// Do not use `doc.fonts.check()` because it may return falsey result.
|
|
34
29
|
const fontFaces = Array.from(doc.fonts.values());
|
|
35
30
|
const matched = fontFaces.find(ff => ff.family === fontName);
|
|
36
31
|
const result = !!matched;
|
|
37
32
|
cached[fontName] = result;
|
|
38
33
|
resolve(result);
|
|
39
34
|
};
|
|
40
|
-
|
|
41
35
|
doc.fonts.ready.then(check);
|
|
42
36
|
});
|
|
43
37
|
}
|
package/dist/ui/czi-icon.css
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
.czi-icon {
|
|
2
2
|
direction: ltr;
|
|
3
3
|
display: inline-block;
|
|
4
|
-
font-family: 'Material Icons', sans-serif;
|
|
4
|
+
font-family: 'Material Icons', sans-serif !important;
|
|
5
5
|
|
|
6
6
|
/* Support for IE. */
|
|
7
7
|
font-feature-settings: 'liga';
|
|
8
|
-
font-size: 20px; /* Preferred icon size */
|
|
8
|
+
font-size: 20px !important; /* Preferred icon size */
|
|
9
9
|
|
|
10
10
|
/* Support for all WebKit browsers. */
|
|
11
11
|
-webkit-font-smoothing: subpixel-antialiased;
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
.czi-icon.superscript,
|
|
55
55
|
.czi-icon.subscript {
|
|
56
56
|
display: inline-block;
|
|
57
|
-
font-family: 'Arial', sans-serif;
|
|
58
|
-
font-size: 12px;
|
|
57
|
+
font-family: 'Arial', sans-serif !important;
|
|
58
|
+
font-size: 12px !important;
|
|
59
59
|
height: 16px;
|
|
60
60
|
text-align: center;
|
|
61
61
|
width: 20px;
|
|
@@ -4,22 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = findActiveFontSize;
|
|
7
|
-
|
|
8
7
|
var _prosemirrorState = require("prosemirror-state");
|
|
9
|
-
|
|
10
8
|
var _prosemirrorUtils = require("prosemirror-utils");
|
|
11
|
-
|
|
12
9
|
var _MarkNames = require("../MarkNames");
|
|
13
|
-
|
|
14
10
|
var _NodeNames = require("../NodeNames");
|
|
15
|
-
|
|
16
11
|
var _findActiveMark = _interopRequireDefault(require("../findActiveMark"));
|
|
17
|
-
|
|
18
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
|
|
20
13
|
// This should map to `--czi-content-font-size` at `czi-editor.css`.
|
|
21
|
-
const FONT_PT_SIZE_DEFAULT = 11;
|
|
14
|
+
const FONT_PT_SIZE_DEFAULT = 11;
|
|
22
15
|
|
|
16
|
+
// This should map to `czi-heading.css`.
|
|
23
17
|
const MAP_HEADING_LEVEL_TO_FONT_PT_SIZE = {
|
|
24
18
|
'1': 20,
|
|
25
19
|
'2': 18,
|
|
@@ -28,7 +22,6 @@ const MAP_HEADING_LEVEL_TO_FONT_PT_SIZE = {
|
|
|
28
22
|
'5': 11,
|
|
29
23
|
'6': 11
|
|
30
24
|
};
|
|
31
|
-
|
|
32
25
|
function findActiveFontSize(state) {
|
|
33
26
|
const {
|
|
34
27
|
schema,
|
|
@@ -39,39 +32,30 @@ function findActiveFontSize(state) {
|
|
|
39
32
|
const markType = schema.marks[_MarkNames.MARK_FONT_SIZE];
|
|
40
33
|
const heading = schema.nodes[_NodeNames.HEADING];
|
|
41
34
|
const defaultSize = String(FONT_PT_SIZE_DEFAULT);
|
|
42
|
-
|
|
43
35
|
if (!markType) {
|
|
44
36
|
return defaultSize;
|
|
45
37
|
}
|
|
46
|
-
|
|
47
38
|
const {
|
|
48
39
|
from,
|
|
49
40
|
to,
|
|
50
41
|
empty
|
|
51
42
|
} = selection;
|
|
52
|
-
|
|
53
43
|
if (empty) {
|
|
54
44
|
const storedMarks = tr.storedMarks || state.storedMarks || selection.$cursor && selection.$cursor.marks && selection.$cursor.marks() || [];
|
|
55
45
|
const sm = storedMarks.find(m => m.type === markType);
|
|
56
46
|
return sm ? String(sm.attrs.pt || defaultSize) : defaultSize;
|
|
57
47
|
}
|
|
58
|
-
|
|
59
48
|
const mark = (0, _findActiveMark.default)(doc, from, to, markType);
|
|
60
|
-
|
|
61
49
|
if (mark) {
|
|
62
50
|
return String(mark.attrs.pt);
|
|
63
51
|
}
|
|
64
|
-
|
|
65
52
|
if (!heading) {
|
|
66
53
|
return defaultSize;
|
|
67
54
|
}
|
|
68
|
-
|
|
69
55
|
const result = (0, _prosemirrorUtils.findParentNodeOfType)(heading)(state.selection);
|
|
70
|
-
|
|
71
56
|
if (!result) {
|
|
72
57
|
return defaultSize;
|
|
73
58
|
}
|
|
74
|
-
|
|
75
59
|
const level = String(result.node.attrs.level);
|
|
76
60
|
return MAP_HEADING_LEVEL_TO_FONT_PT_SIZE[level] || defaultSize;
|
|
77
61
|
}
|
|
@@ -5,19 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.FONT_TYPE_NAME_DEFAULT = void 0;
|
|
7
7
|
exports.default = findActiveFontType;
|
|
8
|
-
|
|
9
8
|
var _prosemirrorState = require("prosemirror-state");
|
|
10
|
-
|
|
11
9
|
var _MarkNames = require("../MarkNames");
|
|
12
|
-
|
|
13
10
|
var _findActiveMark = _interopRequireDefault(require("../findActiveMark"));
|
|
14
|
-
|
|
15
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
-
|
|
17
12
|
// This should map to `--czi-content-font-size` at `czi-editor.css`.
|
|
18
13
|
const FONT_TYPE_NAME_DEFAULT = 'Arial';
|
|
19
14
|
exports.FONT_TYPE_NAME_DEFAULT = FONT_TYPE_NAME_DEFAULT;
|
|
20
|
-
|
|
21
15
|
function findActiveFontType(state) {
|
|
22
16
|
const {
|
|
23
17
|
schema,
|
|
@@ -26,29 +20,23 @@ function findActiveFontType(state) {
|
|
|
26
20
|
tr
|
|
27
21
|
} = state;
|
|
28
22
|
const markType = schema.marks[_MarkNames.MARK_FONT_TYPE];
|
|
29
|
-
|
|
30
23
|
if (!markType) {
|
|
31
24
|
return FONT_TYPE_NAME_DEFAULT;
|
|
32
25
|
}
|
|
33
|
-
|
|
34
26
|
const {
|
|
35
27
|
from,
|
|
36
28
|
to,
|
|
37
29
|
empty
|
|
38
30
|
} = selection;
|
|
39
|
-
|
|
40
31
|
if (empty) {
|
|
41
32
|
const storedMarks = tr.storedMarks || state.storedMarks || selection.$cursor && selection.$cursor.marks && selection.$cursor.marks() || [];
|
|
42
33
|
const sm = storedMarks.find(m => m.type === markType);
|
|
43
34
|
return sm && sm.attrs.name || FONT_TYPE_NAME_DEFAULT;
|
|
44
35
|
}
|
|
45
|
-
|
|
46
36
|
const mark = (0, _findActiveMark.default)(doc, from, to, markType);
|
|
47
37
|
const fontName = mark && mark.attrs.name;
|
|
48
|
-
|
|
49
38
|
if (!fontName) {
|
|
50
39
|
return FONT_TYPE_NAME_DEFAULT;
|
|
51
40
|
}
|
|
52
|
-
|
|
53
41
|
return fontName;
|
|
54
42
|
}
|
|
@@ -4,39 +4,30 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = handleEditorDrop;
|
|
7
|
-
|
|
8
7
|
var _prosemirrorView = require("prosemirror-view");
|
|
9
|
-
|
|
10
8
|
var _ImageUploadPlaceholderPlugin = require("../ImageUploadPlaceholderPlugin");
|
|
11
|
-
|
|
12
9
|
// https://prosemirror.net/examples/upload/
|
|
13
10
|
function handleEditorDrop(view, event) {
|
|
14
11
|
const {
|
|
15
12
|
dataTransfer
|
|
16
13
|
} = event;
|
|
17
|
-
|
|
18
14
|
if (!dataTransfer) {
|
|
19
15
|
return false;
|
|
20
16
|
}
|
|
21
|
-
|
|
22
17
|
const {
|
|
23
18
|
files
|
|
24
19
|
} = dataTransfer;
|
|
25
|
-
|
|
26
20
|
if (!files || !files.length) {
|
|
27
21
|
return false;
|
|
28
22
|
}
|
|
29
|
-
|
|
30
23
|
const filesList = Array.from(files);
|
|
31
24
|
const coords = {
|
|
32
25
|
x: event.clientX,
|
|
33
26
|
y: event.clientY
|
|
34
27
|
};
|
|
35
|
-
|
|
36
28
|
if ((0, _ImageUploadPlaceholderPlugin.uploadImageFiles)(view, filesList, coords)) {
|
|
37
29
|
event.preventDefault();
|
|
38
30
|
return true;
|
|
39
31
|
}
|
|
40
|
-
|
|
41
32
|
return false;
|
|
42
33
|
}
|
|
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = handleEditorKeyDown;
|
|
7
|
-
|
|
8
7
|
var _prosemirrorView = require("prosemirror-view");
|
|
9
|
-
|
|
10
8
|
var _KeyCodes = require("./KeyCodes");
|
|
11
|
-
|
|
12
9
|
const AtomicNodeKeyCodes = new Set([_KeyCodes.BACKSPACE, _KeyCodes.DELETE, _KeyCodes.DOWN_ARROW, _KeyCodes.LEFT_ARROW, _KeyCodes.RIGHT_ARROW, _KeyCodes.UP_ARROW]);
|
|
13
|
-
|
|
14
10
|
function handleEditorKeyDown(view, event) {
|
|
15
11
|
const {
|
|
16
12
|
selection,
|
|
@@ -20,10 +16,8 @@ function handleEditorKeyDown(view, event) {
|
|
|
20
16
|
from,
|
|
21
17
|
to
|
|
22
18
|
} = selection;
|
|
23
|
-
|
|
24
19
|
if (from === to - 1) {
|
|
25
20
|
const node = tr.doc.nodeAt(from);
|
|
26
|
-
|
|
27
21
|
if (node.isAtom && !node.isText && node.isLeaf) {
|
|
28
22
|
// An atomic node (e.g. Image) is selected.
|
|
29
23
|
// Only whitelisted keyCode should be allowed, which prevents user
|
|
@@ -31,6 +25,5 @@ function handleEditorKeyDown(view, event) {
|
|
|
31
25
|
return !AtomicNodeKeyCodes.has(event.keyCode);
|
|
32
26
|
}
|
|
33
27
|
}
|
|
34
|
-
|
|
35
28
|
return false;
|
|
36
29
|
}
|
|
@@ -4,34 +4,25 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = handleEditorPaste;
|
|
7
|
-
|
|
8
7
|
var _prosemirrorView = require("prosemirror-view");
|
|
9
|
-
|
|
10
8
|
var _ImageUploadPlaceholderPlugin = require("../ImageUploadPlaceholderPlugin");
|
|
11
|
-
|
|
12
9
|
function handleEditorPaste(view, event) {
|
|
13
10
|
const {
|
|
14
11
|
clipboardData
|
|
15
12
|
} = event;
|
|
16
|
-
|
|
17
13
|
if (!clipboardData) {
|
|
18
14
|
return false;
|
|
19
15
|
}
|
|
20
|
-
|
|
21
16
|
const {
|
|
22
17
|
files
|
|
23
18
|
} = clipboardData;
|
|
24
|
-
|
|
25
19
|
if (!files || !files.length) {
|
|
26
20
|
return false;
|
|
27
21
|
}
|
|
28
|
-
|
|
29
22
|
const filesList = Array.from(files);
|
|
30
|
-
|
|
31
23
|
if ((0, _ImageUploadPlaceholderPlugin.uploadImageFiles)(view, filesList)) {
|
|
32
24
|
event.preventDefault();
|
|
33
25
|
return true;
|
|
34
26
|
}
|
|
35
|
-
|
|
36
27
|
return false;
|
|
37
28
|
}
|
|
@@ -5,11 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.bpfrpt_proptype_Rect = void 0;
|
|
7
7
|
exports.default = htmlElementToRect;
|
|
8
|
-
|
|
9
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
-
|
|
11
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
|
|
13
10
|
var bpfrpt_proptype_Rect = {
|
|
14
11
|
"h": _propTypes.default.number.isRequired,
|
|
15
12
|
"w": _propTypes.default.number.isRequired,
|
|
@@ -17,7 +14,6 @@ var bpfrpt_proptype_Rect = {
|
|
|
17
14
|
"y": _propTypes.default.number.isRequired
|
|
18
15
|
};
|
|
19
16
|
exports.bpfrpt_proptype_Rect = bpfrpt_proptype_Rect;
|
|
20
|
-
|
|
21
17
|
function htmlElementToRect(el) {
|
|
22
18
|
const rect = el.getBoundingClientRect();
|
|
23
19
|
return {
|
|
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = injectStyleSheet;
|
|
7
|
-
|
|
8
7
|
var _url = _interopRequireDefault(require("url"));
|
|
9
|
-
|
|
10
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
9
|
const addedElements = new Map();
|
|
13
|
-
|
|
14
10
|
function createElement(tag, attrs) {
|
|
15
11
|
const el = document.createElement(tag);
|
|
16
12
|
Object.keys(attrs).forEach(key => {
|
|
@@ -22,15 +18,12 @@ function createElement(tag, attrs) {
|
|
|
22
18
|
});
|
|
23
19
|
return el;
|
|
24
20
|
}
|
|
25
|
-
|
|
26
21
|
function injectStyleSheet(urlStr) {
|
|
27
22
|
const parsedURL = _url.default.parse(urlStr);
|
|
28
|
-
|
|
29
23
|
const {
|
|
30
24
|
protocol
|
|
31
25
|
} = parsedURL;
|
|
32
26
|
const protocolPattern = /^(http:|https:)/;
|
|
33
|
-
|
|
34
27
|
if (!protocolPattern.test(protocol || '')) {
|
|
35
28
|
if (protocolPattern.test(window.location.protocol)) {
|
|
36
29
|
parsedURL.protocol = window.location.protocol;
|
|
@@ -38,13 +31,10 @@ function injectStyleSheet(urlStr) {
|
|
|
38
31
|
parsedURL.protocol = 'http:';
|
|
39
32
|
}
|
|
40
33
|
}
|
|
41
|
-
|
|
42
34
|
const href = _url.default.format(parsedURL);
|
|
43
|
-
|
|
44
35
|
if (addedElements.has(href)) {
|
|
45
36
|
return;
|
|
46
37
|
}
|
|
47
|
-
|
|
48
38
|
const el = createElement('link', {
|
|
49
39
|
crossorigin: 'anonymous',
|
|
50
40
|
href,
|
|
@@ -4,30 +4,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = isElementFullyVisible;
|
|
7
|
-
|
|
8
7
|
var _licitUiCommands = require("@modusoperandi/licit-ui-commands");
|
|
9
|
-
|
|
10
8
|
function isElementFullyVisible(el) {
|
|
11
9
|
const {
|
|
12
10
|
x,
|
|
13
11
|
y,
|
|
14
12
|
w,
|
|
15
13
|
h
|
|
16
|
-
} = (0, _licitUiCommands.fromHTMlElement)(el);
|
|
17
|
-
|
|
14
|
+
} = (0, _licitUiCommands.fromHTMlElement)(el);
|
|
15
|
+
// Only checks the top-left point.
|
|
18
16
|
const nwEl = w && h ? el.ownerDocument.elementFromPoint(x + 1, y + 1) : null;
|
|
19
|
-
|
|
20
17
|
if (!nwEl) {
|
|
21
18
|
return false;
|
|
22
19
|
}
|
|
23
|
-
|
|
24
20
|
if (nwEl === el) {
|
|
25
21
|
return true;
|
|
26
22
|
}
|
|
27
|
-
|
|
28
23
|
if (el.contains(nwEl)) {
|
|
29
24
|
return true;
|
|
30
25
|
}
|
|
31
|
-
|
|
32
26
|
return false;
|
|
33
27
|
}
|
package/dist/ui/isOffline.js
CHANGED