@atlaskit/editor-plugin-text-formatting 2.2.10 → 2.2.12
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 +18 -0
- package/dist/cjs/textFormattingPlugin.js +13 -0
- package/dist/cjs/ui/PrimaryToolbarComponent.js +3 -1
- package/dist/cjs/ui/Toolbar/formatting-in-selection-utils.js +1 -1
- package/dist/es2019/textFormattingPlugin.js +14 -1
- package/dist/es2019/ui/PrimaryToolbarComponent.js +2 -1
- package/dist/es2019/ui/Toolbar/formatting-in-selection-utils.js +1 -1
- package/dist/esm/textFormattingPlugin.js +14 -1
- package/dist/esm/ui/PrimaryToolbarComponent.js +2 -1
- package/dist/esm/ui/Toolbar/formatting-in-selection-utils.js +1 -1
- package/dist/types/ui/PrimaryToolbarComponent.d.ts +1 -0
- package/dist/types-ts4.5/ui/PrimaryToolbarComponent.d.ts +1 -0
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-text-formatting
|
|
2
2
|
|
|
3
|
+
## 2.2.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#161143](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/161143)
|
|
8
|
+
[`6247656fbff10`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6247656fbff10) -
|
|
9
|
+
[ED-28106] Fix toolbar pinning from table cell selections breaking the toolbar
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 2.2.11
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#159090](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/159090)
|
|
17
|
+
[`9cbae97c20f84`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9cbae97c20f84) -
|
|
18
|
+
Reduces rerenders of text formatting options and the toolbar when it is docked to top.
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 2.2.10
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -8,6 +8,7 @@ exports.textFormattingPlugin = void 0;
|
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
11
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
12
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
12
13
|
var _clearFormatting = require("./pm-plugins/clear-formatting");
|
|
13
14
|
var _clearFormattingKeymap = _interopRequireDefault(require("./pm-plugins/clear-formatting-keymap"));
|
|
@@ -37,6 +38,18 @@ var textFormattingPlugin = exports.textFormattingPlugin = function textFormattin
|
|
|
37
38
|
isToolbarReducedSpacing = _ref2.isToolbarReducedSpacing,
|
|
38
39
|
toolbarSize = _ref2.toolbarSize,
|
|
39
40
|
disabled = _ref2.disabled;
|
|
41
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_toolbar_rerender_optimization')) {
|
|
42
|
+
return /*#__PURE__*/_react.default.createElement(_PrimaryToolbarComponent.PrimaryToolbarComponentMemoized, {
|
|
43
|
+
api: api,
|
|
44
|
+
popupsMountPoint: popupsMountPoint,
|
|
45
|
+
popupsScrollableElement: popupsScrollableElement,
|
|
46
|
+
toolbarSize: toolbarSize,
|
|
47
|
+
isReducedSpacing: isToolbarReducedSpacing,
|
|
48
|
+
editorView: editorView,
|
|
49
|
+
disabled: disabled,
|
|
50
|
+
shouldUseResponsiveToolbar: Boolean(options === null || options === void 0 ? void 0 : options.responsiveToolbarMenu)
|
|
51
|
+
});
|
|
52
|
+
}
|
|
40
53
|
return /*#__PURE__*/_react.default.createElement(_PrimaryToolbarComponent.PrimaryToolbarComponent, {
|
|
41
54
|
api: api,
|
|
42
55
|
popupsMountPoint: popupsMountPoint,
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.PrimaryToolbarComponent = PrimaryToolbarComponent;
|
|
8
|
+
exports.PrimaryToolbarComponentMemoized = void 0;
|
|
8
9
|
var _react = _interopRequireDefault(require("react"));
|
|
9
10
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
10
11
|
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
@@ -112,4 +113,5 @@ function PrimaryToolbarComponent(_ref) {
|
|
|
112
113
|
api: api,
|
|
113
114
|
toolbarType: _types.ToolbarType.PRIMARY
|
|
114
115
|
});
|
|
115
|
-
}
|
|
116
|
+
}
|
|
117
|
+
var PrimaryToolbarComponentMemoized = exports.PrimaryToolbarComponentMemoized = /*#__PURE__*/_react.default.memo(PrimaryToolbarComponent);
|
|
@@ -32,7 +32,7 @@ var hasMultiplePartsWithFormattingInSelection = exports.hasMultiplePartsWithForm
|
|
|
32
32
|
};
|
|
33
33
|
var getCommonActiveMarks = exports.getCommonActiveMarks = function getCommonActiveMarks(_ref2) {
|
|
34
34
|
var selectedContent = _ref2.selectedContent;
|
|
35
|
-
if (!selectedContent) {
|
|
35
|
+
if (!selectedContent || selectedContent.length === 0) {
|
|
36
36
|
return [];
|
|
37
37
|
}
|
|
38
38
|
// filter out fragment node contains only spaces
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { code, em, strike, strong, subsup, underline } from '@atlaskit/adf-schema';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
4
5
|
import { plugin as clearFormattingPlugin, pluginKey as clearFormattingPluginKey } from './pm-plugins/clear-formatting';
|
|
5
6
|
import clearFormattingKeymapPlugin from './pm-plugins/clear-formatting-keymap';
|
|
@@ -11,7 +12,7 @@ import { plugin as pmPlugin } from './pm-plugins/main';
|
|
|
11
12
|
import { pluginKey as textFormattingPluginKey } from './pm-plugins/plugin-key';
|
|
12
13
|
import textFormattingSmartInputRulePlugin from './pm-plugins/smart-input-rule';
|
|
13
14
|
import { FloatingToolbarTextFormalWithIntl as FloatingToolbarComponent } from './ui/FloatingToolbarComponent';
|
|
14
|
-
import { PrimaryToolbarComponent } from './ui/PrimaryToolbarComponent';
|
|
15
|
+
import { PrimaryToolbarComponent, PrimaryToolbarComponentMemoized } from './ui/PrimaryToolbarComponent';
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* Text formatting plugin to be added to an `EditorPresetBuilder` and used with `ComposableEditor`
|
|
@@ -30,6 +31,18 @@ export const textFormattingPlugin = ({
|
|
|
30
31
|
toolbarSize,
|
|
31
32
|
disabled
|
|
32
33
|
}) => {
|
|
34
|
+
if (fg('platform_editor_toolbar_rerender_optimization')) {
|
|
35
|
+
return /*#__PURE__*/React.createElement(PrimaryToolbarComponentMemoized, {
|
|
36
|
+
api: api,
|
|
37
|
+
popupsMountPoint: popupsMountPoint,
|
|
38
|
+
popupsScrollableElement: popupsScrollableElement,
|
|
39
|
+
toolbarSize: toolbarSize,
|
|
40
|
+
isReducedSpacing: isToolbarReducedSpacing,
|
|
41
|
+
editorView: editorView,
|
|
42
|
+
disabled: disabled,
|
|
43
|
+
shouldUseResponsiveToolbar: Boolean(options === null || options === void 0 ? void 0 : options.responsiveToolbarMenu)
|
|
44
|
+
});
|
|
45
|
+
}
|
|
33
46
|
return /*#__PURE__*/React.createElement(PrimaryToolbarComponent, {
|
|
34
47
|
api: api,
|
|
35
48
|
popupsMountPoint: popupsMountPoint,
|
|
@@ -20,7 +20,7 @@ export const hasMultiplePartsWithFormattingInSelection = ({
|
|
|
20
20
|
export const getCommonActiveMarks = ({
|
|
21
21
|
selectedContent
|
|
22
22
|
}) => {
|
|
23
|
-
if (!selectedContent) {
|
|
23
|
+
if (!selectedContent || selectedContent.length === 0) {
|
|
24
24
|
return [];
|
|
25
25
|
}
|
|
26
26
|
// filter out fragment node contains only spaces
|
|
@@ -3,6 +3,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { code, em, strike, strong, subsup, underline } from '@atlaskit/adf-schema';
|
|
6
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
7
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
7
8
|
import { plugin as clearFormattingPlugin, pluginKey as clearFormattingPluginKey } from './pm-plugins/clear-formatting';
|
|
8
9
|
import clearFormattingKeymapPlugin from './pm-plugins/clear-formatting-keymap';
|
|
@@ -14,7 +15,7 @@ import { plugin as pmPlugin } from './pm-plugins/main';
|
|
|
14
15
|
import { pluginKey as textFormattingPluginKey } from './pm-plugins/plugin-key';
|
|
15
16
|
import textFormattingSmartInputRulePlugin from './pm-plugins/smart-input-rule';
|
|
16
17
|
import { FloatingToolbarTextFormalWithIntl as FloatingToolbarComponent } from './ui/FloatingToolbarComponent';
|
|
17
|
-
import { PrimaryToolbarComponent } from './ui/PrimaryToolbarComponent';
|
|
18
|
+
import { PrimaryToolbarComponent, PrimaryToolbarComponentMemoized } from './ui/PrimaryToolbarComponent';
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
21
|
* Text formatting plugin to be added to an `EditorPresetBuilder` and used with `ComposableEditor`
|
|
@@ -31,6 +32,18 @@ export var textFormattingPlugin = function textFormattingPlugin(_ref) {
|
|
|
31
32
|
isToolbarReducedSpacing = _ref2.isToolbarReducedSpacing,
|
|
32
33
|
toolbarSize = _ref2.toolbarSize,
|
|
33
34
|
disabled = _ref2.disabled;
|
|
35
|
+
if (fg('platform_editor_toolbar_rerender_optimization')) {
|
|
36
|
+
return /*#__PURE__*/React.createElement(PrimaryToolbarComponentMemoized, {
|
|
37
|
+
api: api,
|
|
38
|
+
popupsMountPoint: popupsMountPoint,
|
|
39
|
+
popupsScrollableElement: popupsScrollableElement,
|
|
40
|
+
toolbarSize: toolbarSize,
|
|
41
|
+
isReducedSpacing: isToolbarReducedSpacing,
|
|
42
|
+
editorView: editorView,
|
|
43
|
+
disabled: disabled,
|
|
44
|
+
shouldUseResponsiveToolbar: Boolean(options === null || options === void 0 ? void 0 : options.responsiveToolbarMenu)
|
|
45
|
+
});
|
|
46
|
+
}
|
|
34
47
|
return /*#__PURE__*/React.createElement(PrimaryToolbarComponent, {
|
|
35
48
|
api: api,
|
|
36
49
|
popupsMountPoint: popupsMountPoint,
|
|
@@ -26,7 +26,7 @@ export var hasMultiplePartsWithFormattingInSelection = function hasMultipleParts
|
|
|
26
26
|
};
|
|
27
27
|
export var getCommonActiveMarks = function getCommonActiveMarks(_ref2) {
|
|
28
28
|
var selectedContent = _ref2.selectedContent;
|
|
29
|
-
if (!selectedContent) {
|
|
29
|
+
if (!selectedContent || selectedContent.length === 0) {
|
|
30
30
|
return [];
|
|
31
31
|
}
|
|
32
32
|
// filter out fragment node contains only spaces
|
|
@@ -13,4 +13,5 @@ interface PrimaryToolbarComponentProps {
|
|
|
13
13
|
shouldUseResponsiveToolbar: boolean;
|
|
14
14
|
}
|
|
15
15
|
export declare function PrimaryToolbarComponent({ api, popupsMountPoint, popupsScrollableElement, toolbarSize, editorView, disabled, isReducedSpacing, shouldUseResponsiveToolbar, }: PrimaryToolbarComponentProps): React.JSX.Element;
|
|
16
|
+
export declare const PrimaryToolbarComponentMemoized: React.MemoExoticComponent<typeof PrimaryToolbarComponent>;
|
|
16
17
|
export {};
|
|
@@ -13,4 +13,5 @@ interface PrimaryToolbarComponentProps {
|
|
|
13
13
|
shouldUseResponsiveToolbar: boolean;
|
|
14
14
|
}
|
|
15
15
|
export declare function PrimaryToolbarComponent({ api, popupsMountPoint, popupsScrollableElement, toolbarSize, editorView, disabled, isReducedSpacing, shouldUseResponsiveToolbar, }: PrimaryToolbarComponentProps): React.JSX.Element;
|
|
16
|
+
export declare const PrimaryToolbarComponentMemoized: React.MemoExoticComponent<typeof PrimaryToolbarComponent>;
|
|
16
17
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-text-formatting",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.12",
|
|
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": "^105.
|
|
37
|
+
"@atlaskit/editor-common": "^105.11.0",
|
|
38
38
|
"@atlaskit/editor-plugin-analytics": "^2.3.0",
|
|
39
39
|
"@atlaskit/editor-plugin-base": "^3.0.0",
|
|
40
40
|
"@atlaskit/editor-plugin-primary-toolbar": "^3.2.0",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@atlaskit/icon": "^26.3.0",
|
|
46
46
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
47
47
|
"@atlaskit/prosemirror-input-rules": "^3.3.0",
|
|
48
|
-
"@atlaskit/tmp-editor-statsig": "^5.
|
|
48
|
+
"@atlaskit/tmp-editor-statsig": "^5.1.0",
|
|
49
49
|
"@atlaskit/tokens": "^4.9.0",
|
|
50
50
|
"@babel/runtime": "^7.0.0",
|
|
51
51
|
"@emotion/react": "^11.7.1",
|
|
@@ -124,6 +124,9 @@
|
|
|
124
124
|
},
|
|
125
125
|
"platform_editor_controls_patch_7": {
|
|
126
126
|
"type": "boolean"
|
|
127
|
+
},
|
|
128
|
+
"platform_editor_toolbar_rerender_optimization": {
|
|
129
|
+
"type": "boolean"
|
|
127
130
|
}
|
|
128
131
|
}
|
|
129
132
|
}
|