@manuscripts/body-editor 3.19.0 → 3.19.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.
- package/dist/cjs/components/cross-ref-check-modal/CrossRefWarningModal.js +202 -52
- package/dist/cjs/components/cross-ref-check-modal/openModal.js +8 -2
- package/dist/cjs/components/references/ReferenceForm/ReferenceForm.js +22 -40
- package/dist/cjs/components/references/ReferenceForm/styled-components.js +1 -13
- package/dist/cjs/components/references/ReferencesEditor.js +26 -1
- package/dist/cjs/components/references/ReferencesModal.js +71 -7
- package/dist/cjs/lib/utils.js +12 -1
- package/dist/cjs/menus.js +12 -0
- package/dist/cjs/plugins/cross-references.js +37 -14
- package/dist/cjs/versions.js +1 -1
- package/dist/cjs/views/ReactSubView.js +1 -0
- package/dist/cjs/views/cross_reference.js +13 -2
- package/dist/cjs/views/cross_reference_editable.js +1 -4
- package/dist/es/components/cross-ref-check-modal/CrossRefWarningModal.js +202 -52
- package/dist/es/components/cross-ref-check-modal/openModal.js +9 -3
- package/dist/es/components/references/ReferenceForm/ReferenceForm.js +21 -40
- package/dist/es/components/references/ReferenceForm/styled-components.js +0 -12
- package/dist/es/components/references/ReferencesEditor.js +21 -0
- package/dist/es/components/references/ReferencesModal.js +73 -9
- package/dist/es/lib/utils.js +11 -1
- package/dist/es/menus.js +12 -0
- package/dist/es/plugins/cross-references.js +37 -15
- package/dist/es/versions.js +1 -1
- package/dist/es/views/ReactSubView.js +1 -0
- package/dist/es/views/cross_reference.js +13 -2
- package/dist/es/views/cross_reference_editable.js +1 -4
- package/dist/types/components/authors-affiliations/AuthorsAndAffiliationsModals.d.ts +1 -1
- package/dist/types/components/cross-ref-check-modal/CrossRefWarningModal.d.ts +4 -2
- package/dist/types/components/cross-ref-check-modal/openModal.d.ts +2 -2
- package/dist/types/components/references/ReferenceForm/ReferenceForm.d.ts +3 -3
- package/dist/types/components/references/ReferenceForm/styled-components.d.ts +0 -1
- package/dist/types/components/references/ReferencesEditor.d.ts +3 -0
- package/dist/types/lib/utils.d.ts +4 -0
- package/dist/types/plugins/cross-references.d.ts +2 -0
- package/dist/types/versions.d.ts +1 -1
- package/dist/types/views/ReactSubView.d.ts +5 -2
- package/dist/types/views/cross_reference.d.ts +1 -0
- package/package.json +2 -2
- package/src/components/cross-ref-check-modal/CrossRefWarningModal.tsx +315 -83
- package/src/components/cross-ref-check-modal/openModal.ts +14 -4
- package/src/components/references/ReferenceForm/ReferenceForm.tsx +21 -82
- package/src/components/references/ReferenceForm/styled-components.ts +0 -13
- package/src/components/references/ReferencesEditor.tsx +38 -0
- package/src/components/references/ReferencesModal.tsx +116 -14
- package/src/lib/utils.ts +24 -0
- package/src/lib/view.ts +1 -0
- package/src/menus.tsx +12 -0
- package/src/plugins/cross-references.ts +41 -13
- package/src/versions.ts +1 -1
- package/src/views/ReactSubView.tsx +6 -3
- package/src/views/cross_reference.ts +14 -2
- package/src/views/cross_reference_editable.ts +1 -4
- package/styles/Editor.css +12 -0
package/dist/es/lib/utils.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { isElementNodeType, isSectionNodeType, schema, } from '@manuscripts/transform';
|
|
17
17
|
import { Fragment, } from 'prosemirror-model';
|
|
18
|
-
import { findChildrenByType, findParentNode, findParentNodeOfTypeClosestToPos, } from 'prosemirror-utils';
|
|
18
|
+
import { findChildren, findChildrenByType, findParentNode, findParentNodeOfTypeClosestToPos, } from 'prosemirror-utils';
|
|
19
19
|
import { fieldConfigMap } from '../components/references/ReferenceForm/config';
|
|
20
20
|
import { arrowDown } from '../icons';
|
|
21
21
|
import { handleEnterKey } from './navigation-utils';
|
|
@@ -197,3 +197,13 @@ export const getLastTitleNode = (state) => {
|
|
|
197
197
|
const titleNode = findChildrenByType(state.doc, state.schema.nodes.title)[0];
|
|
198
198
|
return titleNode;
|
|
199
199
|
};
|
|
200
|
+
export const getSurroundingText = (pos, node) => {
|
|
201
|
+
const nodeContent = findChildren(pos.node(), (child) => child.attrs.id === node.attrs.id)[0];
|
|
202
|
+
const content = pos.node().content;
|
|
203
|
+
const MAX_LENGTH = 40;
|
|
204
|
+
const nodeStart = nodeContent.pos;
|
|
205
|
+
const nodeEnd = nodeContent.pos + node.nodeSize;
|
|
206
|
+
const leftHandText = content.textBetween(nodeStart > MAX_LENGTH ? nodeStart - MAX_LENGTH : 0, nodeStart);
|
|
207
|
+
const rightHandText = content.textBetween(nodeEnd, Math.min(nodeEnd + MAX_LENGTH, content.size));
|
|
208
|
+
return { leftHandText, rightHandText };
|
|
209
|
+
};
|
package/dist/es/menus.js
CHANGED
|
@@ -26,6 +26,7 @@ import { templateAllows } from './lib/template';
|
|
|
26
26
|
import { isEditAllowed } from './lib/utils';
|
|
27
27
|
import { getEditorProps } from './plugins/editor-props';
|
|
28
28
|
import { openInsertAwardModal } from './components/awards/AwardModal';
|
|
29
|
+
import { openReferencesEditor } from './components/references/ReferencesEditor';
|
|
29
30
|
export const getEditorMenus = (editor) => {
|
|
30
31
|
const { isCommandValid, state, view } = editor;
|
|
31
32
|
const doCommand = (command) => () => editor.doCommand(command);
|
|
@@ -563,6 +564,17 @@ export const getEditorMenus = (editor) => {
|
|
|
563
564
|
run: doCommand(insertInlineCitation),
|
|
564
565
|
isHidden: !templateAllows(state, schema.nodes.citation),
|
|
565
566
|
},
|
|
567
|
+
{
|
|
568
|
+
id: 'insert-reference-section',
|
|
569
|
+
label: 'New reference',
|
|
570
|
+
shortcut: {
|
|
571
|
+
mac: 'Option+CommandOrControl+N',
|
|
572
|
+
pc: 'CommandOrControl+Option+N',
|
|
573
|
+
},
|
|
574
|
+
isEnabled: isEditAllowed(state),
|
|
575
|
+
run: doCommand(openReferencesEditor),
|
|
576
|
+
isHidden: !templateAllows(state, schema.nodes.bibliography_item),
|
|
577
|
+
},
|
|
566
578
|
{
|
|
567
579
|
id: 'insert-cross-reference',
|
|
568
580
|
label: 'Cross-reference',
|
|
@@ -14,14 +14,17 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { schema, } from '@manuscripts/transform';
|
|
17
|
-
import { trackChangesPluginKey } from '@manuscripts/track-changes-plugin';
|
|
17
|
+
import { trackChangesPluginKey, TrackChangesAction, } from '@manuscripts/track-changes-plugin';
|
|
18
18
|
import isEqual from 'lodash/isEqual';
|
|
19
19
|
import { NodeSelection, Plugin } from 'prosemirror-state';
|
|
20
20
|
import { Decoration, DecorationSet } from 'prosemirror-view';
|
|
21
21
|
import { openCrossRefWarningModal } from '../components/cross-ref-check-modal/openModal';
|
|
22
22
|
import { objectsKey } from './objects';
|
|
23
|
+
export const DELETE_WITHOUT_REF = 'delete-without-ref';
|
|
24
|
+
export const SELECTED_CROSS_REF_CLASS = 'selected-cross-reference';
|
|
23
25
|
let modalActive = false;
|
|
24
26
|
let modalElement = null;
|
|
27
|
+
let scrollTargetEl = null;
|
|
25
28
|
export default () => {
|
|
26
29
|
let view = null;
|
|
27
30
|
return new Plugin({
|
|
@@ -40,7 +43,10 @@ export default () => {
|
|
|
40
43
|
if (!view ||
|
|
41
44
|
!tr.docChanged ||
|
|
42
45
|
tr.getMeta(trackChangesPluginKey) ||
|
|
43
|
-
tr.getMeta(
|
|
46
|
+
tr.getMeta(TrackChangesAction.refreshChanges) ||
|
|
47
|
+
tr.getMeta('addToHistory') === false ||
|
|
48
|
+
tr.getMeta('collab$') ||
|
|
49
|
+
tr.getMeta(DELETE_WITHOUT_REF)) {
|
|
44
50
|
return true;
|
|
45
51
|
}
|
|
46
52
|
if (modalActive) {
|
|
@@ -59,6 +65,9 @@ export default () => {
|
|
|
59
65
|
modalElement.remove();
|
|
60
66
|
modalElement = null;
|
|
61
67
|
}
|
|
68
|
+
if (scrollTargetEl) {
|
|
69
|
+
scrollTargetEl.classList.remove(SELECTED_CROSS_REF_CLASS);
|
|
70
|
+
}
|
|
62
71
|
};
|
|
63
72
|
const deletedIds = new Set(xrefGroups.map((g) => g.referenced.attrs.id));
|
|
64
73
|
const onClose = () => {
|
|
@@ -149,12 +158,13 @@ function createXrefGroups(targets, stateDoc, resultDoc) {
|
|
|
149
158
|
const xrefs = xrefsByRid.get(id);
|
|
150
159
|
if (xrefs?.length) {
|
|
151
160
|
const label = targets.get(referenced.attrs.id)?.label || '';
|
|
152
|
-
|
|
161
|
+
const caption = targets.get(referenced.attrs.id)?.caption || '';
|
|
162
|
+
xrefGroups.push({ referenced, label, caption, xrefs });
|
|
153
163
|
}
|
|
154
164
|
}
|
|
155
165
|
return xrefGroups;
|
|
156
166
|
}
|
|
157
|
-
const onConfirmCreator = (view, cleanup, deletedIds, tr) => () => {
|
|
167
|
+
const onConfirmCreator = (view, cleanup, deletedIds, tr) => (deleteOption) => {
|
|
158
168
|
cleanup();
|
|
159
169
|
if (!view) {
|
|
160
170
|
return;
|
|
@@ -168,18 +178,23 @@ const onConfirmCreator = (view, cleanup, deletedIds, tr) => () => {
|
|
|
168
178
|
}
|
|
169
179
|
newTr.step(step);
|
|
170
180
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
181
|
+
if (deleteOption === 'delete-with-ref') {
|
|
182
|
+
const xrefPositions = [];
|
|
183
|
+
newTr.doc.descendants((node, pos) => {
|
|
184
|
+
if (node.type === schema.nodes.cross_reference) {
|
|
185
|
+
const rids = node.attrs.rids;
|
|
186
|
+
if (rids.some((rid) => deletedIds.has(rid))) {
|
|
187
|
+
xrefPositions.push({ from: pos, to: pos + node.nodeSize });
|
|
188
|
+
}
|
|
177
189
|
}
|
|
190
|
+
});
|
|
191
|
+
for (let i = xrefPositions.length - 1; i >= 0; i--) {
|
|
192
|
+
const { from, to } = xrefPositions[i];
|
|
193
|
+
newTr.delete(from, to);
|
|
178
194
|
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
newTr.delete(from, to);
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
newTr.setMeta(DELETE_WITHOUT_REF, true);
|
|
183
198
|
}
|
|
184
199
|
view.dispatch(newTr);
|
|
185
200
|
};
|
|
@@ -189,7 +204,6 @@ const selectAndScrollToCreator = (view) => ($pos) => {
|
|
|
189
204
|
}
|
|
190
205
|
const selTr = view.state.tr;
|
|
191
206
|
selTr.setSelection(NodeSelection.create(view.state.doc, $pos.pos));
|
|
192
|
-
view.focus();
|
|
193
207
|
view.dispatch(selTr);
|
|
194
208
|
let scrollable = view.dom.parentElement;
|
|
195
209
|
while (scrollable != null &&
|
|
@@ -212,4 +226,12 @@ const selectAndScrollToCreator = (view) => ($pos) => {
|
|
|
212
226
|
modalElement?.classList.remove('modal-bottom');
|
|
213
227
|
scrollable.scrollTo({ top: scrollTo, behavior: 'smooth' });
|
|
214
228
|
}
|
|
229
|
+
const dom = view.nodeDOM($pos.pos);
|
|
230
|
+
if (dom && dom instanceof HTMLElement) {
|
|
231
|
+
dom.classList.add(SELECTED_CROSS_REF_CLASS);
|
|
232
|
+
if (scrollTargetEl && scrollTargetEl !== dom) {
|
|
233
|
+
scrollTargetEl?.classList.remove(SELECTED_CROSS_REF_CLASS);
|
|
234
|
+
}
|
|
235
|
+
scrollTargetEl = dom;
|
|
236
|
+
}
|
|
215
237
|
};
|
package/dist/es/versions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '3.19.
|
|
1
|
+
export const VERSION = '3.19.2';
|
|
2
2
|
export const MATHJAX_VERSION = '3.2.2';
|
|
@@ -20,6 +20,7 @@ import { createRoot } from 'react-dom/client';
|
|
|
20
20
|
import { ThemeProvider } from 'styled-components';
|
|
21
21
|
function createSubView(props, Component, componentProps, node, getPos, view, classNames = []) {
|
|
22
22
|
const container = document.createElement('div');
|
|
23
|
+
container.unmount = () => root.unmount();
|
|
23
24
|
const Wrapped = createView(props, Component, componentProps, node, getPos, view, classNames, container);
|
|
24
25
|
const root = createRoot(container);
|
|
25
26
|
root.render(React.createElement(Wrapped, null));
|
|
@@ -50,10 +50,21 @@ export class CrossReferenceView extends BaseNodeView {
|
|
|
50
50
|
const target = attrs.rids.length ? targets.get(attrs.rids[0]) : undefined;
|
|
51
51
|
const isSupplement = target?.type === schema.nodes.supplement.name;
|
|
52
52
|
const derivedLabel = isSupplement
|
|
53
|
-
? target?.caption || target?.label || ''
|
|
54
|
-
: target?.label || '';
|
|
53
|
+
? target?.caption || target?.label || '[cross-ref]'
|
|
54
|
+
: target?.label || '[cross-ref]';
|
|
55
55
|
this.dom.textContent = attrs.label || derivedLabel;
|
|
56
56
|
this.dom.addEventListener('click', this.handleClick);
|
|
57
|
+
if (this.isOrphaned()) {
|
|
58
|
+
this.dom.classList.add('orphaned-cross-reference');
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
this.dom.classList.remove('orphaned-cross-reference');
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
isOrphaned() {
|
|
65
|
+
const targets = objectsKey.getState(this.view.state);
|
|
66
|
+
const rid = this.node.attrs.rids[0];
|
|
67
|
+
return !targets?.get(rid);
|
|
57
68
|
}
|
|
58
69
|
}
|
|
59
70
|
export default createNodeView(CrossReferenceView);
|
|
@@ -111,9 +111,7 @@ export class CrossReferenceEditableView extends CrossReferenceView {
|
|
|
111
111
|
this.showContextMenu = () => {
|
|
112
112
|
this.props.popper.destroy();
|
|
113
113
|
const can = this.props.getCapabilities();
|
|
114
|
-
const
|
|
115
|
-
const rid = this.node.attrs.rids[0];
|
|
116
|
-
const isOrphaned = !targets?.get(rid);
|
|
114
|
+
const isOrphaned = this.isOrphaned();
|
|
117
115
|
const actions = [
|
|
118
116
|
{
|
|
119
117
|
label: 'Comment',
|
|
@@ -135,7 +133,6 @@ export class CrossReferenceEditableView extends CrossReferenceView {
|
|
|
135
133
|
label: 'Edit',
|
|
136
134
|
icon: 'Edit',
|
|
137
135
|
action: () => this.handleEdit(),
|
|
138
|
-
disabled: isOrphaned,
|
|
139
136
|
});
|
|
140
137
|
}
|
|
141
138
|
this.contextMenu = ReactSubView(this.props, ContextMenu, { actions }, this.node, this.getPos, this.view, ['context-menu']);
|
|
@@ -26,4 +26,4 @@ export interface AuthorsAndAffiliationsModalsProps {
|
|
|
26
26
|
addNewAffiliation?: boolean;
|
|
27
27
|
}
|
|
28
28
|
export declare const AuthorsAndAffiliationsModals: React.FC<AuthorsAndAffiliationsModalsProps>;
|
|
29
|
-
export declare const openAuthorsAndAffiliationsModals: (pos: number, view: ManuscriptEditorView | EditorView | undefined, initialModal: "authors" | "affiliations") =>
|
|
29
|
+
export declare const openAuthorsAndAffiliationsModals: (pos: number, view: ManuscriptEditorView | EditorView | undefined, initialModal: "authors" | "affiliations") => import("../../views/ReactSubView").SubViewContainer | undefined;
|
|
@@ -14,16 +14,18 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { ManuscriptNode } from '@manuscripts/transform';
|
|
17
|
-
import React from 'react';
|
|
18
17
|
import { ResolvedPos } from 'prosemirror-model';
|
|
18
|
+
import React from 'react';
|
|
19
19
|
export type XrefGroup = {
|
|
20
20
|
referenced: ManuscriptNode;
|
|
21
21
|
label: string;
|
|
22
|
+
caption: string;
|
|
22
23
|
xrefs: [ManuscriptNode, ResolvedPos][];
|
|
23
24
|
};
|
|
25
|
+
export type DeleteOption = 'delete-without-ref' | 'delete-with-ref';
|
|
24
26
|
export declare const CrossRefWarningModal: React.FC<{
|
|
25
27
|
onClose: () => void;
|
|
26
28
|
xrefs: XrefGroup[];
|
|
27
|
-
onConfirm: () => void;
|
|
29
|
+
onConfirm: (deleteOption: DeleteOption) => void;
|
|
28
30
|
selectAndScrollTo: ($pos: ResolvedPos) => void;
|
|
29
31
|
}>;
|
|
@@ -15,5 +15,5 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { ManuscriptEditorView } from '@manuscripts/transform';
|
|
17
17
|
import { ResolvedPos } from 'prosemirror-model';
|
|
18
|
-
import { XrefGroup } from './CrossRefWarningModal';
|
|
19
|
-
export declare const openCrossRefWarningModal: (view: ManuscriptEditorView, xrefGroups: XrefGroup[], onConfirm: () => void, onClose: () => void, selectAndScrollTo: ($pos: ResolvedPos) => void) => HTMLDivElement;
|
|
18
|
+
import { DeleteOption, XrefGroup } from './CrossRefWarningModal';
|
|
19
|
+
export declare const openCrossRefWarningModal: (view: ManuscriptEditorView, xrefGroups: XrefGroup[], onConfirm: (deleteOption: DeleteOption) => void, onClose: () => void, selectAndScrollTo: ($pos: ResolvedPos) => void) => HTMLDivElement;
|
|
@@ -17,13 +17,13 @@ import { BibliographyItemAttrs } from '@manuscripts/transform';
|
|
|
17
17
|
import React, { MutableRefObject } from 'react';
|
|
18
18
|
export interface ReferenceFormActions {
|
|
19
19
|
reset: () => void;
|
|
20
|
+
submit: () => void;
|
|
21
|
+
isDirty: () => boolean;
|
|
20
22
|
}
|
|
23
|
+
export declare const validateReference: (values: BibliographyItemAttrs) => Partial<BibliographyItemAttrs>;
|
|
21
24
|
export declare const ReferenceForm: React.FC<{
|
|
22
25
|
values: BibliographyItemAttrs;
|
|
23
|
-
showDelete: boolean;
|
|
24
26
|
onChange: (values: BibliographyItemAttrs) => void;
|
|
25
|
-
onCancel: () => void;
|
|
26
|
-
onDelete: () => void;
|
|
27
27
|
onSave: (values: BibliographyItemAttrs) => void;
|
|
28
28
|
actionsRef?: MutableRefObject<ReferenceFormActions | undefined>;
|
|
29
29
|
}>;
|
|
@@ -243,7 +243,6 @@ export declare const Button: import("styled-components/dist/types").IStyledCompo
|
|
|
243
243
|
as?: import("styled-components").WebTarget | undefined;
|
|
244
244
|
forwardedAs?: import("styled-components").WebTarget | undefined;
|
|
245
245
|
}, "$defaultColor" | "$size">>> & string;
|
|
246
|
-
export declare const Actions: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
247
246
|
export declare const ReferenceTextField: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, keyof import("@manuscripts/style-guide").TextFieldProps> & import("@manuscripts/style-guide").TextFieldProps, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, keyof import("@manuscripts/style-guide").TextFieldProps> & import("@manuscripts/style-guide").TextFieldProps, never>>, "as" | "forwardedAs"> & {
|
|
248
247
|
as?: import("styled-components").WebTarget | undefined;
|
|
249
248
|
forwardedAs?: import("styled-components").WebTarget | undefined;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { BibliographyItemAttrs } from '@manuscripts/transform';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { ReferencesModalProps } from './ReferencesModal';
|
|
4
|
+
import { EditorState, Transaction } from 'prosemirror-state';
|
|
5
|
+
import { EditorView } from 'prosemirror-view';
|
|
4
6
|
export type ReferencesEditorProps = Omit<ReferencesModalProps, 'isOpen' | 'onCancel' | 'handleImport' | 'onSave'> & {
|
|
5
7
|
onSave: (item: BibliographyItemAttrs[]) => void;
|
|
6
8
|
};
|
|
7
9
|
export declare const ReferencesEditor: React.FC<ReferencesEditorProps>;
|
|
10
|
+
export declare const openReferencesEditor: (state: EditorState, _?: (tr: Transaction) => void, view?: EditorView) => boolean;
|
|
@@ -43,3 +43,7 @@ export declare const getLastTitleNode: (state: ManuscriptEditorState) => {
|
|
|
43
43
|
node: ProseMirrorNode;
|
|
44
44
|
pos: number;
|
|
45
45
|
};
|
|
46
|
+
export declare const getSurroundingText: (pos: ResolvedPos, node: ManuscriptNode) => {
|
|
47
|
+
leftHandText: string;
|
|
48
|
+
rightHandText: string;
|
|
49
|
+
};
|
|
@@ -15,5 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { Plugin } from 'prosemirror-state';
|
|
17
17
|
import { DecorationSet } from 'prosemirror-view';
|
|
18
|
+
export declare const DELETE_WITHOUT_REF = "delete-without-ref";
|
|
19
|
+
export declare const SELECTED_CROSS_REF_CLASS = "selected-cross-reference";
|
|
18
20
|
declare const _default: () => Plugin<DecorationSet>;
|
|
19
21
|
export default _default;
|
package/dist/types/versions.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "3.19.
|
|
1
|
+
export declare const VERSION = "3.19.2";
|
|
2
2
|
export declare const MATHJAX_VERSION = "3.2.2";
|
|
@@ -17,6 +17,9 @@ import { ManuscriptEditorView, ManuscriptNode } from '@manuscripts/transform';
|
|
|
17
17
|
import React from 'react';
|
|
18
18
|
import { EditorProps } from '../configs/ManuscriptsEditor';
|
|
19
19
|
import { Trackable } from '../types';
|
|
20
|
+
export type SubViewContainer = HTMLDivElement & {
|
|
21
|
+
unmount: () => void;
|
|
22
|
+
};
|
|
20
23
|
export interface ReactViewComponentProps<NodeT extends ManuscriptNode> {
|
|
21
24
|
nodeAttrs: NodeT['attrs'];
|
|
22
25
|
setNodeAttrs: (nextAttrs: Partial<NodeT['attrs']>) => void;
|
|
@@ -25,8 +28,8 @@ export interface ReactViewComponentProps<NodeT extends ManuscriptNode> {
|
|
|
25
28
|
getPos: () => number;
|
|
26
29
|
node: ManuscriptNode | Trackable<ManuscriptNode>;
|
|
27
30
|
};
|
|
28
|
-
container:
|
|
31
|
+
container: SubViewContainer;
|
|
29
32
|
}
|
|
30
|
-
declare function createSubView<T extends Trackable<ManuscriptNode>>(props: EditorProps, Component: React.FC<any>, componentProps: object, node: T, getPos: () => number, view: ManuscriptEditorView, classNames?: string[]):
|
|
33
|
+
declare function createSubView<T extends Trackable<ManuscriptNode>>(props: EditorProps, Component: React.FC<any>, componentProps: object, node: T, getPos: () => number, view: ManuscriptEditorView, classNames?: string[]): SubViewContainer;
|
|
31
34
|
export declare function createSubViewAsync<T extends Trackable<ManuscriptNode>>(props: EditorProps, Component: React.FC<any>, componentProps: object, node: T, getPos: () => number, view: ManuscriptEditorView, classNames?: string[]): Promise<HTMLDivElement>;
|
|
32
35
|
export default createSubView;
|
|
@@ -22,6 +22,7 @@ export declare class CrossReferenceView extends BaseNodeView<Trackable<CrossRefe
|
|
|
22
22
|
initialise: () => void;
|
|
23
23
|
ignoreMutation: () => boolean;
|
|
24
24
|
createDOM: () => void;
|
|
25
|
+
protected isOrphaned(): boolean;
|
|
25
26
|
}
|
|
26
27
|
declare const _default: (props: import("../configs/ManuscriptsEditor").EditorProps, dispatch?: import("..").Dispatch) => import("../types").NodeViewCreator<CrossReferenceView>;
|
|
27
28
|
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": "3.19.
|
|
4
|
+
"version": "3.19.2",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@citation-js/plugin-pubmed": "0.3.0",
|
|
42
42
|
"@citation-js/plugin-ris": "0.7.18",
|
|
43
43
|
"@iarna/word-count": "1.1.2",
|
|
44
|
-
"@manuscripts/style-guide": "3.8.
|
|
44
|
+
"@manuscripts/style-guide": "3.8.1",
|
|
45
45
|
"@manuscripts/track-changes-plugin": "2.4.0",
|
|
46
46
|
"@manuscripts/transform": "4.5.7",
|
|
47
47
|
"@popperjs/core": "2.11.8",
|