@atlaskit/editor-plugin-hyperlink 4.2.3 → 4.2.4
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 +9 -0
- package/dist/cjs/editor-commands/commands.js +14 -3
- package/dist/cjs/ui/toolbar/Toolbar.js +1 -1
- package/dist/es2019/editor-commands/commands.js +14 -3
- package/dist/es2019/ui/PrimaryToolbarComponent.js +1 -1
- package/dist/es2019/ui/toolbar/Toolbar.js +1 -1
- package/dist/esm/editor-commands/commands.js +14 -3
- package/dist/esm/ui/toolbar/Toolbar.js +1 -1
- package/package.json +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-hyperlink
|
|
2
2
|
|
|
3
|
+
## 4.2.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#121182](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/121182)
|
|
8
|
+
[`224d725203e16`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/224d725203e16) -
|
|
9
|
+
[ux] EDF-2445 - Link added via cmd-k above a inline comment will be decorated by the inline
|
|
10
|
+
comment under FG platform_editor_update_insert_link_mark_end_pos
|
|
11
|
+
|
|
3
12
|
## 4.2.3
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -23,6 +23,7 @@ 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");
|
|
26
27
|
var _main = require("../pm-plugins/main");
|
|
27
28
|
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; }
|
|
28
29
|
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; }
|
|
@@ -112,10 +113,20 @@ function insertLink(from, to, incomingHref, incomingTitle, displayText, source,
|
|
|
112
113
|
var _text = displayText || incomingTitle || incomingHref;
|
|
113
114
|
if (!displayText || displayText !== currentText) {
|
|
114
115
|
tr.insertText(_text, from, to);
|
|
115
|
-
if (
|
|
116
|
-
|
|
116
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_update_insert_link_mark_end_pos')) {
|
|
117
|
+
// new block created to wrap the link
|
|
118
|
+
if (tr.mapping.map(from) === from + _text.length + 2) {
|
|
119
|
+
// +1 is for the block's opening tag
|
|
120
|
+
markEnd = from + _text.length + 1;
|
|
121
|
+
} else {
|
|
122
|
+
markEnd = from + _text.length;
|
|
123
|
+
}
|
|
117
124
|
} else {
|
|
118
|
-
|
|
125
|
+
if (!(0, _link.isTextAtPos)(from)(state)) {
|
|
126
|
+
markEnd = from + _text.length + 1;
|
|
127
|
+
} else {
|
|
128
|
+
markEnd = from + _text.length;
|
|
129
|
+
}
|
|
119
130
|
}
|
|
120
131
|
}
|
|
121
132
|
tr.addMark(from, markEnd, link.create({
|
|
@@ -136,7 +136,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(opti
|
|
|
136
136
|
var link = linkMark[0] && linkMark[0].attrs.href;
|
|
137
137
|
var isValidUrl = (0, _adfSchema.isSafeUrl)(link);
|
|
138
138
|
var labelOpenLink = formatMessage(isValidUrl ? _messages.linkMessages.openLink : _messages.linkToolbarMessages.unableToOpenLink);
|
|
139
|
-
// TODO: ED-14403 investigate why these are not translating?
|
|
139
|
+
// TODO: ED-14403 - investigate why these are not translating?
|
|
140
140
|
var labelUnlink = formatMessage(_messages.linkToolbarMessages.unlink);
|
|
141
141
|
var editLink = formatMessage(_messages.linkToolbarMessages.editLink);
|
|
142
142
|
var metadata = {
|
|
@@ -5,6 +5,7 @@ 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';
|
|
8
9
|
import { stateKey } from '../pm-plugins/main';
|
|
9
10
|
function setLinkHrefEditorCommand(href, pos, editorAnalyticsApi, to, isTabPressed) {
|
|
10
11
|
return ({
|
|
@@ -96,10 +97,20 @@ export function insertLink(from, to, incomingHref, incomingTitle, displayText, s
|
|
|
96
97
|
const text = displayText || incomingTitle || incomingHref;
|
|
97
98
|
if (!displayText || displayText !== currentText) {
|
|
98
99
|
tr.insertText(text, from, to);
|
|
99
|
-
if (
|
|
100
|
-
|
|
100
|
+
if (fg('platform_editor_update_insert_link_mark_end_pos')) {
|
|
101
|
+
// new block created to wrap the link
|
|
102
|
+
if (tr.mapping.map(from) === from + text.length + 2) {
|
|
103
|
+
// +1 is for the block's opening tag
|
|
104
|
+
markEnd = from + text.length + 1;
|
|
105
|
+
} else {
|
|
106
|
+
markEnd = from + text.length;
|
|
107
|
+
}
|
|
101
108
|
} else {
|
|
102
|
-
|
|
109
|
+
if (!isTextAtPos(from)(state)) {
|
|
110
|
+
markEnd = from + text.length + 1;
|
|
111
|
+
} else {
|
|
112
|
+
markEnd = from + text.length;
|
|
113
|
+
}
|
|
103
114
|
}
|
|
104
115
|
}
|
|
105
116
|
tr.addMark(from, markEnd, link.create({
|
|
@@ -15,7 +15,7 @@ import { ToolbarButton } from '@atlaskit/editor-common/ui-menu';
|
|
|
15
15
|
import LinkIcon from '@atlaskit/icon/core/link';
|
|
16
16
|
const PrimaryToolbarComponentWithIntl = ({
|
|
17
17
|
api,
|
|
18
|
-
// TODO - Analytics
|
|
18
|
+
// TODO: ED-26959 - Analytics
|
|
19
19
|
// editorAnalyticsAPI,
|
|
20
20
|
intl
|
|
21
21
|
}) => {
|
|
@@ -122,7 +122,7 @@ export const getToolbarConfig = (options, pluginInjectionApi) => (state, intl, p
|
|
|
122
122
|
const link = linkMark[0] && linkMark[0].attrs.href;
|
|
123
123
|
const isValidUrl = isSafeUrl(link);
|
|
124
124
|
const labelOpenLink = formatMessage(isValidUrl ? linkMessages.openLink : linkToolbarCommonMessages.unableToOpenLink);
|
|
125
|
-
// TODO: ED-14403 investigate why these are not translating?
|
|
125
|
+
// TODO: ED-14403 - investigate why these are not translating?
|
|
126
126
|
const labelUnlink = formatMessage(linkToolbarCommonMessages.unlink);
|
|
127
127
|
const editLink = formatMessage(linkToolbarCommonMessages.editLink);
|
|
128
128
|
const metadata = {
|
|
@@ -8,6 +8,7 @@ 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';
|
|
11
12
|
import { stateKey } from '../pm-plugins/main';
|
|
12
13
|
function setLinkHrefEditorCommand(href, pos, editorAnalyticsApi, to, isTabPressed) {
|
|
13
14
|
return function (_ref) {
|
|
@@ -95,10 +96,20 @@ export function insertLink(from, to, incomingHref, incomingTitle, displayText, s
|
|
|
95
96
|
var _text = displayText || incomingTitle || incomingHref;
|
|
96
97
|
if (!displayText || displayText !== currentText) {
|
|
97
98
|
tr.insertText(_text, from, to);
|
|
98
|
-
if (
|
|
99
|
-
|
|
99
|
+
if (fg('platform_editor_update_insert_link_mark_end_pos')) {
|
|
100
|
+
// new block created to wrap the link
|
|
101
|
+
if (tr.mapping.map(from) === from + _text.length + 2) {
|
|
102
|
+
// +1 is for the block's opening tag
|
|
103
|
+
markEnd = from + _text.length + 1;
|
|
104
|
+
} else {
|
|
105
|
+
markEnd = from + _text.length;
|
|
106
|
+
}
|
|
100
107
|
} else {
|
|
101
|
-
|
|
108
|
+
if (!isTextAtPos(from)(state)) {
|
|
109
|
+
markEnd = from + _text.length + 1;
|
|
110
|
+
} else {
|
|
111
|
+
markEnd = from + _text.length;
|
|
112
|
+
}
|
|
102
113
|
}
|
|
103
114
|
}
|
|
104
115
|
tr.addMark(from, markEnd, link.create({
|
|
@@ -126,7 +126,7 @@ export var getToolbarConfig = function getToolbarConfig(options, pluginInjection
|
|
|
126
126
|
var link = linkMark[0] && linkMark[0].attrs.href;
|
|
127
127
|
var isValidUrl = isSafeUrl(link);
|
|
128
128
|
var labelOpenLink = formatMessage(isValidUrl ? linkMessages.openLink : linkToolbarCommonMessages.unableToOpenLink);
|
|
129
|
-
// TODO: ED-14403 investigate why these are not translating?
|
|
129
|
+
// TODO: ED-14403 - investigate why these are not translating?
|
|
130
130
|
var labelUnlink = formatMessage(linkToolbarCommonMessages.unlink);
|
|
131
131
|
var editLink = formatMessage(linkToolbarCommonMessages.editLink);
|
|
132
132
|
var metadata = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-hyperlink",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.4",
|
|
4
4
|
"description": "Hyperlink plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
37
37
|
"@atlaskit/analytics-next": "^11.0.0",
|
|
38
|
-
"@atlaskit/editor-common": "^102.
|
|
38
|
+
"@atlaskit/editor-common": "^102.2.0",
|
|
39
39
|
"@atlaskit/editor-plugin-analytics": "^2.1.0",
|
|
40
40
|
"@atlaskit/editor-plugin-card": "^5.2.0",
|
|
41
41
|
"@atlaskit/editor-plugin-connectivity": "^2.0.0",
|
|
@@ -102,6 +102,9 @@
|
|
|
102
102
|
}
|
|
103
103
|
},
|
|
104
104
|
"platform-feature-flags": {
|
|
105
|
+
"platform_editor_update_insert_link_mark_end_pos": {
|
|
106
|
+
"type": "boolean"
|
|
107
|
+
},
|
|
105
108
|
"linking_platform_smart_links_in_live_pages": {
|
|
106
109
|
"type": "boolean"
|
|
107
110
|
}
|