@manuscripts/body-editor 3.8.1 → 3.8.3
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 +25 -2
- package/dist/cjs/components/LanguageDropdown/index.js +3 -2
- package/dist/cjs/components/references/ImportBibliographyModal.js +2 -2
- package/dist/cjs/configs/editor-plugins.js +2 -0
- package/dist/cjs/icons.js +13 -13
- package/dist/{es/components/LanguageDropdown → cjs/lib}/languages.js +10 -10
- package/dist/cjs/lib/popper.js +1 -0
- package/dist/cjs/plugins/section_category.js +1 -1
- package/dist/cjs/plugins/translations.js +96 -0
- package/dist/cjs/versions.js +1 -1
- package/dist/cjs/views/figure_element.js +1 -1
- package/dist/cjs/views/section.js +0 -80
- package/dist/cjs/views/translated_abstract.js +0 -66
- package/dist/es/commands.js +22 -0
- package/dist/es/components/LanguageDropdown/index.js +3 -2
- package/dist/es/components/references/ImportBibliographyModal.js +2 -2
- package/dist/es/configs/editor-plugins.js +2 -0
- package/dist/es/icons.js +13 -13
- package/dist/{cjs/components/LanguageDropdown → es/lib}/languages.js +5 -15
- package/dist/es/lib/popper.js +1 -0
- package/dist/es/plugins/section_category.js +1 -1
- package/dist/es/plugins/translations.js +94 -0
- package/dist/es/versions.js +1 -1
- package/dist/es/views/figure_element.js +2 -2
- package/dist/es/views/section.js +0 -80
- package/dist/es/views/translated_abstract.js +0 -66
- package/dist/types/commands.d.ts +1 -0
- package/dist/types/components/LanguageDropdown/index.d.ts +1 -1
- package/dist/types/configs/ManuscriptsEditor.d.ts +1 -1
- package/dist/types/icons.d.ts +1 -1
- package/dist/types/{components/LanguageDropdown → lib}/languages.d.ts +2 -11
- package/dist/types/plugins/translations.d.ts +19 -0
- package/dist/types/versions.d.ts +1 -1
- package/dist/types/views/section.d.ts +0 -7
- package/dist/types/views/translated_abstract.d.ts +0 -11
- package/package.json +2 -2
- package/styles/AdvancedEditor.css +52 -53
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/*!
|
|
3
2
|
* © 2025 Atypon Systems LLC
|
|
4
3
|
*
|
|
@@ -14,25 +13,16 @@
|
|
|
14
13
|
* See the License for the specific language governing permissions and
|
|
15
14
|
* limitations under the License.
|
|
16
15
|
*/
|
|
17
|
-
|
|
18
|
-
exports.getLanguageDisplayName = exports.getSelectedLanguageName = exports.ENGLISH_FALLBACK = void 0;
|
|
19
|
-
exports.ENGLISH_FALLBACK = {
|
|
16
|
+
const ENGLISH = {
|
|
20
17
|
code: 'en',
|
|
21
18
|
name: 'English',
|
|
22
19
|
nativeName: 'English',
|
|
23
20
|
};
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const language = allLanguages.find((lang) => lang.code === selectedLanguage) ||
|
|
29
|
-
exports.ENGLISH_FALLBACK;
|
|
21
|
+
export const getLanguage = (code, languages) => {
|
|
22
|
+
return languages.find((l) => l.code === code) || ENGLISH;
|
|
23
|
+
};
|
|
24
|
+
export const getLanguageLabel = (language) => {
|
|
30
25
|
return language.nativeName && language.nativeName !== language.name
|
|
31
26
|
? `${language.name} (${language.nativeName})`
|
|
32
27
|
: language.name;
|
|
33
28
|
};
|
|
34
|
-
exports.getSelectedLanguageName = getSelectedLanguageName;
|
|
35
|
-
const getLanguageDisplayName = (languageCode) => {
|
|
36
|
-
return languageCode.toUpperCase();
|
|
37
|
-
};
|
|
38
|
-
exports.getLanguageDisplayName = getLanguageDisplayName;
|
package/dist/es/lib/popper.js
CHANGED
|
@@ -0,0 +1,94 @@
|
|
|
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 { schema } from '@manuscripts/transform';
|
|
17
|
+
import { Plugin } from 'prosemirror-state';
|
|
18
|
+
import { Decoration, DecorationSet } from 'prosemirror-view';
|
|
19
|
+
import { insertTransAbstract } from '../commands';
|
|
20
|
+
import { addAuthorIcon, translateIcon } from '../icons';
|
|
21
|
+
import { getLanguage, getLanguageLabel } from '../lib/languages';
|
|
22
|
+
const createMenuItem = (props, contents, handler, isSelected = false) => {
|
|
23
|
+
const item = document.createElement('div');
|
|
24
|
+
item.className = `menu-item ${isSelected ? 'selected' : ''}`;
|
|
25
|
+
item.textContent = contents;
|
|
26
|
+
item.addEventListener('mousedown', (event) => {
|
|
27
|
+
handler(event);
|
|
28
|
+
props.popper.destroy();
|
|
29
|
+
});
|
|
30
|
+
return item;
|
|
31
|
+
};
|
|
32
|
+
const createLanguageMenu = (props, selectedCode, onSelect) => {
|
|
33
|
+
const menu = document.createElement('div');
|
|
34
|
+
menu.className = 'language menu';
|
|
35
|
+
props.languages.forEach((language) => {
|
|
36
|
+
const item = createMenuItem(props, getLanguageLabel(language), () => onSelect(language.code), selectedCode === language.code);
|
|
37
|
+
menu.appendChild(item);
|
|
38
|
+
});
|
|
39
|
+
return menu;
|
|
40
|
+
};
|
|
41
|
+
export default (props) => new Plugin({
|
|
42
|
+
props: {
|
|
43
|
+
decorations: (state) => {
|
|
44
|
+
const can = props.getCapabilities();
|
|
45
|
+
const canEdit = can.editArticle && insertTransAbstract(state);
|
|
46
|
+
const widgets = [];
|
|
47
|
+
state.doc.descendants((node, pos, parent) => {
|
|
48
|
+
if (node.type === schema.nodes.section &&
|
|
49
|
+
parent?.type === schema.nodes.abstracts &&
|
|
50
|
+
canEdit) {
|
|
51
|
+
widgets.push(Decoration.widget(pos + 1, (view) => {
|
|
52
|
+
const $span = document.createElement('span');
|
|
53
|
+
$span.className = 'add-trans-abstract';
|
|
54
|
+
$span.title = 'Add translation';
|
|
55
|
+
$span.innerHTML = `${addAuthorIcon} <span class="add-trans-abstract-text">Add translation</span>`;
|
|
56
|
+
$span.addEventListener('mousedown', (event) => {
|
|
57
|
+
event.preventDefault();
|
|
58
|
+
event.stopPropagation();
|
|
59
|
+
insertTransAbstract(view.state, view.dispatch, node.attrs.category);
|
|
60
|
+
});
|
|
61
|
+
return $span;
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
if (node.type === schema.nodes.trans_abstract) {
|
|
65
|
+
widgets.push(Decoration.widget(pos + 1, (view) => {
|
|
66
|
+
const $btn = document.createElement('span');
|
|
67
|
+
$btn.className = 'language-selector-btn';
|
|
68
|
+
$btn.setAttribute('data-cy', 'language-selector-btn');
|
|
69
|
+
$btn.contentEditable = 'false';
|
|
70
|
+
const code = node.attrs.lang || 'en';
|
|
71
|
+
const lang = getLanguage(code, props.languages);
|
|
72
|
+
const label = getLanguageLabel(lang);
|
|
73
|
+
$btn.innerHTML = `<span>${label}</span> ${translateIcon}`;
|
|
74
|
+
if (canEdit) {
|
|
75
|
+
$btn.addEventListener('mousedown', (event) => {
|
|
76
|
+
event.preventDefault();
|
|
77
|
+
event.stopPropagation();
|
|
78
|
+
props.popper.destroy();
|
|
79
|
+
const handleSelect = (code) => {
|
|
80
|
+
const tr = view.state.tr.setNodeAttribute(pos, 'lang', code);
|
|
81
|
+
view.dispatch(tr);
|
|
82
|
+
};
|
|
83
|
+
const menu = createLanguageMenu(props, code, handleSelect);
|
|
84
|
+
props.popper.show($btn, menu, 'bottom-end', false);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
return $btn;
|
|
88
|
+
}));
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
return DecorationSet.create(state.doc, widgets);
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
});
|
package/dist/es/versions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '3.8.
|
|
1
|
+
export const VERSION = '3.8.3';
|
|
2
2
|
export const MATHJAX_VERSION = '3.2.2';
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { schema } from '@manuscripts/transform';
|
|
17
17
|
import { TextSelection } from 'prosemirror-state';
|
|
18
|
-
import {
|
|
18
|
+
import { addAuthorIcon } from '../icons';
|
|
19
19
|
import { createNodeView } from './creators';
|
|
20
20
|
import { ImageElementView } from './image_element';
|
|
21
21
|
export class FigureElementView extends ImageElementView {
|
|
@@ -67,7 +67,7 @@ export class FigureElementView extends ImageElementView {
|
|
|
67
67
|
if (this.props.getCapabilities()?.editArticle) {
|
|
68
68
|
this.addFigureBtn = Object.assign(document.createElement('button'), {
|
|
69
69
|
className: 'add-button',
|
|
70
|
-
innerHTML:
|
|
70
|
+
innerHTML: addAuthorIcon,
|
|
71
71
|
title: 'Add figure',
|
|
72
72
|
});
|
|
73
73
|
this.addFigureBtn.addEventListener('click', () => this.addFigure());
|
package/dist/es/views/section.js
CHANGED
|
@@ -13,10 +13,6 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { schema } from '@manuscripts/transform';
|
|
17
|
-
import { TextSelection } from 'prosemirror-state';
|
|
18
|
-
import { findParentNodeOfTypeClosestToPos } from 'prosemirror-utils';
|
|
19
|
-
import { addBtnIcon } from '../icons';
|
|
20
16
|
import { sectionTitleKey } from '../plugins/section_title';
|
|
21
17
|
import BlockView from './block_view';
|
|
22
18
|
import { createNodeView } from './creators';
|
|
@@ -24,26 +20,6 @@ export class SectionView extends BlockView {
|
|
|
24
20
|
constructor() {
|
|
25
21
|
super(...arguments);
|
|
26
22
|
this.elementType = 'section';
|
|
27
|
-
this.addTranslationButton = null;
|
|
28
|
-
this.addTranslation = () => {
|
|
29
|
-
const { state } = this.view;
|
|
30
|
-
const { schema } = state;
|
|
31
|
-
const documentLanguage = state.doc.attrs.primaryLanguageCode || 'en';
|
|
32
|
-
const sectionTitle = schema.nodes.section_title.create();
|
|
33
|
-
const paragraph = schema.nodes.paragraph.create();
|
|
34
|
-
const transAbstractNode = schema.nodes.trans_abstract.create({
|
|
35
|
-
lang: documentLanguage,
|
|
36
|
-
category: this.node.attrs.category,
|
|
37
|
-
}, [sectionTitle, paragraph]);
|
|
38
|
-
const abstracts = findParentNodeOfTypeClosestToPos(this.view.state.doc.resolve(this.getPos()), schema.nodes.abstracts);
|
|
39
|
-
if (abstracts) {
|
|
40
|
-
const tr = state.tr.insert(abstracts.pos + abstracts.node.nodeSize - 1, transAbstractNode);
|
|
41
|
-
const titlePos = abstracts.pos + abstracts.node.nodeSize;
|
|
42
|
-
const selection = TextSelection.create(tr.doc, titlePos);
|
|
43
|
-
tr.setSelection(selection).scrollIntoView();
|
|
44
|
-
this.view.dispatch(tr);
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
23
|
}
|
|
48
24
|
initialise() {
|
|
49
25
|
this.createDOM();
|
|
@@ -58,7 +34,6 @@ export class SectionView extends BlockView {
|
|
|
58
34
|
super.updateContents();
|
|
59
35
|
this.dom.setAttribute('data-category', this.node.attrs.category);
|
|
60
36
|
this.handleSectionNumbering();
|
|
61
|
-
this.handleAddTranslationButton();
|
|
62
37
|
}
|
|
63
38
|
handleSectionNumbering() {
|
|
64
39
|
const sections = sectionTitleKey.getState(this.view.state);
|
|
@@ -73,62 +48,7 @@ export class SectionView extends BlockView {
|
|
|
73
48
|
}
|
|
74
49
|
});
|
|
75
50
|
}
|
|
76
|
-
handleAddTranslationButton() {
|
|
77
|
-
this.cleanupAddTranslationButton();
|
|
78
|
-
const $pos = this.view.state.doc.resolve(this.getPos());
|
|
79
|
-
const isInAbstracts = findParentNodeOfTypeClosestToPos($pos, schema.nodes.abstracts);
|
|
80
|
-
const isAbstractCategory = this.isAbstractCategory(this.node.attrs.category);
|
|
81
|
-
if (isInAbstracts &&
|
|
82
|
-
isAbstractCategory &&
|
|
83
|
-
this.props.getCapabilities()?.editArticle) {
|
|
84
|
-
this.createAddTranslationButton();
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
isAbstractCategory(category) {
|
|
88
|
-
const sectionCategories = this.props.sectionCategories;
|
|
89
|
-
if (!sectionCategories) {
|
|
90
|
-
return false;
|
|
91
|
-
}
|
|
92
|
-
const categoryObj = sectionCategories.get(category);
|
|
93
|
-
if (!categoryObj) {
|
|
94
|
-
return false;
|
|
95
|
-
}
|
|
96
|
-
return (categoryObj.group === 'abstracts' ||
|
|
97
|
-
categoryObj.group === 'abstracts-graphic');
|
|
98
|
-
}
|
|
99
|
-
createAddTranslationButton() {
|
|
100
|
-
const btnContainer = document.createElement('div');
|
|
101
|
-
btnContainer.classList.add('add-translation-container');
|
|
102
|
-
btnContainer.addEventListener('mousedown', (event) => {
|
|
103
|
-
event.preventDefault();
|
|
104
|
-
event.stopPropagation();
|
|
105
|
-
this.addTranslation();
|
|
106
|
-
});
|
|
107
|
-
const addTranslationBtn = Object.assign(document.createElement('button'), {
|
|
108
|
-
className: 'add-button',
|
|
109
|
-
innerHTML: addBtnIcon,
|
|
110
|
-
title: 'Add Translation',
|
|
111
|
-
type: 'button',
|
|
112
|
-
});
|
|
113
|
-
const textElement = document.createElement('span');
|
|
114
|
-
textElement.textContent = 'Add translation';
|
|
115
|
-
textElement.classList.add('add-translation-text');
|
|
116
|
-
btnContainer.appendChild(addTranslationBtn);
|
|
117
|
-
btnContainer.appendChild(textElement);
|
|
118
|
-
this.dom.appendChild(btnContainer);
|
|
119
|
-
this.addTranslationButton = addTranslationBtn;
|
|
120
|
-
}
|
|
121
|
-
cleanupAddTranslationButton() {
|
|
122
|
-
if (this.addTranslationButton) {
|
|
123
|
-
const container = this.addTranslationButton.closest('.add-translation-container');
|
|
124
|
-
if (container) {
|
|
125
|
-
container.remove();
|
|
126
|
-
}
|
|
127
|
-
this.addTranslationButton = null;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
51
|
destroy() {
|
|
131
|
-
this.cleanupAddTranslationButton();
|
|
132
52
|
super.destroy();
|
|
133
53
|
}
|
|
134
54
|
}
|
|
@@ -13,27 +13,12 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import LanguageDropdown from '../components/LanguageDropdown';
|
|
17
|
-
import { getSelectedLanguageName } from '../components/LanguageDropdown/languages';
|
|
18
|
-
import { translateIcon } from '../icons';
|
|
19
16
|
import BlockView from './block_view';
|
|
20
17
|
import { createNodeView } from './creators';
|
|
21
|
-
import ReactSubView from './ReactSubView';
|
|
22
18
|
export class TransAbstractView extends BlockView {
|
|
23
19
|
constructor() {
|
|
24
20
|
super(...arguments);
|
|
25
21
|
this.elementType = 'section';
|
|
26
|
-
this.languageButton = null;
|
|
27
|
-
this.handleButtonClick = (e) => {
|
|
28
|
-
e.stopPropagation();
|
|
29
|
-
if (this.languageButton) {
|
|
30
|
-
this.showLanguageDropdown(this.languageButton);
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
this.handleLanguageChange = (languageCode) => {
|
|
34
|
-
this.updateNodeLanguage(languageCode);
|
|
35
|
-
this.updateButtonContent(languageCode);
|
|
36
|
-
};
|
|
37
22
|
}
|
|
38
23
|
createDOM() {
|
|
39
24
|
super.createDOM();
|
|
@@ -48,11 +33,6 @@ export class TransAbstractView extends BlockView {
|
|
|
48
33
|
updateContents() {
|
|
49
34
|
super.updateContents();
|
|
50
35
|
this.updateAttributes();
|
|
51
|
-
this.handleLanguageSelector();
|
|
52
|
-
}
|
|
53
|
-
destroy() {
|
|
54
|
-
this.cleanupLanguageButton();
|
|
55
|
-
super.destroy();
|
|
56
36
|
}
|
|
57
37
|
updateAttributes() {
|
|
58
38
|
if (this.contentDOM && this.node.attrs.lang) {
|
|
@@ -62,51 +42,5 @@ export class TransAbstractView extends BlockView {
|
|
|
62
42
|
this.dom.setAttribute('data-category', this.node.attrs.category);
|
|
63
43
|
}
|
|
64
44
|
}
|
|
65
|
-
handleLanguageSelector() {
|
|
66
|
-
this.cleanupLanguageButton();
|
|
67
|
-
if (this.props.getCapabilities()?.editArticle) {
|
|
68
|
-
this.createLanguageButton();
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
createLanguageButton() {
|
|
72
|
-
this.languageButton = document.createElement('button');
|
|
73
|
-
this.languageButton.classList.add('language-selector-btn');
|
|
74
|
-
this.languageButton.setAttribute('data-cy', 'language-selector-btn');
|
|
75
|
-
this.updateButtonContent();
|
|
76
|
-
this.languageButton.addEventListener('click', this.handleButtonClick);
|
|
77
|
-
this.dom.prepend(this.languageButton);
|
|
78
|
-
}
|
|
79
|
-
cleanupLanguageButton() {
|
|
80
|
-
if (this.languageButton) {
|
|
81
|
-
this.languageButton.removeEventListener('click', this.handleButtonClick);
|
|
82
|
-
this.languageButton.remove();
|
|
83
|
-
this.languageButton = null;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
updateButtonContent(languageCode = this.node.attrs.lang || 'en') {
|
|
87
|
-
if (!this.languageButton) {
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
const languageName = getSelectedLanguageName(languageCode, this.props.languages || []);
|
|
91
|
-
this.languageButton.innerHTML = `${languageName} ${translateIcon}`;
|
|
92
|
-
}
|
|
93
|
-
showLanguageDropdown(trigger) {
|
|
94
|
-
const currentLanguage = this.node.attrs.lang || 'en';
|
|
95
|
-
this.props.popper.show(trigger, this.createDropdownContainer(currentLanguage), 'bottom-start', false);
|
|
96
|
-
}
|
|
97
|
-
createDropdownContainer(currentLanguage) {
|
|
98
|
-
return ReactSubView(this.props, LanguageDropdown, {
|
|
99
|
-
showButton: false,
|
|
100
|
-
currentLanguage,
|
|
101
|
-
onLanguageSelect: this.handleLanguageChange,
|
|
102
|
-
}, this.node, this.getPos.bind(this), this.view, ['abstracts-language-dropdown']);
|
|
103
|
-
}
|
|
104
|
-
updateNodeLanguage(languageCode) {
|
|
105
|
-
const tr = this.view.state.tr.setNodeMarkup(this.getPos(), undefined, {
|
|
106
|
-
...this.node.attrs,
|
|
107
|
-
lang: languageCode,
|
|
108
|
-
});
|
|
109
|
-
this.view.dispatch(tr);
|
|
110
|
-
}
|
|
111
45
|
}
|
|
112
46
|
export default createNodeView(TransAbstractView);
|
package/dist/types/commands.d.ts
CHANGED
|
@@ -61,6 +61,7 @@ export declare const insertKeywords: (state: ManuscriptEditorState, dispatch?: D
|
|
|
61
61
|
export declare const insertList: (type: ManuscriptNodeType, style?: string) => (state: ManuscriptEditorState, dispatch?: Dispatch, view?: EditorView) => boolean;
|
|
62
62
|
export declare const insertBibliographySection: () => boolean;
|
|
63
63
|
export declare const insertTOCSection: () => boolean;
|
|
64
|
+
export declare const insertTransAbstract: (state: ManuscriptEditorState, dispatch?: Dispatch, category?: string) => boolean;
|
|
64
65
|
export declare const isAtStartOfTextBlock: (state: ManuscriptEditorState, $cursor: ResolvedPos, view?: ManuscriptEditorView) => boolean;
|
|
65
66
|
export declare const isTextSelection: (selection: Selection) => selection is ManuscriptTextSelection;
|
|
66
67
|
export declare const ignoreAtomBlockNodeBackward: (state: ManuscriptEditorState, dispatch?: Dispatch, view?: ManuscriptEditorView) => boolean;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import React from 'react';
|
|
17
|
-
import { Language } from '
|
|
17
|
+
import { Language } from '../../lib/languages';
|
|
18
18
|
interface LanguageDropdownProps {
|
|
19
19
|
onLanguageSelect: (languageCode: string) => void;
|
|
20
20
|
onClose?: () => void;
|
|
@@ -22,7 +22,7 @@ import { Location, NavigateFunction } from 'react-router-dom';
|
|
|
22
22
|
import { DefaultTheme } from 'styled-components';
|
|
23
23
|
import { CollabProvider } from '../classes/collabProvider';
|
|
24
24
|
import { Dispatch } from '../commands';
|
|
25
|
-
import { Language } from '../
|
|
25
|
+
import { Language } from '../lib/languages';
|
|
26
26
|
import { Capabilities } from '../lib/capabilities';
|
|
27
27
|
import { FileAttachment, FileManagement } from '../lib/files';
|
|
28
28
|
import { PopperManager } from '../lib/popper';
|
package/dist/types/icons.d.ts
CHANGED
|
@@ -8,7 +8,6 @@ export declare const sectionCategoryIcon: string;
|
|
|
8
8
|
export declare const scrollIcon: string;
|
|
9
9
|
export declare const lockIcon: string;
|
|
10
10
|
export declare const plusIcon: string;
|
|
11
|
-
export declare const addBtnIcon: string;
|
|
12
11
|
export declare const imageRightIcon: string;
|
|
13
12
|
export declare const imageLeftIcon: string;
|
|
14
13
|
export declare const imageDefaultIcon: string;
|
|
@@ -17,3 +16,4 @@ export declare const draggableIcon: string;
|
|
|
17
16
|
export declare const translateIcon: string;
|
|
18
17
|
export declare const linkIcon: string;
|
|
19
18
|
export declare const fileMainDocumentIcon: string;
|
|
19
|
+
export declare const tickIcon: string;
|
|
@@ -18,14 +18,5 @@ export interface Language {
|
|
|
18
18
|
name: string;
|
|
19
19
|
nativeName: string;
|
|
20
20
|
}
|
|
21
|
-
export declare const
|
|
22
|
-
|
|
23
|
-
name: string;
|
|
24
|
-
nativeName: string;
|
|
25
|
-
};
|
|
26
|
-
export declare const getSelectedLanguageName: (selectedLanguage: string, allLanguages: Array<{
|
|
27
|
-
code: string;
|
|
28
|
-
name: string;
|
|
29
|
-
nativeName?: string;
|
|
30
|
-
}>) => string;
|
|
31
|
-
export declare const getLanguageDisplayName: (languageCode: string) => string;
|
|
21
|
+
export declare const getLanguage: (code: string, languages: Language[]) => Language;
|
|
22
|
+
export declare const getLanguageLabel: (language: Language) => string;
|
|
@@ -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 { Plugin } from 'prosemirror-state';
|
|
17
|
+
import { EditorProps } from '../configs/ManuscriptsEditor';
|
|
18
|
+
declare const _default: (props: EditorProps) => Plugin<null>;
|
|
19
|
+
export default _default;
|
package/dist/types/versions.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "3.8.
|
|
1
|
+
export declare const VERSION = "3.8.3";
|
|
2
2
|
export declare const MATHJAX_VERSION = "3.2.2";
|
|
@@ -17,17 +17,10 @@ import { SectionNode } from '@manuscripts/transform';
|
|
|
17
17
|
import BlockView from './block_view';
|
|
18
18
|
export declare class SectionView extends BlockView<SectionNode> {
|
|
19
19
|
elementType: string;
|
|
20
|
-
element: HTMLElement;
|
|
21
|
-
private addTranslationButton;
|
|
22
20
|
initialise(): void;
|
|
23
21
|
createElement(): void;
|
|
24
22
|
updateContents(): void;
|
|
25
23
|
handleSectionNumbering(): void;
|
|
26
|
-
private handleAddTranslationButton;
|
|
27
|
-
private isAbstractCategory;
|
|
28
|
-
private createAddTranslationButton;
|
|
29
|
-
private cleanupAddTranslationButton;
|
|
30
|
-
private addTranslation;
|
|
31
24
|
destroy(): void;
|
|
32
25
|
}
|
|
33
26
|
declare const _default: (props: import("../configs/ManuscriptsEditor").EditorProps, dispatch?: import("..").Dispatch) => import("../types").NodeViewCreator<SectionView>;
|
|
@@ -18,21 +18,10 @@ import { Trackable } from '../types';
|
|
|
18
18
|
import BlockView from './block_view';
|
|
19
19
|
export declare class TransAbstractView extends BlockView<Trackable<TransAbstractNode>> {
|
|
20
20
|
elementType: string;
|
|
21
|
-
private languageButton;
|
|
22
21
|
createDOM(): void;
|
|
23
22
|
createElement(): void;
|
|
24
23
|
updateContents(): void;
|
|
25
|
-
destroy(): void;
|
|
26
24
|
private updateAttributes;
|
|
27
|
-
private handleLanguageSelector;
|
|
28
|
-
private createLanguageButton;
|
|
29
|
-
private cleanupLanguageButton;
|
|
30
|
-
private updateButtonContent;
|
|
31
|
-
private handleButtonClick;
|
|
32
|
-
private showLanguageDropdown;
|
|
33
|
-
private createDropdownContainer;
|
|
34
|
-
private handleLanguageChange;
|
|
35
|
-
private updateNodeLanguage;
|
|
36
25
|
}
|
|
37
26
|
declare const _default: (props: import("../configs/ManuscriptsEditor").EditorProps, dispatch?: import("..").Dispatch) => import("../types").NodeViewCreator<TransAbstractView>;
|
|
38
27
|
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.8.
|
|
4
|
+
"version": "3.8.3",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@manuscripts/json-schema": "2.2.12",
|
|
41
41
|
"@manuscripts/style-guide": "3.4.0",
|
|
42
42
|
"@manuscripts/track-changes-plugin": "2.2.3",
|
|
43
|
-
"@manuscripts/transform": "4.3.
|
|
43
|
+
"@manuscripts/transform": "4.3.15",
|
|
44
44
|
"@popperjs/core": "2.11.8",
|
|
45
45
|
"citeproc": "2.4.63",
|
|
46
46
|
"codemirror": "5.65.19",
|
|
@@ -183,14 +183,6 @@
|
|
|
183
183
|
margin-bottom: 30px;
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
-
.ProseMirror .block-figure_element .add-button {
|
|
187
|
-
border: 0px;
|
|
188
|
-
left: 53px;
|
|
189
|
-
width: 25px;
|
|
190
|
-
height: 25px;
|
|
191
|
-
position: absolute;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
186
|
.ProseMirror .figure-block:hover .options-button {
|
|
195
187
|
visibility: visible;
|
|
196
188
|
}
|
|
@@ -1820,45 +1812,37 @@ th:hover > .table-context-menu-button,
|
|
|
1820
1812
|
.prosemirror-dropcursor-block {
|
|
1821
1813
|
background-color: transparent !important;
|
|
1822
1814
|
}
|
|
1815
|
+
|
|
1823
1816
|
.ProseMirror .add-button {
|
|
1824
|
-
border:
|
|
1817
|
+
border: 0;
|
|
1825
1818
|
z-index: 1;
|
|
1826
1819
|
cursor: pointer;
|
|
1827
1820
|
border-radius: 50%;
|
|
1828
|
-
background
|
|
1821
|
+
background: unset;
|
|
1822
|
+
padding: 0;
|
|
1829
1823
|
}
|
|
1830
1824
|
|
|
1831
|
-
.ProseMirror .add-button
|
|
1832
|
-
|
|
1825
|
+
.ProseMirror .block-figure_element .add-button {
|
|
1826
|
+
left: 53px;
|
|
1827
|
+
position: absolute;
|
|
1833
1828
|
}
|
|
1834
1829
|
|
|
1835
|
-
.ProseMirror .add-button svg
|
|
1836
|
-
fill: #
|
|
1830
|
+
.ProseMirror .add-button svg rect {
|
|
1831
|
+
fill: #6E6E6E !important;
|
|
1837
1832
|
}
|
|
1838
1833
|
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
position: relative;
|
|
1834
|
+
.ProseMirror .add-button.disabled svg rect {
|
|
1835
|
+
fill: #e2e2e2 !important;
|
|
1842
1836
|
}
|
|
1843
1837
|
|
|
1844
|
-
|
|
1845
|
-
display: flex;
|
|
1846
|
-
align-items: center;
|
|
1847
|
-
gap: 8px;
|
|
1848
|
-
margin: 8px 0;
|
|
1849
|
-
padding: 6px 12px;
|
|
1850
|
-
position: absolute;
|
|
1851
|
-
right: 50px;
|
|
1852
|
-
z-index: 5;
|
|
1853
|
-
cursor: pointer;
|
|
1854
|
-
}
|
|
1838
|
+
/* Abstract translations */
|
|
1855
1839
|
|
|
1856
1840
|
/* Add translation button for individual sections within abstracts */
|
|
1857
1841
|
.ProseMirror .abstracts section[data-category] {
|
|
1858
1842
|
position: relative;
|
|
1859
1843
|
}
|
|
1860
1844
|
|
|
1861
|
-
.ProseMirror .
|
|
1845
|
+
.ProseMirror .add-trans-abstract {
|
|
1862
1846
|
display: flex;
|
|
1863
1847
|
align-items: center;
|
|
1864
1848
|
gap: 8px;
|
|
@@ -1869,41 +1853,56 @@ th:hover > .table-context-menu-button,
|
|
|
1869
1853
|
top: 0;
|
|
1870
1854
|
z-index: 5;
|
|
1871
1855
|
cursor: pointer;
|
|
1856
|
+
background: unset;
|
|
1857
|
+
border: none;
|
|
1872
1858
|
}
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
color: #353535;
|
|
1876
|
-
}
|
|
1877
|
-
.ProseMirror .abstracts .add-translation-container .add-button {
|
|
1878
|
-
margin: 0;
|
|
1879
|
-
padding: 0;
|
|
1859
|
+
|
|
1860
|
+
.ProseMirror .add-trans-abstract svg {
|
|
1880
1861
|
width: 16px;
|
|
1881
1862
|
height: 16px;
|
|
1882
|
-
display: flex;
|
|
1883
|
-
align-items: center;
|
|
1884
|
-
justify-content: center;
|
|
1885
1863
|
}
|
|
1886
1864
|
|
|
1887
|
-
.ProseMirror .
|
|
1888
|
-
|
|
1889
|
-
height: 8px;
|
|
1865
|
+
.ProseMirror .add-trans-abstract svg rect {
|
|
1866
|
+
fill: #6E6E6E !important;
|
|
1890
1867
|
}
|
|
1868
|
+
|
|
1869
|
+
.ProseMirror .add-trans-abstract-text {
|
|
1870
|
+
font-size: 14px;
|
|
1871
|
+
color: #353535;
|
|
1872
|
+
}
|
|
1873
|
+
|
|
1891
1874
|
.ProseMirror .block-trans_abstract .language-selector-btn {
|
|
1892
|
-
position: absolute;
|
|
1893
|
-
z-index: 9;
|
|
1894
|
-
top: 40px;
|
|
1895
|
-
border: 0px;
|
|
1896
|
-
background: transparent;
|
|
1897
|
-
right: 60px;
|
|
1898
1875
|
display: flex;
|
|
1899
|
-
|
|
1876
|
+
position: absolute;
|
|
1877
|
+
top: 14px;
|
|
1878
|
+
right: 50px;
|
|
1879
|
+
line-height: 1.6;
|
|
1880
|
+
background: unset;
|
|
1881
|
+
border: none;
|
|
1882
|
+
padding: 0;
|
|
1883
|
+
margin: 0 6px;
|
|
1884
|
+
cursor: pointer;
|
|
1885
|
+
z-index: 10;
|
|
1886
|
+
align-items: end;
|
|
1887
|
+
gap: 8px;
|
|
1900
1888
|
font-size: 14px;
|
|
1901
1889
|
color: #6e6e6e;
|
|
1902
|
-
cursor: pointer;
|
|
1903
1890
|
}
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1891
|
+
|
|
1892
|
+
.language.menu .menu-item {
|
|
1893
|
+
margin-right: 25px
|
|
1894
|
+
}
|
|
1895
|
+
|
|
1896
|
+
.language.menu .menu-item.selected:after {
|
|
1897
|
+
top: 10px;
|
|
1898
|
+
right: 19px;
|
|
1899
|
+
position: absolute;
|
|
1900
|
+
content: '';
|
|
1901
|
+
height: 10px;
|
|
1902
|
+
width: 5px;
|
|
1903
|
+
border-bottom: 2px solid #36b260;
|
|
1904
|
+
border-right: 2px solid #36b260;
|
|
1905
|
+
transform: rotate(45deg);
|
|
1907
1906
|
}
|
|
1908
1907
|
|
|
1909
1908
|
.ProseMirror .block-trans_abstract p.empty-node[data-placeholder] {
|