@manuscripts/body-editor 1.9.19-LEAN-3535.0 → 1.9.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/assets.js +1 -1
- package/dist/cjs/lib/popper.js +3 -10
- package/dist/cjs/plugins/footnotes/index.js +1 -1
- 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 +10 -9
- package/dist/cjs/views/contributors.js +2 -1
- package/dist/es/assets.js +1 -1
- package/dist/es/lib/popper.js +3 -10
- package/dist/es/plugins/footnotes/index.js +1 -1
- 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 +11 -10
- package/dist/es/views/contributors.js +2 -1
- package/dist/types/assets.d.ts +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/Editor.css +3 -0
package/dist/cjs/assets.js
CHANGED
package/dist/cjs/lib/popper.js
CHANGED
|
@@ -22,9 +22,9 @@ 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
|
-
|
|
25
|
+
if (this.activePopper) {
|
|
26
|
+
return this.destroy();
|
|
27
|
+
}
|
|
28
28
|
window.requestAnimationFrame(() => {
|
|
29
29
|
const container = document.createElement('div');
|
|
30
30
|
container.className = 'popper';
|
|
@@ -57,15 +57,8 @@ class PopperManager {
|
|
|
57
57
|
});
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
|
-
clickEventHandler(event) {
|
|
61
|
-
const editorElement = document.querySelector('.manuscript-editor');
|
|
62
|
-
if (!(editorElement === null || editorElement === void 0 ? void 0 : editorElement.contains(event.target))) {
|
|
63
|
-
this.destroy();
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
60
|
destroy() {
|
|
67
61
|
if (this.activePopper) {
|
|
68
|
-
document.body.removeEventListener('click', this.clickEventHandler);
|
|
69
62
|
this.removeContainerClass(this.activePopper.reference);
|
|
70
63
|
this.activePopper.destroy();
|
|
71
64
|
delete this.activePopper;
|
|
@@ -237,7 +237,7 @@ exports.default = (props) => {
|
|
|
237
237
|
decorations.push(prosemirror_view_1.Decoration.node(parent.pos, parent.pos + parent.node.nodeSize, {
|
|
238
238
|
class: 'footnote-selected',
|
|
239
239
|
}));
|
|
240
|
-
decorations.push(prosemirror_view_1.Decoration.widget(targetNode.pos +
|
|
240
|
+
decorations.push(prosemirror_view_1.Decoration.widget(targetNode.pos + 1, deleteFootnoteWidget(targetNode.node, props, targetNode.node.attrs.id, tableElement), {
|
|
241
241
|
key: targetNode.node.attrs.id,
|
|
242
242
|
}));
|
|
243
243
|
}
|
|
@@ -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;
|
|
@@ -75,6 +77,7 @@ class CitationEditableView extends citation_1.CitationView {
|
|
|
75
77
|
this.props.popper.destroy();
|
|
76
78
|
};
|
|
77
79
|
this.showContextMenu = () => {
|
|
80
|
+
this.props.popper.destroy();
|
|
78
81
|
const componentProps = {
|
|
79
82
|
actions: [
|
|
80
83
|
{ label: 'Edit', action: this.handleEdit, icon: 'EditIcon' },
|
|
@@ -82,9 +85,7 @@ class CitationEditableView extends citation_1.CitationView {
|
|
|
82
85
|
],
|
|
83
86
|
};
|
|
84
87
|
this.contextMenu = (0, ReactSubView_1.default)(this.props, style_guide_1.ContextMenu, componentProps, this.node, this.getPos, this.view, 'context-menu');
|
|
85
|
-
|
|
86
|
-
this.props.popper.show(this.dom, this.contextMenu, 'right-start', false);
|
|
87
|
-
}, 0);
|
|
88
|
+
this.props.popper.show(this.dom, this.contextMenu, 'right-start', false);
|
|
88
89
|
};
|
|
89
90
|
this.showPopper = () => {
|
|
90
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();
|
package/dist/es/assets.js
CHANGED
package/dist/es/lib/popper.js
CHANGED
|
@@ -16,9 +16,9 @@
|
|
|
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
|
-
|
|
19
|
+
if (this.activePopper) {
|
|
20
|
+
return this.destroy();
|
|
21
|
+
}
|
|
22
22
|
window.requestAnimationFrame(() => {
|
|
23
23
|
const container = document.createElement('div');
|
|
24
24
|
container.className = 'popper';
|
|
@@ -51,15 +51,8 @@ export class PopperManager {
|
|
|
51
51
|
});
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
|
-
clickEventHandler(event) {
|
|
55
|
-
const editorElement = document.querySelector('.manuscript-editor');
|
|
56
|
-
if (!(editorElement === null || editorElement === void 0 ? void 0 : editorElement.contains(event.target))) {
|
|
57
|
-
this.destroy();
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
54
|
destroy() {
|
|
61
55
|
if (this.activePopper) {
|
|
62
|
-
document.body.removeEventListener('click', this.clickEventHandler);
|
|
63
56
|
this.removeContainerClass(this.activePopper.reference);
|
|
64
57
|
this.activePopper.destroy();
|
|
65
58
|
delete this.activePopper;
|
|
@@ -229,7 +229,7 @@ export default (props) => {
|
|
|
229
229
|
decorations.push(Decoration.node(parent.pos, parent.pos + parent.node.nodeSize, {
|
|
230
230
|
class: 'footnote-selected',
|
|
231
231
|
}));
|
|
232
|
-
decorations.push(Decoration.widget(targetNode.pos +
|
|
232
|
+
decorations.push(Decoration.widget(targetNode.pos + 1, deleteFootnoteWidget(targetNode.node, props, targetNode.node.attrs.id, tableElement), {
|
|
233
233
|
key: targetNode.node.attrs.id,
|
|
234
234
|
}));
|
|
235
235
|
}
|
|
@@ -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;
|
|
@@ -69,6 +71,7 @@ export class CitationEditableView extends CitationView {
|
|
|
69
71
|
this.props.popper.destroy();
|
|
70
72
|
};
|
|
71
73
|
this.showContextMenu = () => {
|
|
74
|
+
this.props.popper.destroy();
|
|
72
75
|
const componentProps = {
|
|
73
76
|
actions: [
|
|
74
77
|
{ label: 'Edit', action: this.handleEdit, icon: 'EditIcon' },
|
|
@@ -76,9 +79,7 @@ export class CitationEditableView extends CitationView {
|
|
|
76
79
|
],
|
|
77
80
|
};
|
|
78
81
|
this.contextMenu = ReactSubView(this.props, ContextMenu, componentProps, this.node, this.getPos, this.view, 'context-menu');
|
|
79
|
-
|
|
80
|
-
this.props.popper.show(this.dom, this.contextMenu, 'right-start', false);
|
|
81
|
-
}, 0);
|
|
82
|
+
this.props.popper.show(this.dom, this.contextMenu, 'right-start', false);
|
|
82
83
|
};
|
|
83
84
|
this.showPopper = () => {
|
|
84
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();
|
package/dist/types/assets.d.ts
CHANGED
|
@@ -17,4 +17,4 @@ export declare const editIcon = "\n <svg\n width=\"14\"\n height=\"14\"\n
|
|
|
17
17
|
export declare const commentIcon = "\n<svg\n width=\"20\"\n height=\"15\"\n viewBox=\"0 0 20 15\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n d=\"M7.94841 4.18311C7.98238 3.9602 8 3.73191 8 3.49951C8 3.22073 7.97465 2.94787 7.92613 2.68311H13.5C14.8854 2.68311 16.25 3.6425 16.25 5.09977V9.02453L19.1086 12.9949C19.2731 13.2233 19.2958 13.5245 19.1675 13.775C19.0392 14.0255 18.7814 14.1831 18.5 14.1831H5.5C4.11463 14.1831 2.75 13.2237 2.75 11.7664V7.93729C2.9939 7.97821 3.24446 7.99951 3.5 7.99951C3.75553 7.99951 4.00609 7.97821 4.25 7.93729V11.7664C4.25 12.1508 4.67537 12.6831 5.5 12.6831H17.0358L14.8913 9.70467C14.7994 9.57703 14.75 9.42372 14.75 9.26644V5.09977C14.75 4.71538 14.3246 4.18311 13.5 4.18311H7.94841Z\"\n fill=\"#FFBD26\"\n />\n <path\n d=\"M11.5 6.99951H8.5\"\n stroke=\"#FFBD26\"\n stroke-width=\"1.5\"\n stroke-miterlimit=\"10\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n <path\n d=\"M12 9.99951H7\"\n stroke=\"#FFBD26\"\n stroke-width=\"1.5\"\n stroke-miterlimit=\"10\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n <path\n d=\"M3.5 1L3.5 6\"\n stroke=\"#FFBD26\"\n stroke-width=\"1.5\"\n stroke-miterlimit=\"10\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n <path\n d=\"M6 3.5L1 3.5\"\n stroke=\"#FFBD26\"\n stroke-width=\"1.5\"\n stroke-miterlimit=\"10\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n";
|
|
18
18
|
export declare const editAttrsTrackingIcon = "\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M12 2L14 4L9 9L6 10L7 7L12 2Z\"\n stroke=\"#353535\"\n stroke-width=\"1.5\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n <path\n d=\"M13 10V11.5C13 12.328 12.328 13 11.5 13H4.5C3.672 13 3 12.328 3 11.5V4.5C3 3.672 3.672 3 4.5 3H6\"\n stroke=\"#353535\"\n stroke-width=\"1.5\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n";
|
|
19
19
|
export declare const alertIcon = "\n <svg\n width=\"12\"\n height=\"12\"\n viewBox=\"0 0 12 12\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n d=\"M6 12C2.68629 12 1.18852e-06 9.31371 1.47821e-06 6C1.7679e-06 2.68629 2.68629 1.39444e-07 6 4.29138e-07C9.31371 7.18831e-07 12 2.68629 12 6C12 9.31371 9.31371 12 6 12ZM6.74998 2.99996L6.75 6.37462C6.75 6.78819 6.41522 7.12243 6.00166 7.12334C5.58681 7.12426 5.25001 6.78821 5.25001 6.37335L5.25 3.00082C5.25 2.58629 5.58629 2.25037 6.00082 2.25083C6.4147 2.25128 6.74998 2.58607 6.74998 2.99996ZM6.75 8.99263C6.75 9.46884 6.47288 9.75 5.99853 9.75C5.52419 9.75 5.25 9.47179 5.25 8.99558C5.25 8.51937 5.52421 8.25 5.99855 8.25C6.47289 8.25 6.75 8.51642 6.75 8.99263Z\"\n fill=\"#FE8F1F\"\n />\n </svg>\n";
|
|
20
|
-
export declare const deleteIcon = "\n <svg \n width=\"13\" \n height=\"
|
|
20
|
+
export declare const deleteIcon = "\n <svg \n width=\"13\" \n height=\"17\" \n viewBox=\"0 0 13 15\" \n fill=\"none\" \n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path \n fill-rule=\"evenodd\" \n clip-rule=\"evenodd\" \n d=\"M2.00001 3C2 3.00135 2 3.00269 2 3.00404V13.004C2 13.5563 2.44772 14.004 3 14.004H10C10.5523 14.004 11 13.5563 11 13.004V3.00404C11 3.00269 11 3.00135 11 3C11.5978 3.34581 12 3.99215 12 4.73244V13.004C12 14.1086 11.1046 15.004 10 15.004H3C1.89543 15.004 1 14.1086 1 13.004V4.73244C1 3.99215 1.4022 3.34581 2.00001 3Z\" \n fill=\"#C9C9C9\"\n />\n <path \n fill-rule=\"evenodd\" \n clip-rule=\"evenodd\" \n d=\"M4.5 0C3.67157 0 3 0.671573 3 1.5V3.5C3 4.32843 3.67157 5 4.5 5H8.5C9.32843 5 10 4.32843 10 3.5V1.5C10 0.671573 9.32843 0 8.5 0H4.5ZM9 1.5C9 1.22386 8.77614 1 8.5 1H4.5C4.22386 1 4 1.22386 4 1.5C4 1.77614 4.22386 2 4.5 2H8.5C8.77614 2 9 1.77614 9 1.5Z\" \n fill=\"#C9C9C9\"\n />\n <rect \n y=\"2\" \n width=\"13\" \n height=\"3\" \n rx=\"1.5\" \n fill=\"#C9C9C9\"\n />\n <path \n fill-rule=\"evenodd\" \n clip-rule=\"evenodd\" \n d=\"M8 7.5C8 7.22386 8.22386 7 8.5 7C8.77614 7 9 7.22386 9 7.5V11.5C9 11.7761 8.77614 12 8.5 12C8.22386 12 8 11.7761 8 11.5V7.5Z\" \n fill=\"#C9C9C9\"\n />\n <path \n fill-rule=\"evenodd\" \n clip-rule=\"evenodd\" \n d=\"M4 7.5C4 7.22386 4.22386 7 4.5 7C4.77614 7 5 7.22386 5 7.5V11.5C5 11.7761 4.77614 12 4.5 12C4.22386 12 4 11.7761 4 11.5V7.5Z\" \n fill=\"#C9C9C9\"\n />\n <path \n fill-rule=\"evenodd\" \n clip-rule=\"evenodd\" \n d=\"M11.5 3C11.7761 3 12 3.22386 12 3.5C12 3.77614 11.7761 4 11.5 4L1.5 4C1.22386 4 1 3.77614 1 3.5C1 3.22386 1.22386 3 1.5 3L11.5 3Z\" \n fill=\"white\"\n />\n</svg>";
|
|
@@ -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.19
|
|
4
|
+
"version": "1.9.19",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|