@manuscripts/body-editor 3.13.10 → 3.13.12
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 +21 -2
- package/dist/cjs/components/views/FigureDropdown.js +8 -0
- package/dist/cjs/configs/editor-views.js +6 -0
- package/dist/cjs/icons.js +2 -1
- package/dist/cjs/lib/files.js +6 -1
- package/dist/cjs/menus.js +8 -0
- package/dist/cjs/node-type-icons.js +4 -0
- package/dist/cjs/plugins/accessibility_element.js +2 -1
- package/dist/cjs/versions.js +1 -1
- package/dist/cjs/views/accessibility_element.js +7 -1
- package/dist/cjs/views/affiliations.js +5 -1
- package/dist/cjs/views/caption.js +0 -1
- package/dist/cjs/views/caption_title.js +0 -1
- package/dist/cjs/views/headshot_element.js +74 -0
- package/dist/cjs/views/headshot_element_editable.js +20 -0
- package/dist/cjs/views/headshot_grid.js +82 -0
- package/dist/cjs/views/headshot_grid_editable.js +21 -0
- package/dist/cjs/views/headshot_image_editable.js +79 -0
- package/dist/cjs/views/supplement.js +16 -1
- package/dist/es/commands.js +18 -0
- package/dist/es/components/views/FigureDropdown.js +8 -0
- package/dist/es/configs/editor-views.js +6 -0
- package/dist/es/icons.js +2 -1
- package/dist/es/lib/files.js +6 -1
- package/dist/es/menus.js +9 -1
- package/dist/es/node-type-icons.js +5 -1
- package/dist/es/plugins/accessibility_element.js +2 -1
- package/dist/es/versions.js +1 -1
- package/dist/es/views/accessibility_element.js +7 -1
- package/dist/es/views/affiliations.js +5 -1
- package/dist/es/views/caption.js +0 -1
- package/dist/es/views/caption_title.js +0 -1
- package/dist/es/views/headshot_element.js +70 -0
- package/dist/es/views/headshot_element_editable.js +18 -0
- package/dist/es/views/headshot_grid.js +75 -0
- package/dist/es/views/headshot_grid_editable.js +19 -0
- package/dist/es/views/headshot_image_editable.js +75 -0
- package/dist/es/views/supplement.js +16 -1
- package/dist/types/commands.d.ts +1 -0
- package/dist/types/icons.d.ts +1 -0
- package/dist/types/versions.d.ts +1 -1
- package/dist/types/views/headshot_element.d.ts +29 -0
- package/dist/types/views/headshot_element_editable.d.ts +18 -0
- package/dist/types/views/headshot_grid.d.ts +28 -0
- package/dist/types/views/headshot_grid_editable.d.ts +44 -0
- package/dist/types/views/headshot_image_editable.d.ts +28 -0
- package/dist/types/views/supplement.d.ts +1 -0
- package/package.json +2 -2
- package/src/commands.ts +27 -0
- package/src/components/views/FigureDropdown.tsx +11 -0
- package/src/configs/editor-views.ts +6 -0
- package/src/icons.ts +2 -0
- package/src/lib/files.ts +7 -1
- package/src/menus.tsx +10 -0
- package/src/node-type-icons.tsx +12 -0
- package/src/plugins/accessibility_element.ts +4 -1
- package/src/versions.ts +1 -1
- package/src/views/accessibility_element.ts +7 -1
- package/src/views/affiliations.ts +6 -1
- package/src/views/caption.ts +0 -1
- package/src/views/caption_title.ts +0 -1
- package/src/views/headshot_element.ts +98 -0
- package/src/views/headshot_element_editable.ts +20 -0
- package/src/views/headshot_grid.ts +98 -0
- package/src/views/headshot_grid_editable.ts +21 -0
- package/src/views/headshot_image_editable.ts +93 -0
- package/src/views/supplement.ts +15 -2
- package/styles/AdvancedEditor.css +169 -1
- package/styles/Editor.css +1 -1
package/dist/es/lib/files.js
CHANGED
|
@@ -9,6 +9,7 @@ const figureTypes = [
|
|
|
9
9
|
schema.nodes.figure_element,
|
|
10
10
|
schema.nodes.image_element,
|
|
11
11
|
schema.nodes.hero_image,
|
|
12
|
+
schema.nodes.headshot_grid,
|
|
12
13
|
schema.nodes.embed,
|
|
13
14
|
];
|
|
14
15
|
export function memoGroupFiles() {
|
|
@@ -52,7 +53,11 @@ export const groupFiles = (doc, files) => {
|
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
55
|
else {
|
|
55
|
-
|
|
56
|
+
const descend = node.type === schema.nodes.headshot_grid;
|
|
57
|
+
const figureNodeType = node.type === schema.nodes.headshot_grid
|
|
58
|
+
? schema.nodes.headshot_image
|
|
59
|
+
: schema.nodes.figure;
|
|
60
|
+
for (const figure of findChildrenByType(node, figureNodeType, descend)) {
|
|
56
61
|
if (isHidden(figure.node)) {
|
|
57
62
|
continue;
|
|
58
63
|
}
|
package/dist/es/menus.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import { getGroupCategories, schema, } from '@manuscripts/transform';
|
|
17
17
|
import { toggleMark } from 'prosemirror-commands';
|
|
18
18
|
import { redo, undo } from 'prosemirror-history';
|
|
19
|
-
import { activateSearchReplace, addInlineComment, blockActive, canInsert, copySelection, insertAbstractSection, insertAffiliation, insertAward, insertBackmatterSection, insertBlock, insertBoxElement, insertContributors, insertCrossReference, insertEmbed, insertGraphicalAbstract, insertHeroImage, insertInlineCitation, insertInlineEquation, insertInlineFootnote, insertKeywords, insertLink, insertList, insertSection, markActive, paste, } from './commands';
|
|
19
|
+
import { activateSearchReplace, addInlineComment, blockActive, canInsert, copySelection, insertAbstractSection, insertAffiliation, insertAward, insertBackmatterSection, insertBlock, insertBoxElement, insertContributors, insertCrossReference, insertEmbed, insertGraphicalAbstract, insertHeadshotGrid, insertHeroImage, insertInlineCitation, insertInlineEquation, insertInlineFootnote, insertKeywords, insertLink, insertList, insertSection, markActive, paste, } from './commands';
|
|
20
20
|
import { openInsertTableDialog } from './components/toolbar/InsertTableDialog';
|
|
21
21
|
import { ListMenuItem } from './components/toolbar/ListMenuItem';
|
|
22
22
|
import { openInsertSpecialCharacterDialog } from './components/views/InsertSpecialCharacter';
|
|
@@ -269,6 +269,14 @@ export const getEditorMenus = (editor) => {
|
|
|
269
269
|
run: doCommand(insertBoxElement),
|
|
270
270
|
isHidden: !templateAllows(state, schema.nodes.box_element),
|
|
271
271
|
},
|
|
272
|
+
{
|
|
273
|
+
id: 'insert-headshot-grid',
|
|
274
|
+
label: 'Headshot Panel',
|
|
275
|
+
isEnabled: isEditAllowed(state) &&
|
|
276
|
+
isCommandValid(canInsert(schema.nodes.headshot_grid)),
|
|
277
|
+
run: doCommand(insertHeadshotGrid),
|
|
278
|
+
isHidden: !templateAllows(state, schema.nodes.headshot_grid),
|
|
279
|
+
},
|
|
272
280
|
{
|
|
273
281
|
role: 'separator',
|
|
274
282
|
},
|
|
@@ -13,10 +13,12 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { FileDocumentIcon, SupplementsIcon, FileImageIcon, OutlineBlockQuoteIcon, OutlineEmbedIcon, OutlineEquationIcon, OutlineFigureIcon, OutlineManuscriptIcon, OutlineOrderedListIcon, OutlineParagraphIcon, OutlinePullQuoteIcon, OutlineSectionIcon, OutlineTableIcon, OutlineUnorderedListIcon, } from '@manuscripts/style-guide';
|
|
16
|
+
import { AvatarIcon, FileDocumentIcon, SupplementsIcon, FileImageIcon, FileHeadshotGridIcon, OutlineBlockQuoteIcon, OutlineEmbedIcon, OutlineEquationIcon, OutlineFigureIcon, OutlineManuscriptIcon, OutlineOrderedListIcon, OutlineParagraphIcon, OutlinePullQuoteIcon, OutlineSectionIcon, OutlineTableIcon, OutlineUnorderedListIcon, } from '@manuscripts/style-guide';
|
|
17
17
|
import { schema } from '@manuscripts/transform';
|
|
18
18
|
import React from 'react';
|
|
19
19
|
const { nodes } = schema;
|
|
20
|
+
const OutlineHeadshotGridIcon = () => (React.createElement(FileHeadshotGridIcon, { width: "12", height: "12" }));
|
|
21
|
+
const OutlineHeadshotElementIcon = () => (React.createElement(AvatarIcon, { width: "16", height: "16" }));
|
|
20
22
|
const OutlineImageIcon = () => (React.createElement(FileImageIcon, { width: "11", height: "14" }));
|
|
21
23
|
const OutlineSupplementsIcon = () => (React.createElement(SupplementsIcon, { width: "11", height: "14" }));
|
|
22
24
|
const OutlineMainDocumentIcon = () => (React.createElement(FileDocumentIcon, { width: "11", height: "14" }));
|
|
@@ -38,6 +40,8 @@ const icons = new Map([
|
|
|
38
40
|
[nodes.hero_image, OutlineImageIcon],
|
|
39
41
|
[nodes.supplements, OutlineSupplementsIcon],
|
|
40
42
|
[nodes.attachments, OutlineMainDocumentIcon],
|
|
43
|
+
[nodes.headshot_grid, OutlineHeadshotGridIcon],
|
|
44
|
+
[nodes.headshot_element, OutlineHeadshotElementIcon],
|
|
41
45
|
]);
|
|
42
46
|
export const nodeTypeIcon = (nodeType, listType) => {
|
|
43
47
|
if (nodeType === schema.nodes.list) {
|
|
@@ -27,7 +27,8 @@ const isSelectionWithin = (node, pos, selection) => {
|
|
|
27
27
|
const buildExpandButtonDecorations = (doc) => {
|
|
28
28
|
const decorations = [];
|
|
29
29
|
doc.descendants((node, pos) => {
|
|
30
|
-
if (node.type.
|
|
30
|
+
if (node.type !== schema.nodes.headshot_element &&
|
|
31
|
+
node.type.spec.content?.includes('alt_text')) {
|
|
31
32
|
decorations.push(Decoration.widget(pos + node.nodeSize - 1, (view) => {
|
|
32
33
|
const container = document.createElement('div');
|
|
33
34
|
container.className =
|
package/dist/es/versions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '3.13.
|
|
1
|
+
export const VERSION = '3.13.12';
|
|
2
2
|
export const MATHJAX_VERSION = '3.2.2';
|
|
@@ -3,8 +3,15 @@ import { TextSelection } from 'prosemirror-state';
|
|
|
3
3
|
import { createKeyboardInteraction } from '../lib/navigation-utils';
|
|
4
4
|
import BlockView from './block_view';
|
|
5
5
|
import { createNodeView } from './creators';
|
|
6
|
+
import empty from './empty';
|
|
6
7
|
export class AccessibilityElementView extends BlockView {
|
|
7
8
|
initialise() {
|
|
9
|
+
const $pos = this.view.state.doc.resolve(this.getPos());
|
|
10
|
+
if ($pos.parent.type === schema.nodes.headshot_element) {
|
|
11
|
+
const { dom } = empty('accessibility_element')();
|
|
12
|
+
this.dom = dom;
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
8
15
|
this.createDOM();
|
|
9
16
|
this.createElement();
|
|
10
17
|
this.updateContents();
|
|
@@ -24,7 +31,6 @@ export class AccessibilityElementView extends BlockView {
|
|
|
24
31
|
createElement() {
|
|
25
32
|
super.createElement();
|
|
26
33
|
this.contentDOM.className = 'accessibility_element_input';
|
|
27
|
-
this.contentDOM.setAttribute('contenteditable', 'true');
|
|
28
34
|
this.contentDOM.tabIndex = this.node.type === schema.nodes.alt_text ? 0 : -1;
|
|
29
35
|
this.removeKeydownListener = createKeyboardInteraction({
|
|
30
36
|
container: this.contentDOM,
|
|
@@ -114,7 +114,6 @@ export class AffiliationsView extends BlockView {
|
|
|
114
114
|
this.container = document.createElement('div');
|
|
115
115
|
this.container.classList.add('affiliations', 'block');
|
|
116
116
|
this.container.contentEditable = 'false';
|
|
117
|
-
this.container.addEventListener('click', this.handleClick);
|
|
118
117
|
this.dom.setAttribute('contenteditable', 'false');
|
|
119
118
|
this.dom.appendChild(this.container);
|
|
120
119
|
}
|
|
@@ -134,6 +133,11 @@ export class AffiliationsView extends BlockView {
|
|
|
134
133
|
this.updateSelection();
|
|
135
134
|
}
|
|
136
135
|
buildAffiliations(affs) {
|
|
136
|
+
const can = this.props.getCapabilities();
|
|
137
|
+
this.container.removeEventListener('click', this.handleClick);
|
|
138
|
+
if (can.editMetadata) {
|
|
139
|
+
this.container.addEventListener('click', this.handleClick);
|
|
140
|
+
}
|
|
137
141
|
const elements = [];
|
|
138
142
|
for (const affiliation of affs.affiliations) {
|
|
139
143
|
const index = affs.indexedAffiliationIds.get(affiliation.id);
|
package/dist/es/views/caption.js
CHANGED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2026 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 { TextSelection } from 'prosemirror-state';
|
|
17
|
+
import { plusIcon } from '../icons';
|
|
18
|
+
import { handleEnterKey } from '../lib/navigation-utils';
|
|
19
|
+
import { BaseNodeView } from './base_node_view';
|
|
20
|
+
import { createNodeView } from './creators';
|
|
21
|
+
export class HeadshotElement extends BaseNodeView {
|
|
22
|
+
constructor() {
|
|
23
|
+
super(...arguments);
|
|
24
|
+
this.elementType = 'div';
|
|
25
|
+
this.createElement = () => {
|
|
26
|
+
this.dom = document.createElement('div');
|
|
27
|
+
this.dom.classList.add('headshot-element');
|
|
28
|
+
this.dom.tabIndex = 0;
|
|
29
|
+
this.dom.setAttribute('id', this.node.attrs.id);
|
|
30
|
+
this.container = document.createElement('div');
|
|
31
|
+
this.container.classList.add('block');
|
|
32
|
+
this.dom.appendChild(this.container);
|
|
33
|
+
this.contentDOM = document.createElement('div');
|
|
34
|
+
this.contentDOM.classList.add('block-container', 'headshot-element-block');
|
|
35
|
+
this.container.appendChild(this.contentDOM);
|
|
36
|
+
const can = this.props.getCapabilities();
|
|
37
|
+
if (can.editArticle) {
|
|
38
|
+
this.deleteHeadshotButton = document.createElement('button');
|
|
39
|
+
this.deleteHeadshotButton.innerHTML = plusIcon;
|
|
40
|
+
this.deleteHeadshotButton.classList.add('headshot-remove-button');
|
|
41
|
+
this.deleteHeadshotButton.setAttribute('data-cy', 'headshot-delete');
|
|
42
|
+
this.deleteHeadshotButton.contentEditable = 'false';
|
|
43
|
+
this.deleteHeadshotButton.addEventListener('click', this.handleDeleteHeadshot);
|
|
44
|
+
this.deleteHeadshotButton.addEventListener('keydown', handleEnterKey(this.handleDeleteHeadshot));
|
|
45
|
+
this.container.appendChild(this.deleteHeadshotButton);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
this.handleDeleteHeadshot = () => {
|
|
49
|
+
const { state, dispatch } = this.view;
|
|
50
|
+
const { tr } = state;
|
|
51
|
+
const pos = this.getPos();
|
|
52
|
+
tr.delete(pos, pos + this.node.nodeSize);
|
|
53
|
+
this.view.focus();
|
|
54
|
+
const $pos = tr.doc.resolve(pos);
|
|
55
|
+
if ($pos.node().nodeSize > 2) {
|
|
56
|
+
tr.setSelection(TextSelection.near(tr.doc.resolve($pos.start()))).scrollIntoView();
|
|
57
|
+
}
|
|
58
|
+
dispatch(tr);
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
initialise() {
|
|
62
|
+
this.createElement();
|
|
63
|
+
this.updateContents();
|
|
64
|
+
}
|
|
65
|
+
destroy() {
|
|
66
|
+
this.deleteHeadshotButton?.removeEventListener('click', this.handleDeleteHeadshot);
|
|
67
|
+
super.destroy();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
export default createNodeView(HeadshotElement);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2026 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 { HeadshotElement } from './headshot_element';
|
|
18
|
+
export default createEditableNodeView(HeadshotElement);
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2026 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 { schema, } from '@manuscripts/transform';
|
|
17
|
+
import { TextSelection } from 'prosemirror-state';
|
|
18
|
+
import { addAuthorIcon } from '../icons';
|
|
19
|
+
import { createKeyboardInteraction, handleEnterKey, } from '../lib/navigation-utils';
|
|
20
|
+
import BlockView from './block_view';
|
|
21
|
+
import { createNodeView } from './creators';
|
|
22
|
+
export class HeadshotGridView extends BlockView {
|
|
23
|
+
constructor() {
|
|
24
|
+
super(...arguments);
|
|
25
|
+
this.elementType = 'div';
|
|
26
|
+
this.createElement = () => {
|
|
27
|
+
this.container = document.createElement('div');
|
|
28
|
+
this.container.classList.add('block', 'headshot-grid-container');
|
|
29
|
+
this.dom.appendChild(this.container);
|
|
30
|
+
this.contentDOM = document.createElement('div');
|
|
31
|
+
this.contentDOM.classList.add('headshot-grid-block');
|
|
32
|
+
this.contentDOM.setAttribute('id', this.node.attrs.id);
|
|
33
|
+
this.removeKeydownListener = createKeyboardInteraction({
|
|
34
|
+
container: this.contentDOM,
|
|
35
|
+
navigation: {
|
|
36
|
+
arrowKeys: { forward: 'ArrowDown', backward: 'ArrowUp' },
|
|
37
|
+
getItems: () => [...(this.contentDOM?.children || [])],
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
this.container.appendChild(this.contentDOM);
|
|
41
|
+
const can = this.props.getCapabilities();
|
|
42
|
+
if (can.editArticle) {
|
|
43
|
+
this.addHeadshotButton = document.createElement('button');
|
|
44
|
+
this.addHeadshotButton.classList.add('add-headshot-element-button');
|
|
45
|
+
this.addHeadshotButton.setAttribute('data-cy', 'headshot-add');
|
|
46
|
+
this.addHeadshotButton.contentEditable = 'false';
|
|
47
|
+
this.addHeadshotButton.innerHTML = addAuthorIcon;
|
|
48
|
+
const buttonText = document.createElement('span');
|
|
49
|
+
buttonText.classList.add('add-headshot-element-text');
|
|
50
|
+
buttonText.innerText = 'Add Headshot';
|
|
51
|
+
this.addHeadshotButton.appendChild(buttonText);
|
|
52
|
+
this.addHeadshotButton.addEventListener('click', this.handleAddHeadshot);
|
|
53
|
+
this.addHeadshotButton.addEventListener('keydown', handleEnterKey(this.handleAddHeadshot));
|
|
54
|
+
this.container.appendChild(this.addHeadshotButton);
|
|
55
|
+
}
|
|
56
|
+
this.dom.appendChild(this.container);
|
|
57
|
+
};
|
|
58
|
+
this.handleAddHeadshot = () => {
|
|
59
|
+
const { state, dispatch } = this.view;
|
|
60
|
+
const { tr } = state;
|
|
61
|
+
const headshotElementNode = schema.nodes.headshot_element.createAndFill();
|
|
62
|
+
const insertPos = this.getPos() + 1;
|
|
63
|
+
tr.insert(insertPos, headshotElementNode);
|
|
64
|
+
this.view.focus();
|
|
65
|
+
tr.setSelection(TextSelection.create(tr.doc, insertPos));
|
|
66
|
+
dispatch(tr.scrollIntoView());
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
destroy() {
|
|
70
|
+
this.addHeadshotButton?.removeEventListener('click', this.handleAddHeadshot);
|
|
71
|
+
this.removeKeydownListener?.();
|
|
72
|
+
super.destroy();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
export default createNodeView(HeadshotGridView);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2026 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 { HeadshotGridView } from './headshot_grid';
|
|
19
|
+
export default createEditableNodeView(EditableBlock(HeadshotGridView));
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2026 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 { addTrackChangesAttributes, addTrackChangesClassNames, } from '@manuscripts/track-changes-plugin';
|
|
17
|
+
import { cameraIcon, plusIcon } from '../icons';
|
|
18
|
+
import { handleEnterKey } from '../lib/navigation-utils';
|
|
19
|
+
import { createEditableNodeView } from './creators';
|
|
20
|
+
import { FigureEditableView } from './figure_editable';
|
|
21
|
+
export class HeadshotImageEditableView extends FigureEditableView {
|
|
22
|
+
constructor() {
|
|
23
|
+
super(...arguments);
|
|
24
|
+
this.ignoreMutation = () => true;
|
|
25
|
+
this.createPlaceholder = () => {
|
|
26
|
+
const element = document.createElement('div');
|
|
27
|
+
element.classList.add('figure', 'placeholder');
|
|
28
|
+
element.tabIndex = 0;
|
|
29
|
+
const instructions = document.createElement('div');
|
|
30
|
+
instructions.classList.add('instructions');
|
|
31
|
+
instructions.innerHTML = `${cameraIcon}<div>Upload<br>photo</div>`;
|
|
32
|
+
element.appendChild(instructions);
|
|
33
|
+
return element;
|
|
34
|
+
};
|
|
35
|
+
this.handleDetachImage = () => {
|
|
36
|
+
const { state, dispatch } = this.view;
|
|
37
|
+
const pos = this.getPos();
|
|
38
|
+
dispatch(state.tr.delete(pos, pos + this.node.nodeSize));
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
createDOM() {
|
|
42
|
+
this.dom = document.createElement('figure');
|
|
43
|
+
this.container = document.createElement('div');
|
|
44
|
+
this.container.className = 'headshot-figure';
|
|
45
|
+
this.container.contentEditable = 'false';
|
|
46
|
+
this.dom.appendChild(this.container);
|
|
47
|
+
}
|
|
48
|
+
addTools() {
|
|
49
|
+
const src = this.node.attrs.src;
|
|
50
|
+
const files = this.props.getFiles();
|
|
51
|
+
const file = src && files.filter((f) => f.id === src)[0];
|
|
52
|
+
const link = file && this.props.fileManagement.previewLink(file);
|
|
53
|
+
const can = this.props.getCapabilities();
|
|
54
|
+
if (can.detachFile && link) {
|
|
55
|
+
this.detachImageButton = document.createElement('button');
|
|
56
|
+
this.detachImageButton.innerHTML = plusIcon;
|
|
57
|
+
this.detachImageButton.classList.add('headshot-remove-button');
|
|
58
|
+
this.detachImageButton.setAttribute('data-cy', 'headshot-image-detach');
|
|
59
|
+
this.detachImageButton.contentEditable = 'false';
|
|
60
|
+
this.detachImageButton.addEventListener('click', this.handleDetachImage);
|
|
61
|
+
this.detachImageButton.addEventListener('keydown', handleEnterKey(this.handleDetachImage));
|
|
62
|
+
this.container.appendChild(this.detachImageButton);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
updateContents() {
|
|
66
|
+
super.updateContents();
|
|
67
|
+
addTrackChangesAttributes(this.node.attrs, this.dom);
|
|
68
|
+
addTrackChangesClassNames(this.node.attrs, this.dom);
|
|
69
|
+
}
|
|
70
|
+
destroy() {
|
|
71
|
+
this.detachImageButton?.removeEventListener('click', this.handleDetachImage);
|
|
72
|
+
super.destroy();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
export default createEditableNodeView(HeadshotImageEditableView);
|
|
@@ -22,6 +22,7 @@ import { createNodeView } from './creators';
|
|
|
22
22
|
export class SupplementView extends BaseNodeView {
|
|
23
23
|
constructor() {
|
|
24
24
|
super(...arguments);
|
|
25
|
+
this.dragAndDropInitialized = false;
|
|
25
26
|
this.ignoreMutation = () => true;
|
|
26
27
|
this.createElement = () => {
|
|
27
28
|
this.dom = document.createElement('div');
|
|
@@ -40,11 +41,25 @@ export class SupplementView extends BaseNodeView {
|
|
|
40
41
|
initialise() {
|
|
41
42
|
this.createElement();
|
|
42
43
|
this.updateContents();
|
|
43
|
-
this.setupDragAndDrop();
|
|
44
44
|
}
|
|
45
45
|
updateContents() {
|
|
46
46
|
super.updateContents();
|
|
47
47
|
this.refreshFileInfo();
|
|
48
|
+
const can = this.props.getCapabilities();
|
|
49
|
+
this.dom.draggable = can.editArticle;
|
|
50
|
+
if (can.editArticle) {
|
|
51
|
+
if (!this.dragAndDropInitialized) {
|
|
52
|
+
this.setupDragAndDrop();
|
|
53
|
+
this.dragAndDropInitialized = true;
|
|
54
|
+
}
|
|
55
|
+
if (!this.dragIcon) {
|
|
56
|
+
this.addDragIcon();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
this.dragIcon?.remove();
|
|
61
|
+
this.dragIcon = undefined;
|
|
62
|
+
}
|
|
48
63
|
}
|
|
49
64
|
getDropSide(element, clientY) {
|
|
50
65
|
const { top, bottom } = element.getBoundingClientRect();
|
package/dist/types/commands.d.ts
CHANGED
|
@@ -51,6 +51,7 @@ export declare const insertTableElementFooter: (tr: Transaction, table: [Manuscr
|
|
|
51
51
|
export declare const insertFootnotesElement: (tr: Transaction, container: [ManuscriptNode, number]) => [FootnotesElementNode, number];
|
|
52
52
|
export declare const insertInlineFootnote: (state: ManuscriptEditorState, dispatch?: Dispatch) => boolean;
|
|
53
53
|
export declare const insertBoxElement: (state: ManuscriptEditorState, dispatch?: Dispatch) => boolean;
|
|
54
|
+
export declare const insertHeadshotGrid: (state: ManuscriptEditorState, dispatch?: Dispatch) => boolean;
|
|
54
55
|
export declare const insertSection: (subsection?: boolean) => (state: ManuscriptEditorState, dispatch?: Dispatch, view?: EditorView) => boolean;
|
|
55
56
|
export declare const insertAbstractSection: (category?: SectionCategory) => (state: ManuscriptEditorState, dispatch?: Dispatch, view?: EditorView) => boolean;
|
|
56
57
|
export declare const insertBackmatterSection: (category: SectionCategory) => (state: ManuscriptEditorState, dispatch?: Dispatch, view?: EditorView) => boolean;
|
package/dist/types/icons.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export declare const addAuthorIcon: string;
|
|
|
2
2
|
export declare const arrowDown: string;
|
|
3
3
|
export declare const arrowUp: string;
|
|
4
4
|
export declare const alertIcon: string;
|
|
5
|
+
export declare const cameraIcon: string;
|
|
5
6
|
export declare const deleteIcon: string;
|
|
6
7
|
export declare const editIcon: string;
|
|
7
8
|
export declare const sectionCategoryIcon: string;
|
package/dist/types/versions.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "3.13.
|
|
1
|
+
export declare const VERSION = "3.13.12";
|
|
2
2
|
export declare const MATHJAX_VERSION = "3.2.2";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2026 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 { HeadshotElementNode } from '@manuscripts/transform';
|
|
17
|
+
import { Trackable } from '../types';
|
|
18
|
+
import { BaseNodeView } from './base_node_view';
|
|
19
|
+
export declare class HeadshotElement extends BaseNodeView<Trackable<HeadshotElementNode>> {
|
|
20
|
+
elementType: string;
|
|
21
|
+
private container;
|
|
22
|
+
private deleteHeadshotButton;
|
|
23
|
+
initialise(): void;
|
|
24
|
+
createElement: () => void;
|
|
25
|
+
private handleDeleteHeadshot;
|
|
26
|
+
destroy(): void;
|
|
27
|
+
}
|
|
28
|
+
declare const _default: (props: import("../configs/ManuscriptsEditor").EditorProps, dispatch?: import("..").Dispatch) => import("../types").NodeViewCreator<HeadshotElement>;
|
|
29
|
+
export default _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2026 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 { HeadshotElement } from './headshot_element';
|
|
17
|
+
declare const _default: (props: import("../configs/ManuscriptsEditor").EditorProps, dispatch?: import("..").Dispatch) => import("../types").NodeViewCreator<HeadshotElement>;
|
|
18
|
+
export default _default;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2026 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 { HeadshotGridNode } from '@manuscripts/transform';
|
|
17
|
+
import BlockView from './block_view';
|
|
18
|
+
export declare class HeadshotGridView extends BlockView<HeadshotGridNode> {
|
|
19
|
+
elementType: string;
|
|
20
|
+
private container;
|
|
21
|
+
private addHeadshotButton;
|
|
22
|
+
private removeKeydownListener?;
|
|
23
|
+
createElement: () => void;
|
|
24
|
+
private handleAddHeadshot;
|
|
25
|
+
destroy(): void;
|
|
26
|
+
}
|
|
27
|
+
declare const _default: (props: import("../configs/ManuscriptsEditor").EditorProps, dispatch?: import("..").Dispatch) => import("../types").NodeViewCreator<HeadshotGridView>;
|
|
28
|
+
export default _default;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2026 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 { HeadshotGridView } from './headshot_grid';
|
|
17
|
+
declare const _default: (props: import("../configs/ManuscriptsEditor").EditorProps, dispatch?: import("..").Dispatch) => 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;
|
|
34
|
+
elementType: string;
|
|
35
|
+
readonly props: import("../configs/ManuscriptsEditor").EditorProps;
|
|
36
|
+
node: import("prosemirror-model").Node;
|
|
37
|
+
readonly view: import("@manuscripts/transform").ManuscriptEditorView;
|
|
38
|
+
readonly getPos: () => number;
|
|
39
|
+
update(newNode: import("@manuscripts/transform").ManuscriptNode): boolean;
|
|
40
|
+
selectNode(): void;
|
|
41
|
+
deselectNode(): void;
|
|
42
|
+
destroy(): void;
|
|
43
|
+
} & HeadshotGridView>;
|
|
44
|
+
export default _default;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2026 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 { FigureEditableView } from './figure_editable';
|
|
17
|
+
export declare class HeadshotImageEditableView extends FigureEditableView {
|
|
18
|
+
private detachImageButton;
|
|
19
|
+
ignoreMutation: () => boolean;
|
|
20
|
+
createDOM(): void;
|
|
21
|
+
addTools(): void;
|
|
22
|
+
updateContents(): void;
|
|
23
|
+
protected createPlaceholder: () => HTMLDivElement;
|
|
24
|
+
private handleDetachImage;
|
|
25
|
+
destroy(): void;
|
|
26
|
+
}
|
|
27
|
+
declare const _default: (props: import("../configs/ManuscriptsEditor").EditorProps, dispatch?: import("..").Dispatch) => import("../types").NodeViewCreator<HeadshotImageEditableView>;
|
|
28
|
+
export default _default;
|
|
@@ -20,6 +20,7 @@ export declare class SupplementView extends BaseNodeView<Trackable<SupplementNod
|
|
|
20
20
|
private supplementInfoEl;
|
|
21
21
|
private static currentDragSupplementId;
|
|
22
22
|
private dragIcon;
|
|
23
|
+
private dragAndDropInitialized;
|
|
23
24
|
ignoreMutation: () => boolean;
|
|
24
25
|
initialise(): void;
|
|
25
26
|
createElement: () => void;
|
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.13.
|
|
4
|
+
"version": "3.13.12",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@citation-js/plugin-pubmed": "0.3.0",
|
|
42
42
|
"@citation-js/plugin-ris": "0.7.18",
|
|
43
43
|
"@iarna/word-count": "1.1.2",
|
|
44
|
-
"@manuscripts/style-guide": "3.6.
|
|
44
|
+
"@manuscripts/style-guide": "3.6.4",
|
|
45
45
|
"@manuscripts/track-changes-plugin": "2.4.0",
|
|
46
46
|
"@manuscripts/transform": "4.4.5",
|
|
47
47
|
"@popperjs/core": "2.11.8",
|