@manuscripts/article-editor 3.1.24 → 3.1.25-LEAN-3647.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.
@@ -1,26 +1,6 @@
1
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;
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
24
4
  };
25
5
  Object.defineProperty(exports, "__esModule", { value: true });
26
6
  exports.ContentTab = void 0;
@@ -35,10 +15,8 @@ exports.ContentTab = void 0;
35
15
  *
36
16
  * All portions of the code written by Atypon Systems LLC are Copyright (c) 2019 Atypon Systems LLC. All Rights Reserved.
37
17
  */
38
- const body_editor_1 = require("@manuscripts/body-editor");
39
- const react_1 = __importStar(require("react"));
18
+ const react_1 = __importDefault(require("react"));
40
19
  const store_1 = require("../../store");
41
- const SectionInspector_1 = require("../inspector/SectionInspector");
42
20
  const ManuscriptInspector_1 = require("./ManuscriptInspector");
43
21
  const ContentTab = () => {
44
22
  const [{ manuscriptID, editor }] = (0, store_1.useStore)((store) => {
@@ -48,34 +26,8 @@ const ContentTab = () => {
48
26
  };
49
27
  });
50
28
  const { state, dispatch } = editor;
51
- const section = (0, react_1.useMemo)(() => {
52
- if (state.selection) {
53
- const sectionNode = (0, body_editor_1.findParentSection)(state.selection)?.node;
54
- return sectionNode;
55
- }
56
- }, [state.selection]);
57
- const dispatchNodeAttrs = (id, attrs, nodispatch = false) => {
58
- const { tr, doc } = state;
59
- let transaction;
60
- doc.descendants((node, pos) => {
61
- if (node.attrs.id === id) {
62
- tr.setNodeMarkup(pos, undefined, {
63
- ...node.attrs,
64
- ...attrs,
65
- });
66
- if (nodispatch) {
67
- transaction = tr;
68
- }
69
- else {
70
- dispatch(tr);
71
- }
72
- }
73
- });
74
- return transaction;
75
- };
76
29
  return (react_1.default.createElement("div", null,
77
- react_1.default.createElement(ManuscriptInspector_1.ManuscriptInspector, { key: manuscriptID, state: state, dispatch: dispatch }),
78
- section && (react_1.default.createElement(SectionInspector_1.SectionInspector, { "data-cy": section.attrs.category || 'generic-section', key: section.attrs.id, section: section, state: state, dispatchNodeAttrs: dispatchNodeAttrs }))));
30
+ react_1.default.createElement(ManuscriptInspector_1.ManuscriptInspector, { key: manuscriptID, state: state, dispatch: dispatch })));
79
31
  };
80
32
  exports.ContentTab = ContentTab;
81
33
  //# sourceMappingURL=ContentTab.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ContentTab.js","sourceRoot":"","sources":["../../../../src/components/projects/ContentTab.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;GAUG;AACH,0DAA4D;AAE5D,+CAAsC;AAEtC,uCAAsC;AACtC,oEAAgE;AAChE,+DAA2D;AAEpD,MAAM,UAAU,GAAa,GAAG,EAAE;IACvC,MAAM,CAAC,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,GAAG,IAAA,gBAAQ,EAAC,CAAC,KAAK,EAAE,EAAE;QACpD,OAAO;YACL,YA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AiB,EACpD,GAAG,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,EACrB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,iBAAiB,EAAE,iBAAiB,GACpC,CACH,CACG,CACP,CAAA;AACH,CAAC,CAAA;AA5DY,QAAA,UAAU,cA4DtB"}
