@manuscripts/body-editor 3.2.2 → 3.2.4
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 +1 -1
- package/dist/cjs/components/views/FigureDropdown.js +4 -2
- package/dist/cjs/configs/editor-views.js +2 -1
- package/dist/cjs/icons.js +2 -1
- package/dist/cjs/versions.js +1 -1
- package/dist/cjs/views/figure_editable.js +29 -0
- package/dist/cjs/views/figure_element.js +36 -12
- package/dist/cjs/views/image_element.js +40 -0
- package/dist/cjs/views/image_element_editable.js +21 -0
- package/dist/es/commands.js +1 -1
- package/dist/es/components/views/FigureDropdown.js +4 -2
- package/dist/es/configs/editor-views.js +2 -1
- package/dist/es/icons.js +1 -0
- package/dist/es/versions.js +1 -1
- package/dist/es/views/figure_editable.js +29 -0
- package/dist/es/views/figure_element.js +36 -9
- package/dist/es/views/image_element.js +33 -0
- package/dist/es/views/image_element_editable.js +19 -0
- package/dist/types/components/views/FigureDropdown.d.ts +1 -0
- package/dist/types/icons.d.ts +1 -0
- package/dist/types/versions.d.ts +1 -1
- package/dist/types/views/figure_element.d.ts +4 -5
- package/dist/types/views/image_element.d.ts +25 -0
- package/dist/types/views/image_element_editable.d.ts +44 -0
- package/package.json +3 -2
- package/styles/AdvancedEditor.css +152 -1
- package/styles/Editor.css +0 -114
package/dist/cjs/commands.js
CHANGED
|
@@ -260,7 +260,7 @@ const insertTable = (config, state, dispatch) => {
|
|
|
260
260
|
if (!pos) {
|
|
261
261
|
return false;
|
|
262
262
|
}
|
|
263
|
-
const node = (0, exports.createAndFillTableElement)(config);
|
|
263
|
+
const node = (0, exports.createAndFillTableElement)(undefined, config);
|
|
264
264
|
const tr = state.tr.insert(pos, node);
|
|
265
265
|
(0, accessibility_element_1.expandAccessibilitySection)(tr, node);
|
|
266
266
|
tr.setSelection(prosemirror_state_1.NodeSelection.create(tr.doc, pos)).scrollIntoView();
|
|
@@ -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, onDelete, }) => {
|
|
11
11
|
const { isOpen, toggleOpen, wrapperRef } = (0, style_guide_1.useDropdown)();
|
|
12
12
|
const supplements = files.supplements
|
|
13
13
|
.map((s) => s.file)
|
|
@@ -18,6 +18,7 @@ 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;
|
|
21
22
|
return (react_1.default.createElement(DropdownWrapper, { ref: wrapperRef },
|
|
22
23
|
react_1.default.createElement(OptionsButton, { className: 'options-button', onClick: toggleOpen },
|
|
23
24
|
react_1.default.createElement(style_guide_1.DotsIcon, null)),
|
|
@@ -33,7 +34,8 @@ const FigureOptions = ({ can, files, onDownload, onUpload, onDetach, onReplace,
|
|
|
33
34
|
react_1.default.createElement(style_guide_1.UploadIcon, null),
|
|
34
35
|
" Upload new...")) }),
|
|
35
36
|
react_1.default.createElement(ListItemButton, { onClick: onDownload, disabled: !showDownload }, "Download"),
|
|
36
|
-
react_1.default.createElement(ListItemButton, { onClick: onDetach, disabled: !showDetach }, "Detach")
|
|
37
|
+
react_1.default.createElement(ListItemButton, { onClick: onDetach, disabled: !showDetach }, "Detach"),
|
|
38
|
+
showDelete && (react_1.default.createElement(ListItemButton, { onClick: onDelete }, "Delete"))))));
|
|
37
39
|
};
|
|
38
40
|
exports.FigureOptions = FigureOptions;
|
|
39
41
|
const NestedDropdown = ({ parentToggleOpen, buttonText, disabled, list, moveLeft }) => {
|
|
@@ -26,6 +26,7 @@ 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_editable_1 = __importDefault(require("../views/image_element_editable"));
|
|
29
30
|
const inline_equation_editable_1 = __importDefault(require("../views/inline_equation_editable"));
|
|
30
31
|
const inline_footnote_editable_1 = __importDefault(require("../views/inline_footnote_editable"));
|
|
31
32
|
const keyword_1 = __importDefault(require("../views/keyword"));
|
|
@@ -65,7 +66,7 @@ exports.default = (props, dispatch) => {
|
|
|
65
66
|
equation_element: (0, equation_element_editable_1.default)(props),
|
|
66
67
|
figure: (0, figure_editable_1.default)(props, dispatch),
|
|
67
68
|
figure_element: (0, figure_element_editable_1.default)(props, dispatch),
|
|
68
|
-
image_element: (0,
|
|
69
|
+
image_element: (0, image_element_editable_1.default)(props, dispatch),
|
|
69
70
|
footnote: (0, footnote_1.default)(props),
|
|
70
71
|
footnotes_element: (0, footnotes_element_1.default)(props),
|
|
71
72
|
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.plusIcon = exports.lockIcon = exports.scrollIcon = exports.sectionCategoryIcon = exports.editIcon = exports.deleteIcon = exports.alertIcon = exports.arrowUp = exports.arrowDown = void 0;
|
|
3
|
+
exports.addFigureBtnIcon = 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,3 +14,4 @@ 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,6 +22,7 @@ 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");
|
|
25
26
|
const react_1 = require("react");
|
|
26
27
|
const server_1 = require("react-dom/server");
|
|
27
28
|
const FigureDropdown_1 = require("../components/views/FigureDropdown");
|
|
@@ -243,6 +244,7 @@ class FigureEditableView extends figure_1.FigureView {
|
|
|
243
244
|
let handleUpload;
|
|
244
245
|
let handleReplace;
|
|
245
246
|
let handleDetach;
|
|
247
|
+
let handleDelete;
|
|
246
248
|
const src = this.node.attrs.src;
|
|
247
249
|
const files = this.props.getFiles();
|
|
248
250
|
const file = src && files.filter((f) => f.id === src)[0];
|
|
@@ -265,6 +267,32 @@ class FigureEditableView extends figure_1.FigureView {
|
|
|
265
267
|
if (can.uploadFile) {
|
|
266
268
|
handleUpload = (0, figure_uploader_1.figureUploader)(this.upload);
|
|
267
269
|
}
|
|
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
|
+
}
|
|
268
296
|
this.reactTools?.remove();
|
|
269
297
|
if (this.props.dispatch && this.props.theme) {
|
|
270
298
|
const files = this.props.getFiles();
|
|
@@ -276,6 +304,7 @@ class FigureEditableView extends figure_1.FigureView {
|
|
|
276
304
|
onUpload: handleUpload,
|
|
277
305
|
onDetach: handleDetach,
|
|
278
306
|
onReplace: handleReplace,
|
|
307
|
+
onDelete: handleDelete,
|
|
279
308
|
};
|
|
280
309
|
this.reactTools = (0, ReactSubView_1.default)(this.props, FigureDropdown_1.FigureOptions, componentProps, this.node, this.getPos, this.view);
|
|
281
310
|
this.dom.insertBefore(this.reactTools, this.dom.firstChild);
|
|
@@ -14,26 +14,50 @@
|
|
|
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
|
-
};
|
|
20
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
18
|
exports.FigureElementView = void 0;
|
|
22
|
-
const
|
|
19
|
+
const transform_1 = require("@manuscripts/transform");
|
|
20
|
+
const icons_1 = require("../icons");
|
|
23
21
|
const creators_1 = require("./creators");
|
|
24
|
-
|
|
22
|
+
const image_element_1 = require("./image_element");
|
|
23
|
+
class FigureElementView extends image_element_1.ImageElementView {
|
|
25
24
|
constructor() {
|
|
26
25
|
super(...arguments);
|
|
27
26
|
this.ignoreMutation = () => true;
|
|
28
27
|
this.createElement = () => {
|
|
29
|
-
|
|
30
|
-
this.
|
|
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);
|
|
28
|
+
super.createElement();
|
|
29
|
+
this.addFigureElementButtons();
|
|
36
30
|
};
|
|
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
|
+
}
|
|
37
61
|
}
|
|
38
62
|
}
|
|
39
63
|
exports.FigureElementView = FigureElementView;
|
|
@@ -0,0 +1,40 @@
|
|
|
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);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* © 2019 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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const creators_1 = require("./creators");
|
|
19
|
+
const editable_block_1 = require("./editable_block");
|
|
20
|
+
const image_element_1 = require("./image_element");
|
|
21
|
+
exports.default = (0, creators_1.createEditableNodeView)((0, editable_block_1.EditableBlock)(image_element_1.ImageElementView));
|
package/dist/es/commands.js
CHANGED
|
@@ -245,7 +245,7 @@ export const insertTable = (config, state, dispatch) => {
|
|
|
245
245
|
if (!pos) {
|
|
246
246
|
return false;
|
|
247
247
|
}
|
|
248
|
-
const node = createAndFillTableElement(config);
|
|
248
|
+
const node = createAndFillTableElement(undefined, config);
|
|
249
249
|
const tr = state.tr.insert(pos, node);
|
|
250
250
|
expandAccessibilitySection(tr, node);
|
|
251
251
|
tr.setSelection(NodeSelection.create(tr.doc, pos)).scrollIntoView();
|
|
@@ -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, onDelete, }) => {
|
|
5
5
|
const { isOpen, toggleOpen, wrapperRef } = useDropdown();
|
|
6
6
|
const supplements = files.supplements
|
|
7
7
|
.map((s) => s.file)
|
|
@@ -12,6 +12,7 @@ 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;
|
|
15
16
|
return (React.createElement(DropdownWrapper, { ref: wrapperRef },
|
|
16
17
|
React.createElement(OptionsButton, { className: 'options-button', onClick: toggleOpen },
|
|
17
18
|
React.createElement(DotsIcon, null)),
|
|
@@ -27,7 +28,8 @@ export const FigureOptions = ({ can, files, onDownload, onUpload, onDetach, onRe
|
|
|
27
28
|
React.createElement(UploadIcon, null),
|
|
28
29
|
" Upload new...")) }),
|
|
29
30
|
React.createElement(ListItemButton, { onClick: onDownload, disabled: !showDownload }, "Download"),
|
|
30
|
-
React.createElement(ListItemButton, { onClick: onDetach, disabled: !showDetach }, "Detach")
|
|
31
|
+
React.createElement(ListItemButton, { onClick: onDetach, disabled: !showDetach }, "Detach"),
|
|
32
|
+
showDelete && (React.createElement(ListItemButton, { onClick: onDelete }, "Delete"))))));
|
|
31
33
|
};
|
|
32
34
|
const NestedDropdown = ({ parentToggleOpen, buttonText, disabled, list, moveLeft }) => {
|
|
33
35
|
const { isOpen, toggleOpen, wrapperRef } = useDropdown();
|
|
@@ -21,6 +21,7 @@ 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_editable';
|
|
24
25
|
import inlineEquation from '../views/inline_equation_editable';
|
|
25
26
|
import inlineFootnote from '../views/inline_footnote_editable';
|
|
26
27
|
import keyword from '../views/keyword';
|
|
@@ -60,7 +61,7 @@ export default (props, dispatch) => {
|
|
|
60
61
|
equation_element: equationElement(props),
|
|
61
62
|
figure: figure(props, dispatch),
|
|
62
63
|
figure_element: figureElement(props, dispatch),
|
|
63
|
-
image_element:
|
|
64
|
+
image_element: imageElement(props, dispatch),
|
|
64
65
|
footnote: footnote(props),
|
|
65
66
|
footnotes_element: footnotesElement(props),
|
|
66
67
|
general_table_footnote: generalTableFootnote(props, dispatch),
|
package/dist/es/icons.js
CHANGED
|
@@ -11,3 +11,4 @@ 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.2.
|
|
1
|
+
export const VERSION = '3.2.4';
|
|
2
2
|
export const MATHJAX_VERSION = '3.2.2';
|
|
@@ -16,6 +16,7 @@
|
|
|
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';
|
|
19
20
|
import { createElement } from 'react';
|
|
20
21
|
import { renderToStaticMarkup } from 'react-dom/server';
|
|
21
22
|
import { FigureOptions, } from '../components/views/FigureDropdown';
|
|
@@ -237,6 +238,7 @@ export class FigureEditableView extends FigureView {
|
|
|
237
238
|
let handleUpload;
|
|
238
239
|
let handleReplace;
|
|
239
240
|
let handleDetach;
|
|
241
|
+
let handleDelete;
|
|
240
242
|
const src = this.node.attrs.src;
|
|
241
243
|
const files = this.props.getFiles();
|
|
242
244
|
const file = src && files.filter((f) => f.id === src)[0];
|
|
@@ -259,6 +261,32 @@ export class FigureEditableView extends FigureView {
|
|
|
259
261
|
if (can.uploadFile) {
|
|
260
262
|
handleUpload = figureUploader(this.upload);
|
|
261
263
|
}
|
|
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
|
+
}
|
|
262
290
|
this.reactTools?.remove();
|
|
263
291
|
if (this.props.dispatch && this.props.theme) {
|
|
264
292
|
const files = this.props.getFiles();
|
|
@@ -270,6 +298,7 @@ export class FigureEditableView extends FigureView {
|
|
|
270
298
|
onUpload: handleUpload,
|
|
271
299
|
onDetach: handleDetach,
|
|
272
300
|
onReplace: handleReplace,
|
|
301
|
+
onDelete: handleDelete,
|
|
273
302
|
};
|
|
274
303
|
this.reactTools = ReactSubView(this.props, FigureOptions, componentProps, this.node, this.getPos, this.view);
|
|
275
304
|
this.dom.insertBefore(this.reactTools, this.dom.firstChild);
|
|
@@ -13,21 +13,48 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import
|
|
16
|
+
import { schema } from '@manuscripts/transform';
|
|
17
|
+
import { addFigureBtnIcon } from '../icons';
|
|
17
18
|
import { createNodeView } from './creators';
|
|
18
|
-
|
|
19
|
+
import { ImageElementView } from './image_element';
|
|
20
|
+
export class FigureElementView extends ImageElementView {
|
|
19
21
|
constructor() {
|
|
20
22
|
super(...arguments);
|
|
21
23
|
this.ignoreMutation = () => true;
|
|
22
24
|
this.createElement = () => {
|
|
23
|
-
|
|
24
|
-
this.
|
|
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);
|
|
25
|
+
super.createElement();
|
|
26
|
+
this.addFigureElementButtons();
|
|
30
27
|
};
|
|
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
|
+
}
|
|
31
58
|
}
|
|
32
59
|
}
|
|
33
60
|
export default createNodeView(FigureElementView);
|
|
@@ -0,0 +1,33 @@
|
|
|
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);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 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 { createEditableNodeView } from './creators';
|
|
17
|
+
import { EditableBlock } from './editable_block';
|
|
18
|
+
import { ImageElementView } from './image_element';
|
|
19
|
+
export default createEditableNodeView(EditableBlock(ImageElementView));
|
|
@@ -10,6 +10,7 @@ export interface FigureOptionsProps extends FigureDropdownProps {
|
|
|
10
10
|
onUpload?: () => void;
|
|
11
11
|
onDetach?: () => void;
|
|
12
12
|
onReplace?: (file: FileAttachment) => void;
|
|
13
|
+
onDelete?: () => void;
|
|
13
14
|
}
|
|
14
15
|
export interface FigureElementOptionsProps extends FigureDropdownProps {
|
|
15
16
|
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.2.
|
|
1
|
+
export declare const VERSION = "3.2.4";
|
|
2
2
|
export declare const MATHJAX_VERSION = "3.2.2";
|
|
@@ -13,13 +13,12 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
import BlockView from './block_view';
|
|
19
|
-
export declare class FigureElementView extends BlockView<Trackable<FigureElementNode>> {
|
|
20
|
-
private container;
|
|
16
|
+
import { ImageElementView } from './image_element';
|
|
17
|
+
export declare class FigureElementView extends ImageElementView {
|
|
21
18
|
ignoreMutation: () => boolean;
|
|
22
19
|
createElement: () => void;
|
|
20
|
+
private addFigureElementButtons;
|
|
21
|
+
private addFigure;
|
|
23
22
|
}
|
|
24
23
|
declare const _default: (props: import("../configs/ManuscriptsEditor").EditorProps, dispatch?: import("..").Dispatch | undefined) => import("../types").NodeViewCreator<FigureElementView>;
|
|
25
24
|
export default _default;
|
|
@@ -0,0 +1,25 @@
|
|
|
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;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 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 { ImageElementView } from './image_element';
|
|
17
|
+
declare const _default: (props: import("../configs/ManuscriptsEditor").EditorProps, dispatch?: import("..").Dispatch | undefined) => import("../types").NodeViewCreator<{
|
|
18
|
+
gutterButtons(): HTMLElement[];
|
|
19
|
+
actionGutterButtons(): never[];
|
|
20
|
+
createAddButton(): HTMLAnchorElement | null;
|
|
21
|
+
createEditButton(): HTMLElement | null;
|
|
22
|
+
createMenu: () => import("../lib/context-menu").ContextMenu;
|
|
23
|
+
initialise(): void;
|
|
24
|
+
updateContents(): void;
|
|
25
|
+
handleTrackChanges(): void;
|
|
26
|
+
updateClasses(): void;
|
|
27
|
+
updatePlaceholder(): void;
|
|
28
|
+
createElement(): void;
|
|
29
|
+
createDOM(): void;
|
|
30
|
+
gutter: Record<string, HTMLElement>;
|
|
31
|
+
createGutter(className: string, buttons: HTMLElement[]): void;
|
|
32
|
+
dom: HTMLElement;
|
|
33
|
+
contentDOM?: HTMLElement | undefined;
|
|
34
|
+
elementType: string;
|
|
35
|
+
readonly props: import("../configs/ManuscriptsEditor").EditorProps;
|
|
36
|
+
node: import("prosemirror-model").Node;
|
|
37
|
+
readonly view: import("prosemirror-view").EditorView;
|
|
38
|
+
readonly getPos: () => number;
|
|
39
|
+
update(newNode: import("prosemirror-model").Node): boolean;
|
|
40
|
+
selectNode(): void;
|
|
41
|
+
deselectNode(): void;
|
|
42
|
+
destroy(): void;
|
|
43
|
+
} & ImageElementView>;
|
|
44
|
+
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.2.
|
|
4
|
+
"version": "3.2.4",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
"preversion": "npm-run-all --parallel typecheck lint test",
|
|
26
26
|
"test": "jest --runInBand",
|
|
27
27
|
"typecheck": "tsc --noEmit",
|
|
28
|
-
"version": "pnpm build"
|
|
28
|
+
"version": "pnpm build",
|
|
29
|
+
"unlink-all": "rm pnpm-workspace.yaml && pnpm install"
|
|
29
30
|
},
|
|
30
31
|
"dependencies": {
|
|
31
32
|
"@iarna/word-count": "1.1.2",
|
|
@@ -122,6 +122,8 @@
|
|
|
122
122
|
text-indent: 0pt;
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
+
/* Figures */
|
|
126
|
+
|
|
125
127
|
.ProseMirror .figure-block {
|
|
126
128
|
width: 100%;
|
|
127
129
|
border: 1px solid #f2f2f2;
|
|
@@ -132,6 +134,11 @@
|
|
|
132
134
|
|
|
133
135
|
grid-template-columns: repeat(3, auto) !important;
|
|
134
136
|
grid-template-rows: repeat(1, minmax(min-content, max-content)) [caption listing] auto !important;
|
|
137
|
+
|
|
138
|
+
margin: 16px 0 0 !important;
|
|
139
|
+
box-sizing: border-box;
|
|
140
|
+
justify-self: center;
|
|
141
|
+
position: relative;
|
|
135
142
|
}
|
|
136
143
|
|
|
137
144
|
.ProseMirror .figure-group {
|
|
@@ -144,8 +151,140 @@
|
|
|
144
151
|
width: 100%;
|
|
145
152
|
position: relative;
|
|
146
153
|
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;
|
|
147
246
|
}
|
|
148
247
|
|
|
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
|
+
|
|
149
288
|
.ProseMirror .figure-block > figcaption .figure-label {
|
|
150
289
|
display: initial !important;
|
|
151
290
|
}
|
|
@@ -683,6 +822,10 @@ span.comment-marker {
|
|
|
683
822
|
text-decoration: line-through;
|
|
684
823
|
}
|
|
685
824
|
|
|
825
|
+
.tracking-visible .ProseMirror figure.deleted {
|
|
826
|
+
display: flex;
|
|
827
|
+
}
|
|
828
|
+
|
|
686
829
|
.tracking-visible .ProseMirror .block.deleted {
|
|
687
830
|
display: block;
|
|
688
831
|
}
|
|
@@ -794,10 +937,18 @@ figure.block:has(.equation.selected-suggestion) {
|
|
|
794
937
|
.tracking-visible
|
|
795
938
|
.ProseMirror
|
|
796
939
|
[data-track-status='pending'][data-track-op='delete']
|
|
797
|
-
.block
|
|
940
|
+
.block, .tracking-visible
|
|
941
|
+
.ProseMirror .figure-block
|
|
942
|
+
figure[data-track-status='pending'].deleted img {
|
|
798
943
|
box-shadow: inset 3px 0 0 var(--deleted-color);
|
|
799
944
|
}
|
|
800
945
|
|
|
946
|
+
.tracking-visible
|
|
947
|
+
.ProseMirror .figure-block
|
|
948
|
+
figure[data-track-status='pending'].deleted img {
|
|
949
|
+
padding-left: 3px;
|
|
950
|
+
}
|
|
951
|
+
|
|
801
952
|
.selected-suggestion[data-track-status='pending'][data-track-op='delete']
|
|
802
953
|
.block,
|
|
803
954
|
.selected-suggestion[data-track-status='pending'][data-track-op='delete']
|
package/styles/Editor.css
CHANGED
|
@@ -277,120 +277,6 @@
|
|
|
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
|
-
|
|
394
280
|
.ProseMirror .block-table_element .block-gutter {
|
|
395
281
|
padding-top: 1em;
|
|
396
282
|
}
|