@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.
- package/README.md +1 -1
- package/dist/blocknote.js +3454 -2426
- package/dist/blocknote.js.map +1 -1
- package/dist/blocknote.umd.cjs +35 -71
- package/dist/blocknote.umd.cjs.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +7 -6
- package/src/BlockNoteTheme.ts +150 -0
- package/src/extensions/Blocks/BlockAttributes.ts +12 -0
- package/src/extensions/Blocks/MultipleNodeSelection.ts +87 -0
- package/src/extensions/Blocks/PreviousBlockTypePlugin.ts +8 -2
- package/src/extensions/Blocks/nodes/Block.module.css +37 -37
- package/src/extensions/Blocks/nodes/Block.ts +79 -32
- package/src/extensions/Blocks/nodes/BlockGroup.ts +18 -1
- package/src/extensions/Blocks/nodes/Content.ts +14 -1
- package/src/extensions/BubbleMenu/BubbleMenuExtension.tsx +8 -1
- package/src/extensions/BubbleMenu/component/BubbleMenu.tsx +116 -88
- package/src/extensions/BubbleMenu/component/LinkToolbarButton.tsx +8 -8
- package/src/extensions/DraggableBlocks/DraggableBlocksPlugin.tsx +143 -33
- package/src/extensions/DraggableBlocks/components/DragHandle.tsx +14 -19
- package/src/extensions/DraggableBlocks/components/DragHandleMenu.tsx +8 -7
- package/src/extensions/Hyperlinks/HyperlinkMenuPlugin.tsx +31 -66
- package/src/extensions/Hyperlinks/menus/EditHyperlinkMenu.tsx +44 -0
- package/src/extensions/Hyperlinks/menus/EditHyperlinkMenuItem.tsx +34 -0
- package/src/extensions/Hyperlinks/menus/EditHyperlinkMenuItemIcon.tsx +31 -0
- package/src/extensions/Hyperlinks/menus/EditHyperlinkMenuItemInput.tsx +40 -0
- package/src/extensions/Hyperlinks/menus/HoverHyperlinkMenu.tsx +37 -0
- package/src/extensions/Hyperlinks/menus/HyperlinkMenu.tsx +63 -0
- package/src/extensions/SlashMenu/SlashMenuItem.ts +3 -1
- package/src/extensions/SlashMenu/defaultCommands.tsx +4 -4
- package/src/extensions/UniqueID/UniqueID.ts +0 -11
- package/src/shared/components/toolbar/Toolbar.tsx +8 -3
- package/src/shared/components/toolbar/ToolbarButton.tsx +57 -0
- package/src/shared/components/toolbar/ToolbarDropdown.tsx +35 -0
- package/src/shared/components/toolbar/ToolbarDropdownItem.tsx +35 -0
- package/src/shared/components/toolbar/ToolbarDropdownTarget.tsx +31 -0
- package/src/shared/plugins/suggestion/SuggestionItem.ts +3 -1
- package/src/shared/plugins/suggestion/{SuggestionListReactRenderer.ts → SuggestionListReactRenderer.tsx} +13 -4
- package/src/shared/plugins/suggestion/components/SuggestionGroup.tsx +6 -93
- package/src/shared/plugins/suggestion/components/SuggestionGroupItem.tsx +82 -0
- package/src/shared/plugins/suggestion/components/SuggestionList.tsx +24 -23
- package/src/utils.ts +12 -0
- package/types/src/BlockNoteTheme.d.ts +2 -0
- package/types/src/commands/indentation.d.ts +2 -0
- package/types/src/extensions/Blocks/BlockAttributes.d.ts +2 -0
- package/types/src/extensions/Blocks/MultipleNodeSelection.d.ts +24 -0
- package/types/src/extensions/Blocks/nodes/Block.d.ts +1 -1
- package/types/src/extensions/BubbleMenu/component/LinkToolbarButton.d.ts +2 -2
- package/types/src/extensions/Hyperlinks/menus/EditHyperlinkMenu.d.ts +11 -0
- package/types/src/extensions/Hyperlinks/menus/EditHyperlinkMenuItem.d.ts +13 -0
- package/types/src/extensions/Hyperlinks/menus/EditHyperlinkMenuItemIcon.d.ts +8 -0
- package/types/src/extensions/Hyperlinks/menus/EditHyperlinkMenuItemInput.d.ts +9 -0
- package/types/src/extensions/Hyperlinks/menus/HoverHyperlinkMenu.d.ts +12 -0
- package/types/src/extensions/Hyperlinks/menus/HyperlinkMenu.d.ts +21 -0
- package/types/src/extensions/Hyperlinks/menus/helpers/PanelTextInput.d.ts +39 -0
- package/types/src/extensions/Hyperlinks/menus/helpers/PanelTextInputStyles.d.ts +3 -0
- package/types/src/extensions/Hyperlinks/menus/helpers/ToolbarComponent.d.ts +13 -0
- package/types/src/extensions/SlashMenu/SlashMenuItem.d.ts +4 -7
- package/types/src/nodes/ChildgroupNode.d.ts +28 -0
- package/types/src/nodes/patchNodes.d.ts +1 -0
- package/types/src/plugins/TreeViewPlugin/index.d.ts +2 -0
- package/types/src/plugins/animation.d.ts +2 -0
- package/types/src/react/BlockNoteComposer.d.ts +17 -0
- package/types/src/react/BlockNotePlugin.d.ts +1 -0
- package/types/src/react/index.d.ts +3 -0
- package/types/src/react/useBlockNoteSetup.d.ts +2 -0
- package/types/src/registerBlockNote.d.ts +2 -0
- package/types/src/shared/components/toolbar/SimpleToolbarButton.d.ts +2 -3
- package/types/src/shared/components/toolbar/SimpleToolbarDropdown.d.ts +11 -0
- package/types/src/shared/components/toolbar/SimpleToolbarDropdownItem.d.ts +11 -0
- package/types/src/shared/components/toolbar/Toolbar.d.ts +2 -2
- package/types/src/shared/components/toolbar/ToolbarButton.d.ts +15 -0
- package/types/src/shared/components/toolbar/ToolbarDropdown.d.ts +17 -0
- package/types/src/shared/components/toolbar/ToolbarDropdownItem.d.ts +11 -0
- package/types/src/shared/components/toolbar/ToolbarDropdownTarget.d.ts +8 -0
- package/types/src/shared/plugins/suggestion/SuggestionItem.d.ts +2 -4
- package/types/src/shared/plugins/suggestion/components/SuggestionGroupItem.d.ts +9 -0
- package/types/src/shared/plugins/suggestion/components/SuggestionList.d.ts +0 -15
- package/types/src/themes/BlockNoteEditorTheme.d.ts +11 -0
- package/types/src/utils.d.ts +2 -0
- package/src/extensions/BubbleMenu/component/DropdownBlockItem.module.css +0 -13
- package/src/extensions/BubbleMenu/component/DropdownBlockItem.tsx +0 -25
- package/src/extensions/DraggableBlocks/components/DragHandle.module.css +0 -33
- package/src/extensions/DraggableBlocks/components/DragHandleMenu.module.css +0 -10
- package/src/extensions/Hyperlinks/menus/HyperlinkBasicMenu.tsx +0 -59
- package/src/extensions/Hyperlinks/menus/HyperlinkEditMenu.tsx +0 -72
- package/src/extensions/Hyperlinks/menus/atlaskit/PanelTextInput.tsx +0 -173
- package/src/extensions/Hyperlinks/menus/atlaskit/PanelTextInputStyles.ts +0 -36
- package/src/extensions/Hyperlinks/menus/atlaskit/README.md +0 -1
- package/src/extensions/Hyperlinks/menus/atlaskit/ToolbarComponent.tsx +0 -61
- package/src/extensions/helpers/formatKeyboardShortcut.ts +0 -9
- package/src/lib/atlaskit/browser.ts +0 -47
- package/src/shared/components/toolbar/SimpleToolbarButton.module.css +0 -13
- package/src/shared/components/toolbar/SimpleToolbarButton.tsx +0 -56
- package/src/shared/components/toolbar/Toolbar.module.css +0 -10
- package/src/shared/components/toolbar/ToolbarSeparator.module.css +0 -13
- package/src/shared/components/toolbar/ToolbarSeparator.tsx +0 -7
- package/src/shared/plugins/suggestion/components/SuggestionGroup.module.css +0 -45
- 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,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,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,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
|
-
}
|