@manuscripts/body-editor 2.8.75-LEAN-4574.1 → 2.8.76
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/clipboard.js +2 -23
- package/dist/cjs/components/references/ImportBibliographyForm.js +8 -8
- package/dist/cjs/components/references/ReferenceForm/PersonDropDown.js +2 -2
- package/dist/cjs/components/references/ReferenceForm/ReferenceForm.js +31 -42
- package/dist/cjs/components/references/ReferenceForm/config.js +13 -1
- package/dist/cjs/components/views/TableCellContextMenu.js +12 -11
- package/dist/cjs/index.js +1 -2
- package/dist/cjs/lib/context-menu.js +12 -8
- package/dist/cjs/lib/crossref.js +32 -1
- package/dist/cjs/lib/references.js +1 -67
- package/dist/cjs/lib/utils.js +3 -1
- package/dist/cjs/plugins/bibliography/bibliography-utils.js +84 -0
- package/dist/cjs/plugins/bibliography/index.js +128 -0
- package/dist/cjs/plugins/tables-cursor-fix.js +4 -1
- package/dist/cjs/versions.js +1 -1
- package/dist/cjs/views/bibliography_element.js +1 -1
- package/dist/cjs/views/bullet_list.js +44 -0
- package/dist/cjs/views/bullet_list_editable.js +21 -0
- package/dist/cjs/views/list.js +6 -23
- package/dist/cjs/views/ordered_list.js +53 -0
- package/dist/cjs/views/ordered_list_editable.js +21 -0
- package/dist/cjs/views/table_element.js +0 -1
- package/dist/es/clipboard.js +2 -22
- package/dist/es/components/references/ImportBibliographyForm.js +8 -8
- package/dist/es/components/references/ReferenceForm/PersonDropDown.js +2 -2
- package/dist/es/components/references/ReferenceForm/ReferenceForm.js +30 -41
- package/dist/es/components/references/ReferenceForm/config.js +12 -0
- package/dist/es/components/views/TableCellContextMenu.js +12 -11
- package/dist/es/index.js +1 -1
- package/dist/es/lib/context-menu.js +13 -9
- package/dist/es/lib/crossref.js +32 -1
- package/dist/es/lib/references.js +0 -42
- package/dist/es/lib/utils.js +3 -1
- package/dist/es/plugins/bibliography/bibliography-utils.js +77 -0
- package/dist/es/plugins/bibliography/index.js +124 -0
- package/dist/es/plugins/tables-cursor-fix.js +4 -1
- package/dist/es/versions.js +1 -1
- package/dist/es/views/bibliography_element.js +1 -1
- package/dist/es/views/bullet_list.js +36 -0
- package/dist/es/views/bullet_list_editable.js +19 -0
- package/dist/es/views/citation_editable.js +1 -1
- package/dist/es/views/list.js +5 -21
- package/dist/es/views/ordered_list.js +45 -0
- package/dist/es/views/ordered_list_editable.js +19 -0
- package/dist/es/views/table_element.js +0 -1
- package/dist/types/clipboard.d.ts +0 -1
- package/dist/types/components/references/BibliographyItemSource.d.ts +1 -1
- package/dist/types/components/references/CitationEditor.d.ts +1 -1
- package/dist/types/components/references/CitationViewer.d.ts +1 -1
- package/dist/types/components/references/ReferenceForm/PersonDropDown.d.ts +4 -4
- package/dist/types/components/references/ReferenceForm/ReferenceForm.d.ts +1 -1
- package/dist/types/components/references/ReferenceForm/config.d.ts +1 -0
- package/dist/types/components/references/ReferenceLine.d.ts +1 -1
- package/dist/types/components/references/ReferenceSearch.d.ts +1 -1
- package/dist/types/components/references/ReferenceSearchResults.d.ts +1 -1
- package/dist/types/components/references/ReferenceSearchSection.d.ts +1 -1
- package/dist/types/components/references/ReferencesModal.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/lib/context-menu.d.ts +1 -0
- package/dist/types/lib/references.d.ts +4 -3
- package/dist/types/plugins/bibliography/bibliography-utils.d.ts +25 -0
- package/dist/types/plugins/{bibliography.d.ts → bibliography/index.d.ts} +9 -9
- package/dist/types/versions.d.ts +1 -1
- package/dist/types/views/bullet_list.d.ts +25 -0
- package/dist/types/views/bullet_list_editable.d.ts +44 -0
- package/dist/types/views/list.d.ts +1 -2
- package/dist/types/views/ordered_list.d.ts +30 -0
- package/dist/types/views/ordered_list_editable.d.ts +44 -0
- package/dist/types/views/table_element.d.ts +0 -1
- package/package.json +3 -11
- package/dist/cjs/plugins/bibliography.js +0 -177
- package/dist/es/plugins/bibliography.js +0 -149
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { BibliographyItemAttrs } from '@manuscripts/transform';
|
|
17
16
|
import React from 'react';
|
|
17
|
+
import { BibliographyItemAttrs } from '../../lib/references';
|
|
18
18
|
export declare const Metadata: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
19
19
|
export declare const MetadataContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
20
20
|
export declare const ReferenceLine: React.FC<{
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { BibliographyItemAttrs } from '@manuscripts/transform';
|
|
17
16
|
import React from 'react';
|
|
17
|
+
import { BibliographyItemAttrs } from '../../lib/references';
|
|
18
18
|
import { BibliographyItemSource } from './BibliographyItemSource';
|
|
19
19
|
export declare const ReferenceSearch: React.FC<{
|
|
20
20
|
query?: string;
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { BibliographyItemAttrs } from '@manuscripts/transform';
|
|
17
16
|
import React from 'react';
|
|
17
|
+
import { BibliographyItemAttrs } from '../../lib/references';
|
|
18
18
|
export declare const ReferenceSearchResultsContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
19
19
|
export declare const ReferenceSearchResult: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
20
20
|
export declare const ReferenceSearchResults: React.FC<{
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { BibliographyItemAttrs } from '@manuscripts/transform';
|
|
17
16
|
import React from 'react';
|
|
17
|
+
import { BibliographyItemAttrs } from '../../lib/references';
|
|
18
18
|
import { BibliographyItemSource } from './BibliographyItemSource';
|
|
19
19
|
export declare const ReferenceSearchSection: React.FC<{
|
|
20
20
|
query: string;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -40,5 +40,5 @@ export { footnotesKey as footnotesPluginKey } from './plugins/footnotes';
|
|
|
40
40
|
export { bibliographyKey as bibliographyPluginKey } from './plugins/bibliography';
|
|
41
41
|
export { searchReplaceKey as searchReplacePluginKey, SearchReplacePluginState, } from './plugins/search-replace';
|
|
42
42
|
export { getNewMatch, getClosestMatch } from './plugins/search-replace/lib';
|
|
43
|
-
export { metadata,
|
|
43
|
+
export { metadata, BibliographyItemAttrs } from './lib/references';
|
|
44
44
|
export { authorLabel, affiliationLabel, AffiliationAttrs, ContributorAttrs, } from './lib/authors';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BibliographyItemNode, CitationNode } from '@manuscripts/transform';
|
|
2
|
+
import { TrackableAttributes } from '../types';
|
|
3
|
+
export type BibliographyItemAttrs = TrackableAttributes<BibliographyItemNode>;
|
|
4
|
+
export type CitationAttrs = TrackableAttributes<CitationNode>;
|
|
2
5
|
export declare const metadata: (item: BibliographyItemAttrs) => string;
|
|
3
6
|
export declare const issuedYear: (item: BibliographyItemAttrs) => string;
|
|
4
7
|
export declare const authors: (item: BibliographyItemAttrs) => string;
|
|
5
|
-
export declare const importBibliographyItems: (data: string) => Promise<BibliographyItemAttrs[]>;
|
|
6
|
-
export declare const bibliographyItemTypes: [BibliographyItemType, string][];
|
|
@@ -0,0 +1,25 @@
|
|
|
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 { TrackedAttrs } from '@manuscripts/track-changes-plugin';
|
|
17
|
+
import { CitationNode, ManuscriptNode } from '@manuscripts/transform';
|
|
18
|
+
import CiteProc from 'citeproc';
|
|
19
|
+
import { Decoration } from 'prosemirror-view';
|
|
20
|
+
import { PluginState } from './index';
|
|
21
|
+
export declare const isBibliographyElement: (node: ManuscriptNode) => boolean;
|
|
22
|
+
export type CitationNodes = [CitationNode, number][];
|
|
23
|
+
export declare const buildDecorations: (state: PluginState, doc: ManuscriptNode) => Decoration[];
|
|
24
|
+
export declare const getLatest: (a: TrackedAttrs, b: TrackedAttrs) => TrackedAttrs;
|
|
25
|
+
export declare const buildCitations: (citations: CitationNodes) => CiteProc.Citation[];
|
|
@@ -13,21 +13,22 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import {
|
|
17
|
-
import
|
|
16
|
+
import { CitationProvider } from '@manuscripts/library';
|
|
17
|
+
import CiteProc from 'citeproc';
|
|
18
18
|
import { EditorState, Plugin, PluginKey } from 'prosemirror-state';
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
19
|
+
import { CSLProps } from '../../configs/ManuscriptsEditor';
|
|
20
|
+
import { PopperManager } from '../../lib/popper';
|
|
21
|
+
import { BibliographyItemAttrs } from '../../lib/references';
|
|
22
|
+
import { CitationNodes } from './bibliography-utils';
|
|
22
23
|
export declare const bibliographyKey: PluginKey<PluginState>;
|
|
23
24
|
export interface PluginState {
|
|
24
25
|
version: string;
|
|
25
|
-
citationNodes:
|
|
26
|
-
citations:
|
|
26
|
+
citationNodes: CitationNodes;
|
|
27
|
+
citations: CiteProc.Citation[];
|
|
27
28
|
bibliographyItems: Map<string, BibliographyItemAttrs>;
|
|
28
29
|
renderedCitations: Map<string, string>;
|
|
29
30
|
citationCounts: Map<string, number>;
|
|
30
|
-
|
|
31
|
+
provider: CitationProvider;
|
|
31
32
|
}
|
|
32
33
|
export interface BibliographyProps {
|
|
33
34
|
cslProps: CSLProps;
|
|
@@ -35,5 +36,4 @@ export interface BibliographyProps {
|
|
|
35
36
|
}
|
|
36
37
|
declare const _default: (props: BibliographyProps) => Plugin<PluginState>;
|
|
37
38
|
export default _default;
|
|
38
|
-
export declare const buildDecorations: (state: PluginState, doc: ManuscriptNode) => Decoration[];
|
|
39
39
|
export declare const getBibliographyPluginState: (state: EditorState) => PluginState | undefined;
|
package/dist/types/versions.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "2.8.
|
|
1
|
+
export declare const VERSION = "2.8.76";
|
|
2
2
|
export declare const MATHJAX_VERSION = "3.2.2";
|
|
@@ -0,0 +1,25 @@
|
|
|
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 { ListNode, ManuscriptNode } from '@manuscripts/transform';
|
|
17
|
+
import { Trackable } from '../types';
|
|
18
|
+
import BlockView from './block_view';
|
|
19
|
+
export declare class BulletListView extends BlockView<Trackable<ListNode>> {
|
|
20
|
+
elementType: string;
|
|
21
|
+
updateContents(): void;
|
|
22
|
+
}
|
|
23
|
+
export declare const bulletListCallback: (node: ManuscriptNode, dom: HTMLElement) => void;
|
|
24
|
+
declare const _default: (props: import("../configs/ManuscriptsEditor").EditorProps) => import("../types").NodeViewCreator<BulletListView>;
|
|
25
|
+
export default _default;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { BulletListView } from './bullet_list';
|
|
17
|
+
declare const _default: (props: import("../configs/ManuscriptsEditor").EditorProps) => import("../types").NodeViewCreator<{
|
|
18
|
+
gutterButtons(): HTMLElement[];
|
|
19
|
+
actionGutterButtons(): never[];
|
|
20
|
+
createAddButton(): HTMLAnchorElement | null;
|
|
21
|
+
createEditButton(): HTMLElement | null;
|
|
22
|
+
createMenu: () => import("../lib/context-menu").ContextMenu;
|
|
23
|
+
initialise(): void;
|
|
24
|
+
updateContents(): void;
|
|
25
|
+
handleTrackChanges(): void;
|
|
26
|
+
updateClasses(): void;
|
|
27
|
+
updatePlaceholder(): void;
|
|
28
|
+
createElement(): void;
|
|
29
|
+
createDOM(): void;
|
|
30
|
+
gutter: Record<string, HTMLElement>;
|
|
31
|
+
createGutter(className: string, buttons: HTMLElement[]): void;
|
|
32
|
+
dom: HTMLElement;
|
|
33
|
+
contentDOM?: HTMLElement | undefined;
|
|
34
|
+
elementType: string;
|
|
35
|
+
readonly props: import("../configs/ManuscriptsEditor").EditorProps;
|
|
36
|
+
node: import("prosemirror-model").Node;
|
|
37
|
+
readonly view: import("prosemirror-view").EditorView;
|
|
38
|
+
readonly getPos: () => number;
|
|
39
|
+
update(newNode: import("prosemirror-model").Node): boolean;
|
|
40
|
+
selectNode(): void;
|
|
41
|
+
deselectNode(): void;
|
|
42
|
+
destroy(): void;
|
|
43
|
+
} & BulletListView>;
|
|
44
|
+
export default _default;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { ListNode,
|
|
16
|
+
import { ListNode, ManuscriptNode } from '@manuscripts/transform';
|
|
17
17
|
import { Trackable } from '../types';
|
|
18
18
|
import BlockView from './block_view';
|
|
19
19
|
export declare class ListView extends BlockView<Trackable<ListNode>> {
|
|
@@ -49,4 +49,3 @@ declare const _default: (props: import("../configs/ManuscriptsEditor").EditorPro
|
|
|
49
49
|
destroy(): void;
|
|
50
50
|
} & ListView>;
|
|
51
51
|
export default _default;
|
|
52
|
-
export declare const getCssListStyleType: (type: ListStyleType) => "none" | "disc" | "decimal" | "lower-alpha" | "upper-alpha" | "lower-roman" | "upper-roman";
|
|
@@ -0,0 +1,30 @@
|
|
|
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 { ListElement } from '@manuscripts/json-schema';
|
|
17
|
+
import { ListNode, ManuscriptNode } from '@manuscripts/transform';
|
|
18
|
+
import { Trackable } from '../types';
|
|
19
|
+
import BlockView from './block_view';
|
|
20
|
+
export type JatsStyleType = NonNullable<ListElement['listStyleType']>;
|
|
21
|
+
export declare const JATS_HTML_LIST_STYLE_MAPPING: {
|
|
22
|
+
[key in JatsStyleType]: string;
|
|
23
|
+
};
|
|
24
|
+
export declare class OrderedListView extends BlockView<Trackable<ListNode>> {
|
|
25
|
+
elementType: string;
|
|
26
|
+
updateContents(): void;
|
|
27
|
+
}
|
|
28
|
+
export declare const orderedListCallback: (node: ManuscriptNode, dom: HTMLElement) => void;
|
|
29
|
+
declare const _default: (props: import("../configs/ManuscriptsEditor").EditorProps) => import("../types").NodeViewCreator<OrderedListView>;
|
|
30
|
+
export default _default;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { OrderedListView } from './ordered_list';
|
|
17
|
+
declare const _default: (props: import("../configs/ManuscriptsEditor").EditorProps) => import("../types").NodeViewCreator<{
|
|
18
|
+
gutterButtons(): HTMLElement[];
|
|
19
|
+
actionGutterButtons(): never[];
|
|
20
|
+
createAddButton(): HTMLAnchorElement | null;
|
|
21
|
+
createEditButton(): HTMLElement | null;
|
|
22
|
+
createMenu: () => import("../lib/context-menu").ContextMenu;
|
|
23
|
+
initialise(): void;
|
|
24
|
+
updateContents(): void;
|
|
25
|
+
handleTrackChanges(): void;
|
|
26
|
+
updateClasses(): void;
|
|
27
|
+
updatePlaceholder(): void;
|
|
28
|
+
createElement(): void;
|
|
29
|
+
createDOM(): void;
|
|
30
|
+
gutter: Record<string, HTMLElement>;
|
|
31
|
+
createGutter(className: string, buttons: HTMLElement[]): void;
|
|
32
|
+
dom: HTMLElement;
|
|
33
|
+
contentDOM?: HTMLElement | undefined;
|
|
34
|
+
elementType: string;
|
|
35
|
+
readonly props: import("../configs/ManuscriptsEditor").EditorProps;
|
|
36
|
+
node: import("prosemirror-model").Node;
|
|
37
|
+
readonly view: import("prosemirror-view").EditorView;
|
|
38
|
+
readonly getPos: () => number;
|
|
39
|
+
update(newNode: import("prosemirror-model").Node): boolean;
|
|
40
|
+
selectNode(): void;
|
|
41
|
+
deselectNode(): void;
|
|
42
|
+
destroy(): void;
|
|
43
|
+
} & OrderedListView>;
|
|
44
|
+
export default _default;
|
|
@@ -17,7 +17,6 @@ import { TableElementNode } from '@manuscripts/transform';
|
|
|
17
17
|
import BlockView from './block_view';
|
|
18
18
|
export declare class TableElementView extends BlockView<TableElementNode> {
|
|
19
19
|
elementType: string;
|
|
20
|
-
ignoreMutation: () => boolean;
|
|
21
20
|
createElement: () => void;
|
|
22
21
|
}
|
|
23
22
|
declare const _default: (props: import("../configs/ManuscriptsEditor").EditorProps, dispatch?: import("..").Dispatch | undefined) => import("../types").NodeViewCreator<TableElementView>;
|
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": "2.8.
|
|
4
|
+
"version": "2.8.76",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@manuscripts/library": "1.3.14",
|
|
35
35
|
"@manuscripts/style-guide": "2.1.12",
|
|
36
36
|
"@manuscripts/track-changes-plugin": "1.10.7",
|
|
37
|
-
"@manuscripts/transform": "3.0.
|
|
37
|
+
"@manuscripts/transform": "3.0.67",
|
|
38
38
|
"@popperjs/core": "^2.11.8",
|
|
39
39
|
"astrocite-eutils": "^0.16.4",
|
|
40
40
|
"codemirror": "^5.58.1",
|
|
@@ -65,14 +65,7 @@
|
|
|
65
65
|
"react-is": "^18.3.1",
|
|
66
66
|
"react-router-dom": "^6.25.0",
|
|
67
67
|
"react-select": "^5.7.3",
|
|
68
|
-
"styled-components": "^5.2.0"
|
|
69
|
-
"@citation-js/core": "^0.7.18",
|
|
70
|
-
"@citation-js/plugin-bibtex": "^0.7.18",
|
|
71
|
-
"@citation-js/plugin-csl": "^0.7.18",
|
|
72
|
-
"@citation-js/plugin-doi": "^0.7.18",
|
|
73
|
-
"@citation-js/plugin-enw": "^0.3.0",
|
|
74
|
-
"@citation-js/plugin-pubmed": "^0.3.0",
|
|
75
|
-
"@citation-js/plugin-ris": "^0.7.18"
|
|
68
|
+
"styled-components": "^5.2.0"
|
|
76
69
|
},
|
|
77
70
|
"devDependencies": {
|
|
78
71
|
"@babel/core": "^7.20.5",
|
|
@@ -91,7 +84,6 @@
|
|
|
91
84
|
"@types/uuid": "^9.0.0",
|
|
92
85
|
"@typescript-eslint/eslint-plugin": "^5.47.0",
|
|
93
86
|
"@typescript-eslint/parser": "^5.47.0",
|
|
94
|
-
"@types/csl": "npm:csl-json@0.1.0",
|
|
95
87
|
"concurrently": "^7.6.0",
|
|
96
88
|
"eslint": "^8.30.0",
|
|
97
89
|
"eslint-config-prettier": "^8.5.0",
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* © 2019 Atypon Systems LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
-
if (k2 === undefined) k2 = k;
|
|
19
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
-
}
|
|
23
|
-
Object.defineProperty(o, k2, desc);
|
|
24
|
-
}) : (function(o, m, k, k2) {
|
|
25
|
-
if (k2 === undefined) k2 = k;
|
|
26
|
-
o[k2] = m[k];
|
|
27
|
-
}));
|
|
28
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
29
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
30
|
-
}) : function(o, v) {
|
|
31
|
-
o["default"] = v;
|
|
32
|
-
});
|
|
33
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
34
|
-
if (mod && mod.__esModule) return mod;
|
|
35
|
-
var result = {};
|
|
36
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
37
|
-
__setModuleDefault(result, mod);
|
|
38
|
-
return result;
|
|
39
|
-
};
|
|
40
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
-
exports.getBibliographyPluginState = exports.buildDecorations = exports.bibliographyKey = void 0;
|
|
42
|
-
const transform_1 = require("@manuscripts/transform");
|
|
43
|
-
const Citeproc = __importStar(require("citeproc"));
|
|
44
|
-
const lodash_1 = require("lodash");
|
|
45
|
-
const prosemirror_state_1 = require("prosemirror-state");
|
|
46
|
-
const prosemirror_view_1 = require("prosemirror-view");
|
|
47
|
-
exports.bibliographyKey = new prosemirror_state_1.PluginKey('bibliography');
|
|
48
|
-
exports.default = (props) => {
|
|
49
|
-
return new prosemirror_state_1.Plugin({
|
|
50
|
-
key: exports.bibliographyKey,
|
|
51
|
-
state: {
|
|
52
|
-
init(config, instance) {
|
|
53
|
-
return buildBibliographyPluginState(instance.doc, props.cslProps);
|
|
54
|
-
},
|
|
55
|
-
apply(tr, value) {
|
|
56
|
-
if (!tr.steps.length) {
|
|
57
|
-
return value;
|
|
58
|
-
}
|
|
59
|
-
return buildBibliographyPluginState(tr.doc, props.cslProps, value);
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
props: {
|
|
63
|
-
decorations(state) {
|
|
64
|
-
const bib = (0, exports.getBibliographyPluginState)(state);
|
|
65
|
-
return prosemirror_view_1.DecorationSet.create(state.doc, bib ? (0, exports.buildDecorations)(bib, state.doc) : []);
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
});
|
|
69
|
-
};
|
|
70
|
-
let version = 1;
|
|
71
|
-
const buildBibliographyPluginState = (doc, csl, $old) => {
|
|
72
|
-
const nodesMap = new Map();
|
|
73
|
-
const bibliographyItems = new Map();
|
|
74
|
-
doc.descendants((node, pos) => {
|
|
75
|
-
if ((0, transform_1.isCitationNode)(node)) {
|
|
76
|
-
nodesMap.set(node.attrs.id, [node, pos]);
|
|
77
|
-
}
|
|
78
|
-
if ((0, transform_1.isBibliographyItemNode)(node)) {
|
|
79
|
-
bibliographyItems.set(node.attrs.id, node.attrs);
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
const nodes = Array.from(nodesMap.values());
|
|
83
|
-
const citations = nodes.map(([node]) => (0, transform_1.buildCiteprocCitation)(node.attrs));
|
|
84
|
-
const $new = {
|
|
85
|
-
citationNodes: nodes,
|
|
86
|
-
citations,
|
|
87
|
-
bibliographyItems,
|
|
88
|
-
};
|
|
89
|
-
if (!csl.style) {
|
|
90
|
-
return $new;
|
|
91
|
-
}
|
|
92
|
-
if ($old &&
|
|
93
|
-
(0, lodash_1.isEqual)(citations, $old.citations) &&
|
|
94
|
-
(0, lodash_1.isEqual)(bibliographyItems, $old.bibliographyItems)) {
|
|
95
|
-
$new.version = $old.version;
|
|
96
|
-
$new.citationCounts = $old.citationCounts;
|
|
97
|
-
$new.engine = $old.engine;
|
|
98
|
-
$new.renderedCitations = $old.renderedCitations;
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
const citationCounts = new Map();
|
|
102
|
-
const rids = nodes.flatMap((e) => e[0].attrs.rids);
|
|
103
|
-
rids.forEach((rid) => {
|
|
104
|
-
const count = citationCounts.get(rid) || 0;
|
|
105
|
-
citationCounts.set(rid, count + 1);
|
|
106
|
-
});
|
|
107
|
-
const engine = new Citeproc.Engine({
|
|
108
|
-
retrieveLocale: () => csl.locale,
|
|
109
|
-
retrieveItem: (id) => {
|
|
110
|
-
const item = bibliographyItems.get(id);
|
|
111
|
-
if (!item) {
|
|
112
|
-
throw Error(`Missing bibliography item with id ${id}`);
|
|
113
|
-
}
|
|
114
|
-
return item;
|
|
115
|
-
},
|
|
116
|
-
}, csl.style, 'en-US');
|
|
117
|
-
const citationTexts = engine.rebuildProcessorState(nodes.map(([node]) => (0, transform_1.buildCiteprocCitation)(node.attrs)));
|
|
118
|
-
$new.version = String(version++);
|
|
119
|
-
$new.citationCounts = citationCounts;
|
|
120
|
-
$new.engine = engine;
|
|
121
|
-
$new.renderedCitations = new Map(citationTexts.map((i) => [i[0], i[2]]));
|
|
122
|
-
}
|
|
123
|
-
return $new;
|
|
124
|
-
};
|
|
125
|
-
const buildDecorations = (state, doc) => {
|
|
126
|
-
const decorations = [];
|
|
127
|
-
let hasMissingItems = false;
|
|
128
|
-
for (const [node, pos] of state.citationNodes) {
|
|
129
|
-
const rids = node.attrs.rids;
|
|
130
|
-
if (rids.length) {
|
|
131
|
-
for (const rid of rids) {
|
|
132
|
-
if (!state.bibliographyItems.has(rid)) {
|
|
133
|
-
decorations.push(prosemirror_view_1.Decoration.node(pos, pos + node.nodeSize, {
|
|
134
|
-
class: 'citation-missing',
|
|
135
|
-
}));
|
|
136
|
-
hasMissingItems = true;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
else {
|
|
141
|
-
decorations.push(prosemirror_view_1.Decoration.node(pos, pos + node.nodeSize, {
|
|
142
|
-
class: 'citation-empty',
|
|
143
|
-
}));
|
|
144
|
-
}
|
|
145
|
-
decorations.push(prosemirror_view_1.Decoration.node(pos, pos + node.nodeSize, {
|
|
146
|
-
version: state.version,
|
|
147
|
-
}));
|
|
148
|
-
}
|
|
149
|
-
if (hasMissingItems) {
|
|
150
|
-
doc.descendants((node, pos) => {
|
|
151
|
-
if ((0, transform_1.isBibliographyElementNode)(node)) {
|
|
152
|
-
decorations.push(prosemirror_view_1.Decoration.node(pos, pos + node.nodeSize, {
|
|
153
|
-
missing: 'true',
|
|
154
|
-
}));
|
|
155
|
-
decorations.push(prosemirror_view_1.Decoration.widget(pos, () => {
|
|
156
|
-
const el = document.createElement('div');
|
|
157
|
-
el.className = 'bibliography-missing';
|
|
158
|
-
el.textContent = `The bibliography could not be generated, due to a missing library item.`;
|
|
159
|
-
return el;
|
|
160
|
-
}));
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
doc.descendants((node, pos) => {
|
|
165
|
-
if ((0, transform_1.isBibliographyElementNode)(node)) {
|
|
166
|
-
decorations.push(prosemirror_view_1.Decoration.node(pos, pos + node.nodeSize, {
|
|
167
|
-
version: state.version,
|
|
168
|
-
}));
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
return decorations;
|
|
172
|
-
};
|
|
173
|
-
exports.buildDecorations = buildDecorations;
|
|
174
|
-
const getBibliographyPluginState = (state) => {
|
|
175
|
-
return exports.bibliographyKey.getState(state);
|
|
176
|
-
};
|
|
177
|
-
exports.getBibliographyPluginState = getBibliographyPluginState;
|