@atlaskit/editor-core 185.16.7 → 186.0.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 +72 -0
- package/dist/cjs/index.js +6 -56
- package/dist/cjs/labs/next/presets/universal.js +6 -0
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/index.js +0 -13
- package/dist/es2019/labs/next/presets/universal.js +6 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/index.js +0 -13
- package/dist/esm/labs/next/presets/universal.js +6 -0
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/index.d.ts +0 -14
- package/dist/types/labs/next/presets/cxhtml.d.ts +4 -0
- package/dist/types/labs/next/presets/default.d.ts +8 -0
- package/dist/types/labs/next/presets/mobile.d.ts +4 -0
- package/dist/types-ts4.5/index.d.ts +0 -14
- package/dist/types-ts4.5/labs/next/presets/cxhtml.d.ts +4 -0
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +8 -0
- package/dist/types-ts4.5/labs/next/presets/mobile.d.ts +4 -0
- package/package.json +7 -6
- package/report.api.md +0 -58
- package/tmp/api-report-tmp.d.ts +0 -29
- package/dist/cjs/plugins/deprecated-card/doc.js +0 -111
- package/dist/cjs/plugins/deprecated-hyperlink/commands.js +0 -164
- package/dist/es2019/plugins/deprecated-card/doc.js +0 -97
- package/dist/es2019/plugins/deprecated-hyperlink/commands.js +0 -150
- package/dist/esm/plugins/deprecated-card/doc.js +0 -105
- package/dist/esm/plugins/deprecated-hyperlink/commands.js +0 -152
- package/dist/types/plugins/deprecated-card/doc.d.ts +0 -20
- package/dist/types/plugins/deprecated-hyperlink/commands.d.ts +0 -38
- package/dist/types-ts4.5/plugins/deprecated-card/doc.d.ts +0 -20
- package/dist/types-ts4.5/plugins/deprecated-hyperlink/commands.d.ts +0 -38
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import { addLinkMetadata } from '@atlaskit/editor-common/card';
|
|
2
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
3
|
-
import { isTextAtPos, LinkAction } from '@atlaskit/editor-common/link';
|
|
4
|
-
import { getLinkCreationAnalyticsEvent, normalizeUrl } from '@atlaskit/editor-common/utils';
|
|
5
|
-
import { Selection } from 'prosemirror-state';
|
|
6
|
-
import { ACTION } from '@atlaskit/editor-common/analytics';
|
|
7
|
-
import { withAnalytics } from '../analytics';
|
|
8
|
-
import { queueCardsFromChangedTr } from '../deprecated-card/doc';
|
|
9
|
-
// TODO: ED-17836 This workaround is used since we extracted the hyperlink plugin.
|
|
10
|
-
// As soon as we deprecate the plugin we can delete this code.
|
|
11
|
-
/**
|
|
12
|
-
* @deprecated
|
|
13
|
-
* Please do not use this key anymore it will be removed soon.
|
|
14
|
-
* Using plugin keys is a deprecated approach and if you need
|
|
15
|
-
* to access state use the Preset API in EditorNext.
|
|
16
|
-
*/
|
|
17
|
-
export const stateKey = {
|
|
18
|
-
key: 'hyperlinkPlugin$',
|
|
19
|
-
getState: state => {
|
|
20
|
-
return state['hyperlinkPlugin$'];
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* @deprecated
|
|
26
|
-
* Please do not use this function anymore it will be removed soon.
|
|
27
|
-
* If you need to update the link please do it through the Preset
|
|
28
|
-
* API in EditorNext.
|
|
29
|
-
*/
|
|
30
|
-
export function updateLink(href, text, pos, to) {
|
|
31
|
-
return (state, dispatch) => {
|
|
32
|
-
const $pos = state.doc.resolve(pos);
|
|
33
|
-
const node = state.doc.nodeAt(pos);
|
|
34
|
-
if (!node) {
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
const url = normalizeUrl(href);
|
|
38
|
-
const mark = state.schema.marks.link.isInSet(node.marks);
|
|
39
|
-
const linkMark = state.schema.marks.link;
|
|
40
|
-
const rightBound = to && pos !== to ? to : pos - $pos.textOffset + node.nodeSize;
|
|
41
|
-
const tr = state.tr;
|
|
42
|
-
if (!url && text) {
|
|
43
|
-
tr.removeMark(pos, rightBound, linkMark);
|
|
44
|
-
tr.insertText(text, pos, rightBound);
|
|
45
|
-
} else if (!url) {
|
|
46
|
-
return false;
|
|
47
|
-
} else {
|
|
48
|
-
tr.insertText(text, pos, rightBound);
|
|
49
|
-
// Casting to LinkAttributes to prevent wrong attributes been passed (Example ED-7951)
|
|
50
|
-
const linkAttrs = {
|
|
51
|
-
...(mark && mark.attrs || {}),
|
|
52
|
-
href: url
|
|
53
|
-
};
|
|
54
|
-
tr.addMark(pos, pos + text.length, linkMark.create(linkAttrs));
|
|
55
|
-
tr.setMeta(stateKey, {
|
|
56
|
-
type: LinkAction.HIDE_TOOLBAR
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
if (dispatch) {
|
|
60
|
-
dispatch(tr);
|
|
61
|
-
}
|
|
62
|
-
return true;
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* @deprecated
|
|
68
|
-
* Please do not use this function anymore it will be removed soon.
|
|
69
|
-
* If you need to insert link please do it through the Preset
|
|
70
|
-
* API in EditorNext.
|
|
71
|
-
*/
|
|
72
|
-
export function insertLink(from, to, incomingHref, incomingTitle, displayText, source, sourceEvent) {
|
|
73
|
-
return (state, dispatch) => {
|
|
74
|
-
const link = state.schema.marks.link;
|
|
75
|
-
const {
|
|
76
|
-
tr
|
|
77
|
-
} = state;
|
|
78
|
-
if (incomingHref.trim()) {
|
|
79
|
-
var _stateKey$getState;
|
|
80
|
-
const normalizedUrl = normalizeUrl(incomingHref);
|
|
81
|
-
// NB: in this context, `currentText` represents text which has been
|
|
82
|
-
// highlighted in the Editor, upon which a link is is being added.
|
|
83
|
-
const currentText = (_stateKey$getState = stateKey.getState(state)) === null || _stateKey$getState === void 0 ? void 0 : _stateKey$getState.activeText;
|
|
84
|
-
let markEnd = to;
|
|
85
|
-
const text = displayText || incomingTitle || incomingHref;
|
|
86
|
-
if (!displayText || displayText !== currentText) {
|
|
87
|
-
tr.insertText(text, from, to);
|
|
88
|
-
if (!isTextAtPos(from)(state)) {
|
|
89
|
-
markEnd = from + text.length + 1;
|
|
90
|
-
} else {
|
|
91
|
-
markEnd = from + text.length;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
tr.addMark(from, markEnd, link.create({
|
|
95
|
-
href: normalizedUrl
|
|
96
|
-
}));
|
|
97
|
-
tr.setSelection(Selection.near(tr.doc.resolve(markEnd)));
|
|
98
|
-
if (!displayText || displayText === incomingHref) {
|
|
99
|
-
queueCardsFromChangedTr(state, tr, source, ACTION.INSERTED, false, sourceEvent);
|
|
100
|
-
} else if (getBooleanFF('platform.linking-platform.editor.fix-link-insert-analytics')) {
|
|
101
|
-
/**
|
|
102
|
-
* Add link metadata because queue cards would have otherwise handled this for us
|
|
103
|
-
*/
|
|
104
|
-
addLinkMetadata(state.selection, tr, {
|
|
105
|
-
action: ACTION.INSERTED,
|
|
106
|
-
inputMethod: source,
|
|
107
|
-
sourceEvent
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
tr.setMeta(stateKey, {
|
|
111
|
-
type: LinkAction.HIDE_TOOLBAR
|
|
112
|
-
});
|
|
113
|
-
if (dispatch) {
|
|
114
|
-
dispatch(tr);
|
|
115
|
-
}
|
|
116
|
-
return true;
|
|
117
|
-
}
|
|
118
|
-
tr.setMeta(stateKey, {
|
|
119
|
-
type: LinkAction.HIDE_TOOLBAR
|
|
120
|
-
});
|
|
121
|
-
if (dispatch) {
|
|
122
|
-
dispatch(tr);
|
|
123
|
-
}
|
|
124
|
-
return false;
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* @deprecated
|
|
130
|
-
* Please do not use this function anymore it will be removed soon.
|
|
131
|
-
* If you need to insert link please do it through the Preset
|
|
132
|
-
* API in EditorNext.
|
|
133
|
-
*/
|
|
134
|
-
export const insertLinkWithAnalytics = (inputMethod, from, to, href, title, displayText, cardsAvailable = false, sourceEvent = undefined) => {
|
|
135
|
-
// If smart cards are available, we send analytics for hyperlinks when a smart link is rejected.
|
|
136
|
-
if (cardsAvailable && !title && !displayText) {
|
|
137
|
-
return insertLink(from, to, href, title, displayText, inputMethod, sourceEvent);
|
|
138
|
-
}
|
|
139
|
-
return withAnalytics(getLinkCreationAnalyticsEvent(inputMethod, href))(insertLink(from, to, href, title, displayText, inputMethod, sourceEvent));
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* @deprecated
|
|
144
|
-
* Please do not use this function anymore it will be removed soon.
|
|
145
|
-
* If you need to insert link please do it through the Preset
|
|
146
|
-
* API in EditorNext.
|
|
147
|
-
*/
|
|
148
|
-
export const insertLinkWithAnalyticsMobileNative = (inputMethod, from, to, href, title, displayText) => {
|
|
149
|
-
return withAnalytics(getLinkCreationAnalyticsEvent(inputMethod, href))(insertLink(from, to, href, title, displayText, inputMethod));
|
|
150
|
-
};
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WARNING!!!
|
|
3
|
-
* Copied from `editor-plugin-card`.
|
|
4
|
-
*
|
|
5
|
-
* This workaround is used since we extracted the hyperlink + card plugins.
|
|
6
|
-
* It is only used in `deprecated-hyperlink`. It should not be used internally or externally.
|
|
7
|
-
*
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { addLinkMetadata } from '@atlaskit/editor-common/card';
|
|
11
|
-
import { nodesBetweenChanged } from '@atlaskit/editor-common/utils';
|
|
12
|
-
import { normalizeUrl } from '@atlaskit/adf-schema';
|
|
13
|
-
import { md } from '@atlaskit/editor-common/paste';
|
|
14
|
-
|
|
15
|
-
// TODO: ED-15663
|
|
16
|
-
// Please, do not copy or use this kind of code below
|
|
17
|
-
// @ts-ignore
|
|
18
|
-
var pluginKey = {
|
|
19
|
-
key: 'cardPlugin$',
|
|
20
|
-
getState: function getState(state) {
|
|
21
|
-
return state['cardPlugin$'];
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
function shouldReplaceLink(node) {
|
|
25
|
-
var compareLinkText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
26
|
-
var compareToUrl = arguments.length > 2 ? arguments[2] : undefined;
|
|
27
|
-
var linkMark = node.marks.find(function (mark) {
|
|
28
|
-
return mark.type.name === 'link';
|
|
29
|
-
});
|
|
30
|
-
if (!linkMark) {
|
|
31
|
-
// not a link anymore
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// ED-6041: compare normalised link text after linkfy from Markdown transformer
|
|
36
|
-
// instead, since it always decodes URL ('%20' -> ' ') on the link text
|
|
37
|
-
|
|
38
|
-
var normalisedHref = normalizeUrl(md.normalizeLinkText(linkMark.attrs.href));
|
|
39
|
-
var normalizedLinkText = normalizeUrl(md.normalizeLinkText(node.text || ''));
|
|
40
|
-
if (compareLinkText && normalisedHref !== normalizedLinkText) {
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
if (compareToUrl) {
|
|
44
|
-
var normalizedUrl = normalizeUrl(md.normalizeLinkText(compareToUrl));
|
|
45
|
-
if (normalizedUrl !== normalisedHref) {
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return true;
|
|
50
|
-
}
|
|
51
|
-
var cardAction = function cardAction(tr, action) {
|
|
52
|
-
return tr.setMeta(pluginKey, action);
|
|
53
|
-
};
|
|
54
|
-
var queueCards = function queueCards(requests) {
|
|
55
|
-
return function (tr) {
|
|
56
|
-
return cardAction(tr, {
|
|
57
|
-
type: 'QUEUE',
|
|
58
|
-
requests: requests
|
|
59
|
-
});
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* @private
|
|
65
|
-
* @deprecated
|
|
66
|
-
*
|
|
67
|
-
* DO NOT USE THIS
|
|
68
|
-
* It is only used internally for `deprecated-hyperlink`.
|
|
69
|
-
*/
|
|
70
|
-
export var queueCardsFromChangedTr = function queueCardsFromChangedTr(state, tr, source, analyticsAction) {
|
|
71
|
-
var normalizeLinkText = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
72
|
-
var sourceEvent = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : undefined;
|
|
73
|
-
var schema = state.schema;
|
|
74
|
-
var link = schema.marks.link;
|
|
75
|
-
var requests = [];
|
|
76
|
-
nodesBetweenChanged(tr, function (node, pos) {
|
|
77
|
-
if (!node.isText) {
|
|
78
|
-
return true;
|
|
79
|
-
}
|
|
80
|
-
var linkMark = node.marks.find(function (mark) {
|
|
81
|
-
return mark.type === link;
|
|
82
|
-
});
|
|
83
|
-
if (linkMark) {
|
|
84
|
-
if (!shouldReplaceLink(node, normalizeLinkText)) {
|
|
85
|
-
return false;
|
|
86
|
-
}
|
|
87
|
-
requests.push({
|
|
88
|
-
url: linkMark.attrs.href,
|
|
89
|
-
pos: pos,
|
|
90
|
-
appearance: 'inline',
|
|
91
|
-
compareLinkText: normalizeLinkText,
|
|
92
|
-
source: source,
|
|
93
|
-
analyticsAction: analyticsAction,
|
|
94
|
-
sourceEvent: sourceEvent
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
return false;
|
|
98
|
-
});
|
|
99
|
-
if (analyticsAction) {
|
|
100
|
-
addLinkMetadata(state.selection, tr, {
|
|
101
|
-
action: analyticsAction
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
return queueCards(requests)(tr);
|
|
105
|
-
};
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
import { addLinkMetadata } from '@atlaskit/editor-common/card';
|
|
5
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
6
|
-
import { isTextAtPos, LinkAction } from '@atlaskit/editor-common/link';
|
|
7
|
-
import { getLinkCreationAnalyticsEvent, normalizeUrl } from '@atlaskit/editor-common/utils';
|
|
8
|
-
import { Selection } from 'prosemirror-state';
|
|
9
|
-
import { ACTION } from '@atlaskit/editor-common/analytics';
|
|
10
|
-
import { withAnalytics } from '../analytics';
|
|
11
|
-
import { queueCardsFromChangedTr } from '../deprecated-card/doc';
|
|
12
|
-
// TODO: ED-17836 This workaround is used since we extracted the hyperlink plugin.
|
|
13
|
-
// As soon as we deprecate the plugin we can delete this code.
|
|
14
|
-
/**
|
|
15
|
-
* @deprecated
|
|
16
|
-
* Please do not use this key anymore it will be removed soon.
|
|
17
|
-
* Using plugin keys is a deprecated approach and if you need
|
|
18
|
-
* to access state use the Preset API in EditorNext.
|
|
19
|
-
*/
|
|
20
|
-
export var stateKey = {
|
|
21
|
-
key: 'hyperlinkPlugin$',
|
|
22
|
-
getState: function getState(state) {
|
|
23
|
-
return state['hyperlinkPlugin$'];
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* @deprecated
|
|
29
|
-
* Please do not use this function anymore it will be removed soon.
|
|
30
|
-
* If you need to update the link please do it through the Preset
|
|
31
|
-
* API in EditorNext.
|
|
32
|
-
*/
|
|
33
|
-
export function updateLink(href, text, pos, to) {
|
|
34
|
-
return function (state, dispatch) {
|
|
35
|
-
var $pos = state.doc.resolve(pos);
|
|
36
|
-
var node = state.doc.nodeAt(pos);
|
|
37
|
-
if (!node) {
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
var url = normalizeUrl(href);
|
|
41
|
-
var mark = state.schema.marks.link.isInSet(node.marks);
|
|
42
|
-
var linkMark = state.schema.marks.link;
|
|
43
|
-
var rightBound = to && pos !== to ? to : pos - $pos.textOffset + node.nodeSize;
|
|
44
|
-
var tr = state.tr;
|
|
45
|
-
if (!url && text) {
|
|
46
|
-
tr.removeMark(pos, rightBound, linkMark);
|
|
47
|
-
tr.insertText(text, pos, rightBound);
|
|
48
|
-
} else if (!url) {
|
|
49
|
-
return false;
|
|
50
|
-
} else {
|
|
51
|
-
tr.insertText(text, pos, rightBound);
|
|
52
|
-
// Casting to LinkAttributes to prevent wrong attributes been passed (Example ED-7951)
|
|
53
|
-
var linkAttrs = _objectSpread(_objectSpread({}, mark && mark.attrs || {}), {}, {
|
|
54
|
-
href: url
|
|
55
|
-
});
|
|
56
|
-
tr.addMark(pos, pos + text.length, linkMark.create(linkAttrs));
|
|
57
|
-
tr.setMeta(stateKey, {
|
|
58
|
-
type: LinkAction.HIDE_TOOLBAR
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
if (dispatch) {
|
|
62
|
-
dispatch(tr);
|
|
63
|
-
}
|
|
64
|
-
return true;
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* @deprecated
|
|
70
|
-
* Please do not use this function anymore it will be removed soon.
|
|
71
|
-
* If you need to insert link please do it through the Preset
|
|
72
|
-
* API in EditorNext.
|
|
73
|
-
*/
|
|
74
|
-
export function insertLink(from, to, incomingHref, incomingTitle, displayText, source, sourceEvent) {
|
|
75
|
-
return function (state, dispatch) {
|
|
76
|
-
var link = state.schema.marks.link;
|
|
77
|
-
var tr = state.tr;
|
|
78
|
-
if (incomingHref.trim()) {
|
|
79
|
-
var _stateKey$getState;
|
|
80
|
-
var normalizedUrl = normalizeUrl(incomingHref);
|
|
81
|
-
// NB: in this context, `currentText` represents text which has been
|
|
82
|
-
// highlighted in the Editor, upon which a link is is being added.
|
|
83
|
-
var currentText = (_stateKey$getState = stateKey.getState(state)) === null || _stateKey$getState === void 0 ? void 0 : _stateKey$getState.activeText;
|
|
84
|
-
var markEnd = to;
|
|
85
|
-
var text = displayText || incomingTitle || incomingHref;
|
|
86
|
-
if (!displayText || displayText !== currentText) {
|
|
87
|
-
tr.insertText(text, from, to);
|
|
88
|
-
if (!isTextAtPos(from)(state)) {
|
|
89
|
-
markEnd = from + text.length + 1;
|
|
90
|
-
} else {
|
|
91
|
-
markEnd = from + text.length;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
tr.addMark(from, markEnd, link.create({
|
|
95
|
-
href: normalizedUrl
|
|
96
|
-
}));
|
|
97
|
-
tr.setSelection(Selection.near(tr.doc.resolve(markEnd)));
|
|
98
|
-
if (!displayText || displayText === incomingHref) {
|
|
99
|
-
queueCardsFromChangedTr(state, tr, source, ACTION.INSERTED, false, sourceEvent);
|
|
100
|
-
} else if (getBooleanFF('platform.linking-platform.editor.fix-link-insert-analytics')) {
|
|
101
|
-
/**
|
|
102
|
-
* Add link metadata because queue cards would have otherwise handled this for us
|
|
103
|
-
*/
|
|
104
|
-
addLinkMetadata(state.selection, tr, {
|
|
105
|
-
action: ACTION.INSERTED,
|
|
106
|
-
inputMethod: source,
|
|
107
|
-
sourceEvent: sourceEvent
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
tr.setMeta(stateKey, {
|
|
111
|
-
type: LinkAction.HIDE_TOOLBAR
|
|
112
|
-
});
|
|
113
|
-
if (dispatch) {
|
|
114
|
-
dispatch(tr);
|
|
115
|
-
}
|
|
116
|
-
return true;
|
|
117
|
-
}
|
|
118
|
-
tr.setMeta(stateKey, {
|
|
119
|
-
type: LinkAction.HIDE_TOOLBAR
|
|
120
|
-
});
|
|
121
|
-
if (dispatch) {
|
|
122
|
-
dispatch(tr);
|
|
123
|
-
}
|
|
124
|
-
return false;
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* @deprecated
|
|
130
|
-
* Please do not use this function anymore it will be removed soon.
|
|
131
|
-
* If you need to insert link please do it through the Preset
|
|
132
|
-
* API in EditorNext.
|
|
133
|
-
*/
|
|
134
|
-
export var insertLinkWithAnalytics = function insertLinkWithAnalytics(inputMethod, from, to, href, title, displayText) {
|
|
135
|
-
var cardsAvailable = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
136
|
-
var sourceEvent = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : undefined;
|
|
137
|
-
// If smart cards are available, we send analytics for hyperlinks when a smart link is rejected.
|
|
138
|
-
if (cardsAvailable && !title && !displayText) {
|
|
139
|
-
return insertLink(from, to, href, title, displayText, inputMethod, sourceEvent);
|
|
140
|
-
}
|
|
141
|
-
return withAnalytics(getLinkCreationAnalyticsEvent(inputMethod, href))(insertLink(from, to, href, title, displayText, inputMethod, sourceEvent));
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* @deprecated
|
|
146
|
-
* Please do not use this function anymore it will be removed soon.
|
|
147
|
-
* If you need to insert link please do it through the Preset
|
|
148
|
-
* API in EditorNext.
|
|
149
|
-
*/
|
|
150
|
-
export var insertLinkWithAnalyticsMobileNative = function insertLinkWithAnalyticsMobileNative(inputMethod, from, to, href, title, displayText) {
|
|
151
|
-
return withAnalytics(getLinkCreationAnalyticsEvent(inputMethod, href))(insertLink(from, to, href, title, displayText, inputMethod));
|
|
152
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WARNING!!!
|
|
3
|
-
* Copied from `editor-plugin-card`.
|
|
4
|
-
*
|
|
5
|
-
* This workaround is used since we extracted the hyperlink + card plugins.
|
|
6
|
-
* It is only used in `deprecated-hyperlink`. It should not be used internally or externally.
|
|
7
|
-
*
|
|
8
|
-
*/
|
|
9
|
-
import { EditorState, Transaction } from 'prosemirror-state';
|
|
10
|
-
import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
11
|
-
import { ACTION } from '@atlaskit/editor-common/analytics';
|
|
12
|
-
import type { CardReplacementInputMethod } from '@atlaskit/editor-common/card';
|
|
13
|
-
/**
|
|
14
|
-
* @private
|
|
15
|
-
* @deprecated
|
|
16
|
-
*
|
|
17
|
-
* DO NOT USE THIS
|
|
18
|
-
* It is only used internally for `deprecated-hyperlink`.
|
|
19
|
-
*/
|
|
20
|
-
export declare const queueCardsFromChangedTr: (state: EditorState, tr: Transaction, source: CardReplacementInputMethod, analyticsAction?: ACTION, normalizeLinkText?: boolean, sourceEvent?: UIAnalyticsEvent | null | undefined) => Transaction;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
2
|
-
import type { Command, LinkInputType } from '@atlaskit/editor-common/types';
|
|
3
|
-
import { PluginKey } from 'prosemirror-state';
|
|
4
|
-
/**
|
|
5
|
-
* @deprecated
|
|
6
|
-
* Please do not use this key anymore it will be removed soon.
|
|
7
|
-
* Using plugin keys is a deprecated approach and if you need
|
|
8
|
-
* to access state use the Preset API in EditorNext.
|
|
9
|
-
*/
|
|
10
|
-
export declare const stateKey: PluginKey<any>;
|
|
11
|
-
/**
|
|
12
|
-
* @deprecated
|
|
13
|
-
* Please do not use this function anymore it will be removed soon.
|
|
14
|
-
* If you need to update the link please do it through the Preset
|
|
15
|
-
* API in EditorNext.
|
|
16
|
-
*/
|
|
17
|
-
export declare function updateLink(href: string, text: string, pos: number, to?: number): Command;
|
|
18
|
-
/**
|
|
19
|
-
* @deprecated
|
|
20
|
-
* Please do not use this function anymore it will be removed soon.
|
|
21
|
-
* If you need to insert link please do it through the Preset
|
|
22
|
-
* API in EditorNext.
|
|
23
|
-
*/
|
|
24
|
-
export declare function insertLink(from: number, to: number, incomingHref: string, incomingTitle?: string, displayText?: string, source?: LinkInputType, sourceEvent?: UIAnalyticsEvent | null | undefined): Command;
|
|
25
|
-
/**
|
|
26
|
-
* @deprecated
|
|
27
|
-
* Please do not use this function anymore it will be removed soon.
|
|
28
|
-
* If you need to insert link please do it through the Preset
|
|
29
|
-
* API in EditorNext.
|
|
30
|
-
*/
|
|
31
|
-
export declare const insertLinkWithAnalytics: (inputMethod: LinkInputType, from: number, to: number, href: string, title?: string, displayText?: string, cardsAvailable?: boolean, sourceEvent?: UIAnalyticsEvent | null | undefined) => Command;
|
|
32
|
-
/**
|
|
33
|
-
* @deprecated
|
|
34
|
-
* Please do not use this function anymore it will be removed soon.
|
|
35
|
-
* If you need to insert link please do it through the Preset
|
|
36
|
-
* API in EditorNext.
|
|
37
|
-
*/
|
|
38
|
-
export declare const insertLinkWithAnalyticsMobileNative: (inputMethod: LinkInputType, from: number, to: number, href: string, title?: string, displayText?: string) => import("../..").Command;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WARNING!!!
|
|
3
|
-
* Copied from `editor-plugin-card`.
|
|
4
|
-
*
|
|
5
|
-
* This workaround is used since we extracted the hyperlink + card plugins.
|
|
6
|
-
* It is only used in `deprecated-hyperlink`. It should not be used internally or externally.
|
|
7
|
-
*
|
|
8
|
-
*/
|
|
9
|
-
import { EditorState, Transaction } from 'prosemirror-state';
|
|
10
|
-
import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
11
|
-
import { ACTION } from '@atlaskit/editor-common/analytics';
|
|
12
|
-
import type { CardReplacementInputMethod } from '@atlaskit/editor-common/card';
|
|
13
|
-
/**
|
|
14
|
-
* @private
|
|
15
|
-
* @deprecated
|
|
16
|
-
*
|
|
17
|
-
* DO NOT USE THIS
|
|
18
|
-
* It is only used internally for `deprecated-hyperlink`.
|
|
19
|
-
*/
|
|
20
|
-
export declare const queueCardsFromChangedTr: (state: EditorState, tr: Transaction, source: CardReplacementInputMethod, analyticsAction?: ACTION, normalizeLinkText?: boolean, sourceEvent?: UIAnalyticsEvent | null | undefined) => Transaction;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
2
|
-
import type { Command, LinkInputType } from '@atlaskit/editor-common/types';
|
|
3
|
-
import { PluginKey } from 'prosemirror-state';
|
|
4
|
-
/**
|
|
5
|
-
* @deprecated
|
|
6
|
-
* Please do not use this key anymore it will be removed soon.
|
|
7
|
-
* Using plugin keys is a deprecated approach and if you need
|
|
8
|
-
* to access state use the Preset API in EditorNext.
|
|
9
|
-
*/
|
|
10
|
-
export declare const stateKey: PluginKey<any>;
|
|
11
|
-
/**
|
|
12
|
-
* @deprecated
|
|
13
|
-
* Please do not use this function anymore it will be removed soon.
|
|
14
|
-
* If you need to update the link please do it through the Preset
|
|
15
|
-
* API in EditorNext.
|
|
16
|
-
*/
|
|
17
|
-
export declare function updateLink(href: string, text: string, pos: number, to?: number): Command;
|
|
18
|
-
/**
|
|
19
|
-
* @deprecated
|
|
20
|
-
* Please do not use this function anymore it will be removed soon.
|
|
21
|
-
* If you need to insert link please do it through the Preset
|
|
22
|
-
* API in EditorNext.
|
|
23
|
-
*/
|
|
24
|
-
export declare function insertLink(from: number, to: number, incomingHref: string, incomingTitle?: string, displayText?: string, source?: LinkInputType, sourceEvent?: UIAnalyticsEvent | null | undefined): Command;
|
|
25
|
-
/**
|
|
26
|
-
* @deprecated
|
|
27
|
-
* Please do not use this function anymore it will be removed soon.
|
|
28
|
-
* If you need to insert link please do it through the Preset
|
|
29
|
-
* API in EditorNext.
|
|
30
|
-
*/
|
|
31
|
-
export declare const insertLinkWithAnalytics: (inputMethod: LinkInputType, from: number, to: number, href: string, title?: string, displayText?: string, cardsAvailable?: boolean, sourceEvent?: UIAnalyticsEvent | null | undefined) => Command;
|
|
32
|
-
/**
|
|
33
|
-
* @deprecated
|
|
34
|
-
* Please do not use this function anymore it will be removed soon.
|
|
35
|
-
* If you need to insert link please do it through the Preset
|
|
36
|
-
* API in EditorNext.
|
|
37
|
-
*/
|
|
38
|
-
export declare const insertLinkWithAnalyticsMobileNative: (inputMethod: LinkInputType, from: number, to: number, href: string, title?: string, displayText?: string) => import("../..").Command;
|