@manuscripts/body-editor 2.7.1-LEAN-4077.3 → 2.7.1

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.
Files changed (43) hide show
  1. package/dist/cjs/commands.js +1 -16
  2. package/dist/cjs/components/authors/AffiliationForm.js +1 -1
  3. package/dist/cjs/components/authors/AuthorDetailsForm.js +1 -1
  4. package/dist/cjs/components/{ChangeHandlingForm.js → authors/ChangeHandlingForm.js} +2 -12
  5. package/dist/cjs/components/outline/DraggableTree.js +1 -0
  6. package/dist/cjs/components/references/ReferenceForm.js +16 -3
  7. package/dist/cjs/icons.js +1 -2
  8. package/dist/cjs/lib/doc.js +1 -29
  9. package/dist/cjs/menus.js +0 -6
  10. package/dist/cjs/versions.js +1 -1
  11. package/dist/cjs/views/award.js +16 -108
  12. package/dist/cjs/views/awards.js +12 -13
  13. package/dist/es/commands.js +1 -14
  14. package/dist/es/components/authors/AffiliationForm.js +1 -1
  15. package/dist/es/components/authors/AuthorDetailsForm.js +1 -1
  16. package/dist/es/components/{ChangeHandlingForm.js → authors/ChangeHandlingForm.js} +1 -8
  17. package/dist/es/components/outline/DraggableTree.js +1 -0
  18. package/dist/es/components/references/ReferenceForm.js +16 -3
  19. package/dist/es/icons.js +1 -2
  20. package/dist/es/lib/doc.js +0 -27
  21. package/dist/es/menus.js +1 -7
  22. package/dist/es/versions.js +1 -1
  23. package/dist/es/views/award.js +16 -108
  24. package/dist/es/views/awards.js +9 -13
  25. package/dist/types/commands.d.ts +0 -1
  26. package/dist/types/components/{ChangeHandlingForm.d.ts → authors/ChangeHandlingForm.d.ts} +0 -1
  27. package/dist/types/components/references/ReferenceForm.d.ts +1 -0
  28. package/dist/types/icons.d.ts +0 -1
  29. package/dist/types/lib/doc.d.ts +0 -1
  30. package/dist/types/versions.d.ts +1 -1
  31. package/dist/types/views/award.d.ts +3 -12
  32. package/dist/types/views/awards.d.ts +3 -5
  33. package/package.json +3 -3
  34. package/styles/AdvancedEditor.css +30 -33
  35. package/dist/cjs/components/awards/AwardForm.js +0 -145
  36. package/dist/cjs/components/awards/AwardModal.js +0 -80
  37. package/dist/cjs/components/awards/DeleteAwardDiaolog.js +0 -45
  38. package/dist/es/components/awards/AwardForm.js +0 -115
  39. package/dist/es/components/awards/AwardModal.js +0 -50
  40. package/dist/es/components/awards/DeleteAwardDiaolog.js +0 -18
  41. package/dist/types/components/awards/AwardForm.d.ts +0 -24
  42. package/dist/types/components/awards/AwardModal.d.ts +0 -14
  43. package/dist/types/components/awards/DeleteAwardDiaolog.d.ts +0 -5
