@atlaskit/editor-plugin-table 28.0.5 → 28.0.7

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 CHANGED
@@ -1,5 +1,20 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 28.0.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [`f34bb99565856`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f34bb99565856) -
8
+ Remove the `platform_editor_table_q4_patch_3` experiment and permanently retain interaction-aware
9
+ table cell highlighting.
10
+ - Updated dependencies
11
+
12
+ ## 28.0.6
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies
17
+
3
18
  ## 28.0.5
4
19
 
5
20
  ### Patch Changes
@@ -119,7 +119,7 @@ var TableCell = exports.default = /*#__PURE__*/function (_TableNodeView) {
119
119
  // `data-reaches-*` are presentation-only attrs written imperatively for the rounded-corner
120
120
  // masks. Ignore them so ProseMirror doesn't rebuild the table (and drop the header row's
121
121
  // sticky class) on every column insert.
122
- if (mutation.type === 'attributes' && (_mutation$attributeNa = mutation.attributeName) !== null && _mutation$attributeNa !== void 0 && _mutation$attributeNa.startsWith('data-reaches-') && (0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true) && (0, _expValEquals.expValEquals)('platform_editor_table_q4_patch_3', 'isEnabled', true)) {
122
+ if (mutation.type === 'attributes' && (_mutation$attributeNa = mutation.attributeName) !== null && _mutation$attributeNa !== void 0 && _mutation$attributeNa.startsWith('data-reaches-') && (0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true)) {
123
123
  return true;
124
124
  }
125
125
  return false;
@@ -11,7 +11,6 @@ var _state = require("@atlaskit/editor-prosemirror/state");
11
11
  var _view = require("@atlaskit/editor-prosemirror/view");
12
12
  var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
13
13
  var _utils = require("@atlaskit/editor-tables/utils");
14
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
15
14
  var _types = require("../../types");
16
15
  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; }
17
16
  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; }
@@ -67,32 +66,9 @@ var hasHadInteraction = function hasHadInteraction(api) {
67
66
  }
68
67
  return ((_api$interaction$shar = api.interaction.sharedState.currentState()) === null || _api$interaction$shar === void 0 ? void 0 : _api$interaction$shar.interactionState) !== 'hasNotHadInteraction';
69
68
  };
