@manuscripts/body-editor 1.5.6-LEAN-2852-1 → 1.5.6

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.
@@ -399,7 +399,7 @@ const insertFootnotesSection = (state, dispatch) => {
399
399
  };
400
400
  exports.insertFootnotesSection = insertFootnotesSection;
401
401
  const insertBibliographySection = (state, dispatch) => {
402
- if ((0, utils_1.getMatchingDescendant)(state.doc, (node) => node.type === state.schema.nodes.bibliography_section)) {
402
+ if ((0, utils_1.getChildOfType)(state.doc, state.schema.nodes.bibliography_section)) {
403
403
  return false;
404
404
  }
405
405
  const section = state.schema.nodes.bibliography_section.createAndFill({}, [
@@ -34,23 +34,21 @@ const track_changes_utils_1 = require("../../lib/track-changes-utils");
34
34
  const node_type_icons_1 = require("../../node-type-icons");
35
35
  const section_title_1 = require("../../views/section_title");
36
36
  const Outline_1 = require("./Outline");
37
- const excludedTypes = [
38
- transform_1.schema.nodes.table,
39
- transform_1.schema.nodes.figure,
40
- transform_1.schema.nodes.footnotes_element,
41
- transform_1.schema.nodes.bibliography_element,
42
- transform_1.schema.nodes.keywords_section,
43
- transform_1.schema.nodes.title,
44
- ];
45
- const childrenExcludedTypes = [
46
- transform_1.schema.nodes.pullquote_element,
47
- transform_1.schema.nodes.blockquote_element,
48
- ];
49
37
  const isExcluded = (nodeType) => {
38
+ const { nodes } = nodeType.schema;
39
+ const excludedTypes = [
40
+ nodes.table,
41
+ nodes.figure,
42
+ nodes.footnotes_element,
43
+ nodes.bibliography_element,
44
+ nodes.keywords_section,
45
+ ];
50
46
  return excludedTypes.includes(nodeType);
51
47
  };
52
48
  const isChildrenExcluded = (nodeType) => {
53
- return childrenExcludedTypes.includes(nodeType);
49
+ const { nodes } = nodeType.schema;
50
+ const excludedTypes = [nodes.pullquote_element, nodes.blockquote_element];
51
+ return excludedTypes.includes(nodeType);
54
52
  };
55
53
  const buildTree = ({ node, pos, index, selected, parent, }) => {
56
54
  const items = [];
@@ -136,22 +134,23 @@ class Tree extends React.Component {
136
134
  if (isRejectedItem || node.attrs.id === 'META_SECTION') {
137
135
  return null;
138
136
  }
139
- return connectDropTarget(React.createElement("div", null, node.type.name !== 'titles' && (React.createElement(Outline_1.Outline, { style: this.outlineStyles(isDragging) },
140
- React.createElement(Outline_1.OutlineDropPreview, { depth: depth, style: this.topPreviewStyles(mightDrop, dragPosition) }),
141
- !(0, section_title_1.isSpecialSection)(node) && (React.createElement(React.Fragment, null, connectDragSource(React.createElement("div", null,
142
- React.createElement(Outline_1.OutlineItem, { isSelected: isSelected, depth: depth, onContextMenu: this.handleContextMenu },
143
- items.length ? (React.createElement(Outline_1.OutlineItemArrow, { onClick: this.toggle }, open ? (React.createElement(Outline_1.StyledTriangleExpanded, null)) : (React.createElement(Outline_1.StyledTriangleCollapsed, null)))) : (React.createElement(Outline_1.OutlineItemNoArrow, null)),
144
- React.createElement(Outline_1.OutlineItemLink, { to: `#${node.attrs.id || ''}` },
145
- connectDragPreview(React.createElement("span", { style: {
146
- display: 'inline-flex',
147
- alignItems: 'center',
148
- } },
149
- React.createElement(Outline_1.OutlineItemIcon, null, (0, node_type_icons_1.nodeTypeIcon)(node.type)))),
150
- React.createElement(Outline_1.OutlineItemLinkText, { className: `outline-text-${node.type.name} ${isDeletedItem && 'deleted'}` }, this.itemText(node)))))))),
151
- items.length ? (React.createElement("div", { style: {
152
- display: open || (0, section_title_1.isSpecialSection)(node) ? '' : 'none',
153
- } }, items.map((subtree) => (React.createElement(DraggableTree, Object.assign({}, this.props, { key: subtree.node.attrs.id, tree: subtree, view: view, depth: (0, section_title_1.isSpecialSection)(node) ? depth : depth + 1 })))))) : null,
154
- React.createElement(Outline_1.OutlineDropPreview, { depth: depth, style: this.bottomPreviewStyles(mightDrop, dragPosition) })))));
137
+ return connectDropTarget(React.createElement("div", null,
138
+ React.createElement(Outline_1.Outline, { style: this.outlineStyles(isDragging) },
139
+ React.createElement(Outline_1.OutlineDropPreview, { depth: depth, style: this.topPreviewStyles(mightDrop, dragPosition) }),
140
+ !(0, section_title_1.isSpecialSection)(node) && (React.createElement(React.Fragment, null, connectDragSource(React.createElement("div", null,
141
+ React.createElement(Outline_1.OutlineItem, { isSelected: isSelected, depth: depth, onContextMenu: this.handleContextMenu },
142
+ items.length ? (React.createElement(Outline_1.OutlineItemArrow, { onClick: this.toggle }, open ? (React.createElement(Outline_1.StyledTriangleExpanded, null)) : (React.createElement(Outline_1.StyledTriangleCollapsed, null)))) : (React.createElement(Outline_1.OutlineItemNoArrow, null)),
143
+ React.createElement(Outline_1.OutlineItemLink, { to: `#${node.attrs.id || ''}` },
144
+ connectDragPreview(React.createElement("span", { style: {
145
+ display: 'inline-flex',
146
+ alignItems: 'center',
147
+ } },
148
+ React.createElement(Outline_1.OutlineItemIcon, null, (0, node_type_icons_1.nodeTypeIcon)(node.type)))),
149
+ React.createElement(Outline_1.OutlineItemLinkText, { className: `outline-text-${node.type.name} ${isDeletedItem && 'deleted'}` }, this.itemText(node)))))))),
150
+ items.length ? (React.createElement("div", { style: {
151
+ display: open || (0, section_title_1.isSpecialSection)(node) ? '' : 'none',
152
+ } }, items.map((subtree) => (React.createElement(DraggableTree, Object.assign({}, this.props, { key: subtree.node.attrs.id, tree: subtree, view: view, depth: (0, section_title_1.isSpecialSection)(node) ? depth : depth + 1 })))))) : null,
153
+ React.createElement(Outline_1.OutlineDropPreview, { depth: depth, style: this.bottomPreviewStyles(mightDrop, dragPosition) }))));
155
154
  }
156
155
  }
157
156
  const dragSource = (0, react_dnd_1.DragSource)('outline', {
@@ -39,6 +39,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
39
39
  };
40
40
  Object.defineProperty(exports, "__esModule", { value: true });
41
41
  exports.ManuscriptOutline = void 0;
42
+ const title_editor_1 = require("@manuscripts/title-editor");
42
43
  const react_1 = __importStar(require("react"));
43
44
  const use_debounce_1 = require("../hooks/use-debounce");
44
45
  const DraggableTree_1 = __importStar(require("./DraggableTree"));
@@ -48,14 +49,24 @@ const ManuscriptOutline = (props) => {
48
49
  const debouncedProps = (0, use_debounce_1.useDebounce)(props, 500);
49
50
  (0, react_1.useEffect)(() => {
50
51
  var _a;
51
- const { doc, view, selected } = debouncedProps;
52
+ const { doc, view, manuscript, selected } = debouncedProps;
52
53
  if (doc) {
53
- const tree = (0, DraggableTree_1.buildTree)({
54
+ const { items } = (0, DraggableTree_1.buildTree)({
54
55
  node: doc,
55
56
  pos: 0,
56
57
  index: 0,
57
58
  selected,
58
59
  });
60
+ const node = (0, title_editor_1.parse)(manuscript.title || '');
61
+ const tree = {
62
+ node,
63
+ requirementsNode: doc,
64
+ pos: 0,
65
+ endPos: 0,
66
+ index: 0,
67
+ isSelected: !selected,
68
+ items,
69
+ };
59
70
  setValues({ tree, view, editArticle: !!((_a = props.capabilities) === null || _a === void 0 ? void 0 : _a.editArticle) });
60
71
  }
61
72
  else {
@@ -20,15 +20,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.OutlineManuscript = void 0;
22
22
  const OutlineIconManuscript_1 = __importDefault(require("@manuscripts/assets/react/OutlineIconManuscript"));
23
+ const title_editor_1 = require("@manuscripts/title-editor");
23
24
  const transform_1 = require("@manuscripts/transform");
24
25
  const react_1 = __importDefault(require("react"));
25
26
  const Outline_1 = require("./Outline");
26
- const OutlineManuscript = ({ project, manuscript, doc, }) => (react_1.default.createElement(Outline_1.Outline, null,
27
+ const titleText = (value) => {
28
+ const node = (0, title_editor_1.parse)(value, {
29
+ topNode: title_editor_1.schema.nodes.title.create(),
30
+ });
31
+ return node.textContent;
32
+ };
33
+ const OutlineManuscript = ({ project, manuscript, }) => (react_1.default.createElement(Outline_1.Outline, null,
27
34
  react_1.default.createElement(Outline_1.OutlineItem, { isSelected: false, depth: 0 },
28
35
  react_1.default.createElement(Outline_1.OutlineItemLink, { to: `/projects/${project._id}/manuscripts/${manuscript._id}` },
29
36
  react_1.default.createElement(Outline_1.OutlineItemArrow, null,
30
37
  react_1.default.createElement(Outline_1.StyledTriangleCollapsed, null)),
31
38
  react_1.default.createElement(Outline_1.OutlineItemIcon, null,
32
39
  react_1.default.createElement(OutlineIconManuscript_1.default, null)),
33
- react_1.default.createElement(Outline_1.OutlineItemLinkText, { className: 'outline-text-title' }, (0, transform_1.nodeTitle)(doc))))));
40
+ react_1.default.createElement(Outline_1.OutlineItemLinkText, { className: 'outline-text-title' }, manuscript.title ? (titleText(manuscript.title)) : (react_1.default.createElement(Outline_1.OutlineItemPlaceholder, null, (0, transform_1.nodeTitlePlaceholder)(title_editor_1.schema.nodes.title))))))));
34
41
  exports.OutlineManuscript = OutlineManuscript;
@@ -23,7 +23,6 @@ const bibliography_item_editable_1 = __importDefault(require("../views/bibliogra
23
23
  const blockquote_element_editable_1 = __importDefault(require("../views/blockquote_element_editable"));
24
24
  const bullet_list_editable_1 = __importDefault(require("../views/bullet_list_editable"));
25
25
  const citation_editable_1 = __importDefault(require("../views/citation_editable"));
26
- const contributors_section_1 = __importDefault(require("../views/contributors_section"));
27
26
  const cross_reference_editable_1 = __importDefault(require("../views/cross_reference_editable"));
28
27
  const equation_editable_1 = __importDefault(require("../views/equation_editable"));
29
28
  const equation_element_editable_1 = __importDefault(require("../views/equation_element_editable"));
@@ -47,18 +46,15 @@ const pullquote_element_editable_1 = __importDefault(require("../views/pullquote
47
46
  const section_label_1 = __importDefault(require("../views/section_label"));
48
47
  const section_title_editable_1 = __importDefault(require("../views/section_title_editable"));
49
48
  const table_element_editable_1 = __importDefault(require("../views/table_element_editable"));
50
- const title_editable_1 = __importDefault(require("../views/title_editable"));
51
49
  const toc_element_editable_1 = __importDefault(require("../views/toc_element_editable"));
52
50
  exports.default = (props, dispatch) => {
53
51
  return {
54
- title: (0, title_editable_1.default)(props, dispatch),
55
52
  bibliography_item: (0, bibliography_item_editable_1.default)(props),
56
53
  bibliography_element: (0, bibliography_element_editable_1.default)(props),
57
54
  blockquote_element: (0, blockquote_element_editable_1.default)(props),
58
55
  bullet_list: (0, bullet_list_editable_1.default)(props),
59
56
  citation: (0, citation_editable_1.default)(props),
60
57
  cross_reference: (0, cross_reference_editable_1.default)(props),
61
- contributors_section: (0, contributors_section_1.default)(props, dispatch),
62
58
  equation: (0, equation_editable_1.default)(props),
63
59
  equation_element: (0, equation_element_editable_1.default)(props),
64
60
  figure: (0, figure_editable_1.default)(props, dispatch),
@@ -29,11 +29,11 @@ const OutlineIconSection_1 = __importDefault(require("@manuscripts/assets/react/
29
29
  const OutlineIconTable_1 = __importDefault(require("@manuscripts/assets/react/OutlineIconTable"));
30
30
  const OutlineIconUnorderedList_1 = __importDefault(require("@manuscripts/assets/react/OutlineIconUnorderedList"));
31
31
  const style_guide_1 = require("@manuscripts/style-guide");
32
+ const title_editor_1 = require("@manuscripts/title-editor");
32
33
  const transform_1 = require("@manuscripts/transform");
33
34
  const react_1 = __importDefault(require("react"));
34
35
  const { nodes } = transform_1.schema;
35
36
  const icons = new Map([
36
- [nodes.manuscript, OutlineIconManuscript_1.default],
37
37
  [nodes.bibliography_section, OutlineIconSection_1.default],
38
38
  [nodes.blockquote_element, style_guide_1.BlockQuoteIcon],
39
39
  [nodes.bullet_list, OutlineIconUnorderedList_1.default],
@@ -52,6 +52,9 @@ const icons = new Map([
52
52
  [nodes.footnotes_section, OutlineIconSection_1.default],
53
53
  ]);
54
54
  const nodeTypeIcon = (nodeType) => {
55
+ if (nodeType === title_editor_1.schema.nodes.title) {
56
+ return react_1.default.createElement(OutlineIconManuscript_1.default, null);
57
+ }
55
58
  const Icon = icons.get(nodeType);
56
59
  return Icon ? react_1.default.createElement(Icon, null) : null;
57
60
  };
@@ -354,7 +354,7 @@ export const insertFootnotesSection = (state, dispatch) => {
354
354
  return true;
355
355
  };
356
356
  export const insertBibliographySection = (state, dispatch) => {
357
- if (getMatchingDescendant(state.doc, (node) => node.type === state.schema.nodes.bibliography_section)) {
357
+ if (getChildOfType(state.doc, state.schema.nodes.bibliography_section)) {
358
358
  return false;
359
359
  }
360
360
  const section = state.schema.nodes.bibliography_section.createAndFill({}, [
@@ -1,4 +1,4 @@
1
- import { isElementNodeType, nodeTitle, nodeTitlePlaceholder, schema, } from '@manuscripts/transform';
1
+ import { isElementNodeType, nodeTitle, nodeTitlePlaceholder, } from '@manuscripts/transform';
2
2
  import { Fragment } from 'prosemirror-model';
3
3
  import * as React from 'react';
4
4
  import { DragSource, DropTarget, } from 'react-dnd';
@@ -8,23 +8,21 @@ import { isDeleted, isRejectedInsert } from '../../lib/track-changes-utils';
8
8
  import { nodeTypeIcon } from '../../node-type-icons';
9
9
  import { isSpecialSection } from '../../views/section_title';
10
10
  import { Outline, OutlineDropPreview, OutlineItem, OutlineItemArrow, OutlineItemIcon, OutlineItemLink, OutlineItemLinkText, OutlineItemNoArrow, OutlineItemPlaceholder, StyledTriangleCollapsed, StyledTriangleExpanded, } from './Outline';
11
- const excludedTypes = [
12
- schema.nodes.table,
13
- schema.nodes.figure,
14
- schema.nodes.footnotes_element,
15
- schema.nodes.bibliography_element,
16
- schema.nodes.keywords_section,
17
- schema.nodes.title,
18
- ];
19
- const childrenExcludedTypes = [
20
- schema.nodes.pullquote_element,
21
- schema.nodes.blockquote_element,
22
- ];
23
11
  const isExcluded = (nodeType) => {
12
+ const { nodes } = nodeType.schema;
13
+ const excludedTypes = [
14
+ nodes.table,
15
+ nodes.figure,
16
+ nodes.footnotes_element,
17
+ nodes.bibliography_element,
18
+ nodes.keywords_section,
19
+ ];
24
20
  return excludedTypes.includes(nodeType);
25
21
  };
26
22
  const isChildrenExcluded = (nodeType) => {
27
- return childrenExcludedTypes.includes(nodeType);
23
+ const { nodes } = nodeType.schema;
24
+ const excludedTypes = [nodes.pullquote_element, nodes.blockquote_element];
25
+ return excludedTypes.includes(nodeType);
28
26
  };
29
27
  export const buildTree = ({ node, pos, index, selected, parent, }) => {
30
28
  const items = [];
@@ -109,22 +107,23 @@ class Tree extends React.Component {
109
107
  if (isRejectedItem || node.attrs.id === 'META_SECTION') {
110
108
  return null;
111
109
  }
112
- return connectDropTarget(React.createElement("div", null, node.type.name !== 'titles' && (React.createElement(Outline, { style: this.outlineStyles(isDragging) },
113
- React.createElement(OutlineDropPreview, { depth: depth, style: this.topPreviewStyles(mightDrop, dragPosition) }),
114
- !isSpecialSection(node) && (React.createElement(React.Fragment, null, connectDragSource(React.createElement("div", null,
115
- React.createElement(OutlineItem, { isSelected: isSelected, depth: depth, onContextMenu: this.handleContextMenu },
116
- items.length ? (React.createElement(OutlineItemArrow, { onClick: this.toggle }, open ? (React.createElement(StyledTriangleExpanded, null)) : (React.createElement(StyledTriangleCollapsed, null)))) : (React.createElement(OutlineItemNoArrow, null)),
117
- React.createElement(OutlineItemLink, { to: `#${node.attrs.id || ''}` },
118
- connectDragPreview(React.createElement("span", { style: {
119
- display: 'inline-flex',
120
- alignItems: 'center',
121
- } },
122
- React.createElement(OutlineItemIcon, null, nodeTypeIcon(node.type)))),
123
- React.createElement(OutlineItemLinkText, { className: `outline-text-${node.type.name} ${isDeletedItem && 'deleted'}` }, this.itemText(node)))))))),
124
- items.length ? (React.createElement("div", { style: {
125
- display: open || isSpecialSection(node) ? '' : 'none',
126
- } }, items.map((subtree) => (React.createElement(DraggableTree, Object.assign({}, this.props, { key: subtree.node.attrs.id, tree: subtree, view: view, depth: isSpecialSection(node) ? depth : depth + 1 })))))) : null,
127
- React.createElement(OutlineDropPreview, { depth: depth, style: this.bottomPreviewStyles(mightDrop, dragPosition) })))));
110
+ return connectDropTarget(React.createElement("div", null,
111
+ React.createElement(Outline, { style: this.outlineStyles(isDragging) },
112
+ React.createElement(OutlineDropPreview, { depth: depth, style: this.topPreviewStyles(mightDrop, dragPosition) }),
113
+ !isSpecialSection(node) && (React.createElement(React.Fragment, null, connectDragSource(React.createElement("div", null,
114
+ React.createElement(OutlineItem, { isSelected: isSelected, depth: depth, onContextMenu: this.handleContextMenu },
115
+ items.length ? (React.createElement(OutlineItemArrow, { onClick: this.toggle }, open ? (React.createElement(StyledTriangleExpanded, null)) : (React.createElement(StyledTriangleCollapsed, null)))) : (React.createElement(OutlineItemNoArrow, null)),
116
+ React.createElement(OutlineItemLink, { to: `#${node.attrs.id || ''}` },
117
+ connectDragPreview(React.createElement("span", { style: {
118
+ display: 'inline-flex',
119
+ alignItems: 'center',
120
+ } },
121
+ React.createElement(OutlineItemIcon, null, nodeTypeIcon(node.type)))),
122
+ React.createElement(OutlineItemLinkText, { className: `outline-text-${node.type.name} ${isDeletedItem && 'deleted'}` }, this.itemText(node)))))))),
123
+ items.length ? (React.createElement("div", { style: {
124
+ display: open || isSpecialSection(node) ? '' : 'none',
125
+ } }, items.map((subtree) => (React.createElement(DraggableTree, Object.assign({}, this.props, { key: subtree.node.attrs.id, tree: subtree, view: view, depth: isSpecialSection(node) ? depth : depth + 1 })))))) : null,
126
+ React.createElement(OutlineDropPreview, { depth: depth, style: this.bottomPreviewStyles(mightDrop, dragPosition) }))));
128
127
  }
129
128
  }
130
129
  const dragSource = DragSource('outline', {
@@ -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 { parse } from '@manuscripts/title-editor';
16
17
  import React, { useEffect, useState } from 'react';
17
18
  import { useDebounce } from '../hooks/use-debounce';
18
19
  import DraggableTree, { buildTree } from './DraggableTree';
@@ -22,14 +23,24 @@ export const ManuscriptOutline = (props) => {
22
23
  const debouncedProps = useDebounce(props, 500);
23
24
  useEffect(() => {
24
25
  var _a;
25
- const { doc, view, selected } = debouncedProps;
26
+ const { doc, view, manuscript, selected } = debouncedProps;
26
27
  if (doc) {
27
- const tree = buildTree({
28
+ const { items } = buildTree({
28
29
  node: doc,
29
30
  pos: 0,
30
31
  index: 0,
31
32
  selected,
32
33
  });
34
+ const node = parse(manuscript.title || '');
35
+ const tree = {
36
+ node,
37
+ requirementsNode: doc,
38
+ pos: 0,
39
+ endPos: 0,
40
+ index: 0,
41
+ isSelected: !selected,
42
+ items,
43
+ };
33
44
  setValues({ tree, view, editArticle: !!((_a = props.capabilities) === null || _a === void 0 ? void 0 : _a.editArticle) });
34
45
  }
35
46
  else {
@@ -14,14 +14,21 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import OutlineIconManuscript from '@manuscripts/assets/react/OutlineIconManuscript';
17
- import { nodeTitle } from '@manuscripts/transform';
17
+ import { parse, schema } from '@manuscripts/title-editor';
18
+ import { nodeTitlePlaceholder } from '@manuscripts/transform';
18
19
  import React from 'react';
19
- import { Outline, OutlineItem, OutlineItemArrow, OutlineItemIcon, OutlineItemLink, OutlineItemLinkText, StyledTriangleCollapsed, } from './Outline';
20
- export const OutlineManuscript = ({ project, manuscript, doc, }) => (React.createElement(Outline, null,
20
+ import { Outline, OutlineItem, OutlineItemArrow, OutlineItemIcon, OutlineItemLink, OutlineItemLinkText, OutlineItemPlaceholder, StyledTriangleCollapsed, } from './Outline';
21
+ const titleText = (value) => {
22
+ const node = parse(value, {
23
+ topNode: schema.nodes.title.create(),
24
+ });
25
+ return node.textContent;
26
+ };
27
+ export const OutlineManuscript = ({ project, manuscript, }) => (React.createElement(Outline, null,
21
28
  React.createElement(OutlineItem, { isSelected: false, depth: 0 },
22
29
  React.createElement(OutlineItemLink, { to: `/projects/${project._id}/manuscripts/${manuscript._id}` },
23
30
  React.createElement(OutlineItemArrow, null,
24
31
  React.createElement(StyledTriangleCollapsed, null)),
25
32
  React.createElement(OutlineItemIcon, null,
26
33
  React.createElement(OutlineIconManuscript, null)),
27
- React.createElement(OutlineItemLinkText, { className: 'outline-text-title' }, nodeTitle(doc))))));
34
+ React.createElement(OutlineItemLinkText, { className: 'outline-text-title' }, manuscript.title ? (titleText(manuscript.title)) : (React.createElement(OutlineItemPlaceholder, null, nodeTitlePlaceholder(schema.nodes.title))))))));
@@ -18,7 +18,6 @@ import bibliographyItem from '../views/bibliography_item_editable';
18
18
  import blockquoteElement from '../views/blockquote_element_editable';
19
19
  import bulletList from '../views/bullet_list_editable';
20
20
  import citation from '../views/citation_editable';
21
- import contributorsSection from '../views/contributors_section';
22
21
  import crossReference from '../views/cross_reference_editable';
23
22
  import equation from '../views/equation_editable';
24
23
  import equationElement from '../views/equation_element_editable';
@@ -42,18 +41,15 @@ import pullquoteElement from '../views/pullquote_element_editable';
42
41
  import sectionLabel from '../views/section_label';
43
42
  import sectionTitle from '../views/section_title_editable';
44
43
  import tableElement from '../views/table_element_editable';
45
- import title from '../views/title_editable';
46
44
  import tocElement from '../views/toc_element_editable';
47
45
  export default (props, dispatch) => {
48
46
  return {
49
- title: title(props, dispatch),
50
47
  bibliography_item: bibliographyItem(props),
51
48
  bibliography_element: bibliographyElement(props),
52
49
  blockquote_element: blockquoteElement(props),
53
50
  bullet_list: bulletList(props),
54
51
  citation: citation(props),
55
52
  cross_reference: crossReference(props),
56
- contributors_section: contributorsSection(props, dispatch),
57
53
  equation: equation(props),
58
54
  equation_element: equationElement(props),
59
55
  figure: figure(props, dispatch),
@@ -23,11 +23,11 @@ import SectionIcon from '@manuscripts/assets/react/OutlineIconSection';
23
23
  import TableIcon from '@manuscripts/assets/react/OutlineIconTable';
24
24
  import BulletListIcon from '@manuscripts/assets/react/OutlineIconUnorderedList';
25
25
  import { BlockQuoteIcon, PullQuoteIcon } from '@manuscripts/style-guide';
26
+ import { schema as titleSchema } from '@manuscripts/title-editor';
26
27
  import { schema } from '@manuscripts/transform';
27
28
  import React from 'react';
28
29
  const { nodes } = schema;
29
30
  const icons = new Map([
30
- [nodes.manuscript, ManuscriptIcon],
31
31
  [nodes.bibliography_section, SectionIcon],
32
32
  [nodes.blockquote_element, BlockQuoteIcon],
33
33
  [nodes.bullet_list, BulletListIcon],
@@ -46,6 +46,9 @@ const icons = new Map([
46
46
  [nodes.footnotes_section, SectionIcon],
47
47
  ]);
48
48
  export const nodeTypeIcon = (nodeType) => {
49
+ if (nodeType === titleSchema.nodes.title) {
50
+ return React.createElement(ManuscriptIcon, null);
51
+ }
49
52
  const Icon = icons.get(nodeType);
50
53
  return Icon ? React.createElement(Icon, null) : null;
51
54
  };
@@ -29,6 +29,7 @@ export interface TreeItem {
29
29
  pos: number;
30
30
  endPos: number;
31
31
  parent?: ManuscriptNode;
32
+ requirementsNode?: ManuscriptNode | null;
32
33
  }
33
34
  interface Props {
34
35
  depth?: number;
@@ -14,12 +14,10 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { Manuscript, Project } from '@manuscripts/json-schema';
17
- import { ManuscriptNode } from '@manuscripts/transform';
18
17
  import React from 'react';
19
18
  interface Props {
20
19
  project: Project;
21
20
  manuscript: Manuscript;
22
- doc: ManuscriptNode;
23
21
  }
24
22
  export declare const OutlineManuscript: React.FunctionComponent<Props>;
25
23
  export {};
@@ -23,7 +23,6 @@ type EditorProps = EditableBlockProps & CitationEditableProps & FigureProps & Ke
23
23
  theme: DefaultTheme;
24
24
  };
25
25
  declare const _default: (props: EditorProps, dispatch: Dispatch) => {
26
- title: import("../types").NodeViewCreator<import("../views/title").TitleView<any>>;
27
26
  bibliography_item: import("../types").NodeViewCreator<import("../views/bibliography_item").BibliographyItemView<any>>;
28
27
  bibliography_element: import("../types").NodeViewCreator<{
29
28
  gutterButtons: () => HTMLElement[];
@@ -138,7 +137,6 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
138
137
  } & import("../views/bullet_list").BulletListView<any>>;
139
138
  citation: import("../types").NodeViewCreator<import("../views/citation_editable").CitationEditableView>;
140
139
  cross_reference: import("../types").NodeViewCreator<import("../views/cross_reference_editable").CrossReferenceEditableView>;
141
- contributors_section: import("../types").NodeViewCreator<import("../views/contributors_section").ContributorsSectionView<any>>;
142
140
  equation: import("../types").NodeViewCreator<import("../views/equation_editable").EquationEditableView>;
143
141
  equation_element: import("../types").NodeViewCreator<{
144
142
  gutterButtons: () => HTMLElement[];
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.5.6-LEAN-2852-1",
4
+ "version": "1.5.6",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-body-editor",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -28,12 +28,12 @@
28
28
  "dependencies": {
29
29
  "@iarna/word-count": "^1.1.2",
30
30
  "@manuscripts/assets": "^0.6.4",
31
- "@manuscripts/json-schema": "2.2.0-LEAN-2852-14",
32
- "@manuscripts/library": "1.1.12-LEAN-2852-24",
33
- "@manuscripts/style-guide": "1.4.0-LEAN-2852-11",
31
+ "@manuscripts/json-schema": "^2.2.0",
32
+ "@manuscripts/library": "1.2.1",
33
+ "@manuscripts/style-guide": "^1.4.3",
34
34
  "@manuscripts/title-editor": "^1.1.0",
35
35
  "@manuscripts/track-changes-plugin": "^1.7.3",
36
- "@manuscripts/transform": "1.5.1-LEAN-2852-12",
36
+ "@manuscripts/transform": "1.5.2",
37
37
  "astrocite-eutils": "^0.16.4",
38
38
  "axios": "^1.2.2",
39
39
  "codemirror": "^5.58.1",
@@ -144,4 +144,4 @@
144
144
  "resolutions": {
145
145
  "@types/react": "^17.0.2"
146
146
  }
147
- }
147
+ }
@@ -730,27 +730,3 @@ Next levels are shifted 'up' by 1
730
730
  .citation-wrapper:hover .track-changes-review {
731
731
  display: inline-block;
732
732
  }
733
-
734
- .contributors {
735
- white-space: initial;
736
- margin-bottom: 24px;
737
- margin-top: 24px;
738
- }
739
-
740
- .contributors .tools-panel {
741
- position: initial;
742
- }
743
-
744
- .contributors table {
745
- line-height: initial;
746
- width: inherit;
747
- }
748
-
749
- .contributors tr th, .contributors tr td {
750
- border: none !important;
751
- background: none !important;
752
- }
753
-
754
- .contributors th, .contributors td {
755
- padding: initial;
756
- }
package/styles/Editor.css CHANGED
@@ -962,11 +962,3 @@
962
962
  .ProseMirror ol {
963
963
  padding-left: 30px !important;
964
964
  }
965
- .article-titles {
966
- cursor: text;
967
- font-family: "PT Serif", serif;
968
- font-size: 28px;
969
- font-weight: 700;
970
- line-height: 1.43;
971
- padding-left: 65px;
972
- }
@@ -1,36 +0,0 @@
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.ContributorsSectionView = void 0;
7
- const base_node_view_1 = require("./base_node_view");
8
- const creators_1 = require("./creators");
9
- const ReactSubView_1 = __importDefault(require("./ReactSubView"));
10
- class ContributorsSectionView extends base_node_view_1.BaseNodeView {
11
- constructor() {
12
- super(...arguments);
13
- this.initialise = () => {
14
- this.createDOM();
15
- };
16
- this.createDOM = () => {
17
- this.dom = document.createElement('div');
18
- this.dom.classList.add('contributors');
19
- const can = this.props.getCapabilities();
20
- const { components: { MetadataContainer }, subscribeStore, } = this.props;
21
- this.metadata = (0, ReactSubView_1.default)(this.props, MetadataContainer, {
22
- allowInvitingAuthors: false,
23
- showAuthorEditButton: true,
24
- disableEditButton: !can.editMetadata,
25
- subscribe: subscribeStore,
26
- }, this.node, this.getPos, this.view, 'metadata-container');
27
- if (this.metadata) {
28
- this.dom.appendChild(this.metadata);
29
- }
30
- };
31
- this.ignoreMutation = () => true;
32
- this.stopEvent = () => true;
33
- }
34
- }
35
- exports.ContributorsSectionView = ContributorsSectionView;
36
- exports.default = (0, creators_1.createNodeView)(ContributorsSectionView);
@@ -1,37 +0,0 @@
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.TitleView = void 0;
19
- const base_node_view_1 = require("./base_node_view");
20
- const creators_1 = require("./creators");
21
- class TitleView extends base_node_view_1.BaseNodeView {
22
- constructor() {
23
- super(...arguments);
24
- this.initialise = () => {
25
- this.createDOM();
26
- };
27
- this.createDOM = () => {
28
- this.dom = document.createElement('div');
29
- this.dom.classList.add('manuscript-title');
30
- this.contentDOM = document.createElement('div');
31
- this.contentDOM.classList.add('article-titles');
32
- this.dom.appendChild(this.contentDOM);
33
- };
34
- }
35
- }
36
- exports.TitleView = TitleView;
37
- exports.default = (0, creators_1.createNodeView)(TitleView);
@@ -1,20 +0,0 @@
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
- const creators_1 = require("./creators");
19
- const title_1 = require("./title");
20
- exports.default = (0, creators_1.createEditableNodeView)(title_1.TitleView);
@@ -1,29 +0,0 @@
1
- import { BaseNodeView } from './base_node_view';
2
- import { createNodeView } from './creators';
3
- import ReactSubView from './ReactSubView';
4
- export class ContributorsSectionView extends BaseNodeView {
5
- constructor() {
6
- super(...arguments);
7
- this.initialise = () => {
8
- this.createDOM();
9
- };
10
- this.createDOM = () => {
11
- this.dom = document.createElement('div');
12
- this.dom.classList.add('contributors');
13
- const can = this.props.getCapabilities();
14
- const { components: { MetadataContainer }, subscribeStore, } = this.props;
15
- this.metadata = ReactSubView(this.props, MetadataContainer, {
16
- allowInvitingAuthors: false,
17
- showAuthorEditButton: true,
18
- disableEditButton: !can.editMetadata,
19
- subscribe: subscribeStore,
20
- }, this.node, this.getPos, this.view, 'metadata-container');
21
- if (this.metadata) {
22
- this.dom.appendChild(this.metadata);
23
- }
24
- };
25
- this.ignoreMutation = () => true;
26
- this.stopEvent = () => true;
27
- }
28
- }
29
- export default createNodeView(ContributorsSectionView);
@@ -1,33 +0,0 @@
1
- /*!
2
- * © 2019 Atypon Systems LLC
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { BaseNodeView } from './base_node_view';
17
- import { createNodeView } from './creators';
18
- export class TitleView extends BaseNodeView {
19
- constructor() {
20
- super(...arguments);
21
- this.initialise = () => {
22
- this.createDOM();
23
- };
24
- this.createDOM = () => {
25
- this.dom = document.createElement('div');
26
- this.dom.classList.add('manuscript-title');
27
- this.contentDOM = document.createElement('div');
28
- this.contentDOM.classList.add('article-titles');
29
- this.dom.appendChild(this.contentDOM);
30
- };
31
- }
32
- }
33
- export default createNodeView(TitleView);
@@ -1,18 +0,0 @@
1
- /*!
2
- * © 2019 Atypon Systems LLC
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { createEditableNodeView } from './creators';
17
- import { TitleView } from './title';
18
- export default createEditableNodeView(TitleView);
@@ -1,17 +0,0 @@
1
- import { ManuscriptNodeView } from '@manuscripts/transform';
2
- import React from 'react';
3
- import { BaseNodeView } from './base_node_view';
4
- import { EditableBlockProps } from './editable_block';
5
- export interface ContributorsSectionProps extends EditableBlockProps {
6
- components: Record<string, React.ComponentType<any>>;
7
- subscribeStore: any;
8
- }
9
- export declare class ContributorsSectionView<PropsType extends ContributorsSectionProps> extends BaseNodeView<PropsType> implements ManuscriptNodeView {
10
- private metadata;
11
- initialise: () => void;
12
- protected createDOM: () => void;
13
- ignoreMutation: () => boolean;
14
- stopEvent: () => boolean;
15
- }
16
- declare const _default: (props: import("./base_node_view").BaseNodeProps, dispatch?: import("..").Dispatch | undefined) => import("../types").NodeViewCreator<ContributorsSectionView<any>>;
17
- export default _default;
@@ -1,24 +0,0 @@
1
- /*!
2
- * © 2019 Atypon Systems LLC
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { ManuscriptNodeView } from '@manuscripts/transform';
17
- import { BaseNodeProps, BaseNodeView } from './base_node_view';
18
- export declare class TitleView<PropsType extends BaseNodeProps> extends BaseNodeView<PropsType> implements ManuscriptNodeView {
19
- contentDOM: HTMLElement;
20
- initialise: () => void;
21
- protected createDOM: () => void;
22
- }
23
- declare const _default: (props: BaseNodeProps, dispatch?: import("..").Dispatch | undefined) => import("../types").NodeViewCreator<TitleView<any>>;
24
- export default _default;
@@ -1,18 +0,0 @@
1
- /*!
2
- * © 2019 Atypon Systems LLC
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { TitleView } from './title';
17
- declare const _default: (props: import("./editable_block").EditableBlockProps, dispatch?: import("..").Dispatch | undefined) => import("../types").NodeViewCreator<TitleView<any>>;
18
- export default _default;