@atlaskit/editor-plugin-hyperlink 4.2.8 → 4.2.9

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,14 @@
1
1
  # @atlaskit/editor-plugin-hyperlink
2
2
 
3
+ ## 4.2.9
4
+
5
+ ### Patch Changes
6
+
7
+ - [#128611](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/128611)
8
+ [`428548761fab9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/428548761fab9) -
9
+ [ux] ED-27133 fix toolbar link button
10
+ - Updated dependencies
11
+
3
12
  ## 4.2.8
4
13
 
5
14
  ### Patch Changes
@@ -109,19 +109,19 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(opti
109
109
  if (options.disableFloatingToolbar) {
110
110
  return;
111
111
  }
112
+ var linkState = _main.stateKey.getState(state);
113
+ var activeLinkMark = linkState === null || linkState === void 0 ? void 0 : linkState.activeLinkMark;
112
114
 
113
115
  // If range selection, we don't show hyperlink floating toolbar.
114
116
  // 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')) {
117
+ 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
118
  return;
117
119
  }
118
120
  var formatMessage = intl.formatMessage;
119
- var linkState = _main.stateKey.getState(state);
120
121
  var editorCardActions = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c2 = pluginInjectionApi.card) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.actions;
121
122
  var editorAnalyticsApi = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions;
122
123
  var lpLinkPicker = (_options$lpLinkPicker = options.lpLinkPicker) !== null && _options$lpLinkPicker !== void 0 ? _options$lpLinkPicker : true;
123
- if (linkState && linkState.activeLinkMark) {
124
- var activeLinkMark = linkState.activeLinkMark;
124
+ if (activeLinkMark) {
125
125
  var hyperLinkToolbar = {
126
126
  title: 'Hyperlink floating controls',
127
127
  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) {
@@ -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';
@@ -93,23 +93,21 @@ export const getToolbarConfig = (options, pluginInjectionApi) => (state, intl, p
93
93
  if (options.disableFloatingToolbar) {
94
94
  return;
95
95
  }
96
+ const linkState = stateKey.getState(state);
97
+ const activeLinkMark = linkState === null || linkState === void 0 ? void 0 : linkState.activeLinkMark;
96
98
 
97
99
  // If range selection, we don't show hyperlink floating toolbar.
98
100
  // Text Formattting toolbar is shown instaed.
99
- if (state.selection instanceof TextSelection && state.selection.to !== state.selection.from && editorExperiment('platform_editor_controls', 'variant1')) {
101
+ 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
102
  return;
101
103
  }
102
104
  const {
103
105
  formatMessage
104
106
  } = intl;
105
- const linkState = stateKey.getState(state);
106
107
  const editorCardActions = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c3 = pluginInjectionApi.card) === null || _pluginInjectionApi$c3 === void 0 ? void 0 : _pluginInjectionApi$c3.actions;
107
108
  const editorAnalyticsApi = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions;
108
109
  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;
110
+ if (activeLinkMark) {
113
111
  const hyperLinkToolbar = {
114
112
  title: 'Hyperlink floating controls',
115
113
  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),
@@ -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';
@@ -99,19 +99,19 @@ export var getToolbarConfig = function getToolbarConfig(options, pluginInjection
99
99
  if (options.disableFloatingToolbar) {
100
100
  return;
101
101
  }
102
+ var linkState = stateKey.getState(state);
103
+ var activeLinkMark = linkState === null || linkState === void 0 ? void 0 : linkState.activeLinkMark;
102
104
 
103
105
  // If range selection, we don't show hyperlink floating toolbar.
104
106
  // Text Formattting toolbar is shown instaed.
105
- if (state.selection instanceof TextSelection && state.selection.to !== state.selection.from && editorExperiment('platform_editor_controls', 'variant1')) {
107
+ 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
108
  return;
107
109
  }
108
110
  var formatMessage = intl.formatMessage;
109
- var linkState = stateKey.getState(state);
110
111
  var editorCardActions = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c2 = pluginInjectionApi.card) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.actions;
111
112
  var editorAnalyticsApi = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions;
112
113
  var lpLinkPicker = (_options$lpLinkPicker = options.lpLinkPicker) !== null && _options$lpLinkPicker !== void 0 ? _options$lpLinkPicker : true;
113
- if (linkState && linkState.activeLinkMark) {
114
- var activeLinkMark = linkState.activeLinkMark;
114
+ if (activeLinkMark) {
115
115
  var hyperLinkToolbar = {
116
116
  title: 'Hyperlink floating controls',
117
117
  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) {
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.2.9",
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.10.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"