@manuscripts/body-editor 3.8.2 → 3.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/cjs/commands.js +25 -2
  2. package/dist/cjs/components/LanguageDropdown/index.js +3 -2
  3. package/dist/cjs/components/authors/AuthorDetailsForm.js +1 -1
  4. package/dist/cjs/components/references/ImportBibliographyModal.js +2 -2
  5. package/dist/cjs/configs/editor-plugins.js +2 -0
  6. package/dist/cjs/icons.js +13 -13
  7. package/dist/{es/components/LanguageDropdown → cjs/lib}/languages.js +10 -10
  8. package/dist/cjs/lib/popper.js +1 -0
  9. package/dist/cjs/plugins/section_category.js +1 -1
  10. package/dist/cjs/plugins/translations.js +96 -0
  11. package/dist/cjs/versions.js +1 -1
  12. package/dist/cjs/views/figure_element.js +1 -1
  13. package/dist/cjs/views/section.js +0 -80
  14. package/dist/cjs/views/translated_abstract.js +0 -66
  15. package/dist/es/commands.js +22 -0
  16. package/dist/es/components/LanguageDropdown/index.js +3 -2
  17. package/dist/es/components/authors/AuthorDetailsForm.js +1 -1
  18. package/dist/es/components/references/ImportBibliographyModal.js +2 -2
  19. package/dist/es/configs/editor-plugins.js +2 -0
  20. package/dist/es/icons.js +13 -13
  21. package/dist/{cjs/components/LanguageDropdown → es/lib}/languages.js +5 -15
  22. package/dist/es/lib/popper.js +1 -0
  23. package/dist/es/plugins/section_category.js +1 -1
  24. package/dist/es/plugins/translations.js +94 -0
  25. package/dist/es/versions.js +1 -1
  26. package/dist/es/views/figure_element.js +2 -2
  27. package/dist/es/views/section.js +0 -80
  28. package/dist/es/views/translated_abstract.js +0 -66
  29. package/dist/types/commands.d.ts +1 -0
  30. package/dist/types/components/LanguageDropdown/index.d.ts +1 -1
  31. package/dist/types/configs/ManuscriptsEditor.d.ts +1 -1
  32. package/dist/types/icons.d.ts +1 -1
  33. package/dist/types/{components/LanguageDropdown → lib}/languages.d.ts +2 -11
  34. package/dist/types/plugins/translations.d.ts +19 -0
  35. package/dist/types/versions.d.ts +1 -1
  36. package/dist/types/views/section.d.ts +0 -7
  37. package/dist/types/views/translated_abstract.d.ts +0 -11
  38. package/package.json +1 -1
  39. package/styles/AdvancedEditor.css +52 -53
package/dist/es/icons.js CHANGED
@@ -1,4 +1,4 @@
1
- import { AddAuthorIcon, AlertIcon, ArrowDownCircleIcon, ArrowUpIcon, DeleteIcon, DraggableIcon, EditIcon, FileCorruptedIcon, FileMainDocumentIcon, ImageDefaultIcon, ImageLeftIcon, ImageRightIcon, LinkIcon, LockIcon, PlusIcon, ScrollIcon, SectionCategoryIcon, TranslateIcon, } from '@manuscripts/style-guide';
1
+ import { AddAuthorIcon, AlertIcon, ArrowDownCircleIcon, ArrowUpIcon, DeleteIcon, DraggableIcon, EditIcon, FileCorruptedIcon, FileMainDocumentIcon, ImageDefaultIcon, ImageLeftIcon, ImageRightIcon, LinkIcon, LockIcon, PlusIcon, ScrollIcon, SectionCategoryIcon, TickIcon, TranslateIcon, } from '@manuscripts/style-guide';
2
2
  import { createElement } from 'react';
3
3
  import { renderToStaticMarkup } from 'react-dom/server';
4
4
  const renderIcon = (c) => renderToStaticMarkup(createElement(c));
@@ -7,17 +7,17 @@ export const arrowDown = renderIcon(ArrowDownCircleIcon);
7
7
  export const arrowUp = renderIcon(ArrowUpIcon);
