@atlaskit/editor-plugin-card 2.15.2 → 3.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 +20 -0
- package/dist/cjs/analytics/utils.js +6 -6
- package/dist/cjs/datasourceErrorBoundary.js +1 -1
- package/dist/cjs/nodeviews/blockCard.js +15 -22
- package/dist/cjs/nodeviews/datasource.js +1 -1
- package/dist/cjs/nodeviews/embedCard.js +14 -21
- package/dist/cjs/nodeviews/genericCard.js +2 -2
- package/dist/cjs/nodeviews/inlineCard.js +1 -1
- package/dist/cjs/nodeviews/inlineCardWithAwareness.js +1 -1
- package/dist/cjs/nodeviews/lazy-block-card.js +3 -3
- package/dist/cjs/nodeviews/lazy-embed-card.js +3 -3
- package/dist/cjs/plugin.js +3 -2
- package/dist/cjs/pm-plugins/main.js +1 -4
- package/dist/cjs/pm-plugins/reducers.js +1 -1
- package/dist/cjs/toDOM-fixes/blockCard.js +2 -2
- package/dist/cjs/toDOM-fixes/embedCard.js +2 -2
- package/dist/cjs/toolbar.js +12 -19
- package/dist/cjs/ui/CardContextProvider.js +1 -1
- package/dist/cjs/ui/DatasourceModal/index.js +8 -8
- package/dist/cjs/ui/EditLinkToolbar.js +1 -1
- package/dist/cjs/ui/EditorLinkingPlatformAnalytics/index.js +1 -1
- package/dist/cjs/ui/HyperlinkToolbarAppearance.js +1 -3
- package/dist/cjs/ui/InlineCardOverlay/index.js +1 -1
- package/dist/cjs/ui/LinkToolbarAppearance.js +3 -4
- package/dist/cjs/ui/Pulse/index.js +1 -1
- package/dist/cjs/ui/ResizableEmbedCard.js +1 -1
- package/dist/cjs/ui/ToolbarViewedEvent.js +1 -1
- package/dist/es2019/nodeviews/blockCard.js +13 -20
- package/dist/es2019/nodeviews/embedCard.js +12 -19
- package/dist/es2019/nodeviews/lazy-block-card.js +2 -2
- package/dist/es2019/nodeviews/lazy-embed-card.js +2 -2
- package/dist/es2019/plugin.js +2 -2
- package/dist/es2019/pm-plugins/main.js +1 -4
- package/dist/es2019/toDOM-fixes/blockCard.js +2 -2
- package/dist/es2019/toDOM-fixes/embedCard.js +2 -2
- package/dist/es2019/toolbar.js +11 -18
- package/dist/es2019/ui/HyperlinkToolbarAppearance.js +0 -2
- package/dist/es2019/ui/LinkToolbarAppearance.js +1 -2
- package/dist/esm/analytics/utils.js +6 -6
- package/dist/esm/datasourceErrorBoundary.js +1 -1
- package/dist/esm/nodeviews/blockCard.js +15 -22
- package/dist/esm/nodeviews/datasource.js +1 -1
- package/dist/esm/nodeviews/embedCard.js +14 -21
- package/dist/esm/nodeviews/genericCard.js +1 -1
- package/dist/esm/nodeviews/lazy-block-card.js +2 -2
- package/dist/esm/nodeviews/lazy-embed-card.js +2 -2
- package/dist/esm/plugin.js +3 -2
- package/dist/esm/pm-plugins/main.js +1 -4
- package/dist/esm/pm-plugins/reducers.js +1 -1
- package/dist/esm/toDOM-fixes/blockCard.js +2 -2
- package/dist/esm/toDOM-fixes/embedCard.js +2 -2
- package/dist/esm/toolbar.js +11 -18
- package/dist/esm/ui/CardContextProvider.js +1 -1
- package/dist/esm/ui/DatasourceModal/index.js +7 -7
- package/dist/esm/ui/EditLinkToolbar.js +1 -1
- package/dist/esm/ui/EditorLinkingPlatformAnalytics/index.js +1 -1
- package/dist/esm/ui/HyperlinkToolbarAppearance.js +0 -2
- package/dist/esm/ui/LinkToolbarAppearance.js +2 -3
- package/dist/esm/ui/ResizableEmbedCard.js +1 -1
- package/dist/types/nodeviews/blockCard.d.ts +2 -3
- package/dist/types/nodeviews/embedCard.d.ts +2 -3
- package/dist/types/nodeviews/genericCard.d.ts +1 -3
- package/dist/types/plugin.d.ts +1 -1
- package/dist/types/toolbar.d.ts +1 -2
- package/dist/types/types.d.ts +0 -1
- package/dist/types/ui/HyperlinkToolbarAppearance.d.ts +0 -2
- package/dist/types/ui/LinkToolbarAppearance.d.ts +0 -2
- package/dist/types-ts4.5/nodeviews/blockCard.d.ts +2 -3
- package/dist/types-ts4.5/nodeviews/embedCard.d.ts +2 -3
- package/dist/types-ts4.5/nodeviews/genericCard.d.ts +1 -3
- package/dist/types-ts4.5/plugin.d.ts +1 -1
- package/dist/types-ts4.5/toolbar.d.ts +1 -2
- package/dist/types-ts4.5/types.d.ts +0 -1
- package/dist/types-ts4.5/ui/HyperlinkToolbarAppearance.d.ts +0 -2
- package/dist/types-ts4.5/ui/LinkToolbarAppearance.d.ts +0 -2
- package/package.json +4 -6
- package/report.api.md +1 -1
|
@@ -14,10 +14,10 @@ var _actions = require("../../pm-plugins/actions");
|
|
|
14
14
|
var _doc = require("../../pm-plugins/doc");
|
|
15
15
|
var _useFetchDatasourceInfo = require("../useFetchDatasourceInfo");
|
|
16
16
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
17
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
18
|
-
function _createForOfIteratorHelper(
|
|
19
|
-
function _unsupportedIterableToArray(
|
|
20
|
-
function _arrayLikeToArray(
|
|
17
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
19
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
20
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
21
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
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
|
var DatasourceModal = exports.DatasourceModal = function DatasourceModal(_ref) {
|
|
@@ -124,15 +124,15 @@ var resolveColumnsConfig = function resolveColumnsConfig(views) {
|
|
|
124
124
|
try {
|
|
125
125
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
126
126
|
var _step$value = _step.value,
|
|
127
|
-
|
|
127
|
+
key = _step$value.key,
|
|
128
128
|
width = _step$value.width,
|
|
129
129
|
isWrapped = _step$value.isWrapped;
|
|
130
|
-
visibleColumnKeys.push(
|
|
130
|
+
visibleColumnKeys.push(key);
|
|
131
131
|
if (width) {
|
|
132
|
-
columnCustomSizes[
|
|
132
|
+
columnCustomSizes[key] = width;
|
|
133
133
|
}
|
|
134
134
|
if (isWrapped) {
|
|
135
|
-
wrappedColumnKeys.push(
|
|
135
|
+
wrappedColumnKeys.push(key);
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
} catch (err) {
|
|
@@ -22,7 +22,7 @@ var _state = require("@atlaskit/editor-prosemirror/state");
|
|
|
22
22
|
var _actions = require("../pm-plugins/actions");
|
|
23
23
|
var _doc = require("../pm-plugins/doc");
|
|
24
24
|
var _utils = require("../utils");
|
|
25
|
-
function _createSuper(
|
|
25
|
+
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2.default)(t); if (r) { var s = (0, _getPrototypeOf2.default)(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2.default)(this, e); }; }
|
|
26
26
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
27
27
|
function HyperlinkAddToolbarWithState(_ref) {
|
|
28
28
|
var _ref$linkPickerOption = _ref.linkPickerOptions,
|
|
@@ -16,7 +16,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
16
16
|
var _EditorAnalyticsContext = require("../EditorAnalyticsContext");
|
|
17
17
|
var _DatasourceEvents = require("./DatasourceEvents");
|
|
18
18
|
var _LinkEvents = require("./LinkEvents");
|
|
19
|
-
function _createSuper(
|
|
19
|
+
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2.default)(t); if (r) { var s = (0, _getPrototypeOf2.default)(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2.default)(this, e); }; }
|
|
20
20
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
21
21
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
22
22
|
var EditorLinkingPlatformAnalytics = exports.EditorLinkingPlatformAnalytics = /*#__PURE__*/function (_React$PureComponent) {
|
|
@@ -18,7 +18,7 @@ var _DatasourceAppearanceButton = require("./DatasourceAppearanceButton");
|
|
|
18
18
|
var _EditDatasourceButton = require("./EditDatasourceButton");
|
|
19
19
|
var _LinkToolbarAppearance = require("./LinkToolbarAppearance");
|
|
20
20
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
21
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
21
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
22
22
|
function HyperlinkToolbarAppearance(props) {
|
|
23
23
|
var _props$cardOptions3;
|
|
24
24
|
var _useState = (0, _react.useState)(new Map()),
|
|
@@ -31,7 +31,6 @@ function HyperlinkToolbarAppearance(props) {
|
|
|
31
31
|
editorView = props.editorView,
|
|
32
32
|
editorState = props.editorState,
|
|
33
33
|
cardOptions = props.cardOptions,
|
|
34
|
-
platform = props.platform,
|
|
35
34
|
editorAnalyticsApi = props.editorAnalyticsApi;
|
|
36
35
|
var getProvider = /*#__PURE__*/function () {
|
|
37
36
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
@@ -151,7 +150,6 @@ function HyperlinkToolbarAppearance(props) {
|
|
|
151
150
|
editorState: editorState,
|
|
152
151
|
allowEmbeds: cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowEmbeds,
|
|
153
152
|
allowBlockCards: cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowBlockCards,
|
|
154
|
-
platform: platform,
|
|
155
153
|
editorAnalyticsApi: editorAnalyticsApi
|
|
156
154
|
}), (cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowDatasource) && /*#__PURE__*/_react.default.createElement(_DatasourceAppearanceButton.DatasourceAppearanceButton, {
|
|
157
155
|
intl: intl,
|
|
@@ -29,7 +29,7 @@ var _active;
|
|
|
29
29
|
*/
|
|
30
30
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
31
31
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
32
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
32
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
33
33
|
var DEBOUNCE_IN_MS = 5;
|
|
34
34
|
var ESTIMATED_MIN_WIDTH_IN_PX = 16;
|
|
35
35
|
var PADDING_IN_PX = 4;
|
|
@@ -27,10 +27,10 @@ var _toolbar = require("../toolbar");
|
|
|
27
27
|
var _utils2 = require("../utils");
|
|
28
28
|
var _Pulse = require("./Pulse");
|
|
29
29
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
30
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
30
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
31
31
|
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; }
|
|
32
32
|
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; }
|
|
33
|
-
function _createSuper(
|
|
33
|
+
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2.default)(t); if (r) { var s = (0, _getPrototypeOf2.default)(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2.default)(this, e); }; }
|
|
34
34
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
35
35
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
36
36
|
var LinkToolbarAppearance = exports.LinkToolbarAppearance = /*#__PURE__*/function (_React$Component) {
|
|
@@ -53,12 +53,11 @@ var LinkToolbarAppearance = exports.LinkToolbarAppearance = /*#__PURE__*/functio
|
|
|
53
53
|
allowEmbeds = _this$props.allowEmbeds,
|
|
54
54
|
_this$props$allowBloc = _this$props.allowBlockCards,
|
|
55
55
|
allowBlockCards = _this$props$allowBloc === void 0 ? true : _this$props$allowBloc,
|
|
56
|
-
platform = _this$props.platform,
|
|
57
56
|
editorAnalyticsApi = _this$props.editorAnalyticsApi,
|
|
58
57
|
_this$props$showUpgra = _this$props.showUpgradeDiscoverability,
|
|
59
58
|
showUpgradeDiscoverability = _this$props$showUpgra === void 0 ? true : _this$props$showUpgra,
|
|
60
59
|
isDatasourceView = _this$props.isDatasourceView;
|
|
61
|
-
var preview = allowEmbeds && cardContext && url && cardContext.extractors.getPreview(url,
|
|
60
|
+
var preview = allowEmbeds && cardContext && url && cardContext.extractors.getPreview(url, 'web');
|
|
62
61
|
var defaultCommand = function defaultCommand() {
|
|
63
62
|
return false;
|
|
64
63
|
};
|
|
@@ -10,7 +10,7 @@ var _useAnalyticsEvents2 = require("@atlaskit/analytics-next/useAnalyticsEvents"
|
|
|
10
10
|
var _linkingCommon = require("@atlaskit/linking-common");
|
|
11
11
|
var _localStorage = require("../../common/local-storage");
|
|
12
12
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
13
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
13
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
14
|
var DiscoveryPulse = exports.DiscoveryPulse = function DiscoveryPulse(_ref) {
|
|
15
15
|
var children = _ref.children,
|
|
16
16
|
localStorageKey = _ref.localStorageKey,
|
|
@@ -21,7 +21,7 @@ var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
|
21
21
|
var _smartCard = require("@atlaskit/smart-card");
|
|
22
22
|
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; }
|
|
23
23
|
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; }
|
|
24
|
-
function _createSuper(
|
|
24
|
+
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2.default)(t); if (r) { var s = (0, _getPrototypeOf2.default)(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2.default)(this, e); }; }
|
|
25
25
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /**
|
|
26
26
|
* @jsxRuntime classic
|
|
27
27
|
* @jsx jsx
|
|
@@ -13,7 +13,7 @@ var _utils = require("../utils");
|
|
|
13
13
|
var _CardContextProvider = require("./CardContextProvider");
|
|
14
14
|
var _EditorAnalyticsContext = require("./EditorAnalyticsContext");
|
|
15
15
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
16
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
16
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
17
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
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
|
/**
|
|
@@ -75,7 +75,6 @@ export class BlockCardComponent extends React.PureComponent {
|
|
|
75
75
|
const {
|
|
76
76
|
node,
|
|
77
77
|
cardContext,
|
|
78
|
-
platform,
|
|
79
78
|
actionOptions,
|
|
80
79
|
showServerActions,
|
|
81
80
|
onClick
|
|
@@ -93,7 +92,7 @@ export class BlockCardComponent extends React.PureComponent {
|
|
|
93
92
|
onClick: onClick,
|
|
94
93
|
onResolve: this.onResolve,
|
|
95
94
|
onError: this.onError,
|
|
96
|
-
platform:
|
|
95
|
+
platform: 'web',
|
|
97
96
|
actionOptions: actionOptions,
|
|
98
97
|
showServerActions: showServerActions
|
|
99
98
|
}), this.gapCursorSpan());
|
|
@@ -117,20 +116,18 @@ export class BlockCard extends ReactNodeView {
|
|
|
117
116
|
}
|
|
118
117
|
createDomRef() {
|
|
119
118
|
const domRef = document.createElement('div');
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
domRef.contentEditable = 'true';
|
|
131
|
-
}
|
|
132
|
-
domRef.setAttribute('spellcheck', 'false');
|
|
119
|
+
// workaround Chrome bug in https://product-fabric.atlassian.net/browse/ED-5379
|
|
120
|
+
// see also: https://github.com/ProseMirror/prosemirror/issues/884
|
|
121
|
+
if (fg('linking-platform-contenteditable-false-live-view')) {
|
|
122
|
+
var _this$reactComponentP, _this$reactComponentP2, _this$reactComponentP3, _this$reactComponentP4;
|
|
123
|
+
this.unsubscribe = (_this$reactComponentP = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP === void 0 ? void 0 : (_this$reactComponentP2 = _this$reactComponentP.editorViewMode) === null || _this$reactComponentP2 === void 0 ? void 0 : _this$reactComponentP2.sharedState.onChange(({
|
|
124
|
+
nextSharedState
|
|
125
|
+
}) => this.updateContentEditable(nextSharedState, domRef));
|
|
126
|
+
this.updateContentEditable((_this$reactComponentP3 = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP3 === void 0 ? void 0 : (_this$reactComponentP4 = _this$reactComponentP3.editorViewMode) === null || _this$reactComponentP4 === void 0 ? void 0 : _this$reactComponentP4.sharedState.currentState(), domRef);
|
|
127
|
+
} else {
|
|
128
|
+
domRef.contentEditable = 'true';
|
|
133
129
|
}
|
|
130
|
+
domRef.setAttribute('spellcheck', 'false');
|
|
134
131
|
return domRef;
|
|
135
132
|
}
|
|
136
133
|
// Need this function to check if the datasource attribute was added or not to a blockCard.
|
|
@@ -148,7 +145,6 @@ export class BlockCard extends ReactNodeView {
|
|
|
148
145
|
}
|
|
149
146
|
render() {
|
|
150
147
|
const {
|
|
151
|
-
platform,
|
|
152
148
|
actionOptions,
|
|
153
149
|
showServerActions,
|
|
154
150
|
pluginInjectionApi,
|
|
@@ -158,7 +154,6 @@ export class BlockCard extends ReactNodeView {
|
|
|
158
154
|
node: this.node,
|
|
159
155
|
view: this.view,
|
|
160
156
|
getPos: this.getPos,
|
|
161
|
-
platform: platform,
|
|
162
157
|
actionOptions: actionOptions,
|
|
163
158
|
showServerActions: showServerActions,
|
|
164
159
|
pluginInjectionApi: pluginInjectionApi,
|
|
@@ -172,7 +167,6 @@ export class BlockCard extends ReactNodeView {
|
|
|
172
167
|
}
|
|
173
168
|
export const blockCardNodeView = ({
|
|
174
169
|
pmPluginFactoryParams,
|
|
175
|
-
platform,
|
|
176
170
|
actionOptions,
|
|
177
171
|
showServerActions,
|
|
178
172
|
pluginInjectionApi,
|
|
@@ -185,7 +179,6 @@ export const blockCardNodeView = ({
|
|
|
185
179
|
eventDispatcher
|
|
186
180
|
} = pmPluginFactoryParams;
|
|
187
181
|
const reactComponentProps = {
|
|
188
|
-
platform,
|
|
189
182
|
actionOptions,
|
|
190
183
|
showServerActions,
|
|
191
184
|
pluginInjectionApi,
|
|
@@ -194,7 +187,7 @@ export const blockCardNodeView = ({
|
|
|
194
187
|
const isDatasource = isDatasourceNode(node);
|
|
195
188
|
if (isDatasource) {
|
|
196
189
|
var _node$attrs, _node$attrs$datasourc;
|
|
197
|
-
if (allowDatasource &&
|
|
190
|
+
if (allowDatasource && canRenderDatasource(node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : (_node$attrs$datasourc = _node$attrs.datasource) === null || _node$attrs$datasourc === void 0 ? void 0 : _node$attrs$datasourc.id)) {
|
|
198
191
|
const datasourcePosition = typeof getPos === 'function' && getPos();
|
|
199
192
|
const datasourceResolvedPosition = datasourcePosition && view.state.doc.resolve(datasourcePosition);
|
|
200
193
|
const isNodeNested = !!(datasourceResolvedPosition && datasourceResolvedPosition.depth > 0);
|
|
@@ -144,7 +144,7 @@ export class EmbedCardComponent extends React.PureComponent {
|
|
|
144
144
|
})();
|
|
145
145
|
try {
|
|
146
146
|
const cardContext = this.context.contextAdapter ? this.context.contextAdapter.card : undefined;
|
|
147
|
-
const hasPreview = cardContext && cardContext.value.extractors.getPreview(url,
|
|
147
|
+
const hasPreview = cardContext && cardContext.value.extractors.getPreview(url, 'web');
|
|
148
148
|
if (!hasPreview) {
|
|
149
149
|
this.setState({
|
|
150
150
|
hasPreview: false
|
|
@@ -250,7 +250,6 @@ export class EmbedCardComponent extends React.PureComponent {
|
|
|
250
250
|
const {
|
|
251
251
|
node,
|
|
252
252
|
cardContext,
|
|
253
|
-
platform,
|
|
254
253
|
allowResizing,
|
|
255
254
|
fullWidthMode,
|
|
256
255
|
view,
|
|
@@ -298,7 +297,7 @@ export class EmbedCardComponent extends React.PureComponent {
|
|
|
298
297
|
onError: this.onError,
|
|
299
298
|
frameStyle: "show",
|
|
300
299
|
inheritDimensions: true,
|
|
301
|
-
platform:
|
|
300
|
+
platform: 'web',
|
|
302
301
|
container: this.scrollContainer,
|
|
303
302
|
embedIframeRef: this.embedIframeRef,
|
|
304
303
|
actionOptions: actionOptions,
|
|
@@ -349,26 +348,23 @@ export class EmbedCard extends ReactNodeView {
|
|
|
349
348
|
}
|
|
350
349
|
createDomRef() {
|
|
351
350
|
const domRef = document.createElement('div');
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
domRef.contentEditable = 'true';
|
|
362
|
-
}
|
|
363
|
-
domRef.setAttribute('spellcheck', 'false');
|
|
351
|
+
// It is a tradeoff for the bug mentioned that occurs in Chrome: https://product-fabric.atlassian.net/browse/ED-5379, https://github.com/ProseMirror/prosemirror/issues/884
|
|
352
|
+
if (fg('linking-platform-contenteditable-false-live-view')) {
|
|
353
|
+
var _this$reactComponentP, _this$reactComponentP2, _this$reactComponentP3, _this$reactComponentP4;
|
|
354
|
+
this.unsubscribe = (_this$reactComponentP = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP === void 0 ? void 0 : (_this$reactComponentP2 = _this$reactComponentP.editorViewMode) === null || _this$reactComponentP2 === void 0 ? void 0 : _this$reactComponentP2.sharedState.onChange(({
|
|
355
|
+
nextSharedState
|
|
356
|
+
}) => this.updateContentEditable(nextSharedState, domRef));
|
|
357
|
+
this.updateContentEditable((_this$reactComponentP3 = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP3 === void 0 ? void 0 : (_this$reactComponentP4 = _this$reactComponentP3.editorViewMode) === null || _this$reactComponentP4 === void 0 ? void 0 : _this$reactComponentP4.sharedState.currentState(), domRef);
|
|
358
|
+
} else {
|
|
359
|
+
domRef.contentEditable = 'true';
|
|
364
360
|
}
|
|
361
|
+
domRef.setAttribute('spellcheck', 'false');
|
|
365
362
|
return domRef;
|
|
366
363
|
}
|
|
367
364
|
render() {
|
|
368
365
|
const {
|
|
369
366
|
eventDispatcher,
|
|
370
367
|
allowResizing,
|
|
371
|
-
platform,
|
|
372
368
|
fullWidthMode,
|
|
373
369
|
dispatchAnalyticsEvent,
|
|
374
370
|
pluginInjectionApi,
|
|
@@ -380,7 +376,6 @@ export class EmbedCard extends ReactNodeView {
|
|
|
380
376
|
eventDispatcher: eventDispatcher,
|
|
381
377
|
getPos: this.getPos,
|
|
382
378
|
allowResizing: allowResizing,
|
|
383
|
-
platform: platform,
|
|
384
379
|
fullWidthMode: fullWidthMode,
|
|
385
380
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
386
381
|
pluginInjectionApi: pluginInjectionApi,
|
|
@@ -394,7 +389,6 @@ export class EmbedCard extends ReactNodeView {
|
|
|
394
389
|
}
|
|
395
390
|
export const embedCardNodeView = ({
|
|
396
391
|
allowResizing,
|
|
397
|
-
platform,
|
|
398
392
|
fullWidthMode,
|
|
399
393
|
pmPluginFactoryParams,
|
|
400
394
|
pluginInjectionApi,
|
|
@@ -410,7 +404,6 @@ export const embedCardNodeView = ({
|
|
|
410
404
|
const reactComponentProps = {
|
|
411
405
|
eventDispatcher,
|
|
412
406
|
allowResizing,
|
|
413
|
-
platform,
|
|
414
407
|
fullWidthMode,
|
|
415
408
|
dispatchAnalyticsEvent,
|
|
416
409
|
pluginInjectionApi,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { withLazyLoading } from '@atlaskit/editor-common/lazy-node-view';
|
|
2
|
-
import {
|
|
2
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
3
3
|
import { blockCardNodeView } from './blockCard';
|
|
4
4
|
export const lazyBlockCardView = props => {
|
|
5
|
-
if (
|
|
5
|
+
if (editorExperiment('platform_editor_exp_lazy_node_views', false)) {
|
|
6
6
|
return blockCardNodeView(props);
|
|
7
7
|
}
|
|
8
8
|
return withLazyLoading({
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { withLazyLoading } from '@atlaskit/editor-common/lazy-node-view';
|
|
2
|
-
import {
|
|
2
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
3
3
|
import { embedCardNodeView } from './embedCard';
|
|
4
4
|
export const lazyEmbedCardView = props => {
|
|
5
|
-
if (
|
|
5
|
+
if (editorExperiment('platform_editor_exp_lazy_node_views', false)) {
|
|
6
6
|
return embedCardNodeView(props);
|
|
7
7
|
}
|
|
8
8
|
return withLazyLoading({
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -19,7 +19,7 @@ import { EditorSmartCardEvents } from './ui/EditorSmartCardEvents';
|
|
|
19
19
|
import LayoutButton from './ui/LayoutButton';
|
|
20
20
|
import { isDatasourceConfigEditable } from './utils';
|
|
21
21
|
export const cardPlugin = ({
|
|
22
|
-
config: options,
|
|
22
|
+
config: options = {},
|
|
23
23
|
api
|
|
24
24
|
}) => {
|
|
25
25
|
var _options$lpLinkPicker;
|
|
@@ -124,7 +124,7 @@ export const cardPlugin = ({
|
|
|
124
124
|
getEndingToolbarItems: getEndingToolbarItems(options, api)
|
|
125
125
|
},
|
|
126
126
|
pluginsOptions: {
|
|
127
|
-
floatingToolbar: floatingToolbar(options, (_options$lpLinkPicker = options.lpLinkPicker) !== null && _options$lpLinkPicker !== void 0 ? _options$lpLinkPicker : false, options.
|
|
127
|
+
floatingToolbar: floatingToolbar(options, (_options$lpLinkPicker = options.lpLinkPicker) !== null && _options$lpLinkPicker !== void 0 ? _options$lpLinkPicker : false, options.linkPicker, api, options.disableFloatingToolbar),
|
|
128
128
|
quickInsert: ({
|
|
129
129
|
formatMessage
|
|
130
130
|
}) => {
|
|
@@ -47,7 +47,6 @@ const handleAwarenessOverlay = view => {
|
|
|
47
47
|
export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryParams => {
|
|
48
48
|
const {
|
|
49
49
|
editorAppearance,
|
|
50
|
-
platform,
|
|
51
50
|
allowResizing,
|
|
52
51
|
useAlternativePreloader,
|
|
53
52
|
fullWidthMode,
|
|
@@ -61,7 +60,7 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
|
|
|
61
60
|
// @ts-ignore Temporary solution to check for Live Page editor.
|
|
62
61
|
__livePage
|
|
63
62
|
} = options;
|
|
64
|
-
const enableInlineUpgradeFeatures = !!showUpgradeDiscoverability
|
|
63
|
+
const enableInlineUpgradeFeatures = !!showUpgradeDiscoverability;
|
|
65
64
|
const inlineCardViewProducer = getInlineNodeViewProducer({
|
|
66
65
|
pmPluginFactoryParams,
|
|
67
66
|
Component: InlineCardNodeView,
|
|
@@ -240,7 +239,6 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
|
|
|
240
239
|
inlineCard: inlineCardViewProducer,
|
|
241
240
|
blockCard: lazyBlockCardView({
|
|
242
241
|
pmPluginFactoryParams,
|
|
243
|
-
platform,
|
|
244
242
|
actionOptions,
|
|
245
243
|
showServerActions,
|
|
246
244
|
pluginInjectionApi,
|
|
@@ -250,7 +248,6 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
|
|
|
250
248
|
}),
|
|
251
249
|
embedCard: lazyEmbedCardView({
|
|
252
250
|
allowResizing,
|
|
253
|
-
platform,
|
|
254
251
|
fullWidthMode,
|
|
255
252
|
pmPluginFactoryParams,
|
|
256
253
|
pluginInjectionApi,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { blockCard } from '@atlaskit/adf-schema';
|
|
2
2
|
import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
3
|
-
import {
|
|
3
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
4
4
|
// @nodeSpecException:toDOM patch
|
|
5
5
|
export const blockCardSpecWithFixedToDOM = () => {
|
|
6
|
-
if (
|
|
6
|
+
if (editorExperiment('platform_editor_exp_lazy_node_views', false)) {
|
|
7
7
|
return blockCard;
|
|
8
8
|
}
|
|
9
9
|
return {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
import { embedCard } from '@atlaskit/adf-schema';
|
|
12
12
|
import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
13
13
|
import { DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
|
|
14
|
-
import {
|
|
14
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
15
15
|
// From `packages/editor/editor-common/src/ui/MediaSingle/styled.tsx`
|
|
16
16
|
function calcMargin(layout) {
|
|
17
17
|
switch (layout) {
|
|
@@ -52,7 +52,7 @@ const LINE_LENGTH = 760;
|
|
|
52
52
|
|
|
53
53
|
// @nodeSpecException:toDOM patch
|
|
54
54
|
export const embedCardSpecWithFixedToDOM = () => {
|
|
55
|
-
if (
|
|
55
|
+
if (editorExperiment('platform_editor_exp_lazy_node_views', false)) {
|
|
56
56
|
return embedCard;
|
|
57
57
|
}
|
|
58
58
|
return {
|
package/dist/es2019/toolbar.js
CHANGED
|
@@ -93,7 +93,7 @@ export const openLinkSettings = (editorAnalyticsApi, userPreferencesLink) => (st
|
|
|
93
93
|
}
|
|
94
94
|
return true;
|
|
95
95
|
};
|
|
96
|
-
export const floatingToolbar = (cardOptions, lpLinkPicker,
|
|
96
|
+
export const floatingToolbar = (cardOptions, lpLinkPicker, linkPickerOptions, pluginInjectionApi, disableFloatingToolbar) => {
|
|
97
97
|
return (state, intl, providerFactory) => {
|
|
98
98
|
if (disableFloatingToolbar) {
|
|
99
99
|
return;
|
|
@@ -138,7 +138,7 @@ export const floatingToolbar = (cardOptions, lpLinkPicker, platform, linkPickerO
|
|
|
138
138
|
}
|
|
139
139
|
return element;
|
|
140
140
|
},
|
|
141
|
-
items: generateToolbarItems(state, intl, providerFactory, cardOptions, lpLinkPicker,
|
|
141
|
+
items: generateToolbarItems(state, intl, providerFactory, cardOptions, lpLinkPicker, linkPickerOptions, pluginInjectionApi),
|
|
142
142
|
scrollable: pluginState !== null && pluginState !== void 0 && pluginState.showLinkingToolbar ? false : true,
|
|
143
143
|
...editLinkToolbarConfig(Boolean(pluginState === null || pluginState === void 0 ? void 0 : pluginState.showLinkingToolbar), isLinkPickerEnabled)
|
|
144
144
|
};
|
|
@@ -175,7 +175,7 @@ const getToolbarViewedItem = (url, display) => {
|
|
|
175
175
|
})
|
|
176
176
|
}];
|
|
177
177
|
};
|
|
178
|
-
const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkPicker,
|
|
178
|
+
const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkPicker, linkPicker, pluginInjectionApi) => node => {
|
|
179
179
|
var _pluginInjectionApi$a, _pluginInjectionApi$d, _pluginInjectionApi$d2, _node$attrs, _node$attrs$datasourc;
|
|
180
180
|
const {
|
|
181
181
|
url
|
|
@@ -195,18 +195,14 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
|
|
|
195
195
|
title: title
|
|
196
196
|
};
|
|
197
197
|
}
|
|
198
|
-
const pluginState = pluginKey.getState(state);
|
|
199
198
|
const currentAppearance = appearanceForNodeType(node.type);
|
|
200
199
|
const {
|
|
201
200
|
hoverDecoration
|
|
202
201
|
} = (_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 : {};
|
|
203
202
|
const isDatasource = isDatasourceNode(node);
|
|
204
|
-
const
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
/* mobile builds toolbar natively using toolbarItems */
|
|
209
|
-
if (pluginState !== null && pluginState !== void 0 && pluginState.showLinkingToolbar && platform !== 'mobile') {
|
|
203
|
+
const pluginState = pluginKey.getState(state);
|
|
204
|
+
const shouldRenderDatasourceToolbar = isDatasource && cardOptions.allowDatasource && canRenderDatasource(node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : (_node$attrs$datasourc = _node$attrs.datasource) === null || _node$attrs$datasourc === void 0 ? void 0 : _node$attrs$datasourc.id);
|
|
205
|
+
if (pluginState !== null && pluginState !== void 0 && pluginState.showLinkingToolbar) {
|
|
210
206
|
return [buildEditLinkToolbar({
|
|
211
207
|
providerFactory,
|
|
212
208
|
linkPicker,
|
|
@@ -215,12 +211,12 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
|
|
|
215
211
|
lpLinkPicker
|
|
216
212
|
})];
|
|
217
213
|
} else if (shouldRenderDatasourceToolbar) {
|
|
218
|
-
return getDatasourceButtonGroup(metadata, intl, editorAnalyticsApi, node, hoverDecoration, node.attrs.datasource.id, state, cardOptions, currentAppearance
|
|
214
|
+
return getDatasourceButtonGroup(metadata, intl, editorAnalyticsApi, node, hoverDecoration, node.attrs.datasource.id, state, cardOptions, currentAppearance);
|
|
219
215
|
} else {
|
|
220
216
|
const {
|
|
221
217
|
inlineCard
|
|
222
218
|
} = state.schema.nodes;
|
|
223
|
-
const isEditDropdownEnabled =
|
|
219
|
+
const isEditDropdownEnabled = cardOptions.allowDatasource && fg('platform.linking-platform.enable-datasource-edit-dropdown-toolbar');
|
|
224
220
|
const editItems = isEditDropdownEnabled ? [{
|
|
225
221
|
type: 'custom',
|
|
226
222
|
fallback: [],
|
|
@@ -310,7 +306,6 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
|
|
|
310
306
|
editorState: state,
|
|
311
307
|
allowEmbeds: allowEmbeds,
|
|
312
308
|
allowBlockCards: allowBlockCards,
|
|
313
|
-
platform: platform,
|
|
314
309
|
editorAnalyticsApi: editorAnalyticsApi,
|
|
315
310
|
showUpgradeDiscoverability: showUpgradeDiscoverability
|
|
316
311
|
})
|
|
@@ -329,7 +324,7 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
|
|
|
329
324
|
type: 'separator'
|
|
330
325
|
});
|
|
331
326
|
}
|
|
332
|
-
const shouldShowDatasourceEditButton =
|
|
327
|
+
const shouldShowDatasourceEditButton = allowDatasource && !fg('platform.linking-platform.enable-datasource-edit-dropdown-toolbar');
|
|
333
328
|
if (shouldShowDatasourceEditButton) {
|
|
334
329
|
toolbarItems.unshift({
|
|
335
330
|
type: 'custom',
|
|
@@ -383,7 +378,7 @@ export const getSettingsButtonGroup = (intl, editorAnalyticsApi, userPreferences
|
|
|
383
378
|
type: 'separator'
|
|
384
379
|
}];
|
|
385
380
|
};
|
|
386
|
-
const getDatasourceButtonGroup = (metadata, intl, editorAnalyticsApi, node, hoverDecoration, datasourceId, state, cardOptions, currentAppearance
|
|
381
|
+
const getDatasourceButtonGroup = (metadata, intl, editorAnalyticsApi, node, hoverDecoration, datasourceId, state, cardOptions, currentAppearance) => {
|
|
387
382
|
var _node$attrs2;
|
|
388
383
|
const toolbarItems = [];
|
|
389
384
|
if (isDatasourceConfigEditable(datasourceId) && !fg('platform.linking-platform.enable-datasource-edit-dropdown-toolbar')) {
|
|
@@ -431,7 +426,6 @@ const getDatasourceButtonGroup = (metadata, intl, editorAnalyticsApi, node, hove
|
|
|
431
426
|
editorState: state,
|
|
432
427
|
allowEmbeds: allowEmbeds,
|
|
433
428
|
allowBlockCards: allowBlockCards,
|
|
434
|
-
platform: platform,
|
|
435
429
|
editorAnalyticsApi: editorAnalyticsApi,
|
|
436
430
|
showUpgradeDiscoverability: showUpgradeDiscoverability,
|
|
437
431
|
isDatasourceView: true
|
|
@@ -513,7 +507,7 @@ export const shouldRenderToolbarPulse = (embedEnabled, appearance, status, isDis
|
|
|
513
507
|
};
|
|
514
508
|
export const getStartingToolbarItems = (options, api) => {
|
|
515
509
|
return (intl, link, onEditLink, metadata) => {
|
|
516
|
-
const isEditDropdownEnabled = options.
|
|
510
|
+
const isEditDropdownEnabled = options.allowDatasource && fg('platform.linking-platform.enable-datasource-edit-dropdown-toolbar');
|
|
517
511
|
const editLinkItem = isEditDropdownEnabled ? [{
|
|
518
512
|
type: 'custom',
|
|
519
513
|
fallback: [],
|
|
@@ -567,7 +561,6 @@ export const getStartingToolbarItems = (options, api) => {
|
|
|
567
561
|
editorView: editorView,
|
|
568
562
|
editorState: editorView.state,
|
|
569
563
|
cardOptions: options,
|
|
570
|
-
platform: options === null || options === void 0 ? void 0 : options.platform,
|
|
571
564
|
editorAnalyticsApi: api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions,
|
|
572
565
|
editorPluginApi: api
|
|
573
566
|
});
|
|
@@ -16,7 +16,6 @@ export function HyperlinkToolbarAppearance(props) {
|
|
|
16
16
|
editorView,
|
|
17
17
|
editorState,
|
|
18
18
|
cardOptions,
|
|
19
|
-
platform,
|
|
20
19
|
editorAnalyticsApi
|
|
21
20
|
} = props;
|
|
22
21
|
const getProvider = async () => {
|
|
@@ -74,7 +73,6 @@ export function HyperlinkToolbarAppearance(props) {
|
|
|
74
73
|
editorState: editorState,
|
|
75
74
|
allowEmbeds: cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowEmbeds,
|
|
76
75
|
allowBlockCards: cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowBlockCards,
|
|
77
|
-
platform: platform,
|
|
78
76
|
editorAnalyticsApi: editorAnalyticsApi
|
|
79
77
|
}), (cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowDatasource) && /*#__PURE__*/React.createElement(DatasourceAppearanceButton, {
|
|
80
78
|
intl: intl,
|
|
@@ -25,12 +25,11 @@ export class LinkToolbarAppearance extends React.Component {
|
|
|
25
25
|
editorState,
|
|
26
26
|
allowEmbeds,
|
|
27
27
|
allowBlockCards = true,
|
|
28
|
-
platform,
|
|
29
28
|
editorAnalyticsApi,
|
|
30
29
|
showUpgradeDiscoverability = true,
|
|
31
30
|
isDatasourceView
|
|
32
31
|
} = this.props;
|
|
33
|
-
const preview = allowEmbeds && cardContext && url && cardContext.extractors.getPreview(url,
|
|
32
|
+
const preview = allowEmbeds && cardContext && url && cardContext.extractors.getPreview(url, 'web');
|
|
34
33
|
const defaultCommand = () => false;
|
|
35
34
|
if (url) {
|
|
36
35
|
var _cardContext$store, _urlState$error;
|