@manuscripts/body-editor 2.7.6 → 2.7.7
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/lib/helpers.js +0 -5
- package/dist/cjs/versions.js +1 -1
- package/dist/cjs/views/footnote.js +1 -5
- package/dist/cjs/views/inline_footnote.js +5 -9
- package/dist/es/lib/helpers.js +1 -6
- package/dist/es/versions.js +1 -1
- package/dist/es/views/footnote.js +2 -6
- package/dist/es/views/inline_footnote.js +5 -9
- package/dist/types/versions.d.ts +1 -1
- package/dist/types/views/inline_footnote.d.ts +1 -1
- package/package.json +1 -1
- package/styles/AdvancedEditor.css +1 -1
- package/styles/Editor.css +10 -28
package/dist/cjs/lib/helpers.js
CHANGED
|
@@ -75,11 +75,6 @@ const handleScrollToSelectedTarget = (view) => {
|
|
|
75
75
|
behavior: 'smooth',
|
|
76
76
|
block: blockAlignment,
|
|
77
77
|
});
|
|
78
|
-
if ((0, transform_1.isInlineFootnoteNode)(node)) {
|
|
79
|
-
const fn = target;
|
|
80
|
-
fn.classList.add('highlight-footnote-marker');
|
|
81
|
-
setTimeout(() => fn.classList.remove('highlight-footnote-marker'), 3000);
|
|
82
|
-
}
|
|
83
78
|
return true;
|
|
84
79
|
};
|
|
85
80
|
exports.handleScrollToSelectedTarget = handleScrollToSelectedTarget;
|
package/dist/cjs/versions.js
CHANGED
|
@@ -115,7 +115,6 @@ class FootnoteView extends base_node_view_1.BaseNodeView {
|
|
|
115
115
|
super.updateContents();
|
|
116
116
|
const id = this.node.attrs.id;
|
|
117
117
|
const fn = (0, footnotes_1.getFootnotesElementState)(this.view.state, id);
|
|
118
|
-
const pos = this.getPos();
|
|
119
118
|
if (!fn) {
|
|
120
119
|
return;
|
|
121
120
|
}
|
|
@@ -128,11 +127,8 @@ class FootnoteView extends base_node_view_1.BaseNodeView {
|
|
|
128
127
|
marker.classList.add('footnote-marker');
|
|
129
128
|
marker.innerText = fn.labels.get(id) || '';
|
|
130
129
|
}
|
|
131
|
-
const container = (0, footnotes_1.findFootnotesContainerNode)(this.view.state.doc, pos);
|
|
132
130
|
let scrollBtn = null;
|
|
133
|
-
|
|
134
|
-
scrollBtn = this.createButton('scroll-icon', icons_1.scrollIcon, this.handleMarkerClick);
|
|
135
|
-
}
|
|
131
|
+
scrollBtn = this.createButton('scroll-icon', icons_1.scrollIcon, this.handleMarkerClick);
|
|
136
132
|
const deleteBtn = this.createButton('delete-icon', icons_1.deleteIcon, this.handleDeleteClick);
|
|
137
133
|
this.dom.innerHTML = '';
|
|
138
134
|
scrollBtn && this.dom.appendChild(scrollBtn);
|
|
@@ -20,7 +20,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.InlineFootnoteView = void 0;
|
|
22
22
|
const style_guide_1 = require("@manuscripts/style-guide");
|
|
23
|
-
const transform_1 = require("@manuscripts/transform");
|
|
24
23
|
const prosemirror_state_1 = require("prosemirror-state");
|
|
25
24
|
const FootnotesSelector_1 = require("../components/views/FootnotesSelector");
|
|
26
25
|
const footnotes_1 = require("../lib/footnotes");
|
|
@@ -65,12 +64,7 @@ class InlineFootnoteView extends base_node_view_1.BaseNodeView {
|
|
|
65
64
|
if ((0, track_changes_utils_1.isDeleted)(this.node)) {
|
|
66
65
|
return;
|
|
67
66
|
}
|
|
68
|
-
|
|
69
|
-
this.showFootnotesSelector();
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
this.showContextMenu();
|
|
73
|
-
}
|
|
67
|
+
this.showContextMenu();
|
|
74
68
|
};
|
|
75
69
|
this.scrollToReferencedFootnote = () => {
|
|
76
70
|
const state = this.view.state;
|
|
@@ -120,10 +114,9 @@ class InlineFootnoteView extends base_node_view_1.BaseNodeView {
|
|
|
120
114
|
this.dom.classList.add('footnote-marker');
|
|
121
115
|
this.dom.addEventListener('click', this.handleClick);
|
|
122
116
|
this.updateContents();
|
|
123
|
-
const container = (0, footnotes_1.findFootnotesContainerNode)(this.view.state.doc, this.getPos());
|
|
124
|
-
this.isTableFootnote = (0, transform_1.isTableElementNode)(container.node);
|
|
125
117
|
};
|
|
126
118
|
this.selectNode = () => {
|
|
119
|
+
this.dom.classList.add('footnote-marker-selected');
|
|
127
120
|
if (!this.node.attrs.rids.length) {
|
|
128
121
|
this.showFootnotesSelector();
|
|
129
122
|
}
|
|
@@ -195,6 +188,9 @@ class InlineFootnoteView extends base_node_view_1.BaseNodeView {
|
|
|
195
188
|
}
|
|
196
189
|
this.dom.innerText = fn.labels.get(this.node.attrs.id) || '';
|
|
197
190
|
}
|
|
191
|
+
deselectNode() {
|
|
192
|
+
this.dom.classList.remove('footnote-marker-selected');
|
|
193
|
+
}
|
|
198
194
|
}
|
|
199
195
|
exports.InlineFootnoteView = InlineFootnoteView;
|
|
200
196
|
exports.default = (0, creators_1.createNodeView)(InlineFootnoteView);
|
package/dist/es/lib/helpers.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import {
|
|
16
|
+
import { schema, } from '@manuscripts/transform';
|
|
17
17
|
export const isNodeOfType = (...type) => (node) => {
|
|
18
18
|
const [head, ...tail] = type;
|
|
19
19
|
if (node.type === node.type.schema.nodes[head]) {
|
|
@@ -69,11 +69,6 @@ export const handleScrollToSelectedTarget = (view) => {
|
|
|
69
69
|
behavior: 'smooth',
|
|
70
70
|
block: blockAlignment,
|
|
71
71
|
});
|
|
72
|
-
if (isInlineFootnoteNode(node)) {
|
|
73
|
-
const fn = target;
|
|
74
|
-
fn.classList.add('highlight-footnote-marker');
|
|
75
|
-
setTimeout(() => fn.classList.remove('highlight-footnote-marker'), 3000);
|
|
76
|
-
}
|
|
77
72
|
return true;
|
|
78
73
|
};
|
|
79
74
|
export const findWordBoundaries = (state, position) => {
|
package/dist/es/versions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '2.7.
|
|
1
|
+
export const VERSION = '2.7.7';
|
|
2
2
|
export const MATHJAX_VERSION = '3.2.2';
|
|
@@ -19,7 +19,7 @@ import { NodeSelection } from 'prosemirror-state';
|
|
|
19
19
|
import { findParentNodeOfTypeClosestToPos } from 'prosemirror-utils';
|
|
20
20
|
import { DeleteFootnoteDialog, } from '../components/views/DeleteFootnoteDialog';
|
|
21
21
|
import { alertIcon, deleteIcon, scrollIcon } from '../icons';
|
|
22
|
-
import {
|
|
22
|
+
import { getFootnotesElementState } from '../lib/footnotes';
|
|
23
23
|
import { isDeleted } from '../lib/track-changes-utils';
|
|
24
24
|
import { BaseNodeView } from './base_node_view';
|
|
25
25
|
import { createNodeView } from './creators';
|
|
@@ -109,7 +109,6 @@ export class FootnoteView extends BaseNodeView {
|
|
|
109
109
|
super.updateContents();
|
|
110
110
|
const id = this.node.attrs.id;
|
|
111
111
|
const fn = getFootnotesElementState(this.view.state, id);
|
|
112
|
-
const pos = this.getPos();
|
|
113
112
|
if (!fn) {
|
|
114
113
|
return;
|
|
115
114
|
}
|
|
@@ -122,11 +121,8 @@ export class FootnoteView extends BaseNodeView {
|
|
|
122
121
|
marker.classList.add('footnote-marker');
|
|
123
122
|
marker.innerText = fn.labels.get(id) || '';
|
|
124
123
|
}
|
|
125
|
-
const container = findFootnotesContainerNode(this.view.state.doc, pos);
|
|
126
124
|
let scrollBtn = null;
|
|
127
|
-
|
|
128
|
-
scrollBtn = this.createButton('scroll-icon', scrollIcon, this.handleMarkerClick);
|
|
129
|
-
}
|
|
125
|
+
scrollBtn = this.createButton('scroll-icon', scrollIcon, this.handleMarkerClick);
|
|
130
126
|
const deleteBtn = this.createButton('delete-icon', deleteIcon, this.handleDeleteClick);
|
|
131
127
|
this.dom.innerHTML = '';
|
|
132
128
|
scrollBtn && this.dom.appendChild(scrollBtn);
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { ContextMenu } from '@manuscripts/style-guide';
|
|
17
|
-
import { isTableElementNode, } from '@manuscripts/transform';
|
|
18
17
|
import { NodeSelection, TextSelection } from 'prosemirror-state';
|
|
19
18
|
import { FootnotesSelector, } from '../components/views/FootnotesSelector';
|
|
20
19
|
import { createFootnote, findFootnotesContainerNode, getFootnotesElementState, } from '../lib/footnotes';
|
|
@@ -59,12 +58,7 @@ export class InlineFootnoteView extends BaseNodeView {
|
|
|
59
58
|
if (isDeleted(this.node)) {
|
|
60
59
|
return;
|
|
61
60
|
}
|
|
62
|
-
|
|
63
|
-
this.showFootnotesSelector();
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
this.showContextMenu();
|
|
67
|
-
}
|
|
61
|
+
this.showContextMenu();
|
|
68
62
|
};
|
|
69
63
|
this.scrollToReferencedFootnote = () => {
|
|
70
64
|
const state = this.view.state;
|
|
@@ -114,10 +108,9 @@ export class InlineFootnoteView extends BaseNodeView {
|
|
|
114
108
|
this.dom.classList.add('footnote-marker');
|
|
115
109
|
this.dom.addEventListener('click', this.handleClick);
|
|
116
110
|
this.updateContents();
|
|
117
|
-
const container = findFootnotesContainerNode(this.view.state.doc, this.getPos());
|
|
118
|
-
this.isTableFootnote = isTableElementNode(container.node);
|
|
119
111
|
};
|
|
120
112
|
this.selectNode = () => {
|
|
113
|
+
this.dom.classList.add('footnote-marker-selected');
|
|
121
114
|
if (!this.node.attrs.rids.length) {
|
|
122
115
|
this.showFootnotesSelector();
|
|
123
116
|
}
|
|
@@ -189,5 +182,8 @@ export class InlineFootnoteView extends BaseNodeView {
|
|
|
189
182
|
}
|
|
190
183
|
this.dom.innerText = fn.labels.get(this.node.attrs.id) || '';
|
|
191
184
|
}
|
|
185
|
+
deselectNode() {
|
|
186
|
+
this.dom.classList.remove('footnote-marker-selected');
|
|
187
|
+
}
|
|
192
188
|
}
|
|
193
189
|
export default createNodeView(InlineFootnoteView);
|
package/dist/types/versions.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "2.7.
|
|
1
|
+
export declare const VERSION = "2.7.7";
|
|
2
2
|
export declare const MATHJAX_VERSION = "3.2.2";
|
|
@@ -18,7 +18,6 @@ import { Trackable } from '../types';
|
|
|
18
18
|
import { BaseNodeView } from './base_node_view';
|
|
19
19
|
export declare class InlineFootnoteView extends BaseNodeView<Trackable<InlineFootnoteNode>> implements ManuscriptNodeView {
|
|
20
20
|
protected popperContainer: HTMLDivElement;
|
|
21
|
-
isTableFootnote: boolean;
|
|
22
21
|
showContextMenu: () => void;
|
|
23
22
|
handleClick: () => void;
|
|
24
23
|
scrollToReferencedFootnote: () => void;
|
|
@@ -26,6 +25,7 @@ export declare class InlineFootnoteView extends BaseNodeView<Trackable<InlineFoo
|
|
|
26
25
|
updateContents(): void;
|
|
27
26
|
initialise: () => void;
|
|
28
27
|
selectNode: () => void;
|
|
28
|
+
deselectNode(): void;
|
|
29
29
|
ignoreMutation: () => boolean;
|
|
30
30
|
createDOM: () => HTMLSpanElement;
|
|
31
31
|
destroy: () => 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": "2.7.
|
|
4
|
+
"version": "2.7.7",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -559,7 +559,7 @@ span.comment-marker {
|
|
|
559
559
|
|
|
560
560
|
.selected-suggestion:not(.block-container):not(.graphical-abstract):not(
|
|
561
561
|
.keywords
|
|
562
|
-
):not(figure):not(figure .equation) {
|
|
562
|
+
):not(figure):not(figure .equation), .footnote-marker-selected {
|
|
563
563
|
border-width: 2px 0 2px 0 !important;
|
|
564
564
|
border-style: solid !important;
|
|
565
565
|
}
|
package/styles/Editor.css
CHANGED
|
@@ -982,14 +982,15 @@
|
|
|
982
982
|
}
|
|
983
983
|
|
|
984
984
|
.ProseMirror .footnote-marker {
|
|
985
|
-
|
|
985
|
+
margin: 0 5px;
|
|
986
986
|
font-size: 75%;
|
|
987
|
-
margin-bottom: 10px;
|
|
988
987
|
color: #0d79d0;
|
|
989
|
-
|
|
988
|
+
cursor: pointer;
|
|
990
989
|
position: relative;
|
|
990
|
+
margin-bottom: 10px;
|
|
991
|
+
vertical-align: super;
|
|
991
992
|
display: inline-block;
|
|
992
|
-
|
|
993
|
+
border-color: transparent;
|
|
993
994
|
}
|
|
994
995
|
|
|
995
996
|
.ProseMirror .footnote .footnote-marker {
|
|
@@ -997,30 +998,6 @@
|
|
|
997
998
|
cursor: default;
|
|
998
999
|
margin-right: 2px;
|
|
999
1000
|
}
|
|
1000
|
-
.ProseMirror .block-container:not(.block-footnotes_element) .footnote-marker::before, .ProseMirror .block-container:not(.block-footnotes_element) .footnote-marker::after {
|
|
1001
|
-
content: '';
|
|
1002
|
-
opacity: 0;
|
|
1003
|
-
z-index: -1;
|
|
1004
|
-
height: 30px;
|
|
1005
|
-
margin: 0 12px;
|
|
1006
|
-
position: absolute;
|
|
1007
|
-
background: #E2E2E2;
|
|
1008
|
-
pointer-events: none;
|
|
1009
|
-
}
|
|
1010
|
-
.ProseMirror .block-container:not(.block-footnotes_element) .footnote-marker::before {
|
|
1011
|
-
left: 0;
|
|
1012
|
-
}
|
|
1013
|
-
.ProseMirror .block-container:not(.block-footnotes_element) .footnote-marker::after {
|
|
1014
|
-
right:-100px;
|
|
1015
|
-
}
|
|
1016
|
-
.ProseMirror .footnote-marker.highlight-footnote-marker::before, .ProseMirror .footnote-marker.highlight-footnote-marker::after {
|
|
1017
|
-
opacity: 1 !important;
|
|
1018
|
-
width: 45vw;
|
|
1019
|
-
transition: opacity 0.3s ease-in-out;
|
|
1020
|
-
}
|
|
1021
|
-
.ProseMirror .block-container > .block:has(.highlight-footnote-marker.footnote-marker) {
|
|
1022
|
-
overflow-x: hidden;
|
|
1023
|
-
}
|
|
1024
1001
|
.ProseMirror .footnote {
|
|
1025
1002
|
display: flex;
|
|
1026
1003
|
align-items: center;
|
|
@@ -1051,6 +1028,11 @@
|
|
|
1051
1028
|
background-color: #f2fbfc;
|
|
1052
1029
|
border: 1px solid #bce7f6;
|
|
1053
1030
|
}
|
|
1031
|
+
.ProseMirror .footnote-marker-selected:not(.selected-suggestion) {
|
|
1032
|
+
text-decoration: underline;
|
|
1033
|
+
background-color: #f2fbfc;
|
|
1034
|
+
border-color: #0d79d0;
|
|
1035
|
+
}
|
|
1054
1036
|
.ProseMirror .table-footer p {
|
|
1055
1037
|
margin-bottom: 0;
|
|
1056
1038
|
margin-top: 0;
|