@atlaskit/editor-common 109.1.0 → 109.1.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 CHANGED
@@ -1,5 +1,14 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 109.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`360b8c9d0b280`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/360b8c9d0b280) -
8
+ [ux] [ED-29055] selections with no text nodes will always return text formatting marks as active.
9
+ this is behind the aifc experiment and patch 3 experiment
10
+ - Updated dependencies
11
+
3
12
  ## 109.1.0
4
13
 
5
14
  ### Minor Changes
@@ -8,6 +8,7 @@ exports.wholeSelectionHasMarks = exports.isMarkExcluded = exports.isMarkAllowedI
8
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
9
  var _model = require("@atlaskit/editor-prosemirror/model");
10
10
  var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
11
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
11
12
  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; } } }; }
12
13
  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; } }
13
14
  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; }
@@ -136,6 +137,10 @@ var wholeRangeHasMarks = function wholeRangeHasMarks(from, to, doc, markTypes) {
136
137
  var hasMarks = new Map(markTypes.map(function (markType) {
137
138
  return [markType, true];
138
139
  }));
140
+ var hasNoMarks = new Map(markTypes.map(function (markType) {
141
+ return [markType, false];
142
+ }));
143
+ var isTextContent = false;
139
144
  doc.nodesBetween(from, to, function (node) {
140
145
  if (allMarksAreRuledOut(hasMarks)) {
141
146
  // This won't be a true early exit, but will prevent diving into nodes and
@@ -145,6 +150,7 @@ var wholeRangeHasMarks = function wholeRangeHasMarks(from, to, doc, markTypes) {
145
150
  if (!node.type.isText) {
146
151
  return true; // continue traversing
147
152
  }
153
+ isTextContent = true;
148
154
  var _iterator3 = _createForOfIteratorHelper(hasMarks),
149
155
  _step3;
150
156
  try {
@@ -170,6 +176,9 @@ var wholeRangeHasMarks = function wholeRangeHasMarks(from, to, doc, markTypes) {
170
176
  _iterator3.f();
171
177
  }
172
178
  });
179
+ if ((0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_patch_3', 'isEnabled', true)) {
180
+ return isTextContent ? hasMarks : hasNoMarks;
181
+ }
173
182
  return hasMarks;
174
183
  };
175
184
  var isMarkAllowedInRange = exports.isMarkAllowedInRange = function isMarkAllowedInRange(doc, ranges, type) {
@@ -16,7 +16,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
16
16
  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); }
17
17
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
18
18
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
19
- var packageVersion = "109.0.0";
19
+ var packageVersion = "109.1.0";
20
20
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
21
21
  // Remove URL as it has UGC
22
22
  // Ignored via go/ees007
@@ -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 = "109.0.0";
27
+ var packageVersion = "109.1.0";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var fadeIn = (0, _react2.keyframes)({
@@ -1,5 +1,6 @@
1
1
  import { Mark } from '@atlaskit/editor-prosemirror/model';
2
2
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
3
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
3
4
 
4
5
  /**
5
6
  * Determine if a mark of a specific type exists anywhere in the selection.
@@ -96,6 +97,8 @@ const cellSelectionHasMarks = (doc, selection, markTypes) => {
96
97
  };
97
98
  const wholeRangeHasMarks = (from, to, doc, markTypes) => {
98
99
  const hasMarks = new Map(markTypes.map(markType => [markType, true]));
100
+ const hasNoMarks = new Map(markTypes.map(markType => [markType, false]));
101
+ let isTextContent = false;
99
102
  doc.nodesBetween(from, to, node => {
100
103
  if (allMarksAreRuledOut(hasMarks)) {
101
104
  // This won't be a true early exit, but will prevent diving into nodes and
@@ -105,6 +108,7 @@ const wholeRangeHasMarks = (from, to, doc, markTypes) => {
105
108
  if (!node.type.isText) {
106
109
  return true; // continue traversing
107
110
  }
111
+ isTextContent = true;
108
112
  for (const [markType, hasMark] of hasMarks) {
109
113
  if (!hasMark) {
110
114
  continue; // already ruled out the mark, skip further checks
@@ -113,6 +117,9 @@ const wholeRangeHasMarks = (from, to, doc, markTypes) => {
113
117
  hasMarks.set(markType, value);
114
118
  }
115
119
  });
120
+ if (expValEquals('platform_editor_toolbar_aifc_patch_3', 'isEnabled', true)) {
121
+ return isTextContent ? hasMarks : hasNoMarks;
122
+ }
116
123
  return hasMarks;
117
124
  };
118
125
  export const isMarkAllowedInRange = (doc, ranges, type) => {
@@ -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 = "109.0.0";
4
+ const packageVersion = "109.1.0";
5
5
  const sanitiseSentryEvents = (data, _hint) => {
6
6
  // Remove URL as it has UGC
7
7
  // Ignored via go/ees007
@@ -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 = "109.0.0";
17
+ const packageVersion = "109.1.0";
18
18
  const halfFocusRing = 1;
19
19
  const dropOffset = '0, 8';
20
20
  const fadeIn = keyframes({
@@ -4,6 +4,7 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
4
4
  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; }
5
5
  import { Mark } from '@atlaskit/editor-prosemirror/model';
6
6
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
7
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
7
8
 
8
9
  /**
9
10
  * Determine if a mark of a specific type exists anywhere in the selection.
@@ -130,6 +131,10 @@ var wholeRangeHasMarks = function wholeRangeHasMarks(from, to, doc, markTypes) {
130
131
  var hasMarks = new Map(markTypes.map(function (markType) {
131
132
  return [markType, true];
132
133
  }));
134
+ var hasNoMarks = new Map(markTypes.map(function (markType) {
135
+ return [markType, false];
136
+ }));
137
+ var isTextContent = false;
133
138
  doc.nodesBetween(from, to, function (node) {
134
139
  if (allMarksAreRuledOut(hasMarks)) {
135
140
  // This won't be a true early exit, but will prevent diving into nodes and
@@ -139,6 +144,7 @@ var wholeRangeHasMarks = function wholeRangeHasMarks(from, to, doc, markTypes) {
139
144
  if (!node.type.isText) {
140
145
  return true; // continue traversing
141
146
  }
147
+ isTextContent = true;
142
148
  var _iterator3 = _createForOfIteratorHelper(hasMarks),
143
149
  _step3;
144
150
  try {
@@ -164,6 +170,9 @@ var wholeRangeHasMarks = function wholeRangeHasMarks(from, to, doc, markTypes) {
164
170
  _iterator3.f();
165
171
  }
166
172
  });
173
+ if (expValEquals('platform_editor_toolbar_aifc_patch_3', 'isEnabled', true)) {
174
+ return isTextContent ? hasMarks : hasNoMarks;
175
+ }
167
176
  return hasMarks;
168
177
  };
169
178
  export var isMarkAllowedInRange = function isMarkAllowedInRange(doc, ranges, type) {
@@ -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 = "109.0.0";
10
+ var packageVersion = "109.1.0";
11
11
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
12
12
  // Remove URL as it has UGC
13
13
  // Ignored via go/ees007
@@ -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 = "109.0.0";
24
+ var packageVersion = "109.1.0";
25
25
  var halfFocusRing = 1;
26
26
  var dropOffset = '0, 8';
27
27
  var fadeIn = keyframes({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "109.1.0",
3
+ "version": "109.1.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/"
@@ -151,7 +151,7 @@
151
151
  "@atlaskit/icon-object": "^7.2.0",
152
152
  "@atlaskit/link": "^3.2.0",
153
153
  "@atlaskit/link-datasource": "^4.21.0",
154
- "@atlaskit/link-picker": "^3.9.0",
154
+ "@atlaskit/link-picker": "^3.10.0",
155
155
  "@atlaskit/media-card": "^79.5.0",
156
156
  "@atlaskit/media-client": "^35.3.0",
157
157
  "@atlaskit/media-client-react": "^4.1.0",
@@ -167,7 +167,7 @@
167
167
  "@atlaskit/platform-feature-flags-react": "^0.3.0",
168
168
  "@atlaskit/popper": "^7.1.0",
169
169
  "@atlaskit/primitives": "^14.14.0",
170
- "@atlaskit/profilecard": "^24.11.0",
170
+ "@atlaskit/profilecard": "^24.12.0",
171
171
  "@atlaskit/react-ufo": "^4.6.0",
172
172
  "@atlaskit/section-message": "^8.7.0",
173
173
  "@atlaskit/smart-card": "^40.22.0",
@@ -177,7 +177,7 @@
177
177
  "@atlaskit/task-decision": "^19.2.0",
178
178
  "@atlaskit/textfield": "^8.0.0",
179
179
  "@atlaskit/theme": "^21.0.0",
180
- "@atlaskit/tmp-editor-statsig": "^12.10.0",
180
+ "@atlaskit/tmp-editor-statsig": "^12.12.0",
181
181
  "@atlaskit/tokens": "^6.3.0",
182
182
  "@atlaskit/tooltip": "^20.4.0",
183
183
  "@atlaskit/width-detector": "^5.0.0",