@manuscripts/body-editor 1.6.10 → 1.6.12

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.
Files changed (95) hide show
  1. package/dist/cjs/commands.js +57 -1
  2. package/dist/cjs/components/toolbar/LevelSelector.js +2 -2
  3. package/dist/cjs/index.js +4 -9
  4. package/dist/cjs/keys/list.js +9 -9
  5. package/dist/cjs/lib/context-menu.js +81 -163
  6. package/dist/cjs/menus.js +353 -405
  7. package/dist/cjs/toolbar.js +30 -34
  8. package/dist/cjs/views/editable_block.js +12 -4
  9. package/dist/es/commands.js +57 -2
  10. package/dist/es/components/toolbar/LevelSelector.js +2 -2
  11. package/dist/es/index.js +2 -4
  12. package/dist/es/keys/list.js +7 -7
  13. package/dist/es/lib/context-menu.js +81 -163
  14. package/dist/es/menus.js +353 -405
  15. package/dist/es/toolbar.js +31 -35
  16. package/dist/es/views/editable_block.js +13 -5
  17. package/dist/types/commands.d.ts +1 -0
  18. package/dist/types/components/toolbar/LevelSelector.d.ts +2 -2
  19. package/dist/types/configs/editor-views.d.ts +14 -14
  20. package/dist/types/index.d.ts +2 -4
  21. package/dist/types/keys/list.d.ts +1 -1
  22. package/dist/types/lib/context-menu.d.ts +0 -7
  23. package/dist/types/menus.d.ts +2 -3
  24. package/dist/types/toolbar.d.ts +18 -1
  25. package/dist/types/views/bibliography_element_editable.d.ts +1 -1
  26. package/dist/types/views/blockquote_element_editable.d.ts +1 -1
  27. package/dist/types/views/bullet_list_editable.d.ts +1 -1
  28. package/dist/types/views/editable_block.d.ts +1 -1
  29. package/dist/types/views/equation_element_editable.d.ts +1 -1
  30. package/dist/types/views/figure_element_editable.d.ts +1 -1
  31. package/dist/types/views/footnote_editable.d.ts +1 -1
  32. package/dist/types/views/footnotes_element_editable.d.ts +1 -1
  33. package/dist/types/views/listing_element_editable.d.ts +1 -1
  34. package/dist/types/views/ordered_list_editable.d.ts +1 -1
  35. package/dist/types/views/paragraph_editable.d.ts +1 -1
  36. package/dist/types/views/placeholder_element_editable.d.ts +1 -1
  37. package/dist/types/views/pullquote_element_editable.d.ts +1 -1
  38. package/dist/types/views/section_title_editable.d.ts +1 -1
  39. package/dist/types/views/table_element_editable.d.ts +1 -1
  40. package/dist/types/views/toc_element_editable.d.ts +1 -1
  41. package/package.json +3 -5
  42. package/dist/cjs/components/application-menu/ApplicationMenu.js +0 -63
  43. package/dist/cjs/components/application-menu/MenuItemContainer.js +0 -127
  44. package/dist/cjs/components/application-menu/Shortcut.js +0 -63
  45. package/dist/cjs/components/application-menu/index.js +0 -22
  46. package/dist/cjs/components/application-menu/menuState.js +0 -49
  47. package/dist/cjs/components/application-menu/types.js +0 -17
  48. package/dist/cjs/components/application-menu/useApplicationMenus.js +0 -154
  49. package/dist/cjs/components/dialog/TableCellBorderOptions.js +0 -64
  50. package/dist/cjs/components/dialog/TableCellOptions.js +0 -50
  51. package/dist/cjs/components/dialog/TableOptions.js +0 -31
  52. package/dist/cjs/components/dialog/commands.js +0 -185
  53. package/dist/cjs/components/dialog/index.js +0 -26
  54. package/dist/cjs/components/dialog/shared.js +0 -48
  55. package/dist/cjs/components/dialog/types.js +0 -9
  56. package/dist/cjs/components/toolbar/ListStyleSelector.js +0 -150
  57. package/dist/cjs/components/toolbar/ManuscriptToolbar.js +0 -104
  58. package/dist/cjs/components/toolbar/OrderListSelector.js +0 -103
  59. package/dist/cjs/views/EditableBlock.js +0 -37
  60. package/dist/es/components/application-menu/ApplicationMenu.js +0 -56
  61. package/dist/es/components/application-menu/MenuItemContainer.js +0 -120
  62. package/dist/es/components/application-menu/Shortcut.js +0 -56
  63. package/dist/es/components/application-menu/index.js +0 -17
  64. package/dist/es/components/application-menu/menuState.js +0 -44
  65. package/dist/es/components/application-menu/types.js +0 -16
  66. package/dist/es/components/application-menu/useApplicationMenus.js +0 -148
  67. package/dist/es/components/dialog/TableCellBorderOptions.js +0 -36
  68. package/dist/es/components/dialog/TableCellOptions.js +0 -22
  69. package/dist/es/components/dialog/TableOptions.js +0 -26
  70. package/dist/es/components/dialog/commands.js +0 -177
  71. package/dist/es/components/dialog/index.js +0 -18
  72. package/dist/es/components/dialog/shared.js +0 -21
  73. package/dist/es/components/dialog/types.js +0 -6
  74. package/dist/es/components/toolbar/ListStyleSelector.js +0 -120
  75. package/dist/es/components/toolbar/ManuscriptToolbar.js +0 -97
  76. package/dist/es/components/toolbar/OrderListSelector.js +0 -72
  77. package/dist/es/views/EditableBlock.js +0 -29
  78. package/dist/types/components/application-menu/ApplicationMenu.d.ts +0 -24
  79. package/dist/types/components/application-menu/MenuItemContainer.d.ts +0 -27
  80. package/dist/types/components/application-menu/Shortcut.d.ts +0 -26
  81. package/dist/types/components/application-menu/index.d.ts +0 -18
  82. package/dist/types/components/application-menu/menuState.d.ts +0 -18
  83. package/dist/types/components/application-menu/types.d.ts +0 -47
  84. package/dist/types/components/application-menu/useApplicationMenus.d.ts +0 -12
  85. package/dist/types/components/dialog/TableCellBorderOptions.d.ts +0 -9
  86. package/dist/types/components/dialog/TableCellOptions.d.ts +0 -4
  87. package/dist/types/components/dialog/TableOptions.d.ts +0 -4
  88. package/dist/types/components/dialog/commands.d.ts +0 -28
  89. package/dist/types/components/dialog/index.d.ts +0 -4
  90. package/dist/types/components/dialog/shared.d.ts +0 -16
  91. package/dist/types/components/dialog/types.d.ts +0 -16
  92. package/dist/types/components/toolbar/ListStyleSelector.d.ts +0 -36
  93. package/dist/types/components/toolbar/ManuscriptToolbar.d.ts +0 -50
  94. package/dist/types/components/toolbar/OrderListSelector.d.ts +0 -14
  95. package/dist/types/views/EditableBlock.d.ts +0 -19
