@atlaskit/editor-plugin-card 1.15.0 → 2.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 +19 -0
- package/dist/cjs/plugin.js +2 -12
- package/dist/cjs/pm-plugins/doc.js +88 -2
- package/dist/cjs/toolbar.js +4 -7
- package/dist/cjs/ui/EditLinkToolbar.js +3 -15
- package/dist/cjs/ui/HyperlinkToolbarAppearance.js +3 -5
- package/dist/cjs/ui/LinkToolbarAppearance.js +6 -6
- package/dist/cjs/utils.js +1 -4
- package/dist/es2019/plugin.js +3 -11
- package/dist/es2019/pm-plugins/doc.js +84 -1
- package/dist/es2019/toolbar.js +18 -23
- package/dist/es2019/ui/EditLinkToolbar.js +3 -16
- package/dist/es2019/ui/HyperlinkToolbarAppearance.js +3 -5
- package/dist/es2019/ui/LinkToolbarAppearance.js +6 -6
- package/dist/es2019/utils.js +0 -3
- package/dist/esm/plugin.js +3 -13
- package/dist/esm/pm-plugins/doc.js +88 -1
- package/dist/esm/toolbar.js +5 -8
- package/dist/esm/ui/EditLinkToolbar.js +3 -15
- package/dist/esm/ui/HyperlinkToolbarAppearance.js +3 -5
- package/dist/esm/ui/LinkToolbarAppearance.js +6 -6
- package/dist/esm/utils.js +0 -3
- package/dist/types/plugin.d.ts +1 -7
- package/dist/types/pm-plugins/doc.d.ts +11 -4
- package/dist/types/ui/EditLinkToolbar.d.ts +4 -8
- package/dist/types/ui/HyperlinkToolbarAppearance.d.ts +1 -2
- package/dist/types/ui/LinkToolbarAppearance.d.ts +0 -2
- package/dist/types/utils.d.ts +0 -2
- package/dist/types-ts4.5/plugin.d.ts +1 -7
- package/dist/types-ts4.5/pm-plugins/doc.d.ts +11 -4
- package/dist/types-ts4.5/ui/EditLinkToolbar.d.ts +4 -8
- package/dist/types-ts4.5/ui/HyperlinkToolbarAppearance.d.ts +1 -2
- package/dist/types-ts4.5/ui/LinkToolbarAppearance.d.ts +0 -2
- package/dist/types-ts4.5/utils.d.ts +0 -2
- package/package.json +6 -7
- package/dist/cjs/pm-plugins/mountHyperlink.js +0 -84
- package/dist/es2019/pm-plugins/mountHyperlink.js +0 -72
- package/dist/esm/pm-plugins/mountHyperlink.js +0 -77
- package/dist/types/pm-plugins/mountHyperlink.d.ts +0 -5
- package/dist/types-ts4.5/pm-plugins/mountHyperlink.d.ts +0 -5
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
5
|
-
import { getHyperlinkToolbarSettingsButton } from '../toolbar';
|
|
6
|
-
import { HyperlinkToolbarAppearance } from '../ui/HyperlinkToolbarAppearance';
|
|
7
|
-
import { ToolbarViewedEvent } from '../ui/ToolbarViewedEvent';
|
|
8
|
-
var getToolbarViewedItem = function getToolbarViewedItem(link) {
|
|
9
|
-
return [{
|
|
10
|
-
type: 'custom',
|
|
11
|
-
fallback: [],
|
|
12
|
-
render: function render(editorView) {
|
|
13
|
-
return /*#__PURE__*/React.createElement(ToolbarViewedEvent, {
|
|
14
|
-
key: "edit.link.menu.viewed",
|
|
15
|
-
url: link,
|
|
16
|
-
display: "url",
|
|
17
|
-
editorView: editorView
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
}];
|
|
21
|
-
};
|
|
22
|
-
export var mountHyperlinkPlugin = function mountHyperlinkPlugin(pluginInjectionApi, options) {
|
|
23
|
-
return new SafePlugin({
|
|
24
|
-
view: function view(editorView) {
|
|
25
|
-
requestAnimationFrame(function () {
|
|
26
|
-
var _pluginInjectionApi$h, _pluginInjectionApi$c2, _pluginInjectionApi$c3;
|
|
27
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$h = pluginInjectionApi.hyperlink) === null || _pluginInjectionApi$h === void 0 || (_pluginInjectionApi$h = _pluginInjectionApi$h.actions) === null || _pluginInjectionApi$h === void 0 || _pluginInjectionApi$h.prependToolbarButtons({
|
|
28
|
-
items: function items(state, intl, providerFactory, link) {
|
|
29
|
-
return [].concat(_toConsumableArray(getToolbarViewedItem(link)), [{
|
|
30
|
-
type: 'custom',
|
|
31
|
-
fallback: [],
|
|
32
|
-
render: function render(editorView) {
|
|
33
|
-
var _pluginInjectionApi$a, _pluginInjectionApi$c;
|
|
34
|
-
return /*#__PURE__*/React.createElement(HyperlinkToolbarAppearance, {
|
|
35
|
-
key: "link-appearance",
|
|
36
|
-
url: link,
|
|
37
|
-
intl: intl,
|
|
38
|
-
editorView: editorView,
|
|
39
|
-
editorState: state,
|
|
40
|
-
cardOptions: options,
|
|
41
|
-
providerFactory: providerFactory,
|
|
42
|
-
platform: options === null || options === void 0 ? void 0 : options.platform,
|
|
43
|
-
editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions,
|
|
44
|
-
cardActions: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.card) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.actions
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
}]);
|
|
48
|
-
},
|
|
49
|
-
onEscapeCallback: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c2 = pluginInjectionApi.card) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.actions.hideLinkToolbar,
|
|
50
|
-
onInsertLinkCallback: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c3 = pluginInjectionApi.card) === null || _pluginInjectionApi$c3 === void 0 ? void 0 : _pluginInjectionApi$c3.actions.queueCardsFromChangedTr,
|
|
51
|
-
view: editorView,
|
|
52
|
-
skipAnalytics: true
|
|
53
|
-
});
|
|
54
|
-
if (getBooleanFF('platform.editor.card.inject-settings-button')) {
|
|
55
|
-
/**
|
|
56
|
-
* Require either provider to be supplied (controls link preferences)
|
|
57
|
-
* Or explicit user preferences config in order to enable button
|
|
58
|
-
*/
|
|
59
|
-
if (options.provider || options.userPreferencesLink) {
|
|
60
|
-
var _pluginInjectionApi$h2;
|
|
61
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$h2 = pluginInjectionApi.hyperlink) === null || _pluginInjectionApi$h2 === void 0 || _pluginInjectionApi$h2.actions.addToolbarItems({
|
|
62
|
-
items: function items(_, intl) {
|
|
63
|
-
var _pluginInjectionApi$a2;
|
|
64
|
-
return [{
|
|
65
|
-
type: 'separator'
|
|
66
|
-
}, getHyperlinkToolbarSettingsButton(intl, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions, options.userPreferencesLink)];
|
|
67
|
-
},
|
|
68
|
-
placement: 'end',
|
|
69
|
-
view: editorView
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
return {};
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
-
import type { cardPlugin } from '../index';
|
|
4
|
-
import type { CardPluginOptions } from '../types';
|
|
5
|
-
export declare const mountHyperlinkPlugin: (pluginInjectionApi: ExtractInjectionAPI<typeof cardPlugin> | undefined, options: CardPluginOptions) => SafePlugin<any>;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
-
import type { cardPlugin } from '../index';
|
|
4
|
-
import type { CardPluginOptions } from '../types';
|
|
5
|
-
export declare const mountHyperlinkPlugin: (pluginInjectionApi: ExtractInjectionAPI<typeof cardPlugin> | undefined, options: CardPluginOptions) => SafePlugin<any>;
|