@atlaskit/editor-common 82.5.0 → 82.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/dist/cjs/keymaps/keymap.js +46 -13
- package/dist/cjs/link/ConfigureLinkOverlay/OverlayButton.js +87 -0
- package/dist/cjs/link/index.js +7 -0
- package/dist/cjs/link/types.js +1 -0
- 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 +2 -2
- package/dist/cjs/ui-color/ColorPalette/Palettes/highlightColorPalette.js +9 -3
- package/dist/cjs/ui-color/ColorPalette/Palettes/textColorPalette.js +10 -1
- package/dist/cjs/ui-color/index.js +12 -0
- package/dist/es2019/keymaps/keymap.js +46 -13
- package/dist/es2019/link/ConfigureLinkOverlay/OverlayButton.js +80 -0
- package/dist/es2019/link/index.js +2 -1
- package/dist/es2019/link/types.js +1 -0
- 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 +2 -2
- package/dist/es2019/ui-color/ColorPalette/Palettes/highlightColorPalette.js +5 -1
- package/dist/es2019/ui-color/ColorPalette/Palettes/textColorPalette.js +6 -1
- package/dist/es2019/ui-color/index.js +2 -2
- package/dist/esm/keymaps/keymap.js +46 -13
- package/dist/esm/link/ConfigureLinkOverlay/OverlayButton.js +79 -0
- package/dist/esm/link/index.js +2 -1
- package/dist/esm/link/types.js +1 -0
- 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 +2 -2
- package/dist/esm/ui-color/ColorPalette/Palettes/highlightColorPalette.js +8 -0
- package/dist/esm/ui-color/ColorPalette/Palettes/textColorPalette.js +9 -0
- package/dist/esm/ui-color/index.js +2 -2
- package/dist/types/link/ConfigureLinkOverlay/OverlayButton.d.ts +8 -0
- package/dist/types/link/index.d.ts +2 -0
- package/dist/types/link/types.d.ts +5 -1
- package/dist/types/types/annotation/index.d.ts +2 -0
- package/dist/types/types/feature-flags.d.ts +8 -0
- package/dist/types/ui-color/ColorPalette/Palettes/highlightColorPalette.d.ts +1 -0
- package/dist/types/ui-color/ColorPalette/Palettes/textColorPalette.d.ts +2 -0
- package/dist/types/ui-color/index.d.ts +2 -2
- package/dist/types-ts4.5/link/ConfigureLinkOverlay/OverlayButton.d.ts +8 -0
- package/dist/types-ts4.5/link/index.d.ts +2 -0
- package/dist/types-ts4.5/link/types.d.ts +5 -1
- package/dist/types-ts4.5/types/annotation/index.d.ts +2 -0
- package/dist/types-ts4.5/types/feature-flags.d.ts +8 -0
- package/dist/types-ts4.5/ui-color/ColorPalette/Palettes/highlightColorPalette.d.ts +1 -0
- package/dist/types-ts4.5/ui-color/ColorPalette/Palettes/textColorPalette.d.ts +2 -0
- package/dist/types-ts4.5/ui-color/index.d.ts +2 -2
- package/package.json +269 -263
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 82.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#110802](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/110802)
|
|
8
|
+
[`4ec8e069a729b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4ec8e069a729b) -
|
|
9
|
+
Added a new overlay button component, which selects the passed in node at node position on click.
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 82.6.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- [#110884](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/110884)
|
|
20
|
+
[`674f78166705c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/674f78166705c) -
|
|
21
|
+
[ux] [ED-23516] Change border color for highlight and text-color palettes to use tokens.
|
|
22
|
+
Changedefault palette color when undefined
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- [#110390](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/110390)
|
|
27
|
+
[`bead123202369`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/bead123202369) -
|
|
28
|
+
[ux] [ED-23642] Reordering the typeahead so that date, status, code block & info panel are above
|
|
29
|
+
the fold (in the top 5 results)
|
|
30
|
+
- [#110966](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/110966)
|
|
31
|
+
[`31348c335b4b3`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/31348c335b4b3) -
|
|
32
|
+
ED-23690 - add inlineNodeTypes property to AnnotationComponentProps
|
|
33
|
+
- [#109764](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/109764)
|
|
34
|
+
[`0c87bddb30871`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0c87bddb30871) -
|
|
35
|
+
ED-23659 - fix keymap plugin `Dead` keys processing.
|
|
36
|
+
- Updated dependencies
|
|
37
|
+
|
|
3
38
|
## 82.5.0
|
|
4
39
|
|
|
5
40
|
### Minor Changes
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.keymap = keymap;
|
|
7
7
|
var _w3cKeyname = require("w3c-keyname");
|
|
8
8
|
var _keymap = require("@atlaskit/editor-prosemirror/keymap");
|
|
9
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
9
10
|
var _safePlugin = require("../safe-plugin");
|
|
10
11
|
/**
|
|
11
12
|
* A workaround for mostly Cyrillic but should have a positive affect
|
|
@@ -18,20 +19,52 @@ function keymap(bindings) {
|
|
|
18
19
|
return new _safePlugin.SafePlugin({
|
|
19
20
|
props: {
|
|
20
21
|
handleKeyDown: function handleKeyDown(view, event) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
22
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.text-alignment-keyboard-shortcuts')) {
|
|
23
|
+
var name = (0, _w3cKeyname.keyName)(event);
|
|
24
|
+
var keyboardEvent = event;
|
|
25
|
+
|
|
26
|
+
// We will try to bypass the keycode only if any of mod keys are pressed,
|
|
27
|
+
// to allow users to use non-latin and Dead characters.
|
|
28
|
+
var isModKeyPressed = event.ctrlKey || event.metaKey;
|
|
29
|
+
|
|
30
|
+
// Check the unicode of the character to assert that it's not an ASCII character.
|
|
31
|
+
// These are characters outside latin's range.
|
|
32
|
+
var isNonLatinKey = name.length === 1 && /[^\u0000-\u007f]/.test(name);
|
|
33
|
+
|
|
34
|
+
// The `Dead` key is a key that combines with a following key to produce a combined character.
|
|
35
|
+
// It will have `even.key === 'Dead'` in some browsers but the `keyCode` will be the same as in a qwerty-keyboard.
|
|
36
|
+
// See https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key and https://en.wikipedia.org/wiki/Dead_key
|
|
37
|
+
var isDeadKey = name === 'Dead';
|
|
38
|
+
if (isModKeyPressed && (isNonLatinKey || isDeadKey)) {
|
|
39
|
+
keyboardEvent = new KeyboardEvent(event.type, {
|
|
40
|
+
// FIXME: The event.keyCode is deprecated (see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode),
|
|
41
|
+
// and could be removed in any time, but the w3c-keyname library doesn't provide a way to get
|
|
42
|
+
// a key by event.code.
|
|
43
|
+
key: _w3cKeyname.base[event.keyCode],
|
|
44
|
+
code: event.code,
|
|
45
|
+
ctrlKey: event.ctrlKey,
|
|
46
|
+
altKey: event.altKey,
|
|
47
|
+
metaKey: event.metaKey,
|
|
48
|
+
shiftKey: event.shiftKey
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return (0, _keymap.keydownHandler)(bindings)(view, keyboardEvent);
|
|
52
|
+
} else {
|
|
53
|
+
var _name = (0, _w3cKeyname.keyName)(event);
|
|
54
|
+
var _keyboardEvent = event;
|
|
55
|
+
if (event.ctrlKey && _name.length === 1 &&
|
|
56
|
+
// Check the unicode of the character to
|
|
57
|
+
// assert that its not an ASCII character.
|
|
58
|
+
// These are characters outside Latin's range.
|
|
59
|
+
/[^\u0000-\u007f]/.test(_name)) {
|
|
60
|
+
_keyboardEvent = new KeyboardEvent('keydown', {
|
|
61
|
+
key: _w3cKeyname.base[event.keyCode],
|
|
62
|
+
code: event.code,
|
|
63
|
+
ctrlKey: true
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
return (0, _keymap.keydownHandler)(bindings)(view, _keyboardEvent);
|
|
33
67
|
}
|
|
34
|
-
return (0, _keymap.keydownHandler)(bindings)(view, keyboardEvent);
|
|
35
68
|
}
|
|
36
69
|
}
|
|
37
70
|
});
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.OverlayButton = void 0;
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _react2 = require("@emotion/react");
|
|
10
|
+
var _reactIntlNext = require("react-intl-next");
|
|
11
|
+
var _button = _interopRequireDefault(require("@atlaskit/button"));
|
|
12
|
+
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
13
|
+
var _preferences = _interopRequireDefault(require("@atlaskit/icon/glyph/preferences"));
|
|
14
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
15
|
+
var _constants = require("@atlaskit/theme/constants");
|
|
16
|
+
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
17
|
+
var _messages = require("../../messages");
|
|
18
|
+
/** @jsx jsx */
|
|
19
|
+
|
|
20
|
+
var buttonStyles = (0, _react2.css)({
|
|
21
|
+
background: "var(--ds-background-neutral, ".concat(_colors.N30A, ")"),
|
|
22
|
+
color: "var(--ds-icon, ".concat(_colors.N700, ")"),
|
|
23
|
+
'&:hover': {
|
|
24
|
+
background: "var(--ds-background-neutral-hovered, ".concat(_colors.N40A, ")")
|
|
25
|
+
},
|
|
26
|
+
'&:active': {
|
|
27
|
+
background: "var(--ds-background-neutral-pressed, ".concat(_colors.N60A, ")")
|
|
28
|
+
},
|
|
29
|
+
width: '1.375rem',
|
|
30
|
+
height: '1.25rem'
|
|
31
|
+
});
|
|
32
|
+
var buttonWrapperStyles = (0, _react2.css)({
|
|
33
|
+
position: 'absolute',
|
|
34
|
+
zIndex: _constants.layers.card(),
|
|
35
|
+
display: 'inline-flex',
|
|
36
|
+
top: '50%',
|
|
37
|
+
transform: 'translateY(-50%)',
|
|
38
|
+
background: "var(--ds-surface-raised, ".concat(_colors.N0, ")")
|
|
39
|
+
});
|
|
40
|
+
var OverlayButton = exports.OverlayButton = function OverlayButton(_ref) {
|
|
41
|
+
var _docNode$nodeSize;
|
|
42
|
+
var editorView = _ref.editorView,
|
|
43
|
+
_ref$testId = _ref.testId,
|
|
44
|
+
testId = _ref$testId === void 0 ? 'link-configure-overlay-button' : _ref$testId,
|
|
45
|
+
_ref$targetElementPos = _ref.targetElementPos,
|
|
46
|
+
targetElementPos = _ref$targetElementPos === void 0 ? 0 : _ref$targetElementPos;
|
|
47
|
+
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
48
|
+
formatMessage = _useIntl.formatMessage;
|
|
49
|
+
var docNode = editorView.state.doc.nodeAt(targetElementPos);
|
|
50
|
+
var nodeEnd = targetElementPos + ((_docNode$nodeSize = docNode === null || docNode === void 0 ? void 0 : docNode.nodeSize) !== null && _docNode$nodeSize !== void 0 ? _docNode$nodeSize : 0);
|
|
51
|
+
var isText = docNode === null || docNode === void 0 ? void 0 : docNode.isText;
|
|
52
|
+
var handleClick = (0, _react.useCallback)(function () {
|
|
53
|
+
var tr = editorView.state.tr;
|
|
54
|
+
if (isText) {
|
|
55
|
+
tr.setSelection(_state.TextSelection.create(tr.doc, targetElementPos, Math.min(nodeEnd, tr.doc.nodeSize)));
|
|
56
|
+
} else {
|
|
57
|
+
tr.setSelection(_state.NodeSelection.create(tr.doc, targetElementPos));
|
|
58
|
+
}
|
|
59
|
+
editorView.dispatch(tr);
|
|
60
|
+
}, [isText, editorView, nodeEnd, targetElementPos]);
|
|
61
|
+
var _editorView$state$sel = editorView.state.selection,
|
|
62
|
+
from = _editorView$state$sel.from,
|
|
63
|
+
to = _editorView$state$sel.to;
|
|
64
|
+
var isSelected = from === targetElementPos && to === nodeEnd;
|
|
65
|
+
if (!targetElementPos || isSelected) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
var configureLinkLabel = formatMessage(_messages.cardMessages.inlineConfigureLink);
|
|
69
|
+
return (0, _react2.jsx)("span", {
|
|
70
|
+
css: buttonWrapperStyles
|
|
71
|
+
}, (0, _react2.jsx)(_tooltip.default, {
|
|
72
|
+
content: configureLinkLabel,
|
|
73
|
+
hideTooltipOnClick: true,
|
|
74
|
+
testId: "".concat(testId, "-tooltip")
|
|
75
|
+
}, (0, _react2.jsx)(_button.default, {
|
|
76
|
+
testId: testId
|
|
77
|
+
// eslint-disable-next-line @atlaskit/design-system/no-unsafe-style-overrides
|
|
78
|
+
,
|
|
79
|
+
css: buttonStyles,
|
|
80
|
+
onClick: handleClick,
|
|
81
|
+
iconBefore: (0, _react2.jsx)(_preferences.default, {
|
|
82
|
+
label: configureLinkLabel,
|
|
83
|
+
size: "small",
|
|
84
|
+
testId: "".concat(testId, "-configure-icon")
|
|
85
|
+
})
|
|
86
|
+
})));
|
|
87
|
+
};
|
package/dist/cjs/link/index.js
CHANGED
|
@@ -53,6 +53,12 @@ Object.defineProperty(exports, "LinkSearchListItem", {
|
|
|
53
53
|
return _LinkSearchListItem.default;
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
|
+
Object.defineProperty(exports, "OverlayButton", {
|
|
57
|
+
enumerable: true,
|
|
58
|
+
get: function get() {
|
|
59
|
+
return _OverlayButton.OverlayButton;
|
|
60
|
+
}
|
|
61
|
+
});
|
|
56
62
|
Object.defineProperty(exports, "RECENT_SEARCH_LIST_SIZE", {
|
|
57
63
|
enumerable: true,
|
|
58
64
|
get: function get() {
|
|
@@ -137,5 +143,6 @@ var _HyperlinkAddToolbar2 = _interopRequireWildcard(require("./LinkPicker/Hyperl
|
|
|
137
143
|
var _utils = require("./LinkPicker/HyperlinkAddToolbar/utils");
|
|
138
144
|
var _utils2 = require("./utils");
|
|
139
145
|
var _constants = require("./constants");
|
|
146
|
+
var _OverlayButton = require("./ConfigureLinkOverlay/OverlayButton");
|
|
140
147
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
141
148
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
package/dist/cjs/link/types.js
CHANGED
|
@@ -10,6 +10,7 @@ var LinkAction = exports.LinkAction = /*#__PURE__*/function (LinkAction) {
|
|
|
10
10
|
LinkAction["SELECTION_CHANGE"] = "SELECTION_CHANGE";
|
|
11
11
|
LinkAction["INSERT_LINK_TOOLBAR"] = "INSERT";
|
|
12
12
|
LinkAction["EDIT_INSERTED_TOOLBAR"] = "EDIT_INSERTED_TOOLBAR";
|
|
13
|
+
LinkAction["SET_CONFIGURE_BUTTON_TARGET_POS"] = "SET_CONFIGURE_BUTTON_TARGET_POS";
|
|
13
14
|
return LinkAction;
|
|
14
15
|
}({});
|
|
15
16
|
var InsertStatus = exports.InsertStatus = /*#__PURE__*/function (InsertStatus) {
|
|
@@ -17,7 +17,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
17
17
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
18
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
19
19
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
20
|
-
var packageVersion = "82.
|
|
20
|
+
var packageVersion = "82.7.0";
|
|
21
21
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
22
22
|
// Remove URL as it has UGC
|
|
23
23
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -20,7 +20,7 @@ var _Layer = _interopRequireDefault(require("../Layer"));
|
|
|
20
20
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
21
21
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /** @jsx jsx */
|
|
22
22
|
var packageName = "@atlaskit/editor-common";
|
|
23
|
-
var packageVersion = "82.
|
|
23
|
+
var packageVersion = "82.7.0";
|
|
24
24
|
var halfFocusRing = 1;
|
|
25
25
|
var dropOffset = '0, 8';
|
|
26
26
|
var DropList = /*#__PURE__*/function (_Component) {
|
|
@@ -63,7 +63,7 @@ function FunctionalComponentColor(props) {
|
|
|
63
63
|
,
|
|
64
64
|
className: "".concat(isSelected ? 'selected' : ''),
|
|
65
65
|
style: {
|
|
66
|
-
backgroundColor: colorStyle || 'transparent',
|
|
66
|
+
backgroundColor: colorStyle || ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.dynamic-palette-borders') ? "var(--ds-background-input, #FFFFFF)" : 'transparent'),
|
|
67
67
|
border: "1px solid ".concat(borderColor)
|
|
68
68
|
},
|
|
69
69
|
autoFocus: autoFocus
|
|
@@ -128,7 +128,7 @@ var ClassComponentColor = /*#__PURE__*/function (_PureComponent) {
|
|
|
128
128
|
,
|
|
129
129
|
className: "".concat(isSelected ? 'selected' : ''),
|
|
130
130
|
style: {
|
|
131
|
-
backgroundColor: colorStyle || 'transparent',
|
|
131
|
+
backgroundColor: colorStyle || ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.dynamic-palette-borders') ? "var(--ds-background-input, #FFFFFF)" : 'transparent'),
|
|
132
132
|
border: "1px solid ".concat(borderColor)
|
|
133
133
|
},
|
|
134
134
|
autoFocus: autoFocus
|
|
@@ -4,7 +4,8 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.highlightColorPalette = exports.REMOVE_HIGHLIGHT_COLOR = exports.EditorDiagonalLineIcon = void 0;
|
|
7
|
+
exports.highlightColorPaletteWithTokenBorders = exports.highlightColorPalette = exports.REMOVE_HIGHLIGHT_COLOR = exports.EditorDiagonalLineIcon = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
8
9
|
var _react = require("@emotion/react");
|
|
9
10
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
10
11
|
var _icon = _interopRequireDefault(require("@atlaskit/icon"));
|
|
@@ -13,8 +14,8 @@ var _common = require("./common");
|
|
|
13
14
|
var _getColorMessage = _interopRequireDefault(require("./getColorMessage"));
|
|
14
15
|
var _paletteMessages = _interopRequireDefault(require("./paletteMessages"));
|
|
15
16
|
var _textColorPalette = require("./textColorPalette");
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
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; }
|
|
18
|
+
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; } /** @jsx jsx */
|
|
18
19
|
var REMOVE_HIGHLIGHT_COLOR = exports.REMOVE_HIGHLIGHT_COLOR = '#00000000';
|
|
19
20
|
var DiagonalLineGlyph = function DiagonalLineGlyph() {
|
|
20
21
|
return (0, _react.jsx)("svg", {
|
|
@@ -56,4 +57,9 @@ var highlightColorPalette = exports.highlightColorPalette = [{
|
|
|
56
57
|
}];
|
|
57
58
|
_adfSchema.backgroundColorPalette.forEach(function (label, color) {
|
|
58
59
|
highlightColorPalette.push((0, _textColorPalette.mapPaletteColor)(label, color));
|
|
60
|
+
});
|
|
61
|
+
var highlightColorPaletteWithTokenBorders = exports.highlightColorPaletteWithTokenBorders = highlightColorPalette.map(function (paletteColor) {
|
|
62
|
+
return _objectSpread(_objectSpread({}, paletteColor), {}, {
|
|
63
|
+
border: "var(--ds-border, #091E4224)"
|
|
64
|
+
});
|
|
59
65
|
});
|
|
@@ -4,11 +4,14 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.textColorPalette = exports.mapPaletteColor = void 0;
|
|
7
|
+
exports.textColorPaletteWithTokenBorders = exports.textColorPaletteTokenBorders = exports.textColorPalette = exports.mapPaletteColor = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
8
9
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
9
10
|
var _common = require("./common");
|
|
10
11
|
var _getColorMessage = _interopRequireDefault(require("./getColorMessage"));
|
|
11
12
|
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; }
|
|
12
15
|
var mapPaletteColor = exports.mapPaletteColor = function mapPaletteColor(label, color) {
|
|
13
16
|
var key = label.toLowerCase().replace(' ', '-');
|
|
14
17
|
var message = (0, _getColorMessage.default)(_paletteMessages.default, key);
|
|
@@ -22,6 +25,12 @@ var mapPaletteColor = exports.mapPaletteColor = function mapPaletteColor(label,
|
|
|
22
25
|
|
|
23
26
|
// row 1
|
|
24
27
|
var textColorPalette = exports.textColorPalette = [];
|
|
28
|
+
var textColorPaletteTokenBorders = exports.textColorPaletteTokenBorders = [];
|
|
25
29
|
_adfSchema.colorPalette.forEach(function (label, color) {
|
|
26
30
|
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
|
+
});
|
|
27
36
|
});
|
|
@@ -100,6 +100,12 @@ 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
|
+
});
|
|
103
109
|
Object.defineProperty(exports, "lightModeStatusColorPalette", {
|
|
104
110
|
enumerable: true,
|
|
105
111
|
get: function get() {
|
|
@@ -124,6 +130,12 @@ Object.defineProperty(exports, "textColorPalette", {
|
|
|
124
130
|
return _textColorPalette.textColorPalette;
|
|
125
131
|
}
|
|
126
132
|
});
|
|
133
|
+
Object.defineProperty(exports, "textColorPaletteWithTokenBorders", {
|
|
134
|
+
enumerable: true,
|
|
135
|
+
get: function get() {
|
|
136
|
+
return _textColorPalette.textColorPaletteWithTokenBorders;
|
|
137
|
+
}
|
|
138
|
+
});
|
|
127
139
|
Object.defineProperty(exports, "textPaletteTooltipMessages", {
|
|
128
140
|
enumerable: true,
|
|
129
141
|
get: function get() {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { base, keyName } from 'w3c-keyname';
|
|
2
2
|
import { keydownHandler } from '@atlaskit/editor-prosemirror/keymap';
|
|
3
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
import { SafePlugin } from '../safe-plugin';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -13,20 +14,52 @@ export function keymap(bindings) {
|
|
|
13
14
|
return new SafePlugin({
|
|
14
15
|
props: {
|
|
15
16
|
handleKeyDown(view, event) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
if (getBooleanFF('platform.editor.text-alignment-keyboard-shortcuts')) {
|
|
18
|
+
const name = keyName(event);
|
|
19
|
+
let keyboardEvent = event;
|
|
20
|
+
|
|
21
|
+
// We will try to bypass the keycode only if any of mod keys are pressed,
|
|
22
|
+
// to allow users to use non-latin and Dead characters.
|
|
23
|
+
const isModKeyPressed = event.ctrlKey || event.metaKey;
|
|
24
|
+
|
|
25
|
+
// Check the unicode of the character to assert that it's not an ASCII character.
|
|
26
|
+
// These are characters outside latin's range.
|
|
27
|
+
const isNonLatinKey = name.length === 1 && /[^\u0000-\u007f]/.test(name);
|
|
28
|
+
|
|
29
|
+
// The `Dead` key is a key that combines with a following key to produce a combined character.
|
|
30
|
+
// It will have `even.key === 'Dead'` in some browsers but the `keyCode` will be the same as in a qwerty-keyboard.
|
|
31
|
+
// See https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key and https://en.wikipedia.org/wiki/Dead_key
|
|
32
|
+
const isDeadKey = name === 'Dead';
|
|
33
|
+
if (isModKeyPressed && (isNonLatinKey || isDeadKey)) {
|
|
34
|
+
keyboardEvent = new KeyboardEvent(event.type, {
|
|
35
|
+
// FIXME: The event.keyCode is deprecated (see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode),
|
|
36
|
+
// and could be removed in any time, but the w3c-keyname library doesn't provide a way to get
|
|
37
|
+
// a key by event.code.
|
|
38
|
+
key: base[event.keyCode],
|
|
39
|
+
code: event.code,
|
|
40
|
+
ctrlKey: event.ctrlKey,
|
|
41
|
+
altKey: event.altKey,
|
|
42
|
+
metaKey: event.metaKey,
|
|
43
|
+
shiftKey: event.shiftKey
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return keydownHandler(bindings)(view, keyboardEvent);
|
|
47
|
+
} else {
|
|
48
|
+
const name = keyName(event);
|
|
49
|
+
let keyboardEvent = event;
|
|
50
|
+
if (event.ctrlKey && name.length === 1 &&
|
|
51
|
+
// Check the unicode of the character to
|
|
52
|
+
// assert that its not an ASCII character.
|
|
53
|
+
// These are characters outside Latin's range.
|
|
54
|
+
/[^\u0000-\u007f]/.test(name)) {
|
|
55
|
+
keyboardEvent = new KeyboardEvent('keydown', {
|
|
56
|
+
key: base[event.keyCode],
|
|
57
|
+
code: event.code,
|
|
58
|
+
ctrlKey: true
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
return keydownHandler(bindings)(view, keyboardEvent);
|
|
28
62
|
}
|
|
29
|
-
return keydownHandler(bindings)(view, keyboardEvent);
|
|
30
63
|
}
|
|
31
64
|
}
|
|
32
65
|
});
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { useCallback } from 'react';
|
|
3
|
+
import { css, jsx } from '@emotion/react';
|
|
4
|
+
import { useIntl } from 'react-intl-next';
|
|
5
|
+
import Button from '@atlaskit/button';
|
|
6
|
+
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
7
|
+
import PreferencesIcon from '@atlaskit/icon/glyph/preferences';
|
|
8
|
+
import { N0, N30A, N40A, N60A, N700 } from '@atlaskit/theme/colors';
|
|
9
|
+
import { layers } from '@atlaskit/theme/constants';
|
|
10
|
+
import Tooltip from '@atlaskit/tooltip';
|
|
11
|
+
import { cardMessages } from '../../messages';
|
|
12
|
+
const buttonStyles = css({
|
|
13
|
+
background: `var(--ds-background-neutral, ${N30A})`,
|
|
14
|
+
color: `var(--ds-icon, ${N700})`,
|
|
15
|
+
'&:hover': {
|
|
16
|
+
background: `var(--ds-background-neutral-hovered, ${N40A})`
|
|
17
|
+
},
|
|
18
|
+
'&:active': {
|
|
19
|
+
background: `var(--ds-background-neutral-pressed, ${N60A})`
|
|
20
|
+
},
|
|
21
|
+
width: '1.375rem',
|
|
22
|
+
height: '1.25rem'
|
|
23
|
+
});
|
|
24
|
+
const buttonWrapperStyles = css({
|
|
25
|
+
position: 'absolute',
|
|
26
|
+
zIndex: layers.card(),
|
|
27
|
+
display: 'inline-flex',
|
|
28
|
+
top: '50%',
|
|
29
|
+
transform: 'translateY(-50%)',
|
|
30
|
+
background: `var(--ds-surface-raised, ${N0})`
|
|
31
|
+
});
|
|
32
|
+
export const OverlayButton = ({
|
|
33
|
+
editorView,
|
|
34
|
+
testId = 'link-configure-overlay-button',
|
|
35
|
+
targetElementPos = 0
|
|
36
|
+
}) => {
|
|
37
|
+
var _docNode$nodeSize;
|
|
38
|
+
const {
|
|
39
|
+
formatMessage
|
|
40
|
+
} = useIntl();
|
|
41
|
+
const docNode = editorView.state.doc.nodeAt(targetElementPos);
|
|
42
|
+
const nodeEnd = targetElementPos + ((_docNode$nodeSize = docNode === null || docNode === void 0 ? void 0 : docNode.nodeSize) !== null && _docNode$nodeSize !== void 0 ? _docNode$nodeSize : 0);
|
|
43
|
+
const isText = docNode === null || docNode === void 0 ? void 0 : docNode.isText;
|
|
44
|
+
const handleClick = useCallback(() => {
|
|
45
|
+
const tr = editorView.state.tr;
|
|
46
|
+
if (isText) {
|
|
47
|
+
tr.setSelection(TextSelection.create(tr.doc, targetElementPos, Math.min(nodeEnd, tr.doc.nodeSize)));
|
|
48
|
+
} else {
|
|
49
|
+
tr.setSelection(NodeSelection.create(tr.doc, targetElementPos));
|
|
50
|
+
}
|
|
51
|
+
editorView.dispatch(tr);
|
|
52
|
+
}, [isText, editorView, nodeEnd, targetElementPos]);
|
|
53
|
+
const {
|
|
54
|
+
from,
|
|
55
|
+
to
|
|
56
|
+
} = editorView.state.selection;
|
|
57
|
+
const isSelected = from === targetElementPos && to === nodeEnd;
|
|
58
|
+
if (!targetElementPos || isSelected) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
const configureLinkLabel = formatMessage(cardMessages.inlineConfigureLink);
|
|
62
|
+
return jsx("span", {
|
|
63
|
+
css: buttonWrapperStyles
|
|
64
|
+
}, jsx(Tooltip, {
|
|
65
|
+
content: configureLinkLabel,
|
|
66
|
+
hideTooltipOnClick: true,
|
|
67
|
+
testId: `${testId}-tooltip`
|
|
68
|
+
}, jsx(Button, {
|
|
69
|
+
testId: testId
|
|
70
|
+
// eslint-disable-next-line @atlaskit/design-system/no-unsafe-style-overrides
|
|
71
|
+
,
|
|
72
|
+
css: buttonStyles,
|
|
73
|
+
onClick: handleClick,
|
|
74
|
+
iconBefore: jsx(PreferencesIcon, {
|
|
75
|
+
label: configureLinkLabel,
|
|
76
|
+
size: "small",
|
|
77
|
+
testId: `${testId}-configure-icon`
|
|
78
|
+
})
|
|
79
|
+
})));
|
|
80
|
+
};
|
|
@@ -9,4 +9,5 @@ export { HyperlinkAddToolbar } from './LinkPicker/HyperlinkAddToolbar';
|
|
|
9
9
|
export { default as HyperlinkLinkAddToolbar, HyperlinkLinkAddToolbarWithIntl, RECENT_SEARCH_LIST_SIZE } from './LinkPicker/HyperlinkAddToolbar/HyperlinkAddToolbar';
|
|
10
10
|
export { sha1 } from './LinkPicker/HyperlinkAddToolbar/utils';
|
|
11
11
|
export { isLinkAtPos, isTextAtPos, getLinkPreferencesURLFromENV } from './utils';
|
|
12
|
-
export { stagingLinkPreferencesUrl, productionLinkPreferencesUrl } from './constants';
|
|
12
|
+
export { stagingLinkPreferencesUrl, productionLinkPreferencesUrl } from './constants';
|
|
13
|
+
export { OverlayButton } from './ConfigureLinkOverlay/OverlayButton';
|
|
@@ -4,6 +4,7 @@ export let LinkAction = /*#__PURE__*/function (LinkAction) {
|
|
|
4
4
|
LinkAction["SELECTION_CHANGE"] = "SELECTION_CHANGE";
|
|
5
5
|
LinkAction["INSERT_LINK_TOOLBAR"] = "INSERT";
|
|
6
6
|
LinkAction["EDIT_INSERTED_TOOLBAR"] = "EDIT_INSERTED_TOOLBAR";
|
|
7
|
+
LinkAction["SET_CONFIGURE_BUTTON_TARGET_POS"] = "SET_CONFIGURE_BUTTON_TARGET_POS";
|
|
7
8
|
return LinkAction;
|
|
8
9
|
}({});
|
|
9
10
|
export let InsertStatus = /*#__PURE__*/function (InsertStatus) {
|
|
@@ -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 = "82.
|
|
4
|
+
const packageVersion = "82.7.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
|
|
@@ -7,7 +7,7 @@ import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@
|
|
|
7
7
|
import { N0, N50A, N60A, N900 } from '@atlaskit/theme/colors';
|
|
8
8
|
import Layer from '../Layer';
|
|
9
9
|
const packageName = "@atlaskit/editor-common";
|
|
10
|
-
const packageVersion = "82.
|
|
10
|
+
const packageVersion = "82.7.0";
|
|
11
11
|
const halfFocusRing = 1;
|
|
12
12
|
const dropOffset = '0, 8';
|
|
13
13
|
class DropList extends Component {
|
|
@@ -56,7 +56,7 @@ function FunctionalComponentColor(props) {
|
|
|
56
56
|
,
|
|
57
57
|
className: `${isSelected ? 'selected' : ''}`,
|
|
58
58
|
style: {
|
|
59
|
-
backgroundColor: colorStyle || 'transparent',
|
|
59
|
+
backgroundColor: colorStyle || (getBooleanFF('platform.editor.dynamic-palette-borders') ? "var(--ds-background-input, #FFFFFF)" : 'transparent'),
|
|
60
60
|
border: `1px solid ${borderColor}`
|
|
61
61
|
},
|
|
62
62
|
autoFocus: autoFocus
|
|
@@ -119,7 +119,7 @@ class ClassComponentColor extends PureComponent {
|
|
|
119
119
|
,
|
|
120
120
|
className: `${isSelected ? 'selected' : ''}`,
|
|
121
121
|
style: {
|
|
122
|
-
backgroundColor: colorStyle || 'transparent',
|
|
122
|
+
backgroundColor: colorStyle || (getBooleanFF('platform.editor.dynamic-palette-borders') ? "var(--ds-background-input, #FFFFFF)" : 'transparent'),
|
|
123
123
|
border: `1px solid ${borderColor}`
|
|
124
124
|
},
|
|
125
125
|
autoFocus: autoFocus
|
|
@@ -48,4 +48,8 @@ export const highlightColorPalette = [{
|
|
|
48
48
|
}];
|
|
49
49
|
backgroundColorPalette.forEach((label, color) => {
|
|
50
50
|
highlightColorPalette.push(mapPaletteColor(label, color));
|
|
51
|
-
});
|
|
51
|
+
});
|
|
52
|
+
export const highlightColorPaletteWithTokenBorders = highlightColorPalette.map(paletteColor => ({
|
|
53
|
+
...paletteColor,
|
|
54
|
+
border: "var(--ds-border, #091E4224)"
|
|
55
|
+
}));
|
|
@@ -15,6 +15,11 @@ export const mapPaletteColor = (label, color) => {
|
|
|
15
15
|
|
|
16
16
|
// row 1
|
|
17
17
|
export const textColorPalette = [];
|
|
18
|
+
export const textColorPaletteTokenBorders = [];
|
|
18
19
|
colorPalette.forEach((label, color) => {
|
|
19
20
|
textColorPalette.push(mapPaletteColor(label, color));
|
|
20
|
-
});
|
|
21
|
+
});
|
|
22
|
+
export const textColorPaletteWithTokenBorders = textColorPalette.map(paletteColor => ({
|
|
23
|
+
...paletteColor,
|
|
24
|
+
border: "var(--ds-border, #091E4224)"
|
|
25
|
+
}));
|
|
@@ -5,8 +5,8 @@ export { default as cellBackgroundColorPalette } from './ColorPalette/Palettes/c
|
|
|
5
5
|
export { default as colorPaletteMessages } from './ColorPalette/Palettes/paletteMessages';
|
|
6
6
|
export { panelBackgroundPalette, panelDarkModeBackgroundPalette } from './ColorPalette/Palettes/panelBackgroundPalette';
|
|
7
7
|
export { lightModeStatusColorPalette, darkModeStatusColorPalette } from './ColorPalette/Palettes/statusColorPalette';
|
|
8
|
-
export { textColorPalette } from './ColorPalette/Palettes/textColorPalette';
|
|
9
|
-
export { highlightColorPalette, REMOVE_HIGHLIGHT_COLOR } from './ColorPalette/Palettes/highlightColorPalette';
|
|
8
|
+
export { textColorPalette, textColorPaletteWithTokenBorders } from './ColorPalette/Palettes/textColorPalette';
|
|
9
|
+
export { highlightColorPalette, highlightColorPaletteWithTokenBorders, REMOVE_HIGHLIGHT_COLOR } from './ColorPalette/Palettes/highlightColorPalette';
|
|
10
10
|
export { backgroundPaletteTooltipMessages, borderPaletteTooltipMessages, chartsColorPaletteTooltipMessages, textPaletteTooltipMessages } from './ColorPalette/Palettes';
|
|
11
11
|
export { DEFAULT_BORDER_COLOR } from './ColorPalette/Palettes/common';
|
|
12
12
|
export { default as borderColorPalette } from './ColorPalette/Palettes/borderColorPalette';
|