@atlaskit/editor-plugin-hyperlink 4.2.8 → 4.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 CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/editor-plugin-hyperlink
2
2
 
3
+ ## 4.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#128788](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/128788)
8
+ [`83a4d1ba203b0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/83a4d1ba203b0) -
9
+ [ux] update icons
10
+
11
+ ## 4.2.9
12
+
13
+ ### Patch Changes
14
+
15
+ - [#128611](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/128611)
16
+ [`428548761fab9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/428548761fab9) -
17
+ [ux] ED-27133 fix toolbar link button
18
+ - Updated dependencies
19
+
3
20
  ## 4.2.8
4
21
 
5
22
  ### Patch Changes
@@ -19,10 +19,8 @@ var _messages = require("@atlaskit/editor-common/messages");
19
19
  var _ui = require("@atlaskit/editor-common/ui");
20
20
  var _utils = require("@atlaskit/editor-common/utils");
21
21
  var _state = require("@atlaskit/editor-prosemirror/state");
22
- var _linkBroken = _interopRequireDefault(require("@atlaskit/icon/core/link-broken"));
23
- var _linkExternal = _interopRequireDefault(require("@atlaskit/icon/core/link-external"));
24
- var _unlink = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/unlink"));
25
- var _shortcut = _interopRequireDefault(require("@atlaskit/icon/glyph/shortcut"));
22
+ var _linkBrokenEditorUnlink = _interopRequireDefault(require("@atlaskit/icon/core/migration/link-broken--editor-unlink"));
23
+ var _linkExternalShortcut = _interopRequireDefault(require("@atlaskit/icon/core/migration/link-external--shortcut"));
26
24
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
27
25
  var _commands = require("../../editor-commands/commands");
28
26
  var _main = require("../../pm-plugins/main");
