@manuscripts/body-editor 3.16.2 → 3.17.0
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/context-menu.js +28 -11
- package/dist/cjs/lib/popper.js +15 -1
- package/dist/cjs/lib/position-menu.js +175 -100
- package/dist/cjs/plugins/detect-inconsistency/index.js +6 -4
- package/dist/cjs/plugins/persist.js +3 -0
- package/dist/cjs/versions.js +1 -1
- package/dist/cjs/views/box_element.js +23 -1
- package/dist/cjs/views/caption_title.js +1 -1
- package/dist/cjs/views/equation.js +2 -0
- package/dist/cjs/views/equation_editable.js +2 -0
- package/dist/cjs/views/image_element.js +7 -62
- package/dist/cjs/views/inline_equation.js +2 -0
- package/dist/cjs/views/inline_equation_editable.js +2 -0
- package/dist/cjs/views/pullquote_element.js +23 -1
- package/dist/cjs/views/table_element.js +23 -1
- package/dist/es/lib/context-menu.js +29 -12
- package/dist/es/lib/popper.js +15 -1
- package/dist/es/lib/position-menu.js +173 -91
- package/dist/es/plugins/detect-inconsistency/index.js +6 -4
- package/dist/es/plugins/persist.js +3 -0
- package/dist/es/versions.js +1 -1
- package/dist/es/views/box_element.js +23 -1
- package/dist/es/views/caption_title.js +1 -1
- package/dist/es/views/equation.js +2 -0
- package/dist/es/views/equation_editable.js +2 -0
- package/dist/es/views/image_element.js +7 -62
- package/dist/es/views/inline_equation.js +2 -0
- package/dist/es/views/inline_equation_editable.js +2 -0
- package/dist/es/views/pullquote_element.js +23 -1
- package/dist/es/views/table_element.js +23 -1
- package/dist/types/lib/popper.d.ts +4 -2
- package/dist/types/lib/position-menu.d.ts +36 -11
- package/dist/types/versions.d.ts +1 -1
- package/dist/types/views/box_element.d.ts +6 -0
- package/dist/types/views/image_element.d.ts +2 -9
- package/dist/types/views/pullquote_element.d.ts +6 -0
- package/dist/types/views/table_element.d.ts +6 -0
- package/package.json +1 -1
- package/src/lib/context-menu.ts +42 -21
- package/src/lib/popper.ts +18 -1
- package/src/lib/position-menu.ts +242 -137
- package/src/plugins/detect-inconsistency/index.ts +6 -4
- package/src/plugins/persist.ts +3 -0
- package/src/versions.ts +1 -1
- package/src/views/box_element.ts +34 -1
- package/src/views/caption_title.ts +1 -1
- package/src/views/equation.ts +5 -0
- package/src/views/equation_editable.ts +3 -0
- package/src/views/image_element.ts +12 -89
- package/src/views/inline_equation.ts +5 -0
- package/src/views/inline_equation_editable.ts +3 -0
- package/src/views/pullquote_element.ts +33 -1
- package/src/views/table_element.ts +34 -1
- package/styles/AdvancedEditor.css +5 -8
- package/styles/Editor.css +11 -6
|
@@ -20,6 +20,7 @@ import { renderMath } from '../lib/math'
|
|
|
20
20
|
import { Trackable } from '../types'
|
|
21
21
|
import { BaseNodeView } from './base_node_view'
|
|
22
22
|
import { createNodeView } from './creators'
|
|
23
|
+
import { handleEnterKey } from '../lib/navigation-utils'
|
|
23
24
|
|
|
24
25
|
export class InlineEquationView
|
|
25
26
|
extends BaseNodeView<Trackable<InlineEquationNode>>
|
|
@@ -28,6 +29,10 @@ export class InlineEquationView
|
|
|
28
29
|
public initialise() {
|
|
29
30
|
this.createDOM()
|
|
30
31
|
this.updateContents()
|
|
32
|
+
this.dom.addEventListener(
|
|
33
|
+
'keydown',
|
|
34
|
+
handleEnterKey(() => this.selectNode())
|
|
35
|
+
)
|
|
31
36
|
}
|
|
32
37
|
|
|
33
38
|
public updateContents() {
|
|
@@ -38,6 +38,9 @@ export class InlineEquationEditableView extends InlineEquationView {
|
|
|
38
38
|
Esc: () => {
|
|
39
39
|
this.props.popper.destroy()
|
|
40
40
|
this.view.focus()
|
|
41
|
+
const tabbableView =
|
|
42
|
+
this.dom.querySelector<HTMLElement>('[tabindex="0"]')
|
|
43
|
+
tabbableView?.focus()
|
|
41
44
|
},
|
|
42
45
|
},
|
|
43
46
|
})
|
|
@@ -24,10 +24,13 @@ import { setCommentSelection } from '../plugins/comments'
|
|
|
24
24
|
import BlockView from './block_view'
|
|
25
25
|
import { createNodeOrElementView } from './creators'
|
|
26
26
|
import ReactSubView from './ReactSubView'
|
|
27
|
+
import { HorizontalPositionMenu } from '../lib/position-menu'
|
|
27
28
|
|
|
28
29
|
export class PullquoteElementView extends BlockView<PullquoteElementNode> {
|
|
29
30
|
public elementType = 'aside'
|
|
30
31
|
contextMenu: HTMLElement
|
|
32
|
+
container: HTMLDivElement
|
|
33
|
+
private positionMenu: HorizontalPositionMenu
|
|
31
34
|
|
|
32
35
|
public ignoreMutation = () => true
|
|
33
36
|
public stopEvent = () => true
|
|
@@ -51,7 +54,10 @@ export class PullquoteElementView extends BlockView<PullquoteElementNode> {
|
|
|
51
54
|
this.contentDOM.className = 'block'
|
|
52
55
|
this.contentDOM.classList.add('pullquote')
|
|
53
56
|
|
|
54
|
-
this.
|
|
57
|
+
this.container = document.createElement('div')
|
|
58
|
+
this.container.classList.add('container')
|
|
59
|
+
this.container.appendChild(this.contentDOM)
|
|
60
|
+
this.dom.appendChild(this.container)
|
|
55
61
|
|
|
56
62
|
// Add click event listener to handle comment marker clicks
|
|
57
63
|
this.dom.addEventListener('click', this.handleClick)
|
|
@@ -96,11 +102,37 @@ export class PullquoteElementView extends BlockView<PullquoteElementNode> {
|
|
|
96
102
|
return undefined
|
|
97
103
|
}
|
|
98
104
|
|
|
105
|
+
public updateContents() {
|
|
106
|
+
super.updateContents()
|
|
107
|
+
this.addTools()
|
|
108
|
+
}
|
|
109
|
+
|
|
99
110
|
public destroy = () => {
|
|
100
111
|
// Clean up event listener
|
|
101
112
|
this.dom.removeEventListener('click', this.handleClick)
|
|
102
113
|
super.destroy()
|
|
103
114
|
}
|
|
115
|
+
|
|
116
|
+
protected addTools() {
|
|
117
|
+
this.addPositionMenu()
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
protected addPositionMenu() {
|
|
121
|
+
if (!this.positionMenu) {
|
|
122
|
+
this.positionMenu = new HorizontalPositionMenu(
|
|
123
|
+
this,
|
|
124
|
+
this.updateHorizontalPosition,
|
|
125
|
+
this.container
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
this.positionMenu.create()
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
private updateHorizontalPosition(horizontalPosition: string) {
|
|
132
|
+
const tr = this.view.state.tr
|
|
133
|
+
tr.setNodeAttribute(this.getPos(), 'type', horizontalPosition)
|
|
134
|
+
this.view.dispatch(tr)
|
|
135
|
+
}
|
|
104
136
|
}
|
|
105
137
|
|
|
106
138
|
export default createNodeOrElementView(PullquoteElementView, 'aside')
|
|
@@ -18,15 +18,48 @@ import { TableElementNode } from '@manuscripts/transform'
|
|
|
18
18
|
|
|
19
19
|
import BlockView from './block_view'
|
|
20
20
|
import { createNodeView } from './creators'
|
|
21
|
+
import { HorizontalPositionMenu } from '../lib/position-menu'
|
|
21
22
|
|
|
22
23
|
export class TableElementView extends BlockView<TableElementNode> {
|
|
23
24
|
public elementType = 'figure'
|
|
25
|
+
container: HTMLDivElement
|
|
26
|
+
private positionMenu: HorizontalPositionMenu
|
|
24
27
|
|
|
25
28
|
public createElement = () => {
|
|
26
29
|
this.contentDOM = document.createElement('figure')
|
|
27
30
|
this.contentDOM.classList.add('block')
|
|
28
31
|
this.contentDOM.setAttribute('id', this.node.attrs.id)
|
|
29
|
-
|
|
32
|
+
|
|
33
|
+
this.container = document.createElement('div')
|
|
34
|
+
this.container.classList.add('container')
|
|
35
|
+
this.container.appendChild(this.contentDOM)
|
|
36
|
+
this.dom.appendChild(this.container)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
public updateContents() {
|
|
40
|
+
super.updateContents()
|
|
41
|
+
this.addTools()
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
protected addTools() {
|
|
45
|
+
this.addPositionMenu()
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
protected addPositionMenu() {
|
|
49
|
+
if (!this.positionMenu) {
|
|
50
|
+
this.positionMenu = new HorizontalPositionMenu(
|
|
51
|
+
this,
|
|
52
|
+
this.updateHorizontalPosition,
|
|
53
|
+
this.container
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
this.positionMenu.create()
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
private updateHorizontalPosition(horizontalPosition: string) {
|
|
60
|
+
const tr = this.view.state.tr
|
|
61
|
+
tr.setNodeAttribute(this.getPos(), 'type', horizontalPosition)
|
|
62
|
+
this.view.dispatch(tr)
|
|
30
63
|
}
|
|
31
64
|
}
|
|
32
65
|
|
|
@@ -302,9 +302,7 @@
|
|
|
302
302
|
border-radius: var(--focus-outline-radius);
|
|
303
303
|
}
|
|
304
304
|
|
|
305
|
-
.ProseMirror .
|
|
306
|
-
.ProseMirror .block-image_element .position-menu,
|
|
307
|
-
ProseMirror .block-embed .position-menu {
|
|
305
|
+
.ProseMirror .position-menu {
|
|
308
306
|
position: absolute;
|
|
309
307
|
top: 8px;
|
|
310
308
|
right: 21px;
|
|
@@ -514,7 +512,7 @@ ProseMirror .block-embed .position-menu {
|
|
|
514
512
|
left: 100%;
|
|
515
513
|
}
|
|
516
514
|
.figure-block > div.comment-marker {
|
|
517
|
-
position:absolute;
|
|
515
|
+
position: absolute;
|
|
518
516
|
top: 1px;
|
|
519
517
|
left: unset;
|
|
520
518
|
right: -25px;
|
|
@@ -1614,7 +1612,6 @@ th:hover > .table-context-menu-button,
|
|
|
1614
1612
|
display: block;
|
|
1615
1613
|
}
|
|
1616
1614
|
|
|
1617
|
-
|
|
1618
1615
|
.ProseMirror .ext-link-editor-container .close-button:focus-visible,
|
|
1619
1616
|
.ProseMirror .ext-link-editor-container .remove-button:focus-visible,
|
|
1620
1617
|
.ProseMirror .ext-link-editor-container .icon-button:focus-visible {
|
|
@@ -1683,7 +1680,7 @@ th:hover > .table-context-menu-button,
|
|
|
1683
1680
|
cursor: pointer;
|
|
1684
1681
|
}
|
|
1685
1682
|
|
|
1686
|
-
.ProseMirror .accessibility_element_input:focus{
|
|
1683
|
+
.ProseMirror .accessibility_element_input:focus {
|
|
1687
1684
|
outline: none;
|
|
1688
1685
|
}
|
|
1689
1686
|
|
|
@@ -2125,8 +2122,8 @@ th:hover > .table-context-menu-button,
|
|
|
2125
2122
|
* If we later block editing these titles, this padding can go away.
|
|
2126
2123
|
*/
|
|
2127
2124
|
.ProseMirror .abstracts .block-section .block-section_title h1,
|
|
2128
|
-
.ProseMirror .abstracts .block-trans_abstract .block-section_title h1{
|
|
2129
|
-
padding-right:
|
|
2125
|
+
.ProseMirror .abstracts .block-trans_abstract .block-section_title h1 {
|
|
2126
|
+
padding-right: 150px;
|
|
2130
2127
|
}
|
|
2131
2128
|
|
|
2132
2129
|
.ProseMirror .add-trans-abstract {
|
package/styles/Editor.css
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
:root {
|
|
2
2
|
--body-side-margin: 65px;
|
|
3
|
-
--focus-outline-color: #
|
|
3
|
+
--focus-outline-color: #3dadff;
|
|
4
4
|
--focus-outline-offset: 2px;
|
|
5
5
|
--focus-outline-radius: 3px;
|
|
6
6
|
}
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
content: '— ';
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
.ProseMirror .block-container > .block.pullquote {
|
|
86
|
+
.ProseMirror .block-container > .container > .block.pullquote {
|
|
87
87
|
padding: 0 0 7px 48px;
|
|
88
88
|
}
|
|
89
89
|
.ProseMirror .pullquote {
|
|
@@ -291,7 +291,8 @@
|
|
|
291
291
|
cursor: pointer;
|
|
292
292
|
}
|
|
293
293
|
.ProseMirror .citation:focus-visible,
|
|
294
|
-
.ProseMirror .cross-reference:focus-visible
|
|
294
|
+
.ProseMirror .cross-reference:focus-visible,
|
|
295
|
+
.ProseMirror .MathJax:focus-visible {
|
|
295
296
|
outline: 4px solid var(--focus-outline-color);
|
|
296
297
|
outline-offset: var(--focus-outline-offset);
|
|
297
298
|
border-radius: var(--focus-outline-radius);
|
|
@@ -327,7 +328,7 @@
|
|
|
327
328
|
|
|
328
329
|
.ProseMirror .caption-title[element-label]::before,
|
|
329
330
|
.ProseMirror .caption-description > [element-label]::before {
|
|
330
|
-
content: attr(element-label)
|
|
331
|
+
content: attr(element-label) ':';
|
|
331
332
|
}
|
|
332
333
|
|
|
333
334
|
.ProseMirror .caption-title:not(:has(.placeholder-text)) {
|
|
@@ -338,11 +339,14 @@
|
|
|
338
339
|
display: block;
|
|
339
340
|
}
|
|
340
341
|
|
|
341
|
-
.ProseMirror .caption-description,
|
|
342
|
+
.ProseMirror .caption-description,
|
|
343
|
+
.ProseMirror .caption-description[element-label] > p:first-child {
|
|
342
344
|
display: inline;
|
|
343
345
|
}
|
|
344
346
|
|
|
345
|
-
.ProseMirror .caption-description,
|
|
347
|
+
.ProseMirror .caption-description,
|
|
348
|
+
.ProseMirror .caption-title,
|
|
349
|
+
.ProseMirror .element-label {
|
|
346
350
|
font-size: 14px;
|
|
347
351
|
outline: none;
|
|
348
352
|
margin: 0;
|
|
@@ -708,6 +712,7 @@
|
|
|
708
712
|
z-index: 2;
|
|
709
713
|
}
|
|
710
714
|
|
|
715
|
+
.ProseMirror .block-container > .container > .block,
|
|
711
716
|
.ProseMirror .block-container > .block {
|
|
712
717
|
margin: 0;
|
|
713
718
|
z-index: 1;
|