@atlaskit/editor-common 110.41.1 → 110.41.3

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,21 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 110.41.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`7c295bfea1292`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7c295bfea1292) -
8
+ EDITOR-3380 Use preserved selection when deleting selected range
9
+ - Updated dependencies
10
+
11
+ ## 110.41.2
12
+
13
+ ### Patch Changes
14
+
15
+ - [`4ac3023fb991b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4ac3023fb991b) -
16
+ EDITOR-2478 Clean up experiment `platform_editor_nested_table_detection`
17
+ - Updated dependencies
18
+
3
19
  ## 110.41.1
4
20
 
5
21
  ### Patch Changes
@@ -5,7 +5,8 @@
5
5
  "target": "es5",
6
6
  "outDir": "../../../../../confluence/tsDist/@atlaskit__editor-common",
7
7
  "rootDir": "../",
8
- "composite": true
8
+ "composite": true,
9
+ "noCheck": true
9
10
  },
10
11
  "include": [
11
12
  "../src/**/*.ts",
@@ -5,7 +5,8 @@
5
5
  "target": "es5",
6
6
  "outDir": "../../../../../jira/tsDist/@atlaskit__editor-common/app",
7
7
  "rootDir": "../",
8
- "composite": true
8
+ "composite": true,
9
+ "noCheck": true
9
10
  },
10
11
  "include": [
11
12
  "../src/**/*.ts",
@@ -5,7 +5,8 @@
5
5
  "target": "es5",
6
6
  "outDir": "../../../../../tsDist/@atlaskit__editor-common/app",
7
7
  "rootDir": "../",
8
- "composite": true
8
+ "composite": true,
9
+ "noCheck": true
9
10
  },
10
11
  "include": [
11
12
  "../src/**/*.ts",
@@ -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 = "110.41.0";
22
+ var packageVersion = "0.0.0-development";
23
23
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
24
24
  // Remove URL as it has UGC
25
25
  // Ignored via go/ees007
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.isSelectionTableNestedInTable = 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");
9
8
  /*
10
9
  * Returns the level of nesting of a given `nodeType` in the current position.
11
10
  * eg. table > table is nested 1 level, table > table > table is nested 2 levels.
@@ -76,9 +75,6 @@ var isSelectionTableNestedInTable = exports.isSelectionTableNestedInTable = func
76
75
  */
77
76
  var isNestedTablesSupported = exports.isNestedTablesSupported = function isNestedTablesSupported(schema) {
78
77
  var _tableCell$contentMat, _tableHeader$contentM;
79
- if (!(0, _expValEquals.expValEquals)('platform_editor_nested_table_detection', 'isEnabled', true)) {
80
- return true;
81
- }
82
78
  var _schema$nodes = schema.nodes,
83
79
  table = _schema$nodes.table,
84
80
  tableCell = _schema$nodes.tableCell,
@@ -130,15 +130,19 @@ var expandSelectionBounds = exports.expandSelectionBounds = function expandSelec
130
130
  /**
131
131
  * Delete what is selected in the given transaction.
132
132
  * @param tr the transaction to delete the selection from
133
+ * @param selectionToUse optional selection to delete instead of the transaction's current selection
133
134
  * @returns the updated transaction
134
135
  */
135
- var deleteSelectedRange = exports.deleteSelectedRange = function deleteSelectedRange(tr) {
136
- var selection = tr.selection;
136
+ var deleteSelectedRange = exports.deleteSelectedRange = function deleteSelectedRange(tr, selectionToUse) {
137
+ var selection = selectionToUse || tr.selection;
137
138
  var from = selection.$from.pos;
138
139
  var to = selection.$to.pos;
139
140
  if (selection instanceof _state.TextSelection) {
140
- from = from - 1;
141
- to = to + 1;
141
+ // Expand just the from position to the start of the block
142
+ // This ensures entire paragraphs are deleted instead of just
143
+ // the text content, which avoids leaving an empty line behind
144
+ var expanded = expandToBlockRange(selection.$from, selection.$to);
145
+ from = expanded.$from.pos;
142
146
  } else if ((0, _utils.isTableSelected)(selection)) {
143
147
  var table = (0, _utils.findTable)(selection);
144
148
  if (table) {
@@ -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 = "110.41.0";
27
+ var packageVersion = "0.0.0-development";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var fadeIn = (0, _react2.keyframes)({
@@ -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 = "110.41.0";
7
+ const packageVersion = "0.0.0-development";
8
8
  const sanitiseSentryEvents = (data, _hint) => {
9
9
  // Remove URL as it has UGC
10
10
  // Ignored via go/ees007
@@ -1,5 +1,4 @@
1
1
  import { findTable } from '@atlaskit/editor-tables';
2
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
3
2
 
4
3
  /*
5
4
  * Returns the level of nesting of a given `nodeType` in the current position.
@@ -67,9 +66,6 @@ export const isSelectionTableNestedInTable = state => {
67
66
  */
68
67
  export const isNestedTablesSupported = schema => {
69
68
  var _tableCell$contentMat, _tableHeader$contentM;
70
- if (!expValEquals('platform_editor_nested_table_detection', 'isEnabled', true)) {
71
- return true;
72
- }
73
69
  const {
74
70
  table,
75
71
  tableCell,
@@ -129,15 +129,19 @@ export const expandSelectionBounds = ($anchor, $head) => {
129
129
  /**
130
130
  * Delete what is selected in the given transaction.
131
131
  * @param tr the transaction to delete the selection from
132
+ * @param selectionToUse optional selection to delete instead of the transaction's current selection
132
133
  * @returns the updated transaction
133
134
  */
134
- export const deleteSelectedRange = tr => {
135
- const selection = tr.selection;
135
+ export const deleteSelectedRange = (tr, selectionToUse) => {
136
+ const selection = selectionToUse || tr.selection;
136
137
  let from = selection.$from.pos;
137
138
  let to = selection.$to.pos;
138
139
  if (selection instanceof TextSelection) {
139
- from = from - 1;
140
- to = to + 1;
140
+ // Expand just the from position to the start of the block
141
+ // This ensures entire paragraphs are deleted instead of just
142
+ // the text content, which avoids leaving an empty line behind
143
+ const expanded = expandToBlockRange(selection.$from, selection.$to);
144
+ from = expanded.$from.pos;
141
145
  } else if (isTableSelected(selection)) {
142
146
  const table = findTable(selection);
143
147
  if (table) {
@@ -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 = "110.41.0";
17
+ const packageVersion = "0.0.0-development";
18
18
  const halfFocusRing = 1;
19
19
  const dropOffset = '0, 8';
20
20
  const fadeIn = keyframes({
@@ -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 = "110.41.0";
13
+ var packageVersion = "0.0.0-development";
14
14
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
15
15
  // Remove URL as it has UGC
16
16
  // Ignored via go/ees007
@@ -1,5 +1,4 @@
1
1
  import { findTable } from '@atlaskit/editor-tables';
2
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
3
2
 
4
3
  /*
5
4
  * Returns the level of nesting of a given `nodeType` in the current position.
@@ -71,9 +70,6 @@ export var isSelectionTableNestedInTable = function isSelectionTableNestedInTabl
71
70
  */
72
71
  export var isNestedTablesSupported = function isNestedTablesSupported(schema) {
73
72
  var _tableCell$contentMat, _tableHeader$contentM;
74
- if (!expValEquals('platform_editor_nested_table_detection', 'isEnabled', true)) {
75
- return true;
76
- }
77
73
  var _schema$nodes = schema.nodes,
78
74
  table = _schema$nodes.table,
79
75
  tableCell = _schema$nodes.tableCell,
@@ -117,15 +117,19 @@ export var expandSelectionBounds = function expandSelectionBounds($anchor, $head
117
117
  /**
118
118
  * Delete what is selected in the given transaction.
119
119
  * @param tr the transaction to delete the selection from
120
+ * @param selectionToUse optional selection to delete instead of the transaction's current selection
120
121
  * @returns the updated transaction
121
122
  */
122
- export var deleteSelectedRange = function deleteSelectedRange(tr) {
123
- var selection = tr.selection;
123
+ export var deleteSelectedRange = function deleteSelectedRange(tr, selectionToUse) {
124
+ var selection = selectionToUse || tr.selection;
124
125
  var from = selection.$from.pos;
125
126
  var to = selection.$to.pos;
126
127
  if (selection instanceof TextSelection) {
127
- from = from - 1;
128
- to = to + 1;
128
+ // Expand just the from position to the start of the block
129
+ // This ensures entire paragraphs are deleted instead of just
130
+ // the text content, which avoids leaving an empty line behind
131
+ var expanded = expandToBlockRange(selection.$from, selection.$to);
132
+ from = expanded.$from.pos;
129
133
  } else if (isTableSelected(selection)) {
130
134
  var table = findTable(selection);
131
135
  if (table) {
@@ -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 = "110.41.0";
24
+ var packageVersion = "0.0.0-development";
25
25
  var halfFocusRing = 1;
26
26
  var dropOffset = '0, 8';
27
27
  var fadeIn = keyframes({
@@ -1,5 +1,6 @@
1
- import type { ResolvedPos, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
1
+ import type { Node as PMNode, ResolvedPos } from '@atlaskit/editor-prosemirror/model';
2
2
  import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
3
+ import { type Selection } from '@atlaskit/editor-prosemirror/state';
3
4
  export declare const isSelectionAtStartOfNode: ($pos: ResolvedPos, parentNode?: PMNode) => boolean;
4
5
  export declare const isSelectionAtEndOfNode: ($pos: ResolvedPos, parentNode?: PMNode) => boolean;
5
6
  export declare function atTheEndOfDoc(state: EditorState): boolean;
@@ -21,9 +22,10 @@ export declare const expandSelectionBounds: ($anchor: ResolvedPos, $head: Resolv
21
22
  /**
22
23
  * Delete what is selected in the given transaction.
23
24
  * @param tr the transaction to delete the selection from
25
+ * @param selectionToUse optional selection to delete instead of the transaction's current selection
24
26
  * @returns the updated transaction
25
27
  */
26
- export declare const deleteSelectedRange: (tr: Transaction) => Transaction;
28
+ export declare const deleteSelectedRange: (tr: Transaction, selectionToUse?: Selection) => Transaction;
27
29
  /**
28
30
  * This expands the given $from and $to resolved positions to the block boundaries
29
31
  * spanning all nodes in the range up to the nearest common ancestor.
@@ -1,5 +1,6 @@
1
- import type { ResolvedPos, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
1
+ import type { Node as PMNode, ResolvedPos } from '@atlaskit/editor-prosemirror/model';
2
2
  import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
3
+ import { type Selection } from '@atlaskit/editor-prosemirror/state';
3
4
  export declare const isSelectionAtStartOfNode: ($pos: ResolvedPos, parentNode?: PMNode) => boolean;
4
5
  export declare const isSelectionAtEndOfNode: ($pos: ResolvedPos, parentNode?: PMNode) => boolean;
5
6
  export declare function atTheEndOfDoc(state: EditorState): boolean;
@@ -21,9 +22,10 @@ export declare const expandSelectionBounds: ($anchor: ResolvedPos, $head: Resolv
21
22
  /**
22
23
  * Delete what is selected in the given transaction.
23
24
  * @param tr the transaction to delete the selection from
25
+ * @param selectionToUse optional selection to delete instead of the transaction's current selection
24
26
  * @returns the updated transaction
25
27
  */
26
- export declare const deleteSelectedRange: (tr: Transaction) => Transaction;
28
+ export declare const deleteSelectedRange: (tr: Transaction, selectionToUse?: Selection) => Transaction;
27
29
  /**
28
30
  * This expands the given $from and $to resolved positions to the block boundaries
29
31
  * spanning all nodes in the range up to the nearest common ancestor.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "110.41.1",
3
+ "version": "110.41.3",
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/"
@@ -81,7 +81,7 @@
81
81
  "@atlaskit/task-decision": "^19.2.0",
82
82
  "@atlaskit/textfield": "^8.1.0",
83
83
  "@atlaskit/theme": "^21.0.0",
84
- "@atlaskit/tmp-editor-statsig": "^15.3.0",
84
+ "@atlaskit/tmp-editor-statsig": "^15.6.0",
85
85
  "@atlaskit/tokens": "^8.4.0",
86
86
  "@atlaskit/tooltip": "^20.11.0",
87
87
  "@atlaskit/width-detector": "^5.0.0",