@manuscripts/body-editor 1.13.23 → 1.13.24
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/views/citation.js +1 -0
- package/dist/cjs/views/citation_editable.js +15 -5
- package/dist/es/views/citation.js +1 -0
- package/dist/es/views/citation_editable.js +15 -5
- package/dist/types/views/citation.d.ts +1 -0
- package/dist/types/views/citation_editable.d.ts +3 -0
- package/package.json +1 -1
|
@@ -40,6 +40,7 @@ const createBibliographySection = (node) => transform_1.schema.nodes.bibliograph
|
|
|
40
40
|
class CitationEditableView extends citation_1.CitationView {
|
|
41
41
|
constructor() {
|
|
42
42
|
super(...arguments);
|
|
43
|
+
this.can = this.props.getCapabilities();
|
|
43
44
|
this.stopEvent = (event) => {
|
|
44
45
|
var _a;
|
|
45
46
|
const element = event.target;
|
|
@@ -47,17 +48,26 @@ class CitationEditableView extends citation_1.CitationView {
|
|
|
47
48
|
element.classList.contains('comment-icon') ||
|
|
48
49
|
((_a = element.parentElement) === null || _a === void 0 ? void 0 : _a.classList.contains('comment-icon')));
|
|
49
50
|
};
|
|
51
|
+
this.eventHandlers = () => {
|
|
52
|
+
this.dom.addEventListener('mouseup', this.handleClick);
|
|
53
|
+
};
|
|
54
|
+
this.handleClick = (event) => {
|
|
55
|
+
if (this.can.seeReferencesButtons &&
|
|
56
|
+
!(0, track_changes_utils_1.isDeleted)(this.node) &&
|
|
57
|
+
event.button === 0) {
|
|
58
|
+
const attrs = (0, track_changes_utils_1.getActualAttrs)(this.node);
|
|
59
|
+
if (attrs.rids.length) {
|
|
60
|
+
this.showContextMenu();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
50
64
|
this.selectNode = () => {
|
|
51
65
|
this.dom.classList.add('ProseMirror-selectednode');
|
|
52
|
-
|
|
53
|
-
if (can.seeReferencesButtons && !(0, track_changes_utils_1.isDeleted)(this.node)) {
|
|
66
|
+
if (this.can.seeReferencesButtons && !(0, track_changes_utils_1.isDeleted)(this.node)) {
|
|
54
67
|
const attrs = (0, track_changes_utils_1.getActualAttrs)(this.node);
|
|
55
68
|
if (!attrs.rids.length) {
|
|
56
69
|
this.showPopper();
|
|
57
70
|
}
|
|
58
|
-
else {
|
|
59
|
-
this.showContextMenu();
|
|
60
|
-
}
|
|
61
71
|
}
|
|
62
72
|
};
|
|
63
73
|
this.destroy = () => {
|
|
@@ -34,6 +34,7 @@ const createBibliographySection = (node) => schema.nodes.bibliography_section.cr
|
|
|
34
34
|
export class CitationEditableView extends CitationView {
|
|
35
35
|
constructor() {
|
|
36
36
|
super(...arguments);
|
|
37
|
+
this.can = this.props.getCapabilities();
|
|
37
38
|
this.stopEvent = (event) => {
|
|
38
39
|
var _a;
|
|
39
40
|
const element = event.target;
|
|
@@ -41,17 +42,26 @@ export class CitationEditableView extends CitationView {
|
|
|
41
42
|
element.classList.contains('comment-icon') ||
|
|
42
43
|
((_a = element.parentElement) === null || _a === void 0 ? void 0 : _a.classList.contains('comment-icon')));
|
|
43
44
|
};
|
|
45
|
+
this.eventHandlers = () => {
|
|
46
|
+
this.dom.addEventListener('mouseup', this.handleClick);
|
|
47
|
+
};
|
|
48
|
+
this.handleClick = (event) => {
|
|
49
|
+
if (this.can.seeReferencesButtons &&
|
|
50
|
+
!isDeleted(this.node) &&
|
|
51
|
+
event.button === 0) {
|
|
52
|
+
const attrs = getActualAttrs(this.node);
|
|
53
|
+
if (attrs.rids.length) {
|
|
54
|
+
this.showContextMenu();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
44
58
|
this.selectNode = () => {
|
|
45
59
|
this.dom.classList.add('ProseMirror-selectednode');
|
|
46
|
-
|
|
47
|
-
if (can.seeReferencesButtons && !isDeleted(this.node)) {
|
|
60
|
+
if (this.can.seeReferencesButtons && !isDeleted(this.node)) {
|
|
48
61
|
const attrs = getActualAttrs(this.node);
|
|
49
62
|
if (!attrs.rids.length) {
|
|
50
63
|
this.showPopper();
|
|
51
64
|
}
|
|
52
|
-
else {
|
|
53
|
-
this.showContextMenu();
|
|
54
|
-
}
|
|
55
65
|
}
|
|
56
66
|
};
|
|
57
67
|
this.destroy = () => {
|
|
@@ -19,6 +19,7 @@ export declare class CitationView<PropsType extends BaseNodeProps> extends BaseN
|
|
|
19
19
|
ignoreMutation: () => boolean;
|
|
20
20
|
initialise: () => this;
|
|
21
21
|
updateContents: () => void;
|
|
22
|
+
eventHandlers: () => void;
|
|
22
23
|
}
|
|
23
24
|
declare const _default: (props: BaseNodeProps, dispatch?: import("..").Dispatch | undefined) => import("../types").NodeViewCreator<CitationView<any>>;
|
|
24
25
|
export default _default;
|
|
@@ -18,7 +18,10 @@ import { EditableBlockProps } from './editable_block';
|
|
|
18
18
|
export declare class CitationEditableView extends CitationView<EditableBlockProps> {
|
|
19
19
|
private editor;
|
|
20
20
|
private contextMenu;
|
|
21
|
+
private can;
|
|
21
22
|
stopEvent: (event: Event) => boolean;
|
|
23
|
+
eventHandlers: () => void;
|
|
24
|
+
handleClick: (event: MouseEvent) => void;
|
|
22
25
|
selectNode: () => void;
|
|
23
26
|
destroy: () => void;
|
|
24
27
|
showContextMenu: () => void;
|
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.
|
|
4
|
+
"version": "1.13.24",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|