@manuscripts/body-editor 1.5.0-LEAN-2852-13 → 1.5.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.
@@ -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({}, [
@@ -33,6 +33,8 @@ exports.MenuList = styled_components_1.default.div `
33
33
  box-shadow: 0 4px 9px 0 rgba(84, 83, 83, 0.3);
34
34
  color: #353535;
35
35
  min-width: 150px;
36
+ max-height: 70vh;
37
+ overflow-y: auto;
36
38
  padding: 4px 0;
37
39
  white-space: nowrap;
38
40
  width: auto;
@@ -48,8 +48,8 @@ const ManuscriptOutline = (props) => {
48
48
  const [values, setValues] = (0, react_1.useState)();
49
49
  const debouncedProps = (0, use_debounce_1.useDebounce)(props, 500);
50
50
  (0, react_1.useEffect)(() => {
51
- var _a, _b;
52
- const { doc, view, selected } = debouncedProps;
51
+ var _a;
52
+ const { doc, view, manuscript, selected } = debouncedProps;
53
53
  if (doc) {
54
54
  const { items } = (0, DraggableTree_1.buildTree)({
55
55
  node: doc,
@@ -57,7 +57,7 @@ const ManuscriptOutline = (props) => {
57
57
  index: 0,
58
58
  selected,
59
59
  });
60
- const node = (0, title_editor_1.parse)(((_a = doc.content.firstChild) === null || _a === void 0 ? void 0 : _a.textContent) || '');
60
+ const node = (0, title_editor_1.parse)(manuscript.title || '');
61
61
  const tree = {
62
62
  node,
63
63
  requirementsNode: doc,
@@ -67,7 +67,7 @@ const ManuscriptOutline = (props) => {
67
67
  isSelected: !selected,
68
68
  items,
69
69
  };
70
- setValues({ tree, view, editArticle: !!((_b = props.capabilities) === null || _b === void 0 ? void 0 : _b.editArticle) });
70
+ setValues({ tree, view, editArticle: !!((_a = props.capabilities) === null || _a === void 0 ? void 0 : _a.editArticle) });
71
71
  }
72
72
  else {
73
73
  setValues(undefined);
@@ -30,15 +30,12 @@ const titleText = (value) => {
30
30
  });
31
31
  return node.textContent;
32
32
  };
33
- const OutlineManuscript = ({ project, manuscript, doc, }) => {
34
- var _a;
35
- return (react_1.default.createElement(Outline_1.Outline, null,
36
- react_1.default.createElement(Outline_1.OutlineItem, { isSelected: false, depth: 0 },
37
- react_1.default.createElement(Outline_1.OutlineItemLink, { to: `/projects/${project._id}/manuscripts/${manuscript._id}` },
38
- react_1.default.createElement(Outline_1.OutlineItemArrow, null,
39
- react_1.default.createElement(Outline_1.StyledTriangleCollapsed, null)),
40
- react_1.default.createElement(Outline_1.OutlineItemIcon, null,
41
- react_1.default.createElement(OutlineIconManuscript_1.default, null)),
42
- react_1.default.createElement(Outline_1.OutlineItemLinkText, { className: 'outline-text-title' }, ((_a = doc.content.firstChild) === null || _a === void 0 ? void 0 : _a.textContent) ? (titleText(doc.content.firstChild.textContent)) : (react_1.default.createElement(Outline_1.OutlineItemPlaceholder, null, (0, transform_1.nodeTitlePlaceholder)(title_editor_1.schema.nodes.title))))))));
43
- };
33
+ const OutlineManuscript = ({ project, manuscript, }) => (react_1.default.createElement(Outline_1.Outline, null,
34
+ react_1.default.createElement(Outline_1.OutlineItem, { isSelected: false, depth: 0 },
35
+ react_1.default.createElement(Outline_1.OutlineItemLink, { to: `/projects/${project._id}/manuscripts/${manuscript._id}` },
36
+ react_1.default.createElement(Outline_1.OutlineItemArrow, null,
37
+ react_1.default.createElement(Outline_1.StyledTriangleCollapsed, null)),
38
+ react_1.default.createElement(Outline_1.OutlineItemIcon, null,
39
+ react_1.default.createElement(OutlineIconManuscript_1.default, null)),
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))))))));
44
41
  exports.OutlineManuscript = OutlineManuscript;
@@ -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({}, [
@@ -27,6 +27,8 @@ export const MenuList = styled.div `
27
27
  box-shadow: 0 4px 9px 0 rgba(84, 83, 83, 0.3);
28
28
  color: #353535;
29
29
  min-width: 150px;
30
+ max-height: 70vh;
31
+ overflow-y: auto;
30
32
  padding: 4px 0;
31
33
  white-space: nowrap;
32
34
  width: auto;
@@ -22,8 +22,8 @@ export const ManuscriptOutline = (props) => {
22
22
  const [values, setValues] = useState();
23
23
  const debouncedProps = useDebounce(props, 500);
24
24
  useEffect(() => {
25
- var _a, _b;
26
- const { doc, view, selected } = debouncedProps;
25
+ var _a;
26
+ const { doc, view, manuscript, selected } = debouncedProps;
27
27
  if (doc) {
28
28
  const { items } = buildTree({
29
29
  node: doc,
@@ -31,7 +31,7 @@ export const ManuscriptOutline = (props) => {
31
31
  index: 0,
32
32
  selected,
33
33
  });
34
- const node = parse(((_a = doc.content.firstChild) === null || _a === void 0 ? void 0 : _a.textContent) || '');
34
+ const node = parse(manuscript.title || '');
35
35
  const tree = {
36
36
  node,
37
37
  requirementsNode: doc,
@@ -41,7 +41,7 @@ export const ManuscriptOutline = (props) => {
41
41
  isSelected: !selected,
42
42
  items,
43
43
  };
44
- setValues({ tree, view, editArticle: !!((_b = props.capabilities) === null || _b === void 0 ? void 0 : _b.editArticle) });
44
+ setValues({ tree, view, editArticle: !!((_a = props.capabilities) === null || _a === void 0 ? void 0 : _a.editArticle) });
45
45
  }
46
46
  else {
47
47
  setValues(undefined);
@@ -24,14 +24,11 @@ const titleText = (value) => {
24
24
  });
25
25
  return node.textContent;
26
26
  };
27
- export const OutlineManuscript = ({ project, manuscript, doc, }) => {
28
- var _a;
29
- return (React.createElement(Outline, null,
30
- React.createElement(OutlineItem, { isSelected: false, depth: 0 },
31
- React.createElement(OutlineItemLink, { to: `/projects/${project._id}/manuscripts/${manuscript._id}` },
32
- React.createElement(OutlineItemArrow, null,
33
- React.createElement(StyledTriangleCollapsed, null)),
34
- React.createElement(OutlineItemIcon, null,
35
- React.createElement(OutlineIconManuscript, null)),
36
- React.createElement(OutlineItemLinkText, { className: 'outline-text-title' }, ((_a = doc.content.firstChild) === null || _a === void 0 ? void 0 : _a.textContent) ? (titleText(doc.content.firstChild.textContent)) : (React.createElement(OutlineItemPlaceholder, null, nodeTitlePlaceholder(schema.nodes.title))))))));
37
- };
27
+ export const OutlineManuscript = ({ project, manuscript, }) => (React.createElement(Outline, null,
28
+ React.createElement(OutlineItem, { isSelected: false, depth: 0 },
29
+ React.createElement(OutlineItemLink, { to: `/projects/${project._id}/manuscripts/${manuscript._id}` },
30
+ React.createElement(OutlineItemArrow, null,
31
+ React.createElement(StyledTriangleCollapsed, null)),
32
+ React.createElement(OutlineItemIcon, null,
33
+ React.createElement(OutlineIconManuscript, null)),
34
+ React.createElement(OutlineItemLinkText, { className: 'outline-text-title' }, manuscript.title ? (titleText(manuscript.title)) : (React.createElement(OutlineItemPlaceholder, null, nodeTitlePlaceholder(schema.nodes.title))))))));
@@ -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 {};
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.0-LEAN-2852-13",
4
+ "version": "1.5.1",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-body-editor",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -29,12 +29,12 @@
29
29
  "@iarna/word-count": "^1.1.2",
30
30
  "@manuscripts/assets": "^0.6.4",
31
31
  "@manuscripts/comment-editor": "^1.0.3",
32
- "@manuscripts/json-schema": "2.2.0-LEAN-2852-12",
33
- "@manuscripts/library": "1.1.12-LEAN-2852-12",
34
- "@manuscripts/style-guide": "1.4.0-LEAN-2852-7",
32
+ "@manuscripts/json-schema": "^2.2.0",
33
+ "@manuscripts/library": "1.2.0",
34
+ "@manuscripts/style-guide": "1.4.0",
35
35
  "@manuscripts/title-editor": "^1.1.0",
36
36
  "@manuscripts/track-changes-plugin": "^1.7.2",
37
- "@manuscripts/transform": "1.5.0-LEAN-2852-20",
37
+ "@manuscripts/transform": "1.5.0",
38
38
  "astrocite-eutils": "^0.16.4",
39
39
  "axios": "^1.2.2",
40
40
  "codemirror": "^5.58.1",
package/styles/Editor.css CHANGED
@@ -962,11 +962,3 @@
962
962
  .ProseMirror ol {
963
963
  padding-left: 30px !important;
964
964
  }
965
- .article-title {
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,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 titles_1 = require("./titles");
20
- exports.default = (0, creators_1.createEditableNodeView)(titles_1.TitlesView);
@@ -1,52 +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.TitlesView = void 0;
19
- const track_changes_utils_1 = require("../lib/track-changes-utils");
20
- const base_node_view_1 = require("./base_node_view");
21
- const creators_1 = require("./creators");
22
- class TitlesView extends base_node_view_1.BaseNodeView {
23
- constructor() {
24
- super(...arguments);
25
- this.initialise = () => {
26
- this.createDOM();
27
- this.updateContents();
28
- };
29
- this.updateContents = () => {
30
- const titleText = this.node.attrs.title;
31
- if (!(0, track_changes_utils_1.isRejectedInsert)(this.node)) {
32
- const titleElement = document.createElement('div');
33
- titleElement.textContent = titleText;
34
- const blockContainer = document.createElement('div');
35
- blockContainer.classList.add('block-container');
36
- blockContainer.appendChild(titleElement);
37
- this.dom.innerHTML = '';
38
- this.dom.appendChild(blockContainer);
39
- }
40
- else {
41
- this.dom.innerHTML = '';
42
- }
43
- };
44
- this.createDOM = () => {
45
- this.dom = document.createElement('div');
46
- this.dom.classList.add('article-title');
47
- this.contentDOM = this.dom;
48
- };
49
- }
50
- }
51
- exports.TitlesView = TitlesView;
52
- exports.default = (0, creators_1.createNodeView)(TitlesView);
@@ -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 { TitlesView } from './titles';
18
- export default createEditableNodeView(TitlesView);
@@ -1,48 +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 { isRejectedInsert } from '../lib/track-changes-utils';
17
- import { BaseNodeView } from './base_node_view';
18
- import { createNodeView } from './creators';
19
- export class TitlesView extends BaseNodeView {
20
- constructor() {
21
- super(...arguments);
22
- this.initialise = () => {
23
- this.createDOM();
24
- this.updateContents();
25
- };
26
- this.updateContents = () => {
27
- const titleText = this.node.attrs.title;
28
- if (!isRejectedInsert(this.node)) {
29
- const titleElement = document.createElement('div');
30
- titleElement.textContent = titleText;
31
- const blockContainer = document.createElement('div');
32
- blockContainer.classList.add('block-container');
33
- blockContainer.appendChild(titleElement);
34
- this.dom.innerHTML = '';
35
- this.dom.appendChild(blockContainer);
36
- }
37
- else {
38
- this.dom.innerHTML = '';
39
- }
40
- };
41
- this.createDOM = () => {
42
- this.dom = document.createElement('div');
43
- this.dom.classList.add('article-title');
44
- this.contentDOM = this.dom;
45
- };
46
- }
47
- }
48
- export default createNodeView(TitlesView);
@@ -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 { TitlesView } from './titles';
17
- declare const _default: (props: import("./editable_block").EditableBlockProps, dispatch?: import("..").Dispatch | undefined) => import("../types").NodeViewCreator<TitlesView<any>>;
18
- 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 TitlesView<PropsType extends BaseNodeProps> extends BaseNodeView<PropsType> implements ManuscriptNodeView {
19
- initialise: () => void;
20
- updateContents: () => void;
21
- protected createDOM: () => void;
22
- }
23
- declare const _default: (props: BaseNodeProps, dispatch?: import("..").Dispatch | undefined) => import("../types").NodeViewCreator<TitlesView<any>>;
24
- export default _default;