@atlaskit/editor-jira-transformer 8.3.6 → 8.3.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,11 @@
1
1
  # @atlaskit/editor-jira-transformer
2
2
 
3
+ ## 8.3.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [`4e6f1bf8511`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4e6f1bf8511) - [ED-19233] Import prosemirror libraries from internal facade package
8
+
3
9
  ## 8.3.6
4
10
 
5
11
  ### Patch Changes
package/dist/cjs/index.js CHANGED
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.JIRATransformer = void 0;
8
8
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- var _prosemirrorModel = require("prosemirror-model");
10
+ var _model = require("@atlaskit/editor-prosemirror/model");
11
11
  var _parseHtml = _interopRequireDefault(require("./parse-html"));
12
12
  var _fixDoc = _interopRequireDefault(require("./fix-doc"));
13
13
  var _utils = require("./utils");
@@ -75,13 +75,13 @@ var JIRATransformer = /*#__PURE__*/function () {
75
75
  }, {
76
76
  key: "getContent",
77
77
  value: function getContent(node, convertedNodes) {
78
- var fragment = _prosemirrorModel.Fragment.fromArray([]);
78
+ var fragment = _model.Fragment.fromArray([]);
79
79
  var childIndex;
80
80
  for (childIndex = 0; childIndex < node.childNodes.length; childIndex++) {
81
81
  var child = node.childNodes[childIndex];
82
82
  var thing = convertedNodes.get(child);
83
- if (thing instanceof _prosemirrorModel.Fragment || thing instanceof _prosemirrorModel.Node) {
84
- fragment = fragment.append(_prosemirrorModel.Fragment.from(thing));
83
+ if (thing instanceof _model.Fragment || thing instanceof _model.Node) {
84
+ fragment = fragment.append(_model.Fragment.from(thing));
85
85
  }
86
86
  }
87
87
  return fragment;
package/dist/cjs/utils.js CHANGED
@@ -9,7 +9,7 @@ exports.ensureBlocks = ensureBlocks;
9
9
  exports.ensureInline = void 0;
10
10
  var _adfSchema = require("@atlaskit/adf-schema");
11
11
  var _schemaJira = require("@atlaskit/adf-schema/schema-jira");
12
- var _prosemirrorModel = require("prosemirror-model");
12
+ var _model = require("@atlaskit/editor-prosemirror/model");
13
13
  var _emojiHelper = require("./emojiHelper");
14
14
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, 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 normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
15
15
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
@@ -21,7 +21,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
21
21
  function ensureBlocks(fragment, schema, nodeType) {
22
22
  // If all the nodes are inline, we want to wrap in a single paragraph.
23
23
  if (schema.nodes.paragraph.validContent(fragment)) {
24
- return _prosemirrorModel.Fragment.fromArray([schema.nodes.paragraph.createChecked({}, fragment)]);
24
+ return _model.Fragment.fromArray([schema.nodes.paragraph.createChecked({}, fragment)]);
25
25
  }
26
26
 
27
27
  // Either all the nodes are blocks, or a mix of inline and blocks.
@@ -41,7 +41,7 @@ function ensureBlocks(fragment, schema, nodeType) {
41
41
  blockNodes.push(schema.nodes.paragraph.createChecked({}, child));
42
42
  }
43
43
  });
44
- return _prosemirrorModel.Fragment.fromArray(blockNodes);
44
+ return _model.Fragment.fromArray(blockNodes);
45
45
  }
46
46
 
47
47
  /**
@@ -60,7 +60,7 @@ var ensureInline = function ensureInline(schema, content, supportedMarks) {
60
60
  // We replace an non-inline node with UnsupportedInline node
61
61
  result.push(schema.text(node.textContent));
62
62
  });
63
- return _prosemirrorModel.Fragment.fromArray(result);
63
+ return _model.Fragment.fromArray(result);
64
64
  };
65
65
  exports.ensureInline = ensureInline;
66
66
  function convert(content, node, schema) {
@@ -143,7 +143,7 @@ function convert(content, node, schema) {
143
143
  var jiraKey = node.getAttribute('data-jira-key');
144
144
  var link = node.getElementsByTagName('a')[0];
145
145
  if (jiraKey && link) {
146
- return addMarks(_prosemirrorModel.Fragment.from(schema.text(jiraKey)), [schema.marks.link.create({
146
+ return addMarks(_model.Fragment.from(schema.text(jiraKey)), [schema.marks.link.create({
147
147
  href: link.getAttribute('href'),
148
148
  title: link.getAttribute('title')
149
149
  })]);
@@ -236,7 +236,7 @@ function convert(content, node, schema) {
236
236
  fragmentArray.push(mediaNodeType.createChecked({}, mediaArray));
237
237
  }
238
238
  if (fragmentArray.length) {
239
- return _prosemirrorModel.Fragment.fromArray(fragmentArray);
239
+ return _model.Fragment.fromArray(fragmentArray);
240
240
  }
241
241
  return null;
242
242
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-jira-transformer",
3
- "version": "8.3.6",
3
+ "version": "8.3.7",
4
4
  "sideEffects": false
5
5
  }
@@ -1,4 +1,4 @@
1
- import { Fragment, Node as PMNode } from 'prosemirror-model';
1
+ import { Fragment, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
2
  import parseHtml from './parse-html';
3
3
  import fixDoc from './fix-doc';
4
4
  import { bfsOrder, convert, ensureBlocks } from './utils';
@@ -1,6 +1,6 @@
1
1
  import { normalizeHexColor } from '@atlaskit/adf-schema';
2
2
  import { isSchemaWithLists, isSchemaWithMentions, isSchemaWithLinks, isSchemaWithAdvancedTextFormattingMarks, isSchemaWithCodeBlock, isSchemaWithBlockQuotes, isSchemaWithMedia, isSchemaWithSubSupMark, isSchemaWithTextColor, isSchemaWithTables } from '@atlaskit/adf-schema/schema-jira';
3
- import { Fragment } from 'prosemirror-model';
3
+ import { Fragment } from '@atlaskit/editor-prosemirror/model';
4
4
  import { mapImageToEmoji } from './emojiHelper';
5
5
 
6
6
  /**
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-jira-transformer",
3
- "version": "8.3.6",
3
+ "version": "8.3.7",
4
4
  "sideEffects": false
5
5
  }
package/dist/esm/index.js CHANGED
@@ -3,7 +3,7 @@ import _createClass from "@babel/runtime/helpers/createClass";
3
3
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, 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 normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
4
4
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
5
5
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
6
- import { Fragment, Node as PMNode } from 'prosemirror-model';
6
+ import { Fragment, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
7
7
  import parseHtml from './parse-html';
8
8
  import fixDoc from './fix-doc';
9
9
  import { bfsOrder, convert, ensureBlocks } from './utils';
package/dist/esm/utils.js CHANGED
@@ -3,7 +3,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
3
3
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
4
4
  import { normalizeHexColor } from '@atlaskit/adf-schema';
5
5
  import { isSchemaWithLists, isSchemaWithMentions, isSchemaWithLinks, isSchemaWithAdvancedTextFormattingMarks, isSchemaWithCodeBlock, isSchemaWithBlockQuotes, isSchemaWithMedia, isSchemaWithSubSupMark, isSchemaWithTextColor, isSchemaWithTables } from '@atlaskit/adf-schema/schema-jira';
6
- import { Fragment } from 'prosemirror-model';
6
+ import { Fragment } from '@atlaskit/editor-prosemirror/model';
7
7
  import { mapImageToEmoji } from './emojiHelper';
8
8
 
9
9
  /**
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-jira-transformer",
3
- "version": "8.3.6",
3
+ "version": "8.3.7",
4
4
  "sideEffects": false
5
5
  }
@@ -1,4 +1,4 @@
1
- import { Node as PMNode, Schema } from 'prosemirror-model';
1
+ import { Node as PMNode, Schema } from '@atlaskit/editor-prosemirror/model';
2
2
  import { Transformer } from '@atlaskit/editor-common/types';
3
3
  export type CustomEncoder = (userId: string) => string;
4
4
  export interface JIRACustomEncoders {
@@ -1,4 +1,4 @@
1
- import { Fragment, Mark, Node as PMNode, Schema, NodeType } from 'prosemirror-model';
1
+ import { Fragment, Mark, Node as PMNode, Schema, NodeType } from '@atlaskit/editor-prosemirror/model';
2
2
  /**
3
3
  * Ensure that each node in the fragment is a block, wrapping
4
4
  * in a block node if necessary.
@@ -1,4 +1,4 @@
1
- import { Node as PMNode, Schema } from 'prosemirror-model';
1
+ import { Node as PMNode, Schema } from '@atlaskit/editor-prosemirror/model';
2
2
  import { Transformer } from '@atlaskit/editor-common/types';
3
3
  export type CustomEncoder = (userId: string) => string;
4
4
  export interface JIRACustomEncoders {
@@ -1,4 +1,4 @@
1
- import { Fragment, Mark, Node as PMNode, Schema, NodeType } from 'prosemirror-model';
1
+ import { Fragment, Mark, Node as PMNode, Schema, NodeType } from '@atlaskit/editor-prosemirror/model';
2
2
  /**
3
3
  * Ensure that each node in the fragment is a block, wrapping
4
4
  * in a block node if necessary.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-jira-transformer",
3
- "version": "8.3.6",
3
+ "version": "8.3.7",
4
4
  "description": "Editor JIRA transformer's",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -32,18 +32,18 @@
32
32
  }
33
33
  },
34
34
  "dependencies": {
35
- "@atlaskit/adf-schema": "^26.2.0",
36
- "@atlaskit/editor-common": "^74.20.0",
35
+ "@atlaskit/adf-schema": "^26.4.0",
36
+ "@atlaskit/editor-common": "^74.29.0",
37
+ "@atlaskit/editor-prosemirror": "1.0.2",
37
38
  "@babel/runtime": "^7.0.0",
38
- "collapse-whitespace": "^1.1.6",
39
- "prosemirror-model": "1.16.0"
39
+ "collapse-whitespace": "^1.1.6"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "react": "^16.8.0"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@atlaskit/activity": "^1.0.1",
46
- "@atlaskit/editor-core": "^185.15.0",
46
+ "@atlaskit/editor-core": "^187.8.0",
47
47
  "@atlaskit/editor-json-transformer": "^8.10.0",
48
48
  "@atlaskit/editor-test-helpers": "^18.10.0",
49
49
  "@atlaskit/theme": "^12.5.0",
package/report.api.md CHANGED
@@ -15,8 +15,8 @@
15
15
  <!--SECTION START: Main Entry Types-->
16
16
 
17
17
  ```ts
18
- import { Node as Node_2 } from 'prosemirror-model';
19
- import { Schema } from 'prosemirror-model';
18
+ import { Node as Node_2 } from '@atlaskit/editor-prosemirror/model';
19
+ import { Schema } from '@atlaskit/editor-prosemirror/model';
20
20
  import { Transformer as Transformer_2 } from '@atlaskit/editor-common/types';
21
21
 
22
22
  // @public (undocumented)
@@ -0,0 +1,51 @@
1
+ ## API Report File for "@atlaskit/editor-jira-transformer"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+
7
+ import { Node as Node_2 } from '@atlaskit/editor-prosemirror/model';
8
+ import { Schema } from '@atlaskit/editor-prosemirror/model';
9
+ import { Transformer as Transformer_2 } from '@atlaskit/editor-common/types';
10
+
11
+ // @public (undocumented)
12
+ export interface ContextInfo {
13
+ // (undocumented)
14
+ baseUrl: string;
15
+ // (undocumented)
16
+ clientId: string;
17
+ // (undocumented)
18
+ collection: string;
19
+ // (undocumented)
20
+ token: string;
21
+ }
22
+
23
+ // @public (undocumented)
24
+ export type CustomEncoder = (userId: string) => string;
25
+
26
+ // @public (undocumented)
27
+ export interface JIRACustomEncoders {
28
+ // (undocumented)
29
+ mention?: CustomEncoder;
30
+ }
31
+
32
+ // @public (undocumented)
33
+ export class JIRATransformer implements Transformer_2<string> {
34
+ constructor(schema: Schema, customEncoders?: JIRACustomEncoders, mediaContextInfo?: MediaContextInfo);
35
+ // (undocumented)
36
+ encode(node: Node_2): string;
37
+ // (undocumented)
38
+ parse(html: string): Node_2;
39
+ }
40
+
41
+ // @public (undocumented)
42
+ export interface MediaContextInfo {
43
+ // (undocumented)
44
+ uploadContext?: ContextInfo;
45
+ // (undocumented)
46
+ viewContext?: ContextInfo;
47
+ }
48
+
49
+ // (No @packageDocumentation comment for this package)
50
+
51
+ ```