@@ -109,19 +107,19 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(opti
109
107
  if (options.disableFloatingToolbar) {
110
108
  return;
111
109
  }
110
+ var linkState = _main.stateKey.getState(state);
111
+ var activeLinkMark = linkState === null || linkState === void 0 ? void 0 : linkState.activeLinkMark;
112
112
 
113
113
  // If range selection, we don't show hyperlink floating toolbar.
114
114
  // Text Formattting toolbar is shown instaed.
115
- if (state.selection instanceof _state.TextSelection && state.selection.to !== state.selection.from && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
115
+ if (state.selection instanceof _state.TextSelection && state.selection.to !== state.selection.from && (activeLinkMark === null || activeLinkMark === void 0 ? void 0 : activeLinkMark.type) === 'EDIT' && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
116
116
  return;
117
117
  }
118
118
  var formatMessage = intl.formatMessage;
119
- var linkState = _main.stateKey.getState(state);
120
119
  var editorCardActions = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c2 = pluginInjectionApi.card) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.actions;
121
120
  var editorAnalyticsApi = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions;
122
121
  var lpLinkPicker = (_options$lpLinkPicker = options.lpLinkPicker) !== null && _options$lpLinkPicker !== void 0 ? _options$lpLinkPicker : true;
123
- if (linkState && linkState.activeLinkMark) {
124
- var activeLinkMark = linkState.activeLinkMark;
122
+ if (activeLinkMark) {
125
123
  var hyperLinkToolbar = {
126
124
  title: 'Hyperlink floating controls',
127
125
  nodeType: [state.schema.nodes.text, state.schema.nodes.paragraph, state.schema.nodes.heading, state.schema.nodes.taskItem, state.schema.nodes.decisionItem, state.schema.nodes.caption].filter(function (nodeType) {
@@ -174,8 +172,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(opti
174
172
  href: isValidUrl ? link : undefined,
175
173
  onClick: visitHyperlink(editorAnalyticsApi),
176
174
  title: labelOpenLink,
177
- icon: _linkExternal.default,
178
- iconFallback: _shortcut.default,
175
+ icon: _linkExternalShortcut.default,
179
176
  className: 'hyperlink-open-link',
180
177
  metadata: metadata,
181
178
  tabIndex: null
@@ -189,8 +186,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(opti
189
186
  inputMethod: _analytics.INPUT_METHOD.FLOATING_TB
190
187
  }),
191
188
  title: labelUnlink,
192
- icon: _linkBroken.default,
193
- iconFallback: _unlink.default,
189
+ icon: _linkBrokenEditorUnlink.default,
194
190
  tabIndex: null
195
191
  }, {
196
192
  type: 'separator'
@@ -1,6 +1,6 @@
1
1
  import React, { useRef } from 'react';
2
2
  import { isSafeUrl } from '@atlaskit/adf-schema';
3
- import { ACTION, ACTION_SUBJECT_ID, buildVisitedLinkPayload, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
+ import { ACTION, ACTION_SUBJECT_ID, INPUT_METHOD, buildVisitedLinkPayload } from '@atlaskit/editor-common/analytics';
4
4
  import { commandWithMetadata } from '@atlaskit/editor-common/card';
5
5
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
6
6
  import { HyperlinkAddToolbar } from '@atlaskit/editor-common/link';
@@ -8,10 +8,8 @@ import { linkMessages, linkToolbarMessages as linkToolbarCommonMessages } from '
8
8
  import { LINKPICKER_HEIGHT_IN_PX, RECENT_SEARCH_HEIGHT_IN_PX, RECENT_SEARCH_WIDTH_IN_PX } from '@atlaskit/editor-common/ui';
9
9
  import { normalizeUrl } from '@atlaskit/editor-common/utils';
10
10
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
11
- import LinkBrokenIcon from '@atlaskit/icon/core/link-broken';
12
- import LinkExternalIcon from '@atlaskit/icon/core/link-external';
13
- import UnlinkIcon from '@atlaskit/icon/glyph/editor/unlink';
14
- import OpenIcon from '@atlaskit/icon/glyph/shortcut';
11
+ import LinkBrokenIcon from '@atlaskit/icon/core/migration/link-broken--editor-unlink';
12
+ import LinkExternalIcon from '@atlaskit/icon/core/migration/link-external--shortcut';
15
13
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
16
14
  import { editInsertedLink, insertLinkWithAnalytics, onClickAwayCallback, onEscapeCallback, removeLink, updateLink } from '../../editor-commands/commands';
17
15
  import { stateKey } from '../../pm-plugins/main';
@@ -93,23 +91,21 @@ export const getToolbarConfig = (options, pluginInjectionApi) => (state, intl, p
93
91
  if (options.disableFloatingToolbar) {
94
92
  return;
95
93
  }
94
+ const linkState = stateKey.getState(state);
95
+ const activeLinkMark = linkState === null || linkState === void 0 ? void 0 : linkState.activeLinkMark;
96
96
 
97
97
  // If range selection, we don't show hyperlink floating toolbar.
98
98
  // Text Formattting toolbar is shown instaed.
99
- if (state.selection instanceof TextSelection && state.selection.to !== state.selection.from && editorExperiment('platform_editor_controls', 'variant1')) {
99
+ if (state.selection instanceof TextSelection && state.selection.to !== state.selection.from && (activeLinkMark === null || activeLinkMark === void 0 ? void 0 : activeLinkMark.type) === 'EDIT' && editorExperiment('platform_editor_controls', 'variant1')) {
100
100
  return;
101
101
  }
102
102
  const {
103
103
  formatMessage
104
104
  } = intl;
105
- const linkState = stateKey.getState(state);
106
105
  const editorCardActions = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c3 = pluginInjectionApi.card) === null || _pluginInjectionApi$c3 === void 0 ? void 0 : _pluginInjectionApi$c3.actions;
107
106
  const editorAnalyticsApi = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions;
108
107
  const lpLinkPicker = (_options$lpLinkPicker = options.lpLinkPicker) !== null && _options$lpLinkPicker !== void 0 ? _options$lpLinkPicker : true;
109
- if (linkState && linkState.activeLinkMark) {
110
- const {
111
- activeLinkMark
112
- } = linkState;
108
+ if (activeLinkMark) {
113
109
  const hyperLinkToolbar = {
114
110
  title: 'Hyperlink floating controls',
115
111
  nodeType: [state.schema.nodes.text, state.schema.nodes.paragraph, state.schema.nodes.heading, state.schema.nodes.taskItem, state.schema.nodes.decisionItem, state.schema.nodes.caption].filter(nodeType => !!nodeType),
@@ -161,7 +157,6 @@ export const getToolbarConfig = (options, pluginInjectionApi) => (state, intl, p
161
157
  onClick: visitHyperlink(editorAnalyticsApi),
162
158
  title: labelOpenLink,
163
159
  icon: LinkExternalIcon,
164
- iconFallback: OpenIcon,
165
160
  className: 'hyperlink-open-link',
166
161
  metadata: metadata,
167
162
  tabIndex: null
@@ -176,7 +171,6 @@ export const getToolbarConfig = (options, pluginInjectionApi) => (state, intl, p
176
171
  }),
177
172
  title: labelUnlink,
178
173
  icon: LinkBrokenIcon,
179
- iconFallback: UnlinkIcon,
180
174
  tabIndex: null
181
175
  }, {
182
176
  type: 'separator'
@@ -4,7 +4,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
4
4
  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) { _defineProperty(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; }
5
5
  import React, { useRef } from 'react';
6
6
  import { isSafeUrl } from '@atlaskit/adf-schema';
7
- import { ACTION, ACTION_SUBJECT_ID, buildVisitedLinkPayload, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
7
+ import { ACTION, ACTION_SUBJECT_ID, INPUT_METHOD, buildVisitedLinkPayload } from '@atlaskit/editor-common/analytics';
8
8
  import { commandWithMetadata } from '@atlaskit/editor-common/card';
9
9
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
10
10
  import { HyperlinkAddToolbar } from '@atlaskit/editor-common/link';
@@ -12,10 +12,8 @@ import { linkMessages, linkToolbarMessages as linkToolbarCommonMessages } from '
12
12
  import { LINKPICKER_HEIGHT_IN_PX, RECENT_SEARCH_HEIGHT_IN_PX, RECENT_SEARCH_WIDTH_IN_PX } from '@atlaskit/editor-common/ui';
13
13
  import { normalizeUrl } from '@atlaskit/editor-common/utils';
14
14
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
15
- import LinkBrokenIcon from '@atlaskit/icon/core/link-broken';
16
- import LinkExternalIcon from '@atlaskit/icon/core/link-external';
17
- import UnlinkIcon from '@atlaskit/icon/glyph/editor/unlink';
18
- import OpenIcon from '@atlaskit/icon/glyph/shortcut';
15
+ import LinkBrokenIcon from '@atlaskit/icon/core/migration/link-broken--editor-unlink';
16
+ import LinkExternalIcon from '@atlaskit/icon/core/migration/link-external--shortcut';
19
17
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
20
18
  import { editInsertedLink, insertLinkWithAnalytics, onClickAwayCallback, onEscapeCallback, removeLink, updateLink } from '../../editor-commands/commands';
21
19
  import { stateKey } from '../../pm-plugins/main';
@@ -99,19 +97,19 @@ export var getToolbarConfig = function getToolbarConfig(options, pluginInjection
99
97
  if (options.disableFloatingToolbar) {
100
98
  return;
101
99
  }
100
+ var linkState = stateKey.getState(state);
101
+ var activeLinkMark = linkState === null || linkState === void 0 ? void 0 : linkState.activeLinkMark;
102
102
 
103
103
  // If range selection, we don't show hyperlink floating toolbar.
104
104
  // Text Formattting toolbar is shown instaed.
105
- if (state.selection instanceof TextSelection && state.selection.to !== state.selection.from && editorExperiment('platform_editor_controls', 'variant1')) {
105
+ if (state.selection instanceof TextSelection && state.selection.to !== state.selection.from && (activeLinkMark === null || activeLinkMark === void 0 ? void 0 : activeLinkMark.type) === 'EDIT' && editorExperiment('platform_editor_controls', 'variant1')) {
106
106
  return;
107
107
  }
108
108
  var formatMessage = intl.formatMessage;
109
- var linkState = stateKey.getState(state);
110
109
  var editorCardActions = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c2 = pluginInjectionApi.card) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.actions;
111
110
  var editorAnalyticsApi = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions;
112
111
  var lpLinkPicker = (_options$lpLinkPicker = options.lpLinkPicker) !== null && _options$lpLinkPicker !== void 0 ? _options$lpLinkPicker : true;
113
- if (linkState && linkState.activeLinkMark) {
114
- var activeLinkMark = linkState.activeLinkMark;
112
+ if (activeLinkMark) {
115
113
  var hyperLinkToolbar = {
116
114
  title: 'Hyperlink floating controls',
117
115
  nodeType: [state.schema.nodes.text, state.schema.nodes.paragraph, state.schema.nodes.heading, state.schema.nodes.taskItem, state.schema.nodes.decisionItem, state.schema.nodes.caption].filter(function (nodeType) {
@@ -165,7 +163,6 @@ export var getToolbarConfig = function getToolbarConfig(options, pluginInjection
165
163
  onClick: visitHyperlink(editorAnalyticsApi),
166
164
  title: labelOpenLink,
167
165
  icon: LinkExternalIcon,
168
- iconFallback: OpenIcon,
169
166
  className: 'hyperlink-open-link',
170
167
  metadata: metadata,
171
168
  tabIndex: null
@@ -180,7 +177,6 @@ export var getToolbarConfig = function getToolbarConfig(options, pluginInjection
180
177
  }),
181
178
  title: labelUnlink,
182
179
  icon: LinkBrokenIcon,
183
- iconFallback: UnlinkIcon,
184
180
  tabIndex: null
185
181
  }, {
186
182
  type: 'separator'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-hyperlink",
3
- "version": "4.2.8",
3
+ "version": "4.3.0",
4
4
  "description": "Hyperlink plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -35,18 +35,18 @@
35
35
  "dependencies": {
36
36
  "@atlaskit/adf-schema": "^47.6.0",
37
37
  "@atlaskit/analytics-next": "^11.0.0",
38
- "@atlaskit/editor-common": "^102.8.0",
38
+ "@atlaskit/editor-common": "^102.11.0",
39
39
  "@atlaskit/editor-plugin-analytics": "^2.2.0",
40
40
  "@atlaskit/editor-plugin-card": "^5.3.0",
41
41
  "@atlaskit/editor-plugin-connectivity": "^2.0.0",
42
42
  "@atlaskit/editor-plugin-editor-viewmode": "^3.0.0",
43
43
  "@atlaskit/editor-plugin-primary-toolbar": "^3.0.0",
44
- "@atlaskit/editor-plugin-selection-toolbar": "^2.0.0",
44
+ "@atlaskit/editor-plugin-selection-toolbar": "^2.1.0",
45
45
  "@atlaskit/editor-prosemirror": "7.0.0",
46
46
  "@atlaskit/icon": "^25.0.0",
47
47
  "@atlaskit/platform-feature-flags": "^1.1.0",
48
48
  "@atlaskit/prosemirror-input-rules": "^3.3.0",
49
- "@atlaskit/tmp-editor-statsig": "^4.0.0",
49
+ "@atlaskit/tmp-editor-statsig": "^4.1.0",
50
50
  "@babel/runtime": "^7.0.0",
51
51
  "@emotion/react": "^11.7.1",
52
52
  "uuid": "^3.1.0"