@manuscripts/body-editor 1.4.24 → 1.5.0-LEAN-2852-2
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/components/outline/ManuscriptOutline.js +2 -2
- package/dist/cjs/components/outline/OutlineManuscript.js +2 -2
- package/dist/cjs/configs/editor-views.js +2 -0
- package/dist/cjs/views/title_editable.js +20 -0
- package/dist/cjs/views/titles.js +48 -0
- package/dist/es/components/outline/ManuscriptOutline.js +2 -2
- package/dist/es/components/outline/OutlineManuscript.js +2 -2
- package/dist/es/configs/editor-views.js +2 -0
- package/dist/es/views/title_editable.js +18 -0
- package/dist/es/views/titles.js +44 -0
- package/dist/types/components/outline/ManuscriptOutline.d.ts +2 -1
- package/dist/types/components/outline/OutlineManuscript.d.ts +2 -1
- package/dist/types/configs/editor-views.d.ts +1 -0
- package/dist/types/views/title_editable.d.ts +18 -0
- package/dist/types/views/titles.d.ts +24 -0
- package/package.json +6 -6
|
@@ -49,7 +49,7 @@ const ManuscriptOutline = (props) => {
|
|
|
49
49
|
const debouncedProps = (0, use_debounce_1.useDebounce)(props, 500);
|
|
50
50
|
(0, react_1.useEffect)(() => {
|
|
51
51
|
var _a;
|
|
52
|
-
const { doc, view,
|
|
52
|
+
const { doc, view, selected, titles } = 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)(titles.title || '');
|
|
61
61
|
const tree = {
|
|
62
62
|
node,
|
|
63
63
|
requirementsNode: doc,
|
|
@@ -30,12 +30,12 @@ const titleText = (value) => {
|
|
|
30
30
|
});
|
|
31
31
|
return node.textContent;
|
|
32
32
|
};
|
|
33
|
-
const OutlineManuscript = ({ project, manuscript, }) => (react_1.default.createElement(Outline_1.Outline, null,
|
|
33
|
+
const OutlineManuscript = ({ project, manuscript, titles, }) => (react_1.default.createElement(Outline_1.Outline, null,
|
|
34
34
|
react_1.default.createElement(Outline_1.OutlineItem, { isSelected: false, depth: 0 },
|
|
35
35
|
react_1.default.createElement(Outline_1.OutlineItemLink, { to: `/projects/${project._id}/manuscripts/${manuscript._id}` },
|
|
36
36
|
react_1.default.createElement(Outline_1.OutlineItemArrow, null,
|
|
37
37
|
react_1.default.createElement(Outline_1.StyledTriangleCollapsed, null)),
|
|
38
38
|
react_1.default.createElement(Outline_1.OutlineItemIcon, null,
|
|
39
39
|
react_1.default.createElement(OutlineIconManuscript_1.default, null)),
|
|
40
|
-
react_1.default.createElement(Outline_1.OutlineItemLinkText, { className: 'outline-text-title' },
|
|
40
|
+
react_1.default.createElement(Outline_1.OutlineItemLinkText, { className: 'outline-text-title' }, titles.title ? (titleText(titles.title)) : (react_1.default.createElement(Outline_1.OutlineItemPlaceholder, null, (0, transform_1.nodeTitlePlaceholder)(title_editor_1.schema.nodes.title))))))));
|
|
41
41
|
exports.OutlineManuscript = OutlineManuscript;
|
|
@@ -46,6 +46,7 @@ const pullquote_element_editable_1 = __importDefault(require("../views/pullquote
|
|
|
46
46
|
const section_label_1 = __importDefault(require("../views/section_label"));
|
|
47
47
|
const section_title_editable_1 = __importDefault(require("../views/section_title_editable"));
|
|
48
48
|
const table_element_editable_1 = __importDefault(require("../views/table_element_editable"));
|
|
49
|
+
const titles_1 = __importDefault(require("../views/titles"));
|
|
49
50
|
const toc_element_editable_1 = __importDefault(require("../views/toc_element_editable"));
|
|
50
51
|
exports.default = (props, dispatch) => {
|
|
51
52
|
return {
|
|
@@ -78,5 +79,6 @@ exports.default = (props, dispatch) => {
|
|
|
78
79
|
table_element: (0, table_element_editable_1.default)(props),
|
|
79
80
|
toc_element: (0, toc_element_editable_1.default)(props),
|
|
80
81
|
meta_section: meta_section_1.default,
|
|
82
|
+
titles: (0, titles_1.default)(props),
|
|
81
83
|
};
|
|
82
84
|
};
|
|
@@ -0,0 +1,20 @@
|
|
|
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);
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
this.dom.innerHTML = '';
|
|
35
|
+
this.dom.appendChild(titleElement);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
this.dom.innerHTML = '';
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
this.createDOM = () => {
|
|
42
|
+
this.dom = document.createElement('div');
|
|
43
|
+
this.contentDOM = this.dom;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.TitlesView = TitlesView;
|
|
48
|
+
exports.default = (0, creators_1.createNodeView)(TitlesView);
|
|
@@ -23,7 +23,7 @@ export const ManuscriptOutline = (props) => {
|
|
|
23
23
|
const debouncedProps = useDebounce(props, 500);
|
|
24
24
|
useEffect(() => {
|
|
25
25
|
var _a;
|
|
26
|
-
const { doc, view,
|
|
26
|
+
const { doc, view, selected, titles } = 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(titles.title || '');
|
|
35
35
|
const tree = {
|
|
36
36
|
node,
|
|
37
37
|
requirementsNode: doc,
|
|
@@ -24,11 +24,11 @@ const titleText = (value) => {
|
|
|
24
24
|
});
|
|
25
25
|
return node.textContent;
|
|
26
26
|
};
|
|
27
|
-
export const OutlineManuscript = ({ project, manuscript, }) => (React.createElement(Outline, null,
|
|
27
|
+
export const OutlineManuscript = ({ project, manuscript, titles, }) => (React.createElement(Outline, null,
|
|
28
28
|
React.createElement(OutlineItem, { isSelected: false, depth: 0 },
|
|
29
29
|
React.createElement(OutlineItemLink, { to: `/projects/${project._id}/manuscripts/${manuscript._id}` },
|
|
30
30
|
React.createElement(OutlineItemArrow, null,
|
|
31
31
|
React.createElement(StyledTriangleCollapsed, null)),
|
|
32
32
|
React.createElement(OutlineItemIcon, null,
|
|
33
33
|
React.createElement(OutlineIconManuscript, null)),
|
|
34
|
-
React.createElement(OutlineItemLinkText, { className: 'outline-text-title' },
|
|
34
|
+
React.createElement(OutlineItemLinkText, { className: 'outline-text-title' }, titles.title ? (titleText(titles.title)) : (React.createElement(OutlineItemPlaceholder, null, nodeTitlePlaceholder(schema.nodes.title))))))));
|
|
@@ -41,6 +41,7 @@ import pullquoteElement from '../views/pullquote_element_editable';
|
|
|
41
41
|
import sectionLabel from '../views/section_label';
|
|
42
42
|
import sectionTitle from '../views/section_title_editable';
|
|
43
43
|
import tableElement from '../views/table_element_editable';
|
|
44
|
+
import titles from '../views/titles';
|
|
44
45
|
import tocElement from '../views/toc_element_editable';
|
|
45
46
|
export default (props, dispatch) => {
|
|
46
47
|
return {
|
|
@@ -73,5 +74,6 @@ export default (props, dispatch) => {
|
|
|
73
74
|
table_element: tableElement(props),
|
|
74
75
|
toc_element: tocElement(props),
|
|
75
76
|
meta_section: metaSection,
|
|
77
|
+
titles: titles(props),
|
|
76
78
|
};
|
|
77
79
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
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);
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
this.dom.innerHTML = '';
|
|
32
|
+
this.dom.appendChild(titleElement);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
this.dom.innerHTML = '';
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
this.createDOM = () => {
|
|
39
|
+
this.dom = document.createElement('div');
|
|
40
|
+
this.contentDOM = this.dom;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export default createNodeView(TitlesView);
|
|
@@ -13,12 +13,13 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Manuscript } from '@manuscripts/json-schema';
|
|
16
|
+
import { Manuscript, Titles } from '@manuscripts/json-schema';
|
|
17
17
|
import { Capabilities } from '@manuscripts/style-guide';
|
|
18
18
|
import { ManuscriptEditorView, ManuscriptNode, Selected } from '@manuscripts/transform';
|
|
19
19
|
import React from 'react';
|
|
20
20
|
interface Props {
|
|
21
21
|
manuscript: Manuscript;
|
|
22
|
+
titles: Titles;
|
|
22
23
|
selected: Selected | null;
|
|
23
24
|
doc: ManuscriptNode | null;
|
|
24
25
|
capabilities?: Capabilities;
|
|
@@ -13,11 +13,12 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Manuscript, Project } from '@manuscripts/json-schema';
|
|
16
|
+
import { Manuscript, Project, Titles } from '@manuscripts/json-schema';
|
|
17
17
|
import React from 'react';
|
|
18
18
|
interface Props {
|
|
19
19
|
project: Project;
|
|
20
20
|
manuscript: Manuscript;
|
|
21
|
+
titles: Titles;
|
|
21
22
|
}
|
|
22
23
|
export declare const OutlineManuscript: React.FunctionComponent<Props>;
|
|
23
24
|
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
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;
|
|
@@ -0,0 +1,24 @@
|
|
|
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;
|
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.
|
|
4
|
+
"version": "1.5.0-LEAN-2852-2",
|
|
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": "
|
|
33
|
-
"@manuscripts/library": "
|
|
34
|
-
"@manuscripts/style-guide": "
|
|
32
|
+
"@manuscripts/json-schema": "2.2.0-LEAN-2852-5",
|
|
33
|
+
"@manuscripts/library": "1.1.12-LEAN-2852-6",
|
|
34
|
+
"@manuscripts/style-guide": "1.4.0-LEAN-2852-0",
|
|
35
35
|
"@manuscripts/title-editor": "^1.1.0",
|
|
36
36
|
"@manuscripts/track-changes-plugin": "^1.7.2",
|
|
37
|
-
"@manuscripts/transform": "
|
|
37
|
+
"@manuscripts/transform": "1.5.0-LEAN-2852-9",
|
|
38
38
|
"astrocite-eutils": "^0.16.4",
|
|
39
39
|
"axios": "^1.2.2",
|
|
40
40
|
"codemirror": "^5.58.1",
|
|
@@ -145,4 +145,4 @@
|
|
|
145
145
|
"resolutions": {
|
|
146
146
|
"@types/react": "^17.0.2"
|
|
147
147
|
}
|
|
148
|
-
}
|
|
148
|
+
}
|