@manuscripts/body-editor 3.0.2-LEAN-4591.0 → 3.0.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/views/FigureDropdown.js +2 -4
- package/dist/cjs/configs/editor-views.js +1 -2
- package/dist/cjs/icons.js +1 -2
- package/dist/cjs/versions.js +1 -1
- package/dist/cjs/views/figure_editable.js +0 -29
- package/dist/cjs/views/figure_element.js +12 -36
- package/dist/es/components/views/FigureDropdown.js +2 -4
- package/dist/es/configs/editor-views.js +1 -2
- package/dist/es/icons.js +0 -1
- package/dist/es/versions.js +1 -1
- package/dist/es/views/figure_editable.js +0 -29
- package/dist/es/views/figure_element.js +9 -36
- package/dist/types/components/views/FigureDropdown.d.ts +0 -1
- package/dist/types/icons.d.ts +0 -1
- package/dist/types/versions.d.ts +1 -1
- package/dist/types/views/figure_element.d.ts +5 -4
- package/package.json +2 -2
- package/styles/AdvancedEditor.css +1 -152
- package/styles/Editor.css +114 -0
- package/dist/cjs/views/image_element.js +0 -40
- package/dist/es/views/image_element.js +0 -33
- package/dist/types/views/image_element.d.ts +0 -25
|
@@ -7,7 +7,7 @@ exports.FigureOptions = 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 FigureOptions = ({ can, files, onDownload, onUpload, onDetach, onReplace,
|
|
10
|
+
const FigureOptions = ({ can, files, onDownload, onUpload, onDetach, onReplace, }) => {
|
|
11
11
|
const { isOpen, toggleOpen, wrapperRef } = (0, style_guide_1.useDropdown)();
|
|
12
12
|
const supplements = files.supplements
|
|
13
13
|
.map((s) => s.file)
|
|
@@ -18,7 +18,6 @@ const FigureOptions = ({ can, files, onDownload, onUpload, onDetach, onReplace,
|
|
|
18
18
|
const showDetach = onDetach && can.detachFile;
|
|
19
19
|
const showReplace = onReplace && can.replaceFile;
|
|
20
20
|
const replaceBtnText = onDownload ? 'Replace' : 'Choose file';
|
|
21
|
-
const showDelete = onDelete && can.detachFile;
|
|
22
21
|
return (react_1.default.createElement(DropdownWrapper, { ref: wrapperRef },
|
|
23
22
|
react_1.default.createElement(OptionsButton, { className: 'options-button', onClick: toggleOpen },
|
|
24
23
|
react_1.default.createElement(style_guide_1.DotsIcon, null)),
|
|
@@ -34,8 +33,7 @@ const FigureOptions = ({ can, files, onDownload, onUpload, onDetach, onReplace,
|
|
|
34
33
|
react_1.default.createElement(style_guide_1.UploadIcon, null),
|
|
35
34
|
" Upload new...")) }),
|
|
36
35
|
react_1.default.createElement(ListItemButton, { onClick: onDownload, disabled: !showDownload }, "Download"),
|
|
37
|
-
react_1.default.createElement(ListItemButton, { onClick: onDetach, disabled: !showDetach }, "Detach")
|
|
38
|
-
showDelete && (react_1.default.createElement(ListItemButton, { onClick: onDelete }, "Delete"))))));
|
|
36
|
+
react_1.default.createElement(ListItemButton, { onClick: onDetach, disabled: !showDetach }, "Detach")))));
|
|
39
37
|
};
|
|
40
38
|
exports.FigureOptions = FigureOptions;
|
|
41
39
|
const NestedDropdown = ({ parentToggleOpen, buttonText, disabled, list, moveLeft }) => {
|
|
@@ -26,7 +26,6 @@ const footnote_1 = __importDefault(require("../views/footnote"));
|
|
|
26
26
|
const footnotes_element_1 = __importDefault(require("../views/footnotes_element"));
|
|
27
27
|
const general_table_footnote_1 = __importDefault(require("../views/general_table_footnote"));
|
|
28
28
|
const hero_image_editable_1 = __importDefault(require("../views/hero_image_editable"));
|
|
29
|
-
const image_element_1 = __importDefault(require("../views/image_element"));
|
|
30
29
|
const inline_equation_editable_1 = __importDefault(require("../views/inline_equation_editable"));
|
|
31
30
|
const inline_footnote_editable_1 = __importDefault(require("../views/inline_footnote_editable"));
|
|
32
31
|
const keyword_1 = __importDefault(require("../views/keyword"));
|
|
@@ -64,7 +63,7 @@ exports.default = (props, dispatch) => {
|
|
|
64
63
|
equation_element: (0, equation_element_editable_1.default)(props),
|
|
65
64
|
figure: (0, figure_editable_1.default)(props, dispatch),
|
|
66
65
|
figure_element: (0, figure_element_editable_1.default)(props, dispatch),
|
|
67
|
-
image_element: (0,
|
|
66
|
+
image_element: (0, figure_element_editable_1.default)(props, dispatch),
|
|
68
67
|
footnote: (0, footnote_1.default)(props),
|
|
69
68
|
footnotes_element: (0, footnotes_element_1.default)(props),
|
|
70
69
|
general_table_footnote: (0, general_table_footnote_1.default)(props, dispatch),
|
package/dist/cjs/icons.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.plusIcon = exports.lockIcon = exports.scrollIcon = exports.sectionCategoryIcon = exports.editIcon = exports.deleteIcon = exports.alertIcon = exports.arrowUp = exports.arrowDown = 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");
|
|
@@ -14,4 +14,3 @@ exports.sectionCategoryIcon = renderIcon(style_guide_1.SectionCategoryIcon);
|
|
|
14
14
|
exports.scrollIcon = (0, server_1.renderToStaticMarkup)((0, react_1.createElement)(style_guide_1.ScrollIcon));
|
|
15
15
|
exports.lockIcon = (0, server_1.renderToStaticMarkup)((0, react_1.createElement)(style_guide_1.LockIcon));
|
|
16
16
|
exports.plusIcon = renderIcon(style_guide_1.PlusIcon);
|
|
17
|
-
exports.addFigureBtnIcon = (0, server_1.renderToStaticMarkup)((0, react_1.createElement)(style_guide_1.PlusIcon));
|
package/dist/cjs/versions.js
CHANGED
|
@@ -22,7 +22,6 @@ exports.FigureEditableView = exports.figurePositions = void 0;
|
|
|
22
22
|
const style_guide_1 = require("@manuscripts/style-guide");
|
|
23
23
|
const transform_1 = require("@manuscripts/transform");
|
|
24
24
|
const prosemirror_state_1 = require("prosemirror-state");
|
|
25
|
-
const prosemirror_utils_1 = require("prosemirror-utils");
|
|
26
25
|
const react_1 = require("react");
|
|
27
26
|
const server_1 = require("react-dom/server");
|
|
28
27
|
const FigureDropdown_1 = require("../components/views/FigureDropdown");
|
|
@@ -244,7 +243,6 @@ class FigureEditableView extends figure_1.FigureView {
|
|
|
244
243
|
let handleUpload;
|
|
245
244
|
let handleReplace;
|
|
246
245
|
let handleDetach;
|
|
247
|
-
let handleDelete;
|
|
248
246
|
const src = this.node.attrs.src;
|
|
249
247
|
const files = this.props.getFiles();
|
|
250
248
|
const file = src && files.filter((f) => f.id === src)[0];
|
|
@@ -267,32 +265,6 @@ class FigureEditableView extends figure_1.FigureView {
|
|
|
267
265
|
if (can.uploadFile) {
|
|
268
266
|
handleUpload = (0, figure_uploader_1.figureUploader)(this.upload);
|
|
269
267
|
}
|
|
270
|
-
if (can.detachFile) {
|
|
271
|
-
const countFigures = () => {
|
|
272
|
-
const element = (0, prosemirror_utils_1.findParentNodeOfTypeClosestToPos)(this.view.state.doc.resolve(this.getPos()), transform_1.schema.nodes.figure_element);
|
|
273
|
-
let count = 0;
|
|
274
|
-
element?.node.descendants((node) => {
|
|
275
|
-
if (node.type === transform_1.schema.nodes.figure && !(0, track_changes_utils_1.isDeleted)(node)) {
|
|
276
|
-
count++;
|
|
277
|
-
}
|
|
278
|
-
});
|
|
279
|
-
return count;
|
|
280
|
-
};
|
|
281
|
-
const figureCount = countFigures();
|
|
282
|
-
handleDelete =
|
|
283
|
-
figureCount > 1
|
|
284
|
-
? () => {
|
|
285
|
-
const currentCount = countFigures();
|
|
286
|
-
const pos = this.getPos();
|
|
287
|
-
if (currentCount <= 1) {
|
|
288
|
-
return;
|
|
289
|
-
}
|
|
290
|
-
const tr = this.view.state.tr;
|
|
291
|
-
tr.delete(pos, pos + this.node.nodeSize);
|
|
292
|
-
this.view.dispatch(tr);
|
|
293
|
-
}
|
|
294
|
-
: undefined;
|
|
295
|
-
}
|
|
296
268
|
this.reactTools?.remove();
|
|
297
269
|
if (this.props.dispatch && this.props.theme) {
|
|
298
270
|
const files = this.props.getFiles();
|
|
@@ -304,7 +276,6 @@ class FigureEditableView extends figure_1.FigureView {
|
|
|
304
276
|
onUpload: handleUpload,
|
|
305
277
|
onDetach: handleDetach,
|
|
306
278
|
onReplace: handleReplace,
|
|
307
|
-
onDelete: handleDelete,
|
|
308
279
|
};
|
|
309
280
|
this.reactTools = (0, ReactSubView_1.default)(this.props, FigureDropdown_1.FigureOptions, componentProps, this.node, this.getPos, this.view);
|
|
310
281
|
this.dom.insertBefore(this.reactTools, this.dom.firstChild);
|
|
@@ -14,50 +14,26 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
+
};
|
|
17
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
21
|
exports.FigureElementView = void 0;
|
|
19
|
-
const
|
|
20
|
-
const icons_1 = require("../icons");
|
|
22
|
+
const block_view_1 = __importDefault(require("./block_view"));
|
|
21
23
|
const creators_1 = require("./creators");
|
|
22
|
-
|
|
23
|
-
class FigureElementView extends image_element_1.ImageElementView {
|
|
24
|
+
class FigureElementView extends block_view_1.default {
|
|
24
25
|
constructor() {
|
|
25
26
|
super(...arguments);
|
|
26
27
|
this.ignoreMutation = () => true;
|
|
27
28
|
this.createElement = () => {
|
|
28
|
-
|
|
29
|
-
this.
|
|
29
|
+
this.container = document.createElement('div');
|
|
30
|
+
this.container.classList.add('block');
|
|
31
|
+
this.dom.appendChild(this.container);
|
|
32
|
+
this.contentDOM = document.createElement('figure');
|
|
33
|
+
this.contentDOM.classList.add('figure-block');
|
|
34
|
+
this.contentDOM.setAttribute('id', this.node.attrs.id);
|
|
35
|
+
this.container.appendChild(this.contentDOM);
|
|
30
36
|
};
|
|
31
|
-
this.addFigure = () => {
|
|
32
|
-
const { state } = this.view;
|
|
33
|
-
const { tr } = state;
|
|
34
|
-
const figureElementPos = this.getPos();
|
|
35
|
-
let insertPos = figureElementPos + 1;
|
|
36
|
-
let lastFigureEndPos = insertPos;
|
|
37
|
-
let hasFigures = false;
|
|
38
|
-
this.node.forEach((node) => {
|
|
39
|
-
if (node.type === transform_1.schema.nodes.figure) {
|
|
40
|
-
lastFigureEndPos = insertPos + node.nodeSize;
|
|
41
|
-
hasFigures = true;
|
|
42
|
-
}
|
|
43
|
-
insertPos += node.nodeSize;
|
|
44
|
-
});
|
|
45
|
-
const finalInsertPos = hasFigures ? lastFigureEndPos : figureElementPos + 1;
|
|
46
|
-
const figureNode = state.schema.nodes.figure.create();
|
|
47
|
-
tr.insert(finalInsertPos, figureNode);
|
|
48
|
-
this.view.dispatch(tr);
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
addFigureElementButtons() {
|
|
52
|
-
if (this.props.getCapabilities()?.editArticle) {
|
|
53
|
-
const addFigureBtn = Object.assign(document.createElement('button'), {
|
|
54
|
-
className: 'add-figure-button',
|
|
55
|
-
innerHTML: icons_1.addFigureBtnIcon,
|
|
56
|
-
title: 'Add figure',
|
|
57
|
-
});
|
|
58
|
-
addFigureBtn.addEventListener('click', () => this.addFigure());
|
|
59
|
-
this.container.prepend(addFigureBtn);
|
|
60
|
-
}
|
|
61
37
|
}
|
|
62
38
|
}
|
|
63
39
|
exports.FigureElementView = FigureElementView;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DotsIcon, DropdownList, getFileIcon, IconButton, IconTextButton, isImageFile, TriangleCollapsedIcon, UploadIcon, useDropdown, } from '@manuscripts/style-guide';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
|
-
export const FigureOptions = ({ can, files, onDownload, onUpload, onDetach, onReplace,
|
|
4
|
+
export const FigureOptions = ({ can, files, onDownload, onUpload, onDetach, onReplace, }) => {
|
|
5
5
|
const { isOpen, toggleOpen, wrapperRef } = useDropdown();
|
|
6
6
|
const supplements = files.supplements
|
|
7
7
|
.map((s) => s.file)
|
|
@@ -12,7 +12,6 @@ export const FigureOptions = ({ can, files, onDownload, onUpload, onDetach, onRe
|
|
|
12
12
|
const showDetach = onDetach && can.detachFile;
|
|
13
13
|
const showReplace = onReplace && can.replaceFile;
|
|
14
14
|
const replaceBtnText = onDownload ? 'Replace' : 'Choose file';
|
|
15
|
-
const showDelete = onDelete && can.detachFile;
|
|
16
15
|
return (React.createElement(DropdownWrapper, { ref: wrapperRef },
|
|
17
16
|
React.createElement(OptionsButton, { className: 'options-button', onClick: toggleOpen },
|
|
18
17
|
React.createElement(DotsIcon, null)),
|
|
@@ -28,8 +27,7 @@ export const FigureOptions = ({ can, files, onDownload, onUpload, onDetach, onRe
|
|
|
28
27
|
React.createElement(UploadIcon, null),
|
|
29
28
|
" Upload new...")) }),
|
|
30
29
|
React.createElement(ListItemButton, { onClick: onDownload, disabled: !showDownload }, "Download"),
|
|
31
|
-
React.createElement(ListItemButton, { onClick: onDetach, disabled: !showDetach }, "Detach")
|
|
32
|
-
showDelete && (React.createElement(ListItemButton, { onClick: onDelete }, "Delete"))))));
|
|
30
|
+
React.createElement(ListItemButton, { onClick: onDetach, disabled: !showDetach }, "Detach")))));
|
|
33
31
|
};
|
|
34
32
|
const NestedDropdown = ({ parentToggleOpen, buttonText, disabled, list, moveLeft }) => {
|
|
35
33
|
const { isOpen, toggleOpen, wrapperRef } = useDropdown();
|
|
@@ -21,7 +21,6 @@ import footnote from '../views/footnote';
|
|
|
21
21
|
import footnotesElement from '../views/footnotes_element';
|
|
22
22
|
import generalTableFootnote from '../views/general_table_footnote';
|
|
23
23
|
import heroImage from '../views/hero_image_editable';
|
|
24
|
-
import imageElement from '../views/image_element';
|
|
25
24
|
import inlineEquation from '../views/inline_equation_editable';
|
|
26
25
|
import inlineFootnote from '../views/inline_footnote_editable';
|
|
27
26
|
import keyword from '../views/keyword';
|
|
@@ -59,7 +58,7 @@ export default (props, dispatch) => {
|
|
|
59
58
|
equation_element: equationElement(props),
|
|
60
59
|
figure: figure(props, dispatch),
|
|
61
60
|
figure_element: figureElement(props, dispatch),
|
|
62
|
-
image_element:
|
|
61
|
+
image_element: figureElement(props, dispatch),
|
|
63
62
|
footnote: footnote(props),
|
|
64
63
|
footnotes_element: footnotesElement(props),
|
|
65
64
|
general_table_footnote: generalTableFootnote(props, dispatch),
|
package/dist/es/icons.js
CHANGED
|
@@ -11,4 +11,3 @@ export const sectionCategoryIcon = renderIcon(SectionCategoryIcon);
|
|
|
11
11
|
export const scrollIcon = renderToStaticMarkup(createElement(ScrollIcon));
|
|
12
12
|
export const lockIcon = renderToStaticMarkup(createElement(LockIcon));
|
|
13
13
|
export const plusIcon = renderIcon(PlusIcon);
|
|
14
|
-
export const addFigureBtnIcon = renderToStaticMarkup(createElement(PlusIcon));
|
package/dist/es/versions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '3.0.2
|
|
1
|
+
export const VERSION = '3.0.2';
|
|
2
2
|
export const MATHJAX_VERSION = '3.2.2';
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
import { ContextMenu, FileCorruptedIcon, ImageDefaultIcon, ImageLeftIcon, ImageRightIcon, } from '@manuscripts/style-guide';
|
|
17
17
|
import { schema } from '@manuscripts/transform';
|
|
18
18
|
import { NodeSelection } from 'prosemirror-state';
|
|
19
|
-
import { findParentNodeOfTypeClosestToPos } from 'prosemirror-utils';
|
|
20
19
|
import { createElement } from 'react';
|
|
21
20
|
import { renderToStaticMarkup } from 'react-dom/server';
|
|
22
21
|
import { FigureOptions, } from '../components/views/FigureDropdown';
|
|
@@ -238,7 +237,6 @@ export class FigureEditableView extends FigureView {
|
|
|
238
237
|
let handleUpload;
|
|
239
238
|
let handleReplace;
|
|
240
239
|
let handleDetach;
|
|
241
|
-
let handleDelete;
|
|
242
240
|
const src = this.node.attrs.src;
|
|
243
241
|
const files = this.props.getFiles();
|
|
244
242
|
const file = src && files.filter((f) => f.id === src)[0];
|
|
@@ -261,32 +259,6 @@ export class FigureEditableView extends FigureView {
|
|
|
261
259
|
if (can.uploadFile) {
|
|
262
260
|
handleUpload = figureUploader(this.upload);
|
|
263
261
|
}
|
|
264
|
-
if (can.detachFile) {
|
|
265
|
-
const countFigures = () => {
|
|
266
|
-
const element = findParentNodeOfTypeClosestToPos(this.view.state.doc.resolve(this.getPos()), schema.nodes.figure_element);
|
|
267
|
-
let count = 0;
|
|
268
|
-
element?.node.descendants((node) => {
|
|
269
|
-
if (node.type === schema.nodes.figure && !isDeleted(node)) {
|
|
270
|
-
count++;
|
|
271
|
-
}
|
|
272
|
-
});
|
|
273
|
-
return count;
|
|
274
|
-
};
|
|
275
|
-
const figureCount = countFigures();
|
|
276
|
-
handleDelete =
|
|
277
|
-
figureCount > 1
|
|
278
|
-
? () => {
|
|
279
|
-
const currentCount = countFigures();
|
|
280
|
-
const pos = this.getPos();
|
|
281
|
-
if (currentCount <= 1) {
|
|
282
|
-
return;
|
|
283
|
-
}
|
|
284
|
-
const tr = this.view.state.tr;
|
|
285
|
-
tr.delete(pos, pos + this.node.nodeSize);
|
|
286
|
-
this.view.dispatch(tr);
|
|
287
|
-
}
|
|
288
|
-
: undefined;
|
|
289
|
-
}
|
|
290
262
|
this.reactTools?.remove();
|
|
291
263
|
if (this.props.dispatch && this.props.theme) {
|
|
292
264
|
const files = this.props.getFiles();
|
|
@@ -298,7 +270,6 @@ export class FigureEditableView extends FigureView {
|
|
|
298
270
|
onUpload: handleUpload,
|
|
299
271
|
onDetach: handleDetach,
|
|
300
272
|
onReplace: handleReplace,
|
|
301
|
-
onDelete: handleDelete,
|
|
302
273
|
};
|
|
303
274
|
this.reactTools = ReactSubView(this.props, FigureOptions, componentProps, this.node, this.getPos, this.view);
|
|
304
275
|
this.dom.insertBefore(this.reactTools, this.dom.firstChild);
|
|
@@ -13,48 +13,21 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import
|
|
17
|
-
import { addFigureBtnIcon } from '../icons';
|
|
16
|
+
import BlockView from './block_view';
|
|
18
17
|
import { createNodeView } from './creators';
|
|
19
|
-
|
|
20
|
-
export class FigureElementView extends ImageElementView {
|
|
18
|
+
export class FigureElementView extends BlockView {
|
|
21
19
|
constructor() {
|
|
22
20
|
super(...arguments);
|
|
23
21
|
this.ignoreMutation = () => true;
|
|
24
22
|
this.createElement = () => {
|
|
25
|
-
|
|
26
|
-
this.
|
|
23
|
+
this.container = document.createElement('div');
|
|
24
|
+
this.container.classList.add('block');
|
|
25
|
+
this.dom.appendChild(this.container);
|
|
26
|
+
this.contentDOM = document.createElement('figure');
|
|
27
|
+
this.contentDOM.classList.add('figure-block');
|
|
28
|
+
this.contentDOM.setAttribute('id', this.node.attrs.id);
|
|
29
|
+
this.container.appendChild(this.contentDOM);
|
|
27
30
|
};
|
|
28
|
-
this.addFigure = () => {
|
|
29
|
-
const { state } = this.view;
|
|
30
|
-
const { tr } = state;
|
|
31
|
-
const figureElementPos = this.getPos();
|
|
32
|
-
let insertPos = figureElementPos + 1;
|
|
33
|
-
let lastFigureEndPos = insertPos;
|
|
34
|
-
let hasFigures = false;
|
|
35
|
-
this.node.forEach((node) => {
|
|
36
|
-
if (node.type === schema.nodes.figure) {
|
|
37
|
-
lastFigureEndPos = insertPos + node.nodeSize;
|
|
38
|
-
hasFigures = true;
|
|
39
|
-
}
|
|
40
|
-
insertPos += node.nodeSize;
|
|
41
|
-
});
|
|
42
|
-
const finalInsertPos = hasFigures ? lastFigureEndPos : figureElementPos + 1;
|
|
43
|
-
const figureNode = state.schema.nodes.figure.create();
|
|
44
|
-
tr.insert(finalInsertPos, figureNode);
|
|
45
|
-
this.view.dispatch(tr);
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
addFigureElementButtons() {
|
|
49
|
-
if (this.props.getCapabilities()?.editArticle) {
|
|
50
|
-
const addFigureBtn = Object.assign(document.createElement('button'), {
|
|
51
|
-
className: 'add-figure-button',
|
|
52
|
-
innerHTML: addFigureBtnIcon,
|
|
53
|
-
title: 'Add figure',
|
|
54
|
-
});
|
|
55
|
-
addFigureBtn.addEventListener('click', () => this.addFigure());
|
|
56
|
-
this.container.prepend(addFigureBtn);
|
|
57
|
-
}
|
|
58
31
|
}
|
|
59
32
|
}
|
|
60
33
|
export default createNodeView(FigureElementView);
|
|
@@ -10,7 +10,6 @@ export interface FigureOptionsProps extends FigureDropdownProps {
|
|
|
10
10
|
onUpload?: () => void;
|
|
11
11
|
onDetach?: () => void;
|
|
12
12
|
onReplace?: (file: FileAttachment) => void;
|
|
13
|
-
onDelete?: () => void;
|
|
14
13
|
}
|
|
15
14
|
export interface FigureElementOptionsProps extends FigureDropdownProps {
|
|
16
15
|
onAdd: (file: FileAttachment) => Promise<void>;
|
package/dist/types/icons.d.ts
CHANGED
package/dist/types/versions.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "3.0.2
|
|
1
|
+
export declare const VERSION = "3.0.2";
|
|
2
2
|
export declare const MATHJAX_VERSION = "3.2.2";
|
|
@@ -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 {
|
|
17
|
-
|
|
16
|
+
import { FigureElementNode } from '@manuscripts/transform';
|
|
17
|
+
import { Trackable } from '../types';
|
|
18
|
+
import BlockView from './block_view';
|
|
19
|
+
export declare class FigureElementView extends BlockView<Trackable<FigureElementNode>> {
|
|
20
|
+
private container;
|
|
18
21
|
ignoreMutation: () => boolean;
|
|
19
22
|
createElement: () => void;
|
|
20
|
-
private addFigureElementButtons;
|
|
21
|
-
private addFigure;
|
|
22
23
|
}
|
|
23
24
|
declare const _default: (props: import("../configs/ManuscriptsEditor").EditorProps, dispatch?: import("..").Dispatch | undefined) => import("../types").NodeViewCreator<FigureElementView>;
|
|
24
25
|
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.0.2
|
|
4
|
+
"version": "3.0.2",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@citation-js/plugin-pubmed": "0.3.0",
|
|
38
38
|
"@citation-js/plugin-ris": "0.7.18",
|
|
39
39
|
"@manuscripts/json-schema": "2.2.12",
|
|
40
|
-
"@manuscripts/style-guide": "3.0.
|
|
40
|
+
"@manuscripts/style-guide": "3.0.1",
|
|
41
41
|
"@manuscripts/track-changes-plugin": "2.0.1",
|
|
42
42
|
"@manuscripts/transform": "4.0.0",
|
|
43
43
|
"@popperjs/core": "2.11.8",
|
|
@@ -122,8 +122,6 @@
|
|
|
122
122
|
text-indent: 0pt;
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
/* Figures */
|
|
126
|
-
|
|
127
125
|
.ProseMirror .figure-block {
|
|
128
126
|
width: 100%;
|
|
129
127
|
border: 1px solid #f2f2f2;
|
|
@@ -134,11 +132,6 @@
|
|
|
134
132
|
|
|
135
133
|
grid-template-columns: repeat(3, auto) !important;
|
|
136
134
|
grid-template-rows: repeat(1, minmax(min-content, max-content)) [caption listing] auto !important;
|
|
137
|
-
|
|
138
|
-
margin: 16px 0 0;
|
|
139
|
-
box-sizing: border-box;
|
|
140
|
-
justify-self: center;
|
|
141
|
-
position: relative;
|
|
142
135
|
}
|
|
143
136
|
|
|
144
137
|
.ProseMirror .figure-group {
|
|
@@ -151,140 +144,8 @@
|
|
|
151
144
|
width: 100%;
|
|
152
145
|
position: relative;
|
|
153
146
|
grid-column: 1/-1;
|
|
154
|
-
margin: 0;
|
|
155
|
-
display: flex;
|
|
156
|
-
flex-direction: column;
|
|
157
|
-
justify-content: flex-end;
|
|
158
|
-
align-items: center;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
.ProseMirror .figure-images-container .figure-image-container {
|
|
162
|
-
position: relative;
|
|
163
|
-
margin-bottom: 30px;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
.ProseMirror .block-figure_element .add-figure-button {
|
|
167
|
-
border: 0px;
|
|
168
|
-
left: 53px;
|
|
169
|
-
width: 25px;
|
|
170
|
-
z-index: 1;
|
|
171
|
-
height: 25px;
|
|
172
|
-
bottom: 220px;
|
|
173
|
-
cursor: pointer;
|
|
174
|
-
position: absolute;
|
|
175
|
-
border-radius: 50%;
|
|
176
|
-
background-color: #6E6E6E;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
.ProseMirror .block-figure_element .add-figure-button.disabled {
|
|
180
|
-
background-color: #E2E2E2 !important;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
.ProseMirror .block-figure_element .add-figure-button svg path {
|
|
184
|
-
fill: #FFFFFF !important;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
.ProseMirror .figure-block:hover .options-button {
|
|
189
|
-
visibility: visible;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
.ProseMirror .block:focus-within .figure-block,
|
|
193
|
-
.ProseMirror .block:hover .figure-block {
|
|
194
|
-
border-color: #e2e2e2;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
.ProseMirror .figure-block[data-alignment='left'] {
|
|
198
|
-
justify-self: flex-start;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
.ProseMirror .figure-block[data-alignment='right'] {
|
|
202
|
-
justify-self: flex-end;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
.ProseMirror .figure-block .expanded-listing .executable-attachments {
|
|
206
|
-
display: block;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
.ProseMirror .figure-block > .listing {
|
|
210
|
-
grid-column-start: 1;
|
|
211
|
-
grid-column-end: -1;
|
|
212
|
-
padding: 0;
|
|
213
|
-
min-height: 0;
|
|
214
|
-
overflow: visible;
|
|
215
|
-
width: 100%;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
.ProseMirror .figure-block figure {
|
|
219
|
-
padding-bottom: 20px;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
.ProseMirror .figure-block > figcaption {
|
|
223
|
-
grid-column-start: 1;
|
|
224
|
-
grid-column-end: -1;
|
|
225
|
-
margin-top: 30px;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
.ProseMirror .figure-caption {
|
|
229
|
-
display: none;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
.ProseMirror .figure.placeholder {
|
|
233
|
-
align-items: center;
|
|
234
|
-
border-radius: 16px;
|
|
235
|
-
border: 1px dashed #e2e2e2;
|
|
236
|
-
background-color: #fafafa;
|
|
237
|
-
cursor: pointer;
|
|
238
|
-
display: flex;
|
|
239
|
-
justify-content: center;
|
|
240
|
-
text-align: center;
|
|
241
|
-
padding: 64px 32px;
|
|
242
|
-
max-width: 210px;
|
|
243
|
-
min-height: 100px;
|
|
244
|
-
white-space: normal;
|
|
245
|
-
font-size: 14px;
|
|
246
147
|
}
|
|
247
148
|
|
|
248
|
-
.ProseMirror .figure.placeholder a {
|
|
249
|
-
text-decoration: underline;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
.ProseMirror .figure.placeholder.over {
|
|
253
|
-
border-color: #bce7f6;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
.ProseMirror .figure-image {
|
|
257
|
-
max-width: 100%;
|
|
258
|
-
object-fit: contain;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
.ProseMirror .figure-embed {
|
|
262
|
-
width: 640px;
|
|
263
|
-
max-width: 90%;
|
|
264
|
-
position: relative;
|
|
265
|
-
padding-top: 56.25%; /* Player ratio: 100 / (1280 / 720) */
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
.ProseMirror .figure-embed .figure-embed-object {
|
|
269
|
-
position: absolute;
|
|
270
|
-
top: 0;
|
|
271
|
-
left: 0;
|
|
272
|
-
border: none;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
.ProseMirror figcaption {
|
|
276
|
-
background: white;
|
|
277
|
-
font-size: 14px;
|
|
278
|
-
margin-top: 1em;
|
|
279
|
-
text-align: center;
|
|
280
|
-
word-wrap: break-word;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
.ProseMirror .block-table_element figcaption {
|
|
284
|
-
text-align: left;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
|
|
288
149
|
.ProseMirror .figure-block > figcaption .figure-label {
|
|
289
150
|
display: initial !important;
|
|
290
151
|
}
|
|
@@ -822,10 +683,6 @@ span.comment-marker {
|
|
|
822
683
|
text-decoration: line-through;
|
|
823
684
|
}
|
|
824
685
|
|
|
825
|
-
.tracking-visible .ProseMirror figure.deleted {
|
|
826
|
-
display: flex;
|
|
827
|
-
}
|
|
828
|
-
|
|
829
686
|
.tracking-visible .ProseMirror .block.deleted {
|
|
830
687
|
display: block;
|
|
831
688
|
}
|
|
@@ -937,18 +794,10 @@ figure.block:has(.equation.selected-suggestion) {
|
|
|
937
794
|
.tracking-visible
|
|
938
795
|
.ProseMirror
|
|
939
796
|
[data-track-status='pending'][data-track-op='delete']
|
|
940
|
-
.block
|
|
941
|
-
.ProseMirror .figure-block
|
|
942
|
-
figure[data-track-status='pending'].deleted img {
|
|
797
|
+
.block {
|
|
943
798
|
box-shadow: inset 3px 0 0 var(--deleted-color);
|
|
944
799
|
}
|
|
945
800
|
|
|
946
|
-
.tracking-visible
|
|
947
|
-
.ProseMirror .figure-block
|
|
948
|
-
figure[data-track-status='pending'].deleted img {
|
|
949
|
-
padding-left: 3px;
|
|
950
|
-
}
|
|
951
|
-
|
|
952
801
|
.selected-suggestion[data-track-status='pending'][data-track-op='delete']
|
|
953
802
|
.block,
|
|
954
803
|
.selected-suggestion[data-track-status='pending'][data-track-op='delete']
|
package/styles/Editor.css
CHANGED
|
@@ -277,6 +277,120 @@
|
|
|
277
277
|
background-color: #bce7f6;
|
|
278
278
|
}
|
|
279
279
|
|
|
280
|
+
.ProseMirror .figure-block {
|
|
281
|
+
border: 1px solid transparent;
|
|
282
|
+
border-radius: 4px;
|
|
283
|
+
display: grid;
|
|
284
|
+
gap: 20px 40px;
|
|
285
|
+
margin: 16px 0 0;
|
|
286
|
+
box-sizing: border-box;
|
|
287
|
+
justify-self: center;
|
|
288
|
+
position: relative;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.ProseMirror .figure-block:hover .options-button {
|
|
292
|
+
visibility: visible;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
.ProseMirror .block:focus-within .figure-block,
|
|
296
|
+
.ProseMirror .block:hover .figure-block {
|
|
297
|
+
border-color: #e2e2e2;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
.ProseMirror .figure-block[data-alignment='left'] {
|
|
301
|
+
justify-self: flex-start;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.ProseMirror .figure-block[data-alignment='right'] {
|
|
305
|
+
justify-self: flex-end;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
.ProseMirror .figure-block .expanded-listing .executable-attachments {
|
|
309
|
+
display: block;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
.ProseMirror .figure-block figure {
|
|
313
|
+
margin: 0;
|
|
314
|
+
display: flex;
|
|
315
|
+
flex-direction: column;
|
|
316
|
+
justify-content: flex-end;
|
|
317
|
+
align-items: center;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
.ProseMirror .figure-block > .listing {
|
|
321
|
+
grid-column-start: 1;
|
|
322
|
+
grid-column-end: -1;
|
|
323
|
+
padding: 0;
|
|
324
|
+
min-height: 0;
|
|
325
|
+
overflow: visible;
|
|
326
|
+
width: 100%;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.ProseMirror .figure-block > figcaption {
|
|
330
|
+
grid-column-start: 1;
|
|
331
|
+
grid-column-end: -1;
|
|
332
|
+
margin-top: 0;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
.ProseMirror .figure-caption {
|
|
336
|
+
display: none;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
.ProseMirror .figure.placeholder {
|
|
340
|
+
align-items: center;
|
|
341
|
+
border-radius: 16px;
|
|
342
|
+
border: 1px dashed #e2e2e2;
|
|
343
|
+
background-color: #fafafa;
|
|
344
|
+
cursor: pointer;
|
|
345
|
+
display: flex;
|
|
346
|
+
justify-content: center;
|
|
347
|
+
text-align: center;
|
|
348
|
+
padding: 64px 32px;
|
|
349
|
+
max-width: 210px;
|
|
350
|
+
min-height: 100px;
|
|
351
|
+
white-space: normal;
|
|
352
|
+
font-size: 14px;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
.ProseMirror .figure.placeholder a {
|
|
356
|
+
text-decoration: underline;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
.ProseMirror .figure.placeholder.over {
|
|
360
|
+
border-color: #bce7f6;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
.ProseMirror .figure-image {
|
|
364
|
+
max-width: 100%;
|
|
365
|
+
object-fit: contain;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
.ProseMirror .figure-embed {
|
|
369
|
+
width: 640px;
|
|
370
|
+
max-width: 90%;
|
|
371
|
+
position: relative;
|
|
372
|
+
padding-top: 56.25%; /* Player ratio: 100 / (1280 / 720) */
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
.ProseMirror .figure-embed .figure-embed-object {
|
|
376
|
+
position: absolute;
|
|
377
|
+
top: 0;
|
|
378
|
+
left: 0;
|
|
379
|
+
border: none;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
.ProseMirror figcaption {
|
|
383
|
+
background: white;
|
|
384
|
+
font-size: 14px;
|
|
385
|
+
margin-top: 1em;
|
|
386
|
+
text-align: center;
|
|
387
|
+
word-wrap: break-word;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
.ProseMirror .block-table_element figcaption {
|
|
391
|
+
text-align: left;
|
|
392
|
+
}
|
|
393
|
+
|
|
280
394
|
.ProseMirror .block-table_element .block-gutter {
|
|
281
395
|
padding-top: 1em;
|
|
282
396
|
}
|
|
@@ -1,40 +0,0 @@
|
|
|
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.ImageElementView = void 0;
|
|
22
|
-
const block_view_1 = __importDefault(require("./block_view"));
|
|
23
|
-
const creators_1 = require("./creators");
|
|
24
|
-
class ImageElementView extends block_view_1.default {
|
|
25
|
-
constructor() {
|
|
26
|
-
super(...arguments);
|
|
27
|
-
this.ignoreMutation = () => true;
|
|
28
|
-
}
|
|
29
|
-
createElement() {
|
|
30
|
-
this.container = document.createElement('div');
|
|
31
|
-
this.container.classList.add('block');
|
|
32
|
-
this.dom.appendChild(this.container);
|
|
33
|
-
this.contentDOM = document.createElement('figure');
|
|
34
|
-
this.contentDOM.classList.add('figure-block');
|
|
35
|
-
this.contentDOM.setAttribute('id', this.node.attrs.id);
|
|
36
|
-
this.container.appendChild(this.contentDOM);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
exports.ImageElementView = ImageElementView;
|
|
40
|
-
exports.default = (0, creators_1.createNodeView)(ImageElementView);
|
|
@@ -1,33 +0,0 @@
|
|
|
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 BlockView from './block_view';
|
|
17
|
-
import { createNodeView } from './creators';
|
|
18
|
-
export class ImageElementView extends BlockView {
|
|
19
|
-
constructor() {
|
|
20
|
-
super(...arguments);
|
|
21
|
-
this.ignoreMutation = () => true;
|
|
22
|
-
}
|
|
23
|
-
createElement() {
|
|
24
|
-
this.container = document.createElement('div');
|
|
25
|
-
this.container.classList.add('block');
|
|
26
|
-
this.dom.appendChild(this.container);
|
|
27
|
-
this.contentDOM = document.createElement('figure');
|
|
28
|
-
this.contentDOM.classList.add('figure-block');
|
|
29
|
-
this.contentDOM.setAttribute('id', this.node.attrs.id);
|
|
30
|
-
this.container.appendChild(this.contentDOM);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
export default createNodeView(ImageElementView);
|
|
@@ -1,25 +0,0 @@
|
|
|
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 { FigureElementNode } from '@manuscripts/transform';
|
|
17
|
-
import { Trackable } from '../types';
|
|
18
|
-
import BlockView from './block_view';
|
|
19
|
-
export declare class ImageElementView extends BlockView<Trackable<FigureElementNode>> {
|
|
20
|
-
container: HTMLElement;
|
|
21
|
-
ignoreMutation: () => boolean;
|
|
22
|
-
createElement(): void;
|
|
23
|
-
}
|
|
24
|
-
declare const _default: (props: import("../configs/ManuscriptsEditor").EditorProps, dispatch?: import("..").Dispatch | undefined) => import("../types").NodeViewCreator<ImageElementView>;
|
|
25
|
-
export default _default;
|