@manuscripts/body-editor 2.2.16-LEAN-3894.0 → 2.2.17
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/views/FigureDropdown.js +2 -2
- package/dist/cjs/plugins/comments.js +8 -10
- package/dist/cjs/versions.js +1 -1
- package/dist/cjs/views/figure_element.js +3 -1
- package/dist/es/components/views/FigureDropdown.js +2 -2
- package/dist/es/plugins/comments.js +8 -10
- package/dist/es/versions.js +1 -1
- package/dist/es/views/figure_element.js +3 -1
- package/dist/types/components/views/FigureDropdown.d.ts +1 -0
- package/dist/types/versions.d.ts +1 -1
- package/package.json +1 -1
|
@@ -7,14 +7,14 @@ exports.FigureOptions = exports.FigureElementOptions = void 0;
|
|
|
7
7
|
const style_guide_1 = require("@manuscripts/style-guide");
|
|
8
8
|
const react_1 = __importDefault(require("react"));
|
|
9
9
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
10
|
-
const FigureElementOptions = ({ can, files, onAdd, onUpload, }) => {
|
|
10
|
+
const FigureElementOptions = ({ can, files, onAdd, onUpload, hasUploadedImage, }) => {
|
|
11
11
|
const { isOpen, toggleOpen, wrapperRef } = (0, style_guide_1.useDropdown)();
|
|
12
12
|
const supplements = files.supplements
|
|
13
13
|
.map((s) => s.file)
|
|
14
14
|
.filter((f) => (0, style_guide_1.isImageFile)(f.name));
|
|
15
15
|
const others = files.others.filter((f) => (0, style_guide_1.isImageFile)(f.name));
|
|
16
16
|
return (react_1.default.createElement(FilesDropdownWrapper, { onClick: toggleOpen, ref: wrapperRef },
|
|
17
|
-
react_1.default.createElement(FilesButton,
|
|
17
|
+
react_1.default.createElement(FilesButton, { disabled: hasUploadedImage },
|
|
18
18
|
react_1.default.createElement(style_guide_1.AttachIcon, null)),
|
|
19
19
|
isOpen && (react_1.default.createElement(style_guide_1.DropdownList, { direction: 'left', width: 208, height: 187, onClick: toggleOpen, top: 7 },
|
|
20
20
|
react_1.default.createElement(NestedDropdown, { disabled: !can.replaceFile || supplements.length < 1, parentToggleOpen: toggleOpen, buttonText: 'Supplements', list: react_1.default.createElement(react_1.default.Fragment, null, supplements.map((file) => (react_1.default.createElement(ListItemButton, { key: file.id, onClick: () => onAdd(file) },
|
|
@@ -133,16 +133,14 @@ const buildPluginState = (doc, selection) => {
|
|
|
133
133
|
})
|
|
134
134
|
.forEach((c) => {
|
|
135
135
|
allComments.push(c);
|
|
136
|
-
if (!c.
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
pointComments.push(c);
|
|
145
|
-
}
|
|
136
|
+
if (!c.range) {
|
|
137
|
+
nodeComments.push(c);
|
|
138
|
+
}
|
|
139
|
+
else if (c.range.size) {
|
|
140
|
+
highlightComments.push(c);
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
pointComments.push(c);
|
|
146
144
|
}
|
|
147
145
|
});
|
|
148
146
|
for (const comment of highlightComments) {
|
package/dist/cjs/versions.js
CHANGED
|
@@ -78,6 +78,7 @@ class FigureElementView extends block_view_1.default {
|
|
|
78
78
|
const can = this.props.getCapabilities();
|
|
79
79
|
let handleUpload = () => {
|
|
80
80
|
};
|
|
81
|
+
const hasUploadedImage = !!(0, utils_1.getMatchingChild)(this.node, (node) => node.type === transform_1.schema.nodes.figure && node.attrs.src);
|
|
81
82
|
const handleAdd = (file) => __awaiter(this, void 0, void 0, function* () {
|
|
82
83
|
const { state: { tr, schema, selection }, dispatch, } = this.view;
|
|
83
84
|
const src = file.id;
|
|
@@ -115,9 +116,10 @@ class FigureElementView extends block_view_1.default {
|
|
|
115
116
|
files: (0, files_1.groupFiles)(doc, files),
|
|
116
117
|
onUpload: handleUpload,
|
|
117
118
|
onAdd: handleAdd,
|
|
119
|
+
hasUploadedImage: hasUploadedImage,
|
|
118
120
|
};
|
|
119
|
-
this.reactTools = (0, ReactSubView_1.default)(this.props, FigureDropdown_1.FigureElementOptions, componentProps, this.node, this.getPos, this.view);
|
|
120
121
|
(_b = this.reactTools) === null || _b === void 0 ? void 0 : _b.remove();
|
|
122
|
+
this.reactTools = (0, ReactSubView_1.default)(this.props, FigureDropdown_1.FigureElementOptions, componentProps, this.node, this.getPos, this.view);
|
|
121
123
|
this.dom.insertBefore(this.reactTools, this.dom.firstChild);
|
|
122
124
|
}
|
|
123
125
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { AddIcon, AttachIcon, DotsIcon, DropdownList, getFileIcon, IconButton, IconTextButton, isImageFile, RoundIconButton, TriangleCollapsedIcon, UploadIcon, useDropdown, } from '@manuscripts/style-guide';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
|
-
export const FigureElementOptions = ({ can, files, onAdd, onUpload, }) => {
|
|
4
|
+
export const FigureElementOptions = ({ can, files, onAdd, onUpload, hasUploadedImage, }) => {
|
|
5
5
|
const { isOpen, toggleOpen, wrapperRef } = useDropdown();
|
|
6
6
|
const supplements = files.supplements
|
|
7
7
|
.map((s) => s.file)
|
|
8
8
|
.filter((f) => isImageFile(f.name));
|
|
9
9
|
const others = files.others.filter((f) => isImageFile(f.name));
|
|
10
10
|
return (React.createElement(FilesDropdownWrapper, { onClick: toggleOpen, ref: wrapperRef },
|
|
11
|
-
React.createElement(FilesButton,
|
|
11
|
+
React.createElement(FilesButton, { disabled: hasUploadedImage },
|
|
12
12
|
React.createElement(AttachIcon, null)),
|
|
13
13
|
isOpen && (React.createElement(DropdownList, { direction: 'left', width: 208, height: 187, onClick: toggleOpen, top: 7 },
|
|
14
14
|
React.createElement(NestedDropdown, { disabled: !can.replaceFile || supplements.length < 1, parentToggleOpen: toggleOpen, buttonText: 'Supplements', list: React.createElement(React.Fragment, null, supplements.map((file) => (React.createElement(ListItemButton, { key: file.id, onClick: () => onAdd(file) },
|
|
@@ -128,16 +128,14 @@ const buildPluginState = (doc, selection) => {
|
|
|
128
128
|
})
|
|
129
129
|
.forEach((c) => {
|
|
130
130
|
allComments.push(c);
|
|
131
|
-
if (!c.
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
pointComments.push(c);
|
|
140
|
-
}
|
|
131
|
+
if (!c.range) {
|
|
132
|
+
nodeComments.push(c);
|
|
133
|
+
}
|
|
134
|
+
else if (c.range.size) {
|
|
135
|
+
highlightComments.push(c);
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
pointComments.push(c);
|
|
141
139
|
}
|
|
142
140
|
});
|
|
143
141
|
for (const comment of highlightComments) {
|
package/dist/es/versions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '2.2.
|
|
1
|
+
export const VERSION = '2.2.17';
|
|
2
2
|
export const MATHJAX_VERSION = '3.2.2';
|
|
@@ -72,6 +72,7 @@ export class FigureElementView extends BlockView {
|
|
|
72
72
|
const can = this.props.getCapabilities();
|
|
73
73
|
let handleUpload = () => {
|
|
74
74
|
};
|
|
75
|
+
const hasUploadedImage = !!getMatchingChild(this.node, (node) => node.type === schema.nodes.figure && node.attrs.src);
|
|
75
76
|
const handleAdd = (file) => __awaiter(this, void 0, void 0, function* () {
|
|
76
77
|
const { state: { tr, schema, selection }, dispatch, } = this.view;
|
|
77
78
|
const src = file.id;
|
|
@@ -109,9 +110,10 @@ export class FigureElementView extends BlockView {
|
|
|
109
110
|
files: groupFiles(doc, files),
|
|
110
111
|
onUpload: handleUpload,
|
|
111
112
|
onAdd: handleAdd,
|
|
113
|
+
hasUploadedImage: hasUploadedImage,
|
|
112
114
|
};
|
|
113
|
-
this.reactTools = ReactSubView(this.props, FigureElementOptions, componentProps, this.node, this.getPos, this.view);
|
|
114
115
|
(_b = this.reactTools) === null || _b === void 0 ? void 0 : _b.remove();
|
|
116
|
+
this.reactTools = ReactSubView(this.props, FigureElementOptions, componentProps, this.node, this.getPos, this.view);
|
|
115
117
|
this.dom.insertBefore(this.reactTools, this.dom.firstChild);
|
|
116
118
|
}
|
|
117
119
|
};
|
|
@@ -14,6 +14,7 @@ export interface FigureOptionsProps extends FigureDropdownProps {
|
|
|
14
14
|
export interface FigureElementOptionsProps extends FigureDropdownProps {
|
|
15
15
|
onAdd: (file: FileAttachment) => Promise<void>;
|
|
16
16
|
onUpload: () => void;
|
|
17
|
+
hasUploadedImage: boolean;
|
|
17
18
|
}
|
|
18
19
|
export declare const FigureElementOptions: React.FC<FigureElementOptionsProps>;
|
|
19
20
|
export declare const FigureOptions: React.FC<FigureOptionsProps>;
|
package/dist/types/versions.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "2.2.
|
|
1
|
+
export declare const VERSION = "2.2.17";
|
|
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": "2.2.
|
|
4
|
+
"version": "2.2.17",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|