@blocknote/core 0.1.0 → 0.1.2

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 (99) hide show
  1. package/README.md +1 -1
  2. package/dist/blocknote.js +3454 -2426
  3. package/dist/blocknote.js.map +1 -1
  4. package/dist/blocknote.umd.cjs +35 -71
  5. package/dist/blocknote.umd.cjs.map +1 -1
  6. package/dist/style.css +1 -1
  7. package/package.json +7 -6
  8. package/src/BlockNoteTheme.ts +150 -0
  9. package/src/extensions/Blocks/BlockAttributes.ts +12 -0
  10. package/src/extensions/Blocks/MultipleNodeSelection.ts +87 -0
  11. package/src/extensions/Blocks/PreviousBlockTypePlugin.ts +8 -2
  12. package/src/extensions/Blocks/nodes/Block.module.css +37 -37
  13. package/src/extensions/Blocks/nodes/Block.ts +79 -32
  14. package/src/extensions/Blocks/nodes/BlockGroup.ts +18 -1
  15. package/src/extensions/Blocks/nodes/Content.ts +14 -1
  16. package/src/extensions/BubbleMenu/BubbleMenuExtension.tsx +8 -1
  17. package/src/extensions/BubbleMenu/component/BubbleMenu.tsx +116 -88
  18. package/src/extensions/BubbleMenu/component/LinkToolbarButton.tsx +8 -8
  19. package/src/extensions/DraggableBlocks/DraggableBlocksPlugin.tsx +143 -33
  20. package/src/extensions/DraggableBlocks/components/DragHandle.tsx +14 -19
  21. package/src/extensions/DraggableBlocks/components/DragHandleMenu.tsx +8 -7
  22. package/src/extensions/Hyperlinks/HyperlinkMenuPlugin.tsx +31 -66
  23. package/src/extensions/Hyperlinks/menus/EditHyperlinkMenu.tsx +44 -0
  24. package/src/extensions/Hyperlinks/menus/EditHyperlinkMenuItem.tsx +34 -0
  25. package/src/extensions/Hyperlinks/menus/EditHyperlinkMenuItemIcon.tsx +31 -0
  26. package/src/extensions/Hyperlinks/menus/EditHyperlinkMenuItemInput.tsx +40 -0
  27. package/src/extensions/Hyperlinks/menus/HoverHyperlinkMenu.tsx +37 -0
  28. package/src/extensions/Hyperlinks/menus/HyperlinkMenu.tsx +63 -0
  29. package/src/extensions/SlashMenu/SlashMenuItem.ts +3 -1
  30. package/src/extensions/SlashMenu/defaultCommands.tsx +4 -4
  31. package/src/extensions/UniqueID/UniqueID.ts +0 -11
  32. package/src/shared/components/toolbar/Toolbar.tsx +8 -3
  33. package/src/shared/components/toolbar/ToolbarButton.tsx +57 -0
  34. package/src/shared/components/toolbar/ToolbarDropdown.tsx +35 -0
  35. package/src/shared/components/toolbar/ToolbarDropdownItem.tsx +35 -0
  36. package/src/shared/components/toolbar/ToolbarDropdownTarget.tsx +31 -0
  37. package/src/shared/plugins/suggestion/SuggestionItem.ts +3 -1
  38. package/src/shared/plugins/suggestion/{SuggestionListReactRenderer.ts → SuggestionListReactRenderer.tsx} +13 -4
  39. package/src/shared/plugins/suggestion/components/SuggestionGroup.tsx +6 -93
  40. package/src/shared/plugins/suggestion/components/SuggestionGroupItem.tsx +82 -0
  41. package/src/shared/plugins/suggestion/components/SuggestionList.tsx +24 -23
  42. package/src/utils.ts +12 -0
  43. package/types/src/BlockNoteTheme.d.ts +2 -0
  44. package/types/src/commands/indentation.d.ts +2 -0
  45. package/types/src/extensions/Blocks/BlockAttributes.d.ts +2 -0
  46. package/types/src/extensions/Blocks/MultipleNodeSelection.d.ts +24 -0
  47. package/types/src/extensions/Blocks/nodes/Block.d.ts +1 -1
  48. package/types/src/extensions/BubbleMenu/component/LinkToolbarButton.d.ts +2 -2
  49. package/types/src/extensions/Hyperlinks/menus/EditHyperlinkMenu.d.ts +11 -0
  50. package/types/src/extensions/Hyperlinks/menus/EditHyperlinkMenuItem.d.ts +13 -0
  51. package/types/src/extensions/Hyperlinks/menus/EditHyperlinkMenuItemIcon.d.ts +8 -0
  52. package/types/src/extensions/Hyperlinks/menus/EditHyperlinkMenuItemInput.d.ts +9 -0
  53. package/types/src/extensions/Hyperlinks/menus/HoverHyperlinkMenu.d.ts +12 -0
  54. package/types/src/extensions/Hyperlinks/menus/HyperlinkMenu.d.ts +21 -0
  55. package/types/src/extensions/Hyperlinks/menus/helpers/PanelTextInput.d.ts +39 -0
  56. package/types/src/extensions/Hyperlinks/menus/helpers/PanelTextInputStyles.d.ts +3 -0
  57. package/types/src/extensions/Hyperlinks/menus/helpers/ToolbarComponent.d.ts +13 -0
  58. package/types/src/extensions/SlashMenu/SlashMenuItem.d.ts +4 -7
  59. package/types/src/nodes/ChildgroupNode.d.ts +28 -0
  60. package/types/src/nodes/patchNodes.d.ts +1 -0
  61. package/types/src/plugins/TreeViewPlugin/index.d.ts +2 -0
  62. package/types/src/plugins/animation.d.ts +2 -0
  63. package/types/src/react/BlockNoteComposer.d.ts +17 -0
  64. package/types/src/react/BlockNotePlugin.d.ts +1 -0
  65. package/types/src/react/index.d.ts +3 -0
  66. package/types/src/react/useBlockNoteSetup.d.ts +2 -0
  67. package/types/src/registerBlockNote.d.ts +2 -0
  68. package/types/src/shared/components/toolbar/SimpleToolbarButton.d.ts +2 -3
  69. package/types/src/shared/components/toolbar/SimpleToolbarDropdown.d.ts +11 -0
  70. package/types/src/shared/components/toolbar/SimpleToolbarDropdownItem.d.ts +11 -0
  71. package/types/src/shared/components/toolbar/Toolbar.d.ts +2 -2
  72. package/types/src/shared/components/toolbar/ToolbarButton.d.ts +15 -0
  73. package/types/src/shared/components/toolbar/ToolbarDropdown.d.ts +17 -0
  74. package/types/src/shared/components/toolbar/ToolbarDropdownItem.d.ts +11 -0
  75. package/types/src/shared/components/toolbar/ToolbarDropdownTarget.d.ts +8 -0
  76. package/types/src/shared/plugins/suggestion/SuggestionItem.d.ts +2 -4
  77. package/types/src/shared/plugins/suggestion/components/SuggestionGroupItem.d.ts +9 -0
  78. package/types/src/shared/plugins/suggestion/components/SuggestionList.d.ts +0 -15
  79. package/types/src/themes/BlockNoteEditorTheme.d.ts +11 -0
  80. package/types/src/utils.d.ts +2 -0
  81. package/src/extensions/BubbleMenu/component/DropdownBlockItem.module.css +0 -13
  82. package/src/extensions/BubbleMenu/component/DropdownBlockItem.tsx +0 -25
  83. package/src/extensions/DraggableBlocks/components/DragHandle.module.css +0 -33
  84. package/src/extensions/DraggableBlocks/components/DragHandleMenu.module.css +0 -10
  85. package/src/extensions/Hyperlinks/menus/HyperlinkBasicMenu.tsx +0 -59
  86. package/src/extensions/Hyperlinks/menus/HyperlinkEditMenu.tsx +0 -72
  87. package/src/extensions/Hyperlinks/menus/atlaskit/PanelTextInput.tsx +0 -173
  88. package/src/extensions/Hyperlinks/menus/atlaskit/PanelTextInputStyles.ts +0 -36
  89. package/src/extensions/Hyperlinks/menus/atlaskit/README.md +0 -1
  90. package/src/extensions/Hyperlinks/menus/atlaskit/ToolbarComponent.tsx +0 -61
  91. package/src/extensions/helpers/formatKeyboardShortcut.ts +0 -9
  92. package/src/lib/atlaskit/browser.ts +0 -47
  93. package/src/shared/components/toolbar/SimpleToolbarButton.module.css +0 -13
  94. package/src/shared/components/toolbar/SimpleToolbarButton.tsx +0 -56
  95. package/src/shared/components/toolbar/Toolbar.module.css +0 -10
  96. package/src/shared/components/toolbar/ToolbarSeparator.module.css +0 -13
  97. package/src/shared/components/toolbar/ToolbarSeparator.tsx +0 -7
  98. package/src/shared/plugins/suggestion/components/SuggestionGroup.module.css +0 -45
  99. package/src/shared/plugins/suggestion/components/SuggestionList.module.css +0 -10
