@atlaskit/editor-common 114.35.0 → 114.36.1
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 +23 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/nesting/utilities.js +24 -1
- package/dist/cjs/selection/context-helpers.js +62 -2
- package/dist/cjs/toolbar/rank.js +1 -1
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/utils/processRawValue.js +6 -3
- package/dist/cjs/utils/validate-using-spec.js +13 -1
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/nesting/utilities.js +24 -0
- package/dist/es2019/selection/context-helpers.js +60 -2
- package/dist/es2019/toolbar/rank.js +2 -1
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/utils/processRawValue.js +7 -4
- package/dist/es2019/utils/validate-using-spec.js +13 -1
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/nesting/utilities.js +23 -0
- package/dist/esm/selection/context-helpers.js +62 -2
- package/dist/esm/toolbar/rank.js +1 -1
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/utils/processRawValue.js +7 -4
- package/dist/esm/utils/validate-using-spec.js +13 -1
- package/dist/types/nesting/utilities.d.ts +1 -0
- package/dist/types/toolbar/rank.d.ts +1 -0
- package/dist/types/utils/validate-using-spec.d.ts +3 -2
- package/dist/types-ts4.5/nesting/utilities.d.ts +1 -0
- package/dist/types-ts4.5/toolbar/rank.d.ts +1 -0
- package/dist/types-ts4.5/utils/validate-using-spec.d.ts +3 -2
- package/package.json +12 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 114.36.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`e55600892c6bd`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e55600892c6bd) -
|
|
8
|
+
Ensure table localIds (rows, cells) get sent to the BE
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 114.36.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [`4f2e912c65ae3`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4f2e912c65ae3) -
|
|
16
|
+
Gate table-in-panel ADF validation behind experiment (EDITOR-7168)
|
|
17
|
+
- [`dbd418b1304cd`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/dbd418b1304cd) -
|
|
18
|
+
[ux] Added support to show an icon-only version of the hero prompt in the editor's AI toolbar on
|
|
19
|
+
smaller screen sizes, when Rovo is enabled on the product and an empty state hero item is
|
|
20
|
+
configured.
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- Updated dependencies
|
|
25
|
+
|
|
3
26
|
## 114.35.0
|
|
4
27
|
|
|
5
28
|
### Minor Changes
|
|
@@ -19,7 +19,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
19
19
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
20
20
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
21
21
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
22
|
-
var packageVersion = "114.
|
|
22
|
+
var packageVersion = "114.36.0";
|
|
23
23
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
24
24
|
// Remove URL as it has UGC
|
|
25
25
|
// Ignored via go/ees007
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.isSelectionTableNestedInTable = exports.isNestedTablesSupported = exports.getPositionAfterTopParentNodeOfType = exports.getParentOfTypeCount = void 0;
|
|
6
|
+
exports.isSelectionTableNestedInTable = exports.isPanelNestingTableSupported = exports.isNestedTablesSupported = exports.getPositionAfterTopParentNodeOfType = exports.getParentOfTypeCount = void 0;
|
|
7
7
|
var _editorTables = require("@atlaskit/editor-tables");
|
|
8
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
8
9
|
/*
|
|
9
10
|
* Returns the level of nesting of a given `nodeType` in the current position.
|
|
10
11
|
* eg. table > table is nested 1 level, table > table > table is nested 2 levels.
|
|
@@ -87,4 +88,26 @@ var isNestedTablesSupported = exports.isNestedTablesSupported = function isNeste
|
|
|
87
88
|
var tableCellCanContainTable = ((_tableCell$contentMat = tableCell.contentMatch.matchType(table)) === null || _tableCell$contentMat === void 0 ? void 0 : _tableCell$contentMat.validEnd) === true;
|
|
88
89
|
var tableHeaderCanContainTable = ((_tableHeader$contentM = tableHeader.contentMatch.matchType(table)) === null || _tableHeader$contentM === void 0 ? void 0 : _tableHeader$contentM.validEnd) === true;
|
|
89
90
|
return tableCellCanContainTable || tableHeaderCanContainTable;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
/*
|
|
94
|
+
* Returns true if the schema supports nesting a table inside a panel (panel_c1 variant),
|
|
95
|
+
* AND the `platform_editor_nest_table_in_panel` experiment is enabled.
|
|
96
|
+
*
|
|
97
|
+
* ```typescript
|
|
98
|
+
* const supportsTableInPanel = isPanelNestingTableSupported(state.schema);
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
var isPanelNestingTableSupported = exports.isPanelNestingTableSupported = function isPanelNestingTableSupported(schema) {
|
|
102
|
+
var _panel_c1$contentMatc;
|
|
103
|
+
var _schema$nodes2 = schema.nodes,
|
|
104
|
+
table = _schema$nodes2.table,
|
|
105
|
+
panel_c1 = _schema$nodes2.panel_c1;
|
|
106
|
+
if (!table || !panel_c1) {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Confirm the PM schema actually allows table inside panel_c1
|
|
111
|
+
var panelC1CanContainTable = ((_panel_c1$contentMatc = panel_c1.contentMatch.matchType(table)) === null || _panel_c1$contentMatc === void 0 ? void 0 : _panel_c1$contentMatc.validEnd) === true;
|
|
112
|
+
return panelC1CanContainTable && (0, _expValEquals.expValEquals)('platform_editor_nest_table_in_panel', 'isEnabled', true);
|
|
90
113
|
};
|
|
@@ -9,6 +9,8 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
|
|
|
9
9
|
var _editorJsonTransformer = require("@atlaskit/editor-json-transformer");
|
|
10
10
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
11
11
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
12
|
+
var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
|
|
13
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
14
|
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; } } }; }
|
|
13
15
|
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; } }
|
|
14
16
|
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; }
|
|
@@ -109,7 +111,65 @@ var getLocalIdsFromSelection = exports.getLocalIdsFromSelection = function getLo
|
|
|
109
111
|
return null;
|
|
110
112
|
}
|
|
111
113
|
if (selection instanceof _state.NodeSelection) {
|
|
114
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_ai_selection_local_ids')) {
|
|
115
|
+
var _selection$node$attrs;
|
|
116
|
+
var _ids = [];
|
|
117
|
+
var rootLocalId = (_selection$node$attrs = selection.node.attrs) === null || _selection$node$attrs === void 0 ? void 0 : _selection$node$attrs.localId;
|
|
118
|
+
if (rootLocalId) {
|
|
119
|
+
_ids.push(rootLocalId);
|
|
120
|
+
}
|
|
121
|
+
selection.node.descendants(function (node) {
|
|
122
|
+
var _node$attrs;
|
|
123
|
+
if (node.isInline) {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
var localId = (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.localId;
|
|
127
|
+
if (localId) {
|
|
128
|
+
_ids.push(localId);
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
return _ids;
|
|
132
|
+
}
|
|
112
133
|
return [selection.node.attrs.localId];
|
|
134
|
+
} else if (selection instanceof _cellSelection.CellSelection) {
|
|
135
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_ai_selection_local_ids')) {
|
|
136
|
+
var _ids2 = [];
|
|
137
|
+
var ancestorIds = new Set();
|
|
138
|
+
// Collect localIds from each selected cell and its descendants
|
|
139
|
+
selection.forEachCell(function (cellNode, cellPos) {
|
|
140
|
+
var _cellNode$attrs;
|
|
141
|
+
var cellLocalId = (_cellNode$attrs = cellNode.attrs) === null || _cellNode$attrs === void 0 ? void 0 : _cellNode$attrs.localId;
|
|
142
|
+
if (cellLocalId) {
|
|
143
|
+
_ids2.push(cellLocalId);
|
|
144
|
+
}
|
|
145
|
+
cellNode.descendants(function (node) {
|
|
146
|
+
var _node$attrs2;
|
|
147
|
+
if (node.isInline) {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
var localId = (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.localId;
|
|
151
|
+
if (localId) {
|
|
152
|
+
_ids2.push(localId);
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
// Collect ancestor localIds (row, table) separately
|
|
156
|
+
var $cell = selection.$anchorCell.doc.resolve(cellPos + 1);
|
|
157
|
+
for (var depth = $cell.depth - 1; depth >= 1; depth--) {
|
|
158
|
+
var _ancestor$attrs;
|
|
159
|
+
var ancestor = $cell.node(depth);
|
|
160
|
+
var localId = (_ancestor$attrs = ancestor.attrs) === null || _ancestor$attrs === void 0 ? void 0 : _ancestor$attrs.localId;
|
|
161
|
+
if (localId) {
|
|
162
|
+
ancestorIds.add(localId);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
var uniqueIds = new Set(_ids2);
|
|
167
|
+
var uniqueAncestors = (0, _toConsumableArray2.default)(ancestorIds).filter(function (id) {
|
|
168
|
+
return !uniqueIds.has(id);
|
|
169
|
+
});
|
|
170
|
+
return [].concat((0, _toConsumableArray2.default)(uniqueIds), (0, _toConsumableArray2.default)(uniqueAncestors));
|
|
171
|
+
}
|
|
172
|
+
// Fall through to default slice-based behavior when gate is off
|
|
113
173
|
} else if (selection.empty) {
|
|
114
174
|
return [selection.$from.parent.attrs.localId];
|
|
115
175
|
}
|
|
@@ -117,8 +177,8 @@ var getLocalIdsFromSelection = exports.getLocalIdsFromSelection = function getLo
|
|
|
117
177
|
var content = slice.content;
|
|
118
178
|
var ids = [];
|
|
119
179
|
content.forEach(function (node) {
|
|
120
|
-
var _node$
|
|
121
|
-
var localId = (_node$
|
|
180
|
+
var _node$attrs3;
|
|
181
|
+
var localId = (_node$attrs3 = node.attrs) === null || _node$attrs3 === void 0 ? void 0 : _node$attrs3.localId;
|
|
122
182
|
if (localId) {
|
|
123
183
|
ids.push(localId);
|
|
124
184
|
}
|
package/dist/cjs/toolbar/rank.js
CHANGED
|
@@ -16,7 +16,7 @@ var TOOLBAR_RANK = exports.TOOLBAR_RANK = (_TOOLBAR_RANK = {}, (0, _defineProper
|
|
|
16
16
|
var AI_SECTION_RANK = exports.AI_SECTION_RANK = (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, _keys.ROVO_GROUP.key, 100), _keys.ROVO_GROUP_DISPLAY_SMALL.key, 100), _keys.ROVO_GROUP_PRIMARY_TOOLBAR.key, 100), _keys.DEFINE_GROUP.key, 200), _keys.IMPROVE_WRITING_GROUP.key, 300), _keys.HERO_PROMPT_BUTTON_GROUP.key, 300), _keys.AI_SUGGESTIONS_GROUP.key, 400);
|
|
17
17
|
var AI_SUGGESTIONS_GROUP_RANK = exports.AI_SUGGESTIONS_GROUP_RANK = (0, _defineProperty2.default)({}, _keys.AI_SUGGESTIONS_BUTTON.key, 100);
|
|
18
18
|
var ROVO_GROUP_RANK = exports.ROVO_GROUP_RANK = (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, _keys.ROVO_HERO_BUTTON.key, 100), _keys.ROVO_WRITE_BUTTON_PRIMARY_TOOLBAR.key, 100), _keys.ROVO_MENU.key, 200);
|
|
19
|
-
var ROVO_GROUP_DISPLAY_SMALL_RANK = exports.ROVO_GROUP_DISPLAY_SMALL_RANK = (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, _keys.ROVO_HERO_BUTTON.key, 100), _keys.ROVO_MENU_DISPLAY_SMALL.key, 200), _keys.
|
|
19
|
+
var ROVO_GROUP_DISPLAY_SMALL_RANK = exports.ROVO_GROUP_DISPLAY_SMALL_RANK = (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, _keys.ROVO_HERO_BUTTON.key, 100), _keys.ROVO_MENU_DISPLAY_SMALL.key, 200), _keys.HERO_PROMPT_BUTTON.key, 300), _keys.AI_SUGGESTIONS_BUTTON.key, 400);
|
|
20
20
|
var DEFINE_GROUP_RANK = exports.DEFINE_GROUP_RANK = (0, _defineProperty2.default)({}, _keys.DEFINE_BUTTON.key, 100);
|
|
21
21
|
var IMPROVE_WRITING_GROUP_RANK = exports.IMPROVE_WRITING_GROUP_RANK = (0, _defineProperty2.default)({}, _keys.IMPROVE_WRITING_BUTTON.key, 100);
|
|
22
22
|
var HERO_PROMPT_BUTTON_GROUP_RANK = exports.HERO_PROMPT_BUTTON_GROUP_RANK = (0, _defineProperty2.default)({}, _keys.HERO_PROMPT_BUTTON.key, 100);
|
|
@@ -24,7 +24,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
24
24
|
* @jsx jsx
|
|
25
25
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
26
26
|
var packageName = "@atlaskit/editor-common";
|
|
27
|
-
var packageVersion = "114.
|
|
27
|
+
var packageVersion = "114.36.0";
|
|
28
28
|
var halfFocusRing = 1;
|
|
29
29
|
var dropOffset = '0, 8';
|
|
30
30
|
var fadeIn = (0, _react2.keyframes)({
|
|
@@ -248,9 +248,12 @@ function processRawValue(schema, value, providerFactory, sanitizePrivateContent,
|
|
|
248
248
|
// Validate ADF first before converting nested-table extensions into nested tables
|
|
249
249
|
// This matches the renderer's behavior in render-document.ts
|
|
250
250
|
var allowNestedTables = (0, _utilities.isNestedTablesSupported)(schema);
|
|
251
|
-
var
|
|
252
|
-
|
|
253
|
-
|
|
251
|
+
var allowTableInPanel = (0, _utilities.isPanelNestingTableSupported)(schema);
|
|
252
|
+
var validateADFEntityOptions = allowNestedTables || allowTableInPanel ? {
|
|
253
|
+
allowNestedTables: allowNestedTables || undefined,
|
|
254
|
+
allowTableInPanel: allowTableInPanel || undefined
|
|
255
|
+
} : undefined;
|
|
256
|
+
var entity = (0, _validateUsingSpec.validateADFEntity)(schema, transformedAdf || node, dispatchAnalyticsEvent, validateADFEntityOptions);
|
|
254
257
|
|
|
255
258
|
// Convert nested-table extensions into nested tables
|
|
256
259
|
var _transformNestedTable3 = transformNestedTablesWithAnalytics(entity, dispatchAnalyticsEvent);
|
|
@@ -16,7 +16,8 @@ var UNSUPPORTED_NODE_ATTRIBUTE = exports.UNSUPPORTED_NODE_ATTRIBUTE = 'unsupport
|
|
|
16
16
|
var errorCallbackFor = function errorCallbackFor(marks, validate, dispatchAnalyticsEvent, validationOverrides) {
|
|
17
17
|
return function (entity, error, options) {
|
|
18
18
|
return validationErrorHandler(entity, error, _objectSpread(_objectSpread({}, options), {}, {
|
|
19
|
-
allowNestedTables: validationOverrides === null || validationOverrides === void 0 ? void 0 : validationOverrides.allowNestedTables
|
|
19
|
+
allowNestedTables: validationOverrides === null || validationOverrides === void 0 ? void 0 : validationOverrides.allowNestedTables,
|
|
20
|
+
allowTableInPanel: validationOverrides === null || validationOverrides === void 0 ? void 0 : validationOverrides.allowTableInPanel
|
|
20
21
|
}), marks, validate, dispatchAnalyticsEvent);
|
|
21
22
|
};
|
|
22
23
|
};
|
|
@@ -81,6 +82,17 @@ var validationErrorHandler = exports.validationErrorHandler = function validatio
|
|
|
81
82
|
return entity;
|
|
82
83
|
}
|
|
83
84
|
}
|
|
85
|
+
|
|
86
|
+
// panel_c1 is a ProseMirror-only variant: on save, table-in-panel documents are stored as
|
|
87
|
+
// plain ADF `panel` nodes containing a `table`. The base validator-spec does not permit
|
|
88
|
+
// `table` inside `panel` (it's gated behind the experiment), so we suppress the
|
|
89
|
+
// INVALID_CONTENT error when the experiment is active.
|
|
90
|
+
if (options.allowTableInPanel) {
|
|
91
|
+
var _meta = error.meta;
|
|
92
|
+
if ((_meta === null || _meta === void 0 ? void 0 : _meta.parentType) === 'panel' && error.code === 'INVALID_CONTENT' && entity.type === 'table') {
|
|
93
|
+
return entity;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
84
96
|
if (options.allowUnsupportedBlock) {
|
|
85
97
|
return wrapWithUnsupported(entity);
|
|
86
98
|
}
|
|
@@ -4,7 +4,7 @@ import { isFedRamp } from './environment';
|
|
|
4
4
|
import { normaliseSentryBreadcrumbs, SERIALIZABLE_ATTRIBUTES } from './normalise-sentry-breadcrumbs';
|
|
5
5
|
const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
6
6
|
const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
7
|
-
const packageVersion = "114.
|
|
7
|
+
const packageVersion = "114.36.0";
|
|
8
8
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
9
9
|
// Remove URL as it has UGC
|
|
10
10
|
// Ignored via go/ees007
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { findTable } from '@atlaskit/editor-tables';
|
|
2
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
2
3
|
|
|
3
4
|
/*
|
|
4
5
|
* Returns the level of nesting of a given `nodeType` in the current position.
|
|
@@ -79,4 +80,27 @@ export const isNestedTablesSupported = schema => {
|
|
|
79
80
|
const tableCellCanContainTable = ((_tableCell$contentMat = tableCell.contentMatch.matchType(table)) === null || _tableCell$contentMat === void 0 ? void 0 : _tableCell$contentMat.validEnd) === true;
|
|
80
81
|
const tableHeaderCanContainTable = ((_tableHeader$contentM = tableHeader.contentMatch.matchType(table)) === null || _tableHeader$contentM === void 0 ? void 0 : _tableHeader$contentM.validEnd) === true;
|
|
81
82
|
return tableCellCanContainTable || tableHeaderCanContainTable;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
/*
|
|
86
|
+
* Returns true if the schema supports nesting a table inside a panel (panel_c1 variant),
|
|
87
|
+
* AND the `platform_editor_nest_table_in_panel` experiment is enabled.
|
|
88
|
+
*
|
|
89
|
+
* ```typescript
|
|
90
|
+
* const supportsTableInPanel = isPanelNestingTableSupported(state.schema);
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
export const isPanelNestingTableSupported = schema => {
|
|
94
|
+
var _panel_c1$contentMatc;
|
|
95
|
+
const {
|
|
96
|
+
table,
|
|
97
|
+
panel_c1
|
|
98
|
+
} = schema.nodes;
|
|
99
|
+
if (!table || !panel_c1) {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Confirm the PM schema actually allows table inside panel_c1
|
|
104
|
+
const panelC1CanContainTable = ((_panel_c1$contentMatc = panel_c1.contentMatch.matchType(table)) === null || _panel_c1$contentMatc === void 0 ? void 0 : _panel_c1$contentMatc.validEnd) === true;
|
|
105
|
+
return panelC1CanContainTable && expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true);
|
|
82
106
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { nodeToJSON } from '@atlaskit/editor-json-transformer';
|
|
2
2
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import { TextSelection, NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
+
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
6
|
const listDepth = 3;
|
|
5
7
|
export const selectionCoversAllListItems = ($from, $to) => {
|
|
6
8
|
// Block level lists
|
|
@@ -91,7 +93,63 @@ export const getLocalIdsFromSelection = selection => {
|
|
|
91
93
|
return null;
|
|
92
94
|
}
|
|
93
95
|
if (selection instanceof NodeSelection) {
|
|
96
|
+
if (fg('platform_editor_ai_selection_local_ids')) {
|
|
97
|
+
var _selection$node$attrs;
|
|
98
|
+
const ids = [];
|
|
99
|
+
const rootLocalId = (_selection$node$attrs = selection.node.attrs) === null || _selection$node$attrs === void 0 ? void 0 : _selection$node$attrs.localId;
|
|
100
|
+
if (rootLocalId) {
|
|
101
|
+
ids.push(rootLocalId);
|
|
102
|
+
}
|
|
103
|
+
selection.node.descendants(node => {
|
|
104
|
+
var _node$attrs;
|
|
105
|
+
if (node.isInline) {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
const localId = (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.localId;
|
|
109
|
+
if (localId) {
|
|
110
|
+
ids.push(localId);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
return ids;
|
|
114
|
+
}
|
|
94
115
|
return [selection.node.attrs.localId];
|
|
116
|
+
} else if (selection instanceof CellSelection) {
|
|
117
|
+
if (fg('platform_editor_ai_selection_local_ids')) {
|
|
118
|
+
const ids = [];
|
|
119
|
+
const ancestorIds = new Set();
|
|
120
|
+
// Collect localIds from each selected cell and its descendants
|
|
121
|
+
selection.forEachCell((cellNode, cellPos) => {
|
|
122
|
+
var _cellNode$attrs;
|
|
123
|
+
const cellLocalId = (_cellNode$attrs = cellNode.attrs) === null || _cellNode$attrs === void 0 ? void 0 : _cellNode$attrs.localId;
|
|
124
|
+
if (cellLocalId) {
|
|
125
|
+
ids.push(cellLocalId);
|
|
126
|
+
}
|
|
127
|
+
cellNode.descendants(node => {
|
|
128
|
+
var _node$attrs2;
|
|
129
|
+
if (node.isInline) {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
const localId = (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.localId;
|
|
133
|
+
if (localId) {
|
|
134
|
+
ids.push(localId);
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
// Collect ancestor localIds (row, table) separately
|
|
138
|
+
const $cell = selection.$anchorCell.doc.resolve(cellPos + 1);
|
|
139
|
+
for (let depth = $cell.depth - 1; depth >= 1; depth--) {
|
|
140
|
+
var _ancestor$attrs;
|
|
141
|
+
const ancestor = $cell.node(depth);
|
|
142
|
+
const localId = (_ancestor$attrs = ancestor.attrs) === null || _ancestor$attrs === void 0 ? void 0 : _ancestor$attrs.localId;
|
|
143
|
+
if (localId) {
|
|
144
|
+
ancestorIds.add(localId);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
const uniqueIds = new Set(ids);
|
|
149
|
+
const uniqueAncestors = [...ancestorIds].filter(id => !uniqueIds.has(id));
|
|
150
|
+
return [...uniqueIds, ...uniqueAncestors];
|
|
151
|
+
}
|
|
152
|
+
// Fall through to default slice-based behavior when gate is off
|
|
95
153
|
} else if (selection.empty) {
|
|
96
154
|
return [selection.$from.parent.attrs.localId];
|
|
97
155
|
}
|
|
@@ -99,8 +157,8 @@ export const getLocalIdsFromSelection = selection => {
|
|
|
99
157
|
const content = slice.content;
|
|
100
158
|
const ids = [];
|
|
101
159
|
content.forEach(node => {
|
|
102
|
-
var _node$
|
|
103
|
-
const localId = (_node$
|
|
160
|
+
var _node$attrs3;
|
|
161
|
+
const localId = (_node$attrs3 = node.attrs) === null || _node$attrs3 === void 0 ? void 0 : _node$attrs3.localId;
|
|
104
162
|
if (localId) {
|
|
105
163
|
ids.push(localId);
|
|
106
164
|
}
|
|
@@ -42,7 +42,8 @@ export const ROVO_GROUP_RANK = {
|
|
|
42
42
|
export const ROVO_GROUP_DISPLAY_SMALL_RANK = {
|
|
43
43
|
[ROVO_HERO_BUTTON.key]: 100,
|
|
44
44
|
[ROVO_MENU_DISPLAY_SMALL.key]: 200,
|
|
45
|
-
[
|
|
45
|
+
[HERO_PROMPT_BUTTON.key]: 300,
|
|
46
|
+
[AI_SUGGESTIONS_BUTTON.key]: 400
|
|
46
47
|
};
|
|
47
48
|
export const DEFINE_GROUP_RANK = {
|
|
48
49
|
[DEFINE_BUTTON.key]: 100
|
|
@@ -14,7 +14,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
|
14
14
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
15
|
import Layer from '../Layer';
|
|
16
16
|
const packageName = "@atlaskit/editor-common";
|
|
17
|
-
const packageVersion = "114.
|
|
17
|
+
const packageVersion = "114.36.0";
|
|
18
18
|
const halfFocusRing = 1;
|
|
19
19
|
const dropOffset = '0, 8';
|
|
20
20
|
const fadeIn = keyframes({
|
|
@@ -2,7 +2,7 @@ import { syncBlockFallbackTransform, transformDedupeMarks, transformIndentationM
|
|
|
2
2
|
import { Fragment, Node } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
4
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../analytics';
|
|
5
|
-
import { isNestedTablesSupported } from '../nesting/utilities';
|
|
5
|
+
import { isNestedTablesSupported, isPanelNestingTableSupported } from '../nesting/utilities';
|
|
6
6
|
import { sanitizeNodeForPrivacy } from './filter/privacy-filter';
|
|
7
7
|
import { findAndTrackUnsupportedContentNodes } from './track-unsupported-content';
|
|
8
8
|
import { validateADFEntity } from './validate-using-spec';
|
|
@@ -247,9 +247,12 @@ export function processRawValue(schema, value, providerFactory, sanitizePrivateC
|
|
|
247
247
|
// Validate ADF first before converting nested-table extensions into nested tables
|
|
248
248
|
// This matches the renderer's behavior in render-document.ts
|
|
249
249
|
const allowNestedTables = isNestedTablesSupported(schema);
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
250
|
+
const allowTableInPanel = isPanelNestingTableSupported(schema);
|
|
251
|
+
const validateADFEntityOptions = allowNestedTables || allowTableInPanel ? {
|
|
252
|
+
allowNestedTables: allowNestedTables || undefined,
|
|
253
|
+
allowTableInPanel: allowTableInPanel || undefined
|
|
254
|
+
} : undefined;
|
|
255
|
+
let entity = validateADFEntity(schema, transformedAdf || node, dispatchAnalyticsEvent, validateADFEntityOptions);
|
|
253
256
|
|
|
254
257
|
// Convert nested-table extensions into nested tables
|
|
255
258
|
({
|
|
@@ -6,7 +6,8 @@ const errorCallbackFor = (marks, validate, dispatchAnalyticsEvent, validationOve
|
|
|
6
6
|
return (entity, error, options) => {
|
|
7
7
|
return validationErrorHandler(entity, error, {
|
|
8
8
|
...options,
|
|
9
|
-
allowNestedTables: validationOverrides === null || validationOverrides === void 0 ? void 0 : validationOverrides.allowNestedTables
|
|
9
|
+
allowNestedTables: validationOverrides === null || validationOverrides === void 0 ? void 0 : validationOverrides.allowNestedTables,
|
|
10
|
+
allowTableInPanel: validationOverrides === null || validationOverrides === void 0 ? void 0 : validationOverrides.allowTableInPanel
|
|
10
11
|
}, marks, validate, dispatchAnalyticsEvent);
|
|
11
12
|
};
|
|
12
13
|
};
|
|
@@ -71,6 +72,17 @@ export const validationErrorHandler = (entity, error, options, marks, validate,
|
|
|
71
72
|
return entity;
|
|
72
73
|
}
|
|
73
74
|
}
|
|
75
|
+
|
|
76
|
+
// panel_c1 is a ProseMirror-only variant: on save, table-in-panel documents are stored as
|
|
77
|
+
// plain ADF `panel` nodes containing a `table`. The base validator-spec does not permit
|
|
78
|
+
// `table` inside `panel` (it's gated behind the experiment), so we suppress the
|
|
79
|
+
// INVALID_CONTENT error when the experiment is active.
|
|
80
|
+
if (options.allowTableInPanel) {
|
|
81
|
+
const meta = error.meta;
|
|
82
|
+
if ((meta === null || meta === void 0 ? void 0 : meta.parentType) === 'panel' && error.code === 'INVALID_CONTENT' && entity.type === 'table') {
|
|
83
|
+
return entity;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
74
86
|
if (options.allowUnsupportedBlock) {
|
|
75
87
|
return wrapWithUnsupported(entity);
|
|
76
88
|
}
|
|
@@ -10,7 +10,7 @@ import { isFedRamp } from './environment';
|
|
|
10
10
|
import { normaliseSentryBreadcrumbs, SERIALIZABLE_ATTRIBUTES } from './normalise-sentry-breadcrumbs';
|
|
11
11
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
12
12
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
13
|
-
var packageVersion = "114.
|
|
13
|
+
var packageVersion = "114.36.0";
|
|
14
14
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
15
15
|
// Remove URL as it has UGC
|
|
16
16
|
// Ignored via go/ees007
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { findTable } from '@atlaskit/editor-tables';
|
|
2
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
2
3
|
|
|
3
4
|
/*
|
|
4
5
|
* Returns the level of nesting of a given `nodeType` in the current position.
|
|
@@ -82,4 +83,26 @@ export var isNestedTablesSupported = function isNestedTablesSupported(schema) {
|
|
|
82
83
|
var tableCellCanContainTable = ((_tableCell$contentMat = tableCell.contentMatch.matchType(table)) === null || _tableCell$contentMat === void 0 ? void 0 : _tableCell$contentMat.validEnd) === true;
|
|
83
84
|
var tableHeaderCanContainTable = ((_tableHeader$contentM = tableHeader.contentMatch.matchType(table)) === null || _tableHeader$contentM === void 0 ? void 0 : _tableHeader$contentM.validEnd) === true;
|
|
84
85
|
return tableCellCanContainTable || tableHeaderCanContainTable;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/*
|
|
89
|
+
* Returns true if the schema supports nesting a table inside a panel (panel_c1 variant),
|
|
90
|
+
* AND the `platform_editor_nest_table_in_panel` experiment is enabled.
|
|
91
|
+
*
|
|
92
|
+
* ```typescript
|
|
93
|
+
* const supportsTableInPanel = isPanelNestingTableSupported(state.schema);
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
export var isPanelNestingTableSupported = function isPanelNestingTableSupported(schema) {
|
|
97
|
+
var _panel_c1$contentMatc;
|
|
98
|
+
var _schema$nodes2 = schema.nodes,
|
|
99
|
+
table = _schema$nodes2.table,
|
|
100
|
+
panel_c1 = _schema$nodes2.panel_c1;
|
|
101
|
+
if (!table || !panel_c1) {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Confirm the PM schema actually allows table inside panel_c1
|
|
106
|
+
var panelC1CanContainTable = ((_panel_c1$contentMatc = panel_c1.contentMatch.matchType(table)) === null || _panel_c1$contentMatc === void 0 ? void 0 : _panel_c1$contentMatc.validEnd) === true;
|
|
107
|
+
return panelC1CanContainTable && expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true);
|
|
85
108
|
};
|
|
@@ -5,6 +5,8 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
5
5
|
import { nodeToJSON } from '@atlaskit/editor-json-transformer';
|
|
6
6
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
7
7
|
import { TextSelection, NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
8
|
+
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
9
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
10
|
var listDepth = 3;
|
|
9
11
|
export var selectionCoversAllListItems = function selectionCoversAllListItems($from, $to) {
|
|
10
12
|
// Block level lists
|
|
@@ -102,7 +104,65 @@ export var getLocalIdsFromSelection = function getLocalIdsFromSelection(selectio
|
|
|
102
104
|
return null;
|
|
103
105
|
}
|
|
104
106
|
if (selection instanceof NodeSelection) {
|
|
107
|
+
if (fg('platform_editor_ai_selection_local_ids')) {
|
|
108
|
+
var _selection$node$attrs;
|
|
109
|
+
var _ids = [];
|
|
110
|
+
var rootLocalId = (_selection$node$attrs = selection.node.attrs) === null || _selection$node$attrs === void 0 ? void 0 : _selection$node$attrs.localId;
|
|
111
|
+
if (rootLocalId) {
|
|
112
|
+
_ids.push(rootLocalId);
|
|
113
|
+
}
|
|
114
|
+
selection.node.descendants(function (node) {
|
|
115
|
+
var _node$attrs;
|
|
116
|
+
if (node.isInline) {
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
var localId = (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.localId;
|
|
120
|
+
if (localId) {
|
|
121
|
+
_ids.push(localId);
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
return _ids;
|
|
125
|
+
}
|
|
105
126
|
return [selection.node.attrs.localId];
|
|
127
|
+
} else if (selection instanceof CellSelection) {
|
|
128
|
+
if (fg('platform_editor_ai_selection_local_ids')) {
|
|
129
|
+
var _ids2 = [];
|
|
130
|
+
var ancestorIds = new Set();
|
|
131
|
+
// Collect localIds from each selected cell and its descendants
|
|
132
|
+
selection.forEachCell(function (cellNode, cellPos) {
|
|
133
|
+
var _cellNode$attrs;
|
|
134
|
+
var cellLocalId = (_cellNode$attrs = cellNode.attrs) === null || _cellNode$attrs === void 0 ? void 0 : _cellNode$attrs.localId;
|
|
135
|
+
if (cellLocalId) {
|
|
136
|
+
_ids2.push(cellLocalId);
|
|
137
|
+
}
|
|
138
|
+
cellNode.descendants(function (node) {
|
|
139
|
+
var _node$attrs2;
|
|
140
|
+
if (node.isInline) {
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
var localId = (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.localId;
|
|
144
|
+
if (localId) {
|
|
145
|
+
_ids2.push(localId);
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
// Collect ancestor localIds (row, table) separately
|
|
149
|
+
var $cell = selection.$anchorCell.doc.resolve(cellPos + 1);
|
|
150
|
+
for (var depth = $cell.depth - 1; depth >= 1; depth--) {
|
|
151
|
+
var _ancestor$attrs;
|
|
152
|
+
var ancestor = $cell.node(depth);
|
|
153
|
+
var localId = (_ancestor$attrs = ancestor.attrs) === null || _ancestor$attrs === void 0 ? void 0 : _ancestor$attrs.localId;
|
|
154
|
+
if (localId) {
|
|
155
|
+
ancestorIds.add(localId);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
var uniqueIds = new Set(_ids2);
|
|
160
|
+
var uniqueAncestors = _toConsumableArray(ancestorIds).filter(function (id) {
|
|
161
|
+
return !uniqueIds.has(id);
|
|
162
|
+
});
|
|
163
|
+
return [].concat(_toConsumableArray(uniqueIds), _toConsumableArray(uniqueAncestors));
|
|
164
|
+
}
|
|
165
|
+
// Fall through to default slice-based behavior when gate is off
|
|
106
166
|
} else if (selection.empty) {
|
|
107
167
|
return [selection.$from.parent.attrs.localId];
|
|
108
168
|
}
|
|
@@ -110,8 +170,8 @@ export var getLocalIdsFromSelection = function getLocalIdsFromSelection(selectio
|
|
|
110
170
|
var content = slice.content;
|
|
111
171
|
var ids = [];
|
|
112
172
|
content.forEach(function (node) {
|
|
113
|
-
var _node$
|
|
114
|
-
var localId = (_node$
|
|
173
|
+
var _node$attrs3;
|
|
174
|
+
var localId = (_node$attrs3 = node.attrs) === null || _node$attrs3 === void 0 ? void 0 : _node$attrs3.localId;
|
|
115
175
|
if (localId) {
|
|
116
176
|
ids.push(localId);
|
|
117
177
|
}
|
package/dist/esm/toolbar/rank.js
CHANGED
|
@@ -9,7 +9,7 @@ export var TOOLBAR_RANK = (_TOOLBAR_RANK = {}, _defineProperty(_defineProperty(_
|
|
|
9
9
|
export var AI_SECTION_RANK = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ROVO_GROUP.key, 100), ROVO_GROUP_DISPLAY_SMALL.key, 100), ROVO_GROUP_PRIMARY_TOOLBAR.key, 100), DEFINE_GROUP.key, 200), IMPROVE_WRITING_GROUP.key, 300), HERO_PROMPT_BUTTON_GROUP.key, 300), AI_SUGGESTIONS_GROUP.key, 400);
|
|
10
10
|
export var AI_SUGGESTIONS_GROUP_RANK = _defineProperty({}, AI_SUGGESTIONS_BUTTON.key, 100);
|
|
11
11
|
export var ROVO_GROUP_RANK = _defineProperty(_defineProperty(_defineProperty({}, ROVO_HERO_BUTTON.key, 100), ROVO_WRITE_BUTTON_PRIMARY_TOOLBAR.key, 100), ROVO_MENU.key, 200);
|
|
12
|
-
export var ROVO_GROUP_DISPLAY_SMALL_RANK = _defineProperty(_defineProperty(_defineProperty({}, ROVO_HERO_BUTTON.key, 100), ROVO_MENU_DISPLAY_SMALL.key, 200),
|
|
12
|
+
export var ROVO_GROUP_DISPLAY_SMALL_RANK = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ROVO_HERO_BUTTON.key, 100), ROVO_MENU_DISPLAY_SMALL.key, 200), HERO_PROMPT_BUTTON.key, 300), AI_SUGGESTIONS_BUTTON.key, 400);
|
|
13
13
|
export var DEFINE_GROUP_RANK = _defineProperty({}, DEFINE_BUTTON.key, 100);
|
|
14
14
|
export var IMPROVE_WRITING_GROUP_RANK = _defineProperty({}, IMPROVE_WRITING_BUTTON.key, 100);
|
|
15
15
|
export var HERO_PROMPT_BUTTON_GROUP_RANK = _defineProperty({}, HERO_PROMPT_BUTTON.key, 100);
|
|
@@ -21,7 +21,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
|
21
21
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
22
22
|
import Layer from '../Layer';
|
|
23
23
|
var packageName = "@atlaskit/editor-common";
|
|
24
|
-
var packageVersion = "114.
|
|
24
|
+
var packageVersion = "114.36.0";
|
|
25
25
|
var halfFocusRing = 1;
|
|
26
26
|
var dropOffset = '0, 8';
|
|
27
27
|
var fadeIn = keyframes({
|
|
@@ -2,7 +2,7 @@ import { syncBlockFallbackTransform, transformDedupeMarks, transformIndentationM
|
|
|
2
2
|
import { Fragment, Node } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
4
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../analytics';
|
|
5
|
-
import { isNestedTablesSupported } from '../nesting/utilities';
|
|
5
|
+
import { isNestedTablesSupported, isPanelNestingTableSupported } from '../nesting/utilities';
|
|
6
6
|
import { sanitizeNodeForPrivacy } from './filter/privacy-filter';
|
|
7
7
|
import { findAndTrackUnsupportedContentNodes } from './track-unsupported-content';
|
|
8
8
|
import { validateADFEntity } from './validate-using-spec';
|
|
@@ -240,9 +240,12 @@ export function processRawValue(schema, value, providerFactory, sanitizePrivateC
|
|
|
240
240
|
// Validate ADF first before converting nested-table extensions into nested tables
|
|
241
241
|
// This matches the renderer's behavior in render-document.ts
|
|
242
242
|
var allowNestedTables = isNestedTablesSupported(schema);
|
|
243
|
-
var
|
|
244
|
-
|
|
245
|
-
|
|
243
|
+
var allowTableInPanel = isPanelNestingTableSupported(schema);
|
|
244
|
+
var validateADFEntityOptions = allowNestedTables || allowTableInPanel ? {
|
|
245
|
+
allowNestedTables: allowNestedTables || undefined,
|
|
246
|
+
allowTableInPanel: allowTableInPanel || undefined
|
|
247
|
+
} : undefined;
|
|
248
|
+
var entity = validateADFEntity(schema, transformedAdf || node, dispatchAnalyticsEvent, validateADFEntityOptions);
|
|
246
249
|
|
|
247
250
|
// Convert nested-table extensions into nested tables
|
|
248
251
|
var _transformNestedTable3 = transformNestedTablesWithAnalytics(entity, dispatchAnalyticsEvent);
|
|
@@ -8,7 +8,8 @@ import { fireUnsupportedEvent } from './track-unsupported-content';
|
|
|
8
8
|
var errorCallbackFor = function errorCallbackFor(marks, validate, dispatchAnalyticsEvent, validationOverrides) {
|
|
9
9
|
return function (entity, error, options) {
|
|
10
10
|
return validationErrorHandler(entity, error, _objectSpread(_objectSpread({}, options), {}, {
|
|
11
|
-
allowNestedTables: validationOverrides === null || validationOverrides === void 0 ? void 0 : validationOverrides.allowNestedTables
|
|
11
|
+
allowNestedTables: validationOverrides === null || validationOverrides === void 0 ? void 0 : validationOverrides.allowNestedTables,
|
|
12
|
+
allowTableInPanel: validationOverrides === null || validationOverrides === void 0 ? void 0 : validationOverrides.allowTableInPanel
|
|
12
13
|
}), marks, validate, dispatchAnalyticsEvent);
|
|
13
14
|
};
|
|
14
15
|
};
|
|
@@ -73,6 +74,17 @@ export var validationErrorHandler = function validationErrorHandler(entity, erro
|
|
|
73
74
|
return entity;
|
|
74
75
|
}
|
|
75
76
|
}
|
|
77
|
+
|
|
78
|
+
// panel_c1 is a ProseMirror-only variant: on save, table-in-panel documents are stored as
|
|
79
|
+
// plain ADF `panel` nodes containing a `table`. The base validator-spec does not permit
|
|
80
|
+
// `table` inside `panel` (it's gated behind the experiment), so we suppress the
|
|
81
|
+
// INVALID_CONTENT error when the experiment is active.
|
|
82
|
+
if (options.allowTableInPanel) {
|
|
83
|
+
var _meta = error.meta;
|
|
84
|
+
if ((_meta === null || _meta === void 0 ? void 0 : _meta.parentType) === 'panel' && error.code === 'INVALID_CONTENT' && entity.type === 'table') {
|
|
85
|
+
return entity;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
76
88
|
if (options.allowUnsupportedBlock) {
|
|
77
89
|
return wrapWithUnsupported(entity);
|
|
78
90
|
}
|
|
@@ -4,3 +4,4 @@ export declare const getParentOfTypeCount: (nodeType: NodeType) => ($pos: Resolv
|
|
|
4
4
|
export declare const getPositionAfterTopParentNodeOfType: (nodeType: NodeType) => ($pos: ResolvedPos) => number | undefined;
|
|
5
5
|
export declare const isSelectionTableNestedInTable: (state: EditorState) => boolean;
|
|
6
6
|
export declare const isNestedTablesSupported: (schema: Schema) => boolean;
|
|
7
|
+
export declare const isPanelNestingTableSupported: (schema: Schema) => boolean;
|
|
@@ -5,17 +5,18 @@ export declare const UNSUPPORTED_NODE_ATTRIBUTE = "unsupportedNodeAttribute";
|
|
|
5
5
|
import type { UnsupportedContentPayload } from './unsupportedContent/types';
|
|
6
6
|
export type DispatchAnalyticsEvent = (event: UnsupportedContentPayload) => void;
|
|
7
7
|
export declare const validationErrorHandler: (entity: ADFEntity, error: ValidationError, options: ErrorCallbackOptions, marks: string[], validate: Validate, dispatchAnalyticsEvent?: DispatchAnalyticsEvent) => ADFEntity | {
|
|
8
|
-
type: string;
|
|
9
8
|
attrs: {
|
|
10
9
|
originalValue: ADFEntity;
|
|
11
10
|
};
|
|
11
|
+
type: string;
|
|
12
12
|
} | undefined;
|
|
13
13
|
export declare const validateADFEntity: (schema: Schema, node: ADFEntity, dispatchAnalyticsEvent?: DispatchAnalyticsEvent, validationOverrides?: {
|
|
14
14
|
allowNestedTables?: boolean;
|
|
15
|
+
allowTableInPanel?: boolean;
|
|
15
16
|
}) => ADFEntity;
|
|
16
17
|
export declare function wrapWithUnsupported(originalValue: ADFEntity, type?: 'block' | 'inline' | 'mark'): {
|
|
17
|
-
type: string;
|
|
18
18
|
attrs: {
|
|
19
19
|
originalValue: ADFEntity;
|
|
20
20
|
};
|
|
21
|
+
type: string;
|
|
21
22
|
};
|
|
@@ -4,3 +4,4 @@ export declare const getParentOfTypeCount: (nodeType: NodeType) => ($pos: Resolv
|
|
|
4
4
|
export declare const getPositionAfterTopParentNodeOfType: (nodeType: NodeType) => ($pos: ResolvedPos) => number | undefined;
|
|
5
5
|
export declare const isSelectionTableNestedInTable: (state: EditorState) => boolean;
|
|
6
6
|
export declare const isNestedTablesSupported: (schema: Schema) => boolean;
|
|
7
|
+
export declare const isPanelNestingTableSupported: (schema: Schema) => boolean;
|
|
@@ -5,17 +5,18 @@ export declare const UNSUPPORTED_NODE_ATTRIBUTE = "unsupportedNodeAttribute";
|
|
|
5
5
|
import type { UnsupportedContentPayload } from './unsupportedContent/types';
|
|
6
6
|
export type DispatchAnalyticsEvent = (event: UnsupportedContentPayload) => void;
|
|
7
7
|
export declare const validationErrorHandler: (entity: ADFEntity, error: ValidationError, options: ErrorCallbackOptions, marks: string[], validate: Validate, dispatchAnalyticsEvent?: DispatchAnalyticsEvent) => ADFEntity | {
|
|
8
|
-
type: string;
|
|
9
8
|
attrs: {
|
|
10
9
|
originalValue: ADFEntity;
|
|
11
10
|
};
|
|
11
|
+
type: string;
|
|
12
12
|
} | undefined;
|
|
13
13
|
export declare const validateADFEntity: (schema: Schema, node: ADFEntity, dispatchAnalyticsEvent?: DispatchAnalyticsEvent, validationOverrides?: {
|
|
14
14
|
allowNestedTables?: boolean;
|
|
15
|
+
allowTableInPanel?: boolean;
|
|
15
16
|
}) => ADFEntity;
|
|
16
17
|
export declare function wrapWithUnsupported(originalValue: ADFEntity, type?: 'block' | 'inline' | 'mark'): {
|
|
17
|
-
type: string;
|
|
18
18
|
attrs: {
|
|
19
19
|
originalValue: ADFEntity;
|
|
20
20
|
};
|
|
21
|
+
type: string;
|
|
21
22
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "114.
|
|
3
|
+
"version": "114.36.1",
|
|
4
4
|
"description": "A package that contains common classes and components for editor and renderer",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -37,30 +37,30 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@atlaskit/activity-provider": "^2.6.0",
|
|
40
|
-
"@atlaskit/adf-schema": "^52.
|
|
41
|
-
"@atlaskit/adf-utils": "^19.
|
|
40
|
+
"@atlaskit/adf-schema": "^52.12.0",
|
|
41
|
+
"@atlaskit/adf-utils": "^19.30.0",
|
|
42
42
|
"@atlaskit/afm-i18n-platform-editor-editor-common": "2.18.0",
|
|
43
43
|
"@atlaskit/analytics-listeners": "^10.1.0",
|
|
44
44
|
"@atlaskit/analytics-namespaced-context": "^7.3.0",
|
|
45
45
|
"@atlaskit/analytics-next": "^11.2.0",
|
|
46
46
|
"@atlaskit/atlassian-context": "^0.9.0",
|
|
47
|
-
"@atlaskit/browser-apis": "^0.0.
|
|
47
|
+
"@atlaskit/browser-apis": "^0.0.2",
|
|
48
48
|
"@atlaskit/button": "^23.11.0",
|
|
49
49
|
"@atlaskit/codemod-utils": "^4.2.0",
|
|
50
50
|
"@atlaskit/css": "^0.19.0",
|
|
51
51
|
"@atlaskit/custom-steps": "^0.17.0",
|
|
52
|
-
"@atlaskit/dropdown-menu": "^16.
|
|
52
|
+
"@atlaskit/dropdown-menu": "^16.9.0",
|
|
53
53
|
"@atlaskit/editor-json-transformer": "^8.32.0",
|
|
54
54
|
"@atlaskit/editor-palette": "^2.2.0",
|
|
55
55
|
"@atlaskit/editor-prosemirror": "^7.3.0",
|
|
56
56
|
"@atlaskit/editor-shared-styles": "^3.11.0",
|
|
57
57
|
"@atlaskit/editor-tables": "^2.10.0",
|
|
58
|
-
"@atlaskit/editor-toolbar": "^1.
|
|
58
|
+
"@atlaskit/editor-toolbar": "^1.6.0",
|
|
59
59
|
"@atlaskit/editor-toolbar-model": "^0.5.0",
|
|
60
60
|
"@atlaskit/emoji": "^70.9.0",
|
|
61
61
|
"@atlaskit/icon": "^35.0.0",
|
|
62
62
|
"@atlaskit/link": "^3.4.0",
|
|
63
|
-
"@atlaskit/link-datasource": "^5.
|
|
63
|
+
"@atlaskit/link-datasource": "^5.3.0",
|
|
64
64
|
"@atlaskit/link-picker": "^5.1.0",
|
|
65
65
|
"@atlaskit/media-card": "^80.5.0",
|
|
66
66
|
"@atlaskit/media-client": "^36.3.0",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"@atlaskit/task-decision": "^20.1.0",
|
|
88
88
|
"@atlaskit/teams-app-config": "^1.12.0",
|
|
89
89
|
"@atlaskit/textfield": "^8.3.0",
|
|
90
|
-
"@atlaskit/tmp-editor-statsig": "^81.
|
|
90
|
+
"@atlaskit/tmp-editor-statsig": "^81.3.0",
|
|
91
91
|
"@atlaskit/tokens": "^13.0.0",
|
|
92
92
|
"@atlaskit/tooltip": "^22.2.0",
|
|
93
93
|
"@atlaskit/width-detector": "^5.1.0",
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"fuse.js": "^6.6.2",
|
|
108
108
|
"linkify-it": "^3.0.3",
|
|
109
109
|
"lodash": "^4.17.21",
|
|
110
|
-
"markdown-it": "^
|
|
110
|
+
"markdown-it": "^13.0.2",
|
|
111
111
|
"memoize-one": "^6.0.0",
|
|
112
112
|
"popper.js": "^1.14.1",
|
|
113
113
|
"prop-types": "^15.5.10",
|
|
@@ -271,6 +271,9 @@
|
|
|
271
271
|
},
|
|
272
272
|
"people-teams_migrate-user-profile-card": {
|
|
273
273
|
"type": "boolean"
|
|
274
|
+
},
|
|
275
|
+
"platform_editor_ai_selection_local_ids": {
|
|
276
|
+
"type": "boolean"
|
|
274
277
|
}
|
|
275
278
|
}
|
|
276
279
|
}
|