@atlaskit/editor-common 107.6.1 → 107.7.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 +26 -0
- package/afm-cc/tsconfig.json +3 -0
- package/afm-jira/tsconfig.json +3 -0
- package/afm-post-office/tsconfig.json +3 -0
- package/dist/cjs/extensibility/Extension/Extension/index.js +15 -2
- package/dist/cjs/extensibility/Extension/Extension/styles.js +4 -0
- package/dist/cjs/extensibility/Extension/LegacyContentHeader/index.js +109 -0
- package/dist/cjs/extensibility/index.js +7 -0
- package/dist/cjs/hooks/index.js +8 -1
- package/dist/cjs/hooks/useSharedPluginStateWithSelector.js +171 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/type-ahead/messages.js +7 -7
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/es2019/extensibility/Extension/Extension/index.js +10 -1
- package/dist/es2019/extensibility/Extension/Extension/styles.js +4 -0
- package/dist/es2019/extensibility/Extension/LegacyContentHeader/index.js +104 -0
- package/dist/es2019/extensibility/index.js +1 -0
- package/dist/es2019/hooks/index.js +2 -1
- package/dist/es2019/hooks/useSharedPluginStateWithSelector.js +143 -0
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/type-ahead/messages.js +7 -7
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/esm/extensibility/Extension/Extension/index.js +15 -2
- package/dist/esm/extensibility/Extension/Extension/styles.js +4 -0
- package/dist/esm/extensibility/Extension/LegacyContentHeader/index.js +102 -0
- package/dist/esm/extensibility/index.js +1 -0
- package/dist/esm/hooks/index.js +2 -1
- package/dist/esm/hooks/useSharedPluginStateWithSelector.js +165 -0
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/type-ahead/messages.js +7 -7
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/types/extensibility/Extension/LegacyContentHeader/index.d.ts +12 -0
- package/dist/types/extensibility/index.d.ts +1 -0
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/hooks/useSharedPluginStateWithSelector.d.ts +41 -0
- package/dist/types/type-ahead/messages.d.ts +2 -2
- package/dist/types-ts4.5/extensibility/Extension/LegacyContentHeader/index.d.ts +12 -0
- package/dist/types-ts4.5/extensibility/index.d.ts +1 -0
- package/dist/types-ts4.5/hooks/index.d.ts +1 -0
- package/dist/types-ts4.5/hooks/useSharedPluginStateWithSelector.d.ts +41 -0
- package/dist/types-ts4.5/type-ahead/messages.d.ts +2 -2
- package/package.json +8 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 107.7.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#179943](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/179943)
|
|
8
|
+
[`3ecd2fde1b7b2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3ecd2fde1b7b2) -
|
|
9
|
+
[ux] [EDITOR-981] Update extension to use new LegacyContentHeader behind fg
|
|
10
|
+
'platform_editor_legacy_content_macro_visual_update'
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 107.7.0
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- [#182161](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/182161)
|
|
18
|
+
[`dcf2f7bd931a8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/dcf2f7bd931a8) -
|
|
19
|
+
feat: add useSharedStateWithSelector to editor-common
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- [#181781](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/181781)
|
|
24
|
+
[`e0060cc2c2eb7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e0060cc2c2eb7) -
|
|
25
|
+
ED-28417 Offline Editing: Update the type ahead error to clear on new requests, and make error
|
|
26
|
+
more generic.
|
|
27
|
+
- Updated dependencies
|
|
28
|
+
|
|
3
29
|
## 107.6.1
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
package/afm-cc/tsconfig.json
CHANGED
package/afm-jira/tsconfig.json
CHANGED
|
@@ -146,6 +146,9 @@
|
|
|
146
146
|
{
|
|
147
147
|
"path": "../../../design-system/spinner/afm-post-office/tsconfig.json"
|
|
148
148
|
},
|
|
149
|
+
{
|
|
150
|
+
"path": "../../../elements/status/afm-post-office/tsconfig.json"
|
|
151
|
+
},
|
|
149
152
|
{
|
|
150
153
|
"path": "../../../elements/task-decision/afm-post-office/tsconfig.json"
|
|
151
154
|
},
|
|
@@ -12,10 +12,12 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _react2 = require("@emotion/react");
|
|
14
14
|
var _classnames2 = _interopRequireDefault(require("classnames"));
|
|
15
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
16
|
var _hooks = require("../../../hooks");
|
|
16
17
|
var _useSharedPluginStateSelector = require("../../../hooks/useSharedPluginStateSelector/useSharedPluginStateSelector");
|
|
17
18
|
var _ui = require("../../../ui");
|
|
18
19
|
var _utils = require("../../../utils");
|
|
20
|
+
var _LegacyContentHeader = require("../LegacyContentHeader");
|
|
19
21
|
var _Lozenge = _interopRequireDefault(require("../Lozenge"));
|
|
20
22
|
var _styles = require("../styles");
|
|
21
23
|
var _extensionUtils = require("./extension-utils");
|
|
@@ -56,6 +58,7 @@ function ExtensionWithPluginState(props) {
|
|
|
56
58
|
var _extensionNode$attrs, _extensionNode$attrs2;
|
|
57
59
|
return extensionNode.type.name === 'extension' && ((_extensionNode$attrs = extensionNode.attrs) === null || _extensionNode$attrs === void 0 ? void 0 : _extensionNode$attrs.extensionType) === 'com.atlassian.confluence.migration' && ((_extensionNode$attrs2 = extensionNode.attrs) === null || _extensionNode$attrs2 === void 0 ? void 0 : _extensionNode$attrs2.extensionKey) === 'legacy-content';
|
|
58
60
|
};
|
|
61
|
+
var showLegacyContentHeader = (0, _platformFeatureFlags.fg)('platform_editor_legacy_content_macro_visual_update') && isLegacyContentMacroExtension(node);
|
|
59
62
|
var hasBody = ['bodiedExtension', 'multiBodiedExtension'].includes(node.type.name);
|
|
60
63
|
var hasChildren = !!children;
|
|
61
64
|
var removeBorder = showMacroInteractionDesignUpdates || !!(hideFrame && !hasBody);
|
|
@@ -87,7 +90,8 @@ function ExtensionWithPluginState(props) {
|
|
|
87
90
|
'with-margin-styles': showMacroInteractionDesignUpdates && !isNodeNested && !showBodiedExtensionRendererView,
|
|
88
91
|
'with-hover-border': showMacroInteractionDesignUpdates && isNodeHovered,
|
|
89
92
|
'with-danger-overlay': showMacroInteractionDesignUpdates,
|
|
90
|
-
'without-frame': removeBorder
|
|
93
|
+
'without-frame': removeBorder,
|
|
94
|
+
'legacy-content': showLegacyContentHeader
|
|
91
95
|
}, _styles2.widerLayoutClassName, shouldBreakout));
|
|
92
96
|
var overflowClassNames = (0, _classnames2.default)('extension-overflow-wrapper', {
|
|
93
97
|
'with-body': hasBody,
|
|
@@ -128,7 +132,16 @@ function ExtensionWithPluginState(props) {
|
|
|
128
132
|
setIsNodeHovered(didHover);
|
|
129
133
|
}
|
|
130
134
|
};
|
|
131
|
-
return (0, _react2.jsx)(_react.Fragment, null,
|
|
135
|
+
return (0, _react2.jsx)(_react.Fragment, null, showLegacyContentHeader && (0, _react2.jsx)(_LegacyContentHeader.LegacyContentHeader, {
|
|
136
|
+
isNodeSelected: isNodeSelected,
|
|
137
|
+
isNodeHovered: isNodeHovered,
|
|
138
|
+
onMouseEnter: function onMouseEnter() {
|
|
139
|
+
return handleMouseEvent(true);
|
|
140
|
+
},
|
|
141
|
+
onMouseLeave: function onMouseLeave() {
|
|
142
|
+
return handleMouseEvent(false);
|
|
143
|
+
}
|
|
144
|
+
}), !showLegacyContentHeader && showMacroInteractionDesignUpdates && !isLivePageViewMode && (0, _react2.jsx)(_Lozenge.default, {
|
|
132
145
|
isNodeSelected: isNodeSelected,
|
|
133
146
|
isNodeHovered: isNodeHovered,
|
|
134
147
|
isNodeNested: isNodeNested,
|
|
@@ -33,6 +33,10 @@ var wrapperStyleWithoutCursor = (0, _react.css)(_styles.wrapperDefault, {
|
|
|
33
33
|
'&.with-margin-styles': {
|
|
34
34
|
margin: "0 ".concat("var(--ds-space-negative-250, -20px)"),
|
|
35
35
|
padding: "0 ".concat("var(--ds-space-250, 20px)")
|
|
36
|
+
},
|
|
37
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
38
|
+
'&.legacy-content': {
|
|
39
|
+
borderRadius: "0 0 ".concat("var(--ds-border-radius, 3px)", " ", "var(--ds-border-radius, 3px)")
|
|
36
40
|
}
|
|
37
41
|
});
|
|
38
42
|
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.LegacyContentHeader = void 0;
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _react2 = require("@emotion/react");
|
|
10
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
+
var _reactIntlNext = require("react-intl-next");
|
|
12
|
+
var _statusWarning = _interopRequireDefault(require("@atlaskit/icon/core/status-warning"));
|
|
13
|
+
var _link = _interopRequireDefault(require("@atlaskit/link"));
|
|
14
|
+
var _status = require("@atlaskit/status");
|
|
15
|
+
/**
|
|
16
|
+
* @jsxRuntime classic
|
|
17
|
+
* @jsx jsx
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
21
|
+
|
|
22
|
+
var i18n = (0, _reactIntlNext.defineMessages)({
|
|
23
|
+
legacyContentHeader: {
|
|
24
|
+
id: 'editor.extension.legacyContentHeader',
|
|
25
|
+
defaultMessage: 'Legacy Content',
|
|
26
|
+
description: 'Header for the legacy content extension in the editor.'
|
|
27
|
+
},
|
|
28
|
+
contentHasLimitedFunctionality: {
|
|
29
|
+
id: 'editor.extension.legacyContentHeader.contentHasLimitedFunctionality',
|
|
30
|
+
defaultMessage: 'This content has limited functionality, ',
|
|
31
|
+
description: 'Message indicating that the legacy content has limited functionality.'
|
|
32
|
+
},
|
|
33
|
+
learnMore: {
|
|
34
|
+
id: 'editor.extension.legacyContentHeader.learnMore',
|
|
35
|
+
defaultMessage: ' Learn more',
|
|
36
|
+
description: 'Link text for learning more about the legacy content.'
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
var lcmHeaderStyles = (0, _react2.css)({
|
|
40
|
+
padding: "0 ".concat("var(--ds-space-200, 16px)", " ", "var(--ds-space-050, 4px)", " ", "var(--ds-space-200, 16px)"),
|
|
41
|
+
backgroundColor: "var(--ds-background-neutral, #0515240F)",
|
|
42
|
+
borderRadius: "var(--ds-border-radius, 4px)".concat(" ", "var(--ds-border-radius, 4px)", " 0 0"),
|
|
43
|
+
boxShadow: "0 0 0 1px ".concat("var(--ds-background-neutral, #0515240F)"),
|
|
44
|
+
position: 'relative',
|
|
45
|
+
top: "-1px",
|
|
46
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
47
|
+
'&.with-hover-border': {
|
|
48
|
+
boxShadow: "0 0 0 1px ".concat("var(--ds-border-input, #8590A2)")
|
|
49
|
+
},
|
|
50
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
51
|
+
'&.selected': {
|
|
52
|
+
boxShadow: "0 0 0 1px ".concat("var(--ds-border-selected, #0C66E4)"),
|
|
53
|
+
backgroundColor: "var(--ds-background-selected, #E9F2FF)"
|
|
54
|
+
},
|
|
55
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
56
|
+
'& .status-lozenge-span': {
|
|
57
|
+
marginRight: "var(--ds-space-100, 8px)"
|
|
58
|
+
},
|
|
59
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
60
|
+
'& > .legacy-content-header-text': {
|
|
61
|
+
font: "var(--ds-font-body-UNSAFE_small, 12px)",
|
|
62
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
63
|
+
'& span': {
|
|
64
|
+
paddingRight: "var(--ds-space-050, 4px)"
|
|
65
|
+
},
|
|
66
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
67
|
+
'& a': {
|
|
68
|
+
cursor: 'pointer'
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
var LegacyContentHeader = exports.LegacyContentHeader = function LegacyContentHeader(_ref) {
|
|
73
|
+
var isNodeHovered = _ref.isNodeHovered,
|
|
74
|
+
isNodeSelected = _ref.isNodeSelected,
|
|
75
|
+
onMouseEnter = _ref.onMouseEnter,
|
|
76
|
+
onMouseLeave = _ref.onMouseLeave;
|
|
77
|
+
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
78
|
+
formatMessage = _useIntl.formatMessage;
|
|
79
|
+
var classNames = (0, _classnames.default)('legacy-content-header', {
|
|
80
|
+
'with-hover-border': isNodeHovered,
|
|
81
|
+
selected: isNodeSelected
|
|
82
|
+
});
|
|
83
|
+
var learnMore = (0, _react.useCallback)(function () {
|
|
84
|
+
window.open('https://support.atlassian.com/confluence-cloud/docs/the-legacy-content-macro/', '_blank');
|
|
85
|
+
}, []);
|
|
86
|
+
return (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)("div", {
|
|
87
|
+
"data-testid": "editor-extension-legacy-content-header",
|
|
88
|
+
css: [lcmHeaderStyles]
|
|
89
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
90
|
+
,
|
|
91
|
+
className: classNames,
|
|
92
|
+
onMouseEnter: onMouseEnter,
|
|
93
|
+
onMouseLeave: onMouseLeave
|
|
94
|
+
}, (0, _react2.jsx)(_status.Status, {
|
|
95
|
+
text: formatMessage(i18n.legacyContentHeader),
|
|
96
|
+
color: isNodeSelected ? 'blue' : 'neutral',
|
|
97
|
+
style: "bold",
|
|
98
|
+
isBold: true
|
|
99
|
+
}), (0, _react2.jsx)("span", {
|
|
100
|
+
className: "legacy-content-header-text"
|
|
101
|
+
}, (0, _react2.jsx)(_statusWarning.default, {
|
|
102
|
+
label: formatMessage(i18n.contentHasLimitedFunctionality),
|
|
103
|
+
size: "small"
|
|
104
|
+
}), formatMessage(i18n.contentHasLimitedFunctionality), "\xA0", (0, _react2.jsx)(_link.default, {
|
|
105
|
+
onClick: learnMore,
|
|
106
|
+
href: "https://support.atlassian.com/confluence-cloud/docs/the-legacy-content-macro/",
|
|
107
|
+
target: "_blank"
|
|
108
|
+
}, formatMessage(i18n.learnMore)))));
|
|
109
|
+
};
|
|
@@ -34,8 +34,15 @@ Object.defineProperty(exports, "ExtensionNodeWrapper", {
|
|
|
34
34
|
return _ExtensionNodeWrapper.ExtensionNodeWrapper;
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
|
+
Object.defineProperty(exports, "LegacyContentHeader", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function get() {
|
|
40
|
+
return _LegacyContentHeader.LegacyContentHeader;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
37
43
|
var _ExtensionNodeWrapper = require("./ExtensionNodeWrapper");
|
|
38
44
|
var _Extension = require("./Extension");
|
|
45
|
+
var _LegacyContentHeader = require("./Extension/LegacyContentHeader");
|
|
39
46
|
var _extensionNodeView = _interopRequireWildcard(require("./extensionNodeView"));
|
|
40
47
|
var _ExtensionComponent = require("./ExtensionComponent");
|
|
41
48
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
package/dist/cjs/hooks/index.js
CHANGED
|
@@ -28,7 +28,14 @@ Object.defineProperty(exports, "useSharedPluginState", {
|
|
|
28
28
|
return _useSharedPluginState.useSharedPluginState;
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
|
+
Object.defineProperty(exports, "useSharedPluginStateWithSelector", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function get() {
|
|
34
|
+
return _useSharedPluginStateWithSelector.useSharedPluginStateWithSelector;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
31
37
|
var _usePreviousState = _interopRequireDefault(require("./usePreviousState"));
|
|
32
38
|
var _useConstructor = _interopRequireDefault(require("./useConstructor"));
|
|
33
39
|
var _useSharedPluginState = require("./useSharedPluginState");
|
|
34
|
-
var _sharedPluginStateHookMigratorFactory = require("./sharedPluginStateHookMigratorFactory");
|
|
40
|
+
var _sharedPluginStateHookMigratorFactory = require("./sharedPluginStateHookMigratorFactory");
|
|
41
|
+
var _useSharedPluginStateWithSelector = require("./useSharedPluginStateWithSelector");
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useSharedPluginStateWithSelector = useSharedPluginStateWithSelector;
|
|
8
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
+
var _react = require("react");
|
|
12
|
+
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
13
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
14
|
+
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) { (0, _defineProperty2.default)(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; }
|
|
15
|
+
// Ignored via go/ees005
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* Directly map object values
|
|
21
|
+
*
|
|
22
|
+
* @private
|
|
23
|
+
* @param object The object to transform
|
|
24
|
+
* @param mapFunction The function to map an old value to new one
|
|
25
|
+
* @returns Object with the same key but transformed values
|
|
26
|
+
*
|
|
27
|
+
*/
|
|
28
|
+
function mapValues(object, mapFunction) {
|
|
29
|
+
return Object.entries(object).reduce(function (acc, _ref) {
|
|
30
|
+
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
|
31
|
+
key = _ref2[0],
|
|
32
|
+
value = _ref2[1];
|
|
33
|
+
return _objectSpread(_objectSpread({}, acc), {}, (0, _defineProperty2.default)({}, key, mapFunction(value)));
|
|
34
|
+
}, {});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// When we use the `useSharedPluginStateWithSelector` example: `useSharedPluginStateWithSelector(api, ['width'], selector)`
|
|
38
|
+
// it will re-render every time the component re-renders as the array "['width']" is seen as an update.
|
|
39
|
+
// This hook is used to prevent re-renders due to this.
|
|
40
|
+
function useStaticPlugins(plugins) {
|
|
41
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
42
|
+
return (0, _react.useMemo)(function () {
|
|
43
|
+
return plugins;
|
|
44
|
+
}, []);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
*
|
|
49
|
+
* ⚠️⚠️⚠️ This is a debounced hook ⚠️⚠️⚠️
|
|
50
|
+
* If the plugins you are listening to generate multiple shared states while the user is typing,
|
|
51
|
+
* your React Component will get only the last one.
|
|
52
|
+
*
|
|
53
|
+
* Used to return the current plugin state of input dependencies.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* Example in plugin:
|
|
57
|
+
*
|
|
58
|
+
* ```typescript
|
|
59
|
+
* function selector(states: NamedPluginStatesFromInjectionAPI<API, ['dog']>) {
|
|
60
|
+
* return {
|
|
61
|
+
* title: states.dogState?.title,
|
|
62
|
+
* }
|
|
63
|
+
* }
|
|
64
|
+
*
|
|
65
|
+
* function ExampleContent({ api }: Props) {
|
|
66
|
+
* const { title } = useSharedPluginStateWithSelector(
|
|
67
|
+
* api,
|
|
68
|
+
* ['dog'],
|
|
69
|
+
* selector
|
|
70
|
+
* )
|
|
71
|
+
* return <p>{ title }</p>
|
|
72
|
+
* }
|
|
73
|
+
*
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* @param injectionApi Plugin injection API from `NextEditorPlugin`
|
|
77
|
+
* @param plugins Plugin names to get the shared plugin state for
|
|
78
|
+
* @param selector A function that takes the shared states of the plugins and returns a subset of a plugin state.
|
|
79
|
+
* @returns A corresponding object, the keys are names of the plugin with `State` appended,
|
|
80
|
+
* the values are the shared state exposed by that plugin.
|
|
81
|
+
*/
|
|
82
|
+
function useSharedPluginStateWithSelector(injectionApi, plugins, selector) {
|
|
83
|
+
var pluginNames = useStaticPlugins(plugins);
|
|
84
|
+
|
|
85
|
+
// Create a memoized object containing the named plugins
|
|
86
|
+
var namedExternalPlugins = (0, _react.useMemo)(function () {
|
|
87
|
+
return pluginNames.reduce(function (acc, pluginName) {
|
|
88
|
+
return _objectSpread(_objectSpread({}, acc), {}, (0, _defineProperty2.default)({}, "".concat(String(pluginName), "State"), injectionApi === null || injectionApi === void 0 ? void 0 : injectionApi[pluginName]));
|
|
89
|
+
}, {});
|
|
90
|
+
}, [injectionApi, pluginNames]);
|
|
91
|
+
return useSharedPluginStateInternal(namedExternalPlugins, selector);
|
|
92
|
+
}
|
|
93
|
+
function useSharedPluginStateInternal(externalPlugins, selector) {
|
|
94
|
+
var refStates = (0, _react.useRef)(mapValues(externalPlugins, function (value) {
|
|
95
|
+
return value === null || value === void 0 ? void 0 : value.sharedState.currentState();
|
|
96
|
+
}));
|
|
97
|
+
var _useState = (0, _react.useState)(function () {
|
|
98
|
+
return selector(refStates.current);
|
|
99
|
+
}),
|
|
100
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
101
|
+
pluginStates = _useState2[0],
|
|
102
|
+
setPluginState = _useState2[1];
|
|
103
|
+
var mounted = (0, _react.useRef)(false);
|
|
104
|
+
(0, _react.useLayoutEffect)(function () {
|
|
105
|
+
var debouncedPluginStateUpdate = (0, _debounce.default)(function () {
|
|
106
|
+
setPluginState(function (currentPluginStates) {
|
|
107
|
+
// This is to avoid changing behaviour of the hook when selector is not provided.
|
|
108
|
+
var nextStates = selector(_objectSpread({}, refStates.current));
|
|
109
|
+
if (shallowEqual(nextStates, currentPluginStates)) {
|
|
110
|
+
return currentPluginStates;
|
|
111
|
+
}
|
|
112
|
+
return nextStates;
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
// If we re-render this hook due to a change in the external
|
|
117
|
+
// plugins we need to push a state update to ensure we have
|
|
118
|
+
// the most current state.
|
|
119
|
+
if (mounted.current) {
|
|
120
|
+
refStates.current = mapValues(externalPlugins, function (value) {
|
|
121
|
+
return value === null || value === void 0 ? void 0 : value.sharedState.currentState();
|
|
122
|
+
});
|
|
123
|
+
debouncedPluginStateUpdate();
|
|
124
|
+
}
|
|
125
|
+
var unsubs = Object.entries(externalPlugins).map(function (_ref3) {
|
|
126
|
+
var _ref4 = (0, _slicedToArray2.default)(_ref3, 2),
|
|
127
|
+
pluginKey = _ref4[0],
|
|
128
|
+
externalPlugin = _ref4[1];
|
|
129
|
+
return externalPlugin === null || externalPlugin === void 0 ? void 0 : externalPlugin.sharedState.onChange(function (_ref5) {
|
|
130
|
+
var nextSharedState = _ref5.nextSharedState,
|
|
131
|
+
prevSharedState = _ref5.prevSharedState;
|
|
132
|
+
if (prevSharedState === nextSharedState) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
refStates.current[pluginKey] = nextSharedState;
|
|
136
|
+
debouncedPluginStateUpdate();
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
mounted.current = true;
|
|
140
|
+
return function () {
|
|
141
|
+
refStates.current = {};
|
|
142
|
+
unsubs.forEach(function (cb) {
|
|
143
|
+
return cb === null || cb === void 0 ? void 0 : cb();
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
// Do not re-render due to state changes, we only need to check this when
|
|
147
|
+
// setting up the initial subscription.
|
|
148
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
149
|
+
}, [externalPlugins, selector]);
|
|
150
|
+
return pluginStates;
|
|
151
|
+
}
|
|
152
|
+
function shallowEqual(objA, objB) {
|
|
153
|
+
if (objA === objB) {
|
|
154
|
+
return true;
|
|
155
|
+
}
|
|
156
|
+
if ((0, _typeof2.default)(objA) !== 'object' || objA === null || (0, _typeof2.default)(objB) !== 'object' || objB === null) {
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
var keysA = Object.keys(objA);
|
|
160
|
+
var keysB = Object.keys(objB);
|
|
161
|
+
if (keysA.length !== keysB.length) {
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
for (var _i = 0, _keysA = keysA; _i < _keysA.length; _i++) {
|
|
165
|
+
var key = _keysA[_i];
|
|
166
|
+
if (objA[key] !== objB[key]) {
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return true;
|
|
171
|
+
}
|
|
@@ -16,7 +16,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
16
16
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
17
17
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
18
18
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
19
|
-
var packageVersion = "107.
|
|
19
|
+
var packageVersion = "107.7.0";
|
|
20
20
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
21
21
|
// Remove URL as it has UGC
|
|
22
22
|
// Ignored via go/ees007
|
|
@@ -81,15 +81,15 @@ var typeAheadListMessages = exports.typeAheadListMessages = (0, _reactIntlNext.d
|
|
|
81
81
|
defaultMessage: 'Text shortcut',
|
|
82
82
|
description: 'Text shortcut'
|
|
83
83
|
},
|
|
84
|
-
|
|
85
|
-
id: 'fabric.editor.
|
|
84
|
+
typeAheadErrorFallbackHeading: {
|
|
85
|
+
id: 'fabric.editor.typeAheadErrorFallbackHeading',
|
|
86
86
|
defaultMessage: 'Something went wrong!',
|
|
87
|
-
description: '
|
|
87
|
+
description: 'Error message heading shown when typeahead items fail to load'
|
|
88
88
|
},
|
|
89
|
-
|
|
90
|
-
id: 'fabric.editor.
|
|
91
|
-
defaultMessage: '
|
|
92
|
-
description: '
|
|
89
|
+
typeAheadErrorFallbackDesc: {
|
|
90
|
+
id: 'fabric.editor.typeAheadErrorFallbackDescription',
|
|
91
|
+
defaultMessage: 'Please try again.',
|
|
92
|
+
description: 'Error message description shown when typeahead items fail to load'
|
|
93
93
|
},
|
|
94
94
|
viewAllInserts: {
|
|
95
95
|
id: 'fablric.editor.viewAllInserts',
|
|
@@ -23,7 +23,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
23
23
|
* @jsx jsx
|
|
24
24
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
25
25
|
var packageName = "@atlaskit/editor-common";
|
|
26
|
-
var packageVersion = "107.
|
|
26
|
+
var packageVersion = "107.7.0";
|
|
27
27
|
var halfFocusRing = 1;
|
|
28
28
|
var dropOffset = '0, 8';
|
|
29
29
|
// Ignored via go/ees005
|
|
@@ -9,10 +9,12 @@ import React, { Fragment } from 'react';
|
|
|
9
9
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
10
10
|
import { jsx } from '@emotion/react';
|
|
11
11
|
import classnames from 'classnames';
|
|
12
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
13
|
import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '../../../hooks';
|
|
13
14
|
import { useSharedPluginStateSelector } from '../../../hooks/useSharedPluginStateSelector/useSharedPluginStateSelector';
|
|
14
15
|
import { overflowShadow } from '../../../ui';
|
|
15
16
|
import { calculateBreakoutStyles } from '../../../utils';
|
|
17
|
+
import { LegacyContentHeader } from '../LegacyContentHeader';
|
|
16
18
|
import ExtensionLozenge from '../Lozenge';
|
|
17
19
|
import { overlay } from '../styles';
|
|
18
20
|
import { isEmptyBodiedMacro } from './extension-utils';
|
|
@@ -47,6 +49,7 @@ function ExtensionWithPluginState(props) {
|
|
|
47
49
|
var _extensionNode$attrs, _extensionNode$attrs2;
|
|
48
50
|
return extensionNode.type.name === 'extension' && ((_extensionNode$attrs = extensionNode.attrs) === null || _extensionNode$attrs === void 0 ? void 0 : _extensionNode$attrs.extensionType) === 'com.atlassian.confluence.migration' && ((_extensionNode$attrs2 = extensionNode.attrs) === null || _extensionNode$attrs2 === void 0 ? void 0 : _extensionNode$attrs2.extensionKey) === 'legacy-content';
|
|
49
51
|
};
|
|
52
|
+
const showLegacyContentHeader = fg('platform_editor_legacy_content_macro_visual_update') && isLegacyContentMacroExtension(node);
|
|
50
53
|
const hasBody = ['bodiedExtension', 'multiBodiedExtension'].includes(node.type.name);
|
|
51
54
|
const hasChildren = !!children;
|
|
52
55
|
const removeBorder = showMacroInteractionDesignUpdates || !!(hideFrame && !hasBody);
|
|
@@ -81,6 +84,7 @@ function ExtensionWithPluginState(props) {
|
|
|
81
84
|
'with-hover-border': showMacroInteractionDesignUpdates && isNodeHovered,
|
|
82
85
|
'with-danger-overlay': showMacroInteractionDesignUpdates,
|
|
83
86
|
'without-frame': removeBorder,
|
|
87
|
+
'legacy-content': showLegacyContentHeader,
|
|
84
88
|
[widerLayoutClassName]: shouldBreakout
|
|
85
89
|
});
|
|
86
90
|
const overflowClassNames = classnames('extension-overflow-wrapper', {
|
|
@@ -128,7 +132,12 @@ function ExtensionWithPluginState(props) {
|
|
|
128
132
|
setIsNodeHovered(didHover);
|
|
129
133
|
}
|
|
130
134
|
};
|
|
131
|
-
return jsx(Fragment, null,
|
|
135
|
+
return jsx(Fragment, null, showLegacyContentHeader && jsx(LegacyContentHeader, {
|
|
136
|
+
isNodeSelected: isNodeSelected,
|
|
137
|
+
isNodeHovered: isNodeHovered,
|
|
138
|
+
onMouseEnter: () => handleMouseEvent(true),
|
|
139
|
+
onMouseLeave: () => handleMouseEvent(false)
|
|
140
|
+
}), !showLegacyContentHeader && showMacroInteractionDesignUpdates && !isLivePageViewMode && jsx(ExtensionLozenge, {
|
|
132
141
|
isNodeSelected: isNodeSelected,
|
|
133
142
|
isNodeHovered: isNodeHovered,
|
|
134
143
|
isNodeNested: isNodeNested,
|
|
@@ -26,6 +26,10 @@ const wrapperStyleWithoutCursor = css(wrapperDefault, {
|
|
|
26
26
|
'&.with-margin-styles': {
|
|
27
27
|
margin: `0 ${"var(--ds-space-negative-250, -20px)"}`,
|
|
28
28
|
padding: `0 ${"var(--ds-space-250, 20px)"}`
|
|
29
|
+
},
|
|
30
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
31
|
+
'&.legacy-content': {
|
|
32
|
+
borderRadius: `0 0 ${"var(--ds-border-radius, 3px)"} ${"var(--ds-border-radius, 3px)"}`
|
|
29
33
|
}
|
|
30
34
|
});
|
|
31
35
|
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { Fragment, useCallback } from 'react';
|
|
7
|
+
|
|
8
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
|
+
import { css, jsx } from '@emotion/react';
|
|
10
|
+
import classnames from 'classnames';
|
|
11
|
+
import { defineMessages, useIntl } from 'react-intl-next';
|
|
12
|
+
import StatusWarningIcon from '@atlaskit/icon/core/status-warning';
|
|
13
|
+
import Link from '@atlaskit/link';
|
|
14
|
+
import { Status } from '@atlaskit/status';
|
|
15
|
+
const i18n = defineMessages({
|
|
16
|
+
legacyContentHeader: {
|
|
17
|
+
id: 'editor.extension.legacyContentHeader',
|
|
18
|
+
defaultMessage: 'Legacy Content',
|
|
19
|
+
description: 'Header for the legacy content extension in the editor.'
|
|
20
|
+
},
|
|
21
|
+
contentHasLimitedFunctionality: {
|
|
22
|
+
id: 'editor.extension.legacyContentHeader.contentHasLimitedFunctionality',
|
|
23
|
+
defaultMessage: 'This content has limited functionality, ',
|
|
24
|
+
description: 'Message indicating that the legacy content has limited functionality.'
|
|
25
|
+
},
|
|
26
|
+
learnMore: {
|
|
27
|
+
id: 'editor.extension.legacyContentHeader.learnMore',
|
|
28
|
+
defaultMessage: ' Learn more',
|
|
29
|
+
description: 'Link text for learning more about the legacy content.'
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
const lcmHeaderStyles = css({
|
|
33
|
+
padding: `0 ${"var(--ds-space-200, 16px)"} ${"var(--ds-space-050, 4px)"} ${"var(--ds-space-200, 16px)"}`,
|
|
34
|
+
backgroundColor: "var(--ds-background-neutral, #0515240F)",
|
|
35
|
+
borderRadius: `${"var(--ds-border-radius, 4px)"} ${"var(--ds-border-radius, 4px)"} 0 0`,
|
|
36
|
+
boxShadow: `0 0 0 1px ${"var(--ds-background-neutral, #0515240F)"}`,
|
|
37
|
+
position: 'relative',
|
|
38
|
+
top: `-1px`,
|
|
39
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
40
|
+
'&.with-hover-border': {
|
|
41
|
+
boxShadow: `0 0 0 1px ${"var(--ds-border-input, #8590A2)"}`
|
|
42
|
+
},
|
|
43
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
44
|
+
'&.selected': {
|
|
45
|
+
boxShadow: `0 0 0 1px ${"var(--ds-border-selected, #0C66E4)"}`,
|
|
46
|
+
backgroundColor: "var(--ds-background-selected, #E9F2FF)"
|
|
47
|
+
},
|
|
48
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
49
|
+
'& .status-lozenge-span': {
|
|
50
|
+
marginRight: "var(--ds-space-100, 8px)"
|
|
51
|
+
},
|
|
52
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
53
|
+
'& > .legacy-content-header-text': {
|
|
54
|
+
font: "var(--ds-font-body-UNSAFE_small, 12px)",
|
|
55
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
56
|
+
'& span': {
|
|
57
|
+
paddingRight: "var(--ds-space-050, 4px)"
|
|
58
|
+
},
|
|
59
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
60
|
+
'& a': {
|
|
61
|
+
cursor: 'pointer'
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
export const LegacyContentHeader = ({
|
|
66
|
+
isNodeHovered,
|
|
67
|
+
isNodeSelected,
|
|
68
|
+
onMouseEnter,
|
|
69
|
+
onMouseLeave
|
|
70
|
+
}) => {
|
|
71
|
+
const {
|
|
72
|
+
formatMessage
|
|
73
|
+
} = useIntl();
|
|
74
|
+
const classNames = classnames('legacy-content-header', {
|
|
75
|
+
'with-hover-border': isNodeHovered,
|
|
76
|
+
selected: isNodeSelected
|
|
77
|
+
});
|
|
78
|
+
const learnMore = useCallback(() => {
|
|
79
|
+
window.open('https://support.atlassian.com/confluence-cloud/docs/the-legacy-content-macro/', '_blank');
|
|
80
|
+
}, []);
|
|
81
|
+
return jsx(Fragment, null, jsx("div", {
|
|
82
|
+
"data-testid": "editor-extension-legacy-content-header",
|
|
83
|
+
css: [lcmHeaderStyles]
|
|
84
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
85
|
+
,
|
|
86
|
+
className: classNames,
|
|
87
|
+
onMouseEnter: onMouseEnter,
|
|
88
|
+
onMouseLeave: onMouseLeave
|
|
89
|
+
}, jsx(Status, {
|
|
90
|
+
text: formatMessage(i18n.legacyContentHeader),
|
|
91
|
+
color: isNodeSelected ? 'blue' : 'neutral',
|
|
92
|
+
style: "bold",
|
|
93
|
+
isBold: true
|
|
94
|
+
}), jsx("span", {
|
|
95
|
+
className: "legacy-content-header-text"
|
|
96
|
+
}, jsx(StatusWarningIcon, {
|
|
97
|
+
label: formatMessage(i18n.contentHasLimitedFunctionality),
|
|
98
|
+
size: "small"
|
|
99
|
+
}), formatMessage(i18n.contentHasLimitedFunctionality), "\xA0", jsx(Link, {
|
|
100
|
+
onClick: learnMore,
|
|
101
|
+
href: "https://support.atlassian.com/confluence-cloud/docs/the-legacy-content-macro/",
|
|
102
|
+
target: "_blank"
|
|
103
|
+
}, formatMessage(i18n.learnMore)))));
|
|
104
|
+
};
|
|
@@ -3,5 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
export { ExtensionNodeWrapper } from './ExtensionNodeWrapper';
|
|
5
5
|
export { Extension } from './Extension';
|
|
6
|
+
export { LegacyContentHeader } from './Extension/LegacyContentHeader';
|
|
6
7
|
export { default as ExtensionNodeView, ExtensionNode } from './extensionNodeView';
|
|
7
8
|
export { ExtensionComponent } from './ExtensionComponent';
|