@manuscripts/body-editor 3.16.3 → 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/image_element.js +7 -62
- 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/image_element.js +7 -62
- 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/image_element.ts +12 -89
- 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 +9 -5
|
@@ -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 {
|
|
@@ -328,7 +328,7 @@
|
|
|
328
328
|
|
|
329
329
|
.ProseMirror .caption-title[element-label]::before,
|
|
330
330
|
.ProseMirror .caption-description > [element-label]::before {
|
|
331
|
-
content: attr(element-label)
|
|
331
|
+
content: attr(element-label) ':';
|
|
332
332
|
}
|
|
333
333
|
|
|
334
334
|
.ProseMirror .caption-title:not(:has(.placeholder-text)) {
|
|
@@ -339,11 +339,14 @@
|
|
|
339
339
|
display: block;
|
|
340
340
|
}
|
|
341
341
|
|
|
342
|
-
.ProseMirror .caption-description,
|
|
342
|
+
.ProseMirror .caption-description,
|
|
343
|
+
.ProseMirror .caption-description[element-label] > p:first-child {
|
|
343
344
|
display: inline;
|
|
344
345
|
}
|
|
345
346
|
|
|
346
|
-
.ProseMirror .caption-description,
|
|
347
|
+
.ProseMirror .caption-description,
|
|
348
|
+
.ProseMirror .caption-title,
|
|
349
|
+
.ProseMirror .element-label {
|
|
347
350
|
font-size: 14px;
|
|
348
351
|
outline: none;
|
|
349
352
|
margin: 0;
|
|
@@ -709,6 +712,7 @@
|
|
|
709
712
|
z-index: 2;
|
|
710
713
|
}
|
|
711
714
|
|
|
715
|
+
.ProseMirror .block-container > .container > .block,
|
|
712
716
|
.ProseMirror .block-container > .block {
|
|
713
717
|
margin: 0;
|
|
714
718
|
z-index: 1;
|