@manuscripts/body-editor 1.9.20-LEAN-3535.0 → 1.9.20
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/lib/popper.js +2 -13
- package/dist/cjs/plugins/selected-suggestion-ui.js +0 -1
- package/dist/cjs/views/bibliography_element.js +12 -4
- package/dist/cjs/views/citation.js +0 -8
- package/dist/cjs/views/citation_editable.js +9 -9
- package/dist/cjs/views/contributors.js +2 -1
- package/dist/cjs/views/cross_reference_editable.js +1 -1
- package/dist/es/lib/popper.js +2 -13
- package/dist/es/plugins/selected-suggestion-ui.js +0 -1
- package/dist/es/views/bibliography_element.js +12 -4
- package/dist/es/views/citation.js +0 -8
- package/dist/es/views/citation_editable.js +10 -10
- package/dist/es/views/contributors.js +2 -1
- package/dist/es/views/cross_reference_editable.js +1 -1
- package/dist/types/lib/popper.d.ts +0 -1
- package/dist/types/views/bibliography_element.d.ts +1 -0
- package/dist/types/views/citation.d.ts +0 -2
- package/dist/types/views/citation_editable.d.ts +2 -1
- package/package.json +1 -1
- package/styles/popper.css +5 -0
package/dist/cjs/lib/popper.js
CHANGED
|
@@ -22,10 +22,8 @@ exports.PopperManager = void 0;
|
|
|
22
22
|
const popper_js_1 = __importDefault(require("popper.js"));
|
|
23
23
|
class PopperManager {
|
|
24
24
|
show(target, contents, placement = 'bottom', showArrow = true, modifiers = {}) {
|
|
25
|
-
this.
|
|
26
|
-
|
|
27
|
-
this.clickEventHandler = this.clickEventHandler.bind(this);
|
|
28
|
-
document.body.addEventListener('click', this.clickEventHandler);
|
|
25
|
+
if (this.activePopper) {
|
|
26
|
+
return this.destroy();
|
|
29
27
|
}
|
|
30
28
|
window.requestAnimationFrame(() => {
|
|
31
29
|
const container = document.createElement('div');
|
|
@@ -59,17 +57,8 @@ class PopperManager {
|
|
|
59
57
|
});
|
|
60
58
|
});
|
|
61
59
|
}
|
|
62
|
-
clickEventHandler(event) {
|
|
63
|
-
const editorElement = document.querySelector('.manuscript-editor');
|
|
64
|
-
const contextMenuElement = document.querySelector('.context-menu');
|
|
65
|
-
if (!(editorElement === null || editorElement === void 0 ? void 0 : editorElement.contains(event.target)) &&
|
|
66
|
-
!(contextMenuElement === null || contextMenuElement === void 0 ? void 0 : contextMenuElement.contains(event.target))) {
|
|
67
|
-
this.destroy();
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
60
|
destroy() {
|
|
71
61
|
if (this.activePopper) {
|
|
72
|
-
document.body.removeEventListener('click', this.clickEventHandler);
|
|
73
62
|
this.removeContainerClass(this.activePopper.reference);
|
|
74
63
|
this.activePopper.destroy();
|
|
75
64
|
delete this.activePopper;
|
|
@@ -69,7 +69,6 @@ class SuggestionView {
|
|
|
69
69
|
if ((_b = (_a = dom.parentElement) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.classList.contains('keyword')) {
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
|
-
console.log(dom);
|
|
73
72
|
dom.addEventListener('click', this.listener);
|
|
74
73
|
});
|
|
75
74
|
}
|
|
@@ -45,7 +45,9 @@ const ReactSubView_1 = __importDefault(require("./ReactSubView"));
|
|
|
45
45
|
class BibliographyElementBlockView extends block_view_1.default {
|
|
46
46
|
constructor() {
|
|
47
47
|
super(...arguments);
|
|
48
|
+
this.clickedElementId = null;
|
|
48
49
|
this.showPopper = (id) => {
|
|
50
|
+
this.props.popper.destroy();
|
|
49
51
|
const bib = (0, bibliography_1.getBibliographyPluginState)(this.view.state);
|
|
50
52
|
if (!bib) {
|
|
51
53
|
return;
|
|
@@ -69,6 +71,8 @@ class BibliographyElementBlockView extends block_view_1.default {
|
|
|
69
71
|
this.props.setComment((0, transform_1.buildComment)(citationId));
|
|
70
72
|
};
|
|
71
73
|
this.showContextMenu = (elementId) => {
|
|
74
|
+
this.props.popper.destroy();
|
|
75
|
+
this.clickedElementId = null;
|
|
72
76
|
const can = this.props.getCapabilities();
|
|
73
77
|
const element = document.getElementById(elementId);
|
|
74
78
|
const componentProps = {
|
|
@@ -91,6 +95,7 @@ class BibliographyElementBlockView extends block_view_1.default {
|
|
|
91
95
|
};
|
|
92
96
|
this.onClickHandler = (elementId, dataTracked) => {
|
|
93
97
|
var _a;
|
|
98
|
+
this.clickedElementId = elementId;
|
|
94
99
|
const isSelectedSuggestion = !!((_a = selected_suggestion_ui_1.selectedSuggestionKey
|
|
95
100
|
.getState(this.view.state)) === null || _a === void 0 ? void 0 : _a.find(this.getPos(), this.getPos() + this.node.nodeSize).length);
|
|
96
101
|
const { tr, doc } = this.view.state;
|
|
@@ -102,9 +107,11 @@ class BibliographyElementBlockView extends block_view_1.default {
|
|
|
102
107
|
if (isSelectedSuggestion) {
|
|
103
108
|
tr.setMeta(selected_suggestion_ui_1.CLEAR_SUGGESTION_ID, true);
|
|
104
109
|
}
|
|
110
|
+
else {
|
|
111
|
+
this.showContextMenu(elementId);
|
|
112
|
+
}
|
|
105
113
|
}
|
|
106
114
|
this.view.dispatch(tr);
|
|
107
|
-
this.showContextMenu(elementId);
|
|
108
115
|
};
|
|
109
116
|
this.updateContents = () => __awaiter(this, void 0, void 0, function* () {
|
|
110
117
|
this.props.popper.destroy();
|
|
@@ -157,9 +164,7 @@ class BibliographyElementBlockView extends block_view_1.default {
|
|
|
157
164
|
element.classList.add('selected-suggestion');
|
|
158
165
|
}
|
|
159
166
|
if (can.seeReferencesButtons) {
|
|
160
|
-
element.addEventListener('click', () =>
|
|
161
|
-
this.onClickHandler(element.id, dataTracked);
|
|
162
|
-
});
|
|
167
|
+
element.addEventListener('click', () => this.onClickHandler(element.id, dataTracked));
|
|
163
168
|
}
|
|
164
169
|
wrapper.append(element);
|
|
165
170
|
}
|
|
@@ -170,6 +175,9 @@ class BibliographyElementBlockView extends block_view_1.default {
|
|
|
170
175
|
else {
|
|
171
176
|
this.container.appendChild(wrapper);
|
|
172
177
|
}
|
|
178
|
+
if (this.clickedElementId) {
|
|
179
|
+
this.showContextMenu(this.clickedElementId);
|
|
180
|
+
}
|
|
173
181
|
});
|
|
174
182
|
this.createElement = () => {
|
|
175
183
|
this.container = document.createElement('div');
|
|
@@ -27,7 +27,6 @@ class CitationView extends base_node_view_1.BaseNodeView {
|
|
|
27
27
|
constructor() {
|
|
28
28
|
super(...arguments);
|
|
29
29
|
this.ignoreMutation = () => true;
|
|
30
|
-
this.wasUpdated = false;
|
|
31
30
|
this.initialise = () => {
|
|
32
31
|
if (!this.node.type.spec.toDOM) {
|
|
33
32
|
throw Error(`Node view ${this.node.type} doesn't have toDOM method`);
|
|
@@ -60,13 +59,6 @@ class CitationView extends base_node_view_1.BaseNodeView {
|
|
|
60
59
|
this.dom.appendChild(element);
|
|
61
60
|
(0, comment_annotation_1.addCommentToLeafNode)(this.getPos(), this.getPos() + this.node.nodeSize, this.view.state, this.dom);
|
|
62
61
|
this.setDomAttrs(this.node, this.dom, ['rids', 'contents', 'selectedText']);
|
|
63
|
-
if (!this.wasUpdated) {
|
|
64
|
-
this.dom.addEventListener('click', () => this.onClickHandler());
|
|
65
|
-
}
|
|
66
|
-
this.wasUpdated = true;
|
|
67
|
-
this.props.popper.update();
|
|
68
|
-
};
|
|
69
|
-
this.onClickHandler = () => {
|
|
70
62
|
};
|
|
71
63
|
}
|
|
72
64
|
}
|
|
@@ -47,18 +47,17 @@ class CitationEditableView extends citation_1.CitationView {
|
|
|
47
47
|
element.classList.contains('comment-icon') ||
|
|
48
48
|
((_a = element.parentElement) === null || _a === void 0 ? void 0 : _a.classList.contains('comment-icon')));
|
|
49
49
|
};
|
|
50
|
-
this.
|
|
50
|
+
this.selectNode = () => {
|
|
51
51
|
var _a;
|
|
52
52
|
const can = this.props.getCapabilities();
|
|
53
53
|
const dataTracked = this.node.attrs.dataTracked;
|
|
54
54
|
const isSelectedSuggestion = !!((_a = selected_suggestion_ui_1.selectedSuggestionKey
|
|
55
55
|
.getState(this.view.state)) === null || _a === void 0 ? void 0 : _a.find(this.getPos(), this.getPos() + this.node.nodeSize).length);
|
|
56
|
-
|
|
57
|
-
tr.setSelection(prosemirror_state_1.NodeSelection.create(doc, this.getPos()));
|
|
56
|
+
this.dom.classList.add('ProseMirror-selectednode');
|
|
58
57
|
if (dataTracked && !isSelectedSuggestion) {
|
|
59
|
-
tr.setMeta(selected_suggestion_ui_1.SET_SUGGESTION_ID, dataTracked[0].id);
|
|
58
|
+
this.view.dispatch(this.view.state.tr.setMeta(selected_suggestion_ui_1.SET_SUGGESTION_ID, dataTracked[0].id));
|
|
60
59
|
}
|
|
61
|
-
if (can.seeReferencesButtons && !(0, track_changes_utils_1.isDeleted)(this.node)) {
|
|
60
|
+
else if (can.seeReferencesButtons && !(0, track_changes_utils_1.isDeleted)(this.node)) {
|
|
62
61
|
const attrs = (0, track_changes_utils_1.getActualAttrs)(this.node);
|
|
63
62
|
if (!attrs.rids.length) {
|
|
64
63
|
this.showPopper();
|
|
@@ -67,7 +66,10 @@ class CitationEditableView extends citation_1.CitationView {
|
|
|
67
66
|
this.showContextMenu();
|
|
68
67
|
}
|
|
69
68
|
}
|
|
70
|
-
|
|
69
|
+
};
|
|
70
|
+
this.deselectNode = () => {
|
|
71
|
+
this.dom.classList.remove('ProseMirror-selectednode');
|
|
72
|
+
this.props.popper.destroy();
|
|
71
73
|
};
|
|
72
74
|
this.destroy = () => {
|
|
73
75
|
var _a;
|
|
@@ -83,9 +85,7 @@ class CitationEditableView extends citation_1.CitationView {
|
|
|
83
85
|
],
|
|
84
86
|
};
|
|
85
87
|
this.contextMenu = (0, ReactSubView_1.default)(this.props, style_guide_1.ContextMenu, componentProps, this.node, this.getPos, this.view, 'context-menu');
|
|
86
|
-
|
|
87
|
-
this.props.popper.show(this.dom, this.contextMenu, 'right-start', false);
|
|
88
|
-
}, 0);
|
|
88
|
+
this.props.popper.show(this.dom, this.contextMenu, 'right-start', false);
|
|
89
89
|
};
|
|
90
90
|
this.showPopper = () => {
|
|
91
91
|
this.props.popper.destroy();
|
|
@@ -179,6 +179,7 @@ class ContributorsView extends block_view_1.default {
|
|
|
179
179
|
};
|
|
180
180
|
this.onClickHandler = (elementId, dataTracked) => {
|
|
181
181
|
var _a;
|
|
182
|
+
this.props.popper.destroy();
|
|
182
183
|
const isSelectedSuggestion = !!((_a = selected_suggestion_ui_1.selectedSuggestionKey
|
|
183
184
|
.getState(this.view.state)) === null || _a === void 0 ? void 0 : _a.find(this.getPos(), this.getPos() + this.node.nodeSize).length);
|
|
184
185
|
const { tr, doc } = this.view.state;
|
|
@@ -191,11 +192,11 @@ class ContributorsView extends block_view_1.default {
|
|
|
191
192
|
tr.setMeta(selected_suggestion_ui_1.CLEAR_SUGGESTION_ID, true);
|
|
192
193
|
}
|
|
193
194
|
}
|
|
194
|
-
this.view.dispatch(tr);
|
|
195
195
|
if (!((dataTracked === null || dataTracked === void 0 ? void 0 : dataTracked.operation) === track_changes_plugin_1.CHANGE_OPERATION.delete &&
|
|
196
196
|
(dataTracked === null || dataTracked === void 0 ? void 0 : dataTracked.status) !== track_changes_plugin_1.CHANGE_STATUS.rejected)) {
|
|
197
197
|
this.showContextMenu(elementId);
|
|
198
198
|
}
|
|
199
|
+
this.view.dispatch(tr);
|
|
199
200
|
};
|
|
200
201
|
this.showContextMenu = (elementId) => {
|
|
201
202
|
this.props.popper.destroy();
|
|
@@ -54,7 +54,7 @@ class CrossReferenceEditableView extends cross_reference_1.CrossReferenceView {
|
|
|
54
54
|
currentCustomLabel: this.node.attrs.customLabel,
|
|
55
55
|
};
|
|
56
56
|
this.popperContainer = (0, ReactSubView_1.default)(this.props, CrossReferenceItems_1.CrossReferenceItems, componentProps, this.node, this.getPos, this.view, 'cross-reference-editor');
|
|
57
|
-
this.props.popper.show(this.dom, this.popperContainer, '
|
|
57
|
+
this.props.popper.show(this.dom, this.popperContainer, 'auto');
|
|
58
58
|
};
|
|
59
59
|
this.destroy = () => {
|
|
60
60
|
var _a;
|
package/dist/es/lib/popper.js
CHANGED
|
@@ -16,10 +16,8 @@
|
|
|
16
16
|
import Popper from 'popper.js';
|
|
17
17
|
export class PopperManager {
|
|
18
18
|
show(target, contents, placement = 'bottom', showArrow = true, modifiers = {}) {
|
|
19
|
-
this.
|
|
20
|
-
|
|
21
|
-
this.clickEventHandler = this.clickEventHandler.bind(this);
|
|
22
|
-
document.body.addEventListener('click', this.clickEventHandler);
|
|
19
|
+
if (this.activePopper) {
|
|
20
|
+
return this.destroy();
|
|
23
21
|
}
|
|
24
22
|
window.requestAnimationFrame(() => {
|
|
25
23
|
const container = document.createElement('div');
|
|
@@ -53,17 +51,8 @@ export class PopperManager {
|
|
|
53
51
|
});
|
|
54
52
|
});
|
|
55
53
|
}
|
|
56
|
-
clickEventHandler(event) {
|
|
57
|
-
const editorElement = document.querySelector('.manuscript-editor');
|
|
58
|
-
const contextMenuElement = document.querySelector('.context-menu');
|
|
59
|
-
if (!(editorElement === null || editorElement === void 0 ? void 0 : editorElement.contains(event.target)) &&
|
|
60
|
-
!(contextMenuElement === null || contextMenuElement === void 0 ? void 0 : contextMenuElement.contains(event.target))) {
|
|
61
|
-
this.destroy();
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
54
|
destroy() {
|
|
65
55
|
if (this.activePopper) {
|
|
66
|
-
document.body.removeEventListener('click', this.clickEventHandler);
|
|
67
56
|
this.removeContainerClass(this.activePopper.reference);
|
|
68
57
|
this.activePopper.destroy();
|
|
69
58
|
delete this.activePopper;
|
|
@@ -66,7 +66,6 @@ class SuggestionView {
|
|
|
66
66
|
if ((_b = (_a = dom.parentElement) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.classList.contains('keyword')) {
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
|
-
console.log(dom);
|
|
70
69
|
dom.addEventListener('click', this.listener);
|
|
71
70
|
});
|
|
72
71
|
}
|
|
@@ -39,7 +39,9 @@ import ReactSubView from './ReactSubView';
|
|
|
39
39
|
export class BibliographyElementBlockView extends BlockView {
|
|
40
40
|
constructor() {
|
|
41
41
|
super(...arguments);
|
|
42
|
+
this.clickedElementId = null;
|
|
42
43
|
this.showPopper = (id) => {
|
|
44
|
+
this.props.popper.destroy();
|
|
43
45
|
const bib = getBibliographyPluginState(this.view.state);
|
|
44
46
|
if (!bib) {
|
|
45
47
|
return;
|
|
@@ -63,6 +65,8 @@ export class BibliographyElementBlockView extends BlockView {
|
|
|
63
65
|
this.props.setComment(buildComment(citationId));
|
|
64
66
|
};
|
|
65
67
|
this.showContextMenu = (elementId) => {
|
|
68
|
+
this.props.popper.destroy();
|
|
69
|
+
this.clickedElementId = null;
|
|
66
70
|
const can = this.props.getCapabilities();
|
|
67
71
|
const element = document.getElementById(elementId);
|
|
68
72
|
const componentProps = {
|
|
@@ -85,6 +89,7 @@ export class BibliographyElementBlockView extends BlockView {
|
|
|
85
89
|
};
|
|
86
90
|
this.onClickHandler = (elementId, dataTracked) => {
|
|
87
91
|
var _a;
|
|
92
|
+
this.clickedElementId = elementId;
|
|
88
93
|
const isSelectedSuggestion = !!((_a = selectedSuggestionKey
|
|
89
94
|
.getState(this.view.state)) === null || _a === void 0 ? void 0 : _a.find(this.getPos(), this.getPos() + this.node.nodeSize).length);
|
|
90
95
|
const { tr, doc } = this.view.state;
|
|
@@ -96,9 +101,11 @@ export class BibliographyElementBlockView extends BlockView {
|
|
|
96
101
|
if (isSelectedSuggestion) {
|
|
97
102
|
tr.setMeta(CLEAR_SUGGESTION_ID, true);
|
|
98
103
|
}
|
|
104
|
+
else {
|
|
105
|
+
this.showContextMenu(elementId);
|
|
106
|
+
}
|
|
99
107
|
}
|
|
100
108
|
this.view.dispatch(tr);
|
|
101
|
-
this.showContextMenu(elementId);
|
|
102
109
|
};
|
|
103
110
|
this.updateContents = () => __awaiter(this, void 0, void 0, function* () {
|
|
104
111
|
this.props.popper.destroy();
|
|
@@ -151,9 +158,7 @@ export class BibliographyElementBlockView extends BlockView {
|
|
|
151
158
|
element.classList.add('selected-suggestion');
|
|
152
159
|
}
|
|
153
160
|
if (can.seeReferencesButtons) {
|
|
154
|
-
element.addEventListener('click', () =>
|
|
155
|
-
this.onClickHandler(element.id, dataTracked);
|
|
156
|
-
});
|
|
161
|
+
element.addEventListener('click', () => this.onClickHandler(element.id, dataTracked));
|
|
157
162
|
}
|
|
158
163
|
wrapper.append(element);
|
|
159
164
|
}
|
|
@@ -164,6 +169,9 @@ export class BibliographyElementBlockView extends BlockView {
|
|
|
164
169
|
else {
|
|
165
170
|
this.container.appendChild(wrapper);
|
|
166
171
|
}
|
|
172
|
+
if (this.clickedElementId) {
|
|
173
|
+
this.showContextMenu(this.clickedElementId);
|
|
174
|
+
}
|
|
167
175
|
});
|
|
168
176
|
this.createElement = () => {
|
|
169
177
|
this.container = document.createElement('div');
|
|
@@ -24,7 +24,6 @@ export class CitationView extends BaseNodeView {
|
|
|
24
24
|
constructor() {
|
|
25
25
|
super(...arguments);
|
|
26
26
|
this.ignoreMutation = () => true;
|
|
27
|
-
this.wasUpdated = false;
|
|
28
27
|
this.initialise = () => {
|
|
29
28
|
if (!this.node.type.spec.toDOM) {
|
|
30
29
|
throw Error(`Node view ${this.node.type} doesn't have toDOM method`);
|
|
@@ -57,13 +56,6 @@ export class CitationView extends BaseNodeView {
|
|
|
57
56
|
this.dom.appendChild(element);
|
|
58
57
|
addCommentToLeafNode(this.getPos(), this.getPos() + this.node.nodeSize, this.view.state, this.dom);
|
|
59
58
|
this.setDomAttrs(this.node, this.dom, ['rids', 'contents', 'selectedText']);
|
|
60
|
-
if (!this.wasUpdated) {
|
|
61
|
-
this.dom.addEventListener('click', () => this.onClickHandler());
|
|
62
|
-
}
|
|
63
|
-
this.wasUpdated = true;
|
|
64
|
-
this.props.popper.update();
|
|
65
|
-
};
|
|
66
|
-
this.onClickHandler = () => {
|
|
67
59
|
};
|
|
68
60
|
}
|
|
69
61
|
}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { ContextMenu } from '@manuscripts/style-guide';
|
|
17
17
|
import { buildComment, schema, } from '@manuscripts/transform';
|
|
18
|
-
import {
|
|
18
|
+
import { TextSelection } from 'prosemirror-state';
|
|
19
19
|
import { findChildrenByType } from 'prosemirror-utils';
|
|
20
20
|
import { CitationEditor, } from '../components/references/CitationEditor';
|
|
21
21
|
import { CitationViewer, } from '../components/references/CitationViewer';
|
|
@@ -41,18 +41,17 @@ export class CitationEditableView extends CitationView {
|
|
|
41
41
|
element.classList.contains('comment-icon') ||
|
|
42
42
|
((_a = element.parentElement) === null || _a === void 0 ? void 0 : _a.classList.contains('comment-icon')));
|
|
43
43
|
};
|
|
44
|
-
this.
|
|
44
|
+
this.selectNode = () => {
|
|
45
45
|
var _a;
|
|
46
46
|
const can = this.props.getCapabilities();
|
|
47
47
|
const dataTracked = this.node.attrs.dataTracked;
|
|
48
48
|
const isSelectedSuggestion = !!((_a = selectedSuggestionKey
|
|
49
49
|
.getState(this.view.state)) === null || _a === void 0 ? void 0 : _a.find(this.getPos(), this.getPos() + this.node.nodeSize).length);
|
|
50
|
-
|
|
51
|
-
tr.setSelection(NodeSelection.create(doc, this.getPos()));
|
|
50
|
+
this.dom.classList.add('ProseMirror-selectednode');
|
|
52
51
|
if (dataTracked && !isSelectedSuggestion) {
|
|
53
|
-
tr.setMeta(SET_SUGGESTION_ID, dataTracked[0].id);
|
|
52
|
+
this.view.dispatch(this.view.state.tr.setMeta(SET_SUGGESTION_ID, dataTracked[0].id));
|
|
54
53
|
}
|
|
55
|
-
if (can.seeReferencesButtons && !isDeleted(this.node)) {
|
|
54
|
+
else if (can.seeReferencesButtons && !isDeleted(this.node)) {
|
|
56
55
|
const attrs = getActualAttrs(this.node);
|
|
57
56
|
if (!attrs.rids.length) {
|
|
58
57
|
this.showPopper();
|
|
@@ -61,7 +60,10 @@ export class CitationEditableView extends CitationView {
|
|
|
61
60
|
this.showContextMenu();
|
|
62
61
|
}
|
|
63
62
|
}
|
|
64
|
-
|
|
63
|
+
};
|
|
64
|
+
this.deselectNode = () => {
|
|
65
|
+
this.dom.classList.remove('ProseMirror-selectednode');
|
|
66
|
+
this.props.popper.destroy();
|
|
65
67
|
};
|
|
66
68
|
this.destroy = () => {
|
|
67
69
|
var _a;
|
|
@@ -77,9 +79,7 @@ export class CitationEditableView extends CitationView {
|
|
|
77
79
|
],
|
|
78
80
|
};
|
|
79
81
|
this.contextMenu = ReactSubView(this.props, ContextMenu, componentProps, this.node, this.getPos, this.view, 'context-menu');
|
|
80
|
-
|
|
81
|
-
this.props.popper.show(this.dom, this.contextMenu, 'right-start', false);
|
|
82
|
-
}, 0);
|
|
82
|
+
this.props.popper.show(this.dom, this.contextMenu, 'right-start', false);
|
|
83
83
|
};
|
|
84
84
|
this.showPopper = () => {
|
|
85
85
|
this.props.popper.destroy();
|
|
@@ -173,6 +173,7 @@ export class ContributorsView extends BlockView {
|
|
|
173
173
|
};
|
|
174
174
|
this.onClickHandler = (elementId, dataTracked) => {
|
|
175
175
|
var _a;
|
|
176
|
+
this.props.popper.destroy();
|
|
176
177
|
const isSelectedSuggestion = !!((_a = selectedSuggestionKey
|
|
177
178
|
.getState(this.view.state)) === null || _a === void 0 ? void 0 : _a.find(this.getPos(), this.getPos() + this.node.nodeSize).length);
|
|
178
179
|
const { tr, doc } = this.view.state;
|
|
@@ -185,11 +186,11 @@ export class ContributorsView extends BlockView {
|
|
|
185
186
|
tr.setMeta(CLEAR_SUGGESTION_ID, true);
|
|
186
187
|
}
|
|
187
188
|
}
|
|
188
|
-
this.view.dispatch(tr);
|
|
189
189
|
if (!((dataTracked === null || dataTracked === void 0 ? void 0 : dataTracked.operation) === CHANGE_OPERATION.delete &&
|
|
190
190
|
(dataTracked === null || dataTracked === void 0 ? void 0 : dataTracked.status) !== CHANGE_STATUS.rejected)) {
|
|
191
191
|
this.showContextMenu(elementId);
|
|
192
192
|
}
|
|
193
|
+
this.view.dispatch(tr);
|
|
193
194
|
};
|
|
194
195
|
this.showContextMenu = (elementId) => {
|
|
195
196
|
this.props.popper.destroy();
|
|
@@ -48,7 +48,7 @@ export class CrossReferenceEditableView extends CrossReferenceView {
|
|
|
48
48
|
currentCustomLabel: this.node.attrs.customLabel,
|
|
49
49
|
};
|
|
50
50
|
this.popperContainer = ReactSubView(this.props, CrossReferenceItems, componentProps, this.node, this.getPos, this.view, 'cross-reference-editor');
|
|
51
|
-
this.props.popper.show(this.dom, this.popperContainer, '
|
|
51
|
+
this.props.popper.show(this.dom, this.popperContainer, 'auto');
|
|
52
52
|
};
|
|
53
53
|
this.destroy = () => {
|
|
54
54
|
var _a;
|
|
@@ -17,7 +17,6 @@ import Popper from 'popper.js';
|
|
|
17
17
|
export declare class PopperManager {
|
|
18
18
|
protected activePopper?: Popper;
|
|
19
19
|
show(target: Element, contents: HTMLElement, placement?: Popper.Placement, showArrow?: boolean, modifiers?: Popper.Modifiers): void;
|
|
20
|
-
clickEventHandler(event: Event): void;
|
|
21
20
|
destroy(): void;
|
|
22
21
|
update(): void;
|
|
23
22
|
private focusInput;
|
|
@@ -24,6 +24,7 @@ export declare class BibliographyElementBlockView<PropsType extends Bibliography
|
|
|
24
24
|
private container;
|
|
25
25
|
private editor;
|
|
26
26
|
private contextMenu;
|
|
27
|
+
private clickedElementId;
|
|
27
28
|
showPopper: (id: string) => void;
|
|
28
29
|
stopEvent: () => boolean;
|
|
29
30
|
ignoreMutation: () => boolean;
|
|
@@ -17,10 +17,8 @@ import { ManuscriptNodeView } from '@manuscripts/transform';
|
|
|
17
17
|
import { BaseNodeProps, BaseNodeView } from './base_node_view';
|
|
18
18
|
export declare class CitationView<PropsType extends BaseNodeProps> extends BaseNodeView<PropsType> implements ManuscriptNodeView {
|
|
19
19
|
ignoreMutation: () => boolean;
|
|
20
|
-
wasUpdated: boolean;
|
|
21
20
|
initialise: () => this;
|
|
22
21
|
updateContents: () => void;
|
|
23
|
-
onClickHandler: () => void;
|
|
24
22
|
}
|
|
25
23
|
declare const _default: (props: BaseNodeProps, dispatch?: import("..").Dispatch | undefined) => import("../types").NodeViewCreator<CitationView<any>>;
|
|
26
24
|
export default _default;
|
|
@@ -19,7 +19,8 @@ export declare class CitationEditableView extends CitationView<EditableBlockProp
|
|
|
19
19
|
private editor;
|
|
20
20
|
private contextMenu;
|
|
21
21
|
stopEvent: (event: Event) => boolean;
|
|
22
|
-
|
|
22
|
+
selectNode: () => void;
|
|
23
|
+
deselectNode: () => void;
|
|
23
24
|
destroy: () => void;
|
|
24
25
|
showContextMenu: () => void;
|
|
25
26
|
showPopper: () => void;
|
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.9.20
|
|
4
|
+
"version": "1.9.20",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
package/styles/popper.css
CHANGED
|
@@ -200,10 +200,15 @@
|
|
|
200
200
|
position: relative;
|
|
201
201
|
width: 600px;
|
|
202
202
|
}
|
|
203
|
+
|
|
203
204
|
.popper .table-footnote-editor {
|
|
204
205
|
width: 600px;
|
|
205
206
|
}
|
|
206
207
|
|
|
208
|
+
.popper .cross-reference-editor {
|
|
209
|
+
position: relative;
|
|
210
|
+
}
|
|
211
|
+
|
|
207
212
|
.popper .cross-reference-editor,
|
|
208
213
|
.popper .equation-editor,
|
|
209
214
|
.popper .link-editor {
|