@manuscripts/body-editor 3.3.3 → 3.3.5
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 +2 -0
- package/dist/cjs/lib/media.js +8 -8
- package/dist/cjs/versions.js +1 -1
- package/dist/cjs/views/embed.js +1 -1
- package/dist/cjs/views/figure_editable.js +1 -1
- package/dist/es/commands.js +2 -0
- package/dist/es/lib/media.js +8 -8
- package/dist/es/versions.js +1 -1
- package/dist/es/views/embed.js +1 -1
- package/dist/es/views/figure_editable.js +1 -1
- package/dist/types/lib/media.d.ts +6 -1
- package/dist/types/versions.d.ts +1 -1
- package/package.json +1 -1
- package/styles/AdvancedEditor.css +7 -12
package/dist/cjs/commands.js
CHANGED
|
@@ -570,6 +570,8 @@ const insertBoxElement = (state, dispatch) => {
|
|
|
570
570
|
]);
|
|
571
571
|
if (position && dispatch) {
|
|
572
572
|
const tr = state.tr.insert(position, node);
|
|
573
|
+
const sectionTitlePosition = position + 4;
|
|
574
|
+
tr.setSelection(prosemirror_state_1.TextSelection.create(tr.doc, sectionTitlePosition));
|
|
573
575
|
dispatch(tr);
|
|
574
576
|
}
|
|
575
577
|
return true;
|
package/dist/cjs/lib/media.js
CHANGED
|
@@ -78,29 +78,29 @@ const createMediaPlaceholder = (mediaType = 'media', view, getPos) => {
|
|
|
78
78
|
return element;
|
|
79
79
|
};
|
|
80
80
|
exports.createMediaPlaceholder = createMediaPlaceholder;
|
|
81
|
-
const createFileHandlers = (
|
|
81
|
+
const createFileHandlers = (attrs, fileAttrKey, view, props, setAttr) => {
|
|
82
82
|
const handlers = {};
|
|
83
|
-
const
|
|
83
|
+
const controlAttr = attrs[fileAttrKey];
|
|
84
84
|
const files = props.getFiles();
|
|
85
|
-
const file =
|
|
85
|
+
const file = controlAttr && files.find((f) => f.id === controlAttr);
|
|
86
86
|
const can = props.getCapabilities();
|
|
87
|
-
if (
|
|
87
|
+
if (controlAttr && file) {
|
|
88
88
|
handlers.handleDownload = () => {
|
|
89
89
|
props.fileManagement.download(file);
|
|
90
90
|
};
|
|
91
91
|
handlers.handleDetach = () => {
|
|
92
|
-
|
|
92
|
+
setAttr('');
|
|
93
93
|
};
|
|
94
94
|
}
|
|
95
95
|
if (can.replaceFile) {
|
|
96
96
|
handlers.handleReplace = (file, isSupplement = false) => {
|
|
97
|
-
|
|
97
|
+
setAttr(file.id);
|
|
98
98
|
if (isSupplement) {
|
|
99
99
|
const tr = view.state.tr;
|
|
100
100
|
view.state.doc.descendants((node, pos) => {
|
|
101
101
|
if (node.type === transform_1.schema.nodes.supplement) {
|
|
102
|
-
const
|
|
103
|
-
if (
|
|
102
|
+
const attr = node.attrs[fileAttrKey];
|
|
103
|
+
if (attr === file.id) {
|
|
104
104
|
tr.delete(pos, pos + node.nodeSize);
|
|
105
105
|
view.dispatch(tr);
|
|
106
106
|
}
|
package/dist/cjs/versions.js
CHANGED
package/dist/cjs/views/embed.js
CHANGED
|
@@ -115,7 +115,7 @@ class EmbedView extends block_view_1.default {
|
|
|
115
115
|
let handlers;
|
|
116
116
|
const can = this.props.getCapabilities();
|
|
117
117
|
if (this.isUploadedFile()) {
|
|
118
|
-
handlers = (0, media_1.createFileHandlers)(this.node,
|
|
118
|
+
handlers = (0, media_1.createFileHandlers)(this.node.attrs, 'href', this.view, this.props, this.setHref);
|
|
119
119
|
if (can.uploadFile) {
|
|
120
120
|
handlers.handleUpload = (0, media_1.createFileUploader)(this.upload, 'video/*,audio/*');
|
|
121
121
|
}
|
|
@@ -218,7 +218,7 @@ class FigureEditableView extends figure_1.FigureView {
|
|
|
218
218
|
}
|
|
219
219
|
manageReactTools() {
|
|
220
220
|
this.reactTools?.remove();
|
|
221
|
-
const handlers = (0, media_1.createFileHandlers)(this.node,
|
|
221
|
+
const handlers = (0, media_1.createFileHandlers)(this.node.attrs, 'src', this.view, this.props, this.setSrc);
|
|
222
222
|
const can = this.props.getCapabilities();
|
|
223
223
|
if (can.uploadFile) {
|
|
224
224
|
handlers.handleUpload = (0, media_1.createFileUploader)(this.upload, 'image/*');
|
package/dist/es/commands.js
CHANGED
|
@@ -540,6 +540,8 @@ export const insertBoxElement = (state, dispatch) => {
|
|
|
540
540
|
]);
|
|
541
541
|
if (position && dispatch) {
|
|
542
542
|
const tr = state.tr.insert(position, node);
|
|
543
|
+
const sectionTitlePosition = position + 4;
|
|
544
|
+
tr.setSelection(TextSelection.create(tr.doc, sectionTitlePosition));
|
|
543
545
|
dispatch(tr);
|
|
544
546
|
}
|
|
545
547
|
return true;
|
package/dist/es/lib/media.js
CHANGED
|
@@ -70,29 +70,29 @@ export const createMediaPlaceholder = (mediaType = 'media', view, getPos) => {
|
|
|
70
70
|
element.appendChild(instructions);
|
|
71
71
|
return element;
|
|
72
72
|
};
|
|
73
|
-
export const createFileHandlers = (
|
|
73
|
+
export const createFileHandlers = (attrs, fileAttrKey, view, props, setAttr) => {
|
|
74
74
|
const handlers = {};
|
|
75
|
-
const
|
|
75
|
+
const controlAttr = attrs[fileAttrKey];
|
|
76
76
|
const files = props.getFiles();
|
|
77
|
-
const file =
|
|
77
|
+
const file = controlAttr && files.find((f) => f.id === controlAttr);
|
|
78
78
|
const can = props.getCapabilities();
|
|
79
|
-
if (
|
|
79
|
+
if (controlAttr && file) {
|
|
80
80
|
handlers.handleDownload = () => {
|
|
81
81
|
props.fileManagement.download(file);
|
|
82
82
|
};
|
|
83
83
|
handlers.handleDetach = () => {
|
|
84
|
-
|
|
84
|
+
setAttr('');
|
|
85
85
|
};
|
|
86
86
|
}
|
|
87
87
|
if (can.replaceFile) {
|
|
88
88
|
handlers.handleReplace = (file, isSupplement = false) => {
|
|
89
|
-
|
|
89
|
+
setAttr(file.id);
|
|
90
90
|
if (isSupplement) {
|
|
91
91
|
const tr = view.state.tr;
|
|
92
92
|
view.state.doc.descendants((node, pos) => {
|
|
93
93
|
if (node.type === schema.nodes.supplement) {
|
|
94
|
-
const
|
|
95
|
-
if (
|
|
94
|
+
const attr = node.attrs[fileAttrKey];
|
|
95
|
+
if (attr === file.id) {
|
|
96
96
|
tr.delete(pos, pos + node.nodeSize);
|
|
97
97
|
view.dispatch(tr);
|
|
98
98
|
}
|
package/dist/es/versions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '3.3.
|
|
1
|
+
export const VERSION = '3.3.5';
|
|
2
2
|
export const MATHJAX_VERSION = '3.2.2';
|
package/dist/es/views/embed.js
CHANGED
|
@@ -109,7 +109,7 @@ export class EmbedView extends BlockView {
|
|
|
109
109
|
let handlers;
|
|
110
110
|
const can = this.props.getCapabilities();
|
|
111
111
|
if (this.isUploadedFile()) {
|
|
112
|
-
handlers = createFileHandlers(this.node,
|
|
112
|
+
handlers = createFileHandlers(this.node.attrs, 'href', this.view, this.props, this.setHref);
|
|
113
113
|
if (can.uploadFile) {
|
|
114
114
|
handlers.handleUpload = createFileUploader(this.upload, 'video/*,audio/*');
|
|
115
115
|
}
|
|
@@ -215,7 +215,7 @@ export class FigureEditableView extends FigureView {
|
|
|
215
215
|
}
|
|
216
216
|
manageReactTools() {
|
|
217
217
|
this.reactTools?.remove();
|
|
218
|
-
const handlers = createFileHandlers(this.node,
|
|
218
|
+
const handlers = createFileHandlers(this.node.attrs, 'src', this.view, this.props, this.setSrc);
|
|
219
219
|
const can = this.props.getCapabilities();
|
|
220
220
|
if (can.uploadFile) {
|
|
221
221
|
handlers.handleUpload = createFileUploader(this.upload, 'image/*');
|
|
@@ -27,7 +27,12 @@ export interface FileHandlers {
|
|
|
27
27
|
handleDetach?: () => void;
|
|
28
28
|
handleDelete?: () => void;
|
|
29
29
|
}
|
|
30
|
-
|
|
30
|
+
type Handleable = {
|
|
31
|
+
href?: string;
|
|
32
|
+
src?: string;
|
|
33
|
+
};
|
|
34
|
+
export declare const createFileHandlers: <T extends Handleable>(attrs: T, fileAttrKey: keyof Handleable, view: ManuscriptEditorView, props: EditorProps, setAttr: (value: string) => void) => FileHandlers;
|
|
31
35
|
export declare const createReactTools: <T extends ManuscriptNode>(node: Trackable<T>, view: ManuscriptEditorView, getPos: () => number, props: EditorProps, handlers: FileHandlers, isEmbed: boolean, hasSiblings: () => boolean) => HTMLDivElement | null;
|
|
32
36
|
export declare const createFileUploader: (handler: (file: File) => Promise<void>, accept?: string) => () => void;
|
|
33
37
|
export declare const addInteractionHandlers: (element: HTMLElement, uploadFn: (file: File) => Promise<void>, accept?: string) => void;
|
|
38
|
+
export {};
|
package/dist/types/versions.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "3.3.
|
|
1
|
+
export declare const VERSION = "3.3.5";
|
|
2
2
|
export declare const MATHJAX_VERSION = "3.2.2";
|
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.3.
|
|
4
|
+
"version": "3.3.5",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -212,7 +212,7 @@
|
|
|
212
212
|
visibility: visible;
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
-
.ProseMirror .media-preview audio{
|
|
215
|
+
.ProseMirror .media-preview audio {
|
|
216
216
|
margin-top: 40px;
|
|
217
217
|
}
|
|
218
218
|
|
|
@@ -284,7 +284,7 @@
|
|
|
284
284
|
white-space: normal;
|
|
285
285
|
font-size: 14px;
|
|
286
286
|
}
|
|
287
|
-
.ProseMirror .block-embed
|
|
287
|
+
.ProseMirror .block-embed .media-preview .placeholder {
|
|
288
288
|
padding: 16px 32px;
|
|
289
289
|
}
|
|
290
290
|
|
|
@@ -371,11 +371,11 @@
|
|
|
371
371
|
}
|
|
372
372
|
|
|
373
373
|
.ProseMirror .block-figure_element .position-menu,
|
|
374
|
-
.ProseMirror .block-image_element .position-menu,
|
|
374
|
+
.ProseMirror .block-image_element .position-menu,
|
|
375
375
|
ProseMirror .block-embed .position-menu {
|
|
376
376
|
position: absolute;
|
|
377
|
-
top:
|
|
378
|
-
right:
|
|
377
|
+
top: 8px;
|
|
378
|
+
right: 21px;
|
|
379
379
|
z-index: 2;
|
|
380
380
|
cursor: pointer;
|
|
381
381
|
padding-left: 100px;
|
|
@@ -851,9 +851,6 @@ span.comment-marker {
|
|
|
851
851
|
0% {
|
|
852
852
|
background: var(--fade-color);
|
|
853
853
|
}
|
|
854
|
-
100% {
|
|
855
|
-
background: transparent;
|
|
856
|
-
}
|
|
857
854
|
}
|
|
858
855
|
|
|
859
856
|
.selected-suggestion:not(.block-container):not(.graphical-abstract):not(
|
|
@@ -1045,7 +1042,7 @@ figure.block:has(.equation.selected-suggestion) {
|
|
|
1045
1042
|
.tracking-visible
|
|
1046
1043
|
.ProseMirror
|
|
1047
1044
|
[data-track-status='pending'][data-track-op='delete']
|
|
1048
|
-
.block,
|
|
1045
|
+
.block:not(.box-element),
|
|
1049
1046
|
.tracking-visible
|
|
1050
1047
|
.ProseMirror
|
|
1051
1048
|
.figure-block
|
|
@@ -1063,9 +1060,7 @@ figure.block:has(.equation.selected-suggestion) {
|
|
|
1063
1060
|
}
|
|
1064
1061
|
|
|
1065
1062
|
.selected-suggestion[data-track-status='pending'][data-track-op='delete']
|
|
1066
|
-
.block
|
|
1067
|
-
.selected-suggestion[data-track-status='pending'][data-track-op='delete']
|
|
1068
|
-
.block {
|
|
1063
|
+
.block:not(.box-element) {
|
|
1069
1064
|
box-shadow: inset 6px 0 0 var(--deleted-color),
|
|
1070
1065
|
inset 9px 0 0 var(--deleted-pending-bg-color) !important;
|
|
1071
1066
|
animation: fadeOutBackground 3s forwards;
|