@atlaskit/editor-plugin-panel 5.3.0 → 5.3.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 +12 -0
- package/dist/cjs/editor-actions/actions.js +3 -11
- package/dist/cjs/panelPlugin.js +4 -8
- package/dist/cjs/pm-plugins/utils/utils.js +1 -3
- package/dist/es2019/editor-actions/actions.js +4 -12
- package/dist/es2019/panelPlugin.js +13 -12
- package/dist/es2019/pm-plugins/utils/utils.js +2 -5
- package/dist/esm/editor-actions/actions.js +4 -12
- package/dist/esm/panelPlugin.js +5 -9
- package/dist/esm/pm-plugins/utils/utils.js +2 -4
- package/dist/types/ui/toolbar.d.ts +1 -1
- package/dist/types-ts4.5/ui/toolbar.d.ts +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -15,7 +15,6 @@ var _panel = require("@atlaskit/editor-common/panel");
|
|
|
15
15
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
16
16
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
17
17
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
18
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
19
18
|
var _utils3 = require("../pm-plugins/utils/utils");
|
|
20
19
|
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; }
|
|
21
20
|
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; }
|
|
@@ -52,7 +51,6 @@ var changePanelType = exports.changePanelType = function changePanelType(editorA
|
|
|
52
51
|
var panelOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
53
52
|
var allowCustomPanel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
54
53
|
return function (state, dispatch) {
|
|
55
|
-
var _panelNode$node$attrs;
|
|
56
54
|
var nodes = state.schema.nodes,
|
|
57
55
|
tr = state.tr;
|
|
58
56
|
var panelNode = (0, _utils3.findPanel)(state);
|
|
@@ -62,7 +60,6 @@ var changePanelType = exports.changePanelType = function changePanelType(editorA
|
|
|
62
60
|
var newType = panelType;
|
|
63
61
|
var previousType = panelNode.node.attrs.panelType;
|
|
64
62
|
var newTr;
|
|
65
|
-
var localId = (0, _platformFeatureFlags.fg)('platform_editor_adf_with_localid') ? ((_panelNode$node$attrs = panelNode.node.attrs) === null || _panelNode$node$attrs === void 0 ? void 0 : _panelNode$node$attrs.localId) || _adfSchema.uuid.generate() : undefined;
|
|
66
63
|
if (allowCustomPanel) {
|
|
67
64
|
var previousColor = panelNode.node.attrs.panelType === 'custom' ? panelNode.node.attrs.panelColor || 'none' : (0, _panel.getPanelTypeBackgroundNoTokens)(previousType);
|
|
68
65
|
var previousIcon = panelNode.node.attrs.panelIcon;
|
|
@@ -79,13 +76,11 @@ var changePanelType = exports.changePanelType = function changePanelType(editorA
|
|
|
79
76
|
panelIconId: newPanelOptions.emojiId,
|
|
80
77
|
panelIconText: newPanelOptions.emojiText,
|
|
81
78
|
panelColor: newPanelOptions.color,
|
|
82
|
-
panelType: panelType
|
|
83
|
-
localId: localId
|
|
79
|
+
panelType: panelType
|
|
84
80
|
});
|
|
85
81
|
} else {
|
|
86
82
|
newTr = tr.setNodeMarkup(panelNode.pos, nodes.panel, {
|
|
87
|
-
panelType: panelType
|
|
88
|
-
localId: localId
|
|
83
|
+
panelType: panelType
|
|
89
84
|
});
|
|
90
85
|
}
|
|
91
86
|
var payload = {
|
|
@@ -124,10 +119,7 @@ function insertPanelWithAnalytics(inputMethod, analyticsAPI) {
|
|
|
124
119
|
})(function (state, dispatch) {
|
|
125
120
|
var nodes = state.schema.nodes;
|
|
126
121
|
if (nodes.panel && nodes.paragraph) {
|
|
127
|
-
|
|
128
|
-
localId: _adfSchema.uuid.generate()
|
|
129
|
-
} : {};
|
|
130
|
-
return (0, _utils.wrapSelectionIn)(nodes.panel, panelAttrs)(state, dispatch);
|
|
122
|
+
return (0, _utils.wrapSelectionIn)(nodes.panel)(state, dispatch);
|
|
131
123
|
}
|
|
132
124
|
return false;
|
|
133
125
|
});
|
package/dist/cjs/panelPlugin.js
CHANGED
|
@@ -261,10 +261,6 @@ function createPanelAction(_ref4) {
|
|
|
261
261
|
inputMethod = _ref4$inputMethod === void 0 ? _analytics.INPUT_METHOD.QUICK_INSERT : _ref4$inputMethod;
|
|
262
262
|
var panel = state.schema.nodes.panel;
|
|
263
263
|
var tr;
|
|
264
|
-
var panelAttrs = (0, _platformFeatureFlags.fg)('platform_editor_adf_with_localid') ? _objectSpread(_objectSpread({}, attributes), {}, {
|
|
265
|
-
localId: attributes.localId || _adfSchema.uuid.generate()
|
|
266
|
-
}) : _objectSpread({}, attributes);
|
|
267
|
-
|
|
268
264
|
/*
|
|
269
265
|
During investigation of go/j/ED-26928 I found that the behaviour of this experience was very
|
|
270
266
|
inconsistent. I reached out to Nicole* for a design review, and she confirmed that the desired
|
|
@@ -274,7 +270,7 @@ function createPanelAction(_ref4) {
|
|
|
274
270
|
if ((0, _expValEquals.expValEquals)('platform_editor_fix_quick_insert_consistency_exp', 'isEnabled', true)) {
|
|
275
271
|
// If the selection is empty, we want to insert the panel on a new line
|
|
276
272
|
if (state.selection.empty) {
|
|
277
|
-
var node = panel.createAndFill(
|
|
273
|
+
var node = panel.createAndFill(_objectSpread({}, attributes));
|
|
278
274
|
if (!node) {
|
|
279
275
|
return false;
|
|
280
276
|
}
|
|
@@ -290,7 +286,7 @@ function createPanelAction(_ref4) {
|
|
|
290
286
|
tr = (0, _utils.createWrapSelectionTransaction)({
|
|
291
287
|
state: state,
|
|
292
288
|
type: panel,
|
|
293
|
-
nodeAttributes:
|
|
289
|
+
nodeAttributes: _objectSpread({}, attributes)
|
|
294
290
|
});
|
|
295
291
|
}
|
|
296
292
|
} else {
|
|
@@ -300,10 +296,10 @@ function createPanelAction(_ref4) {
|
|
|
300
296
|
tr = state.selection.empty && (0, _utils.createWrapSelectionTransaction)({
|
|
301
297
|
state: state,
|
|
302
298
|
type: panel,
|
|
303
|
-
nodeAttributes:
|
|
299
|
+
nodeAttributes: _objectSpread({}, attributes)
|
|
304
300
|
});
|
|
305
301
|
} else {
|
|
306
|
-
var _node = panel.createAndFill(
|
|
302
|
+
var _node = panel.createAndFill(_objectSpread({}, attributes));
|
|
307
303
|
if (!_node) {
|
|
308
304
|
return false;
|
|
309
305
|
}
|
|
@@ -69,9 +69,7 @@ var handleCut = exports.handleCut = function handleCut(newState, oldState) {
|
|
|
69
69
|
return node.type.name === 'panel';
|
|
70
70
|
})(oldState.tr.selection);
|
|
71
71
|
var clonedPanelNode = oldPanelNode === null || oldPanelNode === void 0 ? void 0 : oldPanelNode.node.copy();
|
|
72
|
-
var newPanelNode = schema.nodes.panel.create(_objectSpread(
|
|
73
|
-
localId: _adfSchema.uuid.generate()
|
|
74
|
-
}), emptyParagraph);
|
|
72
|
+
var newPanelNode = schema.nodes.panel.create(_objectSpread({}, clonedPanelNode === null || clonedPanelNode === void 0 ? void 0 : clonedPanelNode.attrs), emptyParagraph);
|
|
75
73
|
var endPos = oldState.tr.selection.$from.pos;
|
|
76
74
|
if (oldPanelNode) {
|
|
77
75
|
newTr.insert(oldPanelNode.pos, newPanelNode).setSelection(new _state.TextSelection(newTr.doc.resolve(endPos)));
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { PanelType
|
|
1
|
+
import { PanelType } from '@atlaskit/adf-schema';
|
|
2
2
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
|
|
4
4
|
import { getPanelTypeBackgroundNoTokens } from '@atlaskit/editor-common/panel';
|
|
5
5
|
import { wrapSelectionIn } from '@atlaskit/editor-common/utils';
|
|
6
6
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
7
7
|
import { findParentNodeOfType, findSelectedNodeOfType, removeParentNodeOfType, removeSelectedNode } from '@atlaskit/editor-prosemirror/utils';
|
|
8
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
8
|
import { findPanel } from '../pm-plugins/utils/utils';
|
|
10
9
|
export const removePanel = editorAnalyticsAPI => (state, dispatch) => {
|
|
11
10
|
const {
|
|
@@ -38,7 +37,6 @@ export const removePanel = editorAnalyticsAPI => (state, dispatch) => {
|
|
|
38
37
|
return true;
|
|
39
38
|
};
|
|
40
39
|
export const changePanelType = editorAnalyticsAPI => (panelType, panelOptions = {}, allowCustomPanel = false) => (state, dispatch) => {
|
|
41
|
-
var _panelNode$node$attrs;
|
|
42
40
|
const {
|
|
43
41
|
schema: {
|
|
44
42
|
nodes
|
|
@@ -52,7 +50,6 @@ export const changePanelType = editorAnalyticsAPI => (panelType, panelOptions =
|
|
|
52
50
|
const newType = panelType;
|
|
53
51
|
const previousType = panelNode.node.attrs.panelType;
|
|
54
52
|
let newTr;
|
|
55
|
-
const localId = fg('platform_editor_adf_with_localid') ? ((_panelNode$node$attrs = panelNode.node.attrs) === null || _panelNode$node$attrs === void 0 ? void 0 : _panelNode$node$attrs.localId) || uuid.generate() : undefined;
|
|
56
53
|
if (allowCustomPanel) {
|
|
57
54
|
const previousColor = panelNode.node.attrs.panelType === 'custom' ? panelNode.node.attrs.panelColor || 'none' : getPanelTypeBackgroundNoTokens(previousType);
|
|
58
55
|
const previousIcon = panelNode.node.attrs.panelIcon;
|
|
@@ -70,13 +67,11 @@ export const changePanelType = editorAnalyticsAPI => (panelType, panelOptions =
|
|
|
70
67
|
panelIconId: newPanelOptions.emojiId,
|
|
71
68
|
panelIconText: newPanelOptions.emojiText,
|
|
72
69
|
panelColor: newPanelOptions.color,
|
|
73
|
-
panelType
|
|
74
|
-
localId
|
|
70
|
+
panelType
|
|
75
71
|
});
|
|
76
72
|
} else {
|
|
77
73
|
newTr = tr.setNodeMarkup(panelNode.pos, nodes.panel, {
|
|
78
|
-
panelType
|
|
79
|
-
localId
|
|
74
|
+
panelType
|
|
80
75
|
});
|
|
81
76
|
}
|
|
82
77
|
const payload = {
|
|
@@ -115,10 +110,7 @@ export function insertPanelWithAnalytics(inputMethod, analyticsAPI) {
|
|
|
115
110
|
nodes
|
|
116
111
|
} = state.schema;
|
|
117
112
|
if (nodes.panel && nodes.paragraph) {
|
|
118
|
-
|
|
119
|
-
localId: uuid.generate()
|
|
120
|
-
} : {};
|
|
121
|
-
return wrapSelectionIn(nodes.panel, panelAttrs)(state, dispatch);
|
|
113
|
+
return wrapSelectionIn(nodes.panel)(state, dispatch);
|
|
122
114
|
}
|
|
123
115
|
return false;
|
|
124
116
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { extendedPanel, extendedPanelWithLocalId, PanelType
|
|
2
|
+
import { extendedPanel, extendedPanelWithLocalId, PanelType } from '@atlaskit/adf-schema';
|
|
3
3
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { insertSelectedItem } from '@atlaskit/editor-common/insert';
|
|
5
5
|
import { blockTypeMessages } from '@atlaskit/editor-common/messages';
|
|
@@ -234,13 +234,6 @@ function createPanelAction({
|
|
|
234
234
|
panel
|
|
235
235
|
} = state.schema.nodes;
|
|
236
236
|
let tr;
|
|
237
|
-
const panelAttrs = fg('platform_editor_adf_with_localid') ? {
|
|
238
|
-
...attributes,
|
|
239
|
-
localId: attributes.localId || uuid.generate()
|
|
240
|
-
} : {
|
|
241
|
-
...attributes
|
|
242
|
-
};
|
|
243
|
-
|
|
244
237
|
/*
|
|
245
238
|
During investigation of go/j/ED-26928 I found that the behaviour of this experience was very
|
|
246
239
|
inconsistent. I reached out to Nicole* for a design review, and she confirmed that the desired
|
|
@@ -250,7 +243,9 @@ function createPanelAction({
|
|
|
250
243
|
if (expValEquals('platform_editor_fix_quick_insert_consistency_exp', 'isEnabled', true)) {
|
|
251
244
|
// If the selection is empty, we want to insert the panel on a new line
|
|
252
245
|
if (state.selection.empty) {
|
|
253
|
-
const node = panel.createAndFill(
|
|
246
|
+
const node = panel.createAndFill({
|
|
247
|
+
...attributes
|
|
248
|
+
});
|
|
254
249
|
if (!node) {
|
|
255
250
|
return false;
|
|
256
251
|
}
|
|
@@ -266,7 +261,9 @@ function createPanelAction({
|
|
|
266
261
|
tr = createWrapSelectionTransaction({
|
|
267
262
|
state,
|
|
268
263
|
type: panel,
|
|
269
|
-
nodeAttributes:
|
|
264
|
+
nodeAttributes: {
|
|
265
|
+
...attributes
|
|
266
|
+
}
|
|
270
267
|
});
|
|
271
268
|
}
|
|
272
269
|
} else {
|
|
@@ -276,10 +273,14 @@ function createPanelAction({
|
|
|
276
273
|
tr = state.selection.empty && createWrapSelectionTransaction({
|
|
277
274
|
state,
|
|
278
275
|
type: panel,
|
|
279
|
-
nodeAttributes:
|
|
276
|
+
nodeAttributes: {
|
|
277
|
+
...attributes
|
|
278
|
+
}
|
|
280
279
|
});
|
|
281
280
|
} else {
|
|
282
|
-
const node = panel.createAndFill(
|
|
281
|
+
const node = panel.createAndFill({
|
|
282
|
+
...attributes
|
|
283
|
+
});
|
|
283
284
|
if (!node) {
|
|
284
285
|
return false;
|
|
285
286
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PanelType
|
|
1
|
+
import { PanelType } from '@atlaskit/adf-schema';
|
|
2
2
|
import { PanelSharedCssClassName } from '@atlaskit/editor-common/panel';
|
|
3
3
|
import { hexToEditorBackgroundPaletteColor } from '@atlaskit/editor-palette';
|
|
4
4
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
@@ -65,10 +65,7 @@ export const handleCut = (newState, oldState) => {
|
|
|
65
65
|
const oldPanelNode = findParentNode(node => node.type.name === 'panel')(oldState.tr.selection);
|
|
66
66
|
const clonedPanelNode = oldPanelNode === null || oldPanelNode === void 0 ? void 0 : oldPanelNode.node.copy();
|
|
67
67
|
const newPanelNode = schema.nodes.panel.create({
|
|
68
|
-
...(clonedPanelNode === null || clonedPanelNode === void 0 ? void 0 : clonedPanelNode.attrs)
|
|
69
|
-
...(fg('platform_editor_adf_with_localid') && {
|
|
70
|
-
localId: uuid.generate()
|
|
71
|
-
})
|
|
68
|
+
...(clonedPanelNode === null || clonedPanelNode === void 0 ? void 0 : clonedPanelNode.attrs)
|
|
72
69
|
}, emptyParagraph);
|
|
73
70
|
const endPos = oldState.tr.selection.$from.pos;
|
|
74
71
|
if (oldPanelNode) {
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
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; }
|
|
3
3
|
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) { _defineProperty(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; }
|
|
4
|
-
import { PanelType
|
|
4
|
+
import { PanelType } from '@atlaskit/adf-schema';
|
|
5
5
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
6
6
|
import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
|
|
7
7
|
import { getPanelTypeBackgroundNoTokens } from '@atlaskit/editor-common/panel';
|
|
8
8
|
import { wrapSelectionIn } from '@atlaskit/editor-common/utils';
|
|
9
9
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
10
10
|
import { findParentNodeOfType, findSelectedNodeOfType, removeParentNodeOfType, removeSelectedNode } from '@atlaskit/editor-prosemirror/utils';
|
|
11
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
11
|
import { findPanel } from '../pm-plugins/utils/utils';
|
|
13
12
|
export var removePanel = function removePanel(editorAnalyticsAPI) {
|
|
14
13
|
return function (state, dispatch) {
|
|
@@ -43,7 +42,6 @@ export var changePanelType = function changePanelType(editorAnalyticsAPI) {
|
|
|
43
42
|
var panelOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
44
43
|
var allowCustomPanel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
45
44
|
return function (state, dispatch) {
|
|
46
|
-
var _panelNode$node$attrs;
|
|
47
45
|
var nodes = state.schema.nodes,
|
|
48
46
|
tr = state.tr;
|
|
49
47
|
var panelNode = findPanel(state);
|
|
@@ -53,7 +51,6 @@ export var changePanelType = function changePanelType(editorAnalyticsAPI) {
|
|
|
53
51
|
var newType = panelType;
|
|
54
52
|
var previousType = panelNode.node.attrs.panelType;
|
|
55
53
|
var newTr;
|
|
56
|
-
var localId = fg('platform_editor_adf_with_localid') ? ((_panelNode$node$attrs = panelNode.node.attrs) === null || _panelNode$node$attrs === void 0 ? void 0 : _panelNode$node$attrs.localId) || uuid.generate() : undefined;
|
|
57
54
|
if (allowCustomPanel) {
|
|
58
55
|
var previousColor = panelNode.node.attrs.panelType === 'custom' ? panelNode.node.attrs.panelColor || 'none' : getPanelTypeBackgroundNoTokens(previousType);
|
|
59
56
|
var previousIcon = panelNode.node.attrs.panelIcon;
|
|
@@ -70,13 +67,11 @@ export var changePanelType = function changePanelType(editorAnalyticsAPI) {
|
|
|
70
67
|
panelIconId: newPanelOptions.emojiId,
|
|
71
68
|
panelIconText: newPanelOptions.emojiText,
|
|
72
69
|
panelColor: newPanelOptions.color,
|
|
73
|
-
panelType: panelType
|
|
74
|
-
localId: localId
|
|
70
|
+
panelType: panelType
|
|
75
71
|
});
|
|
76
72
|
} else {
|
|
77
73
|
newTr = tr.setNodeMarkup(panelNode.pos, nodes.panel, {
|
|
78
|
-
panelType: panelType
|
|
79
|
-
localId: localId
|
|
74
|
+
panelType: panelType
|
|
80
75
|
});
|
|
81
76
|
}
|
|
82
77
|
var payload = {
|
|
@@ -115,10 +110,7 @@ export function insertPanelWithAnalytics(inputMethod, analyticsAPI) {
|
|
|
115
110
|
})(function (state, dispatch) {
|
|
116
111
|
var nodes = state.schema.nodes;
|
|
117
112
|
if (nodes.panel && nodes.paragraph) {
|
|
118
|
-
|
|
119
|
-
localId: uuid.generate()
|
|
120
|
-
} : {};
|
|
121
|
-
return wrapSelectionIn(nodes.panel, panelAttrs)(state, dispatch);
|
|
113
|
+
return wrapSelectionIn(nodes.panel)(state, dispatch);
|
|
122
114
|
}
|
|
123
115
|
return false;
|
|
124
116
|
});
|
package/dist/esm/panelPlugin.js
CHANGED
|
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
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; }
|
|
3
3
|
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) { _defineProperty(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; }
|
|
4
4
|
import React from 'react';
|
|
5
|
-
import { extendedPanel, extendedPanelWithLocalId, PanelType
|
|
5
|
+
import { extendedPanel, extendedPanelWithLocalId, PanelType } from '@atlaskit/adf-schema';
|
|
6
6
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
7
7
|
import { insertSelectedItem } from '@atlaskit/editor-common/insert';
|
|
8
8
|
import { blockTypeMessages } from '@atlaskit/editor-common/messages';
|
|
@@ -254,10 +254,6 @@ function createPanelAction(_ref4) {
|
|
|
254
254
|
inputMethod = _ref4$inputMethod === void 0 ? INPUT_METHOD.QUICK_INSERT : _ref4$inputMethod;
|
|
255
255
|
var panel = state.schema.nodes.panel;
|
|
256
256
|
var tr;
|
|
257
|
-
var panelAttrs = fg('platform_editor_adf_with_localid') ? _objectSpread(_objectSpread({}, attributes), {}, {
|
|
258
|
-
localId: attributes.localId || uuid.generate()
|
|
259
|
-
}) : _objectSpread({}, attributes);
|
|
260
|
-
|
|
261
257
|
/*
|
|
262
258
|
During investigation of go/j/ED-26928 I found that the behaviour of this experience was very
|
|
263
259
|
inconsistent. I reached out to Nicole* for a design review, and she confirmed that the desired
|
|
@@ -267,7 +263,7 @@ function createPanelAction(_ref4) {
|
|
|
267
263
|
if (expValEquals('platform_editor_fix_quick_insert_consistency_exp', 'isEnabled', true)) {
|
|
268
264
|
// If the selection is empty, we want to insert the panel on a new line
|
|
269
265
|
if (state.selection.empty) {
|
|
270
|
-
var node = panel.createAndFill(
|
|
266
|
+
var node = panel.createAndFill(_objectSpread({}, attributes));
|
|
271
267
|
if (!node) {
|
|
272
268
|
return false;
|
|
273
269
|
}
|
|
@@ -283,7 +279,7 @@ function createPanelAction(_ref4) {
|
|
|
283
279
|
tr = createWrapSelectionTransaction({
|
|
284
280
|
state: state,
|
|
285
281
|
type: panel,
|
|
286
|
-
nodeAttributes:
|
|
282
|
+
nodeAttributes: _objectSpread({}, attributes)
|
|
287
283
|
});
|
|
288
284
|
}
|
|
289
285
|
} else {
|
|
@@ -293,10 +289,10 @@ function createPanelAction(_ref4) {
|
|
|
293
289
|
tr = state.selection.empty && createWrapSelectionTransaction({
|
|
294
290
|
state: state,
|
|
295
291
|
type: panel,
|
|
296
|
-
nodeAttributes:
|
|
292
|
+
nodeAttributes: _objectSpread({}, attributes)
|
|
297
293
|
});
|
|
298
294
|
} else {
|
|
299
|
-
var _node = panel.createAndFill(
|
|
295
|
+
var _node = panel.createAndFill(_objectSpread({}, attributes));
|
|
300
296
|
if (!_node) {
|
|
301
297
|
return false;
|
|
302
298
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
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; }
|
|
3
3
|
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) { _defineProperty(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; }
|
|
4
|
-
import { PanelType
|
|
4
|
+
import { PanelType } from '@atlaskit/adf-schema';
|
|
5
5
|
import { PanelSharedCssClassName } from '@atlaskit/editor-common/panel';
|
|
6
6
|
import { hexToEditorBackgroundPaletteColor } from '@atlaskit/editor-palette';
|
|
7
7
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
@@ -62,9 +62,7 @@ export var handleCut = function handleCut(newState, oldState) {
|
|
|
62
62
|
return node.type.name === 'panel';
|
|
63
63
|
})(oldState.tr.selection);
|
|
64
64
|
var clonedPanelNode = oldPanelNode === null || oldPanelNode === void 0 ? void 0 : oldPanelNode.node.copy();
|
|
65
|
-
var newPanelNode = schema.nodes.panel.create(_objectSpread(
|
|
66
|
-
localId: uuid.generate()
|
|
67
|
-
}), emptyParagraph);
|
|
65
|
+
var newPanelNode = schema.nodes.panel.create(_objectSpread({}, clonedPanelNode === null || clonedPanelNode === void 0 ? void 0 : clonedPanelNode.attrs), emptyParagraph);
|
|
68
66
|
var endPos = oldState.tr.selection.$from.pos;
|
|
69
67
|
if (oldPanelNode) {
|
|
70
68
|
newTr.insert(oldPanelNode.pos, newPanelNode).setSelection(new TextSelection(newTr.doc.resolve(endPos)));
|
|
@@ -11,5 +11,5 @@ import type { EmojiInfo, PanelPluginOptions } from '../panelPluginType';
|
|
|
11
11
|
export declare const panelIconMap: {
|
|
12
12
|
[key in Exclude<PanelType, PanelType.CUSTOM>]: EmojiInfo;
|
|
13
13
|
};
|
|
14
|
-
export declare const getToolbarItems: (formatMessage: IntlShape[
|
|
14
|
+
export declare const getToolbarItems: (formatMessage: IntlShape["formatMessage"], panelNodeType: NodeType, isCustomPanelEnabled: boolean, isCustomPanelEditable: boolean, providerFactory: ProviderFactory, hoverDecoration: HoverDecorationHandler | undefined, editorAnalyticsAPI: EditorAnalyticsAPI | undefined, activePanelType?: string, activePanelColor?: string, activePanelIcon?: string, state?: EditorState, api?: ExtractInjectionAPI<PanelPlugin>) => FloatingToolbarItem<Command>[];
|
|
15
15
|
export declare const getToolbarConfig: (state: EditorState, intl: IntlShape, options: PanelPluginOptions | undefined, providerFactory: ProviderFactory, api: ExtractInjectionAPI<PanelPlugin> | undefined) => FloatingToolbarConfig | undefined;
|
|
@@ -11,5 +11,5 @@ import type { EmojiInfo, PanelPluginOptions } from '../panelPluginType';
|
|
|
11
11
|
export declare const panelIconMap: {
|
|
12
12
|
[key in Exclude<PanelType, PanelType.CUSTOM>]: EmojiInfo;
|
|
13
13
|
};
|
|
14
|
-
export declare const getToolbarItems: (formatMessage: IntlShape[
|
|
14
|
+
export declare const getToolbarItems: (formatMessage: IntlShape["formatMessage"], panelNodeType: NodeType, isCustomPanelEnabled: boolean, isCustomPanelEditable: boolean, providerFactory: ProviderFactory, hoverDecoration: HoverDecorationHandler | undefined, editorAnalyticsAPI: EditorAnalyticsAPI | undefined, activePanelType?: string, activePanelColor?: string, activePanelIcon?: string, state?: EditorState, api?: ExtractInjectionAPI<PanelPlugin>) => FloatingToolbarItem<Command>[];
|
|
15
15
|
export declare const getToolbarConfig: (state: EditorState, intl: IntlShape, options: PanelPluginOptions | undefined, providerFactory: ProviderFactory, api: ExtractInjectionAPI<PanelPlugin> | undefined) => FloatingToolbarConfig | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-panel",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.2",
|
|
4
4
|
"description": "Panel plugin for @atlaskit/editor-core.",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -36,18 +36,18 @@
|
|
|
36
36
|
"@atlaskit/editor-plugin-decorations": "^3.0.0",
|
|
37
37
|
"@atlaskit/editor-plugin-emoji": "^4.2.0",
|
|
38
38
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
39
|
-
"@atlaskit/editor-shared-styles": "^3.
|
|
40
|
-
"@atlaskit/emoji": "^69.
|
|
41
|
-
"@atlaskit/icon": "^27.
|
|
39
|
+
"@atlaskit/editor-shared-styles": "^3.6.0",
|
|
40
|
+
"@atlaskit/emoji": "^69.4.0",
|
|
41
|
+
"@atlaskit/icon": "^27.12.0",
|
|
42
42
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
43
43
|
"@atlaskit/theme": "^19.0.0",
|
|
44
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
44
|
+
"@atlaskit/tmp-editor-statsig": "^11.0.0",
|
|
45
45
|
"@atlaskit/tokens": "^6.0.0",
|
|
46
46
|
"@babel/runtime": "^7.0.0",
|
|
47
47
|
"uuid": "^3.1.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@atlaskit/editor-common": "^107.
|
|
50
|
+
"@atlaskit/editor-common": "^107.25.0",
|
|
51
51
|
"react": "^18.2.0",
|
|
52
52
|
"react-dom": "^18.2.0",
|
|
53
53
|
"react-intl-next": "npm:react-intl@^5.18.1"
|