@atlaskit/editor-plugin-hyperlink 8.1.4 → 8.1.5
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 +8 -0
- package/dist/cjs/ui/toolbar/LinkButton.js +1 -17
- package/dist/cjs/ui/toolbar/Toolbar.js +6 -1
- package/dist/es2019/ui/toolbar/LinkButton.js +1 -19
- package/dist/es2019/ui/toolbar/Toolbar.js +6 -1
- package/dist/esm/ui/toolbar/LinkButton.js +1 -17
- package/dist/esm/ui/toolbar/Toolbar.js +6 -1
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-hyperlink
|
|
2
2
|
|
|
3
|
+
## 8.1.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`351b338797ae4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/351b338797ae4) -
|
|
8
|
+
ED-29460 Clean up platform_editor_toolbar_aifc_fix_editor_view
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 8.1.4
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -11,22 +11,11 @@ var _analytics = require("@atlaskit/editor-common/analytics");
|
|
|
11
11
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
12
12
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
13
13
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
14
|
-
var _toolbar = require("@atlaskit/editor-common/toolbar");
|
|
15
|
-
var _utils = require("@atlaskit/editor-common/utils");
|
|
16
14
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
17
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
18
15
|
var LinkButton = exports.LinkButton = function LinkButton(_ref) {
|
|
19
16
|
var api = _ref.api;
|
|
20
17
|
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
21
18
|
formatMessage = _useIntl.formatMessage;
|
|
22
|
-
var _useEditorToolbar = (0, _toolbar.useEditorToolbar)(),
|
|
23
|
-
editorView = _useEditorToolbar.editorView;
|
|
24
|
-
// Warning! Do not destructure editorView, it will become stale
|
|
25
|
-
var _ref2 = editorView !== null && editorView !== void 0 ? editorView : {
|
|
26
|
-
state: null,
|
|
27
|
-
dispatch: null
|
|
28
|
-
},
|
|
29
|
-
state = _ref2.state;
|
|
30
19
|
var canInsertLink = (0, _hooks.useSharedPluginStateWithSelector)(api, ['hyperlink'], function (state) {
|
|
31
20
|
var _state$hyperlinkState, _state$hyperlinkState2;
|
|
32
21
|
return (_state$hyperlinkState = state === null || state === void 0 || (_state$hyperlinkState2 = state.hyperlinkState) === null || _state$hyperlinkState2 === void 0 ? void 0 : _state$hyperlinkState2.canInsertLink) !== null && _state$hyperlinkState !== void 0 ? _state$hyperlinkState : true;
|
|
@@ -34,12 +23,7 @@ var LinkButton = exports.LinkButton = function LinkButton(_ref) {
|
|
|
34
23
|
var onClick = function onClick() {
|
|
35
24
|
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.hyperlink.commands.showLinkToolbar(_analytics.INPUT_METHOD.FLOATING_TB));
|
|
36
25
|
};
|
|
37
|
-
var isEnabled;
|
|
38
|
-
if ((0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_fix_editor_view', 'isEnabled', true)) {
|
|
39
|
-
isEnabled = canInsertLink;
|
|
40
|
-
} else {
|
|
41
|
-
isEnabled = state !== null && state !== void 0 && state.selection ? (0, _utils.canLinkBeCreatedInRange)(state === null || state === void 0 ? void 0 : state.selection.from, state === null || state === void 0 ? void 0 : state.selection.to)(state) : false;
|
|
42
|
-
}
|
|
26
|
+
var isEnabled = canInsertLink;
|
|
43
27
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarTooltip, {
|
|
44
28
|
content: /*#__PURE__*/_react.default.createElement(_keymaps.ToolTipContent, {
|
|
45
29
|
description: formatMessage(_messages.toolbarInsertBlockMessages.link),
|
|
@@ -25,6 +25,7 @@ var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
|
25
25
|
var _edit = _interopRequireDefault(require("@atlaskit/icon/core/edit"));
|
|
26
26
|
var _linkBrokenEditorUnlink = _interopRequireDefault(require("@atlaskit/icon/core/migration/link-broken--editor-unlink"));
|
|
27
27
|
var _linkExternalShortcut = _interopRequireDefault(require("@atlaskit/icon/core/migration/link-external--shortcut"));
|
|
28
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
28
29
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
29
30
|
var _commands = require("../../editor-commands/commands");
|
|
30
31
|
var _main = require("../../pm-plugins/main");
|
|
@@ -249,10 +250,14 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(opti
|
|
|
249
250
|
}
|
|
250
251
|
var displayText = isEditLink(activeLinkMark) ? getLinkText(activeLinkMark, state) : linkState.activeText;
|
|
251
252
|
var popupHeight = lpLinkPicker ? _ui.LINKPICKER_HEIGHT_IN_PX : _ui.RECENT_SEARCH_HEIGHT_IN_PX;
|
|
253
|
+
|
|
254
|
+
// Removing popupWidth to ensure that we the popup always positions setting positon left instead of flipping to position right
|
|
255
|
+
// inside of a narrow space like Preview panel
|
|
256
|
+
var popupWidth = !lpLinkPicker && (0, _platformFeatureFlags.fg)('platform_editor_link_picker_width_fix') ? undefined : _ui.RECENT_SEARCH_WIDTH_IN_PX;
|
|
252
257
|
return _objectSpread(_objectSpread({}, hyperLinkToolbar), {}, {
|
|
253
258
|
preventPopupOverflow: true,
|
|
254
259
|
height: popupHeight,
|
|
255
|
-
width:
|
|
260
|
+
width: popupWidth,
|
|
256
261
|
items: [{
|
|
257
262
|
type: 'custom',
|
|
258
263
|
fallback: [],
|
|
@@ -4,26 +4,13 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
|
4
4
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
5
5
|
import { ToolTipContent, addLink } from '@atlaskit/editor-common/keymaps';
|
|
6
6
|
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
|
-
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
8
|
-
import { canLinkBeCreatedInRange } from '@atlaskit/editor-common/utils';
|
|
9
7
|
import { LinkIcon, ToolbarButton, ToolbarTooltip } from '@atlaskit/editor-toolbar';
|
|
10
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
11
8
|
export const LinkButton = ({
|
|
12
9
|
api
|
|
13
10
|
}) => {
|
|
14
11
|
const {
|
|
15
12
|
formatMessage
|
|
16
13
|
} = useIntl();
|
|
17
|
-
const {
|
|
18
|
-
editorView
|
|
19
|
-
} = useEditorToolbar();
|
|
20
|
-
// Warning! Do not destructure editorView, it will become stale
|
|
21
|
-
const {
|
|
22
|
-
state
|
|
23
|
-
} = editorView !== null && editorView !== void 0 ? editorView : {
|
|
24
|
-
state: null,
|
|
25
|
-
dispatch: null
|
|
26
|
-
};
|
|
27
14
|
const canInsertLink = useSharedPluginStateWithSelector(api, ['hyperlink'], state => {
|
|
28
15
|
var _state$hyperlinkState, _state$hyperlinkState2;
|
|
29
16
|
return (_state$hyperlinkState = state === null || state === void 0 ? void 0 : (_state$hyperlinkState2 = state.hyperlinkState) === null || _state$hyperlinkState2 === void 0 ? void 0 : _state$hyperlinkState2.canInsertLink) !== null && _state$hyperlinkState !== void 0 ? _state$hyperlinkState : true;
|
|
@@ -31,12 +18,7 @@ export const LinkButton = ({
|
|
|
31
18
|
const onClick = () => {
|
|
32
19
|
api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : api.hyperlink.commands.showLinkToolbar(INPUT_METHOD.FLOATING_TB));
|
|
33
20
|
};
|
|
34
|
-
|
|
35
|
-
if (expValEquals('platform_editor_toolbar_aifc_fix_editor_view', 'isEnabled', true)) {
|
|
36
|
-
isEnabled = canInsertLink;
|
|
37
|
-
} else {
|
|
38
|
-
isEnabled = state !== null && state !== void 0 && state.selection ? canLinkBeCreatedInRange(state === null || state === void 0 ? void 0 : state.selection.from, state === null || state === void 0 ? void 0 : state.selection.to)(state) : false;
|
|
39
|
-
}
|
|
21
|
+
const isEnabled = canInsertLink;
|
|
40
22
|
return /*#__PURE__*/React.createElement(ToolbarTooltip, {
|
|
41
23
|
content: /*#__PURE__*/React.createElement(ToolTipContent, {
|
|
42
24
|
description: formatMessage(messages.link),
|
|
@@ -14,6 +14,7 @@ import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
|
14
14
|
import EditIcon from '@atlaskit/icon/core/edit';
|
|
15
15
|
import LinkBrokenIcon from '@atlaskit/icon/core/migration/link-broken--editor-unlink';
|
|
16
16
|
import LinkExternalIcon from '@atlaskit/icon/core/migration/link-external--shortcut';
|
|
17
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
17
18
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
18
19
|
import { editInsertedLink, insertLinkWithAnalytics, onClickAwayCallback, onEscapeCallback, removeLink, updateLink } from '../../editor-commands/commands';
|
|
19
20
|
import { stateKey } from '../../pm-plugins/main';
|
|
@@ -233,11 +234,15 @@ export const getToolbarConfig = (options, pluginInjectionApi) => (state, intl, p
|
|
|
233
234
|
}
|
|
234
235
|
const displayText = isEditLink(activeLinkMark) ? getLinkText(activeLinkMark, state) : linkState.activeText;
|
|
235
236
|
const popupHeight = lpLinkPicker ? LINKPICKER_HEIGHT_IN_PX : RECENT_SEARCH_HEIGHT_IN_PX;
|
|
237
|
+
|
|
238
|
+
// Removing popupWidth to ensure that we the popup always positions setting positon left instead of flipping to position right
|
|
239
|
+
// inside of a narrow space like Preview panel
|
|
240
|
+
const popupWidth = !lpLinkPicker && fg('platform_editor_link_picker_width_fix') ? undefined : RECENT_SEARCH_WIDTH_IN_PX;
|
|
236
241
|
return {
|
|
237
242
|
...hyperLinkToolbar,
|
|
238
243
|
preventPopupOverflow: true,
|
|
239
244
|
height: popupHeight,
|
|
240
|
-
width:
|
|
245
|
+
width: popupWidth,
|
|
241
246
|
items: [{
|
|
242
247
|
type: 'custom',
|
|
243
248
|
fallback: [],
|
|
@@ -4,22 +4,11 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
|
4
4
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
5
5
|
import { ToolTipContent, addLink } from '@atlaskit/editor-common/keymaps';
|
|
6
6
|
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
|
-
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
8
|
-
import { canLinkBeCreatedInRange } from '@atlaskit/editor-common/utils';
|
|
9
7
|
import { LinkIcon, ToolbarButton, ToolbarTooltip } from '@atlaskit/editor-toolbar';
|
|
10
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
11
8
|
export var LinkButton = function LinkButton(_ref) {
|
|
12
9
|
var api = _ref.api;
|
|
13
10
|
var _useIntl = useIntl(),
|
|
14
11
|
formatMessage = _useIntl.formatMessage;
|
|
15
|
-
var _useEditorToolbar = useEditorToolbar(),
|
|
16
|
-
editorView = _useEditorToolbar.editorView;
|
|
17
|
-
// Warning! Do not destructure editorView, it will become stale
|
|
18
|
-
var _ref2 = editorView !== null && editorView !== void 0 ? editorView : {
|
|
19
|
-
state: null,
|
|
20
|
-
dispatch: null
|
|
21
|
-
},
|
|
22
|
-
state = _ref2.state;
|
|
23
12
|
var canInsertLink = useSharedPluginStateWithSelector(api, ['hyperlink'], function (state) {
|
|
24
13
|
var _state$hyperlinkState, _state$hyperlinkState2;
|
|
25
14
|
return (_state$hyperlinkState = state === null || state === void 0 || (_state$hyperlinkState2 = state.hyperlinkState) === null || _state$hyperlinkState2 === void 0 ? void 0 : _state$hyperlinkState2.canInsertLink) !== null && _state$hyperlinkState !== void 0 ? _state$hyperlinkState : true;
|
|
@@ -27,12 +16,7 @@ export var LinkButton = function LinkButton(_ref) {
|
|
|
27
16
|
var onClick = function onClick() {
|
|
28
17
|
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.hyperlink.commands.showLinkToolbar(INPUT_METHOD.FLOATING_TB));
|
|
29
18
|
};
|
|
30
|
-
var isEnabled;
|
|
31
|
-
if (expValEquals('platform_editor_toolbar_aifc_fix_editor_view', 'isEnabled', true)) {
|
|
32
|
-
isEnabled = canInsertLink;
|
|
33
|
-
} else {
|
|
34
|
-
isEnabled = state !== null && state !== void 0 && state.selection ? canLinkBeCreatedInRange(state === null || state === void 0 ? void 0 : state.selection.from, state === null || state === void 0 ? void 0 : state.selection.to)(state) : false;
|
|
35
|
-
}
|
|
19
|
+
var isEnabled = canInsertLink;
|
|
36
20
|
return /*#__PURE__*/React.createElement(ToolbarTooltip, {
|
|
37
21
|
content: /*#__PURE__*/React.createElement(ToolTipContent, {
|
|
38
22
|
description: formatMessage(messages.link),
|
|
@@ -18,6 +18,7 @@ import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
|
18
18
|
import EditIcon from '@atlaskit/icon/core/edit';
|
|
19
19
|
import LinkBrokenIcon from '@atlaskit/icon/core/migration/link-broken--editor-unlink';
|
|
20
20
|
import LinkExternalIcon from '@atlaskit/icon/core/migration/link-external--shortcut';
|
|
21
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
21
22
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
22
23
|
import { editInsertedLink, insertLinkWithAnalytics, onClickAwayCallback, onEscapeCallback, removeLink, updateLink } from '../../editor-commands/commands';
|
|
23
24
|
import { stateKey } from '../../pm-plugins/main';
|
|
@@ -240,10 +241,14 @@ export var getToolbarConfig = function getToolbarConfig(options, pluginInjection
|
|
|
240
241
|
}
|
|
241
242
|
var displayText = isEditLink(activeLinkMark) ? getLinkText(activeLinkMark, state) : linkState.activeText;
|
|
242
243
|
var popupHeight = lpLinkPicker ? LINKPICKER_HEIGHT_IN_PX : RECENT_SEARCH_HEIGHT_IN_PX;
|
|
244
|
+
|
|
245
|
+
// Removing popupWidth to ensure that we the popup always positions setting positon left instead of flipping to position right
|
|
246
|
+
// inside of a narrow space like Preview panel
|
|
247
|
+
var popupWidth = !lpLinkPicker && fg('platform_editor_link_picker_width_fix') ? undefined : RECENT_SEARCH_WIDTH_IN_PX;
|
|
243
248
|
return _objectSpread(_objectSpread({}, hyperLinkToolbar), {}, {
|
|
244
249
|
preventPopupOverflow: true,
|
|
245
250
|
height: popupHeight,
|
|
246
|
-
width:
|
|
251
|
+
width: popupWidth,
|
|
247
252
|
items: [{
|
|
248
253
|
type: 'custom',
|
|
249
254
|
fallback: [],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-hyperlink",
|
|
3
|
-
"version": "8.1.
|
|
3
|
+
"version": "8.1.5",
|
|
4
4
|
"description": "Hyperlink plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -45,13 +45,13 @@
|
|
|
45
45
|
"@atlaskit/icon": "^28.5.0",
|
|
46
46
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
47
47
|
"@atlaskit/prosemirror-input-rules": "^3.5.0",
|
|
48
|
-
"@atlaskit/tmp-editor-statsig": "^13.
|
|
48
|
+
"@atlaskit/tmp-editor-statsig": "^13.22.0",
|
|
49
49
|
"@babel/runtime": "^7.0.0",
|
|
50
50
|
"@emotion/react": "^11.7.1",
|
|
51
51
|
"uuid": "^3.1.0"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"@atlaskit/editor-common": "^110.
|
|
54
|
+
"@atlaskit/editor-common": "^110.19.0",
|
|
55
55
|
"react": "^18.2.0",
|
|
56
56
|
"react-dom": "^18.2.0",
|
|
57
57
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
@@ -102,6 +102,9 @@
|
|
|
102
102
|
"platform-feature-flags": {
|
|
103
103
|
"platform_editor_use_preferences_plugin": {
|
|
104
104
|
"type": "boolean"
|
|
105
|
+
},
|
|
106
|
+
"platform_editor_link_picker_width_fix": {
|
|
107
|
+
"type": "boolean"
|
|
105
108
|
}
|
|
106
109
|
}
|
|
107
110
|
}
|