@atlaskit/editor-wikimarkup-transformer 11.1.15 → 11.1.17

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,17 @@
1
1
  # @atlaskit/editor-wikimarkup-transformer
2
2
 
3
+ ## 11.1.17
4
+
5
+ ### Patch Changes
6
+
7
+ - [`0ffb55018c9`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0ffb55018c9) - Revert "[ED-17172] Bumped prosemirror-view from 1.23.2 to 1.23.7 and removed work-around for fixed issues"
8
+
9
+ ## 11.1.16
10
+
11
+ ### Patch Changes
12
+
13
+ - [`5ae242b554c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/5ae242b554c) - updated logic to handle multiple linebreaks inside a macro within a list
14
+
3
15
  ## 11.1.15
4
16
 
5
17
  ### Patch Changes
@@ -12,7 +12,7 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
12
12
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
13
  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; } } }; }
14
14
  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); }
15
- 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; }
15
+ 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; }
16
16
  var supportedContentType = ['paragraph', 'orderedList', 'bulletList', 'mediaSingle', 'codeBlock'];
17
17
 
18
18
  /**
@@ -25,6 +25,11 @@ var ListBuilder = /*#__PURE__*/function () {
25
25
  function ListBuilder(schema, bullets) {
26
26
  var _this = this;
27
27
  (0, _classCallCheck2.default)(this, ListBuilder);
28
+ /**
29
+ * Build prosemirror bulletList or orderedList node
30
+ * @param {List} list
31
+ * @returns {PMNode}
32
+ */
28
33
  (0, _defineProperty2.default)(this, "parseList", function (list) {
29
34
  var listNode = _this.schema.nodes[list.type];
30
35
  var output = [];
@@ -55,6 +60,12 @@ var ListBuilder = /*#__PURE__*/function () {
55
60
  }
56
61
  return output;
57
62
  });
63
+ /**
64
+ * Build prosemirror listItem node
65
+ * This function would possibly return non listItem nodes
66
+ * which we need to break out later
67
+ * @param {ListItem} item
68
+ */
58
69
  (0, _defineProperty2.default)(this, "parseListItem", function (item) {
59
70
  var _item$content;
60
71
  var output = [];
@@ -172,19 +183,6 @@ var ListBuilder = /*#__PURE__*/function () {
172
183
  value: function buildPMNode() {
173
184
  return this.parseList(this.root);
174
185
  }
175
-
176
- /**
177
- * Build prosemirror bulletList or orderedList node
178
- * @param {List} list
179
- * @returns {PMNode}
180
- */
181
-
182
- /**
183
- * Build prosemirror listItem node
184
- * This function would possibly return non listItem nodes
185
- * which we need to break out later
186
- * @param {ListItem} item
187
- */
188
186
  }, {
189
187
  key: "isParagraphEmptyTextNode",
190
188
  value: /* Check if all paragraph's children nodes are text and empty */
@@ -10,7 +10,7 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
  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; } } }; }
12
12
  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); }
13
- 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; }
13
+ 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; }
14
14
  /**
15
15
  * Return the cell type based on the delimeter
16
16
  */
@@ -31,6 +31,10 @@ var TableBuilder = /*#__PURE__*/function () {
31
31
  var tableRow = _this.schema.nodes.tableRow;
32
32
  return tableRow.createChecked({}, _this.emptyTableCell());
33
33
  });
34
+ /**
35
+ * Build prosemirror table node
36
+ * @returns {PMNode}
37
+ */
34
38
  (0, _defineProperty2.default)(this, "buildTableNode", function () {
35
39
  var root = _this.root;
36
40
  var table = _this.schema.nodes.table;
@@ -40,10 +44,19 @@ var TableBuilder = /*#__PURE__*/function () {
40
44
  }
41
45
  return table.createChecked({}, content);
42
46
  });
47
+ /**
48
+ * Build prosemirror tr node
49
+ * @returns {PMNode}
50
+ */
43
51
  (0, _defineProperty2.default)(this, "buildTableRowNode", function (row) {
44
52
  var tableRow = _this.schema.nodes.tableRow;
45
53
  return tableRow.createChecked({}, row.cells.map(_this.buildTableCellNode));
46
54
  });
55
+ /**
56
+ * Build prosemirror td/th node
57
+ * @param {TableCell} cell
58
+ * @returns {PMNode}
59
+ */
47
60
  (0, _defineProperty2.default)(this, "buildTableCellNode", function (cell) {
48
61
  var type = cell.type,
49
62
  content = cell.content;
@@ -117,22 +130,6 @@ var TableBuilder = /*#__PURE__*/function () {
117
130
  value: function buildPMNode() {
118
131
  return this.buildTableNode();
119
132
  }
120
-
121
- /**
122
- * Build prosemirror table node
123
- * @returns {PMNode}
124
- */
125
-
126
- /**
127
- * Build prosemirror tr node
128
- * @returns {PMNode}
129
- */
130
-
131
- /**
132
- * Build prosemirror td/th node
133
- * @param {TableCell} cell
134
- * @returns {PMNode}
135
- */
136
133
  }, {
137
134
  key: "addRow",
138
135
  value:
@@ -38,9 +38,7 @@ var _noformatMacro = require("./noformat-macro");
38
38
  var _forceLineBreak = require("./force-line-break");
39
39
  var _issueKey = require("./issue-key");
40
40
  var _tokenToTokenParserMa;
41
- var TokenType; // \\
42
- exports.TokenType = TokenType;
43
- (function (TokenType) {
41
+ var TokenType = /*#__PURE__*/function (TokenType) {
44
42
  TokenType["ADF_MACRO"] = "ADF_MACRO";
45
43
  TokenType["ANCHOR_MACRO"] = "ANCHOR_MACRO";
46
44
  TokenType["CODE_MACRO"] = "CODE_MACRO";
@@ -73,7 +71,9 @@ exports.TokenType = TokenType;
73
71
  TokenType["INSERTED"] = "INSERTED";
74
72
  TokenType["EMOJI"] = "EMOJI";
75
73
  TokenType["FORCE_LINE_BREAK"] = "FORCE_LINE_BREAK";
76
- })(TokenType || (exports.TokenType = TokenType = {}));
74
+ return TokenType;
75
+ }({}); // \\
76
+ exports.TokenType = TokenType;
77
77
  var tokenToTokenParserMapping = (_tokenToTokenParserMa = {}, (0, _defineProperty2.default)(_tokenToTokenParserMa, TokenType.DOUBLE_DASH_SYMBOL, _doubleDashSymbol.doubleDashSymbol), (0, _defineProperty2.default)(_tokenToTokenParserMa, TokenType.TRIPLE_DASH_SYMBOL, _tripleDashSymbol.tripleDashSymbol), (0, _defineProperty2.default)(_tokenToTokenParserMa, TokenType.QUADRUPLE_DASH_SYMBOL, _quadrupleDashSymbol.quadrupleDashSymbol), (0, _defineProperty2.default)(_tokenToTokenParserMa, TokenType.RULER, _ruler.ruler), (0, _defineProperty2.default)(_tokenToTokenParserMa, TokenType.STRONG, _strong.strong), (0, _defineProperty2.default)(_tokenToTokenParserMa, TokenType.MONOSPACE, _monospace.monospace), (0, _defineProperty2.default)(_tokenToTokenParserMa, TokenType.SUPERSCRIPT, _superscript.superscript), (0, _defineProperty2.default)(_tokenToTokenParserMa, TokenType.SUBSCRIPT, _subscript.subscript), (0, _defineProperty2.default)(_tokenToTokenParserMa, TokenType.EMPHASIS, _emphasis.emphasis), (0, _defineProperty2.default)(_tokenToTokenParserMa, TokenType.CITATION, _citation.citation), (0, _defineProperty2.default)(_tokenToTokenParserMa, TokenType.DELETED, _deleted.deleted), (0, _defineProperty2.default)(_tokenToTokenParserMa, TokenType.INSERTED, _inserted.inserted), (0, _defineProperty2.default)(_tokenToTokenParserMa, TokenType.HARD_BREAK, _hardbreak.hardbreak), (0, _defineProperty2.default)(_tokenToTokenParserMa, TokenType.LINK_FORMAT, _linkFormat.linkFormat), (0, _defineProperty2.default)(_tokenToTokenParserMa, TokenType.LINK_TEXT, _linkText.linkText), (0, _defineProperty2.default)(_tokenToTokenParserMa, TokenType.HEADING, _heading.heading), (0, _defineProperty2.default)(_tokenToTokenParserMa, TokenType.MEDIA, _media.media), (0, _defineProperty2.default)(_tokenToTokenParserMa, TokenType.LIST, _list.list), (0, _defineProperty2.default)(_tokenToTokenParserMa, TokenType.QUOTE, _blockquote.blockquote), (0, _defineProperty2.default)(_tokenToTokenParserMa, TokenType.TABLE, _table.table), (0, _defineProperty2.default)(_tokenToTokenParserMa, TokenType.EMOJI, _emoji.emoji), (0, _defineProperty2.default)(_tokenToTokenParserMa, TokenType.ADF_MACRO, _adfMacro.adfMacro), (0, _defineProperty2.default)(_tokenToTokenParserMa, TokenType.ANCHOR_MACRO, _anchorMacro.anchorMacro), (0, _defineProperty2.default)(_tokenToTokenParserMa, TokenType.CODE_MACRO, _codeMacro.codeMacro), (0, _defineProperty2.default)(_tokenToTokenParserMa, TokenType.QUOTE_MACRO, _quoteMacro.quoteMacro), (0, _defineProperty2.default)(_tokenToTokenParserMa, TokenType.NOFORMAT_MACRO, _noformatMacro.noformatMacro), (0, _defineProperty2.default)(_tokenToTokenParserMa, TokenType.PANEL_MACRO, _panelMacro.panelMacro), (0, _defineProperty2.default)(_tokenToTokenParserMa, TokenType.COLOR_MACRO, _colorMacro.colorMacro), (0, _defineProperty2.default)(_tokenToTokenParserMa, TokenType.FORCE_LINE_BREAK, _forceLineBreak.forceLineBreak), (0, _defineProperty2.default)(_tokenToTokenParserMa, TokenType.ISSUE_KEY, _issueKey.issueKey), _tokenToTokenParserMa);
78
78
  function parseToken(input, type, position, schema, context) {
79
79
  var tokenParser = tokenToTokenParserMapping[type];
@@ -10,7 +10,7 @@ var _urlLink = require("./url-link");
10
10
  var _issueLink = require("./issue-link");
11
11
  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; } } }; }
12
12
  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); }
13
- 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; }
13
+ 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; }
14
14
  /**
15
15
  * Given some parsed link text, convert it into a link object that can then be rendered into
16
16
  * the page. The parseAsContentLink() method must have been called on the GenericLinkParser
@@ -42,8 +42,16 @@ var list = function list(_ref) {
42
42
  var builder = null;
43
43
  var contentBuffer = [];
44
44
  var output = [];
45
+ var isWithinMacro = false;
46
+ var macroLength = 0;
45
47
  while (index < input.length) {
46
48
  var char = input.charAt(index);
49
+
50
+ // Reset macro flags -> if we finished parsing the macro block. There can be multiple concecutive macros in a same listItem
51
+ if (isWithinMacro && index === macroLength) {
52
+ isWithinMacro = false;
53
+ macroLength = 0;
54
+ }
47
55
  switch (state) {
48
56
  case processState.NEW_LINE:
49
57
  {
@@ -107,7 +115,8 @@ var list = function list(_ref) {
107
115
 
108
116
  // If we encounter an empty line, we should end the list
109
117
  var emptyLineMatch = substring.match(EMPTY_LINE_REGEXP);
110
- if (emptyLineMatch) {
118
+ // ADFEXP-371 -> We should not end the list if we are inside a macro and we encountered a new line
119
+ if (emptyLineMatch && !isWithinMacro) {
111
120
  state = processState.END;
112
121
  continue;
113
122
  }
@@ -143,33 +152,42 @@ var list = function list(_ref) {
143
152
  if (token.type === 'text') {
144
153
  buffer.push(token.text);
145
154
  } else {
146
- var _contentBuffer3;
147
155
  // We found a macro in the list...
148
156
  if (!builder) {
149
157
  // Something is really wrong here
150
158
  return fallback(input, position);
151
159
  }
152
- if (buffer.length > 0) {
153
- var _contentBuffer2;
154
- /**
155
- * Wrapup what is already in the string buffer and save it to
156
- * contentBuffer
157
- */
158
- var _content = (0, _text.parseString)({
159
- ignoreTokenTypes: ignoreTokenTypes,
160
- schema: schema,
161
- context: context,
162
- input: buffer.join(''),
163
- includeLeadingSpace: true
164
- });
165
- (_contentBuffer2 = contentBuffer).push.apply(_contentBuffer2, (0, _toConsumableArray2.default)(sanitize(_content, schema)));
166
- buffer = [];
160
+ // if (buffer.length > 0) {
161
+ // /**
162
+ // * Wrapup what is already in the string buffer and save it to
163
+ // * contentBuffer
164
+ // */
165
+ // const content = parseString({
166
+ // ignoreTokenTypes,
167
+ // schema,
168
+ // context,
169
+ // input: buffer.join(''),
170
+ // includeLeadingSpace: true,
171
+ // });
172
+ // contentBuffer.push(...sanitize(content, schema));
173
+ // buffer = [];
174
+ // }
175
+
176
+ // contentBuffer.push(...sanitize(token.nodes, schema));
177
+ // }
178
+ // index += token.length;
179
+ // state = processState.BUFFER;
180
+ // continue;
181
+
182
+ // ADFEXP-371 -> check if we encountered a macro and also that we are not inside a macro block already.
183
+ if (token && !isWithinMacro) {
184
+ isWithinMacro = true;
185
+ // macroLength will help to reset the isWithinMacro flag once we have sucessfully parsed entire macro block
186
+ macroLength = index + token.length;
167
187
  }
168
- (_contentBuffer3 = contentBuffer).push.apply(_contentBuffer3, (0, _toConsumableArray2.default)(sanitize(token.nodes, schema)));
169
188
  }
170
- index += token.length;
171
- state = processState.BUFFER;
172
- continue;
189
+ buffer.push(char);
190
+ break;
173
191
  }
174
192
  case processState.END:
175
193
  {
@@ -178,16 +196,16 @@ var list = function list(_ref) {
178
196
  return fallback(input, position);
179
197
  }
180
198
  if (buffer.length > 0) {
181
- var _contentBuffer4;
199
+ var _contentBuffer2;
182
200
  // Wrap up previous list item and clear buffer
183
- var _content2 = (0, _text.parseString)({
201
+ var _content = (0, _text.parseString)({
184
202
  ignoreTokenTypes: ignoreTokenTypes,
185
203
  schema: schema,
186
204
  context: context,
187
205
  input: buffer.join(''),
188
206
  includeLeadingSpace: true
189
207
  });
190
- (_contentBuffer4 = contentBuffer).push.apply(_contentBuffer4, (0, _toConsumableArray2.default)(_content2));
208
+ (_contentBuffer2 = contentBuffer).push.apply(_contentBuffer2, (0, _toConsumableArray2.default)(_content));
191
209
  }
192
210
  builder.add([{
193
211
  style: lastListSymbols,
@@ -204,16 +222,16 @@ var list = function list(_ref) {
204
222
  index++;
205
223
  }
206
224
  if (buffer.length > 0) {
207
- var _contentBuffer5;
225
+ var _contentBuffer3;
208
226
  // Wrap up what's left in the buffer
209
- var _content3 = (0, _text.parseString)({
227
+ var _content2 = (0, _text.parseString)({
210
228
  ignoreTokenTypes: ignoreTokenTypes,
211
229
  schema: schema,
212
230
  context: context,
213
231
  input: buffer.join(''),
214
232
  includeLeadingSpace: true
215
233
  });
216
- (_contentBuffer5 = contentBuffer).push.apply(_contentBuffer5, (0, _toConsumableArray2.default)(_content3));
234
+ (_contentBuffer3 = contentBuffer).push.apply(_contentBuffer3, (0, _toConsumableArray2.default)(_content2));
217
235
  }
218
236
  if (builder) {
219
237
  builder.add([{
@@ -14,7 +14,7 @@ var _panelType = require("../utils/panel-type");
14
14
  var _title = require("../utils/title");
15
15
  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; } } }; }
16
16
  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); }
17
- 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; }
17
+ 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; }
18
18
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
19
19
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
20
20
  var allowedNodeType = ['paragraph', 'heading', 'orderedList', 'bulletList'];
@@ -12,7 +12,7 @@ var _normalize = require("../utils/normalize");
12
12
  var _text2 = require("../text");
13
13
  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; } } }; }
14
14
  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); }
15
- 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; }
15
+ 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; }
16
16
  var quoteMacro = function quoteMacro(_ref) {
17
17
  var input = _ref.input,
18
18
  position = _ref.position,
@@ -12,7 +12,7 @@ var _paragraph = require("../nodes/paragraph");
12
12
  var _tableBuilder = require("../builder/table-builder");
13
13
  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; } } }; }
14
14
  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); }
15
- 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; }
15
+ 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; }
16
16
  function normalizePMNodes(nodes, schema, parentNode) {
17
17
  return [normalizeMediaGroups, normalizeInlineNodes].reduce(function (currentNodes, normFunc) {
18
18
  return normFunc(currentNodes, schema, parentNode);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-wikimarkup-transformer",
3
- "version": "11.1.15",
3
+ "version": "11.1.17",
4
4
  "sideEffects": false
5
5
  }
@@ -9,6 +9,11 @@ export function getType(bullets) {
9
9
  }
10
10
  export class ListBuilder {
11
11
  constructor(schema, bullets) {
12
+ /**
13
+ * Build prosemirror bulletList or orderedList node
14
+ * @param {List} list
15
+ * @returns {PMNode}
16
+ */
12
17
  _defineProperty(this, "parseList", list => {
13
18
  const listNode = this.schema.nodes[list.type];
14
19
  const output = [];
@@ -39,6 +44,12 @@ export class ListBuilder {
39
44
  }
40
45
  return output;
41
46
  });
47
+ /**
48
+ * Build prosemirror listItem node
49
+ * This function would possibly return non listItem nodes
50
+ * which we need to break out later
51
+ * @param {ListItem} item
52
+ */
42
53
  _defineProperty(this, "parseListItem", item => {
43
54
  const output = [];
44
55
  if (!item.content) {
@@ -142,20 +153,6 @@ export class ListBuilder {
142
153
  buildPMNode() {
143
154
  return this.parseList(this.root);
144
155
  }
145
-
146
- /**
147
- * Build prosemirror bulletList or orderedList node
148
- * @param {List} list
149
- * @returns {PMNode}
150
- */
151
-
152
- /**
153
- * Build prosemirror listItem node
154
- * This function would possibly return non listItem nodes
155
- * which we need to break out later
156
- * @param {ListItem} item
157
- */
158
-
159
156
  /* Check if all paragraph's children nodes are text and empty */
160
157
  isParagraphEmptyTextNode(node) {
161
158
  if (node.type.name !== 'paragraph' || !node.childCount) {
@@ -20,6 +20,10 @@ export class TableBuilder {
20
20
  } = this.schema.nodes;
21
21
  return tableRow.createChecked({}, this.emptyTableCell());
22
22
  });
23
+ /**
24
+ * Build prosemirror table node
25
+ * @returns {PMNode}
26
+ */
23
27
  _defineProperty(this, "buildTableNode", () => {
24
28
  const {
25
29
  root
@@ -33,12 +37,21 @@ export class TableBuilder {
33
37
  }
34
38
  return table.createChecked({}, content);
35
39
  });
40
+ /**
41
+ * Build prosemirror tr node
42
+ * @returns {PMNode}
43
+ */
36
44
  _defineProperty(this, "buildTableRowNode", row => {
37
45
  const {
38
46
  tableRow
39
47
  } = this.schema.nodes;
40
48
  return tableRow.createChecked({}, row.cells.map(this.buildTableCellNode));
41
49
  });
50
+ /**
51
+ * Build prosemirror td/th node
52
+ * @param {TableCell} cell
53
+ * @returns {PMNode}
54
+ */
42
55
  _defineProperty(this, "buildTableCellNode", cell => {
43
56
  const {
44
57
  type,
@@ -101,23 +114,6 @@ export class TableBuilder {
101
114
  buildPMNode() {
102
115
  return this.buildTableNode();
103
116
  }
104
-
105
- /**
106
- * Build prosemirror table node
107
- * @returns {PMNode}
108
- */
109
-
110
- /**
111
- * Build prosemirror tr node
112
- * @returns {PMNode}
113
- */
114
-
115
- /**
116
- * Build prosemirror td/th node
117
- * @param {TableCell} cell
118
- * @returns {PMNode}
119
- */
120
-
121
117
  /**
122
118
  * Add a new row to the table
123
119
  */
@@ -28,8 +28,7 @@ import { colorMacro } from './color-macro';
28
28
  import { noformatMacro } from './noformat-macro';
29
29
  import { forceLineBreak } from './force-line-break';
30
30
  import { issueKey } from './issue-key';
31
- export let TokenType; // \\
32
- (function (TokenType) {
31
+ export let TokenType = /*#__PURE__*/function (TokenType) {
33
32
  TokenType["ADF_MACRO"] = "ADF_MACRO";
34
33
  TokenType["ANCHOR_MACRO"] = "ANCHOR_MACRO";
35
34
  TokenType["CODE_MACRO"] = "CODE_MACRO";
@@ -62,7 +61,8 @@ export let TokenType; // \\
62
61
  TokenType["INSERTED"] = "INSERTED";
63
62
  TokenType["EMOJI"] = "EMOJI";
64
63
  TokenType["FORCE_LINE_BREAK"] = "FORCE_LINE_BREAK";
65
- })(TokenType || (TokenType = {}));
64
+ return TokenType;
65
+ }({}); // \\
66
66
  const tokenToTokenParserMapping = {
67
67
  [TokenType.DOUBLE_DASH_SYMBOL]: doubleDashSymbol,
68
68
  [TokenType.TRIPLE_DASH_SYMBOL]: tripleDashSymbol,
@@ -33,8 +33,16 @@ export const list = ({
33
33
  let builder = null;
34
34
  let contentBuffer = [];
35
35
  const output = [];
36
+ let isWithinMacro = false;
37
+ let macroLength = 0;
36
38
  while (index < input.length) {
37
39
  const char = input.charAt(index);
40
+
41
+ // Reset macro flags -> if we finished parsing the macro block. There can be multiple concecutive macros in a same listItem
42
+ if (isWithinMacro && index === macroLength) {
43
+ isWithinMacro = false;
44
+ macroLength = 0;
45
+ }
38
46
  switch (state) {
39
47
  case processState.NEW_LINE:
40
48
  {
@@ -96,7 +104,8 @@ export const list = ({
96
104
 
97
105
  // If we encounter an empty line, we should end the list
98
106
  const emptyLineMatch = substring.match(EMPTY_LINE_REGEXP);
99
- if (emptyLineMatch) {
107
+ // ADFEXP-371 -> We should not end the list if we are inside a macro and we encountered a new line
108
+ if (emptyLineMatch && !isWithinMacro) {
100
109
  state = processState.END;
101
110
  continue;
102
111
  }
@@ -137,26 +146,37 @@ export const list = ({
137
146
  // Something is really wrong here
138
147
  return fallback(input, position);
139
148
  }
140
- if (buffer.length > 0) {
141
- /**
142
- * Wrapup what is already in the string buffer and save it to
143
- * contentBuffer
144
- */
145
- const content = parseString({
146
- ignoreTokenTypes,
147
- schema,
148
- context,
149
- input: buffer.join(''),
150
- includeLeadingSpace: true
151
- });
152
- contentBuffer.push(...sanitize(content, schema));
153
- buffer = [];
149
+ // if (buffer.length > 0) {
150
+ // /**
151
+ // * Wrapup what is already in the string buffer and save it to
152
+ // * contentBuffer
153
+ // */
154
+ // const content = parseString({
155
+ // ignoreTokenTypes,
156
+ // schema,
157
+ // context,
158
+ // input: buffer.join(''),
159
+ // includeLeadingSpace: true,
160
+ // });
161
+ // contentBuffer.push(...sanitize(content, schema));
162
+ // buffer = [];
163
+ // }
164
+
165
+ // contentBuffer.push(...sanitize(token.nodes, schema));
166
+ // }
167
+ // index += token.length;
168
+ // state = processState.BUFFER;
169
+ // continue;
170
+
171
+ // ADFEXP-371 -> check if we encountered a macro and also that we are not inside a macro block already.
172
+ if (token && !isWithinMacro) {
173
+ isWithinMacro = true;
174
+ // macroLength will help to reset the isWithinMacro flag once we have sucessfully parsed entire macro block
175
+ macroLength = index + token.length;
154
176
  }
155
- contentBuffer.push(...sanitize(token.nodes, schema));
156
177
  }
157
- index += token.length;
158
- state = processState.BUFFER;
159
- continue;
178
+ buffer.push(char);
179
+ break;
160
180
  }
161
181
  case processState.END:
162
182
  {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-wikimarkup-transformer",
3
- "version": "11.1.15",
3
+ "version": "11.1.17",
4
4
  "sideEffects": false
5
5
  }
@@ -4,7 +4,7 @@ import _createClass from "@babel/runtime/helpers/createClass";
4
4
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
5
  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; } } }; }
6
6
  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); }
7
- 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; }
7
+ 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; }
8
8
  var supportedContentType = ['paragraph', 'orderedList', 'bulletList', 'mediaSingle', 'codeBlock'];
9
9
 
10
10
  /**
@@ -17,6 +17,11 @@ export var ListBuilder = /*#__PURE__*/function () {
17
17
  function ListBuilder(schema, bullets) {
18
18
  var _this = this;
19
19
  _classCallCheck(this, ListBuilder);
20
+ /**
21
+ * Build prosemirror bulletList or orderedList node
22
+ * @param {List} list
23
+ * @returns {PMNode}
24
+ */
20
25
  _defineProperty(this, "parseList", function (list) {
21
26
  var listNode = _this.schema.nodes[list.type];
22
27
  var output = [];
@@ -47,6 +52,12 @@ export var ListBuilder = /*#__PURE__*/function () {
47
52
  }
48
53
  return output;
49
54
  });
55
+ /**
56
+ * Build prosemirror listItem node
57
+ * This function would possibly return non listItem nodes
58
+ * which we need to break out later
59
+ * @param {ListItem} item
60
+ */
50
61
  _defineProperty(this, "parseListItem", function (item) {
51
62
  var _item$content;
52
63
  var output = [];
@@ -164,19 +175,6 @@ export var ListBuilder = /*#__PURE__*/function () {
164
175
  value: function buildPMNode() {
165
176
  return this.parseList(this.root);
166
177
  }
167
-
168
- /**
169
- * Build prosemirror bulletList or orderedList node
170
- * @param {List} list
171
- * @returns {PMNode}
172
- */
173
-
174
- /**
175
- * Build prosemirror listItem node
176
- * This function would possibly return non listItem nodes
177
- * which we need to break out later
178
- * @param {ListItem} item
179
- */
180
178
  }, {
181
179
  key: "isParagraphEmptyTextNode",
182
180
  value: /* Check if all paragraph's children nodes are text and empty */
@@ -3,7 +3,7 @@ import _createClass from "@babel/runtime/helpers/createClass";
3
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
4
  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; } } }; }
5
5
  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); }
6
- 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
+ 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; }
7
7
  /**
8
8
  * Return the cell type based on the delimeter
9
9
  */
@@ -24,6 +24,10 @@ export var TableBuilder = /*#__PURE__*/function () {
24
24
  var tableRow = _this.schema.nodes.tableRow;
25
25
  return tableRow.createChecked({}, _this.emptyTableCell());
26
26
  });
27
+ /**
28
+ * Build prosemirror table node
29
+ * @returns {PMNode}
30
+ */
27
31
  _defineProperty(this, "buildTableNode", function () {
28
32
  var root = _this.root;
29
33
  var table = _this.schema.nodes.table;
@@ -33,10 +37,19 @@ export var TableBuilder = /*#__PURE__*/function () {
33
37
  }
34
38
  return table.createChecked({}, content);
35
39
  });
40
+ /**
41
+ * Build prosemirror tr node
42
+ * @returns {PMNode}
43
+ */
36
44
  _defineProperty(this, "buildTableRowNode", function (row) {
37
45
  var tableRow = _this.schema.nodes.tableRow;
38
46
  return tableRow.createChecked({}, row.cells.map(_this.buildTableCellNode));
39
47
  });
48
+ /**
49
+ * Build prosemirror td/th node
50
+ * @param {TableCell} cell
51
+ * @returns {PMNode}
52
+ */
40
53
  _defineProperty(this, "buildTableCellNode", function (cell) {
41
54
  var type = cell.type,
42
55
  content = cell.content;
@@ -110,22 +123,6 @@ export var TableBuilder = /*#__PURE__*/function () {
110
123
  value: function buildPMNode() {
111
124
  return this.buildTableNode();
112
125
  }
113
-
114
- /**
115
- * Build prosemirror table node
116
- * @returns {PMNode}
117
- */
118
-
119
- /**
120
- * Build prosemirror tr node
121
- * @returns {PMNode}
122
- */
123
-
124
- /**
125
- * Build prosemirror td/th node
126
- * @param {TableCell} cell
127
- * @returns {PMNode}
128
- */
129
126
  }, {
130
127
  key: "addRow",
131
128
  value:
@@ -30,8 +30,7 @@ import { colorMacro } from './color-macro';
30
30
  import { noformatMacro } from './noformat-macro';
31
31
  import { forceLineBreak } from './force-line-break';
32
32
  import { issueKey } from './issue-key';
33
- export var TokenType; // \\
34
- (function (TokenType) {
33
+ export var TokenType = /*#__PURE__*/function (TokenType) {
35
34
  TokenType["ADF_MACRO"] = "ADF_MACRO";
36
35
  TokenType["ANCHOR_MACRO"] = "ANCHOR_MACRO";
37
36
  TokenType["CODE_MACRO"] = "CODE_MACRO";
@@ -64,7 +63,8 @@ export var TokenType; // \\
64
63
  TokenType["INSERTED"] = "INSERTED";
65
64
  TokenType["EMOJI"] = "EMOJI";
66
65
  TokenType["FORCE_LINE_BREAK"] = "FORCE_LINE_BREAK";
67
- })(TokenType || (TokenType = {}));
66
+ return TokenType;
67
+ }({}); // \\
68
68
  var tokenToTokenParserMapping = (_tokenToTokenParserMa = {}, _defineProperty(_tokenToTokenParserMa, TokenType.DOUBLE_DASH_SYMBOL, doubleDashSymbol), _defineProperty(_tokenToTokenParserMa, TokenType.TRIPLE_DASH_SYMBOL, tripleDashSymbol), _defineProperty(_tokenToTokenParserMa, TokenType.QUADRUPLE_DASH_SYMBOL, quadrupleDashSymbol), _defineProperty(_tokenToTokenParserMa, TokenType.RULER, ruler), _defineProperty(_tokenToTokenParserMa, TokenType.STRONG, strong), _defineProperty(_tokenToTokenParserMa, TokenType.MONOSPACE, monospace), _defineProperty(_tokenToTokenParserMa, TokenType.SUPERSCRIPT, superscript), _defineProperty(_tokenToTokenParserMa, TokenType.SUBSCRIPT, subscript), _defineProperty(_tokenToTokenParserMa, TokenType.EMPHASIS, emphasis), _defineProperty(_tokenToTokenParserMa, TokenType.CITATION, citation), _defineProperty(_tokenToTokenParserMa, TokenType.DELETED, deleted), _defineProperty(_tokenToTokenParserMa, TokenType.INSERTED, inserted), _defineProperty(_tokenToTokenParserMa, TokenType.HARD_BREAK, hardbreak), _defineProperty(_tokenToTokenParserMa, TokenType.LINK_FORMAT, linkFormat), _defineProperty(_tokenToTokenParserMa, TokenType.LINK_TEXT, linkText), _defineProperty(_tokenToTokenParserMa, TokenType.HEADING, heading), _defineProperty(_tokenToTokenParserMa, TokenType.MEDIA, media), _defineProperty(_tokenToTokenParserMa, TokenType.LIST, list), _defineProperty(_tokenToTokenParserMa, TokenType.QUOTE, blockquote), _defineProperty(_tokenToTokenParserMa, TokenType.TABLE, table), _defineProperty(_tokenToTokenParserMa, TokenType.EMOJI, emoji), _defineProperty(_tokenToTokenParserMa, TokenType.ADF_MACRO, adfMacro), _defineProperty(_tokenToTokenParserMa, TokenType.ANCHOR_MACRO, anchorMacro), _defineProperty(_tokenToTokenParserMa, TokenType.CODE_MACRO, codeMacro), _defineProperty(_tokenToTokenParserMa, TokenType.QUOTE_MACRO, quoteMacro), _defineProperty(_tokenToTokenParserMa, TokenType.NOFORMAT_MACRO, noformatMacro), _defineProperty(_tokenToTokenParserMa, TokenType.PANEL_MACRO, panelMacro), _defineProperty(_tokenToTokenParserMa, TokenType.COLOR_MACRO, colorMacro), _defineProperty(_tokenToTokenParserMa, TokenType.FORCE_LINE_BREAK, forceLineBreak), _defineProperty(_tokenToTokenParserMa, TokenType.ISSUE_KEY, issueKey), _tokenToTokenParserMa);
69
69
  export function parseToken(input, type, position, schema, context) {
70
70
  var tokenParser = tokenToTokenParserMapping[type];
@@ -1,6 +1,6 @@
1
1
  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; } } }; }
2
2
  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); }
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; }
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 { mentionLinkResolver } from './mention-link';
5
5
  import { attachmentLinkResolver } from './attachment-link';
6
6
  import { urlLinkResolver } from './url-link';
@@ -34,8 +34,16 @@ export var list = function list(_ref) {
34
34
  var builder = null;
35
35
  var contentBuffer = [];
36
36
  var output = [];
37
+ var isWithinMacro = false;
38
+ var macroLength = 0;
37
39
  while (index < input.length) {
38
40
  var char = input.charAt(index);
41
+
42
+ // Reset macro flags -> if we finished parsing the macro block. There can be multiple concecutive macros in a same listItem
43
+ if (isWithinMacro && index === macroLength) {
44
+ isWithinMacro = false;
45
+ macroLength = 0;
46
+ }
39
47
  switch (state) {
40
48
  case processState.NEW_LINE:
41
49
  {
@@ -99,7 +107,8 @@ export var list = function list(_ref) {
99
107
 
100
108
  // If we encounter an empty line, we should end the list
101
109
  var emptyLineMatch = substring.match(EMPTY_LINE_REGEXP);
102
- if (emptyLineMatch) {
110
+ // ADFEXP-371 -> We should not end the list if we are inside a macro and we encountered a new line
111
+ if (emptyLineMatch && !isWithinMacro) {
103
112
  state = processState.END;
104
113
  continue;
105
114
  }
@@ -135,33 +144,42 @@ export var list = function list(_ref) {
135
144
  if (token.type === 'text') {
136
145
  buffer.push(token.text);
137
146
  } else {
138
- var _contentBuffer3;
139
147
  // We found a macro in the list...
140
148
  if (!builder) {
141
149
  // Something is really wrong here
142
150
  return fallback(input, position);
143
151
  }
144
- if (buffer.length > 0) {
145
- var _contentBuffer2;
146
- /**
147
- * Wrapup what is already in the string buffer and save it to
148
- * contentBuffer
149
- */
150
- var _content = parseString({
151
- ignoreTokenTypes: ignoreTokenTypes,
152
- schema: schema,
153
- context: context,
154
- input: buffer.join(''),
155
- includeLeadingSpace: true
156
- });
157
- (_contentBuffer2 = contentBuffer).push.apply(_contentBuffer2, _toConsumableArray(sanitize(_content, schema)));
158
- buffer = [];
152
+ // if (buffer.length > 0) {
153
+ // /**
154
+ // * Wrapup what is already in the string buffer and save it to
155
+ // * contentBuffer
156
+ // */
157
+ // const content = parseString({
158
+ // ignoreTokenTypes,
159
+ // schema,
160
+ // context,
161
+ // input: buffer.join(''),
162
+ // includeLeadingSpace: true,
163
+ // });
164
+ // contentBuffer.push(...sanitize(content, schema));
165
+ // buffer = [];
166
+ // }
167
+
168
+ // contentBuffer.push(...sanitize(token.nodes, schema));
169
+ // }
170
+ // index += token.length;
171
+ // state = processState.BUFFER;
172
+ // continue;
173
+
174
+ // ADFEXP-371 -> check if we encountered a macro and also that we are not inside a macro block already.
175
+ if (token && !isWithinMacro) {
176
+ isWithinMacro = true;
177
+ // macroLength will help to reset the isWithinMacro flag once we have sucessfully parsed entire macro block
178
+ macroLength = index + token.length;
159
179
  }
160
- (_contentBuffer3 = contentBuffer).push.apply(_contentBuffer3, _toConsumableArray(sanitize(token.nodes, schema)));
161
180
  }
162
- index += token.length;
163
- state = processState.BUFFER;
164
- continue;
181
+ buffer.push(char);
182
+ break;
165
183
  }
166
184
  case processState.END:
167
185
  {
@@ -170,16 +188,16 @@ export var list = function list(_ref) {
170
188
  return fallback(input, position);
171
189
  }
172
190
  if (buffer.length > 0) {
173
- var _contentBuffer4;
191
+ var _contentBuffer2;
174
192
  // Wrap up previous list item and clear buffer
175
- var _content2 = parseString({
193
+ var _content = parseString({
176
194
  ignoreTokenTypes: ignoreTokenTypes,
177
195
  schema: schema,
178
196
  context: context,
179
197
  input: buffer.join(''),
180
198
  includeLeadingSpace: true
181
199
  });
182
- (_contentBuffer4 = contentBuffer).push.apply(_contentBuffer4, _toConsumableArray(_content2));
200
+ (_contentBuffer2 = contentBuffer).push.apply(_contentBuffer2, _toConsumableArray(_content));
183
201
  }
184
202
  builder.add([{
185
203
  style: lastListSymbols,
@@ -196,16 +214,16 @@ export var list = function list(_ref) {
196
214
  index++;
197
215
  }
198
216
  if (buffer.length > 0) {
199
- var _contentBuffer5;
217
+ var _contentBuffer3;
200
218
  // Wrap up what's left in the buffer
201
- var _content3 = parseString({
219
+ var _content2 = parseString({
202
220
  ignoreTokenTypes: ignoreTokenTypes,
203
221
  schema: schema,
204
222
  context: context,
205
223
  input: buffer.join(''),
206
224
  includeLeadingSpace: true
207
225
  });
208
- (_contentBuffer5 = contentBuffer).push.apply(_contentBuffer5, _toConsumableArray(_content3));
226
+ (_contentBuffer3 = contentBuffer).push.apply(_contentBuffer3, _toConsumableArray(_content2));
209
227
  }
210
228
  if (builder) {
211
229
  builder.add([{
@@ -1,7 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  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; } } }; }
3
3
  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); }
4
- 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
+ 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; }
5
5
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6
6
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7
7
  import { commonMacro } from './common-macro';
@@ -1,7 +1,7 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  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; } } }; }
3
3
  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); }
4
- 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
+ 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; }
5
5
  import { commonMacro } from './common-macro';
6
6
  import { hasAnyOfMarks } from '../utils/text';
7
7
  import { normalizePMNodes } from '../utils/normalize';
@@ -1,7 +1,7 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  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; } } }; }
3
3
  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); }
4
- 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
+ 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; }
5
5
  import { createParagraphNodeFromInlineNodes, createEmptyParagraphNode } from '../nodes/paragraph';
6
6
  import { TableBuilder } from '../builder/table-builder';
7
7
  export function normalizePMNodes(nodes, schema, parentNode) {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-wikimarkup-transformer",
3
- "version": "11.1.15",
3
+ "version": "11.1.17",
4
4
  "sideEffects": false
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-wikimarkup-transformer",
3
- "version": "11.1.15",
3
+ "version": "11.1.17",
4
4
  "description": "Wiki markup transformer for JIRA and Confluence",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -33,8 +33,8 @@
33
33
  "devDependencies": {
34
34
  "@atlaskit/activity": "^1.0.1",
35
35
  "@atlaskit/docs": "*",
36
- "@atlaskit/editor-common": "^72.9.0",
37
- "@atlaskit/editor-core": "^182.1.0",
36
+ "@atlaskit/editor-common": "^73.0.0",
37
+ "@atlaskit/editor-core": "^182.2.0",
38
38
  "@atlaskit/editor-test-helpers": "^18.2.0",
39
39
  "@atlaskit/mention": "^22.0.0",
40
40
  "@atlaskit/profilecard": "^19.2.0",