@manuscripts/body-editor 1.7.14 → 1.7.15-LEAN-3405-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/plugins/footnotes/index.js +0 -3
- package/dist/cjs/views/footnotes_element.js +21 -1
- package/dist/cjs/views/footnotes_element_editable.js +1 -1
- package/dist/cjs/views/inline_footnote.js +5 -0
- package/dist/es/plugins/footnotes/index.js +0 -3
- package/dist/es/views/footnotes_element.js +22 -2
- package/dist/es/views/footnotes_element_editable.js +2 -2
- package/dist/es/views/inline_footnote.js +5 -0
- package/dist/types/views/footnotes_element.d.ts +3 -1
- package/dist/types/views/footnotes_element_editable.d.ts +1 -1
- package/package.json +2 -2
- package/styles/Editor.css +12 -2
|
@@ -132,9 +132,6 @@ exports.default = () => {
|
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
if (node.type === transform_1.schema.nodes.footnotes_element) {
|
|
135
|
-
decorations.push(prosemirror_view_1.Decoration.node(pos, pos + node.nodeSize, {
|
|
136
|
-
class: 'footnote-element',
|
|
137
|
-
}));
|
|
138
135
|
if ((parent === null || parent === void 0 ? void 0 : parent.type) === transform_1.schema.nodes.table_element_footer) {
|
|
139
136
|
tableInlineFootnoteIds = (0, footnotes_utils_1.findTableInlineFootnoteIds)(state.doc.resolve(pos));
|
|
140
137
|
}
|
|
@@ -19,22 +19,42 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
19
19
|
};
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.FootnotesElementView = void 0;
|
|
22
|
+
const transform_1 = require("@manuscripts/transform");
|
|
23
|
+
const prosemirror_utils_1 = require("prosemirror-utils");
|
|
24
|
+
const track_changes_utils_1 = require("../lib/track-changes-utils");
|
|
22
25
|
const block_view_1 = __importDefault(require("./block_view"));
|
|
23
26
|
const creators_1 = require("./creators");
|
|
24
27
|
class FootnotesElementView extends block_view_1.default {
|
|
25
28
|
constructor() {
|
|
26
29
|
super(...arguments);
|
|
27
30
|
this.elementType = 'div';
|
|
31
|
+
this.updateContents = () => {
|
|
32
|
+
const $pos = this.view.state.doc.resolve(this.getPos());
|
|
33
|
+
const inTableFooter = !!(0, prosemirror_utils_1.findParentNodeOfTypeClosestToPos)($pos, transform_1.schema.nodes.table_element_footer);
|
|
34
|
+
if (inTableFooter) {
|
|
35
|
+
this.setTCClasses();
|
|
36
|
+
}
|
|
37
|
+
};
|
|
28
38
|
this.checkEditability = () => {
|
|
29
39
|
var _a, _b;
|
|
30
40
|
const editable = this.node.childCount ? 'true' : 'false';
|
|
31
41
|
(_a = this.contentDOM) === null || _a === void 0 ? void 0 : _a.setAttribute('contenteditable', editable);
|
|
32
42
|
(_b = this.dom) === null || _b === void 0 ? void 0 : _b.setAttribute('contenteditable', editable);
|
|
33
43
|
};
|
|
44
|
+
this.setTCClasses = () => {
|
|
45
|
+
const classNames = ['footnote-element'];
|
|
46
|
+
const dataTracked = this.node.attrs.dataTracked;
|
|
47
|
+
if (dataTracked === null || dataTracked === void 0 ? void 0 : dataTracked.length) {
|
|
48
|
+
const lastChange = dataTracked[dataTracked.length - 1];
|
|
49
|
+
const changeClasses = (0, track_changes_utils_1.getChangeClasses)([lastChange]);
|
|
50
|
+
classNames.push(...changeClasses);
|
|
51
|
+
}
|
|
52
|
+
this.dom.className = classNames.join(' ');
|
|
53
|
+
};
|
|
34
54
|
}
|
|
35
55
|
onUpdateContent() {
|
|
36
56
|
this.checkEditability();
|
|
37
57
|
}
|
|
38
58
|
}
|
|
39
59
|
exports.FootnotesElementView = FootnotesElementView;
|
|
40
|
-
exports.default = (0, creators_1.
|
|
60
|
+
exports.default = (0, creators_1.createNodeView)(FootnotesElementView);
|
|
@@ -18,4 +18,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
18
18
|
const creators_1 = require("./creators");
|
|
19
19
|
const editable_block_1 = require("./editable_block");
|
|
20
20
|
const footnotes_element_1 = require("./footnotes_element");
|
|
21
|
-
exports.default = (0, creators_1.
|
|
21
|
+
exports.default = (0, creators_1.createNodeView)((0, editable_block_1.EditableBlock)(footnotes_element_1.FootnotesElementView));
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.InlineFootnoteView = void 0;
|
|
19
|
+
const track_changes_utils_1 = require("../lib/track-changes-utils");
|
|
19
20
|
const base_node_view_1 = require("./base_node_view");
|
|
20
21
|
const creators_1 = require("./creators");
|
|
21
22
|
class InlineFootnoteView extends base_node_view_1.BaseNodeView {
|
|
@@ -26,6 +27,10 @@ class InlineFootnoteView extends base_node_view_1.BaseNodeView {
|
|
|
26
27
|
};
|
|
27
28
|
this.updateContents = () => {
|
|
28
29
|
this.setDomAttrs(this.node, this.dom);
|
|
30
|
+
this.dom.className = [
|
|
31
|
+
'footnote',
|
|
32
|
+
...(0, track_changes_utils_1.getChangeClasses)(this.node.attrs.dataTracked),
|
|
33
|
+
].join(' ');
|
|
29
34
|
};
|
|
30
35
|
this.initialise = () => {
|
|
31
36
|
this.dom = this.createDOM();
|
|
@@ -127,9 +127,6 @@ export default () => {
|
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
if (node.type === schema.nodes.footnotes_element) {
|
|
130
|
-
decorations.push(Decoration.node(pos, pos + node.nodeSize, {
|
|
131
|
-
class: 'footnote-element',
|
|
132
|
-
}));
|
|
133
130
|
if ((parent === null || parent === void 0 ? void 0 : parent.type) === schema.nodes.table_element_footer) {
|
|
134
131
|
tableInlineFootnoteIds = findTableInlineFootnoteIds(state.doc.resolve(pos));
|
|
135
132
|
}
|
|
@@ -13,21 +13,41 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import { schema } from '@manuscripts/transform';
|
|
17
|
+
import { findParentNodeOfTypeClosestToPos } from 'prosemirror-utils';
|
|
18
|
+
import { getChangeClasses } from '../lib/track-changes-utils';
|
|
16
19
|
import BlockView from './block_view';
|
|
17
|
-
import {
|
|
20
|
+
import { createNodeView } from './creators';
|
|
18
21
|
export class FootnotesElementView extends BlockView {
|
|
19
22
|
constructor() {
|
|
20
23
|
super(...arguments);
|
|
21
24
|
this.elementType = 'div';
|
|
25
|
+
this.updateContents = () => {
|
|
26
|
+
const $pos = this.view.state.doc.resolve(this.getPos());
|
|
27
|
+
const inTableFooter = !!findParentNodeOfTypeClosestToPos($pos, schema.nodes.table_element_footer);
|
|
28
|
+
if (inTableFooter) {
|
|
29
|
+
this.setTCClasses();
|
|
30
|
+
}
|
|
31
|
+
};
|
|
22
32
|
this.checkEditability = () => {
|
|
23
33
|
var _a, _b;
|
|
24
34
|
const editable = this.node.childCount ? 'true' : 'false';
|
|
25
35
|
(_a = this.contentDOM) === null || _a === void 0 ? void 0 : _a.setAttribute('contenteditable', editable);
|
|
26
36
|
(_b = this.dom) === null || _b === void 0 ? void 0 : _b.setAttribute('contenteditable', editable);
|
|
27
37
|
};
|
|
38
|
+
this.setTCClasses = () => {
|
|
39
|
+
const classNames = ['footnote-element'];
|
|
40
|
+
const dataTracked = this.node.attrs.dataTracked;
|
|
41
|
+
if (dataTracked === null || dataTracked === void 0 ? void 0 : dataTracked.length) {
|
|
42
|
+
const lastChange = dataTracked[dataTracked.length - 1];
|
|
43
|
+
const changeClasses = getChangeClasses([lastChange]);
|
|
44
|
+
classNames.push(...changeClasses);
|
|
45
|
+
}
|
|
46
|
+
this.dom.className = classNames.join(' ');
|
|
47
|
+
};
|
|
28
48
|
}
|
|
29
49
|
onUpdateContent() {
|
|
30
50
|
this.checkEditability();
|
|
31
51
|
}
|
|
32
52
|
}
|
|
33
|
-
export default
|
|
53
|
+
export default createNodeView(FootnotesElementView);
|
|
@@ -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 { createNodeView } from './creators';
|
|
17
17
|
import { EditableBlock } from './editable_block';
|
|
18
18
|
import { FootnotesElementView } from './footnotes_element';
|
|
19
|
-
export default
|
|
19
|
+
export default createNodeView(EditableBlock(FootnotesElementView));
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import { getChangeClasses } from '../lib/track-changes-utils';
|
|
16
17
|
import { BaseNodeView } from './base_node_view';
|
|
17
18
|
import { createNodeView } from './creators';
|
|
18
19
|
export class InlineFootnoteView extends BaseNodeView {
|
|
@@ -23,6 +24,10 @@ export class InlineFootnoteView extends BaseNodeView {
|
|
|
23
24
|
};
|
|
24
25
|
this.updateContents = () => {
|
|
25
26
|
this.setDomAttrs(this.node, this.dom);
|
|
27
|
+
this.dom.className = [
|
|
28
|
+
'footnote',
|
|
29
|
+
...getChangeClasses(this.node.attrs.dataTracked),
|
|
30
|
+
].join(' ');
|
|
26
31
|
};
|
|
27
32
|
this.initialise = () => {
|
|
28
33
|
this.dom = this.createDOM();
|
|
@@ -17,8 +17,10 @@ import { BaseNodeProps } from './base_node_view';
|
|
|
17
17
|
import BlockView from './block_view';
|
|
18
18
|
export declare class FootnotesElementView<PropsType extends BaseNodeProps> extends BlockView<PropsType> {
|
|
19
19
|
elementType: string;
|
|
20
|
+
updateContents: () => void;
|
|
20
21
|
onUpdateContent(): void;
|
|
21
22
|
checkEditability: () => void;
|
|
23
|
+
setTCClasses: () => void;
|
|
22
24
|
}
|
|
23
|
-
declare const _default: (props: BaseNodeProps) => import("../types").NodeViewCreator<FootnotesElementView<any>>;
|
|
25
|
+
declare const _default: (props: BaseNodeProps, dispatch?: import("..").Dispatch | undefined) => import("../types").NodeViewCreator<FootnotesElementView<any>>;
|
|
24
26
|
export default _default;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { FootnotesElementView } from './footnotes_element';
|
|
17
|
-
declare const _default: (props: import("./base_node_view").BaseNodeProps) => import("../types").NodeViewCreator<{
|
|
17
|
+
declare const _default: (props: import("./base_node_view").BaseNodeProps, dispatch?: import("..").Dispatch | undefined) => import("../types").NodeViewCreator<{
|
|
18
18
|
gutterButtons: () => HTMLElement[];
|
|
19
19
|
actionGutterButtons: () => HTMLElement[];
|
|
20
20
|
createSyncWarningButton: () => HTMLElement | null;
|
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.7.
|
|
4
|
+
"version": "1.7.15-LEAN-3405-0",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@manuscripts/json-schema": "^2.2.4",
|
|
33
33
|
"@manuscripts/library": "^1.3.3",
|
|
34
34
|
"@manuscripts/style-guide": "^1.7.9",
|
|
35
|
-
"@manuscripts/track-changes-plugin": "^1.7.
|
|
35
|
+
"@manuscripts/track-changes-plugin": "^1.7.6",
|
|
36
36
|
"@manuscripts/transform": "^2.1.4",
|
|
37
37
|
"astrocite-eutils": "^0.16.4",
|
|
38
38
|
"axios": "^1.6.7",
|
package/styles/Editor.css
CHANGED
|
@@ -944,6 +944,11 @@
|
|
|
944
944
|
padding-top: 8px;
|
|
945
945
|
}
|
|
946
946
|
|
|
947
|
+
.ProseMirror .table-footer .block-gutter,
|
|
948
|
+
.ProseMirror .table-footer .action-gutter {
|
|
949
|
+
display: none;
|
|
950
|
+
}
|
|
951
|
+
|
|
947
952
|
.ProseMirror .table-footer .footnote-element:not(:first-child)::before {
|
|
948
953
|
content: '';
|
|
949
954
|
border-bottom: 1px dashed #C9C9C9;
|
|
@@ -955,7 +960,12 @@
|
|
|
955
960
|
counter-reset: table_footnote;
|
|
956
961
|
}
|
|
957
962
|
|
|
958
|
-
.ProseMirror
|
|
963
|
+
.ProseMirror
|
|
964
|
+
.table-footer
|
|
965
|
+
.footnote-element
|
|
966
|
+
div.block
|
|
967
|
+
> div:not(:has(.unctied-table-footnote))
|
|
968
|
+
p::before {
|
|
959
969
|
counter-increment: table_footnote;
|
|
960
970
|
content: counter(table_footnote);
|
|
961
971
|
display: inline-block;
|
|
@@ -998,7 +1008,7 @@
|
|
|
998
1008
|
cursor: pointer;
|
|
999
1009
|
}
|
|
1000
1010
|
|
|
1001
|
-
.ProseMirror .footnote-element > div:has(.unctied-table-footnote) {
|
|
1011
|
+
.ProseMirror .footnote-element div.block > div:has(.unctied-table-footnote) {
|
|
1002
1012
|
position: relative;
|
|
1003
1013
|
}
|
|
1004
1014
|
|