@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.
- package/dist/cjs/commands.js +1 -1
- package/dist/cjs/components/application-menu/MenuItemContainer.js +2 -0
- package/dist/cjs/components/outline/ManuscriptOutline.js +4 -4
- package/dist/cjs/components/outline/OutlineManuscript.js +8 -11
- package/dist/es/commands.js +1 -1
- package/dist/es/components/application-menu/MenuItemContainer.js +2 -0
- package/dist/es/components/outline/ManuscriptOutline.js +4 -4
- package/dist/es/components/outline/OutlineManuscript.js +8 -11
- package/dist/types/components/outline/OutlineManuscript.d.ts +0 -2
- package/package.json +5 -5
- package/styles/Editor.css +0 -8
- package/dist/cjs/views/title_editable.js +0 -20
- package/dist/cjs/views/titles.js +0 -52
- package/dist/es/views/title_editable.js +0 -18
- package/dist/es/views/titles.js +0 -48
- package/dist/types/views/title_editable.d.ts +0 -18
- package/dist/types/views/titles.d.ts +0 -24
package/dist/cjs/commands.js
CHANGED
|
@@ -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.
|
|
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({}, [
|
|
@@ -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
|
|
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)(
|
|
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: !!((
|
|
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,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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;
|
package/dist/es/commands.js
CHANGED
|
@@ -354,7 +354,7 @@ export const insertFootnotesSection = (state, dispatch) => {
|
|
|
354
354
|
return true;
|
|
355
355
|
};
|
|
356
356
|
export const insertBibliographySection = (state, dispatch) => {
|
|
357
|
-
if (
|
|
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({}, [
|
|
@@ -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
|
|
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(
|
|
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: !!((
|
|
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,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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.
|
|
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
|
|
33
|
-
"@manuscripts/library": "1.
|
|
34
|
-
"@manuscripts/style-guide": "1.4.0
|
|
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
|
|
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
|
@@ -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);
|
package/dist/cjs/views/titles.js
DELETED
|
@@ -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);
|
package/dist/es/views/titles.js
DELETED
|
@@ -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;
|