@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
|
@@ -5,39 +5,28 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
exports.setParagraphSpacing = setParagraphSpacing;
|
|
8
|
-
|
|
9
8
|
var _licitDocAttrsStep = require("@modusoperandi/licit-doc-attrs-step");
|
|
10
|
-
|
|
11
9
|
var _prosemirrorState = require("prosemirror-state");
|
|
12
|
-
|
|
13
10
|
var _NodeNames = require("./NodeNames");
|
|
14
|
-
|
|
15
11
|
var _prosemirrorView = require("prosemirror-view");
|
|
16
|
-
|
|
17
12
|
var _prosemirrorModel = require("prosemirror-model");
|
|
18
|
-
|
|
19
13
|
var _prosemirrorTransform = require("prosemirror-transform");
|
|
20
|
-
|
|
21
14
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
22
|
-
|
|
23
15
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
24
|
-
|
|
25
|
-
function
|
|
26
|
-
|
|
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); }
|
|
27
19
|
function setParagraphSpacing(tr, schema, paragraphSpacing, isAfter) {
|
|
28
20
|
const {
|
|
29
21
|
selection,
|
|
30
22
|
doc
|
|
31
23
|
} = tr;
|
|
32
|
-
|
|
33
24
|
if (!selection || !doc) {
|
|
34
25
|
return tr;
|
|
35
26
|
}
|
|
36
|
-
|
|
37
27
|
if (!(selection instanceof _prosemirrorState.TextSelection) && !(selection instanceof _prosemirrorState.AllSelection)) {
|
|
38
28
|
return tr;
|
|
39
29
|
}
|
|
40
|
-
|
|
41
30
|
const {
|
|
42
31
|
from,
|
|
43
32
|
to
|
|
@@ -46,19 +35,15 @@ function setParagraphSpacing(tr, schema, paragraphSpacing, isAfter) {
|
|
|
46
35
|
const heading = schema.nodes[_NodeNames.HEADING];
|
|
47
36
|
const listItem = schema.nodes[_NodeNames.LIST_ITEM];
|
|
48
37
|
const blockquote = schema.nodes[_NodeNames.BLOCKQUOTE];
|
|
49
|
-
|
|
50
38
|
if (!paragraph && !heading && !listItem && !blockquote) {
|
|
51
39
|
return tr;
|
|
52
40
|
}
|
|
53
|
-
|
|
54
41
|
const tasks = [];
|
|
55
42
|
const paragraphSpacingValue = paragraphSpacing || null;
|
|
56
43
|
doc.nodesBetween(from, to, (node, pos, parentNode) => {
|
|
57
44
|
const nodeType = node.type;
|
|
58
|
-
|
|
59
45
|
if (nodeType === paragraph || nodeType === heading || nodeType === listItem || nodeType === blockquote) {
|
|
60
46
|
const paragraphSpacing = node.attrs.paragraphSpacing || null;
|
|
61
|
-
|
|
62
47
|
if (paragraphSpacing !== paragraphSpacingValue) {
|
|
63
48
|
tasks.push({
|
|
64
49
|
node,
|
|
@@ -66,17 +51,13 @@ function setParagraphSpacing(tr, schema, paragraphSpacing, isAfter) {
|
|
|
66
51
|
nodeType
|
|
67
52
|
});
|
|
68
53
|
}
|
|
69
|
-
|
|
70
54
|
return nodeType === listItem ? true : false;
|
|
71
55
|
}
|
|
72
|
-
|
|
73
56
|
return true;
|
|
74
57
|
});
|
|
75
|
-
|
|
76
58
|
if (!tasks.length) {
|
|
77
59
|
return tr;
|
|
78
60
|
}
|
|
79
|
-
|
|
80
61
|
tasks.forEach(job => {
|
|
81
62
|
const {
|
|
82
63
|
node,
|
|
@@ -86,7 +67,6 @@ function setParagraphSpacing(tr, schema, paragraphSpacing, isAfter) {
|
|
|
86
67
|
let {
|
|
87
68
|
attrs
|
|
88
69
|
} = node;
|
|
89
|
-
|
|
90
70
|
if (isAfter) {
|
|
91
71
|
attrs = _objectSpread(_objectSpread({}, attrs), {}, {
|
|
92
72
|
paragraphSpacingAfter: paragraphSpacingValue ? paragraphSpacingValue : null
|
|
@@ -96,27 +76,21 @@ function setParagraphSpacing(tr, schema, paragraphSpacing, isAfter) {
|
|
|
96
76
|
paragraphSpacingBefore: paragraphSpacingValue ? paragraphSpacingValue : null
|
|
97
77
|
});
|
|
98
78
|
}
|
|
99
|
-
|
|
100
79
|
tr = tr.setNodeMarkup(pos, nodeType, attrs, node.marks);
|
|
101
80
|
});
|
|
102
81
|
return tr;
|
|
103
82
|
}
|
|
104
|
-
|
|
105
83
|
class ParagraphSpacingCommand extends _licitDocAttrsStep.UICommand {
|
|
106
84
|
constructor(paragraphSpacing, isAfter) {
|
|
107
85
|
super();
|
|
108
|
-
|
|
109
86
|
_defineProperty(this, "_paragraphSpacing", void 0);
|
|
110
|
-
|
|
111
87
|
_defineProperty(this, "_isAfter", void 0);
|
|
112
|
-
|
|
113
88
|
_defineProperty(this, "execute", (state, dispatch, view) => {
|
|
114
89
|
const {
|
|
115
90
|
schema,
|
|
116
91
|
selection
|
|
117
92
|
} = state;
|
|
118
93
|
const tr = setParagraphSpacing(state.tr.setSelection(selection), schema, this._paragraphSpacing, this._isAfter);
|
|
119
|
-
|
|
120
94
|
if (tr.docChanged) {
|
|
121
95
|
dispatch && dispatch(tr);
|
|
122
96
|
return true;
|
|
@@ -124,12 +98,9 @@ class ParagraphSpacingCommand extends _licitDocAttrsStep.UICommand {
|
|
|
124
98
|
return false;
|
|
125
99
|
}
|
|
126
100
|
});
|
|
127
|
-
|
|
128
101
|
this._paragraphSpacing = paragraphSpacing;
|
|
129
102
|
this._isAfter = isAfter;
|
|
130
103
|
}
|
|
131
|
-
|
|
132
104
|
}
|
|
133
|
-
|
|
134
105
|
var _default = ParagraphSpacingCommand;
|
|
135
106
|
exports.default = _default;
|
package/dist/PrintCommand.js
CHANGED
|
@@ -4,40 +4,30 @@ 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 _prosemirrorTransform = require("prosemirror-transform");
|
|
11
|
-
|
|
12
9
|
var _prosemirrorView = require("prosemirror-view");
|
|
13
|
-
|
|
14
10
|
var _licitDocAttrsStep = require("@modusoperandi/licit-doc-attrs-step");
|
|
15
|
-
|
|
16
|
-
function
|
|
17
|
-
|
|
11
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
13
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
18
14
|
class PrintCommand extends _licitDocAttrsStep.UICommand {
|
|
19
15
|
constructor() {
|
|
20
16
|
super(...arguments);
|
|
21
|
-
|
|
22
17
|
_defineProperty(this, "isActive", state => {
|
|
23
18
|
return false;
|
|
24
19
|
});
|
|
25
|
-
|
|
26
20
|
_defineProperty(this, "isEnabled", state => {
|
|
27
21
|
return !!window.print;
|
|
28
22
|
});
|
|
29
|
-
|
|
30
23
|
_defineProperty(this, "execute", (state, dispatch, view) => {
|
|
31
24
|
if (dispatch && window.print) {
|
|
32
25
|
window.print();
|
|
33
26
|
return true;
|
|
34
27
|
}
|
|
35
|
-
|
|
36
28
|
return false;
|
|
37
29
|
});
|
|
38
30
|
}
|
|
39
|
-
|
|
40
31
|
}
|
|
41
|
-
|
|
42
32
|
var _default = PrintCommand;
|
|
43
33
|
exports.default = _default;
|
|
@@ -6,20 +6,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
exports.hideSelectionPlaceholder = hideSelectionPlaceholder;
|
|
8
8
|
exports.showSelectionPlaceholder = showSelectionPlaceholder;
|
|
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-selection-placeholder.css");
|
|
17
|
-
|
|
18
13
|
const PLACE_HOLDER_ID = {
|
|
19
14
|
name: 'SelectionPlaceholderPlugin'
|
|
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,31 +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 deco = _prosemirrorView.Decoration.inline(action.add.from, action.add.to, {
|
|
42
35
|
class: 'czi-selection-placeholder'
|
|
43
36
|
}, {
|
|
44
37
|
id: PLACE_HOLDER_ID
|
|
45
38
|
});
|
|
46
|
-
|
|
47
39
|
set = set.add(tr.doc, [deco]);
|
|
48
40
|
} else if (action.remove) {
|
|
49
41
|
const found = set.find(null, null, specFinder);
|
|
50
42
|
set = set.remove(found);
|
|
51
43
|
}
|
|
52
|
-
|
|
53
44
|
return set;
|
|
54
45
|
}
|
|
55
|
-
|
|
56
46
|
},
|
|
57
47
|
props: {
|
|
58
48
|
decorations: state => {
|
|
@@ -61,50 +51,38 @@ const SPEC = {
|
|
|
61
51
|
}
|
|
62
52
|
}
|
|
63
53
|
};
|
|
64
|
-
|
|
65
54
|
class SelectionPlaceholderPlugin extends _prosemirrorState.Plugin {
|
|
66
55
|
constructor() {
|
|
67
56
|
super(SPEC);
|
|
68
|
-
|
|
69
57
|
if (singletonInstance) {
|
|
70
58
|
return singletonInstance;
|
|
71
59
|
}
|
|
72
|
-
|
|
73
60
|
singletonInstance = this;
|
|
74
61
|
}
|
|
75
|
-
|
|
76
62
|
}
|
|
77
|
-
|
|
78
63
|
function specFinder(spec) {
|
|
79
64
|
return spec.id == PLACE_HOLDER_ID;
|
|
80
65
|
}
|
|
81
|
-
|
|
82
66
|
function findSelectionPlaceholder(state) {
|
|
83
67
|
if (!singletonInstance) {
|
|
84
68
|
return null;
|
|
85
69
|
}
|
|
86
|
-
|
|
87
70
|
if (!state.plugins.includes(singletonInstance)) {
|
|
88
71
|
console.warn('SelectionPlaceholderPlugin is not installed');
|
|
89
72
|
return null;
|
|
90
73
|
}
|
|
91
|
-
|
|
92
74
|
const decos = singletonInstance.getState(state);
|
|
93
75
|
const found = decos.find(null, null, specFinder);
|
|
94
76
|
const pos = found.length ? found[0] : null;
|
|
95
77
|
return pos || null;
|
|
96
78
|
}
|
|
97
|
-
|
|
98
79
|
function showSelectionPlaceholder(state, tr) {
|
|
99
80
|
tr = tr || state.tr;
|
|
100
81
|
const plugin = singletonInstance;
|
|
101
|
-
|
|
102
82
|
if (!plugin || !tr.selection || tr.selection.empty) {
|
|
103
83
|
return tr;
|
|
104
84
|
}
|
|
105
|
-
|
|
106
85
|
const deco = findSelectionPlaceholder(state);
|
|
107
|
-
|
|
108
86
|
if (deco === null) {
|
|
109
87
|
tr = tr.setMeta(plugin, {
|
|
110
88
|
add: {
|
|
@@ -113,28 +91,21 @@ function showSelectionPlaceholder(state, tr) {
|
|
|
113
91
|
}
|
|
114
92
|
});
|
|
115
93
|
}
|
|
116
|
-
|
|
117
94
|
return tr;
|
|
118
95
|
}
|
|
119
|
-
|
|
120
96
|
function hideSelectionPlaceholder(state, tr) {
|
|
121
97
|
tr = tr || state.tr;
|
|
122
98
|
const plugin = singletonInstance;
|
|
123
|
-
|
|
124
99
|
if (!plugin) {
|
|
125
100
|
return tr;
|
|
126
101
|
}
|
|
127
|
-
|
|
128
102
|
const deco = findSelectionPlaceholder(state);
|
|
129
|
-
|
|
130
103
|
if (deco) {
|
|
131
104
|
tr = tr.setMeta(plugin, {
|
|
132
105
|
remove: {}
|
|
133
106
|
});
|
|
134
107
|
}
|
|
135
|
-
|
|
136
108
|
return tr;
|
|
137
109
|
}
|
|
138
|
-
|
|
139
110
|
var _default = SelectionPlaceholderPlugin;
|
|
140
111
|
exports.default = _default;
|
package/dist/SpacerMarkSpec.js
CHANGED
|
@@ -4,17 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = exports.SPACER_SIZE_TAB_LARGE = exports.SPACER_SIZE_TAB = exports.HAIR_SPACE_CHAR = exports.DOM_ATTRIBUTE_SIZE = void 0;
|
|
7
|
-
|
|
8
7
|
var _prosemirrorModel = require("prosemirror-model");
|
|
9
|
-
|
|
10
8
|
var _Types = require("./Types");
|
|
11
|
-
|
|
12
9
|
const DOM_ATTRIBUTE_SIZE = 'data-spacer-size';
|
|
13
10
|
exports.DOM_ATTRIBUTE_SIZE = DOM_ATTRIBUTE_SIZE;
|
|
14
11
|
const SPACER_SIZE_TAB = 'tab';
|
|
15
12
|
exports.SPACER_SIZE_TAB = SPACER_SIZE_TAB;
|
|
16
|
-
const SPACER_SIZE_TAB_LARGE = 'tab-large';
|
|
13
|
+
const SPACER_SIZE_TAB_LARGE = 'tab-large';
|
|
17
14
|
|
|
15
|
+
// See http://jkorpela.fi/chars/spaces.html
|
|
18
16
|
exports.SPACER_SIZE_TAB_LARGE = SPACER_SIZE_TAB_LARGE;
|
|
19
17
|
const HAIR_SPACE_CHAR = '\u200A';
|
|
20
18
|
exports.HAIR_SPACE_CHAR = HAIR_SPACE_CHAR;
|
|
@@ -39,7 +37,6 @@ const SpacerMarkSpec = {
|
|
|
39
37
|
};
|
|
40
38
|
}
|
|
41
39
|
}],
|
|
42
|
-
|
|
43
40
|
toDOM(node) {
|
|
44
41
|
const {
|
|
45
42
|
size
|
|
@@ -48,7 +45,6 @@ const SpacerMarkSpec = {
|
|
|
48
45
|
[DOM_ATTRIBUTE_SIZE]: size
|
|
49
46
|
}, 0];
|
|
50
47
|
}
|
|
51
|
-
|
|
52
48
|
};
|
|
53
49
|
var _default = SpacerMarkSpec;
|
|
54
50
|
exports.default = _default;
|
package/dist/StrikeMarkSpec.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
|
// https://bitbucket.org/atlassian/atlaskit/src/34facee3f461/packages/editor-core/src/schema/nodes/?at=master
|
|
11
9
|
const StrikeMarkSpec = {
|
|
12
10
|
parseDOM: [{
|
|
@@ -15,14 +13,12 @@ const StrikeMarkSpec = {
|
|
|
15
13
|
return value === 'line-through' && null;
|
|
16
14
|
}
|
|
17
15
|
}],
|
|
18
|
-
|
|
19
16
|
toDOM() {
|
|
20
17
|
const style = 'text-decoration: line-through';
|
|
21
18
|
return ['span', {
|
|
22
19
|
style
|
|
23
20
|
}, 0];
|
|
24
21
|
}
|
|
25
|
-
|
|
26
22
|
};
|
|
27
23
|
var _default = StrikeMarkSpec;
|
|
28
24
|
exports.default = _default;
|
package/dist/StrongMarkSpec.js
CHANGED
|
@@ -4,15 +4,14 @@ 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 STRONG_DOM = ['strong', 0];
|
|
11
9
|
const CSS_BOLD_PATTERN = /^(bold(er)?|[5-9]\d{2,})$/;
|
|
12
10
|
const StrongMarkSpec = {
|
|
13
11
|
parseDOM: [{
|
|
14
12
|
tag: 'strong'
|
|
15
|
-
},
|
|
13
|
+
},
|
|
14
|
+
// This works around a Google Docs misbehavior where
|
|
16
15
|
// pasted content will be inexplicably wrapped in `<b>`
|
|
17
16
|
// tags with a font-weight normal.
|
|
18
17
|
{
|
|
@@ -22,11 +21,9 @@ const StrongMarkSpec = {
|
|
|
22
21
|
style: 'font-weight',
|
|
23
22
|
getAttrs: value => CSS_BOLD_PATTERN.test(value) && null
|
|
24
23
|
}],
|
|
25
|
-
|
|
26
24
|
toDOM() {
|
|
27
25
|
return STRONG_DOM;
|
|
28
26
|
}
|
|
29
|
-
|
|
30
27
|
};
|
|
31
28
|
var _default = StrongMarkSpec;
|
|
32
29
|
exports.default = _default;
|
package/dist/StyleView.js
CHANGED
|
@@ -4,26 +4,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.StyleView = void 0;
|
|
7
|
-
|
|
8
7
|
var _prosemirrorView = require("prosemirror-view");
|
|
9
|
-
|
|
10
8
|
var _prosemirrorState = require("prosemirror-state");
|
|
11
|
-
|
|
12
9
|
// temp view for custom style have to check this view is needed?
|
|
10
|
+
|
|
13
11
|
class StyleView {
|
|
14
12
|
constructor(editorView) {
|
|
15
13
|
this.update(editorView, null);
|
|
16
14
|
}
|
|
17
|
-
|
|
18
15
|
update(view, lastState) {
|
|
19
16
|
if (view.readOnly) {
|
|
20
17
|
this.destroy();
|
|
21
18
|
return;
|
|
22
19
|
}
|
|
23
20
|
}
|
|
24
|
-
|
|
25
21
|
destroy() {}
|
|
26
|
-
|
|
27
22
|
}
|
|
28
|
-
|
|
29
23
|
exports.StyleView = StyleView;
|
|
@@ -4,52 +4,36 @@ 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 _prosemirrorTables = require("prosemirror-tables");
|
|
13
|
-
|
|
14
10
|
var _prosemirrorTransform = require("prosemirror-transform");
|
|
15
|
-
|
|
16
11
|
var _prosemirrorView = require("prosemirror-view");
|
|
17
|
-
|
|
18
12
|
var _licitUiCommands = require("@modusoperandi/licit-ui-commands");
|
|
19
|
-
|
|
20
13
|
var _licitDocAttrsStep = require("@modusoperandi/licit-doc-attrs-step");
|
|
21
|
-
|
|
22
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
-
|
|
24
|
-
function
|
|
25
|
-
|
|
15
|
+
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; }
|
|
16
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
17
|
+
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); }
|
|
26
18
|
const setCellBackgroundBlack = (0, _prosemirrorTables.setCellAttr)('background', '#000000');
|
|
27
|
-
|
|
28
19
|
class TableBackgroundColorCommand extends _licitDocAttrsStep.UICommand {
|
|
29
20
|
constructor() {
|
|
30
21
|
super(...arguments);
|
|
31
|
-
|
|
32
22
|
_defineProperty(this, "_popUp", null);
|
|
33
|
-
|
|
34
23
|
_defineProperty(this, "shouldRespondToUIEvent", e => {
|
|
35
24
|
return e.type === _licitDocAttrsStep.UICommand.EventType.MOUSEENTER;
|
|
36
25
|
});
|
|
37
|
-
|
|
38
26
|
_defineProperty(this, "isEnabled", state => {
|
|
39
27
|
return setCellBackgroundBlack(state.tr);
|
|
40
28
|
});
|
|
41
|
-
|
|
42
29
|
_defineProperty(this, "waitForUserInput", (state, dispatch, view, event) => {
|
|
43
30
|
if (this._popUp) {
|
|
44
31
|
return Promise.resolve(undefined);
|
|
45
32
|
}
|
|
46
|
-
|
|
47
33
|
const target = (0, _nullthrows.default)(event).currentTarget;
|
|
48
|
-
|
|
49
34
|
if (!(target instanceof HTMLElement)) {
|
|
50
35
|
return Promise.resolve(undefined);
|
|
51
36
|
}
|
|
52
|
-
|
|
53
37
|
const anchor = event ? event.currentTarget : null;
|
|
54
38
|
return new Promise(resolve => {
|
|
55
39
|
this._popUp = (0, _licitUiCommands.createPopUp)(_licitUiCommands.ColorEditor, null, {
|
|
@@ -64,23 +48,18 @@ class TableBackgroundColorCommand extends _licitDocAttrsStep.UICommand {
|
|
|
64
48
|
});
|
|
65
49
|
});
|
|
66
50
|
});
|
|
67
|
-
|
|
68
51
|
_defineProperty(this, "executeWithUserInput", (state, dispatch, view, hex) => {
|
|
69
52
|
if (dispatch && hex !== undefined) {
|
|
70
53
|
const cmd = (0, _prosemirrorTables.setCellAttr)('background', hex);
|
|
71
54
|
cmd(state, dispatch, view);
|
|
72
55
|
return true;
|
|
73
56
|
}
|
|
74
|
-
|
|
75
57
|
return false;
|
|
76
58
|
});
|
|
77
59
|
}
|
|
78
|
-
|
|
79
60
|
cancel() {
|
|
80
61
|
this._popUp && this._popUp.close(undefined);
|
|
81
62
|
}
|
|
82
|
-
|
|
83
63
|
}
|
|
84
|
-
|
|
85
64
|
var _default = TableBackgroundColorCommand;
|
|
86
65
|
exports.default = _default;
|
|
@@ -4,52 +4,36 @@ 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 _prosemirrorTables = require("prosemirror-tables");
|
|
13
|
-
|
|
14
10
|
var _prosemirrorTransform = require("prosemirror-transform");
|
|
15
|
-
|
|
16
11
|
var _prosemirrorView = require("prosemirror-view");
|
|
17
|
-
|
|
18
12
|
var _licitUiCommands = require("@modusoperandi/licit-ui-commands");
|
|
19
|
-
|
|
20
13
|
var _licitDocAttrsStep = require("@modusoperandi/licit-doc-attrs-step");
|
|
21
|
-
|
|
22
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
-
|
|
24
|
-
function
|
|
25
|
-
|
|
15
|
+
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; }
|
|
16
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
17
|
+
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); }
|
|
26
18
|
const setCellBorderBlack = (0, _prosemirrorTables.setCellAttr)('borderColor', '#000000');
|
|
27
|
-
|
|
28
19
|
class TableBorderColorCommand extends _licitDocAttrsStep.UICommand {
|
|
29
20
|
constructor() {
|
|
30
21
|
super(...arguments);
|
|
31
|
-
|
|
32
22
|
_defineProperty(this, "_popUp", null);
|
|
33
|
-
|
|
34
23
|
_defineProperty(this, "shouldRespondToUIEvent", e => {
|
|
35
24
|
return e.type === _licitDocAttrsStep.UICommand.EventType.MOUSEENTER;
|
|
36
25
|
});
|
|
37
|
-
|
|
38
26
|
_defineProperty(this, "isEnabled", state => {
|
|
39
27
|
return setCellBorderBlack(state.tr);
|
|
40
28
|
});
|
|
41
|
-
|
|
42
29
|
_defineProperty(this, "waitForUserInput", (state, dispatch, view, event) => {
|
|
43
30
|
if (this._popUp) {
|
|
44
31
|
return Promise.resolve(undefined);
|
|
45
32
|
}
|
|
46
|
-
|
|
47
33
|
const target = (0, _nullthrows.default)(event).currentTarget;
|
|
48
|
-
|
|
49
34
|
if (!(target instanceof HTMLElement)) {
|
|
50
35
|
return Promise.resolve(undefined);
|
|
51
36
|
}
|
|
52
|
-
|
|
53
37
|
const anchor = event ? event.currentTarget : null;
|
|
54
38
|
return new Promise(resolve => {
|
|
55
39
|
this._popUp = (0, _licitUiCommands.createPopUp)(_licitUiCommands.ColorEditor, null, {
|
|
@@ -64,23 +48,18 @@ class TableBorderColorCommand extends _licitDocAttrsStep.UICommand {
|
|
|
64
48
|
});
|
|
65
49
|
});
|
|
66
50
|
});
|
|
67
|
-
|
|
68
51
|
_defineProperty(this, "executeWithUserInput", (state, dispatch, view, color) => {
|
|
69
52
|
if (dispatch && color !== undefined) {
|
|
70
53
|
const cmd = (0, _prosemirrorTables.setCellAttr)('borderColor', color);
|
|
71
54
|
cmd(state, dispatch, view);
|
|
72
55
|
return true;
|
|
73
56
|
}
|
|
74
|
-
|
|
75
57
|
return false;
|
|
76
58
|
});
|
|
77
59
|
}
|
|
78
|
-
|
|
79
60
|
cancel() {
|
|
80
61
|
this._popUp && this._popUp.close(undefined);
|
|
81
62
|
}
|
|
82
|
-
|
|
83
63
|
}
|
|
84
|
-
|
|
85
64
|
var _default = TableBorderColorCommand;
|
|
86
65
|
exports.default = _default;
|
|
@@ -4,52 +4,36 @@ 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 _prosemirrorTables = require("prosemirror-tables");
|
|
13
|
-
|
|
14
10
|
var _prosemirrorTransform = require("prosemirror-transform");
|
|
15
|
-
|
|
16
11
|
var _prosemirrorView = require("prosemirror-view");
|
|
17
|
-
|
|
18
12
|
var _licitUiCommands = require("@modusoperandi/licit-ui-commands");
|
|
19
|
-
|
|
20
13
|
var _licitDocAttrsStep = require("@modusoperandi/licit-doc-attrs-step");
|
|
21
|
-
|
|
22
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
-
|
|
24
|
-
function
|
|
25
|
-
|
|
15
|
+
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; }
|
|
16
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
17
|
+
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); }
|
|
26
18
|
const setCellBackgroundBlack = (0, _prosemirrorTables.setCellAttr)('background', '#000000');
|
|
27
|
-
|
|
28
19
|
class TableCellColorCommand extends _licitDocAttrsStep.UICommand {
|
|
29
20
|
constructor() {
|
|
30
21
|
super(...arguments);
|
|
31
|
-
|
|
32
22
|
_defineProperty(this, "_popUp", null);
|
|
33
|
-
|
|
34
23
|
_defineProperty(this, "shouldRespondToUIEvent", e => {
|
|
35
24
|
return e.type === _licitDocAttrsStep.UICommand.EventType.MOUSEENTER;
|
|
36
25
|
});
|
|
37
|
-
|
|
38
26
|
_defineProperty(this, "isEnabled", state => {
|
|
39
27
|
return setCellBackgroundBlack(state.tr);
|
|
40
28
|
});
|
|
41
|
-
|
|
42
29
|
_defineProperty(this, "waitForUserInput", (state, dispatch, view, event) => {
|
|
43
30
|
if (this._popUp) {
|
|
44
31
|
return Promise.resolve(undefined);
|
|
45
32
|
}
|
|
46
|
-
|
|
47
33
|
const target = (0, _nullthrows.default)(event).currentTarget;
|
|
48
|
-
|
|
49
34
|
if (!(target instanceof HTMLElement)) {
|
|
50
35
|
return Promise.resolve(undefined);
|
|
51
36
|
}
|
|
52
|
-
|
|
53
37
|
const anchor = event ? event.currentTarget : null;
|
|
54
38
|
return new Promise(resolve => {
|
|
55
39
|
this._popUp = (0, _licitUiCommands.createPopUp)(_licitUiCommands.ColorEditor, null, {
|
|
@@ -64,19 +48,15 @@ class TableCellColorCommand extends _licitDocAttrsStep.UICommand {
|
|
|
64
48
|
});
|
|
65
49
|
});
|
|
66
50
|
});
|
|
67
|
-
|
|
68
51
|
_defineProperty(this, "executeWithUserInput", (state, dispatch, view, hex) => {
|
|
69
52
|
if (dispatch && hex !== undefined) {
|
|
70
53
|
const cmd = (0, _prosemirrorTables.setCellAttr)('background', hex);
|
|
71
54
|
cmd(state, dispatch, view);
|
|
72
55
|
return true;
|
|
73
56
|
}
|
|
74
|
-
|
|
75
57
|
return false;
|
|
76
58
|
});
|
|
77
59
|
}
|
|
78
|
-
|
|
79
60
|
}
|
|
80
|
-
|
|
81
61
|
var _default = TableCellColorCommand;
|
|
82
62
|
exports.default = _default;
|