@atlaskit/editor-common 82.2.2 → 82.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 +23 -0
- package/dist/cjs/extensibility/Extension/Extension/index.js +0 -1
- package/dist/cjs/extensibility/Extension/Extension/styles.js +4 -9
- package/dist/cjs/extensibility/Extension/InlineExtension/index.js +0 -1
- package/dist/cjs/extensibility/Extension/InlineExtension/styles.js +1 -4
- package/dist/cjs/extensibility/Extension/Lozenge/ExtensionLabel.js +2 -5
- package/dist/cjs/extensibility/MultiBodiedExtension/styles.js +2 -2
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui-color/ColorPalette/Color/index.js +57 -7
- package/dist/cjs/ui-color/ColorPalette/Palettes/highlightColorPalette.js +38 -2
- package/dist/cjs/ui-color/ColorPalette/index.js +4 -2
- package/dist/cjs/utils/annotation/index.js +24 -0
- package/dist/cjs/utils/index.js +6 -0
- package/dist/es2019/extensibility/Extension/Extension/index.js +0 -1
- package/dist/es2019/extensibility/Extension/Extension/styles.js +4 -9
- package/dist/es2019/extensibility/Extension/InlineExtension/index.js +0 -1
- package/dist/es2019/extensibility/Extension/InlineExtension/styles.js +1 -4
- package/dist/es2019/extensibility/Extension/Lozenge/ExtensionLabel.js +2 -5
- package/dist/es2019/extensibility/MultiBodiedExtension/styles.js +2 -2
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui-color/ColorPalette/Color/index.js +61 -1
- package/dist/es2019/ui-color/ColorPalette/Palettes/highlightColorPalette.js +36 -1
- package/dist/es2019/ui-color/ColorPalette/index.js +4 -2
- package/dist/es2019/utils/annotation/index.js +22 -0
- package/dist/es2019/utils/index.js +1 -1
- package/dist/esm/extensibility/Extension/Extension/index.js +0 -1
- package/dist/esm/extensibility/Extension/Extension/styles.js +4 -9
- package/dist/esm/extensibility/Extension/InlineExtension/index.js +0 -1
- package/dist/esm/extensibility/Extension/InlineExtension/styles.js +1 -4
- package/dist/esm/extensibility/Extension/Lozenge/ExtensionLabel.js +2 -5
- package/dist/esm/extensibility/MultiBodiedExtension/styles.js +2 -2
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui-color/ColorPalette/Color/index.js +57 -7
- package/dist/esm/ui-color/ColorPalette/Palettes/highlightColorPalette.js +37 -1
- package/dist/esm/ui-color/ColorPalette/index.js +4 -2
- package/dist/esm/utils/annotation/index.js +22 -0
- package/dist/esm/utils/index.js +1 -1
- package/dist/types/analytics/types/inline-comment-events.d.ts +1 -0
- package/dist/types/types/feature-flags.d.ts +8 -0
- package/dist/types/ui-color/ColorPalette/Color/index.d.ts +5 -2
- package/dist/types/ui-color/ColorPalette/Palettes/highlightColorPalette.d.ts +3 -0
- package/dist/types/ui-color/ColorPalette/Palettes/type.d.ts +2 -0
- package/dist/types/utils/annotation/index.d.ts +10 -0
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types-ts4.5/analytics/types/inline-comment-events.d.ts +1 -0
- package/dist/types-ts4.5/types/feature-flags.d.ts +8 -0
- package/dist/types-ts4.5/ui-color/ColorPalette/Color/index.d.ts +5 -2
- package/dist/types-ts4.5/ui-color/ColorPalette/Palettes/highlightColorPalette.d.ts +3 -0
- package/dist/types-ts4.5/ui-color/ColorPalette/Palettes/type.d.ts +2 -0
- package/dist/types-ts4.5/utils/annotation/index.d.ts +10 -0
- package/dist/types-ts4.5/utils/index.d.ts +1 -1
- package/package.json +5 -2
|
@@ -101,4 +101,26 @@ export function containsAnyAnnotations(slice, state) {
|
|
|
101
101
|
});
|
|
102
102
|
});
|
|
103
103
|
return hasAnnotation;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* This returns a list of node names that are inline nodes in the range.
|
|
108
|
+
*/
|
|
109
|
+
export function getRangeInlineNodeNames({
|
|
110
|
+
doc,
|
|
111
|
+
pos
|
|
112
|
+
}) {
|
|
113
|
+
if (!getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
|
|
114
|
+
return undefined;
|
|
115
|
+
}
|
|
116
|
+
let nodeNames = new Set();
|
|
117
|
+
doc.nodesBetween(pos.from, pos.to, node => {
|
|
118
|
+
if (node.isInline) {
|
|
119
|
+
nodeNames.add(node.type.name);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
// We sort the list alphabetically to make human consumption of the list easier (in tools like the analytics extension)
|
|
124
|
+
const sortedNames = [...nodeNames].sort();
|
|
125
|
+
return sortedNames;
|
|
104
126
|
}
|
|
@@ -2,7 +2,7 @@ import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
|
2
2
|
import { hasDocAsParent } from './document';
|
|
3
3
|
import { isEmptyParagraph } from './editor-core-utils';
|
|
4
4
|
export { shouldAutoLinkifyMatch } from './should-auto-linkify-tld';
|
|
5
|
-
export { canApplyAnnotationOnRange, containsAnyAnnotations, getAnnotationIdsFromRange, hasAnnotationMark } from './annotation';
|
|
5
|
+
export { canApplyAnnotationOnRange, containsAnyAnnotations, getAnnotationIdsFromRange, hasAnnotationMark, getRangeInlineNodeNames } from './annotation';
|
|
6
6
|
export { getExtensionLozengeData } from './macro';
|
|
7
7
|
export { default as browser } from './browser';
|
|
8
8
|
export { default as ErrorReporter } from './error-reporter';
|
|
@@ -53,7 +53,6 @@ function ExtensionWithPluginState(props) {
|
|
|
53
53
|
editorAppearance !== 'full-width';
|
|
54
54
|
var classNames = classnames('extension-container', 'block', shadowClassNames, _defineProperty({
|
|
55
55
|
'with-overlay': !hasBody && !showMacroInteractionDesignUpdates,
|
|
56
|
-
'with-border': showMacroInteractionDesignUpdates,
|
|
57
56
|
'with-bodied-border': showMacroInteractionDesignUpdates && hasBody,
|
|
58
57
|
'with-margin-styles': showMacroInteractionDesignUpdates && !isNodeNested,
|
|
59
58
|
'with-hover-border': showMacroInteractionDesignUpdates && isNodeHovered,
|
|
@@ -11,19 +11,15 @@ export var wrapperStyle = css(wrapperDefault, {
|
|
|
11
11
|
'.extension-overflow-wrapper:not(.with-body)': {
|
|
12
12
|
overflowX: 'auto'
|
|
13
13
|
},
|
|
14
|
-
'&.with-border': {
|
|
15
|
-
border: "1px solid transparent" // adding this so macro doesn't jump when hover border is shown
|
|
16
|
-
},
|
|
17
14
|
'&.with-bodied-border': {
|
|
18
|
-
|
|
15
|
+
boxShadow: "0 0 0 1px ".concat("var(--ds-border, ".concat(N30, ")"))
|
|
19
16
|
},
|
|
20
17
|
'&.with-hover-border': {
|
|
21
|
-
|
|
18
|
+
boxShadow: "0 0 0 1px ".concat("var(--ds-border-input, ".concat(N500, ")"))
|
|
22
19
|
},
|
|
23
20
|
'&.with-margin-styles': {
|
|
24
21
|
margin: "0 ".concat("var(--ds-space-negative-150, -12px)"),
|
|
25
|
-
|
|
26
|
-
padding: '0 10px' // need exact number here to match editor elements' width
|
|
22
|
+
padding: "0 ".concat("var(--ds-space-150, 12px)")
|
|
27
23
|
}
|
|
28
24
|
});
|
|
29
25
|
export var header = css({
|
|
@@ -57,7 +53,6 @@ export var contentWrapper = css({
|
|
|
57
53
|
});
|
|
58
54
|
export var overflowWrapperStyles = css({
|
|
59
55
|
'&.with-margin-styles': {
|
|
60
|
-
|
|
61
|
-
margin: "0 -10px" // need exact number here to match editor elements' width
|
|
56
|
+
margin: "0 ".concat("var(--ds-space-negative-150, -12px)")
|
|
62
57
|
}
|
|
63
58
|
});
|
|
@@ -24,7 +24,6 @@ var InlineExtension = function InlineExtension(props) {
|
|
|
24
24
|
'with-overlay': !showMacroInteractionDesignUpdates,
|
|
25
25
|
'with-children': hasChildren,
|
|
26
26
|
'with-danger-overlay': showMacroInteractionDesignUpdates,
|
|
27
|
-
'with-border': showMacroInteractionDesignUpdates,
|
|
28
27
|
'with-hover-border': showMacroInteractionDesignUpdates && isNodeHovered
|
|
29
28
|
});
|
|
30
29
|
var rendererContainerWidth = widthState ? widthState.width - akEditorGutterPaddingDynamic() * 2 : 0;
|
|
@@ -18,11 +18,8 @@ export var wrapperStyle = css(wrapperDefault, {
|
|
|
18
18
|
padding: 0,
|
|
19
19
|
background: "var(--ds-background-neutral-subtle, white)"
|
|
20
20
|
},
|
|
21
|
-
'&.with-border': {
|
|
22
|
-
border: "1px solid transparent" // adding this so macro doesn't jump when hover border is shown
|
|
23
|
-
},
|
|
24
21
|
'&.with-hover-border': {
|
|
25
|
-
|
|
22
|
+
boxShadow: "0 0 0 1px ".concat("var(--ds-border-input, ".concat(N500, ")"))
|
|
26
23
|
}
|
|
27
24
|
});
|
|
28
25
|
export var inlineWrapperStyles = css({
|
|
@@ -34,11 +34,8 @@ var labelStyles = css({
|
|
|
34
34
|
background: "var(--ds-surface, ".concat(N0, ")")
|
|
35
35
|
},
|
|
36
36
|
'&.bodied-border': {
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
// to account for bodied having borders now - adding this to help with less conditional styling
|
|
40
|
-
border: '1px solid transparent',
|
|
41
|
-
borderBottom: 'none'
|
|
37
|
+
boxShadow: "0 0 0 1px ".concat("var(--ds-border, ".concat(N30, ")"))
|
|
38
|
+
}
|
|
42
39
|
});
|
|
43
40
|
var textStyles = css({
|
|
44
41
|
fontSize: '14px',
|
|
@@ -22,10 +22,10 @@ export var mbeExtensionWrapperCSSStyles = css(wrapperDefault, {
|
|
|
22
22
|
paddingTop: "var(--ds-space-100, 8px)".concat(" !important")
|
|
23
23
|
},
|
|
24
24
|
'&.with-border': {
|
|
25
|
-
|
|
25
|
+
boxShadow: "0 0 0 1px ".concat("var(--ds-border, ".concat(N30, ")"))
|
|
26
26
|
},
|
|
27
27
|
'&.with-hover-border': {
|
|
28
|
-
|
|
28
|
+
boxShadow: "0 0 0 1px ".concat("var(--ds-border-input, ".concat(N500, ")"))
|
|
29
29
|
},
|
|
30
30
|
'&.with-padding-background-styles': {
|
|
31
31
|
padding: "var(--ds-space-100, 8px)",
|
|
@@ -7,7 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
7
7
|
import { isFedRamp } from './environment';
|
|
8
8
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
9
9
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
10
|
-
var packageVersion = "82.
|
|
10
|
+
var packageVersion = "82.3.0";
|
|
11
11
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
12
12
|
// Remove URL as it has UGC
|
|
13
13
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -15,7 +15,7 @@ import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@
|
|
|
15
15
|
import { N0, N50A, N60A, N900 } from '@atlaskit/theme/colors';
|
|
16
16
|
import Layer from '../Layer';
|
|
17
17
|
var packageName = "@atlaskit/editor-common";
|
|
18
|
-
var packageVersion = "82.
|
|
18
|
+
var packageVersion = "82.3.0";
|
|
19
19
|
var halfFocusRing = 1;
|
|
20
20
|
var dropOffset = '0, 8';
|
|
21
21
|
var DropList = /*#__PURE__*/function (_Component) {
|
|
@@ -11,15 +11,64 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
11
11
|
import React, { PureComponent } from 'react';
|
|
12
12
|
import { jsx } from '@emotion/react';
|
|
13
13
|
import EditorDoneIcon from '@atlaskit/icon/glyph/editor/done';
|
|
14
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
14
15
|
import { N0 } from '@atlaskit/theme/colors';
|
|
15
16
|
import Tooltip from '@atlaskit/tooltip';
|
|
16
17
|
import { buttonStyle, buttonWrapperStyle } from './styles';
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
function FunctionalComponentColor(props) {
|
|
19
|
+
var autoFocus = props.autoFocus,
|
|
20
|
+
tabIndex = props.tabIndex,
|
|
21
|
+
value = props.value,
|
|
22
|
+
label = props.label,
|
|
23
|
+
isSelected = props.isSelected,
|
|
24
|
+
borderColor = props.borderColor,
|
|
25
|
+
_props$checkMarkColor = props.checkMarkColor,
|
|
26
|
+
checkMarkColor = _props$checkMarkColor === void 0 ? N0 : _props$checkMarkColor,
|
|
27
|
+
hexToPaletteColor = props.hexToPaletteColor,
|
|
28
|
+
decorator = props.decorator;
|
|
29
|
+
var colorStyle = hexToPaletteColor ? hexToPaletteColor(value) : value;
|
|
30
|
+
var onMouseDown = function onMouseDown(e) {
|
|
31
|
+
e.preventDefault();
|
|
32
|
+
};
|
|
33
|
+
var onClick = function onClick(e) {
|
|
34
|
+
var onClick = props.onClick,
|
|
35
|
+
value = props.value,
|
|
36
|
+
label = props.label;
|
|
37
|
+
e.preventDefault();
|
|
38
|
+
onClick(value, label);
|
|
39
|
+
};
|
|
40
|
+
return jsx(Tooltip, {
|
|
41
|
+
content: label
|
|
42
|
+
}, jsx("span", {
|
|
43
|
+
css: buttonWrapperStyle
|
|
44
|
+
}, jsx("button", {
|
|
45
|
+
type: "button",
|
|
46
|
+
css: buttonStyle,
|
|
47
|
+
"aria-label": label,
|
|
48
|
+
role: "radio",
|
|
49
|
+
"aria-checked": isSelected,
|
|
50
|
+
onClick: onClick,
|
|
51
|
+
onMouseDown: onMouseDown,
|
|
52
|
+
tabIndex: tabIndex
|
|
53
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
54
|
+
,
|
|
55
|
+
className: "".concat(isSelected ? 'selected' : ''),
|
|
56
|
+
style: {
|
|
57
|
+
backgroundColor: colorStyle || 'transparent',
|
|
58
|
+
border: "1px solid ".concat(borderColor)
|
|
59
|
+
},
|
|
60
|
+
autoFocus: autoFocus
|
|
61
|
+
}, isSelected && jsx(EditorDoneIcon, {
|
|
62
|
+
primaryColor: checkMarkColor,
|
|
63
|
+
label: ""
|
|
64
|
+
}), decorator)));
|
|
65
|
+
}
|
|
66
|
+
var ClassComponentColor = /*#__PURE__*/function (_PureComponent) {
|
|
67
|
+
_inherits(ClassComponentColor, _PureComponent);
|
|
68
|
+
var _super = _createSuper(ClassComponentColor);
|
|
69
|
+
function ClassComponentColor() {
|
|
21
70
|
var _this;
|
|
22
|
-
_classCallCheck(this,
|
|
71
|
+
_classCallCheck(this, ClassComponentColor);
|
|
23
72
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
24
73
|
args[_key] = arguments[_key];
|
|
25
74
|
}
|
|
@@ -37,7 +86,7 @@ var Color = /*#__PURE__*/function (_PureComponent) {
|
|
|
37
86
|
});
|
|
38
87
|
return _this;
|
|
39
88
|
}
|
|
40
|
-
_createClass(
|
|
89
|
+
_createClass(ClassComponentColor, [{
|
|
41
90
|
key: "render",
|
|
42
91
|
value: function render() {
|
|
43
92
|
var _this$props2 = this.props,
|
|
@@ -78,6 +127,7 @@ var Color = /*#__PURE__*/function (_PureComponent) {
|
|
|
78
127
|
}))));
|
|
79
128
|
}
|
|
80
129
|
}]);
|
|
81
|
-
return
|
|
130
|
+
return ClassComponentColor;
|
|
82
131
|
}(PureComponent);
|
|
132
|
+
var Color = getBooleanFF('platform.editor.transparent-diagonal-decorator') ? FunctionalComponentColor : ClassComponentColor;
|
|
83
133
|
export default Color;
|
|
@@ -1,15 +1,51 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
1
4
|
import { backgroundColorPalette } from '@atlaskit/adf-schema';
|
|
5
|
+
import Icon from '@atlaskit/icon';
|
|
6
|
+
import { useThemeObserver } from '@atlaskit/tokens';
|
|
2
7
|
import { DEFAULT_BORDER_COLOR } from './common';
|
|
3
8
|
import getColorMessage from './getColorMessage';
|
|
4
9
|
import paletteMessages from './paletteMessages';
|
|
5
10
|
import { mapPaletteColor } from './textColorPalette';
|
|
6
11
|
export var REMOVE_HIGHLIGHT_COLOR = '#00000000';
|
|
12
|
+
var DiagonalLineGlyph = function DiagonalLineGlyph() {
|
|
13
|
+
return jsx("svg", {
|
|
14
|
+
width: "24",
|
|
15
|
+
height: "24",
|
|
16
|
+
viewBox: "0 0 24 24",
|
|
17
|
+
fill: "none",
|
|
18
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
19
|
+
}, jsx("rect", {
|
|
20
|
+
width: "24",
|
|
21
|
+
height: "24",
|
|
22
|
+
fill: "white",
|
|
23
|
+
fillOpacity: "0.01"
|
|
24
|
+
}), jsx("path", {
|
|
25
|
+
fillRule: "evenodd",
|
|
26
|
+
clipRule: "evenodd",
|
|
27
|
+
d: "M17.2038 7.70388C17.5955 8.09565 17.5941 8.73128 17.2005 9.12127L9.1213 17.1277C8.73027 17.5152 8.09958 17.5138 7.71031 17.1245C7.31854 16.7328 7.31997 16.0971 7.71351 15.7071L15.7928 7.70069C16.1838 7.31318 16.8145 7.31461 17.2038 7.70388Z",
|
|
28
|
+
fill: "currentColor",
|
|
29
|
+
fillOpacity: "0.5"
|
|
30
|
+
}));
|
|
31
|
+
};
|
|
32
|
+
export var EditorDiagonalLineIcon = function EditorDiagonalLineIcon() {
|
|
33
|
+
var _useThemeObserver = useThemeObserver(),
|
|
34
|
+
colorMode = _useThemeObserver.colorMode;
|
|
35
|
+
var primaryColor = colorMode === 'dark' ? "var(--ds-background-accent-gray-bolder, #626F86)" : "var(--ds-background-accent-gray-subtle, #8590A2)";
|
|
36
|
+
return jsx(Icon, {
|
|
37
|
+
glyph: DiagonalLineGlyph,
|
|
38
|
+
label: "",
|
|
39
|
+
primaryColor: primaryColor
|
|
40
|
+
});
|
|
41
|
+
};
|
|
7
42
|
export var highlightColorPalette = [{
|
|
8
43
|
value: REMOVE_HIGHLIGHT_COLOR,
|
|
9
44
|
label: 'No color',
|
|
10
45
|
// Mostly informative, only used for analytics
|
|
11
46
|
border: DEFAULT_BORDER_COLOR,
|
|
12
|
-
message: getColorMessage(paletteMessages, 'no-color')
|
|
47
|
+
message: getColorMessage(paletteMessages, 'no-color'),
|
|
48
|
+
decorator: jsx(EditorDiagonalLineIcon, null)
|
|
13
49
|
}];
|
|
14
50
|
backgroundColorPalette.forEach(function (label, color) {
|
|
15
51
|
highlightColorPalette.push(mapPaletteColor(label, color));
|
|
@@ -64,7 +64,8 @@ var ColorPalette = function ColorPalette(props) {
|
|
|
64
64
|
var value = _ref.value,
|
|
65
65
|
label = _ref.label,
|
|
66
66
|
border = _ref.border,
|
|
67
|
-
message = _ref.message
|
|
67
|
+
message = _ref.message,
|
|
68
|
+
decorator = _ref.decorator;
|
|
68
69
|
if (paletteColorTooltipMessages) {
|
|
69
70
|
if (tokenTheme === 'dark') {
|
|
70
71
|
message = getColorMessage(paletteColorTooltipMessages.dark, value.toUpperCase());
|
|
@@ -81,7 +82,8 @@ var ColorPalette = function ColorPalette(props) {
|
|
|
81
82
|
onClick: onClick,
|
|
82
83
|
isSelected: value === selectedColor,
|
|
83
84
|
checkMarkColor: getCheckMarkColor(value, useIconToken),
|
|
84
|
-
hexToPaletteColor: hexToPaletteColor
|
|
85
|
+
hexToPaletteColor: hexToPaletteColor,
|
|
86
|
+
decorator: decorator
|
|
85
87
|
});
|
|
86
88
|
}));
|
|
87
89
|
}));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
1
2
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
2
3
|
export var canApplyAnnotationOnRange = function canApplyAnnotationOnRange(rangeSelection, doc, schema) {
|
|
3
4
|
var from = rangeSelection.from,
|
|
@@ -89,4 +90,25 @@ export function containsAnyAnnotations(slice, state) {
|
|
|
89
90
|
});
|
|
90
91
|
});
|
|
91
92
|
return hasAnnotation;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* This returns a list of node names that are inline nodes in the range.
|
|
97
|
+
*/
|
|
98
|
+
export function getRangeInlineNodeNames(_ref) {
|
|
99
|
+
var doc = _ref.doc,
|
|
100
|
+
pos = _ref.pos;
|
|
101
|
+
if (!getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
|
|
102
|
+
return undefined;
|
|
103
|
+
}
|
|
104
|
+
var nodeNames = new Set();
|
|
105
|
+
doc.nodesBetween(pos.from, pos.to, function (node) {
|
|
106
|
+
if (node.isInline) {
|
|
107
|
+
nodeNames.add(node.type.name);
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
// We sort the list alphabetically to make human consumption of the list easier (in tools like the analytics extension)
|
|
112
|
+
var sortedNames = _toConsumableArray(nodeNames).sort();
|
|
113
|
+
return sortedNames;
|
|
92
114
|
}
|
package/dist/esm/utils/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
|
2
2
|
import { hasDocAsParent } from './document';
|
|
3
3
|
import { isEmptyParagraph } from './editor-core-utils';
|
|
4
4
|
export { shouldAutoLinkifyMatch } from './should-auto-linkify-tld';
|
|
5
|
-
export { canApplyAnnotationOnRange, containsAnyAnnotations, getAnnotationIdsFromRange, hasAnnotationMark } from './annotation';
|
|
5
|
+
export { canApplyAnnotationOnRange, containsAnyAnnotations, getAnnotationIdsFromRange, hasAnnotationMark, getRangeInlineNodeNames } from './annotation';
|
|
6
6
|
export { getExtensionLozengeData } from './macro';
|
|
7
7
|
export { default as browser } from './browser';
|
|
8
8
|
export { default as ErrorReporter } from './error-reporter';
|
|
@@ -6,6 +6,7 @@ export type AnnotationAEPAttributes = undefined | {} | AnnotationDraftAEPAttribu
|
|
|
6
6
|
export type AnnotationDraftAEPAttributes = {
|
|
7
7
|
inputMethod: INPUT_METHOD.TOOLBAR | INPUT_METHOD.SHORTCUT;
|
|
8
8
|
overlap: number;
|
|
9
|
+
inlineNodeNames?: string[];
|
|
9
10
|
};
|
|
10
11
|
export type AnnotationResolvedAEPAttributes = {
|
|
11
12
|
method: RESOLVE_METHOD;
|
|
@@ -285,6 +285,14 @@ export type FeatureFlags = {
|
|
|
285
285
|
* @default false
|
|
286
286
|
*/
|
|
287
287
|
commentsOnMediaAnalytics?: boolean;
|
|
288
|
+
/**
|
|
289
|
+
* @description
|
|
290
|
+
* Enables block elements drag and drop
|
|
291
|
+
*
|
|
292
|
+
* @see https://product-fabric.atlassian.net/browse/ED-22939
|
|
293
|
+
* @default false
|
|
294
|
+
*/
|
|
295
|
+
elementDragAndDrop?: boolean;
|
|
288
296
|
};
|
|
289
297
|
export type FeatureFlagKey = keyof FeatureFlags;
|
|
290
298
|
export type GetEditorFeatureFlags = () => FeatureFlags;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import React, { PureComponent } from 'react';
|
|
2
|
+
import React, { PureComponent, type ReactElement } from 'react';
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
4
|
export interface Props {
|
|
5
5
|
value: string;
|
|
@@ -11,10 +11,13 @@ export interface Props {
|
|
|
11
11
|
checkMarkColor?: string;
|
|
12
12
|
autoFocus?: boolean;
|
|
13
13
|
hexToPaletteColor?: (hexColor: string) => string | undefined;
|
|
14
|
+
decorator?: ReactElement;
|
|
14
15
|
}
|
|
15
|
-
declare
|
|
16
|
+
declare function FunctionalComponentColor(props: Props): jsx.JSX.Element;
|
|
17
|
+
declare class ClassComponentColor extends PureComponent<Props> {
|
|
16
18
|
render(): jsx.JSX.Element;
|
|
17
19
|
onMouseDown: (e: React.MouseEvent<{}>) => void;
|
|
18
20
|
onClick: (e: React.MouseEvent<{}>) => void;
|
|
19
21
|
}
|
|
22
|
+
declare const Color: typeof ClassComponentColor | typeof FunctionalComponentColor;
|
|
20
23
|
export default Color;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
1
3
|
import type { PaletteColor } from './type';
|
|
2
4
|
export declare const REMOVE_HIGHLIGHT_COLOR = "#00000000";
|
|
5
|
+
export declare const EditorDiagonalLineIcon: () => jsx.JSX.Element;
|
|
3
6
|
export declare const highlightColorPalette: Array<PaletteColor>;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
1
2
|
import { type MessageDescriptor } from 'react-intl-next';
|
|
2
3
|
export interface PaletteColor {
|
|
3
4
|
value: string;
|
|
4
5
|
label: string;
|
|
5
6
|
border: string;
|
|
6
7
|
message?: MessageDescriptor;
|
|
8
|
+
decorator?: ReactElement;
|
|
7
9
|
}
|
|
8
10
|
export type Palette = Array<PaletteColor>;
|
|
9
11
|
export type PaletteTooltipMessages = {
|
|
@@ -8,4 +8,14 @@ export declare const canApplyAnnotationOnRange: (rangeSelection: Range, doc: PMN
|
|
|
8
8
|
export declare const getAnnotationIdsFromRange: (rangeSelection: Range, doc: PMNode, schema: Schema) => string[];
|
|
9
9
|
export declare function hasAnnotationMark(node: PMNode, state: EditorState): boolean;
|
|
10
10
|
export declare function containsAnyAnnotations(slice: Slice, state: EditorState): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* This returns a list of node names that are inline nodes in the range.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getRangeInlineNodeNames({ doc, pos, }: {
|
|
15
|
+
doc: PMNode;
|
|
16
|
+
pos: {
|
|
17
|
+
from: number;
|
|
18
|
+
to: number;
|
|
19
|
+
};
|
|
20
|
+
}): string[] | undefined;
|
|
11
21
|
export {};
|
|
@@ -2,7 +2,7 @@ import type { Node as PMNode, ResolvedPos, Schema } from '@atlaskit/editor-prose
|
|
|
2
2
|
import type { EditorState, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import type { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
4
4
|
export { shouldAutoLinkifyMatch } from './should-auto-linkify-tld';
|
|
5
|
-
export { canApplyAnnotationOnRange, containsAnyAnnotations, getAnnotationIdsFromRange, hasAnnotationMark, } from './annotation';
|
|
5
|
+
export { canApplyAnnotationOnRange, containsAnyAnnotations, getAnnotationIdsFromRange, hasAnnotationMark, getRangeInlineNodeNames, } from './annotation';
|
|
6
6
|
export { getExtensionLozengeData } from './macro';
|
|
7
7
|
export type { Params } from './macro';
|
|
8
8
|
export { default as browser } from './browser';
|
|
@@ -6,6 +6,7 @@ export type AnnotationAEPAttributes = undefined | {} | AnnotationDraftAEPAttribu
|
|
|
6
6
|
export type AnnotationDraftAEPAttributes = {
|
|
7
7
|
inputMethod: INPUT_METHOD.TOOLBAR | INPUT_METHOD.SHORTCUT;
|
|
8
8
|
overlap: number;
|
|
9
|
+
inlineNodeNames?: string[];
|
|
9
10
|
};
|
|
10
11
|
export type AnnotationResolvedAEPAttributes = {
|
|
11
12
|
method: RESOLVE_METHOD;
|
|
@@ -285,6 +285,14 @@ export type FeatureFlags = {
|
|
|
285
285
|
* @default false
|
|
286
286
|
*/
|
|
287
287
|
commentsOnMediaAnalytics?: boolean;
|
|
288
|
+
/**
|
|
289
|
+
* @description
|
|
290
|
+
* Enables block elements drag and drop
|
|
291
|
+
*
|
|
292
|
+
* @see https://product-fabric.atlassian.net/browse/ED-22939
|
|
293
|
+
* @default false
|
|
294
|
+
*/
|
|
295
|
+
elementDragAndDrop?: boolean;
|
|
288
296
|
};
|
|
289
297
|
export type FeatureFlagKey = keyof FeatureFlags;
|
|
290
298
|
export type GetEditorFeatureFlags = () => FeatureFlags;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import React, { PureComponent } from 'react';
|
|
2
|
+
import React, { PureComponent, type ReactElement } from 'react';
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
4
|
export interface Props {
|
|
5
5
|
value: string;
|
|
@@ -11,10 +11,13 @@ export interface Props {
|
|
|
11
11
|
checkMarkColor?: string;
|
|
12
12
|
autoFocus?: boolean;
|
|
13
13
|
hexToPaletteColor?: (hexColor: string) => string | undefined;
|
|
14
|
+
decorator?: ReactElement;
|
|
14
15
|
}
|
|
15
|
-
declare
|
|
16
|
+
declare function FunctionalComponentColor(props: Props): jsx.JSX.Element;
|
|
17
|
+
declare class ClassComponentColor extends PureComponent<Props> {
|
|
16
18
|
render(): jsx.JSX.Element;
|
|
17
19
|
onMouseDown: (e: React.MouseEvent<{}>) => void;
|
|
18
20
|
onClick: (e: React.MouseEvent<{}>) => void;
|
|
19
21
|
}
|
|
22
|
+
declare const Color: typeof ClassComponentColor | typeof FunctionalComponentColor;
|
|
20
23
|
export default Color;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
1
3
|
import type { PaletteColor } from './type';
|
|
2
4
|
export declare const REMOVE_HIGHLIGHT_COLOR = "#00000000";
|
|
5
|
+
export declare const EditorDiagonalLineIcon: () => jsx.JSX.Element;
|
|
3
6
|
export declare const highlightColorPalette: Array<PaletteColor>;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
1
2
|
import { type MessageDescriptor } from 'react-intl-next';
|
|
2
3
|
export interface PaletteColor {
|
|
3
4
|
value: string;
|
|
4
5
|
label: string;
|
|
5
6
|
border: string;
|
|
6
7
|
message?: MessageDescriptor;
|
|
8
|
+
decorator?: ReactElement;
|
|
7
9
|
}
|
|
8
10
|
export type Palette = Array<PaletteColor>;
|
|
9
11
|
export type PaletteTooltipMessages = {
|
|
@@ -8,4 +8,14 @@ export declare const canApplyAnnotationOnRange: (rangeSelection: Range, doc: PMN
|
|
|
8
8
|
export declare const getAnnotationIdsFromRange: (rangeSelection: Range, doc: PMNode, schema: Schema) => string[];
|
|
9
9
|
export declare function hasAnnotationMark(node: PMNode, state: EditorState): boolean;
|
|
10
10
|
export declare function containsAnyAnnotations(slice: Slice, state: EditorState): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* This returns a list of node names that are inline nodes in the range.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getRangeInlineNodeNames({ doc, pos, }: {
|
|
15
|
+
doc: PMNode;
|
|
16
|
+
pos: {
|
|
17
|
+
from: number;
|
|
18
|
+
to: number;
|
|
19
|
+
};
|
|
20
|
+
}): string[] | undefined;
|
|
11
21
|
export {};
|
|
@@ -2,7 +2,7 @@ import type { Node as PMNode, ResolvedPos, Schema } from '@atlaskit/editor-prose
|
|
|
2
2
|
import type { EditorState, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import type { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
4
4
|
export { shouldAutoLinkifyMatch } from './should-auto-linkify-tld';
|
|
5
|
-
export { canApplyAnnotationOnRange, containsAnyAnnotations, getAnnotationIdsFromRange, hasAnnotationMark, } from './annotation';
|
|
5
|
+
export { canApplyAnnotationOnRange, containsAnyAnnotations, getAnnotationIdsFromRange, hasAnnotationMark, getRangeInlineNodeNames, } from './annotation';
|
|
6
6
|
export { getExtensionLozengeData } from './macro';
|
|
7
7
|
export type { Params } from './macro';
|
|
8
8
|
export { default as browser } from './browser';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "82.
|
|
3
|
+
"version": "82.3.0",
|
|
4
4
|
"description": "A package that contains common classes and components for editor and renderer",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -136,7 +136,7 @@
|
|
|
136
136
|
"@atlaskit/task-decision": "^17.10.0",
|
|
137
137
|
"@atlaskit/textfield": "^6.3.0",
|
|
138
138
|
"@atlaskit/theme": "^12.9.0",
|
|
139
|
-
"@atlaskit/tokens": "^1.
|
|
139
|
+
"@atlaskit/tokens": "^1.50.0",
|
|
140
140
|
"@atlaskit/tooltip": "^18.4.0",
|
|
141
141
|
"@atlaskit/ufo": "^0.2.0",
|
|
142
142
|
"@atlaskit/width-detector": "^4.2.0",
|
|
@@ -256,6 +256,9 @@
|
|
|
256
256
|
},
|
|
257
257
|
"platform.editor.a11y-element-browser": {
|
|
258
258
|
"type": "boolean"
|
|
259
|
+
},
|
|
260
|
+
"platform.editor.transparent-diagonal-decorator": {
|
|
261
|
+
"type": "boolean"
|
|
259
262
|
}
|
|
260
263
|
}
|
|
261
264
|
}
|