@atlaskit/editor-plugin-card 0.4.8 → 0.5.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 +40 -0
- package/README.md +25 -2
- package/dist/cjs/nodeviews/datasource.js +4 -4
- package/dist/cjs/nodeviews/embedCard.js +4 -4
- package/dist/cjs/nodeviews/genericCard.js +2 -2
- package/dist/cjs/plugin.js +20 -14
- package/dist/cjs/pm-plugins/doc.js +2 -2
- package/dist/cjs/pm-plugins/main.js +2 -2
- package/dist/cjs/pm-plugins/mountHyperlink.js +7 -7
- package/dist/cjs/pm-plugins/reducers.js +2 -2
- package/dist/cjs/pm-plugins/util/state.js +2 -2
- package/dist/cjs/toolbar.js +8 -8
- package/dist/cjs/ui/EditLinkToolbar.js +6 -6
- package/dist/cjs/ui/LayoutButton/index.js +2 -2
- package/dist/cjs/ui/LinkToolbarAppearance.js +2 -2
- package/dist/cjs/ui/ResizableEmbedCard.js +2 -2
- package/dist/cjs/ui/ToolbarViewedEvent.js +2 -2
- package/dist/es2019/nodeviews/datasource.js +2 -2
- package/dist/es2019/nodeviews/embedCard.js +2 -2
- package/dist/es2019/nodeviews/genericCard.js +2 -2
- package/dist/es2019/plugin.js +10 -3
- package/dist/es2019/pm-plugins/main.js +2 -2
- package/dist/es2019/pm-plugins/mountHyperlink.js +7 -7
- package/dist/es2019/toolbar.js +6 -6
- package/dist/es2019/ui/EditLinkToolbar.js +6 -6
- package/dist/esm/nodeviews/datasource.js +4 -4
- package/dist/esm/nodeviews/embedCard.js +4 -4
- package/dist/esm/nodeviews/genericCard.js +2 -2
- package/dist/esm/plugin.js +20 -14
- package/dist/esm/pm-plugins/doc.js +2 -2
- package/dist/esm/pm-plugins/main.js +2 -2
- package/dist/esm/pm-plugins/mountHyperlink.js +7 -7
- package/dist/esm/pm-plugins/reducers.js +2 -2
- package/dist/esm/pm-plugins/util/state.js +2 -2
- package/dist/esm/toolbar.js +8 -8
- package/dist/esm/ui/EditLinkToolbar.js +6 -6
- package/dist/esm/ui/LayoutButton/index.js +2 -2
- package/dist/esm/ui/LinkToolbarAppearance.js +2 -2
- package/dist/esm/ui/ResizableEmbedCard.js +2 -2
- package/dist/esm/ui/ToolbarViewedEvent.js +2 -2
- package/dist/types/nodeviews/datasource.d.ts +6 -5
- package/dist/types/nodeviews/embedCard.d.ts +3 -3
- package/dist/types/nodeviews/genericCard.d.ts +7 -7
- package/dist/types/plugin.d.ts +4 -0
- package/dist/types/pm-plugins/main.d.ts +1 -1
- package/dist/types/pm-plugins/mountHyperlink.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/datasource.d.ts +6 -5
- package/dist/types-ts4.5/nodeviews/embedCard.d.ts +3 -3
- package/dist/types-ts4.5/nodeviews/genericCard.d.ts +7 -7
- package/dist/types-ts4.5/plugin.d.ts +4 -0
- package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/mountHyperlink.d.ts +1 -1
- package/package.json +12 -12
- package/report.api.md +1 -1
- package/tmp/api-report-tmp.d.ts +193 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-card
|
|
2
2
|
|
|
3
|
+
## 0.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`ad3c5c21079`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ad3c5c21079) - Updating all plugins with minor version to correct issue with semver.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 0.4.9
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [`8467bdcdf4f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8467bdcdf4f) - Removing `dependencies` prop from PluginInjectionAPI and changing
|
|
18
|
+
signature of `NextEditorPlugin`.
|
|
19
|
+
|
|
20
|
+
Previously a `NextEditorPlugin` would be consumed as so:
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
const plugin: NextEditorPlugin< ... > = (config, api) => {
|
|
24
|
+
// Can use api like so:
|
|
25
|
+
api.dependencies.core.actions.execute( ... )
|
|
26
|
+
return { ... }
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Now these have become named parameters like so and the `pluginInjectionAPI` is used
|
|
31
|
+
without the `dependencies` prop:
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
const plugin: NextEditorPlugin< ... > = ({ config, api }) => {
|
|
35
|
+
// Can use api like so:
|
|
36
|
+
api.core.actions.execute( ... )
|
|
37
|
+
return { ... }
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
- Updated dependencies
|
|
42
|
+
|
|
3
43
|
## 0.4.8
|
|
4
44
|
|
|
5
45
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,7 +1,30 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Editor plugin card
|
|
2
2
|
|
|
3
3
|
Card plugin for @atlaskit/editor-core
|
|
4
4
|
|
|
5
|
+
**Note:** This component is designed for internal Atlassian development.
|
|
6
|
+
External contributors will be able to use this component but will not be able to submit issues.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
---
|
|
10
|
+
- **Install** - *yarn add @atlaskit/editor-plugin-card*
|
|
11
|
+
- **npm** - [@atlaskit/editor-plugin-card](https://www.npmjs.com/package/@atlaskit/editor-plugin-card)
|
|
12
|
+
- **Source** - [Bitbucket](https://bitbucket.org/atlassian/atlassian-frontend/src/master/packages/editor/editor-plugin-card)
|
|
13
|
+
- **Bundle** - [unpkg.com](https://unpkg.com/@atlaskit/editor-plugin-card/dist/)
|
|
14
|
+
|
|
5
15
|
## Usage
|
|
16
|
+
---
|
|
17
|
+
**Internal use only**
|
|
18
|
+
|
|
19
|
+
@atlaskit/editor-plugin-card is intended for internal use by the @atlaskit/editor-core and as a plugin dependency of the Editor within your product.
|
|
20
|
+
|
|
21
|
+
Direct use of this component is not supported.
|
|
22
|
+
|
|
23
|
+
Please see [Atlaskit - Editor plugin card](https://atlaskit.atlassian.com/packages/editor/editor-plugin-card) for documentation and examples for this package.
|
|
6
24
|
|
|
7
|
-
|
|
25
|
+
## Support
|
|
26
|
+
---
|
|
27
|
+
For internal Atlassian, visit the slack channel [#help-editor](https://atlassian.slack.com/archives/CFG3PSQ9E) for support or visit [go/editor-help](https://go/editor-help) to submit a bug.
|
|
28
|
+
## License
|
|
29
|
+
---
|
|
30
|
+
Please see [Atlassian Frontend - License](https://developer.atlassian.com/cloud/framework/atlassian-frontend/#license) for more licensing information.
|
|
@@ -22,8 +22,8 @@ var _utils = require("@atlaskit/editor-common/utils");
|
|
|
22
22
|
var _linkDatasource = require("@atlaskit/link-datasource");
|
|
23
23
|
var _datasourceErrorBoundary = require("../datasourceErrorBoundary");
|
|
24
24
|
var _doc = require("../pm-plugins/doc");
|
|
25
|
-
function ownKeys(
|
|
26
|
-
function _objectSpread(
|
|
25
|
+
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; }
|
|
26
|
+
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; }
|
|
27
27
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
28
28
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /** @jsx jsx */
|
|
29
29
|
var getPosSafely = function getPosSafely(pos) {
|
|
@@ -126,7 +126,7 @@ var Datasource = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
126
126
|
(0, _inherits2.default)(Datasource, _ReactNodeView);
|
|
127
127
|
var _super2 = _createSuper(Datasource);
|
|
128
128
|
function Datasource(props) {
|
|
129
|
-
var _props$pluginInjectio, _props$pluginInjectio2,
|
|
129
|
+
var _props$pluginInjectio, _props$pluginInjectio2, _sharedState$currentS;
|
|
130
130
|
var _this2;
|
|
131
131
|
(0, _classCallCheck2.default)(this, Datasource);
|
|
132
132
|
_this2 = _super2.call(this, props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props, undefined, true, undefined, props.hasIntlContext);
|
|
@@ -147,7 +147,7 @@ var Datasource = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
147
147
|
tr.setMeta('scrollIntoView', false);
|
|
148
148
|
return dispatch(tr);
|
|
149
149
|
});
|
|
150
|
-
var sharedState = props === null || props === void 0 ? void 0 : (_props$pluginInjectio = props.pluginInjectionApi) === null || _props$pluginInjectio === void 0 ? void 0 : (_props$pluginInjectio2 = _props$pluginInjectio.
|
|
150
|
+
var sharedState = props === null || props === void 0 ? void 0 : (_props$pluginInjectio = props.pluginInjectionApi) === null || _props$pluginInjectio === void 0 ? void 0 : (_props$pluginInjectio2 = _props$pluginInjectio.width) === null || _props$pluginInjectio2 === void 0 ? void 0 : _props$pluginInjectio2.sharedState;
|
|
151
151
|
_this2.tableWidth = sharedState === null || sharedState === void 0 ? void 0 : (_sharedState$currentS = sharedState.currentState()) === null || _sharedState$currentS === void 0 ? void 0 : _sharedState$currentS.width;
|
|
152
152
|
sharedState === null || sharedState === void 0 ? void 0 : sharedState.onChange(function (_ref3) {
|
|
153
153
|
var nextSharedState = _ref3.nextSharedState;
|
|
@@ -27,8 +27,8 @@ var _smartCard = require("@atlaskit/smart-card");
|
|
|
27
27
|
var _actions = require("../pm-plugins/actions");
|
|
28
28
|
var _ResizableEmbedCard = _interopRequireDefault(require("../ui/ResizableEmbedCard"));
|
|
29
29
|
var _genericCard = require("./genericCard");
|
|
30
|
-
function ownKeys(
|
|
31
|
-
function _objectSpread(
|
|
30
|
+
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; }
|
|
31
|
+
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; }
|
|
32
32
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
33
33
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
34
34
|
var CardInner = function CardInner(_ref) {
|
|
@@ -78,8 +78,8 @@ var CardInner = function CardInner(_ref) {
|
|
|
78
78
|
}), smartCard);
|
|
79
79
|
}
|
|
80
80
|
var displayGrid = function displayGrid(visible, gridType, highlight) {
|
|
81
|
-
var _pluginInjectionApi$
|
|
82
|
-
return pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
81
|
+
var _pluginInjectionApi$g;
|
|
82
|
+
return pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$g = pluginInjectionApi.grid.actions) === null || _pluginInjectionApi$g === void 0 ? void 0 : _pluginInjectionApi$g.displayGrid(view)({
|
|
83
83
|
visible: visible,
|
|
84
84
|
gridType: gridType,
|
|
85
85
|
highlight: highlight
|
|
@@ -87,7 +87,7 @@ function Card(SmartCardComponent, UnsupportedComponent) {
|
|
|
87
87
|
// (2) Render a blue link whilst downgrading to `link` in the ADF (fatal errs).
|
|
88
88
|
|
|
89
89
|
if (maybeAPIError.kind && maybeAPIError.kind === 'fatal') {
|
|
90
|
-
var _pluginInjectionApi$
|
|
90
|
+
var _pluginInjectionApi$a;
|
|
91
91
|
this.setState({
|
|
92
92
|
isError: true
|
|
93
93
|
});
|
|
@@ -101,7 +101,7 @@ function Card(SmartCardComponent, UnsupportedComponent) {
|
|
|
101
101
|
if (!getPos || typeof getPos === 'boolean') {
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
|
-
(0, _doc.changeSelectedCardToLinkFallback)(undefined, url, true, node, getPos(), pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
104
|
+
(0, _doc.changeSelectedCardToLinkFallback)(undefined, url, true, node, getPos(), pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions)(view.state, view.dispatch);
|
|
105
105
|
return null;
|
|
106
106
|
} else {
|
|
107
107
|
// Otherwise, render a blue link as fallback (above in render()).
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -24,11 +24,17 @@ var _ModalWithState = _interopRequireDefault(require("./ui/DatasourceModal/Modal
|
|
|
24
24
|
var _EditorLinkingPlatformAnalytics = require("./ui/EditorLinkingPlatformAnalytics");
|
|
25
25
|
var _EditorSmartCardEvents = require("./ui/EditorSmartCardEvents");
|
|
26
26
|
var _LayoutButton = _interopRequireDefault(require("./ui/LayoutButton"));
|
|
27
|
-
function ownKeys(
|
|
28
|
-
function _objectSpread(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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; }
|
|
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; }
|
|
29
|
+
/**
|
|
30
|
+
* Card plugin to be added to an `EditorPresetBuilder` and used with `ComposableEditor`
|
|
31
|
+
* from `@atlaskit/editor-core`.
|
|
32
|
+
*/
|
|
33
|
+
var cardPlugin = function cardPlugin(_ref) {
|
|
34
|
+
var _api$featureFlags;
|
|
35
|
+
var options = _ref.config,
|
|
36
|
+
api = _ref.api;
|
|
37
|
+
var featureFlags = (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
|
|
32
38
|
var cardPluginEvents = featureFlags !== null && featureFlags !== void 0 && featureFlags.lpAnalyticsEventsNext ? (0, _createEventsQueue.createEventsQueue)() : undefined;
|
|
33
39
|
return {
|
|
34
40
|
name: 'card',
|
|
@@ -81,18 +87,18 @@ var cardPlugin = function cardPlugin(options, api) {
|
|
|
81
87
|
}];
|
|
82
88
|
plugins.push({
|
|
83
89
|
name: 'cardKeymap',
|
|
84
|
-
plugin: function plugin(
|
|
85
|
-
var featureFlags =
|
|
90
|
+
plugin: function plugin(_ref2) {
|
|
91
|
+
var featureFlags = _ref2.featureFlags;
|
|
86
92
|
return (0, _keymap.cardKeymap)(featureFlags);
|
|
87
93
|
}
|
|
88
94
|
});
|
|
89
95
|
return plugins;
|
|
90
96
|
},
|
|
91
|
-
contentComponent: function contentComponent(
|
|
92
|
-
var editorView =
|
|
93
|
-
popupsMountPoint =
|
|
94
|
-
popupsScrollableElement =
|
|
95
|
-
popupsBoundariesElement =
|
|
97
|
+
contentComponent: function contentComponent(_ref3) {
|
|
98
|
+
var editorView = _ref3.editorView,
|
|
99
|
+
popupsMountPoint = _ref3.popupsMountPoint,
|
|
100
|
+
popupsScrollableElement = _ref3.popupsScrollableElement,
|
|
101
|
+
popupsBoundariesElement = _ref3.popupsBoundariesElement;
|
|
96
102
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_EditorSmartCardEvents.EditorSmartCardEvents, {
|
|
97
103
|
editorView: editorView
|
|
98
104
|
}), cardPluginEvents && /*#__PURE__*/_react.default.createElement(_EditorLinkingPlatformAnalytics.EditorLinkingPlatformAnalytics, {
|
|
@@ -117,8 +123,8 @@ var cardPlugin = function cardPlugin(options, api) {
|
|
|
117
123
|
},
|
|
118
124
|
pluginsOptions: {
|
|
119
125
|
floatingToolbar: (0, _toolbar.floatingToolbar)(options, featureFlags, options.platform, options.linkPicker, api),
|
|
120
|
-
quickInsert: function quickInsert(
|
|
121
|
-
var formatMessage =
|
|
126
|
+
quickInsert: function quickInsert(_ref4) {
|
|
127
|
+
var formatMessage = _ref4.formatMessage;
|
|
122
128
|
var quickInsertArray = [];
|
|
123
129
|
if (!options.allowDatasource) {
|
|
124
130
|
return quickInsertArray;
|
|
@@ -18,8 +18,8 @@ var _utils2 = require("../utils");
|
|
|
18
18
|
var _actions = require("./actions");
|
|
19
19
|
var _pluginKey = require("./plugin-key");
|
|
20
20
|
var _shouldReplaceLink = require("./shouldReplaceLink");
|
|
21
|
-
function ownKeys(
|
|
22
|
-
function _objectSpread(
|
|
21
|
+
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; }
|
|
22
|
+
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; }
|
|
23
23
|
/**
|
|
24
24
|
* Attempt to replace the link into the respective card.
|
|
25
25
|
*/
|
|
@@ -135,8 +135,8 @@ var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
135
135
|
* other tasks as per common implementations of the JavaScript event loop in browsers.
|
|
136
136
|
*/
|
|
137
137
|
var invoke = (0, _rafSchd.default)(function () {
|
|
138
|
-
var _pluginInjectionApi$
|
|
139
|
-
return (0, _resolve.resolveWithProvider)(view, provider, request, options, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
138
|
+
var _pluginInjectionApi$a, _pluginInjectionApi$a2, _pluginInjectionApi$a3, _pluginInjectionApi$a4;
|
|
139
|
+
return (0, _resolve.resolveWithProvider)(view, provider, request, options, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions, (_pluginInjectionApi$a2 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : (_pluginInjectionApi$a4 = _pluginInjectionApi$a3.sharedState.currentState()) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.createAnalyticsEvent) !== null && _pluginInjectionApi$a2 !== void 0 ? _pluginInjectionApi$a2 : undefined);
|
|
140
140
|
});
|
|
141
141
|
rafCancellationCallbacks.push(invoke.cancel);
|
|
142
142
|
invoke();
|
|
@@ -32,14 +32,14 @@ var mountHyperlinkPlugin = function mountHyperlinkPlugin(pluginInjectionApi, opt
|
|
|
32
32
|
return new _safePlugin.SafePlugin({
|
|
33
33
|
view: function view(editorView) {
|
|
34
34
|
requestAnimationFrame(function () {
|
|
35
|
-
var _pluginInjectionApi$
|
|
36
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
35
|
+
var _pluginInjectionApi$h, _pluginInjectionApi$h2;
|
|
36
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$h = pluginInjectionApi.hyperlink) === null || _pluginInjectionApi$h === void 0 ? void 0 : (_pluginInjectionApi$h2 = _pluginInjectionApi$h.actions) === null || _pluginInjectionApi$h2 === void 0 ? void 0 : _pluginInjectionApi$h2.prependToolbarButtons({
|
|
37
37
|
items: function items(state, intl, providerFactory, link) {
|
|
38
38
|
return [].concat((0, _toConsumableArray2.default)(getToolbarViewedItem(link)), [{
|
|
39
39
|
type: 'custom',
|
|
40
40
|
fallback: [],
|
|
41
41
|
render: function render(editorView) {
|
|
42
|
-
var _pluginInjectionApi$
|
|
42
|
+
var _pluginInjectionApi$a, _pluginInjectionApi$c;
|
|
43
43
|
return /*#__PURE__*/_react.default.createElement(_HyperlinkToolbarAppearance.HyperlinkToolbarAppearance, {
|
|
44
44
|
key: "link-appearance",
|
|
45
45
|
url: link,
|
|
@@ -49,14 +49,14 @@ var mountHyperlinkPlugin = function mountHyperlinkPlugin(pluginInjectionApi, opt
|
|
|
49
49
|
cardOptions: options,
|
|
50
50
|
providerFactory: providerFactory,
|
|
51
51
|
platform: options === null || options === void 0 ? void 0 : options.platform,
|
|
52
|
-
editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
53
|
-
cardActions: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
52
|
+
editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions,
|
|
53
|
+
cardActions: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c = pluginInjectionApi.card) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.actions
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
56
|
}]);
|
|
57
57
|
},
|
|
58
|
-
onEscapeCallback: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.
|
|
59
|
-
onInsertLinkCallback: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.
|
|
58
|
+
onEscapeCallback: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.card.actions.hideLinkToolbar,
|
|
59
|
+
onInsertLinkCallback: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.card.actions.queueCardsFromChangedTr,
|
|
60
60
|
view: editorView
|
|
61
61
|
});
|
|
62
62
|
});
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
function ownKeys(
|
|
10
|
-
function _objectSpread(
|
|
9
|
+
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; }
|
|
10
|
+
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; }
|
|
11
11
|
var queue = function queue(state, action) {
|
|
12
12
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
13
13
|
requests: state.requests.concat(action.requests)
|
|
@@ -7,8 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.getPluginStateWithUpdatedPos = exports.getPluginState = exports.getNewRequests = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _pluginKey = require("../plugin-key");
|
|
10
|
-
function ownKeys(
|
|
11
|
-
function _objectSpread(
|
|
10
|
+
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; }
|
|
11
|
+
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; }
|
|
12
12
|
// ============================================================================ //
|
|
13
13
|
// ============================== PLUGIN STATE ================================ //
|
|
14
14
|
// ============================================================================ //
|
package/dist/cjs/toolbar.js
CHANGED
|
@@ -31,8 +31,8 @@ var _ToolbarViewedEvent = require("./ui/ToolbarViewedEvent");
|
|
|
31
31
|
var _utils3 = require("./utils");
|
|
32
32
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
33
33
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
34
|
-
function ownKeys(
|
|
35
|
-
function _objectSpread(
|
|
34
|
+
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; }
|
|
35
|
+
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; }
|
|
36
36
|
var removeCard = function removeCard(editorAnalyticsApi) {
|
|
37
37
|
return (0, _card.commandWithMetadata)(function (state, dispatch) {
|
|
38
38
|
if (!(state.selection instanceof _state.NodeSelection)) {
|
|
@@ -196,10 +196,10 @@ var getToolbarViewedItem = function getToolbarViewedItem(url, display) {
|
|
|
196
196
|
};
|
|
197
197
|
var generateToolbarItems = function generateToolbarItems(state, featureFlags, intl, providerFactory, cardOptions, platform, linkPicker, pluginInjectionApi) {
|
|
198
198
|
return function (node) {
|
|
199
|
-
var _pluginInjectionApi$
|
|
199
|
+
var _pluginInjectionApi$a, _pluginInjectionApi$d, _pluginInjectionApi$d2, _node$attrs, _node$attrs2, _node$attrs2$datasour;
|
|
200
200
|
var _titleUrlPairFromNode2 = (0, _utils3.titleUrlPairFromNode)(node),
|
|
201
201
|
url = _titleUrlPairFromNode2.url;
|
|
202
|
-
var _ref = (_pluginInjectionApi$
|
|
202
|
+
var _ref = (_pluginInjectionApi$a = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.analytics) !== null && _pluginInjectionApi$a !== void 0 ? _pluginInjectionApi$a : {},
|
|
203
203
|
editorAnalyticsApi = _ref.actions;
|
|
204
204
|
var metadata = {};
|
|
205
205
|
if (url && !(0, _adfSchema.isSafeUrl)(url)) {
|
|
@@ -214,7 +214,7 @@ var generateToolbarItems = function generateToolbarItems(state, featureFlags, in
|
|
|
214
214
|
}
|
|
215
215
|
var pluginState = _main.pluginKey.getState(state);
|
|
216
216
|
var currentAppearance = (0, _utils3.appearanceForNodeType)(node.type);
|
|
217
|
-
var _ref2 = (_pluginInjectionApi$
|
|
217
|
+
var _ref2 = (_pluginInjectionApi$d = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d2 = pluginInjectionApi.decorations) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions) !== null && _pluginInjectionApi$d !== void 0 ? _pluginInjectionApi$d : {},
|
|
218
218
|
hoverDecoration = _ref2.hoverDecoration;
|
|
219
219
|
var isDatasource = currentAppearance === 'block' && (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.datasource);
|
|
220
220
|
var shouldRenderDatasourceToolbar = isDatasource &&
|
|
@@ -278,8 +278,8 @@ var generateToolbarItems = function generateToolbarItems(state, featureFlags, in
|
|
|
278
278
|
onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
|
|
279
279
|
}]);
|
|
280
280
|
if (currentAppearance === 'embed') {
|
|
281
|
-
var _pluginInjectionApi$
|
|
282
|
-
var alignmentOptions = buildAlignmentOptions(state, intl, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 :
|
|
281
|
+
var _pluginInjectionApi$a2;
|
|
282
|
+
var alignmentOptions = buildAlignmentOptions(state, intl, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.width, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions, cardOptions);
|
|
283
283
|
if (alignmentOptions.length) {
|
|
284
284
|
alignmentOptions.push({
|
|
285
285
|
type: 'separator'
|
|
@@ -308,7 +308,7 @@ var generateToolbarItems = function generateToolbarItems(state, featureFlags, in
|
|
|
308
308
|
allowBlockCards: allowBlockCards,
|
|
309
309
|
platform: platform,
|
|
310
310
|
editorAnalyticsApi: editorAnalyticsApi,
|
|
311
|
-
cardActions: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.
|
|
311
|
+
cardActions: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.card.actions
|
|
312
312
|
});
|
|
313
313
|
}
|
|
314
314
|
}, {
|
|
@@ -120,7 +120,7 @@ var EditLinkToolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
120
120
|
},
|
|
121
121
|
onEscapeCallback: function onEscapeCallback(state, dispatch) {
|
|
122
122
|
var tr = state.tr;
|
|
123
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.
|
|
123
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.hyperlink.actions.hideLinkToolbar(tr);
|
|
124
124
|
(0, _actions.hideLinkToolbar)(tr);
|
|
125
125
|
forceFocusSelector === null || forceFocusSelector === void 0 ? void 0 : forceFocusSelector("[aria-label=\"".concat(_messages.linkToolbarMessages.editLink.defaultMessage, "\"]"))(tr);
|
|
126
126
|
if (dispatch) {
|
|
@@ -131,7 +131,7 @@ var EditLinkToolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
131
131
|
},
|
|
132
132
|
onClickAwayCallback: function onClickAwayCallback(state, dispatch) {
|
|
133
133
|
var tr = state.tr;
|
|
134
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.
|
|
134
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.hyperlink.actions.hideLinkToolbar(tr);
|
|
135
135
|
if (dispatch) {
|
|
136
136
|
dispatch(tr);
|
|
137
137
|
return true;
|
|
@@ -172,7 +172,7 @@ var buildEditLinkToolbar = function buildEditLinkToolbar(_ref2) {
|
|
|
172
172
|
disableArrowNavigation: true,
|
|
173
173
|
fallback: [],
|
|
174
174
|
render: function render(view, idx) {
|
|
175
|
-
var _pluginInjectionApi$
|
|
175
|
+
var _pluginInjectionApi$f;
|
|
176
176
|
if (!view || !providerFactory) {
|
|
177
177
|
return null;
|
|
178
178
|
}
|
|
@@ -187,7 +187,7 @@ var buildEditLinkToolbar = function buildEditLinkToolbar(_ref2) {
|
|
|
187
187
|
text: displayInfo.title || '',
|
|
188
188
|
node: node,
|
|
189
189
|
featureFlags: featureFlags,
|
|
190
|
-
forceFocusSelector: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
190
|
+
forceFocusSelector: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$f = pluginInjectionApi.floatingToolbar.actions) === null || _pluginInjectionApi$f === void 0 ? void 0 : _pluginInjectionApi$f.forceFocusSelector,
|
|
191
191
|
onSubmit: function onSubmit(newHref, newText, inputMethod, analytic) {
|
|
192
192
|
var urlChanged = newHref !== displayInfo.url;
|
|
193
193
|
var titleChanged = newText !== displayInfo.title;
|
|
@@ -195,8 +195,8 @@ var buildEditLinkToolbar = function buildEditLinkToolbar(_ref2) {
|
|
|
195
195
|
// If the title is changed in a smartlink, convert to standard blue hyperlink
|
|
196
196
|
// (even if the url was also changed) - we don't want to lose the custom title.
|
|
197
197
|
if (titleChanged) {
|
|
198
|
-
var _pluginInjectionApi$
|
|
199
|
-
return (0, _card.commandWithMetadata)((0, _doc.changeSelectedCardToLink)(newText, newHref, undefined, undefined, undefined, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
198
|
+
var _pluginInjectionApi$a;
|
|
199
|
+
return (0, _card.commandWithMetadata)((0, _doc.changeSelectedCardToLink)(newText, newHref, undefined, undefined, undefined, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions), {
|
|
200
200
|
action: _analytics.ACTION.UPDATED,
|
|
201
201
|
inputMethod: inputMethod,
|
|
202
202
|
sourceEvent: analytic
|
|
@@ -21,8 +21,8 @@ var _actions = require("../../pm-plugins/actions");
|
|
|
21
21
|
var _utils2 = require("./utils");
|
|
22
22
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
23
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
24
|
-
function ownKeys(
|
|
25
|
-
function _objectSpread(
|
|
24
|
+
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; }
|
|
25
|
+
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; } /** @jsx jsx */
|
|
26
26
|
var toolbarButtonWrapperStyles = (0, _react2.css)({
|
|
27
27
|
background: "".concat("var(--ds-background-neutral, ".concat(_colors.N20A, ")")),
|
|
28
28
|
color: "".concat("var(--ds-icon, ".concat(_colors.N300, ")")),
|
|
@@ -22,8 +22,8 @@ var _utils = require("@atlaskit/editor-common/utils");
|
|
|
22
22
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
23
23
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
24
24
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
|
-
function ownKeys(
|
|
26
|
-
function _objectSpread(
|
|
25
|
+
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; }
|
|
26
|
+
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; }
|
|
27
27
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
28
28
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
29
29
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
@@ -20,8 +20,8 @@ var _ui = require("@atlaskit/editor-common/ui");
|
|
|
20
20
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
21
21
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
22
22
|
var _smartCard = require("@atlaskit/smart-card");
|
|
23
|
-
function ownKeys(
|
|
24
|
-
function _objectSpread(
|
|
23
|
+
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; }
|
|
24
|
+
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; }
|
|
25
25
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
26
26
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /** @jsx jsx */
|
|
27
27
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
@@ -14,8 +14,8 @@ var _CardContextProvider = require("./CardContextProvider");
|
|
|
14
14
|
var _EditorAnalyticsContext = require("./EditorAnalyticsContext");
|
|
15
15
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
-
function ownKeys(
|
|
18
|
-
function _objectSpread(
|
|
17
|
+
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; }
|
|
18
|
+
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; }
|
|
19
19
|
var getResolvedAttributesFromStore = function getResolvedAttributesFromStore(url, display, store) {
|
|
20
20
|
if (!store) {
|
|
21
21
|
return {};
|
|
@@ -95,7 +95,7 @@ _defineProperty(DatasourceComponent, "contextTypes", {
|
|
|
95
95
|
});
|
|
96
96
|
export class Datasource extends ReactNodeView {
|
|
97
97
|
constructor(props) {
|
|
98
|
-
var _props$pluginInjectio, _props$pluginInjectio2,
|
|
98
|
+
var _props$pluginInjectio, _props$pluginInjectio2, _sharedState$currentS;
|
|
99
99
|
super(props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props, undefined, true, undefined, props.hasIntlContext);
|
|
100
100
|
// this is necessary so that the datasource toolbar won't be rendered on error
|
|
101
101
|
_defineProperty(this, "updateNodeRemoveAttrs", () => {
|
|
@@ -117,7 +117,7 @@ export class Datasource extends ReactNodeView {
|
|
|
117
117
|
tr.setMeta('scrollIntoView', false);
|
|
118
118
|
return dispatch(tr);
|
|
119
119
|
});
|
|
120
|
-
const sharedState = props === null || props === void 0 ? void 0 : (_props$pluginInjectio = props.pluginInjectionApi) === null || _props$pluginInjectio === void 0 ? void 0 : (_props$pluginInjectio2 = _props$pluginInjectio.
|
|
120
|
+
const sharedState = props === null || props === void 0 ? void 0 : (_props$pluginInjectio = props.pluginInjectionApi) === null || _props$pluginInjectio === void 0 ? void 0 : (_props$pluginInjectio2 = _props$pluginInjectio.width) === null || _props$pluginInjectio2 === void 0 ? void 0 : _props$pluginInjectio2.sharedState;
|
|
121
121
|
this.tableWidth = sharedState === null || sharedState === void 0 ? void 0 : (_sharedState$currentS = sharedState.currentState()) === null || _sharedState$currentS === void 0 ? void 0 : _sharedState$currentS.width;
|
|
122
122
|
sharedState === null || sharedState === void 0 ? void 0 : sharedState.onChange(({
|
|
123
123
|
nextSharedState
|
|
@@ -62,8 +62,8 @@ const CardInner = ({
|
|
|
62
62
|
}), smartCard);
|
|
63
63
|
}
|
|
64
64
|
const displayGrid = (visible, gridType, highlight) => {
|
|
65
|
-
var _pluginInjectionApi$
|
|
66
|
-
return pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
65
|
+
var _pluginInjectionApi$g;
|
|
66
|
+
return pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$g = pluginInjectionApi.grid.actions) === null || _pluginInjectionApi$g === void 0 ? void 0 : _pluginInjectionApi$g.displayGrid(view)({
|
|
67
67
|
visible,
|
|
68
68
|
gridType,
|
|
69
69
|
highlight: highlight
|
|
@@ -61,7 +61,7 @@ export function Card(SmartCardComponent, UnsupportedComponent) {
|
|
|
61
61
|
// (2) Render a blue link whilst downgrading to `link` in the ADF (fatal errs).
|
|
62
62
|
|
|
63
63
|
if (maybeAPIError.kind && maybeAPIError.kind === 'fatal') {
|
|
64
|
-
var _pluginInjectionApi$
|
|
64
|
+
var _pluginInjectionApi$a;
|
|
65
65
|
this.setState({
|
|
66
66
|
isError: true
|
|
67
67
|
});
|
|
@@ -77,7 +77,7 @@ export function Card(SmartCardComponent, UnsupportedComponent) {
|
|
|
77
77
|
if (!getPos || typeof getPos === 'boolean') {
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
80
|
-
changeSelectedCardToLinkFallback(undefined, url, true, node, getPos(), pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
80
|
+
changeSelectedCardToLinkFallback(undefined, url, true, node, getPos(), pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions)(view.state, view.dispatch);
|
|
81
81
|
return null;
|
|
82
82
|
} else {
|
|
83
83
|
// Otherwise, render a blue link as fallback (above in render()).
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -16,9 +16,16 @@ import DatasourceModalWithState from './ui/DatasourceModal/ModalWithState';
|
|
|
16
16
|
import { EditorLinkingPlatformAnalytics } from './ui/EditorLinkingPlatformAnalytics';
|
|
17
17
|
import { EditorSmartCardEvents } from './ui/EditorSmartCardEvents';
|
|
18
18
|
import LayoutButton from './ui/LayoutButton';
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Card plugin to be added to an `EditorPresetBuilder` and used with `ComposableEditor`
|
|
21
|
+
* from `@atlaskit/editor-core`.
|
|
22
|
+
*/
|
|
23
|
+
export const cardPlugin = ({
|
|
24
|
+
config: options,
|
|
25
|
+
api
|
|
26
|
+
}) => {
|
|
27
|
+
var _api$featureFlags;
|
|
28
|
+
const featureFlags = (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
|
|
22
29
|
const cardPluginEvents = featureFlags !== null && featureFlags !== void 0 && featureFlags.lpAnalyticsEventsNext ? createEventsQueue() : undefined;
|
|
23
30
|
return {
|
|
24
31
|
name: 'card',
|
|
@@ -129,8 +129,8 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
|
|
|
129
129
|
* other tasks as per common implementations of the JavaScript event loop in browsers.
|
|
130
130
|
*/
|
|
131
131
|
const invoke = rafSchedule(() => {
|
|
132
|
-
var _pluginInjectionApi$
|
|
133
|
-
return resolveWithProvider(view, provider, request, options, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
132
|
+
var _pluginInjectionApi$a, _pluginInjectionApi$a2, _pluginInjectionApi$a3, _pluginInjectionApi$a4;
|
|
133
|
+
return resolveWithProvider(view, provider, request, options, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions, (_pluginInjectionApi$a2 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : (_pluginInjectionApi$a4 = _pluginInjectionApi$a3.sharedState.currentState()) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.createAnalyticsEvent) !== null && _pluginInjectionApi$a2 !== void 0 ? _pluginInjectionApi$a2 : undefined);
|
|
134
134
|
});
|
|
135
135
|
rafCancellationCallbacks.push(invoke.cancel);
|
|
136
136
|
invoke();
|