@manuscripts/body-editor 1.6.20 → 1.7.0

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.
@@ -25,6 +25,7 @@ const prosemirror_dropcursor_1 = require("prosemirror-dropcursor");
25
25
  const prosemirror_history_1 = require("prosemirror-history");
26
26
  const prosemirror_tables_1 = require("prosemirror-tables");
27
27
  const keys_1 = __importDefault(require("../keys"));
28
+ const affiliations_1 = __importDefault(require("../plugins/affiliations"));
28
29
  const bibliography_1 = __importDefault(require("../plugins/bibliography"));
29
30
  const comment_annotation_1 = __importDefault(require("../plugins/comment_annotation"));
30
31
  const elements_1 = __importDefault(require("../plugins/elements"));
@@ -55,6 +56,7 @@ exports.default = (props) => {
55
56
  (0, toc_1.default)(props),
56
57
  (0, bibliography_1.default)(props),
57
58
  (0, objects_1.default)(props),
59
+ (0, affiliations_1.default)(),
58
60
  (0, comment_annotation_1.default)(props),
59
61
  (0, paragraphs_1.default)(),
60
62
  (0, placeholder_1.default)(),
@@ -18,6 +18,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
18
18
  return (mod && mod.__esModule) ? mod : { "default": mod };
19
19
  };
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
+ const affiliation_1 = __importDefault(require("../views/affiliation"));
22
+ const affiliations_1 = __importDefault(require("../views/affiliations"));
21
23
  const bibliography_element_editable_1 = __importDefault(require("../views/bibliography_element_editable"));
22
24
  const blockquote_element_editable_1 = __importDefault(require("../views/blockquote_element_editable"));
23
25
  const bullet_list_editable_1 = __importDefault(require("../views/bullet_list_editable"));
