@atlaskit/editor-plugin-card 5.4.10 → 5.4.11
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 +6 -0
- package/dist/cjs/pm-plugins/doc.js +32 -15
- package/dist/es2019/pm-plugins/doc.js +27 -14
- package/dist/esm/pm-plugins/doc.js +32 -15
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -11,10 +11,12 @@ var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
|
11
11
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
12
12
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
13
13
|
var _card = require("@atlaskit/editor-common/card");
|
|
14
|
+
var _link = require("@atlaskit/editor-common/link");
|
|
14
15
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
15
16
|
var _history = require("@atlaskit/editor-prosemirror/history");
|
|
16
17
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
17
18
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
19
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
18
20
|
var _actions = require("./actions");
|
|
19
21
|
var _pluginKey = require("./plugin-key");
|
|
20
22
|
var _shouldReplaceLink = require("./shouldReplaceLink");
|
|
@@ -237,23 +239,38 @@ var convertHyperlinkToSmartCard = exports.convertHyperlinkToSmartCard = function
|
|
|
237
239
|
var schema = state.schema;
|
|
238
240
|
var link = schema.marks.link;
|
|
239
241
|
var requests = [];
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
242
|
+
var createRequest = function createRequest(linkMark, pos) {
|
|
243
|
+
return {
|
|
244
|
+
url: linkMark.attrs.href,
|
|
245
|
+
pos: pos,
|
|
246
|
+
appearance: appearance,
|
|
247
|
+
previousAppearance: 'url',
|
|
248
|
+
compareLinkText: normalizeLinkText,
|
|
249
|
+
source: source,
|
|
250
|
+
analyticsAction: _analytics.ACTION.CHANGED_TYPE,
|
|
251
|
+
shouldReplaceLink: true
|
|
252
|
+
};
|
|
253
|
+
};
|
|
254
|
+
if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_3')) {
|
|
255
|
+
var activeLinkMark = (0, _link.getActiveLinkMark)(state);
|
|
256
|
+
if (activeLinkMark) {
|
|
257
|
+
var linkMark = activeLinkMark.node.marks.find(function (mark) {
|
|
258
|
+
return mark.type === link;
|
|
254
259
|
});
|
|
260
|
+
if (linkMark) {
|
|
261
|
+
requests.push(createRequest(linkMark, activeLinkMark.pos));
|
|
262
|
+
}
|
|
255
263
|
}
|
|
256
|
-
}
|
|
264
|
+
} else {
|
|
265
|
+
state.tr.doc.nodesBetween(state.selection.from, state.selection.to, function (node, pos) {
|
|
266
|
+
var linkMark = node.marks.find(function (mark) {
|
|
267
|
+
return mark.type === link;
|
|
268
|
+
});
|
|
269
|
+
if (linkMark) {
|
|
270
|
+
requests.push(createRequest(linkMark, pos));
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
}
|
|
257
274
|
(0, _card.addLinkMetadata)(state.selection, state.tr, {
|
|
258
275
|
action: _analytics.ACTION.CHANGED_TYPE
|
|
259
276
|
});
|
|
@@ -2,10 +2,12 @@ import isEqual from 'lodash/isEqual';
|
|
|
2
2
|
import { isSafeUrl } from '@atlaskit/adf-schema';
|
|
3
3
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, SMART_LINK_TYPE, unlinkPayload } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { addLinkMetadata } from '@atlaskit/editor-common/card';
|
|
5
|
+
import { getActiveLinkMark } from '@atlaskit/editor-common/link';
|
|
5
6
|
import { getAnnotationMarksForPos, getLinkCreationAnalyticsEvent, isFromCurrentDomain, nodesBetweenChanged, processRawValue } from '@atlaskit/editor-common/utils';
|
|
6
7
|
import { closeHistory } from '@atlaskit/editor-prosemirror/history';
|
|
7
8
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
8
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
9
11
|
import { hideDatasourceModal, queueCards, removeDatasourceStash, resolveCard, setDatasourceStash } from './actions';
|
|
10
12
|
import { pluginKey } from './plugin-key';
|
|
11
13
|
import { shouldReplaceLink } from './shouldReplaceLink';
|
|
@@ -218,21 +220,32 @@ export const convertHyperlinkToSmartCard = (state, source, appearance, normalize
|
|
|
218
220
|
link
|
|
219
221
|
} = schema.marks;
|
|
220
222
|
const requests = [];
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
source,
|
|
231
|
-
analyticsAction: ACTION.CHANGED_TYPE,
|
|
232
|
-
shouldReplaceLink: true
|
|
233
|
-
});
|
|
234
|
-
}
|
|
223
|
+
const createRequest = (linkMark, pos) => ({
|
|
224
|
+
url: linkMark.attrs.href,
|
|
225
|
+
pos,
|
|
226
|
+
appearance,
|
|
227
|
+
previousAppearance: 'url',
|
|
228
|
+
compareLinkText: normalizeLinkText,
|
|
229
|
+
source,
|
|
230
|
+
analyticsAction: ACTION.CHANGED_TYPE,
|
|
231
|
+
shouldReplaceLink: true
|
|
235
232
|
});
|
|
233
|
+
if (editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_3')) {
|
|
234
|
+
const activeLinkMark = getActiveLinkMark(state);
|
|
235
|
+
if (activeLinkMark) {
|
|
236
|
+
const linkMark = activeLinkMark.node.marks.find(mark => mark.type === link);
|
|
237
|
+
if (linkMark) {
|
|
238
|
+
requests.push(createRequest(linkMark, activeLinkMark.pos));
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
} else {
|
|
242
|
+
state.tr.doc.nodesBetween(state.selection.from, state.selection.to, (node, pos) => {
|
|
243
|
+
const linkMark = node.marks.find(mark => mark.type === link);
|
|
244
|
+
if (linkMark) {
|
|
245
|
+
requests.push(createRequest(linkMark, pos));
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
}
|
|
236
249
|
addLinkMetadata(state.selection, state.tr, {
|
|
237
250
|
action: ACTION.CHANGED_TYPE
|
|
238
251
|
});
|
|
@@ -6,10 +6,12 @@ import isEqual from 'lodash/isEqual';
|
|
|
6
6
|
import { isSafeUrl } from '@atlaskit/adf-schema';
|
|
7
7
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, SMART_LINK_TYPE, unlinkPayload } from '@atlaskit/editor-common/analytics';
|
|
8
8
|
import { addLinkMetadata } from '@atlaskit/editor-common/card';
|
|
9
|
+
import { getActiveLinkMark } from '@atlaskit/editor-common/link';
|
|
9
10
|
import { getAnnotationMarksForPos, getLinkCreationAnalyticsEvent, isFromCurrentDomain, nodesBetweenChanged, processRawValue } from '@atlaskit/editor-common/utils';
|
|
10
11
|
import { closeHistory } from '@atlaskit/editor-prosemirror/history';
|
|
11
12
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
12
13
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
13
15
|
import { hideDatasourceModal, queueCards, removeDatasourceStash, resolveCard, setDatasourceStash } from './actions';
|
|
14
16
|
import { pluginKey } from './plugin-key';
|
|
15
17
|
import { shouldReplaceLink } from './shouldReplaceLink';
|
|
@@ -231,23 +233,38 @@ export var convertHyperlinkToSmartCard = function convertHyperlinkToSmartCard(st
|
|
|
231
233
|
var schema = state.schema;
|
|
232
234
|
var link = schema.marks.link;
|
|
233
235
|
var requests = [];
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
236
|
+
var createRequest = function createRequest(linkMark, pos) {
|
|
237
|
+
return {
|
|
238
|
+
url: linkMark.attrs.href,
|
|
239
|
+
pos: pos,
|
|
240
|
+
appearance: appearance,
|
|
241
|
+
previousAppearance: 'url',
|
|
242
|
+
compareLinkText: normalizeLinkText,
|
|
243
|
+
source: source,
|
|
244
|
+
analyticsAction: ACTION.CHANGED_TYPE,
|
|
245
|
+
shouldReplaceLink: true
|
|
246
|
+
};
|
|
247
|
+
};
|
|
248
|
+
if (editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_3')) {
|
|
249
|
+
var activeLinkMark = getActiveLinkMark(state);
|
|
250
|
+
if (activeLinkMark) {
|
|
251
|
+
var linkMark = activeLinkMark.node.marks.find(function (mark) {
|
|
252
|
+
return mark.type === link;
|
|
248
253
|
});
|
|
254
|
+
if (linkMark) {
|
|
255
|
+
requests.push(createRequest(linkMark, activeLinkMark.pos));
|
|
256
|
+
}
|
|
249
257
|
}
|
|
250
|
-
}
|
|
258
|
+
} else {
|
|
259
|
+
state.tr.doc.nodesBetween(state.selection.from, state.selection.to, function (node, pos) {
|
|
260
|
+
var linkMark = node.marks.find(function (mark) {
|
|
261
|
+
return mark.type === link;
|
|
262
|
+
});
|
|
263
|
+
if (linkMark) {
|
|
264
|
+
requests.push(createRequest(linkMark, pos));
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
}
|
|
251
268
|
addLinkMetadata(state.selection, state.tr, {
|
|
252
269
|
action: ACTION.CHANGED_TYPE
|
|
253
270
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-card",
|
|
3
|
-
"version": "5.4.
|
|
3
|
+
"version": "5.4.11",
|
|
4
4
|
"description": "Card plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@atlaskit/analytics-next": "^11.0.0",
|
|
38
38
|
"@atlaskit/button": "^23.0.0",
|
|
39
39
|
"@atlaskit/custom-steps": "^0.11.0",
|
|
40
|
-
"@atlaskit/editor-common": "^
|
|
40
|
+
"@atlaskit/editor-common": "^103.0.0",
|
|
41
41
|
"@atlaskit/editor-plugin-analytics": "^2.2.0",
|
|
42
42
|
"@atlaskit/editor-plugin-base": "^2.3.0",
|
|
43
43
|
"@atlaskit/editor-plugin-connectivity": "^2.0.0",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"@atlaskit/smart-card": "^36.2.0",
|
|
64
64
|
"@atlaskit/theme": "^18.0.0",
|
|
65
65
|
"@atlaskit/tmp-editor-statsig": "^4.6.0",
|
|
66
|
-
"@atlaskit/tokens": "^4.
|
|
66
|
+
"@atlaskit/tokens": "^4.7.0",
|
|
67
67
|
"@babel/runtime": "^7.0.0",
|
|
68
68
|
"@emotion/react": "^11.7.1",
|
|
69
69
|
"lodash": "^4.17.21",
|
|
@@ -134,9 +134,6 @@
|
|
|
134
134
|
"platform-editor-plugin-card-icon-migration": {
|
|
135
135
|
"type": "boolean"
|
|
136
136
|
},
|
|
137
|
-
"platform_editor_lego__inline_node_virtualization": {
|
|
138
|
-
"type": "boolean"
|
|
139
|
-
},
|
|
140
137
|
"confluence-issue-terminology-refresh": {
|
|
141
138
|
"type": "boolean"
|
|
142
139
|
},
|
|
@@ -148,6 +145,9 @@
|
|
|
148
145
|
},
|
|
149
146
|
"platform_editor_controls_patch_2": {
|
|
150
147
|
"type": "boolean"
|
|
148
|
+
},
|
|
149
|
+
"platform_editor_controls_patch_3": {
|
|
150
|
+
"type": "boolean"
|
|
151
151
|
}
|
|
152
152
|
},
|
|
153
153
|
"stricter": {
|