@@ -15,8 +15,7 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.mergeCellsWithSpace = exports.addColumns = exports.addHeaderRow = exports.addRows = exports.addInlineComment = exports.addNodeComment = exports.createAndFillTableElement = exports.selectAllIsolating = exports.ignoreAtomBlockNodeForward = exports.isAtEndOfTextBlock = exports.ignoreMetaNodeBackspaceCommand = exports.ignoreAtomBlockNodeBackward = exports.isTextSelection = exports.isAtStartOfTextBlock = exports.insertTOCSection = exports.insertBibliographySection = exports.insertList = exports.insertKeywords = exports.insertAward = exports.insertAffiliation = exports.insertContributors = exports.insertAbstract = exports.insertBackmatterSection = exports.insertSection = exports.insertGraphicalAbstract = exports.insertBoxElement = exports.insertInlineFootnote = exports.insertFootnotesElement = exports.insertTableElementFooter = exports.insertInlineEquation = exports.insertCrossReference = exports.insertInlineCitation = exports.insertLink = exports.insertSectionLabel = exports.findPosBeforeFirstSubsection = exports.insertBreak = exports.deleteBlock = exports.insertBlock = exports.insertSupplement = exports.insertTable = exports.insertFigure = exports.insertGeneralTableFootnote = exports.insertInlineTableFootnote = exports.createBlock = exports.createSelection = exports.canInsert = exports.blockActive = exports.isNodeSelection = exports.markActive = exports.addToStart = void 0;
19
- exports.autoComplete = void 0;
18
+ exports.autoComplete = exports.mergeCellsWithSpace = exports.addColumns = exports.addHeaderRow = exports.addRows = exports.addInlineComment = exports.addNodeComment = exports.createAndFillTableElement = exports.selectAllIsolating = exports.ignoreAtomBlockNodeForward = exports.isAtEndOfTextBlock = exports.ignoreMetaNodeBackspaceCommand = exports.ignoreAtomBlockNodeBackward = exports.isTextSelection = exports.isAtStartOfTextBlock = exports.insertTOCSection = exports.insertBibliographySection = exports.insertList = exports.insertKeywords = exports.insertAffiliation = exports.insertContributors = exports.insertAbstract = exports.insertBackmatterSection = exports.insertSection = exports.insertGraphicalAbstract = exports.insertBoxElement = exports.insertInlineFootnote = exports.insertFootnotesElement = exports.insertTableElementFooter = exports.insertInlineEquation = exports.insertCrossReference = exports.insertInlineCitation = exports.insertLink = exports.insertSectionLabel = exports.findPosBeforeFirstSubsection = exports.insertBreak = exports.deleteBlock = exports.insertBlock = exports.insertSupplement = exports.insertTable = exports.insertFigure = exports.insertGeneralTableFootnote = exports.insertInlineTableFootnote = exports.createBlock = exports.createSelection = exports.canInsert = exports.blockActive = exports.isNodeSelection = exports.markActive = exports.addToStart = void 0;
20
19
  const json_schema_1 = require("@manuscripts/json-schema");
21
20
  const track_changes_plugin_1 = require("@manuscripts/track-changes-plugin");
22
21
  const transform_1 = require("@manuscripts/transform");
@@ -655,20 +654,6 @@ const insertAffiliation = (state, dispatch, view) => {
655
654
  return true;
656
655
  };
657
656
  exports.insertAffiliation = insertAffiliation;
