@manuscripts/body-editor 1.13.28 → 1.13.29

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.
@@ -71,7 +71,6 @@ class PopperManager {
71
71
  }
72
72
  destroy() {
73
73
  if (this.activePopper) {
74
- console.log('destroying popper', this.activePopper, this.activePopper.state.elements.reference);
75
74
  this.removeContainerClass(this.activePopper.state.elements.reference);
76
75
  this.activePopper.destroy();
77
76
  this.activePopper.state.elements.popper.remove();
@@ -37,7 +37,7 @@ const useEditor = (externalProps) => {
37
37
  const view = (0, react_1.useRef)();
38
38
  const props = Object.assign(Object.assign({}, externalProps), { popper: new popper_1.PopperManager() });
39
39
  const [state, setState] = (0, react_1.useState)(() => (0, ManuscriptsEditor_1.createEditorState)(props));
40
- const history = (0, react_router_dom_1.useHistory)();
40
+ const location = (0, react_router_dom_1.useLocation)();
41
41
  const { collabProvider } = props;
42
42
  if (collabProvider) {
43
43
  collabProvider.onNewSteps((newVersion, steps, clientIDs) => __awaiter(void 0, void 0, void 0, function* () {
@@ -112,16 +112,11 @@ const useEditor = (externalProps) => {
112
112
  });
113
113
  }, [state]);
114
114
  (0, react_1.useEffect)(() => {
115
- const unlisten = history.listen(() => {
116
- const nodeId = history.location.hash.substring(1);
117
- if (nodeId) {
118
- focusNodeWithId(nodeId);
119
- }
120
- });
121
- return () => {
122
- unlisten();
123
- };
124
- }, [history, focusNodeWithId]);
115
+ const nodeId = location.hash.substring(1);
116
+ if (nodeId) {
117
+ focusNodeWithId(nodeId);
118
+ }
119
+ }, [location]);
125
120
  return {
126
121
  state,
127
122
  onRender,
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MATHJAX_VERSION = exports.VERSION = void 0;
4
- exports.VERSION = '1.13.28';
4
+ exports.VERSION = '1.13.29';
5
5
  exports.MATHJAX_VERSION = '3.2.2';
@@ -68,7 +68,6 @@ export class PopperManager {
68
68
  }
69
69
  destroy() {
70
70
  if (this.activePopper) {
71
- console.log('destroying popper', this.activePopper, this.activePopper.state.elements.reference);
72
71
  this.removeContainerClass(this.activePopper.state.elements.reference);
73
72
  this.activePopper.destroy();
74
73
  this.activePopper.state.elements.popper.remove();
@@ -26,7 +26,7 @@ import { trackChangesPluginKey, TrackChangesStatus, } from '@manuscripts/track-c
26
26
  import { getVersion, receiveTransaction, sendableSteps, } from 'prosemirror-collab';
27
27
  import { NodeSelection, } from 'prosemirror-state';
28
28
  import { useCallback, useEffect, useRef, useState } from 'react';
29
- import { useHistory } from 'react-router-dom';
29
+ import { useLocation } from 'react-router-dom';
30
30
  import { createEditorState, createEditorView, } from './configs/ManuscriptsEditor';
31
31
  import { PopperManager } from './lib/popper';
32
32
  import { useDoWithDebounce } from './lib/use-do-with-debounce';
@@ -34,7 +34,7 @@ export const useEditor = (externalProps) => {
34
34
  const view = useRef();
35
35
  const props = Object.assign(Object.assign({}, externalProps), { popper: new PopperManager() });
36
36
  const [state, setState] = useState(() => createEditorState(props));
37
- const history = useHistory();
37
+ const location = useLocation();
38
38
  const { collabProvider } = props;
39
39
  if (collabProvider) {
40
40
  collabProvider.onNewSteps((newVersion, steps, clientIDs) => __awaiter(void 0, void 0, void 0, function* () {
@@ -109,16 +109,11 @@ export const useEditor = (externalProps) => {
109
109
  });
110
110
  }, [state]);
111
111
  useEffect(() => {
112
- const unlisten = history.listen(() => {
113
- const nodeId = history.location.hash.substring(1);
114
- if (nodeId) {
115
- focusNodeWithId(nodeId);
116
- }
117
- });
118
- return () => {
119
- unlisten();
120
- };
121
- }, [history, focusNodeWithId]);
112
+ const nodeId = location.hash.substring(1);
113
+ if (nodeId) {
114
+ focusNodeWithId(nodeId);
115
+ }
116
+ }, [location]);
122
117
  return {
123
118
  state,
124
119
  onRender,
@@ -1,2 +1,2 @@
1
- export const VERSION = '1.13.28';
1
+ export const VERSION = '1.13.29';
2
2
  export const MATHJAX_VERSION = '3.2.2';
@@ -13,14 +13,14 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { Link } from 'react-router-dom';
16
+ /// <reference types="react" />
17
17
  export declare const OutlineItemIcon: import("styled-components").StyledComponent<"span", any, {}, never>;
18
18
  export declare const OutlineItem: import("styled-components").StyledComponent<"div", any, {
19
19
  depth: number;
20
20
  }, never>;
21
21
  export declare const OutlineItemArrow: import("styled-components").StyledComponent<"button", any, {}, never>;
22
22
  export declare const OutlineItemNoArrow: import("styled-components").StyledComponent<"span", any, {}, never>;
23
- export declare const OutlineItemLink: import("styled-components").StyledComponent<typeof Link, any, {}, never>;
23
+ export declare const OutlineItemLink: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("react-router-dom").LinkProps & import("react").RefAttributes<HTMLAnchorElement>>, any, {}, never>;
24
24
  export declare const OutlineItemLinkText: import("styled-components").StyledComponent<"span", any, {}, never>;
25
25
  export declare const Outline: import("styled-components").StyledComponent<"div", any, {}, never>;
26
26
  export declare const OutlineItemPlaceholder: import("styled-components").StyledComponent<"span", any, {}, never>;
@@ -17,7 +17,6 @@ import 'prosemirror-view/style/prosemirror.css';
17
17
  import { Manuscript, UserProfile } from '@manuscripts/json-schema';
18
18
  import { Capabilities } from '@manuscripts/style-guide';
19
19
  import { ManuscriptNode } from '@manuscripts/transform';
20
- import { History } from 'history';
21
20
  import { EditorState } from 'prosemirror-state';
22
21
  import { EditorView } from 'prosemirror-view';
23
22
  import { DefaultTheme } from 'styled-components';
@@ -42,7 +41,6 @@ export interface EditorProps {
42
41
  getFiles: () => FileAttachment[];
43
42
  fileManagement: FileManagement;
44
43
  popper: PopperManager;
45
- history: History;
46
44
  getCapabilities: () => Capabilities;
47
45
  userID: string;
48
46
  debug: boolean;
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.13.28";
1
+ export declare const VERSION = "1.13.29";
2
2
  export declare const MATHJAX_VERSION = "3.2.2";
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.13.28",
4
+ "version": "1.13.29",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-body-editor",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -61,7 +61,7 @@
61
61
  "react-dnd-html5-backend": "^16.0.1",
62
62
  "react-dom": "^17.0.2",
63
63
  "react-is": "^17.0.2",
64
- "react-router-dom": "^5.3.4",
64
+ "react-router-dom": "^6.25.0",
65
65
  "react-select": "^5.7.3",
66
66
  "styled-components": "^5.2.0"
67
67
  },
@@ -77,7 +77,7 @@
77
77
  "@types/lodash": "^4.14.202",
78
78
  "@types/react": "^17.0.2",
79
79
  "@types/react-dom": "^17.0.2",
80
- "@types/react-router-dom": "^5.1.6",
80
+ "@types/react-router-dom": "^5.3.3",
81
81
  "@types/styled-components": "^5.1.4",
82
82
  "@types/uuid": "^9.0.0",
83
83
  "@typescript-eslint/eslint-plugin": "^5.47.0",