@atlaskit/editor-plugin-text-formatting 2.1.2 → 2.1.4
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 +14 -0
- package/dist/cjs/pm-plugins/cursor.js +1 -1
- package/dist/cjs/pm-plugins/main.js +1 -1
- package/dist/cjs/textFormattingPlugin.js +1 -10
- package/dist/cjs/ui/FloatingToolbarComponent.js +23 -7
- package/dist/cjs/ui/Toolbar/constants.js +2 -1
- package/dist/cjs/ui/Toolbar/dropdown-menu.js +9 -4
- package/dist/cjs/ui/Toolbar/{bold-button.js → dropdown-toolbar-button.js} +6 -5
- package/dist/cjs/ui/Toolbar/hooks/clear-formatting-icon.js +6 -0
- package/dist/cjs/ui/Toolbar/hooks/formatting-icons.js +45 -4
- package/dist/cjs/ui/Toolbar/hooks/responsive-toolbar-buttons.js +5 -23
- package/dist/cjs/ui/Toolbar/hooks/use-icon-list.js +34 -0
- package/dist/cjs/ui/Toolbar/icons.js +64 -0
- package/dist/es2019/pm-plugins/cursor.js +1 -1
- package/dist/es2019/pm-plugins/main.js +1 -1
- package/dist/es2019/textFormattingPlugin.js +1 -10
- package/dist/es2019/ui/FloatingToolbarComponent.js +21 -7
- package/dist/es2019/ui/Toolbar/constants.js +1 -0
- package/dist/es2019/ui/Toolbar/dropdown-menu.js +7 -4
- package/dist/es2019/ui/Toolbar/{bold-button.js → dropdown-toolbar-button.js} +5 -4
- package/dist/es2019/ui/Toolbar/hooks/clear-formatting-icon.js +5 -0
- package/dist/es2019/ui/Toolbar/hooks/formatting-icons.js +45 -1
- package/dist/es2019/ui/Toolbar/hooks/responsive-toolbar-buttons.js +5 -21
- package/dist/es2019/ui/Toolbar/hooks/use-icon-list.js +27 -0
- package/dist/es2019/ui/Toolbar/icons.js +49 -0
- package/dist/esm/pm-plugins/cursor.js +1 -1
- package/dist/esm/pm-plugins/main.js +1 -1
- package/dist/esm/textFormattingPlugin.js +1 -10
- package/dist/esm/ui/FloatingToolbarComponent.js +20 -7
- package/dist/esm/ui/Toolbar/constants.js +1 -0
- package/dist/esm/ui/Toolbar/dropdown-menu.js +9 -4
- package/dist/esm/ui/Toolbar/{bold-button.js → dropdown-toolbar-button.js} +5 -4
- package/dist/esm/ui/Toolbar/hooks/clear-formatting-icon.js +5 -0
- package/dist/esm/ui/Toolbar/hooks/formatting-icons.js +45 -1
- package/dist/esm/ui/Toolbar/hooks/responsive-toolbar-buttons.js +5 -22
- package/dist/esm/ui/Toolbar/hooks/use-icon-list.js +27 -0
- package/dist/esm/ui/Toolbar/icons.js +56 -0
- package/dist/types/ui/FloatingToolbarComponent.d.ts +7 -3
- package/dist/types/ui/Toolbar/constants.d.ts +1 -0
- package/dist/{types-ts4.5/ui/Toolbar/bold-button.d.ts → types/ui/Toolbar/dropdown-toolbar-button.d.ts} +4 -3
- package/dist/types/ui/Toolbar/hooks/responsive-toolbar-buttons.d.ts +1 -5
- package/dist/types/ui/Toolbar/hooks/use-icon-list.d.ts +11 -0
- package/dist/types/ui/Toolbar/icons.d.ts +4 -0
- package/dist/types-ts4.5/ui/FloatingToolbarComponent.d.ts +7 -3
- package/dist/types-ts4.5/ui/Toolbar/constants.d.ts +1 -0
- package/dist/{types/ui/Toolbar/bold-button.d.ts → types-ts4.5/ui/Toolbar/dropdown-toolbar-button.d.ts} +4 -3
- package/dist/types-ts4.5/ui/Toolbar/hooks/responsive-toolbar-buttons.d.ts +1 -5
- package/dist/types-ts4.5/ui/Toolbar/hooks/use-icon-list.d.ts +11 -0
- package/dist/types-ts4.5/ui/Toolbar/icons.d.ts +4 -0
- package/package.json +5 -5
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
export var useIconList = function useIconList(_ref) {
|
|
4
|
+
var icons = _ref.icons,
|
|
5
|
+
iconTypeList = _ref.iconTypeList;
|
|
6
|
+
return useMemo(function () {
|
|
7
|
+
return icons.reduce(function (acc, icon) {
|
|
8
|
+
if (!icon || !icon.iconMark) {
|
|
9
|
+
return acc;
|
|
10
|
+
}
|
|
11
|
+
var isIconSingleButton = iconTypeList.includes(icon.iconMark);
|
|
12
|
+
if (isIconSingleButton) {
|
|
13
|
+
return {
|
|
14
|
+
dropdownItems: acc.dropdownItems,
|
|
15
|
+
singleItems: [].concat(_toConsumableArray(acc.singleItems), [icon])
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
dropdownItems: [].concat(_toConsumableArray(acc.dropdownItems), [icon]),
|
|
20
|
+
singleItems: acc.singleItems
|
|
21
|
+
};
|
|
22
|
+
}, {
|
|
23
|
+
dropdownItems: [],
|
|
24
|
+
singleItems: []
|
|
25
|
+
});
|
|
26
|
+
}, [icons, iconTypeList]);
|
|
27
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/* eslint-disable @atlaskit/ui-styling-standard/enforce-style-prop */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
var SVGContainer = function SVGContainer(_ref) {
|
|
4
|
+
var children = _ref.children;
|
|
5
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
6
|
+
style: {
|
|
7
|
+
width: "var(--ds-space-300, 24px)",
|
|
8
|
+
height: "var(--ds-space-300, 24px)",
|
|
9
|
+
display: 'flex',
|
|
10
|
+
justifyContent: 'center',
|
|
11
|
+
alignItems: 'center'
|
|
12
|
+
}
|
|
13
|
+
}, children);
|
|
14
|
+
};
|
|
15
|
+
export var Strikethrough = function Strikethrough() {
|
|
16
|
+
return /*#__PURE__*/React.createElement(SVGContainer, null, /*#__PURE__*/React.createElement("svg", {
|
|
17
|
+
width: "16",
|
|
18
|
+
height: "16",
|
|
19
|
+
viewBox: "0 0 16 16",
|
|
20
|
+
fill: "none",
|
|
21
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
22
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
23
|
+
"fill-rule": "evenodd",
|
|
24
|
+
"clip-rule": "evenodd",
|
|
25
|
+
d: "M8.39644 7.25348H13.9004V7.25421H15V8.75421H1V7.25421H2.125V7.25H4.96062C4.45271 6.59457 4.15039 5.77182 4.15039 4.87845C4.15039 2.73833 5.8853 1.00342 8.02542 1.00342H11.9004V2.50342H8.02542C6.71373 2.50342 5.65039 3.56676 5.65039 4.87845C5.65039 6.14664 6.64437 7.18267 7.89576 7.25H8.23074C8.28625 7.25 8.3415 7.25117 8.39644 7.25348ZM12.1058 11.125C12.1058 10.6424 12.0175 10.1804 11.8563 9.75421H10.1705C10.4446 10.1415 10.6058 10.6144 10.6058 11.125C10.6058 12.4367 9.54243 13.5001 8.23074 13.5001H3.15064V15.0001H8.23074C10.3709 15.0001 12.1058 13.2652 12.1058 11.125Z",
|
|
26
|
+
fill: "#44546F"
|
|
27
|
+
})));
|
|
28
|
+
};
|
|
29
|
+
export var Subscript = function Subscript() {
|
|
30
|
+
return /*#__PURE__*/React.createElement(SVGContainer, null, /*#__PURE__*/React.createElement("svg", {
|
|
31
|
+
width: "16",
|
|
32
|
+
height: "16",
|
|
33
|
+
viewBox: "0 0 16 16",
|
|
34
|
+
fill: "none",
|
|
35
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
36
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
37
|
+
"fill-rule": "evenodd",
|
|
38
|
+
"clip-rule": "evenodd",
|
|
39
|
+
d: "M5.10609 6.54799L7.88895 2.09448L9.16102 2.88936L5.99047 7.9633L9.21219 13.1191L7.94012 13.914L5.10609 9.37861L2.27207 13.914L1 13.1191L4.2217 7.9633L1.05117 2.88939L2.32324 2.09451L5.10609 6.54799ZM10.858 15.0001V13.696H12.3499V10.3153L10.8418 11.4343V9.86413L12.3138 8.83114H13.8161V13.696H14.9999V15.0001H10.858Z",
|
|
40
|
+
fill: "#44546F"
|
|
41
|
+
})));
|
|
42
|
+
};
|
|
43
|
+
export var Superscript = function Superscript() {
|
|
44
|
+
return /*#__PURE__*/React.createElement(SVGContainer, null, /*#__PURE__*/React.createElement("svg", {
|
|
45
|
+
width: "16",
|
|
46
|
+
height: "16",
|
|
47
|
+
viewBox: "0 0 16 16",
|
|
48
|
+
fill: "none",
|
|
49
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
50
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
51
|
+
"fill-rule": "evenodd",
|
|
52
|
+
"clip-rule": "evenodd",
|
|
53
|
+
d: "M10.858 7.16892V5.86487H12.3499V2.4842L10.8418 3.60312V2.03298L12.3138 1H13.8161V5.86487H14.9999V7.16892H10.858ZM5.10609 6.5479L7.88895 2.09439L9.16102 2.88927L5.99047 7.96321L9.21219 13.119L7.94012 13.9139L5.10609 9.37852L2.27207 13.9139L1 13.119L4.2217 7.96321L1.05117 2.8893L2.32324 2.09442L5.10609 6.5479Z",
|
|
54
|
+
fill: "#44546F"
|
|
55
|
+
})));
|
|
56
|
+
};
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
2
6
|
import type { WrappedComponentProps } from 'react-intl-next';
|
|
3
7
|
import { type EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
4
8
|
import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
@@ -9,7 +13,7 @@ type FloatingToolbarComponentProps = {
|
|
|
9
13
|
api: ExtractInjectionAPI<TextFormattingPlugin> | undefined;
|
|
10
14
|
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
11
15
|
} & WrappedComponentProps;
|
|
12
|
-
export declare const FloatingToolbarTextFormalWithIntl:
|
|
13
|
-
WrappedComponent:
|
|
16
|
+
export declare const FloatingToolbarTextFormalWithIntl: React.FC<import("react-intl-next").WithIntlProps<FloatingToolbarComponentProps>> & {
|
|
17
|
+
WrappedComponent: React.ComponentType<FloatingToolbarComponentProps>;
|
|
14
18
|
};
|
|
15
19
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
2
2
|
import { IconTypes } from './types';
|
|
3
3
|
export declare const DefaultButtonsToolbar: IconTypes[];
|
|
4
|
+
export declare const DefaultFloatingToolbarButtonsNext: IconTypes[];
|
|
4
5
|
export declare const DefaultButtonsToolbarNext: IconTypes[];
|
|
5
6
|
export declare const DefaultButtonsMenu: IconTypes[];
|
|
6
7
|
export declare const DefaultButtonsMenuNext: IconTypes[];
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* @jsxRuntime classic
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
|
-
import React from 'react';
|
|
5
|
+
import React, { type ReactElement } from 'react';
|
|
6
6
|
import { jsx } from '@emotion/react';
|
|
7
7
|
import { ToolbarType } from './types';
|
|
8
|
-
type
|
|
8
|
+
type DropdownButtonProps = {
|
|
9
9
|
label: string;
|
|
10
10
|
isReducedSpacing: boolean;
|
|
11
11
|
isSelected: boolean;
|
|
@@ -14,6 +14,7 @@ type BoldButtonProps = {
|
|
|
14
14
|
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
15
15
|
onKeyDown?: (event: React.KeyboardEvent) => void;
|
|
16
16
|
toolbarType: ToolbarType;
|
|
17
|
+
iconBefore?: ReactElement;
|
|
17
18
|
};
|
|
18
|
-
export declare const
|
|
19
|
+
export declare const DropdownToolbarButton: ({ label, isReducedSpacing, isDisabled, isSelected, "aria-expanded": ariaExpanded, onClick, onKeyDown, toolbarType, iconBefore, }: DropdownButtonProps) => jsx.JSX.Element;
|
|
19
20
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { MenuIconItem } from '../types';
|
|
3
|
+
import { type IconsPositions } from './use-icon-list';
|
|
3
4
|
export declare const useResponsiveIconTypeButtons: ({ toolbarSize, responsivenessEnabled, }: {
|
|
4
5
|
toolbarSize: ToolbarSize;
|
|
5
6
|
responsivenessEnabled: boolean;
|
|
@@ -8,13 +9,8 @@ export declare const useResponsiveIconTypeMenu: ({ toolbarSize, responsivenessEn
|
|
|
8
9
|
toolbarSize: ToolbarSize;
|
|
9
10
|
responsivenessEnabled: boolean;
|
|
10
11
|
}) => import("../types").IconTypes[];
|
|
11
|
-
type IconsPositions = {
|
|
12
|
-
dropdownItems: Array<MenuIconItem>;
|
|
13
|
-
singleItems: Array<MenuIconItem>;
|
|
14
|
-
};
|
|
15
12
|
export declare const useResponsiveToolbarButtons: ({ icons, toolbarSize, responsivenessEnabled, }: {
|
|
16
13
|
responsivenessEnabled: boolean;
|
|
17
14
|
toolbarSize: ToolbarSize;
|
|
18
15
|
icons: Array<MenuIconItem | null>;
|
|
19
16
|
}) => IconsPositions;
|
|
20
|
-
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { IconTypes, MenuIconItem } from '../types';
|
|
2
|
+
interface UseIconsParams {
|
|
3
|
+
icons: Array<MenuIconItem | null>;
|
|
4
|
+
iconTypeList: IconTypes[];
|
|
5
|
+
}
|
|
6
|
+
export type IconsPositions = {
|
|
7
|
+
dropdownItems: Array<MenuIconItem>;
|
|
8
|
+
singleItems: Array<MenuIconItem>;
|
|
9
|
+
};
|
|
10
|
+
export declare const useIconList: ({ icons, iconTypeList }: UseIconsParams) => IconsPositions;
|
|
11
|
+
export {};
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
2
6
|
import type { WrappedComponentProps } from 'react-intl-next';
|
|
3
7
|
import { type EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
4
8
|
import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
@@ -9,7 +13,7 @@ type FloatingToolbarComponentProps = {
|
|
|
9
13
|
api: ExtractInjectionAPI<TextFormattingPlugin> | undefined;
|
|
10
14
|
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
11
15
|
} & WrappedComponentProps;
|
|
12
|
-
export declare const FloatingToolbarTextFormalWithIntl:
|
|
13
|
-
WrappedComponent:
|
|
16
|
+
export declare const FloatingToolbarTextFormalWithIntl: React.FC<import("react-intl-next").WithIntlProps<FloatingToolbarComponentProps>> & {
|
|
17
|
+
WrappedComponent: React.ComponentType<FloatingToolbarComponentProps>;
|
|
14
18
|
};
|
|
15
19
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
2
2
|
import { IconTypes } from './types';
|
|
3
3
|
export declare const DefaultButtonsToolbar: IconTypes[];
|
|
4
|
+
export declare const DefaultFloatingToolbarButtonsNext: IconTypes[];
|
|
4
5
|
export declare const DefaultButtonsToolbarNext: IconTypes[];
|
|
5
6
|
export declare const DefaultButtonsMenu: IconTypes[];
|
|
6
7
|
export declare const DefaultButtonsMenuNext: IconTypes[];
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* @jsxRuntime classic
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
|
-
import React from 'react';
|
|
5
|
+
import React, { type ReactElement } from 'react';
|
|
6
6
|
import { jsx } from '@emotion/react';
|
|
7
7
|
import { ToolbarType } from './types';
|
|
8
|
-
type
|
|
8
|
+
type DropdownButtonProps = {
|
|
9
9
|
label: string;
|
|
10
10
|
isReducedSpacing: boolean;
|
|
11
11
|
isSelected: boolean;
|
|
@@ -14,6 +14,7 @@ type BoldButtonProps = {
|
|
|
14
14
|
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
15
15
|
onKeyDown?: (event: React.KeyboardEvent) => void;
|
|
16
16
|
toolbarType: ToolbarType;
|
|
17
|
+
iconBefore?: ReactElement;
|
|
17
18
|
};
|
|
18
|
-
export declare const
|
|
19
|
+
export declare const DropdownToolbarButton: ({ label, isReducedSpacing, isDisabled, isSelected, "aria-expanded": ariaExpanded, onClick, onKeyDown, toolbarType, iconBefore, }: DropdownButtonProps) => jsx.JSX.Element;
|
|
19
20
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { MenuIconItem } from '../types';
|
|
3
|
+
import { type IconsPositions } from './use-icon-list';
|
|
3
4
|
export declare const useResponsiveIconTypeButtons: ({ toolbarSize, responsivenessEnabled, }: {
|
|
4
5
|
toolbarSize: ToolbarSize;
|
|
5
6
|
responsivenessEnabled: boolean;
|
|
@@ -8,13 +9,8 @@ export declare const useResponsiveIconTypeMenu: ({ toolbarSize, responsivenessEn
|
|
|
8
9
|
toolbarSize: ToolbarSize;
|
|
9
10
|
responsivenessEnabled: boolean;
|
|
10
11
|
}) => import("../types").IconTypes[];
|
|
11
|
-
type IconsPositions = {
|
|
12
|
-
dropdownItems: Array<MenuIconItem>;
|
|
13
|
-
singleItems: Array<MenuIconItem>;
|
|
14
|
-
};
|
|
15
12
|
export declare const useResponsiveToolbarButtons: ({ icons, toolbarSize, responsivenessEnabled, }: {
|
|
16
13
|
responsivenessEnabled: boolean;
|
|
17
14
|
toolbarSize: ToolbarSize;
|
|
18
15
|
icons: Array<MenuIconItem | null>;
|
|
19
16
|
}) => IconsPositions;
|
|
20
|
-
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { IconTypes, MenuIconItem } from '../types';
|
|
2
|
+
interface UseIconsParams {
|
|
3
|
+
icons: Array<MenuIconItem | null>;
|
|
4
|
+
iconTypeList: IconTypes[];
|
|
5
|
+
}
|
|
6
|
+
export type IconsPositions = {
|
|
7
|
+
dropdownItems: Array<MenuIconItem>;
|
|
8
|
+
singleItems: Array<MenuIconItem>;
|
|
9
|
+
};
|
|
10
|
+
export declare const useIconList: ({ icons, iconTypeList }: UseIconsParams) => IconsPositions;
|
|
11
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-text-formatting",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.4",
|
|
4
4
|
"description": "Text-formatting plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
37
|
-
"@atlaskit/editor-common": "^102.
|
|
37
|
+
"@atlaskit/editor-common": "^102.5.0",
|
|
38
38
|
"@atlaskit/editor-plugin-analytics": "^2.1.0",
|
|
39
39
|
"@atlaskit/editor-plugin-base": "^2.3.0",
|
|
40
40
|
"@atlaskit/editor-plugin-primary-toolbar": "^3.0.0",
|
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
43
43
|
"@atlaskit/editor-shared-styles": "^3.4.0",
|
|
44
44
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
45
|
-
"@atlaskit/icon": "^
|
|
45
|
+
"@atlaskit/icon": "^25.0.0",
|
|
46
46
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
47
47
|
"@atlaskit/prosemirror-input-rules": "^3.3.0",
|
|
48
|
-
"@atlaskit/tmp-editor-statsig": "^3.
|
|
49
|
-
"@atlaskit/tokens": "^4.
|
|
48
|
+
"@atlaskit/tmp-editor-statsig": "^3.6.0",
|
|
49
|
+
"@atlaskit/tokens": "^4.5.0",
|
|
50
50
|
"@babel/runtime": "^7.0.0",
|
|
51
51
|
"@emotion/react": "^11.7.1",
|
|
52
52
|
"react-intl-next": "npm:react-intl@^5.18.1"
|