@atlaskit/editor-plugin-insert-block 1.14.6 → 2.0.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.
- package/CHANGELOG.md +24 -0
- package/dist/cjs/plugin.js +0 -1
- package/dist/cjs/ui/ElementBrowser/InsertMenu.js +10 -9
- package/dist/cjs/ui/ElementRail/MainToolBarIcon.js +15 -3
- package/dist/cjs/ui/ElementRail/index.js +2 -1
- package/dist/cjs/ui/ToolbarInsertBlock/block-insert-element-browser.js +2 -1
- package/dist/cjs/ui/ToolbarInsertBlock/block-insert-menu.js +10 -27
- package/dist/cjs/ui/ToolbarInsertBlock/create-items.js +2 -4
- package/dist/cjs/ui/ToolbarInsertBlock/index.js +11 -11
- package/dist/cjs/ui/ToolbarInsertBlock/item.js +26 -6
- package/dist/es2019/plugin.js +0 -1
- package/dist/es2019/ui/ElementBrowser/InsertMenu.js +10 -9
- package/dist/es2019/ui/ElementRail/MainToolBarIcon.js +15 -3
- package/dist/es2019/ui/ElementRail/index.js +2 -1
- package/dist/es2019/ui/ToolbarInsertBlock/block-insert-element-browser.js +2 -1
- package/dist/es2019/ui/ToolbarInsertBlock/block-insert-menu.js +10 -27
- package/dist/es2019/ui/ToolbarInsertBlock/create-items.js +2 -4
- package/dist/es2019/ui/ToolbarInsertBlock/index.js +11 -11
- package/dist/es2019/ui/ToolbarInsertBlock/item.js +22 -6
- package/dist/esm/plugin.js +0 -1
- package/dist/esm/ui/ElementBrowser/InsertMenu.js +10 -9
- package/dist/esm/ui/ElementRail/MainToolBarIcon.js +15 -3
- package/dist/esm/ui/ElementRail/index.js +2 -1
- package/dist/esm/ui/ToolbarInsertBlock/block-insert-element-browser.js +2 -1
- package/dist/esm/ui/ToolbarInsertBlock/block-insert-menu.js +10 -27
- package/dist/esm/ui/ToolbarInsertBlock/create-items.js +2 -4
- package/dist/esm/ui/ToolbarInsertBlock/index.js +11 -11
- package/dist/esm/ui/ToolbarInsertBlock/item.js +26 -6
- package/dist/types/plugin.d.ts +0 -1
- package/dist/types/ui/ElementBrowser/InsertMenu.d.ts +1 -1
- package/dist/types/ui/ElementBrowser/types.d.ts +1 -0
- package/dist/types/ui/ElementRail/MainToolBarIcon.d.ts +2 -1
- package/dist/types/ui/ToolbarInsertBlock/block-insert-element-browser.d.ts +1 -0
- package/dist/types/ui/ToolbarInsertBlock/block-insert-menu.d.ts +1 -1
- package/dist/types/ui/ToolbarInsertBlock/types.d.ts +1 -2
- package/dist/types-ts4.5/plugin.d.ts +0 -1
- package/dist/types-ts4.5/ui/ElementBrowser/InsertMenu.d.ts +1 -1
- package/dist/types-ts4.5/ui/ElementBrowser/types.d.ts +1 -0
- package/dist/types-ts4.5/ui/ElementRail/MainToolBarIcon.d.ts +2 -1
- package/dist/types-ts4.5/ui/ToolbarInsertBlock/block-insert-element-browser.d.ts +1 -0
- package/dist/types-ts4.5/ui/ToolbarInsertBlock/block-insert-menu.d.ts +1 -1
- package/dist/types-ts4.5/ui/ToolbarInsertBlock/types.d.ts +1 -2
- package/package.json +8 -7
- package/dist/cjs/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +0 -42
- package/dist/cjs/ui/ToolbarInsertBlock/sort-items.js +0 -30
- package/dist/es2019/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +0 -35
- package/dist/es2019/ui/ToolbarInsertBlock/sort-items.js +0 -22
- package/dist/esm/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +0 -35
- package/dist/esm/ui/ToolbarInsertBlock/sort-items.js +0 -24
- package/dist/types/ui/ToolbarInsertBlock/block-insert-menu-legacy.d.ts +0 -21
- package/dist/types/ui/ToolbarInsertBlock/sort-items.d.ts +0 -2
- package/dist/types-ts4.5/ui/ToolbarInsertBlock/block-insert-menu-legacy.d.ts +0 -21
- package/dist/types-ts4.5/ui/ToolbarInsertBlock/sort-items.d.ts +0 -2
|
@@ -42,12 +42,11 @@ export interface Props {
|
|
|
42
42
|
insertMenuItems?: MenuItem[];
|
|
43
43
|
showElementBrowserLink?: boolean;
|
|
44
44
|
showSeparator?: boolean;
|
|
45
|
-
replacePlusMenuWithElementBrowser?: boolean;
|
|
46
45
|
onShowMediaPicker?: () => void;
|
|
47
46
|
onInsertBlockType?: (name: string) => Command;
|
|
48
47
|
onInsertMacroFromMacroBrowser?: (macroProvider: MacroProvider, node?: PMNode, isEditing?: boolean) => (view: EditorView) => void;
|
|
49
48
|
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
50
|
-
pluginInjectionApi
|
|
49
|
+
pluginInjectionApi: ExtractInjectionAPI<InsertBlockPlugin> | undefined;
|
|
51
50
|
mentionsDisabled?: boolean;
|
|
52
51
|
editorAppearance?: EditorAppearance;
|
|
53
52
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-insert-block",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Insert block plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,27 +32,27 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/button": "^20.1.0",
|
|
35
|
-
"@atlaskit/editor-common": "^89.
|
|
35
|
+
"@atlaskit/editor-common": "^89.3.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "^1.8.0",
|
|
37
37
|
"@atlaskit/editor-plugin-block-type": "^3.14.0",
|
|
38
38
|
"@atlaskit/editor-plugin-code-block": "^3.3.0",
|
|
39
39
|
"@atlaskit/editor-plugin-date": "^2.3.0",
|
|
40
|
-
"@atlaskit/editor-plugin-emoji": "^2.
|
|
41
|
-
"@atlaskit/editor-plugin-expand": "^2.
|
|
40
|
+
"@atlaskit/editor-plugin-emoji": "^2.6.0",
|
|
41
|
+
"@atlaskit/editor-plugin-expand": "^2.7.0",
|
|
42
42
|
"@atlaskit/editor-plugin-extension": "^1.14.0",
|
|
43
43
|
"@atlaskit/editor-plugin-feature-flags": "^1.2.0",
|
|
44
44
|
"@atlaskit/editor-plugin-hyperlink": "^2.9.0",
|
|
45
45
|
"@atlaskit/editor-plugin-image-upload": "^1.2.0",
|
|
46
|
-
"@atlaskit/editor-plugin-layout": "^1.
|
|
46
|
+
"@atlaskit/editor-plugin-layout": "^1.8.0",
|
|
47
47
|
"@atlaskit/editor-plugin-media": "^1.31.0",
|
|
48
48
|
"@atlaskit/editor-plugin-mentions": "^2.6.0",
|
|
49
|
-
"@atlaskit/editor-plugin-panel": "^2.
|
|
49
|
+
"@atlaskit/editor-plugin-panel": "^2.5.0",
|
|
50
50
|
"@atlaskit/editor-plugin-placeholder-text": "^1.7.0",
|
|
51
51
|
"@atlaskit/editor-plugin-primary-toolbar": "^2.0.0",
|
|
52
52
|
"@atlaskit/editor-plugin-quick-insert": "^1.3.0",
|
|
53
53
|
"@atlaskit/editor-plugin-rule": "^1.8.0",
|
|
54
54
|
"@atlaskit/editor-plugin-status": "^2.4.0",
|
|
55
|
-
"@atlaskit/editor-plugin-table": "^7.
|
|
55
|
+
"@atlaskit/editor-plugin-table": "^7.27.0",
|
|
56
56
|
"@atlaskit/editor-plugin-tasks-and-decisions": "^2.5.0",
|
|
57
57
|
"@atlaskit/editor-plugin-type-ahead": "^1.8.0",
|
|
58
58
|
"@atlaskit/editor-prosemirror": "6.0.0",
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
"@atlaskit/emoji": "^67.7.0",
|
|
61
61
|
"@atlaskit/heading": "2.4.5",
|
|
62
62
|
"@atlaskit/icon": "^22.18.0",
|
|
63
|
+
"@atlaskit/icon-lab": "^0.2.0",
|
|
63
64
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
64
65
|
"@atlaskit/primitives": "^12.1.0",
|
|
65
66
|
"@atlaskit/theme": "^13.0.0",
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.BlockInsertMenuLegacy = void 0;
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _uiMenu = require("@atlaskit/editor-common/ui-menu");
|
|
10
|
-
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
11
|
-
var _dropdownButton = require("./dropdown-button");
|
|
12
|
-
var BlockInsertMenuLegacy = exports.BlockInsertMenuLegacy = function BlockInsertMenuLegacy(props) {
|
|
13
|
-
var items = props.items;
|
|
14
|
-
var dropdownItems = _react.default.useMemo(function () {
|
|
15
|
-
return [{
|
|
16
|
-
items: items
|
|
17
|
-
}];
|
|
18
|
-
}, [items]);
|
|
19
|
-
return /*#__PURE__*/_react.default.createElement(_uiMenu.DropdownMenuWithKeyboardNavigation, {
|
|
20
|
-
items: dropdownItems,
|
|
21
|
-
onItemActivated: props.onItemActivated,
|
|
22
|
-
onOpenChange: props.onOpenChange,
|
|
23
|
-
mountTo: props.popupsMountPoint,
|
|
24
|
-
boundariesElement: props.popupsBoundariesElement,
|
|
25
|
-
scrollableElement: props.popupsScrollableElement,
|
|
26
|
-
isOpen: props.open,
|
|
27
|
-
fitHeight: 188,
|
|
28
|
-
fitWidth: 175,
|
|
29
|
-
zIndex: _editorSharedStyles.akEditorMenuZIndex
|
|
30
|
-
}, /*#__PURE__*/_react.default.createElement(_dropdownButton.DropDownButton, {
|
|
31
|
-
"aria-expanded": props.open,
|
|
32
|
-
"aria-haspopup": true,
|
|
33
|
-
handleRef: props.onRef,
|
|
34
|
-
selected: props.open,
|
|
35
|
-
disabled: props.disabled,
|
|
36
|
-
onClick: props.onClick,
|
|
37
|
-
onKeyDown: props.onKeyDown,
|
|
38
|
-
spacing: props.spacing,
|
|
39
|
-
label: props.label,
|
|
40
|
-
"aria-keyshortcuts": "/"
|
|
41
|
-
}));
|
|
42
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.sortItems = void 0;
|
|
7
|
-
var endPositionNames = ['macro-browser', 'slash-onboarding'];
|
|
8
|
-
var isMacro = function isMacro(item) {
|
|
9
|
-
return typeof item.content === 'string' && item.content.includes('macro');
|
|
10
|
-
};
|
|
11
|
-
var sortItems = exports.sortItems = function sortItems(items) {
|
|
12
|
-
return items.sort(function (a, b) {
|
|
13
|
-
if (endPositionNames.includes(a.value.name) && endPositionNames.includes(b.value.name)) {
|
|
14
|
-
return endPositionNames.indexOf(a.value.name) - endPositionNames.indexOf(b.value.name);
|
|
15
|
-
}
|
|
16
|
-
if (endPositionNames.includes(b.value.name)) {
|
|
17
|
-
return -1;
|
|
18
|
-
}
|
|
19
|
-
if (endPositionNames.includes(a.value.name)) {
|
|
20
|
-
return 1;
|
|
21
|
-
}
|
|
22
|
-
if (isMacro(a) && !isMacro(b)) {
|
|
23
|
-
return 1;
|
|
24
|
-
}
|
|
25
|
-
if (isMacro(b) && !isMacro(a)) {
|
|
26
|
-
return -1;
|
|
27
|
-
}
|
|
28
|
-
return a.content < b.content ? -1 : 1;
|
|
29
|
-
});
|
|
30
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { DropdownMenuWithKeyboardNavigation as DropdownMenu } from '@atlaskit/editor-common/ui-menu';
|
|
3
|
-
import { akEditorMenuZIndex } from '@atlaskit/editor-shared-styles';
|
|
4
|
-
import { DropDownButton } from './dropdown-button';
|
|
5
|
-
export const BlockInsertMenuLegacy = props => {
|
|
6
|
-
const {
|
|
7
|
-
items
|
|
8
|
-
} = props;
|
|
9
|
-
const dropdownItems = React.useMemo(() => [{
|
|
10
|
-
items
|
|
11
|
-
}], [items]);
|
|
12
|
-
return /*#__PURE__*/React.createElement(DropdownMenu, {
|
|
13
|
-
items: dropdownItems,
|
|
14
|
-
onItemActivated: props.onItemActivated,
|
|
15
|
-
onOpenChange: props.onOpenChange,
|
|
16
|
-
mountTo: props.popupsMountPoint,
|
|
17
|
-
boundariesElement: props.popupsBoundariesElement,
|
|
18
|
-
scrollableElement: props.popupsScrollableElement,
|
|
19
|
-
isOpen: props.open,
|
|
20
|
-
fitHeight: 188,
|
|
21
|
-
fitWidth: 175,
|
|
22
|
-
zIndex: akEditorMenuZIndex
|
|
23
|
-
}, /*#__PURE__*/React.createElement(DropDownButton, {
|
|
24
|
-
"aria-expanded": props.open,
|
|
25
|
-
"aria-haspopup": true,
|
|
26
|
-
handleRef: props.onRef,
|
|
27
|
-
selected: props.open,
|
|
28
|
-
disabled: props.disabled,
|
|
29
|
-
onClick: props.onClick,
|
|
30
|
-
onKeyDown: props.onKeyDown,
|
|
31
|
-
spacing: props.spacing,
|
|
32
|
-
label: props.label,
|
|
33
|
-
"aria-keyshortcuts": "/"
|
|
34
|
-
}));
|
|
35
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
const endPositionNames = ['macro-browser', 'slash-onboarding'];
|
|
2
|
-
const isMacro = item => typeof item.content === 'string' && item.content.includes('macro');
|
|
3
|
-
export const sortItems = items => {
|
|
4
|
-
return items.sort((a, b) => {
|
|
5
|
-
if (endPositionNames.includes(a.value.name) && endPositionNames.includes(b.value.name)) {
|
|
6
|
-
return endPositionNames.indexOf(a.value.name) - endPositionNames.indexOf(b.value.name);
|
|
7
|
-
}
|
|
8
|
-
if (endPositionNames.includes(b.value.name)) {
|
|
9
|
-
return -1;
|
|
10
|
-
}
|
|
11
|
-
if (endPositionNames.includes(a.value.name)) {
|
|
12
|
-
return 1;
|
|
13
|
-
}
|
|
14
|
-
if (isMacro(a) && !isMacro(b)) {
|
|
15
|
-
return 1;
|
|
16
|
-
}
|
|
17
|
-
if (isMacro(b) && !isMacro(a)) {
|
|
18
|
-
return -1;
|
|
19
|
-
}
|
|
20
|
-
return a.content < b.content ? -1 : 1;
|
|
21
|
-
});
|
|
22
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { DropdownMenuWithKeyboardNavigation as DropdownMenu } from '@atlaskit/editor-common/ui-menu';
|
|
3
|
-
import { akEditorMenuZIndex } from '@atlaskit/editor-shared-styles';
|
|
4
|
-
import { DropDownButton } from './dropdown-button';
|
|
5
|
-
export var BlockInsertMenuLegacy = function BlockInsertMenuLegacy(props) {
|
|
6
|
-
var items = props.items;
|
|
7
|
-
var dropdownItems = React.useMemo(function () {
|
|
8
|
-
return [{
|
|
9
|
-
items: items
|
|
10
|
-
}];
|
|
11
|
-
}, [items]);
|
|
12
|
-
return /*#__PURE__*/React.createElement(DropdownMenu, {
|
|
13
|
-
items: dropdownItems,
|
|
14
|
-
onItemActivated: props.onItemActivated,
|
|
15
|
-
onOpenChange: props.onOpenChange,
|
|
16
|
-
mountTo: props.popupsMountPoint,
|
|
17
|
-
boundariesElement: props.popupsBoundariesElement,
|
|
18
|
-
scrollableElement: props.popupsScrollableElement,
|
|
19
|
-
isOpen: props.open,
|
|
20
|
-
fitHeight: 188,
|
|
21
|
-
fitWidth: 175,
|
|
22
|
-
zIndex: akEditorMenuZIndex
|
|
23
|
-
}, /*#__PURE__*/React.createElement(DropDownButton, {
|
|
24
|
-
"aria-expanded": props.open,
|
|
25
|
-
"aria-haspopup": true,
|
|
26
|
-
handleRef: props.onRef,
|
|
27
|
-
selected: props.open,
|
|
28
|
-
disabled: props.disabled,
|
|
29
|
-
onClick: props.onClick,
|
|
30
|
-
onKeyDown: props.onKeyDown,
|
|
31
|
-
spacing: props.spacing,
|
|
32
|
-
label: props.label,
|
|
33
|
-
"aria-keyshortcuts": "/"
|
|
34
|
-
}));
|
|
35
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
var endPositionNames = ['macro-browser', 'slash-onboarding'];
|
|
2
|
-
var isMacro = function isMacro(item) {
|
|
3
|
-
return typeof item.content === 'string' && item.content.includes('macro');
|
|
4
|
-
};
|
|
5
|
-
export var sortItems = function sortItems(items) {
|
|
6
|
-
return items.sort(function (a, b) {
|
|
7
|
-
if (endPositionNames.includes(a.value.name) && endPositionNames.includes(b.value.name)) {
|
|
8
|
-
return endPositionNames.indexOf(a.value.name) - endPositionNames.indexOf(b.value.name);
|
|
9
|
-
}
|
|
10
|
-
if (endPositionNames.includes(b.value.name)) {
|
|
11
|
-
return -1;
|
|
12
|
-
}
|
|
13
|
-
if (endPositionNames.includes(a.value.name)) {
|
|
14
|
-
return 1;
|
|
15
|
-
}
|
|
16
|
-
if (isMacro(a) && !isMacro(b)) {
|
|
17
|
-
return 1;
|
|
18
|
-
}
|
|
19
|
-
if (isMacro(b) && !isMacro(a)) {
|
|
20
|
-
return -1;
|
|
21
|
-
}
|
|
22
|
-
return a.content < b.content ? -1 : 1;
|
|
23
|
-
});
|
|
24
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
3
|
-
import type { BlockMenuItem } from './create-items';
|
|
4
|
-
export interface BlockInsertMenuLegacyProps {
|
|
5
|
-
disabled: boolean;
|
|
6
|
-
spacing: 'none' | 'default';
|
|
7
|
-
label: string;
|
|
8
|
-
open: boolean;
|
|
9
|
-
items: BlockMenuItem[];
|
|
10
|
-
popupsMountPoint?: HTMLElement;
|
|
11
|
-
popupsBoundariesElement?: HTMLElement;
|
|
12
|
-
popupsScrollableElement?: HTMLElement;
|
|
13
|
-
onClick: React.MouseEventHandler;
|
|
14
|
-
onKeyDown?: React.KeyboardEventHandler;
|
|
15
|
-
onRef(el: HTMLElement): void;
|
|
16
|
-
onItemActivated(attrs: {
|
|
17
|
-
item: MenuItem;
|
|
18
|
-
}): void;
|
|
19
|
-
onOpenChange(attrs: any): void;
|
|
20
|
-
}
|
|
21
|
-
export declare const BlockInsertMenuLegacy: (props: BlockInsertMenuLegacyProps) => JSX.Element;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
3
|
-
import type { BlockMenuItem } from './create-items';
|
|
4
|
-
export interface BlockInsertMenuLegacyProps {
|
|
5
|
-
disabled: boolean;
|
|
6
|
-
spacing: 'none' | 'default';
|
|
7
|
-
label: string;
|
|
8
|
-
open: boolean;
|
|
9
|
-
items: BlockMenuItem[];
|
|
10
|
-
popupsMountPoint?: HTMLElement;
|
|
11
|
-
popupsBoundariesElement?: HTMLElement;
|
|
12
|
-
popupsScrollableElement?: HTMLElement;
|
|
13
|
-
onClick: React.MouseEventHandler;
|
|
14
|
-
onKeyDown?: React.KeyboardEventHandler;
|
|
15
|
-
onRef(el: HTMLElement): void;
|
|
16
|
-
onItemActivated(attrs: {
|
|
17
|
-
item: MenuItem;
|
|
18
|
-
}): void;
|
|
19
|
-
onOpenChange(attrs: any): void;
|
|
20
|
-
}
|
|
21
|
-
export declare const BlockInsertMenuLegacy: (props: BlockInsertMenuLegacyProps) => JSX.Element;
|