@manuscripts/body-editor 3.13.10 → 3.13.11
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/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 -0
- 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/es/commands.js +18 -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 -0
- 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/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/package.json +2 -2
- package/src/commands.ts +27 -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 -0
- 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/styles/AdvancedEditor.css +169 -1
|
@@ -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);
|
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.11";
|
|
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;
|
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.11",
|
|
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",
|
package/src/commands.ts
CHANGED
|
@@ -925,6 +925,33 @@ export const insertBoxElement = (
|
|
|
925
925
|
return true
|
|
926
926
|
}
|
|
927
927
|
|
|
928
|
+
export const insertHeadshotGrid = (
|
|
929
|
+
state: ManuscriptEditorState,
|
|
930
|
+
dispatch?: Dispatch
|
|
931
|
+
) => {
|
|
932
|
+
const selection = state.selection
|
|
933
|
+
const { nodes } = schema
|
|
934
|
+
|
|
935
|
+
const isBody = hasParentNodeOfType(nodes.body)(selection)
|
|
936
|
+
if (!isBody) {
|
|
937
|
+
return false
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
const position = findBlockInsertPosition(state)
|
|
941
|
+
|
|
942
|
+
if (position && dispatch) {
|
|
943
|
+
const headshotElement =
|
|
944
|
+
schema.nodes.headshot_element.createAndFill() as ManuscriptNode
|
|
945
|
+
const node = nodes.headshot_grid.create({}, headshotElement)
|
|
946
|
+
const tr = state.tr.insert(position, node)
|
|
947
|
+
const headshotNamePosition = position + 2
|
|
948
|
+
tr.setSelection(TextSelection.create(tr.doc, headshotNamePosition))
|
|
949
|
+
dispatch(tr.scrollIntoView())
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
return true
|
|
953
|
+
}
|
|
954
|
+
|
|
928
955
|
export const insertSection =
|
|
929
956
|
(subsection = false) =>
|
|
930
957
|
(state: ManuscriptEditorState, dispatch?: Dispatch, view?: EditorView) => {
|
|
@@ -45,6 +45,9 @@ import footnote from '../views/footnote'
|
|
|
45
45
|
import footnotesElement from '../views/footnotes_element'
|
|
46
46
|
import generalTableFootnote from '../views/general_table_footnote'
|
|
47
47
|
import heroImage from '../views/hero_image_editable'
|
|
48
|
+
import headshotGrid from '../views/headshot_grid_editable'
|
|
49
|
+
import headshotElement from '../views/headshot_element'
|
|
50
|
+
import headshotImage from '../views/headshot_image_editable'
|
|
48
51
|
import imageElement from '../views/image_element_editable'
|
|
49
52
|
import inlineEquation from '../views/inline_equation_editable'
|
|
50
53
|
import inlineFootnote from '../views/inline_footnote_editable'
|
|
@@ -130,6 +133,9 @@ export default (
|
|
|
130
133
|
long_desc: accessibilityElement(props, dispatch),
|
|
131
134
|
alt_text: accessibilityElement(props, dispatch),
|
|
132
135
|
hero_image: heroImage(props, dispatch),
|
|
136
|
+
headshot_grid: headshotGrid(props, dispatch),
|
|
137
|
+
headshot_element: headshotElement(props, dispatch),
|
|
138
|
+
headshot_image: headshotImage(props, dispatch),
|
|
133
139
|
abstracts: abstracts(props),
|
|
134
140
|
trans_abstract: transAbstract(props),
|
|
135
141
|
trans_graphical_abstract: transGraphicalAbstract(props),
|
package/src/icons.ts
CHANGED
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
AlertIcon,
|
|
19
19
|
ArrowDownCircleIcon,
|
|
20
20
|
ArrowUpIcon,
|
|
21
|
+
CameraIcon,
|
|
21
22
|
DeleteIcon,
|
|
22
23
|
DraggableIcon,
|
|
23
24
|
EditIcon,
|
|
@@ -44,6 +45,7 @@ export const addAuthorIcon = renderIcon(AddAuthorIcon)
|
|
|
44
45
|
export const arrowDown = renderIcon(ArrowDownCircleIcon)
|
|
45
46
|
export const arrowUp = renderIcon(ArrowUpIcon)
|
|
46
47
|
export const alertIcon = renderIcon(AlertIcon)
|
|
48
|
+
export const cameraIcon = renderIcon(CameraIcon)
|
|
47
49
|
export const deleteIcon = renderIcon(DeleteIcon)
|
|
48
50
|
export const editIcon = renderIcon(EditIcon)
|
|
49
51
|
export const sectionCategoryIcon = renderIcon(SectionCategoryIcon)
|
package/src/lib/files.ts
CHANGED
|
@@ -69,6 +69,7 @@ const figureTypes = [
|
|
|
69
69
|
schema.nodes.figure_element,
|
|
70
70
|
schema.nodes.image_element,
|
|
71
71
|
schema.nodes.hero_image,
|
|
72
|
+
schema.nodes.headshot_grid,
|
|
72
73
|
schema.nodes.embed,
|
|
73
74
|
]
|
|
74
75
|
|
|
@@ -119,7 +120,12 @@ export const groupFiles = (
|
|
|
119
120
|
})
|
|
120
121
|
}
|
|
121
122
|
} else {
|
|
122
|
-
|
|
123
|
+
const descend = node.type === schema.nodes.headshot_grid
|
|
124
|
+
const figureNodeType =
|
|
125
|
+
node.type === schema.nodes.headshot_grid
|
|
126
|
+
? schema.nodes.headshot_image
|
|
127
|
+
: schema.nodes.figure
|
|
128
|
+
for (const figure of findChildrenByType(node, figureNodeType, descend)) {
|
|
123
129
|
if (isHidden(figure.node)) {
|
|
124
130
|
continue
|
|
125
131
|
}
|
package/src/menus.tsx
CHANGED
|
@@ -40,6 +40,7 @@ import {
|
|
|
40
40
|
insertCrossReference,
|
|
41
41
|
insertEmbed,
|
|
42
42
|
insertGraphicalAbstract,
|
|
43
|
+
insertHeadshotGrid,
|
|
43
44
|
insertHeroImage,
|
|
44
45
|
insertInlineCitation,
|
|
45
46
|
insertInlineEquation,
|
|
@@ -333,6 +334,15 @@ export const getEditorMenus = (
|
|
|
333
334
|
run: doCommand(insertBoxElement),
|
|
334
335
|
isHidden: !templateAllows(state, schema.nodes.box_element),
|
|
335
336
|
},
|
|
337
|
+
{
|
|
338
|
+
id: 'insert-headshot-grid',
|
|
339
|
+
label: 'Headshot Panel',
|
|
340
|
+
isEnabled:
|
|
341
|
+
isEditAllowed(state) &&
|
|
342
|
+
isCommandValid(canInsert(schema.nodes.headshot_grid)),
|
|
343
|
+
run: doCommand(insertHeadshotGrid),
|
|
344
|
+
isHidden: !templateAllows(state, schema.nodes.headshot_grid),
|
|
345
|
+
},
|
|
336
346
|
{
|
|
337
347
|
role: 'separator',
|
|
338
348
|
},
|
package/src/node-type-icons.tsx
CHANGED
|
@@ -15,9 +15,11 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import {
|
|
18
|
+
AvatarIcon,
|
|
18
19
|
FileDocumentIcon,
|
|
19
20
|
SupplementsIcon,
|
|
20
21
|
FileImageIcon,
|
|
22
|
+
FileHeadshotGridIcon,
|
|
21
23
|
OutlineBlockQuoteIcon,
|
|
22
24
|
OutlineEmbedIcon,
|
|
23
25
|
OutlineEquationIcon,
|
|
@@ -36,6 +38,14 @@ import React from 'react'
|
|
|
36
38
|
|
|
37
39
|
const { nodes } = schema
|
|
38
40
|
|
|
41
|
+
const OutlineHeadshotGridIcon: React.FC = () => (
|
|
42
|
+
<FileHeadshotGridIcon width="12" height="12" />
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
const OutlineHeadshotElementIcon: React.FC = () => (
|
|
46
|
+
<AvatarIcon width="16" height="16" />
|
|
47
|
+
)
|
|
48
|
+
|
|
39
49
|
const OutlineImageIcon: React.FC = () => (
|
|
40
50
|
<FileImageIcon width="11" height="14" />
|
|
41
51
|
)
|
|
@@ -67,6 +77,8 @@ const icons: Map<
|
|
|
67
77
|
[nodes.hero_image, OutlineImageIcon],
|
|
68
78
|
[nodes.supplements, OutlineSupplementsIcon],
|
|
69
79
|
[nodes.attachments, OutlineMainDocumentIcon],
|
|
80
|
+
[nodes.headshot_grid, OutlineHeadshotGridIcon],
|
|
81
|
+
[nodes.headshot_element, OutlineHeadshotElementIcon],
|
|
70
82
|
])
|
|
71
83
|
|
|
72
84
|
export const nodeTypeIcon = (nodeType: NodeType, listType?: string) => {
|
|
@@ -71,7 +71,10 @@ const isSelectionWithin = (
|
|
|
71
71
|
const buildExpandButtonDecorations = (doc: ManuscriptNode) => {
|
|
72
72
|
const decorations: Decoration[] = []
|
|
73
73
|
doc.descendants((node, pos) => {
|
|
74
|
-
if (
|
|
74
|
+
if (
|
|
75
|
+
node.type !== schema.nodes.headshot_element &&
|
|
76
|
+
node.type.spec.content?.includes('alt_text')
|
|
77
|
+
) {
|
|
75
78
|
decorations.push(
|
|
76
79
|
Decoration.widget(
|
|
77
80
|
pos + node.nodeSize - 1,
|
package/src/versions.ts
CHANGED
|
@@ -19,11 +19,18 @@ import { TextSelection } from 'prosemirror-state'
|
|
|
19
19
|
import { createKeyboardInteraction } from '../lib/navigation-utils'
|
|
20
20
|
import BlockView from './block_view'
|
|
21
21
|
import { createNodeView } from './creators'
|
|
22
|
+
import empty from './empty'
|
|
22
23
|
export class AccessibilityElementView extends BlockView<LongDescNode> {
|
|
23
24
|
public contentDOM: HTMLElement
|
|
24
25
|
private removeKeydownListener?: () => void
|
|
25
26
|
|
|
26
27
|
public initialise() {
|
|
28
|
+
const $pos = this.view.state.doc.resolve(this.getPos())
|
|
29
|
+
if ($pos.parent.type === schema.nodes.headshot_element) {
|
|
30
|
+
const { dom } = empty('accessibility_element')()
|
|
31
|
+
this.dom = dom
|
|
32
|
+
return
|
|
33
|
+
}
|
|
27
34
|
this.createDOM()
|
|
28
35
|
this.createElement()
|
|
29
36
|
this.updateContents()
|