@atlaskit/editor-plugin-card 1.14.0 → 1.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/cjs/nodeviews/datasource.js +2 -1
- package/dist/cjs/pm-plugins/main.js +20 -2
- package/dist/cjs/ui/LayoutButton/index.js +6 -2
- package/dist/es2019/nodeviews/datasource.js +2 -1
- package/dist/es2019/pm-plugins/main.js +18 -1
- package/dist/es2019/ui/LayoutButton/index.js +6 -2
- package/dist/esm/nodeviews/datasource.js +2 -1
- package/dist/esm/pm-plugins/main.js +18 -1
- package/dist/esm/ui/LayoutButton/index.js +6 -2
- package/dist/types/pm-plugins/main.d.ts +2 -0
- package/dist/types-ts4.5/pm-plugins/main.d.ts +2 -0
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-card
|
|
2
2
|
|
|
3
|
+
## 1.14.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#99680](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/99680)
|
|
8
|
+
[`538e71f42af4`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/538e71f42af4) -
|
|
9
|
+
Add code behind an FF to control what events are sent to prose mirror based on classnames, in
|
|
10
|
+
orderto control toolbar and selection behaviour for smart links in live pages.
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 1.14.1
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#101042](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/101042)
|
|
18
|
+
[`7775bd23868c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/7775bd23868c) -
|
|
19
|
+
[ux] Change default layout of all datasources to be wide
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
|
|
3
22
|
## 1.14.0
|
|
4
23
|
|
|
5
24
|
### Minor Changes
|
|
@@ -22,6 +22,7 @@ var _styles = require("@atlaskit/editor-common/styles");
|
|
|
22
22
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
23
23
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
24
24
|
var _linkDatasource = require("@atlaskit/link-datasource");
|
|
25
|
+
var _linkingCommon = require("@atlaskit/linking-common");
|
|
25
26
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
26
27
|
var _datasourceErrorBoundary = require("../datasourceErrorBoundary");
|
|
27
28
|
var _EditorAnalyticsContext = require("../ui/EditorAnalyticsContext");
|
|
@@ -282,7 +283,7 @@ var Datasource = exports.Datasource = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
282
283
|
}, (0, _react2.jsx)("div", {
|
|
283
284
|
className: _styles.DATASOURCE_INNER_CONTAINER_CLASSNAME,
|
|
284
285
|
style: {
|
|
285
|
-
minWidth: this.isNodeNested ? '100%' : (0, _utils.calcBreakoutWidth)(attrs.layout, this.tableWidth)
|
|
286
|
+
minWidth: this.isNodeNested ? '100%' : (0, _utils.calcBreakoutWidth)(attrs.layout || _linkingCommon.DATASOURCE_DEFAULT_LAYOUT, this.tableWidth)
|
|
286
287
|
}
|
|
287
288
|
}, (0, _react2.jsx)(DatasourceComponent, {
|
|
288
289
|
node: this.node,
|
|
@@ -4,13 +4,14 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.createPlugin = void 0;
|
|
7
|
+
exports.createPlugin = exports.ALLOW_EVENTS_CLASSNAME = void 0;
|
|
8
8
|
Object.defineProperty(exports, "pluginKey", {
|
|
9
9
|
enumerable: true,
|
|
10
10
|
get: function get() {
|
|
11
11
|
return _pluginKey.pluginKey;
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
|
+
exports.stopEvent = void 0;
|
|
14
15
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
16
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
16
17
|
var _rafSchd = _interopRequireDefault(require("raf-schd"));
|
|
@@ -20,6 +21,7 @@ var _styles = require("@atlaskit/editor-common/styles");
|
|
|
20
21
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
21
22
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
22
23
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
24
|
+
var _linkingCommon = require("@atlaskit/linking-common");
|
|
23
25
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
24
26
|
var _eventsFromTr = require("../analytics/events-from-tr");
|
|
25
27
|
var _localStorage = require("../common/local-storage");
|
|
@@ -36,6 +38,19 @@ var _state2 = require("./util/state");
|
|
|
36
38
|
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; }
|
|
37
39
|
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; }
|
|
38
40
|
var LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK = 'smart-link-upgrade-pulse';
|
|
41
|
+
var ALLOW_EVENTS_CLASSNAME = exports.ALLOW_EVENTS_CLASSNAME = 'card-plugin-element-allow-events';
|
|
42
|
+
var stopEvent = exports.stopEvent = function stopEvent(event) {
|
|
43
|
+
if (!(0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-links-in-live-pages')) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
var target = event.target;
|
|
47
|
+
// Stop events from propogating to prose-mirror and selecting the node and/or
|
|
48
|
+
// opening the toolbar, unless a parent of the target has a defined className
|
|
49
|
+
if (target instanceof HTMLElement && target.closest(".".concat(ALLOW_EVENTS_CLASSNAME))) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
return true;
|
|
53
|
+
};
|
|
39
54
|
var handleAwarenessOverlay = function handleAwarenessOverlay(view) {
|
|
40
55
|
var currentState = (0, _state2.getPluginState)(view.state);
|
|
41
56
|
var overlayCandidatePos = currentState === null || currentState === void 0 ? void 0 : currentState.overlayCandidatePosition;
|
|
@@ -74,6 +89,9 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
|
|
|
74
89
|
allowBlockCards: allowBlockCards,
|
|
75
90
|
pluginInjectionApi: pluginInjectionApi,
|
|
76
91
|
onClickCallback: onClickCallback
|
|
92
|
+
},
|
|
93
|
+
extraNodeViewProps: {
|
|
94
|
+
stopEvent: stopEvent
|
|
77
95
|
}
|
|
78
96
|
});
|
|
79
97
|
return new _safePlugin.SafePlugin({
|
|
@@ -168,7 +186,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
|
|
|
168
186
|
if (isDatasource && shouldUpdateTableRef) {
|
|
169
187
|
var _node$attrs2;
|
|
170
188
|
// since we use the plugin state, which is a shared state, we need to update the datasourceTableRef, layout on each selection
|
|
171
|
-
var layout = (node === null || node === void 0 || (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.layout) ||
|
|
189
|
+
var layout = (node === null || node === void 0 || (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.layout) || _linkingCommon.DATASOURCE_DEFAULT_LAYOUT;
|
|
172
190
|
var isNested = selection.$anchor.depth > 0;
|
|
173
191
|
|
|
174
192
|
// we want to disable resize button when datasource table is nested by not setting then datasourceTableRef on selection
|
|
@@ -15,6 +15,7 @@ var _uiMenu = require("@atlaskit/editor-common/ui-menu");
|
|
|
15
15
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
16
16
|
var _collapse = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/collapse"));
|
|
17
17
|
var _expand = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/expand"));
|
|
18
|
+
var _linkingCommon = require("@atlaskit/linking-common");
|
|
18
19
|
var _colors = require("@atlaskit/theme/colors");
|
|
19
20
|
var _actions = require("../../pm-plugins/actions");
|
|
20
21
|
var _utils2 = require("./utils");
|
|
@@ -31,7 +32,7 @@ var toolbarButtonWrapperStyles = (0, _react2.css)({
|
|
|
31
32
|
var LayoutButton = exports.LayoutButton = function LayoutButton(_ref) {
|
|
32
33
|
var onLayoutChange = _ref.onLayoutChange,
|
|
33
34
|
_ref$layout = _ref.layout,
|
|
34
|
-
layout = _ref$layout === void 0 ?
|
|
35
|
+
layout = _ref$layout === void 0 ? _linkingCommon.DATASOURCE_DEFAULT_LAYOUT : _ref$layout,
|
|
35
36
|
formatMessage = _ref.intl.formatMessage,
|
|
36
37
|
mountPoint = _ref.mountPoint,
|
|
37
38
|
boundariesElement = _ref.boundariesElement,
|
|
@@ -83,10 +84,13 @@ var LayoutButtonWrapper = function LayoutButtonWrapper(_ref2) {
|
|
|
83
84
|
var _getDatasource = (0, _utils2.getDatasource)(editorView),
|
|
84
85
|
node = _getDatasource.node,
|
|
85
86
|
pos = _getDatasource.pos;
|
|
87
|
+
|
|
88
|
+
// If layout doesn't exist in ADF it returns null, we want to change to undefined
|
|
89
|
+
// which results in default parameter value being used in LayoutButton.
|
|
86
90
|
var _ref3 = cardState !== null && cardState !== void 0 ? cardState : {},
|
|
87
91
|
datasourceTableRef = _ref3.datasourceTableRef,
|
|
88
92
|
_ref3$layout = _ref3.layout,
|
|
89
|
-
layout = _ref3$layout === void 0 ? (node === null || node === void 0 || (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.layout) ||
|
|
93
|
+
layout = _ref3$layout === void 0 ? (node === null || node === void 0 || (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.layout) || undefined : _ref3$layout;
|
|
90
94
|
var isDatasource = !!(node !== null && node !== void 0 && (_node$attrs2 = node.attrs) !== null && _node$attrs2 !== void 0 && _node$attrs2.datasource);
|
|
91
95
|
var onLayoutChange = function onLayoutChange(layout) {
|
|
92
96
|
var _getDatasource$node;
|
|
@@ -8,6 +8,7 @@ import { DATASOURCE_INNER_CONTAINER_CLASSNAME, SmartCardSharedCssClassName } fro
|
|
|
8
8
|
import { UnsupportedInline } from '@atlaskit/editor-common/ui';
|
|
9
9
|
import { calcBreakoutWidth } from '@atlaskit/editor-common/utils';
|
|
10
10
|
import { DatasourceTableView } from '@atlaskit/link-datasource';
|
|
11
|
+
import { DATASOURCE_DEFAULT_LAYOUT } from '@atlaskit/linking-common';
|
|
11
12
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
12
13
|
import { DatasourceErrorBoundary } from '../datasourceErrorBoundary';
|
|
13
14
|
import { EditorAnalyticsContext } from '../ui/EditorAnalyticsContext';
|
|
@@ -230,7 +231,7 @@ export class Datasource extends ReactNodeView {
|
|
|
230
231
|
}, jsx("div", {
|
|
231
232
|
className: DATASOURCE_INNER_CONTAINER_CLASSNAME,
|
|
232
233
|
style: {
|
|
233
|
-
minWidth: this.isNodeNested ? '100%' : calcBreakoutWidth(attrs.layout, this.tableWidth)
|
|
234
|
+
minWidth: this.isNodeNested ? '100%' : calcBreakoutWidth(attrs.layout || DATASOURCE_DEFAULT_LAYOUT, this.tableWidth)
|
|
234
235
|
}
|
|
235
236
|
}, jsx(DatasourceComponent, {
|
|
236
237
|
node: this.node,
|
|
@@ -5,6 +5,7 @@ import { DATASOURCE_INNER_CONTAINER_CLASSNAME } from '@atlaskit/editor-common/st
|
|
|
5
5
|
import { canRenderDatasource } from '@atlaskit/editor-common/utils';
|
|
6
6
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
7
7
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
8
|
+
import { DATASOURCE_DEFAULT_LAYOUT } from '@atlaskit/linking-common';
|
|
8
9
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
9
10
|
import { eventsFromTransaction } from '../analytics/events-from-tr';
|
|
10
11
|
import { isLocalStorageKeyDiscovered } from '../common/local-storage';
|
|
@@ -20,6 +21,19 @@ import { handleProvider, resolveWithProvider } from './util/resolve';
|
|
|
20
21
|
import { getNewRequests, getPluginState, getPluginStateWithUpdatedPos } from './util/state';
|
|
21
22
|
export { pluginKey } from './plugin-key';
|
|
22
23
|
const LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK = 'smart-link-upgrade-pulse';
|
|
24
|
+
export const ALLOW_EVENTS_CLASSNAME = 'card-plugin-element-allow-events';
|
|
25
|
+
export const stopEvent = event => {
|
|
26
|
+
if (!getBooleanFF('platform.linking-platform.smart-links-in-live-pages')) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
const target = event.target;
|
|
30
|
+
// Stop events from propogating to prose-mirror and selecting the node and/or
|
|
31
|
+
// opening the toolbar, unless a parent of the target has a defined className
|
|
32
|
+
if (target instanceof HTMLElement && target.closest(`.${ALLOW_EVENTS_CLASSNAME}`)) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
return true;
|
|
36
|
+
};
|
|
23
37
|
const handleAwarenessOverlay = view => {
|
|
24
38
|
const currentState = getPluginState(view.state);
|
|
25
39
|
const overlayCandidatePos = currentState === null || currentState === void 0 ? void 0 : currentState.overlayCandidatePosition;
|
|
@@ -59,6 +73,9 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
|
|
|
59
73
|
allowBlockCards,
|
|
60
74
|
pluginInjectionApi,
|
|
61
75
|
onClickCallback
|
|
76
|
+
},
|
|
77
|
+
extraNodeViewProps: {
|
|
78
|
+
stopEvent
|
|
62
79
|
}
|
|
63
80
|
});
|
|
64
81
|
return new SafePlugin({
|
|
@@ -158,7 +175,7 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
|
|
|
158
175
|
if (isDatasource && shouldUpdateTableRef) {
|
|
159
176
|
var _node$attrs2;
|
|
160
177
|
// since we use the plugin state, which is a shared state, we need to update the datasourceTableRef, layout on each selection
|
|
161
|
-
const layout = (node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.layout) ||
|
|
178
|
+
const layout = (node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.layout) || DATASOURCE_DEFAULT_LAYOUT;
|
|
162
179
|
const isNested = selection.$anchor.depth > 0;
|
|
163
180
|
|
|
164
181
|
// we want to disable resize button when datasource table is nested by not setting then datasourceTableRef on selection
|
|
@@ -8,6 +8,7 @@ import { ToolbarButton } from '@atlaskit/editor-common/ui-menu';
|
|
|
8
8
|
import { getNextBreakoutMode, getTitle } from '@atlaskit/editor-common/utils';
|
|
9
9
|
import CollapseIcon from '@atlaskit/icon/glyph/editor/collapse';
|
|
10
10
|
import ExpandIcon from '@atlaskit/icon/glyph/editor/expand';
|
|
11
|
+
import { DATASOURCE_DEFAULT_LAYOUT } from '@atlaskit/linking-common';
|
|
11
12
|
import { B300, N20A, N300 } from '@atlaskit/theme/colors';
|
|
12
13
|
import { setCardLayout } from '../../pm-plugins/actions';
|
|
13
14
|
import { getDatasource } from './utils';
|
|
@@ -21,7 +22,7 @@ const toolbarButtonWrapperStyles = css({
|
|
|
21
22
|
});
|
|
22
23
|
export const LayoutButton = ({
|
|
23
24
|
onLayoutChange,
|
|
24
|
-
layout =
|
|
25
|
+
layout = DATASOURCE_DEFAULT_LAYOUT,
|
|
25
26
|
intl: {
|
|
26
27
|
formatMessage
|
|
27
28
|
},
|
|
@@ -78,9 +79,12 @@ const LayoutButtonWrapper = ({
|
|
|
78
79
|
node,
|
|
79
80
|
pos
|
|
80
81
|
} = getDatasource(editorView);
|
|
82
|
+
|
|
83
|
+
// If layout doesn't exist in ADF it returns null, we want to change to undefined
|
|
84
|
+
// which results in default parameter value being used in LayoutButton.
|
|
81
85
|
const {
|
|
82
86
|
datasourceTableRef,
|
|
83
|
-
layout = (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.layout) ||
|
|
87
|
+
layout = (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.layout) || undefined
|
|
84
88
|
} = cardState !== null && cardState !== void 0 ? cardState : {};
|
|
85
89
|
const isDatasource = !!(node !== null && node !== void 0 && (_node$attrs2 = node.attrs) !== null && _node$attrs2 !== void 0 && _node$attrs2.datasource);
|
|
86
90
|
const onLayoutChange = layout => {
|
|
@@ -20,6 +20,7 @@ import { DATASOURCE_INNER_CONTAINER_CLASSNAME, SmartCardSharedCssClassName } fro
|
|
|
20
20
|
import { UnsupportedInline } from '@atlaskit/editor-common/ui';
|
|
21
21
|
import { calcBreakoutWidth } from '@atlaskit/editor-common/utils';
|
|
22
22
|
import { DatasourceTableView } from '@atlaskit/link-datasource';
|
|
23
|
+
import { DATASOURCE_DEFAULT_LAYOUT } from '@atlaskit/linking-common';
|
|
23
24
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
24
25
|
import { DatasourceErrorBoundary } from '../datasourceErrorBoundary';
|
|
25
26
|
import { EditorAnalyticsContext } from '../ui/EditorAnalyticsContext';
|
|
@@ -276,7 +277,7 @@ export var Datasource = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
276
277
|
}, jsx("div", {
|
|
277
278
|
className: DATASOURCE_INNER_CONTAINER_CLASSNAME,
|
|
278
279
|
style: {
|
|
279
|
-
minWidth: this.isNodeNested ? '100%' : calcBreakoutWidth(attrs.layout, this.tableWidth)
|
|
280
|
+
minWidth: this.isNodeNested ? '100%' : calcBreakoutWidth(attrs.layout || DATASOURCE_DEFAULT_LAYOUT, this.tableWidth)
|
|
280
281
|
}
|
|
281
282
|
}, jsx(DatasourceComponent, {
|
|
282
283
|
node: this.node,
|
|
@@ -9,6 +9,7 @@ import { DATASOURCE_INNER_CONTAINER_CLASSNAME } from '@atlaskit/editor-common/st
|
|
|
9
9
|
import { canRenderDatasource } from '@atlaskit/editor-common/utils';
|
|
10
10
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
11
11
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
12
|
+
import { DATASOURCE_DEFAULT_LAYOUT } from '@atlaskit/linking-common';
|
|
12
13
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
13
14
|
import { eventsFromTransaction } from '../analytics/events-from-tr';
|
|
14
15
|
import { isLocalStorageKeyDiscovered } from '../common/local-storage';
|
|
@@ -24,6 +25,19 @@ import { handleProvider, resolveWithProvider } from './util/resolve';
|
|
|
24
25
|
import { getNewRequests, getPluginState, getPluginStateWithUpdatedPos } from './util/state';
|
|
25
26
|
export { pluginKey } from './plugin-key';
|
|
26
27
|
var LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK = 'smart-link-upgrade-pulse';
|
|
28
|
+
export var ALLOW_EVENTS_CLASSNAME = 'card-plugin-element-allow-events';
|
|
29
|
+
export var stopEvent = function stopEvent(event) {
|
|
30
|
+
if (!getBooleanFF('platform.linking-platform.smart-links-in-live-pages')) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
var target = event.target;
|
|
34
|
+
// Stop events from propogating to prose-mirror and selecting the node and/or
|
|
35
|
+
// opening the toolbar, unless a parent of the target has a defined className
|
|
36
|
+
if (target instanceof HTMLElement && target.closest(".".concat(ALLOW_EVENTS_CLASSNAME))) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
return true;
|
|
40
|
+
};
|
|
27
41
|
var handleAwarenessOverlay = function handleAwarenessOverlay(view) {
|
|
28
42
|
var currentState = getPluginState(view.state);
|
|
29
43
|
var overlayCandidatePos = currentState === null || currentState === void 0 ? void 0 : currentState.overlayCandidatePosition;
|
|
@@ -62,6 +76,9 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
62
76
|
allowBlockCards: allowBlockCards,
|
|
63
77
|
pluginInjectionApi: pluginInjectionApi,
|
|
64
78
|
onClickCallback: onClickCallback
|
|
79
|
+
},
|
|
80
|
+
extraNodeViewProps: {
|
|
81
|
+
stopEvent: stopEvent
|
|
65
82
|
}
|
|
66
83
|
});
|
|
67
84
|
return new SafePlugin({
|
|
@@ -156,7 +173,7 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
156
173
|
if (isDatasource && shouldUpdateTableRef) {
|
|
157
174
|
var _node$attrs2;
|
|
158
175
|
// since we use the plugin state, which is a shared state, we need to update the datasourceTableRef, layout on each selection
|
|
159
|
-
var layout = (node === null || node === void 0 || (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.layout) ||
|
|
176
|
+
var layout = (node === null || node === void 0 || (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.layout) || DATASOURCE_DEFAULT_LAYOUT;
|
|
160
177
|
var isNested = selection.$anchor.depth > 0;
|
|
161
178
|
|
|
162
179
|
// we want to disable resize button when datasource table is nested by not setting then datasourceTableRef on selection
|
|
@@ -11,6 +11,7 @@ import { ToolbarButton } from '@atlaskit/editor-common/ui-menu';
|
|
|
11
11
|
import { getNextBreakoutMode, getTitle } from '@atlaskit/editor-common/utils';
|
|
12
12
|
import CollapseIcon from '@atlaskit/icon/glyph/editor/collapse';
|
|
13
13
|
import ExpandIcon from '@atlaskit/icon/glyph/editor/expand';
|
|
14
|
+
import { DATASOURCE_DEFAULT_LAYOUT } from '@atlaskit/linking-common';
|
|
14
15
|
import { B300, N20A, N300 } from '@atlaskit/theme/colors';
|
|
15
16
|
import { setCardLayout } from '../../pm-plugins/actions';
|
|
16
17
|
import { getDatasource } from './utils';
|
|
@@ -25,7 +26,7 @@ var toolbarButtonWrapperStyles = css({
|
|
|
25
26
|
export var LayoutButton = function LayoutButton(_ref) {
|
|
26
27
|
var onLayoutChange = _ref.onLayoutChange,
|
|
27
28
|
_ref$layout = _ref.layout,
|
|
28
|
-
layout = _ref$layout === void 0 ?
|
|
29
|
+
layout = _ref$layout === void 0 ? DATASOURCE_DEFAULT_LAYOUT : _ref$layout,
|
|
29
30
|
formatMessage = _ref.intl.formatMessage,
|
|
30
31
|
mountPoint = _ref.mountPoint,
|
|
31
32
|
boundariesElement = _ref.boundariesElement,
|
|
@@ -77,10 +78,13 @@ var LayoutButtonWrapper = function LayoutButtonWrapper(_ref2) {
|
|
|
77
78
|
var _getDatasource = getDatasource(editorView),
|
|
78
79
|
node = _getDatasource.node,
|
|
79
80
|
pos = _getDatasource.pos;
|
|
81
|
+
|
|
82
|
+
// If layout doesn't exist in ADF it returns null, we want to change to undefined
|
|
83
|
+
// which results in default parameter value being used in LayoutButton.
|
|
80
84
|
var _ref3 = cardState !== null && cardState !== void 0 ? cardState : {},
|
|
81
85
|
datasourceTableRef = _ref3.datasourceTableRef,
|
|
82
86
|
_ref3$layout = _ref3.layout,
|
|
83
|
-
layout = _ref3$layout === void 0 ? (node === null || node === void 0 || (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.layout) ||
|
|
87
|
+
layout = _ref3$layout === void 0 ? (node === null || node === void 0 || (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.layout) || undefined : _ref3$layout;
|
|
84
88
|
var isDatasource = !!(node !== null && node !== void 0 && (_node$attrs2 = node.attrs) !== null && _node$attrs2 !== void 0 && _node$attrs2.datasource);
|
|
85
89
|
var onLayoutChange = function onLayoutChange(layout) {
|
|
86
90
|
var _getDatasource$node;
|
|
@@ -3,4 +3,6 @@ import type { ExtractInjectionAPI, PMPluginFactoryParams } from '@atlaskit/edito
|
|
|
3
3
|
import type { cardPlugin } from '../index';
|
|
4
4
|
import type { CardPluginOptions, CardPluginState } from '../types';
|
|
5
5
|
export { pluginKey } from './plugin-key';
|
|
6
|
+
export declare const ALLOW_EVENTS_CLASSNAME = "card-plugin-element-allow-events";
|
|
7
|
+
export declare const stopEvent: (event: Event) => boolean;
|
|
6
8
|
export declare const createPlugin: (options: CardPluginOptions, pluginInjectionApi: ExtractInjectionAPI<typeof cardPlugin> | undefined) => (pmPluginFactoryParams: PMPluginFactoryParams) => SafePlugin<CardPluginState>;
|
|
@@ -3,4 +3,6 @@ import type { ExtractInjectionAPI, PMPluginFactoryParams } from '@atlaskit/edito
|
|
|
3
3
|
import type { cardPlugin } from '../index';
|
|
4
4
|
import type { CardPluginOptions, CardPluginState } from '../types';
|
|
5
5
|
export { pluginKey } from './plugin-key';
|
|
6
|
+
export declare const ALLOW_EVENTS_CLASSNAME = "card-plugin-element-allow-events";
|
|
7
|
+
export declare const stopEvent: (event: Event) => boolean;
|
|
6
8
|
export declare const createPlugin: (options: CardPluginOptions, pluginInjectionApi: ExtractInjectionAPI<typeof cardPlugin> | undefined) => (pmPluginFactoryParams: PMPluginFactoryParams) => SafePlugin<CardPluginState>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-card",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.2",
|
|
4
4
|
"description": "Card plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@atlaskit/adf-schema": "^36.8.0",
|
|
36
36
|
"@atlaskit/analytics-next": "^9.3.0",
|
|
37
37
|
"@atlaskit/custom-steps": "^0.2.0",
|
|
38
|
-
"@atlaskit/editor-common": "^80.
|
|
38
|
+
"@atlaskit/editor-common": "^80.5.0",
|
|
39
39
|
"@atlaskit/editor-plugin-analytics": "^1.2.0",
|
|
40
40
|
"@atlaskit/editor-plugin-decorations": "^1.1.0",
|
|
41
41
|
"@atlaskit/editor-plugin-editor-viewmode": "^1.1.0",
|
|
@@ -47,17 +47,17 @@
|
|
|
47
47
|
"@atlaskit/editor-prosemirror": "4.0.1",
|
|
48
48
|
"@atlaskit/editor-shared-styles": "^2.11.0",
|
|
49
49
|
"@atlaskit/frontend-utilities": "^2.7.0",
|
|
50
|
-
"@atlaskit/icon": "^22.
|
|
50
|
+
"@atlaskit/icon": "^22.3.0",
|
|
51
51
|
"@atlaskit/link-analytics": "^8.3.0",
|
|
52
52
|
"@atlaskit/link-client-extension": "^1.8.0",
|
|
53
53
|
"@atlaskit/link-datasource": "^2.3.0",
|
|
54
|
-
"@atlaskit/linking-common": "^5.
|
|
55
|
-
"@atlaskit/linking-types": "^8.
|
|
54
|
+
"@atlaskit/linking-common": "^5.7.0",
|
|
55
|
+
"@atlaskit/linking-types": "^8.9.0",
|
|
56
56
|
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
57
|
-
"@atlaskit/primitives": "^6.
|
|
57
|
+
"@atlaskit/primitives": "^6.3.0",
|
|
58
58
|
"@atlaskit/smart-card": "^26.69.0",
|
|
59
59
|
"@atlaskit/theme": "^12.8.0",
|
|
60
|
-
"@atlaskit/tokens": "^1.
|
|
60
|
+
"@atlaskit/tokens": "^1.49.0",
|
|
61
61
|
"@babel/runtime": "^7.0.0",
|
|
62
62
|
"@emotion/react": "^11.7.1",
|
|
63
63
|
"lodash": "^4.17.21",
|