@atlaskit/editor-plugin-status 3.1.24 → 3.1.26
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 +15 -0
- package/dist/cjs/nodeviews/statusNodeSpec.js +7 -216
- package/dist/cjs/pm-plugins/plugin.js +2 -16
- package/dist/cjs/statusPlugin.js +2 -2
- package/dist/es2019/nodeviews/statusNodeSpec.js +1 -214
- package/dist/es2019/pm-plugins/plugin.js +2 -16
- package/dist/es2019/statusPlugin.js +2 -2
- package/dist/esm/nodeviews/statusNodeSpec.js +6 -214
- package/dist/esm/pm-plugins/plugin.js +2 -16
- package/dist/esm/statusPlugin.js +2 -2
- package/dist/types/nodeviews/statusNodeSpec.d.ts +0 -7
- package/dist/types-ts4.5/nodeviews/statusNodeSpec.d.ts +0 -7
- package/package.json +5 -5
- package/dist/cjs/nodeviews/status.js +0 -71
- package/dist/es2019/nodeviews/status.js +0 -70
- package/dist/esm/nodeviews/status.js +0 -63
- package/dist/types/nodeviews/status.d.ts +0 -28
- package/dist/types-ts4.5/nodeviews/status.d.ts +0 -28
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-status
|
|
2
2
|
|
|
3
|
+
## 3.1.26
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#178271](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/178271)
|
|
8
|
+
[`fd1a32b0a4f6b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/fd1a32b0a4f6b) -
|
|
9
|
+
[ED-28322] Remove React version of status nodes to clean up experiment platform_editor_vanilla_dom
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 3.1.25
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 3.1.24
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -4,236 +4,27 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.statusToDOM =
|
|
7
|
+
exports.statusToDOM = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _reactIntlNext = require("react-intl-next");
|
|
10
|
-
var _adfSchema = require("@atlaskit/adf-schema");
|
|
11
9
|
var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
|
|
12
10
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
13
11
|
var _whitespace = require("@atlaskit/editor-common/whitespace");
|
|
14
12
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
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; }
|
|
16
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; }
|
|
17
|
-
var isSSR = Boolean(process.env.REACT_SSR);
|
|
18
|
-
var intl;
|
|
19
|
-
|
|
20
|
-
// copied from packages/elements/status/src/components/Status.tsx
|
|
21
|
-
var colorToLozengeAppearanceMap = {
|
|
22
|
-
neutral: 'default',
|
|
23
|
-
purple: 'new',
|
|
24
|
-
blue: 'inprogress',
|
|
25
|
-
red: 'removed',
|
|
26
|
-
yellow: 'moved',
|
|
27
|
-
green: 'success'
|
|
28
|
-
};
|
|
29
|
-
var lozengeAppearanceToBgColorMap = {
|
|
30
|
-
bold: {
|
|
31
|
-
default: '#DDDEE1',
|
|
32
|
-
inprogress: '#8FB8F6',
|
|
33
|
-
moved: '#F9C84E',
|
|
34
|
-
new: '#D8A0F7',
|
|
35
|
-
removed: '#FD9891',
|
|
36
|
-
success: '#B3DF72'
|
|
37
|
-
},
|
|
38
|
-
subtle: {
|
|
39
|
-
default: "var(--ds-background-neutral-subtle, #00000000)",
|
|
40
|
-
inprogress: "var(--ds-background-neutral-subtle, #00000000)",
|
|
41
|
-
moved: "var(--ds-background-neutral-subtle, #00000000)",
|
|
42
|
-
new: "var(--ds-background-neutral-subtle, #00000000)",
|
|
43
|
-
removed: "var(--ds-background-neutral-subtle, #00000000)",
|
|
44
|
-
success: "var(--ds-background-neutral-subtle, #00000000)"
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
var borderStyleMap = {
|
|
48
|
-
subtle: {
|
|
49
|
-
default: "1px solid #B7B9BE",
|
|
50
|
-
inprogress: "1px solid #669DF1",
|
|
51
|
-
moved: "1px solid #FCA700",
|
|
52
|
-
new: "1px solid #C97CF4",
|
|
53
|
-
removed: "1px solid #F87168",
|
|
54
|
-
success: "1px solid #94C748"
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
var backgroundColorsOld = {
|
|
58
|
-
bold: {
|
|
59
|
-
default: "var(--ds-background-neutral-bold, #44546F)",
|
|
60
|
-
inprogress: "var(--ds-background-information-bold, #0C66E4)",
|
|
61
|
-
moved: "var(--ds-background-warning-bold, #F5CD47)",
|
|
62
|
-
new: "var(--ds-background-discovery-bold, #6E5DC6)",
|
|
63
|
-
removed: "var(--ds-background-danger-bold, #C9372C)",
|
|
64
|
-
success: "var(--ds-background-success-bold, #1F845A)"
|
|
65
|
-
},
|
|
66
|
-
subtle: {
|
|
67
|
-
default: "var(--ds-background-neutral, #091E420F)",
|
|
68
|
-
inprogress: "var(--ds-background-information, #E9F2FF)",
|
|
69
|
-
moved: "var(--ds-background-warning, #FFF7D6)",
|
|
70
|
-
new: "var(--ds-background-discovery, #F3F0FF)",
|
|
71
|
-
removed: "var(--ds-background-danger, #FFECEB)",
|
|
72
|
-
success: "var(--ds-background-success, #DCFFF1)"
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
var textColorsOld = {
|
|
76
|
-
bold: {
|
|
77
|
-
default: "var(--ds-text-inverse, #FFFFFF)",
|
|
78
|
-
inprogress: "var(--ds-text-inverse, #FFFFFF)",
|
|
79
|
-
moved: "var(--ds-text-warning-inverse, #172B4D)",
|
|
80
|
-
new: "var(--ds-text-inverse, #FFFFFF)",
|
|
81
|
-
removed: "var(--ds-text-inverse, #FFFFFF)",
|
|
82
|
-
success: "var(--ds-text-inverse, #FFFFFF)"
|
|
83
|
-
},
|
|
84
|
-
subtle: {
|
|
85
|
-
default: "var(--ds-text-subtle, #44546F)",
|
|
86
|
-
inprogress: "var(--ds-text-information, #0055CC)",
|
|
87
|
-
moved: "var(--ds-text-warning, #A54800)",
|
|
88
|
-
new: "var(--ds-text-discovery, #5E4DB2)",
|
|
89
|
-
removed: "var(--ds-text-danger, #AE2E24)",
|
|
90
|
-
success: "var(--ds-text-success, #216E4E)"
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
var DEFAULT_APPEARANCE = 'default';
|
|
94
|
-
|
|
95
15
|
// eg. Version/4.0 Chrome/95.0.4638.50
|
|
96
16
|
var isAndroidChromium = typeof window !== 'undefined' && /Version\/(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])* Chrome\/(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*/.test(window.navigator.userAgent);
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Wrapper for ADF status node spec to augment toDOM implementation
|
|
100
|
-
* with fallback UI for lazy node view rendering / window virtualization
|
|
101
|
-
* @returns
|
|
102
|
-
* @example
|
|
103
|
-
*/
|
|
104
|
-
var statusNodeSpec = exports.statusNodeSpec = function statusNodeSpec() {
|
|
105
|
-
if (isSSR) {
|
|
106
|
-
return _adfSchema.status;
|
|
107
|
-
}
|
|
108
|
-
return _objectSpread(_objectSpread({}, _adfSchema.status), {}, {
|
|
109
|
-
toDOM: function toDOM(node) {
|
|
110
|
-
var _style$backgroundColo;
|
|
111
|
-
var _node$attrs = node.attrs,
|
|
112
|
-
text = _node$attrs.text,
|
|
113
|
-
color = _node$attrs.color,
|
|
114
|
-
style = _node$attrs.style;
|
|
115
|
-
intl = intl || (0, _reactIntlNext.createIntl)({
|
|
116
|
-
locale: document.documentElement.lang || 'en-US'
|
|
117
|
-
});
|
|
118
|
-
var isComponentVisualRefresh = (0, _platformFeatureFlags.fg)('platform-component-visual-refresh');
|
|
119
|
-
var maxWidth = 200;
|
|
120
|
-
var maxWidthValue = typeof maxWidth === 'string' ? maxWidth : "".concat(maxWidth, "px");
|
|
121
|
-
var editorNodeWrapperAttrs = {
|
|
122
|
-
'data-testid': 'statusContainerView',
|
|
123
|
-
style: (0, _lazyNodeView.convertToInlineCss)(text ? {
|
|
124
|
-
opacity: 1
|
|
125
|
-
} : {
|
|
126
|
-
opacity: 0.5
|
|
127
|
-
})
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
// packages/elements/status/src/components/Status.tsx
|
|
131
|
-
var appearance = colorToLozengeAppearanceMap[color] || DEFAULT_APPEARANCE;
|
|
132
|
-
var statusElementAttrs = {
|
|
133
|
-
style: (0, _lazyNodeView.convertToInlineCss)(isAndroidChromium ? {
|
|
134
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles -- Ignored via go/DSP-18766
|
|
135
|
-
display: 'inline-block !important',
|
|
136
|
-
verticalAlign: 'middle'
|
|
137
|
-
} : {}),
|
|
138
|
-
class: 'status-lozenge-span',
|
|
139
|
-
'aria-busy': 'true',
|
|
140
|
-
'data-node-type': 'status',
|
|
141
|
-
'data-prosemirror-node-name': 'status',
|
|
142
|
-
'data-color': color,
|
|
143
|
-
'data-style': style
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
// packages/design-system/lozenge/src/Lozenge/index.tsx
|
|
147
|
-
var appearanceStyle = isComponentVisualRefresh ? 'bold' : 'subtle';
|
|
148
|
-
var appearanceType = appearance in lozengeAppearanceToBgColorMap[appearanceStyle] ? appearance : 'default';
|
|
149
|
-
var lozengeWrapperAttrs = {
|
|
150
|
-
style: (0, _lazyNodeView.convertToInlineCss)(_objectSpread({
|
|
151
|
-
maxWidth: "calc(200px - ".concat("var(--ds-space-100, 8px)", ")"),
|
|
152
|
-
// container
|
|
153
|
-
display: 'inline-flex',
|
|
154
|
-
boxSizing: 'border-box',
|
|
155
|
-
position: 'static',
|
|
156
|
-
blockSize: 'min-content',
|
|
157
|
-
borderRadius: '3px',
|
|
158
|
-
overflow: 'hidden',
|
|
159
|
-
paddingInline: "var(--ds-space-050, 4px)",
|
|
160
|
-
// background
|
|
161
|
-
backgroundColor: (_style$backgroundColo = style === null || style === void 0 ? void 0 : style.backgroundColor) !== null && _style$backgroundColo !== void 0 ? _style$backgroundColo : lozengeAppearanceToBgColorMap[appearanceStyle][appearanceType]
|
|
162
|
-
}, appearanceStyle === 'subtle' ? (0, _platformFeatureFlags.fg)('visual-refresh_drop_5') ? {
|
|
163
|
-
outline: borderStyleMap[appearanceStyle][appearanceType],
|
|
164
|
-
outlineOffset: -1
|
|
165
|
-
} : {
|
|
166
|
-
border: borderStyleMap[appearanceStyle][appearanceType]
|
|
167
|
-
} : {}))
|
|
168
|
-
};
|
|
169
|
-
var lozengeTextAttrs = {
|
|
170
|
-
style: (0, _lazyNodeView.convertToInlineCss)(_objectSpread({
|
|
171
|
-
color: appearanceStyle === 'subtle' ? "var(--ds-text, #172B4D)" : '#292A2E',
|
|
172
|
-
maxWidth: "calc(".concat(maxWidthValue, " - ", "var(--ds-space-100, 8px)", ")"),
|
|
173
|
-
font: "var(--ds-font-body-small, normal 400 11px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)",
|
|
174
|
-
fontWeight: "var(--ds-font-weight-bold, 700)",
|
|
175
|
-
fontSize: '11px',
|
|
176
|
-
// can't use token - underlying DS lozenge is out by 1px which causes layout shift
|
|
177
|
-
overflow: 'hidden',
|
|
178
|
-
textOverflow: 'ellipsis',
|
|
179
|
-
textTransform: "var(--ds-UNSAFE-textTransformUppercase, uppercase)",
|
|
180
|
-
whiteSpace: 'nowrap'
|
|
181
|
-
}, (0, _platformFeatureFlags.fg)('platform-lozenge-custom-letterspacing') ? {
|
|
182
|
-
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
183
|
-
letterSpacing: '0.165px'
|
|
184
|
-
} : {}))
|
|
185
|
-
};
|
|
186
|
-
if (isComponentVisualRefresh) {
|
|
187
|
-
return ['span', editorNodeWrapperAttrs, ['span', statusElementAttrs, ['span', lozengeWrapperAttrs, ['span', lozengeTextAttrs, text]]]];
|
|
188
|
-
} else {
|
|
189
|
-
var _style$color;
|
|
190
|
-
// packages/design-system/lozenge/src/Lozenge/index.tsx
|
|
191
|
-
var appearanceTypeOld = appearance in backgroundColorsOld[appearanceStyle] ? appearance : 'default';
|
|
192
|
-
var legacyLozengeBoxAttrs = {
|
|
193
|
-
style: (0, _lazyNodeView.convertToInlineCss)({
|
|
194
|
-
backgroundColor: backgroundColorsOld[appearanceStyle][appearanceTypeOld],
|
|
195
|
-
maxWidth: '100%',
|
|
196
|
-
paddingInline: "var(--ds-space-050, 4px)",
|
|
197
|
-
display: 'inline-flex',
|
|
198
|
-
borderRadius: "var(--ds-border-radius, 4px)",
|
|
199
|
-
blockSize: 'min-content',
|
|
200
|
-
position: 'static',
|
|
201
|
-
overflow: 'hidden',
|
|
202
|
-
boxSizing: 'border-box',
|
|
203
|
-
appearance: 'none',
|
|
204
|
-
border: 'none'
|
|
205
|
-
})
|
|
206
|
-
};
|
|
207
|
-
var legacyLozengeTextAttrs = {
|
|
208
|
-
style: (0, _lazyNodeView.convertToInlineCss)({
|
|
209
|
-
font: "var(--ds-font-body-small, normal 400 11px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)",
|
|
210
|
-
fontFamily: "var(--ds-font-family-body, ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)",
|
|
211
|
-
fontWeight: "var(--ds-font-weight-bold, 700)",
|
|
212
|
-
overflow: 'hidden',
|
|
213
|
-
textOverflow: 'ellipsis',
|
|
214
|
-
textTransform: "var(--ds-UNSAFE-textTransformUppercase, uppercase)",
|
|
215
|
-
whiteSpace: 'nowrap',
|
|
216
|
-
color: (_style$color = style === null || style === void 0 ? void 0 : style.color) !== null && _style$color !== void 0 ? _style$color : textColorsOld[appearanceStyle][appearanceTypeOld],
|
|
217
|
-
maxWidth: '100%'
|
|
218
|
-
})
|
|
219
|
-
};
|
|
220
|
-
return ['span', editorNodeWrapperAttrs, ['span', statusElementAttrs, ['span', legacyLozengeBoxAttrs, ['span', legacyLozengeTextAttrs, text]]]];
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
});
|
|
224
|
-
};
|
|
225
17
|
var statusToDOM = exports.statusToDOM = function statusToDOM(node) {
|
|
226
|
-
var _node$
|
|
227
|
-
text = _node$
|
|
228
|
-
color = _node$
|
|
229
|
-
style = _node$
|
|
230
|
-
localId = _node$
|
|
18
|
+
var _node$attrs = node.attrs,
|
|
19
|
+
text = _node$attrs.text,
|
|
20
|
+
color = _node$attrs.color,
|
|
21
|
+
style = _node$attrs.style,
|
|
22
|
+
localId = _node$attrs.localId;
|
|
231
23
|
var editorNodeWrapperAttrs = {
|
|
232
24
|
class: 'statusView-content-wrap inlineNodeView',
|
|
233
25
|
'data-testid': 'statusContainerView',
|
|
234
|
-
'data-prosemirror-node-view-type': 'vanilla',
|
|
235
26
|
'data-prosemirror-node-name': 'status',
|
|
236
|
-
'
|
|
27
|
+
'localid': localId
|
|
237
28
|
};
|
|
238
29
|
var statusElementAttrs = {
|
|
239
30
|
style: (0, _lazyNodeView.convertToInlineCss)(isAndroidChromium ? {
|
|
@@ -6,12 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _reactNodeView = require("@atlaskit/editor-common/react-node-view");
|
|
10
9
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
11
10
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
12
11
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
13
|
-
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
14
|
-
var _status = require("../nodeviews/status");
|
|
15
12
|
var _StatusNodeView = require("../nodeviews/StatusNodeView");
|
|
16
13
|
var _pluginKey = require("./plugin-key");
|
|
17
14
|
var _utils2 = require("./utils");
|
|
@@ -111,19 +108,8 @@ var createPlugin = function createPlugin(pmPluginFactoryParams, options) {
|
|
|
111
108
|
key: _pluginKey.pluginKey,
|
|
112
109
|
props: {
|
|
113
110
|
nodeViews: {
|
|
114
|
-
status: function status(node
|
|
115
|
-
|
|
116
|
-
exposure: true
|
|
117
|
-
})) {
|
|
118
|
-
return new _StatusNodeView.StatusNodeView(node, pmPluginFactoryParams.getIntl());
|
|
119
|
-
}
|
|
120
|
-
return (0, _reactNodeView.getInlineNodeViewProducer)({
|
|
121
|
-
pmPluginFactoryParams: pmPluginFactoryParams,
|
|
122
|
-
Component: _status.StatusNodeView,
|
|
123
|
-
extraComponentProps: {
|
|
124
|
-
options: options
|
|
125
|
-
}
|
|
126
|
-
})(node, view, getPos, decorations);
|
|
111
|
+
status: function status(node) {
|
|
112
|
+
return new _StatusNodeView.StatusNodeView(node, pmPluginFactoryParams.getIntl());
|
|
127
113
|
}
|
|
128
114
|
}
|
|
129
115
|
}
|
package/dist/cjs/statusPlugin.js
CHANGED
|
@@ -6,13 +6,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.statusPlugin = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _adfSchema = require("@atlaskit/adf-schema");
|
|
9
10
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
10
11
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
11
12
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
12
13
|
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
13
14
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
14
15
|
var _comment = _interopRequireDefault(require("@atlaskit/icon/core/comment"));
|
|
15
|
-
var _statusNodeSpec = require("./nodeviews/statusNodeSpec");
|
|
16
16
|
var _actions = require("./pm-plugins/actions");
|
|
17
17
|
var _keymap = require("./pm-plugins/keymap");
|
|
18
18
|
var _plugin = _interopRequireDefault(require("./pm-plugins/plugin"));
|
|
@@ -27,7 +27,7 @@ var statusPlugin = exports.statusPlugin = function statusPlugin(_ref) {
|
|
|
27
27
|
nodes: function nodes() {
|
|
28
28
|
return [{
|
|
29
29
|
name: 'status',
|
|
30
|
-
node:
|
|
30
|
+
node: _adfSchema.status
|
|
31
31
|
}];
|
|
32
32
|
},
|
|
33
33
|
pmPlugins: function pmPlugins() {
|
|
@@ -1,222 +1,10 @@
|
|
|
1
|
-
import { createIntl } from 'react-intl-next';
|
|
2
|
-
import { status } from '@atlaskit/adf-schema';
|
|
3
1
|
import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
4
2
|
import { browser } from '@atlaskit/editor-common/utils';
|
|
5
3
|
import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/whitespace';
|
|
6
4
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
|
-
const isSSR = Boolean(process.env.REACT_SSR);
|
|
8
|
-
let intl;
|
|
9
|
-
|
|
10
|
-
// copied from packages/elements/status/src/components/Status.tsx
|
|
11
|
-
const colorToLozengeAppearanceMap = {
|
|
12
|
-
neutral: 'default',
|
|
13
|
-
purple: 'new',
|
|
14
|
-
blue: 'inprogress',
|
|
15
|
-
red: 'removed',
|
|
16
|
-
yellow: 'moved',
|
|
17
|
-
green: 'success'
|
|
18
|
-
};
|
|
19
|
-
const lozengeAppearanceToBgColorMap = {
|
|
20
|
-
bold: {
|
|
21
|
-
default: '#DDDEE1',
|
|
22
|
-
inprogress: '#8FB8F6',
|
|
23
|
-
moved: '#F9C84E',
|
|
24
|
-
new: '#D8A0F7',
|
|
25
|
-
removed: '#FD9891',
|
|
26
|
-
success: '#B3DF72'
|
|
27
|
-
},
|
|
28
|
-
subtle: {
|
|
29
|
-
default: "var(--ds-background-neutral-subtle, #00000000)",
|
|
30
|
-
inprogress: "var(--ds-background-neutral-subtle, #00000000)",
|
|
31
|
-
moved: "var(--ds-background-neutral-subtle, #00000000)",
|
|
32
|
-
new: "var(--ds-background-neutral-subtle, #00000000)",
|
|
33
|
-
removed: "var(--ds-background-neutral-subtle, #00000000)",
|
|
34
|
-
success: "var(--ds-background-neutral-subtle, #00000000)"
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
const borderStyleMap = {
|
|
38
|
-
subtle: {
|
|
39
|
-
default: `1px solid #B7B9BE`,
|
|
40
|
-
inprogress: `1px solid #669DF1`,
|
|
41
|
-
moved: `1px solid #FCA700`,
|
|
42
|
-
new: `1px solid #C97CF4`,
|
|
43
|
-
removed: `1px solid #F87168`,
|
|
44
|
-
success: `1px solid #94C748`
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
const backgroundColorsOld = {
|
|
48
|
-
bold: {
|
|
49
|
-
default: "var(--ds-background-neutral-bold, #44546F)",
|
|
50
|
-
inprogress: "var(--ds-background-information-bold, #0C66E4)",
|
|
51
|
-
moved: "var(--ds-background-warning-bold, #F5CD47)",
|
|
52
|
-
new: "var(--ds-background-discovery-bold, #6E5DC6)",
|
|
53
|
-
removed: "var(--ds-background-danger-bold, #C9372C)",
|
|
54
|
-
success: "var(--ds-background-success-bold, #1F845A)"
|
|
55
|
-
},
|
|
56
|
-
subtle: {
|
|
57
|
-
default: "var(--ds-background-neutral, #091E420F)",
|
|
58
|
-
inprogress: "var(--ds-background-information, #E9F2FF)",
|
|
59
|
-
moved: "var(--ds-background-warning, #FFF7D6)",
|
|
60
|
-
new: "var(--ds-background-discovery, #F3F0FF)",
|
|
61
|
-
removed: "var(--ds-background-danger, #FFECEB)",
|
|
62
|
-
success: "var(--ds-background-success, #DCFFF1)"
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
const textColorsOld = {
|
|
66
|
-
bold: {
|
|
67
|
-
default: "var(--ds-text-inverse, #FFFFFF)",
|
|
68
|
-
inprogress: "var(--ds-text-inverse, #FFFFFF)",
|
|
69
|
-
moved: "var(--ds-text-warning-inverse, #172B4D)",
|
|
70
|
-
new: "var(--ds-text-inverse, #FFFFFF)",
|
|
71
|
-
removed: "var(--ds-text-inverse, #FFFFFF)",
|
|
72
|
-
success: "var(--ds-text-inverse, #FFFFFF)"
|
|
73
|
-
},
|
|
74
|
-
subtle: {
|
|
75
|
-
default: "var(--ds-text-subtle, #44546F)",
|
|
76
|
-
inprogress: "var(--ds-text-information, #0055CC)",
|
|
77
|
-
moved: "var(--ds-text-warning, #A54800)",
|
|
78
|
-
new: "var(--ds-text-discovery, #5E4DB2)",
|
|
79
|
-
removed: "var(--ds-text-danger, #AE2E24)",
|
|
80
|
-
success: "var(--ds-text-success, #216E4E)"
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
const DEFAULT_APPEARANCE = 'default';
|
|
84
5
|
|
|
85
6
|
// eg. Version/4.0 Chrome/95.0.4638.50
|
|
86
7
|
const isAndroidChromium = typeof window !== 'undefined' && /Version\/.* Chrome\/.*/u.test(window.navigator.userAgent);
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Wrapper for ADF status node spec to augment toDOM implementation
|
|
90
|
-
* with fallback UI for lazy node view rendering / window virtualization
|
|
91
|
-
* @returns
|
|
92
|
-
* @example
|
|
93
|
-
*/
|
|
94
|
-
export const statusNodeSpec = () => {
|
|
95
|
-
if (isSSR) {
|
|
96
|
-
return status;
|
|
97
|
-
}
|
|
98
|
-
return {
|
|
99
|
-
...status,
|
|
100
|
-
toDOM: node => {
|
|
101
|
-
var _style$backgroundColo;
|
|
102
|
-
const {
|
|
103
|
-
text,
|
|
104
|
-
color,
|
|
105
|
-
style
|
|
106
|
-
} = node.attrs;
|
|
107
|
-
intl = intl || createIntl({
|
|
108
|
-
locale: document.documentElement.lang || 'en-US'
|
|
109
|
-
});
|
|
110
|
-
const isComponentVisualRefresh = fg('platform-component-visual-refresh');
|
|
111
|
-
const maxWidth = 200;
|
|
112
|
-
const maxWidthValue = typeof maxWidth === 'string' ? maxWidth : `${maxWidth}px`;
|
|
113
|
-
const editorNodeWrapperAttrs = {
|
|
114
|
-
'data-testid': 'statusContainerView',
|
|
115
|
-
style: convertToInlineCss(text ? {
|
|
116
|
-
opacity: 1
|
|
117
|
-
} : {
|
|
118
|
-
opacity: 0.5
|
|
119
|
-
})
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
// packages/elements/status/src/components/Status.tsx
|
|
123
|
-
const appearance = colorToLozengeAppearanceMap[color] || DEFAULT_APPEARANCE;
|
|
124
|
-
const statusElementAttrs = {
|
|
125
|
-
style: convertToInlineCss(isAndroidChromium ? {
|
|
126
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles -- Ignored via go/DSP-18766
|
|
127
|
-
display: 'inline-block !important',
|
|
128
|
-
verticalAlign: 'middle'
|
|
129
|
-
} : {}),
|
|
130
|
-
class: 'status-lozenge-span',
|
|
131
|
-
'aria-busy': 'true',
|
|
132
|
-
'data-node-type': 'status',
|
|
133
|
-
'data-prosemirror-node-name': 'status',
|
|
134
|
-
'data-color': color,
|
|
135
|
-
'data-style': style
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
// packages/design-system/lozenge/src/Lozenge/index.tsx
|
|
139
|
-
const appearanceStyle = isComponentVisualRefresh ? 'bold' : 'subtle';
|
|
140
|
-
const appearanceType = appearance in lozengeAppearanceToBgColorMap[appearanceStyle] ? appearance : 'default';
|
|
141
|
-
const lozengeWrapperAttrs = {
|
|
142
|
-
style: convertToInlineCss({
|
|
143
|
-
maxWidth: `calc(200px - ${"var(--ds-space-100, 8px)"})`,
|
|
144
|
-
// container
|
|
145
|
-
display: 'inline-flex',
|
|
146
|
-
boxSizing: 'border-box',
|
|
147
|
-
position: 'static',
|
|
148
|
-
blockSize: 'min-content',
|
|
149
|
-
borderRadius: '3px',
|
|
150
|
-
overflow: 'hidden',
|
|
151
|
-
paddingInline: "var(--ds-space-050, 4px)",
|
|
152
|
-
// background
|
|
153
|
-
backgroundColor: (_style$backgroundColo = style === null || style === void 0 ? void 0 : style.backgroundColor) !== null && _style$backgroundColo !== void 0 ? _style$backgroundColo : lozengeAppearanceToBgColorMap[appearanceStyle][appearanceType],
|
|
154
|
-
// border
|
|
155
|
-
...(appearanceStyle === 'subtle' ? fg('visual-refresh_drop_5') ? {
|
|
156
|
-
outline: borderStyleMap[appearanceStyle][appearanceType],
|
|
157
|
-
outlineOffset: -1
|
|
158
|
-
} : {
|
|
159
|
-
border: borderStyleMap[appearanceStyle][appearanceType]
|
|
160
|
-
} : {})
|
|
161
|
-
})
|
|
162
|
-
};
|
|
163
|
-
const lozengeTextAttrs = {
|
|
164
|
-
style: convertToInlineCss({
|
|
165
|
-
color: appearanceStyle === 'subtle' ? "var(--ds-text, #172B4D)" : '#292A2E',
|
|
166
|
-
maxWidth: `calc(${maxWidthValue} - ${"var(--ds-space-100, 8px)"})`,
|
|
167
|
-
font: "var(--ds-font-body-small, normal 400 11px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)",
|
|
168
|
-
fontWeight: "var(--ds-font-weight-bold, 700)",
|
|
169
|
-
fontSize: '11px',
|
|
170
|
-
// can't use token - underlying DS lozenge is out by 1px which causes layout shift
|
|
171
|
-
overflow: 'hidden',
|
|
172
|
-
textOverflow: 'ellipsis',
|
|
173
|
-
textTransform: "var(--ds-UNSAFE-textTransformUppercase, uppercase)",
|
|
174
|
-
whiteSpace: 'nowrap',
|
|
175
|
-
...(fg('platform-lozenge-custom-letterspacing') ? {
|
|
176
|
-
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
177
|
-
letterSpacing: '0.165px'
|
|
178
|
-
} : {})
|
|
179
|
-
})
|
|
180
|
-
};
|
|
181
|
-
if (isComponentVisualRefresh) {
|
|
182
|
-
return ['span', editorNodeWrapperAttrs, ['span', statusElementAttrs, ['span', lozengeWrapperAttrs, ['span', lozengeTextAttrs, text]]]];
|
|
183
|
-
} else {
|
|
184
|
-
var _style$color;
|
|
185
|
-
// packages/design-system/lozenge/src/Lozenge/index.tsx
|
|
186
|
-
const appearanceTypeOld = appearance in backgroundColorsOld[appearanceStyle] ? appearance : 'default';
|
|
187
|
-
const legacyLozengeBoxAttrs = {
|
|
188
|
-
style: convertToInlineCss({
|
|
189
|
-
backgroundColor: backgroundColorsOld[appearanceStyle][appearanceTypeOld],
|
|
190
|
-
maxWidth: '100%',
|
|
191
|
-
paddingInline: "var(--ds-space-050, 4px)",
|
|
192
|
-
display: 'inline-flex',
|
|
193
|
-
borderRadius: "var(--ds-border-radius, 4px)",
|
|
194
|
-
blockSize: 'min-content',
|
|
195
|
-
position: 'static',
|
|
196
|
-
overflow: 'hidden',
|
|
197
|
-
boxSizing: 'border-box',
|
|
198
|
-
appearance: 'none',
|
|
199
|
-
border: 'none'
|
|
200
|
-
})
|
|
201
|
-
};
|
|
202
|
-
const legacyLozengeTextAttrs = {
|
|
203
|
-
style: convertToInlineCss({
|
|
204
|
-
font: "var(--ds-font-body-small, normal 400 11px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)",
|
|
205
|
-
fontFamily: "var(--ds-font-family-body, ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)",
|
|
206
|
-
fontWeight: "var(--ds-font-weight-bold, 700)",
|
|
207
|
-
overflow: 'hidden',
|
|
208
|
-
textOverflow: 'ellipsis',
|
|
209
|
-
textTransform: "var(--ds-UNSAFE-textTransformUppercase, uppercase)",
|
|
210
|
-
whiteSpace: 'nowrap',
|
|
211
|
-
color: (_style$color = style === null || style === void 0 ? void 0 : style.color) !== null && _style$color !== void 0 ? _style$color : textColorsOld[appearanceStyle][appearanceTypeOld],
|
|
212
|
-
maxWidth: '100%'
|
|
213
|
-
})
|
|
214
|
-
};
|
|
215
|
-
return ['span', editorNodeWrapperAttrs, ['span', statusElementAttrs, ['span', legacyLozengeBoxAttrs, ['span', legacyLozengeTextAttrs, text]]]];
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
};
|
|
219
|
-
};
|
|
220
8
|
export const statusToDOM = node => {
|
|
221
9
|
const {
|
|
222
10
|
text,
|
|
@@ -227,9 +15,8 @@ export const statusToDOM = node => {
|
|
|
227
15
|
const editorNodeWrapperAttrs = {
|
|
228
16
|
class: 'statusView-content-wrap inlineNodeView',
|
|
229
17
|
'data-testid': 'statusContainerView',
|
|
230
|
-
'data-prosemirror-node-view-type': 'vanilla',
|
|
231
18
|
'data-prosemirror-node-name': 'status',
|
|
232
|
-
'
|
|
19
|
+
'localid': localId
|
|
233
20
|
};
|
|
234
21
|
const statusElementAttrs = {
|
|
235
22
|
style: convertToInlineCss(isAndroidChromium ? {
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { getInlineNodeViewProducer } from '@atlaskit/editor-common/react-node-view';
|
|
2
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
2
|
import { pmHistoryPluginKey } from '@atlaskit/editor-common/utils';
|
|
4
3
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
6
|
-
import { StatusNodeView } from '../nodeviews/status';
|
|
7
4
|
import { StatusNodeView as StatusNodeViewVanilla } from '../nodeviews/StatusNodeView';
|
|
8
5
|
import { pluginKey } from './plugin-key';
|
|
9
6
|
import { isEmptyStatus, mayGetStatusAtSelection } from './utils';
|
|
@@ -103,19 +100,8 @@ const createPlugin = (pmPluginFactoryParams, options) => new SafePlugin({
|
|
|
103
100
|
key: pluginKey,
|
|
104
101
|
props: {
|
|
105
102
|
nodeViews: {
|
|
106
|
-
status:
|
|
107
|
-
|
|
108
|
-
exposure: true
|
|
109
|
-
})) {
|
|
110
|
-
return new StatusNodeViewVanilla(node, pmPluginFactoryParams.getIntl());
|
|
111
|
-
}
|
|
112
|
-
return getInlineNodeViewProducer({
|
|
113
|
-
pmPluginFactoryParams,
|
|
114
|
-
Component: StatusNodeView,
|
|
115
|
-
extraComponentProps: {
|
|
116
|
-
options
|
|
117
|
-
}
|
|
118
|
-
})(node, view, getPos, decorations);
|
|
103
|
+
status: node => {
|
|
104
|
+
return new StatusNodeViewVanilla(node, pmPluginFactoryParams.getIntl());
|
|
119
105
|
}
|
|
120
106
|
}
|
|
121
107
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { status } from '@atlaskit/adf-schema';
|
|
2
3
|
import { ACTION_SUBJECT_ID, ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
4
|
import { addInlineComment, ToolTipContent } from '@atlaskit/editor-common/keymaps';
|
|
4
5
|
import { annotationMessages, toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
5
6
|
import { IconStatus } from '@atlaskit/editor-common/quick-insert';
|
|
6
7
|
import { calculateToolbarPositionAboveSelection } from '@atlaskit/editor-common/utils';
|
|
7
8
|
import CommentIcon from '@atlaskit/icon/core/comment';
|
|
8
|
-
import { statusNodeSpec } from './nodeviews/statusNodeSpec';
|
|
9
9
|
import { commitStatusPicker, insertStatus, removeStatus, updateStatusWithAnalytics } from './pm-plugins/actions';
|
|
10
10
|
import { keymapPlugin } from './pm-plugins/keymap';
|
|
11
11
|
import createStatusPlugin from './pm-plugins/plugin';
|
|
@@ -21,7 +21,7 @@ export const statusPlugin = ({
|
|
|
21
21
|
nodes() {
|
|
22
22
|
return [{
|
|
23
23
|
name: 'status',
|
|
24
|
-
node:
|
|
24
|
+
node: status
|
|
25
25
|
}];
|
|
26
26
|
},
|
|
27
27
|
pmPlugins() {
|
|
@@ -1,232 +1,24 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
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; }
|
|
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
|
-
import { createIntl } from 'react-intl-next';
|
|
5
|
-
import { status } from '@atlaskit/adf-schema';
|
|
6
4
|
import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
7
5
|
import { browser } from '@atlaskit/editor-common/utils';
|
|
8
6
|
import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/whitespace';
|
|
9
7
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
|
-
var isSSR = Boolean(process.env.REACT_SSR);
|
|
11
|
-
var intl;
|
|
12
|
-
|
|
13
|
-
// copied from packages/elements/status/src/components/Status.tsx
|
|
14
|
-
var colorToLozengeAppearanceMap = {
|
|
15
|
-
neutral: 'default',
|
|
16
|
-
purple: 'new',
|
|
17
|
-
blue: 'inprogress',
|
|
18
|
-
red: 'removed',
|
|
19
|
-
yellow: 'moved',
|
|
20
|
-
green: 'success'
|
|
21
|
-
};
|
|
22
|
-
var lozengeAppearanceToBgColorMap = {
|
|
23
|
-
bold: {
|
|
24
|
-
default: '#DDDEE1',
|
|
25
|
-
inprogress: '#8FB8F6',
|
|
26
|
-
moved: '#F9C84E',
|
|
27
|
-
new: '#D8A0F7',
|
|
28
|
-
removed: '#FD9891',
|
|
29
|
-
success: '#B3DF72'
|
|
30
|
-
},
|
|
31
|
-
subtle: {
|
|
32
|
-
default: "var(--ds-background-neutral-subtle, #00000000)",
|
|
33
|
-
inprogress: "var(--ds-background-neutral-subtle, #00000000)",
|
|
34
|
-
moved: "var(--ds-background-neutral-subtle, #00000000)",
|
|
35
|
-
new: "var(--ds-background-neutral-subtle, #00000000)",
|
|
36
|
-
removed: "var(--ds-background-neutral-subtle, #00000000)",
|
|
37
|
-
success: "var(--ds-background-neutral-subtle, #00000000)"
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
var borderStyleMap = {
|
|
41
|
-
subtle: {
|
|
42
|
-
default: "1px solid #B7B9BE",
|
|
43
|
-
inprogress: "1px solid #669DF1",
|
|
44
|
-
moved: "1px solid #FCA700",
|
|
45
|
-
new: "1px solid #C97CF4",
|
|
46
|
-
removed: "1px solid #F87168",
|
|
47
|
-
success: "1px solid #94C748"
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
var backgroundColorsOld = {
|
|
51
|
-
bold: {
|
|
52
|
-
default: "var(--ds-background-neutral-bold, #44546F)",
|
|
53
|
-
inprogress: "var(--ds-background-information-bold, #0C66E4)",
|
|
54
|
-
moved: "var(--ds-background-warning-bold, #F5CD47)",
|
|
55
|
-
new: "var(--ds-background-discovery-bold, #6E5DC6)",
|
|
56
|
-
removed: "var(--ds-background-danger-bold, #C9372C)",
|
|
57
|
-
success: "var(--ds-background-success-bold, #1F845A)"
|
|
58
|
-
},
|
|
59
|
-
subtle: {
|
|
60
|
-
default: "var(--ds-background-neutral, #091E420F)",
|
|
61
|
-
inprogress: "var(--ds-background-information, #E9F2FF)",
|
|
62
|
-
moved: "var(--ds-background-warning, #FFF7D6)",
|
|
63
|
-
new: "var(--ds-background-discovery, #F3F0FF)",
|
|
64
|
-
removed: "var(--ds-background-danger, #FFECEB)",
|
|
65
|
-
success: "var(--ds-background-success, #DCFFF1)"
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
var textColorsOld = {
|
|
69
|
-
bold: {
|
|
70
|
-
default: "var(--ds-text-inverse, #FFFFFF)",
|
|
71
|
-
inprogress: "var(--ds-text-inverse, #FFFFFF)",
|
|
72
|
-
moved: "var(--ds-text-warning-inverse, #172B4D)",
|
|
73
|
-
new: "var(--ds-text-inverse, #FFFFFF)",
|
|
74
|
-
removed: "var(--ds-text-inverse, #FFFFFF)",
|
|
75
|
-
success: "var(--ds-text-inverse, #FFFFFF)"
|
|
76
|
-
},
|
|
77
|
-
subtle: {
|
|
78
|
-
default: "var(--ds-text-subtle, #44546F)",
|
|
79
|
-
inprogress: "var(--ds-text-information, #0055CC)",
|
|
80
|
-
moved: "var(--ds-text-warning, #A54800)",
|
|
81
|
-
new: "var(--ds-text-discovery, #5E4DB2)",
|
|
82
|
-
removed: "var(--ds-text-danger, #AE2E24)",
|
|
83
|
-
success: "var(--ds-text-success, #216E4E)"
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
var DEFAULT_APPEARANCE = 'default';
|
|
87
8
|
|
|
88
9
|
// eg. Version/4.0 Chrome/95.0.4638.50
|
|
89
10
|
var isAndroidChromium = typeof window !== 'undefined' && /Version\/(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])* Chrome\/(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*/.test(window.navigator.userAgent);
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Wrapper for ADF status node spec to augment toDOM implementation
|
|
93
|
-
* with fallback UI for lazy node view rendering / window virtualization
|
|
94
|
-
* @returns
|
|
95
|
-
* @example
|
|
96
|
-
*/
|
|
97
|
-
export var statusNodeSpec = function statusNodeSpec() {
|
|
98
|
-
if (isSSR) {
|
|
99
|
-
return status;
|
|
100
|
-
}
|
|
101
|
-
return _objectSpread(_objectSpread({}, status), {}, {
|
|
102
|
-
toDOM: function toDOM(node) {
|
|
103
|
-
var _style$backgroundColo;
|
|
104
|
-
var _node$attrs = node.attrs,
|
|
105
|
-
text = _node$attrs.text,
|
|
106
|
-
color = _node$attrs.color,
|
|
107
|
-
style = _node$attrs.style;
|
|
108
|
-
intl = intl || createIntl({
|
|
109
|
-
locale: document.documentElement.lang || 'en-US'
|
|
110
|
-
});
|
|
111
|
-
var isComponentVisualRefresh = fg('platform-component-visual-refresh');
|
|
112
|
-
var maxWidth = 200;
|
|
113
|
-
var maxWidthValue = typeof maxWidth === 'string' ? maxWidth : "".concat(maxWidth, "px");
|
|
114
|
-
var editorNodeWrapperAttrs = {
|
|
115
|
-
'data-testid': 'statusContainerView',
|
|
116
|
-
style: convertToInlineCss(text ? {
|
|
117
|
-
opacity: 1
|
|
118
|
-
} : {
|
|
119
|
-
opacity: 0.5
|
|
120
|
-
})
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
// packages/elements/status/src/components/Status.tsx
|
|
124
|
-
var appearance = colorToLozengeAppearanceMap[color] || DEFAULT_APPEARANCE;
|
|
125
|
-
var statusElementAttrs = {
|
|
126
|
-
style: convertToInlineCss(isAndroidChromium ? {
|
|
127
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles -- Ignored via go/DSP-18766
|
|
128
|
-
display: 'inline-block !important',
|
|
129
|
-
verticalAlign: 'middle'
|
|
130
|
-
} : {}),
|
|
131
|
-
class: 'status-lozenge-span',
|
|
132
|
-
'aria-busy': 'true',
|
|
133
|
-
'data-node-type': 'status',
|
|
134
|
-
'data-prosemirror-node-name': 'status',
|
|
135
|
-
'data-color': color,
|
|
136
|
-
'data-style': style
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
// packages/design-system/lozenge/src/Lozenge/index.tsx
|
|
140
|
-
var appearanceStyle = isComponentVisualRefresh ? 'bold' : 'subtle';
|
|
141
|
-
var appearanceType = appearance in lozengeAppearanceToBgColorMap[appearanceStyle] ? appearance : 'default';
|
|
142
|
-
var lozengeWrapperAttrs = {
|
|
143
|
-
style: convertToInlineCss(_objectSpread({
|
|
144
|
-
maxWidth: "calc(200px - ".concat("var(--ds-space-100, 8px)", ")"),
|
|
145
|
-
// container
|
|
146
|
-
display: 'inline-flex',
|
|
147
|
-
boxSizing: 'border-box',
|
|
148
|
-
position: 'static',
|
|
149
|
-
blockSize: 'min-content',
|
|
150
|
-
borderRadius: '3px',
|
|
151
|
-
overflow: 'hidden',
|
|
152
|
-
paddingInline: "var(--ds-space-050, 4px)",
|
|
153
|
-
// background
|
|
154
|
-
backgroundColor: (_style$backgroundColo = style === null || style === void 0 ? void 0 : style.backgroundColor) !== null && _style$backgroundColo !== void 0 ? _style$backgroundColo : lozengeAppearanceToBgColorMap[appearanceStyle][appearanceType]
|
|
155
|
-
}, appearanceStyle === 'subtle' ? fg('visual-refresh_drop_5') ? {
|
|
156
|
-
outline: borderStyleMap[appearanceStyle][appearanceType],
|
|
157
|
-
outlineOffset: -1
|
|
158
|
-
} : {
|
|
159
|
-
border: borderStyleMap[appearanceStyle][appearanceType]
|
|
160
|
-
} : {}))
|
|
161
|
-
};
|
|
162
|
-
var lozengeTextAttrs = {
|
|
163
|
-
style: convertToInlineCss(_objectSpread({
|
|
164
|
-
color: appearanceStyle === 'subtle' ? "var(--ds-text, #172B4D)" : '#292A2E',
|
|
165
|
-
maxWidth: "calc(".concat(maxWidthValue, " - ", "var(--ds-space-100, 8px)", ")"),
|
|
166
|
-
font: "var(--ds-font-body-small, normal 400 11px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)",
|
|
167
|
-
fontWeight: "var(--ds-font-weight-bold, 700)",
|
|
168
|
-
fontSize: '11px',
|
|
169
|
-
// can't use token - underlying DS lozenge is out by 1px which causes layout shift
|
|
170
|
-
overflow: 'hidden',
|
|
171
|
-
textOverflow: 'ellipsis',
|
|
172
|
-
textTransform: "var(--ds-UNSAFE-textTransformUppercase, uppercase)",
|
|
173
|
-
whiteSpace: 'nowrap'
|
|
174
|
-
}, fg('platform-lozenge-custom-letterspacing') ? {
|
|
175
|
-
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
176
|
-
letterSpacing: '0.165px'
|
|
177
|
-
} : {}))
|
|
178
|
-
};
|
|
179
|
-
if (isComponentVisualRefresh) {
|
|
180
|
-
return ['span', editorNodeWrapperAttrs, ['span', statusElementAttrs, ['span', lozengeWrapperAttrs, ['span', lozengeTextAttrs, text]]]];
|
|
181
|
-
} else {
|
|
182
|
-
var _style$color;
|
|
183
|
-
// packages/design-system/lozenge/src/Lozenge/index.tsx
|
|
184
|
-
var appearanceTypeOld = appearance in backgroundColorsOld[appearanceStyle] ? appearance : 'default';
|
|
185
|
-
var legacyLozengeBoxAttrs = {
|
|
186
|
-
style: convertToInlineCss({
|
|
187
|
-
backgroundColor: backgroundColorsOld[appearanceStyle][appearanceTypeOld],
|
|
188
|
-
maxWidth: '100%',
|
|
189
|
-
paddingInline: "var(--ds-space-050, 4px)",
|
|
190
|
-
display: 'inline-flex',
|
|
191
|
-
borderRadius: "var(--ds-border-radius, 4px)",
|
|
192
|
-
blockSize: 'min-content',
|
|
193
|
-
position: 'static',
|
|
194
|
-
overflow: 'hidden',
|
|
195
|
-
boxSizing: 'border-box',
|
|
196
|
-
appearance: 'none',
|
|
197
|
-
border: 'none'
|
|
198
|
-
})
|
|
199
|
-
};
|
|
200
|
-
var legacyLozengeTextAttrs = {
|
|
201
|
-
style: convertToInlineCss({
|
|
202
|
-
font: "var(--ds-font-body-small, normal 400 11px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)",
|
|
203
|
-
fontFamily: "var(--ds-font-family-body, ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)",
|
|
204
|
-
fontWeight: "var(--ds-font-weight-bold, 700)",
|
|
205
|
-
overflow: 'hidden',
|
|
206
|
-
textOverflow: 'ellipsis',
|
|
207
|
-
textTransform: "var(--ds-UNSAFE-textTransformUppercase, uppercase)",
|
|
208
|
-
whiteSpace: 'nowrap',
|
|
209
|
-
color: (_style$color = style === null || style === void 0 ? void 0 : style.color) !== null && _style$color !== void 0 ? _style$color : textColorsOld[appearanceStyle][appearanceTypeOld],
|
|
210
|
-
maxWidth: '100%'
|
|
211
|
-
})
|
|
212
|
-
};
|
|
213
|
-
return ['span', editorNodeWrapperAttrs, ['span', statusElementAttrs, ['span', legacyLozengeBoxAttrs, ['span', legacyLozengeTextAttrs, text]]]];
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
});
|
|
217
|
-
};
|
|
218
11
|
export var statusToDOM = function statusToDOM(node) {
|
|
219
|
-
var _node$
|
|
220
|
-
text = _node$
|
|
221
|
-
color = _node$
|
|
222
|
-
style = _node$
|
|
223
|
-
localId = _node$
|
|
12
|
+
var _node$attrs = node.attrs,
|
|
13
|
+
text = _node$attrs.text,
|
|
14
|
+
color = _node$attrs.color,
|
|
15
|
+
style = _node$attrs.style,
|
|
16
|
+
localId = _node$attrs.localId;
|
|
224
17
|
var editorNodeWrapperAttrs = {
|
|
225
18
|
class: 'statusView-content-wrap inlineNodeView',
|
|
226
19
|
'data-testid': 'statusContainerView',
|
|
227
|
-
'data-prosemirror-node-view-type': 'vanilla',
|
|
228
20
|
'data-prosemirror-node-name': 'status',
|
|
229
|
-
'
|
|
21
|
+
'localid': localId
|
|
230
22
|
};
|
|
231
23
|
var statusElementAttrs = {
|
|
232
24
|
style: convertToInlineCss(isAndroidChromium ? {
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
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; }
|
|
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
|
-
import { getInlineNodeViewProducer } from '@atlaskit/editor-common/react-node-view';
|
|
5
4
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
6
5
|
import { pmHistoryPluginKey } from '@atlaskit/editor-common/utils';
|
|
7
6
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
8
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
9
|
-
import { StatusNodeView } from '../nodeviews/status';
|
|
10
7
|
import { StatusNodeView as StatusNodeViewVanilla } from '../nodeviews/StatusNodeView';
|
|
11
8
|
import { pluginKey } from './plugin-key';
|
|
12
9
|
import { isEmptyStatus, mayGetStatusAtSelection } from './utils';
|
|
@@ -104,19 +101,8 @@ var createPlugin = function createPlugin(pmPluginFactoryParams, options) {
|
|
|
104
101
|
key: pluginKey,
|
|
105
102
|
props: {
|
|
106
103
|
nodeViews: {
|
|
107
|
-
status: function status(node
|
|
108
|
-
|
|
109
|
-
exposure: true
|
|
110
|
-
})) {
|
|
111
|
-
return new StatusNodeViewVanilla(node, pmPluginFactoryParams.getIntl());
|
|
112
|
-
}
|
|
113
|
-
return getInlineNodeViewProducer({
|
|
114
|
-
pmPluginFactoryParams: pmPluginFactoryParams,
|
|
115
|
-
Component: StatusNodeView,
|
|
116
|
-
extraComponentProps: {
|
|
117
|
-
options: options
|
|
118
|
-
}
|
|
119
|
-
})(node, view, getPos, decorations);
|
|
104
|
+
status: function status(node) {
|
|
105
|
+
return new StatusNodeViewVanilla(node, pmPluginFactoryParams.getIntl());
|
|
120
106
|
}
|
|
121
107
|
}
|
|
122
108
|
}
|
package/dist/esm/statusPlugin.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { status } from '@atlaskit/adf-schema';
|
|
2
3
|
import { ACTION_SUBJECT_ID, ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
4
|
import { addInlineComment, ToolTipContent } from '@atlaskit/editor-common/keymaps';
|
|
4
5
|
import { annotationMessages, toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
5
6
|
import { IconStatus } from '@atlaskit/editor-common/quick-insert';
|
|
6
7
|
import { calculateToolbarPositionAboveSelection } from '@atlaskit/editor-common/utils';
|
|
7
8
|
import CommentIcon from '@atlaskit/icon/core/comment';
|
|
8
|
-
import { statusNodeSpec } from './nodeviews/statusNodeSpec';
|
|
9
9
|
import { commitStatusPicker, insertStatus, removeStatus, updateStatusWithAnalytics } from './pm-plugins/actions';
|
|
10
10
|
import { keymapPlugin } from './pm-plugins/keymap';
|
|
11
11
|
import createStatusPlugin from './pm-plugins/plugin';
|
|
@@ -20,7 +20,7 @@ export var statusPlugin = function statusPlugin(_ref) {
|
|
|
20
20
|
nodes: function nodes() {
|
|
21
21
|
return [{
|
|
22
22
|
name: 'status',
|
|
23
|
-
node:
|
|
23
|
+
node: status
|
|
24
24
|
}];
|
|
25
25
|
},
|
|
26
26
|
pmPlugins: function pmPlugins() {
|
|
@@ -1,9 +1,2 @@
|
|
|
1
1
|
import type { DOMOutputSpec, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
/**
|
|
3
|
-
* Wrapper for ADF status node spec to augment toDOM implementation
|
|
4
|
-
* with fallback UI for lazy node view rendering / window virtualization
|
|
5
|
-
* @returns
|
|
6
|
-
* @example
|
|
7
|
-
*/
|
|
8
|
-
export declare const statusNodeSpec: () => import("prosemirror-model").NodeSpec;
|
|
9
2
|
export declare const statusToDOM: (node: PMNode) => DOMOutputSpec;
|
|
@@ -1,9 +1,2 @@
|
|
|
1
1
|
import type { DOMOutputSpec, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
/**
|
|
3
|
-
* Wrapper for ADF status node spec to augment toDOM implementation
|
|
4
|
-
* with fallback UI for lazy node view rendering / window virtualization
|
|
5
|
-
* @returns
|
|
6
|
-
* @example
|
|
7
|
-
*/
|
|
8
|
-
export declare const statusNodeSpec: () => import("prosemirror-model").NodeSpec;
|
|
9
2
|
export declare const statusToDOM: (node: PMNode) => DOMOutputSpec;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-status",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.26",
|
|
4
4
|
"description": "Status plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -35,16 +35,16 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
37
37
|
"@atlaskit/analytics-next": "^11.1.0",
|
|
38
|
-
"@atlaskit/editor-common": "^107.
|
|
38
|
+
"@atlaskit/editor-common": "^107.3.0",
|
|
39
39
|
"@atlaskit/editor-plugin-analytics": "^2.3.0",
|
|
40
40
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
41
41
|
"@atlaskit/editor-shared-styles": "^3.4.0",
|
|
42
|
-
"@atlaskit/icon": "^27.
|
|
42
|
+
"@atlaskit/icon": "^27.2.0",
|
|
43
43
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
44
44
|
"@atlaskit/status": "^3.0.0",
|
|
45
45
|
"@atlaskit/theme": "^18.0.0",
|
|
46
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
47
|
-
"@atlaskit/tokens": "^5.
|
|
46
|
+
"@atlaskit/tmp-editor-statsig": "^8.5.0",
|
|
47
|
+
"@atlaskit/tokens": "^5.4.0",
|
|
48
48
|
"@atlaskit/visually-hidden": "^3.0.0",
|
|
49
49
|
"@babel/runtime": "^7.0.0",
|
|
50
50
|
"@emotion/react": "^11.7.1"
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.StatusNodeView = exports.IntlStatusContainerView = void 0;
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _react2 = require("@emotion/react");
|
|
10
|
-
var _reactIntlNext = require("react-intl-next");
|
|
11
|
-
var _messages = require("@atlaskit/editor-common/messages");
|
|
12
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
|
-
var _element = require("@atlaskit/status/element");
|
|
14
|
-
/**
|
|
15
|
-
* @jsxRuntime classic
|
|
16
|
-
* @jsx jsx
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
20
|
-
|
|
21
|
-
var styledStatusStyles = (0, _react2.css)({
|
|
22
|
-
opacity: 1
|
|
23
|
-
});
|
|
24
|
-
var styledStatusPlaceholderStyles = (0, _react2.css)({
|
|
25
|
-
opacity: 0.5
|
|
26
|
-
});
|
|
27
|
-
var StatusContainerView = function StatusContainerView(props) {
|
|
28
|
-
var text = props.text,
|
|
29
|
-
color = props.color,
|
|
30
|
-
localId = props.localId,
|
|
31
|
-
style = props.style,
|
|
32
|
-
formatMessage = props.intl.formatMessage;
|
|
33
|
-
var statusText = text ? text : formatMessage(_messages.statusMessages.placeholder);
|
|
34
|
-
var handleClick = function handleClick(event) {
|
|
35
|
-
if (event.nativeEvent.stopImmediatePropagation) {
|
|
36
|
-
event.nativeEvent.stopImmediatePropagation();
|
|
37
|
-
}
|
|
38
|
-
// handling of popup is done in plugin.apply on selection change.
|
|
39
|
-
};
|
|
40
|
-
return (0, _react2.jsx)("span", {
|
|
41
|
-
css: text ? styledStatusStyles : styledStatusPlaceholderStyles,
|
|
42
|
-
"data-testid": "statusContainerView"
|
|
43
|
-
}, (0, _react2.jsx)(_element.Status, {
|
|
44
|
-
text: statusText,
|
|
45
|
-
color: color,
|
|
46
|
-
localId: localId
|
|
47
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
48
|
-
,
|
|
49
|
-
style: style,
|
|
50
|
-
onClick: handleClick,
|
|
51
|
-
isBold: (0, _platformFeatureFlags.fg)('platform-component-visual-refresh')
|
|
52
|
-
}));
|
|
53
|
-
};
|
|
54
|
-
var IntlStatusContainerView = exports.IntlStatusContainerView = (0, _reactIntlNext.injectIntl)(StatusContainerView);
|
|
55
|
-
var StatusNodeView = exports.StatusNodeView = function StatusNodeView(props) {
|
|
56
|
-
var view = props.view;
|
|
57
|
-
var _props$node$attrs = props.node.attrs,
|
|
58
|
-
text = _props$node$attrs.text,
|
|
59
|
-
color = _props$node$attrs.color,
|
|
60
|
-
localId = _props$node$attrs.localId,
|
|
61
|
-
style = _props$node$attrs.style;
|
|
62
|
-
return (0, _react2.jsx)(IntlStatusContainerView, {
|
|
63
|
-
view: view,
|
|
64
|
-
text: text,
|
|
65
|
-
color: color
|
|
66
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
67
|
-
,
|
|
68
|
-
style: style,
|
|
69
|
-
localId: localId
|
|
70
|
-
});
|
|
71
|
-
};
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jsxRuntime classic
|
|
3
|
-
* @jsx jsx
|
|
4
|
-
*/
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
|
-
import { css, jsx } from '@emotion/react';
|
|
9
|
-
import { injectIntl } from 'react-intl-next';
|
|
10
|
-
import { statusMessages as messages } from '@atlaskit/editor-common/messages';
|
|
11
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
|
-
import { Status } from '@atlaskit/status/element';
|
|
13
|
-
const styledStatusStyles = css({
|
|
14
|
-
opacity: 1
|
|
15
|
-
});
|
|
16
|
-
const styledStatusPlaceholderStyles = css({
|
|
17
|
-
opacity: 0.5
|
|
18
|
-
});
|
|
19
|
-
const StatusContainerView = props => {
|
|
20
|
-
const {
|
|
21
|
-
text,
|
|
22
|
-
color,
|
|
23
|
-
localId,
|
|
24
|
-
style,
|
|
25
|
-
intl: {
|
|
26
|
-
formatMessage
|
|
27
|
-
}
|
|
28
|
-
} = props;
|
|
29
|
-
const statusText = text ? text : formatMessage(messages.placeholder);
|
|
30
|
-
const handleClick = event => {
|
|
31
|
-
if (event.nativeEvent.stopImmediatePropagation) {
|
|
32
|
-
event.nativeEvent.stopImmediatePropagation();
|
|
33
|
-
}
|
|
34
|
-
// handling of popup is done in plugin.apply on selection change.
|
|
35
|
-
};
|
|
36
|
-
return jsx("span", {
|
|
37
|
-
css: text ? styledStatusStyles : styledStatusPlaceholderStyles,
|
|
38
|
-
"data-testid": "statusContainerView"
|
|
39
|
-
}, jsx(Status, {
|
|
40
|
-
text: statusText,
|
|
41
|
-
color: color,
|
|
42
|
-
localId: localId
|
|
43
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
44
|
-
,
|
|
45
|
-
style: style,
|
|
46
|
-
onClick: handleClick,
|
|
47
|
-
isBold: fg('platform-component-visual-refresh')
|
|
48
|
-
}));
|
|
49
|
-
};
|
|
50
|
-
export const IntlStatusContainerView = injectIntl(StatusContainerView);
|
|
51
|
-
export const StatusNodeView = props => {
|
|
52
|
-
const {
|
|
53
|
-
view
|
|
54
|
-
} = props;
|
|
55
|
-
const {
|
|
56
|
-
text,
|
|
57
|
-
color,
|
|
58
|
-
localId,
|
|
59
|
-
style
|
|
60
|
-
} = props.node.attrs;
|
|
61
|
-
return jsx(IntlStatusContainerView, {
|
|
62
|
-
view: view,
|
|
63
|
-
text: text,
|
|
64
|
-
color: color
|
|
65
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
66
|
-
,
|
|
67
|
-
style: style,
|
|
68
|
-
localId: localId
|
|
69
|
-
});
|
|
70
|
-
};
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jsxRuntime classic
|
|
3
|
-
* @jsx jsx
|
|
4
|
-
*/
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
|
-
import { css, jsx } from '@emotion/react';
|
|
9
|
-
import { injectIntl } from 'react-intl-next';
|
|
10
|
-
import { statusMessages as messages } from '@atlaskit/editor-common/messages';
|
|
11
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
|
-
import { Status } from '@atlaskit/status/element';
|
|
13
|
-
var styledStatusStyles = css({
|
|
14
|
-
opacity: 1
|
|
15
|
-
});
|
|
16
|
-
var styledStatusPlaceholderStyles = css({
|
|
17
|
-
opacity: 0.5
|
|
18
|
-
});
|
|
19
|
-
var StatusContainerView = function StatusContainerView(props) {
|
|
20
|
-
var text = props.text,
|
|
21
|
-
color = props.color,
|
|
22
|
-
localId = props.localId,
|
|
23
|
-
style = props.style,
|
|
24
|
-
formatMessage = props.intl.formatMessage;
|
|
25
|
-
var statusText = text ? text : formatMessage(messages.placeholder);
|
|
26
|
-
var handleClick = function handleClick(event) {
|
|
27
|
-
if (event.nativeEvent.stopImmediatePropagation) {
|
|
28
|
-
event.nativeEvent.stopImmediatePropagation();
|
|
29
|
-
}
|
|
30
|
-
// handling of popup is done in plugin.apply on selection change.
|
|
31
|
-
};
|
|
32
|
-
return jsx("span", {
|
|
33
|
-
css: text ? styledStatusStyles : styledStatusPlaceholderStyles,
|
|
34
|
-
"data-testid": "statusContainerView"
|
|
35
|
-
}, jsx(Status, {
|
|
36
|
-
text: statusText,
|
|
37
|
-
color: color,
|
|
38
|
-
localId: localId
|
|
39
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
40
|
-
,
|
|
41
|
-
style: style,
|
|
42
|
-
onClick: handleClick,
|
|
43
|
-
isBold: fg('platform-component-visual-refresh')
|
|
44
|
-
}));
|
|
45
|
-
};
|
|
46
|
-
export var IntlStatusContainerView = injectIntl(StatusContainerView);
|
|
47
|
-
export var StatusNodeView = function StatusNodeView(props) {
|
|
48
|
-
var view = props.view;
|
|
49
|
-
var _props$node$attrs = props.node.attrs,
|
|
50
|
-
text = _props$node$attrs.text,
|
|
51
|
-
color = _props$node$attrs.color,
|
|
52
|
-
localId = _props$node$attrs.localId,
|
|
53
|
-
style = _props$node$attrs.style;
|
|
54
|
-
return jsx(IntlStatusContainerView, {
|
|
55
|
-
view: view,
|
|
56
|
-
text: text,
|
|
57
|
-
color: color
|
|
58
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
59
|
-
,
|
|
60
|
-
style: style,
|
|
61
|
-
localId: localId
|
|
62
|
-
});
|
|
63
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jsxRuntime classic
|
|
3
|
-
* @jsx jsx
|
|
4
|
-
*/
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import { jsx } from '@emotion/react';
|
|
7
|
-
import type { IntlShape } from 'react-intl-next';
|
|
8
|
-
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
9
|
-
import type { InlineNodeViewComponentProps } from '@atlaskit/editor-common/react-node-view';
|
|
10
|
-
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
11
|
-
import type { Color, StatusStyle } from '@atlaskit/status/element';
|
|
12
|
-
import type { StatusPluginOptions } from '../types';
|
|
13
|
-
export interface ContainerProps {
|
|
14
|
-
view: EditorView;
|
|
15
|
-
intl: IntlShape;
|
|
16
|
-
text?: string;
|
|
17
|
-
color: Color;
|
|
18
|
-
style?: StatusStyle;
|
|
19
|
-
localId?: string;
|
|
20
|
-
eventDispatcher?: EventDispatcher;
|
|
21
|
-
}
|
|
22
|
-
export declare const IntlStatusContainerView: React.FC<import("react-intl-next").WithIntlProps<ContainerProps>> & {
|
|
23
|
-
WrappedComponent: React.ComponentType<ContainerProps>;
|
|
24
|
-
};
|
|
25
|
-
export type Props = InlineNodeViewComponentProps & {
|
|
26
|
-
options: StatusPluginOptions | undefined;
|
|
27
|
-
};
|
|
28
|
-
export declare const StatusNodeView: (props: Props) => jsx.JSX.Element;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jsxRuntime classic
|
|
3
|
-
* @jsx jsx
|
|
4
|
-
*/
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import { jsx } from '@emotion/react';
|
|
7
|
-
import type { IntlShape } from 'react-intl-next';
|
|
8
|
-
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
9
|
-
import type { InlineNodeViewComponentProps } from '@atlaskit/editor-common/react-node-view';
|
|
10
|
-
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
11
|
-
import type { Color, StatusStyle } from '@atlaskit/status/element';
|
|
12
|
-
import type { StatusPluginOptions } from '../types';
|
|
13
|
-
export interface ContainerProps {
|
|
14
|
-
view: EditorView;
|
|
15
|
-
intl: IntlShape;
|
|
16
|
-
text?: string;
|
|
17
|
-
color: Color;
|
|
18
|
-
style?: StatusStyle;
|
|
19
|
-
localId?: string;
|
|
20
|
-
eventDispatcher?: EventDispatcher;
|
|
21
|
-
}
|
|
22
|
-
export declare const IntlStatusContainerView: React.FC<import("react-intl-next").WithIntlProps<ContainerProps>> & {
|
|
23
|
-
WrappedComponent: React.ComponentType<ContainerProps>;
|
|
24
|
-
};
|
|
25
|
-
export type Props = InlineNodeViewComponentProps & {
|
|
26
|
-
options: StatusPluginOptions | undefined;
|
|
27
|
-
};
|
|
28
|
-
export declare const StatusNodeView: (props: Props) => jsx.JSX.Element;
|