@atlaskit/editor-jira-transformer 20.0.1 → 20.0.2

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,13 @@
1
1
  # @atlaskit/editor-jira-transformer
2
2
 
3
+ ## 20.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`24d7483e9519e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/24d7483e9519e) -
8
+ Cleans up prefer static regex violations
9
+ - Updated dependencies
10
+
3
11
  ## 20.0.1
4
12
 
5
13
  ### Patch Changes
package/dist/cjs/index.js CHANGED
@@ -15,6 +15,9 @@ var _schemaJira = require("@atlaskit/adf-schema/schema-jira");
15
15
  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; } } }; }
16
16
  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; } }
17
17
  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; }
18
+ // Ignored via go/ees005
19
+ // eslint-disable-next-line require-unicode-regexp
20
+ var FRAGMENT_HREF_REGEX = /^#/;
18
21
  var JIRATransformer = exports.JIRATransformer = /*#__PURE__*/function () {
19
22
  function JIRATransformer(schema, customEncoders, mediaContextInfo) {
20
23
  (0, _classCallCheck2.default)(this, JIRATransformer);
@@ -290,9 +293,7 @@ var JIRATransformer = exports.JIRATransformer = /*#__PURE__*/function () {
290
293
  var href = mark.attrs['href'];
291
294
 
292
295
  /** JIRA always expects external-link attribute set on links created via editor unless its #fragment */
293
- // Ignored via go/ees005
294
- // eslint-disable-next-line require-unicode-regexp
295
- if (!href.match(/^#/)) {
296
+ if (!href.match(FRAGMENT_HREF_REGEX)) {
296
297
  linkElem.setAttribute('class', 'external-link');
297
298
  linkElem.setAttribute('rel', 'nofollow');
298
299
  }
package/dist/cjs/utils.js CHANGED
@@ -14,6 +14,10 @@ var _emojiHelper = require("./emojiHelper");
14
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; } } }; }
15
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; } }
16
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; }
17
+ // Ignored via go/ees005
18
+ // eslint-disable-next-line require-unicode-regexp
19
+ var WHITESPACE_ONLY_REGEX = /^\s*$/;
20
+
17
21
  /**
18
22
  * Ensure that each node in the fragment is a block, wrapping
19
23
  * in a block node if necessary.
@@ -234,9 +238,7 @@ function convert(content, node, schema) {
234
238
  if (child.type === schema.nodes.media) {
235
239
  mediaArray.push(child);
236
240
  return;
237
- // Ignored via go/ees005
238
- // eslint-disable-next-line require-unicode-regexp
239
- } else if (!(child.isText && /^\s*$/.test(child.text || ''))) {
241
+ } else if (!(child.isText && WHITESPACE_ONLY_REGEX.test(child.text || ''))) {
240
242
  hasNonMediaChildren = true;
241
243
  }
242
244
  contentArray.push(child);
@@ -3,6 +3,9 @@ import parseHtml from './parse-html';
3
3
  import fixDoc from './fix-doc';
4
4
  import { bfsOrder, convert, ensureBlocks } from './utils';
5
5
  import { isSchemaWithLists, isSchemaWithMentions, isSchemaWithEmojis, isSchemaWithCodeBlock, isSchemaWithBlockQuotes, isSchemaWithMedia, isSchemaWithTables } from '@atlaskit/adf-schema/schema-jira';
6
+ // Ignored via go/ees005
7
+ // eslint-disable-next-line require-unicode-regexp
8
+ const FRAGMENT_HREF_REGEX = /^#/;
6
9
  export class JIRATransformer {
7
10
  constructor(schema, customEncoders, mediaContextInfo) {
8
11
  this.schema = schema;
@@ -254,9 +257,7 @@ export class JIRATransformer {
254
257
  const href = mark.attrs['href'];
255
258
 
256
259
  /** JIRA always expects external-link attribute set on links created via editor unless its #fragment */
