@manuscripts/body-editor 1.7.12 → 1.7.13-LEAN-3340-2

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.
@@ -31,9 +31,11 @@ const prosemirror_state_1 = require("prosemirror-state");
31
31
  const react_1 = require("react");
32
32
  const react_router_dom_1 = require("react-router-dom");
33
33
  const ManuscriptsEditor_1 = require("./configs/ManuscriptsEditor");
34
+ const popper_1 = require("./lib/popper");
34
35
  const use_do_with_debounce_1 = require("./lib/use-do-with-debounce");
35
- const useEditor = (props) => {
36
+ const useEditor = (externalProps) => {
36
37
  const view = (0, react_1.useRef)();
38
+ const props = Object.assign(Object.assign({}, externalProps), { popper: new popper_1.PopperManager() });
37
39
  const [state, setState] = (0, react_1.useState)(() => (0, ManuscriptsEditor_1.createEditorState)(props));
38
40
  const history = (0, react_router_dom_1.useHistory)();
39
41
  const { collabProvider } = props;
@@ -158,8 +158,12 @@ class BibliographyElementBlockView extends block_view_1.default {
158
158
  };
159
159
  this.addClickListenerToBibItem = (element, dataTracked) => {
160
160
  if (dataTracked.status !== track_changes_plugin_1.CHANGE_STATUS.rejected) {
161
- element.addEventListener('click', () => {
162
- this.view.dispatch(this.view.state.tr.setMeta(selected_suggestion_ui_1.SET_SUGGESTION_ID, dataTracked.id));
161
+ element.addEventListener('click', (e) => {
162
+ console.log(e);
163
+ console.log('CLICK');
164
+ setTimeout(() => {
165
+ this.view.dispatch(this.view.state.tr.setMeta(selected_suggestion_ui_1.SET_SUGGESTION_ID, dataTracked.id));
166
+ });
163
167
  });
164
168
  }
165
169
  };
@@ -28,9 +28,11 @@ import { NodeSelection, } from 'prosemirror-state';
28
28
  import { useCallback, useEffect, useRef, useState } from 'react';
29
29
  import { useHistory } from 'react-router-dom';
30
30
  import { createEditorState, createEditorView, } from './configs/ManuscriptsEditor';
31
+ import { PopperManager } from './lib/popper';
31
32
  import { useDoWithDebounce } from './lib/use-do-with-debounce';
32
- export const useEditor = (props) => {
33
+ export const useEditor = (externalProps) => {
33
34
  const view = useRef();
35
+ const props = Object.assign(Object.assign({}, externalProps), { popper: new PopperManager() });
34
36
  const [state, setState] = useState(() => createEditorState(props));
35
37
  const history = useHistory();
36
38
  const { collabProvider } = props;
@@ -152,8 +152,12 @@ export class BibliographyElementBlockView extends BlockView {
152
152
  };
153
153
  this.addClickListenerToBibItem = (element, dataTracked) => {
154
154
  if (dataTracked.status !== CHANGE_STATUS.rejected) {
155
- element.addEventListener('click', () => {
156
- this.view.dispatch(this.view.state.tr.setMeta(SET_SUGGESTION_ID, dataTracked.id));
155
+ element.addEventListener('click', (e) => {
156
+ console.log(e);
157
+ console.log('CLICK');
158
+ setTimeout(() => {
159
+ this.view.dispatch(this.view.state.tr.setMeta(SET_SUGGESTION_ID, dataTracked.id));
160
+ });
157
161
  });
158
162
  }
159
163
  };
@@ -54,5 +54,6 @@ export interface EditorProps {
54
54
  openAuthorEditing: () => void;
55
55
  selectAuthorForEditing: (authorId: string) => void;
56
56
  }
57
+ export type ExternalProps = Omit<EditorProps, 'popper'>;
57
58
  export declare const createEditorState: (props: EditorProps) => EditorState;
58
59
  export declare const createEditorView: (props: EditorProps, root: HTMLElement, state: EditorState, dispatch: Dispatch) => EditorView;
@@ -15,8 +15,8 @@
15
15
  */
16
16
  import { Command, EditorState, Transaction } from 'prosemirror-state';
17
17
  import { EditorView } from 'prosemirror-view';
18
- import { EditorProps } from './configs/ManuscriptsEditor';
19
- export declare const useEditor: (props: EditorProps) => {
18
+ import { ExternalProps } from './configs/ManuscriptsEditor';
19
+ export declare const useEditor: (externalProps: ExternalProps) => {
20
20
  state: EditorState;
21
21
  onRender: (el: HTMLDivElement | null) => void;
22
22
  isCommandValid: (command: Command) => boolean;
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.7.12",
4
+ "version": "1.7.13-LEAN-3340-2",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-body-editor",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -31,9 +31,9 @@
31
31
  "@manuscripts/assets": "^0.6.4",
32
32
  "@manuscripts/json-schema": "^2.2.4",
33
33
  "@manuscripts/library": "^1.3.3",
34
- "@manuscripts/style-guide": "1.7.7",
34
+ "@manuscripts/style-guide": "1.7.8",
35
35
  "@manuscripts/track-changes-plugin": "^1.7.5",
36
- "@manuscripts/transform": "^2.1.2",
36
+ "@manuscripts/transform": "2.1.3",
37
37
  "astrocite-eutils": "^0.16.4",
38
38
  "axios": "^1.6.7",
39
39
  "codemirror": "^5.58.1",
@@ -109,4 +109,4 @@
109
109
  "resolutions": {
110
110
  "@types/react": "^17.0.2"
111
111
  }
112
- }
112
+ }