@atlaskit/editor-plugin-hyperlink 4.5.4 → 5.0.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 +49 -0
- package/dist/cjs/ui/toolbar/Toolbar.js +20 -9
- package/dist/es2019/ui/toolbar/Toolbar.js +20 -9
- package/dist/esm/ui/toolbar/Toolbar.js +20 -9
- package/package.json +15 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,54 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-hyperlink
|
|
2
2
|
|
|
3
|
+
## 5.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#181024](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/181024)
|
|
8
|
+
[`8e80c487ca307`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8e80c487ca307) - ##
|
|
9
|
+
Make `@atlaskit/editor-common` a peer dependency
|
|
10
|
+
|
|
11
|
+
**WHAT:** `@atlaskit/editor-common` has been moved from `dependencies` to `peerDependencies` in
|
|
12
|
+
all editor plugin packages.
|
|
13
|
+
|
|
14
|
+
**WHY:** This change ensures that only a single version of `@atlaskit/editor-common` is used in
|
|
15
|
+
consuming applications, preventing issues caused by multiple versions of singleton libraries (such
|
|
16
|
+
as context mismatches or duplicated state). This is especially important for packages that rely on
|
|
17
|
+
shared context or singletons.
|
|
18
|
+
|
|
19
|
+
**HOW TO ADJUST:**
|
|
20
|
+
|
|
21
|
+
- Consumers must now explicitly install `@atlaskit/editor-common` in their own project if they use
|
|
22
|
+
any of these editor plugins.
|
|
23
|
+
- Ensure the version you install matches the version required by the plugins.
|
|
24
|
+
- You can use the
|
|
25
|
+
[`check-peer-dependencies`](https://www.npmjs.com/package/check-peer-dependencies) package to
|
|
26
|
+
verify that all required peer dependencies are installed and compatible.
|
|
27
|
+
- Example install command:
|
|
28
|
+
```
|
|
29
|
+
npm install @atlaskit/editor-common
|
|
30
|
+
```
|
|
31
|
+
or
|
|
32
|
+
```
|
|
33
|
+
yarn add @atlaskit/editor-common
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**Note:** This is a breaking change. If `@atlaskit/editor-common` is not installed at the
|
|
37
|
+
application level, you may see errors or unexpected behavior.
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- Updated dependencies
|
|
42
|
+
|
|
43
|
+
## 4.5.5
|
|
44
|
+
|
|
45
|
+
### Patch Changes
|
|
46
|
+
|
|
47
|
+
- [#179868](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/179868)
|
|
48
|
+
[`87856dbd47c93`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/87856dbd47c93) -
|
|
49
|
+
[ux] [ED-27899] Fix separators and order for plain links
|
|
50
|
+
- Updated dependencies
|
|
51
|
+
|
|
3
52
|
## 4.5.4
|
|
4
53
|
|
|
5
54
|
### Patch Changes
|
|
@@ -24,6 +24,8 @@ var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
|
24
24
|
var _edit = _interopRequireDefault(require("@atlaskit/icon/core/edit"));
|
|
25
25
|
var _linkBrokenEditorUnlink = _interopRequireDefault(require("@atlaskit/icon/core/migration/link-broken--editor-unlink"));
|
|
26
26
|
var _linkExternalShortcut = _interopRequireDefault(require("@atlaskit/icon/core/migration/link-external--shortcut"));
|
|
27
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
28
|
+
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
27
29
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
28
30
|
var _commands = require("../../editor-commands/commands");
|
|
29
31
|
var _main = require("../../pm-plugins/main");
|
|
@@ -181,20 +183,21 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(opti
|
|
|
181
183
|
if (activeLinkMark.node.text) {
|
|
182
184
|
metadata.title = activeLinkMark.node.text;
|
|
183
185
|
}
|
|
186
|
+
var isEditorControlsOn = (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_controls', 'cohort', 'variant1');
|
|
184
187
|
var cardActions = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c3 = pluginInjectionApi.card) === null || _pluginInjectionApi$c3 === void 0 ? void 0 : _pluginInjectionApi$c3.actions;
|
|
185
|
-
var startingToolbarItems = (_cardActions$getStart = cardActions === null || cardActions === void 0 ? void 0 : cardActions.getStartingToolbarItems(intl, link, (0, _commands.editInsertedLink)(editorAnalyticsApi), metadata,
|
|
188
|
+
var startingToolbarItems = (_cardActions$getStart = cardActions === null || cardActions === void 0 ? void 0 : cardActions.getStartingToolbarItems(intl, link, (0, _commands.editInsertedLink)(editorAnalyticsApi), metadata, isEditorControlsOn ? state : undefined)) !== null && _cardActions$getStart !== void 0 ? _cardActions$getStart : [{
|
|
186
189
|
id: 'editor.link.edit',
|
|
187
190
|
testId: 'editor.link.edit',
|
|
188
191
|
type: 'button',
|
|
189
192
|
onClick: (0, _commands.editInsertedLink)(editorAnalyticsApi),
|
|
190
193
|
title: editLink,
|
|
191
|
-
showTitle:
|
|
194
|
+
showTitle: isEditorControlsOn ? false : true,
|
|
192
195
|
metadata: metadata,
|
|
193
|
-
icon:
|
|
196
|
+
icon: isEditorControlsOn ? _edit.default : undefined
|
|
194
197
|
}, {
|
|
195
198
|
type: 'separator'
|
|
196
199
|
}];
|
|
197
|
-
var
|
|
200
|
+
var openLinkButton = {
|
|
198
201
|
id: 'editor.link.openLink',
|
|
199
202
|
testId: 'editor.link.openLink',
|
|
200
203
|
type: 'button',
|
|
@@ -207,9 +210,8 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(opti
|
|
|
207
210
|
className: 'hyperlink-open-link',
|
|
208
211
|
metadata: metadata,
|
|
209
212
|
tabIndex: null
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
}, {
|
|
213
|
+
};
|
|
214
|
+
var unlinkButton = {
|
|
213
215
|
id: 'editor.link.unlink',
|
|
214
216
|
testId: 'editor.link.unlink',
|
|
215
217
|
type: 'button',
|
|
@@ -219,9 +221,18 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(opti
|
|
|
219
221
|
title: labelUnlink,
|
|
220
222
|
icon: _linkBrokenEditorUnlink.default,
|
|
221
223
|
tabIndex: null
|
|
222
|
-
}
|
|
224
|
+
};
|
|
225
|
+
var items = [].concat((0, _toConsumableArray2.default)(startingToolbarItems), (0, _toConsumableArray2.default)(isEditorControlsOn && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_15') ? [unlinkButton, {
|
|
226
|
+
type: 'separator',
|
|
227
|
+
fullHeight: true
|
|
228
|
+
}, openLinkButton, {
|
|
229
|
+
type: 'separator',
|
|
230
|
+
fullHeight: true
|
|
231
|
+
}] : [openLinkButton, {
|
|
223
232
|
type: 'separator'
|
|
224
|
-
}, {
|
|
233
|
+
}, unlinkButton, {
|
|
234
|
+
type: 'separator'
|
|
235
|
+
}]), [{
|
|
225
236
|
type: 'copy-button',
|
|
226
237
|
items: [{
|
|
227
238
|
state: state,
|
|
@@ -13,6 +13,8 @@ import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
|
13
13
|
import EditIcon from '@atlaskit/icon/core/edit';
|
|
14
14
|
import LinkBrokenIcon from '@atlaskit/icon/core/migration/link-broken--editor-unlink';
|
|
15
15
|
import LinkExternalIcon from '@atlaskit/icon/core/migration/link-external--shortcut';
|
|
16
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
17
|
+
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
16
18
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
17
19
|
import { editInsertedLink, insertLinkWithAnalytics, onClickAwayCallback, onEscapeCallback, removeLink, updateLink } from '../../editor-commands/commands';
|
|
18
20
|
import { stateKey } from '../../pm-plugins/main';
|
|
@@ -167,20 +169,21 @@ export const getToolbarConfig = (options, pluginInjectionApi) => (state, intl, p
|
|
|
167
169
|
if (activeLinkMark.node.text) {
|
|
168
170
|
metadata.title = activeLinkMark.node.text;
|
|
169
171
|
}
|
|
172
|
+
const isEditorControlsOn = expValEqualsNoExposure('platform_editor_controls', 'cohort', 'variant1');
|
|
170
173
|
const cardActions = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c4 = pluginInjectionApi.card) === null || _pluginInjectionApi$c4 === void 0 ? void 0 : _pluginInjectionApi$c4.actions;
|
|
171
|
-
const startingToolbarItems = (_cardActions$getStart = cardActions === null || cardActions === void 0 ? void 0 : cardActions.getStartingToolbarItems(intl, link, editInsertedLink(editorAnalyticsApi), metadata,
|
|
174
|
+
const startingToolbarItems = (_cardActions$getStart = cardActions === null || cardActions === void 0 ? void 0 : cardActions.getStartingToolbarItems(intl, link, editInsertedLink(editorAnalyticsApi), metadata, isEditorControlsOn ? state : undefined)) !== null && _cardActions$getStart !== void 0 ? _cardActions$getStart : [{
|
|
172
175
|
id: 'editor.link.edit',
|
|
173
176
|
testId: 'editor.link.edit',
|
|
174
177
|
type: 'button',
|
|
175
178
|
onClick: editInsertedLink(editorAnalyticsApi),
|
|
176
179
|
title: editLink,
|
|
177
|
-
showTitle:
|
|
180
|
+
showTitle: isEditorControlsOn ? false : true,
|
|
178
181
|
metadata: metadata,
|
|
179
|
-
icon:
|
|
182
|
+
icon: isEditorControlsOn ? EditIcon : undefined
|
|
180
183
|
}, {
|
|
181
184
|
type: 'separator'
|
|
182
185
|
}];
|
|
183
|
-
const
|
|
186
|
+
const openLinkButton = {
|
|
184
187
|
id: 'editor.link.openLink',
|
|
185
188
|
testId: 'editor.link.openLink',
|
|
186
189
|
type: 'button',
|
|
@@ -193,9 +196,8 @@ export const getToolbarConfig = (options, pluginInjectionApi) => (state, intl, p
|
|
|
193
196
|
className: 'hyperlink-open-link',
|
|
194
197
|
metadata: metadata,
|
|
195
198
|
tabIndex: null
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
}, {
|
|
199
|
+
};
|
|
200
|
+
const unlinkButton = {
|
|
199
201
|
id: 'editor.link.unlink',
|
|
200
202
|
testId: 'editor.link.unlink',
|
|
201
203
|
type: 'button',
|
|
@@ -205,9 +207,18 @@ export const getToolbarConfig = (options, pluginInjectionApi) => (state, intl, p
|
|
|
205
207
|
title: labelUnlink,
|
|
206
208
|
icon: LinkBrokenIcon,
|
|
207
209
|
tabIndex: null
|
|
208
|
-
}
|
|
210
|
+
};
|
|
211
|
+
const items = [...startingToolbarItems, ...(isEditorControlsOn && fg('platform_editor_controls_patch_15') ? [unlinkButton, {
|
|
212
|
+
type: 'separator',
|
|
213
|
+
fullHeight: true
|
|
214
|
+
}, openLinkButton, {
|
|
215
|
+
type: 'separator',
|
|
216
|
+
fullHeight: true
|
|
217
|
+
}] : [openLinkButton, {
|
|
209
218
|
type: 'separator'
|
|
210
|
-
}, {
|
|
219
|
+
}, unlinkButton, {
|
|
220
|
+
type: 'separator'
|
|
221
|
+
}]), {
|
|
211
222
|
type: 'copy-button',
|
|
212
223
|
items: [{
|
|
213
224
|
state,
|
|
@@ -17,6 +17,8 @@ import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
|
17
17
|
import EditIcon from '@atlaskit/icon/core/edit';
|
|
18
18
|
import LinkBrokenIcon from '@atlaskit/icon/core/migration/link-broken--editor-unlink';
|
|
19
19
|
import LinkExternalIcon from '@atlaskit/icon/core/migration/link-external--shortcut';
|
|
20
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
21
|
+
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
20
22
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
21
23
|
import { editInsertedLink, insertLinkWithAnalytics, onClickAwayCallback, onEscapeCallback, removeLink, updateLink } from '../../editor-commands/commands';
|
|
22
24
|
import { stateKey } from '../../pm-plugins/main';
|
|
@@ -172,20 +174,21 @@ export var getToolbarConfig = function getToolbarConfig(options, pluginInjection
|
|
|
172
174
|
if (activeLinkMark.node.text) {
|
|
173
175
|
metadata.title = activeLinkMark.node.text;
|
|
174
176
|
}
|
|
177
|
+
var isEditorControlsOn = expValEqualsNoExposure('platform_editor_controls', 'cohort', 'variant1');
|
|
175
178
|
var cardActions = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c3 = pluginInjectionApi.card) === null || _pluginInjectionApi$c3 === void 0 ? void 0 : _pluginInjectionApi$c3.actions;
|
|
176
|
-
var startingToolbarItems = (_cardActions$getStart = cardActions === null || cardActions === void 0 ? void 0 : cardActions.getStartingToolbarItems(intl, link, editInsertedLink(editorAnalyticsApi), metadata,
|
|
179
|
+
var startingToolbarItems = (_cardActions$getStart = cardActions === null || cardActions === void 0 ? void 0 : cardActions.getStartingToolbarItems(intl, link, editInsertedLink(editorAnalyticsApi), metadata, isEditorControlsOn ? state : undefined)) !== null && _cardActions$getStart !== void 0 ? _cardActions$getStart : [{
|
|
177
180
|
id: 'editor.link.edit',
|
|
178
181
|
testId: 'editor.link.edit',
|
|
179
182
|
type: 'button',
|
|
180
183
|
onClick: editInsertedLink(editorAnalyticsApi),
|
|
181
184
|
title: editLink,
|
|
182
|
-
showTitle:
|
|
185
|
+
showTitle: isEditorControlsOn ? false : true,
|
|
183
186
|
metadata: metadata,
|
|
184
|
-
icon:
|
|
187
|
+
icon: isEditorControlsOn ? EditIcon : undefined
|
|
185
188
|
}, {
|
|
186
189
|
type: 'separator'
|
|
187
190
|
}];
|
|
188
|
-
var
|
|
191
|
+
var openLinkButton = {
|
|
189
192
|
id: 'editor.link.openLink',
|
|
190
193
|
testId: 'editor.link.openLink',
|
|
191
194
|
type: 'button',
|
|
@@ -198,9 +201,8 @@ export var getToolbarConfig = function getToolbarConfig(options, pluginInjection
|
|
|
198
201
|
className: 'hyperlink-open-link',
|
|
199
202
|
metadata: metadata,
|
|
200
203
|
tabIndex: null
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
}, {
|
|
204
|
+
};
|
|
205
|
+
var unlinkButton = {
|
|
204
206
|
id: 'editor.link.unlink',
|
|
205
207
|
testId: 'editor.link.unlink',
|
|
206
208
|
type: 'button',
|
|
@@ -210,9 +212,18 @@ export var getToolbarConfig = function getToolbarConfig(options, pluginInjection
|
|
|
210
212
|
title: labelUnlink,
|
|
211
213
|
icon: LinkBrokenIcon,
|
|
212
214
|
tabIndex: null
|
|
213
|
-
}
|
|
215
|
+
};
|
|
216
|
+
var items = [].concat(_toConsumableArray(startingToolbarItems), _toConsumableArray(isEditorControlsOn && fg('platform_editor_controls_patch_15') ? [unlinkButton, {
|
|
217
|
+
type: 'separator',
|
|
218
|
+
fullHeight: true
|
|
219
|
+
}, openLinkButton, {
|
|
220
|
+
type: 'separator',
|
|
221
|
+
fullHeight: true
|
|
222
|
+
}] : [openLinkButton, {
|
|
214
223
|
type: 'separator'
|
|
215
|
-
}, {
|
|
224
|
+
}, unlinkButton, {
|
|
225
|
+
type: 'separator'
|
|
226
|
+
}]), [{
|
|
216
227
|
type: 'copy-button',
|
|
217
228
|
items: [{
|
|
218
229
|
state: state,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-hyperlink",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "Hyperlink plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -9,8 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"atlassian": {
|
|
11
11
|
"team": "Editor: Jenga",
|
|
12
|
-
"singleton": true
|
|
13
|
-
"runReact18": true
|
|
12
|
+
"singleton": true
|
|
14
13
|
},
|
|
15
14
|
"repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
|
|
16
15
|
"main": "dist/cjs/index.js",
|
|
@@ -35,30 +34,30 @@
|
|
|
35
34
|
"dependencies": {
|
|
36
35
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
37
36
|
"@atlaskit/analytics-next": "^11.1.0",
|
|
38
|
-
"@atlaskit/editor-
|
|
39
|
-
"@atlaskit/editor-plugin-
|
|
40
|
-
"@atlaskit/editor-plugin-
|
|
41
|
-
"@atlaskit/editor-plugin-
|
|
42
|
-
"@atlaskit/editor-plugin-
|
|
43
|
-
"@atlaskit/editor-plugin-
|
|
44
|
-
"@atlaskit/editor-plugin-selection-toolbar": "^3.7.0",
|
|
37
|
+
"@atlaskit/editor-plugin-analytics": "^3.0.0",
|
|
38
|
+
"@atlaskit/editor-plugin-card": "^7.0.0",
|
|
39
|
+
"@atlaskit/editor-plugin-connectivity": "^3.0.0",
|
|
40
|
+
"@atlaskit/editor-plugin-editor-viewmode": "^5.0.0",
|
|
41
|
+
"@atlaskit/editor-plugin-primary-toolbar": "^4.0.0",
|
|
42
|
+
"@atlaskit/editor-plugin-selection-toolbar": "^4.0.0",
|
|
45
43
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
46
|
-
"@atlaskit/icon": "^27.
|
|
44
|
+
"@atlaskit/icon": "^27.2.0",
|
|
47
45
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
48
46
|
"@atlaskit/prosemirror-input-rules": "^3.3.0",
|
|
49
|
-
"@atlaskit/tmp-editor-statsig": "^8.
|
|
47
|
+
"@atlaskit/tmp-editor-statsig": "^8.7.0",
|
|
50
48
|
"@babel/runtime": "^7.0.0",
|
|
51
49
|
"@emotion/react": "^11.7.1",
|
|
52
50
|
"uuid": "^3.1.0"
|
|
53
51
|
},
|
|
54
52
|
"peerDependencies": {
|
|
53
|
+
"@atlaskit/editor-common": "^107.6.0",
|
|
55
54
|
"react": "^18.2.0",
|
|
56
55
|
"react-dom": "^18.2.0",
|
|
57
56
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
58
57
|
},
|
|
59
58
|
"devDependencies": {
|
|
60
59
|
"@atlaskit/activity-provider": "^2.5.0",
|
|
61
|
-
"@atlaskit/link-test-helpers": "^8.
|
|
60
|
+
"@atlaskit/link-test-helpers": "^8.2.0",
|
|
62
61
|
"@atlaskit/media-test-helpers": "^37.0.0",
|
|
63
62
|
"@atlaskit/ssr": "workspace:^",
|
|
64
63
|
"@atlaskit/util-data-test": "^18.0.0",
|
|
@@ -107,6 +106,9 @@
|
|
|
107
106
|
},
|
|
108
107
|
"platform_editor_use_preferences_plugin": {
|
|
109
108
|
"type": "boolean"
|
|
109
|
+
},
|
|
110
|
+
"platform_editor_controls_patch_15": {
|
|
111
|
+
"type": "boolean"
|
|
110
112
|
}
|
|
111
113
|
}
|
|
112
114
|
}
|