257
- // Ignored via go/ees005
258
- // eslint-disable-next-line require-unicode-regexp
259
- if (!href.match(/^#/)) {
260
+ if (!href.match(FRAGMENT_HREF_REGEX)) {
260
261
  linkElem.setAttribute('class', 'external-link');
261
262
  linkElem.setAttribute('rel', 'nofollow');
262
263
  }
@@ -3,6 +3,10 @@ import { isSchemaWithLists, isSchemaWithMentions, isSchemaWithLinks, isSchemaWit
3
3
  import { Fragment } from '@atlaskit/editor-prosemirror/model';
4
4
  import { mapImageToEmoji } from './emojiHelper';
5
5
 
6
+ // Ignored via go/ees005
7
+ // eslint-disable-next-line require-unicode-regexp
8
+ const WHITESPACE_ONLY_REGEX = /^\s*$/;
9
+
6
10
  /**
7
11
  * Ensure that each node in the fragment is a block, wrapping
8
12
  * in a block node if necessary.
@@ -220,9 +224,7 @@ export function convert(content, node, schema) {
220
224
  if (child.type === schema.nodes.media) {
221
225
  mediaArray.push(child);
222
226
  return;
223
- // Ignored via go/ees005
224
- // eslint-disable-next-line require-unicode-regexp
225
- } else if (!(child.isText && /^\s*$/.test(child.text || ''))) {
227
+ } else if (!(child.isText && WHITESPACE_ONLY_REGEX.test(child.text || ''))) {
226
228
  hasNonMediaChildren = true;
227
229
  }
228
230
  contentArray.push(child);
package/dist/esm/index.js CHANGED
@@ -8,6 +8,9 @@ import parseHtml from './parse-html';
8
8
  import fixDoc from './fix-doc';
9
9
  import { bfsOrder, convert, ensureBlocks } from './utils';
10
10
  import { isSchemaWithLists, isSchemaWithMentions, isSchemaWithEmojis, isSchemaWithCodeBlock, isSchemaWithBlockQuotes, isSchemaWithMedia, isSchemaWithTables } from '@atlaskit/adf-schema/schema-jira';
11
+ // Ignored via go/ees005
12
+ // eslint-disable-next-line require-unicode-regexp
13
+ var FRAGMENT_HREF_REGEX = /^#/;
11
14
  export var JIRATransformer = /*#__PURE__*/function () {
12
15
  function JIRATransformer(schema, customEncoders, mediaContextInfo) {
13
16
  _classCallCheck(this, JIRATransformer);
@@ -283,9 +286,7 @@ export var JIRATransformer = /*#__PURE__*/function () {
283
286
  var href = mark.attrs['href'];
284
287
 
285
288
  /** JIRA always expects external-link attribute set on links created via editor unless its #fragment */
286
- // Ignored via go/ees005
287
- // eslint-disable-next-line require-unicode-regexp
288
- if (!href.match(/^#/)) {
289
+ if (!href.match(FRAGMENT_HREF_REGEX)) {
289
290
  linkElem.setAttribute('class', 'external-link');
290
291
  linkElem.setAttribute('rel', 'nofollow');
291
292
  }
package/dist/esm/utils.js CHANGED
@@ -6,6 +6,10 @@ import { isSchemaWithLists, isSchemaWithMentions, isSchemaWithLinks, isSchemaWit
6
6
  import { Fragment } from '@atlaskit/editor-prosemirror/model';
7
7
  import { mapImageToEmoji } from './emojiHelper';
8
8
 
9
+ // Ignored via go/ees005
10
+ // eslint-disable-next-line require-unicode-regexp
11
+ var WHITESPACE_ONLY_REGEX = /^\s*$/;
12
+
9
13
  /**
10
14
  * Ensure that each node in the fragment is a block, wrapping
11
15
  * in a block node if necessary.
@@ -226,9 +230,7 @@ export function convert(content, node, schema) {
226
230
  if (child.type === schema.nodes.media) {
227
231
  mediaArray.push(child);
228
232
  return;
229
- // Ignored via go/ees005
230
- // eslint-disable-next-line require-unicode-regexp
231
- } else if (!(child.isText && /^\s*$/.test(child.text || ''))) {
233
+ } else if (!(child.isText && WHITESPACE_ONLY_REGEX.test(child.text || ''))) {
232
234
  hasNonMediaChildren = true;
233
235
  }
234
236
  contentArray.push(child);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-jira-transformer",
3
- "version": "20.0.1",
3
+ "version": "20.0.2",
4
4
  "description": "Editor JIRA transformer's",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -27,18 +27,18 @@
27
27
  "collapse-whitespace": "^1.1.6"
28
28
  },
29
29
  "peerDependencies": {
30
- "@atlaskit/editor-common": "^116.4.0",
30
+ "@atlaskit/editor-common": "^116.17.0",
31
31
  "react": "^18.2.0"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@atlaskit/activity": "^1.0.1",
35
- "@atlaskit/editor-core": "^221.1.0",
35
+ "@atlaskit/editor-core": "^221.5.0",
36
36
  "@atlaskit/editor-json-transformer": "^9.0.0",
37
37
  "@atlaskit/editor-test-helpers": "workspace:^",
38
- "@atlaskit/mention": "^27.1.0",
39
- "@atlaskit/theme": "^26.0.0",
40
- "@atlaskit/tokens": "^14.0.0",
41
- "@atlaskit/util-data-test": "^19.0.0",
38
+ "@atlaskit/mention": "^27.5.0",
39
+ "@atlaskit/theme": "^26.1.0",
40
+ "@atlaskit/tokens": "^15.2.0",
41
+ "@atlaskit/util-data-test": "^19.1.0",
42
42
  "@atlassian/structured-docs-types": "workspace:^",
43
43
  "@emotion/react": "^11.7.1",
44
44
  "react": "^18.2.0"