@atlaskit/editor-plugin-hyperlink 18.0.7 → 18.1.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,24 @@
1
1
  # @atlaskit/editor-plugin-hyperlink
2
2
 
3
+ ## 18.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`bd2c5b0112185`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/bd2c5b0112185) -
8
+ Remove stale API report artifacts from published Platform packages.
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies
13
+
14
+ ## 18.0.8
15
+
16
+ ### Patch Changes
17
+
18
+ - [`6304662fbdf4a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6304662fbdf4a) -
19
+ Use the supported `createRoot` API when `platform_editor_react19_migration` is enabled.
20
+ - Updated dependencies
21
+
3
22
  ## 18.0.7
4
23
 
5
24
  ### Patch Changes
@@ -19,7 +19,7 @@ var _link2 = _interopRequireDefault(require("@atlaskit/icon/core/link"));
19
19
  var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
20
20
  var _fg = require("@atlaskit/platform-feature-flags/fg");
21
21
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
22
- var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
22
+ var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
23
23
  var _commands = require("./editor-commands/commands");
24
24
  var _fakeCursorForToolbar = _interopRequireDefault(require("./pm-plugins/fake-cursor-for-toolbar"));
25
25
  var _inputRule = require("./pm-plugins/input-rule");
@@ -199,7 +199,7 @@ var hyperlinkPlugin = exports.hyperlinkPlugin = function hyperlinkPlugin(_ref) {
199
199
  var _api$userPreferences, _api$selectionToolbar;
200
200
  var formatMessage = _ref5.formatMessage;
201
201
  var toolbarDocking = (0, _fg.fg)('platform_editor_use_preferences_plugin') ? api === null || api === void 0 || (_api$userPreferences = api.userPreferences) === null || _api$userPreferences === void 0 || (_api$userPreferences = _api$userPreferences.sharedState.currentState()) === null || _api$userPreferences === void 0 ? void 0 : _api$userPreferences.preferences.toolbarDockingPosition : api === null || api === void 0 || (_api$selectionToolbar = api.selectionToolbar) === null || _api$selectionToolbar === void 0 || (_api$selectionToolbar = _api$selectionToolbar.sharedState) === null || _api$selectionToolbar === void 0 || (_api$selectionToolbar = _api$selectionToolbar.currentState()) === null || _api$selectionToolbar === void 0 ? void 0 : _api$selectionToolbar.toolbarDocking;
202
- if (toolbarDocking === 'none' && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1', {
202
+ if (toolbarDocking === 'none' && (0, _editorExperiment.editorExperiment)('platform_editor_controls', 'variant1', {
203
203
  exposure: true
204
204
  })) {
205
205
  var toolbarButton = function toolbarButton() {
@@ -232,7 +232,7 @@ var hyperlinkPlugin = exports.hyperlinkPlugin = function hyperlinkPlugin(_ref) {
232
232
  }
233
233
  }
234
234
  }), !isToolbarAIFCEnabled && {
235
- primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1', {
235
+ primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) && (0, _editorExperiment.editorExperiment)('platform_editor_controls', 'variant1', {
236
236
  exposure: true
237
237
  }) ? primaryToolbarComponent : undefined
238
238
  })
@@ -10,12 +10,12 @@ var _reactDom = require("react-dom");
10
10
  var _client = require("react-dom/client");
11
11
  var _reactIntl = require("react-intl");
12
12
  var _link = require("@atlaskit/editor-common/link");
13
- var _fg = require("@atlaskit/platform-feature-flags/fg");
13
+ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
14
14
  var reactRoots = new WeakMap();
15
15
 
16
- /** Mounts `element` into `mountPoint`: uses the React 18/19 `createRoot` API when `nike_r19_render_unmount` is on, else the legacy render path. */
16
+ /** Mounts `element` into `mountPoint` using `createRoot` when the migration experiment is on. */
17
17
  var renderToMountPoint = function renderToMountPoint(element, mountPoint) {
18
- if ((0, _fg.fg)('nike_r19_render_unmount')) {
18
+ if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_react19_migration')) {
19
19
  var root = reactRoots.get(mountPoint);
20
20
  if (!root) {
21
21
  root = (0, _client.createRoot)(mountPoint);
@@ -26,7 +26,7 @@ var _utils2 = require("@atlaskit/editor-prosemirror/utils");
26
26
  var _edit = _interopRequireDefault(require("@atlaskit/icon/core/edit"));
27
27
  var _linkBroken = _interopRequireDefault(require("@atlaskit/icon/core/link-broken"));
28
28
  var _linkExternal = _interopRequireDefault(require("@atlaskit/icon/core/link-external"));
29
- var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
29
+ var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
30
30
  var _commands = require("../../editor-commands/commands");
31
31
  var _main = require("../../pm-plugins/main");
32
32
  var _toolbarButtons = require("../../pm-plugins/toolbar-buttons");
@@ -128,7 +128,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(opti
128
128
 
129
129
  // If range selection, we don't show hyperlink floating toolbar.
130
130
  // Text Formattting toolbar is shown instaed.
131
- 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')) {
131
+ if (state.selection instanceof _state.TextSelection && state.selection.to !== state.selection.from && (activeLinkMark === null || activeLinkMark === void 0 ? void 0 : activeLinkMark.type) === 'EDIT' && (0, _editorExperiment.editorExperiment)('platform_editor_controls', 'variant1')) {
132
132
  return;
133
133
  }
134
134
  var formatMessage = intl.formatMessage;
@@ -147,7 +147,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(opti
147
147
  // getDomRef by default uses view.state.selection.from to position the toolbar.
148
148
  // However, when the user clicks in right after the link the view.state.selection.from references to the dom after the selection.
149
149
  // So instead we want to use the activeLinkMark.pos which has been calculated as the position before the click so that would be the link node
150
- getDomRef: activeLinkMark && (activeLinkMark.type === 'EDIT_INSERTED' || activeLinkMark.type === 'EDIT') && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? function (view) {
150
+ getDomRef: activeLinkMark && (activeLinkMark.type === 'EDIT_INSERTED' || activeLinkMark.type === 'EDIT') && (0, _editorExperiment.editorExperiment)('platform_editor_controls', 'variant1') ? function (view) {
151
151
  var domRef = (0, _utils2.findDomRefAtPos)(activeLinkMark.pos, view.domAtPos.bind(view));
152
152
  return domRef instanceof HTMLElement ? domRef : undefined;
153
153
  } : undefined
@@ -11,7 +11,7 @@ import LinkIcon from '@atlaskit/icon/core/link';
11
11
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
12
12
  import { fg } from '@atlaskit/platform-feature-flags/fg';
13
13
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
14
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
14
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
15
15
  import { hideLinkToolbarSetMeta, insertLinkWithAnalytics, removeLinkEditorCommand, showLinkToolbar, updateLink, updateLinkEditorCommand } from './editor-commands/commands';
16
16
  import fakeCursorToolbarPlugin from './pm-plugins/fake-cursor-for-toolbar';
17
17
  import { createInputRulePlugin } from './pm-plugins/input-rule';
@@ -3,12 +3,12 @@ import { render } from 'react-dom';
3
3
  import { createRoot } from 'react-dom/client';
4
4
  import { IntlProvider } from 'react-intl';
5
5
  import { LinkAction, OverlayButton } from '@atlaskit/editor-common/link';
6
- import { fg } from '@atlaskit/platform-feature-flags/fg';
6
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
7
7
  const reactRoots = new WeakMap();
8
8
 
9
- /** Mounts `element` into `mountPoint`: uses the React 18/19 `createRoot` API when `nike_r19_render_unmount` is on, else the legacy render path. */
9
+ /** Mounts `element` into `mountPoint` using `createRoot` when the migration experiment is on. */
10
10
  const renderToMountPoint = (element, mountPoint) => {
11
- if (fg('nike_r19_render_unmount')) {
11
+ if (isExperimentEnabled('platform_editor_react19_migration')) {
12
12
  let root = reactRoots.get(mountPoint);
13
13
  if (!root) {
14
14
  root = createRoot(mountPoint);
@@ -15,7 +15,7 @@ import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
15
15
  import EditIcon from '@atlaskit/icon/core/edit';
16
16
  import LinkBrokenIcon from '@atlaskit/icon/core/link-broken';
17
17
  import LinkExternalIcon from '@atlaskit/icon/core/link-external';
18
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
18
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
19
19
  import { editInsertedLink, insertLinkWithAnalytics, onClickAwayCallback, onEscapeCallback, removeLink, updateLink } from '../../editor-commands/commands';
20
20
  import { stateKey } from '../../pm-plugins/main';
21
21
  import { toolbarKey } from '../../pm-plugins/toolbar-buttons';
@@ -14,7 +14,7 @@ import LinkIcon from '@atlaskit/icon/core/link';
14
14
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
15
15
  import { fg } from '@atlaskit/platform-feature-flags/fg';
16
16
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
17
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
17
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
18
18
  import { hideLinkToolbarSetMeta, insertLinkWithAnalytics, removeLinkEditorCommand, showLinkToolbar as _showLinkToolbar, updateLink, updateLinkEditorCommand } from './editor-commands/commands';
19
19
  import fakeCursorToolbarPlugin from './pm-plugins/fake-cursor-for-toolbar';
20
20
  import { createInputRulePlugin } from './pm-plugins/input-rule';
@@ -3,12 +3,12 @@ import { render } from 'react-dom';
3
3
  import { createRoot } from 'react-dom/client';
4
4
  import { IntlProvider } from 'react-intl';
5
5
  import { LinkAction, OverlayButton } from '@atlaskit/editor-common/link';
6
- import { fg } from '@atlaskit/platform-feature-flags/fg';
6
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
7
7
  var reactRoots = new WeakMap();
8
8
 
9
- /** Mounts `element` into `mountPoint`: uses the React 18/19 `createRoot` API when `nike_r19_render_unmount` is on, else the legacy render path. */
9
+ /** Mounts `element` into `mountPoint` using `createRoot` when the migration experiment is on. */
10
10
  var renderToMountPoint = function renderToMountPoint(element, mountPoint) {
11
- if (fg('nike_r19_render_unmount')) {
11
+ if (isExperimentEnabled('platform_editor_react19_migration')) {
12
12
  var root = reactRoots.get(mountPoint);
13
13
  if (!root) {
14
14
  root = createRoot(mountPoint);
@@ -19,7 +19,7 @@ import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
19
19
  import EditIcon from '@atlaskit/icon/core/edit';
20
20
  import LinkBrokenIcon from '@atlaskit/icon/core/link-broken';
21
21
  import LinkExternalIcon from '@atlaskit/icon/core/link-external';
22
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
22
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
23
23
  import { editInsertedLink, insertLinkWithAnalytics, onClickAwayCallback, onEscapeCallback, removeLink, updateLink } from '../../editor-commands/commands';
24
24
  import { stateKey } from '../../pm-plugins/main';
25
25
  import { toolbarKey } from '../../pm-plugins/toolbar-buttons';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-hyperlink",
3
- "version": "18.0.7",
3
+ "version": "18.1.0",
4
4
  "description": "Hyperlink plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -22,13 +22,13 @@
22
22
  "atlaskit:src": "src/index.ts",
23
23
  "dependencies": {
24
24
  "@atlaskit/adf-schema": "^57.2.0",
25
- "@atlaskit/analytics-next": "^12.4.0",
26
- "@atlaskit/editor-plugin-analytics": "^16.0.0",
27
- "@atlaskit/editor-plugin-card": "^22.0.0",
25
+ "@atlaskit/analytics-next": "^12.5.0",
26
+ "@atlaskit/editor-plugin-analytics": "^16.1.0",
27
+ "@atlaskit/editor-plugin-card": "^22.1.0",
28
28
  "@atlaskit/editor-plugin-connectivity": "^16.0.0",
29
29
  "@atlaskit/editor-plugin-editor-viewmode": "^18.0.0",
30
30
  "@atlaskit/editor-plugin-primary-toolbar": "^17.0.0",
31
- "@atlaskit/editor-plugin-selection-toolbar": "^17.0.0",
31
+ "@atlaskit/editor-plugin-selection-toolbar": "^17.1.0",
32
32
  "@atlaskit/editor-plugin-toolbar": "^13.0.0",
33
33
  "@atlaskit/editor-plugin-ui-control-registry": "^10.0.0",
34
34
  "@atlaskit/editor-plugin-user-intent": "^14.0.0",
@@ -36,17 +36,17 @@
36
36
  "@atlaskit/editor-toolbar": "^2.6.0",
37
37
  "@atlaskit/editor-toolbar-model": "^1.2.0",
38
38
  "@atlaskit/editor-ui-control-model": "^2.9.0",
39
- "@atlaskit/icon": "^37.5.0",
39
+ "@atlaskit/icon": "^37.6.0",
40
40
  "@atlaskit/platform-feature-experiments": "^0.3.0",
41
- "@atlaskit/platform-feature-flags": "^2.1.0",
42
- "@atlaskit/prosemirror-input-rules": "^4.0.0",
43
- "@atlaskit/tmp-editor-statsig": "^167.0.0",
41
+ "@atlaskit/platform-feature-flags": "^2.2.0",
42
+ "@atlaskit/prosemirror-input-rules": "^4.1.0",
43
+ "@atlaskit/tmp-editor-statsig": "^168.0.0",
44
44
  "@babel/runtime": "^7.0.0",
45
45
  "@emotion/react": "^11.7.1",
46
46
  "uuid": "^3.1.0"
47
47
  },
48
48
  "peerDependencies": {
49
- "@atlaskit/editor-common": "^120.7.0",
49
+ "@atlaskit/editor-common": "^120.9.0",
50
50
  "react": "^18.2.0 || ^19.2.0",
51
51
  "react-dom": "^18.2.0 || ^19.2.0",
52
52
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
@@ -95,9 +95,6 @@
95
95
  "platform-feature-flags": {
96
96
  "platform_editor_use_preferences_plugin": {
97
97
  "type": "boolean"
98
- },
99
- "nike_r19_render_unmount": {
100
- "type": "boolean"
101
98
  }
102
99
  }
103
100
  }
package/report.api.md DELETED
@@ -1,126 +0,0 @@
1
- <!-- API Report Version: 2.3 -->
2
-
3
- ## API Report File for "@atlaskit/editor-plugin-hyperlink"
4
-
5
- > Do not edit this file. This report is auto-generated using
6
- > [API Extractor](https://api-extractor.com/).
7
- > [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
8
-
9
- ### Table of contents
10
-
11
- - [Main Entry Types](#main-entry-types)
12
- - [Peer Dependencies](#peer-dependencies)
13
-
14
- ### Main Entry Types
15
-
16
- <!--SECTION START: Main Entry Types-->
17
-
18
- ```ts
19
- import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
20
- import type { Command } from '@atlaskit/editor-common/types';
21
- import type { EditorCommand } from '@atlaskit/editor-common/types';
22
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
23
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
24
- import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
25
- import type { FloatingToolbarItem } from '@atlaskit/editor-common/types';
26
- import type { HyperlinkPluginOptions } from '@atlaskit/editor-common/types';
27
- import type { HyperlinkState } from '@atlaskit/editor-common/link';
28
- import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
29
- import type { IntlShape } from 'react-intl';
30
- import type { LinkInputType } from '@atlaskit/editor-common/types';
31
- import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
32
- import type { OptionalPlugin } from '@atlaskit/editor-common/types';
33
- import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
34
- import type { QueueCardsFromTransactionAction } from '@atlaskit/editor-common/card';
35
- import type { Transaction } from '@atlaskit/editor-prosemirror/state';
36
- import type { UIAnalyticsEvent } from '@atlaskit/analytics-next';
37
-
38
- // @public (undocumented)
39
- type GetToolbarItems = (
40
- state: EditorState,
41
- intl: IntlShape,
42
- providerFactory: ProviderFactory,
43
- link: string,
44
- ) => FloatingToolbarItem<any>[];
45
-
46
- // @public (undocumented)
47
- export type HideLinkToolbar = (tr: Transaction) => Transaction;
48
-
49
- // @public (undocumented)
50
- export type HyperlinkPlugin = NextEditorPlugin<
51
- 'hyperlink',
52
- {
53
- pluginConfiguration: HyperlinkPluginOptions | undefined;
54
- dependencies: [OptionalPlugin<FeatureFlagsPlugin>, OptionalPlugin<AnalyticsPlugin>];
55
- actions: {
56
- prependToolbarButtons: PrependToolbarButtons;
57
- hideLinkToolbar: HideLinkToolbar;
58
- insertLink: InsertLink;
59
- updateLink: UpdateLink;
60
- };
61
- commands: {
62
- showLinkToolbar: ShowLinkToolbar;
63
- };
64
- sharedState: HyperlinkState | undefined;
65
- }
66
- >;
67
-
68
- // @public
69
- export const hyperlinkPlugin: HyperlinkPlugin;
70
-
71
- // @public (undocumented)
72
- type HyperlinkToolbarItemsState = {
73
- items: GetToolbarItems;
74
- };
75
-
76
- // @public (undocumented)
77
- type InputMethod =
78
- | INPUT_METHOD.INSERT_MENU
79
- | INPUT_METHOD.QUICK_INSERT
80
- | INPUT_METHOD.SHORTCUT
81
- | INPUT_METHOD.TOOLBAR;
82
-
83
- // @public (undocumented)
84
- export type InsertLink = (
85
- inputMethod: LinkInputType,
86
- from: number,
87
- to: number,
88
- href: string,
89
- title?: string,
90
- displayText?: string,
91
- cardsAvailable?: boolean,
92
- sourceEvent?: UIAnalyticsEvent | null | undefined,
93
- ) => Command;
94
-
95
- // @public (undocumented)
96
- export type PrependToolbarButtons = (props: PrependToolbarButtonsProps) => void;
97
-
98
- // @public (undocumented)
99
- interface PrependToolbarButtonsProps extends HyperlinkToolbarItemsState {
100
- // (undocumented)
101
- view: EditorView;
102
- }
103
-
104
- // @public (undocumented)
105
- export type ShowLinkToolbar = (inputMethod: InputMethod) => EditorCommand;
106
-
107
- // @public (undocumented)
108
- export type UpdateLink = (href: string, text: string, pos: number, to?: number) => Command;
109
-
110
- // (No @packageDocumentation comment for this package)
111
- ```
112
-
113
- <!--SECTION END: Main Entry Types-->
114
-
115
- ### Peer Dependencies
116
-
117
- <!--SECTION START: Peer Dependencies-->
118
-
119
- ```json
120
- {
121
- "react": "^16.8.0",
122
- "react-intl": "npm:react-intl@^5.18.1"
123
- }
124
- ```
125
-
126
- <!--SECTION END: Peer Dependencies-->