@atlaskit/editor-wikimarkup-transformer 11.0.7 → 11.0.10
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 +19 -0
- package/dist/cjs/parser/tokenize/citation.js +6 -2
- package/dist/cjs/parser/tokenize/deleted.js +6 -2
- package/dist/cjs/parser/tokenize/emphasis.js +6 -2
- package/dist/cjs/parser/tokenize/inserted.js +6 -2
- package/dist/cjs/parser/tokenize/keyword.js +8 -0
- package/dist/cjs/parser/tokenize/link-text.js +6 -6
- package/dist/cjs/parser/tokenize/monospace.js +10 -4
- package/dist/cjs/parser/tokenize/strong.js +6 -2
- package/dist/cjs/parser/tokenize/subscript.js +6 -2
- package/dist/cjs/parser/tokenize/superscript.js +6 -2
- package/dist/cjs/parser/utils/text.js +18 -2
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/parser/tokenize/citation.js +7 -3
- package/dist/es2019/parser/tokenize/deleted.js +7 -3
- package/dist/es2019/parser/tokenize/emphasis.js +7 -3
- package/dist/es2019/parser/tokenize/inserted.js +7 -3
- package/dist/es2019/parser/tokenize/keyword.js +8 -0
- package/dist/es2019/parser/tokenize/link-text.js +6 -6
- package/dist/es2019/parser/tokenize/monospace.js +7 -2
- package/dist/es2019/parser/tokenize/strong.js +7 -3
- package/dist/es2019/parser/tokenize/subscript.js +7 -3
- package/dist/es2019/parser/tokenize/superscript.js +7 -3
- package/dist/es2019/parser/utils/text.js +14 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/parser/tokenize/citation.js +7 -3
- package/dist/esm/parser/tokenize/deleted.js +7 -3
- package/dist/esm/parser/tokenize/emphasis.js +7 -3
- package/dist/esm/parser/tokenize/inserted.js +7 -3
- package/dist/esm/parser/tokenize/keyword.js +8 -0
- package/dist/esm/parser/tokenize/link-text.js +6 -6
- package/dist/esm/parser/tokenize/monospace.js +7 -2
- package/dist/esm/parser/tokenize/strong.js +7 -3
- package/dist/esm/parser/tokenize/subscript.js +7 -3
- package/dist/esm/parser/tokenize/superscript.js +7 -3
- package/dist/esm/parser/utils/text.js +14 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/parser/utils/text.d.ts +4 -0
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/editor-wikimarkup-transformer
|
|
2
2
|
|
|
3
|
+
## 11.0.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`c0315117480`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c0315117480) - ESS-2375 Text effects should support surrounding curly braces
|
|
8
|
+
|
|
9
|
+
## 11.0.9
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`daa1dac9961`](https://bitbucket.org/atlassian/atlassian-frontend/commits/daa1dac9961) - Update the @atlaskit/editor-wikimarkup-transformer to use emotion instead of styled and also updated the dependencies
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
16
|
+
## 11.0.8
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- [`ca8996c6153`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ca8996c6153) - ESS-2439 Remove bad characters from end of regex match
|
|
21
|
+
|
|
3
22
|
## 11.0.7
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -60,9 +60,13 @@ var citation = function citation(_ref) {
|
|
|
60
60
|
};
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
+
var _getSurroundingSymbol = (0, _text.getSurroundingSymbols)(input.substring(position), '??', '??'),
|
|
64
|
+
openingSymbol = _getSurroundingSymbol.openingSymbol,
|
|
65
|
+
closingSymbol = _getSurroundingSymbol.closingSymbol;
|
|
66
|
+
|
|
63
67
|
return (0, _commonFormatter.commonFormatter)(input, position, schema, {
|
|
64
|
-
opening:
|
|
65
|
-
closing:
|
|
68
|
+
opening: openingSymbol,
|
|
69
|
+
closing: closingSymbol,
|
|
66
70
|
context: context,
|
|
67
71
|
rawContentProcessor: rawContentProcessor
|
|
68
72
|
});
|
|
@@ -55,9 +55,13 @@ var deleted = function deleted(_ref) {
|
|
|
55
55
|
};
|
|
56
56
|
};
|
|
57
57
|
|
|
58
|
+
var _getSurroundingSymbol = (0, _text.getSurroundingSymbols)(input.substring(position), '-', '-'),
|
|
59
|
+
openingSymbol = _getSurroundingSymbol.openingSymbol,
|
|
60
|
+
closingSymbol = _getSurroundingSymbol.closingSymbol;
|
|
61
|
+
|
|
58
62
|
return (0, _commonFormatter.commonFormatter)(input, position, schema, {
|
|
59
|
-
opening:
|
|
60
|
-
closing:
|
|
63
|
+
opening: openingSymbol,
|
|
64
|
+
closing: closingSymbol,
|
|
61
65
|
context: context,
|
|
62
66
|
rawContentProcessor: rawContentProcessor
|
|
63
67
|
});
|
|
@@ -54,9 +54,13 @@ var emphasis = function emphasis(_ref) {
|
|
|
54
54
|
};
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
+
var _getSurroundingSymbol = (0, _text.getSurroundingSymbols)(input.substring(position), '_', '_'),
|
|
58
|
+
openingSymbol = _getSurroundingSymbol.openingSymbol,
|
|
59
|
+
closingSymbol = _getSurroundingSymbol.closingSymbol;
|
|
60
|
+
|
|
57
61
|
return (0, _commonFormatter.commonFormatter)(input, position, schema, {
|
|
58
|
-
opening:
|
|
59
|
-
closing:
|
|
62
|
+
opening: openingSymbol,
|
|
63
|
+
closing: closingSymbol,
|
|
60
64
|
context: context,
|
|
61
65
|
rawContentProcessor: rawContentProcessor
|
|
62
66
|
});
|
|
@@ -54,9 +54,13 @@ var inserted = function inserted(_ref) {
|
|
|
54
54
|
};
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
+
var _getSurroundingSymbol = (0, _text.getSurroundingSymbols)(input.substring(position), '+', '+'),
|
|
58
|
+
openingSymbol = _getSurroundingSymbol.openingSymbol,
|
|
59
|
+
closingSymbol = _getSurroundingSymbol.closingSymbol;
|
|
60
|
+
|
|
57
61
|
return (0, _commonFormatter.commonFormatter)(input, position, schema, {
|
|
58
|
-
opening:
|
|
59
|
-
closing:
|
|
62
|
+
opening: openingSymbol,
|
|
63
|
+
closing: closingSymbol,
|
|
60
64
|
context: context,
|
|
61
65
|
rawContentProcessor: rawContentProcessor
|
|
62
66
|
});
|
|
@@ -56,6 +56,14 @@ var keywordTokenMap = {
|
|
|
56
56
|
'----': _.TokenType.QUADRUPLE_DASH_SYMBOL,
|
|
57
57
|
'---': _.TokenType.TRIPLE_DASH_SYMBOL,
|
|
58
58
|
'--': _.TokenType.DOUBLE_DASH_SYMBOL,
|
|
59
|
+
'{-}': _.TokenType.DELETED,
|
|
60
|
+
'{+}': _.TokenType.INSERTED,
|
|
61
|
+
'{*}': _.TokenType.STRONG,
|
|
62
|
+
'{^}': _.TokenType.SUPERSCRIPT,
|
|
63
|
+
'{~}': _.TokenType.SUBSCRIPT,
|
|
64
|
+
'{_}': _.TokenType.EMPHASIS,
|
|
65
|
+
'{{{}': _.TokenType.MONOSPACE,
|
|
66
|
+
'{??}': _.TokenType.CITATION,
|
|
59
67
|
'-': _.TokenType.DELETED,
|
|
60
68
|
'+': _.TokenType.INSERTED,
|
|
61
69
|
'*': _.TokenType.STRONG,
|
|
@@ -21,10 +21,9 @@ var linkText = function linkText(_ref) {
|
|
|
21
21
|
|
|
22
22
|
if (!match) {
|
|
23
23
|
return fallback(input, position);
|
|
24
|
-
}
|
|
25
|
-
|
|
24
|
+
}
|
|
26
25
|
|
|
27
|
-
match =
|
|
26
|
+
match = trimBadEndChar(match); // Remove mailto:
|
|
28
27
|
|
|
29
28
|
var textRepresentation = match[1] === 'mailto:' ? match[2] : match[0]; // parse and correctly encode any illegal characters, and
|
|
30
29
|
// so no longer need to be encoded when used below
|
|
@@ -76,8 +75,9 @@ function fallback(input, position) {
|
|
|
76
75
|
text: input.substr(position, 1),
|
|
77
76
|
length: 1
|
|
78
77
|
};
|
|
79
|
-
}
|
|
78
|
+
} // removes bad characters from the end of regex match
|
|
79
|
+
|
|
80
80
|
|
|
81
|
-
function
|
|
82
|
-
return input[0].
|
|
81
|
+
function trimBadEndChar(input) {
|
|
82
|
+
return [input[0].replace(/[.,>)\];}"\'!]*$/, ''), input[1], input[2].replace(/[.,>)\];}"\'!]*$/, '')];
|
|
83
83
|
}
|
|
@@ -7,9 +7,11 @@ exports.monospace = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _ = require("./");
|
|
9
9
|
|
|
10
|
+
var _text = require("../utils/text");
|
|
11
|
+
|
|
10
12
|
var _commonFormatter = require("./common-formatter");
|
|
11
13
|
|
|
12
|
-
var
|
|
14
|
+
var _text2 = require("../text");
|
|
13
15
|
|
|
14
16
|
var monospace = function monospace(_ref) {
|
|
15
17
|
var input = _ref.input,
|
|
@@ -34,7 +36,7 @@ var monospace = function monospace(_ref) {
|
|
|
34
36
|
};
|
|
35
37
|
|
|
36
38
|
var rawContentProcessor = function rawContentProcessor(raw, length) {
|
|
37
|
-
var content = (0,
|
|
39
|
+
var content = (0, _text2.parseString)({
|
|
38
40
|
ignoreTokenTypes: ignoreTokenTypes,
|
|
39
41
|
schema: schema,
|
|
40
42
|
context: context,
|
|
@@ -48,9 +50,13 @@ var monospace = function monospace(_ref) {
|
|
|
48
50
|
};
|
|
49
51
|
};
|
|
50
52
|
|
|
53
|
+
var _getSurroundingSymbol = (0, _text.getSurroundingSymbols)(input.substring(position), '{{', '}}'),
|
|
54
|
+
openingSymbol = _getSurroundingSymbol.openingSymbol,
|
|
55
|
+
closingSymbol = _getSurroundingSymbol.closingSymbol;
|
|
56
|
+
|
|
51
57
|
return (0, _commonFormatter.commonFormatter)(input, position, schema, {
|
|
52
|
-
opening:
|
|
53
|
-
closing:
|
|
58
|
+
opening: openingSymbol,
|
|
59
|
+
closing: closingSymbol,
|
|
54
60
|
context: context,
|
|
55
61
|
rawContentProcessor: rawContentProcessor
|
|
56
62
|
});
|
|
@@ -54,9 +54,13 @@ var strong = function strong(_ref) {
|
|
|
54
54
|
};
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
+
var _getSurroundingSymbol = (0, _text.getSurroundingSymbols)(input.substring(position), '*', '*'),
|
|
58
|
+
openingSymbol = _getSurroundingSymbol.openingSymbol,
|
|
59
|
+
closingSymbol = _getSurroundingSymbol.closingSymbol;
|
|
60
|
+
|
|
57
61
|
return (0, _commonFormatter.commonFormatter)(input, position, schema, {
|
|
58
|
-
opening:
|
|
59
|
-
closing:
|
|
62
|
+
opening: openingSymbol,
|
|
63
|
+
closing: closingSymbol,
|
|
60
64
|
context: context,
|
|
61
65
|
rawContentProcessor: rawContentProcessor
|
|
62
66
|
});
|
|
@@ -56,9 +56,13 @@ var subscript = function subscript(_ref) {
|
|
|
56
56
|
};
|
|
57
57
|
};
|
|
58
58
|
|
|
59
|
+
var _getSurroundingSymbol = (0, _text.getSurroundingSymbols)(input.substring(position), '~', '~'),
|
|
60
|
+
openingSymbol = _getSurroundingSymbol.openingSymbol,
|
|
61
|
+
closingSymbol = _getSurroundingSymbol.closingSymbol;
|
|
62
|
+
|
|
59
63
|
return (0, _commonFormatter.commonFormatter)(input, position, schema, {
|
|
60
|
-
opening:
|
|
61
|
-
closing:
|
|
64
|
+
opening: openingSymbol,
|
|
65
|
+
closing: closingSymbol,
|
|
62
66
|
context: context,
|
|
63
67
|
rawContentProcessor: rawContentProcessor
|
|
64
68
|
});
|
|
@@ -56,9 +56,13 @@ var superscript = function superscript(_ref) {
|
|
|
56
56
|
};
|
|
57
57
|
};
|
|
58
58
|
|
|
59
|
+
var _getSurroundingSymbol = (0, _text.getSurroundingSymbols)(input.substring(position), '^', '^'),
|
|
60
|
+
openingSymbol = _getSurroundingSymbol.openingSymbol,
|
|
61
|
+
closingSymbol = _getSurroundingSymbol.closingSymbol;
|
|
62
|
+
|
|
59
63
|
return (0, _commonFormatter.commonFormatter)(input, position, schema, {
|
|
60
|
-
opening:
|
|
61
|
-
closing:
|
|
64
|
+
opening: openingSymbol,
|
|
65
|
+
closing: closingSymbol,
|
|
62
66
|
context: context,
|
|
63
67
|
rawContentProcessor: rawContentProcessor
|
|
64
68
|
});
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.StringBuffer = void 0;
|
|
8
|
+
exports.getSurroundingSymbols = exports.StringBuffer = void 0;
|
|
9
9
|
exports.hasAnyOfMarks = hasAnyOfMarks;
|
|
10
10
|
exports.isBlank = isBlank;
|
|
11
11
|
exports.isDigit = isDigit;
|
|
@@ -36,8 +36,24 @@ function isBlank(value) {
|
|
|
36
36
|
|
|
37
37
|
function isNotBlank(value) {
|
|
38
38
|
return !isBlank(value);
|
|
39
|
-
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* ESS-2375 Returns the beginning and closing symbol to parse a token
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
var getSurroundingSymbols = function getSurroundingSymbols(trimmedInput, openingText, closingText) {
|
|
46
|
+
var openingSymbol = trimmedInput.startsWith("{".concat(openingText, "}")) ? "{".concat(openingText, "}") : openingText;
|
|
47
|
+
var endIndex = trimmedInput.indexOf(closingText, openingSymbol === "{".concat(openingText, "}") ? openingText.length + 2 : openingText.length);
|
|
48
|
+
var closingSymbol = endIndex > -1 && trimmedInput.charAt(endIndex - 1) === '{' && trimmedInput.charAt(endIndex + closingText.length) === '}' ? "{".concat(closingText, "}") : closingText;
|
|
49
|
+
return {
|
|
50
|
+
openingSymbol: openingSymbol,
|
|
51
|
+
closingSymbol: closingSymbol
|
|
52
|
+
};
|
|
53
|
+
}; // TODO This is using strings which makes it potentially a performance bottleneck
|
|
54
|
+
|
|
40
55
|
|
|
56
|
+
exports.getSurroundingSymbols = getSurroundingSymbols;
|
|
41
57
|
|
|
42
58
|
var StringBuffer = /*#__PURE__*/function () {
|
|
43
59
|
function StringBuffer() {
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TokenType } from './';
|
|
2
|
-
import { hasAnyOfMarks } from '../utils/text';
|
|
2
|
+
import { hasAnyOfMarks, getSurroundingSymbols } from '../utils/text';
|
|
3
3
|
import { commonFormatter } from './common-formatter';
|
|
4
4
|
import { parseString } from '../text';
|
|
5
5
|
import { EM_DASH } from '../../char';
|
|
@@ -44,9 +44,13 @@ export const citation = ({
|
|
|
44
44
|
};
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
+
const {
|
|
48
|
+
openingSymbol,
|
|
49
|
+
closingSymbol
|
|
50
|
+
} = getSurroundingSymbols(input.substring(position), '??', '??');
|
|
47
51
|
return commonFormatter(input, position, schema, {
|
|
48
|
-
opening:
|
|
49
|
-
closing:
|
|
52
|
+
opening: openingSymbol,
|
|
53
|
+
closing: closingSymbol,
|
|
50
54
|
context,
|
|
51
55
|
rawContentProcessor
|
|
52
56
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TokenType } from './';
|
|
2
|
-
import { hasAnyOfMarks } from '../utils/text';
|
|
2
|
+
import { hasAnyOfMarks, getSurroundingSymbols } from '../utils/text';
|
|
3
3
|
import { commonFormatter } from './common-formatter';
|
|
4
4
|
import { parseString } from '../text';
|
|
5
5
|
export const deleted = ({
|
|
@@ -40,9 +40,13 @@ export const deleted = ({
|
|
|
40
40
|
};
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
+
const {
|
|
44
|
+
openingSymbol,
|
|
45
|
+
closingSymbol
|
|
46
|
+
} = getSurroundingSymbols(input.substring(position), '-', '-');
|
|
43
47
|
return commonFormatter(input, position, schema, {
|
|
44
|
-
opening:
|
|
45
|
-
closing:
|
|
48
|
+
opening: openingSymbol,
|
|
49
|
+
closing: closingSymbol,
|
|
46
50
|
context,
|
|
47
51
|
rawContentProcessor
|
|
48
52
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TokenType } from './';
|
|
2
|
-
import { hasAnyOfMarks } from '../utils/text';
|
|
2
|
+
import { hasAnyOfMarks, getSurroundingSymbols } from '../utils/text';
|
|
3
3
|
import { commonFormatter } from './common-formatter';
|
|
4
4
|
import { parseString } from '../text';
|
|
5
5
|
export const emphasis = ({
|
|
@@ -39,9 +39,13 @@ export const emphasis = ({
|
|
|
39
39
|
};
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
+
const {
|
|
43
|
+
openingSymbol,
|
|
44
|
+
closingSymbol
|
|
45
|
+
} = getSurroundingSymbols(input.substring(position), '_', '_');
|
|
42
46
|
return commonFormatter(input, position, schema, {
|
|
43
|
-
opening:
|
|
44
|
-
closing:
|
|
47
|
+
opening: openingSymbol,
|
|
48
|
+
closing: closingSymbol,
|
|
45
49
|
context,
|
|
46
50
|
rawContentProcessor
|
|
47
51
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TokenType } from './';
|
|
2
|
-
import { hasAnyOfMarks } from '../utils/text';
|
|
2
|
+
import { hasAnyOfMarks, getSurroundingSymbols } from '../utils/text';
|
|
3
3
|
import { commonFormatter } from './common-formatter';
|
|
4
4
|
import { parseString } from '../text';
|
|
5
5
|
export const inserted = ({
|
|
@@ -39,9 +39,13 @@ export const inserted = ({
|
|
|
39
39
|
};
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
+
const {
|
|
43
|
+
openingSymbol,
|
|
44
|
+
closingSymbol
|
|
45
|
+
} = getSurroundingSymbols(input.substring(position), '+', '+');
|
|
42
46
|
return commonFormatter(input, position, schema, {
|
|
43
|
-
opening:
|
|
44
|
-
closing:
|
|
47
|
+
opening: openingSymbol,
|
|
48
|
+
closing: closingSymbol,
|
|
45
49
|
context,
|
|
46
50
|
rawContentProcessor
|
|
47
51
|
});
|
|
@@ -44,6 +44,14 @@ const keywordTokenMap = {
|
|
|
44
44
|
'----': TokenType.QUADRUPLE_DASH_SYMBOL,
|
|
45
45
|
'---': TokenType.TRIPLE_DASH_SYMBOL,
|
|
46
46
|
'--': TokenType.DOUBLE_DASH_SYMBOL,
|
|
47
|
+
'{-}': TokenType.DELETED,
|
|
48
|
+
'{+}': TokenType.INSERTED,
|
|
49
|
+
'{*}': TokenType.STRONG,
|
|
50
|
+
'{^}': TokenType.SUPERSCRIPT,
|
|
51
|
+
'{~}': TokenType.SUBSCRIPT,
|
|
52
|
+
'{_}': TokenType.EMPHASIS,
|
|
53
|
+
'{{{}': TokenType.MONOSPACE,
|
|
54
|
+
'{??}': TokenType.CITATION,
|
|
47
55
|
'-': TokenType.DELETED,
|
|
48
56
|
'+': TokenType.INSERTED,
|
|
49
57
|
'*': TokenType.STRONG,
|
|
@@ -11,10 +11,9 @@ export const linkText = ({
|
|
|
11
11
|
|
|
12
12
|
if (!match) {
|
|
13
13
|
return fallback(input, position);
|
|
14
|
-
}
|
|
15
|
-
|
|
14
|
+
}
|
|
16
15
|
|
|
17
|
-
match =
|
|
16
|
+
match = trimBadEndChar(match); // Remove mailto:
|
|
18
17
|
|
|
19
18
|
const textRepresentation = match[1] === 'mailto:' ? match[2] : match[0]; // parse and correctly encode any illegal characters, and
|
|
20
19
|
// so no longer need to be encoded when used below
|
|
@@ -64,8 +63,9 @@ function fallback(input, position) {
|
|
|
64
63
|
text: input.substr(position, 1),
|
|
65
64
|
length: 1
|
|
66
65
|
};
|
|
67
|
-
}
|
|
66
|
+
} // removes bad characters from the end of regex match
|
|
67
|
+
|
|
68
68
|
|
|
69
|
-
function
|
|
70
|
-
return input[0].
|
|
69
|
+
function trimBadEndChar(input) {
|
|
70
|
+
return [input[0].replace(/[.,>)\];}"\'!]*$/, ''), input[1], input[2].replace(/[.,>)\];}"\'!]*$/, '')];
|
|
71
71
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TokenType } from './';
|
|
2
|
+
import { getSurroundingSymbols } from '../utils/text';
|
|
2
3
|
import { commonFormatter } from './common-formatter';
|
|
3
4
|
import { parseString } from '../text';
|
|
4
5
|
export const monospace = ({
|
|
@@ -38,9 +39,13 @@ export const monospace = ({
|
|
|
38
39
|
};
|
|
39
40
|
};
|
|
40
41
|
|
|
42
|
+
const {
|
|
43
|
+
openingSymbol,
|
|
44
|
+
closingSymbol
|
|
45
|
+
} = getSurroundingSymbols(input.substring(position), '{{', '}}');
|
|
41
46
|
return commonFormatter(input, position, schema, {
|
|
42
|
-
opening:
|
|
43
|
-
closing:
|
|
47
|
+
opening: openingSymbol,
|
|
48
|
+
closing: closingSymbol,
|
|
44
49
|
context,
|
|
45
50
|
rawContentProcessor
|
|
46
51
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TokenType } from './';
|
|
2
|
-
import { hasAnyOfMarks } from '../utils/text';
|
|
2
|
+
import { hasAnyOfMarks, getSurroundingSymbols } from '../utils/text';
|
|
3
3
|
import { commonFormatter } from './common-formatter';
|
|
4
4
|
import { parseString } from '../text';
|
|
5
5
|
export const strong = ({
|
|
@@ -39,9 +39,13 @@ export const strong = ({
|
|
|
39
39
|
};
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
+
const {
|
|
43
|
+
openingSymbol,
|
|
44
|
+
closingSymbol
|
|
45
|
+
} = getSurroundingSymbols(input.substring(position), '*', '*');
|
|
42
46
|
return commonFormatter(input, position, schema, {
|
|
43
|
-
opening:
|
|
44
|
-
closing:
|
|
47
|
+
opening: openingSymbol,
|
|
48
|
+
closing: closingSymbol,
|
|
45
49
|
context,
|
|
46
50
|
rawContentProcessor
|
|
47
51
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TokenType } from './';
|
|
2
|
-
import { hasAnyOfMarks } from '../utils/text';
|
|
2
|
+
import { hasAnyOfMarks, getSurroundingSymbols } from '../utils/text';
|
|
3
3
|
import { commonFormatter } from './common-formatter';
|
|
4
4
|
import { parseString } from '../text';
|
|
5
5
|
export const subscript = ({
|
|
@@ -41,9 +41,13 @@ export const subscript = ({
|
|
|
41
41
|
};
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
+
const {
|
|
45
|
+
openingSymbol,
|
|
46
|
+
closingSymbol
|
|
47
|
+
} = getSurroundingSymbols(input.substring(position), '~', '~');
|
|
44
48
|
return commonFormatter(input, position, schema, {
|
|
45
|
-
opening:
|
|
46
|
-
closing:
|
|
49
|
+
opening: openingSymbol,
|
|
50
|
+
closing: closingSymbol,
|
|
47
51
|
context,
|
|
48
52
|
rawContentProcessor
|
|
49
53
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TokenType } from './';
|
|
2
|
-
import { hasAnyOfMarks } from '../utils/text';
|
|
2
|
+
import { hasAnyOfMarks, getSurroundingSymbols } from '../utils/text';
|
|
3
3
|
import { commonFormatter } from './common-formatter';
|
|
4
4
|
import { parseString } from '../text';
|
|
5
5
|
export const superscript = ({
|
|
@@ -41,9 +41,13 @@ export const superscript = ({
|
|
|
41
41
|
};
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
+
const {
|
|
45
|
+
openingSymbol,
|
|
46
|
+
closingSymbol
|
|
47
|
+
} = getSurroundingSymbols(input.substring(position), '^', '^');
|
|
44
48
|
return commonFormatter(input, position, schema, {
|
|
45
|
-
opening:
|
|
46
|
-
closing:
|
|
49
|
+
opening: openingSymbol,
|
|
50
|
+
closing: closingSymbol,
|
|
47
51
|
context,
|
|
48
52
|
rawContentProcessor
|
|
49
53
|
});
|
|
@@ -12,7 +12,20 @@ export function isBlank(value) {
|
|
|
12
12
|
}
|
|
13
13
|
export function isNotBlank(value) {
|
|
14
14
|
return !isBlank(value);
|
|
15
|
-
}
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* ESS-2375 Returns the beginning and closing symbol to parse a token
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
export const getSurroundingSymbols = (trimmedInput, openingText, closingText) => {
|
|
21
|
+
const openingSymbol = trimmedInput.startsWith(`{${openingText}}`) ? `{${openingText}}` : openingText;
|
|
22
|
+
const endIndex = trimmedInput.indexOf(closingText, openingSymbol === `{${openingText}}` ? openingText.length + 2 : openingText.length);
|
|
23
|
+
const closingSymbol = endIndex > -1 && trimmedInput.charAt(endIndex - 1) === '{' && trimmedInput.charAt(endIndex + closingText.length) === '}' ? `{${closingText}}` : closingText;
|
|
24
|
+
return {
|
|
25
|
+
openingSymbol,
|
|
26
|
+
closingSymbol
|
|
27
|
+
};
|
|
28
|
+
}; // TODO This is using strings which makes it potentially a performance bottleneck
|
|
16
29
|
|
|
17
30
|
export class StringBuffer {
|
|
18
31
|
constructor(buffer = '') {
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import { TokenType } from './';
|
|
3
|
-
import { hasAnyOfMarks } from '../utils/text';
|
|
3
|
+
import { hasAnyOfMarks, getSurroundingSymbols } from '../utils/text';
|
|
4
4
|
import { commonFormatter } from './common-formatter';
|
|
5
5
|
import { parseString } from '../text';
|
|
6
6
|
import { EM_DASH } from '../../char';
|
|
@@ -45,9 +45,13 @@ export var citation = function citation(_ref) {
|
|
|
45
45
|
};
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
+
var _getSurroundingSymbol = getSurroundingSymbols(input.substring(position), '??', '??'),
|
|
49
|
+
openingSymbol = _getSurroundingSymbol.openingSymbol,
|
|
50
|
+
closingSymbol = _getSurroundingSymbol.closingSymbol;
|
|
51
|
+
|
|
48
52
|
return commonFormatter(input, position, schema, {
|
|
49
|
-
opening:
|
|
50
|
-
closing:
|
|
53
|
+
opening: openingSymbol,
|
|
54
|
+
closing: closingSymbol,
|
|
51
55
|
context: context,
|
|
52
56
|
rawContentProcessor: rawContentProcessor
|
|
53
57
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import { TokenType } from './';
|
|
3
|
-
import { hasAnyOfMarks } from '../utils/text';
|
|
3
|
+
import { hasAnyOfMarks, getSurroundingSymbols } from '../utils/text';
|
|
4
4
|
import { commonFormatter } from './common-formatter';
|
|
5
5
|
import { parseString } from '../text';
|
|
6
6
|
export var deleted = function deleted(_ref) {
|
|
@@ -41,9 +41,13 @@ export var deleted = function deleted(_ref) {
|
|
|
41
41
|
};
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
+
var _getSurroundingSymbol = getSurroundingSymbols(input.substring(position), '-', '-'),
|
|
45
|
+
openingSymbol = _getSurroundingSymbol.openingSymbol,
|
|
46
|
+
closingSymbol = _getSurroundingSymbol.closingSymbol;
|
|
47
|
+
|
|
44
48
|
return commonFormatter(input, position, schema, {
|
|
45
|
-
opening:
|
|
46
|
-
closing:
|
|
49
|
+
opening: openingSymbol,
|
|
50
|
+
closing: closingSymbol,
|
|
47
51
|
context: context,
|
|
48
52
|
rawContentProcessor: rawContentProcessor
|
|
49
53
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import { TokenType } from './';
|
|
3
|
-
import { hasAnyOfMarks } from '../utils/text';
|
|
3
|
+
import { hasAnyOfMarks, getSurroundingSymbols } from '../utils/text';
|
|
4
4
|
import { commonFormatter } from './common-formatter';
|
|
5
5
|
import { parseString } from '../text';
|
|
6
6
|
export var emphasis = function emphasis(_ref) {
|
|
@@ -40,9 +40,13 @@ export var emphasis = function emphasis(_ref) {
|
|
|
40
40
|
};
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
+
var _getSurroundingSymbol = getSurroundingSymbols(input.substring(position), '_', '_'),
|
|
44
|
+
openingSymbol = _getSurroundingSymbol.openingSymbol,
|
|
45
|
+
closingSymbol = _getSurroundingSymbol.closingSymbol;
|
|
46
|
+
|
|
43
47
|
return commonFormatter(input, position, schema, {
|
|
44
|
-
opening:
|
|
45
|
-
closing:
|
|
48
|
+
opening: openingSymbol,
|
|
49
|
+
closing: closingSymbol,
|
|
46
50
|
context: context,
|
|
47
51
|
rawContentProcessor: rawContentProcessor
|
|
48
52
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import { TokenType } from './';
|
|
3
|
-
import { hasAnyOfMarks } from '../utils/text';
|
|
3
|
+
import { hasAnyOfMarks, getSurroundingSymbols } from '../utils/text';
|
|
4
4
|
import { commonFormatter } from './common-formatter';
|
|
5
5
|
import { parseString } from '../text';
|
|
6
6
|
export var inserted = function inserted(_ref) {
|
|
@@ -40,9 +40,13 @@ export var inserted = function inserted(_ref) {
|
|
|
40
40
|
};
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
+
var _getSurroundingSymbol = getSurroundingSymbols(input.substring(position), '+', '+'),
|
|
44
|
+
openingSymbol = _getSurroundingSymbol.openingSymbol,
|
|
45
|
+
closingSymbol = _getSurroundingSymbol.closingSymbol;
|
|
46
|
+
|
|
43
47
|
return commonFormatter(input, position, schema, {
|
|
44
|
-
opening:
|
|
45
|
-
closing:
|
|
48
|
+
opening: openingSymbol,
|
|
49
|
+
closing: closingSymbol,
|
|
46
50
|
context: context,
|
|
47
51
|
rawContentProcessor: rawContentProcessor
|
|
48
52
|
});
|
|
@@ -44,6 +44,14 @@ var keywordTokenMap = {
|
|
|
44
44
|
'----': TokenType.QUADRUPLE_DASH_SYMBOL,
|
|
45
45
|
'---': TokenType.TRIPLE_DASH_SYMBOL,
|
|
46
46
|
'--': TokenType.DOUBLE_DASH_SYMBOL,
|
|
47
|
+
'{-}': TokenType.DELETED,
|
|
48
|
+
'{+}': TokenType.INSERTED,
|
|
49
|
+
'{*}': TokenType.STRONG,
|
|
50
|
+
'{^}': TokenType.SUPERSCRIPT,
|
|
51
|
+
'{~}': TokenType.SUBSCRIPT,
|
|
52
|
+
'{_}': TokenType.EMPHASIS,
|
|
53
|
+
'{{{}': TokenType.MONOSPACE,
|
|
54
|
+
'{??}': TokenType.CITATION,
|
|
47
55
|
'-': TokenType.DELETED,
|
|
48
56
|
'+': TokenType.INSERTED,
|
|
49
57
|
'*': TokenType.STRONG,
|
|
@@ -10,10 +10,9 @@ export var linkText = function linkText(_ref) {
|
|
|
10
10
|
|
|
11
11
|
if (!match) {
|
|
12
12
|
return fallback(input, position);
|
|
13
|
-
}
|
|
14
|
-
|
|
13
|
+
}
|
|
15
14
|
|
|
16
|
-
match =
|
|
15
|
+
match = trimBadEndChar(match); // Remove mailto:
|
|
17
16
|
|
|
18
17
|
var textRepresentation = match[1] === 'mailto:' ? match[2] : match[0]; // parse and correctly encode any illegal characters, and
|
|
19
18
|
// so no longer need to be encoded when used below
|
|
@@ -63,8 +62,9 @@ function fallback(input, position) {
|
|
|
63
62
|
text: input.substr(position, 1),
|
|
64
63
|
length: 1
|
|
65
64
|
};
|
|
66
|
-
}
|
|
65
|
+
} // removes bad characters from the end of regex match
|
|
66
|
+
|
|
67
67
|
|
|
68
|
-
function
|
|
69
|
-
return input[0].
|
|
68
|
+
function trimBadEndChar(input) {
|
|
69
|
+
return [input[0].replace(/[.,>)\];}"\'!]*$/, ''), input[1], input[2].replace(/[.,>)\];}"\'!]*$/, '')];
|
|
70
70
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TokenType } from './';
|
|
2
|
+
import { getSurroundingSymbols } from '../utils/text';
|
|
2
3
|
import { commonFormatter } from './common-formatter';
|
|
3
4
|
import { parseString } from '../text';
|
|
4
5
|
export var monospace = function monospace(_ref) {
|
|
@@ -38,9 +39,13 @@ export var monospace = function monospace(_ref) {
|
|
|
38
39
|
};
|
|
39
40
|
};
|
|
40
41
|
|
|
42
|
+
var _getSurroundingSymbol = getSurroundingSymbols(input.substring(position), '{{', '}}'),
|
|
43
|
+
openingSymbol = _getSurroundingSymbol.openingSymbol,
|
|
44
|
+
closingSymbol = _getSurroundingSymbol.closingSymbol;
|
|
45
|
+
|
|
41
46
|
return commonFormatter(input, position, schema, {
|
|
42
|
-
opening:
|
|
43
|
-
closing:
|
|
47
|
+
opening: openingSymbol,
|
|
48
|
+
closing: closingSymbol,
|
|
44
49
|
context: context,
|
|
45
50
|
rawContentProcessor: rawContentProcessor
|
|
46
51
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import { TokenType } from './';
|
|
3
|
-
import { hasAnyOfMarks } from '../utils/text';
|
|
3
|
+
import { hasAnyOfMarks, getSurroundingSymbols } from '../utils/text';
|
|
4
4
|
import { commonFormatter } from './common-formatter';
|
|
5
5
|
import { parseString } from '../text';
|
|
6
6
|
export var strong = function strong(_ref) {
|
|
@@ -40,9 +40,13 @@ export var strong = function strong(_ref) {
|
|
|
40
40
|
};
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
+
var _getSurroundingSymbol = getSurroundingSymbols(input.substring(position), '*', '*'),
|
|
44
|
+
openingSymbol = _getSurroundingSymbol.openingSymbol,
|
|
45
|
+
closingSymbol = _getSurroundingSymbol.closingSymbol;
|
|
46
|
+
|
|
43
47
|
return commonFormatter(input, position, schema, {
|
|
44
|
-
opening:
|
|
45
|
-
closing:
|
|
48
|
+
opening: openingSymbol,
|
|
49
|
+
closing: closingSymbol,
|
|
46
50
|
context: context,
|
|
47
51
|
rawContentProcessor: rawContentProcessor
|
|
48
52
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import { TokenType } from './';
|
|
3
|
-
import { hasAnyOfMarks } from '../utils/text';
|
|
3
|
+
import { hasAnyOfMarks, getSurroundingSymbols } from '../utils/text';
|
|
4
4
|
import { commonFormatter } from './common-formatter';
|
|
5
5
|
import { parseString } from '../text';
|
|
6
6
|
export var subscript = function subscript(_ref) {
|
|
@@ -42,9 +42,13 @@ export var subscript = function subscript(_ref) {
|
|
|
42
42
|
};
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
+
var _getSurroundingSymbol = getSurroundingSymbols(input.substring(position), '~', '~'),
|
|
46
|
+
openingSymbol = _getSurroundingSymbol.openingSymbol,
|
|
47
|
+
closingSymbol = _getSurroundingSymbol.closingSymbol;
|
|
48
|
+
|
|
45
49
|
return commonFormatter(input, position, schema, {
|
|
46
|
-
opening:
|
|
47
|
-
closing:
|
|
50
|
+
opening: openingSymbol,
|
|
51
|
+
closing: closingSymbol,
|
|
48
52
|
context: context,
|
|
49
53
|
rawContentProcessor: rawContentProcessor
|
|
50
54
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import { TokenType } from './';
|
|
3
|
-
import { hasAnyOfMarks } from '../utils/text';
|
|
3
|
+
import { hasAnyOfMarks, getSurroundingSymbols } from '../utils/text';
|
|
4
4
|
import { commonFormatter } from './common-formatter';
|
|
5
5
|
import { parseString } from '../text';
|
|
6
6
|
export var superscript = function superscript(_ref) {
|
|
@@ -42,9 +42,13 @@ export var superscript = function superscript(_ref) {
|
|
|
42
42
|
};
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
+
var _getSurroundingSymbol = getSurroundingSymbols(input.substring(position), '^', '^'),
|
|
46
|
+
openingSymbol = _getSurroundingSymbol.openingSymbol,
|
|
47
|
+
closingSymbol = _getSurroundingSymbol.closingSymbol;
|
|
48
|
+
|
|
45
49
|
return commonFormatter(input, position, schema, {
|
|
46
|
-
opening:
|
|
47
|
-
closing:
|
|
50
|
+
opening: openingSymbol,
|
|
51
|
+
closing: closingSymbol,
|
|
48
52
|
context: context,
|
|
49
53
|
rawContentProcessor: rawContentProcessor
|
|
50
54
|
});
|
|
@@ -19,7 +19,20 @@ export function isBlank(value) {
|
|
|
19
19
|
}
|
|
20
20
|
export function isNotBlank(value) {
|
|
21
21
|
return !isBlank(value);
|
|
22
|
-
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* ESS-2375 Returns the beginning and closing symbol to parse a token
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
export var getSurroundingSymbols = function getSurroundingSymbols(trimmedInput, openingText, closingText) {
|
|
28
|
+
var openingSymbol = trimmedInput.startsWith("{".concat(openingText, "}")) ? "{".concat(openingText, "}") : openingText;
|
|
29
|
+
var endIndex = trimmedInput.indexOf(closingText, openingSymbol === "{".concat(openingText, "}") ? openingText.length + 2 : openingText.length);
|
|
30
|
+
var closingSymbol = endIndex > -1 && trimmedInput.charAt(endIndex - 1) === '{' && trimmedInput.charAt(endIndex + closingText.length) === '}' ? "{".concat(closingText, "}") : closingText;
|
|
31
|
+
return {
|
|
32
|
+
openingSymbol: openingSymbol,
|
|
33
|
+
closingSymbol: closingSymbol
|
|
34
|
+
};
|
|
35
|
+
}; // TODO This is using strings which makes it potentially a performance bottleneck
|
|
23
36
|
|
|
24
37
|
export var StringBuffer = /*#__PURE__*/function () {
|
|
25
38
|
function StringBuffer() {
|
package/dist/esm/version.json
CHANGED
|
@@ -6,6 +6,10 @@ export declare function hasAnyOfMarks(node: PMNode, types: string[]): boolean;
|
|
|
6
6
|
export declare function isDigit(value: string): boolean;
|
|
7
7
|
export declare function isBlank(value: string | null): boolean;
|
|
8
8
|
export declare function isNotBlank(value: string | null): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* ESS-2375 Returns the beginning and closing symbol to parse a token
|
|
11
|
+
*/
|
|
12
|
+
export declare const getSurroundingSymbols: (trimmedInput: string, openingText: string, closingText: string) => Record<string, string>;
|
|
9
13
|
export declare class StringBuffer {
|
|
10
14
|
private buffer;
|
|
11
15
|
constructor(buffer?: string);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-wikimarkup-transformer",
|
|
3
|
-
"version": "11.0.
|
|
3
|
+
"version": "11.0.10",
|
|
4
4
|
"description": "Wiki markup transformer for JIRA and Confluence",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@atlaskit/adf-schema": "^23.
|
|
27
|
+
"@atlaskit/adf-schema": "^23.1.0",
|
|
28
28
|
"@atlaskit/editor-json-transformer": "^8.7.0",
|
|
29
29
|
"@atlaskit/theme": "^12.1.0",
|
|
30
30
|
"@babel/runtime": "^7.0.0",
|
|
@@ -33,20 +33,20 @@
|
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@atlaskit/activity": "^1.0.1",
|
|
35
35
|
"@atlaskit/docs": "*",
|
|
36
|
-
"@atlaskit/editor-common": "^
|
|
37
|
-
"@atlaskit/editor-core": "^
|
|
36
|
+
"@atlaskit/editor-common": "^68.0.0",
|
|
37
|
+
"@atlaskit/editor-core": "^167.0.0",
|
|
38
38
|
"@atlaskit/editor-test-helpers": "^17.0.0",
|
|
39
39
|
"@atlaskit/mention": "^21.0.0",
|
|
40
|
-
"@atlaskit/profilecard": "^16.
|
|
41
|
-
"@atlaskit/renderer": "^
|
|
42
|
-
"@atlaskit/util-data-test": "^17.
|
|
40
|
+
"@atlaskit/profilecard": "^16.5.0",
|
|
41
|
+
"@atlaskit/renderer": "^96.0.0",
|
|
42
|
+
"@atlaskit/util-data-test": "^17.3.0",
|
|
43
43
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
44
|
+
"@emotion/react": "^11.7.1",
|
|
44
45
|
"@types/prosemirror-model": "^1.11.0",
|
|
45
46
|
"cookie": "^0.3.1",
|
|
46
47
|
"debug": "^2.2.0",
|
|
47
48
|
"react": "^16.8.0",
|
|
48
49
|
"rxjs": "^5.5.0",
|
|
49
|
-
"styled-components": "^3.2.6",
|
|
50
50
|
"typescript": "4.2.4"
|
|
51
51
|
},
|
|
52
52
|
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
|