@manuscripts/body-editor 3.4.4 → 3.4.6
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 +7 -0
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/lib/context-menu.js +6 -1
- package/dist/cjs/lib/template.js +25 -0
- package/dist/cjs/menus.js +25 -0
- package/dist/cjs/versions.js +1 -1
- package/dist/cjs/views/figure_editable.js +13 -1
- package/dist/cjs/views/figure_element.js +10 -0
- package/dist/es/commands.js +7 -0
- package/dist/es/configs/ManuscriptsEditor.js +1 -1
- package/dist/es/index.js +1 -0
- package/dist/es/lib/context-menu.js +6 -1
- package/dist/es/lib/template.js +21 -0
- package/dist/es/menus.js +25 -0
- package/dist/es/versions.js +1 -1
- package/dist/es/views/figure_editable.js +13 -1
- package/dist/es/views/figure_element.js +10 -0
- package/dist/types/configs/ManuscriptsEditor.d.ts +2 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/lib/template.d.ts +18 -0
- package/dist/types/versions.d.ts +1 -1
- package/dist/types/views/figure_editable.d.ts +3 -1
- package/dist/types/views/figure_element.d.ts +1 -0
- package/package.json +3 -3
package/dist/cjs/commands.js
CHANGED
|
@@ -30,6 +30,7 @@ const comments_1 = require("./lib/comments");
|
|
|
30
30
|
const doc_1 = require("./lib/doc");
|
|
31
31
|
const footnotes_1 = require("./lib/footnotes");
|
|
32
32
|
const helpers_1 = require("./lib/helpers");
|
|
33
|
+
const template_1 = require("./lib/template");
|
|
33
34
|
const track_changes_utils_1 = require("./lib/track-changes-utils");
|
|
34
35
|
const utils_1 = require("./lib/utils");
|
|
35
36
|
const accessibility_element_1 = require("./plugins/accessibility_element");
|
|
@@ -93,6 +94,9 @@ const blockActive = (type) => (state) => {
|
|
|
93
94
|
exports.blockActive = blockActive;
|
|
94
95
|
const canInsert = (type) => (state) => {
|
|
95
96
|
const { $from, $to } = state.selection;
|
|
97
|
+
if (!(0, template_1.templateAllows)(state, type)) {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
96
100
|
if (($from.node().type === transform_1.schema.nodes.title ||
|
|
97
101
|
$from.node().type === transform_1.schema.nodes.section_title) &&
|
|
98
102
|
$from.pos === $to.pos &&
|
|
@@ -318,6 +322,9 @@ const insertAttachment = (file, state, type, dispatch) => {
|
|
|
318
322
|
};
|
|
319
323
|
exports.insertAttachment = insertAttachment;
|
|
320
324
|
const insertBlock = (nodeType) => (state, dispatch) => {
|
|
325
|
+
if (!(0, exports.canInsert)(nodeType)(state)) {
|
|
326
|
+
return false;
|
|
327
|
+
}
|
|
321
328
|
const position = findBlockInsertPosition(state);
|
|
322
329
|
if (position === null) {
|
|
323
330
|
return false;
|
package/dist/cjs/index.js
CHANGED
|
@@ -53,6 +53,7 @@ __exportStar(require("./toolbar"), exports);
|
|
|
53
53
|
__exportStar(require("./lib/comments"), exports);
|
|
54
54
|
__exportStar(require("./lib/files"), exports);
|
|
55
55
|
__exportStar(require("./lib/footnotes"), exports);
|
|
56
|
+
__exportStar(require("./lib/template"), exports);
|
|
56
57
|
__exportStar(require("./lib/doc"), exports);
|
|
57
58
|
__exportStar(require("./lib/media"), exports);
|
|
58
59
|
__exportStar(require("./plugins/comments"), exports);
|
|
@@ -24,6 +24,7 @@ const server_1 = require("react-dom/server");
|
|
|
24
24
|
const commands_1 = require("../commands");
|
|
25
25
|
const popper_1 = require("./popper");
|
|
26
26
|
const position_menu_1 = require("./position-menu");
|
|
27
|
+
const template_1 = require("./template");
|
|
27
28
|
const utils_1 = require("./utils");
|
|
28
29
|
const popper = new popper_1.PopperManager();
|
|
29
30
|
const readonlyTypes = [
|
|
@@ -338,9 +339,13 @@ class ContextMenu {
|
|
|
338
339
|
return $pos.parent.canReplaceWith(index, index, type);
|
|
339
340
|
};
|
|
340
341
|
const checkNode = (node, pos) => {
|
|
342
|
+
if (!(0, template_1.templateAllows)(this.view.state, nodes[node])) {
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
341
345
|
canInsertAt(nodes[node], pos) && insertable.add(node);
|
|
342
346
|
};
|
|
343
|
-
if (canInsertAt(nodes.section, endPos)
|
|
347
|
+
if (canInsertAt(nodes.section, endPos) &&
|
|
348
|
+
(0, template_1.templateAllows)(this.view.state, nodes.section)) {
|
|
344
349
|
insertable.add('subsection');
|
|
345
350
|
}
|
|
346
351
|
checkNode('section', insertPos);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* © 2019 Atypon Systems LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.templateAllows = void 0;
|
|
19
|
+
const editor_props_1 = require("../plugins/editor-props");
|
|
20
|
+
const templateAllows = (state, nodeType) => {
|
|
21
|
+
const props = (0, editor_props_1.getEditorProps)(state);
|
|
22
|
+
const hiddenNodeTypes = props?.hiddenNodeTypes;
|
|
23
|
+
return !hiddenNodeTypes?.length || !hiddenNodeTypes.includes(nodeType);
|
|
24
|
+
};
|
|
25
|
+
exports.templateAllows = templateAllows;
|
package/dist/cjs/menus.js
CHANGED
|
@@ -24,6 +24,7 @@ const InsertTableDialog_1 = require("./components/toolbar/InsertTableDialog");
|
|
|
24
24
|
const ListMenuItem_1 = require("./components/toolbar/ListMenuItem");
|
|
25
25
|
const InsertSpecialCharacter_1 = require("./components/views/InsertSpecialCharacter");
|
|
26
26
|
const hierarchy_1 = require("./lib/hierarchy");
|
|
27
|
+
const template_1 = require("./lib/template");
|
|
27
28
|
const utils_1 = require("./lib/utils");
|
|
28
29
|
const editor_props_1 = require("./plugins/editor-props");
|
|
29
30
|
const getEditorMenus = (editor) => {
|
|
@@ -134,24 +135,28 @@ const getEditorMenus = (editor) => {
|
|
|
134
135
|
label: 'Authors',
|
|
135
136
|
isEnabled: isCommandValid(commands_1.insertContributors),
|
|
136
137
|
run: doCommand(commands_1.insertContributors),
|
|
138
|
+
isHidden: !(0, template_1.templateAllows)(state, transform_1.schema.nodes.contributors),
|
|
137
139
|
},
|
|
138
140
|
{
|
|
139
141
|
id: 'insert-contributors',
|
|
140
142
|
label: 'Affiliations',
|
|
141
143
|
isEnabled: isCommandValid(commands_1.insertAffiliation),
|
|
142
144
|
run: doCommand(commands_1.insertAffiliation),
|
|
145
|
+
isHidden: !(0, template_1.templateAllows)(state, transform_1.schema.nodes.affiliations),
|
|
143
146
|
},
|
|
144
147
|
{
|
|
145
148
|
id: 'insert-awards',
|
|
146
149
|
label: 'Funder Information',
|
|
147
150
|
isEnabled: isCommandValid(commands_1.insertAward),
|
|
148
151
|
run: doCommand(commands_1.insertAward),
|
|
152
|
+
isHidden: !(0, template_1.templateAllows)(state, transform_1.schema.nodes.awards),
|
|
149
153
|
},
|
|
150
154
|
{
|
|
151
155
|
id: 'insert-keywords',
|
|
152
156
|
label: 'Keywords',
|
|
153
157
|
isEnabled: isCommandValid(commands_1.insertKeywords),
|
|
154
158
|
run: doCommand(commands_1.insertKeywords),
|
|
159
|
+
isHidden: !(0, template_1.templateAllows)(state, transform_1.schema.nodes.keywords),
|
|
155
160
|
},
|
|
156
161
|
],
|
|
157
162
|
},
|
|
@@ -160,6 +165,7 @@ const getEditorMenus = (editor) => {
|
|
|
160
165
|
label: 'Author Notes',
|
|
161
166
|
isEnabled: true,
|
|
162
167
|
submenu: categories.map(insertBackmatterSectionMenu),
|
|
168
|
+
isHidden: !(0, template_1.templateAllows)(state, transform_1.schema.nodes.author_notes),
|
|
163
169
|
},
|
|
164
170
|
{
|
|
165
171
|
id: 'insert-section',
|
|
@@ -170,6 +176,7 @@ const getEditorMenus = (editor) => {
|
|
|
170
176
|
},
|
|
171
177
|
isEnabled: (0, utils_1.isEditAllowed)(state) && isCommandValid((0, commands_1.insertSection)()),
|
|
172
178
|
run: doCommand((0, commands_1.insertSection)()),
|
|
179
|
+
isHidden: !(0, template_1.templateAllows)(state, transform_1.schema.nodes.section),
|
|
173
180
|
},
|
|
174
181
|
{
|
|
175
182
|
id: 'insert-subsection',
|
|
@@ -180,6 +187,7 @@ const getEditorMenus = (editor) => {
|
|
|
180
187
|
},
|
|
181
188
|
isEnabled: (0, utils_1.isEditAllowed)(state) && isCommandValid((0, commands_1.insertSection)(true)),
|
|
182
189
|
run: doCommand((0, commands_1.insertSection)(true)),
|
|
190
|
+
isHidden: !(0, template_1.templateAllows)(state, transform_1.schema.nodes.section),
|
|
183
191
|
},
|
|
184
192
|
{
|
|
185
193
|
id: 'insert-paragraph',
|
|
@@ -187,6 +195,7 @@ const getEditorMenus = (editor) => {
|
|
|
187
195
|
isEnabled: (0, utils_1.isEditAllowed)(state) &&
|
|
188
196
|
isCommandValid((0, commands_1.canInsert)(transform_1.schema.nodes.paragraph)),
|
|
189
197
|
run: doCommand((0, commands_1.insertBlock)(transform_1.schema.nodes.paragraph)),
|
|
198
|
+
isHidden: !(0, template_1.templateAllows)(state, transform_1.schema.nodes.paragraph),
|
|
190
199
|
},
|
|
191
200
|
{
|
|
192
201
|
role: 'separator',
|
|
@@ -197,6 +206,7 @@ const getEditorMenus = (editor) => {
|
|
|
197
206
|
isEnabled: (0, utils_1.isEditAllowed)(state) &&
|
|
198
207
|
isCommandValid((0, commands_1.canInsert)(transform_1.schema.nodes.blockquote_element)),
|
|
199
208
|
run: doCommand((0, commands_1.insertBlock)(transform_1.schema.nodes.blockquote_element)),
|
|
209
|
+
isHidden: !(0, template_1.templateAllows)(state, transform_1.schema.nodes.blockquote_element),
|
|
200
210
|
},
|
|
201
211
|
{
|
|
202
212
|
id: 'insert-pullquote',
|
|
@@ -204,6 +214,7 @@ const getEditorMenus = (editor) => {
|
|
|
204
214
|
isEnabled: (0, utils_1.isEditAllowed)(state) &&
|
|
205
215
|
isCommandValid((0, commands_1.canInsert)(transform_1.schema.nodes.pullquote_element)),
|
|
206
216
|
run: doCommand((0, commands_1.insertBlock)(transform_1.schema.nodes.pullquote_element)),
|
|
217
|
+
isHidden: !(0, template_1.templateAllows)(state, transform_1.schema.nodes.pullquote_element),
|
|
207
218
|
},
|
|
208
219
|
{
|
|
209
220
|
role: 'separator',
|
|
@@ -218,6 +229,7 @@ const getEditorMenus = (editor) => {
|
|
|
218
229
|
isEnabled: (0, utils_1.isEditAllowed)(state) &&
|
|
219
230
|
isCommandValid((0, commands_1.canInsert)(transform_1.schema.nodes.box_element)),
|
|
220
231
|
run: doCommand(commands_1.insertBoxElement),
|
|
232
|
+
isHidden: !(0, template_1.templateAllows)(state, transform_1.schema.nodes.box_element),
|
|
221
233
|
},
|
|
222
234
|
{
|
|
223
235
|
id: 'insert-figure-element',
|
|
@@ -229,6 +241,7 @@ const getEditorMenus = (editor) => {
|
|
|
229
241
|
isEnabled: (0, utils_1.isEditAllowed)(state) &&
|
|
230
242
|
isCommandValid((0, commands_1.canInsert)(transform_1.schema.nodes.figure_element)),
|
|
231
243
|
run: doCommand((0, commands_1.insertBlock)(transform_1.schema.nodes.figure_element)),
|
|
244
|
+
isHidden: !(0, template_1.templateAllows)(state, transform_1.schema.nodes.figure_element),
|
|
232
245
|
},
|
|
233
246
|
{
|
|
234
247
|
id: 'insert-image-element',
|
|
@@ -236,12 +249,14 @@ const getEditorMenus = (editor) => {
|
|
|
236
249
|
isEnabled: (0, utils_1.isEditAllowed)(state) &&
|
|
237
250
|
isCommandValid((0, commands_1.canInsert)(transform_1.schema.nodes.image_element)),
|
|
238
251
|
run: doCommand((0, commands_1.insertBlock)(transform_1.schema.nodes.image_element)),
|
|
252
|
+
isHidden: !(0, template_1.templateAllows)(state, transform_1.schema.nodes.image_element),
|
|
239
253
|
},
|
|
240
254
|
{
|
|
241
255
|
id: 'insert-hero-image',
|
|
242
256
|
label: 'Hero Image',
|
|
243
257
|
isEnabled: (0, utils_1.isEditAllowed)(state) && isCommandValid((0, commands_1.insertHeroImage)()),
|
|
244
258
|
run: doCommand((0, commands_1.insertHeroImage)()),
|
|
259
|
+
isHidden: !(0, template_1.templateAllows)(state, transform_1.schema.nodes.hero_image),
|
|
245
260
|
},
|
|
246
261
|
{
|
|
247
262
|
id: 'insert-table-element',
|
|
@@ -253,6 +268,7 @@ const getEditorMenus = (editor) => {
|
|
|
253
268
|
isEnabled: (0, utils_1.isEditAllowed)(state) &&
|
|
254
269
|
isCommandValid((0, commands_1.canInsert)(transform_1.schema.nodes.table_element)),
|
|
255
270
|
run: () => (0, InsertTableDialog_1.openInsertTableDialog)(editor.state, editor.dispatch),
|
|
271
|
+
isHidden: !(0, template_1.templateAllows)(state, transform_1.schema.nodes.table_element),
|
|
256
272
|
},
|
|
257
273
|
{
|
|
258
274
|
role: 'separator',
|
|
@@ -263,6 +279,7 @@ const getEditorMenus = (editor) => {
|
|
|
263
279
|
isActive: (0, commands_1.blockActive)(transform_1.schema.nodes.embed)(state),
|
|
264
280
|
isEnabled: (0, utils_1.isEditAllowed)(state) && isCommandValid((0, commands_1.canInsert)(transform_1.schema.nodes.embed)),
|
|
265
281
|
run: doCommand(commands_1.insertEmbed),
|
|
282
|
+
isHidden: !(0, template_1.templateAllows)(state, transform_1.schema.nodes.embed),
|
|
266
283
|
},
|
|
267
284
|
{
|
|
268
285
|
id: 'insert-link',
|
|
@@ -274,6 +291,7 @@ const getEditorMenus = (editor) => {
|
|
|
274
291
|
isActive: (0, commands_1.blockActive)(transform_1.schema.nodes.link)(state),
|
|
275
292
|
isEnabled: (0, utils_1.isEditAllowed)(state) && isCommandValid((0, commands_1.canInsert)(transform_1.schema.nodes.link)),
|
|
276
293
|
run: doCommand(commands_1.insertLink),
|
|
294
|
+
isHidden: !(0, template_1.templateAllows)(state, transform_1.schema.nodes.link),
|
|
277
295
|
},
|
|
278
296
|
{
|
|
279
297
|
role: 'separator',
|
|
@@ -288,6 +306,7 @@ const getEditorMenus = (editor) => {
|
|
|
288
306
|
isEnabled: (0, utils_1.isEditAllowed)(state) &&
|
|
289
307
|
isCommandValid((0, commands_1.canInsert)(transform_1.schema.nodes.equation_element)),
|
|
290
308
|
run: doCommand((0, commands_1.insertBlock)(transform_1.schema.nodes.equation_element)),
|
|
309
|
+
isHidden: !(0, template_1.templateAllows)(state, transform_1.schema.nodes.equation_element),
|
|
291
310
|
},
|
|
292
311
|
{
|
|
293
312
|
id: 'insert-inline-equation',
|
|
@@ -299,6 +318,7 @@ const getEditorMenus = (editor) => {
|
|
|
299
318
|
isEnabled: (0, utils_1.isEditAllowed)(state) &&
|
|
300
319
|
isCommandValid((0, commands_1.canInsert)(transform_1.schema.nodes.inline_equation)),
|
|
301
320
|
run: doCommand(commands_1.insertInlineEquation),
|
|
321
|
+
isHidden: !(0, template_1.templateAllows)(state, transform_1.schema.nodes.inline_equation),
|
|
302
322
|
},
|
|
303
323
|
{
|
|
304
324
|
role: 'separator',
|
|
@@ -313,6 +333,7 @@ const getEditorMenus = (editor) => {
|
|
|
313
333
|
isEnabled: (0, utils_1.isEditAllowed)(state) &&
|
|
314
334
|
isCommandValid((0, commands_1.canInsert)(transform_1.schema.nodes.citation)),
|
|
315
335
|
run: doCommand(commands_1.insertInlineCitation),
|
|
336
|
+
isHidden: !(0, template_1.templateAllows)(state, transform_1.schema.nodes.citation),
|
|
316
337
|
},
|
|
317
338
|
{
|
|
318
339
|
id: 'insert-cross-reference',
|
|
@@ -324,6 +345,7 @@ const getEditorMenus = (editor) => {
|
|
|
324
345
|
isEnabled: (0, utils_1.isEditAllowed)(state) &&
|
|
325
346
|
isCommandValid((0, commands_1.canInsert)(transform_1.schema.nodes.cross_reference)),
|
|
326
347
|
run: doCommand(commands_1.insertCrossReference),
|
|
348
|
+
isHidden: !(0, template_1.templateAllows)(state, transform_1.schema.nodes.cross_reference),
|
|
327
349
|
},
|
|
328
350
|
{
|
|
329
351
|
id: 'insert-footnote',
|
|
@@ -335,18 +357,21 @@ const getEditorMenus = (editor) => {
|
|
|
335
357
|
isEnabled: (0, utils_1.isEditAllowed)(state) &&
|
|
336
358
|
isCommandValid((0, commands_1.canInsert)(transform_1.schema.nodes.inline_footnote)),
|
|
337
359
|
run: doCommand(commands_1.insertInlineFootnote),
|
|
360
|
+
isHidden: !(0, template_1.templateAllows)(state, transform_1.schema.nodes.inline_footnote),
|
|
338
361
|
},
|
|
339
362
|
{
|
|
340
363
|
id: 'insert-special-character',
|
|
341
364
|
label: 'Special Characters',
|
|
342
365
|
isEnabled: (0, utils_1.isEditAllowed)(state) && isCommandValid((0, commands_1.canInsert)(transform_1.schema.nodes.text)),
|
|
343
366
|
run: () => (0, InsertSpecialCharacter_1.openInsertSpecialCharacterDialog)(editor.view),
|
|
367
|
+
isHidden: !(0, template_1.templateAllows)(state, transform_1.schema.nodes.text),
|
|
344
368
|
},
|
|
345
369
|
{
|
|
346
370
|
id: 'insert-comment',
|
|
347
371
|
label: 'Comment',
|
|
348
372
|
isEnabled: (0, utils_1.isEditAllowed)(state) && isCommandValid(commands_1.addInlineComment),
|
|
349
373
|
run: doCommand(commands_1.addInlineComment),
|
|
374
|
+
isHidden: !(0, template_1.templateAllows)(state, transform_1.schema.nodes.comment),
|
|
350
375
|
},
|
|
351
376
|
],
|
|
352
377
|
};
|
package/dist/cjs/versions.js
CHANGED
|
@@ -60,6 +60,15 @@ class FigureEditableView extends figure_1.FigureView {
|
|
|
60
60
|
this.upload = this.upload.bind(this);
|
|
61
61
|
this.createDOM();
|
|
62
62
|
this.updateContents();
|
|
63
|
+
const domElement = this.dom;
|
|
64
|
+
domElement.__figureView = this;
|
|
65
|
+
}
|
|
66
|
+
update(newNode) {
|
|
67
|
+
const handledBySuper = super.update(newNode);
|
|
68
|
+
if (handledBySuper) {
|
|
69
|
+
this.addTools();
|
|
70
|
+
}
|
|
71
|
+
return handledBySuper;
|
|
63
72
|
}
|
|
64
73
|
clearTargetClass(target, classes = ['drop-target-above', 'drop-target-below']) {
|
|
65
74
|
target.classList.remove(...classes);
|
|
@@ -191,11 +200,14 @@ class FigureEditableView extends figure_1.FigureView {
|
|
|
191
200
|
}
|
|
192
201
|
addTools() {
|
|
193
202
|
this.manageReactTools();
|
|
203
|
+
const existingDragHandlers = this.container.querySelectorAll('.drag-handler');
|
|
204
|
+
existingDragHandlers.forEach((handler) => handler.remove());
|
|
194
205
|
const $pos = this.view.state.doc.resolve(this.getPos());
|
|
195
206
|
const parent = $pos.parent;
|
|
196
207
|
if (this.props.getCapabilities()?.editArticle &&
|
|
197
208
|
parent.type === transform_1.schema.nodes.figure_element &&
|
|
198
|
-
!(0, track_changes_utils_1.isDeleted)(this.node)
|
|
209
|
+
!(0, track_changes_utils_1.isDeleted)(this.node) &&
|
|
210
|
+
this.countFigures() > 1) {
|
|
199
211
|
const dragHandle = document.createElement('div');
|
|
200
212
|
dragHandle.className = 'drag-handler';
|
|
201
213
|
dragHandle.innerHTML = icons_1.draggableIcon;
|
|
@@ -118,10 +118,20 @@ class FigureElementView extends image_element_1.ImageElementView {
|
|
|
118
118
|
requestAnimationFrame(() => {
|
|
119
119
|
this.updateButtonPosition();
|
|
120
120
|
this.updateAddButtonState();
|
|
121
|
+
this.updateChildDragHandlers();
|
|
121
122
|
});
|
|
122
123
|
}
|
|
123
124
|
return handledBySuper;
|
|
124
125
|
}
|
|
126
|
+
updateChildDragHandlers() {
|
|
127
|
+
const dragHandlers = this.container.querySelectorAll('.drag-handler');
|
|
128
|
+
dragHandlers.forEach((handler) => handler.remove());
|
|
129
|
+
const figureElements = this.container.querySelectorAll('figure');
|
|
130
|
+
figureElements.forEach((figureElement) => {
|
|
131
|
+
const figureView = figureElement.__figureView;
|
|
132
|
+
figureView?.addTools();
|
|
133
|
+
});
|
|
134
|
+
}
|
|
125
135
|
updateContents() {
|
|
126
136
|
super.updateContents();
|
|
127
137
|
requestAnimationFrame(() => {
|
package/dist/es/commands.js
CHANGED
|
@@ -26,6 +26,7 @@ import { getCommentKey, getCommentRange } from './lib/comments';
|
|
|
26
26
|
import { findAbstractsNode, findBackmatter, findBibliographySection, findBody, findFootnotesSection, insertAttachmentsNode, insertAwardsNode, insertFootnotesSection, insertSupplementsNode, } from './lib/doc';
|
|
27
27
|
import { createFootnote, findFootnotesContainerNode, getFootnotesElementState, } from './lib/footnotes';
|
|
28
28
|
import { findWordBoundaries, isNodeOfType, nearestAncestor, } from './lib/helpers';
|
|
29
|
+
import { templateAllows } from './lib/template';
|
|
29
30
|
import { isDeleted } from './lib/track-changes-utils';
|
|
30
31
|
import { findParentNodeWithId, getChildOfType, getInsertPos, getLastTitleNode, isBodyLocked, } from './lib/utils';
|
|
31
32
|
import { expandAccessibilitySection } from './plugins/accessibility_element';
|
|
@@ -85,6 +86,9 @@ export const blockActive = (type) => (state) => {
|
|
|
85
86
|
};
|
|
86
87
|
export const canInsert = (type) => (state) => {
|
|
87
88
|
const { $from, $to } = state.selection;
|
|
89
|
+
if (!templateAllows(state, type)) {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
88
92
|
if (($from.node().type === schema.nodes.title ||
|
|
89
93
|
$from.node().type === schema.nodes.section_title) &&
|
|
90
94
|
$from.pos === $to.pos &&
|
|
@@ -300,6 +304,9 @@ export const insertAttachment = (file, state, type, dispatch) => {
|
|
|
300
304
|
return true;
|
|
301
305
|
};
|
|
302
306
|
export const insertBlock = (nodeType) => (state, dispatch) => {
|
|
307
|
+
if (!canInsert(nodeType)(state)) {
|
|
308
|
+
return false;
|
|
309
|
+
}
|
|
303
310
|
const position = findBlockInsertPosition(state);
|
|
304
311
|
if (position === null) {
|
|
305
312
|
return false;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import 'prosemirror-view/style/prosemirror.css';
|
|
17
|
-
import { schema } from '@manuscripts/transform';
|
|
17
|
+
import { schema, } from '@manuscripts/transform';
|
|
18
18
|
import { EditorState } from 'prosemirror-state';
|
|
19
19
|
import { EditorView } from 'prosemirror-view';
|
|
20
20
|
import { clipboardParser } from '../clipboard';
|
package/dist/es/index.js
CHANGED
|
@@ -27,6 +27,7 @@ export * from './toolbar';
|
|
|
27
27
|
export * from './lib/comments';
|
|
28
28
|
export * from './lib/files';
|
|
29
29
|
export * from './lib/footnotes';
|
|
30
|
+
export * from './lib/template';
|
|
30
31
|
export * from './lib/doc';
|
|
31
32
|
export * from './lib/media';
|
|
32
33
|
export * from './plugins/comments';
|
|
@@ -21,6 +21,7 @@ import { renderToStaticMarkup } from 'react-dom/server';
|
|
|
21
21
|
import { addNodeComment, createBlock, findPosBeforeFirstSubsection, insertGeneralTableFootnote, insertInlineTableFootnote, isCommentingAllowed, } from '../commands';
|
|
22
22
|
import { PopperManager } from './popper';
|
|
23
23
|
import { createPositionOptions } from './position-menu';
|
|
24
|
+
import { templateAllows } from './template';
|
|
24
25
|
import { getMatchingChild, isChildOfNodeTypes, isSelectionInNode, } from './utils';
|
|
25
26
|
const popper = new PopperManager();
|
|
26
27
|
const readonlyTypes = [
|
|
@@ -334,9 +335,13 @@ export class ContextMenu {
|
|
|
334
335
|
return $pos.parent.canReplaceWith(index, index, type);
|
|
335
336
|
};
|
|
336
337
|
const checkNode = (node, pos) => {
|
|
338
|
+
if (!templateAllows(this.view.state, nodes[node])) {
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
337
341
|
canInsertAt(nodes[node], pos) && insertable.add(node);
|
|
338
342
|
};
|
|
339
|
-
if (canInsertAt(nodes.section, endPos)
|
|
343
|
+
if (canInsertAt(nodes.section, endPos) &&
|
|
344
|
+
templateAllows(this.view.state, nodes.section)) {
|
|
340
345
|
insertable.add('subsection');
|
|
341
346
|
}
|
|
342
347
|
checkNode('section', insertPos);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { getEditorProps } from '../plugins/editor-props';
|
|
17
|
+
export const templateAllows = (state, nodeType) => {
|
|
18
|
+
const props = getEditorProps(state);
|
|
19
|
+
const hiddenNodeTypes = props?.hiddenNodeTypes;
|
|
20
|
+
return !hiddenNodeTypes?.length || !hiddenNodeTypes.includes(nodeType);
|
|
21
|
+
};
|
package/dist/es/menus.js
CHANGED
|
@@ -21,6 +21,7 @@ import { openInsertTableDialog } from './components/toolbar/InsertTableDialog';
|
|
|
21
21
|
import { ListMenuItem } from './components/toolbar/ListMenuItem';
|
|
22
22
|
import { openInsertSpecialCharacterDialog } from './components/views/InsertSpecialCharacter';
|
|
23
23
|
import { deleteClosestParentElement, findClosestParentElementNodeName, } from './lib/hierarchy';
|
|
24
|
+
import { templateAllows } from './lib/template';
|
|
24
25
|
import { isEditAllowed } from './lib/utils';
|
|
25
26
|
import { getEditorProps } from './plugins/editor-props';
|
|
26
27
|
export const getEditorMenus = (editor) => {
|
|
@@ -131,24 +132,28 @@ export const getEditorMenus = (editor) => {
|
|
|
131
132
|
label: 'Authors',
|
|
132
133
|
isEnabled: isCommandValid(insertContributors),
|
|
133
134
|
run: doCommand(insertContributors),
|
|
135
|
+
isHidden: !templateAllows(state, schema.nodes.contributors),
|
|
134
136
|
},
|
|
135
137
|
{
|
|
136
138
|
id: 'insert-contributors',
|
|
137
139
|
label: 'Affiliations',
|
|
138
140
|
isEnabled: isCommandValid(insertAffiliation),
|
|
139
141
|
run: doCommand(insertAffiliation),
|
|
142
|
+
isHidden: !templateAllows(state, schema.nodes.affiliations),
|
|
140
143
|
},
|
|
141
144
|
{
|
|
142
145
|
id: 'insert-awards',
|
|
143
146
|
label: 'Funder Information',
|
|
144
147
|
isEnabled: isCommandValid(insertAward),
|
|
145
148
|
run: doCommand(insertAward),
|
|
149
|
+
isHidden: !templateAllows(state, schema.nodes.awards),
|
|
146
150
|
},
|
|
147
151
|
{
|
|
148
152
|
id: 'insert-keywords',
|
|
149
153
|
label: 'Keywords',
|
|
150
154
|
isEnabled: isCommandValid(insertKeywords),
|
|
151
155
|
run: doCommand(insertKeywords),
|
|
156
|
+
isHidden: !templateAllows(state, schema.nodes.keywords),
|
|
152
157
|
},
|
|
153
158
|
],
|
|
154
159
|
},
|
|
@@ -157,6 +162,7 @@ export const getEditorMenus = (editor) => {
|
|
|
157
162
|
label: 'Author Notes',
|
|
158
163
|
isEnabled: true,
|
|
159
164
|
submenu: categories.map(insertBackmatterSectionMenu),
|
|
165
|
+
isHidden: !templateAllows(state, schema.nodes.author_notes),
|
|
160
166
|
},
|
|
161
167
|
{
|
|
162
168
|
id: 'insert-section',
|
|
@@ -167,6 +173,7 @@ export const getEditorMenus = (editor) => {
|
|
|
167
173
|
},
|
|
168
174
|
isEnabled: isEditAllowed(state) && isCommandValid(insertSection()),
|
|
169
175
|
run: doCommand(insertSection()),
|
|
176
|
+
isHidden: !templateAllows(state, schema.nodes.section),
|
|
170
177
|
},
|
|
171
178
|
{
|
|
172
179
|
id: 'insert-subsection',
|
|
@@ -177,6 +184,7 @@ export const getEditorMenus = (editor) => {
|
|
|
177
184
|
},
|
|
178
185
|
isEnabled: isEditAllowed(state) && isCommandValid(insertSection(true)),
|
|
179
186
|
run: doCommand(insertSection(true)),
|
|
187
|
+
isHidden: !templateAllows(state, schema.nodes.section),
|
|
180
188
|
},
|
|
181
189
|
{
|
|
182
190
|
id: 'insert-paragraph',
|
|
@@ -184,6 +192,7 @@ export const getEditorMenus = (editor) => {
|
|
|
184
192
|
isEnabled: isEditAllowed(state) &&
|
|
185
193
|
isCommandValid(canInsert(schema.nodes.paragraph)),
|
|
186
194
|
run: doCommand(insertBlock(schema.nodes.paragraph)),
|
|
195
|
+
isHidden: !templateAllows(state, schema.nodes.paragraph),
|
|
187
196
|
},
|
|
188
197
|
{
|
|
189
198
|
role: 'separator',
|
|
@@ -194,6 +203,7 @@ export const getEditorMenus = (editor) => {
|
|
|
194
203
|
isEnabled: isEditAllowed(state) &&
|
|
195
204
|
isCommandValid(canInsert(schema.nodes.blockquote_element)),
|
|
196
205
|
run: doCommand(insertBlock(schema.nodes.blockquote_element)),
|
|
206
|
+
isHidden: !templateAllows(state, schema.nodes.blockquote_element),
|
|
197
207
|
},
|
|
198
208
|
{
|
|
199
209
|
id: 'insert-pullquote',
|
|
@@ -201,6 +211,7 @@ export const getEditorMenus = (editor) => {
|
|
|
201
211
|
isEnabled: isEditAllowed(state) &&
|
|
202
212
|
isCommandValid(canInsert(schema.nodes.pullquote_element)),
|
|
203
213
|
run: doCommand(insertBlock(schema.nodes.pullquote_element)),
|
|
214
|
+
isHidden: !templateAllows(state, schema.nodes.pullquote_element),
|
|
204
215
|
},
|
|
205
216
|
{
|
|
206
217
|
role: 'separator',
|
|
@@ -215,6 +226,7 @@ export const getEditorMenus = (editor) => {
|
|
|
215
226
|
isEnabled: isEditAllowed(state) &&
|
|
216
227
|
isCommandValid(canInsert(schema.nodes.box_element)),
|
|
217
228
|
run: doCommand(insertBoxElement),
|
|
229
|
+
isHidden: !templateAllows(state, schema.nodes.box_element),
|
|
218
230
|
},
|
|
219
231
|
{
|
|
220
232
|
id: 'insert-figure-element',
|
|
@@ -226,6 +238,7 @@ export const getEditorMenus = (editor) => {
|
|
|
226
238
|
isEnabled: isEditAllowed(state) &&
|
|
227
239
|
isCommandValid(canInsert(schema.nodes.figure_element)),
|
|
228
240
|
run: doCommand(insertBlock(schema.nodes.figure_element)),
|
|
241
|
+
isHidden: !templateAllows(state, schema.nodes.figure_element),
|
|
229
242
|
},
|
|
230
243
|
{
|
|
231
244
|
id: 'insert-image-element',
|
|
@@ -233,12 +246,14 @@ export const getEditorMenus = (editor) => {
|
|
|
233
246
|
isEnabled: isEditAllowed(state) &&
|
|
234
247
|
isCommandValid(canInsert(schema.nodes.image_element)),
|
|
235
248
|
run: doCommand(insertBlock(schema.nodes.image_element)),
|
|
249
|
+
isHidden: !templateAllows(state, schema.nodes.image_element),
|
|
236
250
|
},
|
|
237
251
|
{
|
|
238
252
|
id: 'insert-hero-image',
|
|
239
253
|
label: 'Hero Image',
|
|
240
254
|
isEnabled: isEditAllowed(state) && isCommandValid(insertHeroImage()),
|
|
241
255
|
run: doCommand(insertHeroImage()),
|
|
256
|
+
isHidden: !templateAllows(state, schema.nodes.hero_image),
|
|
242
257
|
},
|
|
243
258
|
{
|
|
244
259
|
id: 'insert-table-element',
|
|
@@ -250,6 +265,7 @@ export const getEditorMenus = (editor) => {
|
|
|
250
265
|
isEnabled: isEditAllowed(state) &&
|
|
251
266
|
isCommandValid(canInsert(schema.nodes.table_element)),
|
|
252
267
|
run: () => openInsertTableDialog(editor.state, editor.dispatch),
|
|
268
|
+
isHidden: !templateAllows(state, schema.nodes.table_element),
|
|
253
269
|
},
|
|
254
270
|
{
|
|
255
271
|
role: 'separator',
|
|
@@ -260,6 +276,7 @@ export const getEditorMenus = (editor) => {
|
|
|
260
276
|
isActive: blockActive(schema.nodes.embed)(state),
|
|
261
277
|
isEnabled: isEditAllowed(state) && isCommandValid(canInsert(schema.nodes.embed)),
|
|
262
278
|
run: doCommand(insertEmbed),
|
|
279
|
+
isHidden: !templateAllows(state, schema.nodes.embed),
|
|
263
280
|
},
|
|
264
281
|
{
|
|
265
282
|
id: 'insert-link',
|
|
@@ -271,6 +288,7 @@ export const getEditorMenus = (editor) => {
|
|
|
271
288
|
isActive: blockActive(schema.nodes.link)(state),
|
|
272
289
|
isEnabled: isEditAllowed(state) && isCommandValid(canInsert(schema.nodes.link)),
|
|
273
290
|
run: doCommand(insertLink),
|
|
291
|
+
isHidden: !templateAllows(state, schema.nodes.link),
|
|
274
292
|
},
|
|
275
293
|
{
|
|
276
294
|
role: 'separator',
|
|
@@ -285,6 +303,7 @@ export const getEditorMenus = (editor) => {
|
|
|
285
303
|
isEnabled: isEditAllowed(state) &&
|
|
286
304
|
isCommandValid(canInsert(schema.nodes.equation_element)),
|
|
287
305
|
run: doCommand(insertBlock(schema.nodes.equation_element)),
|
|
306
|
+
isHidden: !templateAllows(state, schema.nodes.equation_element),
|
|
288
307
|
},
|
|
289
308
|
{
|
|
290
309
|
id: 'insert-inline-equation',
|
|
@@ -296,6 +315,7 @@ export const getEditorMenus = (editor) => {
|
|
|
296
315
|
isEnabled: isEditAllowed(state) &&
|
|
297
316
|
isCommandValid(canInsert(schema.nodes.inline_equation)),
|
|
298
317
|
run: doCommand(insertInlineEquation),
|
|
318
|
+
isHidden: !templateAllows(state, schema.nodes.inline_equation),
|
|
299
319
|
},
|
|
300
320
|
{
|
|
301
321
|
role: 'separator',
|
|
@@ -310,6 +330,7 @@ export const getEditorMenus = (editor) => {
|
|
|
310
330
|
isEnabled: isEditAllowed(state) &&
|
|
311
331
|
isCommandValid(canInsert(schema.nodes.citation)),
|
|
312
332
|
run: doCommand(insertInlineCitation),
|
|
333
|
+
isHidden: !templateAllows(state, schema.nodes.citation),
|
|
313
334
|
},
|
|
314
335
|
{
|
|
315
336
|
id: 'insert-cross-reference',
|
|
@@ -321,6 +342,7 @@ export const getEditorMenus = (editor) => {
|
|
|
321
342
|
isEnabled: isEditAllowed(state) &&
|
|
322
343
|
isCommandValid(canInsert(schema.nodes.cross_reference)),
|
|
323
344
|
run: doCommand(insertCrossReference),
|
|
345
|
+
isHidden: !templateAllows(state, schema.nodes.cross_reference),
|
|
324
346
|
},
|
|
325
347
|
{
|
|
326
348
|
id: 'insert-footnote',
|
|
@@ -332,18 +354,21 @@ export const getEditorMenus = (editor) => {
|
|
|
332
354
|
isEnabled: isEditAllowed(state) &&
|
|
333
355
|
isCommandValid(canInsert(schema.nodes.inline_footnote)),
|
|
334
356
|
run: doCommand(insertInlineFootnote),
|
|
357
|
+
isHidden: !templateAllows(state, schema.nodes.inline_footnote),
|
|
335
358
|
},
|
|
336
359
|
{
|
|
337
360
|
id: 'insert-special-character',
|
|
338
361
|
label: 'Special Characters',
|
|
339
362
|
isEnabled: isEditAllowed(state) && isCommandValid(canInsert(schema.nodes.text)),
|
|
340
363
|
run: () => openInsertSpecialCharacterDialog(editor.view),
|
|
364
|
+
isHidden: !templateAllows(state, schema.nodes.text),
|
|
341
365
|
},
|
|
342
366
|
{
|
|
343
367
|
id: 'insert-comment',
|
|
344
368
|
label: 'Comment',
|
|
345
369
|
isEnabled: isEditAllowed(state) && isCommandValid(addInlineComment),
|
|
346
370
|
run: doCommand(addInlineComment),
|
|
371
|
+
isHidden: !templateAllows(state, schema.nodes.comment),
|
|
347
372
|
},
|
|
348
373
|
],
|
|
349
374
|
};
|
package/dist/es/versions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '3.4.
|
|
1
|
+
export const VERSION = '3.4.6';
|
|
2
2
|
export const MATHJAX_VERSION = '3.2.2';
|
|
@@ -57,6 +57,15 @@ export class FigureEditableView extends FigureView {
|
|
|
57
57
|
this.upload = this.upload.bind(this);
|
|
58
58
|
this.createDOM();
|
|
59
59
|
this.updateContents();
|
|
60
|
+
const domElement = this.dom;
|
|
61
|
+
domElement.__figureView = this;
|
|
62
|
+
}
|
|
63
|
+
update(newNode) {
|
|
64
|
+
const handledBySuper = super.update(newNode);
|
|
65
|
+
if (handledBySuper) {
|
|
66
|
+
this.addTools();
|
|
67
|
+
}
|
|
68
|
+
return handledBySuper;
|
|
60
69
|
}
|
|
61
70
|
clearTargetClass(target, classes = ['drop-target-above', 'drop-target-below']) {
|
|
62
71
|
target.classList.remove(...classes);
|
|
@@ -188,11 +197,14 @@ export class FigureEditableView extends FigureView {
|
|
|
188
197
|
}
|
|
189
198
|
addTools() {
|
|
190
199
|
this.manageReactTools();
|
|
200
|
+
const existingDragHandlers = this.container.querySelectorAll('.drag-handler');
|
|
201
|
+
existingDragHandlers.forEach((handler) => handler.remove());
|
|
191
202
|
const $pos = this.view.state.doc.resolve(this.getPos());
|
|
192
203
|
const parent = $pos.parent;
|
|
193
204
|
if (this.props.getCapabilities()?.editArticle &&
|
|
194
205
|
parent.type === schema.nodes.figure_element &&
|
|
195
|
-
!isDeleted(this.node)
|
|
206
|
+
!isDeleted(this.node) &&
|
|
207
|
+
this.countFigures() > 1) {
|
|
196
208
|
const dragHandle = document.createElement('div');
|
|
197
209
|
dragHandle.className = 'drag-handler';
|
|
198
210
|
dragHandle.innerHTML = draggableIcon;
|
|
@@ -115,10 +115,20 @@ export class FigureElementView extends ImageElementView {
|
|
|
115
115
|
requestAnimationFrame(() => {
|
|
116
116
|
this.updateButtonPosition();
|
|
117
117
|
this.updateAddButtonState();
|
|
118
|
+
this.updateChildDragHandlers();
|
|
118
119
|
});
|
|
119
120
|
}
|
|
120
121
|
return handledBySuper;
|
|
121
122
|
}
|
|
123
|
+
updateChildDragHandlers() {
|
|
124
|
+
const dragHandlers = this.container.querySelectorAll('.drag-handler');
|
|
125
|
+
dragHandlers.forEach((handler) => handler.remove());
|
|
126
|
+
const figureElements = this.container.querySelectorAll('figure');
|
|
127
|
+
figureElements.forEach((figureElement) => {
|
|
128
|
+
const figureView = figureElement.__figureView;
|
|
129
|
+
figureView?.addTools();
|
|
130
|
+
});
|
|
131
|
+
}
|
|
122
132
|
updateContents() {
|
|
123
133
|
super.updateContents();
|
|
124
134
|
requestAnimationFrame(() => {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import 'prosemirror-view/style/prosemirror.css';
|
|
17
17
|
import { UserProfile } from '@manuscripts/json-schema';
|
|
18
18
|
import { Capabilities } from '@manuscripts/style-guide';
|
|
19
|
-
import { ManuscriptNode, SectionCategory } from '@manuscripts/transform';
|
|
19
|
+
import { ManuscriptNode, ManuscriptNodeType, SectionCategory } from '@manuscripts/transform';
|
|
20
20
|
import { EditorState } from 'prosemirror-state';
|
|
21
21
|
import { EditorView } from 'prosemirror-view';
|
|
22
22
|
import { Location, NavigateFunction } from 'react-router-dom';
|
|
@@ -54,6 +54,7 @@ export interface EditorProps {
|
|
|
54
54
|
onEditorClick: (pos: number, node: ManuscriptNode, nodePos: number, event: MouseEvent) => void;
|
|
55
55
|
lockBody: boolean;
|
|
56
56
|
isViewingMode?: boolean;
|
|
57
|
+
hiddenNodeTypes?: ManuscriptNodeType[] | undefined;
|
|
57
58
|
}
|
|
58
59
|
export type ExternalProps = Omit<EditorProps, 'popper' | 'dispatch'>;
|
|
59
60
|
export declare const createEditorState: (props: EditorProps) => EditorState;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ export * from './toolbar';
|
|
|
28
28
|
export * from './lib/comments';
|
|
29
29
|
export * from './lib/files';
|
|
30
30
|
export * from './lib/footnotes';
|
|
31
|
+
export * from './lib/template';
|
|
31
32
|
export * from './lib/doc';
|
|
32
33
|
export * from './lib/media';
|
|
33
34
|
export * from './plugins/comments';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { ManuscriptNodeType } from '@manuscripts/transform';
|
|
17
|
+
import { EditorState } from 'prosemirror-state';
|
|
18
|
+
export declare const templateAllows: (state: EditorState, nodeType: ManuscriptNodeType) => boolean;
|
package/dist/types/versions.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "3.4.
|
|
1
|
+
export declare const VERSION = "3.4.6";
|
|
2
2
|
export declare const MATHJAX_VERSION = "3.2.2";
|
|
@@ -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 { ManuscriptNode } from '@manuscripts/transform';
|
|
16
17
|
import { FigureView } from './figure';
|
|
17
18
|
export declare class FigureEditableView extends FigureView {
|
|
18
19
|
reactTools: HTMLDivElement | null;
|
|
@@ -22,6 +23,7 @@ export declare class FigureEditableView extends FigureView {
|
|
|
22
23
|
private static currentDragFigureId;
|
|
23
24
|
private dragAndDropInitialized;
|
|
24
25
|
initialise(): void;
|
|
26
|
+
update(newNode: ManuscriptNode): boolean;
|
|
25
27
|
private clearTargetClass;
|
|
26
28
|
private handleDragStart;
|
|
27
29
|
private setupDragAndDrop;
|
|
@@ -29,7 +31,7 @@ export declare class FigureEditableView extends FigureView {
|
|
|
29
31
|
private moveFigure;
|
|
30
32
|
upload: (file: File) => Promise<void>;
|
|
31
33
|
updateContents(): void;
|
|
32
|
-
|
|
34
|
+
addTools(): void;
|
|
33
35
|
countFigures(): number;
|
|
34
36
|
private manageReactTools;
|
|
35
37
|
protected setSrc: (src: string) => void;
|
|
@@ -26,6 +26,7 @@ export declare class FigureElementView extends ImageElementView {
|
|
|
26
26
|
private updateButtonPosition;
|
|
27
27
|
private updateAddButtonState;
|
|
28
28
|
update(node: Node): boolean;
|
|
29
|
+
private updateChildDragHandlers;
|
|
29
30
|
updateContents(): void;
|
|
30
31
|
private addFigure;
|
|
31
32
|
destroy(): 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": "3.4.
|
|
4
|
+
"version": "3.4.6",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
"@cospired/i18n-iso-languages": "^4.2.0",
|
|
40
40
|
"@iarna/word-count": "1.1.2",
|
|
41
41
|
"@manuscripts/json-schema": "2.2.12",
|
|
42
|
-
"@manuscripts/style-guide": "3.2.
|
|
42
|
+
"@manuscripts/style-guide": "3.2.4",
|
|
43
43
|
"@manuscripts/track-changes-plugin": "2.0.10",
|
|
44
|
-
"@manuscripts/transform": "4.2.
|
|
44
|
+
"@manuscripts/transform": "4.2.14",
|
|
45
45
|
"@popperjs/core": "2.11.8",
|
|
46
46
|
"citeproc": "2.4.63",
|
|
47
47
|
"codemirror": "5.65.19",
|