@manuscripts/body-editor 1.13.29 → 2.0.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/tests.js +2 -0
- package/dist/cjs/versions.js +1 -1
- package/dist/cjs/views/ReactSubView.js +8 -7
- package/dist/cjs/views/figure_editable.js +14 -19
- package/dist/es/tests.js +2 -0
- package/dist/es/versions.js +1 -1
- package/dist/es/views/ReactSubView.js +8 -7
- package/dist/es/views/figure_editable.js +14 -19
- package/dist/types/versions.d.ts +1 -1
- package/package.json +9 -8
package/dist/cjs/tests.js
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
require("regenerator-runtime/runtime");
|
|
19
|
+
const util_1 = require("util");
|
|
19
20
|
const uuid_1 = require("uuid");
|
|
20
21
|
process.env.API_BASE_URL = 'https://127.0.0.1/';
|
|
21
22
|
const supportedCommands = [];
|
|
@@ -30,3 +31,4 @@ if (!window.URL.createObjectURL) {
|
|
|
30
31
|
value: jest.fn(() => 'blob:https://localhost/' + (0, uuid_1.v4)()),
|
|
31
32
|
});
|
|
32
33
|
}
|
|
34
|
+
Object.assign(global, { TextDecoder: util_1.TextDecoder, TextEncoder: util_1.TextEncoder });
|
package/dist/cjs/versions.js
CHANGED
|
@@ -19,15 +19,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
19
19
|
};
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
const react_1 = __importDefault(require("react"));
|
|
22
|
-
const
|
|
22
|
+
const client_1 = require("react-dom/client");
|
|
23
23
|
const styled_components_1 = require("styled-components");
|
|
24
24
|
exports.default = (props, Component, componentProps, node, getPos, view, classNames = '') => {
|
|
25
|
-
const
|
|
26
|
-
|
|
25
|
+
const container = document.createElement('div');
|
|
26
|
+
container.classList.add('tools-panel');
|
|
27
27
|
if (classNames) {
|
|
28
|
-
|
|
28
|
+
container.classList.add(classNames);
|
|
29
29
|
}
|
|
30
|
-
|
|
30
|
+
container.setAttribute('contenteditable', 'false');
|
|
31
31
|
const Wrapped = () => {
|
|
32
32
|
const setNodeAttrs = (nextAttrs) => {
|
|
33
33
|
const { selection, tr } = view.state;
|
|
@@ -40,6 +40,7 @@ exports.default = (props, Component, componentProps, node, getPos, view, classNa
|
|
|
40
40
|
return (react_1.default.createElement(styled_components_1.ThemeProvider, { theme: props.theme },
|
|
41
41
|
react_1.default.createElement(Component, Object.assign({ nodeAttrs: node.attrs, setNodeAttrs: setNodeAttrs, viewProps: { node, view, getPos } }, props, componentProps))));
|
|
42
42
|
};
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
const root = (0, client_1.createRoot)(container);
|
|
44
|
+
root.render(react_1.default.createElement(Wrapped, null));
|
|
45
|
+
return container;
|
|
45
46
|
};
|
|
@@ -30,7 +30,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
30
30
|
exports.FigureEditableView = void 0;
|
|
31
31
|
const style_guide_1 = require("@manuscripts/style-guide");
|
|
32
32
|
const react_1 = require("react");
|
|
33
|
-
const
|
|
33
|
+
const server_1 = require("react-dom/server");
|
|
34
34
|
const FigureDropdown_1 = require("../components/views/FigureDropdown");
|
|
35
35
|
const files_1 = require("../lib/files");
|
|
36
36
|
const track_changes_utils_1 = require("../lib/track-changes-utils");
|
|
@@ -156,27 +156,22 @@ class FigureEditableView extends figure_1.FigureView {
|
|
|
156
156
|
element.classList.add('figure', 'placeholder');
|
|
157
157
|
const instructions = document.createElement('div');
|
|
158
158
|
instructions.classList.add('instructions');
|
|
159
|
-
const
|
|
160
|
-
react_dom_1.default.render((0, react_1.createElement)(style_guide_1.FileCorruptedIcon, { className: 'icon' }), iconContainer, () => {
|
|
161
|
-
const target = instructions.querySelector('.unsupported-icon-wrapper');
|
|
162
|
-
if (target) {
|
|
163
|
-
target.innerHTML = iconContainer.innerHTML;
|
|
164
|
-
}
|
|
165
|
-
});
|
|
159
|
+
const iconHtml = (0, server_1.renderToStaticMarkup)((0, react_1.createElement)(style_guide_1.FileCorruptedIcon, { className: 'icon' }));
|
|
166
160
|
instructions.innerHTML = `
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
161
|
+
<div>
|
|
162
|
+
<div class="unsupported-icon-wrapper">${iconHtml}</div>
|
|
163
|
+
<div>${name}</div>
|
|
164
|
+
<div class="unsupported-format-label">
|
|
165
|
+
Unsupported file format
|
|
166
|
+
</div>
|
|
167
|
+
<div>
|
|
168
|
+
${((_a = this.props.getCapabilities()) === null || _a === void 0 ? void 0 : _a.editArticle)
|
|
175
169
|
? 'Click to add image'
|
|
176
170
|
: 'No image here yet…'}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
171
|
+
</div>
|
|
172
|
+
</div>
|
|
173
|
+
`;
|
|
174
|
+
element.appendChild(instructions);
|
|
180
175
|
return element;
|
|
181
176
|
};
|
|
182
177
|
this.createImg = (src) => {
|
package/dist/es/tests.js
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import 'regenerator-runtime/runtime';
|
|
17
|
+
import { TextDecoder, TextEncoder } from 'util';
|
|
17
18
|
import { v4 as uuid } from 'uuid';
|
|
18
19
|
process.env.API_BASE_URL = 'https://127.0.0.1/';
|
|
19
20
|
const supportedCommands = [];
|
|
@@ -28,3 +29,4 @@ if (!window.URL.createObjectURL) {
|
|
|
28
29
|
value: jest.fn(() => 'blob:https://localhost/' + uuid()),
|
|
29
30
|
});
|
|
30
31
|
}
|
|
32
|
+
Object.assign(global, { TextDecoder, TextEncoder });
|
package/dist/es/versions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '
|
|
1
|
+
export const VERSION = '2.0.1';
|
|
2
2
|
export const MATHJAX_VERSION = '3.2.2';
|
|
@@ -14,15 +14,15 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import React from 'react';
|
|
17
|
-
import
|
|
17
|
+
import { createRoot } from 'react-dom/client';
|
|
18
18
|
import { ThemeProvider } from 'styled-components';
|
|
19
19
|
export default (props, Component, componentProps, node, getPos, view, classNames = '') => {
|
|
20
|
-
const
|
|
21
|
-
|
|
20
|
+
const container = document.createElement('div');
|
|
21
|
+
container.classList.add('tools-panel');
|
|
22
22
|
if (classNames) {
|
|
23
|
-
|
|
23
|
+
container.classList.add(classNames);
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
container.setAttribute('contenteditable', 'false');
|
|
26
26
|
const Wrapped = () => {
|
|
27
27
|
const setNodeAttrs = (nextAttrs) => {
|
|
28
28
|
const { selection, tr } = view.state;
|
|
@@ -35,6 +35,7 @@ export default (props, Component, componentProps, node, getPos, view, classNames
|
|
|
35
35
|
return (React.createElement(ThemeProvider, { theme: props.theme },
|
|
36
36
|
React.createElement(Component, Object.assign({ nodeAttrs: node.attrs, setNodeAttrs: setNodeAttrs, viewProps: { node, view, getPos } }, props, componentProps))));
|
|
37
37
|
};
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
const root = createRoot(container);
|
|
39
|
+
root.render(React.createElement(Wrapped, null));
|
|
40
|
+
return container;
|
|
40
41
|
};
|
|
@@ -24,7 +24,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
24
24
|
};
|
|
25
25
|
import { FileCorruptedIcon } from '@manuscripts/style-guide';
|
|
26
26
|
import { createElement } from 'react';
|
|
27
|
-
import
|
|
27
|
+
import { renderToStaticMarkup } from 'react-dom/server';
|
|
28
28
|
import { FigureOptions, } from '../components/views/FigureDropdown';
|
|
29
29
|
import { groupFiles } from '../lib/files';
|
|
30
30
|
import { getActualAttrs } from '../lib/track-changes-utils';
|
|
@@ -150,27 +150,22 @@ export class FigureEditableView extends FigureView {
|
|
|
150
150
|
element.classList.add('figure', 'placeholder');
|
|
151
151
|
const instructions = document.createElement('div');
|
|
152
152
|
instructions.classList.add('instructions');
|
|
153
|
-
const
|
|
154
|
-
ReactDOM.render(createElement(FileCorruptedIcon, { className: 'icon' }), iconContainer, () => {
|
|
155
|
-
const target = instructions.querySelector('.unsupported-icon-wrapper');
|
|
156
|
-
if (target) {
|
|
157
|
-
target.innerHTML = iconContainer.innerHTML;
|
|
158
|
-
}
|
|
159
|
-
});
|
|
153
|
+
const iconHtml = renderToStaticMarkup(createElement(FileCorruptedIcon, { className: 'icon' }));
|
|
160
154
|
instructions.innerHTML = `
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
155
|
+
<div>
|
|
156
|
+
<div class="unsupported-icon-wrapper">${iconHtml}</div>
|
|
157
|
+
<div>${name}</div>
|
|
158
|
+
<div class="unsupported-format-label">
|
|
159
|
+
Unsupported file format
|
|
160
|
+
</div>
|
|
161
|
+
<div>
|
|
162
|
+
${((_a = this.props.getCapabilities()) === null || _a === void 0 ? void 0 : _a.editArticle)
|
|
169
163
|
? 'Click to add image'
|
|
170
164
|
: 'No image here yet…'}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
165
|
+
</div>
|
|
166
|
+
</div>
|
|
167
|
+
`;
|
|
168
|
+
element.appendChild(instructions);
|
|
174
169
|
return element;
|
|
175
170
|
};
|
|
176
171
|
this.createImg = (src) => {
|
package/dist/types/versions.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "
|
|
1
|
+
export declare const VERSION = "2.0.1";
|
|
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": "
|
|
4
|
+
"version": "2.0.1",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@iarna/word-count": "^1.1.2",
|
|
32
32
|
"@manuscripts/json-schema": "2.2.10",
|
|
33
33
|
"@manuscripts/library": "1.3.10",
|
|
34
|
-
"@manuscripts/style-guide": "
|
|
34
|
+
"@manuscripts/style-guide": "2.0.0",
|
|
35
35
|
"@manuscripts/track-changes-plugin": "1.7.14",
|
|
36
36
|
"@manuscripts/transform": "2.3.21",
|
|
37
37
|
"@popperjs/core": "^2.11.8",
|
|
@@ -56,11 +56,11 @@
|
|
|
56
56
|
"prosemirror-transform": "^1.7.0",
|
|
57
57
|
"prosemirror-utils": "^0.9.6",
|
|
58
58
|
"prosemirror-view": "^1.29.1",
|
|
59
|
-
"react": "^
|
|
59
|
+
"react": "^18.3.1",
|
|
60
60
|
"react-dnd": "^16.0.1",
|
|
61
61
|
"react-dnd-html5-backend": "^16.0.1",
|
|
62
|
-
"react-dom": "^
|
|
63
|
-
"react-is": "^
|
|
62
|
+
"react-dom": "^18.3.1",
|
|
63
|
+
"react-is": "^18.3.1",
|
|
64
64
|
"react-router-dom": "^6.25.0",
|
|
65
65
|
"react-select": "^5.7.3",
|
|
66
66
|
"styled-components": "^5.2.0"
|
|
@@ -75,8 +75,8 @@
|
|
|
75
75
|
"@types/dompurify": "^2.4.0",
|
|
76
76
|
"@types/jest": "^29.2.4",
|
|
77
77
|
"@types/lodash": "^4.14.202",
|
|
78
|
-
"@types/react": "^
|
|
79
|
-
"@types/react-dom": "^
|
|
78
|
+
"@types/react": "^18.3.1",
|
|
79
|
+
"@types/react-dom": "^18.3.0",
|
|
80
80
|
"@types/react-router-dom": "^5.3.3",
|
|
81
81
|
"@types/styled-components": "^5.1.4",
|
|
82
82
|
"@types/uuid": "^9.0.0",
|
|
@@ -104,11 +104,12 @@
|
|
|
104
104
|
"prettier": "^2.8.1",
|
|
105
105
|
"regenerator-runtime": "^0.13.11",
|
|
106
106
|
"rimraf": "^3.0.2",
|
|
107
|
+
"text-encoding-polyfill": "^0.6.7",
|
|
107
108
|
"typescript": "^4.0.5",
|
|
108
109
|
"uuid": "^9.0.0"
|
|
109
110
|
},
|
|
110
111
|
"resolutions": {
|
|
111
|
-
"@types/react": "^
|
|
112
|
+
"@types/react": "^18.3.1",
|
|
112
113
|
"prosemirror-tables": "^1.3.5"
|
|
113
114
|
}
|
|
114
115
|
}
|