@manuscripts/body-editor 1.6.4 → 1.6.6-LEAN-3074-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.
@@ -18,6 +18,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
18
18
  return (mod && mod.__esModule) ? mod : { "default": mod };
19
19
  };
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.createEditorView = exports.createEditorState = void 0;
21
22
  require("prosemirror-view/style/prosemirror.css");
22
23
  const transform_1 = require("@manuscripts/transform");
23
24
  const prosemirror_state_1 = require("prosemirror-state");
@@ -25,26 +26,24 @@ const prosemirror_view_1 = require("prosemirror-view");
25
26
  const paste_1 = require("../lib/paste");
26
27
  const editor_plugins_1 = __importDefault(require("./editor-plugins"));
27
28
  const editor_views_1 = __importDefault(require("./editor-views"));
28
- exports.default = {
29
- createState: (props) => {
30
- return prosemirror_state_1.EditorState.create({
31
- doc: props.doc,
32
- schema: transform_1.schema,
33
- plugins: (0, editor_plugins_1.default)(props),
34
- });
29
+ const createEditorState = (props) => prosemirror_state_1.EditorState.create({
30
+ doc: props.doc,
31
+ schema: transform_1.schema,
32
+ plugins: (0, editor_plugins_1.default)(props),
33
+ });
34
+ exports.createEditorState = createEditorState;
35
+ const createEditorView = (props, root, state, dispatch) => new prosemirror_view_1.EditorView(root, {
36
+ state,
37
+ editable: () => props.getCapabilities().editArticle,
38
+ scrollMargin: {
39
+ top: 100,
40
+ bottom: 100,
41
+ left: 0,
42
+ right: 0,
35
43
  },
36
- createView: (props) => (el, state, dispatch) => new prosemirror_view_1.EditorView(el, {
37
- state,
38
- editable: () => props.getCapabilities().editArticle,
39
- scrollMargin: {
40
- top: 100,
41
- bottom: 100,
42
- left: 0,
43
- right: 0,
44
- },
45
- dispatchTransaction: dispatch,
46
- nodeViews: (0, editor_views_1.default)(props, dispatch),
47
- attributes: props.attributes,
48
- transformPasted: paste_1.transformPasted,
49
- }),
50
- };
44
+ dispatchTransaction: dispatch,
45
+ nodeViews: (0, editor_views_1.default)(props, dispatch),
46
+ attributes: props.attributes,
47
+ transformPasted: paste_1.transformPasted,
48
+ });
49
+ exports.createEditorView = createEditorView;
@@ -46,6 +46,7 @@ const pullquote_element_editable_1 = __importDefault(require("../views/pullquote
46
46
  const section_label_1 = __importDefault(require("../views/section_label"));
47
47
  const section_title_editable_1 = __importDefault(require("../views/section_title_editable"));
48
48
  const table_element_editable_1 = __importDefault(require("../views/table_element_editable"));
49
+ const table_element_footer_editable_1 = __importDefault(require("../views/table_element_footer_editable"));
49
50
  const title_editable_1 = __importDefault(require("../views/title_editable"));
50
51
  const toc_element_editable_1 = __importDefault(require("../views/toc_element_editable"));
51
52
  exports.default = (props, dispatch) => {
@@ -78,6 +79,7 @@ exports.default = (props, dispatch) => {
78
79
  section_title: (0, section_title_editable_1.default)(props),
79
80
  section_label: (0, section_label_1.default)(props),
80
81
  table_element: (0, table_element_editable_1.default)(props),
82
+ table_element_footer: (0, table_element_footer_editable_1.default)(props),
81
83
  toc_element: (0, toc_element_editable_1.default)(props),
82
84
  comments: (0, empty_1.default)('comments'),
83
85
  };
package/dist/cjs/index.js CHANGED
@@ -28,11 +28,8 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
28
28
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
29
29
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
30
30
  };
31
- var __importDefault = (this && this.__importDefault) || function (mod) {
32
- return (mod && mod.__esModule) ? mod : { "default": mod };
33
- };
34
31
  Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.ManuscriptsEditor = exports.useEditor = exports.isHighlightComment = exports.isThereSelector = exports.commentScroll = exports.toolbar = exports.PopperManager = exports.CollabProvider = exports.getMenus = exports.ManuscriptToolbar = exports.OutlineManuscript = exports.OutlineItemIcon = exports.ManuscriptOutline = exports.DialogNames = exports.DialogController = void 0;
32
+ exports.isHighlightComment = exports.isThereSelector = exports.commentScroll = exports.toolbar = exports.PopperManager = exports.CollabProvider = exports.ManuscriptToolbar = exports.OutlineManuscript = exports.OutlineItemIcon = exports.ManuscriptOutline = exports.DialogNames = exports.DialogController = void 0;
36
33
  __exportStar(require("./citation-sources"), exports);
37
34
  __exportStar(require("./commands"), exports);
38
35
  __exportStar(require("./components/application-menu"), exports);
@@ -47,8 +44,7 @@ var OutlineManuscript_1 = require("./components/outline/OutlineManuscript");
47
44
  Object.defineProperty(exports, "OutlineManuscript", { enumerable: true, get: function () { return OutlineManuscript_1.OutlineManuscript; } });
48
45
  var ManuscriptToolbar_1 = require("./components/toolbar/ManuscriptToolbar");
49
46
  Object.defineProperty(exports, "ManuscriptToolbar", { enumerable: true, get: function () { return ManuscriptToolbar_1.ManuscriptToolbar; } });
50
- var menus_1 = require("./menus");
51
- Object.defineProperty(exports, "getMenus", { enumerable: true, get: function () { return __importDefault(menus_1).default; } });
47
+ __exportStar(require("./menus"), exports);
52
48
  var collabProvider_1 = require("./classes/collabProvider");
53
49
  Object.defineProperty(exports, "CollabProvider", { enumerable: true, get: function () { return collabProvider_1.CollabProvider; } });
54
50
  var popper_1 = require("./lib/popper");
@@ -62,7 +58,4 @@ Object.defineProperty(exports, "isThereSelector", { enumerable: true, get: funct
62
58
  Object.defineProperty(exports, "isHighlightComment", { enumerable: true, get: function () { return comment_annotation_1.isHighlightComment; } });
63
59
  __exportStar(require("./plugins/keywords"), exports);
64
60
  __exportStar(require("./lib/utils"), exports);
65
- var useEditor_1 = require("./useEditor");
66
- Object.defineProperty(exports, "useEditor", { enumerable: true, get: function () { return __importDefault(useEditor_1).default; } });
67
- var ManuscriptsEditor_1 = require("./configs//ManuscriptsEditor");
68
- Object.defineProperty(exports, "ManuscriptsEditor", { enumerable: true, get: function () { return __importDefault(ManuscriptsEditor_1).default; } });
61
+ __exportStar(require("./useEditor"), exports);
package/dist/cjs/menus.js CHANGED
@@ -15,6 +15,7 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.getMenus = void 0;
18
19
  const transform_1 = require("@manuscripts/transform");
19
20
  const prosemirror_commands_1 = require("prosemirror-commands");
20
21
  const prosemirror_history_1 = require("prosemirror-history");
@@ -24,7 +25,7 @@ const commands_1 = require("./commands");
24
25
  const dialog_1 = require("./components/dialog");
25
26
  const list_1 = require("./keys/list");
26
27
  const hierarchy_1 = require("./lib/hierarchy");
27
- exports.default = (editor, handleOpenDialog, footnotesEnabled, contentEditable) => {
28
+ const getMenus = (editor, handleOpenDialog, footnotesEnabled, contentEditable) => {
28
29
  const { isCommandValid, state } = editor;
29
30
  const wrap = (command) => () => editor.doCommand(command);
30
31
  let menus = [
@@ -438,3 +439,4 @@ exports.default = (editor, handleOpenDialog, footnotesEnabled, contentEditable)
438
439
  return menuGroup;
439
440
  });
440
441
  };
442
+ exports.getMenus = getMenus;
@@ -5,7 +5,13 @@ const transform_1 = require("@manuscripts/transform");
5
5
  function findHighlightMarkers(doc) {
6
6
  const markers = [];
7
7
  let current;
8
+ const commentIds = [];
8
9
  doc.descendants((node, pos) => {
10
+ if (node.type.name === transform_1.schema.nodes.comments.name) {
11
+ node.content.forEach(({ attrs }) => {
12
+ commentIds.push(attrs.id);
13
+ });
14
+ }
9
15
  if ((0, transform_1.isHighlightMarkerNode)(node)) {
10
16
  const { position, tid, id } = node.attrs;
11
17
  if (position === 'start') {
@@ -21,6 +27,6 @@ function findHighlightMarkers(doc) {
21
27
  }
22
28
  }
23
29
  });
24
- return markers;
30
+ return markers.filter((marker) => commentIds.includes(marker.id));
25
31
  }
26
32
  exports.findHighlightMarkers = findHighlightMarkers;
@@ -24,19 +24,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
24
24
  });
25
25
  };
26
26
  Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.useEditor = void 0;
27
28
  const track_changes_plugin_1 = require("@manuscripts/track-changes-plugin");
28
29
  const prosemirror_collab_1 = require("prosemirror-collab");
29
30
  const prosemirror_state_1 = require("prosemirror-state");
30
31
  const react_1 = require("react");
31
32
  const react_router_dom_1 = require("react-router-dom");
33
+ const ManuscriptsEditor_1 = require("./configs/ManuscriptsEditor");
32
34
  const use_do_with_debounce_1 = require("./lib/use-do-with-debounce");
33
- const bibliography_1 = require("./plugins/bibliography");
34
- const useEditor = (initialState, createView, editorProps) => {
35
+ const useEditor = (props) => {
35
36
  const view = (0, react_1.useRef)();
36
- const [state, setState] = (0, react_1.useState)(initialState);
37
- const [viewElement, setViewElement] = (0, react_1.useState)(null);
37
+ const [state, setState] = (0, react_1.useState)(() => (0, ManuscriptsEditor_1.createEditorState)(props));
38
38
  const history = (0, react_router_dom_1.useHistory)();
39
- const { collabProvider } = editorProps;
39
+ const { collabProvider } = props;
40
40
  if (collabProvider) {
41
41
  collabProvider.onNewSteps((newVersion, steps, clientIDs) => __awaiter(void 0, void 0, void 0, function* () {
42
42
  if (state && view.current) {
@@ -70,26 +70,15 @@ const useEditor = (initialState, createView, editorProps) => {
70
70
  debounce(() => {
71
71
  setState(nextState);
72
72
  }, 200, !tr.isGeneric);
73
- return state;
73
+ return nextState;
74
74
  }, []);
75
- const replaceView = (state, createView) => {
76
- if (viewElement && view.current) {
77
- view.current.destroy();
78
- view.current = createView(viewElement, state, dispatch);
79
- setState(view.current.state);
80
- }
81
- };
82
75
  const onRender = (0, react_1.useCallback)((el) => {
83
76
  var _a;
84
77
  if (!el) {
85
78
  return;
86
79
  }
87
- view.current = createView(el, ((_a = view.current) === null || _a === void 0 ? void 0 : _a.state) || state, dispatch);
80
+ view.current = (0, ManuscriptsEditor_1.createEditorView)(props, el, ((_a = view.current) === null || _a === void 0 ? void 0 : _a.state) || state, dispatch);
88
81
  setState(view.current.state);
89
- setViewElement(el);
90
- view.current.dispatch(view.current.state.tr.setMeta(bibliography_1.bibliographyKey, {
91
- initCitations: true,
92
- }));
93
82
  }, []);
94
83
  const isCommandValid = (0, react_1.useCallback)((command) => command(state), [state]);
95
84
  const doCommand = (0, react_1.useCallback)((command) => command(state, dispatch, view.current), [state, dispatch]);
@@ -138,9 +127,8 @@ const useEditor = (initialState, createView, editorProps) => {
138
127
  isCommandValid,
139
128
  doCommand,
140
129
  replaceState,
141
- replaceView,
142
130
  view: view.current,
143
131
  dispatch,
144
132
  };
145
133
  };
146
- exports.default = useEditor;
134
+ exports.useEditor = useEditor;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ /*!
3
+ * © 2019 Atypon Systems LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.TableElementFooterView = void 0;
19
+ const base_node_view_1 = require("./base_node_view");
20
+ const creators_1 = require("./creators");
21
+ class TableElementFooterView extends base_node_view_1.BaseNodeView {
22
+ constructor() {
23
+ super(...arguments);
24
+ this.initialise = () => {
25
+ this.createDOM();
26
+ };
27
+ this.createDOM = () => {
28
+ this.dom = document.createElement('div');
29
+ this.dom.classList.add('table-footer');
30
+ this.dom.setAttribute('id', this.node.attrs.id);
31
+ this.contentDOM = this.dom;
32
+ };
33
+ }
34
+ }
35
+ exports.TableElementFooterView = TableElementFooterView;
36
+ exports.default = (0, creators_1.createNodeView)(TableElementFooterView);
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ /*!
3
+ * © 2019 Atypon Systems LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const creators_1 = require("./creators");
19
+ const table_element_footer_1 = require("./table_element_footer");
20
+ exports.default = (0, creators_1.createEditableNodeView)(table_element_footer_1.TableElementFooterView);
@@ -20,26 +20,22 @@ import { EditorView } from 'prosemirror-view';
20
20
  import { transformPasted } from '../lib/paste';
21
21
  import plugins from './editor-plugins';
22
22
  import views from './editor-views';
23
- export default {
24
- createState: (props) => {
25
- return EditorState.create({
26
- doc: props.doc,
27
- schema,
28
- plugins: plugins(props),
29
- });
23
+ export const createEditorState = (props) => EditorState.create({
24
+ doc: props.doc,
25
+ schema,
26
+ plugins: plugins(props),
27
+ });
28
+ export const createEditorView = (props, root, state, dispatch) => new EditorView(root, {
29
+ state,
30
+ editable: () => props.getCapabilities().editArticle,
31
+ scrollMargin: {
32
+ top: 100,
33
+ bottom: 100,
34
+ left: 0,
35
+ right: 0,
30
36
  },
31
- createView: (props) => (el, state, dispatch) => new EditorView(el, {
32
- state,
33
- editable: () => props.getCapabilities().editArticle,
34
- scrollMargin: {
35
- top: 100,
36
- bottom: 100,
37
- left: 0,
38
- right: 0,
39
- },
40
- dispatchTransaction: dispatch,
41
- nodeViews: views(props, dispatch),
42
- attributes: props.attributes,
43
- transformPasted,
44
- }),
45
- };
37
+ dispatchTransaction: dispatch,
38
+ nodeViews: views(props, dispatch),
39
+ attributes: props.attributes,
40
+ transformPasted,
41
+ });
@@ -41,6 +41,7 @@ import pullquoteElement from '../views/pullquote_element_editable';
41
41
  import sectionLabel from '../views/section_label';
42
42
  import sectionTitle from '../views/section_title_editable';
43
43
  import tableElement from '../views/table_element_editable';
44
+ import tableElementFooter from '../views/table_element_footer_editable';
44
45
  import title from '../views/title_editable';
45
46
  import tocElement from '../views/toc_element_editable';
46
47
  export default (props, dispatch) => {
@@ -73,6 +74,7 @@ export default (props, dispatch) => {
73
74
  section_title: sectionTitle(props),
74
75
  section_label: sectionLabel(props),
75
76
  table_element: tableElement(props),
77
+ table_element_footer: tableElementFooter(props),
76
78
  toc_element: tocElement(props),
77
79
  comments: empty('comments'),
78
80
  };
package/dist/es/index.js CHANGED
@@ -21,7 +21,7 @@ export { ManuscriptOutline } from './components/outline/ManuscriptOutline';
21
21
  export { OutlineItemIcon } from './components/outline/Outline';
22
22
  export { OutlineManuscript } from './components/outline/OutlineManuscript';
23
23
  export { ManuscriptToolbar, } from './components/toolbar/ManuscriptToolbar';
24
- export { default as getMenus } from './menus';
24
+ export * from './menus';
25
25
  export { CollabProvider } from './classes/collabProvider';
26
26
  export { PopperManager } from './lib/popper';
27
27
  export { toolbar } from './toolbar';
@@ -29,5 +29,4 @@ export * from './plugins/highlight';
29
29
  export { commentScroll, isThereSelector, isHighlightComment, } from './plugins/comment_annotation';
30
30
  export * from './plugins/keywords';
31
31
  export * from './lib/utils';
32
- export { default as useEditor } from './useEditor';
33
- export { default as ManuscriptsEditor } from './configs//ManuscriptsEditor';
32
+ export * from './useEditor';
package/dist/es/menus.js CHANGED
@@ -22,7 +22,7 @@ import { addComment, blockActive, canInsert, ifInTableBody, insertBibliographySe
22
22
  import { DialogNames } from './components/dialog';
23
23
  import { skipTrackingChanges } from './keys/list';
24
24
  import { deleteClosestParentElement, findClosestParentElementNodeName, } from './lib/hierarchy';
25
- export default (editor, handleOpenDialog, footnotesEnabled, contentEditable) => {
25
+ export const getMenus = (editor, handleOpenDialog, footnotesEnabled, contentEditable) => {
26
26
  const { isCommandValid, state } = editor;
27
27
  const wrap = (command) => () => editor.doCommand(command);
28
28
  let menus = [
@@ -1,8 +1,14 @@
1
- import { isHighlightMarkerNode } from '@manuscripts/transform';
1
+ import { isHighlightMarkerNode, schema } from '@manuscripts/transform';
2
2
  export function findHighlightMarkers(doc) {
3
3
  const markers = [];
4
4
  let current;
5
+ const commentIds = [];
5
6
  doc.descendants((node, pos) => {
7
+ if (node.type.name === schema.nodes.comments.name) {
8
+ node.content.forEach(({ attrs }) => {
9
+ commentIds.push(attrs.id);
10
+ });
11
+ }
6
12
  if (isHighlightMarkerNode(node)) {
7
13
  const { position, tid, id } = node.attrs;
8
14
  if (position === 'start') {
@@ -18,5 +24,5 @@ export function findHighlightMarkers(doc) {
18
24
  }
19
25
  }
20
26
  });
21
- return markers;
27
+ return markers.filter((marker) => commentIds.includes(marker.id));
22
28
  }
@@ -27,14 +27,13 @@ import { getVersion, receiveTransaction, sendableSteps, } from 'prosemirror-coll
27
27
  import { NodeSelection, } from 'prosemirror-state';
28
28
  import { useCallback, useEffect, useRef, useState } from 'react';
29
29
  import { useHistory } from 'react-router-dom';
30
+ import { createEditorState, createEditorView, } from './configs/ManuscriptsEditor';
30
31
  import { useDoWithDebounce } from './lib/use-do-with-debounce';
31
- import { bibliographyKey } from './plugins/bibliography';
32
- const useEditor = (initialState, createView, editorProps) => {
32
+ export const useEditor = (props) => {
33
33
  const view = useRef();
34
- const [state, setState] = useState(initialState);
35
- const [viewElement, setViewElement] = useState(null);
34
+ const [state, setState] = useState(() => createEditorState(props));
36
35
  const history = useHistory();
37
- const { collabProvider } = editorProps;
36
+ const { collabProvider } = props;
38
37
  if (collabProvider) {
39
38
  collabProvider.onNewSteps((newVersion, steps, clientIDs) => __awaiter(void 0, void 0, void 0, function* () {
40
39
  if (state && view.current) {
@@ -68,26 +67,15 @@ const useEditor = (initialState, createView, editorProps) => {
68
67
  debounce(() => {
69
68
  setState(nextState);
70
69
  }, 200, !tr.isGeneric);
71
- return state;
70
+ return nextState;
72
71
  }, []);
73
- const replaceView = (state, createView) => {
74
- if (viewElement && view.current) {
75
- view.current.destroy();
76
- view.current = createView(viewElement, state, dispatch);
77
- setState(view.current.state);
78
- }
79
- };
80
72
  const onRender = useCallback((el) => {
81
73
  var _a;
82
74
  if (!el) {
83
75
  return;
84
76
  }
85
- view.current = createView(el, ((_a = view.current) === null || _a === void 0 ? void 0 : _a.state) || state, dispatch);
77
+ view.current = createEditorView(props, el, ((_a = view.current) === null || _a === void 0 ? void 0 : _a.state) || state, dispatch);
86
78
  setState(view.current.state);
87
- setViewElement(el);
88
- view.current.dispatch(view.current.state.tr.setMeta(bibliographyKey, {
89
- initCitations: true,
90
- }));
91
79
  }, []);
92
80
  const isCommandValid = useCallback((command) => command(state), [state]);
93
81
  const doCommand = useCallback((command) => command(state, dispatch, view.current), [state, dispatch]);
@@ -136,9 +124,7 @@ const useEditor = (initialState, createView, editorProps) => {
136
124
  isCommandValid,
137
125
  doCommand,
138
126
  replaceState,
139
- replaceView,
140
127
  view: view.current,
141
128
  dispatch,
142
129
  };
143
130
  };
144
- export default useEditor;
@@ -0,0 +1,32 @@
1
+ /*!
2
+ * © 2019 Atypon Systems LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { BaseNodeView } from './base_node_view';
17
+ import { createNodeView } from './creators';
18
+ export class TableElementFooterView extends BaseNodeView {
19
+ constructor() {
20
+ super(...arguments);
21
+ this.initialise = () => {
22
+ this.createDOM();
23
+ };
24
+ this.createDOM = () => {
25
+ this.dom = document.createElement('div');
26
+ this.dom.classList.add('table-footer');
27
+ this.dom.setAttribute('id', this.node.attrs.id);
28
+ this.contentDOM = this.dom;
29
+ };
30
+ }
31
+ }
32
+ export default createNodeView(TableElementFooterView);
@@ -0,0 +1,18 @@
1
+ /*!
2
+ * © 2019 Atypon Systems LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { createEditableNodeView } from './creators';
17
+ import { TableElementFooterView } from './table_element_footer';
18
+ export default createEditableNodeView(TableElementFooterView);
@@ -19,11 +19,12 @@ import { Capabilities, FileAttachment, FileManagement } from '@manuscripts/style
19
19
  import { Build, ManuscriptNode } from '@manuscripts/transform';
20
20
  import { History } from 'history';
21
21
  import { EditorState, Plugin } from 'prosemirror-state';
22
+ import { EditorView } from 'prosemirror-view';
22
23
  import React from 'react';
23
24
  import { DefaultTheme } from 'styled-components';
24
25
  import { CollabProvider } from '../classes/collabProvider';
26
+ import { Dispatch } from '../commands';
25
27
  import { PopperManager } from '../lib/popper';
26
- import { CreateView } from '../useEditor';
27
28
  export type CSLProps = {
28
29
  style?: string;
29
30
  locale?: string;
@@ -58,8 +59,5 @@ export interface EditorProps {
58
59
  environment?: string;
59
60
  collabProvider?: CollabProvider;
60
61
  }
61
- declare const _default: {
62
- createState: (props: EditorProps) => EditorState;
63
- createView: (props: EditorProps) => CreateView;
64
- };
65
- export default _default;
62
+ export declare const createEditorState: (props: EditorProps) => EditorState;
63
+ export declare const createEditorView: (props: EditorProps, root: HTMLElement, state: EditorState, dispatch: Dispatch) => EditorView;
@@ -532,6 +532,7 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
532
532
  updateNodeAttrs: (attrs: import("prosemirror-model").Attrs) => void;
533
533
  deleteNode: (id: string) => void;
534
534
  } & import("../views/table_element").TableElementView>;
535
+ table_element_footer: import("../types").NodeViewCreator<import("../views/table_element_footer").TableElementFooterView<any>>;
535
536
  toc_element: import("../types").NodeViewCreator<{
536
537
  gutterButtons: () => HTMLElement[];
537
538
  actionGutterButtons: () => HTMLElement[];
@@ -21,7 +21,7 @@ export { ManuscriptOutline } from './components/outline/ManuscriptOutline';
21
21
  export { OutlineItemIcon } from './components/outline/Outline';
22
22
  export { OutlineManuscript } from './components/outline/OutlineManuscript';
23
23
  export { ManuscriptToolbar, ToolbarButtonConfig, } from './components/toolbar/ManuscriptToolbar';
24
- export { default as getMenus } from './menus';
24
+ export * from './menus';
25
25
  export { ChangeReceiver } from './types';
26
26
  export { CollabProvider } from './classes/collabProvider';
27
27
  export { PopperManager } from './lib/popper';
@@ -30,5 +30,4 @@ export * from './plugins/highlight';
30
30
  export { commentScroll, isThereSelector, isHighlightComment, } from './plugins/comment_annotation';
31
31
  export * from './plugins/keywords';
32
32
  export * from './lib/utils';
33
- export { default as useEditor } from './useEditor';
34
- export { default as ManuscriptsEditor } from './configs//ManuscriptsEditor';
33
+ export * from './useEditor';
@@ -15,6 +15,5 @@
15
15
  */
16
16
  import { MenuSpec } from './components/application-menu';
17
17
  import { DialogNames } from './components/dialog';
18
- import useEditor from './useEditor';
19
- declare const _default: (editor: ReturnType<typeof useEditor>, handleOpenDialog: (dialog: DialogNames) => void, footnotesEnabled?: boolean, contentEditable?: boolean) => MenuSpec[];
20
- export default _default;
18
+ import { useEditor } from './useEditor';
19
+ export declare const getMenus: (editor: ReturnType<typeof useEditor>, handleOpenDialog: (dialog: DialogNames) => void, footnotesEnabled?: boolean, contentEditable?: boolean) => MenuSpec[];
@@ -16,15 +16,12 @@
16
16
  import { Command, EditorState, Transaction } from 'prosemirror-state';
17
17
  import { EditorView } from 'prosemirror-view';
18
18
  import { EditorProps } from './configs/ManuscriptsEditor';
19
- export type CreateView = (element: HTMLDivElement, state: EditorState, dispatch: (tr: Transaction) => EditorState) => EditorView;
20
- declare const useEditor: (initialState: EditorState, createView: CreateView, editorProps: EditorProps) => {
19
+ export declare const useEditor: (props: EditorProps) => {
21
20
  state: EditorState;
22
21
  onRender: (el: HTMLDivElement | null) => void;
23
22
  isCommandValid: (command: Command) => boolean;
24
23
  doCommand: (command: Command) => boolean;
25
24
  replaceState: (state: EditorState) => void;
26
- replaceView: (state: EditorState, createView: CreateView) => void;
27
25
  view: EditorView | undefined;
28
26
  dispatch: (tr: Transaction) => EditorState;
29
27
  };
30
- export default useEditor;
@@ -0,0 +1,23 @@
1
+ /*!
2
+ * © 2019 Atypon Systems LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { ManuscriptNodeView } from '@manuscripts/transform';
17
+ import { BaseNodeProps, BaseNodeView } from './base_node_view';
18
+ export declare class TableElementFooterView<PropsType extends BaseNodeProps> extends BaseNodeView<PropsType> implements ManuscriptNodeView {
19
+ initialise: () => void;
20
+ createDOM: () => void;
21
+ }
22
+ declare const _default: (props: BaseNodeProps, dispatch?: import("..").Dispatch | undefined) => import("../types").NodeViewCreator<TableElementFooterView<any>>;
23
+ export default _default;
@@ -0,0 +1,18 @@
1
+ /*!
2
+ * © 2019 Atypon Systems LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { TableElementFooterView } from './table_element_footer';
17
+ declare const _default: (props: import("./editable_block").EditableBlockProps, dispatch?: import("..").Dispatch | undefined) => import("../types").NodeViewCreator<TableElementFooterView<any>>;
18
+ export default _default;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@manuscripts/body-editor",
3
3
  "description": "Prosemirror components for editing and viewing manuscripts",
4
- "version": "1.6.4",
4
+ "version": "1.6.6-LEAN-3074-0",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-body-editor",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -30,10 +30,10 @@
30
30
  "@iarna/word-count": "^1.1.2",
31
31
  "@manuscripts/assets": "^0.6.4",
32
32
  "@manuscripts/json-schema": "2.2.1",
33
- "@manuscripts/library": "1.3.0",
34
- "@manuscripts/style-guide": "1.5.0",
33
+ "@manuscripts/library": "1.3.0-LEAN-3074-1",
34
+ "@manuscripts/style-guide": "1.5.0-LEAN-3074-1",
35
35
  "@manuscripts/track-changes-plugin": "^1.7.5",
36
- "@manuscripts/transform": "2.0.0",
36
+ "@manuscripts/transform": "2.0.1-LEAN-3074-0",
37
37
  "astrocite-eutils": "^0.16.4",
38
38
  "axios": "^1.2.2",
39
39
  "codemirror": "^5.58.1",
@@ -128,4 +128,4 @@
128
128
  "resolutions": {
129
129
  "@types/react": "^17.0.2"
130
130
  }
131
- }
131
+ }
package/styles/Editor.css CHANGED
@@ -939,6 +939,47 @@
939
939
  font-size: 75%;
940
940
  }
941
941
 
942
+ .ProseMirror .table-footer {
943
+ font-size: 14px;
944
+ }
945
+
946
+ .ProseMirror .table-footer > div:first-child {
947
+ padding-top: 8px;
948
+ }
949
+
950
+ .ProseMirror .table-footer > div:not(:first-child)::before {
951
+ content: '';
952
+ border-bottom: 1px dashed #C9C9C9;
953
+ display: block;
954
+ margin-bottom: 14px;
955
+ }
956
+
957
+ .ProseMirror .table-footer > div {
958
+ counter-reset: table_footnote;
959
+ }
960
+
961
+ .ProseMirror .table-footer > div > div > p::before {
962
+ counter-increment: table_footnote;
963
+ content: counter(table_footnote);
964
+ display: inline-block;
965
+ position: relative;
966
+ cursor: pointer;
967
+ vertical-align: super;
968
+ font-size: 75%;
969
+ margin-right: 4px;
970
+ }
971
+
972
+ .ProseMirror .table-footer > div > div > p {
973
+ margin-bottom: 0px;
974
+ margin-top: 0px;
975
+ }
976
+
977
+ /* .ProseMirror .table-footer > div > div > p:focus {
978
+ padding: 8px 0 8px 0;
979
+ border: 1px solid #bce7f6;
980
+ background-color: #f2fbfc;
981
+ } */
982
+
942
983
  .ProseMirror .footnote-label {
943
984
  vertical-align: super;
944
985
  font-size: 75%;
@@ -962,3 +1003,7 @@
962
1003
  line-height: 1.43;
963
1004
  padding-left: 65px;
964
1005
  }
1006
+ div[style*="background-color: rgba(249, 2, 2, 0.53)"] {
1007
+ background-color: #ffe08b !important;
1008
+ }
1009
+