@manuscripts/body-editor 1.13.16 → 1.13.19
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/dist/cjs/commands.js +18 -1
- package/dist/cjs/components/views/TableCellContextMenu.js +19 -5
- package/dist/cjs/lib/context-menu.js +2 -10
- package/dist/cjs/lib/popper.js +19 -18
- package/dist/cjs/views/table_cell.js +1 -2
- package/dist/es/commands.js +16 -0
- package/dist/es/components/views/TableCellContextMenu.js +20 -6
- package/dist/es/lib/context-menu.js +2 -10
- package/dist/es/lib/popper.js +19 -15
- package/dist/es/views/table_cell.js +1 -2
- package/dist/types/commands.d.ts +2 -1
- package/dist/types/lib/popper.d.ts +2 -2
- package/package.json +3 -3
- package/styles/AdvancedEditor.css +4 -2
- package/styles/popper.css +6 -11
package/dist/cjs/commands.js
CHANGED
|
@@ -15,13 +15,14 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.insertTableFootnote = exports.addInlineComment = exports.addNodeComment = exports.createAndFillTableElement = exports.selectAllIsolating = exports.ignoreAtomBlockNodeForward = exports.isAtEndOfTextBlock = exports.ignoreMetaNodeBackspaceCommand = exports.ignoreAtomBlockNodeBackward = exports.isTextSelection = exports.isAtStartOfTextBlock = exports.insertTOCSection = exports.insertBibliographySection = exports.insertList = exports.insertKeywords = exports.insertContributors = exports.insertAbstract = exports.insertBackMatterSection = exports.insertSection = exports.insertGraphicalAbstract = exports.insertInlineFootnote = exports.insertInlineEquation = exports.insertCrossReference = exports.insertInlineCitation = exports.insertLink = exports.insertSectionLabel = exports.insertBreak = exports.deleteBlock = exports.insertBlock = exports.insertFileAsFigure = exports.insertGeneralFootnote = exports.createBlock = exports.createSelection = exports.canInsert = exports.blockActive = exports.isNodeSelection = exports.markActive = void 0;
|
|
18
|
+
exports.addRows = exports.insertTableFootnote = exports.addInlineComment = exports.addNodeComment = exports.createAndFillTableElement = exports.selectAllIsolating = exports.ignoreAtomBlockNodeForward = exports.isAtEndOfTextBlock = exports.ignoreMetaNodeBackspaceCommand = exports.ignoreAtomBlockNodeBackward = exports.isTextSelection = exports.isAtStartOfTextBlock = exports.insertTOCSection = exports.insertBibliographySection = exports.insertList = exports.insertKeywords = exports.insertContributors = exports.insertAbstract = exports.insertBackMatterSection = exports.insertSection = exports.insertGraphicalAbstract = exports.insertInlineFootnote = exports.insertInlineEquation = exports.insertCrossReference = exports.insertInlineCitation = exports.insertLink = exports.insertSectionLabel = exports.insertBreak = exports.deleteBlock = exports.insertBlock = exports.insertFileAsFigure = exports.insertGeneralFootnote = exports.createBlock = exports.createSelection = exports.canInsert = exports.blockActive = exports.isNodeSelection = exports.markActive = void 0;
|
|
19
19
|
const json_schema_1 = require("@manuscripts/json-schema");
|
|
20
20
|
const track_changes_plugin_1 = require("@manuscripts/track-changes-plugin");
|
|
21
21
|
const transform_1 = require("@manuscripts/transform");
|
|
22
22
|
const prosemirror_model_1 = require("prosemirror-model");
|
|
23
23
|
const prosemirror_schema_list_1 = require("prosemirror-schema-list");
|
|
24
24
|
const prosemirror_state_1 = require("prosemirror-state");
|
|
25
|
+
const prosemirror_tables_1 = require("prosemirror-tables");
|
|
25
26
|
const prosemirror_transform_1 = require("prosemirror-transform");
|
|
26
27
|
const prosemirror_utils_1 = require("prosemirror-utils");
|
|
27
28
|
const comments_1 = require("./lib/comments");
|
|
@@ -947,3 +948,19 @@ const insertTableFootnote = (node, position, view, inlineFootnote) => {
|
|
|
947
948
|
dispatch(view.state.tr.setSelection(textSelection).scrollIntoView());
|
|
948
949
|
};
|
|
949
950
|
exports.insertTableFootnote = insertTableFootnote;
|
|
951
|
+
const addRows = (direction) => (state, dispatch) => {
|
|
952
|
+
if (!(0, prosemirror_tables_1.isInTable)(state)) {
|
|
953
|
+
return false;
|
|
954
|
+
}
|
|
955
|
+
if (dispatch) {
|
|
956
|
+
const { tr } = state;
|
|
957
|
+
const rect = (0, prosemirror_tables_1.selectedRect)(state);
|
|
958
|
+
const selectedRows = rect.bottom - rect.top;
|
|
959
|
+
for (let i = 0; i < selectedRows; i++) {
|
|
960
|
+
(0, prosemirror_tables_1.addRow)(tr, rect, rect[direction]);
|
|
961
|
+
}
|
|
962
|
+
dispatch(tr);
|
|
963
|
+
}
|
|
964
|
+
return true;
|
|
965
|
+
};
|
|
966
|
+
exports.addRows = addRows;
|
|
@@ -32,19 +32,32 @@ const track_changes_plugin_1 = require("@manuscripts/track-changes-plugin");
|
|
|
32
32
|
const prosemirror_tables_1 = require("prosemirror-tables");
|
|
33
33
|
const react_1 = __importStar(require("react"));
|
|
34
34
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
35
|
+
const commands_1 = require("../../commands");
|
|
36
|
+
const getSelectedCells = (state) => {
|
|
37
|
+
const { selection } = state;
|
|
38
|
+
const selectedCells = { rows: 1 };
|
|
39
|
+
if (selection instanceof prosemirror_tables_1.CellSelection) {
|
|
40
|
+
const rect = (0, prosemirror_tables_1.selectedRect)(state);
|
|
41
|
+
selectedCells.rows = rect.bottom - rect.top;
|
|
42
|
+
}
|
|
43
|
+
return selectedCells;
|
|
44
|
+
};
|
|
35
45
|
const ContextMenu = ({ view, close, }) => {
|
|
36
46
|
const runCommand = (command, noTracking) => {
|
|
37
47
|
command(view.state, (tr) => view.dispatch((noTracking && (0, track_changes_plugin_1.skipTracking)(tr)) || tr));
|
|
38
48
|
close();
|
|
39
49
|
};
|
|
40
50
|
const [columnAction, setColumnAction] = (0, react_1.useState)(undefined);
|
|
51
|
+
const { rows } = getSelectedCells(view.state);
|
|
41
52
|
return (react_1.default.createElement(MenuDropdownList, null,
|
|
42
|
-
react_1.default.createElement(ActionButton, { onClick: () => runCommand(
|
|
53
|
+
react_1.default.createElement(ActionButton, { onClick: () => runCommand((0, commands_1.addRows)('top')) },
|
|
43
54
|
react_1.default.createElement(style_guide_1.PlusIcon, null),
|
|
44
|
-
" Insert row above"
|
|
45
|
-
|
|
55
|
+
" Insert row above ",
|
|
56
|
+
rows > 1 && rows),
|
|
57
|
+
react_1.default.createElement(ActionButton, { onClick: () => runCommand((0, commands_1.addRows)('bottom')) },
|
|
46
58
|
react_1.default.createElement(style_guide_1.PlusIcon, null),
|
|
47
|
-
" Insert row below"
|
|
59
|
+
" Insert row below ",
|
|
60
|
+
rows > 1 && rows),
|
|
48
61
|
react_1.default.createElement(ActionButton, { onClick: () => setColumnAction(() => prosemirror_tables_1.addColumnBefore) },
|
|
49
62
|
react_1.default.createElement(style_guide_1.PlusIcon, null),
|
|
50
63
|
" Insert column to the left"),
|
|
@@ -54,7 +67,8 @@ const ContextMenu = ({ view, close, }) => {
|
|
|
54
67
|
react_1.default.createElement(Separator, null),
|
|
55
68
|
react_1.default.createElement(ActionButton, { onClick: () => runCommand(prosemirror_tables_1.deleteRow) },
|
|
56
69
|
react_1.default.createElement(GrayDeleteIcon, null),
|
|
57
|
-
" Delete row"
|
|
70
|
+
" Delete row ",
|
|
71
|
+
rows > 1 && rows),
|
|
58
72
|
react_1.default.createElement(ActionButton, { onClick: () => setColumnAction(() => prosemirror_tables_1.deleteColumn) },
|
|
59
73
|
react_1.default.createElement(GrayDeleteIcon, null),
|
|
60
74
|
" Delete column"),
|
|
@@ -137,11 +137,7 @@ class ContextMenu {
|
|
|
137
137
|
}
|
|
138
138
|
}));
|
|
139
139
|
}
|
|
140
|
-
popper.show(target, menu, 'right', true
|
|
141
|
-
modifiers: {
|
|
142
|
-
offset: { offset: '0, 50%p' },
|
|
143
|
-
},
|
|
144
|
-
});
|
|
140
|
+
popper.show(target, menu, 'right', true);
|
|
145
141
|
this.addPopperEventListeners();
|
|
146
142
|
};
|
|
147
143
|
this.showEditMenu = (target) => {
|
|
@@ -276,11 +272,7 @@ class ContextMenu {
|
|
|
276
272
|
}));
|
|
277
273
|
}));
|
|
278
274
|
}
|
|
279
|
-
popper.show(target, menu, 'right', true
|
|
280
|
-
modifiers: {
|
|
281
|
-
offset: { offset: '0, 50%p' },
|
|
282
|
-
},
|
|
283
|
-
});
|
|
275
|
+
popper.show(target, menu, 'right', true);
|
|
284
276
|
this.addPopperEventListeners();
|
|
285
277
|
};
|
|
286
278
|
this.createMenuItem = (contents, handler) => {
|
package/dist/cjs/lib/popper.js
CHANGED
|
@@ -14,17 +14,14 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
-
};
|
|
20
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
18
|
exports.PopperManager = void 0;
|
|
22
|
-
const
|
|
19
|
+
const core_1 = require("@popperjs/core");
|
|
23
20
|
class PopperManager {
|
|
24
21
|
constructor() {
|
|
25
22
|
this.isActive = () => !!this.activePopper;
|
|
26
23
|
}
|
|
27
|
-
show(target, contents, placement = 'bottom', showArrow = true, modifiers =
|
|
24
|
+
show(target, contents, placement = 'bottom', showArrow = true, modifiers = []) {
|
|
28
25
|
this.destroy();
|
|
29
26
|
window.requestAnimationFrame(() => {
|
|
30
27
|
const container = document.createElement('div');
|
|
@@ -36,25 +33,27 @@ class PopperManager {
|
|
|
36
33
|
const arrow = document.createElement('div');
|
|
37
34
|
arrow.className = 'popper-arrow';
|
|
38
35
|
container.appendChild(arrow);
|
|
39
|
-
modifiers.
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
modifiers.push({
|
|
37
|
+
name: 'arrow',
|
|
38
|
+
options: {
|
|
39
|
+
element: arrow,
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
42
|
}
|
|
43
43
|
else {
|
|
44
|
-
modifiers.
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
modifiers.push({
|
|
45
|
+
name: 'arrow',
|
|
46
|
+
options: {
|
|
47
|
+
element: null,
|
|
48
|
+
},
|
|
49
|
+
});
|
|
47
50
|
}
|
|
48
|
-
modifiers.preventOverflow = {
|
|
49
|
-
escapeWithReference: true,
|
|
50
|
-
};
|
|
51
51
|
container.appendChild(contents);
|
|
52
52
|
document.body.appendChild(container);
|
|
53
|
-
this.activePopper =
|
|
53
|
+
this.activePopper = (0, core_1.createPopper)(target, container, {
|
|
54
54
|
placement,
|
|
55
|
-
removeOnDestroy: true,
|
|
56
55
|
modifiers,
|
|
57
|
-
|
|
56
|
+
onFirstUpdate: () => {
|
|
58
57
|
this.addContainerClass(target);
|
|
59
58
|
this.focusInput(container);
|
|
60
59
|
},
|
|
@@ -72,8 +71,10 @@ class PopperManager {
|
|
|
72
71
|
}
|
|
73
72
|
destroy() {
|
|
74
73
|
if (this.activePopper) {
|
|
75
|
-
|
|
74
|
+
console.log('destroying popper', this.activePopper, this.activePopper.state.elements.reference);
|
|
75
|
+
this.removeContainerClass(this.activePopper.state.elements.reference);
|
|
76
76
|
this.activePopper.destroy();
|
|
77
|
+
this.activePopper.state.elements.popper.remove();
|
|
77
78
|
if (this.handleDocumentClick) {
|
|
78
79
|
window.removeEventListener('click', this.handleDocumentClick);
|
|
79
80
|
}
|
|
@@ -61,8 +61,7 @@ class TableCellView extends block_view_1.default {
|
|
|
61
61
|
}
|
|
62
62
|
else {
|
|
63
63
|
if (!(this.view.state.selection instanceof prosemirror_tables_1.CellSelection &&
|
|
64
|
-
|
|
65
|
-
this.getPos() === this.view.state.selection.$headCell.pos))) {
|
|
64
|
+
!!this.view.state.selection.ranges.find((range) => range.$from.pos === this.getPos() + 1))) {
|
|
66
65
|
this.view.dispatch(this.view.state.tr.setSelection(prosemirror_state_1.TextSelection.create(this.view.state.doc, this.getPos())));
|
|
67
66
|
this.view.focus();
|
|
68
67
|
}
|
package/dist/es/commands.js
CHANGED
|
@@ -19,6 +19,7 @@ import { generateID, isElementNodeType, isFootnoteNode, isInBibliographySection,
|
|
|
19
19
|
import { Fragment, NodeRange, } from 'prosemirror-model';
|
|
20
20
|
import { wrapInList } from 'prosemirror-schema-list';
|
|
21
21
|
import { NodeSelection, TextSelection, } from 'prosemirror-state';
|
|
22
|
+
import { addRow, isInTable, selectedRect } from 'prosemirror-tables';
|
|
22
23
|
import { findWrapping, liftTarget, ReplaceAroundStep, } from 'prosemirror-transform';
|
|
23
24
|
import { findChildrenByType, findParentNodeOfType, findParentNodeOfTypeClosestToPos, } from 'prosemirror-utils';
|
|
24
25
|
import { getCommentKey, getCommentRange } from './lib/comments';
|
|
@@ -907,3 +908,18 @@ export const insertTableFootnote = (node, position, view, inlineFootnote) => {
|
|
|
907
908
|
view.focus();
|
|
908
909
|
dispatch(view.state.tr.setSelection(textSelection).scrollIntoView());
|
|
909
910
|
};
|
|
911
|
+
export const addRows = (direction) => (state, dispatch) => {
|
|
912
|
+
if (!isInTable(state)) {
|
|
913
|
+
return false;
|
|
914
|
+
}
|
|
915
|
+
if (dispatch) {
|
|
916
|
+
const { tr } = state;
|
|
917
|
+
const rect = selectedRect(state);
|
|
918
|
+
const selectedRows = rect.bottom - rect.top;
|
|
919
|
+
for (let i = 0; i < selectedRows; i++) {
|
|
920
|
+
addRow(tr, rect, rect[direction]);
|
|
921
|
+
}
|
|
922
|
+
dispatch(tr);
|
|
923
|
+
}
|
|
924
|
+
return true;
|
|
925
|
+
};
|
|
@@ -1,21 +1,34 @@
|
|
|
1
1
|
import { ColumnChangeWarningDialog, DeleteIcon, IconTextButton, PlusIcon, } from '@manuscripts/style-guide';
|
|
2
2
|
import { skipTracking } from '@manuscripts/track-changes-plugin';
|
|
3
|
-
import { addColumnAfter, addColumnBefore,
|
|
3
|
+
import { addColumnAfter, addColumnBefore, CellSelection, deleteColumn, deleteRow, selectedRect, } from 'prosemirror-tables';
|
|
4
4
|
import React, { useState } from 'react';
|
|
5
5
|
import styled from 'styled-components';
|
|
6
|
+
import { addRows } from '../../commands';
|
|
7
|
+
const getSelectedCells = (state) => {
|
|
8
|
+
const { selection } = state;
|
|
9
|
+
const selectedCells = { rows: 1 };
|
|
10
|
+
if (selection instanceof CellSelection) {
|
|
11
|
+
const rect = selectedRect(state);
|
|
12
|
+
selectedCells.rows = rect.bottom - rect.top;
|
|
13
|
+
}
|
|
14
|
+
return selectedCells;
|
|
15
|
+
};
|
|
6
16
|
export const ContextMenu = ({ view, close, }) => {
|
|
7
17
|
const runCommand = (command, noTracking) => {
|
|
8
18
|
command(view.state, (tr) => view.dispatch((noTracking && skipTracking(tr)) || tr));
|
|
9
19
|
close();
|
|
10
20
|
};
|
|
11
21
|
const [columnAction, setColumnAction] = useState(undefined);
|
|
22
|
+
const { rows } = getSelectedCells(view.state);
|
|
12
23
|
return (React.createElement(MenuDropdownList, null,
|
|
13
|
-
React.createElement(ActionButton, { onClick: () => runCommand(
|
|
24
|
+
React.createElement(ActionButton, { onClick: () => runCommand(addRows('top')) },
|
|
14
25
|
React.createElement(PlusIcon, null),
|
|
15
|
-
" Insert row above"
|
|
16
|
-
|
|
26
|
+
" Insert row above ",
|
|
27
|
+
rows > 1 && rows),
|
|
28
|
+
React.createElement(ActionButton, { onClick: () => runCommand(addRows('bottom')) },
|
|
17
29
|
React.createElement(PlusIcon, null),
|
|
18
|
-
" Insert row below"
|
|
30
|
+
" Insert row below ",
|
|
31
|
+
rows > 1 && rows),
|
|
19
32
|
React.createElement(ActionButton, { onClick: () => setColumnAction(() => addColumnBefore) },
|
|
20
33
|
React.createElement(PlusIcon, null),
|
|
21
34
|
" Insert column to the left"),
|
|
@@ -25,7 +38,8 @@ export const ContextMenu = ({ view, close, }) => {
|
|
|
25
38
|
React.createElement(Separator, null),
|
|
26
39
|
React.createElement(ActionButton, { onClick: () => runCommand(deleteRow) },
|
|
27
40
|
React.createElement(GrayDeleteIcon, null),
|
|
28
|
-
" Delete row"
|
|
41
|
+
" Delete row ",
|
|
42
|
+
rows > 1 && rows),
|
|
29
43
|
React.createElement(ActionButton, { onClick: () => setColumnAction(() => deleteColumn) },
|
|
30
44
|
React.createElement(GrayDeleteIcon, null),
|
|
31
45
|
" Delete column"),
|
|
@@ -130,11 +130,7 @@ export class ContextMenu {
|
|
|
130
130
|
}
|
|
131
131
|
}));
|
|
132
132
|
}
|
|
133
|
-
popper.show(target, menu, 'right', true
|
|
134
|
-
modifiers: {
|
|
135
|
-
offset: { offset: '0, 50%p' },
|
|
136
|
-
},
|
|
137
|
-
});
|
|
133
|
+
popper.show(target, menu, 'right', true);
|
|
138
134
|
this.addPopperEventListeners();
|
|
139
135
|
};
|
|
140
136
|
this.showEditMenu = (target) => {
|
|
@@ -269,11 +265,7 @@ export class ContextMenu {
|
|
|
269
265
|
}));
|
|
270
266
|
}));
|
|
271
267
|
}
|
|
272
|
-
popper.show(target, menu, 'right', true
|
|
273
|
-
modifiers: {
|
|
274
|
-
offset: { offset: '0, 50%p' },
|
|
275
|
-
},
|
|
276
|
-
});
|
|
268
|
+
popper.show(target, menu, 'right', true);
|
|
277
269
|
this.addPopperEventListeners();
|
|
278
270
|
};
|
|
279
271
|
this.createMenuItem = (contents, handler) => {
|
package/dist/es/lib/popper.js
CHANGED
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import
|
|
16
|
+
import { createPopper, } from '@popperjs/core';
|
|
17
17
|
export class PopperManager {
|
|
18
18
|
constructor() {
|
|
19
19
|
this.isActive = () => !!this.activePopper;
|
|
20
20
|
}
|
|
21
|
-
show(target, contents, placement = 'bottom', showArrow = true, modifiers =
|
|
21
|
+
show(target, contents, placement = 'bottom', showArrow = true, modifiers = []) {
|
|
22
22
|
this.destroy();
|
|
23
23
|
window.requestAnimationFrame(() => {
|
|
24
24
|
const container = document.createElement('div');
|
|
@@ -30,25 +30,27 @@ export class PopperManager {
|
|
|
30
30
|
const arrow = document.createElement('div');
|
|
31
31
|
arrow.className = 'popper-arrow';
|
|
32
32
|
container.appendChild(arrow);
|
|
33
|
-
modifiers.
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
modifiers.push({
|
|
34
|
+
name: 'arrow',
|
|
35
|
+
options: {
|
|
36
|
+
element: arrow,
|
|
37
|
+
},
|
|
38
|
+
});
|
|
36
39
|
}
|
|
37
40
|
else {
|
|
38
|
-
modifiers.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
+
modifiers.push({
|
|
42
|
+
name: 'arrow',
|
|
43
|
+
options: {
|
|
44
|
+
element: null,
|
|
45
|
+
},
|
|
46
|
+
});
|
|
41
47
|
}
|
|
42
|
-
modifiers.preventOverflow = {
|
|
43
|
-
escapeWithReference: true,
|
|
44
|
-
};
|
|
45
48
|
container.appendChild(contents);
|
|
46
49
|
document.body.appendChild(container);
|
|
47
|
-
this.activePopper =
|
|
50
|
+
this.activePopper = createPopper(target, container, {
|
|
48
51
|
placement,
|
|
49
|
-
removeOnDestroy: true,
|
|
50
52
|
modifiers,
|
|
51
|
-
|
|
53
|
+
onFirstUpdate: () => {
|
|
52
54
|
this.addContainerClass(target);
|
|
53
55
|
this.focusInput(container);
|
|
54
56
|
},
|
|
@@ -66,8 +68,10 @@ export class PopperManager {
|
|
|
66
68
|
}
|
|
67
69
|
destroy() {
|
|
68
70
|
if (this.activePopper) {
|
|
69
|
-
|
|
71
|
+
console.log('destroying popper', this.activePopper, this.activePopper.state.elements.reference);
|
|
72
|
+
this.removeContainerClass(this.activePopper.state.elements.reference);
|
|
70
73
|
this.activePopper.destroy();
|
|
74
|
+
this.activePopper.state.elements.popper.remove();
|
|
71
75
|
if (this.handleDocumentClick) {
|
|
72
76
|
window.removeEventListener('click', this.handleDocumentClick);
|
|
73
77
|
}
|
|
@@ -55,8 +55,7 @@ export class TableCellView extends BlockView {
|
|
|
55
55
|
}
|
|
56
56
|
else {
|
|
57
57
|
if (!(this.view.state.selection instanceof CellSelection &&
|
|
58
|
-
|
|
59
|
-
this.getPos() === this.view.state.selection.$headCell.pos))) {
|
|
58
|
+
!!this.view.state.selection.ranges.find((range) => range.$from.pos === this.getPos() + 1))) {
|
|
60
59
|
this.view.dispatch(this.view.state.tr.setSelection(TextSelection.create(this.view.state.doc, this.getPos())));
|
|
61
60
|
this.view.focus();
|
|
62
61
|
}
|
package/dist/types/commands.d.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import { FileAttachment, TableConfig } from '@manuscripts/style-guide';
|
|
17
17
|
import { InlineFootnoteNode, ManuscriptEditorState, ManuscriptEditorView, ManuscriptMarkType, ManuscriptNode, ManuscriptNodeType, ManuscriptTransaction } from '@manuscripts/transform';
|
|
18
18
|
import { Attrs, ResolvedPos } from 'prosemirror-model';
|
|
19
|
-
import { NodeSelection, Selection, TextSelection, Transaction } from 'prosemirror-state';
|
|
19
|
+
import { EditorState, NodeSelection, Selection, TextSelection, Transaction } from 'prosemirror-state';
|
|
20
20
|
import { NodeWithPos } from 'prosemirror-utils';
|
|
21
21
|
import { EditorView } from 'prosemirror-view';
|
|
22
22
|
import { EditorAction } from './types';
|
|
@@ -62,4 +62,5 @@ interface NodeWithPosition {
|
|
|
62
62
|
pos: number;
|
|
63
63
|
}
|
|
64
64
|
export declare const insertTableFootnote: (node: ManuscriptNode, position: number, view: EditorView, inlineFootnote?: NodeWithPosition) => void;
|
|
65
|
+
export declare const addRows: (direction: 'top' | 'bottom') => (state: EditorState, dispatch?: ((tr: Transaction) => void) | undefined) => boolean;
|
|
65
66
|
export {};
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import
|
|
16
|
+
import { Placement, StrictModifiers } from '@popperjs/core';
|
|
17
17
|
export declare class PopperManager {
|
|
18
18
|
private activePopper?;
|
|
19
19
|
private handleDocumentClick?;
|
|
20
|
-
show(target: Element, contents: HTMLElement, placement?:
|
|
20
|
+
show(target: Element, contents: HTMLElement, placement?: Placement, showArrow?: boolean, modifiers?: Array<Partial<StrictModifiers>>): void;
|
|
21
21
|
destroy(): void;
|
|
22
22
|
update(): void;
|
|
23
23
|
isActive: () => boolean;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manuscripts/body-editor",
|
|
3
3
|
"description": "Prosemirror components for editing and viewing manuscripts",
|
|
4
|
-
"version": "1.13.
|
|
4
|
+
"version": "1.13.19",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -33,14 +33,14 @@
|
|
|
33
33
|
"@manuscripts/style-guide": "1.13.12",
|
|
34
34
|
"@manuscripts/track-changes-plugin": "1.7.14",
|
|
35
35
|
"@manuscripts/transform": "2.3.19",
|
|
36
|
+
"@popperjs/core": "^2.11.8",
|
|
36
37
|
"astrocite-eutils": "^0.16.4",
|
|
37
|
-
"mathjax-full": "^3.2.2",
|
|
38
38
|
"codemirror": "^5.58.1",
|
|
39
39
|
"dompurify": "^2.4.1",
|
|
40
40
|
"formik": "^2.2.9",
|
|
41
41
|
"grapheme-splitter": "^1.0.4",
|
|
42
42
|
"history": "^4.10.1",
|
|
43
|
-
"
|
|
43
|
+
"mathjax-full": "^3.2.2",
|
|
44
44
|
"prosemirror-collab": "^1.3.1",
|
|
45
45
|
"prosemirror-commands": "^1.5.0",
|
|
46
46
|
"prosemirror-dropcursor": "^1.6.1",
|
|
@@ -551,12 +551,14 @@ span.comment-marker {
|
|
|
551
551
|
font-family: Lato, sans-serif;
|
|
552
552
|
font-size: 14px;
|
|
553
553
|
line-height: 16px;
|
|
554
|
-
margin-bottom: 4px;
|
|
555
554
|
border: 1px solid transparent;
|
|
556
555
|
border-radius: 6px;
|
|
557
556
|
position: relative;
|
|
558
557
|
cursor: default;
|
|
559
558
|
padding: 4px 8px;
|
|
559
|
+
border: 1px solid #C9C9C9;
|
|
560
|
+
margin-top: 10px;
|
|
561
|
+
margin-bottom: 4px;
|
|
560
562
|
}
|
|
561
563
|
|
|
562
564
|
.keywords .selected-suggestion {
|
|
@@ -987,4 +989,4 @@ span.accepted .selected-suggestion,
|
|
|
987
989
|
|
|
988
990
|
.ProseMirror td:hover > .table-context-menu-button, th:hover > .table-context-menu-button, .open-context-menu {
|
|
989
991
|
visibility: visible !important;
|
|
990
|
-
}
|
|
992
|
+
}
|
package/styles/popper.css
CHANGED
|
@@ -14,47 +14,42 @@
|
|
|
14
14
|
border: 5px solid transparent;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
.popper[
|
|
17
|
+
.popper[data-popper-placement='bottom'] .popper-arrow {
|
|
18
18
|
top: -5px;
|
|
19
19
|
left: calc(50% - 5px);
|
|
20
20
|
border-bottom-color: #e2e2e2;
|
|
21
21
|
border-top-width: 0;
|
|
22
|
-
margin: 0 5px;
|
|
23
22
|
}
|
|
24
23
|
|
|
25
|
-
.popper[
|
|
24
|
+
.popper[data-popper-placement='top'] .popper-arrow {
|
|
26
25
|
bottom: -5px;
|
|
27
26
|
left: calc(50% - 5px);
|
|
28
27
|
border-top-color: #e2e2e2;
|
|
29
28
|
border-bottom-width: 0;
|
|
30
|
-
margin: 0 5px;
|
|
31
29
|
}
|
|
32
30
|
|
|
33
|
-
.popper[
|
|
31
|
+
.popper[data-popper-placement='left'] .popper-arrow {
|
|
34
32
|
right: -5px;
|
|
35
33
|
top: calc(50% - 5px);
|
|
36
34
|
border-left-color: #e2e2e2;
|
|
37
35
|
border-right-width: 0;
|
|
38
|
-
margin: 5px 0;
|
|
39
36
|
}
|
|
40
37
|
|
|
41
|
-
.popper[
|
|
38
|
+
.popper[data-popper-placement='right'] .popper-arrow {
|
|
42
39
|
left: -5px;
|
|
43
40
|
top: calc(50% - 5px);
|
|
44
41
|
border-right-color: #e2e2e2;
|
|
45
42
|
border-left-width: 0;
|
|
46
|
-
margin: 5px 0;
|
|
47
43
|
}
|
|
48
44
|
|
|
49
|
-
.popper[
|
|
45
|
+
.popper[data-popper-placement='bottom-start'] .popper-arrow {
|
|
50
46
|
top: -5px;
|
|
51
47
|
left: calc(50% - 5px);
|
|
52
48
|
border-bottom-color: #e2e2e2;
|
|
53
49
|
border-top-width: 0;
|
|
54
|
-
margin: 0 5px;
|
|
55
50
|
}
|
|
56
51
|
|
|
57
|
-
/*.popper[
|
|
52
|
+
/*.popper[data-popper-placement="right-end"] .popper-arrow {
|
|
58
53
|
left: -5px;
|
|
59
54
|
top: 5px;
|
|
60
55
|
border-right-color: #eee;
|