@manuscripts/article-editor 1.9.4 → 1.9.5-LEAN-3092-0
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/src/components/Sidebar/Sidebar.js +1 -2
- package/dist/cjs/src/components/Sidebar/Sidebar.js.map +1 -1
- package/dist/cjs/src/hooks/use-create-editor.js +0 -18
- package/dist/cjs/src/hooks/use-create-editor.js.map +1 -1
- package/dist/es/src/components/Sidebar/Sidebar.js +1 -2
- package/dist/es/src/components/Sidebar/Sidebar.js.map +1 -1
- package/dist/es/src/hooks/use-create-editor.js +0 -18
- package/dist/es/src/hooks/use-create-editor.js.map +1 -1
- package/package.json +6 -7
- package/dist/cjs/src/components/SelectField.js +0 -24
- package/dist/cjs/src/components/SelectField.js.map +0 -1
- package/dist/cjs/src/components/library/BibliographyImportButton.js +0 -149
- package/dist/cjs/src/components/library/BibliographyImportButton.js.map +0 -1
- package/dist/cjs/src/components/library/CitationEditor.js +0 -227
- package/dist/cjs/src/components/library/CitationEditor.js.map +0 -1
- package/dist/cjs/src/components/library/CitationModal.js +0 -262
- package/dist/cjs/src/components/library/CitationModal.js.map +0 -1
- package/dist/cjs/src/components/library/CitationSearch.js +0 -214
- package/dist/cjs/src/components/library/CitationSearch.js.map +0 -1
- package/dist/cjs/src/components/library/CitationSearchSection.js +0 -133
- package/dist/cjs/src/components/library/CitationSearchSection.js.map +0 -1
- package/dist/cjs/src/components/library/CitationViewer.js +0 -53
- package/dist/cjs/src/components/library/CitationViewer.js.map +0 -1
- package/dist/cjs/src/components/library/ReferenceForm.js +0 -419
- package/dist/cjs/src/components/library/ReferenceForm.js.map +0 -1
- package/dist/cjs/src/components/library/ReferencesEditor.js +0 -70
- package/dist/cjs/src/components/library/ReferencesEditor.js.map +0 -1
- package/dist/cjs/src/components/library/ReferencesViewer.js +0 -33
- package/dist/cjs/src/components/library/ReferencesViewer.js.map +0 -1
- package/dist/cjs/src/components/library/SearchResults.js +0 -126
- package/dist/cjs/src/components/library/SearchResults.js.map +0 -1
- package/dist/cjs/src/components/projects/icons/DeleteIcon.js +0 -27
- package/dist/cjs/src/components/projects/icons/DeleteIcon.js.map +0 -1
- package/dist/cjs/src/components/projects/icons/GroupIcon.js +0 -29
- package/dist/cjs/src/components/projects/icons/GroupIcon.js.map +0 -1
- package/dist/cjs/src/components/projects/icons/LinkIcon.js +0 -23
- package/dist/cjs/src/components/projects/icons/LinkIcon.js.map +0 -1
- package/dist/cjs/src/components/projects/icons/TemplateIcon.js +0 -23
- package/dist/cjs/src/components/projects/icons/TemplateIcon.js.map +0 -1
- package/dist/cjs/src/lib/select-styles.js +0 -40
- package/dist/cjs/src/lib/select-styles.js.map +0 -1
- package/dist/cjs/src/lib/sources.js +0 -36
- package/dist/cjs/src/lib/sources.js.map +0 -1
- package/dist/es/src/components/SelectField.js +0 -17
- package/dist/es/src/components/SelectField.js.map +0 -1
- package/dist/es/src/components/library/BibliographyImportButton.js +0 -120
- package/dist/es/src/components/library/BibliographyImportButton.js.map +0 -1
- package/dist/es/src/components/library/CitationEditor.js +0 -198
- package/dist/es/src/components/library/CitationEditor.js.map +0 -1
- package/dist/es/src/components/library/CitationModal.js +0 -232
- package/dist/es/src/components/library/CitationModal.js.map +0 -1
- package/dist/es/src/components/library/CitationSearch.js +0 -184
- package/dist/es/src/components/library/CitationSearch.js.map +0 -1
- package/dist/es/src/components/library/CitationSearchSection.js +0 -103
- package/dist/es/src/components/library/CitationSearchSection.js.map +0 -1
- package/dist/es/src/components/library/CitationViewer.js +0 -46
- package/dist/es/src/components/library/CitationViewer.js.map +0 -1
- package/dist/es/src/components/library/ReferenceForm.js +0 -389
- package/dist/es/src/components/library/ReferenceForm.js.map +0 -1
- package/dist/es/src/components/library/ReferencesEditor.js +0 -43
- package/dist/es/src/components/library/ReferencesEditor.js.map +0 -1
- package/dist/es/src/components/library/ReferencesViewer.js +0 -26
- package/dist/es/src/components/library/ReferencesViewer.js.map +0 -1
- package/dist/es/src/components/library/SearchResults.js +0 -119
- package/dist/es/src/components/library/SearchResults.js.map +0 -1
- package/dist/es/src/components/projects/icons/DeleteIcon.js +0 -20
- package/dist/es/src/components/projects/icons/DeleteIcon.js.map +0 -1
- package/dist/es/src/components/projects/icons/GroupIcon.js +0 -22
- package/dist/es/src/components/projects/icons/GroupIcon.js.map +0 -1
- package/dist/es/src/components/projects/icons/LinkIcon.js +0 -16
- package/dist/es/src/components/projects/icons/LinkIcon.js.map +0 -1
- package/dist/es/src/components/projects/icons/TemplateIcon.js +0 -16
- package/dist/es/src/components/projects/icons/TemplateIcon.js.map +0 -1
- package/dist/es/src/lib/select-styles.js +0 -37
- package/dist/es/src/lib/select-styles.js.map +0 -1
- package/dist/es/src/lib/sources.js +0 -33
- package/dist/es/src/lib/sources.js.map +0 -1
- package/dist/types/src/components/SelectField.d.ts +0 -23
- package/dist/types/src/components/library/BibliographyImportButton.d.ts +0 -23
- package/dist/types/src/components/library/CitationEditor.d.ts +0 -30
- package/dist/types/src/components/library/CitationModal.d.ts +0 -17
- package/dist/types/src/components/library/CitationSearch.d.ts +0 -22
- package/dist/types/src/components/library/CitationSearchSection.d.ts +0 -34
- package/dist/types/src/components/library/CitationViewer.d.ts +0 -18
- package/dist/types/src/components/library/ReferenceForm.d.ts +0 -51
- package/dist/types/src/components/library/ReferencesEditor.d.ts +0 -22
- package/dist/types/src/components/library/ReferencesViewer.d.ts +0 -9
- package/dist/types/src/components/library/SearchResults.d.ts +0 -26
- package/dist/types/src/components/projects/icons/DeleteIcon.d.ts +0 -13
- package/dist/types/src/components/projects/icons/GroupIcon.d.ts +0 -15
- package/dist/types/src/components/projects/icons/LinkIcon.d.ts +0 -13
- package/dist/types/src/components/projects/icons/TemplateIcon.d.ts +0 -13
- package/dist/types/src/lib/select-styles.d.ts +0 -13
- package/dist/types/src/lib/sources.d.ts +0 -25
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* The contents of this file are subject to the Common Public Attribution License Version 1.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://mpapp-public.gitlab.io/manuscripts-frontend/LICENSE. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.
|
|
3
|
-
*
|
|
4
|
-
* Software distributed under the License is distributed on an “AS IS” basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
|
|
5
|
-
*
|
|
6
|
-
* The Original Code is manuscripts-frontend.
|
|
7
|
-
*
|
|
8
|
-
* The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
|
|
9
|
-
*
|
|
10
|
-
* All portions of the code written by Atypon Systems LLC are Copyright (c) 2019 Atypon Systems LLC. All Rights Reserved.
|
|
11
|
-
*/
|
|
12
|
-
import { crossref } from '@manuscripts/body-editor';
|
|
13
|
-
import { estimateID } from '@manuscripts/library';
|
|
14
|
-
import { ButtonGroup, IconTextButton, PrimaryButton, SecondaryButton, Tip, UploadIcon, } from '@manuscripts/style-guide';
|
|
15
|
-
import { buildBibliographyItem } from '@manuscripts/transform';
|
|
16
|
-
import axios from 'axios';
|
|
17
|
-
import { debounce } from 'lodash-es';
|
|
18
|
-
import React, { useCallback, useEffect, useState } from 'react';
|
|
19
|
-
import styled from 'styled-components';
|
|
20
|
-
import { filterLibrary } from '../../lib/search-library';
|
|
21
|
-
import { TemplateIcon } from '../projects/icons/TemplateIcon';
|
|
22
|
-
import Search, { SearchWrapper } from '../Search';
|
|
23
|
-
import { BibliographyImportButton } from './BibliographyImportButton';
|
|
24
|
-
import { CitationSearchSection } from './CitationSearchSection';
|
|
25
|
-
const Results = styled.div `
|
|
26
|
-
max-height: 400px;
|
|
27
|
-
overflow-y: auto;
|
|
28
|
-
`;
|
|
29
|
-
const Actions = styled(ButtonGroup) `
|
|
30
|
-
align-items: center;
|
|
31
|
-
box-shadow: 0 -2px 12px 0 rgba(216, 216, 216, 0.26);
|
|
32
|
-
display: flex;
|
|
33
|
-
justify-content: space-between;
|
|
34
|
-
padding: ${(props) => props.theme.grid.unit * 4}px;
|
|
35
|
-
`;
|
|
36
|
-
const Container = styled.div `
|
|
37
|
-
flex: 1;
|
|
38
|
-
font-family: ${(props) => props.theme.font.family.sans};
|
|
39
|
-
`;
|
|
40
|
-
const ImportButton = ({ importItems, importing, }) => (React.createElement(IconTextButton, { onClick: importItems },
|
|
41
|
-
React.createElement(Tip, { title: 'Import bibliography data from a BibTeX or RIS file', placement: 'top' }, importing ? ('Importing…') : (React.createElement(React.Fragment, null,
|
|
42
|
-
React.createElement(UploadIcon, null),
|
|
43
|
-
"Import from file")))));
|
|
44
|
-
export const CitationSearch = ({ bibliographyItems, handleCite, addCitation, importItems: _importItems, query: initialQuery, handleCancel, }) => {
|
|
45
|
-
const [error, setError] = useState();
|
|
46
|
-
const [selectedSource, setSelectedSource] = useState();
|
|
47
|
-
const [query, setQuery] = useState(initialQuery);
|
|
48
|
-
const [selected, setSelected] = useState(new Map());
|
|
49
|
-
const [fetching, setFetching] = useState(new Set());
|
|
50
|
-
const [sources, setSources] = useState();
|
|
51
|
-
const [updated, setUpdated] = useState(Date.now());
|
|
52
|
-
const searchLibrary = useCallback((query, params) => {
|
|
53
|
-
return filterLibrary(bibliographyItems, query).then((items) => ({
|
|
54
|
-
items: items.slice(0, params.rows),
|
|
55
|
-
total: items.length,
|
|
56
|
-
}));
|
|
57
|
-
}, [bibliographyItems]);
|
|
58
|
-
const [cancelTokenSource, setCancelTokenSource] = useState();
|
|
59
|
-
const apiSearchCallback = useCallback((query, params, mailto) => {
|
|
60
|
-
cancelTokenSource?.cancel();
|
|
61
|
-
const sourceToken = axios.CancelToken.source();
|
|
62
|
-
setCancelTokenSource(sourceToken);
|
|
63
|
-
return crossref.search(query, params.rows, mailto, sourceToken.token);
|
|
64
|
-
}, [cancelTokenSource]);
|
|
65
|
-
useEffect(() => {
|
|
66
|
-
const sources = [
|
|
67
|
-
{
|
|
68
|
-
id: 'library',
|
|
69
|
-
title: 'Document',
|
|
70
|
-
search: searchLibrary,
|
|
71
|
-
},
|
|
72
|
-
];
|
|
73
|
-
if (query.trim().length > 2) {
|
|
74
|
-
sources.push({
|
|
75
|
-
id: 'crossref',
|
|
76
|
-
title: 'External sources',
|
|
77
|
-
search: apiSearchCallback,
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
setSources(sources);
|
|
81
|
-
}, [apiSearchCallback, query, searchLibrary]);
|
|
82
|
-
const addToSelection = useCallback((id, data) => {
|
|
83
|
-
if (selected.has(id)) {
|
|
84
|
-
selected.delete(id); // remove item
|
|
85
|
-
setSelected(new Map([...selected]));
|
|
86
|
-
}
|
|
87
|
-
else if (data._id) {
|
|
88
|
-
selected.set(id, data); // re-use existing data model
|
|
89
|
-
setSelected(new Map([...selected]));
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
setFetching((fetching) => {
|
|
93
|
-
fetching.add(id);
|
|
94
|
-
return new Set([...fetching]);
|
|
95
|
-
});
|
|
96
|
-
// fetch Citeproc JSON
|
|
97
|
-
crossref
|
|
98
|
-
.fetch(data)
|
|
99
|
-
.then((result) => {
|
|
100
|
-
// remove DOI URLs
|
|
101
|
-
if (result.URL &&
|
|
102
|
-
result.URL.match(/^https?:\/\/(dx\.)?doi\.org\//)) {
|
|
103
|
-
delete result.URL;
|
|
104
|
-
}
|
|
105
|
-
setSelected((selected) => {
|
|
106
|
-
selected.set(id, buildBibliographyItem({
|
|
107
|
-
...result,
|
|
108
|
-
type: result.type == 'journal-article'
|
|
109
|
-
? 'article-journal'
|
|
110
|
-
: result.type,
|
|
111
|
-
}));
|
|
112
|
-
return new Map([...selected]);
|
|
113
|
-
});
|
|
114
|
-
window.setTimeout(() => {
|
|
115
|
-
setFetching((fetching) => {
|
|
116
|
-
fetching.delete(id);
|
|
117
|
-
return new Set([...fetching]);
|
|
118
|
-
});
|
|
119
|
-
}, 100);
|
|
120
|
-
})
|
|
121
|
-
.catch((error) => {
|
|
122
|
-
setError(error.message);
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
}, [selected]);
|
|
126
|
-
const handleCiteClick = useCallback(() => {
|
|
127
|
-
const items = Array.from(selected.values());
|
|
128
|
-
return handleCite(items);
|
|
129
|
-
}, [handleCite, selected]);
|
|
130
|
-
const debouncedCallback = debounce((value) => setQuery(value.trim()), 800);
|
|
131
|
-
const debouncedSetQuery = useCallback((event) => debouncedCallback(event.target.value), [debouncedCallback]);
|
|
132
|
-
const importItems = useCallback((items) => {
|
|
133
|
-
return _importItems(items).then((newItems) => {
|
|
134
|
-
setSelected((selected) => {
|
|
135
|
-
// if there's a single new imported item, select it
|
|
136
|
-
if (newItems.length === 1) {
|
|
137
|
-
const [newItem] = newItems;
|
|
138
|
-
const estimatedID = estimateID(newItem);
|
|
139
|
-
selected.set(estimatedID, newItem);
|
|
140
|
-
}
|
|
141
|
-
return new Map([...selected]);
|
|
142
|
-
});
|
|
143
|
-
// clear the query after importing items
|
|
144
|
-
setQuery('');
|
|
145
|
-
// ensure that the filters re-run
|
|
146
|
-
setUpdated(Date.now());
|
|
147
|
-
return newItems;
|
|
148
|
-
});
|
|
149
|
-
}, [_importItems]);
|
|
150
|
-
if (!sources) {
|
|
151
|
-
return null;
|
|
152
|
-
}
|
|
153
|
-
return (React.createElement(Container, null,
|
|
154
|
-
React.createElement(SearchWrapper, null,
|
|
155
|
-
React.createElement(Search, { autoComplete: 'off', handleSearchChange: debouncedSetQuery, placeholder: 'Search', defaultValue: initialQuery, type: 'search' })),
|
|
156
|
-
React.createElement(Results, null,
|
|
157
|
-
error && React.createElement("div", null, error),
|
|
158
|
-
sources.map((source) => (React.createElement(CitationSearchSection, { key: `${source.id}-${updated}`, source: source, addToSelection: addToSelection, selectSource: () => setSelectedSource(source.id), selected: selected, fetching: fetching, query: query, rows: selectedSource === source.id ? 25 : 3 })))),
|
|
159
|
-
React.createElement(Actions, null,
|
|
160
|
-
React.createElement(AddCitationActions, null,
|
|
161
|
-
React.createElement(BibliographyImportButton, { importItems: importItems, component: ImportButton }),
|
|
162
|
-
React.createElement(IconTextButton, { onClick: addCitation },
|
|
163
|
-
React.createElement(TemplateIcon, null),
|
|
164
|
-
"Add new")),
|
|
165
|
-
React.createElement(ButtonGroup, null,
|
|
166
|
-
React.createElement(SecondaryButton, { onClick: handleCancel }, "Close"),
|
|
167
|
-
React.createElement(PrimaryButton, { onClick: handleCiteClick, disabled: selected.size === 0 }, "Cite")))));
|
|
168
|
-
};
|
|
169
|
-
const AddCitationActions = styled(ButtonGroup) `
|
|
170
|
-
button {
|
|
171
|
-
margin-right: ${(props) => props.theme.grid.unit * 8}px;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
button:hover,
|
|
175
|
-
button:active {
|
|
176
|
-
path {
|
|
177
|
-
stroke: ${(props) => props.theme.colors.brand.medium};
|
|
178
|
-
}
|
|
179
|
-
rect {
|
|
180
|
-
stroke: ${(props) => props.theme.colors.brand.medium};
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
`;
|
|
184
|
-
//# sourceMappingURL=CitationSearch.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CitationSearch.js","sourceRoot":"","sources":["../../../../../src/components/library/CitationSearch.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAEnD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,EACL,WAAW,EACX,cAAc,EACd,aAAa,EACb,eAAe,EACf,GAAG,EACH,UAAU,GACX,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAS,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AACrE,OAAO,KAA4B,MAAM,OAAO,CAAA;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AACpC,OAAO,KAAK,EAAE,EAAe,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C,IAAI,CAAC,IAAI,GAAG,CAAC;;;;;;gBAMxC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM;;;gBAG1C,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM;;;CAGzD,CAAA"}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* The contents of this file are subject to the Common Public Attribution License Version 1.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://mpapp-public.gitlab.io/manuscripts-frontend/LICENSE. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.
|
|
3
|
-
*
|
|
4
|
-
* Software distributed under the License is distributed on an “AS IS” basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
|
|
5
|
-
*
|
|
6
|
-
* The Original Code is manuscripts-frontend.
|
|
7
|
-
*
|
|
8
|
-
* The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
|
|
9
|
-
*
|
|
10
|
-
* All portions of the code written by Atypon Systems LLC are Copyright (c) 2019 Atypon Systems LLC. All Rights Reserved.
|
|
11
|
-
*/
|
|
12
|
-
import ArrowDownBlack from '@manuscripts/assets/react/ArrowDownBlack';
|
|
13
|
-
import { SecondaryButton } from '@manuscripts/style-guide';
|
|
14
|
-
import React, { useCallback, useEffect, useState } from 'react';
|
|
15
|
-
import styled from 'styled-components';
|
|
16
|
-
import config from '../../config';
|
|
17
|
-
import { SearchResults } from './SearchResults';
|
|
18
|
-
const ResultsSection = styled.div `
|
|
19
|
-
margin: ${(props) => props.theme.grid.unit * 2}px 0;
|
|
20
|
-
`;
|
|
21
|
-
const SearchSource = styled.div `
|
|
22
|
-
margin: 0 ${(props) => props.theme.grid.unit * 4}px
|
|
23
|
-
${(props) => props.theme.grid.unit * 2}px;
|
|
24
|
-
color: ${(props) => props.theme.colors.text.secondary};
|
|
25
|
-
cursor: pointer;
|
|
26
|
-
|
|
27
|
-
&:hover {
|
|
28
|
-
color: ${(props) => props.theme.colors.text.muted};
|
|
29
|
-
}
|
|
30
|
-
`;
|
|
31
|
-
const MoreButton = styled(SecondaryButton) `
|
|
32
|
-
font-size: inherit;
|
|
33
|
-
text-transform: none;
|
|
34
|
-
text-decoration: underline;
|
|
35
|
-
border: none;
|
|
36
|
-
margin-left: ${(props) => props.theme.grid.unit * 4}px;
|
|
37
|
-
color: ${(props) => props.theme.colors.button.default.color.default};
|
|
38
|
-
`;
|
|
39
|
-
const DropdownChevron = styled(ArrowDownBlack) `
|
|
40
|
-
margin-right: ${(props) => props.theme.grid.unit * 4}px;
|
|
41
|
-
width: ${(props) => props.theme.grid.unit * 6}px;
|
|
42
|
-
`;
|
|
43
|
-
export const CitationSearchSection = ({ query, source, addToSelection, selectSource, rows, selected, fetching, }) => {
|
|
44
|
-
const [error, setError] = useState();
|
|
45
|
-
const [expanded, setExpanded] = useState(true);
|
|
46
|
-
const [searching, setSearching] = useState(false);
|
|
47
|
-
const [showMoreSearching, setShowMoreSearching] = useState(false);
|
|
48
|
-
const [results, setResults] = useState();
|
|
49
|
-
useEffect(() => {
|
|
50
|
-
setError(undefined);
|
|
51
|
-
setResults(undefined);
|
|
52
|
-
setShowMoreSearching(false);
|
|
53
|
-
setSearching(query !== '');
|
|
54
|
-
}, [query]);
|
|
55
|
-
const handleSearchResults = useCallback((searchQuery, results) => {
|
|
56
|
-
if (searchQuery === query) {
|
|
57
|
-
setError(undefined);
|
|
58
|
-
setSearching(false);
|
|
59
|
-
setShowMoreSearching(false);
|
|
60
|
-
setResults(results);
|
|
61
|
-
}
|
|
62
|
-
}, [query]);
|
|
63
|
-
useEffect(() => {
|
|
64
|
-
if (!expanded) {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
if (source.id !== 'library' && !query) {
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
source
|
|
71
|
-
.search(query, { rows }, config.support.email)
|
|
72
|
-
.then((results) => {
|
|
73
|
-
handleSearchResults(query, results);
|
|
74
|
-
})
|
|
75
|
-
.catch((error) => {
|
|
76
|
-
setError(error.message);
|
|
77
|
-
});
|
|
78
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
79
|
-
}, [query, expanded, handleSearchResults, rows]);
|
|
80
|
-
const toggleExpanded = useCallback(() => {
|
|
81
|
-
setExpanded((value) => !value);
|
|
82
|
-
}, []);
|
|
83
|
-
const showMoreCallback = useCallback(() => {
|
|
84
|
-
selectSource(source.id);
|
|
85
|
-
setSearching(true);
|
|
86
|
-
setShowMoreSearching(true);
|
|
87
|
-
}, [selectSource, source.id]);
|
|
88
|
-
return (React.createElement(ResultsSection, null,
|
|
89
|
-
React.createElement(SearchSource, { onClick: toggleExpanded },
|
|
90
|
-
React.createElement(DropdownChevron, { style: {
|
|
91
|
-
transform: expanded ? 'rotate(0)' : 'rotate(-90deg)',
|
|
92
|
-
} }),
|
|
93
|
-
source.title),
|
|
94
|
-
expanded && (React.createElement(SearchResults, { error: error, results: results, searching: searching, showMoreSearching: showMoreSearching, handleSelect: addToSelection, selected: selected, fetching: fetching })),
|
|
95
|
-
showMoreSearching && React.createElement(SearchingLabel, null, "Searching...."),
|
|
96
|
-
expanded && results && results.total > rows && rows < 25 && (React.createElement(MoreButton, { onClick: showMoreCallback, "data-cy": 'more-button' }, "Show more"))));
|
|
97
|
-
};
|
|
98
|
-
export const SearchingLabel = styled.div `
|
|
99
|
-
color: ${(props) => props.theme.colors.text.secondary};
|
|
100
|
-
margin: ${(props) => props.theme.grid.unit * 4}px
|
|
101
|
-
${(props) => props.theme.grid.unit * 5}px;
|
|
102
|
-
`;
|
|
103
|
-
//# sourceMappingURL=CitationSearchSection.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":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,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,gBAAgB;iBACrD,GACD;YACD,MAAM,CAAC,KAAK,CACA;QAEd,QAAQ,IAAI,CACX,oBAAC,aAAa,IACZ,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,iBAAiB,EAAE,iBAAiB,EACpC,YAAY,EAAE,cAAc,EAC5B,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,GAClB,CACH;QAEA,iBAAiB,IAAI,oBAAC,cAAc,wBAA+B;QACnE,QAAQ,IAAI,OAAO,IAAI,OAAO,CAAC,KAAK,GAAG,IAAI,IAAI,IAAI,GAAG,EAAE,IAAI,CAC3D,oBAAC,UAAU,IAAC,OAAO,EAAE,gBAAgB,aAAW,aAAa,gBAEhD,CACd,CACc,CAClB,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAA;WAC7B,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS;YAC3C,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC;MAC1C,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC;CACzC,CAAA"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* The contents of this file are subject to the Common Public Attribution License Version 1.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://mpapp-public.gitlab.io/manuscripts-frontend/LICENSE. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.
|
|
3
|
-
*
|
|
4
|
-
* Software distributed under the License is distributed on an “AS IS” basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
|
|
5
|
-
*
|
|
6
|
-
* The Original Code is manuscripts-frontend.
|
|
7
|
-
*
|
|
8
|
-
* The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
|
|
9
|
-
*
|
|
10
|
-
* All portions of the code written by Atypon Systems LLC are Copyright (c) 2019 Atypon Systems LLC. All Rights Reserved.
|
|
11
|
-
*/
|
|
12
|
-
import { shortLibraryItemMetadata } from '@manuscripts/library';
|
|
13
|
-
import { Title } from '@manuscripts/title-editor';
|
|
14
|
-
import React from 'react';
|
|
15
|
-
import styled from 'styled-components';
|
|
16
|
-
const CitedItem = styled.div `
|
|
17
|
-
padding: ${(props) => props.theme.grid.unit * 4}px 0;
|
|
18
|
-
cursor: pointer;
|
|
19
|
-
|
|
20
|
-
&:not(:last-of-type) {
|
|
21
|
-
border-bottom: 1px solid ${(props) => props.theme.colors.border.tertiary};
|
|
22
|
-
}
|
|
23
|
-
`;
|
|
24
|
-
const CitedItemTitle = styled(Title) ``;
|
|
25
|
-
const CitedItemAuthors = styled.div `
|
|
26
|
-
margin-top: ${(props) => props.theme.grid.unit}px;
|
|
27
|
-
color: ${(props) => props.theme.colors.text.secondary};
|
|
28
|
-
flex: 1;
|
|
29
|
-
white-space: nowrap;
|
|
30
|
-
text-overflow: ellipsis;
|
|
31
|
-
overflow: hidden;
|
|
32
|
-
`;
|
|
33
|
-
const CitedItems = styled.div `
|
|
34
|
-
padding: 0 ${(props) => props.theme.grid.unit * 4}px;
|
|
35
|
-
font-family: ${(props) => props.theme.font.family.sans};
|
|
36
|
-
max-height: 70vh;
|
|
37
|
-
overflow-y: auto;
|
|
38
|
-
`;
|
|
39
|
-
export const CitationViewer = ({ items }) => (React.createElement(CitedItems, null, items.map((item) => (React.createElement(CitedItem, { key: item._id, onClick: () => {
|
|
40
|
-
if (item.DOI) {
|
|
41
|
-
window.open(`https://doi.org/${item.DOI}`);
|
|
42
|
-
}
|
|
43
|
-
} },
|
|
44
|
-
React.createElement(CitedItemTitle, { value: item.title || 'Untitled' }),
|
|
45
|
-
React.createElement(CitedItemAuthors, null, shortLibraryItemMetadata(item)))))));
|
|
46
|
-
//# sourceMappingURL=CitationViewer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CitationViewer.js","sourceRoot":"","sources":["../../../../../src/components/library/CitationViewer.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAA;AACjD,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAEtC,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAA;aACf,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC;;;;+BAIlB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ;;CAE3E,CAAA;AAED,MAAM,cAAc,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA,EAAE,CAAA;AAEtC,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAA;gBACnB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI;WACrC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS;;;;;CAKtD,CAAA;AAED,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAA;eACd,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC;iBAClC,CAAC,KAAK,EAAE,EA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