@@ -15,32 +15,29 @@
15
15
  */
16
16
  import { schema } from '@manuscripts/transform';
17
17
  import { toggleMark } from 'prosemirror-commands';
18
- import { wrapInList } from 'prosemirror-schema-list';
19
- import { addComment, blockActive, canInsert, insertBlock, insertInlineCitation, markActive, } from './commands';
20
- import { OrderListSelector } from './components/toolbar/OrderListSelector';
18
+ import { addComment, blockActive, canInsert, insertBlock, insertInlineCitation, insertList, markActive, } from './commands';
21
19
  import icons from './icons';
22
- import { skipTrackingChanges } from './keys/list';
23
20
  export const toolbar = {
24
21
  style: {
25
22
  bold: {
26
23
  title: 'Toggle bold',
27
24
  content: icons.bold,
28
- active: markActive(schema.marks.bold),
29
- enable: toggleMark(schema.marks.bold),
25
+ isActive: markActive(schema.marks.bold),
26
+ isEnabled: toggleMark(schema.marks.bold),
30
27
  run: toggleMark(schema.marks.bold),
31
28
  },
32
29
  italic: {
33
30
  title: 'Toggle italic',
34
31
  content: icons.italic,
35
- active: markActive(schema.marks.italic),
36
- enable: toggleMark(schema.marks.italic),
32
+ isActive: markActive(schema.marks.italic),
33
+ isEnabled: toggleMark(schema.marks.italic),
37
34
  run: toggleMark(schema.marks.italic),
38
35
  },
39
36
  underline: {
40
37
  title: 'Toggle underline',
41
38
  content: icons.underline,
42
- active: markActive(schema.marks.underline),
43
- enable: toggleMark(schema.marks.underline),
39
+ isActive: markActive(schema.marks.underline),
40
+ isEnabled: toggleMark(schema.marks.underline),
44
41
  run: toggleMark(schema.marks.underline),
45
42
  },
46
43
  },
@@ -48,15 +45,15 @@ export const toolbar = {
48
45
  subscript: {
49
46
  title: 'Toggle subscript',
50
47
  content: icons.subscript,
51
- active: markActive(schema.marks.subscript),
52
- enable: toggleMark(schema.marks.subscript),
48
+ isActive: markActive(schema.marks.subscript),
49
+ isEnabled: toggleMark(schema.marks.subscript),
53
50
  run: toggleMark(schema.marks.subscript),
54
51
  },
55
52
  superscript: {
56
53
  title: 'Toggle superscript',
57
54
  content: icons.superscript,
58
- active: markActive(schema.marks.superscript),
59
- enable: toggleMark(schema.marks.superscript),
55
+ isActive: markActive(schema.marks.superscript),
56
+ isEnabled: toggleMark(schema.marks.superscript),
60
57
  run: toggleMark(schema.marks.superscript),
61
58
  },
62
59
  },
@@ -64,31 +61,36 @@ export const toolbar = {
64
61
  bullet_list: {
65
62
  title: 'Wrap in bullet list',
66
63
  content: icons.bullet_list,
67
- active: blockActive(schema.nodes.bullet_list),
68
- enable: wrapInList(schema.nodes.bullet_list),
69
- run: skipTrackingChanges(wrapInList(schema.nodes.bullet_list)),
64
+ isActive: blockActive(schema.nodes.bullet_list),
65
+ isEnabled: insertList(schema.nodes.bullet_list),
66
+ run: insertList(schema.nodes.bullet_list),
70
67
  },
71
68
  ordered_list: {
72
69
  title: 'Wrap in ordered list',
73
- active: blockActive(schema.nodes.ordered_list),
74
- enable: wrapInList(schema.nodes.ordered_list),
75
- run: skipTrackingChanges(wrapInList(schema.nodes.ordered_list, {
76
- listStyleType: 'order',
77
- })),
78
- Component: OrderListSelector,
70
+ content: icons.ordered_list,
71
+ isActive: blockActive(schema.nodes.ordered_list),
72
+ isEnabled: insertList(schema.nodes.ordered_list, 'order'),
73
+ run: insertList(schema.nodes.ordered_list, 'order'),
74
+ options: {
75
+ order: insertList(schema.nodes.ordered_list, 'order'),
76
+ 'alpha-upper': insertList(schema.nodes.ordered_list, 'alpha-upper'),
77
+ 'alpha-lower': insertList(schema.nodes.ordered_list, 'alpha-lower'),
78
+ 'roman-upper': insertList(schema.nodes.ordered_list, 'roman-upper'),
79
+ 'roman-lower': insertList(schema.nodes.ordered_list, 'roman-lower'),
80
+ },
79
81
  },
80
82
  },
81
83
  inline: {
82
84
  citation: {
83
85
  title: 'Insert citation',
84
86
  content: icons.citation,
85
- enable: canInsert(schema.nodes.citation),
87
+ isEnabled: canInsert(schema.nodes.citation),
86
88
  run: insertInlineCitation,
87
89
  },
88
- highlight: {
90
+ comment: {
89
91
  title: 'Insert comment',
90
92
  content: icons.highlight,
91
- enable: canInsert(schema.nodes.highlight_marker),
93
+ isEnabled: canInsert(schema.nodes.highlight_marker),
92
94
  run: addComment,
93
95
  },
94
96
  },
@@ -96,26 +98,20 @@ export const toolbar = {
96
98
  figure_element: {
97
99
  title: 'Insert figure',
98
100
  content: icons.figure_element,
99
- enable: canInsert(schema.nodes.figure_element),
101
+ isEnabled: canInsert(schema.nodes.figure_element),
100
102
  run: insertBlock(schema.nodes.figure_element),
101
103
  },
102
104
  table_element: {
103
105
  title: 'Insert table',
104
106
  content: icons.table_element,
105
- enable: canInsert(schema.nodes.table_element),
107
+ isEnabled: canInsert(schema.nodes.table_element),
106
108
  run: insertBlock(schema.nodes.table_element),
107
109
  },
108
110
  equation_element: {
109
111
  title: 'Insert equation',
110
112
  content: icons.equation_element,
111
- enable: canInsert(schema.nodes.equation_element),
113
+ isEnabled: canInsert(schema.nodes.equation_element),
112
114
  run: insertBlock(schema.nodes.equation_element),
113
115
  },
114
- listing_element: {
115
- title: 'Insert listing',
116
- content: icons.listing_element,
117
- enable: canInsert(schema.nodes.listing_element),
118
- run: insertBlock(schema.nodes.listing_element),
119
- },
120
116
  },
121
117
  };
@@ -22,14 +22,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
22
22
  step((generator = generator.apply(thisArg, _arguments || [])).next());
23
23
  });