8
8
  export const alertIcon = renderIcon(AlertIcon);
9
9
  export const deleteIcon = renderIcon(DeleteIcon);
10
- export const editIcon = renderToStaticMarkup(createElement(EditIcon));
10
+ export const editIcon = renderIcon(EditIcon);
11
11
  export const sectionCategoryIcon = renderIcon(SectionCategoryIcon);
12
- export const scrollIcon = renderToStaticMarkup(createElement(ScrollIcon));
13
- export const lockIcon = renderToStaticMarkup(createElement(LockIcon));
12
+ export const scrollIcon = renderIcon(ScrollIcon);
13
+ export const lockIcon = renderIcon(LockIcon);
14
14
  export const plusIcon = renderIcon(PlusIcon);
15
- export const addBtnIcon = renderToStaticMarkup(createElement(PlusIcon));
16
- export const imageRightIcon = renderToStaticMarkup(createElement(ImageRightIcon));
17
- export const imageLeftIcon = renderToStaticMarkup(createElement(ImageLeftIcon));
18
- export const imageDefaultIcon = renderToStaticMarkup(createElement(ImageDefaultIcon));
19
- export const fileCorruptedIcon = renderToStaticMarkup(createElement(FileCorruptedIcon));
20
- export const draggableIcon = renderToStaticMarkup(createElement(DraggableIcon));
21
- export const translateIcon = renderToStaticMarkup(createElement(TranslateIcon));
22
- export const linkIcon = renderToStaticMarkup(createElement(LinkIcon));
23
- export const fileMainDocumentIcon = renderToStaticMarkup(createElement(FileMainDocumentIcon));
15
+ export const imageRightIcon = renderIcon(ImageRightIcon);
16
+ export const imageLeftIcon = renderIcon(ImageLeftIcon);
17
+ export const imageDefaultIcon = renderIcon(ImageDefaultIcon);
18
+ export const fileCorruptedIcon = renderIcon(FileCorruptedIcon);
19
+ export const draggableIcon = renderIcon(DraggableIcon);
20
+ export const translateIcon = renderIcon(TranslateIcon);
21
+ export const linkIcon = renderIcon(LinkIcon);
22
+ export const fileMainDocumentIcon = renderIcon(FileMainDocumentIcon);
23
+ export const tickIcon = renderIcon(TickIcon);
@@ -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
- Object.defineProperty(exports, "__esModule", { value: true });
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 getSelectedLanguageName = (selectedLanguage, allLanguages) => {
25
- if (!allLanguages.length) {
26
- return 'English (Default)';
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;
@@ -62,6 +62,7 @@ export class PopperManager {
62
62
  }
63
63
  };
64
64
  if (contents.classList.contains('context-menu') ||
65
+ contents.classList.contains('language') ||
65
66
  contents.classList.contains('section-category')) {
66
67
  window.addEventListener('click', this.handleDocumentClick);
67
68
  }
@@ -13,7 +13,7 @@ export default (props) => new Plugin({
13
13
  return value;
14
14
  }
15
15
  return buildPluginState(newState, props);
16
- }
16
+ },
17
17
  },
18
18
  props: {
19
19
  decorations: (state) => sectionCategoryKey.getState(state)?.decorations || DecorationSet.empty,
@@ -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
+ });
@@ -1,2 +1,2 @@
1
- export const VERSION = '3.8.2';
1
+ export const VERSION = '3.8.4';
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 { addBtnIcon } from '../icons';
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: addBtnIcon,
70
+ innerHTML: addAuthorIcon,
71
71
  title: 'Add figure',
72
72
  });
73
73
  this.addFigureBtn.addEventListener('click', () => this.addFigure());
@@ -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);
@@ -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 './languages';
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 '../components/LanguageDropdown/languages';
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';
@@ -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 ENGLISH_FALLBACK: {
22
- code: string;
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;
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "3.8.2";
1
+ export declare const VERSION = "3.8.4";
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.2",
4
+ "version": "3.8.4",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-body-editor",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",