658
- const insertAward = (state, dispatch, view) => {
659
- const award = transform_1.schema.nodes.award.create();
660
- const tr = state.tr;
661
- const awards = (0, doc_1.insertAwardsNode)(tr);
662
- const pos = awards.pos + awards.node.nodeSize - 1;
663
- tr.insert(pos, award);
664
- const selection = prosemirror_state_1.NodeSelection.create(tr.doc, pos);
665
- view && view.focus();
666
- if (dispatch) {
667
- dispatch(tr.setSelection(selection).scrollIntoView());
668
- }
669
- return true;
670
- };
671
- exports.insertAward = insertAward;
672
657
  const insertKeywords = (state, dispatch, view) => {
673
658
  if ((0, utils_1.getChildOfType)(state.doc, transform_1.schema.nodes.keywords, true)) {
674
659
  return false;
@@ -8,7 +8,7 @@ const style_guide_1 = require("@manuscripts/style-guide");
8
8
  const formik_1 = require("formik");
9
9
  const react_1 = __importDefault(require("react"));
10
10
  const styled_components_1 = __importDefault(require("styled-components"));
11
- const ChangeHandlingForm_1 = require("../ChangeHandlingForm");
11
+ const ChangeHandlingForm_1 = require("./ChangeHandlingForm");
12
12
  const Row = styled_components_1.default.div `
13
13
  display: flex;
14
14
  border-top: 1px solid ${(props) => props.theme.colors.border.field.default};
@@ -46,7 +46,7 @@ const style_guide_1 = require("@manuscripts/style-guide");
46
46
  const formik_1 = require("formik");
47
47
  const react_1 = __importStar(require("react"));
48
48
  const styled_components_1 = __importDefault(require("styled-components"));
49
- const ChangeHandlingForm_1 = require("../ChangeHandlingForm");
49
+ const ChangeHandlingForm_1 = require("./ChangeHandlingForm");
50
50
  exports.LabelText = styled_components_1.default.div `
51
51
  font: ${(props) => props.theme.font.weight.normal}
52
52
  ${(props) => props.theme.font.size.normal} / 1
@@ -22,26 +22,16 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
25
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.FlexForm = exports.ChangeHandlingForm = void 0;
26
+ exports.ChangeHandlingForm = void 0;
30
27
  const formik_1 = require("formik");
31
28
  const react_1 = __importStar(require("react"));
32
- const styled_components_1 = __importDefault(require("styled-components"));
33
29
  const ChangeHandlingForm = (props) => {
34
30
  const { values } = (0, formik_1.useFormikContext)();
35
31
  (0, react_1.useEffect)(() => {
36
32
  var _a;
37
33
  (_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, values);
38
34
  }, [props.onChange, values]);
39
- return react_1.default.createElement(exports.FlexForm, null, props.children);
35
+ return react_1.default.createElement(formik_1.Form, null, props.children);
40
36
  };
41
37
  exports.ChangeHandlingForm = ChangeHandlingForm;
42
- exports.FlexForm = (0, styled_components_1.default)(formik_1.Form) `
43
- height: 100%;
44
- display: flex;
45
- flex-direction: column;
46
- overflow: hidden;
47
- `;
@@ -45,6 +45,7 @@ const excludedTypes = [
45
45
  transform_1.schema.nodes.author_notes,
46
46
  transform_1.schema.nodes.title,
47
47
  transform_1.schema.nodes.embed,
48
+ transform_1.schema.nodes.image_element,
48
49
  ];
49
50
  const childrenExcludedTypes = [
50
51
  transform_1.schema.nodes.pullquote_element,
@@ -41,13 +41,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
41
41
  return (mod && mod.__esModule) ? mod : { "default": mod };
42
42
  };
43
43
  Object.defineProperty(exports, "__esModule", { value: true });
44
- exports.ReferenceForm = exports.FormFields = exports.ReferenceTextArea = exports.FormField = exports.LabelContainer = void 0;
44
+ exports.ReferenceForm = exports.FormFields = exports.FlexForm = exports.ReferenceTextArea = exports.FormField = exports.LabelContainer = void 0;
45
45
  const json_schema_1 = require("@manuscripts/json-schema");
46
46
  const style_guide_1 = require("@manuscripts/style-guide");
47
47
  const formik_1 = require("formik");
48
48
  const react_1 = __importStar(require("react"));
49
49
  const styled_components_1 = __importDefault(require("styled-components"));
50
- const ChangeHandlingForm_1 = require("../ChangeHandlingForm");
51
50
  exports.LabelContainer = styled_components_1.default.div `
52
51
  display: flex;
53
52
  justify-content: space-between;
@@ -143,6 +142,12 @@ exports.ReferenceTextArea = (0, styled_components_1.default)(style_guide_1.TextA
143
142
  height: ${(props) => props.theme.grid.unit * 20}px;
144
143
  resize: none;
145
144
  `;
145
+ exports.FlexForm = (0, styled_components_1.default)(formik_1.Form) `
146
+ height: 100%;
147
+ display: flex;
148
+ flex-direction: column;
149
+ overflow: hidden;
150
+ `;
146
151
  exports.FormFields = styled_components_1.default.div `
147
152
  flex: 1;
148
153
  overflow-y: auto;
@@ -207,6 +212,14 @@ const bibliographyItemTypeOptions = bibliographyItemTypes.map((i) => ({
207
212
  label: i[1],
208
213
  value: i[0],
209
214
  }));
215
+ const ChangeHandlingForm = (props) => {
216
+ const { values } = (0, formik_1.useFormikContext)();
217
+ (0, react_1.useEffect)(() => {
218
+ var _a;
219
+ (_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, values);
220
+ }, [props.onChange, values]);
221
+ return react_1.default.createElement(exports.FlexForm, null, props.children);
222
+ };
210
223
  const ReferenceForm = ({ values, showDelete, onChange, onDelete, onCancel, onSave, actionsRef, }) => {
211
224
  const fieldsRef = (0, react_1.useRef)(null);
212
225
  (0, react_1.useEffect)(() => {
@@ -225,7 +238,7 @@ const ReferenceForm = ({ values, showDelete, onChange, onDelete, onCancel, onSav
225
238
  };
226
239
  }
227
240
  return (react_1.default.createElement(formik_1.Formik, { initialValues: values, onSubmit: onSave, enableReinitialize: true, innerRef: formRef }, (formik) => {
228
- return (react_1.default.createElement(ChangeHandlingForm_1.ChangeHandlingForm, { onChange: onChange },
241
+ return (react_1.default.createElement(ChangeHandlingForm, { onChange: onChange },
229
242
  react_1.default.createElement(style_guide_1.Dialog, { isOpen: showDeleteDialog, category: style_guide_1.Category.confirmation, header: "Delete Reference", message: "Are you sure you want to delete this reference from the list?", actions: {
230
243
  secondary: {
231
244
  action: () => {
package/dist/cjs/icons.js CHANGED
@@ -1,12 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.scrollIcon = exports.sectionCategoryIcon = exports.editIcon = exports.deleteIcon = exports.alertIcon = void 0;
3
+ exports.scrollIcon = exports.sectionCategoryIcon = exports.deleteIcon = exports.alertIcon = void 0;
4
4
  const style_guide_1 = require("@manuscripts/style-guide");
5
5
  const react_1 = require("react");
6
6
  const server_1 = require("react-dom/server");
7
7
  const renderIcon = (c) => (0, server_1.renderToStaticMarkup)((0, react_1.createElement)(c));
8
8
  exports.alertIcon = renderIcon(style_guide_1.AlertIcon);
9
9
  exports.deleteIcon = renderIcon(style_guide_1.DeleteIcon);
10
- exports.editIcon = (0, server_1.renderToStaticMarkup)((0, react_1.createElement)(style_guide_1.EditIcon));
11
10
  exports.sectionCategoryIcon = renderIcon(style_guide_1.SectionCategoryIcon);
12
11
  exports.scrollIcon = (0, server_1.renderToStaticMarkup)((0, react_1.createElement)(style_guide_1.ScrollIcon));
@@ -1,36 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.findNodeByID = exports.findGraphicalAbstractFigureElement = exports.findBibliographySection = exports.findBackmatter = exports.findBody = exports.findAbstractsNode = exports.insertFootnotesSection = exports.insertSupplementsNode = exports.insertAwardsNode = void 0;
3
+ exports.findNodeByID = exports.findGraphicalAbstractFigureElement = exports.findBibliographySection = exports.findBackmatter = exports.findBody = exports.findAbstractsNode = exports.insertFootnotesSection = exports.insertSupplementsNode = void 0;
4
4
  const transform_1 = require("@manuscripts/transform");
5
5
  const prosemirror_utils_1 = require("prosemirror-utils");
6
- const insertAwardsNode = (tr) => {
7
- const doc = tr.doc;
8
- const awards = (0, prosemirror_utils_1.findChildrenByType)(doc, transform_1.schema.nodes.awards)[0];
9
- if (awards) {
10
- return awards;
11
- }
12
- const positions = [];
13
- const possibleNodesTypes = [
14
- 'doi',
15
- 'keywords',
16
- 'supplements',
17
- 'abstracts',
18
- 'body',
19
- ];
20
- doc.descendants((node, pos) => {
21
- if (possibleNodesTypes.includes(node.type.name)) {
22
- positions.push(pos);
23
- }
24
- });
25
- const pos = positions.length === 0 ? 0 : Math.min(...positions);
26
- const node = transform_1.schema.nodes.awards.createAndFill();
27
- tr.insert(pos, node);
28
- return {
29
- node,
30
- pos,
31
- };
32
- };
33
- exports.insertAwardsNode = insertAwardsNode;
34
6
  const insertSupplementsNode = (tr) => {
35
7
  const doc = tr.doc;
36
8
  const supplements = (0, prosemirror_utils_1.findChildrenByType)(doc, transform_1.schema.nodes.supplements)[0];
package/dist/cjs/menus.js CHANGED
@@ -114,12 +114,6 @@ const getEditorMenus = (editor) => {
114
114
  isEnabled: isCommandValid(commands_1.insertAffiliation),
115
115
  run: doCommand(commands_1.insertAffiliation),
116
116
  },
117
- {
118
- id: 'insert-awards',
119
- label: 'Funder Information',
120
- isEnabled: isCommandValid(commands_1.insertAward),
121
- run: doCommand(commands_1.insertAward),
122
- },
123
117
  {
124
118
  id: 'insert-keywords',
125
119
  label: 'Keywords',
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MATHJAX_VERSION = exports.VERSION = void 0;
4
- exports.VERSION = '2.7.1-LEAN-4077.3';
4
+ exports.VERSION = '2.7.1';
5
5
  exports.MATHJAX_VERSION = '3.2.2';
@@ -19,131 +19,39 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
19
19
  };
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.AwardView = void 0;
22
- const style_guide_1 = require("@manuscripts/style-guide");
23
- const transform_1 = require("@manuscripts/transform");
24
- const AwardModal_1 = require("../components/awards/AwardModal");
25
- const DeleteAwardDiaolog_1 = require("../components/awards/DeleteAwardDiaolog");
26
- const track_changes_utils_1 = require("../lib/track-changes-utils");
27
- const view_1 = require("../lib/view");
28
22
  const block_view_1 = __importDefault(require("./block_view"));
29
23
  const creators_1 = require("./creators");
30
- const ReactSubView_1 = __importDefault(require("./ReactSubView"));
31
24
  class AwardView extends block_view_1.default {
32
25
  constructor() {
33
26
  super(...arguments);
34
- this.createAwardFragment = (className, title, content) => {
35
- const awardFragment = document.createElement('div');
36
- awardFragment.classList.add(className);
37
- if (title) {
38
- const titleElement = document.createElement('span');
39
- titleElement.classList.add('title');
40
- titleElement.textContent = title;
41
- awardFragment.appendChild(titleElement);
42
- }
43
- if (content) {
44
- const contentElement = document.createElement('span');
45
- contentElement.classList.add('content');
46
- contentElement.textContent = content;
47
- awardFragment.appendChild(contentElement);
48
- }
49
- return awardFragment;
50
- };
51
- this.handleClick = () => {
52
- if ((0, track_changes_utils_1.isDeleted)(this.node) || !this.props.getCapabilities().editArticle) {
53
- return;
54
- }
55
- this.showContextMenu();
56
- };
57
- this.showContextMenu = () => {
58
- this.props.popper.destroy();
59
- if (!this.contentDOM) {
60
- return;
61
- }
62
- const componentProps = {
63
- actions: [
64
- {
65
- label: 'Edit',
66
- action: () => {
67
- this.props.popper.destroy();
68
- this.showAwardModal(this.node);
69
- },
70
- icon: 'Edit',
71
- },
72
- {
73
- label: 'Delete',
74
- action: () => {
75
- this.props.popper.destroy();
76
- this.showDeleteAwardDialog();
77
- },
78
- icon: 'Delete',
79
- },
80
- ],
81
- };
82
- this.props.popper.show(this.contentDOM, (0, ReactSubView_1.default)(this.props, style_guide_1.ContextMenu, componentProps, this.node, this.getPos, this.view, 'context-menu'), 'right-start', false);
83
- };
84
- this.showAwardModal = (award) => {
85
- var _a, _b;
86
- (_a = this.dialog) === null || _a === void 0 ? void 0 : _a.remove();
87
- (_b = this.popperContainer) === null || _b === void 0 ? void 0 : _b.remove();
88
- const componentProps = {
89
- initialData: (award === null || award === void 0 ? void 0 : award.attrs) || {},
90
- onSaveAward: this.handleSaveAward,
91
- onCancelAward: this.handleCancelAward,
92
- };
93
- this.popperContainer = (0, ReactSubView_1.default)(this.props, AwardModal_1.AwardModal, componentProps, this.node, this.getPos, this.view, 'award-editor');
94
- this.props.popper.show(this.dom, this.popperContainer, 'auto', false);
95
- };
96
- this.handleSaveAward = (award) => {
97
- (0, view_1.updateNodeAttrs)(this.view, transform_1.schema.nodes.award, award);
98
- };
99
- this.handleCancelAward = () => {
100
- };
101
- this.showDeleteAwardDialog = () => {
102
- var _a;
103
- (_a = this.dialog) === null || _a === void 0 ? void 0 : _a.remove();
104
- const award = this.node;
105
- const pos = this.getPos();
106
- const handleDelete = () => {
107
- if (award) {
108
- const tr = this.view.state.tr;
109
- const from = pos;
110
- const to = pos + award.nodeSize;
111
- this.view.dispatch(tr.delete(from, to));
112
- }
113
- };
114
- const componentProps = {
115
- handleDelete: handleDelete,
116
- };
117
- this.popperContainer = (0, ReactSubView_1.default)(this.props, DeleteAwardDiaolog_1.DeleteAwardDialog, componentProps, this.node, this.getPos, this.view, 'award-editor');
118
- this.props.popper.show(this.dom, this.popperContainer, 'auto', false);
27
+ this.createAwardElement = (className, textContent) => {
28
+ const element = document.createElement('div');
29
+ element.classList.add(className);
30
+ element.textContent = textContent;
31
+ return element;
119
32
  };
120
33
  }
34
+ initialise() {
35
+ this.createDOM();
36
+ this.contentDOM = this.dom;
37
+ this.updateContents();
38
+ }
121
39
  updateContents() {
122
- super.updateContents();
123
40
  if (!this.contentDOM) {
124
41
  return;
125
42
  }
43
+ this.contentDOM.innerHTML = '';
44
+ this.contentDOM.classList.remove('block-container');
45
+ const notAvailable = 'N/A';
126
46
  const { recipient, code, source } = this.node.attrs;
127
47
  if (!source) {
128
48
  return;
129
49
  }
130
- this.contentDOM.innerHTML = '';
131
- const notAvailable = 'N/A';
132
50
  const fragment = document.createDocumentFragment();
133
- fragment.appendChild(this.createAwardFragment('award-source', '', source));
134
- fragment.appendChild(this.createAwardFragment('award-code', 'Grant Number(s): ', code ? code.split(';').join(', ') : notAvailable));
135
- fragment.appendChild(this.createAwardFragment('award-recipient', 'Recipient: ', recipient ? recipient : notAvailable));
136
- if (this.props.getCapabilities().editArticle) {
137
- this.dom.addEventListener('mouseup', this.handleClick);
138
- }
51
+ fragment.appendChild(this.createAwardElement('award-source', source));
52
+ fragment.appendChild(this.createAwardElement('award-code', `Grant Number(s): ${code ? code.split(';').join(', ') : notAvailable}`));
53
+ fragment.appendChild(this.createAwardElement('award-recipient', `Recipient: ${recipient ? recipient : notAvailable}`));
139
54
  this.contentDOM.appendChild(fragment);
140
- this.updateClasses();
141
- }
142
- selectNode() {
143
- super.selectNode();
144
- if (!this.node.attrs.source) {
145
- this.showAwardModal(this.node);
146
- }
147
55
  }
148
56
  }
149
57
  exports.AwardView = AwardView;
@@ -14,40 +14,39 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
+ var __importDefault = (this && this.__importDefault) || function (mod) {
18
+ return (mod && mod.__esModule) ? mod : { "default": mod };
19
+ };
17
20
  Object.defineProperty(exports, "__esModule", { value: true });
18
21
  exports.AwardsView = void 0;
19
22
  const utils_1 = require("../lib/utils");
20
- const base_node_view_1 = require("./base_node_view");
23
+ const block_view_1 = __importDefault(require("./block_view"));
21
24
  const creators_1 = require("./creators");
22
- class AwardsView extends base_node_view_1.BaseNodeView {
25
+ class AwardsView extends block_view_1.default {
23
26
  constructor() {
24
27
  super(...arguments);
25
28
  this.elementType = 'div';
26
29
  this.createElement = () => {
30
+ this.wrapper = document.createElement(this.elementType);
31
+ this.wrapper.classList.add('block');
27
32
  this.contentDOM = document.createElement(this.elementType);
28
33
  this.contentDOM.className = 'block';
34
+ this.wrapper.appendChild(this.contentDOM);
35
+ this.dom.appendChild(this.wrapper);
29
36
  };
30
37
  }
31
- initialise() {
32
- this.createDOM();
33
- this.createElement();
34
- this.updateContents();
35
- }
36
- createDOM() {
37
- this.dom = document.createElement(this.elementType);
38
- this.dom.classList.add(`block-${this.node.type.name}`);
39
- }
40
38
  updateContents() {
41
39
  super.updateContents();
42
40
  if (!this.contentDOM) {
43
41
  return;
44
42
  }
45
- this.dom.innerHTML = '';
46
43
  this.dom.setAttribute('contenteditable', 'false');
47
44
  this.contentDOM.setAttribute('contenteditable', 'false');
48
45
  if (this.node.content.size !== 0) {
46
+ this.wrapper.innerHTML = '';
47
+ this.wrapper.setAttribute('contenteditable', 'false');
49
48
  const header = (0, utils_1.createHeader)(this.node.type.name, 'Funder Information');
50
- this.dom.append(header, this.contentDOM);
49
+ this.wrapper.append(header, this.contentDOM);
51
50
  }
52
51
  }
53
52
  }
@@ -23,7 +23,7 @@ import { addColSpan, addColumnAfter, addColumnBefore, addRow, CellSelection, sel
23
23
  import { findWrapping, liftTarget, ReplaceAroundStep, ReplaceStep, } from 'prosemirror-transform';
24
24
  import { findChildrenByType, findParentNodeOfType, findParentNodeOfTypeClosestToPos, flatten, hasParentNodeOfType, } from 'prosemirror-utils';
25
25
  import { getCommentKey, getCommentRange } from './lib/comments';
26
- import { findBackmatter, findBibliographySection, findBody, insertAwardsNode, insertFootnotesSection, insertSupplementsNode, } from './lib/doc';
26
+ import { findBackmatter, findBibliographySection, findBody, insertFootnotesSection, insertSupplementsNode, } from './lib/doc';
27
27
  import { createFootnote, findFootnotesContainerNode, getFootnotesElementState, } from './lib/footnotes';
28
28
  import { findWordBoundaries, isNodeOfType, nearestAncestor, } from './lib/helpers';
29
29
  import { isDeleted } from './lib/track-changes-utils';
@@ -620,19 +620,6 @@ export const insertAffiliation = (state, dispatch, view) => {
620
620
  }
621
621
  return true;
622
622
  };
623
- export const insertAward = (state, dispatch, view) => {
624
- const award = schema.nodes.award.create();
625
- const tr = state.tr;
626
- const awards = insertAwardsNode(tr);
627
- const pos = awards.pos + awards.node.nodeSize - 1;
628
- tr.insert(pos, award);
629
- const selection = NodeSelection.create(tr.doc, pos);
630
- view && view.focus();
631
- if (dispatch) {
632
- dispatch(tr.setSelection(selection).scrollIntoView());
633
- }
634
- return true;
635
- };
636
623
  export const insertKeywords = (state, dispatch, view) => {
637
624
  if (getChildOfType(state.doc, schema.nodes.keywords, true)) {
638
625
  return false;
@@ -2,7 +2,7 @@ import { TextField } from '@manuscripts/style-guide';
2
2
  import { Field, Formik } from 'formik';
3
3
  import React from 'react';
4
4
  import styled from 'styled-components';
5
- import { ChangeHandlingForm } from '../ChangeHandlingForm';
5
+ import { ChangeHandlingForm } from './ChangeHandlingForm';
6
6
  const Row = styled.div `
7
7
  display: flex;
8
8
  border-top: 1px solid ${(props) => props.theme.colors.border.field.default};
@@ -17,7 +17,7 @@ import { CheckboxField, CheckboxLabel, TextField, TextFieldGroupContainer, TextF
17
17
  import { Field, Formik } from 'formik';
18
18
  import React, { useRef } from 'react';
19
19
  import styled from 'styled-components';
20
- import { ChangeHandlingForm } from '../ChangeHandlingForm';
20
+ import { ChangeHandlingForm } from './ChangeHandlingForm';
21
21
  export const LabelText = styled.div `
22
22
  font: ${(props) => props.theme.font.weight.normal}
23
23
  ${(props) => props.theme.font.size.normal} / 1
@@ -1,17 +1,10 @@
1
1
  import { Form, useFormikContext } from 'formik';
2
2
  import React, { useEffect } from 'react';
3
- import styled from 'styled-components';
4
3
  export const ChangeHandlingForm = (props) => {
5
4
  const { values } = useFormikContext();
6
5
  useEffect(() => {
7
6
  var _a;
8
7
  (_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, values);
9
8
  }, [props.onChange, values]);
10
- return React.createElement(FlexForm, null, props.children);
9
+ return React.createElement(Form, null, props.children);
11
10
  };
12
- export const FlexForm = styled(Form) `
13
- height: 100%;
14
- display: flex;
15
- flex-direction: column;
16
- overflow: hidden;
17
- `;
@@ -19,6 +19,7 @@ const excludedTypes = [
19
19
  schema.nodes.author_notes,
20
20
  schema.nodes.title,
21
21
  schema.nodes.embed,
22
+ schema.nodes.image_element,
22
23
  ];
23
24
  const childrenExcludedTypes = [
24
25
  schema.nodes.pullquote_element,
@@ -15,10 +15,9 @@
15
15
  */
16
16
  import { buildBibliographicDate, buildBibliographicName, } from '@manuscripts/json-schema';
17
17
  import { AddAuthorIcon, ArrowDownIcon, ButtonGroup, Category, DeleteIcon, Dialog, IconButton, LinkIcon, PrimaryButton, SecondaryButton, SelectField, TextArea, TextField, Tooltip, } from '@manuscripts/style-guide';
18
- import { Field, FieldArray, Formik } from 'formik';
19
- import React, { useEffect, useRef, useState } from 'react';
18
+ import { Field, FieldArray, Form, Formik, useFormikContext, } from 'formik';
19
+ import React, { useEffect, useRef, useState, } from 'react';
20
20
  import styled from 'styled-components';
21
- import { ChangeHandlingForm } from '../ChangeHandlingForm';
22
21
  export const LabelContainer = styled.div `
23
22
  display: flex;
24
23
  justify-content: space-between;
@@ -114,6 +113,12 @@ export const ReferenceTextArea = styled(TextArea) `
114
113
  height: ${(props) => props.theme.grid.unit * 20}px;
115
114
  resize: none;
116
115
  `;
116
+ export const FlexForm = styled(Form) `
117
+ height: 100%;
118
+ display: flex;
119
+ flex-direction: column;
120
+ overflow: hidden;
121
+ `;
117
122
  export const FormFields = styled.div `
118
123
  flex: 1;
119
124
  overflow-y: auto;
@@ -178,6 +183,14 @@ const bibliographyItemTypeOptions = bibliographyItemTypes.map((i) => ({
178
183
  label: i[1],
179
184
  value: i[0],
180
185
  }));
186
+ const ChangeHandlingForm = (props) => {
187
+ const { values } = useFormikContext();
188
+ useEffect(() => {
189
+ var _a;
190
+ (_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, values);
191
+ }, [props.onChange, values]);
192
+ return React.createElement(FlexForm, null, props.children);
193
+ };
181
194
  export const ReferenceForm = ({ values, showDelete, onChange, onDelete, onCancel, onSave, actionsRef, }) => {
182
195
  const fieldsRef = useRef(null);
183
196
  useEffect(() => {
package/dist/es/icons.js CHANGED
@@ -1,9 +1,8 @@
1
- import { AlertIcon, DeleteIcon, EditIcon, ScrollIcon, SectionCategoryIcon, } from '@manuscripts/style-guide';
1
+ import { AlertIcon, DeleteIcon, ScrollIcon, SectionCategoryIcon, } from '@manuscripts/style-guide';
2
2
  import { createElement } from 'react';
3
3
  import { renderToStaticMarkup } from 'react-dom/server';
4
4
  const renderIcon = (c) => renderToStaticMarkup(createElement(c));
5
5
  export const alertIcon = renderIcon(AlertIcon);
6
6
  export const deleteIcon = renderIcon(DeleteIcon);
7
- export const editIcon = renderToStaticMarkup(createElement(EditIcon));
8
7
  export const sectionCategoryIcon = renderIcon(SectionCategoryIcon);
9
8
  export const scrollIcon = renderToStaticMarkup(createElement(ScrollIcon));
@@ -1,32 +1,5 @@
1
1
  import { schema, } from '@manuscripts/transform';
2
2
  import { findChildren, findChildrenByType } from 'prosemirror-utils';
3
- export const insertAwardsNode = (tr) => {
4
- const doc = tr.doc;
5
- const awards = findChildrenByType(doc, schema.nodes.awards)[0];
6
- if (awards) {
7
- return awards;
8
- }
9
- const positions = [];
10
- const possibleNodesTypes = [
11
- 'doi',
12
- 'keywords',
13
- 'supplements',
14
- 'abstracts',
15
- 'body',
16
- ];
17
- doc.descendants((node, pos) => {
18
- if (possibleNodesTypes.includes(node.type.name)) {
19
- positions.push(pos);
20
- }
21
- });
22
- const pos = positions.length === 0 ? 0 : Math.min(...positions);
23
- const node = schema.nodes.awards.createAndFill();
24
- tr.insert(pos, node);
25
- return {
26
- node,
27
- pos,
28
- };
29
- };
30
3
  export const insertSupplementsNode = (tr) => {
31
4
  const doc = tr.doc;
32
5
  const supplements = findChildrenByType(doc, schema.nodes.supplements)[0];
package/dist/es/menus.js CHANGED
@@ -16,7 +16,7 @@
16
16
  import { getGroupCateogries, schema, } from '@manuscripts/transform';
17
17
  import { toggleMark } from 'prosemirror-commands';
18
18
  import { redo, undo } from 'prosemirror-history';
19
- import { addInlineComment, blockActive, canInsert, insertAbstract, insertAffiliation, insertAward, insertBackmatterSection, insertBlock, insertBoxElement, insertContributors, insertCrossReference, insertGraphicalAbstract, insertInlineCitation, insertInlineEquation, insertInlineFootnote, insertKeywords, insertLink, insertList, insertSection, markActive, } from './commands';
19
+ import { addInlineComment, blockActive, canInsert, insertAbstract, insertAffiliation, insertBackmatterSection, insertBlock, insertBoxElement, insertContributors, insertCrossReference, insertGraphicalAbstract, insertInlineCitation, insertInlineEquation, insertInlineFootnote, insertKeywords, insertLink, insertList, insertSection, markActive, } from './commands';
20
20
  import { openInsertTableDialog } from './components/toolbar/InsertTableDialog';
21
21
  import { ListMenuItem } from './components/toolbar/ListMenuItem';
22
22
  import { deleteClosestParentElement, findClosestParentElementNodeName, } from './lib/hierarchy';
@@ -111,12 +111,6 @@ export const getEditorMenus = (editor) => {
111
111
  isEnabled: isCommandValid(insertAffiliation),
112
112
  run: doCommand(insertAffiliation),
113
113
  },
114
- {
115
- id: 'insert-awards',
116
- label: 'Funder Information',
117
- isEnabled: isCommandValid(insertAward),
118
- run: doCommand(insertAward),
119
- },
120
114
  {
121
115
  id: 'insert-keywords',
122
116
  label: 'Keywords',
@@ -1,2 +1,2 @@
1
- export const VERSION = '2.7.1-LEAN-4077.3';
1
+ export const VERSION = '2.7.1';
2
2
  export const MATHJAX_VERSION = '3.2.2';