@atlaskit/editor-common 84.1.0 → 84.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/afm-cc/tsconfig.json +3 -0
- package/afm-jira/tsconfig.json +3 -0
- package/dist/cjs/extensibility/ExtensionNodeWrapper.js +2 -2
- package/dist/cjs/link/ConfigureLinkOverlay/Dropdown.js +56 -0
- package/dist/cjs/link/ConfigureLinkOverlay/StyledButton.js +38 -0
- package/dist/cjs/link/ConfigureLinkOverlay/{OverlayButton.js → index.js} +29 -22
- package/dist/cjs/link/index.js +2 -2
- package/dist/cjs/mark/commands.js +2 -7
- package/dist/cjs/messages/annotation.js +1 -1
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/react-node-view/getInlineNodeViewProducer.js +3 -2
- package/dist/cjs/resizer/Resizer.js +23 -45
- package/dist/cjs/styles/shared/annotation.js +2 -34
- package/dist/cjs/styles/shared/smartCard.js +1 -1
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui-color/ColorPalette/Color/index.js +1 -2
- package/dist/cjs/ui-color/ColorPalette/Palettes/highlightColorPalette.js +6 -11
- package/dist/cjs/ui-color/ColorPalette/Palettes/textColorPalette.js +2 -11
- package/dist/cjs/ui-color/index.js +0 -12
- package/dist/cjs/utils/annotation/index.js +10 -18
- package/dist/cjs/utils/index.js +5 -1
- package/dist/cjs/utils/scroll-gutter.js +3 -0
- package/dist/cjs/utils/validator.js +5 -5
- package/dist/cjs/whitespace/index.js +18 -0
- package/dist/es2019/extensibility/ExtensionNodeWrapper.js +1 -1
- package/dist/es2019/link/ConfigureLinkOverlay/Dropdown.js +45 -0
- package/dist/es2019/link/ConfigureLinkOverlay/StyledButton.js +30 -0
- package/dist/es2019/link/ConfigureLinkOverlay/{OverlayButton.js → index.js} +28 -24
- package/dist/es2019/link/index.js +1 -1
- package/dist/es2019/mark/commands.js +3 -10
- package/dist/es2019/messages/annotation.js +1 -1
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/react-node-view/getInlineNodeViewProducer.js +2 -1
- package/dist/es2019/resizer/Resizer.js +26 -54
- package/dist/es2019/styles/shared/annotation.js +3 -35
- package/dist/es2019/styles/shared/smartCard.js +2 -2
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui-color/ColorPalette/Color/index.js +1 -2
- package/dist/es2019/ui-color/ColorPalette/Palettes/highlightColorPalette.js +2 -7
- package/dist/es2019/ui-color/ColorPalette/Palettes/textColorPalette.js +2 -7
- package/dist/es2019/ui-color/index.js +2 -2
- package/dist/es2019/utils/annotation/index.js +11 -21
- package/dist/es2019/utils/index.js +4 -1
- package/dist/es2019/utils/scroll-gutter.js +3 -0
- package/dist/es2019/utils/validator.js +6 -6
- package/dist/es2019/whitespace/index.js +1 -0
- package/dist/esm/extensibility/ExtensionNodeWrapper.js +1 -1
- package/dist/esm/link/ConfigureLinkOverlay/Dropdown.js +46 -0
- package/dist/esm/link/ConfigureLinkOverlay/StyledButton.js +31 -0
- package/dist/esm/link/ConfigureLinkOverlay/{OverlayButton.js → index.js} +31 -24
- package/dist/esm/link/index.js +1 -1
- package/dist/esm/mark/commands.js +3 -8
- package/dist/esm/messages/annotation.js +1 -1
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/react-node-view/getInlineNodeViewProducer.js +2 -1
- package/dist/esm/resizer/Resizer.js +23 -45
- package/dist/esm/styles/shared/annotation.js +3 -35
- package/dist/esm/styles/shared/smartCard.js +2 -2
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui-color/ColorPalette/Color/index.js +1 -2
- package/dist/esm/ui-color/ColorPalette/Palettes/highlightColorPalette.js +1 -10
- package/dist/esm/ui-color/ColorPalette/Palettes/textColorPalette.js +1 -10
- package/dist/esm/ui-color/index.js +2 -2
- package/dist/esm/utils/annotation/index.js +11 -19
- package/dist/esm/utils/index.js +4 -1
- package/dist/esm/utils/scroll-gutter.js +3 -0
- package/dist/esm/utils/validator.js +6 -6
- package/dist/esm/whitespace/index.js +1 -0
- package/dist/types/link/ConfigureLinkOverlay/Dropdown.d.ts +7 -0
- package/dist/types/link/ConfigureLinkOverlay/StyledButton.d.ts +7 -0
- package/dist/types/link/index.d.ts +2 -2
- package/dist/types/types/annotation/index.d.ts +2 -2
- package/dist/types/ui-color/ColorPalette/Palettes/highlightColorPalette.d.ts +0 -1
- package/dist/types/ui-color/ColorPalette/Palettes/textColorPalette.d.ts +1 -2
- package/dist/types/ui-color/index.d.ts +2 -2
- package/dist/types/utils/annotation/index.d.ts +2 -2
- package/dist/types/utils/index.d.ts +4 -1
- package/dist/types/utils/scroll-gutter.d.ts +3 -0
- package/dist/types/whitespace/index.d.ts +1 -0
- package/dist/types-ts4.5/link/ConfigureLinkOverlay/Dropdown.d.ts +7 -0
- package/dist/types-ts4.5/link/ConfigureLinkOverlay/StyledButton.d.ts +7 -0
- package/dist/types-ts4.5/link/index.d.ts +2 -2
- package/dist/types-ts4.5/types/annotation/index.d.ts +2 -2
- package/dist/types-ts4.5/ui-color/ColorPalette/Palettes/highlightColorPalette.d.ts +0 -1
- package/dist/types-ts4.5/ui-color/ColorPalette/Palettes/textColorPalette.d.ts +1 -2
- package/dist/types-ts4.5/ui-color/index.d.ts +2 -2
- package/dist/types-ts4.5/utils/annotation/index.d.ts +2 -2
- package/dist/types-ts4.5/utils/index.d.ts +4 -1
- package/dist/types-ts4.5/utils/scroll-gutter.d.ts +3 -0
- package/dist/types-ts4.5/whitespace/index.d.ts +1 -0
- package/package.json +6 -13
- package/whitespace/package.json +15 -0
- /package/dist/cjs/{utils → whitespace}/whitespace.js +0 -0
- /package/dist/es2019/{utils → whitespace}/whitespace.js +0 -0
- /package/dist/esm/{utils → whitespace}/whitespace.js +0 -0
- /package/dist/types/link/ConfigureLinkOverlay/{OverlayButton.d.ts → index.d.ts} +0 -0
- /package/dist/types/{utils → whitespace}/whitespace.d.ts +0 -0
- /package/dist/types-ts4.5/link/ConfigureLinkOverlay/{OverlayButton.d.ts → index.d.ts} +0 -0
- /package/dist/types-ts4.5/{utils → whitespace}/whitespace.d.ts +0 -0
|
@@ -4,21 +4,17 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
7
|
+
exports.textColorPaletteTokenBorders = exports.textColorPalette = exports.mapPaletteColor = void 0;
|
|
9
8
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
10
|
-
var _common = require("./common");
|
|
11
9
|
var _getColorMessage = _interopRequireDefault(require("./getColorMessage"));
|
|
12
10
|
var _paletteMessages = _interopRequireDefault(require("./paletteMessages"));
|
|
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
11
|
var mapPaletteColor = exports.mapPaletteColor = function mapPaletteColor(label, color) {
|
|
16
12
|
var key = label.toLowerCase().replace(' ', '-');
|
|
17
13
|
var message = (0, _getColorMessage.default)(_paletteMessages.default, key);
|
|
18
14
|
return {
|
|
19
15
|
value: color,
|
|
20
16
|
label: label,
|
|
21
|
-
border:
|
|
17
|
+
border: "var(--ds-border, #091E4224)",
|
|
22
18
|
message: message
|
|
23
19
|
};
|
|
24
20
|
};
|
|
@@ -28,9 +24,4 @@ var textColorPalette = exports.textColorPalette = [];
|
|
|
28
24
|
var textColorPaletteTokenBorders = exports.textColorPaletteTokenBorders = [];
|
|
29
25
|
_adfSchema.colorPalette.forEach(function (label, color) {
|
|
30
26
|
textColorPalette.push(mapPaletteColor(label, color));
|
|
31
|
-
});
|
|
32
|
-
var textColorPaletteWithTokenBorders = exports.textColorPaletteWithTokenBorders = textColorPalette.map(function (paletteColor) {
|
|
33
|
-
return _objectSpread(_objectSpread({}, paletteColor), {}, {
|
|
34
|
-
border: "var(--ds-border, #091E4224)"
|
|
35
|
-
});
|
|
36
27
|
});
|
|
@@ -100,12 +100,6 @@ Object.defineProperty(exports, "highlightColorPalette", {
|
|
|
100
100
|
return _highlightColorPalette.highlightColorPalette;
|
|
101
101
|
}
|
|
102
102
|
});
|
|
103
|
-
Object.defineProperty(exports, "highlightColorPaletteWithTokenBorders", {
|
|
104
|
-
enumerable: true,
|
|
105
|
-
get: function get() {
|
|
106
|
-
return _highlightColorPalette.highlightColorPaletteWithTokenBorders;
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
103
|
Object.defineProperty(exports, "lightModeStatusColorPalette", {
|
|
110
104
|
enumerable: true,
|
|
111
105
|
get: function get() {
|
|
@@ -130,12 +124,6 @@ Object.defineProperty(exports, "textColorPalette", {
|
|
|
130
124
|
return _textColorPalette.textColorPalette;
|
|
131
125
|
}
|
|
132
126
|
});
|
|
133
|
-
Object.defineProperty(exports, "textColorPaletteWithTokenBorders", {
|
|
134
|
-
enumerable: true,
|
|
135
|
-
get: function get() {
|
|
136
|
-
return _textColorPalette.textColorPaletteWithTokenBorders;
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
127
|
Object.defineProperty(exports, "textPaletteTooltipMessages", {
|
|
140
128
|
enumerable: true,
|
|
141
129
|
get: function get() {
|
|
@@ -19,29 +19,21 @@ var canApplyAnnotationOnRange = exports.canApplyAnnotationOnRange = function can
|
|
|
19
19
|
if (isNaN(from + to) || to - from <= 0 || to < 0 || from < 0) {
|
|
20
20
|
return false;
|
|
21
21
|
}
|
|
22
|
-
var inlineCard = schema.nodes.inlineCard;
|
|
23
22
|
var foundInvalid = false;
|
|
24
23
|
doc.nodesBetween(rangeSelection.from, rangeSelection.to, function (node, _pos, parent) {
|
|
25
24
|
// Special exception for hardBreak nodes
|
|
26
25
|
if (schema.nodes.hardBreak === node.type) {
|
|
27
26
|
return false;
|
|
28
27
|
}
|
|
28
|
+
|
|
29
29
|
// For block elements or text nodes, we want to check
|
|
30
30
|
// if annotations are allowed inside this tree
|
|
31
31
|
// or if we're leaf and not text
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
if ((0
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
foundInvalid = true;
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
} else {
|
|
41
|
-
if (node.isInline && !node.isText && node.type !== inlineCard || node.isLeaf && !node.isText && node.type !== inlineCard || node.isText && !(parent !== null && parent !== void 0 && parent.type.allowsMarkType(schema.marks.annotation))) {
|
|
42
|
-
foundInvalid = true;
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
32
|
+
if ((0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes')) {
|
|
33
|
+
var isAllowedInlineNode = ['emoji', 'status', 'date', 'mention', 'inlineCard'].includes(node.type.name);
|
|
34
|
+
if (node.isInline && !node.isText && !isAllowedInlineNode || node.isLeaf && !node.isText && !isAllowedInlineNode || node.isText && !(parent !== null && parent !== void 0 && parent.type.allowsMarkType(schema.marks.annotation))) {
|
|
35
|
+
foundInvalid = true;
|
|
36
|
+
return false;
|
|
45
37
|
}
|
|
46
38
|
} else {
|
|
47
39
|
if (node.isInline && !node.isText || node.isLeaf && !node.isText || node.isText && !(parent !== null && parent !== void 0 && parent.type.allowsMarkType(schema.marks.annotation))) {
|
|
@@ -111,7 +103,7 @@ function containsAnyAnnotations(slice, state) {
|
|
|
111
103
|
function getRangeInlineNodeNames(_ref) {
|
|
112
104
|
var doc = _ref.doc,
|
|
113
105
|
pos = _ref.pos;
|
|
114
|
-
if (!(0, _platformFeatureFlags.
|
|
106
|
+
if (!(0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes')) {
|
|
115
107
|
return undefined;
|
|
116
108
|
}
|
|
117
109
|
var nodeNames = new Set();
|
|
@@ -129,13 +121,13 @@ function getRangeInlineNodeNames(_ref) {
|
|
|
129
121
|
/**
|
|
130
122
|
* This function returns a list of node types that are wrapped by an annotation mark.
|
|
131
123
|
*
|
|
132
|
-
* The `undefined` will be returned if `
|
|
124
|
+
* The `undefined` will be returned if `editor_inline_comments_on_inline_nodes` is off.
|
|
133
125
|
*
|
|
134
126
|
* @todo: Do not forget to remove `undefined` when the
|
|
135
|
-
* `
|
|
127
|
+
* `editor_inline_comments_on_inline_nodes` is removed.
|
|
136
128
|
*/
|
|
137
129
|
function getAnnotationInlineNodeTypes(state, annotationId) {
|
|
138
|
-
if (!(0, _platformFeatureFlags.
|
|
130
|
+
if (!(0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes')) {
|
|
139
131
|
return undefined;
|
|
140
132
|
}
|
|
141
133
|
var mark = state.schema.marks.annotation.create({
|
package/dist/cjs/utils/index.js
CHANGED
|
@@ -1152,7 +1152,7 @@ var _table = require("./table");
|
|
|
1152
1152
|
var _compareNodes = require("./compareNodes");
|
|
1153
1153
|
var _compose = require("./compose");
|
|
1154
1154
|
var _isTextInput = require("./is-text-input");
|
|
1155
|
-
var _whitespace = require("
|
|
1155
|
+
var _whitespace = require("../whitespace");
|
|
1156
1156
|
var _shouldForceTracking = require("./should-force-tracking");
|
|
1157
1157
|
var _getModeFromTheme = require("./getModeFromTheme");
|
|
1158
1158
|
var _getPerformanceOptions = require("./get-performance-options");
|
|
@@ -1181,6 +1181,10 @@ var _insertNodeIntoOrderedList = require("./insert-node-into-ordered-list");
|
|
|
1181
1181
|
var _wrapSelectionIn = require("./wrap-selection-in");
|
|
1182
1182
|
var _calculateToolbarPosition = require("./calculate-toolbar-position");
|
|
1183
1183
|
var _nodesByLocalIds = require("./nodes-by-localIds");
|
|
1184
|
+
/**
|
|
1185
|
+
* @deprecated - [ED-23844] moving to own entry point @atlaskit/editor-common/whitespace
|
|
1186
|
+
*/
|
|
1187
|
+
|
|
1184
1188
|
// prosemirror-history does not export its plugin key
|
|
1185
1189
|
var pmHistoryPluginKey = exports.pmHistoryPluginKey = 'history$';
|
|
1186
1190
|
function shallowEqual() {
|
|
@@ -5,5 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.GUTTER_SIZE_MOBILE_IN_PX = exports.GUTTER_SIZE_IN_PX = exports.GUTTER_SELECTOR = void 0;
|
|
7
7
|
var GUTTER_SIZE_IN_PX = exports.GUTTER_SIZE_IN_PX = 120; // Default gutter size
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated - [ED-23844] only used in Editor Core
|
|
10
|
+
*/
|
|
8
11
|
var GUTTER_SIZE_MOBILE_IN_PX = exports.GUTTER_SIZE_MOBILE_IN_PX = 36; // Gutter size for Mobile
|
|
9
12
|
var GUTTER_SELECTOR = exports.GUTTER_SELECTOR = '#editor-scroll-gutter';
|
|
@@ -255,7 +255,7 @@ var getValidNode = exports.getValidNode = function getValidNode(originalNode) {
|
|
|
255
255
|
return _objectSpread({
|
|
256
256
|
type: type,
|
|
257
257
|
attrs: attrs
|
|
258
|
-
}, (0, _platformFeatureFlags.
|
|
258
|
+
}, (0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes') ? {
|
|
259
259
|
marks: marks
|
|
260
260
|
} : {});
|
|
261
261
|
}
|
|
@@ -267,7 +267,7 @@ var getValidNode = exports.getValidNode = function getValidNode(originalNode) {
|
|
|
267
267
|
return _objectSpread({
|
|
268
268
|
type: type,
|
|
269
269
|
attrs: attrs
|
|
270
|
-
}, (0, _platformFeatureFlags.
|
|
270
|
+
}, (0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes') ? {
|
|
271
271
|
marks: marks
|
|
272
272
|
} : {});
|
|
273
273
|
}
|
|
@@ -279,7 +279,7 @@ var getValidNode = exports.getValidNode = function getValidNode(originalNode) {
|
|
|
279
279
|
return _objectSpread({
|
|
280
280
|
type: type,
|
|
281
281
|
attrs: attrs
|
|
282
|
-
}, (0, _platformFeatureFlags.
|
|
282
|
+
}, (0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes') ? {
|
|
283
283
|
marks: marks
|
|
284
284
|
} : {});
|
|
285
285
|
}
|
|
@@ -302,7 +302,7 @@ var getValidNode = exports.getValidNode = function getValidNode(originalNode) {
|
|
|
302
302
|
return _objectSpread({
|
|
303
303
|
type: type,
|
|
304
304
|
attrs: attrs
|
|
305
|
-
}, (0, _platformFeatureFlags.
|
|
305
|
+
}, (0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes') ? {
|
|
306
306
|
marks: marks
|
|
307
307
|
} : {});
|
|
308
308
|
}
|
|
@@ -509,7 +509,7 @@ var getValidNode = exports.getValidNode = function getValidNode(originalNode) {
|
|
|
509
509
|
text: mentionText,
|
|
510
510
|
accessLevel: ''
|
|
511
511
|
}
|
|
512
|
-
}, (0, _platformFeatureFlags.
|
|
512
|
+
}, (0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes') ? {
|
|
513
513
|
marks: marks
|
|
514
514
|
} : {});
|
|
515
515
|
if (mentionAccess) {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "ZERO_WIDTH_JOINER", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _whitespace.ZERO_WIDTH_JOINER;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "ZERO_WIDTH_SPACE", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _whitespace.ZERO_WIDTH_SPACE;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _whitespace = require("./whitespace");
|
|
@@ -4,7 +4,7 @@ import React from 'react';
|
|
|
4
4
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
5
5
|
import { css, jsx } from '@emotion/react';
|
|
6
6
|
import classnames from 'classnames';
|
|
7
|
-
import { ZERO_WIDTH_SPACE } from '../
|
|
7
|
+
import { ZERO_WIDTH_SPACE } from '../whitespace';
|
|
8
8
|
const styles = css({
|
|
9
9
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
10
10
|
'&.inline-extension': {
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
/** @jsx jsx */
|
|
3
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
4
|
+
import { jsx } from '@emotion/react';
|
|
5
|
+
import { useIntl } from 'react-intl-next';
|
|
6
|
+
import DropdownMenu, { DropdownItem, DropdownItemGroup } from '@atlaskit/dropdown-menu';
|
|
7
|
+
import ChevronDownIcon from '@atlaskit/icon/glyph/chevron-down';
|
|
8
|
+
import PreferencesIcon from '@atlaskit/icon/glyph/preferences';
|
|
9
|
+
import ShortcutIcon from '@atlaskit/icon/glyph/shortcut';
|
|
10
|
+
import { cardMessages as messages } from '../../messages';
|
|
11
|
+
import { StyledButton } from './StyledButton';
|
|
12
|
+
const Dropdown = ({
|
|
13
|
+
testId
|
|
14
|
+
}) => {
|
|
15
|
+
const {
|
|
16
|
+
formatMessage
|
|
17
|
+
} = useIntl();
|
|
18
|
+
const configureLinkLabel = formatMessage(messages.inlineConfigureLink);
|
|
19
|
+
const goToLinkLabel = formatMessage(messages.inlineGoToLink);
|
|
20
|
+
return jsx(DropdownMenu, {
|
|
21
|
+
trigger: ({
|
|
22
|
+
triggerRef,
|
|
23
|
+
...props
|
|
24
|
+
}) => jsx(StyledButton, _extends({
|
|
25
|
+
innerRef: triggerRef
|
|
26
|
+
}, props, {
|
|
27
|
+
iconBefore: jsx(ChevronDownIcon, {
|
|
28
|
+
label: configureLinkLabel,
|
|
29
|
+
size: 'small'
|
|
30
|
+
})
|
|
31
|
+
})),
|
|
32
|
+
testId: `${testId}-dropdown`
|
|
33
|
+
}, jsx(DropdownItemGroup, null, jsx(DropdownItem, {
|
|
34
|
+
elemBefore: jsx(ShortcutIcon, {
|
|
35
|
+
label: goToLinkLabel,
|
|
36
|
+
size: 'medium'
|
|
37
|
+
})
|
|
38
|
+
}, goToLinkLabel), jsx(DropdownItem, {
|
|
39
|
+
elemBefore: jsx(PreferencesIcon, {
|
|
40
|
+
label: configureLinkLabel,
|
|
41
|
+
size: 'medium'
|
|
42
|
+
})
|
|
43
|
+
}, configureLinkLabel)));
|
|
44
|
+
};
|
|
45
|
+
export default Dropdown;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
/** @jsx jsx */
|
|
3
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
4
|
+
import { css, jsx } from '@emotion/react';
|
|
5
|
+
import Button from '@atlaskit/button';
|
|
6
|
+
import { N30A, N40A, N60A, N700 } from '@atlaskit/theme/colors';
|
|
7
|
+
const buttonStyles = css({
|
|
8
|
+
display: 'flex',
|
|
9
|
+
background: `var(--ds-background-neutral, ${N30A})`,
|
|
10
|
+
color: `var(--ds-icon, ${N700})`,
|
|
11
|
+
'&:hover': {
|
|
12
|
+
background: `var(--ds-background-neutral-hovered, ${N40A})`
|
|
13
|
+
},
|
|
14
|
+
'&:active': {
|
|
15
|
+
background: `var(--ds-background-neutral-pressed, ${N60A})`
|
|
16
|
+
},
|
|
17
|
+
width: '1.375rem',
|
|
18
|
+
height: '1.25rem'
|
|
19
|
+
});
|
|
20
|
+
export const StyledButton = ({
|
|
21
|
+
innerRef,
|
|
22
|
+
...props
|
|
23
|
+
}) => {
|
|
24
|
+
return jsx(Button, _extends({}, props, {
|
|
25
|
+
ref: innerRef
|
|
26
|
+
// eslint-disable-next-line @atlaskit/design-system/no-unsafe-style-overrides
|
|
27
|
+
,
|
|
28
|
+
css: buttonStyles
|
|
29
|
+
}));
|
|
30
|
+
};
|
|
@@ -1,29 +1,17 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { useCallback } from 'react';
|
|
2
|
+
import { useCallback, useLayoutEffect, useState } from 'react';
|
|
3
3
|
|
|
4
4
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
5
5
|
import { css, jsx } from '@emotion/react';
|
|
6
6
|
import { useIntl } from 'react-intl-next';
|
|
7
|
-
import Button from '@atlaskit/button';
|
|
8
7
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
9
8
|
import PreferencesIcon from '@atlaskit/icon/glyph/preferences';
|
|
10
|
-
import { N0
|
|
9
|
+
import { N0 } from '@atlaskit/theme/colors';
|
|
11
10
|
import { layers } from '@atlaskit/theme/constants';
|
|
12
11
|
import Tooltip from '@atlaskit/tooltip';
|
|
13
12
|
import { cardMessages } from '../../messages';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
background: `var(--ds-background-neutral, ${N30A})`,
|
|
17
|
-
color: `var(--ds-icon, ${N700})`,
|
|
18
|
-
'&:hover': {
|
|
19
|
-
background: `var(--ds-background-neutral-hovered, ${N40A})`
|
|
20
|
-
},
|
|
21
|
-
'&:active': {
|
|
22
|
-
background: `var(--ds-background-neutral-pressed, ${N60A})`
|
|
23
|
-
},
|
|
24
|
-
width: '1.375rem',
|
|
25
|
-
height: '1.25rem'
|
|
26
|
-
});
|
|
13
|
+
import Dropdown from './Dropdown';
|
|
14
|
+
import { StyledButton } from './StyledButton';
|
|
27
15
|
const buttonWrapperStyles = css({
|
|
28
16
|
position: 'absolute',
|
|
29
17
|
zIndex: layers.card(),
|
|
@@ -33,6 +21,7 @@ const buttonWrapperStyles = css({
|
|
|
33
21
|
background: `var(--ds-surface-raised, ${N0})`,
|
|
34
22
|
borderRadius: "var(--ds-border-radius, 3px)"
|
|
35
23
|
});
|
|
24
|
+
const showDropdownThresholdPx = 50;
|
|
36
25
|
export const OverlayButton = ({
|
|
37
26
|
editorView,
|
|
38
27
|
testId = 'link-configure-overlay-button',
|
|
@@ -42,6 +31,23 @@ export const OverlayButton = ({
|
|
|
42
31
|
const {
|
|
43
32
|
formatMessage
|
|
44
33
|
} = useIntl();
|
|
34
|
+
const configureLinkLabel = formatMessage(cardMessages.inlineConfigureLink);
|
|
35
|
+
const [showDropdown, setShowDropdown] = useState(false);
|
|
36
|
+
useLayoutEffect(() => {
|
|
37
|
+
var _domNode;
|
|
38
|
+
let domNode = editorView.nodeDOM(targetElementPos);
|
|
39
|
+
if (((_domNode = domNode) === null || _domNode === void 0 ? void 0 : _domNode.nodeType) === Node.TEXT_NODE) {
|
|
40
|
+
domNode = domNode.parentElement;
|
|
41
|
+
}
|
|
42
|
+
if (domNode instanceof HTMLElement) {
|
|
43
|
+
const {
|
|
44
|
+
width
|
|
45
|
+
} = domNode.getBoundingClientRect();
|
|
46
|
+
if (width < showDropdownThresholdPx) {
|
|
47
|
+
setShowDropdown(true);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}, [editorView, targetElementPos]);
|
|
45
51
|
const docNode = editorView.state.doc.nodeAt(targetElementPos);
|
|
46
52
|
const nodeEnd = targetElementPos + ((_docNode$nodeSize = docNode === null || docNode === void 0 ? void 0 : docNode.nodeSize) !== null && _docNode$nodeSize !== void 0 ? _docNode$nodeSize : 0);
|
|
47
53
|
const isText = docNode === null || docNode === void 0 ? void 0 : docNode.isText;
|
|
@@ -62,18 +68,16 @@ export const OverlayButton = ({
|
|
|
62
68
|
if (!targetElementPos || isSelected) {
|
|
63
69
|
return null;
|
|
64
70
|
}
|
|
65
|
-
const configureLinkLabel = formatMessage(cardMessages.inlineConfigureLink);
|
|
66
71
|
return jsx("span", {
|
|
67
|
-
css: buttonWrapperStyles
|
|
68
|
-
|
|
72
|
+
css: buttonWrapperStyles,
|
|
73
|
+
"data-testid": testId
|
|
74
|
+
}, showDropdown ? jsx(Dropdown, {
|
|
75
|
+
testId: testId
|
|
76
|
+
}) : jsx(Tooltip, {
|
|
69
77
|
content: configureLinkLabel,
|
|
70
78
|
hideTooltipOnClick: true,
|
|
71
79
|
testId: `${testId}-tooltip`
|
|
72
|
-
}, jsx(
|
|
73
|
-
testId: testId
|
|
74
|
-
// eslint-disable-next-line @atlaskit/design-system/no-unsafe-style-overrides
|
|
75
|
-
,
|
|
76
|
-
css: buttonStyles,
|
|
80
|
+
}, jsx(StyledButton, {
|
|
77
81
|
onClick: handleClick,
|
|
78
82
|
iconBefore: jsx(PreferencesIcon, {
|
|
79
83
|
label: configureLinkLabel,
|
|
@@ -10,4 +10,4 @@ export { default as HyperlinkLinkAddToolbar, HyperlinkLinkAddToolbarWithIntl, RE
|
|
|
10
10
|
export { sha1 } from './LinkPicker/HyperlinkAddToolbar/utils';
|
|
11
11
|
export { isLinkAtPos, isTextAtPos, getLinkPreferencesURLFromENV } from './utils';
|
|
12
12
|
export { stagingLinkPreferencesUrl, productionLinkPreferencesUrl } from './constants';
|
|
13
|
-
export { OverlayButton } from './ConfigureLinkOverlay
|
|
13
|
+
export { OverlayButton } from './ConfigureLinkOverlay';
|
|
@@ -2,7 +2,7 @@ import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
|
2
2
|
// eslint-disable-next-line no-duplicate-imports
|
|
3
3
|
|
|
4
4
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
5
|
-
import {
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
6
|
const SMART_TO_ASCII = {
|
|
7
7
|
'…': '...',
|
|
8
8
|
'→': '->',
|
|
@@ -150,24 +150,17 @@ export const applyMarkOnRange = (from, to, removeMark, mark, tr) => {
|
|
|
150
150
|
const {
|
|
151
151
|
code
|
|
152
152
|
} = schema.marks;
|
|
153
|
-
const {
|
|
154
|
-
inlineCard
|
|
155
|
-
} = schema.nodes;
|
|
156
153
|
if (mark.type === code) {
|
|
157
|
-
|
|
154
|
+
fg('platform.editor.simplify-inline-cards-in-code-blocks_jw6t1') ? transformNonTextNodesToText(from, to, tr) : transformSmartCharsMentionsAndEmojis(from, to, tr);
|
|
158
155
|
}
|
|
159
156
|
tr.doc.nodesBetween(tr.mapping.map(from), tr.mapping.map(to), (node, pos) => {
|
|
160
|
-
if (
|
|
157
|
+
if (fg('editor_inline_comments_on_inline_nodes')) {
|
|
161
158
|
if (!node.isText) {
|
|
162
159
|
const isAllowedInlineNode = ['emoji', 'status', 'date', 'mention', 'inlineCard'].includes(node.type.name);
|
|
163
160
|
if (!isAllowedInlineNode) {
|
|
164
161
|
return true;
|
|
165
162
|
}
|
|
166
163
|
}
|
|
167
|
-
} else if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes')) {
|
|
168
|
-
if (!node.isText && node.type !== inlineCard) {
|
|
169
|
-
return true;
|
|
170
|
-
}
|
|
171
164
|
} else {
|
|
172
165
|
if (!node.isText) {
|
|
173
166
|
return true;
|
|
@@ -5,7 +5,7 @@ export const annotationMessages = defineMessages({
|
|
|
5
5
|
defaultMessage: 'Comment',
|
|
6
6
|
description: 'Create/add an inline comment based on the users selection'
|
|
7
7
|
},
|
|
8
|
-
// TODO: Remove this message when the
|
|
8
|
+
// TODO: Remove this message when the editor_inline_comments_on_inline_nodes FF is removed
|
|
9
9
|
createCommentInvalid: {
|
|
10
10
|
id: 'fabric.editor.createCommentInvalid',
|
|
11
11
|
defaultMessage: 'You can only comment on text and headings',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isFedRamp } from './environment';
|
|
2
2
|
const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
3
3
|
const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
4
|
-
const packageVersion = "84.
|
|
4
|
+
const packageVersion = "84.3.0";
|
|
5
5
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
6
6
|
// Remove URL as it has UGC
|
|
7
7
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -6,7 +6,8 @@ import React from 'react';
|
|
|
6
6
|
import { jsx } from '@emotion/react';
|
|
7
7
|
import { ACTION_SUBJECT, ACTION_SUBJECT_ID } from '../analytics';
|
|
8
8
|
import { ErrorBoundary } from '../ui/ErrorBoundary';
|
|
9
|
-
import { analyticsEventKey, browser, getPerformanceOptions, startMeasureReactNodeViewRendered, stopMeasureReactNodeViewRendered
|
|
9
|
+
import { analyticsEventKey, browser, getPerformanceOptions, startMeasureReactNodeViewRendered, stopMeasureReactNodeViewRendered } from '../utils';
|
|
10
|
+
import { ZERO_WIDTH_SPACE } from '../whitespace';
|
|
10
11
|
import { generateUniqueNodeKey } from './generateUniqueNodeKey';
|
|
11
12
|
export const inlineNodeViewClassname = 'inlineNodeView';
|
|
12
13
|
function createNodeView({
|
|
@@ -2,7 +2,6 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import React, { forwardRef, useCallback, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import { Resizable } from 're-resizable';
|
|
5
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
import Tooltip from '@atlaskit/tooltip';
|
|
7
6
|
import { handleWrapperClass, resizerDangerClassName, resizerExtendedZone, resizerHandleClassName, resizerHandleThumbClassName, resizerHandleTrackClassName, resizerHandleZIndex, resizerHoverZoneClassName, resizerItemClassName } from '../styles/shared/resizer';
|
|
8
7
|
const SUPPORTED_HANDLES = ['left', 'right'];
|
|
@@ -125,33 +124,15 @@ const ResizerNext = (props, ref) => {
|
|
|
125
124
|
[position]: thumb
|
|
126
125
|
};
|
|
127
126
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
if (!!handleTooltipContent) {
|
|
138
|
-
return {
|
|
139
|
-
...result,
|
|
140
|
-
[position]:
|
|
141
|
-
/*#__PURE__*/
|
|
142
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
143
|
-
React.createElement("div", {
|
|
144
|
-
contentEditable: false,
|
|
145
|
-
style: inheritedCSS
|
|
146
|
-
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
147
|
-
content: handleTooltipContent,
|
|
148
|
-
hideTooltipOnClick: true,
|
|
149
|
-
position: "mouse",
|
|
150
|
-
mousePosition: "auto-start",
|
|
151
|
-
testId: `resizer-handle-${position}-tooltip`
|
|
152
|
-
}, thumbWithTrack))
|
|
153
|
-
};
|
|
154
|
-
}
|
|
127
|
+
const thumbWithTrack =
|
|
128
|
+
/*#__PURE__*/
|
|
129
|
+
//It's important to have {thumb} element before the div, the thumb element is the one that gets focus and only the 1st element recives aria-descibedby attribute which is important for screen reader users
|
|
130
|
+
React.createElement(React.Fragment, null, thumb, /*#__PURE__*/React.createElement("div", {
|
|
131
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
132
|
+
className: classnames(resizerHandleTrackClassName, handleHighlight),
|
|
133
|
+
"data-testid": `resizer-handle-${position}-track`
|
|
134
|
+
}));
|
|
135
|
+
if (!!handleTooltipContent) {
|
|
155
136
|
return {
|
|
156
137
|
...result,
|
|
157
138
|
[position]:
|
|
@@ -160,34 +141,25 @@ const ResizerNext = (props, ref) => {
|
|
|
160
141
|
React.createElement("div", {
|
|
161
142
|
contentEditable: false,
|
|
162
143
|
style: inheritedCSS
|
|
163
|
-
},
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
171
|
-
className: classnames(resizerHandleTrackClassName, handleHighlight),
|
|
172
|
-
"data-testid": `resizer-handle-${position}-track`
|
|
173
|
-
}));
|
|
174
|
-
if (!!handleTooltipContent) {
|
|
175
|
-
return {
|
|
176
|
-
...result,
|
|
177
|
-
[position]: /*#__PURE__*/React.createElement(Tooltip, {
|
|
178
|
-
content: handleTooltipContent,
|
|
179
|
-
hideTooltipOnClick: true,
|
|
180
|
-
position: "mouse",
|
|
181
|
-
mousePosition: "auto-start",
|
|
182
|
-
testId: `resizer-handle-${position}-tooltip`
|
|
183
|
-
}, thumbWithTrack)
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
return {
|
|
187
|
-
...result,
|
|
188
|
-
[position]: thumbWithTrack
|
|
144
|
+
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
145
|
+
content: handleTooltipContent,
|
|
146
|
+
hideTooltipOnClick: true,
|
|
147
|
+
position: "mouse",
|
|
148
|
+
mousePosition: "auto-start",
|
|
149
|
+
testId: `resizer-handle-${position}-tooltip`
|
|
150
|
+
}, thumbWithTrack))
|
|
189
151
|
};
|
|
190
152
|
}
|
|
153
|
+
return {
|
|
154
|
+
...result,
|
|
155
|
+
[position]:
|
|
156
|
+
/*#__PURE__*/
|
|
157
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
158
|
+
React.createElement("div", {
|
|
159
|
+
contentEditable: false,
|
|
160
|
+
style: inheritedCSS
|
|
161
|
+
}, thumbWithTrack)
|
|
162
|
+
};
|
|
191
163
|
}, {});
|
|
192
164
|
}, [handleHighlight, handleTooltipContent]);
|
|
193
165
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
2
2
|
import { css } from '@emotion/react';
|
|
3
|
-
import {
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
4
|
import { N60A, Y300, Y75 } from '@atlaskit/theme/colors';
|
|
5
5
|
export const annotationPrefix = 'ak-editor-annotation';
|
|
6
6
|
export const AnnotationSharedClassNames = {
|
|
@@ -17,7 +17,7 @@ export const BlockAnnotationSharedClassNames = {
|
|
|
17
17
|
const Yellow100 = 'rgb(255, 247, 214)';
|
|
18
18
|
const Y200a = 'rgba(255, 196, 0, 0.82)';
|
|
19
19
|
export const AnnotationSharedCSSByState = () => {
|
|
20
|
-
if (
|
|
20
|
+
if (fg('editor_inline_comments_on_inline_nodes')) {
|
|
21
21
|
// NOTE: These styles are shared between renderer and editor. Sometimes they
|
|
22
22
|
// need different selectors and other times they apply the same attributes
|
|
23
23
|
// in a different way. For example in renderer the focus styles are an
|
|
@@ -47,38 +47,6 @@ export const AnnotationSharedCSSByState = () => {
|
|
|
47
47
|
borderBottomColor: `var(--ds-border-accent-yellow, ${Y200a})`
|
|
48
48
|
})
|
|
49
49
|
};
|
|
50
|
-
} else if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes')) {
|
|
51
|
-
return {
|
|
52
|
-
focus: css({
|
|
53
|
-
background: `var(--ds-background-accent-yellow-subtler, ${Y75})`,
|
|
54
|
-
borderBottom: `2px solid ${`var(--ds-border-accent-yellow, ${Y300})`}`,
|
|
55
|
-
boxShadow: `var(--ds-shadow-overlay, ${`1px 2px 3px ${N60A}, -1px 2px 3px ${N60A}`})`,
|
|
56
|
-
cursor: 'pointer',
|
|
57
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
58
|
-
'&:has(.card)': {
|
|
59
|
-
fontSize: '1.5rem',
|
|
60
|
-
lineHeight: '1.2rem',
|
|
61
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
62
|
-
'& > *': {
|
|
63
|
-
fontSize: '16px'
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}),
|
|
67
|
-
blur: css({
|
|
68
|
-
background: `var(--ds-background-accent-yellow-subtlest, ${Yellow100})`,
|
|
69
|
-
borderBottom: `2px solid ${`var(--ds-border-accent-yellow, ${Y200a})`}`,
|
|
70
|
-
cursor: 'pointer',
|
|
71
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
72
|
-
'&:has(.card)': {
|
|
73
|
-
fontSize: '1.5rem',
|
|
74
|
-
lineHeight: '1.2rem',
|
|
75
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
76
|
-
'& > *': {
|
|
77
|
-
fontSize: '16px'
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
})
|
|
81
|
-
};
|
|
82
50
|
} else {
|
|
83
51
|
return {
|
|
84
52
|
focus: css({
|
|
@@ -98,7 +66,7 @@ export const AnnotationSharedCSSByState = () => {
|
|
|
98
66
|
};
|
|
99
67
|
}
|
|
100
68
|
};
|
|
101
|
-
export const annotationSharedStyles = () =>
|
|
69
|
+
export const annotationSharedStyles = () => fg('editor_inline_comments_on_inline_nodes') ?
|
|
102
70
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- `AnnotationSharedCSSByState()` is not safe in object syntax
|
|
103
71
|
css`
|
|
104
72
|
.ProseMirror {
|