@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
@@ -1,47 +0,0 @@
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
- /// <reference types="react" />
17
- import { ManuscriptEditorState } from '@manuscripts/transform';
18
- import { Transaction } from 'prosemirror-state';
19
- export type Dispatch = (tr: Transaction) => void;
20
- export interface Accelerator {
21
- mac: string;
22
- pc: string;
23
- }
24
- export type FromState<T> = ((state: ManuscriptEditorState) => T) | T;
25
- export interface MenuSpec {
26
- id?: string;
27
- label?: React.ReactNode | string;
28
- role?: string;
29
- accelerator?: Accelerator;
30
- active?: boolean;
31
- enable?: boolean;
32
- run?: () => void;
33
- submenu?: MenuSpec[];
34
- }
35
- export interface MenuItem {
36
- id: string;
37
- label: React.ReactNode | string;
38
- role: string;
39
- accelerator: Accelerator | null;
40
- active: boolean;
41
- enable: boolean;
42
- isOpen: boolean;
43
- run: (() => void) | null;
44
- submenu: MenuItem[] | null;
45
- }
46
- export type MenuPointer = [number, number, number];
47
- export type PointerTransform = (pointer: MenuPointer) => MenuPointer;
@@ -1,12 +0,0 @@
1
- import { KeyboardEvent } from 'react';
2
- import { MenuItem, MenuSpec } from './types';
3
- export declare const prevValidItem: (menu: MenuItem[], current: number) => number;
4
- export declare const nextValidItem: (menu: MenuItem[], current: number) => number;
5
- export declare const useApplicationMenus: (menuSpec: MenuSpec[]) => {
6
- handleKeydown: (e: KeyboardEvent<HTMLDivElement>) => boolean;
7
- toggleMenus: () => void;
8
- menuState: MenuItem[];
9
- handleItemClick: (indices: number[]) => void;
10
- isMenuOpen: boolean;
11
- wrapperRef: import("react").RefObject<HTMLDivElement>;
12
- };
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- import { Props } from './types';
3
- export interface TableCellBorderParams {
4
- direction: 'all' | 'top' | 'bottom' | 'left' | 'right';
5
- width: number;
6
- color: string;
7
- }
8
- declare const TableCellBorderOptions: React.FC<Props>;
9
- export default TableCellBorderOptions;
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import { Props } from './types';
3
- declare const TableCellOptions: React.FC<Props>;
4
- export default TableCellOptions;
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import { Props } from './types';
3
- declare const TableOptions: React.FC<Props>;
4
- export default TableOptions;
@@ -1,28 +0,0 @@
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 { ManuscriptEditorState, ManuscriptTransaction, TableCellNode, TableCellStyles, TableNode } from '@manuscripts/transform';
17
- import { TableCellBorderParams } from './TableCellBorderOptions';
18
- export type Dispatch = (tr: ManuscriptTransaction) => void;
19
- export declare const getSelectedTableAttr: (state: ManuscriptEditorState) => {
20
- id: string;
21
- headerRows: number;
22
- footerRows: number;
23
- comments?: import("@manuscripts/transform").CommentNode[] | undefined;
24
- };
25
- export declare const setTableAttrs: (attrs: TableNode['attrs']) => (state: ManuscriptEditorState, dispatch?: Dispatch) => boolean;
26
- export declare const getSelectedTableCellStyles: (state: ManuscriptEditorState) => TableCellStyles;
27
- export declare const setTableCellStyles: (styles: Partial<TableCellNode['attrs']['styles']>) => (state: ManuscriptEditorState, dispatch?: Dispatch) => boolean;
28
- export declare const setTableCellBorderStyles: ({ direction, width, color }: TableCellBorderParams) => (state: ManuscriptEditorState, dispatch?: Dispatch) => boolean;
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import { Props } from './types';
3
- export { DialogNames } from './types';
4
- export declare const DialogController: React.FC<Props>;
@@ -1,16 +0,0 @@
1
- import { Command, EditorState, Transaction } from 'prosemirror-state';
2
- interface ChildProps<State> {
3
- state: State;
4
- handleChange: (key: string, value: string) => void;
5
- }
6
- interface ModalProps<State> {
7
- handleCloseDialog: () => void;
8
- editorState: EditorState;
9
- dispatch: (tr: Transaction) => void;
10
- selector: (editorState: EditorState) => State;
11
- command: (state: State) => Command;
12
- header: string;
13
- children: (props: ChildProps<State>) => JSX.Element;
14
- }
15
- export declare function Modal<State>({ handleCloseDialog, editorState, dispatch, selector, command, header, children, }: ModalProps<State>): JSX.Element;
16
- export {};
@@ -1,16 +0,0 @@
1
- import { Color } from '@manuscripts/json-schema';
2
- import { ManuscriptEditorState } from '@manuscripts/transform';
3
- import { Transaction } from 'prosemirror-state';
4
- export declare enum DialogNames {
5
- TableOptions = "TableOptions",
6
- TableCellOptions = "TableCellOptions",
7
- TableCellBorderOptions = "TableCellBorderOptions"
8
- }
9
- export interface Props {
10
- handleCloseDialog: () => void;
11
- currentDialog?: DialogNames | null;
12
- editorState: ManuscriptEditorState;
13
- dispatch: (tr: Transaction) => void;
14
- colors: Color[];
15
- handleAddColor: (hexCode: string) => void;
16
- }
@@ -1,36 +0,0 @@
1
- /*!
2
- * © 2023 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 React from 'react';
17
- export declare const ListButton: import("styled-components").StyledComponent<"button", any, {
18
- type: "button";
19
- } & {
20
- 'data-active'?: boolean | undefined;
21
- }, "type">;
22
- export declare const ListStyleButton: import("styled-components").StyledComponent<"button", any, {
23
- type: "button";
24
- } & {
25
- 'data-active'?: boolean | undefined;
26
- }, "type">;
27
- type ListStyle = {
28
- items: [string, string, string];
29
- type: string;
30
- };
31
- export declare const ListStyleSelector: React.FC<{
32
- disabled?: boolean;
33
- onClickListType: (type: string) => void;
34
- list: ListStyle[];
35
- }>;
36
- export {};
@@ -1,50 +0,0 @@
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 { Capabilities } from '@manuscripts/style-guide';
17
- import { ManuscriptEditorState, ManuscriptEditorView } from '@manuscripts/transform';
18
- import { EditorState, Transaction } from 'prosemirror-state';
19
- import React from 'react';
20
- export declare const ToolbarItem: import("styled-components").StyledComponent<"div", any, {}, never>;
21
- export declare const ToolbarContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
22
- export declare const ToolbarGroup: import("styled-components").StyledComponent<"div", any, {}, never>;
23
- export interface ToolbarButtonConfig {
24
- title: string;
25
- content?: React.ReactNode;
26
- active?: (state: EditorState) => boolean;
27
- run: (state: EditorState, dispatch: (tr: Transaction) => void) => void;
28
- enable?: (state: EditorState) => boolean;
29
- Component?: React.JSXElementConstructor<{
30
- state: ManuscriptEditorState;
31
- dispatch: (tr: Transaction) => void;
32
- view?: ManuscriptEditorView;
33
- title: string;
34
- active?: (state: EditorState) => boolean;
35
- run: (state: EditorState, dispatch: (tr: Transaction) => void) => void;
36
- enable?: (state: EditorState) => boolean;
37
- }>;
38
- }
39
- export interface ToolbarConfig {
40
- [key: string]: {
41
- [key: string]: ToolbarButtonConfig;
42
- };
43
- }
44
- export declare const ManuscriptToolbar: React.FunctionComponent<{
45
- state: ManuscriptEditorState;
46
- dispatch: (tr: Transaction) => void;
47
- view?: ManuscriptEditorView;
48
- footnotesEnabled?: boolean;
49
- can: Capabilities;
50
- }>;
@@ -1,14 +0,0 @@
1
- import { ManuscriptEditorState, ManuscriptEditorView } from '@manuscripts/transform';
2
- import { NodeRange } from 'prosemirror-model';
3
- import { EditorState, Transaction } from 'prosemirror-state';
4
- import React from 'react';
5
- export declare const OrderListSelector: React.FC<{
6
- state: ManuscriptEditorState;
7
- dispatch: (tr: Transaction) => void;
8
- view?: ManuscriptEditorView;
9
- title: string;
10
- active?: (state: EditorState) => boolean;
11
- run: (state: EditorState, dispatch: (tr: Transaction) => void) => void;
12
- enable?: (state: EditorState) => boolean;
13
- }>;
14
- export declare const updateListStyle: (state: ManuscriptEditorState, dispatch: (tr: Transaction) => void, range: NodeRange, type: string) => void;
@@ -1,19 +0,0 @@
1
- import { ManuscriptEditorView, ManuscriptNode } from '@manuscripts/transform';
2
- import React, { SyntheticEvent } from 'react';
3
- export declare const Menus: React.FC<{
4
- openAddMenu: (e: SyntheticEvent) => void;
5
- openEditMenu: (e: SyntheticEvent) => void;
6
- }>;
7
- export declare const openMenu: (viewProps: ViewProps, edit?: boolean) => (e: SyntheticEvent) => void;
8
- export interface ViewProps {
9
- node: ManuscriptNode;
10
- view: ManuscriptEditorView;
11
- getPos: () => number;
12
- }
13
- interface EditableBlockProps {
14
- canWrite: boolean;
15
- viewProps: ViewProps;
16
- }
17
- declare const EditableBlock: React.FC<EditableBlockProps>;
18
- export default EditableBlock;
19
- export declare const MenuButton: import("styled-components").StyledComponent<"a", any, {}, never>;