@manuscripts/body-editor 3.5.9 → 3.5.11
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/configs/editor-views.js +4 -0
- package/dist/cjs/icons.js +2 -1
- package/dist/cjs/versions.js +1 -1
- package/dist/cjs/views/attachment.js +131 -0
- package/dist/cjs/views/attachments.js +64 -0
- package/dist/cjs/views/hero_image.js +2 -2
- package/dist/es/configs/editor-views.js +4 -0
- package/dist/es/icons.js +2 -1
- package/dist/es/versions.js +1 -1
- package/dist/es/views/attachment.js +124 -0
- package/dist/es/views/attachments.js +57 -0
- package/dist/es/views/hero_image.js +2 -2
- package/dist/types/icons.d.ts +1 -0
- package/dist/types/versions.d.ts +1 -1
- package/dist/types/views/attachment.d.ts +36 -0
- package/dist/types/views/attachments.d.ts +27 -0
- package/package.json +2 -2
- package/styles/AdvancedEditor.css +75 -5
|
@@ -8,6 +8,8 @@ const accessibility_element_1 = __importDefault(require("../views/accessibility_
|
|
|
8
8
|
const affiliations_1 = __importDefault(require("../views/affiliations"));
|
|
9
9
|
const alt_title_1 = __importDefault(require("../views/alt_title"));
|
|
10
10
|
const alt_titles_section_1 = __importDefault(require("../views/alt_titles_section"));
|
|
11
|
+
const attachment_1 = __importDefault(require("../views/attachment"));
|
|
12
|
+
const attachments_1 = __importDefault(require("../views/attachments"));
|
|
11
13
|
const author_notes_1 = __importDefault(require("../views/author_notes"));
|
|
12
14
|
const award_1 = __importDefault(require("../views/award"));
|
|
13
15
|
const awards_1 = __importDefault(require("../views/awards"));
|
|
@@ -103,5 +105,7 @@ exports.default = (props, dispatch) => {
|
|
|
103
105
|
hero_image: (0, hero_image_editable_1.default)(props, dispatch),
|
|
104
106
|
abstracts: (0, abstracts_1.default)(props),
|
|
105
107
|
trans_abstract: (0, translated_abstract_editable_1.default)(props),
|
|
108
|
+
attachment: (0, attachment_1.default)(props, dispatch),
|
|
109
|
+
attachments: (0, attachments_1.default)(props, dispatch),
|
|
106
110
|
};
|
|
107
111
|
};
|
package/dist/cjs/icons.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.translateIcon = exports.draggableIcon = exports.fileCorruptedIcon = exports.imageDefaultIcon = exports.imageLeftIcon = exports.imageRightIcon = exports.addBtnIcon = exports.plusIcon = exports.lockIcon = exports.scrollIcon = exports.sectionCategoryIcon = exports.editIcon = exports.deleteIcon = exports.alertIcon = exports.arrowUp = exports.arrowDown = exports.addAuthorIcon = void 0;
|
|
3
|
+
exports.fileMainDocumentIcon = exports.translateIcon = exports.draggableIcon = exports.fileCorruptedIcon = exports.imageDefaultIcon = exports.imageLeftIcon = exports.imageRightIcon = exports.addBtnIcon = exports.plusIcon = exports.lockIcon = exports.scrollIcon = exports.sectionCategoryIcon = exports.editIcon = exports.deleteIcon = exports.alertIcon = exports.arrowUp = exports.arrowDown = exports.addAuthorIcon = void 0;
|
|
4
4
|
const style_guide_1 = require("@manuscripts/style-guide");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const server_1 = require("react-dom/server");
|
|
@@ -22,3 +22,4 @@ exports.imageDefaultIcon = (0, server_1.renderToStaticMarkup)((0, react_1.create
|
|
|
22
22
|
exports.fileCorruptedIcon = (0, server_1.renderToStaticMarkup)((0, react_1.createElement)(style_guide_1.FileCorruptedIcon));
|
|
23
23
|
exports.draggableIcon = (0, server_1.renderToStaticMarkup)((0, react_1.createElement)(style_guide_1.DraggableIcon));
|
|
24
24
|
exports.translateIcon = (0, server_1.renderToStaticMarkup)((0, react_1.createElement)(style_guide_1.TranslateIcon));
|
|
25
|
+
exports.fileMainDocumentIcon = (0, server_1.renderToStaticMarkup)((0, react_1.createElement)(style_guide_1.FileMainDocumentIcon));
|
package/dist/cjs/versions.js
CHANGED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* © 2025 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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.AttachmentView = void 0;
|
|
22
|
+
const icons_1 = require("../icons");
|
|
23
|
+
const block_view_1 = __importDefault(require("./block_view"));
|
|
24
|
+
const creators_1 = require("./creators");
|
|
25
|
+
class AttachmentView extends block_view_1.default {
|
|
26
|
+
constructor() {
|
|
27
|
+
super(...arguments);
|
|
28
|
+
this.createElement = () => {
|
|
29
|
+
this.createContainer();
|
|
30
|
+
this.renderView();
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
updateContents() {
|
|
34
|
+
this.renderView();
|
|
35
|
+
}
|
|
36
|
+
renderView() {
|
|
37
|
+
this.container.innerHTML = '';
|
|
38
|
+
const file = this.getFileFromAttachment();
|
|
39
|
+
if (!file) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (this.isPDF(file)) {
|
|
43
|
+
this.createPDFPreview(file);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
createContainer() {
|
|
47
|
+
this.container = document.createElement('div');
|
|
48
|
+
this.container.classList.add('attachment-item');
|
|
49
|
+
this.container.addEventListener('click', (e) => {
|
|
50
|
+
e.stopPropagation();
|
|
51
|
+
this.setMainDocumentSelection();
|
|
52
|
+
});
|
|
53
|
+
this.dom.appendChild(this.container);
|
|
54
|
+
}
|
|
55
|
+
isPDF(file) {
|
|
56
|
+
return file.name?.toLowerCase().endsWith('.pdf') ?? false;
|
|
57
|
+
}
|
|
58
|
+
getFileFromAttachment() {
|
|
59
|
+
const { href } = this.node.attrs;
|
|
60
|
+
if (!href) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
const files = this.props?.getFiles?.() || [];
|
|
64
|
+
return files.find((f) => f.id === href) || null;
|
|
65
|
+
}
|
|
66
|
+
createPDFPreview(file) {
|
|
67
|
+
this.container.setAttribute('data-pdf-preview', file.id);
|
|
68
|
+
const header = this.createHeader(file);
|
|
69
|
+
const content = this.createContent(file);
|
|
70
|
+
this.container.appendChild(header);
|
|
71
|
+
this.container.appendChild(content);
|
|
72
|
+
}
|
|
73
|
+
createHeader(file) {
|
|
74
|
+
const header = document.createElement('div');
|
|
75
|
+
header.className = 'attachment-header';
|
|
76
|
+
const icon = this.createIcon();
|
|
77
|
+
const name = this.createFileName(file.name);
|
|
78
|
+
header.append(icon, name);
|
|
79
|
+
return header;
|
|
80
|
+
}
|
|
81
|
+
createIcon() {
|
|
82
|
+
const icon = document.createElement('span');
|
|
83
|
+
icon.className = 'attachment-icon';
|
|
84
|
+
icon.innerHTML = icons_1.fileMainDocumentIcon;
|
|
85
|
+
return icon;
|
|
86
|
+
}
|
|
87
|
+
createFileName(fileName) {
|
|
88
|
+
const name = document.createElement('span');
|
|
89
|
+
Object.assign(name, {
|
|
90
|
+
textContent: fileName,
|
|
91
|
+
className: 'attachment-name',
|
|
92
|
+
title: fileName,
|
|
93
|
+
});
|
|
94
|
+
return name;
|
|
95
|
+
}
|
|
96
|
+
createContent(file) {
|
|
97
|
+
const content = document.createElement('div');
|
|
98
|
+
content.className = 'attachment-content';
|
|
99
|
+
const embed = document.createElement('embed');
|
|
100
|
+
Object.assign(embed, {
|
|
101
|
+
src: this.getPDFUrl(file),
|
|
102
|
+
type: 'application/pdf',
|
|
103
|
+
className: 'attachment-pdf',
|
|
104
|
+
height: '400px',
|
|
105
|
+
width: '100%',
|
|
106
|
+
});
|
|
107
|
+
embed.style.border = 'none';
|
|
108
|
+
content.appendChild(embed);
|
|
109
|
+
return content;
|
|
110
|
+
}
|
|
111
|
+
getPDFUrl(file) {
|
|
112
|
+
const baseUrl = file.link || file.id || '#';
|
|
113
|
+
if (baseUrl && baseUrl !== '#') {
|
|
114
|
+
const separator = baseUrl.includes('?') ? '&' : '?';
|
|
115
|
+
return `${baseUrl}${separator}inline=true`;
|
|
116
|
+
}
|
|
117
|
+
return baseUrl;
|
|
118
|
+
}
|
|
119
|
+
setMainDocumentSelection() {
|
|
120
|
+
if (this.props.onEditorClick) {
|
|
121
|
+
const event = {
|
|
122
|
+
target: { dataset: { action: 'select-main-document' } },
|
|
123
|
+
stopPropagation: () => {
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
this.props.onEditorClick(this.getPos(), this.node, this.getPos(), event);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
exports.AttachmentView = AttachmentView;
|
|
131
|
+
exports.default = (0, creators_1.createNodeView)(AttachmentView);
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* © 2025 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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.AttachmentsView = void 0;
|
|
22
|
+
const icons_1 = require("../icons");
|
|
23
|
+
const block_view_1 = __importDefault(require("./block_view"));
|
|
24
|
+
const creators_1 = require("./creators");
|
|
25
|
+
class AttachmentsView extends block_view_1.default {
|
|
26
|
+
constructor() {
|
|
27
|
+
super(...arguments);
|
|
28
|
+
this.collapsed = false;
|
|
29
|
+
this.ignoreMutation = () => true;
|
|
30
|
+
this.createElement = () => {
|
|
31
|
+
this.container = document.createElement('div');
|
|
32
|
+
this.container.classList.add('block', 'attachments-container');
|
|
33
|
+
this.dom.appendChild(this.container);
|
|
34
|
+
this.container.appendChild(this.createPanel());
|
|
35
|
+
const content = document.createElement('div');
|
|
36
|
+
content.className = 'attachments-content';
|
|
37
|
+
this.container.appendChild(content);
|
|
38
|
+
this.contentDOM = content;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
createPanel() {
|
|
42
|
+
const panel = document.createElement('div');
|
|
43
|
+
panel.classList.add('panel-header');
|
|
44
|
+
const label = document.createElement('span');
|
|
45
|
+
label.textContent = 'Main Document';
|
|
46
|
+
label.contentEditable = 'false';
|
|
47
|
+
const toggleBtn = document.createElement('button');
|
|
48
|
+
toggleBtn.classList.add('toggle-btn', 'button-reset');
|
|
49
|
+
toggleBtn.innerHTML = icons_1.arrowUp;
|
|
50
|
+
toggleBtn.classList.toggle('collapsed', this.collapsed);
|
|
51
|
+
toggleBtn.onclick = () => {
|
|
52
|
+
this.collapsed = !this.collapsed;
|
|
53
|
+
if (this.contentDOM) {
|
|
54
|
+
this.contentDOM.style.display = this.collapsed ? 'none' : '';
|
|
55
|
+
}
|
|
56
|
+
toggleBtn.classList.toggle('collapsed', this.collapsed);
|
|
57
|
+
};
|
|
58
|
+
panel.appendChild(label);
|
|
59
|
+
panel.appendChild(toggleBtn);
|
|
60
|
+
return panel;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.AttachmentsView = AttachmentsView;
|
|
64
|
+
exports.default = (0, creators_1.createNodeView)(AttachmentsView);
|
|
@@ -40,12 +40,12 @@ class HeroImageView extends block_view_1.default {
|
|
|
40
40
|
}
|
|
41
41
|
createPanel() {
|
|
42
42
|
const panel = document.createElement('div');
|
|
43
|
-
panel.classList.add('
|
|
43
|
+
panel.classList.add('panel-header');
|
|
44
44
|
const label = document.createElement('span');
|
|
45
45
|
label.textContent = 'Hero image';
|
|
46
46
|
label.contentEditable = 'false';
|
|
47
47
|
const heroImageToggleBtn = document.createElement('button');
|
|
48
|
-
heroImageToggleBtn.classList.add('
|
|
48
|
+
heroImageToggleBtn.classList.add('toggle-btn', 'button-reset');
|
|
49
49
|
heroImageToggleBtn.innerHTML = icons_1.arrowUp;
|
|
50
50
|
heroImageToggleBtn.classList.toggle('collapsed', this.collapsed);
|
|
51
51
|
heroImageToggleBtn.onclick = () => {
|
|
@@ -3,6 +3,8 @@ import accessibilityElement from '../views/accessibility_element';
|
|
|
3
3
|
import affiliations from '../views/affiliations';
|
|
4
4
|
import alt_title from '../views/alt_title';
|
|
5
5
|
import alt_titles_section from '../views/alt_titles_section';
|
|
6
|
+
import attachment from '../views/attachment';
|
|
7
|
+
import attachments from '../views/attachments';
|
|
6
8
|
import authorNotes from '../views/author_notes';
|
|
7
9
|
import award from '../views/award';
|
|
8
10
|
import awards from '../views/awards';
|
|
@@ -98,5 +100,7 @@ export default (props, dispatch) => {
|
|
|
98
100
|
hero_image: heroImage(props, dispatch),
|
|
99
101
|
abstracts: abstracts(props),
|
|
100
102
|
trans_abstract: transAbstract(props),
|
|
103
|
+
attachment: attachment(props, dispatch),
|
|
104
|
+
attachments: attachments(props, dispatch),
|
|
101
105
|
};
|
|
102
106
|
};
|
package/dist/es/icons.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AddAuthorIcon, AlertIcon, ArrowDownCircleIcon, ArrowUpIcon, DeleteIcon, DraggableIcon, EditIcon, FileCorruptedIcon, ImageDefaultIcon, ImageLeftIcon, ImageRightIcon, LockIcon, PlusIcon, ScrollIcon, SectionCategoryIcon, TranslateIcon, } from '@manuscripts/style-guide';
|
|
1
|
+
import { AddAuthorIcon, AlertIcon, ArrowDownCircleIcon, ArrowUpIcon, DeleteIcon, DraggableIcon, EditIcon, FileCorruptedIcon, FileMainDocumentIcon, ImageDefaultIcon, ImageLeftIcon, ImageRightIcon, LockIcon, PlusIcon, ScrollIcon, SectionCategoryIcon, TranslateIcon, } from '@manuscripts/style-guide';
|
|
2
2
|
import { createElement } from 'react';
|
|
3
3
|
import { renderToStaticMarkup } from 'react-dom/server';
|
|
4
4
|
const renderIcon = (c) => renderToStaticMarkup(createElement(c));
|
|
@@ -19,3 +19,4 @@ export const imageDefaultIcon = renderToStaticMarkup(createElement(ImageDefaultI
|
|
|
19
19
|
export const fileCorruptedIcon = renderToStaticMarkup(createElement(FileCorruptedIcon));
|
|
20
20
|
export const draggableIcon = renderToStaticMarkup(createElement(DraggableIcon));
|
|
21
21
|
export const translateIcon = renderToStaticMarkup(createElement(TranslateIcon));
|
|
22
|
+
export const fileMainDocumentIcon = renderToStaticMarkup(createElement(FileMainDocumentIcon));
|
package/dist/es/versions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '3.5.
|
|
1
|
+
export const VERSION = '3.5.11';
|
|
2
2
|
export const MATHJAX_VERSION = '3.2.2';
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2025 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 { fileMainDocumentIcon } from '../icons';
|
|
17
|
+
import BlockView from './block_view';
|
|
18
|
+
import { createNodeView } from './creators';
|
|
19
|
+
export class AttachmentView extends BlockView {
|
|
20
|
+
constructor() {
|
|
21
|
+
super(...arguments);
|
|
22
|
+
this.createElement = () => {
|
|
23
|
+
this.createContainer();
|
|
24
|
+
this.renderView();
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
updateContents() {
|
|
28
|
+
this.renderView();
|
|
29
|
+
}
|
|
30
|
+
renderView() {
|
|
31
|
+
this.container.innerHTML = '';
|
|
32
|
+
const file = this.getFileFromAttachment();
|
|
33
|
+
if (!file) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (this.isPDF(file)) {
|
|
37
|
+
this.createPDFPreview(file);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
createContainer() {
|
|
41
|
+
this.container = document.createElement('div');
|
|
42
|
+
this.container.classList.add('attachment-item');
|
|
43
|
+
this.container.addEventListener('click', (e) => {
|
|
44
|
+
e.stopPropagation();
|
|
45
|
+
this.setMainDocumentSelection();
|
|
46
|
+
});
|
|
47
|
+
this.dom.appendChild(this.container);
|
|
48
|
+
}
|
|
49
|
+
isPDF(file) {
|
|
50
|
+
return file.name?.toLowerCase().endsWith('.pdf') ?? false;
|
|
51
|
+
}
|
|
52
|
+
getFileFromAttachment() {
|
|
53
|
+
const { href } = this.node.attrs;
|
|
54
|
+
if (!href) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
const files = this.props?.getFiles?.() || [];
|
|
58
|
+
return files.find((f) => f.id === href) || null;
|
|
59
|
+
}
|
|
60
|
+
createPDFPreview(file) {
|
|
61
|
+
this.container.setAttribute('data-pdf-preview', file.id);
|
|
62
|
+
const header = this.createHeader(file);
|
|
63
|
+
const content = this.createContent(file);
|
|
64
|
+
this.container.appendChild(header);
|
|
65
|
+
this.container.appendChild(content);
|
|
66
|
+
}
|
|
67
|
+
createHeader(file) {
|
|
68
|
+
const header = document.createElement('div');
|
|
69
|
+
header.className = 'attachment-header';
|
|
70
|
+
const icon = this.createIcon();
|
|
71
|
+
const name = this.createFileName(file.name);
|
|
72
|
+
header.append(icon, name);
|
|
73
|
+
return header;
|
|
74
|
+
}
|
|
75
|
+
createIcon() {
|
|
76
|
+
const icon = document.createElement('span');
|
|
77
|
+
icon.className = 'attachment-icon';
|
|
78
|
+
icon.innerHTML = fileMainDocumentIcon;
|
|
79
|
+
return icon;
|
|
80
|
+
}
|
|
81
|
+
createFileName(fileName) {
|
|
82
|
+
const name = document.createElement('span');
|
|
83
|
+
Object.assign(name, {
|
|
84
|
+
textContent: fileName,
|
|
85
|
+
className: 'attachment-name',
|
|
86
|
+
title: fileName,
|
|
87
|
+
});
|
|
88
|
+
return name;
|
|
89
|
+
}
|
|
90
|
+
createContent(file) {
|
|
91
|
+
const content = document.createElement('div');
|
|
92
|
+
content.className = 'attachment-content';
|
|
93
|
+
const embed = document.createElement('embed');
|
|
94
|
+
Object.assign(embed, {
|
|
95
|
+
src: this.getPDFUrl(file),
|
|
96
|
+
type: 'application/pdf',
|
|
97
|
+
className: 'attachment-pdf',
|
|
98
|
+
height: '400px',
|
|
99
|
+
width: '100%',
|
|
100
|
+
});
|
|
101
|
+
embed.style.border = 'none';
|
|
102
|
+
content.appendChild(embed);
|
|
103
|
+
return content;
|
|
104
|
+
}
|
|
105
|
+
getPDFUrl(file) {
|
|
106
|
+
const baseUrl = file.link || file.id || '#';
|
|
107
|
+
if (baseUrl && baseUrl !== '#') {
|
|
108
|
+
const separator = baseUrl.includes('?') ? '&' : '?';
|
|
109
|
+
return `${baseUrl}${separator}inline=true`;
|
|
110
|
+
}
|
|
111
|
+
return baseUrl;
|
|
112
|
+
}
|
|
113
|
+
setMainDocumentSelection() {
|
|
114
|
+
if (this.props.onEditorClick) {
|
|
115
|
+
const event = {
|
|
116
|
+
target: { dataset: { action: 'select-main-document' } },
|
|
117
|
+
stopPropagation: () => {
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
this.props.onEditorClick(this.getPos(), this.node, this.getPos(), event);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
export default createNodeView(AttachmentView);
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2025 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 { arrowUp } from '../icons';
|
|
17
|
+
import BlockView from './block_view';
|
|
18
|
+
import { createNodeView } from './creators';
|
|
19
|
+
export class AttachmentsView extends BlockView {
|
|
20
|
+
constructor() {
|
|
21
|
+
super(...arguments);
|
|
22
|
+
this.collapsed = false;
|
|
23
|
+
this.ignoreMutation = () => true;
|
|
24
|
+
this.createElement = () => {
|
|
25
|
+
this.container = document.createElement('div');
|
|
26
|
+
this.container.classList.add('block', 'attachments-container');
|
|
27
|
+
this.dom.appendChild(this.container);
|
|
28
|
+
this.container.appendChild(this.createPanel());
|
|
29
|
+
const content = document.createElement('div');
|
|
30
|
+
content.className = 'attachments-content';
|
|
31
|
+
this.container.appendChild(content);
|
|
32
|
+
this.contentDOM = content;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
createPanel() {
|
|
36
|
+
const panel = document.createElement('div');
|
|
37
|
+
panel.classList.add('panel-header');
|
|
38
|
+
const label = document.createElement('span');
|
|
39
|
+
label.textContent = 'Main Document';
|
|
40
|
+
label.contentEditable = 'false';
|
|
41
|
+
const toggleBtn = document.createElement('button');
|
|
42
|
+
toggleBtn.classList.add('toggle-btn', 'button-reset');
|
|
43
|
+
toggleBtn.innerHTML = arrowUp;
|
|
44
|
+
toggleBtn.classList.toggle('collapsed', this.collapsed);
|
|
45
|
+
toggleBtn.onclick = () => {
|
|
46
|
+
this.collapsed = !this.collapsed;
|
|
47
|
+
if (this.contentDOM) {
|
|
48
|
+
this.contentDOM.style.display = this.collapsed ? 'none' : '';
|
|
49
|
+
}
|
|
50
|
+
toggleBtn.classList.toggle('collapsed', this.collapsed);
|
|
51
|
+
};
|
|
52
|
+
panel.appendChild(label);
|
|
53
|
+
panel.appendChild(toggleBtn);
|
|
54
|
+
return panel;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
export default createNodeView(AttachmentsView);
|
|
@@ -34,12 +34,12 @@ export class HeroImageView extends BlockView {
|
|
|
34
34
|
}
|
|
35
35
|
createPanel() {
|
|
36
36
|
const panel = document.createElement('div');
|
|
37
|
-
panel.classList.add('
|
|
37
|
+
panel.classList.add('panel-header');
|
|
38
38
|
const label = document.createElement('span');
|
|
39
39
|
label.textContent = 'Hero image';
|
|
40
40
|
label.contentEditable = 'false';
|
|
41
41
|
const heroImageToggleBtn = document.createElement('button');
|
|
42
|
-
heroImageToggleBtn.classList.add('
|
|
42
|
+
heroImageToggleBtn.classList.add('toggle-btn', 'button-reset');
|
|
43
43
|
heroImageToggleBtn.innerHTML = arrowUp;
|
|
44
44
|
heroImageToggleBtn.classList.toggle('collapsed', this.collapsed);
|
|
45
45
|
heroImageToggleBtn.onclick = () => {
|
package/dist/types/icons.d.ts
CHANGED
package/dist/types/versions.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "3.5.
|
|
1
|
+
export declare const VERSION = "3.5.11";
|
|
2
2
|
export declare const MATHJAX_VERSION = "3.2.2";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2025 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 { AttachmentNode } from '@manuscripts/transform';
|
|
17
|
+
import { Trackable } from '../types';
|
|
18
|
+
import BlockView from './block_view';
|
|
19
|
+
export declare class AttachmentView extends BlockView<Trackable<AttachmentNode>> {
|
|
20
|
+
private container;
|
|
21
|
+
createElement: () => void;
|
|
22
|
+
updateContents(): void;
|
|
23
|
+
private renderView;
|
|
24
|
+
private createContainer;
|
|
25
|
+
private isPDF;
|
|
26
|
+
private getFileFromAttachment;
|
|
27
|
+
private createPDFPreview;
|
|
28
|
+
private createHeader;
|
|
29
|
+
private createIcon;
|
|
30
|
+
private createFileName;
|
|
31
|
+
private createContent;
|
|
32
|
+
private getPDFUrl;
|
|
33
|
+
private setMainDocumentSelection;
|
|
34
|
+
}
|
|
35
|
+
declare const _default: (props: import("../configs/ManuscriptsEditor").EditorProps, dispatch?: import("..").Dispatch) => import("../types").NodeViewCreator<AttachmentView>;
|
|
36
|
+
export default _default;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2025 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 { ManuscriptNode } from '@manuscripts/transform';
|
|
17
|
+
import { Trackable } from '../types';
|
|
18
|
+
import BlockView from './block_view';
|
|
19
|
+
export declare class AttachmentsView extends BlockView<Trackable<ManuscriptNode>> {
|
|
20
|
+
private container;
|
|
21
|
+
private collapsed;
|
|
22
|
+
ignoreMutation: () => boolean;
|
|
23
|
+
createElement: () => void;
|
|
24
|
+
createPanel(): HTMLDivElement;
|
|
25
|
+
}
|
|
26
|
+
declare const _default: (props: import("../configs/ManuscriptsEditor").EditorProps, dispatch?: import("..").Dispatch) => import("../types").NodeViewCreator<AttachmentsView>;
|
|
27
|
+
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": "3.5.
|
|
4
|
+
"version": "3.5.11",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@iarna/word-count": "1.1.2",
|
|
41
41
|
"@manuscripts/json-schema": "2.2.12",
|
|
42
42
|
"@manuscripts/style-guide": "3.3.0",
|
|
43
|
-
"@manuscripts/track-changes-plugin": "2.0.
|
|
43
|
+
"@manuscripts/track-changes-plugin": "2.0.13",
|
|
44
44
|
"@manuscripts/transform": "4.2.17",
|
|
45
45
|
"@popperjs/core": "2.11.8",
|
|
46
46
|
"citeproc": "2.4.63",
|
|
@@ -1607,10 +1607,14 @@ th:hover > .table-context-menu-button,
|
|
|
1607
1607
|
left: 93%;
|
|
1608
1608
|
}
|
|
1609
1609
|
|
|
1610
|
-
.
|
|
1610
|
+
.block-hero_image {
|
|
1611
|
+
margin-bottom: 30px;
|
|
1612
|
+
}
|
|
1613
|
+
|
|
1614
|
+
.hero-image-container, .attachments-container {
|
|
1611
1615
|
border: 1px solid #c9c9c9;
|
|
1612
1616
|
border-radius: 4px;
|
|
1613
|
-
background:
|
|
1617
|
+
background: #ffffff;
|
|
1614
1618
|
padding: 0 !important;
|
|
1615
1619
|
}
|
|
1616
1620
|
|
|
@@ -1621,7 +1625,7 @@ th:hover > .table-context-menu-button,
|
|
|
1621
1625
|
margin: 0 35pt 32px 35pt;
|
|
1622
1626
|
}
|
|
1623
1627
|
|
|
1624
|
-
.
|
|
1628
|
+
.panel-header {
|
|
1625
1629
|
display: flex;
|
|
1626
1630
|
justify-content: space-between;
|
|
1627
1631
|
align-items: center;
|
|
@@ -1640,11 +1644,14 @@ th:hover > .table-context-menu-button,
|
|
|
1640
1644
|
.hero-image-container .position-menu {
|
|
1641
1645
|
display: none !important;
|
|
1642
1646
|
}
|
|
1643
|
-
.
|
|
1647
|
+
.toggle-btn {
|
|
1648
|
+
cursor: pointer;
|
|
1649
|
+
}
|
|
1650
|
+
.toggle-btn svg {
|
|
1644
1651
|
width: 16px;
|
|
1645
1652
|
height: 9px;
|
|
1646
1653
|
}
|
|
1647
|
-
.
|
|
1654
|
+
.toggle-btn.collapsed svg {
|
|
1648
1655
|
transform: rotate(180deg);
|
|
1649
1656
|
}
|
|
1650
1657
|
|
|
@@ -1793,3 +1800,66 @@ th:hover > .table-context-menu-button,
|
|
|
1793
1800
|
.ProseMirror .abstracts.empty-node .add-translation-container {
|
|
1794
1801
|
display: none;
|
|
1795
1802
|
}
|
|
1803
|
+
|
|
1804
|
+
/* Attachment styles */
|
|
1805
|
+
.attachments-container .attachment-item {
|
|
1806
|
+
border: 1px solid #ddd;
|
|
1807
|
+
border-radius: 8px;
|
|
1808
|
+
padding: 16px;
|
|
1809
|
+
margin: 15px !important;
|
|
1810
|
+
background: #f9f9f9;
|
|
1811
|
+
cursor: pointer;
|
|
1812
|
+
}
|
|
1813
|
+
|
|
1814
|
+
.attachments-container .attachment-header {
|
|
1815
|
+
display: flex;
|
|
1816
|
+
align-items: center;
|
|
1817
|
+
margin-bottom: 12px;
|
|
1818
|
+
padding-bottom: 8px;
|
|
1819
|
+
border-bottom: 1px solid #e0e0e0;
|
|
1820
|
+
}
|
|
1821
|
+
|
|
1822
|
+
.attachments-container .attachment-item .attachment-icon {
|
|
1823
|
+
margin-right: 12px;
|
|
1824
|
+
}
|
|
1825
|
+
|
|
1826
|
+
.attachments-container .attachment-item .attachment-name {
|
|
1827
|
+
font-weight: bold;
|
|
1828
|
+
color: #333;
|
|
1829
|
+
flex: 1;
|
|
1830
|
+
}
|
|
1831
|
+
|
|
1832
|
+
.attachments-container .attachment-item .attachment-badge {
|
|
1833
|
+
padding: 4px 8px;
|
|
1834
|
+
border-radius: 12px;
|
|
1835
|
+
font-size: 12px;
|
|
1836
|
+
font-weight: bold;
|
|
1837
|
+
}
|
|
1838
|
+
|
|
1839
|
+
.attachments-container .attachment-item .attachment-badge.pdf {
|
|
1840
|
+
background: #28a745;
|
|
1841
|
+
color: white;
|
|
1842
|
+
}
|
|
1843
|
+
|
|
1844
|
+
.attachments-container .attachment-item .attachment-badge.file {
|
|
1845
|
+
background: #6c757d;
|
|
1846
|
+
color: white;
|
|
1847
|
+
}
|
|
1848
|
+
|
|
1849
|
+
.attachments-container .attachment-item .attachment-content {
|
|
1850
|
+
text-align: center;
|
|
1851
|
+
margin: 20px;
|
|
1852
|
+
}
|
|
1853
|
+
|
|
1854
|
+
.attachments-container .attachment-item .attachment-iframe {
|
|
1855
|
+
width: 100%;
|
|
1856
|
+
height: 500px;
|
|
1857
|
+
border: 1px solid #ccc;
|
|
1858
|
+
border-radius: 4px;
|
|
1859
|
+
margin-bottom: 12px;
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1862
|
+
|
|
1863
|
+
.block-attachments:has(.attachment-item:empty), .block-attachments.empty-node {
|
|
1864
|
+
display: none !important;
|
|
1865
|
+
}
|