@manuscripts/body-editor 1.7.35 → 1.7.37
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/views/affiliations.js +9 -0
- package/dist/cjs/views/citation_editable.js +1 -0
- package/dist/cjs/views/contributors.js +61 -22
- package/dist/cjs/views/keyword_group.js +10 -0
- package/dist/es/views/affiliations.js +9 -0
- package/dist/es/views/citation_editable.js +1 -0
- package/dist/es/views/contributors.js +63 -24
- package/dist/es/views/keyword_group.js +10 -0
- package/dist/types/views/affiliations.d.ts +2 -0
- package/dist/types/views/contributors.d.ts +5 -4
- package/dist/types/views/keyword_group.d.ts +2 -0
- package/package.json +3 -3
- package/styles/AdvancedEditor.css +30 -27
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.AffiliationsView = void 0;
|
|
7
|
+
const prosemirror_state_1 = require("prosemirror-state");
|
|
7
8
|
const block_view_1 = __importDefault(require("./block_view"));
|
|
8
9
|
const creators_1 = require("./creators");
|
|
9
10
|
class AffiliationsView extends block_view_1.default {
|
|
@@ -18,6 +19,14 @@ class AffiliationsView extends block_view_1.default {
|
|
|
18
19
|
this.dom.setAttribute('contenteditable', 'false');
|
|
19
20
|
this.dom.appendChild(this.contentDOM);
|
|
20
21
|
};
|
|
22
|
+
this.updateContents = () => {
|
|
23
|
+
this.dom.addEventListener('click', () => this.onClickHandler());
|
|
24
|
+
};
|
|
25
|
+
this.onClickHandler = () => {
|
|
26
|
+
const { tr, doc } = this.view.state;
|
|
27
|
+
tr.setSelection(prosemirror_state_1.NodeSelection.create(doc, this.getPos()));
|
|
28
|
+
this.view.dispatch(tr);
|
|
29
|
+
};
|
|
21
30
|
}
|
|
22
31
|
}
|
|
23
32
|
exports.AffiliationsView = AffiliationsView;
|
|
@@ -74,6 +74,7 @@ class CitationEditableView extends citation_1.CitationView {
|
|
|
74
74
|
this.props.popper.destroy();
|
|
75
75
|
};
|
|
76
76
|
this.showContextMenu = () => {
|
|
77
|
+
this.props.popper.destroy();
|
|
77
78
|
const componentProps = {
|
|
78
79
|
actions: [
|
|
79
80
|
{ label: 'Edit', action: this.handleEdit, icon: 'EditIcon' },
|
|
@@ -20,7 +20,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.ContributorsView = void 0;
|
|
22
22
|
const style_guide_1 = require("@manuscripts/style-guide");
|
|
23
|
+
const track_changes_plugin_1 = require("@manuscripts/track-changes-plugin");
|
|
23
24
|
const transform_1 = require("@manuscripts/transform");
|
|
25
|
+
const prosemirror_state_1 = require("prosemirror-state");
|
|
24
26
|
const AuthorsModal_1 = require("../components/authors/AuthorsModal");
|
|
25
27
|
const authors_1 = require("../lib/authors");
|
|
26
28
|
const track_changes_utils_1 = require("../lib/track-changes-utils");
|
|
@@ -41,12 +43,14 @@ class ContributorsView extends block_view_1.default {
|
|
|
41
43
|
this.updateContents();
|
|
42
44
|
};
|
|
43
45
|
this.updateContents = () => {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
setTimeout(() => {
|
|
47
|
+
this.updateClasses();
|
|
48
|
+
this.updateAttributes();
|
|
49
|
+
this.container.innerHTML = '';
|
|
50
|
+
this.buildAuthors();
|
|
51
|
+
this.createEditButton();
|
|
52
|
+
this.createLegend();
|
|
53
|
+
}, 0);
|
|
50
54
|
};
|
|
51
55
|
this.buildAuthors = () => {
|
|
52
56
|
var _a;
|
|
@@ -79,7 +83,9 @@ class ContributorsView extends block_view_1.default {
|
|
|
79
83
|
const pluginState = affiliations_1.affiliationsKey.getState(this.view.state);
|
|
80
84
|
const attrs = node.attrs;
|
|
81
85
|
const displayAttr = (0, track_changes_utils_1.getActualAttrs)(node);
|
|
86
|
+
const containerWrapper = document.createElement('div');
|
|
82
87
|
const container = document.createElement('button');
|
|
88
|
+
containerWrapper.classList.add('contributor-wrapper');
|
|
83
89
|
container.classList.add('contributor');
|
|
84
90
|
container.setAttribute('id', attrs.id);
|
|
85
91
|
container.setAttribute('contenteditable', 'false');
|
|
@@ -95,9 +101,12 @@ class ContributorsView extends block_view_1.default {
|
|
|
95
101
|
}
|
|
96
102
|
const can = this.props.getCapabilities();
|
|
97
103
|
const disableEditButton = !can.editMetadata;
|
|
98
|
-
const { isCorresponding, email } = displayAttr;
|
|
104
|
+
const { isCorresponding, email, id } = displayAttr;
|
|
99
105
|
if (!disableEditButton) {
|
|
100
|
-
container.addEventListener('click',
|
|
106
|
+
container.addEventListener('click', () => {
|
|
107
|
+
const dataTracked = attrs.dataTracked;
|
|
108
|
+
this.onClickHandler(id, dataTracked ? dataTracked[0] : undefined);
|
|
109
|
+
});
|
|
101
110
|
}
|
|
102
111
|
const name = (0, authors_1.authorLabel)(displayAttr);
|
|
103
112
|
container.innerHTML =
|
|
@@ -125,7 +134,8 @@ class ContributorsView extends block_view_1.default {
|
|
|
125
134
|
if (selectedAuthor && selectedAuthor === attrs.id) {
|
|
126
135
|
container.classList.add('selected-suggestion');
|
|
127
136
|
}
|
|
128
|
-
|
|
137
|
+
containerWrapper.appendChild(container);
|
|
138
|
+
return containerWrapper;
|
|
129
139
|
};
|
|
130
140
|
this.isJointFirstAuthor = (authors, index) => {
|
|
131
141
|
const author = index === 0 ? authors[index] : authors[index - 1];
|
|
@@ -147,7 +157,7 @@ class ContributorsView extends block_view_1.default {
|
|
|
147
157
|
const can = this.props.getCapabilities();
|
|
148
158
|
const button = (0, ReactSubView_1.default)(this.props, style_guide_1.SecondaryButton, {
|
|
149
159
|
mini: true,
|
|
150
|
-
onClick: this.
|
|
160
|
+
onClick: () => this.handleEdit(''),
|
|
151
161
|
className: 'edit-authors-button',
|
|
152
162
|
disabled: !can.editMetadata,
|
|
153
163
|
children: 'Edit Authors',
|
|
@@ -167,17 +177,48 @@ class ContributorsView extends block_view_1.default {
|
|
|
167
177
|
}
|
|
168
178
|
}
|
|
169
179
|
};
|
|
170
|
-
this.
|
|
171
|
-
var _a
|
|
172
|
-
|
|
180
|
+
this.onClickHandler = (elementId, dataTracked) => {
|
|
181
|
+
var _a;
|
|
182
|
+
this.props.popper.destroy();
|
|
183
|
+
const isSelectedSuggestion = !!((_a = selected_suggestion_ui_1.selectedSuggestionKey
|
|
184
|
+
.getState(this.view.state)) === null || _a === void 0 ? void 0 : _a.find(this.getPos(), this.getPos() + this.node.nodeSize).length);
|
|
185
|
+
const { tr, doc } = this.view.state;
|
|
186
|
+
tr.setSelection(prosemirror_state_1.NodeSelection.create(doc, this.getPos()));
|
|
187
|
+
if (dataTracked && dataTracked.status !== track_changes_plugin_1.CHANGE_STATUS.rejected) {
|
|
188
|
+
tr.setMeta(selected_suggestion_ui_1.SET_SUGGESTION_ID, dataTracked.id);
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
if (isSelectedSuggestion) {
|
|
192
|
+
tr.setMeta(selected_suggestion_ui_1.CLEAR_SUGGESTION_ID, true);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if (!((dataTracked === null || dataTracked === void 0 ? void 0 : dataTracked.operation) === track_changes_plugin_1.CHANGE_OPERATION.delete &&
|
|
196
|
+
(dataTracked === null || dataTracked === void 0 ? void 0 : dataTracked.status) !== track_changes_plugin_1.CHANGE_STATUS.rejected)) {
|
|
197
|
+
this.showContextMenu(elementId);
|
|
198
|
+
}
|
|
199
|
+
this.view.dispatch(tr);
|
|
200
|
+
};
|
|
201
|
+
this.showContextMenu = (elementId) => {
|
|
202
|
+
this.props.popper.destroy();
|
|
203
|
+
const element = document.getElementById(elementId);
|
|
204
|
+
const componentProps = {
|
|
205
|
+
actions: [
|
|
206
|
+
{
|
|
207
|
+
label: 'Edit',
|
|
208
|
+
action: () => this.handleEdit(elementId),
|
|
209
|
+
icon: 'EditIcon',
|
|
210
|
+
},
|
|
211
|
+
],
|
|
212
|
+
};
|
|
213
|
+
this.contextMenu = (0, ReactSubView_1.default)(this.props, style_guide_1.ContextMenu, componentProps, this.node, this.getPos, this.view, 'context-menu');
|
|
214
|
+
this.props.popper.show(element, this.contextMenu, 'right-start');
|
|
215
|
+
};
|
|
216
|
+
this.handleEdit = (id) => {
|
|
217
|
+
var _a;
|
|
218
|
+
this.props.popper.destroy();
|
|
173
219
|
const contributors = (0, view_1.findChildrenAttrsByType)(this.view, transform_1.schema.nodes.contributor);
|
|
174
220
|
const affiliations = (0, view_1.findChildrenAttrsByType)(this.view, transform_1.schema.nodes.affiliation);
|
|
175
|
-
|
|
176
|
-
const target = e.target;
|
|
177
|
-
if (target) {
|
|
178
|
-
const id = (_a = target.closest('.contributor')) === null || _a === void 0 ? void 0 : _a.getAttribute('id');
|
|
179
|
-
author = contributors.filter((a) => a.id === id)[0];
|
|
180
|
-
}
|
|
221
|
+
const author = id ? contributors.filter((a) => a.id === id)[0] : undefined;
|
|
181
222
|
const componentProps = {
|
|
182
223
|
author,
|
|
183
224
|
authors: contributors,
|
|
@@ -186,7 +227,7 @@ class ContributorsView extends block_view_1.default {
|
|
|
186
227
|
onDeleteAuthor: this.handleDeleteAuthor,
|
|
187
228
|
onSaveAffiliation: this.handleSaveAffiliation,
|
|
188
229
|
};
|
|
189
|
-
(
|
|
230
|
+
(_a = this.popper) === null || _a === void 0 ? void 0 : _a.remove();
|
|
190
231
|
this.popper = (0, ReactSubView_1.default)(this.props, AuthorsModal_1.AuthorsModal, componentProps, this.node, this.getPos, this.view);
|
|
191
232
|
this.container.appendChild(this.popper);
|
|
192
233
|
};
|
|
@@ -219,8 +260,6 @@ class ContributorsView extends block_view_1.default {
|
|
|
219
260
|
const node = transform_1.schema.nodes.affiliation.create(attrs);
|
|
220
261
|
this.view.dispatch(tr.insert(parent.pos + 1, node));
|
|
221
262
|
};
|
|
222
|
-
this.ignoreMutation = () => true;
|
|
223
|
-
this.stopEvent = () => true;
|
|
224
263
|
}
|
|
225
264
|
createNote(text = '', title = '') {
|
|
226
265
|
const el = document.createElement('span');
|
|
@@ -19,6 +19,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
19
19
|
};
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.KeywordGroupView = void 0;
|
|
22
|
+
const prosemirror_state_1 = require("prosemirror-state");
|
|
22
23
|
const AddKeywordInline_1 = require("../components/keywords/AddKeywordInline");
|
|
23
24
|
const block_view_1 = __importDefault(require("./block_view"));
|
|
24
25
|
const creators_1 = require("./creators");
|
|
@@ -44,6 +45,15 @@ class KeywordGroupView extends block_view_1.default {
|
|
|
44
45
|
this.element.appendChild(this.addingTools);
|
|
45
46
|
}
|
|
46
47
|
};
|
|
48
|
+
this.updateContents = () => {
|
|
49
|
+
this.dom.addEventListener('click', (event) => this.onClickHandler(event));
|
|
50
|
+
};
|
|
51
|
+
this.onClickHandler = (event) => {
|
|
52
|
+
event === null || event === void 0 ? void 0 : event.stopPropagation();
|
|
53
|
+
const { tr, doc } = this.view.state;
|
|
54
|
+
tr.setSelection(prosemirror_state_1.NodeSelection.create(doc, this.getPos()));
|
|
55
|
+
this.view.dispatch(tr);
|
|
56
|
+
};
|
|
47
57
|
}
|
|
48
58
|
}
|
|
49
59
|
exports.KeywordGroupView = KeywordGroupView;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { NodeSelection } from 'prosemirror-state';
|
|
1
2
|
import BlockView from './block_view';
|
|
2
3
|
import { createNodeView } from './creators';
|
|
3
4
|
export class AffiliationsView extends BlockView {
|
|
@@ -12,6 +13,14 @@ export class AffiliationsView extends BlockView {
|
|
|
12
13
|
this.dom.setAttribute('contenteditable', 'false');
|
|
13
14
|
this.dom.appendChild(this.contentDOM);
|
|
14
15
|
};
|
|
16
|
+
this.updateContents = () => {
|
|
17
|
+
this.dom.addEventListener('click', () => this.onClickHandler());
|
|
18
|
+
};
|
|
19
|
+
this.onClickHandler = () => {
|
|
20
|
+
const { tr, doc } = this.view.state;
|
|
21
|
+
tr.setSelection(NodeSelection.create(doc, this.getPos()));
|
|
22
|
+
this.view.dispatch(tr);
|
|
23
|
+
};
|
|
15
24
|
}
|
|
16
25
|
}
|
|
17
26
|
export default createNodeView(AffiliationsView);
|
|
@@ -68,6 +68,7 @@ export class CitationEditableView extends CitationView {
|
|
|
68
68
|
this.props.popper.destroy();
|
|
69
69
|
};
|
|
70
70
|
this.showContextMenu = () => {
|
|
71
|
+
this.props.popper.destroy();
|
|
71
72
|
const componentProps = {
|
|
72
73
|
actions: [
|
|
73
74
|
{ label: 'Edit', action: this.handleEdit, icon: 'EditIcon' },
|
|
@@ -13,14 +13,16 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { SecondaryButton } from '@manuscripts/style-guide';
|
|
16
|
+
import { ContextMenu, SecondaryButton, } from '@manuscripts/style-guide';
|
|
17
|
+
import { CHANGE_OPERATION, CHANGE_STATUS, } from '@manuscripts/track-changes-plugin';
|
|
17
18
|
import { isContributorNode, schema, } from '@manuscripts/transform';
|
|
19
|
+
import { NodeSelection } from 'prosemirror-state';
|
|
18
20
|
import { AuthorsModal, } from '../components/authors/AuthorsModal';
|
|
19
21
|
import { authorLabel } from '../lib/authors';
|
|
20
22
|
import { getActualAttrs } from '../lib/track-changes-utils';
|
|
21
23
|
import { deleteNode, findChildByID, findChildByType, findChildrenAttrsByType, updateNodeAttrs, } from '../lib/view';
|
|
22
24
|
import { affiliationsKey } from '../plugins/affiliations';
|
|
23
|
-
import { selectedSuggestionKey } from '../plugins/selected-suggestion-ui';
|
|
25
|
+
import { CLEAR_SUGGESTION_ID, selectedSuggestionKey, SET_SUGGESTION_ID, } from '../plugins/selected-suggestion-ui';
|
|
24
26
|
import BlockView from './block_view';
|
|
25
27
|
import { createNodeView } from './creators';
|
|
26
28
|
import ReactSubView from './ReactSubView';
|
|
@@ -35,12 +37,14 @@ export class ContributorsView extends BlockView {
|
|
|
35
37
|
this.updateContents();
|
|
36
38
|
};
|
|
37
39
|
this.updateContents = () => {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
setTimeout(() => {
|
|
41
|
+
this.updateClasses();
|
|
42
|
+
this.updateAttributes();
|
|
43
|
+
this.container.innerHTML = '';
|
|
44
|
+
this.buildAuthors();
|
|
45
|
+
this.createEditButton();
|
|
46
|
+
this.createLegend();
|
|
47
|
+
}, 0);
|
|
44
48
|
};
|
|
45
49
|
this.buildAuthors = () => {
|
|
46
50
|
var _a;
|
|
@@ -73,7 +77,9 @@ export class ContributorsView extends BlockView {
|
|
|
73
77
|
const pluginState = affiliationsKey.getState(this.view.state);
|
|
74
78
|
const attrs = node.attrs;
|
|
75
79
|
const displayAttr = getActualAttrs(node);
|
|
80
|
+
const containerWrapper = document.createElement('div');
|
|
76
81
|
const container = document.createElement('button');
|
|
82
|
+
containerWrapper.classList.add('contributor-wrapper');
|
|
77
83
|
container.classList.add('contributor');
|
|
78
84
|
container.setAttribute('id', attrs.id);
|
|
79
85
|
container.setAttribute('contenteditable', 'false');
|
|
@@ -89,9 +95,12 @@ export class ContributorsView extends BlockView {
|
|
|
89
95
|
}
|
|
90
96
|
const can = this.props.getCapabilities();
|
|
91
97
|
const disableEditButton = !can.editMetadata;
|
|
92
|
-
const { isCorresponding, email } = displayAttr;
|
|
98
|
+
const { isCorresponding, email, id } = displayAttr;
|
|
93
99
|
if (!disableEditButton) {
|
|
94
|
-
container.addEventListener('click',
|
|
100
|
+
container.addEventListener('click', () => {
|
|
101
|
+
const dataTracked = attrs.dataTracked;
|
|
102
|
+
this.onClickHandler(id, dataTracked ? dataTracked[0] : undefined);
|
|
103
|
+
});
|
|
95
104
|
}
|
|
96
105
|
const name = authorLabel(displayAttr);
|
|
97
106
|
container.innerHTML =
|
|
@@ -119,7 +128,8 @@ export class ContributorsView extends BlockView {
|
|
|
119
128
|
if (selectedAuthor && selectedAuthor === attrs.id) {
|
|
120
129
|
container.classList.add('selected-suggestion');
|
|
121
130
|
}
|
|
122
|
-
|
|
131
|
+
containerWrapper.appendChild(container);
|
|
132
|
+
return containerWrapper;
|
|
123
133
|
};
|
|
124
134
|
this.isJointFirstAuthor = (authors, index) => {
|
|
125
135
|
const author = index === 0 ? authors[index] : authors[index - 1];
|
|
@@ -141,7 +151,7 @@ export class ContributorsView extends BlockView {
|
|
|
141
151
|
const can = this.props.getCapabilities();
|
|
142
152
|
const button = ReactSubView(this.props, SecondaryButton, {
|
|
143
153
|
mini: true,
|
|
144
|
-
onClick: this.
|
|
154
|
+
onClick: () => this.handleEdit(''),
|
|
145
155
|
className: 'edit-authors-button',
|
|
146
156
|
disabled: !can.editMetadata,
|
|
147
157
|
children: 'Edit Authors',
|
|
@@ -161,17 +171,48 @@ export class ContributorsView extends BlockView {
|
|
|
161
171
|
}
|
|
162
172
|
}
|
|
163
173
|
};
|
|
164
|
-
this.
|
|
165
|
-
var _a
|
|
166
|
-
|
|
174
|
+
this.onClickHandler = (elementId, dataTracked) => {
|
|
175
|
+
var _a;
|
|
176
|
+
this.props.popper.destroy();
|
|
177
|
+
const isSelectedSuggestion = !!((_a = selectedSuggestionKey
|
|
178
|
+
.getState(this.view.state)) === null || _a === void 0 ? void 0 : _a.find(this.getPos(), this.getPos() + this.node.nodeSize).length);
|
|
179
|
+
const { tr, doc } = this.view.state;
|
|
180
|
+
tr.setSelection(NodeSelection.create(doc, this.getPos()));
|
|
181
|
+
if (dataTracked && dataTracked.status !== CHANGE_STATUS.rejected) {
|
|
182
|
+
tr.setMeta(SET_SUGGESTION_ID, dataTracked.id);
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
if (isSelectedSuggestion) {
|
|
186
|
+
tr.setMeta(CLEAR_SUGGESTION_ID, true);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
if (!((dataTracked === null || dataTracked === void 0 ? void 0 : dataTracked.operation) === CHANGE_OPERATION.delete &&
|
|
190
|
+
(dataTracked === null || dataTracked === void 0 ? void 0 : dataTracked.status) !== CHANGE_STATUS.rejected)) {
|
|
191
|
+
this.showContextMenu(elementId);
|
|
192
|
+
}
|
|
193
|
+
this.view.dispatch(tr);
|
|
194
|
+
};
|
|
195
|
+
this.showContextMenu = (elementId) => {
|
|
196
|
+
this.props.popper.destroy();
|
|
197
|
+
const element = document.getElementById(elementId);
|
|
198
|
+
const componentProps = {
|
|
199
|
+
actions: [
|
|
200
|
+
{
|
|
201
|
+
label: 'Edit',
|
|
202
|
+
action: () => this.handleEdit(elementId),
|
|
203
|
+
icon: 'EditIcon',
|
|
204
|
+
},
|
|
205
|
+
],
|
|
206
|
+
};
|
|
207
|
+
this.contextMenu = ReactSubView(this.props, ContextMenu, componentProps, this.node, this.getPos, this.view, 'context-menu');
|
|
208
|
+
this.props.popper.show(element, this.contextMenu, 'right-start');
|
|
209
|
+
};
|
|
210
|
+
this.handleEdit = (id) => {
|
|
211
|
+
var _a;
|
|
212
|
+
this.props.popper.destroy();
|
|
167
213
|
const contributors = findChildrenAttrsByType(this.view, schema.nodes.contributor);
|
|
168
214
|
const affiliations = findChildrenAttrsByType(this.view, schema.nodes.affiliation);
|
|
169
|
-
|
|
170
|
-
const target = e.target;
|
|
171
|
-
if (target) {
|
|
172
|
-
const id = (_a = target.closest('.contributor')) === null || _a === void 0 ? void 0 : _a.getAttribute('id');
|
|
173
|
-
author = contributors.filter((a) => a.id === id)[0];
|
|
174
|
-
}
|
|
215
|
+
const author = id ? contributors.filter((a) => a.id === id)[0] : undefined;
|
|
175
216
|
const componentProps = {
|
|
176
217
|
author,
|
|
177
218
|
authors: contributors,
|
|
@@ -180,7 +221,7 @@ export class ContributorsView extends BlockView {
|
|
|
180
221
|
onDeleteAuthor: this.handleDeleteAuthor,
|
|
181
222
|
onSaveAffiliation: this.handleSaveAffiliation,
|
|
182
223
|
};
|
|
183
|
-
(
|
|
224
|
+
(_a = this.popper) === null || _a === void 0 ? void 0 : _a.remove();
|
|
184
225
|
this.popper = ReactSubView(this.props, AuthorsModal, componentProps, this.node, this.getPos, this.view);
|
|
185
226
|
this.container.appendChild(this.popper);
|
|
186
227
|
};
|
|
@@ -213,8 +254,6 @@ export class ContributorsView extends BlockView {
|
|
|
213
254
|
const node = schema.nodes.affiliation.create(attrs);
|
|
214
255
|
this.view.dispatch(tr.insert(parent.pos + 1, node));
|
|
215
256
|
};
|
|
216
|
-
this.ignoreMutation = () => true;
|
|
217
|
-
this.stopEvent = () => true;
|
|
218
257
|
}
|
|
219
258
|
createNote(text = '', title = '') {
|
|
220
259
|
const el = document.createElement('span');
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import { NodeSelection } from 'prosemirror-state';
|
|
16
17
|
import { AddKeywordInline } from '../components/keywords/AddKeywordInline';
|
|
17
18
|
import BlockView from './block_view';
|
|
18
19
|
import { createNodeView } from './creators';
|
|
@@ -38,6 +39,15 @@ export class KeywordGroupView extends BlockView {
|
|
|
38
39
|
this.element.appendChild(this.addingTools);
|
|
39
40
|
}
|
|
40
41
|
};
|
|
42
|
+
this.updateContents = () => {
|
|
43
|
+
this.dom.addEventListener('click', (event) => this.onClickHandler(event));
|
|
44
|
+
};
|
|
45
|
+
this.onClickHandler = (event) => {
|
|
46
|
+
event === null || event === void 0 ? void 0 : event.stopPropagation();
|
|
47
|
+
const { tr, doc } = this.view.state;
|
|
48
|
+
tr.setSelection(NodeSelection.create(doc, this.getPos()));
|
|
49
|
+
this.view.dispatch(tr);
|
|
50
|
+
};
|
|
41
51
|
}
|
|
42
52
|
}
|
|
43
53
|
export default createNodeView(KeywordGroupView);
|
|
@@ -4,6 +4,8 @@ export declare class AffiliationsView<PropsType extends EditableBlockProps> exte
|
|
|
4
4
|
ignoreMutation: () => boolean;
|
|
5
5
|
stopEvent: () => boolean;
|
|
6
6
|
createElement: () => void;
|
|
7
|
+
updateContents: () => void;
|
|
8
|
+
private onClickHandler;
|
|
7
9
|
}
|
|
8
10
|
declare const _default: (props: import("./base_node_view").BaseNodeProps, dispatch?: import("..").Dispatch | undefined) => import("../types").NodeViewCreator<AffiliationsView<any>>;
|
|
9
11
|
export default _default;
|
|
@@ -24,27 +24,28 @@ export interface ContributorsProps extends EditableBlockProps {
|
|
|
24
24
|
selectAuthorForEditing: (authorId: string) => void;
|
|
25
25
|
}
|
|
26
26
|
export declare class ContributorsView<PropsType extends ContributorsProps> extends BlockView<PropsType> {
|
|
27
|
+
contextMenu: HTMLElement;
|
|
27
28
|
container: HTMLElement;
|
|
28
29
|
inner: HTMLElement;
|
|
29
30
|
popper?: HTMLElement;
|
|
30
31
|
initialise: () => void;
|
|
31
32
|
updateContents: () => void;
|
|
32
33
|
buildAuthors: () => void;
|
|
33
|
-
buildAuthor: (node: ContributorNode, isJointFirstAuthor: boolean, selectedAuthor?: string) =>
|
|
34
|
+
buildAuthor: (node: ContributorNode, isJointFirstAuthor: boolean, selectedAuthor?: string) => HTMLDivElement;
|
|
34
35
|
createNote(text?: string, title?: string): HTMLSpanElement;
|
|
35
36
|
isJointFirstAuthor: (authors: ContributorNode[], index: number) => boolean;
|
|
36
37
|
createElement: () => void;
|
|
37
38
|
createDOM: () => void;
|
|
38
39
|
createEditButton: () => void;
|
|
39
40
|
createLegend: () => void;
|
|
40
|
-
|
|
41
|
+
private onClickHandler;
|
|
42
|
+
showContextMenu: (elementId: string) => void;
|
|
43
|
+
handleEdit: (id: string) => void;
|
|
41
44
|
handleSaveAuthor: (author: ContributorAttrs) => void;
|
|
42
45
|
handleDeleteAuthor: (author: ContributorAttrs) => void;
|
|
43
46
|
handleSaveAffiliation: (affiliation: AffiliationAttrs) => void;
|
|
44
47
|
insertAuthorNode: (attrs: ContributorAttrs) => void;
|
|
45
48
|
insertAffiliationNode: (attrs: AffiliationAttrs) => void;
|
|
46
|
-
ignoreMutation: () => boolean;
|
|
47
|
-
stopEvent: () => boolean;
|
|
48
49
|
}
|
|
49
50
|
declare const _default: (props: import("./base_node_view").BaseNodeProps, dispatch?: import("..").Dispatch | undefined) => import("../types").NodeViewCreator<ContributorsView<any>>;
|
|
50
51
|
export default _default;
|
|
@@ -21,6 +21,8 @@ export declare class KeywordGroupView extends BlockView<EditableBlockProps> {
|
|
|
21
21
|
ignoreMutation: () => boolean;
|
|
22
22
|
stopEvent: () => boolean;
|
|
23
23
|
createElement: () => void;
|
|
24
|
+
updateContents: () => void;
|
|
25
|
+
private onClickHandler;
|
|
24
26
|
}
|
|
25
27
|
declare const _default: (props: import("./base_node_view").BaseNodeProps, dispatch?: import("..").Dispatch | undefined) => import("../types").NodeViewCreator<KeywordGroupView>;
|
|
26
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": "1.7.
|
|
4
|
+
"version": "1.7.37",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@manuscripts/assets": "^0.6.4",
|
|
32
32
|
"@manuscripts/json-schema": "^2.2.7",
|
|
33
33
|
"@manuscripts/library": "^1.3.6",
|
|
34
|
-
"@manuscripts/style-guide": "1.8.
|
|
34
|
+
"@manuscripts/style-guide": "1.8.6",
|
|
35
35
|
"@manuscripts/track-changes-plugin": "1.7.9",
|
|
36
36
|
"@manuscripts/transform": "2.1.13",
|
|
37
37
|
"astrocite-eutils": "^0.16.4",
|
|
@@ -112,4 +112,4 @@
|
|
|
112
112
|
"@types/react": "^17.0.2",
|
|
113
113
|
"prosemirror-tables": "^1.3.5"
|
|
114
114
|
}
|
|
115
|
-
}
|
|
115
|
+
}
|
|
@@ -782,12 +782,6 @@ Next levels are shifted 'up' by 1
|
|
|
782
782
|
color: var(--deleted-color);
|
|
783
783
|
}
|
|
784
784
|
|
|
785
|
-
.contributor[data-track-op='delete']:not([data-track-status='rejected']),
|
|
786
|
-
.contributor[data-track-op='delete']:not([data-track-status='rejected']) .name,
|
|
787
|
-
.affiliation[data-track-op='delete']:not([data-track-status='rejected']) {
|
|
788
|
-
pointer-events: none;
|
|
789
|
-
}
|
|
790
|
-
|
|
791
785
|
.contributor[data-track-op='delete']:not([data-track-status='rejected']) {
|
|
792
786
|
color: var(--deleted-color);
|
|
793
787
|
}
|
|
@@ -805,29 +799,52 @@ Next levels are shifted 'up' by 1
|
|
|
805
799
|
.contributors {
|
|
806
800
|
white-space: initial;
|
|
807
801
|
margin-top: 24px;
|
|
808
|
-
align-items: center;
|
|
809
802
|
display: flex;
|
|
810
803
|
justify-content: space-between;
|
|
804
|
+
align-items: flex-start;
|
|
805
|
+
gap: 0 .5em;
|
|
811
806
|
}
|
|
812
807
|
.contributors-list {
|
|
808
|
+
display: flex;
|
|
809
|
+
max-width: 100%;
|
|
813
810
|
flex: 0 1 auto;
|
|
811
|
+
flex-wrap: wrap;
|
|
812
|
+
gap: 0 .25em;
|
|
814
813
|
}
|
|
815
|
-
|
|
816
814
|
.contributors .tools-panel {
|
|
817
815
|
position: initial;
|
|
816
|
+
display: flex;
|
|
818
817
|
flex: 1;
|
|
818
|
+
align-items: center;
|
|
819
|
+
}
|
|
820
|
+
.contributor-wrapper {
|
|
821
|
+
display: flex;
|
|
822
|
+
}
|
|
823
|
+
.contributor-wrapper:after {
|
|
824
|
+
content: ', ';
|
|
825
|
+
color: #353535;
|
|
826
|
+
}
|
|
827
|
+
.contributor-wrapper:last-child::after {
|
|
828
|
+
content: '';
|
|
829
|
+
margin-right: 0;
|
|
830
|
+
}
|
|
831
|
+
.contributor-wrapper .contributor-comment {
|
|
832
|
+
left: 0;
|
|
833
|
+
top: -8px;
|
|
834
|
+
width: auto;
|
|
835
|
+
height: auto;
|
|
819
836
|
}
|
|
820
|
-
|
|
821
837
|
.contributor {
|
|
838
|
+
position: relative;
|
|
822
839
|
display: inline-flex;
|
|
823
840
|
background: transparent;
|
|
824
841
|
border: 0;
|
|
825
|
-
font-family: 'PT Sans', sans-serif;
|
|
826
842
|
font-size: 1rem;
|
|
827
843
|
text-decoration: none;
|
|
828
844
|
color: inherit;
|
|
829
845
|
outline: none;
|
|
830
|
-
padding:
|
|
846
|
+
padding: 4px;
|
|
847
|
+
/* margin: 0 6px; */
|
|
831
848
|
}
|
|
832
849
|
|
|
833
850
|
.contributor:not(:disabled):hover {
|
|
@@ -843,16 +860,6 @@ Next levels are shifted 'up' by 1
|
|
|
843
860
|
cursor: pointer !important;
|
|
844
861
|
}
|
|
845
862
|
|
|
846
|
-
.contributor:after {
|
|
847
|
-
content: ', ';
|
|
848
|
-
color: #353535;
|
|
849
|
-
margin-right: 5px;
|
|
850
|
-
}
|
|
851
|
-
.contributor:last-child::after {
|
|
852
|
-
content: '';
|
|
853
|
-
margin-right: 0;
|
|
854
|
-
}
|
|
855
|
-
|
|
856
863
|
.contributors-legend {
|
|
857
864
|
margin: 16px 0 0 0;
|
|
858
865
|
}
|
|
@@ -864,11 +871,7 @@ Next levels are shifted 'up' by 1
|
|
|
864
871
|
vertical-align: top;
|
|
865
872
|
}
|
|
866
873
|
|
|
867
|
-
|
|
868
|
-
align-items: center;
|
|
869
|
-
display: flex;
|
|
870
|
-
margin-left: 8px;
|
|
871
|
-
}
|
|
874
|
+
|
|
872
875
|
|
|
873
876
|
.contributor-note {
|
|
874
877
|
display: inline-block;
|
|
@@ -897,4 +900,4 @@ Next levels are shifted 'up' by 1
|
|
|
897
900
|
|
|
898
901
|
* {
|
|
899
902
|
scroll-behavior: smooth;
|
|
900
|
-
}
|
|
903
|
+
}
|