@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,52 +4,34 @@ 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 _reactDom = _interopRequireDefault(require("react-dom"));
|
|
15
|
-
|
|
16
11
|
var _isEditorStateEmpty = _interopRequireDefault(require("./isEditorStateEmpty"));
|
|
17
|
-
|
|
18
12
|
require("./ui/czi-editor.css");
|
|
19
|
-
|
|
20
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
-
|
|
22
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
|
-
|
|
24
15
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
|
-
|
|
26
|
-
function
|
|
27
|
-
|
|
16
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
17
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
18
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
28
19
|
const CLASS_NAME_HAS_PLACEHOLDER = 'czi-has-placeholder';
|
|
29
|
-
|
|
30
20
|
class ContentPlaceholderView {
|
|
31
21
|
constructor(editorView) {
|
|
32
22
|
_defineProperty(this, "_el", null);
|
|
33
|
-
|
|
34
23
|
_defineProperty(this, "_focused", null);
|
|
35
|
-
|
|
36
24
|
_defineProperty(this, "_view", null);
|
|
37
|
-
|
|
38
25
|
_defineProperty(this, "_visible", null);
|
|
39
|
-
|
|
40
26
|
_defineProperty(this, "_checkFocus", () => {
|
|
41
27
|
const el = this._el;
|
|
42
28
|
const view = this._view;
|
|
43
|
-
|
|
44
29
|
if (!view || !el) {
|
|
45
30
|
return;
|
|
46
31
|
}
|
|
47
|
-
|
|
48
32
|
const doc = document;
|
|
49
33
|
const activeElement = doc.activeElement;
|
|
50
|
-
|
|
51
34
|
const bodyEl = this._getBodyElement();
|
|
52
|
-
|
|
53
35
|
if (!activeElement || !bodyEl || doc.hasFocus && !doc.hasFocus()) {
|
|
54
36
|
this._onBlur();
|
|
55
37
|
} else {
|
|
@@ -60,45 +42,35 @@ class ContentPlaceholderView {
|
|
|
60
42
|
}
|
|
61
43
|
}
|
|
62
44
|
});
|
|
63
|
-
|
|
64
45
|
const _el = document.createElement('div');
|
|
65
|
-
|
|
66
46
|
this._el = _el;
|
|
67
47
|
this._view = editorView;
|
|
68
48
|
_el.className = 'czi-editor-content-placeholder';
|
|
69
49
|
editorView.dom.parentNode.appendChild(_el);
|
|
70
50
|
document.addEventListener('focusin', this._checkFocus, true);
|
|
71
51
|
document.addEventListener('focusout', this._checkFocus, false);
|
|
72
|
-
this.update(editorView);
|
|
73
|
-
// calls `this._checkFocus` which will set `_focused` accordingly.
|
|
52
|
+
this.update(editorView);
|
|
74
53
|
|
|
54
|
+
// We don't know whether view is focused at this moment yet. Manually
|
|
55
|
+
// calls `this._checkFocus` which will set `_focused` accordingly.
|
|
75
56
|
this._checkFocus();
|
|
76
57
|
}
|
|
77
|
-
|
|
78
58
|
update(view) {
|
|
79
59
|
this._view = view;
|
|
80
60
|
const el = this._el;
|
|
81
|
-
|
|
82
61
|
if (!el || !view) {
|
|
83
62
|
return;
|
|
84
63
|
}
|
|
85
|
-
|
|
86
64
|
if (this._focused || !(0, _isEditorStateEmpty.default)(view.state)) {
|
|
87
65
|
this._hide();
|
|
88
|
-
|
|
89
66
|
return;
|
|
90
67
|
}
|
|
91
|
-
|
|
92
68
|
const parentEl = el.parentNode;
|
|
93
|
-
|
|
94
69
|
const bodyEl = this._getBodyElement();
|
|
95
|
-
|
|
96
70
|
const placeholder = view.placeholder;
|
|
97
|
-
|
|
98
71
|
if (!parentEl || !bodyEl || !placeholder) {
|
|
99
72
|
return;
|
|
100
73
|
}
|
|
101
|
-
|
|
102
74
|
this._visible = true;
|
|
103
75
|
view.dom.classList.add(CLASS_NAME_HAS_PLACEHOLDER);
|
|
104
76
|
const parentElRect = parentEl.getBoundingClientRect();
|
|
@@ -111,21 +83,15 @@ class ContentPlaceholderView {
|
|
|
111
83
|
el.style.padding = bodyStyle.padding;
|
|
112
84
|
el.style.display = 'block';
|
|
113
85
|
el.style.width = bodyEl.offsetWidth + 'px';
|
|
114
|
-
|
|
115
86
|
_reactDom.default.render( /*#__PURE__*/React.createElement("div", null, placeholder), el);
|
|
116
87
|
}
|
|
117
|
-
|
|
118
88
|
destroy() {
|
|
119
89
|
this._hide();
|
|
120
|
-
|
|
121
90
|
const el = this._el;
|
|
122
|
-
|
|
123
91
|
if (el) {
|
|
124
92
|
el.parentNode && el.parentNode.removeChild(el);
|
|
125
|
-
|
|
126
93
|
_reactDom.default.unmountComponentAtNode(el);
|
|
127
94
|
}
|
|
128
|
-
|
|
129
95
|
document.removeEventListener('focusin', this._checkFocus, true);
|
|
130
96
|
document.removeEventListener('focusout', this._checkFocus, false);
|
|
131
97
|
this._view = null;
|
|
@@ -133,21 +99,16 @@ class ContentPlaceholderView {
|
|
|
133
99
|
this._focused = false;
|
|
134
100
|
this._visible = false;
|
|
135
101
|
}
|
|
136
|
-
|
|
137
102
|
_onFocus() {
|
|
138
103
|
if (this._focused !== true) {
|
|
139
104
|
this._focused = true;
|
|
140
|
-
|
|
141
105
|
this._hide();
|
|
142
106
|
}
|
|
143
107
|
}
|
|
144
|
-
|
|
145
108
|
_onBlur() {
|
|
146
109
|
const view = this._view;
|
|
147
|
-
|
|
148
110
|
if (this._focused !== false) {
|
|
149
111
|
this._focused = false;
|
|
150
|
-
|
|
151
112
|
if (view && (0, _isEditorStateEmpty.default)(view.state)) {
|
|
152
113
|
this._show();
|
|
153
114
|
} else {
|
|
@@ -155,62 +116,49 @@ class ContentPlaceholderView {
|
|
|
155
116
|
}
|
|
156
117
|
}
|
|
157
118
|
}
|
|
158
|
-
|
|
159
119
|
_getBodyElement() {
|
|
160
120
|
const view = this._view;
|
|
161
121
|
return view && view.docView && view.docView.dom && view.docView.dom.firstChild;
|
|
162
122
|
}
|
|
163
|
-
|
|
164
123
|
_show() {
|
|
165
124
|
if (this._visible !== true) {
|
|
166
125
|
const el = this._el;
|
|
167
126
|
const view = this._view;
|
|
168
127
|
this._visible = true;
|
|
169
|
-
|
|
170
128
|
if (el) {
|
|
171
129
|
el.style.display = 'block';
|
|
172
130
|
}
|
|
173
|
-
|
|
174
131
|
if (view) {
|
|
175
132
|
this.update(view);
|
|
176
133
|
view.dom.classList.add(CLASS_NAME_HAS_PLACEHOLDER);
|
|
177
134
|
}
|
|
178
135
|
}
|
|
179
136
|
}
|
|
180
|
-
|
|
181
137
|
_hide() {
|
|
182
138
|
if (this._visible !== false) {
|
|
183
139
|
const el = this._el;
|
|
184
140
|
const view = this._view;
|
|
185
141
|
this._visible = false;
|
|
186
|
-
|
|
187
142
|
if (el) {
|
|
188
143
|
el.style.display = 'none';
|
|
189
144
|
}
|
|
190
|
-
|
|
191
145
|
if (view) {
|
|
192
146
|
view.dom.classList.remove(CLASS_NAME_HAS_PLACEHOLDER);
|
|
193
147
|
}
|
|
194
148
|
}
|
|
195
149
|
}
|
|
196
|
-
|
|
197
150
|
}
|
|
198
|
-
|
|
199
151
|
class ContentPlaceholderPlugin extends _prosemirrorState.Plugin {
|
|
200
152
|
constructor() {
|
|
201
153
|
super({
|
|
202
154
|
// [FS] IRAD-1005 2020-07-07
|
|
203
155
|
// Upgrade outdated packages.
|
|
204
156
|
key: new _prosemirrorState.PluginKey('ContentPlaceholderPlugin'),
|
|
205
|
-
|
|
206
157
|
view(editorView) {
|
|
207
158
|
return new ContentPlaceholderView(editorView);
|
|
208
159
|
}
|
|
209
|
-
|
|
210
160
|
});
|
|
211
161
|
}
|
|
212
|
-
|
|
213
162
|
}
|
|
214
|
-
|
|
215
163
|
var _default = ContentPlaceholderPlugin;
|
|
216
164
|
exports.default = _default;
|
|
@@ -6,20 +6,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
exports.hideCursorPlaceholder = hideCursorPlaceholder;
|
|
8
8
|
exports.showCursorPlaceholder = showCursorPlaceholder;
|
|
9
|
-
|
|
10
9
|
var _prosemirrorState = require("prosemirror-state");
|
|
11
|
-
|
|
12
10
|
var _prosemirrorTransform = require("prosemirror-transform");
|
|
13
|
-
|
|
14
11
|
var _prosemirrorView = require("prosemirror-view");
|
|
15
|
-
|
|
16
12
|
require("./ui/czi-cursor-placeholder.css");
|
|
17
|
-
|
|
18
13
|
const PLACE_HOLDER_ID = {
|
|
19
14
|
name: 'CursorPlaceholderPlugin'
|
|
20
15
|
};
|
|
21
|
-
let singletonInstance = null;
|
|
16
|
+
let singletonInstance = null;
|
|
22
17
|
|
|
18
|
+
// https://prosemirror.net/examples/upload/
|
|
23
19
|
const SPEC = {
|
|
24
20
|
// [FS] IRAD-1005 2020-07-07
|
|
25
21
|
// Upgrade outdated packages.
|
|
@@ -28,32 +24,25 @@ const SPEC = {
|
|
|
28
24
|
init() {
|
|
29
25
|
return _prosemirrorView.DecorationSet.empty;
|
|
30
26
|
},
|
|
31
|
-
|
|
32
27
|
apply(tr, set) {
|
|
33
28
|
set = set.map(tr.mapping, tr.doc);
|
|
34
29
|
const action = tr.getMeta(this);
|
|
35
|
-
|
|
36
30
|
if (!action) {
|
|
37
31
|
return set;
|
|
38
32
|
}
|
|
39
|
-
|
|
40
33
|
if (action.add) {
|
|
41
34
|
const widget = document.createElement('czi-cursor-placeholder');
|
|
42
35
|
widget.className = 'czi-cursor-placeholder';
|
|
43
|
-
|
|
44
36
|
const deco = _prosemirrorView.Decoration.widget(action.add.pos, widget, {
|
|
45
37
|
id: PLACE_HOLDER_ID
|
|
46
38
|
});
|
|
47
|
-
|
|
48
39
|
set = set.add(tr.doc, [deco]);
|
|
49
40
|
} else if (action.remove) {
|
|
50
41
|
const found = set.find(null, null, specFinder);
|
|
51
42
|
set = set.remove(found);
|
|
52
43
|
}
|
|
53
|
-
|
|
54
44
|
return set;
|
|
55
45
|
}
|
|
56
|
-
|
|
57
46
|
},
|
|
58
47
|
props: {
|
|
59
48
|
decorations: state => {
|
|
@@ -62,83 +51,64 @@ const SPEC = {
|
|
|
62
51
|
}
|
|
63
52
|
}
|
|
64
53
|
};
|
|
65
|
-
|
|
66
54
|
class CursorPlaceholderPlugin extends _prosemirrorState.Plugin {
|
|
67
55
|
constructor() {
|
|
68
56
|
super(SPEC);
|
|
69
|
-
|
|
70
57
|
if (singletonInstance) {
|
|
71
58
|
return singletonInstance;
|
|
72
59
|
}
|
|
73
|
-
|
|
74
60
|
singletonInstance = this;
|
|
75
61
|
}
|
|
76
|
-
|
|
77
62
|
}
|
|
78
|
-
|
|
79
63
|
function specFinder(spec) {
|
|
80
64
|
return spec.id === PLACE_HOLDER_ID;
|
|
81
65
|
}
|
|
82
|
-
|
|
83
66
|
function findCursorPlaceholderPos(state) {
|
|
84
67
|
if (!singletonInstance) {
|
|
85
68
|
return null;
|
|
86
69
|
}
|
|
87
|
-
|
|
88
70
|
const decos = singletonInstance.getState(state);
|
|
89
71
|
const found = decos.find(null, null, specFinder);
|
|
90
72
|
const pos = found.length ? found[0].from : null;
|
|
91
73
|
return pos || null;
|
|
92
74
|
}
|
|
93
|
-
|
|
94
75
|
function showCursorPlaceholder(state) {
|
|
95
76
|
const plugin = singletonInstance;
|
|
96
77
|
let {
|
|
97
78
|
tr
|
|
98
79
|
} = state;
|
|
99
|
-
|
|
100
80
|
if (!plugin || !tr.selection) {
|
|
101
81
|
return tr;
|
|
102
82
|
}
|
|
103
|
-
|
|
104
83
|
const pos = findCursorPlaceholderPos(state);
|
|
105
|
-
|
|
106
84
|
if (pos === null) {
|
|
107
85
|
if (!tr.selection.empty) {
|
|
108
86
|
// Replace the selection with a placeholder.
|
|
109
87
|
tr = tr.deleteSelection();
|
|
110
88
|
}
|
|
111
|
-
|
|
112
89
|
tr = tr.setMeta(plugin, {
|
|
113
90
|
add: {
|
|
114
91
|
pos: tr.selection.from
|
|
115
92
|
}
|
|
116
93
|
});
|
|
117
94
|
}
|
|
118
|
-
|
|
119
95
|
return tr;
|
|
120
96
|
}
|
|
121
|
-
|
|
122
97
|
function hideCursorPlaceholder(state) {
|
|
123
98
|
const plugin = singletonInstance;
|
|
124
99
|
let {
|
|
125
100
|
tr
|
|
126
101
|
} = state;
|
|
127
|
-
|
|
128
102
|
if (!plugin) {
|
|
129
103
|
return tr;
|
|
130
104
|
}
|
|
131
|
-
|
|
132
105
|
const pos = findCursorPlaceholderPos(state);
|
|
133
|
-
|
|
134
106
|
if (pos !== null) {
|
|
135
107
|
tr = tr.setMeta(plugin, {
|
|
136
108
|
remove: {}
|
|
137
109
|
});
|
|
138
110
|
}
|
|
139
|
-
|
|
140
111
|
return tr;
|
|
141
112
|
}
|
|
142
|
-
|
|
143
113
|
var _default = CursorPlaceholderPlugin;
|
|
144
114
|
exports.default = _default;
|
package/dist/DocLayoutCommand.js
CHANGED
|
@@ -4,60 +4,43 @@ 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 _prosemirrorTransform = require("prosemirror-transform");
|
|
13
|
-
|
|
14
10
|
var _prosemirrorView = require("prosemirror-view");
|
|
15
|
-
|
|
16
11
|
var _licitDocAttrsStep = require("@modusoperandi/licit-doc-attrs-step");
|
|
17
|
-
|
|
18
12
|
var _DocLayoutEditor = _interopRequireWildcard(require("./ui/DocLayoutEditor"));
|
|
19
|
-
|
|
20
13
|
var _licitUiCommands = require("@modusoperandi/licit-ui-commands");
|
|
21
|
-
|
|
22
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
|
-
|
|
24
15
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
|
-
|
|
26
|
-
function
|
|
27
|
-
|
|
16
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
17
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
18
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
28
19
|
function setDocLayout(tr, schema, width, layout) {
|
|
29
20
|
const {
|
|
30
21
|
doc
|
|
31
22
|
} = tr;
|
|
32
|
-
|
|
33
23
|
if (!doc) {
|
|
34
24
|
return tr;
|
|
35
25
|
}
|
|
36
|
-
|
|
37
26
|
tr = tr.step(new _licitDocAttrsStep.SetDocAttrStep('width', width || null));
|
|
38
27
|
tr = tr.step(new _licitDocAttrsStep.SetDocAttrStep('layout', layout || null));
|
|
39
28
|
return tr;
|
|
40
29
|
}
|
|
41
|
-
|
|
42
30
|
class DocLayoutCommand extends _licitDocAttrsStep.UICommand {
|
|
43
31
|
constructor() {
|
|
44
32
|
super(...arguments);
|
|
45
|
-
|
|
46
33
|
_defineProperty(this, "_popUp", null);
|
|
47
|
-
|
|
48
34
|
_defineProperty(this, "isEnabled", state => {
|
|
49
35
|
return true;
|
|
50
36
|
});
|
|
51
|
-
|
|
52
37
|
_defineProperty(this, "isActive", state => {
|
|
53
38
|
return !!this._popUp;
|
|
54
39
|
});
|
|
55
|
-
|
|
56
40
|
_defineProperty(this, "waitForUserInput", (state, dispatch, view, event) => {
|
|
57
41
|
if (this._popUp) {
|
|
58
42
|
return Promise.resolve(undefined);
|
|
59
43
|
}
|
|
60
|
-
|
|
61
44
|
const {
|
|
62
45
|
doc
|
|
63
46
|
} = state;
|
|
@@ -76,7 +59,6 @@ class DocLayoutCommand extends _licitDocAttrsStep.UICommand {
|
|
|
76
59
|
});
|
|
77
60
|
});
|
|
78
61
|
});
|
|
79
|
-
|
|
80
62
|
_defineProperty(this, "executeWithUserInput", (state, dispatch, view, inputs) => {
|
|
81
63
|
if (dispatch) {
|
|
82
64
|
const {
|
|
@@ -85,10 +67,9 @@ class DocLayoutCommand extends _licitDocAttrsStep.UICommand {
|
|
|
85
67
|
} = state;
|
|
86
68
|
let {
|
|
87
69
|
tr
|
|
88
|
-
} = state;
|
|
89
|
-
|
|
70
|
+
} = state;
|
|
71
|
+
// tr = view ? hideCursorPlaceholder(view.state) : tr;
|
|
90
72
|
tr = tr.setSelection(selection);
|
|
91
|
-
|
|
92
73
|
if (inputs) {
|
|
93
74
|
const {
|
|
94
75
|
width,
|
|
@@ -96,16 +77,12 @@ class DocLayoutCommand extends _licitDocAttrsStep.UICommand {
|
|
|
96
77
|
} = inputs;
|
|
97
78
|
tr = setDocLayout(tr, schema, width, layout);
|
|
98
79
|
}
|
|
99
|
-
|
|
100
80
|
dispatch(tr);
|
|
101
81
|
view && view.focus();
|
|
102
82
|
}
|
|
103
|
-
|
|
104
83
|
return false;
|
|
105
84
|
});
|
|
106
85
|
}
|
|
107
|
-
|
|
108
86
|
}
|
|
109
|
-
|
|
110
87
|
var _default = DocLayoutCommand;
|
|
111
88
|
exports.default = _default;
|
package/dist/DocNodeSpec.js
CHANGED
|
@@ -5,11 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = exports.LAYOUT = exports.ATTRIBUTE_LAYOUT = void 0;
|
|
7
7
|
exports.getAttrs = getAttrs;
|
|
8
|
-
|
|
9
8
|
var _convertToCSSPTValue = _interopRequireDefault(require("./convertToCSSPTValue"));
|
|
10
|
-
|
|
11
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
|
|
13
10
|
const LAYOUT = {
|
|
14
11
|
DESKTOP_SCREEN_4_3: 'desktop_screen_4_3',
|
|
15
12
|
DESKTOP_SCREEN_16_9: 'desktop_screen_16_9',
|
|
@@ -21,7 +18,6 @@ const LAYOUT = {
|
|
|
21
18
|
exports.LAYOUT = LAYOUT;
|
|
22
19
|
const ATTRIBUTE_LAYOUT = 'data-layout';
|
|
23
20
|
exports.ATTRIBUTE_LAYOUT = ATTRIBUTE_LAYOUT;
|
|
24
|
-
|
|
25
21
|
function getAttrs(el) {
|
|
26
22
|
const attrs = {
|
|
27
23
|
layout: null,
|
|
@@ -35,14 +31,12 @@ function getAttrs(el) {
|
|
|
35
31
|
} = el.style || {};
|
|
36
32
|
const ww = (0, _convertToCSSPTValue.default)(width) || (0, _convertToCSSPTValue.default)(maxWidth);
|
|
37
33
|
const pp = (0, _convertToCSSPTValue.default)(padding);
|
|
38
|
-
|
|
39
34
|
if (ww) {
|
|
40
35
|
// 1pt = 1/72in
|
|
41
36
|
// letter size: 8.5in x 11inch
|
|
42
37
|
const ptWidth = ww + pp * 2;
|
|
43
38
|
const inWidth = ptWidth / 72;
|
|
44
39
|
const cmWidth = inWidth * 2.54;
|
|
45
|
-
|
|
46
40
|
if (inWidth >= 10.9 && inWidth <= 11.1) {
|
|
47
41
|
// Round up to letter size.
|
|
48
42
|
attrs.layout = LAYOUT.US_LETTER_LANDSCAPE;
|
|
@@ -55,16 +49,13 @@ function getAttrs(el) {
|
|
|
55
49
|
attrs.layout = LAYOUT.A4_PORTRAIT;
|
|
56
50
|
} else {
|
|
57
51
|
attrs.width = ptWidth;
|
|
58
|
-
|
|
59
52
|
if (pp) {
|
|
60
53
|
attrs.padding = pp;
|
|
61
54
|
}
|
|
62
55
|
}
|
|
63
56
|
}
|
|
64
|
-
|
|
65
57
|
return attrs;
|
|
66
58
|
}
|
|
67
|
-
|
|
68
59
|
const DocNodeSpec = {
|
|
69
60
|
attrs: {
|
|
70
61
|
layout: {
|
package/dist/EMMarkSpec.js
CHANGED
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _Types = require("./Types");
|
|
9
|
-
|
|
10
8
|
const EM_DOM = ['em', 0];
|
|
11
9
|
const EMMarkSpec = {
|
|
12
10
|
parseDOM: [{
|
|
@@ -16,11 +14,9 @@ const EMMarkSpec = {
|
|
|
16
14
|
}, {
|
|
17
15
|
style: 'font-style=italic'
|
|
18
16
|
}],
|
|
19
|
-
|
|
20
17
|
toDOM() {
|
|
21
18
|
return EM_DOM;
|
|
22
19
|
}
|
|
23
|
-
|
|
24
20
|
};
|
|
25
21
|
var _default = EMMarkSpec;
|
|
26
22
|
exports.default = _default;
|
package/dist/EditorCommands.js
CHANGED
|
@@ -4,59 +4,32 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.UNDERLINE = exports.UL = exports.TEXT_LINE_SPACINGS = exports.TEXT_INSERT_TAB_SPACE = exports.TEXT_HIGHLIGHT = exports.TEXT_COLOR = exports.TEXT_ALIGN_RIGHT = exports.TEXT_ALIGN_LEFT = exports.TEXT_ALIGN_JUSTIFY = exports.TEXT_ALIGN_CENTER = exports.TABLE_TOGGLE_HEADER_ROW = exports.TABLE_TOGGLE_HEADER_COLUMN = exports.TABLE_TOGGLE_HEADER_CELL = exports.TABLE_SPLIT_ROW = exports.TABLE_MOVE_TO_PREV_CELL = exports.TABLE_MOVE_TO_NEXT_CELL = exports.TABLE_MERGE_CELLS = exports.TABLE_INSERT_TABLE = exports.TABLE_DELETE_TABLE = exports.TABLE_DELETE_ROW = exports.TABLE_DELETE_COLUMN = exports.TABLE_BORDER_COLOR = exports.TABLE_BACKGROUND_COLOR = exports.TABLE_ADD_ROW_BEFORE = exports.TABLE_ADD_ROW_AFTER = exports.TABLE_ADD_COLUMN_BEFORE = exports.TABLE_ADD_COLUMN_AFTER = exports.SUPER = exports.SUB = exports.STRONG = exports.STRIKE = exports.PRINT = exports.MATH_EDIT = exports.LIST_SPLIT = exports.LIST_ITEM_MERGE_UP = exports.LIST_ITEM_MERGE_DOWN = exports.LIST_ITEM_INSERT_NEW_LINE = exports.LINK_SET_URL = exports.INDENT_MORE = exports.INDENT_LESS = exports.IMAGE_UPLOAD = exports.IMAGE_FROM_URL = exports.HR = exports.HISTORY_UNDO = exports.HISTORY_REDO = exports.H6 = exports.H5 = exports.H4 = exports.H3 = exports.H2 = exports.H1 = exports.EM = exports.DOC_LAYOUT = exports.CLEAR_FORMAT = void 0;
|
|
7
|
-
|
|
8
7
|
var ProsemirrorTables = _interopRequireWildcard(require("prosemirror-tables"));
|
|
9
|
-
|
|
10
8
|
var _DocLayoutCommand = _interopRequireDefault(require("./DocLayoutCommand"));
|
|
11
|
-
|
|
12
9
|
var _licitUiCommands = require("@modusoperandi/licit-ui-commands");
|
|
13
|
-
|
|
14
10
|
var _HistoryRedoCommand = _interopRequireDefault(require("./HistoryRedoCommand"));
|
|
15
|
-
|
|
16
11
|
var _HistoryUndoCommand = _interopRequireDefault(require("./HistoryUndoCommand"));
|
|
17
|
-
|
|
18
12
|
var _HorizontalRuleCommand = _interopRequireDefault(require("./HorizontalRuleCommand"));
|
|
19
|
-
|
|
20
13
|
var _ImageFromURLCommand = _interopRequireDefault(require("./ImageFromURLCommand"));
|
|
21
|
-
|
|
22
14
|
var _ImageUploadCommand = _interopRequireDefault(require("./ImageUploadCommand"));
|
|
23
|
-
|
|
24
15
|
var _LinkSetURLCommand = _interopRequireDefault(require("./LinkSetURLCommand"));
|
|
25
|
-
|
|
26
16
|
var _ListItemInsertNewLineCommand = _interopRequireDefault(require("./ListItemInsertNewLineCommand"));
|
|
27
|
-
|
|
28
17
|
var _ListItemMergeCommand = _interopRequireDefault(require("./ListItemMergeCommand"));
|
|
29
|
-
|
|
30
18
|
var _ListSplitCommand = _interopRequireDefault(require("./ListSplitCommand"));
|
|
31
|
-
|
|
32
19
|
var _ListToggleCommand = require("./ListToggleCommand");
|
|
33
|
-
|
|
34
20
|
var MarkNames = _interopRequireWildcard(require("./MarkNames"));
|
|
35
|
-
|
|
36
21
|
var _MarksClearCommand = _interopRequireDefault(require("./MarksClearCommand"));
|
|
37
|
-
|
|
38
22
|
var _MathEditCommand = _interopRequireDefault(require("./MathEditCommand"));
|
|
39
|
-
|
|
40
23
|
var _PrintCommand = _interopRequireDefault(require("./PrintCommand"));
|
|
41
|
-
|
|
42
24
|
var _TableBackgroundColorCommand = _interopRequireDefault(require("./TableBackgroundColorCommand"));
|
|
43
|
-
|
|
44
25
|
var _TableBorderColorCommand = _interopRequireDefault(require("./TableBorderColorCommand"));
|
|
45
|
-
|
|
46
26
|
var _TableInsertCommand = _interopRequireDefault(require("./TableInsertCommand"));
|
|
47
|
-
|
|
48
27
|
var _TableMergeCellsCommand = _interopRequireDefault(require("./TableMergeCellsCommand"));
|
|
49
|
-
|
|
50
28
|
var _TextInsertTabSpaceCommand = _interopRequireDefault(require("./TextInsertTabSpaceCommand"));
|
|
51
|
-
|
|
52
29
|
var _createCommand = _interopRequireDefault(require("./createCommand"));
|
|
53
|
-
|
|
54
30
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
55
|
-
|
|
56
31
|
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); }
|
|
57
|
-
|
|
58
32
|
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; }
|
|
59
|
-
|
|
60
33
|
// [FS][07-MAY-2020][IRAD-956]
|
|
61
34
|
// import BlockquoteInsertNewLineCommand from './BlockquoteInsertNewLineCommand';
|
|
62
35
|
// import BlockquoteToggleCommand from './BlockquoteToggleCommand';
|
|
@@ -87,16 +60,17 @@ const {
|
|
|
87
60
|
MARK_SUPER,
|
|
88
61
|
MARK_SUB,
|
|
89
62
|
MARK_UNDERLINE
|
|
90
|
-
} = MarkNames;
|
|
63
|
+
} = MarkNames;
|
|
64
|
+
|
|
65
|
+
// Note that Firefox will, by default, add various kinds of controls to
|
|
91
66
|
// editable tables, even though those don't work in ProseMirror. The only way
|
|
92
67
|
// to turn these off is globally, which you might want to do with the
|
|
93
68
|
// following code:
|
|
94
|
-
|
|
95
69
|
document.execCommand('enableObjectResizing', false, 'false');
|
|
96
|
-
document.execCommand('enableInlineTableEditing', false, 'false');
|
|
70
|
+
document.execCommand('enableInlineTableEditing', false, 'false');
|
|
71
|
+
// [FS][07-MAY-2020][IRAD-956]
|
|
97
72
|
// export const BLOCKQUOTE_TOGGLE = new BlockquoteToggleCommand();
|
|
98
73
|
// export const BLOCKQUOTE_INSERT_NEW_LINE = new BlockquoteInsertNewLineCommand();
|
|
99
|
-
|
|
100
74
|
const CLEAR_FORMAT = new _MarksClearCommand.default();
|
|
101
75
|
exports.CLEAR_FORMAT = CLEAR_FORMAT;
|
|
102
76
|
const DOC_LAYOUT = new _DocLayoutCommand.default();
|
|
@@ -199,9 +173,7 @@ const TEXT_HIGHLIGHT = new _licitUiCommands.TextHighlightCommand();
|
|
|
199
173
|
exports.TEXT_HIGHLIGHT = TEXT_HIGHLIGHT;
|
|
200
174
|
const TEXT_INSERT_TAB_SPACE = new _TextInsertTabSpaceCommand.default();
|
|
201
175
|
exports.TEXT_INSERT_TAB_SPACE = TEXT_INSERT_TAB_SPACE;
|
|
202
|
-
|
|
203
176
|
const TEXT_LINE_SPACINGS = _licitUiCommands.TextLineSpacingCommand.createGroup();
|
|
204
|
-
|
|
205
177
|
exports.TEXT_LINE_SPACINGS = TEXT_LINE_SPACINGS;
|
|
206
178
|
const UL = new _ListToggleCommand.ListToggleCommand(false, '');
|
|
207
179
|
exports.UL = UL;
|