24
24
  };
25
- import { nodeNames, schema } from '@manuscripts/transform';
25
+ import { nodeNames, schema, } from '@manuscripts/transform';
26
+ import { findParentNodeOfTypeClosestToPos } from 'prosemirror-utils';
26
27
  import { ContextMenu } from '../lib/context-menu';
27
28
  const isNotNull = (a) => a !== null;
29
+ const hasParent = ($pos, type) => {
30
+ return !!findParentNodeOfTypeClosestToPos($pos, type);
31
+ };
28
32
  export const EditableBlock = (Base) => {
29
33
  return class extends Base {
30
34
  constructor() {
31
35
  super(...arguments);
32
- this.gutterButtons = () => [this.createAddButton(true), this.createEditButton()].filter(isNotNull);
36
+ this.gutterButtons = () => [this.createAddButton(), this.createEditButton()].filter(isNotNull);
33
37
  this.actionGutterButtons = () => [this.createSyncWarningButton()].filter(isNotNull);
34
38
  this.createSyncWarningButton = () => {
35
39
  var _a;
@@ -65,13 +69,17 @@ export const EditableBlock = (Base) => {
65
69
  });
66
70
  return warningButton;
67
71
  };
68
- this.createAddButton = (after) => {
72
+ this.createAddButton = () => {
69
73
  var _a;
70
- const $pos = this.view.state.doc.resolve(this.getPos());
71
74
  const hasAccess = (_a = this.props.getCapabilities()) === null || _a === void 0 ? void 0 : _a.editArticle;
72
- if (!hasAccess || $pos.parent.type === schema.nodes.keywords) {
75
+ if (!hasAccess) {
76
+ return null;
77
+ }
78
+ const $pos = this.view.state.doc.resolve(this.getPos());
79
+ if (hasParent($pos, schema.nodes.keywords)) {
73
80
  return null;
74
81
  }
82
+ const after = !hasParent($pos, schema.nodes.bibliography_section);
75
83
  const button = document.createElement('a');
76
84
  button.classList.add('add-block');
77
85
  button.classList.add(after ? 'add-block-after' : 'add-block-before');
@@ -38,6 +38,7 @@ export declare const insertInlineEquation: (state: ManuscriptEditorState, dispat
38
38
  export declare const insertInlineFootnote: (kind: 'footnote' | 'endnote') => (state: ManuscriptEditorState, dispatch?: Dispatch) => boolean;
39
39
  export declare const insertGraphicalAbstract: (state: ManuscriptEditorState, dispatch?: Dispatch) => boolean;
40
40
  export declare const insertSection: (subsection?: boolean) => (state: ManuscriptEditorState, dispatch?: Dispatch) => boolean;
41
+ export declare const insertList: (type: ManuscriptNodeType, style?: string) => (state: ManuscriptEditorState, dispatch?: Dispatch) => boolean;
41
42
  export declare const insertBibliographySection: (state: ManuscriptEditorState, dispatch?: Dispatch) => boolean;
42
43
  export declare const insertTOCSection: (state: ManuscriptEditorState, dispatch?: Dispatch) => boolean;
43
44
  export declare const ifInTableBody: (command: (state: ManuscriptEditorState) => boolean) => (state: ManuscriptEditorState) => boolean;
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * © 2019 Atypon Systems LLC
2
+ * © 2024 Atypon Systems LLC
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
16
16
  import { ManuscriptEditorState, ManuscriptEditorView } from '@manuscripts/transform';
17
17
  import { Transaction } from 'prosemirror-state';
18
18
  import React from 'react';
19
- export declare const LevelSelector: React.FunctionComponent<{
19
+ export declare const LevelSelector: React.FC<{
20
20
  state: ManuscriptEditorState;
21
21
  dispatch: (tr: Transaction) => void;
22
22
  view?: ManuscriptEditorView;
@@ -28,7 +28,7 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
28
28
  gutterButtons: () => HTMLElement[];
29
29
  actionGutterButtons: () => HTMLElement[];
30
30
  createSyncWarningButton: () => HTMLElement | null;
31
- createAddButton: (after: boolean) => HTMLElement | null;
31
+ createAddButton: () => HTMLElement | null;
32
32
  createEditButton: () => HTMLElement | null;
33
33
  createMenu: () => import("../lib/context-menu").ContextMenu;
34
34
  viewAttributes: {
@@ -66,7 +66,7 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
66
66
  gutterButtons: () => HTMLElement[];
67
67
  actionGutterButtons: () => HTMLElement[];
68
68
  createSyncWarningButton: () => HTMLElement | null;
69
- createAddButton: (after: boolean) => HTMLElement | null;
69
+ createAddButton: () => HTMLElement | null;
70
70
  createEditButton: () => HTMLElement | null;
71
71
  createMenu: () => import("../lib/context-menu").ContextMenu;
72
72
  viewAttributes: {
@@ -104,7 +104,7 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
104
104
  gutterButtons: () => HTMLElement[];
105
105
  actionGutterButtons: () => HTMLElement[];
106
106
  createSyncWarningButton: () => HTMLElement | null;
107
- createAddButton: (after: boolean) => HTMLElement | null;
107
+ createAddButton: () => HTMLElement | null;
108
108
  createEditButton: () => HTMLElement | null;
109
109
  createMenu: () => import("../lib/context-menu").ContextMenu;
110
110
  viewAttributes: {
@@ -146,7 +146,7 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
146
146
  gutterButtons: () => HTMLElement[];
147
147
  actionGutterButtons: () => HTMLElement[];
148
148
  createSyncWarningButton: () => HTMLElement | null;
149
- createAddButton: (after: boolean) => HTMLElement | null;
149
+ createAddButton: () => HTMLElement | null;
150
150
  createEditButton: () => HTMLElement | null;
151
151
  createMenu: () => import("../lib/context-menu").ContextMenu;
152
152
  viewAttributes: {
@@ -185,7 +185,7 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
185
185
  gutterButtons: () => HTMLElement[];
186
186
  actionGutterButtons: () => HTMLElement[];
187
187
  createSyncWarningButton: () => HTMLElement | null;
188
- createAddButton: (after: boolean) => HTMLElement | null;
188
+ createAddButton: () => HTMLElement | null;
189
189
  createEditButton: () => HTMLElement | null;
190
190
  createMenu: () => import("../lib/context-menu").ContextMenu;
191
191
  viewAttributes: {
@@ -223,7 +223,7 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
223
223
  gutterButtons: () => HTMLElement[];
224
224
  actionGutterButtons: () => HTMLElement[];
225
225
  createSyncWarningButton: () => HTMLElement | null;
226
- createAddButton: (after: boolean) => HTMLElement | null;
226
+ createAddButton: () => HTMLElement | null;
227
227
  createEditButton: () => HTMLElement | null;
228
228
  createMenu: () => import("../lib/context-menu").ContextMenu;
229
229
  viewAttributes: {
@@ -268,7 +268,7 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
268
268
  gutterButtons: () => HTMLElement[];
269
269
  actionGutterButtons: () => HTMLElement[];
270
270
  createSyncWarningButton: () => HTMLElement | null;
271
- createAddButton: (after: boolean) => HTMLElement | null;
271
+ createAddButton: () => HTMLElement | null;
272
272
  createEditButton: () => HTMLElement | null;
273
273
  createMenu: () => import("../lib/context-menu").ContextMenu;
274
274
  viewAttributes: {
@@ -306,7 +306,7 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
306
306
  gutterButtons: () => HTMLElement[];
307
307
  actionGutterButtons: () => HTMLElement[];
308
308
  createSyncWarningButton: () => HTMLElement | null;
309
- createAddButton: (after: boolean) => HTMLElement | null;
309
+ createAddButton: () => HTMLElement | null;
310
310
  createEditButton: () => HTMLElement | null;
311
311
  createMenu: () => import("../lib/context-menu").ContextMenu;
312
312
  viewAttributes: {
@@ -344,7 +344,7 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
344
344
  gutterButtons: () => HTMLElement[];
345
345
  actionGutterButtons: () => HTMLElement[];
346
346
  createSyncWarningButton: () => HTMLElement | null;
347
- createAddButton: (after: boolean) => HTMLElement | null;
347
+ createAddButton: () => HTMLElement | null;
348
348
  createEditButton: () => HTMLElement | null;
349
349
  createMenu: () => import("../lib/context-menu").ContextMenu;
350
350
  viewAttributes: {
@@ -383,7 +383,7 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
383
383
  gutterButtons: () => HTMLElement[];
384
384
  actionGutterButtons: () => HTMLElement[];
385
385
  createSyncWarningButton: () => HTMLElement | null;
386
- createAddButton: (after: boolean) => HTMLElement | null;
386
+ createAddButton: () => HTMLElement | null;
387
387
  createEditButton: () => HTMLElement | null;
388
388
  createMenu: () => import("../lib/context-menu").ContextMenu;
389
389
  viewAttributes: {
@@ -421,7 +421,7 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
421
421
  gutterButtons: () => HTMLElement[];
422
422
  actionGutterButtons: () => HTMLElement[];
423
423
  createSyncWarningButton: () => HTMLElement | null;
424
- createAddButton: (after: boolean) => HTMLElement | null;
424
+ createAddButton: () => HTMLElement | null;
425
425
  createEditButton: () => HTMLElement | null;
426
426
  createMenu: () => import("../lib/context-menu").ContextMenu;
427
427
  viewAttributes: {
@@ -459,7 +459,7 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
459
459
  gutterButtons: () => HTMLElement[];
460
460
  actionGutterButtons: () => HTMLElement[];
461
461
  createSyncWarningButton: () => HTMLElement | null;
462
- createAddButton: (after: boolean) => HTMLElement | null;
462
+ createAddButton: () => HTMLElement | null;
463
463
  createEditButton: () => HTMLElement | null;
464
464
  createMenu: () => import("../lib/context-menu").ContextMenu;
465
465
  viewAttributes: {
@@ -498,7 +498,7 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
498
498
  gutterButtons: () => HTMLElement[];
499
499
  actionGutterButtons: () => HTMLElement[];
500
500
  createSyncWarningButton: () => HTMLElement | null;
501
- createAddButton: (after: boolean) => HTMLElement | null;
501
+ createAddButton: () => HTMLElement | null;
502
502
  createEditButton: () => HTMLElement | null;
503
503
  createMenu: () => import("../lib/context-menu").ContextMenu;
504
504
  viewAttributes: {
@@ -536,7 +536,7 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
536
536
  gutterButtons: () => HTMLElement[];
537
537
  actionGutterButtons: () => HTMLElement[];
538
538
  createSyncWarningButton: () => HTMLElement | null;
539
- createAddButton: (after: boolean) => HTMLElement | null;
539
+ createAddButton: () => HTMLElement | null;
540
540
  createEditButton: () => HTMLElement | null;
541
541
  createMenu: () => import("../lib/context-menu").ContextMenu;
542
542
  viewAttributes: {
@@ -15,17 +15,15 @@
15
15
  */
16
16
  export * from './citation-sources';
17
17
  export * from './commands';
18
- export * from './components/application-menu';
19
- export { DialogController, DialogNames } from './components/dialog';
20
18
  export { ManuscriptOutline } from './components/outline/ManuscriptOutline';
21
19
  export { OutlineItemIcon } from './components/outline/Outline';
22
20
  export { OutlineManuscript } from './components/outline/OutlineManuscript';
23
- export { ManuscriptToolbar, ToolbarButtonConfig, } from './components/toolbar/ManuscriptToolbar';
21
+ export { LevelSelector } from './components/toolbar/LevelSelector';
24
22
  export * from './menus';
25
23
  export { ChangeReceiver } from './types';
26
24
  export { CollabProvider } from './classes/collabProvider';
27
25
  export { PopperManager } from './lib/popper';
28
- export { toolbar } from './toolbar';
26
+ export * from './toolbar';
29
27
  export * from './plugins/highlight';
30
28
  export { commentScroll, isThereSelector, isHighlightComment, } from './plugins/comment_annotation';
31
29
  export * from './lib/utils';
@@ -17,7 +17,7 @@ import { ManuscriptEditorState } from '@manuscripts/transform';
17
17
  import { Command } from 'prosemirror-state';
18
18
  import { Dispatch } from '../commands';
19
19
  import { EditorAction } from '../types';
20
- export declare const skipTrackingChanges: (command: Command) => (state: ManuscriptEditorState, dispatch?: Dispatch) => boolean;
20
+ export declare const skipCommandTracking: (command: Command) => (state: ManuscriptEditorState, dispatch?: Dispatch) => boolean;
21
21
  declare const listKeymap: {
22
22
  [key: string]: EditorAction;
23
23
  };
@@ -24,22 +24,15 @@ export declare class ContextMenu {
24
24
  private readonly view;
25
25
  private readonly getPos;
26
26
  private readonly actions;
27
- private suppressibleAttrs;
28
27
  constructor(node: ManuscriptNode, view: ManuscriptEditorView, getPos: () => number, actions?: Actions);
29
28
  showAddMenu: (target: Element, after: boolean) => void;
30
29
  showEditMenu: (target: Element) => void;
31
- private addBlock;
32
- private canAddBlock;
33
30
  private createMenuItem;
34
31
  private createMenuSection;
35
32
  private insertableTypes;
36
- private showMenuSection;
37
33
  private changeNodeType;
38
34
  private deleteNode;
39
35
  private resolvePos;
40
- private splitSection;
41
- private toggleNodeAttr;
42
- private buildSuppressOptions;
43
36
  private addPopperEventListeners;
44
37
  private trimTitle;
45
38
  }
@@ -13,7 +13,6 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { MenuSpec } from './components/application-menu';
17
- import { DialogNames } from './components/dialog';
16
+ import { MenuSpec } from '@manuscripts/style-guide';
18
17
  import { useEditor } from './useEditor';
19
- export declare const getMenus: (editor: ReturnType<typeof useEditor>, handleOpenDialog: (dialog: DialogNames) => void, footnotesEnabled?: boolean, contentEditable?: boolean) => MenuSpec[];
18
+ export declare const getEditorMenus: (editor: ReturnType<typeof useEditor>) => MenuSpec[];
@@ -13,5 +13,22 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { ToolbarConfig } from './components/toolbar/ManuscriptToolbar';
16
+ import { EditorState } from 'prosemirror-state';
17
+ import { ReactNode } from 'react';
18
+ import { Dispatch } from './commands';
19
+ export interface ToolbarButtonConfig {
20
+ title: string;
21
+ content: ReactNode;
22
+ isActive?: (state: EditorState) => boolean;
23
+ run: (state: EditorState, dispatch: Dispatch) => void;
24
+ isEnabled: (state: EditorState) => boolean;
25
+ options?: {
26
+ [key: string]: (state: EditorState, dispatch: Dispatch) => void;
27
+ };
28
+ }
29
+ export interface ToolbarConfig {
30
+ [key: string]: {
31
+ [key: string]: ToolbarButtonConfig;
32
+ };
33
+ }
17
34
  export declare const toolbar: ToolbarConfig;
@@ -18,7 +18,7 @@ declare const _default: (props: import("./editable_block").EditableBlockProps, d
18
18
  gutterButtons: () => HTMLElement[];
19
19
  actionGutterButtons: () => HTMLElement[];
20
20
  createSyncWarningButton: () => HTMLElement | null;
21
- createAddButton: (after: boolean) => HTMLElement | null;
21
+ createAddButton: () => HTMLElement | null;
22
22
  createEditButton: () => HTMLElement | null;
23
23
  createMenu: () => import("../lib/context-menu").ContextMenu;
24
24
  viewAttributes: {
@@ -18,7 +18,7 @@ declare const _default: (props: import("./base_node_view").BaseNodeProps) => imp
18
18
  gutterButtons: () => HTMLElement[];
19
19
  actionGutterButtons: () => HTMLElement[];
20
20
  createSyncWarningButton: () => HTMLElement | null;
21
- createAddButton: (after: boolean) => HTMLElement | null;
21
+ createAddButton: () => HTMLElement | null;
22
22
  createEditButton: () => HTMLElement | null;
23
23
  createMenu: () => import("../lib/context-menu").ContextMenu;
24
24
  viewAttributes: {
@@ -18,7 +18,7 @@ declare const _default: (props: import("./base_node_view").BaseNodeProps) => imp
18
18
  gutterButtons: () => HTMLElement[];
19
19
  actionGutterButtons: () => HTMLElement[];
20
20
  createSyncWarningButton: () => HTMLElement | null;
21
- createAddButton: (after: boolean) => HTMLElement | null;
21
+ createAddButton: () => HTMLElement | null;
22
22
  createEditButton: () => HTMLElement | null;
23
23
  createMenu: () => import("../lib/context-menu").ContextMenu;
24
24
  viewAttributes: {
@@ -35,7 +35,7 @@ export declare const EditableBlock: <T extends Constructor<BlockView<EditableBlo
35
35
  gutterButtons: () => HTMLElement[];
36
36
  actionGutterButtons: () => HTMLElement[];
37
37
  createSyncWarningButton: () => HTMLElement | null;
38
- createAddButton: (after: boolean) => HTMLElement | null;
38
+ createAddButton: () => HTMLElement | null;
39
39
  createEditButton: () => HTMLElement | null;
40
40
  createMenu: () => ContextMenu;
41
41
  viewAttributes: {
@@ -18,7 +18,7 @@ declare const _default: (props: import("./editable_block").EditableBlockProps, d
18
18
  gutterButtons: () => HTMLElement[];
19
19
  actionGutterButtons: () => HTMLElement[];
20
20
  createSyncWarningButton: () => HTMLElement | null;
21
- createAddButton: (after: boolean) => HTMLElement | null;
21
+ createAddButton: () => HTMLElement | null;
22
22
  createEditButton: () => HTMLElement | null;
23
23
  createMenu: () => import("../lib/context-menu").ContextMenu;
24
24
  viewAttributes: {
@@ -18,7 +18,7 @@ declare const _default: (props: import("./editable_block").EditableBlockProps, d
18
18
  gutterButtons: () => HTMLElement[];
19
19
  actionGutterButtons: () => HTMLElement[];
20
20
  createSyncWarningButton: () => HTMLElement | null;
21
- createAddButton: (after: boolean) => HTMLElement | null;
21
+ createAddButton: () => HTMLElement | null;
22
22
  createEditButton: () => HTMLElement | null;
23
23
  createMenu: () => import("../lib/context-menu").ContextMenu;
24
24
  viewAttributes: {
@@ -18,7 +18,7 @@ declare const _default: (props: import("./base_node_view").BaseNodeProps) => imp
18
18
  gutterButtons: () => HTMLElement[];
19
19
  actionGutterButtons: () => HTMLElement[];
20
20
  createSyncWarningButton: () => HTMLElement | null;
21
- createAddButton: (after: boolean) => HTMLElement | null;
21
+ createAddButton: () => HTMLElement | null;
22
22
  createEditButton: () => HTMLElement | null;
23
23
  createMenu: () => import("../lib/context-menu").ContextMenu;
24
24
  viewAttributes: {
@@ -18,7 +18,7 @@ declare const _default: (props: import("./base_node_view").BaseNodeProps) => imp
18
18
  gutterButtons: () => HTMLElement[];
19
19
  actionGutterButtons: () => HTMLElement[];
20
20
  createSyncWarningButton: () => HTMLElement | null;
21
- createAddButton: (after: boolean) => HTMLElement | null;
21
+ createAddButton: () => HTMLElement | null;
22
22
  createEditButton: () => HTMLElement | null;
23
23
  createMenu: () => import("../lib/context-menu").ContextMenu;
24
24
  viewAttributes: {
@@ -18,7 +18,7 @@ declare const _default: (props: import("./editable_block").EditableBlockProps, d
18
18
  gutterButtons: () => HTMLElement[];
19
19
  actionGutterButtons: () => HTMLElement[];
20
20
  createSyncWarningButton: () => HTMLElement | null;
21
- createAddButton: (after: boolean) => HTMLElement | null;
21
+ createAddButton: () => HTMLElement | null;
22
22
  createEditButton: () => HTMLElement | null;
23
23
  createMenu: () => import("../lib/context-menu").ContextMenu;
24
24
  viewAttributes: {
@@ -18,7 +18,7 @@ declare const _default: (props: import("./base_node_view").BaseNodeProps) => imp
18
18
  gutterButtons: () => HTMLElement[];
19
19
  actionGutterButtons: () => HTMLElement[];
20
20
  createSyncWarningButton: () => HTMLElement | null;
21
- createAddButton: (after: boolean) => HTMLElement | null;
21
+ createAddButton: () => HTMLElement | null;
22
22
  createEditButton: () => HTMLElement | null;
23
23
  createMenu: () => import("../lib/context-menu").ContextMenu;
24
24
  viewAttributes: {
@@ -18,7 +18,7 @@ declare const _default: (props: import("./base_node_view").BaseNodeProps) => imp
18
18
  gutterButtons: () => HTMLElement[];
19
19
  actionGutterButtons: () => HTMLElement[];
20
20
  createSyncWarningButton: () => HTMLElement | null;
21
- createAddButton: (after: boolean) => HTMLElement | null;
21
+ createAddButton: () => HTMLElement | null;
22
22
  createEditButton: () => HTMLElement | null;
23
23
  createMenu: () => import("../lib/context-menu").ContextMenu;
24
24
  viewAttributes: {
@@ -18,7 +18,7 @@ declare const _default: (props: import("./editable_block").EditableBlockProps, d
18
18
  gutterButtons: () => HTMLElement[];
19
19
  actionGutterButtons: () => HTMLElement[];
20
20
  createSyncWarningButton: () => HTMLElement | null;
21
- createAddButton: (after: boolean) => HTMLElement | null;
21
+ createAddButton: () => HTMLElement | null;
22
22
  createEditButton: () => HTMLElement | null;
23
23
  createMenu: () => import("../lib/context-menu").ContextMenu;
24
24
  viewAttributes: {
@@ -18,7 +18,7 @@ declare const _default: (props: import("./base_node_view").BaseNodeProps) => imp
18
18
  gutterButtons: () => HTMLElement[];
19
19
  actionGutterButtons: () => HTMLElement[];
20
20
  createSyncWarningButton: () => HTMLElement | null;
21
- createAddButton: (after: boolean) => HTMLElement | null;
21
+ createAddButton: () => HTMLElement | null;
22
22
  createEditButton: () => HTMLElement | null;
23
23
  createMenu: () => import("../lib/context-menu").ContextMenu;
24
24
  viewAttributes: {
@@ -18,7 +18,7 @@ declare const _default: (props: import("./editable_block").EditableBlockProps, d
18
18
  gutterButtons: () => HTMLElement[];
19
19
  actionGutterButtons: () => HTMLElement[];
20
20
  createSyncWarningButton: () => HTMLElement | null;
21
- createAddButton: (after: boolean) => HTMLElement | null;
21
+ createAddButton: () => HTMLElement | null;
22
22
  createEditButton: () => HTMLElement | null;
23
23
  createMenu: () => import("../lib/context-menu").ContextMenu;
24
24
  viewAttributes: {
@@ -18,7 +18,7 @@ declare const _default: (props: import("./editable_block").EditableBlockProps, d
18
18
  gutterButtons: () => HTMLElement[];
19
19
  actionGutterButtons: () => HTMLElement[];
20
20
  createSyncWarningButton: () => HTMLElement | null;
21
- createAddButton: (after: boolean) => HTMLElement | null;
21
+ createAddButton: () => HTMLElement | null;
22
22
  createEditButton: () => HTMLElement | null;
23
23
  createMenu: () => import("../lib/context-menu").ContextMenu;
24
24
  viewAttributes: {
@@ -18,7 +18,7 @@ declare const _default: (props: import("./editable_block").EditableBlockProps, d
18
18
  gutterButtons: () => HTMLElement[];
19
19
  actionGutterButtons: () => HTMLElement[];
20
20
  createSyncWarningButton: () => HTMLElement | null;
21
- createAddButton: (after: boolean) => HTMLElement | null;
21
+ createAddButton: () => HTMLElement | null;
22
22
  createEditButton: () => HTMLElement | null;
23
23
  createMenu: () => import("../lib/context-menu").ContextMenu;
24
24
  viewAttributes: {
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.6.10",
4
+ "version": "1.6.12",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-body-editor",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -31,19 +31,17 @@
31
31
  "@manuscripts/assets": "^0.6.4",
32
32
  "@manuscripts/json-schema": "2.2.1",
33
33
  "@manuscripts/library": "1.3.0",
34
- "@manuscripts/style-guide": "1.5.0",
34
+ "@manuscripts/style-guide": "1.6.0",
35
35
  "@manuscripts/track-changes-plugin": "^1.7.5",
36
- "@manuscripts/transform": "2.0.0",
36
+ "@manuscripts/transform": "2.0.1",
37
37
  "astrocite-eutils": "^0.16.4",
38
38
  "axios": "^1.2.2",
39
39
  "codemirror": "^5.58.1",
40
40
  "dompurify": "^2.4.1",
41
- "formik": "^2.2.9",
42
41
  "grapheme-splitter": "^1.0.4",
43
42
  "history": "^4.10.1",
44
43
  "lodash-es": "^4.17.21",
45
44
  "popper.js": "^1.16.1",
46
- "pretty-bytes": "^6.0.0",
47
45
  "prosemirror-collab": "^1.3.1",
48
46
  "prosemirror-commands": "^1.5.0",
49
47
  "prosemirror-dropcursor": "^1.6.1",