1
+ {"version":3,"file":"ContentTab.js","sourceRoot":"","sources":["../../../../src/components/projects/ContentTab.tsx"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;GAUG;AACH,kDAAyB;AAEzB,uCAAsC;AACtC,+DAA2D;AAEpD,MAAM,UAAU,GAAa,GAAG,EAAE;IACvC,MAAM,CAAC,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,GAAG,IAAA,gBAAQ,EAAC,CAAC,KAAK,EAAE,EAAE;QACpD,OAAO;YACL,YAAY,EAAE,KAAK,CAAC,YAAY;YAChC,MAAM,EAAE,KAAK,CAAC,MAAM;SACrB,CAAA;IACH,CAAC,CAAC,CAAA;IAEF,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAA;IAElC,OAAO,CACL;QACE,8BAAC,yCAAmB,IAClB,GAAG,EAAE,YAAY,EACjB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,GAClB,CACE,CACP,CAAA;AACH,CAAC,CAAA;AAnBY,QAAA,UAAU,cAmBtB"}
@@ -21,7 +21,7 @@ const QuarterbackStepsExchanger_1 = require("../quarterback/QuarterbackStepsExch
21
21
  const store_1 = require("../store");
22
22
  const theme_1 = require("../theme/theme");
23
23
  const useCreateEditor = () => {
24
- const [{ doc, manuscriptID, projectID, user, fileManagement, initialDocVersion, style, locale, authToken, }, dispatch, getState,] = (0, store_1.useStore)((store) => ({
24
+ const [{ doc, manuscriptID, projectID, user, fileManagement, initialDocVersion, style, locale, authToken, sectionCategories, }, dispatch, getState,] = (0, store_1.useStore)((store) => ({
25
25
  doc: store.doc,
26
26
  manuscriptID: store.manuscriptID,
27
27
  project: store.project,
@@ -32,6 +32,7 @@ const useCreateEditor = () => {
32
32
  style: store.cslStyle,
33
33
  locale: store.cslLocale,
34
34
  authToken: store.authToken,
35
+ sectionCategories: store.sectionCategories,
35
36
  }));
36
37
  const getCapabilities = (0, lodash_1.memoize)((project, user, permittedActions) => (0, style_guide_1.getCapabilities)(project, user, undefined, permittedActions));
37
38
  const config = (0, config_1.getConfig)();
@@ -70,6 +71,7 @@ const useCreateEditor = () => {
70
71
  dispatch({ preventUnload });
71
72
  }
72
73
  }),
74
+ sectionCategories: sectionCategories,
73
75
  navigate: (0, react_router_dom_1.useNavigate)(),
74
76
  location: (0, react_router_dom_1.useLocation)(),
75
77
  };
@@ -1 +1 @@
1
- {"version":3,"file":"use-create-editor.js","sourceRoot":"","sources":["../../../src/hooks/use-create-editor.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;GAUG;AACH,0DAAoD;AACpD,0DAAmF;AACnF,mCAAgC;AAChC,uDAA2D;AAE3D,sCAAqC;AACrC,wFAAyE;AACzE,oCAAmC;AACnC,0CAAsC;AAE/B,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,MAAM,CACJ,EACE,GAAG,EACH,YAAY,EACZ,SAAS,EACT,IAAI,EACJ,cAAc,EACd,iBAAiB,EACjB,KAAK,EACL,MAAM,EACN,SAAS,GACV,EACD,QAAQ,EACR,QAAQ,EACT,GAAG,IAAA,gBAAQ,EAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACvB,GAAG,EAAE,KAAK,CAAC,GAAG;QACd,YAAY,EAAE,KAAK,CAAC,YAAY;QAChC,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,cAAc,EAAE,KAAK,CAAC,cAAc;QACpC,iBAAiB,EAAE,KAAK,CAAC,iBAAiB;QAC1C,KAAK,EAAE,KAAK,CAAC,QAAQ;QACrB,MAAM,EAAE,KA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,CAAC,CAAA;aAC1C;iBAAM;gBACL,QAAQ,CAAC,EAAE,aAAa,EAAE,CAAC,CAAA;aAC5B;QACH,CAAC,CACF;QACD,QAAQ,EAAE,IAAA,8BAAW,GAAE;QACvB,QAAQ,EAAE,IAAA,8BAAW,GAAE;KACxB,CAAA;IAED,MAAM,MAAM,GAAG,IAAA,uBAAS,EAAC,KAAK,CAAC,CAAA;IAC/B,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AA9EY,QAAA,eAAe,mBA8E3B"}
1
+ {"version":3,"file":"use-create-editor.js","sourceRoot":"","sources":["../../../src/hooks/use-create-editor.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;GAUG;AACH,0DAAoD;AACpD,0DAAmF;AACnF,mCAAgC;AAChC,uDAA2D;AAE3D,sCAAqC;AACrC,wFAAyE;AACzE,oCAAmC;AACnC,0CAAsC;AAE/B,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,MAAM,CACJ,EACE,GAAG,EACH,YAAY,EACZ,SAAS,EACT,IAAI,EACJ,cAAc,EACd,iBAAiB,EACjB,KAAK,EACL,MAAM,EACN,SAAS,EACT,iBAAiB,GAClB,EACD,QAAQ,EACR,QAAQ,EACT,GAAG,IAAA,gBAAQ,EAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACvB,GAAG,EAAE,KAAK,CAAC,GAAG;QACd,YAAY,EAAE,KAAK,CAAC,YAAY;QAChC,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,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;QAC1B,iBAAiB,EAAE,KAAK,CAAC,iBAAiB;KAC3C,CA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AE,CAAC,CAAA;aAC5B;QACH,CAAC,CACF;QACD,iBAAiB,EAAE,iBAAiB;QACpC,QAAQ,EAAE,IAAA,8BAAW,GAAE;QACvB,QAAQ,EAAE,IAAA,8BAAW,GAAE;KACxB,CAAA;IACD,MAAM,MAAM,GAAG,IAAA,uBAAS,EAAC,KAAK,CAAC,CAAA;IAC/B,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAhFY,QAAA,eAAe,mBAgF3B"}
@@ -9,10 +9,8 @@
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 { findParentSection } from '@manuscripts/body-editor';
13
- import React, { useMemo } from 'react';
12
+ import React from 'react';
14
13
  import { useStore } from '../../store';
15
- import { SectionInspector } from '../inspector/SectionInspector';
16
14
  import { ManuscriptInspector } from './ManuscriptInspector';
17
15
  export const ContentTab = () => {
18
16
  const [{ manuscriptID, editor }] = useStore((store) => {
@@ -22,33 +20,7 @@ export const ContentTab = () => {
22
20
  };
23
21
  });
24
22
  const { state, dispatch } = editor;
25
- const section = useMemo(() => {
26
- if (state.selection) {
27
- const sectionNode = findParentSection(state.selection)?.node;
28
- return sectionNode;
29
- }
30
- }, [state.selection]);
31
- const dispatchNodeAttrs = (id, attrs, nodispatch = false) => {
32
- const { tr, doc } = state;
33
- let transaction;
34
- doc.descendants((node, pos) => {
35
- if (node.attrs.id === id) {
36
- tr.setNodeMarkup(pos, undefined, {
37
- ...node.attrs,
38
- ...attrs,
39
- });
40
- if (nodispatch) {
41
- transaction = tr;
42
- }
43
- else {
44
- dispatch(tr);
45
- }
46
- }
47
- });
48
- return transaction;
49
- };
50
23
  return (React.createElement("div", null,
51
- React.createElement(ManuscriptInspector, { key: manuscriptID, state: state, dispatch: dispatch }),
52
- section && (React.createElement(SectionInspector, { "data-cy": section.attrs.category || 'generic-section', key: section.attrs.id, section: section, state: state, dispatchNodeAttrs: dispatchNodeAttrs }))));
24
+ React.createElement(ManuscriptInspector, { key: manuscriptID, state: state, dispatch: dispatch })));
53
25
  };
54
26
  //# sourceMappingURL=ContentTab.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ContentTab.js","sourceRoot":"","sources":["../../../../src/components/projects/ContentTab.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAE5D,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAE3D,MAAM,CAAC,MAAM,UAAU,GAAa,GAAG,EAAE;IACvC,MAAM,CAAC,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE;QACpD,OAAO;YACL,YAAY,EAAE,KAAK,CAAC,YAAY;YAChC,MAAM,EAAE,KAAK,CAAC,MAAM;SACrB,CAAA;IACH,CAAC,CAAC,CAAA;IAEF,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAA;IAElC,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE;QAC3B,IAAI,KAAK,CAAC,SAAS,EAAE;YACnB,MAAM,WAAW,GAAG,iBAAiB,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,IAAI,CAAA;YAC5D,OAAO,WAA0B,CAAA;SAClC;IACH,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAA;IAErB,MAAM,iBAAiB,GAAG,CACxB,EAAU,EACV,KAA8B,EAC9B,UAAU,GAAG,KAAK,EAClB,EAAE;QACF,MAAM,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,KAAK,CAAA;QACzB,IAAI,WAAW,CAAA;QAEf,GAAG,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;YAC5B,IAAI,IAAI,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,EAAE;gBACxB,EAAE,CAAC,aAAa,CAAC,GAAG,EAAE,SAAS,EAAE;oBAC/B,GAAG,IAAI,CAAC,KAAK;oBACb,GAAG,KAAK;iBACT,CAAC,CAAA;gBACF,IAAI,UAAU,EAAE;oBACd,WAAW,GAAG,EAAE,CAAA;iBACjB;qBAAM;oBACL,QAAQ,CAAC,EAAE,CAAC,CAAA;iBACb;aACF;QACH,CAAC,CAAC,CAAA;QACF,OAAO,WAAW,CAAA;IACpB,CAAC,CAAA;IAED,OAAO,CACL;QACE,oBAAC,mBAAmB,IAClB,GAAG,EAAE,YAAY,EACjB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,GAClB;QAED,OAAO,IAAI,CACV,oBAAC,gBAAgB,eACN,OAAO,CAAC,KAAK,CAAC,QAAQ,IAAI,iBAAiB,EACpD,GAAG,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,EACrB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,iBAAiB,EAAE,iBAAiB,GACpC,CACH,CACG,CACP,CAAA;AACH,CAAC,CAAA"}
1
+ {"version":3,"file":"ContentTab.js","sourceRoot":"","sources":["../../../../src/components/projects/ContentTab.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAE3D,MAAM,CAAC,MAAM,UAAU,GAAa,GAAG,EAAE;IACvC,MAAM,CAAC,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE;QACpD,OAAO;YACL,YAAY,EAAE,KAAK,CAAC,YAAY;YAChC,MAAM,EAAE,KAAK,CAAC,MAAM;SACrB,CAAA;IACH,CAAC,CAAC,CAAA;IAEF,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAA;IAElC,OAAO,CACL;QACE,oBAAC,mBAAmB,IAClB,GAAG,EAAE,YAAY,EACjB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,GAClB,CACE,CACP,CAAA;AACH,CAAC,CAAA"}
@@ -18,7 +18,7 @@ import { stepsExchanger } from '../quarterback/QuarterbackStepsExchanger';
18
18
  import { useStore } from '../store';
19
19
  import { theme } from '../theme/theme';
20
20
  export const useCreateEditor = () => {
21
- const [{ doc, manuscriptID, projectID, user, fileManagement, initialDocVersion, style, locale, authToken, }, dispatch, getState,] = useStore((store) => ({
21
+ const [{ doc, manuscriptID, projectID, user, fileManagement, initialDocVersion, style, locale, authToken, sectionCategories, }, dispatch, getState,] = useStore((store) => ({
22
22
  doc: store.doc,
23
23
  manuscriptID: store.manuscriptID,
24
24
  project: store.project,
@@ -29,6 +29,7 @@ export const useCreateEditor = () => {
29
29
  style: store.cslStyle,
30
30
  locale: store.cslLocale,
31
31
  authToken: store.authToken,
32
+ sectionCategories: store.sectionCategories,
32
33
  }));
33
34
  const getCapabilities = memoize((project, user, permittedActions) => getActionCapabilities(project, user, undefined, permittedActions));
34
35
  const config = getConfig();
@@ -67,6 +68,7 @@ export const useCreateEditor = () => {
67
68
  dispatch({ preventUnload });
68
69
  }
69
70
  }),
71
+ sectionCategories: sectionCategories,
70
72
  navigate: useNavigate(),
71
73
  location: useLocation(),
72
74
  };
@@ -1 +1 @@
1
- {"version":3,"file":"use-create-editor.js","sourceRoot":"","sources":["../../../src/hooks/use-create-editor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,EAAE,eAAe,IAAI,qBAAqB,EAAE,MAAM,0BAA0B,CA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GAAG,SAAS,CAAC,KAAK,CAAC,CAAA;IAC/B,OAAO,MAAM,CAAA;AACf,CAAC,CAAA"}
@@ -1,2 +1,13 @@
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
+ */
1
12
  import React from 'react';
2
13
  export declare const ContentTab: React.FC;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manuscripts/article-editor",
3
- "version": "3.1.24",
3
+ "version": "3.1.25-LEAN-3647.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",
@@ -35,12 +35,12 @@
35
35
  "@fontsource/lato": "^4.5.10",
36
36
  "@fontsource/pt-sans": "^4.5.11",
37
37
  "@fontsource/pt-serif": "^4.5.11",
38
- "@manuscripts/body-editor": "2.0.30",
38
+ "@manuscripts/body-editor": "2.0.31-LEAN-3647.1",
39
39
  "@manuscripts/json-schema": "2.2.10",
40
40
  "@manuscripts/library": "1.3.11",
41
- "@manuscripts/style-guide": "2.0.7",
41
+ "@manuscripts/style-guide": "2.0.8-LEAN-3647.0",
42
42
  "@manuscripts/track-changes-plugin": "1.7.17",
43
- "@manuscripts/transform": "2.3.25",
43
+ "@manuscripts/transform": "2.3.26-LEAN-3647.0",
44
44
  "prosemirror-utils": "^0.9.6",
45
45
  "@popperjs/core": "^2.11.8",
46
46
  "@reach/tabs": "^0.18.0",
@@ -1,108 +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.SectionInspector = 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 style_guide_1 = require("@manuscripts/style-guide");
42
- const transform_1 = require("@manuscripts/transform");
43
- const prosemirror_utils_1 = require("prosemirror-utils");
44
- const react_1 = __importStar(require("react"));
45
- const styled_components_1 = __importDefault(require("styled-components"));
46
- const section_categories_1 = require("../../lib/section-categories");
47
- const store_1 = require("../../store");
48
- const InspectorSection_1 = require("../InspectorSection");
49
- const CategoryInput_1 = require("../projects/CategoryInput");
50
- const SectionInspector = ({ dispatchNodeAttrs, section, state }) => {
51
- const [{ sectionCategories, doc }] = (0, store_1.useStore)((store) => ({
52
- doc: store.doc,
53
- sectionCategories: (0, section_categories_1.sortSectionCategories)(store.sectionCategories),
54
- }));
55
- const title = (0, react_1.useMemo)(() => {
56
- let titleText = '';
57
- section.forEach((n) => {
58
- if (n.type === transform_1.schema.nodes.title) {
59
- titleText = n.text || '';
60
- }
61
- });
62
- return titleText;
63
- }, [section]);
64
- const [existingCatsCounted, isSubSection] = (0, react_1.useMemo)(() => {
65
- let isSubSection = false;
66
- const exisitingCats = {};
67
- doc.descendants((node, _, nodeParent) => {
68
- if (node.type === transform_1.schema.nodes.section) {
69
- if (nodeParent?.type === transform_1.schema.nodes.section && node.eq(section)) {
70
- isSubSection = true;
71
- }
72
- const currentSection = node;
73
- const cat = currentSection.attrs.category;
74
- if (cat && cat.startsWith('MPSectionCategory:')) {
75
- // @TODO - check this part - cat.startsWith('MPSectionCategory:')
76
- exisitingCats[cat] = exisitingCats[cat] ? exisitingCats[cat]++ : 1;
77
- }
78
- }
79
- });
80
- return [exisitingCats, isSubSection];
81
- }, [doc]); // eslint-disable-line react-hooks/exhaustive-deps
82
- const sortedSectionCategories = (0, react_1.useMemo)(() => {
83
- const container = (0, prosemirror_utils_1.findParentNode)((node) => node.attrs.category)(state.selection)?.node;
84
- if (!container) {
85
- return [];
86
- }
87
- const sectionCategory = sectionCategories.find(({ _id }) => _id === container.attrs.category);
88
- if (!sectionCategory) {
89
- return [];
90
- }
91
- return sectionCategories.filter(({ groupIDs }) => groupIDs &&
92
- groupIDs.some((groupID) => sectionCategory.groupIDs?.includes(groupID)));
93
- }, [sectionCategories, state.selection]);
94
- const currentSectionCategory = (0, section_categories_1.chooseSectionCategory)(section, isSubSection);
95
- return (react_1.default.createElement(InspectorSection_1.InspectorSection, { title: 'Section' },
96
- title && react_1.default.createElement(SectionTitle, { value: title }),
97
- (0, section_categories_1.isEditableSectionCategoryID)(currentSectionCategory) && (react_1.default.createElement(react_1.default.Fragment, null,
98
- react_1.default.createElement(InspectorSection_1.Subheading, null, "Category"),
99
- react_1.default.createElement(CategoryInput_1.CategoryInput, { value: currentSectionCategory, sectionCategories: sortedSectionCategories, existingCatsCounted: existingCatsCounted, handleChange: (category) => {
100
- dispatchNodeAttrs(section.attrs.id, { category });
101
- } })))));
102
- };
103
- exports.SectionInspector = SectionInspector;
104
- const SectionTitle = (0, styled_components_1.default)(style_guide_1.RichText) `
105
- color: ${(props) => props.theme.colors.text.primary};
106
- margin: 4px 0;
107
- `;
108
- //# sourceMappingURL=SectionInspector.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SectionInspector.js","sourceRoot":"","sources":["../../../../src/components/inspector/SectionInspector.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;GAUG;AACH,0DAAmD;AACnD,sDAAuE;AAEvE,yDAAkD;AAClD,+CAAsC;AACtC,0EAAsC;AAEtC,qEAIqC;AACrC,uCAAsC;AACtC,0DAAkE;AAClE,6DAAyD;AAElD,MAAM,gBAAgB,GAQxB,CAAC,EAAE,iBAAiB,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE;IAC7C,MAAM,CAAC,EAAE,iBAAiB,EAAE,GAAG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EAAE,KAAK,GAAI;QAEvC,IAAA,gDAA2B,EAAC,sBAAsB,CAAC,IAAI,CACtD;YACE,8BAAC,6BAAU,mBAAsB;YAEjC,8BAAC,6BAAa,IACZ,KAAK,EAAE,sBAAsB,EAC7B,iBAAiB,EAAE,uBAAuB,EAC1C,mBAAmB,EAAE,mBAAmB,EACxC,YAAY,EAAE,CAAC,QAAgB,EAAE,EAAE;oBACjC,iBAAiB,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAA;gBACnD,CAAC,GACD,CACD,CACJ,CACgB,CACpB,CAAA;AACH,CAAC,CAAA;AA5FY,QAAA,gBAAgB,oBA4F5B;AAED,MAAM,YAAY,GAAG,IAAA,2BAAM,EAAC,sBAAQ,CAAC,CAAA;WAC1B,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO;;CAEpD,CAAA"}
@@ -1,95 +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) 2020 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.CategoryInput = void 0;
41
- const transform_1 = require("@manuscripts/transform");
42
- const prosemirror_utils_1 = require("prosemirror-utils");
43
- const react_1 = __importStar(require("react"));
44
- const react_select_1 = __importDefault(require("react-select"));
45
- const styled_components_1 = __importDefault(require("styled-components"));
46
- const use_synced_data_1 = require("../../hooks/use-synced-data");
47
- const section_categories_1 = require("../../lib/section-categories");
48
- const store_1 = require("../../store");
49
- const TagsInput_1 = require("./TagsInput");
50
- const CategoryInput = ({ value, handleChange, existingCatsCounted, sectionCategories }) => {
51
- const [currentValue, handleLocalChange] = (0, use_synced_data_1.useSyncedData)(value, handleChange, 0);
52
- const [{ doc }] = (0, store_1.useStore)((state) => ({
53
- doc: state.doc,
54
- }));
55
- const handleInputChange = (0, react_1.useCallback)((newValue) => newValue && handleLocalChange(newValue.value), [handleLocalChange]);
56
- const OptionComponent = ({ innerProps, data, }) => {
57
- return (react_1.default.createElement(TagsInput_1.OptionWrapper, { ...innerProps, isDisabled: data.isDisabled, ref: null }, data.label));
58
- };
59
- const options = (0, react_1.useMemo)(() => {
60
- const backmatter = (0, prosemirror_utils_1.findChildrenByType)(doc, transform_1.schema.nodes.backmatter)[0];
61
- const options = [];
62
- sectionCategories.map((cat) => {
63
- // check if the category is part of the backmatter section, and its already present in the document
64
- let isDisabled = false;
65
- if (cat.groupIDs &&
66
- (0, section_categories_1.isBackMatterSection)(cat.groupIDs[0]) &&
67
- (0, section_categories_1.backMatterSectionCategoryExist)(backmatter.node, cat._id)) {
68
- isDisabled = true;
69
- }
70
- if ((0, section_categories_1.isEditableSectionCategory)(cat) &&
71
- (!(0, section_categories_1.isUniquePresent)(cat, existingCatsCounted) ||
72
- (0, section_categories_1.isUniqueCurrent)(cat._id, currentValue))) {
73
- options.push({
74
- value: cat._id,
75
- label: cat.name,
76
- isDisabled: isDisabled,
77
- });
78
- }
79
- });
80
- return options;
81
- }, [currentValue, existingCatsCounted, sectionCategories, doc]);
82
- const selectionValue = (0, react_1.useMemo)(() => {
83
- const cat = sectionCategories.find((category) => category._id === currentValue);
84
- return cat && { value: cat._id, label: cat.name, isDisabled: false };
85
- }, [currentValue, sectionCategories]);
86
- return (react_1.default.createElement(Container, null,
87
- react_1.default.createElement(react_select_1.default, { value: selectionValue, options: options, menuPortalTarget: document.body, onChange: handleInputChange, maxMenuHeight: 150, components: {
88
- Option: OptionComponent,
89
- } })));
90
- };
91
- exports.CategoryInput = CategoryInput;
92
- const Container = styled_components_1.default.div `
93
- height: ${(props) => props.theme.grid.unit * 30}px;
94
- `;
95
- //# sourceMappingURL=CategoryInput.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CategoryInput.js","sourceRoot":"","sources":["../../../../src/components/projects/CategoryInput.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,sDAA+C;AAC/C,yDAAsD;AACtD,+CAAmD;AACnD,gEAAkD;AAClD,0EAAsC;AAEtC,iEAA2D;AAC3D,q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AAA;AAjFY,QAAA,aAAa,iBAiFzB;AAED,MAAM,SAAS,GAAG,2BAAM,CAAC,GAAG,CAAA;YAChB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,EAAE;CAChD,CAAA"}
@@ -1,72 +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) 2020 Atypon Systems LLC. All Rights Reserved.
12
- */
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.backMatterSectionCategoryExist = exports.isBackMatterSection = exports.isUniquePresent = exports.isUniqueCurrent = exports.isUnique = exports.chooseSectionCategory = exports.sortSectionCategories = exports.isEditableSectionCategory = exports.isEditableSectionCategoryID = exports.uniqueSectionCategories = exports.uneditableSectionCategories = void 0;
15
- exports.uneditableSectionCategories = [
16
- 'MPSectionCategory:bibliography',
17
- 'MPSectionCategory:keywords',
18
- 'MPSectionCategory:list-of-figures',
19
- 'MPSectionCategory:list-of-tables',
20
- 'MPSectionCategory:toc',
21
- ];
22
- exports.uniqueSectionCategories = [
23
- 'MPSectionCategory:abstract-graphical',
24
- 'MPSectionCategory:abstract',
25
- ];
26
- const isEditableSectionCategoryID = (id) => !exports.uneditableSectionCategories.includes(id);
27
- exports.isEditableSectionCategoryID = isEditableSectionCategoryID;
28
- const isEditableSectionCategory = (sectionCategory) => (0, exports.isEditableSectionCategoryID)(sectionCategory._id);
29
- exports.isEditableSectionCategory = isEditableSectionCategory;
30
- const sortSectionCategories = (sectionCategories) => sectionCategories.sort((a, b) => a.priority - b.priority);
31
- exports.sortSectionCategories = sortSectionCategories;
32
- const chooseSectionCategory = (section, isSubSection) => {
33
- if (section.attrs.category) {
34
- return section.attrs.category;
35
- }
36
- return isSubSection
37
- ? 'MPSectionCategory:subsection'
38
- : 'MPSectionCategory:section';
39
- };
40
- exports.chooseSectionCategory = chooseSectionCategory;
41
- const isUnique = (categoryId) => {
42
- return exports.uniqueSectionCategories.includes(categoryId);
43
- };
44
- exports.isUnique = isUnique;
45
- const isUniqueCurrent = (categoryId, currentCategoryId) => {
46
- return categoryId === currentCategoryId;
47
- };
48
- exports.isUniqueCurrent = isUniqueCurrent;
49
- const isUniquePresent = (cat, existingCats) => {
50
- return (0, exports.isUnique)(cat._id) && Object.keys(existingCats).includes(cat._id);
51
- };
52
- exports.isUniquePresent = isUniquePresent;
53
- const isBackMatterSection = (groupId) => {
54
- return groupId === 'MPSectionCategory:backmatter';
55
- };
56
- exports.isBackMatterSection = isBackMatterSection;
57
- const backMatterSectionCategoryExist = (parent, category) => {
58
- let found = false;
59
- parent.descendants((node) => {
60
- if (node.attrs.category === category) {
61
- found = true;
62
- return false;
63
- }
64
- if (found) {
65
- return false;
66
- }
67
- return true;
68
- });
69
- return found;
70
- };
71
- exports.backMatterSectionCategoryExist = backMatterSectionCategoryExist;
72
- //# sourceMappingURL=section-categories.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"section-categories.js","sourceRoot":"","sources":["../../../src/lib/section-categories.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAKU,QAAA,2BAA2B,GAAa;IACnD,gCAAgC;IAChC,4BAA4B;IAC5B,mCAAmC;IACnC,kCAAkC;IAClC,uBAAuB;CACxB,CAAA;AAEY,QAAA,uB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GAAG,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AACzE,CAAC,CAAA;AALY,QAAA,eAAe,mBAK3B;AAEM,MAAM,mBAAmB,GAAG,CAAC,OAAe,EAAE,EAAE;IACrD,OAAO,OAAO,KAAK,8BAA8B,CAAA;AACnD,CAAC,CAAA;AAFY,QAAA,mBAAmB,uBAE/B;AAEM,MAAM,8BAA8B,GAAG,CAC5C,MAAsB,EACtB,QAAgB,EAChB,EAAE;IACF,IAAI,KAAK,GAAG,KAAK,CAAA;IACjB,MAAM,CAAC,WAAW,CAAC,CAAC,IAAoB,EAAE,EAAE;QAC1C,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,KAAK,QAAQ,EAAE;YACpC,KAAK,GAAG,IAAI,CAAA;YACZ,OAAO,KAAK,CAAA;SACb;QACD,IAAI,KAAK,EAAE;YACT,OAAO,KAAK,CAAA;SACb;QACD,OAAO,IAAI,CAAA;IACb,CAAC,CAAC,CAAA;IACF,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AAhBY,QAAA,8BAA8B,kCAgB1C"}
@@ -1,78 +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 { RichText } from '@manuscripts/style-guide';
13
- import { schema } from '@manuscripts/transform';
14
- import { findParentNode } from 'prosemirror-utils';
15
- import React, { useMemo } from 'react';
16
- import styled from 'styled-components';
17
- import { chooseSectionCategory, isEditableSectionCategoryID, sortSectionCategories, } from '../../lib/section-categories';
18
- import { useStore } from '../../store';
19
- import { InspectorSection, Subheading } from '../InspectorSection';
20
- import { CategoryInput } from '../projects/CategoryInput';
21
- export const SectionInspector = ({ dispatchNodeAttrs, section, state }) => {
22
- const [{ sectionCategories, doc }] = useStore((store) => ({
23
- doc: store.doc,
24
- sectionCategories: sortSectionCategories(store.sectionCategories),
25
- }));
26
- const title = useMemo(() => {
27
- let titleText = '';
28
- section.forEach((n) => {
29
- if (n.type === schema.nodes.title) {
30
- titleText = n.text || '';
31
- }
32
- });
33
- return titleText;
34
- }, [section]);
35
- const [existingCatsCounted, isSubSection] = useMemo(() => {
36
- let isSubSection = false;
37
- const exisitingCats = {};
38
- doc.descendants((node, _, nodeParent) => {
39
- if (node.type === schema.nodes.section) {
40
- if (nodeParent?.type === schema.nodes.section && node.eq(section)) {
41
- isSubSection = true;
42
- }
43
- const currentSection = node;
44
- const cat = currentSection.attrs.category;
45
- if (cat && cat.startsWith('MPSectionCategory:')) {
46
- // @TODO - check this part - cat.startsWith('MPSectionCategory:')
47
- exisitingCats[cat] = exisitingCats[cat] ? exisitingCats[cat]++ : 1;
48
- }
49
- }
50
- });
51
- return [exisitingCats, isSubSection];
52
- }, [doc]); // eslint-disable-line react-hooks/exhaustive-deps
53
- const sortedSectionCategories = useMemo(() => {
54
- const container = findParentNode((node) => node.attrs.category)(state.selection)?.node;
55
- if (!container) {
56
- return [];
57
- }
58
- const sectionCategory = sectionCategories.find(({ _id }) => _id === container.attrs.category);
59
- if (!sectionCategory) {
60
- return [];
61
- }
62
- return sectionCategories.filter(({ groupIDs }) => groupIDs &&
63
- groupIDs.some((groupID) => sectionCategory.groupIDs?.includes(groupID)));
64
- }, [sectionCategories, state.selection]);
65
- const currentSectionCategory = chooseSectionCategory(section, isSubSection);
66
- return (React.createElement(InspectorSection, { title: 'Section' },
67
- title && React.createElement(SectionTitle, { value: title }),
68
- isEditableSectionCategoryID(currentSectionCategory) && (React.createElement(React.Fragment, null,
69
- React.createElement(Subheading, null, "Category"),
70
- React.createElement(CategoryInput, { value: currentSectionCategory, sectionCategories: sortedSectionCategories, existingCatsCounted: existingCatsCounted, handleChange: (category) => {
71
- dispatchNodeAttrs(section.attrs.id, { category });
72
- } })))));
73
- };
74
- const SectionTitle = styled(RichText) `
75
- color: ${(props) => props.theme.colors.text.primary};
76
- margin: 4px 0;
77
- `;
78
- //# sourceMappingURL=SectionInspector.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SectionInspector.js","sourceRoot":"","sources":["../../../../src/components/inspector/SectionInspector.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AACnD,OAAO,EAAE,MAAM,EAA0B,MAAM,wBAAwB,CAAA;AAEvE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAEtC,OAAO,EACL,qBAAqB,EACrB,2BAA2B,EAC3B,qBAAqB,GACtB,MAAM,8BAA8B,CAAA;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAEzD,MAAM,CAAC,MAAM,gBAAgB,GAQxB,CAAC,EAAE,iBAAiB,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE;IAC7C,MAAM,CAAC,EAAE,iBAAiB,EAAE,GAAG,E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AC,IAAI,CACtD;YACE,oBAAC,UAAU,mBAAsB;YAEjC,oBAAC,aAAa,IACZ,KAAK,EAAE,sBAAsB,EAC7B,iBAAiB,EAAE,uBAAuB,EAC1C,mBAAmB,EAAE,mBAAmB,EACxC,YAAY,EAAE,CAAC,QAAgB,EAAE,EAAE;oBACjC,iBAAiB,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAA;gBACnD,CAAC,GACD,CACD,CACJ,CACgB,CACpB,CAAA;AACH,CAAC,CAAA;AAED,MAAM,YAAY,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;WAC1B,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO;;CAEpD,CAAA"}
@@ -1,65 +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) 2020 Atypon Systems LLC. All Rights Reserved.
11
- */
12
- import { schema } from '@manuscripts/transform';
13
- import { findChildrenByType } from 'prosemirror-utils';
14
- import React, { useCallback, useMemo } from 'react';
15
- import Select from 'react-select';
16
- import styled from 'styled-components';
17
- import { useSyncedData } from '../../hooks/use-synced-data';
18
- import { backMatterSectionCategoryExist, isBackMatterSection, isEditableSectionCategory, isUniqueCurrent, isUniquePresent, } from '../../lib/section-categories';
19
- import { useStore } from '../../store';
20
- import { OptionWrapper } from './TagsInput';
21
- export const CategoryInput = ({ value, handleChange, existingCatsCounted, sectionCategories }) => {
22
- const [currentValue, handleLocalChange] = useSyncedData(value, handleChange, 0);
23
- const [{ doc }] = useStore((state) => ({
24
- doc: state.doc,
25
- }));
26
- const handleInputChange = useCallback((newValue) => newValue && handleLocalChange(newValue.value), [handleLocalChange]);
27
- const OptionComponent = ({ innerProps, data, }) => {
28
- return (React.createElement(OptionWrapper, { ...innerProps, isDisabled: data.isDisabled, ref: null }, data.label));
29
- };
30
- const options = useMemo(() => {
31
- const backmatter = findChildrenByType(doc, schema.nodes.backmatter)[0];
32
- const options = [];
33
- sectionCategories.map((cat) => {
34
- // check if the category is part of the backmatter section, and its already present in the document
35
- let isDisabled = false;
36
- if (cat.groupIDs &&
37
- isBackMatterSection(cat.groupIDs[0]) &&
38
- backMatterSectionCategoryExist(backmatter.node, cat._id)) {
39
- isDisabled = true;
40
- }
41
- if (isEditableSectionCategory(cat) &&
42
- (!isUniquePresent(cat, existingCatsCounted) ||
43
- isUniqueCurrent(cat._id, currentValue))) {
44
- options.push({
45
- value: cat._id,
46
- label: cat.name,
47
- isDisabled: isDisabled,
48
- });
49
- }
50
- });
51
- return options;
52
- }, [currentValue, existingCatsCounted, sectionCategories, doc]);
53
- const selectionValue = useMemo(() => {
54
- const cat = sectionCategories.find((category) => category._id === currentValue);
55
- return cat && { value: cat._id, label: cat.name, isDisabled: false };
56
- }, [currentValue, sectionCategories]);
57
- return (React.createElement(Container, null,
58
- React.createElement(Select, { value: selectionValue, options: options, menuPortalTarget: document.body, onChange: handleInputChange, maxMenuHeight: 150, components: {
59
- Option: OptionComponent,
60
- } })));
61
- };
62
- const Container = styled.div `
63
- height: ${(props) => props.theme.grid.unit * 30}px;
64
- `;
65
- //# sourceMappingURL=CategoryInput.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CategoryInput.js","sourceRoot":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Y,CAC5C,CAAA;QACD,OAAO,GAAG,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,CAAA;IACtE,CAAC,EAAE,CAAC,YAAY,EAAE,iBAAiB,CAAC,CAAC,CAAA;IACrC,OAAO,CACL,oBAAC,SAAS;QACR,oBAAC,MAAM,IACL,KAAK,EAAE,cAAc,EACrB,OAAO,EAAE,OAAO,EAChB,gBAAgB,EAAE,QAAQ,CAAC,IAAI,EAC/B,QAAQ,EAAE,iBAAiB,EAC3B,aAAa,EAAE,GAAG,EAClB,UAAU,EAAE;gBACV,MAAM,EAAE,eAAe;aACxB,GACD,CACQ,CACb,CAAA;AACH,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAA;YAChB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,EAAE;CAChD,CAAA"}
@@ -1,60 +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) 2020 Atypon Systems LLC. All Rights Reserved.
11
- */
12
- export const uneditableSectionCategories = [
13
- 'MPSectionCategory:bibliography',
14
- 'MPSectionCategory:keywords',
15
- 'MPSectionCategory:list-of-figures',
16
- 'MPSectionCategory:list-of-tables',
17
- 'MPSectionCategory:toc',
18
- ];
19
- export const uniqueSectionCategories = [
20
- 'MPSectionCategory:abstract-graphical',
21
- 'MPSectionCategory:abstract',
22
- ];
23
- export const isEditableSectionCategoryID = (id) => !uneditableSectionCategories.includes(id);
24
- export const isEditableSectionCategory = (sectionCategory) => isEditableSectionCategoryID(sectionCategory._id);
25
- export const sortSectionCategories = (sectionCategories) => sectionCategories.sort((a, b) => a.priority - b.priority);
26
- export const chooseSectionCategory = (section, isSubSection) => {
27
- if (section.attrs.category) {
28
- return section.attrs.category;
29
- }
30
- return isSubSection
31
- ? 'MPSectionCategory:subsection'
32
- : 'MPSectionCategory:section';
33
- };
34
- export const isUnique = (categoryId) => {
35
- return uniqueSectionCategories.includes(categoryId);
36
- };
37
- export const isUniqueCurrent = (categoryId, currentCategoryId) => {
38
- return categoryId === currentCategoryId;
39
- };
40
- export const isUniquePresent = (cat, existingCats) => {
41
- return isUnique(cat._id) && Object.keys(existingCats).includes(cat._id);
42
- };
43
- export const isBackMatterSection = (groupId) => {
44
- return groupId === 'MPSectionCategory:backmatter';
45
- };
46
- export const backMatterSectionCategoryExist = (parent, category) => {
47
- let found = false;
48
- parent.descendants((node) => {
49
- if (node.attrs.category === category) {
50
- found = true;
51
- return false;
52
- }
53
- if (found) {
54
- return false;
55
- }
56
- return true;
57
- });
58
- return found;
59
- };
60
- //# sourceMappingURL=section-categories.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"section-categories.js","sourceRoot":"","sources":["../../../src/lib/section-categories.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH,MAAM,CAAC,MAAM,2BAA2B,GAAa;IACnD,gCAAgC;IAChC,4BAA4B;IAC5B,mCAAmC;IACnC,kCAAkC;IAClC,uBAAuB;CACxB,CAAA;AAED,MAAM,CAAC,MAAM,uBAAuB,GAAa;IAC/C,sCAAsC;IACtC,4BAA4B;CAC7B,CAAA;AAED,M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AmB,GAAG,CAAC,OAAe,EAAE,EAAE;IACrD,OAAO,OAAO,KAAK,8BAA8B,CAAA;AACnD,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAC5C,MAAsB,EACtB,QAAgB,EAChB,EAAE;IACF,IAAI,KAAK,GAAG,KAAK,CAAA;IACjB,MAAM,CAAC,WAAW,CAAC,CAAC,IAAoB,EAAE,EAAE;QAC1C,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,KAAK,QAAQ,EAAE;YACpC,KAAK,GAAG,IAAI,CAAA;YACZ,OAAO,KAAK,CAAA;SACb;QACD,IAAI,KAAK,EAAE;YACT,OAAO,KAAK,CAAA;SACb;QACD,OAAO,IAAI,CAAA;IACb,CAAC,CAAC,CAAA;IACF,OAAO,KAAK,CAAA;AACd,CAAC,CAAA"}
@@ -1,8 +0,0 @@
1
- import { SectionNode } from '@manuscripts/transform';
2
- import { EditorState, Transaction } from 'prosemirror-state';
3
- import React from 'react';
4
- export declare const SectionInspector: React.FC<{
5
- dispatchNodeAttrs: (id: string, attrs: Record<string, unknown>, nodispatch?: boolean) => Transaction | undefined;
6
- section: SectionNode;
7
- state: EditorState;
8
- }>;
@@ -1,21 +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) 2020 Atypon Systems LLC. All Rights Reserved.
11
- */
12
- import { SectionCategory } from '@manuscripts/json-schema';
13
- import React from 'react';
14
- export declare const CategoryInput: React.FC<{
15
- value: string;
16
- sectionCategories: SectionCategory[];
17
- handleChange: (category: string) => void;
18
- existingCatsCounted: {
19
- [key: string]: number;
20
- };
21
- }>;
@@ -1,26 +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) 2020 Atypon Systems LLC. All Rights Reserved.
11
- */
12
- import { SectionCategory } from '@manuscripts/json-schema';
13
- import { ManuscriptNode, SectionNode } from '@manuscripts/transform';
14
- export declare const uneditableSectionCategories: string[];
15
- export declare const uniqueSectionCategories: string[];
16
- export declare const isEditableSectionCategoryID: (id: string) => boolean;
17
- export declare const isEditableSectionCategory: (sectionCategory: SectionCategory) => boolean;
18
- export declare const sortSectionCategories: (sectionCategories: SectionCategory[]) => SectionCategory[];
19
- export declare const chooseSectionCategory: (section: SectionNode, isSubSection?: boolean) => string;
20
- export declare const isUnique: (categoryId: string) => boolean;
21
- export declare const isUniqueCurrent: (categoryId: string, currentCategoryId: string) => boolean;
22
- export declare const isUniquePresent: (cat: SectionCategory, existingCats: {
23
- [key: string]: number;
24
- }) => boolean;
25
- export declare const isBackMatterSection: (groupId: string) => boolean;
26
- export declare const backMatterSectionCategoryExist: (parent: ManuscriptNode, category: string) => boolean;