@atlaskit/editor-common 72.6.0 → 72.7.0
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 +30 -0
- package/dist/cjs/analytics/types/enums.js +3 -0
- package/dist/cjs/hooks/index.js +8 -1
- package/dist/cjs/hooks/useSharedPluginState.js +102 -0
- package/dist/cjs/messages/{codeBlockCopyButton.js → codeBlockButton.js} +13 -3
- package/dist/cjs/messages/index.js +3 -3
- package/dist/cjs/normalize-feature-flags.js +12 -0
- package/dist/cjs/preset/plugin-injection-api.js +115 -53
- package/dist/cjs/styles/shared/table.js +2 -0
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui-color/ColorPalette/Palettes/borderColorPalette.js +24 -0
- package/dist/cjs/ui-color/ColorPalette/Palettes/index.js +6 -0
- package/dist/cjs/ui-color/ColorPalette/Palettes/paletteMessagesTokenModeNames.js +25 -2
- package/dist/cjs/ui-color/index.js +14 -1
- package/dist/cjs/utils/validator.js +7 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/analytics/types/enums.js +3 -0
- package/dist/es2019/hooks/index.js +2 -1
- package/dist/es2019/hooks/useSharedPluginState.js +78 -0
- package/dist/{esm/messages/codeBlockCopyButton.js → es2019/messages/codeBlockButton.js} +11 -1
- package/dist/es2019/messages/index.js +1 -1
- package/dist/es2019/normalize-feature-flags.js +9 -0
- package/dist/es2019/preset/plugin-injection-api.js +64 -33
- package/dist/es2019/styles/shared/table.js +2 -0
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui-color/ColorPalette/Palettes/borderColorPalette.js +16 -0
- package/dist/es2019/ui-color/ColorPalette/Palettes/index.js +1 -1
- package/dist/es2019/ui-color/ColorPalette/Palettes/paletteMessagesTokenModeNames.js +24 -0
- package/dist/es2019/ui-color/index.js +3 -2
- package/dist/es2019/utils/validator.js +7 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/analytics/types/enums.js +3 -0
- package/dist/esm/hooks/index.js +2 -1
- package/dist/esm/hooks/useSharedPluginState.js +95 -0
- package/dist/{es2019/messages/codeBlockCopyButton.js → esm/messages/codeBlockButton.js} +11 -1
- package/dist/esm/messages/index.js +1 -1
- package/dist/esm/normalize-feature-flags.js +11 -0
- package/dist/esm/preset/plugin-injection-api.js +115 -53
- package/dist/esm/styles/shared/table.js +2 -0
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui-color/ColorPalette/Palettes/borderColorPalette.js +16 -0
- package/dist/esm/ui-color/ColorPalette/Palettes/index.js +1 -1
- package/dist/esm/ui-color/ColorPalette/Palettes/paletteMessagesTokenModeNames.js +22 -0
- package/dist/esm/ui-color/index.js +3 -2
- package/dist/esm/utils/validator.js +7 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/analytics/types/enums.d.ts +3 -0
- package/dist/types/analytics/types/media-events.d.ts +3 -1
- package/dist/types/collab/types.d.ts +15 -0
- package/dist/types/collab.d.ts +1 -1
- package/dist/types/extensions/types/extension-handler.d.ts +1 -1
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/hooks/useSharedPluginState.d.ts +39 -0
- package/dist/types/messages/codeBlockButton.d.ts +22 -0
- package/dist/types/messages/index.d.ts +1 -1
- package/dist/types/normalize-feature-flags.d.ts +7 -0
- package/dist/types/preset/plugin-injection-api.d.ts +3 -1
- package/dist/types/styles/shared/table.d.ts +2 -0
- package/dist/types/types/feature-flags.d.ts +10 -0
- package/dist/types/types/floating-toolbar.d.ts +5 -0
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/types/next-editor-plugin.d.ts +5 -4
- package/dist/types/ui/EventHandlers/index.d.ts +2 -2
- package/dist/types/ui-color/ColorPalette/Palettes/borderColorPalette.d.ts +3 -0
- package/dist/types/ui-color/ColorPalette/Palettes/index.d.ts +1 -1
- package/dist/types/ui-color/ColorPalette/Palettes/paletteMessagesTokenModeNames.d.ts +36 -0
- package/dist/types/ui-color/index.d.ts +2 -1
- package/package.json +10 -9
- package/report.api.md +1 -1
- package/dist/types/messages/codeBlockCopyButton.d.ts +0 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 72.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`2192c9417d7`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2192c9417d7) - [ESS-3335] Review Collab Provider API error handling & types
|
|
8
|
+
- [`bf04c417bfd`](https://bitbucket.org/atlassian/atlassian-frontend/commits/bf04c417bfd) - Add "border" mark to stage0 ADF schema
|
|
9
|
+
- [`27b106a736b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/27b106a736b) - ESS-3274 Refactor participant logic our of Provider class
|
|
10
|
+
- [`af9a85063e5`](https://bitbucket.org/atlassian/atlassian-frontend/commits/af9a85063e5) - add image border toolbar
|
|
11
|
+
- [`0419ca96512`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0419ca96512) - [ED-17209] `Renamed externalPlugins` API to `dependencies`
|
|
12
|
+
- [`bad1fae839b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/bad1fae839b) - Adds `useSharedPluginState` hook which can be used to replace instances of `WithPluginState`. It will take the dependency injection API (provided by a `NextEditorPlugin` and return the shared state for the specified plugins rather than using plugin keys in `WithPluginState`.
|
|
13
|
+
- [`c138d6d000f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c138d6d000f) - CCECO-283 Extended Extension API update function with ability to update the content of the node
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [`4f75910f899`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4f75910f899) - [ux] Add code wrapping button to code block TSLA-266
|
|
18
|
+
- [`1b4642c6b8c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1b4642c6b8c) - [ED-17287] Update feature flag usage for base plugin
|
|
19
|
+
- [`ef830fdabfa`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ef830fdabfa) - [ED-17294] Enable type checking for Preset plugins on unit tests
|
|
20
|
+
- [`04edc92c8f0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/04edc92c8f0) - ED-16974: Set focus to Editor after Confirmation dialog is closed.
|
|
21
|
+
- [`7946da1848a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7946da1848a) - [ux] [ED-16668] Update table shadow intersection table to observe new shadow sentinels instead of first and last cell
|
|
22
|
+
- [`a9d6c74f7cd`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a9d6c74f7cd) - Update optional feature flag type
|
|
23
|
+
- [`7d13224adfc`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7d13224adfc) - [ED-16731] Initial migration for Feature Flags plugin
|
|
24
|
+
- [`31717a1fe63`](https://bitbucket.org/atlassian/atlassian-frontend/commits/31717a1fe63) - Fix the bug when clicking on media inline files in Hybrid Renderer, viewer is not opening.
|
|
25
|
+
- Updated dependencies
|
|
26
|
+
|
|
27
|
+
## 72.6.1
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- [`b737494c727`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b737494c727) - Update optional feature flag type
|
|
32
|
+
|
|
3
33
|
## 72.6.0
|
|
4
34
|
|
|
5
35
|
### Minor Changes
|
|
@@ -232,6 +232,7 @@ exports.ACTION_SUBJECT_ID = ACTION_SUBJECT_ID;
|
|
|
232
232
|
ACTION_SUBJECT_ID["ANNOTATE_BUTTON"] = "annotateButton";
|
|
233
233
|
ACTION_SUBJECT_ID["AVATAR_GROUP_PLUGIN"] = "AvatarGroupInPlugin";
|
|
234
234
|
ACTION_SUBJECT_ID["BLOCK_QUOTE"] = "blockQuote";
|
|
235
|
+
ACTION_SUBJECT_ID["BORDER"] = "border";
|
|
235
236
|
ACTION_SUBJECT_ID["BUTTON_CATEGORY"] = "categoryButton";
|
|
236
237
|
ACTION_SUBJECT_ID["BUTTON_FEEDBACK"] = "feedbackButton";
|
|
237
238
|
ACTION_SUBJECT_ID["BUTTON_HELP"] = "helpButton";
|
|
@@ -241,6 +242,8 @@ exports.ACTION_SUBJECT_ID = ACTION_SUBJECT_ID;
|
|
|
241
242
|
ACTION_SUBJECT_ID["CARD_INLINE"] = "inlineCard";
|
|
242
243
|
ACTION_SUBJECT_ID["CELL"] = "cell";
|
|
243
244
|
ACTION_SUBJECT_ID["CODE_BLOCK"] = "codeBlock";
|
|
245
|
+
ACTION_SUBJECT_ID["CODEBLOCK_COPY"] = "codeBlockCopy";
|
|
246
|
+
ACTION_SUBJECT_ID["CODEBLOCK_WRAP"] = "codeBlockWrap";
|
|
244
247
|
ACTION_SUBJECT_ID["DATE"] = "date";
|
|
245
248
|
ACTION_SUBJECT_ID["DATE_DAY"] = "day";
|
|
246
249
|
ACTION_SUBJECT_ID["DATE_MONTH"] = "month";
|
package/dist/cjs/hooks/index.js
CHANGED
|
@@ -16,5 +16,12 @@ Object.defineProperty(exports, "usePreviousState", {
|
|
|
16
16
|
return _usePreviousState.default;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
+
Object.defineProperty(exports, "useSharedPluginState", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function get() {
|
|
22
|
+
return _useSharedPluginState.useSharedPluginState;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
19
25
|
var _usePreviousState = _interopRequireDefault(require("./usePreviousState"));
|
|
20
|
-
var _useConstructor = _interopRequireDefault(require("./useConstructor"));
|
|
26
|
+
var _useConstructor = _interopRequireDefault(require("./useConstructor"));
|
|
27
|
+
var _useSharedPluginState = require("./useSharedPluginState");
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useSharedPluginState = useSharedPluginState;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
|
+
var _react = require("react");
|
|
11
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
12
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* Directly map object values
|
|
16
|
+
*
|
|
17
|
+
* @param object The object to transform
|
|
18
|
+
* @param mapFunction The function to map an old value to new one
|
|
19
|
+
* @returns Object with the same key but transformed values
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
function mapValues(object, mapFunction) {
|
|
23
|
+
return Object.entries(object).reduce(function (acc, _ref) {
|
|
24
|
+
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
|
25
|
+
key = _ref2[0],
|
|
26
|
+
value = _ref2[1];
|
|
27
|
+
return _objectSpread(_objectSpread({}, acc), {}, (0, _defineProperty2.default)({}, key, mapFunction(value)));
|
|
28
|
+
}, {});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
* Used to return the current plugin state of
|
|
34
|
+
* input dependencies
|
|
35
|
+
*
|
|
36
|
+
* Example in plugin:
|
|
37
|
+
*
|
|
38
|
+
* ```typescript
|
|
39
|
+
* function ExampleContent({ api }: Props) {
|
|
40
|
+
* const { dogState, exampleState } = useSharedPluginState(
|
|
41
|
+
* api,
|
|
42
|
+
* ['dog', 'example']
|
|
43
|
+
* )
|
|
44
|
+
* return <p>{ dogState.title } { exampleState.description }</p>
|
|
45
|
+
* }
|
|
46
|
+
*
|
|
47
|
+
* const examplePlugin: NextEditorPlugin<'example', { dependencies: [typeof pluginDog] }> = (_, api) => {
|
|
48
|
+
* return {
|
|
49
|
+
* name: 'example',
|
|
50
|
+
* contentComponent: () =>
|
|
51
|
+
* <ExampleContent
|
|
52
|
+
* api={api}
|
|
53
|
+
* />
|
|
54
|
+
* }
|
|
55
|
+
* }
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* @param injectionApi Plugin injection API from `NextEditorPlugin`
|
|
59
|
+
* @param plugins Plugin names to get the shared plugin state for
|
|
60
|
+
* @returns A corresponding object, the keys are names of the plugin with `State` appended,
|
|
61
|
+
* the values are the shared state exposed by that plugin.
|
|
62
|
+
*/
|
|
63
|
+
function useSharedPluginState(injectionApi, plugins) {
|
|
64
|
+
// Create a memoized object containing the named plugins
|
|
65
|
+
var namedExternalPlugins = (0, _react.useMemo)(function () {
|
|
66
|
+
return plugins.reduce(function (acc, pluginName) {
|
|
67
|
+
return _objectSpread(_objectSpread({}, acc), {}, (0, _defineProperty2.default)({}, "".concat(pluginName, "State"), injectionApi === null || injectionApi === void 0 ? void 0 : injectionApi.dependencies[pluginName]));
|
|
68
|
+
}, {});
|
|
69
|
+
}, [injectionApi === null || injectionApi === void 0 ? void 0 : injectionApi.dependencies, plugins]);
|
|
70
|
+
return useSharedPluginStateInternal(namedExternalPlugins);
|
|
71
|
+
}
|
|
72
|
+
function useSharedPluginStateInternal(externalPlugins) {
|
|
73
|
+
var _useState = (0, _react.useState)(mapValues(externalPlugins, function (value) {
|
|
74
|
+
return value === null || value === void 0 ? void 0 : value.sharedState.currentState();
|
|
75
|
+
})),
|
|
76
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
77
|
+
state = _useState2[0],
|
|
78
|
+
setState = _useState2[1];
|
|
79
|
+
(0, _react.useEffect)(function () {
|
|
80
|
+
var unsubscribeListeners = Object.entries(externalPlugins).map(function (_ref3) {
|
|
81
|
+
var _ref4 = (0, _slicedToArray2.default)(_ref3, 2),
|
|
82
|
+
pluginKey = _ref4[0],
|
|
83
|
+
externalPlugin = _ref4[1];
|
|
84
|
+
return externalPlugin === null || externalPlugin === void 0 ? void 0 : externalPlugin.sharedState.onChange(function (_ref5) {
|
|
85
|
+
var nextSharedState = _ref5.nextSharedState,
|
|
86
|
+
prevSharedState = _ref5.prevSharedState;
|
|
87
|
+
if (prevSharedState === nextSharedState) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
setState(function (state) {
|
|
91
|
+
return _objectSpread(_objectSpread({}, state), {}, (0, _defineProperty2.default)({}, pluginKey, nextSharedState));
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
return function () {
|
|
96
|
+
unsubscribeListeners.forEach(function (cb) {
|
|
97
|
+
return cb === null || cb === void 0 ? void 0 : cb();
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
}, [externalPlugins]);
|
|
101
|
+
return state;
|
|
102
|
+
}
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.codeBlockButtonMessages = void 0;
|
|
7
7
|
var _reactIntlNext = require("react-intl-next");
|
|
8
|
-
var
|
|
8
|
+
var codeBlockButtonMessages = (0, _reactIntlNext.defineMessages)({
|
|
9
9
|
copyCodeToClipboard: {
|
|
10
10
|
id: 'fabric.editor.codeBlockCopyButton.copyToClipboard',
|
|
11
11
|
defaultMessage: 'Copy as text',
|
|
@@ -15,6 +15,16 @@ var codeBlockCopyButtonMessages = (0, _reactIntlNext.defineMessages)({
|
|
|
15
15
|
id: 'fabric.editor.codeBlockCopyButton.copiedToClipboard',
|
|
16
16
|
defaultMessage: 'Copied!',
|
|
17
17
|
description: 'Copied the content of the code block as text to clipboard'
|
|
18
|
+
},
|
|
19
|
+
wrapCode: {
|
|
20
|
+
id: 'fabric.editor.codeBlockWrapButton.wrapCodeBlock',
|
|
21
|
+
defaultMessage: 'Turn on wrap',
|
|
22
|
+
description: 'Wrap the content of the code block'
|
|
23
|
+
},
|
|
24
|
+
unwrapCode: {
|
|
25
|
+
id: 'fabric.editor.codeBlockWrapButton.unwrapCodeBlock',
|
|
26
|
+
defaultMessage: 'Turn off wrap',
|
|
27
|
+
description: 'Wrap the content of the code block'
|
|
18
28
|
}
|
|
19
29
|
});
|
|
20
|
-
exports.
|
|
30
|
+
exports.codeBlockButtonMessages = codeBlockButtonMessages;
|
|
@@ -9,10 +9,10 @@ Object.defineProperty(exports, "codeBidiWarningMessages", {
|
|
|
9
9
|
return _codeBidiWarning.codeBidiWarningMessages;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
Object.defineProperty(exports, "
|
|
12
|
+
Object.defineProperty(exports, "codeBlockButtonMessages", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
get: function get() {
|
|
15
|
-
return
|
|
15
|
+
return _codeBlockButton.codeBlockButtonMessages;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
exports.default = void 0;
|
|
@@ -38,7 +38,7 @@ var _reactIntlNext = require("react-intl-next");
|
|
|
38
38
|
var _codeBidiWarning = require("./codeBidiWarning");
|
|
39
39
|
var _link = require("./link");
|
|
40
40
|
var _unsupportedContent = require("./unsupportedContent");
|
|
41
|
-
var
|
|
41
|
+
var _codeBlockButton = require("./codeBlockButton");
|
|
42
42
|
var _insertBlock = require("./insert-block");
|
|
43
43
|
var _default = (0, _reactIntlNext.defineMessages)({
|
|
44
44
|
layoutFixedWidth: {
|
|
@@ -4,6 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
+
exports.getEnabledFeatureFlagKeys = getEnabledFeatureFlagKeys;
|
|
7
8
|
exports.normalizeFeatureFlags = normalizeFeatureFlags;
|
|
8
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
10
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
@@ -72,4 +73,15 @@ function normalizeFeatureFlags(rawFeatureFlags, options) {
|
|
|
72
73
|
}
|
|
73
74
|
return flags;
|
|
74
75
|
}, {});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Transforms FeatureFlags to a type safe string array of the enabled feature flags.
|
|
80
|
+
*
|
|
81
|
+
* Useful for analytics and analysis purposes.
|
|
82
|
+
*/
|
|
83
|
+
function getEnabledFeatureFlagKeys(featureFlags) {
|
|
84
|
+
return Object.keys(featureFlags).filter(function (key) {
|
|
85
|
+
return featureFlags[key] === true;
|
|
86
|
+
});
|
|
75
87
|
}
|
|
@@ -5,9 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.SharedStateAPI = exports.PluginsData = exports.EditorPluginInjectionAPI = void 0;
|
|
8
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
8
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
10
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
11
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
13
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
12
14
|
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
13
15
|
var _throttle = _interopRequireDefault(require("lodash/throttle"));
|
|
@@ -20,56 +22,78 @@ function hasGetSharedState(plugin) {
|
|
|
20
22
|
function hasActions(plugin) {
|
|
21
23
|
return (0, _typeof2.default)(plugin.actions) === 'object';
|
|
22
24
|
}
|
|
23
|
-
var
|
|
24
|
-
|
|
25
|
-
*
|
|
26
|
-
* After some investigations, we discovered this is the best ratio for our current Editor: 80ms. That means is five times bigger than the 60fps dream target.
|
|
27
|
-
*
|
|
28
|
-
* In the future, once we remove the entire WithPluginState, We may decide to reduce this value.
|
|
29
|
-
*
|
|
30
|
-
*/
|
|
31
|
-
var THROTTLE_CALLS_FOR_MILLISECONDS = DREAM_TARGET_60_FPS * 5;
|
|
32
|
-
var notifyListenersThrottled = (0, _throttle.default)(function (_ref) {
|
|
33
|
-
var newEditorState = _ref.newEditorState,
|
|
34
|
-
oldEditorState = _ref.oldEditorState,
|
|
35
|
-
listeners = _ref.listeners,
|
|
25
|
+
var filterPluginsWithListeners = function filterPluginsWithListeners(_ref) {
|
|
26
|
+
var listeners = _ref.listeners,
|
|
36
27
|
plugins = _ref.plugins;
|
|
28
|
+
return Array.from(listeners.keys()).map(function (pluginName) {
|
|
29
|
+
return plugins.get(pluginName);
|
|
30
|
+
}).filter(function (plugin) {
|
|
31
|
+
return plugin !== undefined && hasGetSharedState(plugin);
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var extractSharedStateFromPlugins = function extractSharedStateFromPlugins(_ref2) {
|
|
35
|
+
var oldEditorState = _ref2.oldEditorState,
|
|
36
|
+
newEditorState = _ref2.newEditorState,
|
|
37
|
+
plugins = _ref2.plugins;
|
|
37
38
|
var isInitialization = !oldEditorState && newEditorState;
|
|
38
|
-
var
|
|
39
|
-
var _iterator = _createForOfIteratorHelper(
|
|
39
|
+
var result = new Map();
|
|
40
|
+
var _iterator = _createForOfIteratorHelper(plugins),
|
|
40
41
|
_step;
|
|
41
42
|
try {
|
|
42
|
-
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return "continue";
|
|
43
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
44
|
+
var _plugin = _step.value;
|
|
45
|
+
if (!_plugin || !hasGetSharedState(_plugin)) {
|
|
46
|
+
continue;
|
|
47
47
|
}
|
|
48
|
-
var nextSharedState =
|
|
49
|
-
var prevSharedState = !isInitialization && oldEditorState ?
|
|
48
|
+
var nextSharedState = _plugin.getSharedState(newEditorState);
|
|
49
|
+
var prevSharedState = !isInitialization && oldEditorState ? _plugin.getSharedState(oldEditorState) : undefined;
|
|
50
50
|
var isSamePluginState = (0, _isEqual.default)(prevSharedState, nextSharedState);
|
|
51
51
|
if (isInitialization || !isSamePluginState) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
prevSharedState: prevSharedState
|
|
56
|
-
}));
|
|
52
|
+
result.set(_plugin.name, {
|
|
53
|
+
nextSharedState: nextSharedState,
|
|
54
|
+
prevSharedState: prevSharedState
|
|
57
55
|
});
|
|
58
56
|
}
|
|
59
|
-
};
|
|
60
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
61
|
-
var _ret = _loop();
|
|
62
|
-
if (_ret === "continue") continue;
|
|
63
57
|
}
|
|
64
58
|
} catch (err) {
|
|
65
59
|
_iterator.e(err);
|
|
66
60
|
} finally {
|
|
67
61
|
_iterator.f();
|
|
68
62
|
}
|
|
63
|
+
return result;
|
|
64
|
+
};
|
|
65
|
+
var THROTTLE_CALLS_FOR_MILLISECONDS = 0;
|
|
66
|
+
var notifyListenersThrottled = (0, _throttle.default)(function (_ref3) {
|
|
67
|
+
var listeners = _ref3.listeners,
|
|
68
|
+
updatesToNotifyQueue = _ref3.updatesToNotifyQueue;
|
|
69
|
+
var callbacks = [];
|
|
70
|
+
var _iterator2 = _createForOfIteratorHelper(updatesToNotifyQueue.entries()),
|
|
71
|
+
_step2;
|
|
72
|
+
try {
|
|
73
|
+
var _loop = function _loop() {
|
|
74
|
+
var _step2$value = (0, _slicedToArray2.default)(_step2.value, 2),
|
|
75
|
+
pluginName = _step2$value[0],
|
|
76
|
+
diffs = _step2$value[1];
|
|
77
|
+
var pluginListeners = listeners.get(pluginName) || [];
|
|
78
|
+
pluginListeners.forEach(function (callback) {
|
|
79
|
+
diffs.forEach(function (diff) {
|
|
80
|
+
callbacks.push(callback.bind(callback, diff));
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
85
|
+
_loop();
|
|
86
|
+
}
|
|
87
|
+
} catch (err) {
|
|
88
|
+
_iterator2.e(err);
|
|
89
|
+
} finally {
|
|
90
|
+
_iterator2.f();
|
|
91
|
+
}
|
|
92
|
+
updatesToNotifyQueue.clear();
|
|
69
93
|
if (callbacks.length === 0) {
|
|
70
94
|
return;
|
|
71
95
|
}
|
|
72
|
-
callbacks.forEach(function (cb) {
|
|
96
|
+
callbacks.reverse().forEach(function (cb) {
|
|
73
97
|
cb();
|
|
74
98
|
});
|
|
75
99
|
}, THROTTLE_CALLS_FOR_MILLISECONDS);
|
|
@@ -98,9 +122,10 @@ var ActionsAPI = /*#__PURE__*/function () {
|
|
|
98
122
|
return ActionsAPI;
|
|
99
123
|
}();
|
|
100
124
|
var SharedStateAPI = /*#__PURE__*/function () {
|
|
101
|
-
function SharedStateAPI(
|
|
102
|
-
var getEditorState =
|
|
125
|
+
function SharedStateAPI(_ref4) {
|
|
126
|
+
var getEditorState = _ref4.getEditorState;
|
|
103
127
|
(0, _classCallCheck2.default)(this, SharedStateAPI);
|
|
128
|
+
(0, _defineProperty2.default)(this, "updatesToNotifyQueue", new Map());
|
|
104
129
|
this.getEditorState = getEditorState;
|
|
105
130
|
this.listeners = new Map();
|
|
106
131
|
}
|
|
@@ -121,10 +146,10 @@ var SharedStateAPI = /*#__PURE__*/function () {
|
|
|
121
146
|
var pluginName = plugin.name;
|
|
122
147
|
return {
|
|
123
148
|
currentState: function currentState() {
|
|
124
|
-
|
|
125
|
-
if (!state || !hasGetSharedState(plugin)) {
|
|
149
|
+
if (!hasGetSharedState(plugin)) {
|
|
126
150
|
return undefined;
|
|
127
151
|
}
|
|
152
|
+
var state = _this.getEditorState();
|
|
128
153
|
return plugin.getSharedState(state);
|
|
129
154
|
},
|
|
130
155
|
onChange: function onChange(sub) {
|
|
@@ -132,42 +157,74 @@ var SharedStateAPI = /*#__PURE__*/function () {
|
|
|
132
157
|
pluginListeners.add(sub);
|
|
133
158
|
_this.listeners.set(pluginName, pluginListeners);
|
|
134
159
|
return function () {
|
|
135
|
-
|
|
160
|
+
return _this.cleanupSubscription(pluginName, sub);
|
|
136
161
|
};
|
|
137
162
|
}
|
|
138
163
|
};
|
|
139
164
|
}
|
|
165
|
+
}, {
|
|
166
|
+
key: "cleanupSubscription",
|
|
167
|
+
value: function cleanupSubscription(pluginName, sub) {
|
|
168
|
+
(this.listeners.get(pluginName) || new Set()).delete(sub);
|
|
169
|
+
}
|
|
140
170
|
}, {
|
|
141
171
|
key: "notifyListeners",
|
|
142
|
-
value: function notifyListeners(
|
|
143
|
-
var newEditorState =
|
|
144
|
-
oldEditorState =
|
|
145
|
-
plugins =
|
|
146
|
-
var listeners = this.listeners
|
|
147
|
-
|
|
148
|
-
|
|
172
|
+
value: function notifyListeners(_ref5) {
|
|
173
|
+
var newEditorState = _ref5.newEditorState,
|
|
174
|
+
oldEditorState = _ref5.oldEditorState,
|
|
175
|
+
plugins = _ref5.plugins;
|
|
176
|
+
var listeners = this.listeners,
|
|
177
|
+
updatesToNotifyQueue = this.updatesToNotifyQueue;
|
|
178
|
+
var pluginsFiltered = filterPluginsWithListeners({
|
|
179
|
+
plugins: plugins,
|
|
180
|
+
listeners: listeners
|
|
181
|
+
});
|
|
182
|
+
var sharedStateDiffs = extractSharedStateFromPlugins({
|
|
149
183
|
oldEditorState: oldEditorState,
|
|
150
|
-
|
|
151
|
-
plugins:
|
|
184
|
+
newEditorState: newEditorState,
|
|
185
|
+
plugins: pluginsFiltered
|
|
186
|
+
});
|
|
187
|
+
if (sharedStateDiffs.size === 0) {
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
var _iterator3 = _createForOfIteratorHelper(sharedStateDiffs),
|
|
191
|
+
_step3;
|
|
192
|
+
try {
|
|
193
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
194
|
+
var _step3$value = (0, _slicedToArray2.default)(_step3.value, 2),
|
|
195
|
+
pluginName = _step3$value[0],
|
|
196
|
+
nextDiff = _step3$value[1];
|
|
197
|
+
var currentDiffQueue = updatesToNotifyQueue.get(pluginName) || [];
|
|
198
|
+
updatesToNotifyQueue.set(pluginName, [].concat((0, _toConsumableArray2.default)(currentDiffQueue), [nextDiff]));
|
|
199
|
+
}
|
|
200
|
+
} catch (err) {
|
|
201
|
+
_iterator3.e(err);
|
|
202
|
+
} finally {
|
|
203
|
+
_iterator3.f();
|
|
204
|
+
}
|
|
205
|
+
notifyListenersThrottled({
|
|
206
|
+
updatesToNotifyQueue: updatesToNotifyQueue,
|
|
207
|
+
listeners: listeners
|
|
152
208
|
});
|
|
153
209
|
}
|
|
154
210
|
}, {
|
|
155
211
|
key: "destroy",
|
|
156
212
|
value: function destroy() {
|
|
157
213
|
this.listeners.clear();
|
|
214
|
+
this.updatesToNotifyQueue.clear();
|
|
158
215
|
}
|
|
159
216
|
}]);
|
|
160
217
|
return SharedStateAPI;
|
|
161
218
|
}();
|
|
162
219
|
exports.SharedStateAPI = SharedStateAPI;
|
|
163
220
|
var EditorPluginInjectionAPI = /*#__PURE__*/function () {
|
|
164
|
-
function EditorPluginInjectionAPI(
|
|
221
|
+
function EditorPluginInjectionAPI(_ref6) {
|
|
165
222
|
var _this2 = this;
|
|
166
|
-
var getEditorState =
|
|
223
|
+
var getEditorState = _ref6.getEditorState;
|
|
167
224
|
(0, _classCallCheck2.default)(this, EditorPluginInjectionAPI);
|
|
168
|
-
(0, _defineProperty2.default)(this, "onEditorViewUpdated", function (
|
|
169
|
-
var newEditorState =
|
|
170
|
-
oldEditorState =
|
|
225
|
+
(0, _defineProperty2.default)(this, "onEditorViewUpdated", function (_ref7) {
|
|
226
|
+
var newEditorState = _ref7.newEditorState,
|
|
227
|
+
oldEditorState = _ref7.oldEditorState;
|
|
171
228
|
_this2.sharedStateAPI.notifyListeners({
|
|
172
229
|
newEditorState: newEditorState,
|
|
173
230
|
oldEditorState: oldEditorState,
|
|
@@ -196,8 +253,13 @@ var EditorPluginInjectionAPI = /*#__PURE__*/function () {
|
|
|
196
253
|
var sharedStateAPI = this.sharedStateAPI,
|
|
197
254
|
actionsAPI = this.actionsAPI,
|
|
198
255
|
getPluginByName = this.getPluginByName;
|
|
199
|
-
var
|
|
256
|
+
var dependencies = new Proxy({}, {
|
|
200
257
|
get: function get(target, prop, receiver) {
|
|
258
|
+
// If we pass this as a prop React hates us
|
|
259
|
+
// Let's just reflect the result and ignore these
|
|
260
|
+
if (prop === 'toJSON') {
|
|
261
|
+
return Reflect.get(target, prop);
|
|
262
|
+
}
|
|
201
263
|
var plugin = getPluginByName(prop);
|
|
202
264
|
if (!plugin) {
|
|
203
265
|
// eslint-disable-next-line
|
|
@@ -214,7 +276,7 @@ var EditorPluginInjectionAPI = /*#__PURE__*/function () {
|
|
|
214
276
|
}
|
|
215
277
|
});
|
|
216
278
|
return {
|
|
217
|
-
|
|
279
|
+
dependencies: dependencies
|
|
218
280
|
};
|
|
219
281
|
}
|
|
220
282
|
}]);
|
|
@@ -43,6 +43,8 @@ var TableSharedCssClassName = {
|
|
|
43
43
|
TABLE_STICKY_WRAPPER: "".concat(_adfSchema.tablePrefixSelector, "-sticky-wrapper"),
|
|
44
44
|
TABLE_STICKY_SENTINEL_TOP: "".concat(_adfSchema.tablePrefixSelector, "-sticky-sentinel-top"),
|
|
45
45
|
TABLE_STICKY_SENTINEL_BOTTOM: "".concat(_adfSchema.tablePrefixSelector, "-sticky-sentinel-bottom"),
|
|
46
|
+
TABLE_SHADOW_SENTINEL_LEFT: "".concat(_adfSchema.tablePrefixSelector, "-shadow-sentinel-left"),
|
|
47
|
+
TABLE_SHADOW_SENTINEL_RIGHT: "".concat(_adfSchema.tablePrefixSelector, "-shadow-sentinel-right"),
|
|
46
48
|
TABLE_CELL_NODEVIEW_CONTENT_DOM: _adfSchema.tableCellContentDomSelector,
|
|
47
49
|
TABLE_CELL_WRAPPER: _adfSchema.tableCellSelector,
|
|
48
50
|
TABLE_HEADER_CELL_WRAPPER: _adfSchema.tableHeaderSelector,
|
|
@@ -24,7 +24,7 @@ var _templateObject, _templateObject2, _templateObject3;
|
|
|
24
24
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
25
25
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
26
26
|
var packageName = "@atlaskit/editor-common";
|
|
27
|
-
var packageVersion = "72.
|
|
27
|
+
var packageVersion = "72.7.0";
|
|
28
28
|
var halfFocusRing = 1;
|
|
29
29
|
var dropOffset = "0, ".concat((0, _constants.gridSize)(), "px");
|
|
30
30
|
var DropList = /*#__PURE__*/function (_Component) {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _adfSchema = require("@atlaskit/adf-schema");
|
|
9
|
+
var _common = require("./common");
|
|
10
|
+
var _getColorMessage = _interopRequireDefault(require("./getColorMessage"));
|
|
11
|
+
var _paletteMessages = _interopRequireDefault(require("./paletteMessages"));
|
|
12
|
+
var borderColorPalette = [];
|
|
13
|
+
_adfSchema.borderColorPalette.forEach(function (label, color) {
|
|
14
|
+
var key = label.toLowerCase().replace(' ', '-');
|
|
15
|
+
var message = (0, _getColorMessage.default)(_paletteMessages.default, key);
|
|
16
|
+
borderColorPalette.push({
|
|
17
|
+
value: color,
|
|
18
|
+
label: label,
|
|
19
|
+
border: _common.DEFAULT_BORDER_COLOR,
|
|
20
|
+
message: message
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
var _default = borderColorPalette;
|
|
24
|
+
exports.default = _default;
|
|
@@ -15,6 +15,12 @@ Object.defineProperty(exports, "backgroundPaletteTooltipMessages", {
|
|
|
15
15
|
return _paletteMessagesTokenModeNames.backgroundPaletteTooltipMessages;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
+
Object.defineProperty(exports, "borderPaletteTooltipMessages", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _paletteMessagesTokenModeNames.borderPaletteTooltipMessages;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
18
24
|
Object.defineProperty(exports, "textPaletteTooltipMessages", {
|
|
19
25
|
enumerable: true,
|
|
20
26
|
get: function get() {
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.textPaletteTooltipMessages = exports.lightTextPaletteTooltipMessages = exports.lightBackgroundPaletteTooltipMessages = exports.darkTextPaletteTooltipMessages = exports.darkBackgroundPaletteTooltipMessages = exports.backgroundPaletteTooltipMessages = void 0;
|
|
7
|
+
exports.textPaletteTooltipMessages = exports.lightTextPaletteTooltipMessages = exports.lightBackgroundPaletteTooltipMessages = exports.darkTextPaletteTooltipMessages = exports.darkBackgroundPaletteTooltipMessages = exports.borderPaletteTooltipMessages = exports.backgroundPaletteTooltipMessages = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _reactIntlNext = require("react-intl-next");
|
|
10
10
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -258,4 +258,27 @@ var backgroundPaletteTooltipMessages = {
|
|
|
258
258
|
light: lightBackgroundPaletteTooltipMessages,
|
|
259
259
|
dark: darkBackgroundPaletteTooltipMessages
|
|
260
260
|
};
|
|
261
|
-
exports.backgroundPaletteTooltipMessages = backgroundPaletteTooltipMessages;
|
|
261
|
+
exports.backgroundPaletteTooltipMessages = backgroundPaletteTooltipMessages;
|
|
262
|
+
var lightBorderPaletteTooltipMessages = (0, _reactIntlNext.defineMessages)({
|
|
263
|
+
'#091E4224': {
|
|
264
|
+
id: 'fabric.theme.subtle-gray',
|
|
265
|
+
defaultMessage: 'Subtle gray',
|
|
266
|
+
description: 'Name of a color'
|
|
267
|
+
},
|
|
268
|
+
'#758195': {
|
|
269
|
+
id: 'fabric.theme.gray',
|
|
270
|
+
defaultMessage: 'Gray',
|
|
271
|
+
description: 'Name of a color'
|
|
272
|
+
},
|
|
273
|
+
'#172B4D': {
|
|
274
|
+
id: 'fabric.theme.bold-gray',
|
|
275
|
+
defaultMessage: 'Bold gray',
|
|
276
|
+
description: 'Name of a color'
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
var darkBorderPaletteTooltipMessages = _objectSpread({}, lightBorderPaletteTooltipMessages);
|
|
280
|
+
var borderPaletteTooltipMessages = {
|
|
281
|
+
light: lightBorderPaletteTooltipMessages,
|
|
282
|
+
dark: darkBorderPaletteTooltipMessages
|
|
283
|
+
};
|
|
284
|
+
exports.borderPaletteTooltipMessages = borderPaletteTooltipMessages;
|
|
@@ -34,6 +34,18 @@ Object.defineProperty(exports, "backgroundPaletteTooltipMessages", {
|
|
|
34
34
|
return _Palettes.backgroundPaletteTooltipMessages;
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
|
+
Object.defineProperty(exports, "borderColorPalette", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function get() {
|
|
40
|
+
return _borderColorPalette.default;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
Object.defineProperty(exports, "borderPaletteTooltipMessages", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function get() {
|
|
46
|
+
return _Palettes.borderPaletteTooltipMessages;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
37
49
|
Object.defineProperty(exports, "cellBackgroundColorPalette", {
|
|
38
50
|
enumerable: true,
|
|
39
51
|
get: function get() {
|
|
@@ -109,4 +121,5 @@ var _panelBackgroundPalette = require("./ColorPalette/Palettes/panelBackgroundPa
|
|
|
109
121
|
var _statusColorPalette = require("./ColorPalette/Palettes/statusColorPalette");
|
|
110
122
|
var _textColorPalette = require("./ColorPalette/Palettes/textColorPalette");
|
|
111
123
|
var _Palettes = require("./ColorPalette/Palettes");
|
|
112
|
-
var _common = require("./ColorPalette/Palettes/common");
|
|
124
|
+
var _common = require("./ColorPalette/Palettes/common");
|
|
125
|
+
var _borderColorPalette = _interopRequireDefault(require("./ColorPalette/Palettes/borderColorPalette"));
|
package/dist/cjs/version.json
CHANGED