@manuscripts/body-editor 1.5.7-LEAN-2055-0 → 1.5.8
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/commands.js +0 -6
- package/dist/cjs/lib/utils.js +3 -3
- package/dist/cjs/plugins/bibliography/bibliography-utils.js +1 -10
- package/dist/cjs/plugins/bibliography/index.js +6 -15
- package/dist/cjs/plugins/tracking-mark.js +3 -3
- package/dist/cjs/views/bibliography_element.js +3 -138
- package/dist/cjs/views/block_view.js +4 -0
- package/dist/cjs/views/citation.js +1 -1
- package/dist/cjs/views/citation_editable.js +22 -4
- package/dist/cjs/views/footnotes_element.js +9 -0
- package/dist/es/commands.js +0 -6
- package/dist/es/lib/utils.js +3 -3
- package/dist/es/plugins/bibliography/bibliography-utils.js +1 -10
- package/dist/es/plugins/bibliography/index.js +6 -15
- package/dist/es/plugins/tracking-mark.js +3 -3
- package/dist/es/views/bibliography_element.js +3 -138
- package/dist/es/views/block_view.js +4 -0
- package/dist/es/views/citation.js +1 -1
- package/dist/es/views/citation_editable.js +22 -4
- package/dist/es/views/footnotes_element.js +9 -0
- package/dist/types/configs/editor-views.d.ts +14 -0
- package/dist/types/lib/utils.d.ts +2 -2
- package/dist/types/plugins/bibliography/bibliography-utils.d.ts +1 -1
- package/dist/types/plugins/bibliography/types.d.ts +0 -1
- package/dist/types/plugins/tracking-mark.d.ts +2 -2
- package/dist/types/views/bibliography_element.d.ts +1 -12
- package/dist/types/views/bibliography_element_editable.d.ts +1 -0
- package/dist/types/views/block_view.d.ts +1 -0
- package/dist/types/views/blockquote_element_editable.d.ts +1 -0
- package/dist/types/views/bullet_list_editable.d.ts +1 -0
- package/dist/types/views/editable_block.d.ts +1 -0
- package/dist/types/views/equation_element_editable.d.ts +1 -0
- package/dist/types/views/figure_element_editable.d.ts +1 -0
- package/dist/types/views/footnote_editable.d.ts +1 -0
- package/dist/types/views/footnotes_element.d.ts +2 -0
- package/dist/types/views/footnotes_element_editable.d.ts +1 -0
- package/dist/types/views/listing_element_editable.d.ts +1 -0
- package/dist/types/views/ordered_list_editable.d.ts +1 -0
- package/dist/types/views/paragraph_editable.d.ts +1 -0
- package/dist/types/views/placeholder_element_editable.d.ts +1 -0
- package/dist/types/views/pullquote_element_editable.d.ts +1 -0
- package/dist/types/views/section_title_editable.d.ts +1 -0
- package/dist/types/views/table_element_editable.d.ts +1 -0
- package/dist/types/views/toc_element_editable.d.ts +1 -0
- package/package.json +3 -3
- package/styles/Editor.css +9 -1
package/dist/cjs/commands.js
CHANGED
|
@@ -257,9 +257,6 @@ const insertLink = (state, dispatch) => {
|
|
|
257
257
|
return true;
|
|
258
258
|
};
|
|
259
259
|
exports.insertLink = insertLink;
|
|
260
|
-
const needsBibliography = (state) => !bibliography_1.bibliographyKey.getState(state).citations.length &&
|
|
261
|
-
!(0, utils_1.getChildOfType)(state.tr.doc, state.schema.nodes.bibliography_section);
|
|
262
|
-
const createBibliographySection = (state) => state.schema.nodes.bibliography_section.createAndFill({}, state.schema.nodes.section_title.create({}, state.schema.text('Bibliography')));
|
|
263
260
|
const insertInlineCitation = (state, dispatch, view, embeddedCitationItems = []) => {
|
|
264
261
|
const citation = (0, transform_1.buildCitation)(state.selection.$anchor.parent.attrs.id, embeddedCitationItems);
|
|
265
262
|
const node = state.schema.nodes.citation.create({
|
|
@@ -270,9 +267,6 @@ const insertInlineCitation = (state, dispatch, view, embeddedCitationItems = [])
|
|
|
270
267
|
const pos = state.selection.to;
|
|
271
268
|
const { tr } = state;
|
|
272
269
|
tr.insert(pos, node);
|
|
273
|
-
if (needsBibliography(state)) {
|
|
274
|
-
tr.insert(tr.doc.content.size, createBibliographySection(state)).setMeta(bibliography_1.bibliographyKey, { bibliographyInserted: true });
|
|
275
|
-
}
|
|
276
270
|
if (dispatch) {
|
|
277
271
|
const selection = prosemirror_state_1.NodeSelection.create(tr.doc, pos);
|
|
278
272
|
dispatch(tr.setSelection(selection).scrollIntoView());
|
package/dist/cjs/lib/utils.js
CHANGED
|
@@ -30,8 +30,8 @@ function* iterateChildren(node, recurse = false) {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
exports.iterateChildren = iterateChildren;
|
|
33
|
-
const getMatchingChild = (parent, matcher) => {
|
|
34
|
-
for (const node of iterateChildren(parent)) {
|
|
33
|
+
const getMatchingChild = (parent, matcher, deep = false) => {
|
|
34
|
+
for (const node of iterateChildren(parent, deep)) {
|
|
35
35
|
if (matcher(node)) {
|
|
36
36
|
return node;
|
|
37
37
|
}
|
|
@@ -46,7 +46,7 @@ const getMatchingDescendant = (parent, matcher) => {
|
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
48
|
exports.getMatchingDescendant = getMatchingDescendant;
|
|
49
|
-
const getChildOfType = (parent, nodeType) => !!(0, exports.getMatchingChild)(parent, (node) => node.type === nodeType);
|
|
49
|
+
const getChildOfType = (parent, nodeType, deep = false) => !!(0, exports.getMatchingChild)(parent, (node) => node.type.name === nodeType.name, deep);
|
|
50
50
|
exports.getChildOfType = getChildOfType;
|
|
51
51
|
exports.findParentNodeWithId = (0, prosemirror_utils_1.findParentNode)((node) => 'id' in node.attrs);
|
|
52
52
|
exports.findParentNodeWithIdValue = (0, prosemirror_utils_1.findParentNode)((node) => node.attrs.id);
|
|
@@ -34,7 +34,7 @@ const lodash_es_1 = require("lodash-es");
|
|
|
34
34
|
const prosemirror_view_1 = require("prosemirror-view");
|
|
35
35
|
const isBibliographyElement = (node) => node.type === node.type.schema.nodes.bibliography_element;
|
|
36
36
|
exports.isBibliographyElement = isBibliographyElement;
|
|
37
|
-
const buildDecorations = (doc, citationNodes, popper, referencesModelMap
|
|
37
|
+
const buildDecorations = (doc, citationNodes, popper, referencesModelMap) => {
|
|
38
38
|
const decorations = [];
|
|
39
39
|
let hasMissingItems = false;
|
|
40
40
|
for (const [node, pos, citation] of citationNodes) {
|
|
@@ -72,15 +72,6 @@ const buildDecorations = (doc, citationNodes, popper, referencesModelMap, trigge
|
|
|
72
72
|
}
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
|
-
if (triggerUpdate) {
|
|
76
|
-
doc.descendants((node, pos) => {
|
|
77
|
-
if ((0, exports.isBibliographyElement)(node)) {
|
|
78
|
-
decorations.push(prosemirror_view_1.Decoration.node(pos, pos + node.nodeSize, {}, {
|
|
79
|
-
triggerUpdate: true,
|
|
80
|
-
}));
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
75
|
return decorations;
|
|
85
76
|
};
|
|
86
77
|
exports.buildDecorations = buildDecorations;
|
|
@@ -20,7 +20,6 @@ const library_1 = require("@manuscripts/library");
|
|
|
20
20
|
const lodash_es_1 = require("lodash-es");
|
|
21
21
|
const prosemirror_state_1 = require("prosemirror-state");
|
|
22
22
|
const prosemirror_view_1 = require("prosemirror-view");
|
|
23
|
-
const track_changes_utils_1 = require("../../lib/track-changes-utils");
|
|
24
23
|
const bibliography_utils_1 = require("./bibliography-utils");
|
|
25
24
|
exports.bibliographyKey = new prosemirror_state_1.PluginKey('bibliography');
|
|
26
25
|
exports.default = (props) => {
|
|
@@ -31,9 +30,8 @@ exports.default = (props) => {
|
|
|
31
30
|
init(config, instance) {
|
|
32
31
|
const referencesModelMap = (0, bibliography_utils_1.getReferencesModelMap)(instance.doc);
|
|
33
32
|
const citationNodes = (0, library_1.buildCitationNodes)(instance.doc, referencesModelMap);
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const bibliographyItems = (0, library_1.buildBibliographyItems)(filteredCitationNodes, (id) => referencesModelMap.get(id));
|
|
33
|
+
const citations = (0, library_1.buildCitations)(citationNodes, (id) => referencesModelMap.get(id));
|
|
34
|
+
const bibliographyItems = (0, library_1.buildBibliographyItems)(citationNodes, (id) => referencesModelMap.get(id));
|
|
37
35
|
return {
|
|
38
36
|
citationNodes,
|
|
39
37
|
citations,
|
|
@@ -43,16 +41,12 @@ exports.default = (props) => {
|
|
|
43
41
|
apply(tr, value, oldState, newState) {
|
|
44
42
|
const referencesModelMap = (0, bibliography_utils_1.getReferencesModelMap)(newState.doc);
|
|
45
43
|
const citationNodes = (0, library_1.buildCitationNodes)(newState.doc, referencesModelMap);
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
-
const bibliographyItems = (0, library_1.buildBibliographyItems)(filteredCitationNodes, (id) => referencesModelMap.get(id));
|
|
49
|
-
const meta = tr.getMeta(exports.bibliographyKey);
|
|
50
|
-
const triggerUpdate = meta && meta.triggerUpdate;
|
|
44
|
+
const citations = (0, library_1.buildCitations)(citationNodes, (id) => referencesModelMap.get(id));
|
|
45
|
+
const bibliographyItems = (0, library_1.buildBibliographyItems)(citationNodes, (id) => referencesModelMap.get(id));
|
|
51
46
|
return {
|
|
52
47
|
citationNodes,
|
|
53
48
|
citations,
|
|
54
49
|
bibliographyItems,
|
|
55
|
-
triggerUpdate,
|
|
56
50
|
};
|
|
57
51
|
},
|
|
58
52
|
},
|
|
@@ -80,9 +74,6 @@ exports.default = (props) => {
|
|
|
80
74
|
if (selection instanceof prosemirror_state_1.NodeSelection) {
|
|
81
75
|
tr.setSelection(prosemirror_state_1.NodeSelection.create(tr.doc, selection.from));
|
|
82
76
|
}
|
|
83
|
-
tr.setMeta(exports.bibliographyKey, {
|
|
84
|
-
triggerUpdate: true,
|
|
85
|
-
});
|
|
86
77
|
tr.setMeta('origin', exports.bibliographyKey);
|
|
87
78
|
return tr;
|
|
88
79
|
}
|
|
@@ -92,8 +83,8 @@ exports.default = (props) => {
|
|
|
92
83
|
},
|
|
93
84
|
props: {
|
|
94
85
|
decorations(state) {
|
|
95
|
-
const { citationNodes
|
|
96
|
-
return prosemirror_view_1.DecorationSet.create(state.doc, (0, bibliography_utils_1.buildDecorations)(state.doc, citationNodes, props.popper, (0, bibliography_utils_1.getReferencesModelMap)(state.doc)
|
|
86
|
+
const { citationNodes } = exports.bibliographyKey.getState(state);
|
|
87
|
+
return prosemirror_view_1.DecorationSet.create(state.doc, (0, bibliography_utils_1.buildDecorations)(state.doc, citationNodes, props.popper, (0, bibliography_utils_1.getReferencesModelMap)(state.doc)));
|
|
97
88
|
},
|
|
98
89
|
},
|
|
99
90
|
});
|
|
@@ -41,17 +41,17 @@ const buildDecorations = (state) => {
|
|
|
41
41
|
if (change.type === 'node-attr-change' &&
|
|
42
42
|
change.dataTracked.status === track_changes_plugin_1.CHANGE_STATUS.pending &&
|
|
43
43
|
change.dataTracked.operation === track_changes_plugin_1.CHANGE_OPERATION.set_node_attributes) {
|
|
44
|
-
decorations.push(prosemirror_view_1.Decoration.widget(change.from + 1, (0, exports.getAttrsTrackingButton)(change
|
|
44
|
+
decorations.push(prosemirror_view_1.Decoration.widget(change.from + 1, (0, exports.getAttrsTrackingButton)(change), {
|
|
45
45
|
key: change.id,
|
|
46
46
|
}));
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
49
|
return decorations;
|
|
50
50
|
};
|
|
51
|
-
const getAttrsTrackingButton = (
|
|
51
|
+
const getAttrsTrackingButton = (change) => {
|
|
52
52
|
const el = document.createElement('button');
|
|
53
53
|
el.className = 'attrs-popper-button';
|
|
54
|
-
el.value =
|
|
54
|
+
el.value = change.id;
|
|
55
55
|
el.innerHTML = editIcon;
|
|
56
56
|
return el;
|
|
57
57
|
};
|
|
@@ -14,160 +14,25 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
27
|
-
var t = {};
|
|
28
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
29
|
-
t[p] = s[p];
|
|
30
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
31
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
32
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
33
|
-
t[p[i]] = s[p[i]];
|
|
34
|
-
}
|
|
35
|
-
return t;
|
|
36
|
-
};
|
|
37
17
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
38
18
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
39
19
|
};
|
|
40
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
21
|
exports.BibliographyElementBlockView = void 0;
|
|
42
|
-
const library_1 = require("@manuscripts/library");
|
|
43
|
-
const track_changes_plugin_1 = require("@manuscripts/track-changes-plugin");
|
|
44
|
-
const transform_1 = require("@manuscripts/transform");
|
|
45
|
-
const react_1 = __importDefault(require("react"));
|
|
46
|
-
const assets_1 = require("../assets");
|
|
47
|
-
const dompurify_1 = require("../lib/dompurify");
|
|
48
|
-
const bibliography_1 = require("../plugins/bibliography");
|
|
49
|
-
const bibliography_utils_1 = require("../plugins/bibliography/bibliography-utils");
|
|
50
|
-
const comment_annotation_1 = require("../plugins/comment_annotation");
|
|
51
|
-
const tracking_mark_1 = require("../plugins/tracking-mark");
|
|
52
22
|
const block_view_1 = __importDefault(require("./block_view"));
|
|
53
23
|
const creators_1 = require("./creators");
|
|
54
|
-
const createBibliography = (bibliographyItems, cslProps) => __awaiter(void 0, void 0, void 0, function* () {
|
|
55
|
-
const bibliographyItemsMap = new Map(bibliographyItems.map((item) => [item._id, item]));
|
|
56
|
-
const getLibraryItem = (id) => bibliographyItemsMap.get(id);
|
|
57
|
-
const { style = '', locale } = cslProps;
|
|
58
|
-
const provider = new library_1.CitationProvider({
|
|
59
|
-
getLibraryItem,
|
|
60
|
-
citationStyle: style,
|
|
61
|
-
locale,
|
|
62
|
-
});
|
|
63
|
-
const [bibmeta, generatedBibliographyItems] = provider.makeBibliography(bibliographyItems);
|
|
64
|
-
if (bibmeta.bibliography_errors.length) {
|
|
65
|
-
console.error(bibmeta.bibliography_errors);
|
|
66
|
-
}
|
|
67
|
-
const bibliographyFragment = generatedBibliographyItems
|
|
68
|
-
.map((item, i) => `<div id=${bibmeta.entry_ids[i]} class="bib-item"><div><div class="csl-bib-body">${item}</div></div></div>`)
|
|
69
|
-
.join('');
|
|
70
|
-
return (0, dompurify_1.sanitize)(`<div class="contents">${bibliographyFragment}</div>`);
|
|
71
|
-
});
|
|
72
24
|
class BibliographyElementBlockView extends block_view_1.default {
|
|
73
25
|
constructor() {
|
|
74
26
|
super(...arguments);
|
|
75
|
-
this.showPopper = (referenceID) => {
|
|
76
|
-
const { renderReactComponent, components: { ReferencesEditor }, } = this.props;
|
|
77
|
-
const handleSave = (data) => __awaiter(this, void 0, void 0, function* () {
|
|
78
|
-
const _a = data, { _id: id, 'container-title': containerTitle, DOI: doi } = _a, rest = __rest(_a, ["_id", 'container-title', "DOI"]);
|
|
79
|
-
this.updateNodeAttrs(Object.assign({ id,
|
|
80
|
-
containerTitle,
|
|
81
|
-
doi }, rest));
|
|
82
|
-
});
|
|
83
|
-
if (!this.popperContainer) {
|
|
84
|
-
this.popperContainer = document.createElement('div');
|
|
85
|
-
this.popperContainer.className = 'references';
|
|
86
|
-
}
|
|
87
|
-
renderReactComponent(react_1.default.createElement(ReferencesEditor, { saveModel: handleSave, deleteModel: this.deleteNode, modelMap: (0, bibliography_utils_1.getReferencesModelMap)(this.view.state.doc, true), referenceID: referenceID }), this.popperContainer);
|
|
88
|
-
this.props.popper.show(this.dom, this.popperContainer, 'right');
|
|
89
|
-
};
|
|
90
27
|
this.stopEvent = () => true;
|
|
91
28
|
this.ignoreMutation = () => true;
|
|
92
|
-
this.updateContents = () => __awaiter(this, void 0, void 0, function* () {
|
|
93
|
-
const bibliographyItems = bibliography_1.bibliographyKey.getState(this.view.state).bibliographyItems;
|
|
94
|
-
const commentsDecorationSet = comment_annotation_1.commentAnnotation.getState(this.view.state);
|
|
95
|
-
const commentElementMap = new Map();
|
|
96
|
-
const dataTrackedMap = new Map();
|
|
97
|
-
this.node.descendants((node, pos) => {
|
|
98
|
-
if (commentsDecorationSet) {
|
|
99
|
-
const nodePosition = this.getPos() + pos + 2;
|
|
100
|
-
const commentWidget = commentsDecorationSet.find(nodePosition, nodePosition);
|
|
101
|
-
if (commentWidget.length) {
|
|
102
|
-
const commentElement = commentWidget[0].type.toDOM();
|
|
103
|
-
commentElementMap.set(commentElement.id, commentElement);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
const dataTracked = node.attrs.dataTracked;
|
|
107
|
-
if (dataTracked === null || dataTracked === void 0 ? void 0 : dataTracked.length) {
|
|
108
|
-
const lastChange = dataTracked[dataTracked.length - 1];
|
|
109
|
-
dataTrackedMap.set(node.attrs.id, lastChange);
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
const bibliographyFragment = yield createBibliography(bibliographyItems, this.props.cslProps);
|
|
113
|
-
const bibItems = bibliographyFragment.querySelectorAll('.bib-item');
|
|
114
|
-
bibItems.forEach((element) => {
|
|
115
|
-
const doubleButton = document.createElement('div');
|
|
116
|
-
const editButton = document.createElement('button');
|
|
117
|
-
const commentButton = document.createElement('button');
|
|
118
|
-
doubleButton.className = 'bibliography-double-button';
|
|
119
|
-
editButton.className = 'bibliography-edit-button';
|
|
120
|
-
commentButton.className = 'bibliography-comment-button';
|
|
121
|
-
commentButton.addEventListener('click', (e) => {
|
|
122
|
-
e.preventDefault();
|
|
123
|
-
this.props.setComment((0, transform_1.buildComment)(element.id));
|
|
124
|
-
});
|
|
125
|
-
editButton.addEventListener('click', (e) => {
|
|
126
|
-
e.preventDefault();
|
|
127
|
-
this.showPopper(element.id);
|
|
128
|
-
this.popperContainer = undefined;
|
|
129
|
-
});
|
|
130
|
-
editButton.innerHTML = assets_1.editIcon;
|
|
131
|
-
commentButton.innerHTML = assets_1.commentIcon;
|
|
132
|
-
doubleButton.append(editButton, commentButton);
|
|
133
|
-
if (this.props.getCapabilities().seeReferencesButtons &&
|
|
134
|
-
!element.querySelector('.bibliography-double-button')) {
|
|
135
|
-
element.appendChild(doubleButton);
|
|
136
|
-
}
|
|
137
|
-
editButton.disabled = !this.props.getCapabilities().editCitationsAndRefs;
|
|
138
|
-
const commentElement = commentElementMap.get(element.id);
|
|
139
|
-
if (commentElement) {
|
|
140
|
-
element.childNodes[0].appendChild(commentElement);
|
|
141
|
-
}
|
|
142
|
-
const dataTracked = dataTrackedMap.get(element.id);
|
|
143
|
-
if (dataTracked) {
|
|
144
|
-
element.classList.add('attrs-track-mark');
|
|
145
|
-
const decoration = (0, tracking_mark_1.getMarkDecoration)(dataTracked);
|
|
146
|
-
decoration.style && element.setAttribute('style', decoration.style);
|
|
147
|
-
if (dataTracked.status === track_changes_plugin_1.CHANGE_STATUS.pending &&
|
|
148
|
-
dataTracked.operation === track_changes_plugin_1.CHANGE_OPERATION.set_node_attributes) {
|
|
149
|
-
element.childNodes[0].appendChild((0, tracking_mark_1.getAttrsTrackingButton)(dataTracked.id));
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
const oldContent = this.container.querySelector('.contents');
|
|
154
|
-
if (oldContent) {
|
|
155
|
-
this.container.replaceChild(bibliographyFragment, oldContent);
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
this.container.appendChild(bibliographyFragment);
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
29
|
this.createElement = () => {
|
|
162
|
-
this.container = document.createElement('div');
|
|
163
|
-
this.container.classList.add('block');
|
|
164
|
-
this.container.contentEditable = 'false';
|
|
165
|
-
this.dom.appendChild(this.container);
|
|
166
30
|
this.contentDOM = document.createElement('div');
|
|
167
31
|
this.contentDOM.classList.add('block');
|
|
168
32
|
this.contentDOM.setAttribute('id', this.node.attrs.id);
|
|
169
|
-
this.contentDOM.
|
|
170
|
-
this.
|
|
33
|
+
this.contentDOM.setAttribute('contenteditable', 'false');
|
|
34
|
+
this.dom.setAttribute('contenteditable', 'false');
|
|
35
|
+
this.dom.appendChild(this.contentDOM);
|
|
171
36
|
};
|
|
172
37
|
}
|
|
173
38
|
}
|
|
@@ -34,6 +34,7 @@ class BlockView extends base_node_view_1.BaseNodeView {
|
|
|
34
34
|
this.updateContents = () => {
|
|
35
35
|
this.updateClasses();
|
|
36
36
|
this.updateAttributes();
|
|
37
|
+
this.onUpdateContent();
|
|
37
38
|
};
|
|
38
39
|
this.updateClasses = () => {
|
|
39
40
|
if (!this.contentDOM) {
|
|
@@ -89,5 +90,8 @@ class BlockView extends base_node_view_1.BaseNodeView {
|
|
|
89
90
|
this.gutterButtons = () => [];
|
|
90
91
|
this.actionGutterButtons = () => [];
|
|
91
92
|
}
|
|
93
|
+
onUpdateContent() {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
92
96
|
}
|
|
93
97
|
exports.default = BlockView;
|
|
@@ -119,7 +119,7 @@ class CitationView extends base_node_view_1.BaseNodeView {
|
|
|
119
119
|
const citeprocContent = citeprocCitations === null || citeprocCitations === void 0 ? void 0 : citeprocCitations.get(this.node.attrs.rid);
|
|
120
120
|
const fragment = (0, dompurify_1.sanitize)(citeprocContent && citeprocContent !== '[NO_PRINTED_FORM]'
|
|
121
121
|
? citeprocContent
|
|
122
|
-
:
|
|
122
|
+
: this.node.attrs.contents, {
|
|
123
123
|
ALLOWED_TAGS: ['i', 'b', 'span', 'sup', 'sub', '#text'],
|
|
124
124
|
});
|
|
125
125
|
citationElement.appendChild(fragment);
|
|
@@ -48,6 +48,10 @@ const bibliography_1 = require("../plugins/bibliography");
|
|
|
48
48
|
const bibliography_utils_1 = require("../plugins/bibliography/bibliography-utils");
|
|
49
49
|
const citation_1 = require("./citation");
|
|
50
50
|
const creators_1 = require("./creators");
|
|
51
|
+
const createBibliographySection = (bibItem) => transform_1.schema.nodes.bibliography_section.createAndFill({}, [
|
|
52
|
+
transform_1.schema.nodes.section_title.create({}, transform_1.schema.text('Bibliography')),
|
|
53
|
+
transform_1.schema.nodes.bibliography_element.create({}, bibItem ? [bibItem] : []),
|
|
54
|
+
]);
|
|
51
55
|
class CitationEditableView extends citation_1.CitationView {
|
|
52
56
|
constructor() {
|
|
53
57
|
super(...arguments);
|
|
@@ -185,13 +189,27 @@ class CitationEditableView extends citation_1.CitationView {
|
|
|
185
189
|
insertBibliographyNode(view, item) {
|
|
186
190
|
const { doc, tr } = view.state;
|
|
187
191
|
const { DOI: doi, ['container-title']: containerTitle } = item, restAttr = __rest(item, ["DOI", 'container-title']);
|
|
188
|
-
|
|
192
|
+
let bibElement = null;
|
|
193
|
+
let pos = null;
|
|
194
|
+
doc.descendants((node, nodePos) => {
|
|
189
195
|
if (node.type === transform_1.schema.nodes.bibliography_element) {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
return false;
|
|
196
|
+
bibElement = node;
|
|
197
|
+
pos = nodePos;
|
|
193
198
|
}
|
|
194
199
|
});
|
|
200
|
+
let newTr;
|
|
201
|
+
const bibItem = transform_1.schema.nodes.bibliography_item.create(Object.assign({ id: item._id, doi,
|
|
202
|
+
containerTitle }, restAttr));
|
|
203
|
+
if (bibElement && pos) {
|
|
204
|
+
newTr = tr.insert(pos + 1, bibItem);
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
newTr = tr
|
|
208
|
+
.insert(tr.doc.content.size, createBibliographySection(bibItem))
|
|
209
|
+
.setMeta(bibliography_1.bibliographyKey, { bibliographyInserted: true });
|
|
210
|
+
}
|
|
211
|
+
view.dispatch(newTr);
|
|
212
|
+
return false;
|
|
195
213
|
}
|
|
196
214
|
}
|
|
197
215
|
exports.CitationEditableView = CitationEditableView;
|
|
@@ -25,6 +25,15 @@ class FootnotesElementView extends block_view_1.default {
|
|
|
25
25
|
constructor() {
|
|
26
26
|
super(...arguments);
|
|
27
27
|
this.elementType = 'div';
|
|
28
|
+
this.checkEditability = () => {
|
|
29
|
+
var _a, _b;
|
|
30
|
+
const editable = this.node.childCount ? 'true' : 'false';
|
|
31
|
+
(_a = this.contentDOM) === null || _a === void 0 ? void 0 : _a.setAttribute('contenteditable', editable);
|
|
32
|
+
(_b = this.dom) === null || _b === void 0 ? void 0 : _b.setAttribute('contenteditable', editable);
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
onUpdateContent() {
|
|
36
|
+
this.checkEditability();
|
|
28
37
|
}
|
|
29
38
|
}
|
|
30
39
|
exports.FootnotesElementView = FootnotesElementView;
|
package/dist/es/commands.js
CHANGED
|
@@ -219,9 +219,6 @@ export const insertLink = (state, dispatch) => {
|
|
|
219
219
|
}
|
|
220
220
|
return true;
|
|
221
221
|
};
|
|
222
|
-
const needsBibliography = (state) => !bibliographyKey.getState(state).citations.length &&
|
|
223
|
-
!getChildOfType(state.tr.doc, state.schema.nodes.bibliography_section);
|
|
224
|
-
const createBibliographySection = (state) => state.schema.nodes.bibliography_section.createAndFill({}, state.schema.nodes.section_title.create({}, state.schema.text('Bibliography')));
|
|
225
222
|
export const insertInlineCitation = (state, dispatch, view, embeddedCitationItems = []) => {
|
|
226
223
|
const citation = buildCitation(state.selection.$anchor.parent.attrs.id, embeddedCitationItems);
|
|
227
224
|
const node = state.schema.nodes.citation.create({
|
|
@@ -232,9 +229,6 @@ export const insertInlineCitation = (state, dispatch, view, embeddedCitationItem
|
|
|
232
229
|
const pos = state.selection.to;
|
|
233
230
|
const { tr } = state;
|
|
234
231
|
tr.insert(pos, node);
|
|
235
|
-
if (needsBibliography(state)) {
|
|
236
|
-
tr.insert(tr.doc.content.size, createBibliographySection(state)).setMeta(bibliographyKey, { bibliographyInserted: true });
|
|
237
|
-
}
|
|
238
232
|
if (dispatch) {
|
|
239
233
|
const selection = NodeSelection.create(tr.doc, pos);
|
|
240
234
|
dispatch(tr.setSelection(selection).scrollIntoView());
|
package/dist/es/lib/utils.js
CHANGED
|
@@ -26,8 +26,8 @@ export function* iterateChildren(node, recurse = false) {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
export const getMatchingChild = (parent, matcher) => {
|
|
30
|
-
for (const node of iterateChildren(parent)) {
|
|
29
|
+
export const getMatchingChild = (parent, matcher, deep = false) => {
|
|
30
|
+
for (const node of iterateChildren(parent, deep)) {
|
|
31
31
|
if (matcher(node)) {
|
|
32
32
|
return node;
|
|
33
33
|
}
|
|
@@ -40,7 +40,7 @@ export const getMatchingDescendant = (parent, matcher) => {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
|
-
export const getChildOfType = (parent, nodeType) => !!getMatchingChild(parent, (node) => node.type === nodeType);
|
|
43
|
+
export const getChildOfType = (parent, nodeType, deep = false) => !!getMatchingChild(parent, (node) => node.type.name === nodeType.name, deep);
|
|
44
44
|
export const findParentNodeWithId = findParentNode((node) => 'id' in node.attrs);
|
|
45
45
|
export const findParentNodeWithIdValue = findParentNode((node) => node.attrs.id);
|
|
46
46
|
export const findParentSection = findParentNode((node) => isSectionNodeType(node.type));
|
|
@@ -30,7 +30,7 @@ import { schema } from '@manuscripts/transform';
|
|
|
30
30
|
import { pickBy } from 'lodash-es';
|
|
31
31
|
import { Decoration } from 'prosemirror-view';
|
|
32
32
|
export const isBibliographyElement = (node) => node.type === node.type.schema.nodes.bibliography_element;
|
|
33
|
-
export const buildDecorations = (doc, citationNodes, popper, referencesModelMap
|
|
33
|
+
export const buildDecorations = (doc, citationNodes, popper, referencesModelMap) => {
|
|
34
34
|
const decorations = [];
|
|
35
35
|
let hasMissingItems = false;
|
|
36
36
|
for (const [node, pos, citation] of citationNodes) {
|
|
@@ -68,15 +68,6 @@ export const buildDecorations = (doc, citationNodes, popper, referencesModelMap,
|
|
|
68
68
|
}
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
|
-
if (triggerUpdate) {
|
|
72
|
-
doc.descendants((node, pos) => {
|
|
73
|
-
if (isBibliographyElement(node)) {
|
|
74
|
-
decorations.push(Decoration.node(pos, pos + node.nodeSize, {}, {
|
|
75
|
-
triggerUpdate: true,
|
|
76
|
-
}));
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
71
|
return decorations;
|
|
81
72
|
};
|
|
82
73
|
const cleanData = (model) => pickBy(model, (value) => value !== undefined);
|
|
@@ -17,7 +17,6 @@ import { buildBibliographyItems, buildCitationNodes, buildCitations, CitationPro
|
|
|
17
17
|
import { isEqual } from 'lodash-es';
|
|
18
18
|
import { NodeSelection, Plugin, PluginKey } from 'prosemirror-state';
|
|
19
19
|
import { DecorationSet } from 'prosemirror-view';
|
|
20
|
-
import { isDeleted, isRejectedInsert } from '../../lib/track-changes-utils';
|
|
21
20
|
import { buildDecorations, getReferencesModelMap } from './bibliography-utils';
|
|
22
21
|
export const bibliographyKey = new PluginKey('bibliography');
|
|
23
22
|
export default (props) => {
|
|
@@ -28,9 +27,8 @@ export default (props) => {
|
|
|
28
27
|
init(config, instance) {
|
|
29
28
|
const referencesModelMap = getReferencesModelMap(instance.doc);
|
|
30
29
|
const citationNodes = buildCitationNodes(instance.doc, referencesModelMap);
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const bibliographyItems = buildBibliographyItems(filteredCitationNodes, (id) => referencesModelMap.get(id));
|
|
30
|
+
const citations = buildCitations(citationNodes, (id) => referencesModelMap.get(id));
|
|
31
|
+
const bibliographyItems = buildBibliographyItems(citationNodes, (id) => referencesModelMap.get(id));
|
|
34
32
|
return {
|
|
35
33
|
citationNodes,
|
|
36
34
|
citations,
|
|
@@ -40,16 +38,12 @@ export default (props) => {
|
|
|
40
38
|
apply(tr, value, oldState, newState) {
|
|
41
39
|
const referencesModelMap = getReferencesModelMap(newState.doc);
|
|
42
40
|
const citationNodes = buildCitationNodes(newState.doc, referencesModelMap);
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
const bibliographyItems = buildBibliographyItems(filteredCitationNodes, (id) => referencesModelMap.get(id));
|
|
46
|
-
const meta = tr.getMeta(bibliographyKey);
|
|
47
|
-
const triggerUpdate = meta && meta.triggerUpdate;
|
|
41
|
+
const citations = buildCitations(citationNodes, (id) => referencesModelMap.get(id));
|
|
42
|
+
const bibliographyItems = buildBibliographyItems(citationNodes, (id) => referencesModelMap.get(id));
|
|
48
43
|
return {
|
|
49
44
|
citationNodes,
|
|
50
45
|
citations,
|
|
51
46
|
bibliographyItems,
|
|
52
|
-
triggerUpdate,
|
|
53
47
|
};
|
|
54
48
|
},
|
|
55
49
|
},
|
|
@@ -77,9 +71,6 @@ export default (props) => {
|
|
|
77
71
|
if (selection instanceof NodeSelection) {
|
|
78
72
|
tr.setSelection(NodeSelection.create(tr.doc, selection.from));
|
|
79
73
|
}
|
|
80
|
-
tr.setMeta(bibliographyKey, {
|
|
81
|
-
triggerUpdate: true,
|
|
82
|
-
});
|
|
83
74
|
tr.setMeta('origin', bibliographyKey);
|
|
84
75
|
return tr;
|
|
85
76
|
}
|
|
@@ -89,8 +80,8 @@ export default (props) => {
|
|
|
89
80
|
},
|
|
90
81
|
props: {
|
|
91
82
|
decorations(state) {
|
|
92
|
-
const { citationNodes
|
|
93
|
-
return DecorationSet.create(state.doc, buildDecorations(state.doc, citationNodes, props.popper, getReferencesModelMap(state.doc)
|
|
83
|
+
const { citationNodes } = bibliographyKey.getState(state);
|
|
84
|
+
return DecorationSet.create(state.doc, buildDecorations(state.doc, citationNodes, props.popper, getReferencesModelMap(state.doc)));
|
|
94
85
|
},
|
|
95
86
|
},
|
|
96
87
|
});
|
|
@@ -38,17 +38,17 @@ const buildDecorations = (state) => {
|
|
|
38
38
|
if (change.type === 'node-attr-change' &&
|
|
39
39
|
change.dataTracked.status === CHANGE_STATUS.pending &&
|
|
40
40
|
change.dataTracked.operation === CHANGE_OPERATION.set_node_attributes) {
|
|
41
|
-
decorations.push(Decoration.widget(change.from + 1, getAttrsTrackingButton(change
|
|
41
|
+
decorations.push(Decoration.widget(change.from + 1, getAttrsTrackingButton(change), {
|
|
42
42
|
key: change.id,
|
|
43
43
|
}));
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
46
|
return decorations;
|
|
47
47
|
};
|
|
48
|
-
export const getAttrsTrackingButton = (
|
|
48
|
+
export const getAttrsTrackingButton = (change) => {
|
|
49
49
|
const el = document.createElement('button');
|
|
50
50
|
el.className = 'attrs-popper-button';
|
|
51
|
-
el.value =
|
|
51
|
+
el.value = change.id;
|
|
52
52
|
el.innerHTML = editIcon;
|
|
53
53
|
return el;
|
|
54
54
|
};
|
|
@@ -13,155 +13,20 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
17
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
18
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
19
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
20
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
21
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
22
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
|
-
var t = {};
|
|
27
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
-
t[p] = s[p];
|
|
29
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
-
t[p[i]] = s[p[i]];
|
|
33
|
-
}
|
|
34
|
-
return t;
|
|
35
|
-
};
|
|
36
|
-
import { CitationProvider } from '@manuscripts/library';
|
|
37
|
-
import { CHANGE_OPERATION, CHANGE_STATUS, } from '@manuscripts/track-changes-plugin';
|
|
38
|
-
import { buildComment } from '@manuscripts/transform';
|
|
39
|
-
import React from 'react';
|
|
40
|
-
import { commentIcon, editIcon } from '../assets';
|
|
41
|
-
import { sanitize } from '../lib/dompurify';
|
|
42
|
-
import { bibliographyKey } from '../plugins/bibliography';
|
|
43
|
-
import { getReferencesModelMap } from '../plugins/bibliography/bibliography-utils';
|
|
44
|
-
import { commentAnnotation } from '../plugins/comment_annotation';
|
|
45
|
-
import { getAttrsTrackingButton, getMarkDecoration, } from '../plugins/tracking-mark';
|
|
46
16
|
import BlockView from './block_view';
|
|
47
17
|
import { createNodeView } from './creators';
|
|
48
|
-
const createBibliography = (bibliographyItems, cslProps) => __awaiter(void 0, void 0, void 0, function* () {
|
|
49
|
-
const bibliographyItemsMap = new Map(bibliographyItems.map((item) => [item._id, item]));
|
|
50
|
-
const getLibraryItem = (id) => bibliographyItemsMap.get(id);
|
|
51
|
-
const { style = '', locale } = cslProps;
|
|
52
|
-
const provider = new CitationProvider({
|
|
53
|
-
getLibraryItem,
|
|
54
|
-
citationStyle: style,
|
|
55
|
-
locale,
|
|
56
|
-
});
|
|
57
|
-
const [bibmeta, generatedBibliographyItems] = provider.makeBibliography(bibliographyItems);
|
|
58
|
-
if (bibmeta.bibliography_errors.length) {
|
|
59
|
-
console.error(bibmeta.bibliography_errors);
|
|
60
|
-
}
|
|
61
|
-
const bibliographyFragment = generatedBibliographyItems
|
|
62
|
-
.map((item, i) => `<div id=${bibmeta.entry_ids[i]} class="bib-item"><div><div class="csl-bib-body">${item}</div></div></div>`)
|
|
63
|
-
.join('');
|
|
64
|
-
return sanitize(`<div class="contents">${bibliographyFragment}</div>`);
|
|
65
|
-
});
|
|
66
18
|
export class BibliographyElementBlockView extends BlockView {
|
|
67
19
|
constructor() {
|
|
68
20
|
super(...arguments);
|
|
69
|
-
this.showPopper = (referenceID) => {
|
|
70
|
-
const { renderReactComponent, components: { ReferencesEditor }, } = this.props;
|
|
71
|
-
const handleSave = (data) => __awaiter(this, void 0, void 0, function* () {
|
|
72
|
-
const _a = data, { _id: id, 'container-title': containerTitle, DOI: doi } = _a, rest = __rest(_a, ["_id", 'container-title', "DOI"]);
|
|
73
|
-
this.updateNodeAttrs(Object.assign({ id,
|
|
74
|
-
containerTitle,
|
|
75
|
-
doi }, rest));
|
|
76
|
-
});
|
|
77
|
-
if (!this.popperContainer) {
|
|
78
|
-
this.popperContainer = document.createElement('div');
|
|
79
|
-
this.popperContainer.className = 'references';
|
|
80
|
-
}
|
|
81
|
-
renderReactComponent(React.createElement(ReferencesEditor, { saveModel: handleSave, deleteModel: this.deleteNode, modelMap: getReferencesModelMap(this.view.state.doc, true), referenceID: referenceID }), this.popperContainer);
|
|
82
|
-
this.props.popper.show(this.dom, this.popperContainer, 'right');
|
|
83
|
-
};
|
|
84
21
|
this.stopEvent = () => true;
|
|
85
22
|
this.ignoreMutation = () => true;
|
|
86
|
-
this.updateContents = () => __awaiter(this, void 0, void 0, function* () {
|
|
87
|
-
const bibliographyItems = bibliographyKey.getState(this.view.state).bibliographyItems;
|
|
88
|
-
const commentsDecorationSet = commentAnnotation.getState(this.view.state);
|
|
89
|
-
const commentElementMap = new Map();
|
|
90
|
-
const dataTrackedMap = new Map();
|
|
91
|
-
this.node.descendants((node, pos) => {
|
|
92
|
-
if (commentsDecorationSet) {
|
|
93
|
-
const nodePosition = this.getPos() + pos + 2;
|
|
94
|
-
const commentWidget = commentsDecorationSet.find(nodePosition, nodePosition);
|
|
95
|
-
if (commentWidget.length) {
|
|
96
|
-
const commentElement = commentWidget[0].type.toDOM();
|
|
97
|
-
commentElementMap.set(commentElement.id, commentElement);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
const dataTracked = node.attrs.dataTracked;
|
|
101
|
-
if (dataTracked === null || dataTracked === void 0 ? void 0 : dataTracked.length) {
|
|
102
|
-
const lastChange = dataTracked[dataTracked.length - 1];
|
|
103
|
-
dataTrackedMap.set(node.attrs.id, lastChange);
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
const bibliographyFragment = yield createBibliography(bibliographyItems, this.props.cslProps);
|
|
107
|
-
const bibItems = bibliographyFragment.querySelectorAll('.bib-item');
|
|
108
|
-
bibItems.forEach((element) => {
|
|
109
|
-
const doubleButton = document.createElement('div');
|
|
110
|
-
const editButton = document.createElement('button');
|
|
111
|
-
const commentButton = document.createElement('button');
|
|
112
|
-
doubleButton.className = 'bibliography-double-button';
|
|
113
|
-
editButton.className = 'bibliography-edit-button';
|
|
114
|
-
commentButton.className = 'bibliography-comment-button';
|
|
115
|
-
commentButton.addEventListener('click', (e) => {
|
|
116
|
-
e.preventDefault();
|
|
117
|
-
this.props.setComment(buildComment(element.id));
|
|
118
|
-
});
|
|
119
|
-
editButton.addEventListener('click', (e) => {
|
|
120
|
-
e.preventDefault();
|
|
121
|
-
this.showPopper(element.id);
|
|
122
|
-
this.popperContainer = undefined;
|
|
123
|
-
});
|
|
124
|
-
editButton.innerHTML = editIcon;
|
|
125
|
-
commentButton.innerHTML = commentIcon;
|
|
126
|
-
doubleButton.append(editButton, commentButton);
|
|
127
|
-
if (this.props.getCapabilities().seeReferencesButtons &&
|
|
128
|
-
!element.querySelector('.bibliography-double-button')) {
|
|
129
|
-
element.appendChild(doubleButton);
|
|
130
|
-
}
|
|
131
|
-
editButton.disabled = !this.props.getCapabilities().editCitationsAndRefs;
|
|
132
|
-
const commentElement = commentElementMap.get(element.id);
|
|
133
|
-
if (commentElement) {
|
|
134
|
-
element.childNodes[0].appendChild(commentElement);
|
|
135
|
-
}
|
|
136
|
-
const dataTracked = dataTrackedMap.get(element.id);
|
|
137
|
-
if (dataTracked) {
|
|
138
|
-
element.classList.add('attrs-track-mark');
|
|
139
|
-
const decoration = getMarkDecoration(dataTracked);
|
|
140
|
-
decoration.style && element.setAttribute('style', decoration.style);
|
|
141
|
-
if (dataTracked.status === CHANGE_STATUS.pending &&
|
|
142
|
-
dataTracked.operation === CHANGE_OPERATION.set_node_attributes) {
|
|
143
|
-
element.childNodes[0].appendChild(getAttrsTrackingButton(dataTracked.id));
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
const oldContent = this.container.querySelector('.contents');
|
|
148
|
-
if (oldContent) {
|
|
149
|
-
this.container.replaceChild(bibliographyFragment, oldContent);
|
|
150
|
-
}
|
|
151
|
-
else {
|
|
152
|
-
this.container.appendChild(bibliographyFragment);
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
23
|
this.createElement = () => {
|
|
156
|
-
this.container = document.createElement('div');
|
|
157
|
-
this.container.classList.add('block');
|
|
158
|
-
this.container.contentEditable = 'false';
|
|
159
|
-
this.dom.appendChild(this.container);
|
|
160
24
|
this.contentDOM = document.createElement('div');
|
|
161
25
|
this.contentDOM.classList.add('block');
|
|
162
26
|
this.contentDOM.setAttribute('id', this.node.attrs.id);
|
|
163
|
-
this.contentDOM.
|
|
164
|
-
this.
|
|
27
|
+
this.contentDOM.setAttribute('contenteditable', 'false');
|
|
28
|
+
this.dom.setAttribute('contenteditable', 'false');
|
|
29
|
+
this.dom.appendChild(this.contentDOM);
|
|
165
30
|
};
|
|
166
31
|
}
|
|
167
32
|
}
|
|
@@ -32,6 +32,7 @@ export default class BlockView extends BaseNodeView {
|
|
|
32
32
|
this.updateContents = () => {
|
|
33
33
|
this.updateClasses();
|
|
34
34
|
this.updateAttributes();
|
|
35
|
+
this.onUpdateContent();
|
|
35
36
|
};
|
|
36
37
|
this.updateClasses = () => {
|
|
37
38
|
if (!this.contentDOM) {
|
|
@@ -87,4 +88,7 @@ export default class BlockView extends BaseNodeView {
|
|
|
87
88
|
this.gutterButtons = () => [];
|
|
88
89
|
this.actionGutterButtons = () => [];
|
|
89
90
|
}
|
|
91
|
+
onUpdateContent() {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
90
94
|
}
|
|
@@ -90,7 +90,7 @@ export class CitationView extends BaseNodeView {
|
|
|
90
90
|
const citeprocContent = citeprocCitations === null || citeprocCitations === void 0 ? void 0 : citeprocCitations.get(this.node.attrs.rid);
|
|
91
91
|
const fragment = sanitize(citeprocContent && citeprocContent !== '[NO_PRINTED_FORM]'
|
|
92
92
|
? citeprocContent
|
|
93
|
-
:
|
|
93
|
+
: this.node.attrs.contents, {
|
|
94
94
|
ALLOWED_TAGS: ['i', 'b', 'span', 'sup', 'sub', '#text'],
|
|
95
95
|
});
|
|
96
96
|
citationElement.appendChild(fragment);
|
|
@@ -42,6 +42,10 @@ import { bibliographyKey } from '../plugins/bibliography';
|
|
|
42
42
|
import { getReferencesModelMap } from '../plugins/bibliography/bibliography-utils';
|
|
43
43
|
import { CitationView } from './citation';
|
|
44
44
|
import { createEditableNodeView } from './creators';
|
|
45
|
+
const createBibliographySection = (bibItem) => schema.nodes.bibliography_section.createAndFill({}, [
|
|
46
|
+
schema.nodes.section_title.create({}, schema.text('Bibliography')),
|
|
47
|
+
schema.nodes.bibliography_element.create({}, bibItem ? [bibItem] : []),
|
|
48
|
+
]);
|
|
45
49
|
export class CitationEditableView extends CitationView {
|
|
46
50
|
constructor() {
|
|
47
51
|
super(...arguments);
|
|
@@ -179,13 +183,27 @@ export class CitationEditableView extends CitationView {
|
|
|
179
183
|
insertBibliographyNode(view, item) {
|
|
180
184
|
const { doc, tr } = view.state;
|
|
181
185
|
const { DOI: doi, ['container-title']: containerTitle } = item, restAttr = __rest(item, ["DOI", 'container-title']);
|
|
182
|
-
|
|
186
|
+
let bibElement = null;
|
|
187
|
+
let pos = null;
|
|
188
|
+
doc.descendants((node, nodePos) => {
|
|
183
189
|
if (node.type === schema.nodes.bibliography_element) {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
return false;
|
|
190
|
+
bibElement = node;
|
|
191
|
+
pos = nodePos;
|
|
187
192
|
}
|
|
188
193
|
});
|
|
194
|
+
let newTr;
|
|
195
|
+
const bibItem = schema.nodes.bibliography_item.create(Object.assign({ id: item._id, doi,
|
|
196
|
+
containerTitle }, restAttr));
|
|
197
|
+
if (bibElement && pos) {
|
|
198
|
+
newTr = tr.insert(pos + 1, bibItem);
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
newTr = tr
|
|
202
|
+
.insert(tr.doc.content.size, createBibliographySection(bibItem))
|
|
203
|
+
.setMeta(bibliographyKey, { bibliographyInserted: true });
|
|
204
|
+
}
|
|
205
|
+
view.dispatch(newTr);
|
|
206
|
+
return false;
|
|
189
207
|
}
|
|
190
208
|
}
|
|
191
209
|
export default createEditableNodeView(CitationEditableView);
|
|
@@ -19,6 +19,15 @@ export class FootnotesElementView extends BlockView {
|
|
|
19
19
|
constructor() {
|
|
20
20
|
super(...arguments);
|
|
21
21
|
this.elementType = 'div';
|
|
22
|
+
this.checkEditability = () => {
|
|
23
|
+
var _a, _b;
|
|
24
|
+
const editable = this.node.childCount ? 'true' : 'false';
|
|
25
|
+
(_a = this.contentDOM) === null || _a === void 0 ? void 0 : _a.setAttribute('contenteditable', editable);
|
|
26
|
+
(_b = this.dom) === null || _b === void 0 ? void 0 : _b.setAttribute('contenteditable', editable);
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
onUpdateContent() {
|
|
30
|
+
this.checkEditability();
|
|
22
31
|
}
|
|
23
32
|
}
|
|
24
33
|
export default createNodeOrElementView(FootnotesElementView, 'div');
|
|
@@ -38,6 +38,7 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
|
|
|
38
38
|
};
|
|
39
39
|
initialise: () => void;
|
|
40
40
|
updateContents: () => void;
|
|
41
|
+
onUpdateContent(): void;
|
|
41
42
|
updateClasses: () => void;
|
|
42
43
|
updateAttributes: () => void;
|
|
43
44
|
createElement: () => void;
|
|
@@ -75,6 +76,7 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
|
|
|
75
76
|
};
|
|
76
77
|
initialise: () => void;
|
|
77
78
|
updateContents: () => void;
|
|
79
|
+
onUpdateContent(): void;
|
|
78
80
|
updateClasses: () => void;
|
|
79
81
|
updateAttributes: () => void;
|
|
80
82
|
createElement: () => void;
|
|
@@ -112,6 +114,7 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
|
|
|
112
114
|
};
|
|
113
115
|
initialise: () => void;
|
|
114
116
|
updateContents: () => void;
|
|
117
|
+
onUpdateContent(): void;
|
|
115
118
|
updateClasses: () => void;
|
|
116
119
|
updateAttributes: () => void;
|
|
117
120
|
createElement: () => void;
|
|
@@ -152,6 +155,7 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
|
|
|
152
155
|
};
|
|
153
156
|
initialise: () => void;
|
|
154
157
|
updateContents: () => void;
|
|
158
|
+
onUpdateContent(): void;
|
|
155
159
|
updateClasses: () => void;
|
|
156
160
|
updateAttributes: () => void;
|
|
157
161
|
createElement: () => void;
|
|
@@ -190,6 +194,7 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
|
|
|
190
194
|
};
|
|
191
195
|
initialise: () => void;
|
|
192
196
|
updateContents: () => void;
|
|
197
|
+
onUpdateContent(): void;
|
|
193
198
|
updateClasses: () => void;
|
|
194
199
|
updateAttributes: () => void;
|
|
195
200
|
createElement: () => void;
|
|
@@ -227,6 +232,7 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
|
|
|
227
232
|
};
|
|
228
233
|
initialise: () => void;
|
|
229
234
|
updateContents: () => void;
|
|
235
|
+
onUpdateContent(): void;
|
|
230
236
|
updateClasses: () => void;
|
|
231
237
|
updateAttributes: () => void;
|
|
232
238
|
createElement: () => void;
|
|
@@ -271,6 +277,7 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
|
|
|
271
277
|
};
|
|
272
278
|
initialise: () => void;
|
|
273
279
|
updateContents: () => void;
|
|
280
|
+
onUpdateContent(): void;
|
|
274
281
|
updateClasses: () => void;
|
|
275
282
|
updateAttributes: () => void;
|
|
276
283
|
createElement: () => void;
|
|
@@ -308,6 +315,7 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
|
|
|
308
315
|
};
|
|
309
316
|
initialise: () => void;
|
|
310
317
|
updateContents: () => void;
|
|
318
|
+
onUpdateContent(): void;
|
|
311
319
|
updateClasses: () => void;
|
|
312
320
|
updateAttributes: () => void;
|
|
313
321
|
createElement: () => void;
|
|
@@ -345,6 +353,7 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
|
|
|
345
353
|
};
|
|
346
354
|
initialise: () => void;
|
|
347
355
|
updateContents: () => void;
|
|
356
|
+
onUpdateContent(): void;
|
|
348
357
|
updateClasses: () => void;
|
|
349
358
|
updateAttributes: () => void;
|
|
350
359
|
createElement: () => void;
|
|
@@ -383,6 +392,7 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
|
|
|
383
392
|
};
|
|
384
393
|
initialise: () => void;
|
|
385
394
|
updateContents: () => void;
|
|
395
|
+
onUpdateContent(): void;
|
|
386
396
|
updateClasses: () => void;
|
|
387
397
|
updateAttributes: () => void;
|
|
388
398
|
createElement: () => void;
|
|
@@ -420,6 +430,7 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
|
|
|
420
430
|
};
|
|
421
431
|
initialise: () => void;
|
|
422
432
|
updateContents: () => void;
|
|
433
|
+
onUpdateContent(): void;
|
|
423
434
|
updateClasses: () => void;
|
|
424
435
|
updateAttributes: () => void;
|
|
425
436
|
createElement: () => void;
|
|
@@ -457,6 +468,7 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
|
|
|
457
468
|
};
|
|
458
469
|
initialise: () => void;
|
|
459
470
|
updateContents: () => void;
|
|
471
|
+
onUpdateContent(): void;
|
|
460
472
|
updateClasses: () => void;
|
|
461
473
|
updateAttributes: () => void;
|
|
462
474
|
createElement: () => void;
|
|
@@ -495,6 +507,7 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
|
|
|
495
507
|
};
|
|
496
508
|
initialise: () => void;
|
|
497
509
|
updateContents: () => void;
|
|
510
|
+
onUpdateContent(): void;
|
|
498
511
|
updateClasses: () => void;
|
|
499
512
|
updateAttributes: () => void;
|
|
500
513
|
createElement: () => void;
|
|
@@ -532,6 +545,7 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
|
|
|
532
545
|
};
|
|
533
546
|
initialise: () => void;
|
|
534
547
|
updateContents: () => void;
|
|
548
|
+
onUpdateContent(): void;
|
|
535
549
|
updateClasses: () => void;
|
|
536
550
|
updateAttributes: () => void;
|
|
537
551
|
createElement: () => void;
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
import { ManuscriptNode, ManuscriptNodeType } from '@manuscripts/transform';
|
|
17
17
|
import { Selection } from 'prosemirror-state';
|
|
18
18
|
export declare function iterateChildren(node: ManuscriptNode, recurse?: boolean): Iterable<ManuscriptNode>;
|
|
19
|
-
export declare const getMatchingChild: (parent: ManuscriptNode, matcher: (node: ManuscriptNode) => boolean) => ManuscriptNode | undefined;
|
|
19
|
+
export declare const getMatchingChild: (parent: ManuscriptNode, matcher: (node: ManuscriptNode) => boolean, deep?: boolean) => ManuscriptNode | undefined;
|
|
20
20
|
export declare const getMatchingDescendant: (parent: ManuscriptNode, matcher: (node: ManuscriptNode) => boolean) => ManuscriptNode | undefined;
|
|
21
|
-
export declare const getChildOfType: (parent: ManuscriptNode, nodeType: ManuscriptNodeType) => boolean;
|
|
21
|
+
export declare const getChildOfType: (parent: ManuscriptNode, nodeType: ManuscriptNodeType, deep?: boolean) => boolean;
|
|
22
22
|
export declare const findParentNodeWithId: (selection: Selection) => import("prosemirror-utils").ContentNodeWithPos | undefined;
|
|
23
23
|
export declare const findParentNodeWithIdValue: (selection: Selection) => import("prosemirror-utils").ContentNodeWithPos | undefined;
|
|
24
24
|
export declare const findParentSection: (selection: Selection) => import("prosemirror-utils").ContentNodeWithPos | undefined;
|
|
@@ -19,6 +19,6 @@ import { ManuscriptNode } from '@manuscripts/transform';
|
|
|
19
19
|
import { Decoration } from 'prosemirror-view';
|
|
20
20
|
import { PopperManager } from '../../lib/popper';
|
|
21
21
|
export declare const isBibliographyElement: (node: ManuscriptNode) => boolean;
|
|
22
|
-
export declare const buildDecorations: (doc: ManuscriptNode, citationNodes: CitationNodes, popper: PopperManager, referencesModelMap: Map<string, Model
|
|
22
|
+
export declare const buildDecorations: (doc: ManuscriptNode, citationNodes: CitationNodes, popper: PopperManager, referencesModelMap: Map<string, Model>) => Decoration[];
|
|
23
23
|
export declare const getNodeModel: <T extends Model>(node: ManuscriptNode, excludeDeletedNode?: boolean) => T | undefined;
|
|
24
24
|
export declare const getReferencesModelMap: (doc: ManuscriptNode, excludeDeletedNode?: boolean) => Map<string, Model>;
|
|
@@ -29,7 +29,6 @@ export interface PluginState {
|
|
|
29
29
|
citationNodes: CitationNodes;
|
|
30
30
|
citations: CiteProcCitation[];
|
|
31
31
|
bibliographyItems: BibliographyItem[];
|
|
32
|
-
triggerUpdate?: boolean;
|
|
33
32
|
}
|
|
34
33
|
export interface BibliographyProps {
|
|
35
34
|
getCitationProvider: () => CitationProvider | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { TrackedAttrs } from '@manuscripts/track-changes-plugin';
|
|
1
|
+
import { NodeAttrChange, TrackedAttrs } from '@manuscripts/track-changes-plugin';
|
|
2
2
|
import { Plugin } from 'prosemirror-state';
|
|
3
3
|
import { DecorationAttrs, DecorationSet } from 'prosemirror-view';
|
|
4
4
|
declare const _default: () => Plugin<DecorationSet>;
|
|
5
5
|
export default _default;
|
|
6
|
-
export declare const getAttrsTrackingButton: (
|
|
6
|
+
export declare const getAttrsTrackingButton: (change: NodeAttrChange) => HTMLButtonElement;
|
|
7
7
|
export declare const getMarkDecoration: (dataTracked: TrackedAttrs, htmlNode?: HTMLElement) => DecorationAttrs;
|
|
@@ -13,22 +13,11 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { CommentAnnotation } from '@manuscripts/json-schema';
|
|
17
|
-
import React from 'react';
|
|
18
16
|
import { BaseNodeProps } from './base_node_view';
|
|
19
17
|
import BlockView from './block_view';
|
|
20
|
-
|
|
21
|
-
interface BibliographyElementViewProps extends BaseNodeProps {
|
|
22
|
-
setComment: (comment?: CommentAnnotation) => void;
|
|
23
|
-
components: Record<string, React.ComponentType<any>>;
|
|
24
|
-
}
|
|
25
|
-
export declare class BibliographyElementBlockView<PropsType extends BibliographyElementViewProps & EditableBlockProps> extends BlockView<PropsType> {
|
|
26
|
-
container: HTMLElement;
|
|
27
|
-
popperContainer?: HTMLDivElement;
|
|
28
|
-
showPopper: (referenceID: string) => void;
|
|
18
|
+
export declare class BibliographyElementBlockView<PropsType extends BaseNodeProps> extends BlockView<PropsType> {
|
|
29
19
|
stopEvent: () => boolean;
|
|
30
20
|
ignoreMutation: () => boolean;
|
|
31
|
-
updateContents: () => Promise<void>;
|
|
32
21
|
createElement: () => void;
|
|
33
22
|
}
|
|
34
23
|
declare const _default: (props: BaseNodeProps, dispatch?: import("..").Dispatch | undefined) => import("../types").NodeViewCreator<BibliographyElementBlockView<any>>;
|
|
@@ -28,6 +28,7 @@ declare const _default: (props: import("./editable_block").EditableBlockProps, d
|
|
|
28
28
|
};
|
|
29
29
|
initialise: () => void;
|
|
30
30
|
updateContents: () => void;
|
|
31
|
+
onUpdateContent(): void;
|
|
31
32
|
updateClasses: () => void;
|
|
32
33
|
updateAttributes: () => void;
|
|
33
34
|
createElement: () => void;
|
|
@@ -23,6 +23,7 @@ export default class BlockView<T extends BaseNodeProps> extends BaseNodeView<T>
|
|
|
23
23
|
};
|
|
24
24
|
initialise: () => void;
|
|
25
25
|
updateContents: () => void;
|
|
26
|
+
onUpdateContent(): void;
|
|
26
27
|
updateClasses: () => void;
|
|
27
28
|
updateAttributes: () => void;
|
|
28
29
|
createElement: () => void;
|
|
@@ -28,6 +28,7 @@ declare const _default: (props: import("./base_node_view").BaseNodeProps) => imp
|
|
|
28
28
|
};
|
|
29
29
|
initialise: () => void;
|
|
30
30
|
updateContents: () => void;
|
|
31
|
+
onUpdateContent(): void;
|
|
31
32
|
updateClasses: () => void;
|
|
32
33
|
updateAttributes: () => void;
|
|
33
34
|
createElement: () => void;
|
|
@@ -28,6 +28,7 @@ declare const _default: (props: import("./base_node_view").BaseNodeProps) => imp
|
|
|
28
28
|
};
|
|
29
29
|
initialise: () => void;
|
|
30
30
|
updateContents: () => void;
|
|
31
|
+
onUpdateContent(): void;
|
|
31
32
|
updateClasses: () => void;
|
|
32
33
|
updateAttributes: () => void;
|
|
33
34
|
createElement: () => void;
|
|
@@ -45,6 +45,7 @@ export declare const EditableBlock: <T extends Constructor<BlockView<EditableBlo
|
|
|
45
45
|
};
|
|
46
46
|
initialise: () => void;
|
|
47
47
|
updateContents: () => void;
|
|
48
|
+
onUpdateContent(): void;
|
|
48
49
|
updateClasses: () => void;
|
|
49
50
|
updateAttributes: () => void;
|
|
50
51
|
createElement: () => void;
|
|
@@ -28,6 +28,7 @@ declare const _default: (props: import("./editable_block").EditableBlockProps, d
|
|
|
28
28
|
};
|
|
29
29
|
initialise: () => void;
|
|
30
30
|
updateContents: () => void;
|
|
31
|
+
onUpdateContent(): void;
|
|
31
32
|
updateClasses: () => void;
|
|
32
33
|
updateAttributes: () => void;
|
|
33
34
|
createElement: () => void;
|
|
@@ -28,6 +28,7 @@ declare const _default: (props: import("./editable_block").EditableBlockProps, d
|
|
|
28
28
|
};
|
|
29
29
|
initialise: () => void;
|
|
30
30
|
updateContents: () => void;
|
|
31
|
+
onUpdateContent(): void;
|
|
31
32
|
updateClasses: () => void;
|
|
32
33
|
updateAttributes: () => void;
|
|
33
34
|
createElement: () => void;
|
|
@@ -28,6 +28,7 @@ declare const _default: (props: import("./base_node_view").BaseNodeProps) => imp
|
|
|
28
28
|
};
|
|
29
29
|
initialise: () => void;
|
|
30
30
|
updateContents: () => void;
|
|
31
|
+
onUpdateContent(): void;
|
|
31
32
|
updateClasses: () => void;
|
|
32
33
|
updateAttributes: () => void;
|
|
33
34
|
createElement: () => void;
|
|
@@ -17,6 +17,8 @@ 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
|
+
onUpdateContent(): void;
|
|
21
|
+
checkEditability: () => void;
|
|
20
22
|
}
|
|
21
23
|
declare const _default: (props: BaseNodeProps) => import("../types").NodeViewCreator<FootnotesElementView<any>>;
|
|
22
24
|
export default _default;
|
|
@@ -28,6 +28,7 @@ declare const _default: (props: import("./base_node_view").BaseNodeProps) => imp
|
|
|
28
28
|
};
|
|
29
29
|
initialise: () => void;
|
|
30
30
|
updateContents: () => void;
|
|
31
|
+
onUpdateContent(): void;
|
|
31
32
|
updateClasses: () => void;
|
|
32
33
|
updateAttributes: () => void;
|
|
33
34
|
createElement: () => void;
|
|
@@ -28,6 +28,7 @@ declare const _default: (props: import("./editable_block").EditableBlockProps, d
|
|
|
28
28
|
};
|
|
29
29
|
initialise: () => void;
|
|
30
30
|
updateContents: () => void;
|
|
31
|
+
onUpdateContent(): void;
|
|
31
32
|
updateClasses: () => void;
|
|
32
33
|
updateAttributes: () => void;
|
|
33
34
|
createElement: () => void;
|
|
@@ -28,6 +28,7 @@ declare const _default: (props: import("./base_node_view").BaseNodeProps) => imp
|
|
|
28
28
|
};
|
|
29
29
|
initialise: () => void;
|
|
30
30
|
updateContents: () => void;
|
|
31
|
+
onUpdateContent(): void;
|
|
31
32
|
updateClasses: () => void;
|
|
32
33
|
updateAttributes: () => void;
|
|
33
34
|
createElement: () => void;
|
|
@@ -28,6 +28,7 @@ declare const _default: (props: import("./base_node_view").BaseNodeProps) => imp
|
|
|
28
28
|
};
|
|
29
29
|
initialise: () => void;
|
|
30
30
|
updateContents: () => void;
|
|
31
|
+
onUpdateContent(): void;
|
|
31
32
|
updateClasses: () => void;
|
|
32
33
|
updateAttributes: () => void;
|
|
33
34
|
createElement: () => void;
|
|
@@ -28,6 +28,7 @@ declare const _default: (props: import("./editable_block").EditableBlockProps, d
|
|
|
28
28
|
};
|
|
29
29
|
initialise: () => void;
|
|
30
30
|
updateContents: () => void;
|
|
31
|
+
onUpdateContent(): void;
|
|
31
32
|
updateClasses: () => void;
|
|
32
33
|
updateAttributes: () => void;
|
|
33
34
|
createElement: () => void;
|
|
@@ -28,6 +28,7 @@ declare const _default: (props: import("./base_node_view").BaseNodeProps) => imp
|
|
|
28
28
|
};
|
|
29
29
|
initialise: () => void;
|
|
30
30
|
updateContents: () => void;
|
|
31
|
+
onUpdateContent(): void;
|
|
31
32
|
updateClasses: () => void;
|
|
32
33
|
updateAttributes: () => void;
|
|
33
34
|
createElement: () => void;
|
|
@@ -28,6 +28,7 @@ declare const _default: (props: import("./editable_block").EditableBlockProps, d
|
|
|
28
28
|
};
|
|
29
29
|
initialise: () => void;
|
|
30
30
|
updateContents: () => void;
|
|
31
|
+
onUpdateContent(): void;
|
|
31
32
|
updateClasses: () => void;
|
|
32
33
|
updateAttributes: () => void;
|
|
33
34
|
createElement: () => void;
|
|
@@ -28,6 +28,7 @@ declare const _default: (props: import("./editable_block").EditableBlockProps, d
|
|
|
28
28
|
};
|
|
29
29
|
initialise: () => void;
|
|
30
30
|
updateContents: () => void;
|
|
31
|
+
onUpdateContent(): void;
|
|
31
32
|
updateClasses: () => void;
|
|
32
33
|
updateAttributes: () => void;
|
|
33
34
|
createElement: () => void;
|
|
@@ -28,6 +28,7 @@ declare const _default: (props: import("./editable_block").EditableBlockProps, d
|
|
|
28
28
|
};
|
|
29
29
|
initialise: () => void;
|
|
30
30
|
updateContents: () => void;
|
|
31
|
+
onUpdateContent(): void;
|
|
31
32
|
updateClasses: () => void;
|
|
32
33
|
updateAttributes: () => void;
|
|
33
34
|
createElement: () => 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": "1.5.
|
|
4
|
+
"version": "1.5.8",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@manuscripts/style-guide": "^1.4.3",
|
|
34
34
|
"@manuscripts/title-editor": "^1.1.0",
|
|
35
35
|
"@manuscripts/track-changes-plugin": "^1.7.3",
|
|
36
|
-
"@manuscripts/transform": "1.5.
|
|
36
|
+
"@manuscripts/transform": "1.5.3",
|
|
37
37
|
"astrocite-eutils": "^0.16.4",
|
|
38
38
|
"axios": "^1.2.2",
|
|
39
39
|
"codemirror": "^5.58.1",
|
|
@@ -144,4 +144,4 @@
|
|
|
144
144
|
"resolutions": {
|
|
145
145
|
"@types/react": "^17.0.2"
|
|
146
146
|
}
|
|
147
|
-
}
|
|
147
|
+
}
|
package/styles/Editor.css
CHANGED
|
@@ -731,8 +731,12 @@
|
|
|
731
731
|
text-align: center;
|
|
732
732
|
}
|
|
733
733
|
|
|
734
|
+
.ProseMirror .block {
|
|
735
|
+
counter-reset: bib_item;
|
|
736
|
+
}
|
|
734
737
|
|
|
735
738
|
.ProseMirror .bib-item {
|
|
739
|
+
counter-increment: bib_item;
|
|
736
740
|
position: relative;
|
|
737
741
|
margin-right: 40px;
|
|
738
742
|
}
|
|
@@ -747,7 +751,11 @@
|
|
|
747
751
|
|
|
748
752
|
.ProseMirror .csl-left-margin {
|
|
749
753
|
padding-right: 1ch;
|
|
750
|
-
display:
|
|
754
|
+
display: none;
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
.ProseMirror .csl-right-inline::before {
|
|
758
|
+
content: counter(bib_item) '. ';
|
|
751
759
|
}
|
|
752
760
|
|
|
753
761
|
.ProseMirror .csl-entry a {
|