@atlaskit/editor-common 105.2.3 → 105.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 105.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#155142](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/155142)
8
+ [`50eb20003ad27`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/50eb20003ad27) -
9
+ Replace platform_editor_table_row_span_fix with platform_editor_table_row_span_fix_confluence
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
15
+ ## 105.2.4
16
+
17
+ ### Patch Changes
18
+
19
+ - [#154988](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/154988)
20
+ [`76019734ff982`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/76019734ff982) -
21
+ [ED-27560] Adds `isInitialised` state variable to text-formatting plugin and migrates it to
22
+ useSharedPluginStateSelector
23
+ - Updated dependencies
24
+
3
25
  ## 105.2.3
4
26
 
5
27
  ### Patch Changes
@@ -17,7 +17,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
17
17
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
18
18
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
19
19
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
20
- var packageVersion = "105.2.3";
20
+ var packageVersion = "105.3.0";
21
21
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
22
22
  // Remove URL as it has UGC
23
23
  // Ignored via go/ees007
@@ -23,7 +23,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
23
23
  * @jsx jsx
24
24
  */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
25
25
  var packageName = "@atlaskit/editor-common";
26
- var packageVersion = "105.2.3";
26
+ var packageVersion = "105.3.0";
27
27
  var halfFocusRing = 1;
28
28
  var dropOffset = '0, 8';
29
29
  // Ignored via go/ees005
@@ -12,10 +12,17 @@ exports.isPositionNearTableRow = isPositionNearTableRow;
12
12
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
13
13
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
14
14
  /**
15
- * Looks at every table row to find the correct number of columns for table, which
16
- * accounts for tables with uneven rows.
15
+ * Returns an array of column widths (0 if column width is undefined) of a given table node by scanning the **entire table**.
17
16
  *
18
- * Returns an array of column widths if defined otherwise 0, positions respect table order.
17
+ * Warning: the entire table is scanned and should only be used if where the table can be in a broken state such that rows have different number of cells (e.g. in **renderer**).
18
+ * @param node - Table node
19
+ * @example
20
+ * ```ts
21
+ * const columnWidths = getColumnWidths(tableNode);
22
+ * console.log(columnWidths);
23
+ * // Output: [100, 200, 300]
24
+ * ```
25
+ * @returns Array<number>
19
26
  */
20
27
  function getColumnWidths(node) {
21
28
  var tableColumnWidths = [];
@@ -42,11 +49,25 @@ function getColumnWidths(node) {
42
49
  });
43
50
  return tableColumnWidths;
44
51
  }