@@ -1,61 +0,0 @@
1
- import styled, { css } from "styled-components";
2
- import { N80, N30 } from "@atlaskit/theme/colors";
3
-
4
- // code taken from https://bitbucket.org/atlassian/design-system-mirror/src/master/editor/editor-core/src/ui/LinkSearch/ToolbarComponents.tsx
5
- // and https://bitbucket.org/atlassian/design-system-mirror/src/master/editor/editor-core/src/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.tsx
6
-
7
- export const RECENT_SEARCH_WIDTH_IN_PX = 420;
8
- export const RECENT_SEARCH_WIDTH_WITHOUT_ITEMS_IN_PX = 360;
9
- export const RECENT_SEARCH_HEIGHT_IN_PX = 360;
10
-
11
- // These components below are mainly used in HyperlinkEditMenu as wrapper components for input fields
12
-
13
- export const InputWrapper = `
14
- display: flex;
15
- line-height: 0;
16
- padding: 4px 0;
17
- align-items: center;
18
- `;
19
-
20
- export const UrlInputWrapper = styled.div`
21
- ${InputWrapper}
22
- border-bottom: none !important;
23
- `;
24
-
25
- export const Container = styled.div`
26
- width: ${RECENT_SEARCH_WIDTH_IN_PX}px;
27
- display: flex;
28
- flex-direction: column;
29
- overflow: auto;
30
- padding: 0;
31
-
32
- ${({ provider }: { provider: boolean }) =>
33
- css`
34
- width: ${provider
35
- ? RECENT_SEARCH_WIDTH_IN_PX
36
- : RECENT_SEARCH_WIDTH_WITHOUT_ITEMS_IN_PX}px;
37
- `};
38
- line-height: initial;
39
- `;
40
-
41
- export const TextInputWrapper = styled.div`
42
- ${InputWrapper};
43
- border-top: 1px solid ${N30};
44
- `;
45
-
46
- export const IconWrapper = styled.span`
47
- color: ${N80};
48
- padding: 3px 6px;
49
- width: 32px;
50
- `;
51
-
52
- export const ContainerWrapper = styled.div`
53
- background-color: white;
54
- border-radius: 3px;
55
- box-shadow: rgb(9 30 66 / 31%) 0px 0px 1px,
56
- rgb(9 30 66 / 25%) 0px 4px 8px -2px;
57
- padding: 3px 6px;
58
- display: flex;
59
- line-height: 1;
60
- box-sizing: border-box;
61
- `;
@@ -1,9 +0,0 @@
1
- import browser from "../../lib/atlaskit/browser";
2
-
3
- export default function formatKeyboardShortcut(shortcut: string) {
4
- if (browser.ios || browser.mac) {
5
- return shortcut.replace("Mod", "⌘");
6
- } else {
7
- return shortcut.replace("Mod", "Ctrl");
8
- }
9
- }
@@ -1,47 +0,0 @@
1
- // from atlaskit/editor-common
2
- const result = {
3
- mac: false,
4
- ie: false,
5
- ie_version: 0,
6
- gecko: false,
7
- chrome: false,
8
- chrome_version: 0,
9
- android: false,
10
- ios: false,
11
- webkit: false,
12
- };
13
-
14
- if (typeof navigator !== "undefined") {
15
- const ieEdge = /Edge\/(\d+)/.exec(navigator.userAgent);
16
- const ieUpTo10 = /MSIE \d/.test(navigator.userAgent);
17
- const ie11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(
18
- navigator.userAgent
19
- );
20
-
21
- result.mac = /Mac/.test(navigator.platform);
22
- let ie = (result.ie = !!(ieUpTo10 || ie11up || ieEdge));
23
- result.ie_version = ieUpTo10
24
- ? (document as any).documentMode || 6
25
- : ie11up
26
- ? +ie11up[1]
27
- : ieEdge
28
- ? +ieEdge[1]
29
- : null;
30
- result.gecko = !ie && /gecko\/\d/i.test(navigator.userAgent);
31
- result.chrome = !ie && /Chrome\//.test(navigator.userAgent);
32
- result.chrome_version = parseInt(
33
- (navigator.userAgent.match(/Chrome\/(\d{2})/) || [])[1],
34
- 10
35
- );
36
- result.android = /Android \d/.test(navigator.userAgent);
37
- result.ios =
38
- !ie &&
39
- /AppleWebKit/.test(navigator.userAgent) &&
40
- /Mobile\/\w+/.test(navigator.userAgent);
41
- result.webkit =
42
- !ie &&
43
- !!document.documentElement &&
44
- "WebkitAppearance" in document.documentElement.style;
45
- }
46
-
47
- export default result;
@@ -1,13 +0,0 @@
1
- .icon {
2
- width: 20px;
3
- height: 20px;
4
- fill: var(--N800);
5
- }
6
-
7
- .isSelected {
8
- fill: white;
9
- }
10
-
11
- .isDisabled {
12
- fill: gray;
13
- }
@@ -1,56 +0,0 @@
1
- import Button from "@atlaskit/button";
2
- import Tippy from "@tippyjs/react";
3
- import { forwardRef } from "react";
4
- import styles from "./SimpleToolbarButton.module.css";
5
- import { TooltipContent } from "../tooltip/TooltipContent";
6
- import React from "react";
7
-
8
- export type SimpleToolbarButtonProps = {
9
- onClick?: (e: React.MouseEvent) => void;
10
- icon?: React.ComponentType<{ className: string }>;
11
- mainTooltip: string;
12
- secondaryTooltip?: string;
13
- isSelected?: boolean;
14
- children?: any;
15
- isDisabled?: boolean;
16
- };
17
-
18
- /**
19
- * Helper for basic buttons that show in the inline bubble menu.
20
- */
21
- export const SimpleToolbarButton = forwardRef(
22
- (props: SimpleToolbarButtonProps, ref) => {
23
- const ButtonIcon = props.icon;
24
- return (
25
- <Tippy
26
- content={
27
- <TooltipContent
28
- mainTooltip={props.mainTooltip}
29
- secondaryTooltip={props.secondaryTooltip}
30
- />
31
- }>
32
- <Button
33
- ref={ref as any}
34
- appearance="subtle"
35
- onClick={props.onClick}
36
- isSelected={props.isSelected || false}
37
- isDisabled={props.isDisabled || false}
38
- iconBefore={
39
- ButtonIcon && (
40
- <ButtonIcon
41
- className={
42
- styles.icon +
43
- " " +
44
- (props.isSelected ? styles.isSelected : "") +
45
- " " +
46
- (props.isDisabled ? styles.isDisabled : "")
47
- }
48
- />
49
- )
50
- }>
51
- {props.children}
52
- </Button>
53
- </Tippy>
54
- );
55
- }
56
- );
@@ -1,10 +0,0 @@
1
- .toolbar {
2
- color: var(--N800);
3
- background-color: white;
4
- border: 1px solid var(--N40);
5
- box-shadow: 0px 4px 8px rgba(9, 30, 66, 0.15),
6
- 0px 0px 1px rgba(9, 30, 66, 0.21);
7
- border-radius: 4px;
8
- font-size: 14px;
9
- line-height: 1.42857142857143;
10
- }
@@ -1,13 +0,0 @@
1
- .separator {
2
- padding-left: 0.1em !important;
3
- padding-right: 0.1em !important;
4
- }
5
- .separator::before {
6
- content: "|";
7
- color: lightgray;
8
- }
9
-
10
- .separator:hover {
11
- cursor: auto !important;
12
- background: white !important;
13
- }
@@ -1,7 +0,0 @@
1
- import styles from "./ToolbarSeparator.module.css";
2
- import Button from "@atlaskit/button";
3
-
4
- export const ToolbarSeparator = () => {
5
- // return <span className={styles.separator}></span>;
6
- return <Button appearance="subtle" className={styles.separator} />;
7
- };
@@ -1,45 +0,0 @@
1
- .suggestionWrapper {
2
- display: flex;
3
- flex-flow: row nowrap;
4
- justify-content: space-between;
5
- white-space: initial;
6
- padding: 0px;
7
- }
8
-
9
- .buttonName {
10
- font-size: small;
11
- margin-bottom: 4px;
12
- }
13
- .buttonHint {
14
- font-size: smaller;
15
- color: rgb(128, 128, 128);
16
- }
17
- .buttonShortcut {
18
- font-size: x-small;
19
- color: rgb(128, 128, 128);
20
- background-color: rgba(128, 128, 128, 0.2);
21
- vertical-align: top;
22
- padding: 3px;
23
- border-radius: 3px;
24
- }
25
- .iconWrapper {
26
- border: 1px solid rgba(128, 128, 128, 0.5);
27
- border-radius: 4px;
28
- background-color: white;
29
- width: 40px;
30
- height: 40px;
31
- padding: 10px;
32
- }
33
- .icon {
34
- width: 20px;
35
- height: 20px;
36
- fill: var(--N800);
37
- }
38
- .icon path[fill="none"] {
39
- stroke: none;
40
- }
41
-
42
- .selectedIcon path {
43
- stroke: var(--N800);
44
- stroke-width: 1px;
45
- }
@@ -1,10 +0,0 @@
1
- .menuList {
2
- color: var(--N800);
3
- background-color: white;
4
- border: 1px solid var(--N40);
5
- box-shadow: 0px 4px 8px rgba(9, 30, 66, 0.25),
6
- 0px 0px 1px rgba(9, 30, 66, 0.31);
7
- border-radius: 4px;
8
- max-width: 320;
9
- margin: 16px auto;
10
- }