@atlaskit/editor-plugin-hyperlink 4.4.0 → 4.4.2
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 +14 -0
- package/dist/cjs/editor-commands/commands.js +5 -14
- package/dist/cjs/hyperlinkPlugin.js +2 -1
- package/dist/es2019/editor-commands/commands.js +5 -14
- package/dist/es2019/hyperlinkPlugin.js +2 -1
- package/dist/esm/editor-commands/commands.js +5 -14
- package/dist/esm/hyperlinkPlugin.js +2 -1
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-hyperlink
|
|
2
2
|
|
|
3
|
+
## 4.4.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#150122](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/150122)
|
|
8
|
+
[`92cc72b849cd4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/92cc72b849cd4) -
|
|
9
|
+
EDITOR-705 - cleanup FG platform_editor_update_insert_link_mark_end_pos
|
|
10
|
+
|
|
11
|
+
## 4.4.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 4.4.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
|
@@ -23,7 +23,6 @@ var _link = require("@atlaskit/editor-common/link");
|
|
|
23
23
|
var _preset = require("@atlaskit/editor-common/preset");
|
|
24
24
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
25
25
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
26
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
27
26
|
var _main = require("../pm-plugins/main");
|
|
28
27
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
29
28
|
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) { (0, _defineProperty2.default)(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; }
|
|
@@ -113,20 +112,12 @@ function insertLink(from, to, incomingHref, incomingTitle, displayText, source,
|
|
|
113
112
|
var _text = displayText || incomingTitle || incomingHref;
|
|
114
113
|
if (!displayText || displayText !== currentText) {
|
|
115
114
|
tr.insertText(_text, from, to);
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
markEnd = from + _text.length + 1;
|
|
121
|
-
} else {
|
|
122
|
-
markEnd = from + _text.length;
|
|
123
|
-
}
|
|
115
|
+
// new block created to wrap the link
|
|
116
|
+
if (tr.mapping.map(from) === from + _text.length + 2) {
|
|
117
|
+
// +1 is for the block's opening tag
|
|
118
|
+
markEnd = from + _text.length + 1;
|
|
124
119
|
} else {
|
|
125
|
-
|
|
126
|
-
markEnd = from + _text.length + 1;
|
|
127
|
-
} else {
|
|
128
|
-
markEnd = from + _text.length;
|
|
129
|
-
}
|
|
120
|
+
markEnd = from + _text.length;
|
|
130
121
|
}
|
|
131
122
|
}
|
|
132
123
|
tr.addMark(from, markEnd, link.create({
|
|
@@ -15,6 +15,7 @@ var _preset = require("@atlaskit/editor-common/preset");
|
|
|
15
15
|
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
16
16
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
17
17
|
var _linkEditorLink = _interopRequireDefault(require("@atlaskit/icon/core/migration/link--editor-link"));
|
|
18
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
18
19
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
19
20
|
var _commands = require("./editor-commands/commands");
|
|
20
21
|
var _fakeCursorForToolbar = _interopRequireDefault(require("./pm-plugins/fake-cursor-for-toolbar"));
|
|
@@ -49,7 +50,7 @@ var hyperlinkPlugin = exports.hyperlinkPlugin = function hyperlinkPlugin(_ref) {
|
|
|
49
50
|
var primaryToolbarComponent;
|
|
50
51
|
if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1', {
|
|
51
52
|
exposure: true
|
|
52
|
-
})) {
|
|
53
|
+
}) && !(0, _platformFeatureFlags.fg)('platform_editor_insert_button_on_primary_toolbar')) {
|
|
53
54
|
var _api$primaryToolbar;
|
|
54
55
|
primaryToolbarComponent = function primaryToolbarComponent() {
|
|
55
56
|
var _api$analytics;
|
|
@@ -5,7 +5,6 @@ import { isTextAtPos, LinkAction } from '@atlaskit/editor-common/link';
|
|
|
5
5
|
import { editorCommandToPMCommand } from '@atlaskit/editor-common/preset';
|
|
6
6
|
import { getLinkCreationAnalyticsEvent, normalizeUrl } from '@atlaskit/editor-common/utils';
|
|
7
7
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
8
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
8
|
import { stateKey } from '../pm-plugins/main';
|
|
10
9
|
function setLinkHrefEditorCommand(href, pos, editorAnalyticsApi, to, isTabPressed) {
|
|
11
10
|
return ({
|
|
@@ -97,20 +96,12 @@ export function insertLink(from, to, incomingHref, incomingTitle, displayText, s
|
|
|
97
96
|
const text = displayText || incomingTitle || incomingHref;
|
|
98
97
|
if (!displayText || displayText !== currentText) {
|
|
99
98
|
tr.insertText(text, from, to);
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
markEnd = from + text.length + 1;
|
|
105
|
-
} else {
|
|
106
|
-
markEnd = from + text.length;
|
|
107
|
-
}
|
|
99
|
+
// new block created to wrap the link
|
|
100
|
+
if (tr.mapping.map(from) === from + text.length + 2) {
|
|
101
|
+
// +1 is for the block's opening tag
|
|
102
|
+
markEnd = from + text.length + 1;
|
|
108
103
|
} else {
|
|
109
|
-
|
|
110
|
-
markEnd = from + text.length + 1;
|
|
111
|
-
} else {
|
|
112
|
-
markEnd = from + text.length;
|
|
113
|
-
}
|
|
104
|
+
markEnd = from + text.length;
|
|
114
105
|
}
|
|
115
106
|
}
|
|
116
107
|
tr.addMark(from, markEnd, link.create({
|
|
@@ -8,6 +8,7 @@ import { editorCommandToPMCommand } from '@atlaskit/editor-common/preset';
|
|
|
8
8
|
import { IconLink } from '@atlaskit/editor-common/quick-insert';
|
|
9
9
|
import { canLinkBeCreatedInRange } from '@atlaskit/editor-common/utils';
|
|
10
10
|
import LinkIcon from '@atlaskit/icon/core/migration/link--editor-link';
|
|
11
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
12
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
12
13
|
import { hideLinkToolbarSetMeta, insertLinkWithAnalytics, removeLinkEditorCommand, showLinkToolbar, updateLink, updateLinkEditorCommand } from './editor-commands/commands';
|
|
13
14
|
import fakeCursorToolbarPlugin from './pm-plugins/fake-cursor-for-toolbar';
|
|
@@ -42,7 +43,7 @@ export const hyperlinkPlugin = ({
|
|
|
42
43
|
let primaryToolbarComponent;
|
|
43
44
|
if (editorExperiment('platform_editor_controls', 'variant1', {
|
|
44
45
|
exposure: true
|
|
45
|
-
})) {
|
|
46
|
+
}) && !fg('platform_editor_insert_button_on_primary_toolbar')) {
|
|
46
47
|
var _api$primaryToolbar;
|
|
47
48
|
primaryToolbarComponent = () => {
|
|
48
49
|
var _api$analytics;
|
|
@@ -8,7 +8,6 @@ import { isTextAtPos, LinkAction } from '@atlaskit/editor-common/link';
|
|
|
8
8
|
import { editorCommandToPMCommand } from '@atlaskit/editor-common/preset';
|
|
9
9
|
import { getLinkCreationAnalyticsEvent, normalizeUrl } from '@atlaskit/editor-common/utils';
|
|
10
10
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
11
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
11
|
import { stateKey } from '../pm-plugins/main';
|
|
13
12
|
function setLinkHrefEditorCommand(href, pos, editorAnalyticsApi, to, isTabPressed) {
|
|
14
13
|
return function (_ref) {
|
|
@@ -96,20 +95,12 @@ export function insertLink(from, to, incomingHref, incomingTitle, displayText, s
|
|
|
96
95
|
var _text = displayText || incomingTitle || incomingHref;
|
|
97
96
|
if (!displayText || displayText !== currentText) {
|
|
98
97
|
tr.insertText(_text, from, to);
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
markEnd = from + _text.length + 1;
|
|
104
|
-
} else {
|
|
105
|
-
markEnd = from + _text.length;
|
|
106
|
-
}
|
|
98
|
+
// new block created to wrap the link
|
|
99
|
+
if (tr.mapping.map(from) === from + _text.length + 2) {
|
|
100
|
+
// +1 is for the block's opening tag
|
|
101
|
+
markEnd = from + _text.length + 1;
|
|
107
102
|
} else {
|
|
108
|
-
|
|
109
|
-
markEnd = from + _text.length + 1;
|
|
110
|
-
} else {
|
|
111
|
-
markEnd = from + _text.length;
|
|
112
|
-
}
|
|
103
|
+
markEnd = from + _text.length;
|
|
113
104
|
}
|
|
114
105
|
}
|
|
115
106
|
tr.addMark(from, markEnd, link.create({
|
|
@@ -8,6 +8,7 @@ import { editorCommandToPMCommand } from '@atlaskit/editor-common/preset';
|
|
|
8
8
|
import { IconLink } from '@atlaskit/editor-common/quick-insert';
|
|
9
9
|
import { canLinkBeCreatedInRange } from '@atlaskit/editor-common/utils';
|
|
10
10
|
import LinkIcon from '@atlaskit/icon/core/migration/link--editor-link';
|
|
11
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
12
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
12
13
|
import { hideLinkToolbarSetMeta, insertLinkWithAnalytics, removeLinkEditorCommand, showLinkToolbar as _showLinkToolbar, updateLink, updateLinkEditorCommand } from './editor-commands/commands';
|
|
13
14
|
import fakeCursorToolbarPlugin from './pm-plugins/fake-cursor-for-toolbar';
|
|
@@ -42,7 +43,7 @@ export var hyperlinkPlugin = function hyperlinkPlugin(_ref) {
|
|
|
42
43
|
var primaryToolbarComponent;
|
|
43
44
|
if (editorExperiment('platform_editor_controls', 'variant1', {
|
|
44
45
|
exposure: true
|
|
45
|
-
})) {
|
|
46
|
+
}) && !fg('platform_editor_insert_button_on_primary_toolbar')) {
|
|
46
47
|
var _api$primaryToolbar;
|
|
47
48
|
primaryToolbarComponent = function primaryToolbarComponent() {
|
|
48
49
|
var _api$analytics;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-hyperlink",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.2",
|
|
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": "^
|
|
38
|
+
"@atlaskit/editor-common": "^104.1.0",
|
|
39
39
|
"@atlaskit/editor-plugin-analytics": "^2.2.0",
|
|
40
40
|
"@atlaskit/editor-plugin-card": "^5.4.0",
|
|
41
41
|
"@atlaskit/editor-plugin-connectivity": "^2.0.0",
|
|
42
42
|
"@atlaskit/editor-plugin-editor-viewmode": "^3.1.0",
|
|
43
43
|
"@atlaskit/editor-plugin-primary-toolbar": "^3.2.0",
|
|
44
|
-
"@atlaskit/editor-plugin-selection-toolbar": "^3.
|
|
44
|
+
"@atlaskit/editor-plugin-selection-toolbar": "^3.6.0",
|
|
45
45
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
46
|
-
"@atlaskit/icon": "^25.
|
|
46
|
+
"@atlaskit/icon": "^25.7.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.
|
|
49
|
+
"@atlaskit/tmp-editor-statsig": "^4.18.0",
|
|
50
50
|
"@babel/runtime": "^7.0.0",
|
|
51
51
|
"@emotion/react": "^11.7.1",
|
|
52
52
|
"uuid": "^3.1.0"
|
|
@@ -59,10 +59,10 @@
|
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@atlaskit/activity-provider": "^2.5.0",
|
|
61
61
|
"@atlaskit/link-test-helpers": "^8.0.0",
|
|
62
|
-
"@atlaskit/media-test-helpers": "^
|
|
63
|
-
"@atlaskit/ssr": "
|
|
62
|
+
"@atlaskit/media-test-helpers": "^36.0.0",
|
|
63
|
+
"@atlaskit/ssr": "workspace:^",
|
|
64
64
|
"@atlaskit/util-data-test": "^18.0.0",
|
|
65
|
-
"@atlaskit/visual-regression": "
|
|
65
|
+
"@atlaskit/visual-regression": "workspace:^",
|
|
66
66
|
"@testing-library/react": "^13.4.0",
|
|
67
67
|
"raf-stub": "^2.0.1",
|
|
68
68
|
"typescript": "~5.4.2",
|
|
@@ -102,10 +102,10 @@
|
|
|
102
102
|
}
|
|
103
103
|
},
|
|
104
104
|
"platform-feature-flags": {
|
|
105
|
-
"
|
|
105
|
+
"linking_platform_smart_links_in_live_pages": {
|
|
106
106
|
"type": "boolean"
|
|
107
107
|
},
|
|
108
|
-
"
|
|
108
|
+
"platform_editor_insert_button_on_primary_toolbar": {
|
|
109
109
|
"type": "boolean"
|
|
110
110
|
},
|
|
111
111
|
"platform_editor_controls_patch_3": {
|