70
- var createLegacyStateField = function createLegacyStateField() {
71
- return {
72
- init: function init(_config, state) {
73
- return buildState(getActiveCellPos(state), state);
74
- },
75
- apply: function apply(tr, prev, _oldState, newState) {
76
- if (tr.docChanged) {
77
- // Doc changed — always rebuild since positions may have shifted.
78
- return buildState(getActiveCellPos(newState), newState);
79
- }
80
- if (!tr.selectionSet) {
81
- // Neither doc nor selection changed — nothing to do.
82
- return prev;
83
- }
84
69
 
85
- // Selection changed only rebuild if the cursor moved to a different cell.
86
- var nextCellPos = getActiveCellPos(newState);
87
- return nextCellPos === prev.cellPos ? prev : buildState(nextCellPos, newState);
88
- }
89
- };
90
- };
91
-
92
- /**
93
- * Stays hidden until the first interaction
94
- */
95
- var createGatedStateField = function createGatedStateField(api) {
70
+ /** Stays hidden until the first interaction. */
71
+ var createStateField = function createStateField(api) {
96
72
  return {
97
73
  init: function init(_config, state) {
98
74
  var interacted = hasHadInteraction(api);
@@ -128,7 +104,7 @@ var createGatedStateField = function createGatedStateField(api) {
128
104
  var createPlugin = exports.createPlugin = function createPlugin(api) {
129
105
  return new _safePlugin.SafePlugin({
130
106
  key: activeCellHighlightPluginKey,
131
- state: (0, _expValEquals.expValEquals)('platform_editor_table_q4_patch_3', 'isEnabled', true) ? createGatedStateField(api) : createLegacyStateField(),
107
+ state: createStateField(api),
132
108
  props: {
133
109
  decorations: function decorations(state) {
134
110
  var _activeCellHighlightP, _activeCellHighlightP2;
@@ -92,7 +92,7 @@ export default class TableCell extends TableNodeView {
92
92
  // `data-reaches-*` are presentation-only attrs written imperatively for the rounded-corner
93
93
  // masks. Ignore them so ProseMirror doesn't rebuild the table (and drop the header row's
94
94
  // sticky class) on every column insert.
95
- if (mutation.type === 'attributes' && (_mutation$attributeNa = mutation.attributeName) !== null && _mutation$attributeNa !== void 0 && _mutation$attributeNa.startsWith('data-reaches-') && expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) && expValEquals('platform_editor_table_q4_patch_3', 'isEnabled', true)) {
95
+ if (mutation.type === 'attributes' && (_mutation$attributeNa = mutation.attributeName) !== null && _mutation$attributeNa !== void 0 && _mutation$attributeNa.startsWith('data-reaches-') && expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true)) {
96
96
  return true;
97
97
  }
98
98
  return false;
@@ -3,7 +3,6 @@ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
3
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
4
4
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
5
5
  import { findCellClosestToPos } from '@atlaskit/editor-tables/utils';
6
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
7
6
  import { TableCssClassName as ClassName } from '../../types';
8
7
  const EMPTY_STATE = {
9
8
  cellPos: -1,
@@ -57,28 +56,9 @@ const hasHadInteraction = api => {
57
56
  }
58
57
  return ((_api$interaction$shar = api.interaction.sharedState.currentState()) === null || _api$interaction$shar === void 0 ? void 0 : _api$interaction$shar.interactionState) !== 'hasNotHadInteraction';
59
58
  };
60
- const createLegacyStateField = () => ({
61
- init: (_config, state) => buildState(getActiveCellPos(state), state),
62
- apply: (tr, prev, _oldState, newState) => {
63
- if (tr.docChanged) {
64
- // Doc changed — always rebuild since positions may have shifted.
65
- return buildState(getActiveCellPos(newState), newState);
66
- }
67
- if (!tr.selectionSet) {
68
- // Neither doc nor selection changed — nothing to do.
69
- return prev;
70
- }
71
-
72
- // Selection changed — only rebuild if the cursor moved to a different cell.
73
- const nextCellPos = getActiveCellPos(newState);
74
- return nextCellPos === prev.cellPos ? prev : buildState(nextCellPos, newState);
75
- }
76
- });
77
59
 
78
- /**
79
- * Stays hidden until the first interaction
80
- */
81
- const createGatedStateField = api => ({
60
+ /** Stays hidden until the first interaction. */
61
+ const createStateField = api => ({
82
62
  init: (_config, state) => {
83
63
  const interacted = hasHadInteraction(api);
84
64
  return {
@@ -114,7 +94,7 @@ const createGatedStateField = api => ({
114
94
  export const createPlugin = api => {
115
95
  return new SafePlugin({
116
96
  key: activeCellHighlightPluginKey,
117
- state: expValEquals('platform_editor_table_q4_patch_3', 'isEnabled', true) ? createGatedStateField(api) : createLegacyStateField(),
97
+ state: createStateField(api),
118
98
  props: {
119
99
  decorations: state => {
120
100
  var _activeCellHighlightP, _activeCellHighlightP2;
@@ -112,7 +112,7 @@ var TableCell = /*#__PURE__*/function (_TableNodeView) {
112
112
  // `data-reaches-*` are presentation-only attrs written imperatively for the rounded-corner
113
113
  // masks. Ignore them so ProseMirror doesn't rebuild the table (and drop the header row's
114
114
  // sticky class) on every column insert.
115
- if (mutation.type === 'attributes' && (_mutation$attributeNa = mutation.attributeName) !== null && _mutation$attributeNa !== void 0 && _mutation$attributeNa.startsWith('data-reaches-') && expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) && expValEquals('platform_editor_table_q4_patch_3', 'isEnabled', true)) {
115
+ if (mutation.type === 'attributes' && (_mutation$attributeNa = mutation.attributeName) !== null && _mutation$attributeNa !== void 0 && _mutation$attributeNa.startsWith('data-reaches-') && expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true)) {
116
116
  return true;
117
117
  }
118
118
  return false;
@@ -6,7 +6,6 @@ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
6
6
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
7
7
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
8
8
  import { findCellClosestToPos } from '@atlaskit/editor-tables/utils';
9
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
10
9
  import { TableCssClassName as ClassName } from '../../types';
11
10
  var EMPTY_STATE = {
12
11
  cellPos: -1,
@@ -60,32 +59,9 @@ var hasHadInteraction = function hasHadInteraction(api) {
60
59
  }
61
60
  return ((_api$interaction$shar = api.interaction.sharedState.currentState()) === null || _api$interaction$shar === void 0 ? void 0 : _api$interaction$shar.interactionState) !== 'hasNotHadInteraction';
62
61
  };
63
- var createLegacyStateField = function createLegacyStateField() {
64
- return {
65
- init: function init(_config, state) {
66
- return buildState(getActiveCellPos(state), state);
67
- },
68
- apply: function apply(tr, prev, _oldState, newState) {
69
- if (tr.docChanged) {
70
- // Doc changed — always rebuild since positions may have shifted.
71
- return buildState(getActiveCellPos(newState), newState);
72
- }
73
- if (!tr.selectionSet) {
74
- // Neither doc nor selection changed — nothing to do.
75
- return prev;
76
- }
77
62
 
78
- // Selection changed only rebuild if the cursor moved to a different cell.
79
- var nextCellPos = getActiveCellPos(newState);
80
- return nextCellPos === prev.cellPos ? prev : buildState(nextCellPos, newState);
81
- }
82
- };
83
- };
84
-
85
- /**
86
- * Stays hidden until the first interaction
87
- */
88
- var createGatedStateField = function createGatedStateField(api) {
63
+ /** Stays hidden until the first interaction. */
64
+ var createStateField = function createStateField(api) {
89
65
  return {
90
66
  init: function init(_config, state) {
91
67
  var interacted = hasHadInteraction(api);
@@ -121,7 +97,7 @@ var createGatedStateField = function createGatedStateField(api) {
121
97
  export var createPlugin = function createPlugin(api) {
122
98
  return new SafePlugin({
123
99
  key: activeCellHighlightPluginKey,
124
- state: expValEquals('platform_editor_table_q4_patch_3', 'isEnabled', true) ? createGatedStateField(api) : createLegacyStateField(),
100
+ state: createStateField(api),
125
101
  props: {
126
102
  decorations: function decorations(state) {
127
103
  var _activeCellHighlightP, _activeCellHighlightP2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "28.0.5",
3
+ "version": "28.0.7",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -29,7 +29,7 @@
29
29
  "@atlaskit/editor-plugin-batch-attribute-updates": "^16.0.0",
30
30
  "@atlaskit/editor-plugin-content-insertion": "^16.0.0",
31
31
  "@atlaskit/editor-plugin-editor-viewmode": "^18.0.0",
32
- "@atlaskit/editor-plugin-extension": "19.0.3",
32
+ "@atlaskit/editor-plugin-extension": "19.0.5",
33
33
  "@atlaskit/editor-plugin-guideline": "^16.0.0",
34
34
  "@atlaskit/editor-plugin-interaction": "^27.0.0",
35
35
  "@atlaskit/editor-plugin-limited-mode": "^13.0.0",
@@ -42,7 +42,7 @@
42
42
  "@atlaskit/editor-shared-styles": "^4.0.0",
43
43
  "@atlaskit/editor-tables": "^3.0.0",
44
44
  "@atlaskit/editor-toolbar": "^2.6.0",
45
- "@atlaskit/editor-ui-control-model": "^2.8.0",
45
+ "@atlaskit/editor-ui-control-model": "^2.9.0",
46
46
  "@atlaskit/icon": "^37.5.0",
47
47
  "@atlaskit/icon-lab": "^7.7.0",
48
48
  "@atlaskit/insm": "^3.0.0",
@@ -53,7 +53,7 @@
53
53
  "@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^3.1.0",
54
54
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^2.1.0",
55
55
  "@atlaskit/primitives": "^22.4.0",
56
- "@atlaskit/tmp-editor-statsig": "^163.0.0",
56
+ "@atlaskit/tmp-editor-statsig": "^165.0.0",
57
57
  "@atlaskit/toggle": "^17.2.0",
58
58
  "@atlaskit/tokens": "^16.8.0",
59
59
  "@atlaskit/tooltip": "^24.2.0",
@@ -68,7 +68,7 @@
68
68
  "uuid": "^3.1.0"
69
69
  },
70
70
  "peerDependencies": {
71
- "@atlaskit/editor-common": "^120.3.0",
71
+ "@atlaskit/editor-common": "^120.6.0",
72
72
  "react": "^18.2.0 || ^19.2.0",
73
73
  "react-dom": "^18.2.0 || ^19.2.0",
74
74
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"