@@ -58,6 +60,8 @@ exports.default = (props, dispatch) => {
58
60
  citation: (0, citation_editable_1.default)(props, dispatch),
59
61
  cross_reference: (0, cross_reference_editable_1.default)(props, dispatch),
60
62
  contributors: (0, contributors_1.default)(props, dispatch),
63
+ affiliations: (0, affiliations_1.default)(props, dispatch),
64
+ affiliation: (0, affiliation_1.default)(props, dispatch),
61
65
  equation: (0, equation_editable_1.default)(props),
62
66
  equation_element: (0, equation_element_editable_1.default)(props),
63
67
  figure: (0, figure_editable_1.default)(props, dispatch),
package/dist/cjs/index.js CHANGED
@@ -52,4 +52,5 @@ Object.defineProperty(exports, "commentScroll", { enumerable: true, get: functio
52
52
  Object.defineProperty(exports, "isThereSelector", { enumerable: true, get: function () { return comment_annotation_1.isThereSelector; } });
53
53
  Object.defineProperty(exports, "isHighlightComment", { enumerable: true, get: function () { return comment_annotation_1.isHighlightComment; } });
54
54
  __exportStar(require("./lib/utils"), exports);
55
+ __exportStar(require("./lib/track-changes-utils"), exports);
55
56
  __exportStar(require("./useEditor"), exports);
@@ -15,7 +15,7 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.isTracked = exports.getChangeClasses = exports.isPendingSetAttrs = exports.isPending = exports.isPendingInsert = exports.isDeleted = exports.isRejectedInsert = void 0;
18
+ exports.getActualAttrs = exports.isTracked = exports.getChangeClasses = exports.isPendingSetAttrs = exports.isPending = exports.isPendingInsert = exports.isDeleted = exports.isRejectedInsert = void 0;
19
19
  function isRejectedInsert(node) {
20
20
  if (node.attrs.dataTracked) {
21
21
  const changes = node.attrs.dataTracked;
@@ -80,3 +80,13 @@ function isTracked(node) {
80
80
  return false;
81
81
  }
82
82
  exports.isTracked = isTracked;
83
+ function getActualAttrs(node) {
84
+ const attrs = node.attrs;
85
+ if (attrs.dataTracked &&
86
+ attrs.dataTracked[0].status === 'rejected' &&
87
+ attrs.dataTracked[0].operation === 'set_attrs') {
88
+ return attrs.dataTracked[0].oldAttrs;
89
+ }
90
+ return attrs;
91
+ }
92
+ exports.getActualAttrs = getActualAttrs;
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ /*!
3
+ * © 2019 Atypon Systems LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.buildPluginState = exports.affiliationsKey = void 0;
19
+ const transform_1 = require("@manuscripts/transform");
20
+ const prosemirror_state_1 = require("prosemirror-state");
21
+ const prosemirror_view_1 = require("prosemirror-view");
22
+ const track_changes_utils_1 = require("../lib/track-changes-utils");
23
+ exports.affiliationsKey = new prosemirror_state_1.PluginKey('affiliations');
24
+ const buildPluginState = (doc) => {
25
+ const contributors = [];
26
+ const affiliations = [];
27
+ doc.descendants((node, pos) => {
28
+ if ((0, track_changes_utils_1.isDeleted)(node)) {
29
+ return;
30
+ }
31
+ if ((0, transform_1.isAffiliationNode)(node)) {
32
+ affiliations.push([node, pos]);
33
+ }
34
+ if ((0, transform_1.isContributorNode)(node)) {
35
+ contributors.push([node, pos]);
36
+ }
37
+ });
38
+ const iAffiliations = new Set();
39
+ contributors
40
+ .sort(([a], [b]) => {
41
+ return (Number((0, track_changes_utils_1.getActualAttrs)(a).priority) - Number((0, track_changes_utils_1.getActualAttrs)(b).priority));
42
+ })
43
+ .forEach(([author]) => {
44
+ (0, track_changes_utils_1.getActualAttrs)(author).affiliations.forEach((aff) => {
45
+ iAffiliations.add(aff);
46
+ });
47
+ });
48
+ const indexedAffiliationIds = new Map([...iAffiliations].map((id, i) => [id, i + 1]));
49
+ return {
50
+ indexedAffiliationIds,
51
+ contributors,
52
+ affiliations,
53
+ };
54
+ };
55
+ exports.buildPluginState = buildPluginState;
56
+ let count = 0;
57
+ exports.default = () => {
58
+ return new prosemirror_state_1.Plugin({
59
+ key: exports.affiliationsKey,
60
+ state: {
61
+ init(config, instance) {
62
+ return (0, exports.buildPluginState)(instance.doc);
63
+ },
64
+ apply(tr, value, oldState, newState) {
65
+ const prevPluginState = exports.affiliationsKey.getState(oldState);
66
+ if (!tr.docChanged && prevPluginState) {
67
+ return prevPluginState;
68
+ }
69
+ else {
70
+ return (0, exports.buildPluginState)(newState.doc);
71
+ }
72
+ },
73
+ },
74
+ appendTransaction(transactions, oldState, newState) {
75
+ const { indexedAffiliationIds } = exports.affiliationsKey.getState(newState);
76
+ const oldPluginState = exports.affiliationsKey.getState(oldState);
77
+ const { tr } = newState;
78
+ const affiliations = [];
79
+ newState.doc.descendants((node, pos) => {
80
+ if ((0, track_changes_utils_1.isDeleted)(node)) {
81
+ return;
82
+ }
83
+ if ((0, transform_1.isAffiliationNode)(node)) {
84
+ affiliations.push([node, pos]);
85
+ }
86
+ });
87
+ for (const [id] of oldPluginState.indexedAffiliationIds.entries()) {
88
+ if (!indexedAffiliationIds.has(id)) {
89
+ const affiliation = affiliations.find(([node]) => node.attrs.id === id);
90
+ if (affiliation && !(0, track_changes_utils_1.isPendingInsert)(affiliation[0])) {
91
+ tr.delete(affiliation[1], affiliation[1] + affiliation[0].nodeSize);
92
+ }
93
+ }
94
+ }
95
+ tr.setMeta('origin', 'affiliations');
96
+ return tr;
97
+ },
98
+ props: {
99
+ decorations: (state) => {
100
+ const decorations = [];
101
+ const allNodes = [];
102
+ state.doc.descendants((node, pos) => {
103
+ if ((0, transform_1.isAffiliationNode)(node) || (0, transform_1.isContributorNode)(node)) {
104
+ allNodes.push([node, pos]);
105
+ }
106
+ });
107
+ if (allNodes.length) {
108
+ allNodes.forEach(([node, pos]) => {
109
+ decorations.push(prosemirror_view_1.Decoration.node(pos, pos + node.nodeSize, {}, {
110
+ refresh: count++,
111
+ }));
112
+ });
113
+ }
114
+ return prosemirror_view_1.DecorationSet.create(state.doc, decorations);
115
+ },
116
+ },
117
+ });
118
+ };
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ /*!
3
+ * © 2019 Atypon Systems LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.AffiliationView = void 0;
19
+ const track_changes_utils_1 = require("../lib/track-changes-utils");
20
+ const affiliations_1 = require("../plugins/affiliations");
21
+ const base_node_view_1 = require("./base_node_view");
22
+ const creators_1 = require("./creators");
23
+ class AffiliationView extends base_node_view_1.BaseNodeView {
24
+ constructor() {
25
+ super(...arguments);
26
+ this.initialise = () => {
27
+ this.createDOM();
28
+ };
29
+ this.updateContents = () => {
30
+ var _a;
31
+ const attrs = this.node.attrs;
32
+ const pluginState = affiliations_1.affiliationsKey.getState(this.view.state);
33
+ this.dom.innerHTML = this.formatAddress((0, track_changes_utils_1.getActualAttrs)(this.node));
34
+ if (pluginState === null || pluginState === void 0 ? void 0 : pluginState.indexedAffiliationIds) {
35
+ const order = pluginState.indexedAffiliationIds.get(attrs.id);
36
+ this.dom.innerHTML = order
37
+ ? `<b>${order}</b> ${this.dom.innerHTML}`
38
+ : this.dom.innerHTML;
39
+ this.dom.setAttribute('style', 'order: ' + (order || (pluginState === null || pluginState === void 0 ? void 0 : pluginState.affiliations.length) + 1));
40
+ }
41
+ if ((_a = attrs.dataTracked) === null || _a === void 0 ? void 0 : _a.length) {
42
+ this.dom.setAttribute('data-track-status', attrs.dataTracked[0].status);
43
+ this.dom.setAttribute('data-track-op', attrs.dataTracked[0].operation);
44
+ }
45
+ else {
46
+ this.dom.removeAttribute('data-track-status');
47
+ this.dom.removeAttribute('data-track-type');
48
+ }
49
+ };
50
+ this.createDOM = () => {
51
+ this.dom = document.createElement('div');
52
+ this.dom.classList.add('affiliation');
53
+ this.dom.setAttribute('id', this.node.attrs.id);
54
+ this.updateContents();
55
+ };
56
+ this.ignoreMutation = () => true;
57
+ this.stopEvent = () => true;
58
+ this.formatAddress = (affiliation) => {
59
+ const { department, institution, addressLine1, city, county, country, postCode, } = affiliation;
60
+ return [
61
+ department,
62
+ institution,
63
+ addressLine1,
64
+ city,
65
+ county,
66
+ country,
67
+ postCode,
68
+ ]
69
+ .filter(Boolean)
70
+ .join(', ');
71
+ };
72
+ }
73
+ }
74
+ exports.AffiliationView = AffiliationView;
75
+ exports.default = (0, creators_1.createNodeView)(AffiliationView);
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.AffiliationsView = void 0;
7
+ const block_view_1 = __importDefault(require("./block_view"));
8
+ const creators_1 = require("./creators");
9
+ class AffiliationsView extends block_view_1.default {
10
+ constructor() {
11
+ super(...arguments);
12
+ this.ignoreMutation = () => true;
13
+ this.stopEvent = () => true;
14
+ this.createElement = () => {
15
+ this.contentDOM = document.createElement(this.elementType);
16
+ this.contentDOM.className = 'block';
17
+ this.contentDOM.setAttribute('contenteditable', 'false');
18
+ this.dom.setAttribute('contenteditable', 'false');
19
+ this.dom.appendChild(this.contentDOM);
20
+ };
21
+ }
22
+ }
23
+ exports.AffiliationsView = AffiliationsView;
24
+ exports.default = (0, creators_1.createNodeView)(AffiliationsView);
@@ -4,32 +4,171 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ContributorsView = void 0;
7
- const base_node_view_1 = require("./base_node_view");
7
+ const style_guide_1 = require("@manuscripts/style-guide");
8
+ const transform_1 = require("@manuscripts/transform");
9
+ const track_changes_utils_1 = require("../lib/track-changes-utils");
10
+ const affiliations_1 = require("../plugins/affiliations");
11
+ const block_view_1 = __importDefault(require("./block_view"));
8
12
  const creators_1 = require("./creators");
9
13
  const ReactSubView_1 = __importDefault(require("./ReactSubView"));
10
- class ContributorsView extends base_node_view_1.BaseNodeView {
14
+ class ContributorsView extends block_view_1.default {
11
15
  constructor() {
12
16
  super(...arguments);
13
17
  this.initialise = () => {
14
18
  this.createDOM();
19
+ this.createGutter('block-gutter', this.gutterButtons().filter(Boolean));
20
+ this.createElement();
21
+ this.createGutter('action-gutter', this.actionGutterButtons().filter(Boolean));
22
+ this.updateContents();
23
+ };
24
+ this.updateContents = () => {
25
+ this.updateClasses();
26
+ this.updateAttributes();
27
+ this.container.innerHTML = '';
28
+ this.buildAuthors();
29
+ this.createEditButton();
30
+ this.createLegend();
31
+ };
32
+ this.buildAuthors = () => {
33
+ var _a;
34
+ const authors = [];
35
+ const authorsWrapper = document.createElement('div');
36
+ authorsWrapper.classList.add('contributors-list');
37
+ (_a = this.node.content) === null || _a === void 0 ? void 0 : _a.forEach((node) => {
38
+ if ((0, transform_1.isContributorNode)(node)) {
39
+ authors.push(node);
40
+ }
41
+ });
42
+ authors
43
+ .sort((a, b) => Number(a.attrs.priority) - Number(b.attrs.priority))
44
+ .forEach((author, i) => {
45
+ if ((0, track_changes_utils_1.getActualAttrs)(author).role !== 'author') {
46
+ return;
47
+ }
48
+ const jointAuthors = this.isJointFirstAuthor(authors, i);
49
+ authorsWrapper.appendChild(this.buildAuthor(author, jointAuthors));
50
+ });
51
+ this.container.appendChild(authorsWrapper);
52
+ };
53
+ this.buildAuthor = (node, isJointFirstAuthor) => {
54
+ var _a;
55
+ const pluginState = affiliations_1.affiliationsKey.getState(this.view.state);
56
+ const attrs = node.attrs;
57
+ const displayAttr = (0, track_changes_utils_1.getActualAttrs)(node);
58
+ const container = document.createElement('button');
59
+ container.classList.add('contributor');
60
+ container.setAttribute('id', attrs.id);
61
+ container.setAttribute('contenteditable', 'false');
62
+ if ((_a = attrs.dataTracked) === null || _a === void 0 ? void 0 : _a.length) {
63
+ container.setAttribute('data-track-status', attrs.dataTracked[0].status);
64
+ container.setAttribute('data-track-op', attrs.dataTracked[0].operation);
65
+ }
66
+ else {
67
+ container.removeAttribute('data-track-status');
68
+ container.removeAttribute('data-track-type');
69
+ }
70
+ const can = this.props.getCapabilities();
71
+ const disableEditButton = !can.editMetadata;
72
+ const { bibliographicName, isCorresponding, email, id } = displayAttr;
73
+ container.addEventListener('click', (e) => {
74
+ e.preventDefault();
75
+ if (!disableEditButton) {
76
+ this.props.openAuthorEditing();
77
+ this.props.selectAuthorForEditing(id);
78
+ }
79
+ });
80
+ const name = this.buildNameLiteral(bibliographicName);
81
+ container.innerHTML =
82
+ isCorresponding && email
83
+ ? `<span class="name">${name} (${email})</span>`
84
+ : `<span class="name">${name}</span>`;
85
+ const noteText = [];
86
+ if (pluginState === null || pluginState === void 0 ? void 0 : pluginState.indexedAffiliationIds) {
87
+ displayAttr.affiliations.map((af) => {
88
+ const index = pluginState === null || pluginState === void 0 ? void 0 : pluginState.indexedAffiliationIds.get(af);
89
+ if (index) {
90
+ noteText.push(index.toString());
91
+ }
92
+ });
93
+ }
94
+ if (isJointFirstAuthor) {
95
+ container.appendChild(this.createNote('†', 'Joint contributor'));
96
+ }
97
+ if (noteText) {
98
+ container.appendChild(this.createNote(noteText.join(',')));
99
+ }
100
+ if (displayAttr.isCorresponding) {
101
+ container.appendChild(this.createNote('*', 'Corresponding author'));
102
+ }
103
+ return container;
104
+ };
105
+ this.initials = (given) => given
106
+ ? given
107
+ .trim()
108
+ .split(' ')
109
+ .map((part) => part.substr(0, 1).toUpperCase() + '.')
110
+ .join('')
111
+ : '';
112
+ this.buildNameLiteral = ({ given = '', family = '', suffix = '' }) => {
113
+ if (!given && !family) {
114
+ return 'Unknown Author';
115
+ }
116
+ return [this.initials(given), family, suffix]
117
+ .filter((part) => part)
118
+ .join(' ');
119
+ };
120
+ this.isJointFirstAuthor = (authors, index) => {
121
+ const author = index === 0 ? authors[index] : authors[index - 1];
122
+ return Boolean(author.attrs.isJointContributor);
123
+ };
124
+ this.createElement = () => {
125
+ this.inner = document.createElement('div');
126
+ this.inner.classList.add('authors-container', 'block');
127
+ this.dom.appendChild(this.inner);
128
+ this.container = document.createElement('div');
129
+ this.container.classList.add('contributors');
130
+ this.inner.appendChild(this.container);
15
131
  };
16
132
  this.createDOM = () => {
17
133
  this.dom = document.createElement('div');
18
- this.dom.classList.add('contributors');
134
+ this.dom.classList.add('block-container', `block-${this.node.type.name}`);
135
+ };
136
+ this.createEditButton = () => {
19
137
  const can = this.props.getCapabilities();
20
- const { components: { AuthorsInlineViewContainer }, subscribeStore, } = this.props;
21
- this.metadata = (0, ReactSubView_1.default)(this.props, AuthorsInlineViewContainer, {
22
- showAuthorEditButton: true,
23
- disableEditButton: !can.editMetadata,
24
- subscribe: subscribeStore,
25
- }, this.node, this.getPos, this.view, 'metadata-container');
26
- if (this.metadata) {
27
- this.dom.appendChild(this.metadata);
138
+ const button = (0, ReactSubView_1.default)(this.props, style_guide_1.SecondaryButton, {
139
+ mini: true,
140
+ onClick: this.props.openAuthorEditing,
141
+ className: 'edit-authors-button',
142
+ disabled: !can.editMetadata,
143
+ children: 'Edit Authors',
144
+ }, this.node, this.getPos, this.view);
145
+ this.container.appendChild(button);
146
+ };
147
+ this.createLegend = () => {
148
+ const state = affiliations_1.affiliationsKey.getState(this.view.state);
149
+ if (state === null || state === void 0 ? void 0 : state.contributors) {
150
+ const isThereJointContributor = state.contributors.find(([contributor]) => contributor.attrs.isJointContributor);
151
+ if (isThereJointContributor) {
152
+ const element = document.createElement('p');
153
+ element.classList.add('contributors-legend');
154
+ element.innerHTML =
155
+ '<span class="symbol">†</span>These authors contributed equally to this work.';
156
+ this.container.appendChild(element);
157
+ }
28
158
  }
29
159
  };
30
160
  this.ignoreMutation = () => true;
31
161
  this.stopEvent = () => true;
32
162
  }
163
+ createNote(text = '', title = '') {
164
+ const el = document.createElement('span');
165
+ el.innerHTML = text;
166
+ if (title) {
167
+ el.setAttribute('title', title);
168
+ }
169
+ el.classList.add('contributor-note');
170
+ return el;
171
+ }
33
172
  }
34
173
  exports.ContributorsView = ContributorsView;
35
174
  exports.default = (0, creators_1.createNodeView)(ContributorsView);
@@ -32,6 +32,7 @@ const style_guide_1 = require("@manuscripts/style-guide");
32
32
  const react_1 = require("react");
33
33
  const react_dom_1 = __importDefault(require("react-dom"));
34
34
  const FigureDropdown_1 = require("../components/views/FigureDropdown");
35
+ const track_changes_utils_1 = require("../lib/track-changes-utils");
35
36
  const creators_1 = require("./creators");
36
37
  const figure_1 = require("./figure");
37
38
  const figure_uploader_1 = require("./figure_uploader");
@@ -50,12 +51,8 @@ class FigureEditableView extends figure_1.FigureView {
50
51
  };
51
52
  this.updateContents = () => {
52
53
  var _a, _b;
53
- let attrs = this.node.attrs;
54
+ const attrs = (0, track_changes_utils_1.getActualAttrs)(this.node);
54
55
  if ((_a = this.node.attrs.dataTracked) === null || _a === void 0 ? void 0 : _a.length) {
55
- if (this.node.attrs.dataTracked[0].status === 'rejected' &&
56
- this.node.attrs.dataTracked[0].operation === 'set_attrs') {
57
- attrs = this.node.attrs.dataTracked[0].oldAttrs;
58
- }
59
56
  this.dom.setAttribute('data-track-status', this.node.attrs.dataTracked[0].status);
60
57
  this.dom.setAttribute('data-track-op', this.node.attrs.dataTracked[0].operation);
61
58
  }
@@ -19,6 +19,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
19
19
  };
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.KeywordView = void 0;
22
+ const prosemirror_state_1 = require("prosemirror-state");
22
23
  const DeleteKeywordDialog_1 = require("../components/keywords/DeleteKeywordDialog");
23
24
  const track_changes_utils_1 = require("../lib/track-changes-utils");
24
25
  const base_node_view_1 = require("./base_node_view");
@@ -67,7 +68,7 @@ class KeywordView extends base_node_view_1.BaseNodeView {
67
68
  const pos = this.getPos();
68
69
  const handleDelete = () => {
69
70
  const tr = this.view.state.tr;
70
- tr.delete(pos, pos + keyword.nodeSize);
71
+ tr.setSelection(prosemirror_state_1.TextSelection.near(this.view.state.doc.resolve(0))).delete(pos, pos + keyword.nodeSize + 1);
71
72
  this.view.dispatch(tr);
72
73
  };
73
74
  const componentProps = {
@@ -20,6 +20,7 @@ import { dropCursor } from 'prosemirror-dropcursor';
20
20
  import { history } from 'prosemirror-history';
21
21
  import { tableEditing } from 'prosemirror-tables';
22
22
  import keys from '../keys';
23
+ import affiliations from '../plugins/affiliations';
23
24
  import bibliography from '../plugins/bibliography';
24
25
  import comment_annotation from '../plugins/comment_annotation';
25
26
  import elements from '../plugins/elements';
@@ -50,6 +51,7 @@ export default (props) => {
50
51
  toc(props),
51
52
  bibliography(props),
52
53
  objects(props),
54
+ affiliations(),
53
55
  comment_annotation(props),
54
56
  paragraphs(),
55
57
  placeholder(),
@@ -13,6 +13,8 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import affiliation from '../views/affiliation';
17
+ import affiliationsSection from '../views/affiliations';
16
18
  import bibliographyElement from '../views/bibliography_element_editable';
17
19
  import blockquoteElement from '../views/blockquote_element_editable';
18
20
  import bulletList from '../views/bullet_list_editable';
@@ -53,6 +55,8 @@ export default (props, dispatch) => {
53
55
  citation: citation(props, dispatch),
54
56
  cross_reference: crossReference(props, dispatch),
55
57
  contributors: contributorsSection(props, dispatch),
58
+ affiliations: affiliationsSection(props, dispatch),
59
+ affiliation: affiliation(props, dispatch),
56
60
  equation: equation(props),
57
61
  equation_element: equationElement(props),
58
62
  figure: figure(props, dispatch),
package/dist/es/index.js CHANGED
@@ -26,4 +26,5 @@ export * from './toolbar';
26
26
  export * from './plugins/highlight';
27
27
  export { commentScroll, isThereSelector, isHighlightComment, } from './plugins/comment_annotation';
28
28
  export * from './lib/utils';
29
+ export * from './lib/track-changes-utils';
29
30
  export * from './useEditor';
@@ -70,3 +70,12 @@ export function isTracked(node) {
70
70
  }
71
71
  return false;
72
72
  }
73
+ export function getActualAttrs(node) {
74
+ const attrs = node.attrs;
75
+ if (attrs.dataTracked &&
76
+ attrs.dataTracked[0].status === 'rejected' &&
77
+ attrs.dataTracked[0].operation === 'set_attrs') {
78
+ return attrs.dataTracked[0].oldAttrs;
79
+ }
80
+ return attrs;
81
+ }