52
+
53
+ /**
54
+ * Returns an array of column widths (0 if column width is undefined) of a given table node by scanning the **first row**.
55
+ *
56
+ * Warning: is preferred and should be used if the table is not in a broken state (e.g. in **editor**).
57
+ * @param node - Table node
58
+ * @example
59
+ * ```ts
60
+ * const columnWidths = calcTableColumnWidths(tableNode);
61
+ * console.log(columnWidths);
62
+ * // Output: [100, 200, 300]
63
+ * ```
64
+ * @returns Array<number>
65
+ */
45
66
  function calcTableColumnWidths(node) {
46
67
  // Ignored via go/ees007
47
68
  // eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
48
69
  // TODO: replaced with getColumnWidths, which correctly scans entire table for column widths
49
- if ((0, _platformFeatureFlags.fg)('platform_editor_table_row_span_fix')) {
70
+ if ((0, _platformFeatureFlags.fg)('platform_editor_table_row_span_fix') || (0, _platformFeatureFlags.fg)('platform_editor_table_row_span_fix_all')) {
50
71
  var _firstRow = node.firstChild;
51
72
  var _tableColumnWidths = [];
52
73
  if (_firstRow) {
@@ -84,6 +105,12 @@ function calcTableColumnWidths(node) {
84
105
  }
85
106
  return tableColumnWidths;
86
107
  }
108
+
109
+ /**
110
+ *
111
+ * @param tableNode
112
+ * @example
113
+ */
87
114
  function hasMergedCell(tableNode) {
88
115
  var hasSpan = false;
89
116
  tableNode.descendants(function (node) {
@@ -100,6 +127,12 @@ function hasMergedCell(tableNode) {
100
127
  });
101
128
  return hasSpan;
102
129
  }
130
+
131
+ /**
132
+ *
133
+ * @param tableNode
134
+ * @example
135
+ */
103
136
  function convertProsemirrorTableNodeToArrayOfRows(tableNode) {
104
137
  var result = [];
105
138
  tableNode.forEach(function (rowNode) {
@@ -119,6 +152,13 @@ function convertProsemirrorTableNodeToArrayOfRows(tableNode) {
119
152
  Returns true when a sibling node, or any of the parent's sibling
120
153
  nodes are a tableRow
121
154
  */
155
+ /**
156
+ *
157
+ * @param pos
158
+ * @param schema
159
+ * @param direction
160
+ * @example
161
+ */
122
162
  function isPositionNearTableRow(pos, schema, direction) {
123
163
  if (!schema.nodes.tableRow) {
124
164
  return false;
@@ -1,7 +1,7 @@
1
1
  import { isFedRamp } from './environment';
2
2
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
3
3
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
4
- const packageVersion = "105.2.3";
4
+ const packageVersion = "105.3.0";
5
5
  const sanitiseSentryEvents = (data, _hint) => {
6
6
  // Remove URL as it has UGC
7
7
  // Ignored via go/ees007
@@ -13,7 +13,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
13
13
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
14
14
  import Layer from '../Layer';
15
15
  const packageName = "@atlaskit/editor-common";
16
- const packageVersion = "105.2.3";
16
+ const packageVersion = "105.3.0";
17
17
  const halfFocusRing = 1;
18
18
  const dropOffset = '0, 8';
19
19
  // Ignored via go/ees005
@@ -1,10 +1,17 @@
1
1
  import { fg } from '@atlaskit/platform-feature-flags';
2
2
 
3
3
  /**
4
- * Looks at every table row to find the correct number of columns for table, which
5
- * accounts for tables with uneven rows.
4
+ * Returns an array of column widths (0 if column width is undefined) of a given table node by scanning the **entire table**.
6
5
  *
7
- * Returns an array of column widths if defined otherwise 0, positions respect table order.
6
+ * Warning: the entire table is scanned and should only be used if where the table can be in a broken state such that rows have different number of cells (e.g. in **renderer**).
7
+ * @param node - Table node
8
+ * @example
9
+ * ```ts
10
+ * const columnWidths = getColumnWidths(tableNode);
11
+ * console.log(columnWidths);
12
+ * // Output: [100, 200, 300]
13
+ * ```
14
+ * @returns Array<number>
8
15
  */
9
16
  export function getColumnWidths(node) {
10
17
  let tableColumnWidths = [];
@@ -32,11 +39,25 @@ export function getColumnWidths(node) {
32
39
  });
33
40
  return tableColumnWidths;
34
41
  }
42
+
43
+ /**
44
+ * Returns an array of column widths (0 if column width is undefined) of a given table node by scanning the **first row**.
45
+ *
46
+ * Warning: is preferred and should be used if the table is not in a broken state (e.g. in **editor**).
47
+ * @param node - Table node
48
+ * @example
49
+ * ```ts
50
+ * const columnWidths = calcTableColumnWidths(tableNode);
51
+ * console.log(columnWidths);
52
+ * // Output: [100, 200, 300]
53
+ * ```
54
+ * @returns Array<number>
55
+ */
35
56
  export function calcTableColumnWidths(node) {
36
57
  // Ignored via go/ees007
37
58
  // eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
38
59
  // TODO: replaced with getColumnWidths, which correctly scans entire table for column widths
39
- if (fg('platform_editor_table_row_span_fix')) {
60
+ if (fg('platform_editor_table_row_span_fix') || fg('platform_editor_table_row_span_fix_all')) {
40
61
  const firstRow = node.firstChild;
41
62
  const tableColumnWidths = [];
42
63
  if (firstRow) {
@@ -75,6 +96,12 @@ export function calcTableColumnWidths(node) {
75
96
  }
76
97
  return tableColumnWidths;
77
98
  }
99
+
100
+ /**
101
+ *
102
+ * @param tableNode
103
+ * @example
104
+ */
78
105
  export function hasMergedCell(tableNode) {
79
106
  let hasSpan = false;
80
107
  tableNode.descendants(node => {
@@ -92,6 +119,12 @@ export function hasMergedCell(tableNode) {
92
119
  });
93
120
  return hasSpan;
94
121
  }
122
+
123
+ /**
124
+ *
125
+ * @param tableNode
126
+ * @example
127
+ */
95
128
  export function convertProsemirrorTableNodeToArrayOfRows(tableNode) {
96
129
  const result = [];
97
130
  tableNode.forEach(rowNode => {
@@ -109,6 +142,13 @@ export function convertProsemirrorTableNodeToArrayOfRows(tableNode) {
109
142
  Returns true when a sibling node, or any of the parent's sibling
110
143
  nodes are a tableRow
111
144
  */
145
+ /**
146
+ *
147
+ * @param pos
148
+ * @param schema
149
+ * @param direction
150
+ * @example
151
+ */
112
152
  export function isPositionNearTableRow(pos, schema, direction) {
113
153
  if (!schema.nodes.tableRow) {
114
154
  return false;
@@ -7,7 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
7
7
  import { isFedRamp } from './environment';
8
8
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
9
9
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
10
- var packageVersion = "105.2.3";
10
+ var packageVersion = "105.3.0";
11
11
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
12
12
  // Remove URL as it has UGC
13
13
  // Ignored via go/ees007
@@ -20,7 +20,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
20
20
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
21
21
  import Layer from '../Layer';
22
22
  var packageName = "@atlaskit/editor-common";
23
- var packageVersion = "105.2.3";
23
+ var packageVersion = "105.3.0";
24
24
  var halfFocusRing = 1;
25
25
  var dropOffset = '0, 8';
26
26
  // Ignored via go/ees005
@@ -2,10 +2,17 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  import { fg } from '@atlaskit/platform-feature-flags';
3
3
 
4
4
  /**
5
- * Looks at every table row to find the correct number of columns for table, which
6
- * accounts for tables with uneven rows.
5
+ * Returns an array of column widths (0 if column width is undefined) of a given table node by scanning the **entire table**.
7
6
  *
8
- * Returns an array of column widths if defined otherwise 0, positions respect table order.
7
+ * Warning: the entire table is scanned and should only be used if where the table can be in a broken state such that rows have different number of cells (e.g. in **renderer**).
8
+ * @param node - Table node
9
+ * @example
10
+ * ```ts
11
+ * const columnWidths = getColumnWidths(tableNode);
12
+ * console.log(columnWidths);
13
+ * // Output: [100, 200, 300]
14
+ * ```
15
+ * @returns Array<number>
9
16
  */
10
17
  export function getColumnWidths(node) {
11
18
  var tableColumnWidths = [];
@@ -32,11 +39,25 @@ export function getColumnWidths(node) {
32
39
  });
33
40
  return tableColumnWidths;
34
41
  }
42
+
43
+ /**
44
+ * Returns an array of column widths (0 if column width is undefined) of a given table node by scanning the **first row**.
45
+ *
46
+ * Warning: is preferred and should be used if the table is not in a broken state (e.g. in **editor**).
47
+ * @param node - Table node
48
+ * @example
49
+ * ```ts
50
+ * const columnWidths = calcTableColumnWidths(tableNode);
51
+ * console.log(columnWidths);
52
+ * // Output: [100, 200, 300]
53
+ * ```
54
+ * @returns Array<number>
55
+ */
35
56
  export function calcTableColumnWidths(node) {
36
57
  // Ignored via go/ees007
37
58
  // eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
38
59
  // TODO: replaced with getColumnWidths, which correctly scans entire table for column widths
39
- if (fg('platform_editor_table_row_span_fix')) {
60
+ if (fg('platform_editor_table_row_span_fix') || fg('platform_editor_table_row_span_fix_all')) {
40
61
  var _firstRow = node.firstChild;
41
62
  var _tableColumnWidths = [];
42
63
  if (_firstRow) {
@@ -74,6 +95,12 @@ export function calcTableColumnWidths(node) {
74
95
  }
75
96
  return tableColumnWidths;
76
97
  }
98
+
99
+ /**
100
+ *
101
+ * @param tableNode
102
+ * @example
103
+ */
77
104
  export function hasMergedCell(tableNode) {
78
105
  var hasSpan = false;
79
106
  tableNode.descendants(function (node) {
@@ -90,6 +117,12 @@ export function hasMergedCell(tableNode) {
90
117
  });
91
118
  return hasSpan;
92
119
  }
120
+
121
+ /**
122
+ *
123
+ * @param tableNode
124
+ * @example
125
+ */
93
126
  export function convertProsemirrorTableNodeToArrayOfRows(tableNode) {
94
127
  var result = [];
95
128
  tableNode.forEach(function (rowNode) {
@@ -109,6 +142,13 @@ export function convertProsemirrorTableNodeToArrayOfRows(tableNode) {
109
142
  Returns true when a sibling node, or any of the parent's sibling
110
143
  nodes are a tableRow
111
144
  */
145
+ /**
146
+ *
147
+ * @param pos
148
+ * @param schema
149
+ * @param direction
150
+ * @example
151
+ */
112
152
  export function isPositionNearTableRow(pos, schema, direction) {
113
153
  if (!schema.nodes.tableRow) {
114
154
  return false;
@@ -15,6 +15,7 @@ export interface TextFormattingOptions {
15
15
  responsiveToolbarMenu?: boolean;
16
16
  }
17
17
  export interface TextFormattingState {
18
+ isInitialised: boolean;
18
19
  emActive?: boolean;
19
20
  emDisabled?: boolean;
20
21
  emHidden?: boolean;
@@ -1,12 +1,49 @@
1
1
  import type { Node as PmNode, ResolvedPos, Schema } from '@atlaskit/editor-prosemirror/model';
2
2
  /**
3
- * Looks at every table row to find the correct number of columns for table, which
4
- * accounts for tables with uneven rows.
3
+ * Returns an array of column widths (0 if column width is undefined) of a given table node by scanning the **entire table**.
5
4
  *
6
- * Returns an array of column widths if defined otherwise 0, positions respect table order.
5
+ * Warning: the entire table is scanned and should only be used if where the table can be in a broken state such that rows have different number of cells (e.g. in **renderer**).
6
+ * @param node - Table node
7
+ * @example
8
+ * ```ts
9
+ * const columnWidths = getColumnWidths(tableNode);
10
+ * console.log(columnWidths);
11
+ * // Output: [100, 200, 300]
12
+ * ```
13
+ * @returns Array<number>
7
14
  */
8
15
  export declare function getColumnWidths(node: PmNode): number[];
16
+ /**
17
+ * Returns an array of column widths (0 if column width is undefined) of a given table node by scanning the **first row**.
18
+ *
19
+ * Warning: is preferred and should be used if the table is not in a broken state (e.g. in **editor**).
20
+ * @param node - Table node
21
+ * @example
22
+ * ```ts
23
+ * const columnWidths = calcTableColumnWidths(tableNode);
24
+ * console.log(columnWidths);
25
+ * // Output: [100, 200, 300]
26
+ * ```
27
+ * @returns Array<number>
28
+ */
9
29
  export declare function calcTableColumnWidths(node: PmNode): number[];
30
+ /**
31
+ *
32
+ * @param tableNode
33
+ * @example
34
+ */
10
35
  export declare function hasMergedCell(tableNode: PmNode): boolean;
36
+ /**
37
+ *
38
+ * @param tableNode
39
+ * @example
40
+ */
11
41
  export declare function convertProsemirrorTableNodeToArrayOfRows(tableNode: PmNode): Array<Array<PmNode | null>>;
42
+ /**
43
+ *
44
+ * @param pos
45
+ * @param schema
46
+ * @param direction
47
+ * @example
48
+ */
12
49
  export declare function isPositionNearTableRow(pos: ResolvedPos, schema: Schema, direction: 'before' | 'after'): boolean;
@@ -15,6 +15,7 @@ export interface TextFormattingOptions {
15
15
  responsiveToolbarMenu?: boolean;
16
16
  }
17
17
  export interface TextFormattingState {
18
+ isInitialised: boolean;
18
19
  emActive?: boolean;
19
20
  emDisabled?: boolean;
20
21
  emHidden?: boolean;
@@ -1,12 +1,49 @@
1
1
  import type { Node as PmNode, ResolvedPos, Schema } from '@atlaskit/editor-prosemirror/model';
2
2
  /**
3
- * Looks at every table row to find the correct number of columns for table, which
4
- * accounts for tables with uneven rows.
3
+ * Returns an array of column widths (0 if column width is undefined) of a given table node by scanning the **entire table**.
5
4
  *
6
- * Returns an array of column widths if defined otherwise 0, positions respect table order.
5
+ * Warning: the entire table is scanned and should only be used if where the table can be in a broken state such that rows have different number of cells (e.g. in **renderer**).
6
+ * @param node - Table node
7
+ * @example
8
+ * ```ts
9
+ * const columnWidths = getColumnWidths(tableNode);
10
+ * console.log(columnWidths);
11
+ * // Output: [100, 200, 300]
12
+ * ```
13
+ * @returns Array<number>
7
14
  */
8
15
  export declare function getColumnWidths(node: PmNode): number[];
16
+ /**
17
+ * Returns an array of column widths (0 if column width is undefined) of a given table node by scanning the **first row**.
18
+ *
19
+ * Warning: is preferred and should be used if the table is not in a broken state (e.g. in **editor**).
20
+ * @param node - Table node
21
+ * @example
22
+ * ```ts
23
+ * const columnWidths = calcTableColumnWidths(tableNode);
24
+ * console.log(columnWidths);
25
+ * // Output: [100, 200, 300]
26
+ * ```
27
+ * @returns Array<number>
28
+ */
9
29
  export declare function calcTableColumnWidths(node: PmNode): number[];
30
+ /**
31
+ *
32
+ * @param tableNode
33
+ * @example
34
+ */
10
35
  export declare function hasMergedCell(tableNode: PmNode): boolean;
36
+ /**
37
+ *
38
+ * @param tableNode
39
+ * @example
40
+ */
11
41
  export declare function convertProsemirrorTableNodeToArrayOfRows(tableNode: PmNode): Array<Array<PmNode | null>>;
42
+ /**
43
+ *
44
+ * @param pos
45
+ * @param schema
46
+ * @param direction
47
+ * @example
48
+ */
12
49
  export declare function isPositionNearTableRow(pos: ResolvedPos, schema: Schema, direction: 'before' | 'after'): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "105.2.3",
3
+ "version": "105.3.0",
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/"
@@ -144,7 +144,7 @@
144
144
  "@atlaskit/link-datasource": "^4.10.0",
145
145
  "@atlaskit/link-picker": "^3.2.0",
146
146
  "@atlaskit/media-card": "^79.2.0",
147
- "@atlaskit/media-client": "^33.1.0",
147
+ "@atlaskit/media-client": "^33.2.0",
148
148
  "@atlaskit/media-client-react": "^4.0.0",
149
149
  "@atlaskit/media-common": "^12.0.0",
150
150
  "@atlaskit/media-file-preview": "^0.11.0",
@@ -158,16 +158,16 @@
158
158
  "@atlaskit/platform-feature-flags-react": "^0.2.0",
159
159
  "@atlaskit/popper": "^7.0.0",
160
160
  "@atlaskit/primitives": "^14.7.0",
161
- "@atlaskit/profilecard": "^23.12.0",
162
- "@atlaskit/react-ufo": "^3.11.0",
161
+ "@atlaskit/profilecard": "^23.14.0",
162
+ "@atlaskit/react-ufo": "^3.12.0",
163
163
  "@atlaskit/section-message": "^8.2.0",
164
- "@atlaskit/smart-card": "^38.0.0",
164
+ "@atlaskit/smart-card": "^38.1.0",
165
165
  "@atlaskit/smart-user-picker": "^8.0.0",
166
166
  "@atlaskit/spinner": "^18.0.0",
167
167
  "@atlaskit/task-decision": "^19.2.0",
168
168
  "@atlaskit/textfield": "^8.0.0",
169
169
  "@atlaskit/theme": "^18.0.0",
170
- "@atlaskit/tmp-editor-statsig": "^4.21.0",
170
+ "@atlaskit/tmp-editor-statsig": "^4.22.0",
171
171
  "@atlaskit/tokens": "^4.8.0",
172
172
  "@atlaskit/tooltip": "^20.0.0",
173
173
  "@atlaskit/width-detector": "^5.0.0",
@@ -290,6 +290,9 @@
290
290
  "platform_editor_table_row_span_fix": {
291
291
  "type": "boolean"
292
292
  },
293
+ "platform_editor_table_row_span_fix_all": {
294
+ "type": "boolean"
295
+ },
293
296
  "platform-component-visual-refresh": {
294
297
  "type": "boolean"
295
298
  },