@manuscripts/body-editor 3.2.28 → 3.2.29
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/versions.js
CHANGED
|
@@ -51,7 +51,6 @@ class FigureElementView extends image_element_1.ImageElementView {
|
|
|
51
51
|
}
|
|
52
52
|
initialise() {
|
|
53
53
|
super.initialise();
|
|
54
|
-
requestAnimationFrame(() => this.updateButtonPosition());
|
|
55
54
|
this.setupResizeObserver();
|
|
56
55
|
}
|
|
57
56
|
setupResizeObserver() {
|
|
@@ -90,17 +89,45 @@ class FigureElementView extends image_element_1.ImageElementView {
|
|
|
90
89
|
const relativeTop = lastFigureRect.bottom - containerRect.top + 20;
|
|
91
90
|
this.addFigureBtn.style.top = `${relativeTop}px`;
|
|
92
91
|
}
|
|
92
|
+
updateAddButtonState() {
|
|
93
|
+
if (!this.addFigureBtn) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
let hasEmptyFigure = false;
|
|
97
|
+
this.node.forEach((node) => {
|
|
98
|
+
if (node.type === transform_1.schema.nodes.figure) {
|
|
99
|
+
const src = node.attrs.src || '';
|
|
100
|
+
if (src.trim().length === 0) {
|
|
101
|
+
hasEmptyFigure = true;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
if (hasEmptyFigure) {
|
|
106
|
+
this.addFigureBtn.classList.add('disabled');
|
|
107
|
+
this.addFigureBtn.disabled = true;
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
this.addFigureBtn.classList.remove('disabled');
|
|
111
|
+
this.addFigureBtn.disabled = false;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
93
114
|
update(node) {
|
|
94
115
|
const handledBySuper = super.update(node);
|
|
95
116
|
if (handledBySuper) {
|
|
96
117
|
this.setupResizeObserver();
|
|
97
|
-
requestAnimationFrame(() =>
|
|
118
|
+
requestAnimationFrame(() => {
|
|
119
|
+
this.updateButtonPosition();
|
|
120
|
+
this.updateAddButtonState();
|
|
121
|
+
});
|
|
98
122
|
}
|
|
99
123
|
return handledBySuper;
|
|
100
124
|
}
|
|
101
125
|
updateContents() {
|
|
102
126
|
super.updateContents();
|
|
103
|
-
requestAnimationFrame(() =>
|
|
127
|
+
requestAnimationFrame(() => {
|
|
128
|
+
this.updateButtonPosition();
|
|
129
|
+
this.updateAddButtonState();
|
|
130
|
+
});
|
|
104
131
|
}
|
|
105
132
|
destroy() {
|
|
106
133
|
if (this.resizeObserver) {
|
package/dist/es/versions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '3.2.
|
|
1
|
+
export const VERSION = '3.2.29';
|
|
2
2
|
export const MATHJAX_VERSION = '3.2.2';
|
|
@@ -48,7 +48,6 @@ export class FigureElementView extends ImageElementView {
|
|
|
48
48
|
}
|
|
49
49
|
initialise() {
|
|
50
50
|
super.initialise();
|
|
51
|
-
requestAnimationFrame(() => this.updateButtonPosition());
|
|
52
51
|
this.setupResizeObserver();
|
|
53
52
|
}
|
|
54
53
|
setupResizeObserver() {
|
|
@@ -87,17 +86,45 @@ export class FigureElementView extends ImageElementView {
|
|
|
87
86
|
const relativeTop = lastFigureRect.bottom - containerRect.top + 20;
|
|
88
87
|
this.addFigureBtn.style.top = `${relativeTop}px`;
|
|
89
88
|
}
|
|
89
|
+
updateAddButtonState() {
|
|
90
|
+
if (!this.addFigureBtn) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
let hasEmptyFigure = false;
|
|
94
|
+
this.node.forEach((node) => {
|
|
95
|
+
if (node.type === schema.nodes.figure) {
|
|
96
|
+
const src = node.attrs.src || '';
|
|
97
|
+
if (src.trim().length === 0) {
|
|
98
|
+
hasEmptyFigure = true;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
if (hasEmptyFigure) {
|
|
103
|
+
this.addFigureBtn.classList.add('disabled');
|
|
104
|
+
this.addFigureBtn.disabled = true;
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
this.addFigureBtn.classList.remove('disabled');
|
|
108
|
+
this.addFigureBtn.disabled = false;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
90
111
|
update(node) {
|
|
91
112
|
const handledBySuper = super.update(node);
|
|
92
113
|
if (handledBySuper) {
|
|
93
114
|
this.setupResizeObserver();
|
|
94
|
-
requestAnimationFrame(() =>
|
|
115
|
+
requestAnimationFrame(() => {
|
|
116
|
+
this.updateButtonPosition();
|
|
117
|
+
this.updateAddButtonState();
|
|
118
|
+
});
|
|
95
119
|
}
|
|
96
120
|
return handledBySuper;
|
|
97
121
|
}
|
|
98
122
|
updateContents() {
|
|
99
123
|
super.updateContents();
|
|
100
|
-
requestAnimationFrame(() =>
|
|
124
|
+
requestAnimationFrame(() => {
|
|
125
|
+
this.updateButtonPosition();
|
|
126
|
+
this.updateAddButtonState();
|
|
127
|
+
});
|
|
101
128
|
}
|
|
102
129
|
destroy() {
|
|
103
130
|
if (this.resizeObserver) {
|
package/dist/types/versions.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "3.2.
|
|
1
|
+
export declare const VERSION = "3.2.29";
|
|
2
2
|
export declare const MATHJAX_VERSION = "3.2.2";
|
|
@@ -24,6 +24,7 @@ export declare class FigureElementView extends ImageElementView {
|
|
|
24
24
|
private setupResizeObserver;
|
|
25
25
|
private addFigureElementButtons;
|
|
26
26
|
private updateButtonPosition;
|
|
27
|
+
private updateAddButtonState;
|
|
27
28
|
update(node: Node): boolean;
|
|
28
29
|
updateContents(): void;
|
|
29
30
|
private addFigure;
|
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.2.
|
|
4
|
+
"version": "3.2.29",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|