@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
|
@@ -35,7 +35,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
35
35
|
};
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
37
|
exports.SidebarContent = exports.ModalBody = exports.StyledModalMain = exports.ModalSidebar = exports.Sidebar = void 0;
|
|
38
|
-
const style_guide_1 = require("@manuscripts/style-guide");
|
|
39
38
|
const styled_components_1 = __importStar(require("styled-components"));
|
|
40
39
|
const SidebarCommonStyles = (0, styled_components_1.css) `
|
|
41
40
|
box-sizing: border-box;
|
|
@@ -61,7 +60,7 @@ exports.ModalSidebar = styled_components_1.default.div `
|
|
|
61
60
|
overflow: auto;
|
|
62
61
|
width: 340px;
|
|
63
62
|
`;
|
|
64
|
-
exports.StyledModalMain =
|
|
63
|
+
exports.StyledModalMain = styled_components_1.default.div `
|
|
65
64
|
box-sizing: border-box;
|
|
66
65
|
max-width: 60vw;
|
|
67
66
|
width: 480px;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sidebar.js","sourceRoot":"","sources":["../../../../../src/components/Sidebar/Sidebar.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,
|
|
1
|
+
{"version":3,"file":"Sidebar.js","sourceRoot":"","sources":["../../../../../src/components/Sidebar/Sidebar.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uEAA+C;AAE/C,MAAM,mBAAmB,GAAG,IAAA,uBAAG,EAAA;;;;;aAKlB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC;MAC3C,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC;;;CAGzC,CAAA;AAEY,QAAA,OAAO,GAAG,2BAAM,CAAC,GAAG,CAAA;IAC7B,mBAAmB;gBACP,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS;4BACtC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ;CACxE,CAAA;AAEY,QAAA,YAAY,GAAG,2BAAM,CAAC,GAAG,CAAA;IAClC,mBAAmB;sBACD,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS;4BAC5C,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO;+BACvC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO;;;;CAIxE,CAAA;AAEY,QAAA,eAAe,GAAG,2BAAM,CAAC,GAAG,CAAA;;;;CAIxC,CAAA;AAEY,QAAA,SAAS,GAAG,2BAAM,CAAC,GAAG,CAAA;;;;;;CAMlC,CAAA;AAEY,QAAA,cAAc,GAAG,2BAAM,CAAC,GAAG,CAAA;;eAEzB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC;;;;CAIlD,CAAA"}
|
|
@@ -20,19 +20,12 @@ const style_guide_1 = require("@manuscripts/style-guide");
|
|
|
20
20
|
const track_changes_plugin_1 = require("@manuscripts/track-changes-plugin");
|
|
21
21
|
const transform_1 = require("@manuscripts/transform");
|
|
22
22
|
const lodash_1 = require("lodash");
|
|
23
|
-
const react_1 = __importDefault(require("react"));
|
|
24
|
-
const react_dom_1 = __importDefault(require("react-dom"));
|
|
25
23
|
const react_router_1 = require("react-router");
|
|
26
|
-
const CitationEditor_1 = __importDefault(require("../components/library/CitationEditor"));
|
|
27
|
-
const CitationViewer_1 = require("../components/library/CitationViewer");
|
|
28
|
-
const ReferencesEditor_1 = require("../components/library/ReferencesEditor");
|
|
29
|
-
const ReferencesViewer_1 = require("../components/library/ReferencesViewer");
|
|
30
24
|
const AuthorsInlineViewContainer_1 = __importDefault(require("../components/metadata/AuthorsInlineViewContainer"));
|
|
31
25
|
const config_1 = __importDefault(require("../config"));
|
|
32
26
|
const QuarterbackStepsExchanger_1 = require("../quarterback/QuarterbackStepsExchanger");
|
|
33
27
|
const store_1 = require("../store");
|
|
34
28
|
const theme_1 = require("../theme/theme");
|
|
35
|
-
const ThemeProvider_1 = require("../theme/ThemeProvider");
|
|
36
29
|
const useCreateEditor = () => {
|
|
37
30
|
const [{ doc, ancestorDoc, manuscript, project, popper, user, modelMap, commitAtLoad, fileManagement, initialDocVersion, style, locale, authToken, }, dispatch, getState, subscribe,] = (0, store_1.useStore)((store) => ({
|
|
38
31
|
doc: store.doc,
|
|
@@ -123,20 +116,9 @@ const useCreateEditor = () => {
|
|
|
123
116
|
}
|
|
124
117
|
},
|
|
125
118
|
getModelMap,
|
|
126
|
-
saveModel,
|
|
127
119
|
deleteModel,
|
|
128
120
|
retrySync,
|
|
129
|
-
renderReactComponent: (child, container) => {
|
|
130
|
-
if (child && typeof child !== 'boolean') {
|
|
131
|
-
react_dom_1.default.render(react_1.default.createElement(ThemeProvider_1.ThemeProvider, null, child), container);
|
|
132
|
-
}
|
|
133
|
-
},
|
|
134
|
-
unmountReactComponent: react_dom_1.default.unmountComponentAtNode,
|
|
135
121
|
components: {
|
|
136
|
-
ReferencesEditor: ReferencesEditor_1.ReferencesEditor,
|
|
137
|
-
ReferencesViewer: ReferencesViewer_1.ReferencesViewer,
|
|
138
|
-
CitationEditor: CitationEditor_1.default,
|
|
139
|
-
CitationViewer: CitationViewer_1.CitationViewer,
|
|
140
122
|
AuthorsInlineViewContainer: AuthorsInlineViewContainer_1.default,
|
|
141
123
|
},
|
|
142
124
|
subscribeStore: subscribe,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-create-editor.js","sourceRoot":"","sources":["../../../../src/hooks/use-create-editor.tsx"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;GAUG;AACH,0DAAoD;AAEpD,0DAAmF;AACnF,4EAAsE;AACtE,sDAAiE;AACjE,mCAAgC;AAChC
|
|
1
|
+
{"version":3,"file":"use-create-editor.js","sourceRoot":"","sources":["../../../../src/hooks/use-create-editor.tsx"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;GAUG;AACH,0DAAoD;AAEpD,0DAAmF;AACnF,4EAAsE;AACtE,sDAAiE;AACjE,mCAAgC;AAChC,+CAAyC;AAEzC,mHAA0F;AAC1F,uDAA8B;AAC9B,wFAAyE;AACzE,oCAAmC;AACnC,0CAAsC;AAE/B,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,MAAM,CACJ,EACE,GAAG,EACH,WAAW,EACX,UAAU,EACV,OAAO,EACP,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,KAAK,EACL,MAAM,EACN,SAAS,GACV,EACD,QAAQ,EACR,QAAQ,EACR,SAAS,EACV,GAAG,IAAA,gBAAQ,EAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACvB,GAAG,EAAE,KAAK,CAAC,GAAG;QACd,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,YAAY,EAAE,KAAK,CAAC,YAAY;QAChC,cAAc,EAAE,KAAK,CAAC,cAAc;QACpC,iBAAiB,EAAE,KAAK,CAAC,iBAAiB;QAC1C,KAAK,EAAE,KAAK,CAAC,QAAQ;QACrB,MAAM,EAAE,KAAK,CAAC,SAAS;QACvB,SAAS,EAAE,KAAK,CAAC,SAAS;KAC3B,CAAC,CAAC,CAAA;IAEH,MAAM,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AW,EAAE,WAAW;QACxB,MAAM,EAAE,YAAY,IAAI,IAAI;QAC5B,KAAK,EAAL,aAAK;QACL,eAAe,EAAE,GAAG,EAAE;YACpB,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAA;YACxB,OAAO,eAAe,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAA;QAC3E,CAAC;QACD,QAAQ,EAAE,GAAG,EAAE;YACb,OAAO,QAAQ,EAAE,CAAC,KAAK,CAAA;QACzB,CAAC;QACD,cAAc,EAAE,cAAc;QAC9B,cAAc,EAAE,IAAA,0CAAc,EAC5B,UAAU,CAAC,GAAG,EACd,OAAO,CAAC,GAAG,EACX,iBAAiB,EACjB,SAAS,CACV;KACF,CAAA;IAED,MAAM,MAAM,GAAG,IAAA,uBAAS,EAAC,KAAK,CAAC,CAAA;IAC/B,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AArJY,QAAA,eAAe,mBAqJ3B"}
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
*
|
|
10
10
|
* All portions of the code written by Atypon Systems LLC are Copyright (c) 2019 Atypon Systems LLC. All Rights Reserved.
|
|
11
11
|
*/
|
|
12
|
-
import { ModalMain } from '@manuscripts/style-guide';
|
|
13
12
|
import styled, { css } from 'styled-components';
|
|
14
13
|
const SidebarCommonStyles = css `
|
|
15
14
|
box-sizing: border-box;
|
|
@@ -35,7 +34,7 @@ export const ModalSidebar = styled.div `
|
|
|
35
34
|
overflow: auto;
|
|
36
35
|
width: 340px;
|
|
37
36
|
`;
|
|
38
|
-
export const StyledModalMain = styled
|
|
37
|
+
export const StyledModalMain = styled.div `
|
|
39
38
|
box-sizing: border-box;
|
|
40
39
|
max-width: 60vw;
|
|
41
40
|
width: 480px;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sidebar.js","sourceRoot":"","sources":["../../../../../src/components/Sidebar/Sidebar.tsx"],"names":[],"mappings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;;;CAMlC,CAAA;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAA;;eAEzB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC;;;;CAIlD,CAAA"}
|
|
@@ -14,19 +14,12 @@ import { getCapabilities as getActionCapabilities } from '@manuscripts/style-gui
|
|
|
14
14
|
import { trackChangesPlugin } from '@manuscripts/track-changes-plugin';
|
|
15
15
|
import { buildContribution } from '@manuscripts/transform';
|
|
16
16
|
import { memoize } from 'lodash';
|
|
17
|
-
import React from 'react';
|
|
18
|
-
import ReactDOM from 'react-dom';
|
|
19
17
|
import { useHistory } from 'react-router';
|
|
20
|
-
import CitationEditor from '../components/library/CitationEditor';
|
|
21
|
-
import { CitationViewer } from '../components/library/CitationViewer';
|
|
22
|
-
import { ReferencesEditor } from '../components/library/ReferencesEditor';
|
|
23
|
-
import { ReferencesViewer } from '../components/library/ReferencesViewer';
|
|
24
18
|
import AuthorsInlineViewContainer from '../components/metadata/AuthorsInlineViewContainer';
|
|
25
19
|
import config from '../config';
|
|
26
20
|
import { stepsExchanger } from '../quarterback/QuarterbackStepsExchanger';
|
|
27
21
|
import { useStore } from '../store';
|
|
28
22
|
import { theme } from '../theme/theme';
|
|
29
|
-
import { ThemeProvider } from '../theme/ThemeProvider';
|
|
30
23
|
export const useCreateEditor = () => {
|
|
31
24
|
const [{ doc, ancestorDoc, manuscript, project, popper, user, modelMap, commitAtLoad, fileManagement, initialDocVersion, style, locale, authToken, }, dispatch, getState, subscribe,] = useStore((store) => ({
|
|
32
25
|
doc: store.doc,
|
|
@@ -117,20 +110,9 @@ export const useCreateEditor = () => {
|
|
|
117
110
|
}
|
|
118
111
|
},
|
|
119
112
|
getModelMap,
|
|
120
|
-
saveModel,
|
|
121
113
|
deleteModel,
|
|
122
114
|
retrySync,
|
|
123
|
-
renderReactComponent: (child, container) => {
|
|
124
|
-
if (child && typeof child !== 'boolean') {
|
|
125
|
-
ReactDOM.render(React.createElement(ThemeProvider, null, child), container);
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
unmountReactComponent: ReactDOM.unmountComponentAtNode,
|
|
129
115
|
components: {
|
|
130
|
-
ReferencesEditor,
|
|
131
|
-
ReferencesViewer,
|
|
132
|
-
CitationEditor,
|
|
133
|
-
CitationViewer,
|
|
134
116
|
AuthorsInlineViewContainer,
|
|
135
117
|
},
|
|
136
118
|
subscribeStore: subscribe,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-create-editor.js","sourceRoot":"","sources":["../../../../src/hooks/use-create-editor.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAEpD,OAAO,EAAE,eAAe,IAAI,qBAAqB,EAAE,MAAM,0BAA0B,CAAA;AACnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AACtE,OAAO,EAAS,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAChC,OAAO,
|
|
1
|
+
{"version":3,"file":"use-create-editor.js","sourceRoot":"","sources":["../../../../src/hooks/use-create-editor.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAEpD,OAAO,EAAE,eAAe,IAAI,qBAAqB,EAAE,MAAM,0BAA0B,CAAA;AACnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AACtE,OAAO,EAAS,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,OAAO,0BAA0B,MAAM,mDAAmD,CAAA;AAC1F,OAAO,MAAM,MAAM,WA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;QACD,QAAQ,EAAE,GAAG,EAAE;YACb,OAAO,QAAQ,EAAE,CAAC,KAAK,CAAA;QACzB,CAAC;QACD,cAAc,EAAE,cAAc;QAC9B,cAAc,EAAE,cAAc,CAC5B,UAAU,CAAC,GAAG,EACd,OAAO,CAAC,GAAG,EACX,iBAAiB,EACjB,SAAS,CACV;KACF,CAAA;IAED,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC,CAAA;IAC/B,OAAO,MAAM,CAAA;AACf,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manuscripts/article-editor",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.5-LEAN-3092-0",
|
|
4
4
|
"license": "CPAL-1.0",
|
|
5
5
|
"description": "React components for editing and viewing manuscripts",
|
|
6
6
|
"repository": "github:Atypon-OpenSource/manuscripts-article-editor",
|
|
@@ -38,20 +38,19 @@
|
|
|
38
38
|
"@fontsource/pt-sans": "^4.5.11",
|
|
39
39
|
"@fontsource/pt-serif": "^4.5.11",
|
|
40
40
|
"@manuscripts/assets": "^0.6.4",
|
|
41
|
-
"@manuscripts/body-editor": "1.6.
|
|
42
|
-
"@manuscripts/json-schema": "
|
|
43
|
-
"@manuscripts/library": "1.3.2",
|
|
44
|
-
"@manuscripts/style-guide": "1.
|
|
41
|
+
"@manuscripts/body-editor": "1.6.14-LEAN-3094",
|
|
42
|
+
"@manuscripts/json-schema": "2.2.2-LEAN-3093",
|
|
43
|
+
"@manuscripts/library": "1.3.2-LEAN-3092-0",
|
|
44
|
+
"@manuscripts/style-guide": "1.7.0-LEAN-3092-0",
|
|
45
45
|
"@manuscripts/title-editor": "^1.1.0",
|
|
46
46
|
"@manuscripts/track-changes-plugin": "^1.7.5",
|
|
47
|
-
"@manuscripts/transform": "2.0.4",
|
|
47
|
+
"@manuscripts/transform": "2.0.4-LEAN-3093",
|
|
48
48
|
"@microsoft/fetch-event-source": "^2.0.1",
|
|
49
49
|
"@reach/tabs": "^0.11.2",
|
|
50
50
|
"autotrack": "^2.4.1",
|
|
51
51
|
"axios": "^1.2.2",
|
|
52
52
|
"blob-to-buffer": "^1.2.9",
|
|
53
53
|
"broadcast-channel": "^5.0.2",
|
|
54
|
-
"fuzzysort": "^2.0.4",
|
|
55
54
|
"graphql": "^15.8.0",
|
|
56
55
|
"graphql-tag": "^2.11.0",
|
|
57
56
|
"history": "^4.10.1",
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* 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.
|
|
4
|
-
*
|
|
5
|
-
* 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.
|
|
6
|
-
*
|
|
7
|
-
* The Original Code is manuscripts-frontend.
|
|
8
|
-
*
|
|
9
|
-
* The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
|
|
10
|
-
*
|
|
11
|
-
* All portions of the code written by Atypon Systems LLC are Copyright (c) 2019 Atypon Systems LLC. All Rights Reserved.
|
|
12
|
-
*/
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.SelectField = void 0;
|
|
18
|
-
const react_1 = __importDefault(require("react"));
|
|
19
|
-
const react_select_1 = __importDefault(require("react-select"));
|
|
20
|
-
const SelectField = ({ id, options, field, form, }) => (react_1.default.createElement(react_select_1.default, { inputId: id, options: options, name: field.name, value: options
|
|
21
|
-
? options.find((option) => option.value === field.value)
|
|
22
|
-
: undefined, onChange: (option) => form.setFieldValue(field.name, option.value), onBlur: field.onBlur }));
|
|
23
|
-
exports.SelectField = SelectField;
|
|
24
|
-
//# sourceMappingURL=SelectField.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SelectField.js","sourceRoot":"","sources":["../../../../src/components/SelectField.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;;;;AAGH,kDAAyB;AACzB,gEAAiC;AAY1B,MAAM,WAAW,GAAgD,CAAC,EACvE,EAAE,EACF,OAAO,EACP,KAAK,EACL,IAAI,GACL,EAAE,EAAE,CAAC,CACJ,8BAAC,sBAAM,IACL,OAAO,EAAE,EAAE,EACX,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,KAAK,EACH,OAAO;QACL,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,KAAK,KAAK,CAAC,KAAK,CAAC;QACxD,CAAC,CAAC,SAAS,EAEf,QAAQ,EAAE,CAAC,MAAkB,EAAE,EAAE,CAC/B,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,EAE9C,MAAM,EAAE,KAAK,CAAC,MAAM,GACpB,CACH,CAAA;AApBY,QAAA,WAAW,eAoBvB"}
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* 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.
|
|
4
|
-
*
|
|
5
|
-
* 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.
|
|
6
|
-
*
|
|
7
|
-
* The Original Code is manuscripts-frontend.
|
|
8
|
-
*
|
|
9
|
-
* The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
|
|
10
|
-
*
|
|
11
|
-
* All portions of the code written by Atypon Systems LLC are Copyright (c) 2019 Atypon Systems LLC. All Rights Reserved.
|
|
12
|
-
*/
|
|
13
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
-
}
|
|
19
|
-
Object.defineProperty(o, k2, desc);
|
|
20
|
-
}) : (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
o[k2] = m[k];
|
|
23
|
-
}));
|
|
24
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
-
}) : function(o, v) {
|
|
27
|
-
o["default"] = v;
|
|
28
|
-
});
|
|
29
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
-
if (mod && mod.__esModule) return mod;
|
|
31
|
-
var result = {};
|
|
32
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
-
__setModuleDefault(result, mod);
|
|
34
|
-
return result;
|
|
35
|
-
};
|
|
36
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
-
};
|
|
39
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.BibliographyImportButton = void 0;
|
|
41
|
-
const AttentionRed_1 = __importDefault(require("@manuscripts/assets/react/AttentionRed"));
|
|
42
|
-
const Check_1 = __importDefault(require("@manuscripts/assets/react/Check"));
|
|
43
|
-
const library_1 = require("@manuscripts/library");
|
|
44
|
-
const style_guide_1 = require("@manuscripts/style-guide");
|
|
45
|
-
const transform_1 = require("@manuscripts/transform");
|
|
46
|
-
const react_1 = __importStar(require("react"));
|
|
47
|
-
const react_intl_1 = require("react-intl");
|
|
48
|
-
const errors_1 = require("../../lib/errors");
|
|
49
|
-
const ContactSupportButton_1 = require("../ContactSupportButton");
|
|
50
|
-
const NotificationProvider_1 = require("../NotificationProvider");
|
|
51
|
-
const Notifications_1 = require("../Notifications");
|
|
52
|
-
const CITATION_IMPORT_NOTIFICATION_ID = 'citation-import';
|
|
53
|
-
const createCitationImportErrorNotification = (title) => ({ removeNotification }) => (react_1.default.createElement(Notifications_1.NotificationPrompt, null,
|
|
54
|
-
react_1.default.createElement(Notifications_1.NotificationHead, null,
|
|
55
|
-
react_1.default.createElement(AttentionRed_1.default, null),
|
|
56
|
-
react_1.default.createElement(Notifications_1.NotificationMessage, null,
|
|
57
|
-
react_1.default.createElement(Notifications_1.NotificationTitle, null, title))),
|
|
58
|
-
react_1.default.createElement(Notifications_1.NotificationActions, null,
|
|
59
|
-
react_1.default.createElement(style_guide_1.SecondaryButton, { onClick: removeNotification }, "Dismiss"))));
|
|
60
|
-
const createCitationImportSuccessNotification = (count) => ({ removeNotification }) => (react_1.default.createElement(Notifications_1.NotificationPrompt, null,
|
|
61
|
-
react_1.default.createElement(Notifications_1.NotificationHead, null,
|
|
62
|
-
react_1.default.createElement(Check_1.default, { color: 'green' }),
|
|
63
|
-
react_1.default.createElement(Notifications_1.NotificationMessage, null,
|
|
64
|
-
react_1.default.createElement(Notifications_1.NotificationTitle, null,
|
|
65
|
-
react_1.default.createElement(CitationImportSuccessMessage, { count: count })))),
|
|
66
|
-
react_1.default.createElement(Notifications_1.NotificationActions, null,
|
|
67
|
-
react_1.default.createElement(style_guide_1.SecondaryButton, { onClick: removeNotification }, "Dismiss"))));
|
|
68
|
-
const openFilePicker = (acceptedExtensions, multiple = false) => new Promise((resolve, reject) => {
|
|
69
|
-
const input = document.createElement('input');
|
|
70
|
-
input.type = 'file';
|
|
71
|
-
input.accept = acceptedExtensions.join(',');
|
|
72
|
-
input.multiple = multiple;
|
|
73
|
-
const handleFocus = () => {
|
|
74
|
-
window.removeEventListener('focus', handleFocus);
|
|
75
|
-
// This event is fired before the input's change event,
|
|
76
|
-
// and before the input's FileList has been populated,
|
|
77
|
-
// so a delay is needed.
|
|
78
|
-
window.setTimeout(() => {
|
|
79
|
-
if (!input.files || !input.files.length) {
|
|
80
|
-
resolve([]);
|
|
81
|
-
}
|
|
82
|
-
}, 1000);
|
|
83
|
-
};
|
|
84
|
-
// window "focus" event, fired even if the file picker is cancelled.
|
|
85
|
-
window.addEventListener('focus', handleFocus);
|
|
86
|
-
input.addEventListener('change', () => {
|
|
87
|
-
if (input.files && input.files.length) {
|
|
88
|
-
for (const file of input.files) {
|
|
89
|
-
const ext = file.type.split('/').pop() || '';
|
|
90
|
-
const extension = ext.toLowerCase();
|
|
91
|
-
if (!acceptedExtensions.includes(extension)) {
|
|
92
|
-
const error = new errors_1.FileExtensionError(extension, acceptedExtensions);
|
|
93
|
-
reject(error);
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
resolve(Array.from(input.files));
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
resolve([]);
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
input.click();
|
|
104
|
-
});
|
|
105
|
-
exports.BibliographyImportButton = react_1.default.memo(({ importItems, component: Component }) => {
|
|
106
|
-
const { showNotification } = (0, react_1.useContext)(NotificationProvider_1.NotificationContext);
|
|
107
|
-
const [importing, setImporting] = (0, react_1.useState)(false);
|
|
108
|
-
const handleImport = (0, react_1.useCallback)(() => {
|
|
109
|
-
setImporting(true);
|
|
110
|
-
openFilePicker(['.bib', '.bibtex', '.ris'])
|
|
111
|
-
.then(async ([file]) => {
|
|
112
|
-
if (!file) {
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
const text = await window
|
|
116
|
-
.fetch(URL.createObjectURL(file))
|
|
117
|
-
.then((response) => response.text());
|
|
118
|
-
if (!text) {
|
|
119
|
-
showNotification(CITATION_IMPORT_NOTIFICATION_ID, createCitationImportErrorNotification('No bibliography items were found in this file'));
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
const ext = file.type.split('/').pop() || '';
|
|
123
|
-
const items = await (0, library_1.parseBibliography)(text, ext);
|
|
124
|
-
if (!items || !items.length) {
|
|
125
|
-
showNotification(CITATION_IMPORT_NOTIFICATION_ID, createCitationImportErrorNotification('No bibliography items were found in this file'));
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
const bibliographyItems = items.map(transform_1.buildBibliographyItem);
|
|
129
|
-
const newItems = await importItems(bibliographyItems);
|
|
130
|
-
showNotification(CITATION_IMPORT_NOTIFICATION_ID, createCitationImportSuccessNotification(newItems.length));
|
|
131
|
-
})
|
|
132
|
-
.finally(() => {
|
|
133
|
-
setImporting(false);
|
|
134
|
-
})
|
|
135
|
-
.catch(() => {
|
|
136
|
-
showNotification(CITATION_IMPORT_NOTIFICATION_ID, createCitationImportErrorNotification(react_1.default.createElement(react_1.default.Fragment, null,
|
|
137
|
-
"There was an error importing the file. Please",
|
|
138
|
-
' ',
|
|
139
|
-
react_1.default.createElement(ContactSupportButton_1.ContactSupportButton, null, "contact support"),
|
|
140
|
-
" if this persists.")));
|
|
141
|
-
});
|
|
142
|
-
}, [importItems, showNotification]);
|
|
143
|
-
return react_1.default.createElement(Component, { importItems: handleImport, importing: importing });
|
|
144
|
-
});
|
|
145
|
-
const CitationImportSuccessMessage = ({ count }) => (react_1.default.createElement(react_intl_1.FormattedMessage, { id: 'citation_import_success', defaultMessage: `{count, number} {count, plural,
|
|
146
|
-
one {record}
|
|
147
|
-
other {records}
|
|
148
|
-
} imported into the project library`, values: { count } }));
|
|
149
|
-
//# sourceMappingURL=BibliographyImportButton.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BibliographyImportButton.js","sourceRoot":"","sources":["../../../../../src/components/library/BibliographyImportButton.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,0FAAiE;AACjE,4EAAmD;AAEnD,kDAAwD;AACxD,0DAA0D;AAC1D,sDAAqE;AACrE,+CAAgE;AAChE,2CAA6C;AAE7C,6CAAqD;AACrD,kEAA8D;AAC9D,kEAGgC;AAChC,oDAMyB;AAEzB,MAAM,+BAA+B,GAAG,iBAAiB,CAAA;AAEzD,MAAM,qCAAqC,GACzC,CAAC,KAA2B,EAAyB,EAAE,CACvD,CAAC,EAAE,kBAAkB,EAAE,EAAE,EAAE,CACzB,CACE,8BAAC,kCAAkB;IACjB,8BAAC,gCAAgB;QACf,8BAAC,sBAAY,OAAG;QAChB,8BAAC,mCAAmB;YAClB,8BAAC,iCAAiB,QAAE,KAAK,CAAqB,CAC1B,CACL;IACnB,8BAAC,mCAAmB;QAClB,8BAAC,6BAAe,IAAC,OAAO,EAAE,kBAAkB,cAE1B,CACE,CACH,CACtB,CAAA;AAEL,MAAM,uCAAuC,GAC3C,CAAC,KAAa,EAAyB,EAAE,CACzC,CAAC,EAAE,kBAAkB,EAAE,EAAE,EAAE,CACzB,CACE,8BAAC,kCAAkB;IACjB,8BAAC,gCAAgB;QACf,8BAAC,eAAK,IAAC,KAAK,EAAE,OAAO,GAAI;QACzB,8BAAC,mCAAmB;YAClB,8BAAC,iCAAiB;gBAChB,8BAAC,4BAA4B,IAAC,KAAK,EAAE,KAAK,GAAI,CAC5B,CACA,CACL;IACnB,8BAAC,mCAAmB;QA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,EAAE,EAAE,KAAK,EAAE,GACjB,CACH,CAAA"}
|
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.CitedItemMetadata = exports.CitedItemTitle = void 0;
|
|
30
|
-
/*!
|
|
31
|
-
* 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.
|
|
32
|
-
*
|
|
33
|
-
* 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.
|
|
34
|
-
*
|
|
35
|
-
* The Original Code is manuscripts-frontend.
|
|
36
|
-
*
|
|
37
|
-
* The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
|
|
38
|
-
*
|
|
39
|
-
* All portions of the code written by Atypon Systems LLC are Copyright (c) 2019 Atypon Systems LLC. All Rights Reserved.
|
|
40
|
-
*/
|
|
41
|
-
const AnnotationEdit_1 = __importDefault(require("@manuscripts/assets/react/AnnotationEdit"));
|
|
42
|
-
const CloseIconDark_1 = __importDefault(require("@manuscripts/assets/react/CloseIconDark"));
|
|
43
|
-
const json_schema_1 = require("@manuscripts/json-schema");
|
|
44
|
-
const library_1 = require("@manuscripts/library");
|
|
45
|
-
const style_guide_1 = require("@manuscripts/style-guide");
|
|
46
|
-
const title_editor_1 = require("@manuscripts/title-editor");
|
|
47
|
-
const transform_1 = require("@manuscripts/transform");
|
|
48
|
-
const react_1 = __importStar(require("react"));
|
|
49
|
-
const styled_components_1 = __importStar(require("styled-components"));
|
|
50
|
-
const CitationModal_1 = require("./CitationModal");
|
|
51
|
-
const CitationSearch_1 = require("./CitationSearch");
|
|
52
|
-
const CitedItem = styled_components_1.default.div `
|
|
53
|
-
padding: ${(props) => props.theme.grid.unit * 4}px 0;
|
|
54
|
-
|
|
55
|
-
&:not(:last-of-type) {
|
|
56
|
-
border-bottom: 1px solid ${(props) => props.theme.colors.border.secondary};
|
|
57
|
-
}
|
|
58
|
-
`;
|
|
59
|
-
const textOverflow = (0, styled_components_1.css) `
|
|
60
|
-
text-overflow: ellipsis;
|
|
61
|
-
white-space: nowrap;
|
|
62
|
-
overflow: hidden;
|
|
63
|
-
`;
|
|
64
|
-
exports.CitedItemTitle = (0, styled_components_1.default)(title_editor_1.Title) `
|
|
65
|
-
${(props) => props.withOverflow && textOverflow}
|
|
66
|
-
`;
|
|
67
|
-
exports.CitedItemMetadata = styled_components_1.default.div `
|
|
68
|
-
color: ${(props) => props.theme.colors.text.secondary};
|
|
69
|
-
flex: 1;
|
|
70
|
-
font-weight: ${(props) => props.theme.font.weight.light};
|
|
71
|
-
margin-top: ${(props) => props.theme.grid.unit}px;
|
|
72
|
-
${textOverflow}
|
|
73
|
-
`;
|
|
74
|
-
const CitedItemActionLine = styled_components_1.default.div `
|
|
75
|
-
display: flex;
|
|
76
|
-
align-items: center;
|
|
77
|
-
justify-content: space-between;
|
|
78
|
-
white-space: nowrap;
|
|
79
|
-
`;
|
|
80
|
-
const CitedItemActions = styled_components_1.default.span `
|
|
81
|
-
display: inline-flex;
|
|
82
|
-
align-items: center;
|
|
83
|
-
flex-shrink: 0;
|
|
84
|
-
|
|
85
|
-
svg.remove-icon {
|
|
86
|
-
height: ${(props) => props.theme.grid.unit * 4}px;
|
|
87
|
-
width: ${(props) => props.theme.grid.unit * 4}px;
|
|
88
|
-
}
|
|
89
|
-
`;
|
|
90
|
-
const CitedItems = styled_components_1.default.div `
|
|
91
|
-
padding: 0 ${(props) => props.theme.grid.unit * 4}px;
|
|
92
|
-
font-family: ${(props) => props.theme.font.family.sans};
|
|
93
|
-
max-height: 70vh;
|
|
94
|
-
min-height: 100px;
|
|
95
|
-
overflow-y: auto;
|
|
96
|
-
`;
|
|
97
|
-
const ActionButton = (0, styled_components_1.default)(style_guide_1.IconButton).attrs({
|
|
98
|
-
size: 24,
|
|
99
|
-
}) `
|
|
100
|
-
:disabled {
|
|
101
|
-
background-color: transparent !important;
|
|
102
|
-
border-color: transparent !important;
|
|
103
|
-
color: rgb(255, 255, 255);
|
|
104
|
-
path,
|
|
105
|
-
g {
|
|
106
|
-
fill: ${(props) => props.theme.colors.background.tertiary} !important;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
:not(:disabled):focus,
|
|
110
|
-
:not(:disabled):hover {
|
|
111
|
-
path,
|
|
112
|
-
g {
|
|
113
|
-
fill: ${(props) => props.theme.colors.brand.medium} !important;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
`;
|
|
117
|
-
const Actions = styled_components_1.default.div `
|
|
118
|
-
margin: ${(props) => props.theme.grid.unit * 4}px;
|
|
119
|
-
display: flex;
|
|
120
|
-
justify-content: space-between;
|
|
121
|
-
align-items: center;
|
|
122
|
-
`;
|
|
123
|
-
const CitationEditor = ({ items, modelMap: initModelMap, saveModel, deleteModel, handleCancel, handleCite, handleClose, handleRemove, selectedText, setComment, importItems, insertBibliographyNode, citation, updatePopper, canEdit, }) => {
|
|
124
|
-
const [searching, setSearching] = (0, react_1.useState)(false);
|
|
125
|
-
const [modelMap, setModelMap] = (0, react_1.useState)(initModelMap);
|
|
126
|
-
const saveCallback = (0, react_1.useCallback)(async (item) => {
|
|
127
|
-
await saveModel({ ...item, objectType: json_schema_1.ObjectTypes.BibliographyItem });
|
|
128
|
-
setModelMap(new Map([
|
|
129
|
-
...modelMap,
|
|
130
|
-
[item._id, { ...item, objectType: json_schema_1.ObjectTypes.BibliographyItem }],
|
|
131
|
-
]));
|
|
132
|
-
updatePopper();
|
|
133
|
-
}, [modelMap, saveModel, updatePopper]);
|
|
134
|
-
const [showEditModel, setShowEditModel] = (0, react_1.useState)(false);
|
|
135
|
-
const [selectedItem, setSelectedItem] = (0, react_1.useState)();
|
|
136
|
-
const referenceIdRef = (0, react_1.useRef)('');
|
|
137
|
-
const onCitationEditClick = (0, react_1.useCallback)((e) => {
|
|
138
|
-
const itemId = e.currentTarget.value;
|
|
139
|
-
const reference = modelMap.get(itemId);
|
|
140
|
-
setSelectedItem(reference);
|
|
141
|
-
setShowEditModel(true);
|
|
142
|
-
referenceIdRef.current = reference._id;
|
|
143
|
-
}, [modelMap]);
|
|
144
|
-
const deleteReferenceCallback = (0, react_1.useCallback)(async () => {
|
|
145
|
-
if (selectedItem) {
|
|
146
|
-
await deleteModel(selectedItem._id);
|
|
147
|
-
modelMap.delete(selectedItem._id);
|
|
148
|
-
setModelMap(new Map([...modelMap]));
|
|
149
|
-
setSelectedItem(modelMap.get(referenceIdRef.current));
|
|
150
|
-
}
|
|
151
|
-
}, [selectedItem, modelMap, deleteModel, referenceIdRef]);
|
|
152
|
-
const [deleteDialog, setDeleteDialog] = (0, react_1.useState)({ show: false });
|
|
153
|
-
const addCitationCallback = (0, react_1.useCallback)(async () => {
|
|
154
|
-
const item = (0, transform_1.buildBibliographyItem)({
|
|
155
|
-
title: 'Untitled',
|
|
156
|
-
type: 'article-journal',
|
|
157
|
-
});
|
|
158
|
-
setSearching(false);
|
|
159
|
-
setSelectedItem(item);
|
|
160
|
-
setShowEditModel(true);
|
|
161
|
-
insertBibliographyNode(item);
|
|
162
|
-
setModelMap(new Map([...modelMap, [item._id, { ...item }]]));
|
|
163
|
-
}, [insertBibliographyNode, modelMap]);
|
|
164
|
-
const addCommentCallback = (0, react_1.useCallback)(() => setComment((0, transform_1.buildComment)(citation._id)), [citation._id, setComment]);
|
|
165
|
-
const bibliographyItems = (0, react_1.useMemo)(() => {
|
|
166
|
-
const citedReferencesSet = new Set(items.map((item) => item._id));
|
|
167
|
-
return new Map((0, transform_1.getModelsByType)(modelMap, json_schema_1.ObjectTypes.BibliographyItem)
|
|
168
|
-
.filter((model) => !citedReferencesSet.has(model._id))
|
|
169
|
-
.map((model) => [model._id, model]));
|
|
170
|
-
}, [items, modelMap]);
|
|
171
|
-
if (searching) {
|
|
172
|
-
return (react_1.default.createElement(CitationSearch_1.CitationSearch, { query: selectedText, bibliographyItems: bibliographyItems, importItems: importItems, handleCite: handleCite, addCitation: addCitationCallback, handleCancel: () => setSearching(false) }));
|
|
173
|
-
}
|
|
174
|
-
if (!items.length) {
|
|
175
|
-
return (react_1.default.createElement("div", null,
|
|
176
|
-
react_1.default.createElement(CitationSearch_1.CitationSearch, { query: selectedText, bibliographyItems: bibliographyItems, importItems: importItems, handleCite: handleCite, addCitation: addCitationCallback, handleCancel: handleCancel }),
|
|
177
|
-
react_1.default.createElement(CitationModal_1.CitationModal, { editCitation: showEditModel, modelMap: modelMap, saveCallback: saveCallback, selectedItem: selectedItem, deleteCallback: deleteReferenceCallback, setSelectedItem: setSelectedItem, setShowEditModel: setShowEditModel })));
|
|
178
|
-
}
|
|
179
|
-
return (react_1.default.createElement("div", null,
|
|
180
|
-
react_1.default.createElement(style_guide_1.Dialog, { isOpen: deleteDialog.show, category: style_guide_1.Category.confirmation, header: "Remove cited item", message: "Are you sure you want to remove this cited item? It will still exist in the reference list.", actions: {
|
|
181
|
-
secondary: {
|
|
182
|
-
action: () => {
|
|
183
|
-
if (deleteDialog.id) {
|
|
184
|
-
handleRemove(deleteDialog.id);
|
|
185
|
-
setDeleteDialog({ show: false });
|
|
186
|
-
}
|
|
187
|
-
},
|
|
188
|
-
title: 'Remove',
|
|
189
|
-
},
|
|
190
|
-
primary: {
|
|
191
|
-
action: () => setDeleteDialog({ show: false }),
|
|
192
|
-
title: 'Cancel',
|
|
193
|
-
},
|
|
194
|
-
} }),
|
|
195
|
-
react_1.default.createElement(CitedItems, null, items.map((item) => (react_1.default.createElement(CitedItem, { key: item._id, style: {
|
|
196
|
-
color: item.title === '[missing library item]' ? 'red' : 'inherit',
|
|
197
|
-
} },
|
|
198
|
-
react_1.default.createElement(exports.CitedItemTitle, { value: item.title || 'Untitled' }),
|
|
199
|
-
react_1.default.createElement(CitedItemActionLine, null,
|
|
200
|
-
react_1.default.createElement(exports.CitedItemMetadata, null, (0, library_1.shortLibraryItemMetadata)(item)),
|
|
201
|
-
react_1.default.createElement(CitedItemActions, null,
|
|
202
|
-
react_1.default.createElement(EditCitationButton, { value: item._id, onClick: onCitationEditClick, disabled: !canEdit },
|
|
203
|
-
react_1.default.createElement(AnnotationEdit_1.default, { color: '#6E6E6E' })),
|
|
204
|
-
react_1.default.createElement(ActionButton, { disabled: !canEdit, onClick: () => setDeleteDialog({ show: true, id: item._id }) },
|
|
205
|
-
react_1.default.createElement(CloseIconDark_1.default, { className: 'remove-icon' })))))))),
|
|
206
|
-
react_1.default.createElement(CitationModal_1.CitationModal, { editCitation: showEditModel, modelMap: modelMap, saveCallback: saveCallback, selectedItem: selectedItem, deleteCallback: deleteReferenceCallback, setSelectedItem: setSelectedItem, setShowEditModel: setShowEditModel }),
|
|
207
|
-
react_1.default.createElement(Actions, null,
|
|
208
|
-
react_1.default.createElement(style_guide_1.IconTextButton, { onClick: addCommentCallback },
|
|
209
|
-
react_1.default.createElement(style_guide_1.AddComment, null),
|
|
210
|
-
react_1.default.createElement(AddCommentButtonText, null, "Add Comment")),
|
|
211
|
-
react_1.default.createElement(style_guide_1.ButtonGroup, null,
|
|
212
|
-
react_1.default.createElement(style_guide_1.SecondaryButton, { onClick: () => handleClose() }, "Done"),
|
|
213
|
-
react_1.default.createElement(style_guide_1.PrimaryButton, { disabled: !canEdit, onClick: () => setSearching(true) }, "Add Citation")))));
|
|
214
|
-
};
|
|
215
|
-
exports.default = CitationEditor;
|
|
216
|
-
const EditCitationButton = (0, styled_components_1.default)(ActionButton) `
|
|
217
|
-
margin-right: ${(props) => props.theme.grid.unit * 3}px;
|
|
218
|
-
`;
|
|
219
|
-
const AddCommentButtonText = styled_components_1.default.div `
|
|
220
|
-
display: contents;
|
|
221
|
-
font-family: ${(props) => props.theme.font.family.sans};
|
|
222
|
-
font-weight: ${(props) => props.theme.font.weight.normal};
|
|
223
|
-
font-size: ${(props) => props.theme.font.size.small};
|
|
224
|
-
line-height: ${(props) => props.theme.font.lineHeight.large};
|
|
225
|
-
color: ${(props) => props.theme.colors.text.primary};
|
|
226
|
-
`;
|
|
227
|
-
//# sourceMappingURL=CitationEditor.js.map
|