@manuscripts/body-editor 2.0.46 → 2.0.47
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/components/views/TableCellContextMenu.js +6 -3
- package/dist/cjs/versions.js +1 -1
- package/dist/cjs/views/table_cell.js +17 -0
- package/dist/es/components/views/TableCellContextMenu.js +6 -3
- package/dist/es/versions.js +1 -1
- package/dist/es/views/table_cell.js +17 -0
- package/dist/types/components/views/TableCellContextMenu.d.ts +1 -0
- package/dist/types/versions.d.ts +1 -1
- package/dist/types/views/table_cell.d.ts +1 -0
- package/package.json +2 -2
|
@@ -57,7 +57,7 @@ const ColumnChangeWarningDialog = ({ isOpen, primaryAction, secondaryAction }) =
|
|
|
57
57
|
title: 'Cancel',
|
|
58
58
|
},
|
|
59
59
|
} }));
|
|
60
|
-
const ContextMenu = ({ view, close, }) => {
|
|
60
|
+
const ContextMenu = ({ view, close, onCancelColumnDialog }) => {
|
|
61
61
|
const runCommand = (command, noTracking) => {
|
|
62
62
|
command(view.state, (tr) => view.dispatch((noTracking && (0, track_changes_plugin_1.skipTracking)(tr)) || tr));
|
|
63
63
|
close();
|
|
@@ -66,7 +66,7 @@ const ContextMenu = ({ view, close, }) => {
|
|
|
66
66
|
const isCellSelectionMerged = (0, prosemirror_tables_1.mergeCells)(view.state);
|
|
67
67
|
const isCellSelectionSplittable = (0, prosemirror_tables_1.splitCell)(view.state);
|
|
68
68
|
const { rows, columns } = getSelectedCellsCount(view.state);
|
|
69
|
-
return (react_1.default.createElement(MenuDropdownList,
|
|
69
|
+
return (react_1.default.createElement(MenuDropdownList, { className: 'table-ctx' },
|
|
70
70
|
react_1.default.createElement(ActionButton, { onClick: () => runCommand((0, commands_1.addRows)('top')) },
|
|
71
71
|
react_1.default.createElement(style_guide_1.PlusIcon, null),
|
|
72
72
|
" Insert ",
|
|
@@ -104,7 +104,10 @@ const ContextMenu = ({ view, close, }) => {
|
|
|
104
104
|
runCommand(columnAction, true);
|
|
105
105
|
setColumnAction(undefined);
|
|
106
106
|
}
|
|
107
|
-
}, secondaryAction: () =>
|
|
107
|
+
}, secondaryAction: () => {
|
|
108
|
+
setColumnAction(undefined);
|
|
109
|
+
onCancelColumnDialog();
|
|
110
|
+
} })));
|
|
108
111
|
};
|
|
109
112
|
exports.ContextMenu = ContextMenu;
|
|
110
113
|
const MenuDropdownList = styled_components_1.default.div `
|
package/dist/cjs/versions.js
CHANGED
|
@@ -77,9 +77,11 @@ class TableCellView extends block_view_1.default {
|
|
|
77
77
|
this.props.popper.destroy();
|
|
78
78
|
contextMenuButton.classList.toggle('open-context-menu');
|
|
79
79
|
},
|
|
80
|
+
onCancelColumnDialog: () => this.addOutClickListener(contextMenuButton),
|
|
80
81
|
}, this.view.state.selection.$from.node(), this.getPos, this.view, 'table-cell-context-menu');
|
|
81
82
|
contextMenuButton.classList.toggle('open-context-menu');
|
|
82
83
|
this.props.popper.show(contextMenuButton, contextMenu, 'right', false);
|
|
84
|
+
this.addOutClickListener(contextMenuButton);
|
|
83
85
|
}
|
|
84
86
|
});
|
|
85
87
|
this.dom.appendChild(contextMenuButton);
|
|
@@ -93,6 +95,21 @@ class TableCellView extends block_view_1.default {
|
|
|
93
95
|
const outputSpec = this.node.type.spec.toDOM(this.node);
|
|
94
96
|
return prosemirror_model_1.DOMSerializer.renderSpec(document, outputSpec).dom;
|
|
95
97
|
}
|
|
98
|
+
addOutClickListener(contextMenuButton) {
|
|
99
|
+
const listener = (event) => {
|
|
100
|
+
var _a;
|
|
101
|
+
const target = event.target;
|
|
102
|
+
if (!target.classList.contains('open-context-menu') &&
|
|
103
|
+
!((_a = target.parentNode) === null || _a === void 0 ? void 0 : _a.classList.contains('table-ctx'))) {
|
|
104
|
+
this.props.popper.destroy();
|
|
105
|
+
contextMenuButton.classList.toggle('open-context-menu');
|
|
106
|
+
}
|
|
107
|
+
window.removeEventListener('mousedown', listener);
|
|
108
|
+
window.removeEventListener('keydown', listener);
|
|
109
|
+
};
|
|
110
|
+
window.addEventListener('mousedown', listener);
|
|
111
|
+
window.addEventListener('keydown', listener);
|
|
112
|
+
}
|
|
96
113
|
}
|
|
97
114
|
exports.TableCellView = TableCellView;
|
|
98
115
|
exports.default = (0, creators_1.createNodeView)(TableCellView);
|
|
@@ -28,7 +28,7 @@ const ColumnChangeWarningDialog = ({ isOpen, primaryAction, secondaryAction }) =
|
|
|
28
28
|
title: 'Cancel',
|
|
29
29
|
},
|
|
30
30
|
} }));
|
|
31
|
-
export const ContextMenu = ({ view, close, }) => {
|
|
31
|
+
export const ContextMenu = ({ view, close, onCancelColumnDialog }) => {
|
|
32
32
|
const runCommand = (command, noTracking) => {
|
|
33
33
|
command(view.state, (tr) => view.dispatch((noTracking && skipTracking(tr)) || tr));
|
|
34
34
|
close();
|
|
@@ -37,7 +37,7 @@ export const ContextMenu = ({ view, close, }) => {
|
|
|
37
37
|
const isCellSelectionMerged = mergeCells(view.state);
|
|
38
38
|
const isCellSelectionSplittable = splitCell(view.state);
|
|
39
39
|
const { rows, columns } = getSelectedCellsCount(view.state);
|
|
40
|
-
return (React.createElement(MenuDropdownList,
|
|
40
|
+
return (React.createElement(MenuDropdownList, { className: 'table-ctx' },
|
|
41
41
|
React.createElement(ActionButton, { onClick: () => runCommand(addRows('top')) },
|
|
42
42
|
React.createElement(PlusIcon, null),
|
|
43
43
|
" Insert ",
|
|
@@ -75,7 +75,10 @@ export const ContextMenu = ({ view, close, }) => {
|
|
|
75
75
|
runCommand(columnAction, true);
|
|
76
76
|
setColumnAction(undefined);
|
|
77
77
|
}
|
|
78
|
-
}, secondaryAction: () =>
|
|
78
|
+
}, secondaryAction: () => {
|
|
79
|
+
setColumnAction(undefined);
|
|
80
|
+
onCancelColumnDialog();
|
|
81
|
+
} })));
|
|
79
82
|
};
|
|
80
83
|
const MenuDropdownList = styled.div `
|
|
81
84
|
display: flex;
|
package/dist/es/versions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '2.0.
|
|
1
|
+
export const VERSION = '2.0.47';
|
|
2
2
|
export const MATHJAX_VERSION = '3.2.2';
|
|
@@ -71,9 +71,11 @@ export class TableCellView extends BlockView {
|
|
|
71
71
|
this.props.popper.destroy();
|
|
72
72
|
contextMenuButton.classList.toggle('open-context-menu');
|
|
73
73
|
},
|
|
74
|
+
onCancelColumnDialog: () => this.addOutClickListener(contextMenuButton),
|
|
74
75
|
}, this.view.state.selection.$from.node(), this.getPos, this.view, 'table-cell-context-menu');
|
|
75
76
|
contextMenuButton.classList.toggle('open-context-menu');
|
|
76
77
|
this.props.popper.show(contextMenuButton, contextMenu, 'right', false);
|
|
78
|
+
this.addOutClickListener(contextMenuButton);
|
|
77
79
|
}
|
|
78
80
|
});
|
|
79
81
|
this.dom.appendChild(contextMenuButton);
|
|
@@ -87,5 +89,20 @@ export class TableCellView extends BlockView {
|
|
|
87
89
|
const outputSpec = this.node.type.spec.toDOM(this.node);
|
|
88
90
|
return DOMSerializer.renderSpec(document, outputSpec).dom;
|
|
89
91
|
}
|
|
92
|
+
addOutClickListener(contextMenuButton) {
|
|
93
|
+
const listener = (event) => {
|
|
94
|
+
var _a;
|
|
95
|
+
const target = event.target;
|
|
96
|
+
if (!target.classList.contains('open-context-menu') &&
|
|
97
|
+
!((_a = target.parentNode) === null || _a === void 0 ? void 0 : _a.classList.contains('table-ctx'))) {
|
|
98
|
+
this.props.popper.destroy();
|
|
99
|
+
contextMenuButton.classList.toggle('open-context-menu');
|
|
100
|
+
}
|
|
101
|
+
window.removeEventListener('mousedown', listener);
|
|
102
|
+
window.removeEventListener('keydown', listener);
|
|
103
|
+
};
|
|
104
|
+
window.addEventListener('mousedown', listener);
|
|
105
|
+
window.addEventListener('keydown', listener);
|
|
106
|
+
}
|
|
90
107
|
}
|
|
91
108
|
export default createNodeView(TableCellView);
|
package/dist/types/versions.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "2.0.
|
|
1
|
+
export declare const VERSION = "2.0.47";
|
|
2
2
|
export declare const MATHJAX_VERSION = "3.2.2";
|
|
@@ -22,6 +22,7 @@ export declare class TableCellView extends BlockView<ManuscriptNode> {
|
|
|
22
22
|
updateContents: () => void;
|
|
23
23
|
private createContextMenu;
|
|
24
24
|
private toDom;
|
|
25
|
+
private addOutClickListener;
|
|
25
26
|
}
|
|
26
27
|
declare const _default: (props: import("./base_node_view").BaseNodeProps, dispatch?: import("..").Dispatch | undefined) => import("../types").NodeViewCreator<TableCellView>;
|
|
27
28
|
export default _default;
|
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": "2.0.
|
|
4
|
+
"version": "2.0.47",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -116,4 +116,4 @@
|
|
|
116
116
|
"engines": {
|
|
117
117
|
"node": ">=20.16.0"
|
|
118
118
|
}
|
|
119
|
-
}
|
|
119
|
+
}
|