@blocknote/core 0.1.0-alpha.3 → 0.1.1

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 (109) hide show
  1. package/LICENSE +373 -0
  2. package/README.md +4 -2
  3. package/dist/blocknote.js +3461 -2429
  4. package/dist/blocknote.js.map +1 -1
  5. package/dist/blocknote.umd.cjs +35 -71
  6. package/dist/blocknote.umd.cjs.map +1 -1
  7. package/dist/style.css +1 -1
  8. package/package.json +9 -7
  9. package/src/BlockNoteExtensions.ts +10 -17
  10. package/src/BlockNoteTheme.ts +150 -0
  11. package/src/EditorContent.tsx +2 -1
  12. package/src/extensions/Blocks/BlockAttributes.ts +12 -0
  13. package/src/extensions/Blocks/MultipleNodeSelection.ts +87 -0
  14. package/src/extensions/Blocks/OrderedListPlugin.ts +2 -2
  15. package/src/extensions/Blocks/PreviousBlockTypePlugin.ts +8 -2
  16. package/src/extensions/Blocks/helpers/findBlock.ts +1 -1
  17. package/src/extensions/Blocks/nodes/Block.module.css +37 -37
  18. package/src/extensions/Blocks/nodes/Block.ts +89 -45
  19. package/src/extensions/Blocks/nodes/BlockGroup.ts +19 -2
  20. package/src/extensions/Blocks/nodes/Content.ts +15 -2
  21. package/src/extensions/BubbleMenu/BubbleMenuExtension.tsx +10 -2
  22. package/src/extensions/BubbleMenu/component/BubbleMenu.tsx +122 -98
  23. package/src/extensions/BubbleMenu/component/LinkToolbarButton.tsx +8 -8
  24. package/src/extensions/DraggableBlocks/DraggableBlocksPlugin.tsx +143 -33
  25. package/src/extensions/DraggableBlocks/components/DragHandle.tsx +15 -21
  26. package/src/extensions/DraggableBlocks/components/DragHandleMenu.tsx +8 -7
  27. package/src/extensions/Hyperlinks/HyperlinkMenuPlugin.tsx +31 -66
  28. package/src/extensions/Hyperlinks/menus/EditHyperlinkMenu.tsx +44 -0
  29. package/src/extensions/Hyperlinks/menus/EditHyperlinkMenuItem.tsx +34 -0
  30. package/src/extensions/Hyperlinks/menus/EditHyperlinkMenuItemIcon.tsx +31 -0
  31. package/src/extensions/Hyperlinks/menus/EditHyperlinkMenuItemInput.tsx +40 -0
  32. package/src/extensions/Hyperlinks/menus/HoverHyperlinkMenu.tsx +37 -0
  33. package/src/extensions/Hyperlinks/menus/HyperlinkMenu.tsx +63 -0
  34. package/src/extensions/SlashMenu/SlashMenuItem.ts +3 -1
  35. package/src/extensions/SlashMenu/defaultCommands.tsx +4 -4
  36. package/src/extensions/TrailingNode/TrailingNodeExtension.ts +8 -5
  37. package/src/shared/components/toolbar/Toolbar.tsx +8 -3
  38. package/src/shared/components/toolbar/ToolbarButton.tsx +57 -0
  39. package/src/shared/components/toolbar/ToolbarDropdown.tsx +35 -0
  40. package/src/shared/components/toolbar/ToolbarDropdownItem.tsx +35 -0
  41. package/src/shared/components/toolbar/ToolbarDropdownTarget.tsx +31 -0
  42. package/src/shared/plugins/suggestion/SuggestionItem.ts +3 -1
  43. package/src/shared/plugins/suggestion/{SuggestionListReactRenderer.ts → SuggestionListReactRenderer.tsx} +13 -4
  44. package/src/shared/plugins/suggestion/components/SuggestionGroup.tsx +6 -93
  45. package/src/shared/plugins/suggestion/components/SuggestionGroupItem.tsx +82 -0
  46. package/src/shared/plugins/suggestion/components/SuggestionList.tsx +24 -23
  47. package/src/useEditor.ts +4 -0
  48. package/src/utils.ts +12 -0
  49. package/types/src/BlockNoteExtensions.d.ts +3 -0
  50. package/types/src/BlockNoteTheme.d.ts +2 -0
  51. package/types/src/commands/indentation.d.ts +2 -0
  52. package/types/src/extensions/Blocks/BlockAttributes.d.ts +2 -0
  53. package/types/src/extensions/Blocks/MultipleNodeSelection.d.ts +24 -0
  54. package/types/src/extensions/Blocks/nodes/Block.d.ts +1 -1
  55. package/types/src/extensions/BubbleMenu/component/LinkToolbarButton.d.ts +2 -2
  56. package/types/src/extensions/Hyperlinks/menus/EditHyperlinkMenu.d.ts +11 -0
  57. package/types/src/extensions/Hyperlinks/menus/EditHyperlinkMenuItem.d.ts +13 -0
  58. package/types/src/extensions/Hyperlinks/menus/EditHyperlinkMenuItemIcon.d.ts +8 -0
  59. package/types/src/extensions/Hyperlinks/menus/EditHyperlinkMenuItemInput.d.ts +9 -0
  60. package/types/src/extensions/Hyperlinks/menus/HoverHyperlinkMenu.d.ts +12 -0
  61. package/types/src/extensions/Hyperlinks/menus/HyperlinkMenu.d.ts +21 -0
  62. package/types/src/extensions/Hyperlinks/menus/helpers/PanelTextInput.d.ts +39 -0
  63. package/types/src/extensions/Hyperlinks/menus/helpers/PanelTextInputStyles.d.ts +3 -0
  64. package/types/src/extensions/Hyperlinks/menus/helpers/ToolbarComponent.d.ts +13 -0
  65. package/types/src/extensions/SlashMenu/SlashMenuItem.d.ts +4 -7
  66. package/types/src/extensions/TrailingNode/TrailingNodeExtension.d.ts +3 -0
  67. package/types/src/nodes/ChildgroupNode.d.ts +28 -0
  68. package/types/src/nodes/patchNodes.d.ts +1 -0
  69. package/types/src/plugins/TreeViewPlugin/index.d.ts +2 -0
  70. package/types/src/plugins/animation.d.ts +2 -0
  71. package/types/src/react/BlockNoteComposer.d.ts +17 -0
  72. package/types/src/react/BlockNotePlugin.d.ts +1 -0
  73. package/types/src/react/index.d.ts +3 -0
  74. package/types/src/react/useBlockNoteSetup.d.ts +2 -0
  75. package/types/src/registerBlockNote.d.ts +2 -0
  76. package/types/src/shared/components/toolbar/SimpleToolbarButton.d.ts +2 -3
  77. package/types/src/shared/components/toolbar/SimpleToolbarDropdown.d.ts +11 -0
  78. package/types/src/shared/components/toolbar/SimpleToolbarDropdownItem.d.ts +11 -0
  79. package/types/src/shared/components/toolbar/Toolbar.d.ts +2 -2
  80. package/types/src/shared/components/toolbar/ToolbarButton.d.ts +15 -0
  81. package/types/src/shared/components/toolbar/ToolbarDropdown.d.ts +17 -0
  82. package/types/src/shared/components/toolbar/ToolbarDropdownItem.d.ts +11 -0
  83. package/types/src/shared/components/toolbar/ToolbarDropdownTarget.d.ts +8 -0
  84. package/types/src/shared/plugins/suggestion/SuggestionItem.d.ts +2 -4
  85. package/types/src/shared/plugins/suggestion/components/SuggestionGroupItem.d.ts +9 -0
  86. package/types/src/shared/plugins/suggestion/components/SuggestionList.d.ts +0 -15
  87. package/types/src/themes/BlockNoteEditorTheme.d.ts +11 -0
  88. package/types/src/useEditor.d.ts +3 -0
  89. package/types/src/utils.d.ts +2 -0
  90. package/src/extensions/Blocks/nodes/README.md +0 -26
  91. package/src/extensions/BubbleMenu/component/DropdownBlockItem.module.css +0 -13
  92. package/src/extensions/BubbleMenu/component/DropdownBlockItem.tsx +0 -25
  93. package/src/extensions/DraggableBlocks/components/DragHandle.module.css +0 -33
  94. package/src/extensions/DraggableBlocks/components/DragHandleMenu.module.css +0 -10
  95. package/src/extensions/Hyperlinks/menus/HyperlinkBasicMenu.tsx +0 -59
  96. package/src/extensions/Hyperlinks/menus/HyperlinkEditMenu.tsx +0 -72
  97. package/src/extensions/Hyperlinks/menus/atlaskit/PanelTextInput.tsx +0 -173
  98. package/src/extensions/Hyperlinks/menus/atlaskit/PanelTextInputStyles.ts +0 -36
  99. package/src/extensions/Hyperlinks/menus/atlaskit/README.md +0 -1
  100. package/src/extensions/Hyperlinks/menus/atlaskit/ToolbarComponent.tsx +0 -61
  101. package/src/extensions/helpers/formatKeyboardShortcut.ts +0 -9
  102. package/src/lib/atlaskit/browser.ts +0 -47
  103. package/src/shared/components/toolbar/SimpleToolbarButton.module.css +0 -13
  104. package/src/shared/components/toolbar/SimpleToolbarButton.tsx +0 -56
  105. package/src/shared/components/toolbar/Toolbar.module.css +0 -10
  106. package/src/shared/components/toolbar/ToolbarSeparator.module.css +0 -13
  107. package/src/shared/components/toolbar/ToolbarSeparator.tsx +0 -7
  108. package/src/shared/plugins/suggestion/components/SuggestionGroup.module.css +0 -45
  109. package/src/shared/plugins/suggestion/components/SuggestionList.module.css +0 -10
