@manuscripts/body-editor 3.6.18 → 3.6.20
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/commands.js +5 -31
- package/dist/cjs/components/affiliations/AffiliationsModal.js +2 -1
- package/dist/cjs/lib/context-menu.js +5 -7
- package/dist/cjs/versions.js +1 -1
- package/dist/cjs/views/affiliations.js +5 -0
- package/dist/cjs/views/pullquote_element.js +19 -0
- package/dist/es/commands.js +4 -29
- package/dist/es/components/affiliations/AffiliationsModal.js +2 -1
- package/dist/es/lib/context-menu.js +6 -8
- package/dist/es/versions.js +1 -1
- package/dist/es/views/affiliations.js +6 -1
- package/dist/es/views/pullquote_element.js +19 -0
- package/dist/types/commands.d.ts +1 -2
- package/dist/types/components/affiliations/AffiliationsModal.d.ts +1 -0
- package/dist/types/versions.d.ts +1 -1
- package/dist/types/views/affiliations.d.ts +1 -0
- package/dist/types/views/pullquote_element.d.ts +2 -0
- package/package.json +1 -1
- package/styles/AdvancedEditor.css +4 -0
package/dist/cjs/commands.js
CHANGED
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.
|
|
19
|
-
exports.ignoreEnterInSubtitles = exports.insertHeroImage = exports.activateSearchReplace = exports.activateSearch = exports.autoComplete = exports.addColumns =
|
|
18
|
+
exports.addHeaderRow = exports.addRows = exports.addInlineComment = exports.addNodeComment = exports.createAndFillTableElement = exports.selectAllIsolating = exports.ignoreAtomBlockNodeForward = exports.isAtEndOfTextBlock = exports.ignoreMetaNodeBackspaceCommand = exports.ignoreAtomBlockNodeBackward = exports.isTextSelection = exports.isAtStartOfTextBlock = exports.insertTOCSection = exports.insertBibliographySection = exports.insertList = exports.insertKeywords = exports.insertAward = exports.insertAffiliation = exports.insertContributors = exports.insertGraphicalAbstract = exports.insertBackmatterSection = exports.insertAbstractSection = exports.insertSection = exports.insertBoxElement = exports.insertInlineFootnote = exports.insertFootnotesElement = exports.insertTableElementFooter = exports.insertInlineEquation = exports.insertCrossReference = exports.insertInlineCitation = exports.insertLink = exports.insertSectionLabel = exports.findPosBeforeFirstSubsection = exports.insertBreak = exports.deleteBlock = exports.insertBlock = exports.insertAttachment = exports.insertSupplement = exports.insertTable = exports.insertEmbed = exports.insertFigure = exports.insertGeneralTableFootnote = exports.insertInlineTableFootnote = exports.createBlock = exports.createSelection = exports.canInsert = exports.blockActive = exports.isNodeSelection = exports.markActive = exports.addToStart = void 0;
|
|
19
|
+
exports.ignoreEnterInSubtitles = exports.insertHeroImage = exports.activateSearchReplace = exports.activateSearch = exports.autoComplete = exports.addColumns = void 0;
|
|
20
20
|
const json_schema_1 = require("@manuscripts/json-schema");
|
|
21
21
|
const track_changes_plugin_1 = require("@manuscripts/track-changes-plugin");
|
|
22
22
|
const transform_1 = require("@manuscripts/transform");
|
|
@@ -731,8 +731,7 @@ const insertContributors = (state, dispatch, view) => {
|
|
|
731
731
|
return false;
|
|
732
732
|
}
|
|
733
733
|
if (!contributors) {
|
|
734
|
-
const
|
|
735
|
-
const pos = title.pos + title.node.nodeSize;
|
|
734
|
+
const pos = (0, utils_1.findInsertionPosition)(transform_1.schema.nodes.contributors, state.doc);
|
|
736
735
|
const contributorsNode = state.schema.nodes.contributors.create({
|
|
737
736
|
id: '',
|
|
738
737
|
});
|
|
@@ -756,8 +755,7 @@ const insertAffiliation = (state, dispatch, view) => {
|
|
|
756
755
|
return false;
|
|
757
756
|
}
|
|
758
757
|
if (!affiliations) {
|
|
759
|
-
const
|
|
760
|
-
const pos = title.pos + title.node.nodeSize;
|
|
758
|
+
const pos = (0, utils_1.findInsertionPosition)(transform_1.schema.nodes.affiliations, state.doc);
|
|
761
759
|
const affiliationsNode = state.schema.nodes.affiliations.create({
|
|
762
760
|
id: '',
|
|
763
761
|
});
|
|
@@ -1118,31 +1116,7 @@ const getParentNode = (selection) => {
|
|
|
1118
1116
|
}
|
|
1119
1117
|
return node;
|
|
1120
1118
|
};
|
|
1121
|
-
const isCommentingAllowed = (type) => type === transform_1.schema.nodes.title ||
|
|
1122
|
-
type === transform_1.schema.nodes.subtitles ||
|
|
1123
|
-
type === transform_1.schema.nodes.section ||
|
|
1124
|
-
type === transform_1.schema.nodes.citation ||
|
|
1125
|
-
type === transform_1.schema.nodes.bibliography_item ||
|
|
1126
|
-
type === transform_1.schema.nodes.footnotes_section ||
|
|
1127
|
-
type === transform_1.schema.nodes.bibliography_section ||
|
|
1128
|
-
type === transform_1.schema.nodes.box_element ||
|
|
1129
|
-
type === transform_1.schema.nodes.graphical_abstract_section ||
|
|
1130
|
-
type === transform_1.schema.nodes.keyword_group ||
|
|
1131
|
-
type === transform_1.schema.nodes.paragraph ||
|
|
1132
|
-
type === transform_1.schema.nodes.figure_element ||
|
|
1133
|
-
type === transform_1.schema.nodes.list ||
|
|
1134
|
-
type === transform_1.schema.nodes.table_element ||
|
|
1135
|
-
type === transform_1.schema.nodes.embed ||
|
|
1136
|
-
type === transform_1.schema.nodes.affiliations ||
|
|
1137
|
-
type === transform_1.schema.nodes.contributors ||
|
|
1138
|
-
type === transform_1.schema.nodes.image_element ||
|
|
1139
|
-
type === transform_1.schema.nodes.hero_image ||
|
|
1140
|
-
type === transform_1.schema.nodes.trans_abstract;
|
|
1141
|
-
exports.isCommentingAllowed = isCommentingAllowed;
|
|
1142
1119
|
const addNodeComment = (node, state, dispatch) => {
|
|
1143
|
-
if (!(0, exports.isCommentingAllowed)(node.type)) {
|
|
1144
|
-
return false;
|
|
1145
|
-
}
|
|
1146
1120
|
const props = (0, editor_props_1.getEditorProps)(state);
|
|
1147
1121
|
const contribution = (0, json_schema_1.buildContribution)(props.userID);
|
|
1148
1122
|
const attrs = {
|
|
@@ -1169,7 +1143,7 @@ exports.addNodeComment = addNodeComment;
|
|
|
1169
1143
|
const addInlineComment = (state, dispatch) => {
|
|
1170
1144
|
const selection = state.selection;
|
|
1171
1145
|
const node = getParentNode(selection);
|
|
1172
|
-
if (!node
|
|
1146
|
+
if (!node) {
|
|
1173
1147
|
return false;
|
|
1174
1148
|
}
|
|
1175
1149
|
let from = selection.from;
|
|
@@ -60,7 +60,7 @@ function makeAuthorItems(authors) {
|
|
|
60
60
|
label: `${author.bibliographicName.given} ${author.bibliographicName.family}`,
|
|
61
61
|
}));
|
|
62
62
|
}
|
|
63
|
-
const AffiliationsModal = ({ authors: $authors, affiliations: $affiliations, affiliation, onSaveAffiliation, onDeleteAffiliation, onUpdateAuthors, addNewAffiliation = false, }) => {
|
|
63
|
+
const AffiliationsModal = ({ authors: $authors, affiliations: $affiliations, affiliation, onSaveAffiliation, onDeleteAffiliation, onUpdateAuthors, clearSelection, addNewAffiliation = false, }) => {
|
|
64
64
|
const [isOpen, setIsOpen] = (0, react_1.useState)(true);
|
|
65
65
|
const [selection, setSelection] = (0, react_1.useState)(affiliation);
|
|
66
66
|
const [showingDeleteDialog, setShowDeleteDialog] = (0, react_1.useState)(false);
|
|
@@ -114,6 +114,7 @@ const AffiliationsModal = ({ authors: $authors, affiliations: $affiliations, aff
|
|
|
114
114
|
else {
|
|
115
115
|
setIsOpen(false);
|
|
116
116
|
}
|
|
117
|
+
clearSelection();
|
|
117
118
|
};
|
|
118
119
|
const handleSelect = (affiliation) => {
|
|
119
120
|
const values = valuesRef.current;
|
|
@@ -209,14 +209,12 @@ class ContextMenu {
|
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
211
|
const commentTarget = this.getCommentTarget();
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
popper.destroy();
|
|
217
|
-
}));
|
|
212
|
+
menu.appendChild(this.createMenuSection((section) => {
|
|
213
|
+
section.appendChild(this.createMenuItem('Comment', () => {
|
|
214
|
+
(0, commands_1.addNodeComment)(commentTarget, this.view.state, this.view.dispatch);
|
|
215
|
+
popper.destroy();
|
|
218
216
|
}));
|
|
219
|
-
}
|
|
217
|
+
}));
|
|
220
218
|
if (type === transform_1.schema.nodes.table_element) {
|
|
221
219
|
const items = [];
|
|
222
220
|
const isInsideNode = (0, utils_1.isSelectionInNode)(this.view.state, this.node);
|
package/dist/cjs/versions.js
CHANGED
|
@@ -86,6 +86,7 @@ class AffiliationsView extends block_view_1.default {
|
|
|
86
86
|
onDeleteAffiliation: this.handleDeleteAffiliation,
|
|
87
87
|
onUpdateAuthors: this.handleUpdateAuthors,
|
|
88
88
|
addNewAffiliation: addNew,
|
|
89
|
+
clearSelection: this.clearSelection,
|
|
89
90
|
};
|
|
90
91
|
this.popper?.remove();
|
|
91
92
|
this.popper = (0, ReactSubView_1.default)(this.props, AffiliationsModal_1.AffiliationsModal, componentProps, this.node, this.getPos, this.view);
|
|
@@ -143,6 +144,10 @@ class AffiliationsView extends block_view_1.default {
|
|
|
143
144
|
this.handleEdit('', true);
|
|
144
145
|
}
|
|
145
146
|
};
|
|
147
|
+
this.clearSelection = () => {
|
|
148
|
+
const { state, dispatch } = this.view;
|
|
149
|
+
dispatch(state.tr.setSelection(prosemirror_state_1.Selection.atStart(state.doc)));
|
|
150
|
+
};
|
|
146
151
|
this.handleUpdateAuthors = (authors) => {
|
|
147
152
|
authors.forEach((author) => {
|
|
148
153
|
(0, view_1.updateNodeAttrs)(this.view, transform_1.schema.nodes.contributor, author);
|
|
@@ -21,7 +21,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
21
21
|
exports.PullquoteElementView = void 0;
|
|
22
22
|
const style_guide_1 = require("@manuscripts/style-guide");
|
|
23
23
|
const transform_1 = require("@manuscripts/transform");
|
|
24
|
+
const prosemirror_state_1 = require("prosemirror-state");
|
|
24
25
|
const prosemirror_utils_1 = require("prosemirror-utils");
|
|
26
|
+
const comments_1 = require("../plugins/comments");
|
|
25
27
|
const block_view_1 = __importDefault(require("./block_view"));
|
|
26
28
|
const creators_1 = require("./creators");
|
|
27
29
|
const ReactSubView_1 = __importDefault(require("./ReactSubView"));
|
|
@@ -31,11 +33,24 @@ class PullquoteElementView extends block_view_1.default {
|
|
|
31
33
|
this.elementType = 'aside';
|
|
32
34
|
this.ignoreMutation = () => true;
|
|
33
35
|
this.stopEvent = () => true;
|
|
36
|
+
this.handleClick = (event) => {
|
|
37
|
+
const element = event.target;
|
|
38
|
+
const marker = element.closest('.comment-marker');
|
|
39
|
+
if (marker) {
|
|
40
|
+
const key = marker.dataset.key;
|
|
41
|
+
const tr = this.view.state.tr;
|
|
42
|
+
(0, comments_1.setCommentSelection)(tr, key, undefined, false);
|
|
43
|
+
tr.setSelection(prosemirror_state_1.NodeSelection.create(this.view.state.doc, this.getPos()));
|
|
44
|
+
this.view.dispatch(tr);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
34
48
|
this.createElement = () => {
|
|
35
49
|
this.contentDOM = document.createElement(this.elementType);
|
|
36
50
|
this.contentDOM.className = 'block';
|
|
37
51
|
this.contentDOM.classList.add('pullquote');
|
|
38
52
|
this.dom.appendChild(this.contentDOM);
|
|
53
|
+
this.dom.addEventListener('click', this.handleClick);
|
|
39
54
|
};
|
|
40
55
|
this.actionGutterButtons = () => {
|
|
41
56
|
const contextMenu = this.addFigureContextMenu();
|
|
@@ -59,6 +74,10 @@ class PullquoteElementView extends block_view_1.default {
|
|
|
59
74
|
}
|
|
60
75
|
return undefined;
|
|
61
76
|
};
|
|
77
|
+
this.destroy = () => {
|
|
78
|
+
this.dom.removeEventListener('click', this.handleClick);
|
|
79
|
+
super.destroy();
|
|
80
|
+
};
|
|
62
81
|
}
|
|
63
82
|
handleAddFigure() {
|
|
64
83
|
const tr = this.view.state.tr;
|
package/dist/es/commands.js
CHANGED
|
@@ -28,7 +28,7 @@ import { createFootnote, findFootnotesContainerNode, getFootnotesElementState, }
|
|
|
28
28
|
import { findWordBoundaries, isNodeOfType, nearestAncestor, } from './lib/helpers';
|
|
29
29
|
import { templateAllows } from './lib/template';
|
|
30
30
|
import { isDeleted } from './lib/track-changes-utils';
|
|
31
|
-
import { findInsertionPosition, findParentNodeWithId, getChildOfType, getInsertPos,
|
|
31
|
+
import { findInsertionPosition, findParentNodeWithId, getChildOfType, getInsertPos, isBodyLocked, } from './lib/utils';
|
|
32
32
|
import { expandAccessibilitySection } from './plugins/accessibility_element';
|
|
33
33
|
import { setCommentSelection } from './plugins/comments';
|
|
34
34
|
import { getEditorProps } from './plugins/editor-props';
|
|
@@ -696,8 +696,7 @@ export const insertContributors = (state, dispatch, view) => {
|
|
|
696
696
|
return false;
|
|
697
697
|
}
|
|
698
698
|
if (!contributors) {
|
|
699
|
-
const
|
|
700
|
-
const pos = title.pos + title.node.nodeSize;
|
|
699
|
+
const pos = findInsertionPosition(schema.nodes.contributors, state.doc);
|
|
701
700
|
const contributorsNode = state.schema.nodes.contributors.create({
|
|
702
701
|
id: '',
|
|
703
702
|
});
|
|
@@ -720,8 +719,7 @@ export const insertAffiliation = (state, dispatch, view) => {
|
|
|
720
719
|
return false;
|
|
721
720
|
}
|
|
722
721
|
if (!affiliations) {
|
|
723
|
-
const
|
|
724
|
-
const pos = title.pos + title.node.nodeSize;
|
|
722
|
+
const pos = findInsertionPosition(schema.nodes.affiliations, state.doc);
|
|
725
723
|
const affiliationsNode = state.schema.nodes.affiliations.create({
|
|
726
724
|
id: '',
|
|
727
725
|
});
|
|
@@ -1068,30 +1066,7 @@ const getParentNode = (selection) => {
|
|
|
1068
1066
|
}
|
|
1069
1067
|
return node;
|
|
1070
1068
|
};
|
|
1071
|
-
export const isCommentingAllowed = (type) => type === schema.nodes.title ||
|
|
1072
|
-
type === schema.nodes.subtitles ||
|
|
1073
|
-
type === schema.nodes.section ||
|
|
1074
|
-
type === schema.nodes.citation ||
|
|
1075
|
-
type === schema.nodes.bibliography_item ||
|
|
1076
|
-
type === schema.nodes.footnotes_section ||
|
|
1077
|
-
type === schema.nodes.bibliography_section ||
|
|
1078
|
-
type === schema.nodes.box_element ||
|
|
1079
|
-
type === schema.nodes.graphical_abstract_section ||
|
|
1080
|
-
type === schema.nodes.keyword_group ||
|
|
1081
|
-
type === schema.nodes.paragraph ||
|
|
1082
|
-
type === schema.nodes.figure_element ||
|
|
1083
|
-
type === schema.nodes.list ||
|
|
1084
|
-
type === schema.nodes.table_element ||
|
|
1085
|
-
type === schema.nodes.embed ||
|
|
1086
|
-
type === schema.nodes.affiliations ||
|
|
1087
|
-
type === schema.nodes.contributors ||
|
|
1088
|
-
type === schema.nodes.image_element ||
|
|
1089
|
-
type === schema.nodes.hero_image ||
|
|
1090
|
-
type === schema.nodes.trans_abstract;
|
|
1091
1069
|
export const addNodeComment = (node, state, dispatch) => {
|
|
1092
|
-
if (!isCommentingAllowed(node.type)) {
|
|
1093
|
-
return false;
|
|
1094
|
-
}
|
|
1095
1070
|
const props = getEditorProps(state);
|
|
1096
1071
|
const contribution = buildContribution(props.userID);
|
|
1097
1072
|
const attrs = {
|
|
@@ -1117,7 +1092,7 @@ export const addNodeComment = (node, state, dispatch) => {
|
|
|
1117
1092
|
export const addInlineComment = (state, dispatch) => {
|
|
1118
1093
|
const selection = state.selection;
|
|
1119
1094
|
const node = getParentNode(selection);
|
|
1120
|
-
if (!node
|
|
1095
|
+
if (!node) {
|
|
1121
1096
|
return false;
|
|
1122
1097
|
}
|
|
1123
1098
|
let from = selection.from;
|
|
@@ -21,7 +21,7 @@ function makeAuthorItems(authors) {
|
|
|
21
21
|
label: `${author.bibliographicName.given} ${author.bibliographicName.family}`,
|
|
22
22
|
}));
|
|
23
23
|
}
|
|
24
|
-
export const AffiliationsModal = ({ authors: $authors, affiliations: $affiliations, affiliation, onSaveAffiliation, onDeleteAffiliation, onUpdateAuthors, addNewAffiliation = false, }) => {
|
|
24
|
+
export const AffiliationsModal = ({ authors: $authors, affiliations: $affiliations, affiliation, onSaveAffiliation, onDeleteAffiliation, onUpdateAuthors, clearSelection, addNewAffiliation = false, }) => {
|
|
25
25
|
const [isOpen, setIsOpen] = useState(true);
|
|
26
26
|
const [selection, setSelection] = useState(affiliation);
|
|
27
27
|
const [showingDeleteDialog, setShowDeleteDialog] = useState(false);
|
|
@@ -75,6 +75,7 @@ export const AffiliationsModal = ({ authors: $authors, affiliations: $affiliatio
|
|
|
75
75
|
else {
|
|
76
76
|
setIsOpen(false);
|
|
77
77
|
}
|
|
78
|
+
clearSelection();
|
|
78
79
|
};
|
|
79
80
|
const handleSelect = (affiliation) => {
|
|
80
81
|
const values = valuesRef.current;
|
|
@@ -19,7 +19,7 @@ import { TextSelection } from 'prosemirror-state';
|
|
|
19
19
|
import { findChildrenByType } from 'prosemirror-utils';
|
|
20
20
|
import { createElement } from 'react';
|
|
21
21
|
import { renderToStaticMarkup } from 'react-dom/server';
|
|
22
|
-
import { addNodeComment, createBlock, findPosBeforeFirstSubsection, insertGeneralTableFootnote, insertInlineTableFootnote,
|
|
22
|
+
import { addNodeComment, createBlock, findPosBeforeFirstSubsection, insertGeneralTableFootnote, insertInlineTableFootnote, } from '../commands';
|
|
23
23
|
import { PopperManager } from './popper';
|
|
24
24
|
import { createPositionOptions } from './position-menu';
|
|
25
25
|
import { templateAllows } from './template';
|
|
@@ -205,14 +205,12 @@ export class ContextMenu {
|
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
const commentTarget = this.getCommentTarget();
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
popper.destroy();
|
|
213
|
-
}));
|
|
208
|
+
menu.appendChild(this.createMenuSection((section) => {
|
|
209
|
+
section.appendChild(this.createMenuItem('Comment', () => {
|
|
210
|
+
addNodeComment(commentTarget, this.view.state, this.view.dispatch);
|
|
211
|
+
popper.destroy();
|
|
214
212
|
}));
|
|
215
|
-
}
|
|
213
|
+
}));
|
|
216
214
|
if (type === schema.nodes.table_element) {
|
|
217
215
|
const items = [];
|
|
218
216
|
const isInsideNode = isSelectionInNode(this.view.state, this.node);
|
package/dist/es/versions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '3.6.
|
|
1
|
+
export const VERSION = '3.6.20';
|
|
2
2
|
export const MATHJAX_VERSION = '3.2.2';
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { ContextMenu } from '@manuscripts/style-guide';
|
|
17
17
|
import { schema } from '@manuscripts/transform';
|
|
18
|
-
import { NodeSelection } from 'prosemirror-state';
|
|
18
|
+
import { NodeSelection, Selection } from 'prosemirror-state';
|
|
19
19
|
import { AffiliationsModal, } from '../components/affiliations/AffiliationsModal';
|
|
20
20
|
import { alertIcon } from '../icons';
|
|
21
21
|
import { affiliationName, } from '../lib/authors';
|
|
@@ -80,6 +80,7 @@ export class AffiliationsView extends BlockView {
|
|
|
80
80
|
onDeleteAffiliation: this.handleDeleteAffiliation,
|
|
81
81
|
onUpdateAuthors: this.handleUpdateAuthors,
|
|
82
82
|
addNewAffiliation: addNew,
|
|
83
|
+
clearSelection: this.clearSelection,
|
|
83
84
|
};
|
|
84
85
|
this.popper?.remove();
|
|
85
86
|
this.popper = ReactSubView(this.props, AffiliationsModal, componentProps, this.node, this.getPos, this.view);
|
|
@@ -137,6 +138,10 @@ export class AffiliationsView extends BlockView {
|
|
|
137
138
|
this.handleEdit('', true);
|
|
138
139
|
}
|
|
139
140
|
};
|
|
141
|
+
this.clearSelection = () => {
|
|
142
|
+
const { state, dispatch } = this.view;
|
|
143
|
+
dispatch(state.tr.setSelection(Selection.atStart(state.doc)));
|
|
144
|
+
};
|
|
140
145
|
this.handleUpdateAuthors = (authors) => {
|
|
141
146
|
authors.forEach((author) => {
|
|
142
147
|
updateNodeAttrs(this.view, schema.nodes.contributor, author);
|
|
@@ -15,7 +15,9 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { ContextMenu } from '@manuscripts/style-guide';
|
|
17
17
|
import { schema } from '@manuscripts/transform';
|
|
18
|
+
import { NodeSelection } from 'prosemirror-state';
|
|
18
19
|
import { findChildrenByType } from 'prosemirror-utils';
|
|
20
|
+
import { setCommentSelection } from '../plugins/comments';
|
|
19
21
|
import BlockView from './block_view';
|
|
20
22
|
import { createNodeOrElementView } from './creators';
|
|
21
23
|
import ReactSubView from './ReactSubView';
|
|
@@ -25,11 +27,24 @@ export class PullquoteElementView extends BlockView {
|
|
|
25
27
|
this.elementType = 'aside';
|
|
26
28
|
this.ignoreMutation = () => true;
|
|
27
29
|
this.stopEvent = () => true;
|
|
30
|
+
this.handleClick = (event) => {
|
|
31
|
+
const element = event.target;
|
|
32
|
+
const marker = element.closest('.comment-marker');
|
|
33
|
+
if (marker) {
|
|
34
|
+
const key = marker.dataset.key;
|
|
35
|
+
const tr = this.view.state.tr;
|
|
36
|
+
setCommentSelection(tr, key, undefined, false);
|
|
37
|
+
tr.setSelection(NodeSelection.create(this.view.state.doc, this.getPos()));
|
|
38
|
+
this.view.dispatch(tr);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
28
42
|
this.createElement = () => {
|
|
29
43
|
this.contentDOM = document.createElement(this.elementType);
|
|
30
44
|
this.contentDOM.className = 'block';
|
|
31
45
|
this.contentDOM.classList.add('pullquote');
|
|
32
46
|
this.dom.appendChild(this.contentDOM);
|
|
47
|
+
this.dom.addEventListener('click', this.handleClick);
|
|
33
48
|
};
|
|
34
49
|
this.actionGutterButtons = () => {
|
|
35
50
|
const contextMenu = this.addFigureContextMenu();
|
|
@@ -53,6 +68,10 @@ export class PullquoteElementView extends BlockView {
|
|
|
53
68
|
}
|
|
54
69
|
return undefined;
|
|
55
70
|
};
|
|
71
|
+
this.destroy = () => {
|
|
72
|
+
this.dom.removeEventListener('click', this.handleClick);
|
|
73
|
+
super.destroy();
|
|
74
|
+
};
|
|
56
75
|
}
|
|
57
76
|
handleAddFigure() {
|
|
58
77
|
const tr = this.view.state.tr;
|
package/dist/types/commands.d.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { FootnotesElementNode, ManuscriptEditorState, ManuscriptEditorView, ManuscriptMarkType, ManuscriptNode, ManuscriptNodeSelection, ManuscriptNodeType, ManuscriptResolvedPos, ManuscriptTextSelection, ManuscriptTransaction, SectionCategory } from '@manuscripts/transform';
|
|
17
|
-
import { Attrs,
|
|
17
|
+
import { Attrs, ResolvedPos } from 'prosemirror-model';
|
|
18
18
|
import { EditorState, Selection, Transaction } from 'prosemirror-state';
|
|
19
19
|
import { EditorView } from 'prosemirror-view';
|
|
20
20
|
import { FileAttachment } from './lib/files';
|
|
@@ -74,7 +74,6 @@ export type TableConfig = {
|
|
|
74
74
|
includeHeader: boolean;
|
|
75
75
|
};
|
|
76
76
|
export declare const createAndFillTableElement: (attrs?: Attrs, config?: TableConfig) => import("prosemirror-model").Node;
|
|
77
|
-
export declare const isCommentingAllowed: (type: NodeType) => boolean;
|
|
78
77
|
export declare const addNodeComment: (node: ManuscriptNode, state: ManuscriptEditorState, dispatch?: Dispatch) => boolean;
|
|
79
78
|
export declare const addInlineComment: (state: ManuscriptEditorState, dispatch?: Dispatch) => boolean;
|
|
80
79
|
export declare const addRows: (direction: "top" | "bottom") => (state: EditorState, dispatch?: (tr: Transaction) => void) => boolean;
|
|
@@ -7,6 +7,7 @@ export interface AffiliationsModalProps {
|
|
|
7
7
|
onSaveAffiliation: (affiliation: AffiliationAttrs) => void;
|
|
8
8
|
onDeleteAffiliation: (affiliation: AffiliationAttrs) => void;
|
|
9
9
|
onUpdateAuthors: (authors: ContributorAttrs[]) => void;
|
|
10
|
+
clearSelection: () => void;
|
|
10
11
|
addNewAffiliation?: boolean;
|
|
11
12
|
}
|
|
12
13
|
export declare const AffiliationsModal: React.FC<AffiliationsModalProps>;
|
package/dist/types/versions.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "3.6.
|
|
1
|
+
export declare const VERSION = "3.6.20";
|
|
2
2
|
export declare const MATHJAX_VERSION = "3.2.2";
|
|
@@ -39,6 +39,7 @@ export declare class AffiliationsView extends BlockView<Trackable<AffiliationNod
|
|
|
39
39
|
showContextMenu: (element: Element) => void;
|
|
40
40
|
actionGutterButtons: () => HTMLElement[];
|
|
41
41
|
selectNode: () => void;
|
|
42
|
+
clearSelection: () => void;
|
|
42
43
|
handleUpdateAuthors: (authors: ContributorAttrs[]) => void;
|
|
43
44
|
}
|
|
44
45
|
declare const _default: (props: import("../configs/ManuscriptsEditor").EditorProps, dispatch?: import("..").Dispatch) => import("../types").NodeViewCreator<AffiliationsView>;
|
|
@@ -20,10 +20,12 @@ export declare class PullquoteElementView extends BlockView<PullquoteElementNode
|
|
|
20
20
|
contextMenu: HTMLElement;
|
|
21
21
|
ignoreMutation: () => boolean;
|
|
22
22
|
stopEvent: () => boolean;
|
|
23
|
+
private handleClick;
|
|
23
24
|
createElement: () => void;
|
|
24
25
|
handleAddFigure(): void;
|
|
25
26
|
actionGutterButtons: () => HTMLElement[];
|
|
26
27
|
addFigureContextMenu: () => HTMLElement | undefined;
|
|
28
|
+
destroy: () => void;
|
|
27
29
|
}
|
|
28
30
|
declare const _default: (props: import("../configs/ManuscriptsEditor").EditorProps) => import("../types").NodeViewCreator<PullquoteElementView>;
|
|
29
31
|
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.6.
|
|
4
|
+
"version": "3.6.20",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|