@@ -1,59 +0,0 @@
1
- import { useState } from "react";
2
- import { RiExternalLinkFill, RiLinkUnlink } from "react-icons/ri";
3
- import { SimpleToolbarButton } from "../../../shared/components/toolbar/SimpleToolbarButton";
4
- import { Toolbar } from "../../../shared/components/toolbar/Toolbar";
5
- import { ToolbarSeparator } from "../../../shared/components/toolbar/ToolbarSeparator";
6
- import React from "react";
7
-
8
- type HyperlinkMenuProps = {
9
- href: string;
10
- removeHandler: () => void;
11
- editMenu: React.ReactElement;
12
- };
13
-
14
- /**
15
- * A hyperlink menu shown when an anchor is hovered over.
16
- * It shows options to edit / remove / open the link
17
- */
18
- export const HyperlinkBasicMenu = (props: HyperlinkMenuProps) => {
19
- const [isEditing, setIsEditing] = useState(false);
20
- if (isEditing) {
21
- return props.editMenu;
22
- }
23
-
24
- function onEditClick(e: React.MouseEvent) {
25
- setIsEditing(true);
26
- e.stopPropagation();
27
- }
28
-
29
- return (
30
- <Toolbar>
31
- <SimpleToolbarButton
32
- mainTooltip="Edit"
33
- isSelected={false}
34
- onClick={onEditClick}>
35
- Edit Link
36
- </SimpleToolbarButton>
37
-
38
- <ToolbarSeparator />
39
-
40
- <SimpleToolbarButton
41
- mainTooltip="Open in new tab"
42
- isSelected={false}
43
- onClick={() => {
44
- window.open(props.href, "_blank");
45
- }}
46
- icon={RiExternalLinkFill}
47
- />
48
-
49
- <ToolbarSeparator />
50
-
51
- <SimpleToolbarButton
52
- mainTooltip="Remove link"
53
- isSelected={false}
54
- onClick={props.removeHandler}
55
- icon={RiLinkUnlink}
56
- />
57
- </Toolbar>
58
- );
59
- };
@@ -1,72 +0,0 @@
1
- import Tippy from "@tippyjs/react";
2
- import { useState } from "react";
3
- import { RiLink, RiText } from "react-icons/ri";
4
- import { TooltipContent } from "../../../shared/components/tooltip/TooltipContent";
5
- import PanelTextInput from "./atlaskit/PanelTextInput";
6
- import {
7
- Container,
8
- ContainerWrapper,
9
- IconWrapper,
10
- TextInputWrapper,
11
- UrlInputWrapper,
12
- } from "./atlaskit/ToolbarComponent";
13
-
14
- export type HyperlinkEditorMenuProps = {
15
- url: string;
16
- text: string;
17
- onSubmit: (url: string, text: string) => void;
18
- };
19
-
20
- /**
21
- * The sub menu for editing an anchor element
22
- */
23
- export const HyperlinkEditMenu = (props: HyperlinkEditorMenuProps) => {
24
- const [url, setUrl] = useState(props.url);
25
- const [text, setText] = useState(props.text);
26
-
27
- return (
28
- <ContainerWrapper>
29
- <Container provider={false}>
30
- <UrlInputWrapper>
31
- <IconWrapper>
32
- <Tippy
33
- content={<TooltipContent mainTooltip="Edit URL" />}
34
- placement="left">
35
- <span>
36
- <RiLink size={20}></RiLink>
37
- </span>
38
- </Tippy>
39
- </IconWrapper>
40
- <PanelTextInput
41
- defaultValue={url}
42
- autoFocus={true}
43
- onSubmit={(value) => {
44
- props.onSubmit(value, text);
45
- }}
46
- onChange={(value) => {
47
- setUrl(value);
48
- }}></PanelTextInput>
49
- </UrlInputWrapper>
50
- <TextInputWrapper>
51
- <IconWrapper>
52
- <Tippy
53
- content={<TooltipContent mainTooltip="Edit title" />}
54
- placement="left">
55
- <span>
56
- <RiText size={20} />
57
- </span>
58
- </Tippy>
59
- </IconWrapper>
60
- <PanelTextInput
61
- defaultValue={text!}
62
- onSubmit={(value) => {
63
- props.onSubmit(url, value);
64
- }}
65
- onChange={(value) => {
66
- setText(value);
67
- }}></PanelTextInput>
68
- </TextInputWrapper>
69
- </Container>
70
- </ContainerWrapper>
71
- );
72
- };
@@ -1,173 +0,0 @@
1
- import { KeyboardEvent, PureComponent } from "react";
2
- import { Input } from "./PanelTextInputStyles";
3
- import { FocusEvent } from "react";
4
- import browser from "../../../../lib/atlaskit/browser";
5
-
6
- // code adapted from https://bitbucket.org/atlassian/design-system-mirror/src/master/editor/editor-core/src/ui/PanelTextInput/index.tsx
7
-
8
- export interface Props {
9
- autoFocus?: boolean | FocusOptions;
10
- defaultValue?: string;
11
- onChange?: (value: string) => void;
12
- onSubmit?: (value: string) => void;
13
- onCancel?: (e: KeyboardEvent) => void;
14
- placeholder?: string;
15
- onMouseDown?: Function;
16
- onKeyDown?: (e: KeyboardEvent<any>) => void;
17
- // overrides default browser undo behaviour (cmd/ctrl + z) with that function
18
- onUndo?: Function;
19
- // overrides default browser redo behaviour (cm + shift + z / ctrl + y) with that function
20
- onRedo?: Function;
21
- onBlur?: Function;
22
- width?: number;
23
- maxLength?: number;
24
- testId?: string;
25
- ariaLabel?: string;
26
- id?: string;
27
- }
28
-
29
- export interface State {
30
- value?: string;
31
- }
32
-
33
- const KeyZCode = 90;
34
- const KeyYCode = 89;
35
-
36
- // returns an <Input> Component, used as an input field in HyperlinkEditMenu
37
- export default class PanelTextInput extends PureComponent<Props, State> {
38
- private input?: HTMLInputElement;
39
- private focusTimeoutId: number | undefined;
40
-
41
- constructor(props: Props) {
42
- super(props);
43
-
44
- this.state = {
45
- value: props.defaultValue || "",
46
- };
47
- }
48
-
49
- UNSAFE_componentWillReceiveProps(nextProps: Props) {
50
- if (nextProps.defaultValue !== this.props.defaultValue) {
51
- this.setState({
52
- value: nextProps.defaultValue,
53
- });
54
- }
55
- }
56
-
57
- componentWillUnmount() {
58
- window.clearTimeout(this.focusTimeoutId);
59
- }
60
-
61
- onMouseDown = () => {
62
- const { onMouseDown } = this.props;
63
- if (onMouseDown) {
64
- onMouseDown();
65
- }
66
- };
67
-
68
- onBlur = (e: FocusEvent<any>) => {
69
- const { onBlur } = this.props;
70
- if (onBlur) {
71
- onBlur(e);
72
- }
73
- };
74
-
75
- render() {
76
- const { placeholder, width, maxLength, testId, ariaLabel } = this.props;
77
- const { value } = this.state;
78
- return (
79
- <Input
80
- data-testid={testId || ""}
81
- type="text"
82
- placeholder={placeholder}
83
- value={value}
84
- onChange={this.handleChange}
85
- onKeyDown={this.handleKeydown}
86
- onMouseDown={this.onMouseDown}
87
- onBlur={this.onBlur}
88
- ref={this.handleRef}
89
- width={width}
90
- maxLength={maxLength}
91
- aria-label={ariaLabel}
92
- id={this.props.id}
93
- style={{ fontSize: `0.8rem` }}
94
- />
95
- );
96
- }
97
-
98
- focus() {
99
- const { input } = this;
100
- if (input) {
101
- const focusOpts =
102
- typeof this.props.autoFocus === "object" ? this.props.autoFocus : {};
103
- input.focus(focusOpts);
104
- }
105
- }
106
-
107
- private handleChange = () => {
108
- const { onChange } = this.props;
109
- if (this.input) {
110
- this.setState({
111
- value: this.input.value,
112
- });
113
- }
114
-
115
- if (onChange && this.input) {
116
- onChange(this.input.value);
117
- }
118
- };
119
-
120
- private handleKeydown = (e: KeyboardEvent<any>) => {
121
- const { onUndo, onRedo, onSubmit, onCancel } = this.props;
122
- if (e.keyCode === 13 && onSubmit) {
123
- e.preventDefault(); // Prevent from submitting if an editor is inside a form.
124
- onSubmit(this.input!.value);
125
- } else if (e.keyCode === 27 && onCancel) {
126
- onCancel(e);
127
- } else if (typeof onUndo === "function" && this.isUndoEvent(e)) {
128
- e.preventDefault();
129
- onUndo();
130
- } else if (typeof onRedo === "function" && this.isRedoEvent(e)) {
131
- e.preventDefault();
132
- onRedo();
133
- }
134
-
135
- if (this.props.onKeyDown) {
136
- this.props.onKeyDown(e);
137
- }
138
- };
139
-
140
- private isUndoEvent(event: KeyboardEvent<any>) {
141
- return (
142
- event.keyCode === KeyZCode &&
143
- // cmd + z for mac
144
- ((browser.mac && event.metaKey && !event.shiftKey) ||
145
- // ctrl + z for non-mac
146
- (!browser.mac && event.ctrlKey))
147
- );
148
- }
149
-
150
- private isRedoEvent(event: KeyboardEvent<any>) {
151
- return (
152
- // ctrl + y for non-mac
153
- (!browser.mac && event.ctrlKey && event.keyCode === KeyYCode) ||
154
- (browser.mac &&
155
- event.metaKey &&
156
- event.shiftKey &&
157
- event.keyCode === KeyZCode) ||
158
- (event.ctrlKey && event.shiftKey && event.keyCode === KeyZCode)
159
- );
160
- }
161
-
162
- private handleRef = (input: HTMLInputElement | null) => {
163
- if (input instanceof HTMLInputElement) {
164
- this.input = input;
165
- if (this.props.autoFocus) {
166
- // Need this to prevent jumping when we render TextInput inside Portal @see ED-2992
167
- this.focusTimeoutId = window.setTimeout(() => this.focus());
168
- }
169
- } else {
170
- this.input = undefined;
171
- }
172
- };
173
- }
@@ -1,36 +0,0 @@
1
- import { N400, N800 } from "@atlaskit/theme/colors";
2
- import styled from "styled-components";
3
-
4
- // code taken from https://bitbucket.org/atlassian/design-system-mirror/src/master/editor/editor-core/src/ui/PanelTextInput/styles.ts
5
-
6
- // Normal .className gets overridden by input[type=text] hence this hack to produce input.className
7
- export const Input = styled.input`
8
- input& {
9
- autofocus: true;
10
- background: transparent;
11
- border: 0;
12
- border-radius: 0;
13
- box-sizing: content-box;
14
- color: ${N400};
15
- flex-grow: 1;
16
- font-size: 13px;
17
- line-height: 20px;
18
- padding: 0;
19
- ${(props) => (props.width ? `width: ${props.width}px` : "")};
20
- min-width: 145px;
21
-
22
- /* Hides IE10+ built-in [x] clear input button */
23
- &::-ms-clear {
24
- display: none;
25
- }
26
-
27
- &:focus {
28
- outline: none;
29
- }
30
-
31
- &::placeholder {
32
- color: ${N800};
33
- opacity: 0.5;
34
- }
35
- }
36
- `;
@@ -1 +0,0 @@
1
- Helper code copied from AtlasKit
@@ -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
- }