@atlaskit/editor-wikimarkup-transformer 9.5.3
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 +2299 -0
- package/LICENSE +13 -0
- package/build/tsconfig.json +17 -0
- package/char/package.json +7 -0
- package/dist/cjs/char.js +8 -0
- package/dist/cjs/encoder/emoji-unicode-mapping.js +1618 -0
- package/dist/cjs/encoder/index.js +76 -0
- package/dist/cjs/encoder/marks/__base.js +24 -0
- package/dist/cjs/encoder/marks/code.js +12 -0
- package/dist/cjs/encoder/marks/color.js +12 -0
- package/dist/cjs/encoder/marks/em.js +19 -0
- package/dist/cjs/encoder/marks/link.js +12 -0
- package/dist/cjs/encoder/marks/strike.js +14 -0
- package/dist/cjs/encoder/marks/strong.js +18 -0
- package/dist/cjs/encoder/marks/subsup.js +18 -0
- package/dist/cjs/encoder/marks/underline.js +14 -0
- package/dist/cjs/encoder/nodes/block-card.js +18 -0
- package/dist/cjs/encoder/nodes/blockquote.js +21 -0
- package/dist/cjs/encoder/nodes/bullet-list.js +21 -0
- package/dist/cjs/encoder/nodes/code-block.js +27 -0
- package/dist/cjs/encoder/nodes/date.js +21 -0
- package/dist/cjs/encoder/nodes/decisionItem.js +23 -0
- package/dist/cjs/encoder/nodes/decisionList.js +18 -0
- package/dist/cjs/encoder/nodes/doc.js +21 -0
- package/dist/cjs/encoder/nodes/embed-card.js +18 -0
- package/dist/cjs/encoder/nodes/emoji.js +26 -0
- package/dist/cjs/encoder/nodes/expand.js +22 -0
- package/dist/cjs/encoder/nodes/hard-break.js +12 -0
- package/dist/cjs/encoder/nodes/heading.js +18 -0
- package/dist/cjs/encoder/nodes/inline-card.js +26 -0
- package/dist/cjs/encoder/nodes/inlines.js +44 -0
- package/dist/cjs/encoder/nodes/listItem.js +77 -0
- package/dist/cjs/encoder/nodes/media-group.js +24 -0
- package/dist/cjs/encoder/nodes/media.js +66 -0
- package/dist/cjs/encoder/nodes/mention.js +27 -0
- package/dist/cjs/encoder/nodes/ordered-list.js +21 -0
- package/dist/cjs/encoder/nodes/panel.js +29 -0
- package/dist/cjs/encoder/nodes/paragraph.js +23 -0
- package/dist/cjs/encoder/nodes/rule.js +12 -0
- package/dist/cjs/encoder/nodes/status.js +43 -0
- package/dist/cjs/encoder/nodes/table.js +77 -0
- package/dist/cjs/encoder/nodes/taskItem.js +32 -0
- package/dist/cjs/encoder/nodes/taskList.js +27 -0
- package/dist/cjs/encoder/nodes/text.js +67 -0
- package/dist/cjs/encoder/nodes/unknown.js +17 -0
- package/dist/cjs/index.js +93 -0
- package/dist/cjs/interfaces.js +5 -0
- package/dist/cjs/parser/abstract-tree.js +44 -0
- package/dist/cjs/parser/builder/list-builder.js +350 -0
- package/dist/cjs/parser/builder/table-builder.js +156 -0
- package/dist/cjs/parser/color.js +13 -0
- package/dist/cjs/parser/error.js +22 -0
- package/dist/cjs/parser/nodes/mediaGroup.js +25 -0
- package/dist/cjs/parser/nodes/mediaSingle.js +107 -0
- package/dist/cjs/parser/nodes/paragraph.js +72 -0
- package/dist/cjs/parser/nodes/rule.js +27 -0
- package/dist/cjs/parser/nodes/text.js +15 -0
- package/dist/cjs/parser/text.js +165 -0
- package/dist/cjs/parser/tokenize/adf-macro.js +49 -0
- package/dist/cjs/parser/tokenize/anchor-macro.js +31 -0
- package/dist/cjs/parser/tokenize/blockquote.js +42 -0
- package/dist/cjs/parser/tokenize/citation.js +71 -0
- package/dist/cjs/parser/tokenize/code-macro.js +95 -0
- package/dist/cjs/parser/tokenize/color-macro.js +64 -0
- package/dist/cjs/parser/tokenize/common-formatter.js +230 -0
- package/dist/cjs/parser/tokenize/common-macro.js +62 -0
- package/dist/cjs/parser/tokenize/dash-token-creator.js +42 -0
- package/dist/cjs/parser/tokenize/deleted.js +66 -0
- package/dist/cjs/parser/tokenize/double-dash-symbol.js +30 -0
- package/dist/cjs/parser/tokenize/emoji.js +184 -0
- package/dist/cjs/parser/tokenize/emphasis.js +65 -0
- package/dist/cjs/parser/tokenize/file-link.js +36 -0
- package/dist/cjs/parser/tokenize/force-line-break.js +48 -0
- package/dist/cjs/parser/tokenize/hardbreak.js +33 -0
- package/dist/cjs/parser/tokenize/heading.js +70 -0
- package/dist/cjs/parser/tokenize/index.js +144 -0
- package/dist/cjs/parser/tokenize/inserted.js +65 -0
- package/dist/cjs/parser/tokenize/issue-key.js +107 -0
- package/dist/cjs/parser/tokenize/keyword.js +159 -0
- package/dist/cjs/parser/tokenize/link-text.js +77 -0
- package/dist/cjs/parser/tokenize/links/attachment-link.js +18 -0
- package/dist/cjs/parser/tokenize/links/issue-link.js +41 -0
- package/dist/cjs/parser/tokenize/links/link-format.js +65 -0
- package/dist/cjs/parser/tokenize/links/link-parser.js +224 -0
- package/dist/cjs/parser/tokenize/links/link-resolver.js +57 -0
- package/dist/cjs/parser/tokenize/links/mention-link.js +24 -0
- package/dist/cjs/parser/tokenize/links/url-link.js +64 -0
- package/dist/cjs/parser/tokenize/list.js +339 -0
- package/dist/cjs/parser/tokenize/media.js +51 -0
- package/dist/cjs/parser/tokenize/monospace.js +59 -0
- package/dist/cjs/parser/tokenize/noformat-macro.js +46 -0
- package/dist/cjs/parser/tokenize/panel-macro.js +106 -0
- package/dist/cjs/parser/tokenize/quadruple-dash-symbol.js +30 -0
- package/dist/cjs/parser/tokenize/quote-macro.js +166 -0
- package/dist/cjs/parser/tokenize/ruler.js +33 -0
- package/dist/cjs/parser/tokenize/strong.js +65 -0
- package/dist/cjs/parser/tokenize/subscript.js +67 -0
- package/dist/cjs/parser/tokenize/superscript.js +67 -0
- package/dist/cjs/parser/tokenize/table.js +353 -0
- package/dist/cjs/parser/tokenize/triple-dash-symbol.js +30 -0
- package/dist/cjs/parser/tokenize/whitespace.js +56 -0
- package/dist/cjs/parser/utils/attrs.js +33 -0
- package/dist/cjs/parser/utils/color-name-mapping.js +700 -0
- package/dist/cjs/parser/utils/escape.js +36 -0
- package/dist/cjs/parser/utils/normalize.js +209 -0
- package/dist/cjs/parser/utils/panel-type.js +120 -0
- package/dist/cjs/parser/utils/text.js +98 -0
- package/dist/cjs/parser/utils/title.js +17 -0
- package/dist/cjs/parser/utils/url.js +31 -0
- package/dist/cjs/version.json +5 -0
- package/dist/es2019/char.js +1 -0
- package/dist/es2019/encoder/emoji-unicode-mapping.js +1611 -0
- package/dist/es2019/encoder/index.js +51 -0
- package/dist/es2019/encoder/marks/__base.js +15 -0
- package/dist/es2019/encoder/marks/code.js +3 -0
- package/dist/es2019/encoder/marks/color.js +3 -0
- package/dist/es2019/encoder/marks/em.js +9 -0
- package/dist/es2019/encoder/marks/link.js +3 -0
- package/dist/es2019/encoder/marks/strike.js +4 -0
- package/dist/es2019/encoder/marks/strong.js +9 -0
- package/dist/es2019/encoder/marks/subsup.js +8 -0
- package/dist/es2019/encoder/marks/underline.js +4 -0
- package/dist/es2019/encoder/nodes/block-card.js +8 -0
- package/dist/es2019/encoder/nodes/blockquote.js +10 -0
- package/dist/es2019/encoder/nodes/bullet-list.js +10 -0
- package/dist/es2019/encoder/nodes/code-block.js +16 -0
- package/dist/es2019/encoder/nodes/date.js +12 -0
- package/dist/es2019/encoder/nodes/decisionItem.js +12 -0
- package/dist/es2019/encoder/nodes/decisionList.js +8 -0
- package/dist/es2019/encoder/nodes/doc.js +10 -0
- package/dist/es2019/encoder/nodes/embed-card.js +8 -0
- package/dist/es2019/encoder/nodes/emoji.js +15 -0
- package/dist/es2019/encoder/nodes/expand.js +11 -0
- package/dist/es2019/encoder/nodes/hard-break.js +3 -0
- package/dist/es2019/encoder/nodes/heading.js +8 -0
- package/dist/es2019/encoder/nodes/inline-card.js +15 -0
- package/dist/es2019/encoder/nodes/inlines.js +26 -0
- package/dist/es2019/encoder/nodes/listItem.js +63 -0
- package/dist/es2019/encoder/nodes/media-group.js +13 -0
- package/dist/es2019/encoder/nodes/media.js +54 -0
- package/dist/es2019/encoder/nodes/mention.js +16 -0
- package/dist/es2019/encoder/nodes/ordered-list.js +10 -0
- package/dist/es2019/encoder/nodes/panel.js +19 -0
- package/dist/es2019/encoder/nodes/paragraph.js +12 -0
- package/dist/es2019/encoder/nodes/rule.js +3 -0
- package/dist/es2019/encoder/nodes/status.js +23 -0
- package/dist/es2019/encoder/nodes/table.js +62 -0
- package/dist/es2019/encoder/nodes/taskItem.js +21 -0
- package/dist/es2019/encoder/nodes/taskList.js +17 -0
- package/dist/es2019/encoder/nodes/text.js +46 -0
- package/dist/es2019/encoder/nodes/unknown.js +8 -0
- package/dist/es2019/index.js +58 -0
- package/dist/es2019/interfaces.js +1 -0
- package/dist/es2019/parser/abstract-tree.js +23 -0
- package/dist/es2019/parser/builder/list-builder.js +294 -0
- package/dist/es2019/parser/builder/table-builder.js +135 -0
- package/dist/es2019/parser/color.js +5 -0
- package/dist/es2019/parser/error.js +15 -0
- package/dist/es2019/parser/nodes/mediaGroup.js +18 -0
- package/dist/es2019/parser/nodes/mediaSingle.js +95 -0
- package/dist/es2019/parser/nodes/paragraph.js +43 -0
- package/dist/es2019/parser/nodes/rule.js +21 -0
- package/dist/es2019/parser/nodes/text.js +8 -0
- package/dist/es2019/parser/text.js +145 -0
- package/dist/es2019/parser/tokenize/adf-macro.js +40 -0
- package/dist/es2019/parser/tokenize/anchor-macro.js +22 -0
- package/dist/es2019/parser/tokenize/blockquote.js +26 -0
- package/dist/es2019/parser/tokenize/citation.js +53 -0
- package/dist/es2019/parser/tokenize/code-macro.js +57 -0
- package/dist/es2019/parser/tokenize/color-macro.js +46 -0
- package/dist/es2019/parser/tokenize/common-formatter.js +215 -0
- package/dist/es2019/parser/tokenize/common-macro.js +48 -0
- package/dist/es2019/parser/tokenize/dash-token-creator.js +31 -0
- package/dist/es2019/parser/tokenize/deleted.js +49 -0
- package/dist/es2019/parser/tokenize/double-dash-symbol.js +11 -0
- package/dist/es2019/parser/tokenize/emoji.js +174 -0
- package/dist/es2019/parser/tokenize/emphasis.js +48 -0
- package/dist/es2019/parser/tokenize/file-link.js +25 -0
- package/dist/es2019/parser/tokenize/force-line-break.js +38 -0
- package/dist/es2019/parser/tokenize/hardbreak.js +24 -0
- package/dist/es2019/parser/tokenize/heading.js +58 -0
- package/dist/es2019/parser/tokenize/index.js +129 -0
- package/dist/es2019/parser/tokenize/inserted.js +48 -0
- package/dist/es2019/parser/tokenize/issue-key.js +81 -0
- package/dist/es2019/parser/tokenize/keyword.js +142 -0
- package/dist/es2019/parser/tokenize/link-text.js +65 -0
- package/dist/es2019/parser/tokenize/links/attachment-link.js +8 -0
- package/dist/es2019/parser/tokenize/links/issue-link.js +35 -0
- package/dist/es2019/parser/tokenize/links/link-format.js +52 -0
- package/dist/es2019/parser/tokenize/links/link-parser.js +208 -0
- package/dist/es2019/parser/tokenize/links/link-resolver.js +39 -0
- package/dist/es2019/parser/tokenize/links/mention-link.js +17 -0
- package/dist/es2019/parser/tokenize/links/url-link.js +49 -0
- package/dist/es2019/parser/tokenize/list.js +296 -0
- package/dist/es2019/parser/tokenize/media.js +30 -0
- package/dist/es2019/parser/tokenize/monospace.js +47 -0
- package/dist/es2019/parser/tokenize/noformat-macro.js +37 -0
- package/dist/es2019/parser/tokenize/panel-macro.js +63 -0
- package/dist/es2019/parser/tokenize/quadruple-dash-symbol.js +22 -0
- package/dist/es2019/parser/tokenize/quote-macro.js +129 -0
- package/dist/es2019/parser/tokenize/ruler.js +23 -0
- package/dist/es2019/parser/tokenize/strong.js +48 -0
- package/dist/es2019/parser/tokenize/subscript.js +50 -0
- package/dist/es2019/parser/tokenize/superscript.js +50 -0
- package/dist/es2019/parser/tokenize/table.js +333 -0
- package/dist/es2019/parser/tokenize/triple-dash-symbol.js +11 -0
- package/dist/es2019/parser/tokenize/whitespace.js +45 -0
- package/dist/es2019/parser/utils/attrs.js +17 -0
- package/dist/es2019/parser/utils/color-name-mapping.js +693 -0
- package/dist/es2019/parser/utils/escape.js +28 -0
- package/dist/es2019/parser/utils/normalize.js +161 -0
- package/dist/es2019/parser/utils/panel-type.js +109 -0
- package/dist/es2019/parser/utils/text.js +58 -0
- package/dist/es2019/parser/utils/title.js +10 -0
- package/dist/es2019/parser/utils/url.js +24 -0
- package/dist/es2019/version.json +5 -0
- package/dist/esm/char.js +1 -0
- package/dist/esm/encoder/emoji-unicode-mapping.js +1611 -0
- package/dist/esm/encoder/index.js +51 -0
- package/dist/esm/encoder/marks/__base.js +15 -0
- package/dist/esm/encoder/marks/code.js +3 -0
- package/dist/esm/encoder/marks/color.js +3 -0
- package/dist/esm/encoder/marks/em.js +9 -0
- package/dist/esm/encoder/marks/link.js +3 -0
- package/dist/esm/encoder/marks/strike.js +4 -0
- package/dist/esm/encoder/marks/strong.js +9 -0
- package/dist/esm/encoder/marks/subsup.js +8 -0
- package/dist/esm/encoder/marks/underline.js +4 -0
- package/dist/esm/encoder/nodes/block-card.js +8 -0
- package/dist/esm/encoder/nodes/blockquote.js +11 -0
- package/dist/esm/encoder/nodes/bullet-list.js +11 -0
- package/dist/esm/encoder/nodes/code-block.js +16 -0
- package/dist/esm/encoder/nodes/date.js +12 -0
- package/dist/esm/encoder/nodes/decisionItem.js +13 -0
- package/dist/esm/encoder/nodes/decisionList.js +8 -0
- package/dist/esm/encoder/nodes/doc.js +11 -0
- package/dist/esm/encoder/nodes/embed-card.js +8 -0
- package/dist/esm/encoder/nodes/emoji.js +15 -0
- package/dist/esm/encoder/nodes/expand.js +12 -0
- package/dist/esm/encoder/nodes/hard-break.js +3 -0
- package/dist/esm/encoder/nodes/heading.js +8 -0
- package/dist/esm/encoder/nodes/inline-card.js +15 -0
- package/dist/esm/encoder/nodes/inlines.js +26 -0
- package/dist/esm/encoder/nodes/listItem.js +63 -0
- package/dist/esm/encoder/nodes/media-group.js +14 -0
- package/dist/esm/encoder/nodes/media.js +57 -0
- package/dist/esm/encoder/nodes/mention.js +19 -0
- package/dist/esm/encoder/nodes/ordered-list.js +11 -0
- package/dist/esm/encoder/nodes/panel.js +18 -0
- package/dist/esm/encoder/nodes/paragraph.js +13 -0
- package/dist/esm/encoder/nodes/rule.js +3 -0
- package/dist/esm/encoder/nodes/status.js +29 -0
- package/dist/esm/encoder/nodes/table.js +66 -0
- package/dist/esm/encoder/nodes/taskItem.js +22 -0
- package/dist/esm/encoder/nodes/taskList.js +18 -0
- package/dist/esm/encoder/nodes/text.js +51 -0
- package/dist/esm/encoder/nodes/unknown.js +6 -0
- package/dist/esm/index.js +78 -0
- package/dist/esm/interfaces.js +1 -0
- package/dist/esm/parser/abstract-tree.js +34 -0
- package/dist/esm/parser/builder/list-builder.js +338 -0
- package/dist/esm/parser/builder/table-builder.js +150 -0
- package/dist/esm/parser/color.js +5 -0
- package/dist/esm/parser/error.js +15 -0
- package/dist/esm/parser/nodes/mediaGroup.js +18 -0
- package/dist/esm/parser/nodes/mediaSingle.js +97 -0
- package/dist/esm/parser/nodes/paragraph.js +61 -0
- package/dist/esm/parser/nodes/rule.js +18 -0
- package/dist/esm/parser/nodes/text.js +8 -0
- package/dist/esm/parser/text.js +149 -0
- package/dist/esm/parser/tokenize/adf-macro.js +39 -0
- package/dist/esm/parser/tokenize/anchor-macro.js +21 -0
- package/dist/esm/parser/tokenize/blockquote.js +28 -0
- package/dist/esm/parser/tokenize/citation.js +54 -0
- package/dist/esm/parser/tokenize/code-macro.js +80 -0
- package/dist/esm/parser/tokenize/color-macro.js +46 -0
- package/dist/esm/parser/tokenize/common-formatter.js +216 -0
- package/dist/esm/parser/tokenize/common-macro.js +52 -0
- package/dist/esm/parser/tokenize/dash-token-creator.js +33 -0
- package/dist/esm/parser/tokenize/deleted.js +50 -0
- package/dist/esm/parser/tokenize/double-dash-symbol.js +19 -0
- package/dist/esm/parser/tokenize/emoji.js +173 -0
- package/dist/esm/parser/tokenize/emphasis.js +49 -0
- package/dist/esm/parser/tokenize/file-link.js +25 -0
- package/dist/esm/parser/tokenize/force-line-break.js +38 -0
- package/dist/esm/parser/tokenize/hardbreak.js +23 -0
- package/dist/esm/parser/tokenize/heading.js +58 -0
- package/dist/esm/parser/tokenize/index.js +102 -0
- package/dist/esm/parser/tokenize/inserted.js +49 -0
- package/dist/esm/parser/tokenize/issue-key.js +89 -0
- package/dist/esm/parser/tokenize/keyword.js +142 -0
- package/dist/esm/parser/tokenize/link-text.js +64 -0
- package/dist/esm/parser/tokenize/links/attachment-link.js +8 -0
- package/dist/esm/parser/tokenize/links/issue-link.js +33 -0
- package/dist/esm/parser/tokenize/links/link-format.js +51 -0
- package/dist/esm/parser/tokenize/links/link-parser.js +213 -0
- package/dist/esm/parser/tokenize/links/link-resolver.js +55 -0
- package/dist/esm/parser/tokenize/links/mention-link.js +17 -0
- package/dist/esm/parser/tokenize/links/url-link.js +50 -0
- package/dist/esm/parser/tokenize/list.js +318 -0
- package/dist/esm/parser/tokenize/media.js +36 -0
- package/dist/esm/parser/tokenize/monospace.js +47 -0
- package/dist/esm/parser/tokenize/noformat-macro.js +34 -0
- package/dist/esm/parser/tokenize/panel-macro.js +88 -0
- package/dist/esm/parser/tokenize/quadruple-dash-symbol.js +21 -0
- package/dist/esm/parser/tokenize/quote-macro.js +148 -0
- package/dist/esm/parser/tokenize/ruler.js +22 -0
- package/dist/esm/parser/tokenize/strong.js +49 -0
- package/dist/esm/parser/tokenize/subscript.js +51 -0
- package/dist/esm/parser/tokenize/superscript.js +51 -0
- package/dist/esm/parser/tokenize/table.js +336 -0
- package/dist/esm/parser/tokenize/triple-dash-symbol.js +19 -0
- package/dist/esm/parser/tokenize/whitespace.js +45 -0
- package/dist/esm/parser/utils/attrs.js +23 -0
- package/dist/esm/parser/utils/color-name-mapping.js +693 -0
- package/dist/esm/parser/utils/escape.js +28 -0
- package/dist/esm/parser/utils/normalize.js +195 -0
- package/dist/esm/parser/utils/panel-type.js +109 -0
- package/dist/esm/parser/utils/text.js +81 -0
- package/dist/esm/parser/utils/title.js +10 -0
- package/dist/esm/parser/utils/url.js +24 -0
- package/dist/esm/version.json +5 -0
- package/dist/types/char.d.ts +1 -0
- package/dist/types/encoder/emoji-unicode-mapping.d.ts +3 -0
- package/dist/types/encoder/index.d.ts +9 -0
- package/dist/types/encoder/marks/__base.d.ts +5 -0
- package/dist/types/encoder/marks/code.d.ts +2 -0
- package/dist/types/encoder/marks/color.d.ts +2 -0
- package/dist/types/encoder/marks/em.d.ts +2 -0
- package/dist/types/encoder/marks/link.d.ts +2 -0
- package/dist/types/encoder/marks/strike.d.ts +2 -0
- package/dist/types/encoder/marks/strong.d.ts +6 -0
- package/dist/types/encoder/marks/subsup.d.ts +2 -0
- package/dist/types/encoder/marks/underline.d.ts +2 -0
- package/dist/types/encoder/nodes/block-card.d.ts +2 -0
- package/dist/types/encoder/nodes/blockquote.d.ts +2 -0
- package/dist/types/encoder/nodes/bullet-list.d.ts +2 -0
- package/dist/types/encoder/nodes/code-block.d.ts +2 -0
- package/dist/types/encoder/nodes/date.d.ts +2 -0
- package/dist/types/encoder/nodes/decisionItem.d.ts +3 -0
- package/dist/types/encoder/nodes/decisionList.d.ts +2 -0
- package/dist/types/encoder/nodes/doc.d.ts +2 -0
- package/dist/types/encoder/nodes/embed-card.d.ts +2 -0
- package/dist/types/encoder/nodes/emoji.d.ts +2 -0
- package/dist/types/encoder/nodes/expand.d.ts +2 -0
- package/dist/types/encoder/nodes/hard-break.d.ts +2 -0
- package/dist/types/encoder/nodes/heading.d.ts +2 -0
- package/dist/types/encoder/nodes/inline-card.d.ts +2 -0
- package/dist/types/encoder/nodes/inlines.d.ts +2 -0
- package/dist/types/encoder/nodes/listItem.d.ts +3 -0
- package/dist/types/encoder/nodes/media-group.d.ts +2 -0
- package/dist/types/encoder/nodes/media.d.ts +2 -0
- package/dist/types/encoder/nodes/mention.d.ts +2 -0
- package/dist/types/encoder/nodes/ordered-list.d.ts +2 -0
- package/dist/types/encoder/nodes/panel.d.ts +2 -0
- package/dist/types/encoder/nodes/paragraph.d.ts +2 -0
- package/dist/types/encoder/nodes/rule.d.ts +2 -0
- package/dist/types/encoder/nodes/status.d.ts +2 -0
- package/dist/types/encoder/nodes/table.d.ts +2 -0
- package/dist/types/encoder/nodes/taskItem.d.ts +3 -0
- package/dist/types/encoder/nodes/taskList.d.ts +2 -0
- package/dist/types/encoder/nodes/text.d.ts +2 -0
- package/dist/types/encoder/nodes/unknown.d.ts +2 -0
- package/dist/types/index.d.ts +15 -0
- package/dist/types/interfaces.d.ts +68 -0
- package/dist/types/parser/abstract-tree.d.ts +11 -0
- package/dist/types/parser/builder/list-builder.d.ts +66 -0
- package/dist/types/parser/builder/table-builder.d.ts +45 -0
- package/dist/types/parser/color.d.ts +3 -0
- package/dist/types/parser/error.d.ts +1 -0
- package/dist/types/parser/nodes/mediaGroup.d.ts +3 -0
- package/dist/types/parser/nodes/mediaSingle.d.ts +5 -0
- package/dist/types/parser/nodes/paragraph.d.ts +7 -0
- package/dist/types/parser/nodes/rule.d.ts +3 -0
- package/dist/types/parser/nodes/text.d.ts +2 -0
- package/dist/types/parser/text.d.ts +10 -0
- package/dist/types/parser/tokenize/adf-macro.d.ts +2 -0
- package/dist/types/parser/tokenize/anchor-macro.d.ts +2 -0
- package/dist/types/parser/tokenize/blockquote.d.ts +2 -0
- package/dist/types/parser/tokenize/citation.d.ts +2 -0
- package/dist/types/parser/tokenize/code-macro.d.ts +2 -0
- package/dist/types/parser/tokenize/color-macro.d.ts +2 -0
- package/dist/types/parser/tokenize/common-formatter.d.ts +10 -0
- package/dist/types/parser/tokenize/common-macro.d.ts +10 -0
- package/dist/types/parser/tokenize/dash-token-creator.d.ts +2 -0
- package/dist/types/parser/tokenize/deleted.d.ts +2 -0
- package/dist/types/parser/tokenize/double-dash-symbol.d.ts +1 -0
- package/dist/types/parser/tokenize/emoji.d.ts +15 -0
- package/dist/types/parser/tokenize/emphasis.d.ts +2 -0
- package/dist/types/parser/tokenize/file-link.d.ts +3 -0
- package/dist/types/parser/tokenize/force-line-break.d.ts +2 -0
- package/dist/types/parser/tokenize/hardbreak.d.ts +2 -0
- package/dist/types/parser/tokenize/heading.d.ts +2 -0
- package/dist/types/parser/tokenize/index.d.ts +55 -0
- package/dist/types/parser/tokenize/inserted.d.ts +2 -0
- package/dist/types/parser/tokenize/issue-key.d.ts +20 -0
- package/dist/types/parser/tokenize/keyword.d.ts +13 -0
- package/dist/types/parser/tokenize/link-text.d.ts +3 -0
- package/dist/types/parser/tokenize/links/attachment-link.d.ts +4 -0
- package/dist/types/parser/tokenize/links/issue-link.d.ts +4 -0
- package/dist/types/parser/tokenize/links/link-format.d.ts +2 -0
- package/dist/types/parser/tokenize/links/link-parser.d.ts +17 -0
- package/dist/types/parser/tokenize/links/link-resolver.d.ts +5 -0
- package/dist/types/parser/tokenize/links/mention-link.d.ts +4 -0
- package/dist/types/parser/tokenize/links/url-link.d.ts +4 -0
- package/dist/types/parser/tokenize/list.d.ts +3 -0
- package/dist/types/parser/tokenize/media.d.ts +2 -0
- package/dist/types/parser/tokenize/monospace.d.ts +2 -0
- package/dist/types/parser/tokenize/noformat-macro.d.ts +2 -0
- package/dist/types/parser/tokenize/panel-macro.d.ts +2 -0
- package/dist/types/parser/tokenize/quadruple-dash-symbol.d.ts +2 -0
- package/dist/types/parser/tokenize/quote-macro.d.ts +5 -0
- package/dist/types/parser/tokenize/ruler.d.ts +2 -0
- package/dist/types/parser/tokenize/strong.d.ts +2 -0
- package/dist/types/parser/tokenize/subscript.d.ts +2 -0
- package/dist/types/parser/tokenize/superscript.d.ts +2 -0
- package/dist/types/parser/tokenize/table.d.ts +2 -0
- package/dist/types/parser/tokenize/triple-dash-symbol.d.ts +1 -0
- package/dist/types/parser/tokenize/whitespace.d.ts +3 -0
- package/dist/types/parser/utils/attrs.d.ts +3 -0
- package/dist/types/parser/utils/color-name-mapping.d.ts +10 -0
- package/dist/types/parser/utils/escape.d.ts +2 -0
- package/dist/types/parser/utils/normalize.d.ts +4 -0
- package/dist/types/parser/utils/panel-type.d.ts +3 -0
- package/dist/types/parser/utils/text.d.ts +21 -0
- package/dist/types/parser/utils/title.d.ts +7 -0
- package/dist/types/parser/utils/url.d.ts +8 -0
- package/docs/0-intro.tsx +24 -0
- package/interfaces/package.json +7 -0
- package/package.json +53 -0
- package/tsconfig.json +12 -0
- package/typings/json.d.ts +1 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.linkText = exports.LINK_TEXT_REGEXP = void 0;
|
|
7
|
+
|
|
8
|
+
var _adfSchema = require("@atlaskit/adf-schema");
|
|
9
|
+
|
|
10
|
+
var _url = require("../utils/url");
|
|
11
|
+
|
|
12
|
+
// the regex should exclude the period and exclamation mark as the last character
|
|
13
|
+
var LINK_TEXT_REGEXP = /^((?:(?:https?|ftps?):\/\/)|irc:\/\/|mailto:)([\w?!~^\/\\#$%&'()*+,\-.\/:;<=@]*[\w~^\/\\#$%&'()*+,\-\/:;<=@])/i;
|
|
14
|
+
exports.LINK_TEXT_REGEXP = LINK_TEXT_REGEXP;
|
|
15
|
+
|
|
16
|
+
var linkText = function linkText(_ref) {
|
|
17
|
+
var input = _ref.input,
|
|
18
|
+
position = _ref.position,
|
|
19
|
+
schema = _ref.schema;
|
|
20
|
+
var match = input.substring(position).match(LINK_TEXT_REGEXP);
|
|
21
|
+
|
|
22
|
+
if (!match) {
|
|
23
|
+
return fallback(input, position);
|
|
24
|
+
} // Remove mailto:
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
var textRepresentation = match[1] === 'mailto:' ? match[2] : match[0]; // parse and correctly encode any illegal characters, and
|
|
28
|
+
// so no longer need to be encoded when used below
|
|
29
|
+
|
|
30
|
+
var url = (0, _url.decode)(unescape(match[0]));
|
|
31
|
+
|
|
32
|
+
if (!(0, _adfSchema.isSafeUrl)(url)) {
|
|
33
|
+
return fallback(input, position);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
var mark = schema.marks.link.create({
|
|
37
|
+
href: url
|
|
38
|
+
});
|
|
39
|
+
var textNode = schema.text(textRepresentation, [mark]);
|
|
40
|
+
return {
|
|
41
|
+
type: 'pmnode',
|
|
42
|
+
nodes: [textNode],
|
|
43
|
+
length: match[0].length
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
exports.linkText = linkText;
|
|
48
|
+
|
|
49
|
+
function unescape(url) {
|
|
50
|
+
var result = '';
|
|
51
|
+
|
|
52
|
+
for (var i = 0; i < url.length; i++) {
|
|
53
|
+
var char = url[i];
|
|
54
|
+
|
|
55
|
+
if (char !== '\\') {
|
|
56
|
+
result += char;
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
var nextChar = url[i + 1];
|
|
61
|
+
|
|
62
|
+
if (nextChar) {
|
|
63
|
+
result += nextChar;
|
|
64
|
+
i++;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return result;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function fallback(input, position) {
|
|
72
|
+
return {
|
|
73
|
+
type: 'text',
|
|
74
|
+
text: input.substr(position, 1),
|
|
75
|
+
length: 1
|
|
76
|
+
};
|
|
77
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.attachmentLinkResolver = attachmentLinkResolver;
|
|
9
|
+
|
|
10
|
+
var _mediaGroup = _interopRequireDefault(require("../../nodes/mediaGroup"));
|
|
11
|
+
|
|
12
|
+
function attachmentLinkResolver(link, schema, context) {
|
|
13
|
+
if (link.attachmentName) {
|
|
14
|
+
return [(0, _mediaGroup.default)(schema, link.attachmentName, context)];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.issueLinkResolver = issueLinkResolver;
|
|
7
|
+
|
|
8
|
+
var _issueKey = require("../issue-key");
|
|
9
|
+
|
|
10
|
+
function issueLinkResolver(link, schema, context) {
|
|
11
|
+
var originalLinkText = link.originalLinkText,
|
|
12
|
+
linkTitle = link.linkTitle,
|
|
13
|
+
notLinkBody = link.notLinkBody;
|
|
14
|
+
|
|
15
|
+
if (linkTitle === 'smart-card' || linkTitle === 'block-link' // TODO: Depricated should be removed in the next major release
|
|
16
|
+
) {
|
|
17
|
+
return [schema.nodes.blockCard.createChecked({
|
|
18
|
+
url: notLinkBody
|
|
19
|
+
})];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (linkTitle === 'smart-link') {
|
|
23
|
+
return [schema.nodes.inlineCard.createChecked({
|
|
24
|
+
url: notLinkBody
|
|
25
|
+
})];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (linkTitle === 'smart-embed') {
|
|
29
|
+
return [schema.nodes.embedCard.createChecked({
|
|
30
|
+
url: notLinkBody
|
|
31
|
+
})];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
var issue = (0, _issueKey.getIssue)(context, originalLinkText);
|
|
35
|
+
|
|
36
|
+
if (issue) {
|
|
37
|
+
return (0, _issueKey.buildInlineCard)(schema, issue);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.linkFormat = void 0;
|
|
7
|
+
|
|
8
|
+
var _ = require("../");
|
|
9
|
+
|
|
10
|
+
var _text = require("../../text");
|
|
11
|
+
|
|
12
|
+
var _linkResolver = require("./link-resolver");
|
|
13
|
+
|
|
14
|
+
var _linkParser = require("./link-parser");
|
|
15
|
+
|
|
16
|
+
// [http://www.example.com] and [Example|http://www.example.com]
|
|
17
|
+
var LINK_FORMAT_REGEXP = /^\[([^\[\]\n]+)]/;
|
|
18
|
+
|
|
19
|
+
var linkFormat = function linkFormat(_ref) {
|
|
20
|
+
var input = _ref.input,
|
|
21
|
+
position = _ref.position,
|
|
22
|
+
schema = _ref.schema,
|
|
23
|
+
context = _ref.context;
|
|
24
|
+
var match = input.substring(position).match(LINK_FORMAT_REGEXP);
|
|
25
|
+
/**
|
|
26
|
+
* The following token types will be ignored in parsing
|
|
27
|
+
* the content of a table cell
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
var ignoreTokenTypes = [_.TokenType.DOUBLE_DASH_SYMBOL, _.TokenType.TRIPLE_DASH_SYMBOL, _.TokenType.QUADRUPLE_DASH_SYMBOL, _.TokenType.TABLE, _.TokenType.RULER, // We want to avoid recursion
|
|
31
|
+
_.TokenType.LINK_TEXT, _.TokenType.LINK_FORMAT];
|
|
32
|
+
|
|
33
|
+
if (!match) {
|
|
34
|
+
return fallback();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
var content = (0, _linkParser.parseContentLink)(match[1]);
|
|
38
|
+
var resolvedLink = (0, _linkResolver.resolveLink)(content, schema, context);
|
|
39
|
+
|
|
40
|
+
if (resolvedLink) {
|
|
41
|
+
return resolvedLink;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
var nodes = (0, _text.parseString)({
|
|
45
|
+
schema: schema,
|
|
46
|
+
context: context,
|
|
47
|
+
ignoreTokenTypes: ignoreTokenTypes,
|
|
48
|
+
input: match[0]
|
|
49
|
+
});
|
|
50
|
+
return {
|
|
51
|
+
type: 'pmnode',
|
|
52
|
+
nodes: nodes,
|
|
53
|
+
length: match[0].length
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
exports.linkFormat = linkFormat;
|
|
58
|
+
|
|
59
|
+
function fallback() {
|
|
60
|
+
return {
|
|
61
|
+
type: 'text',
|
|
62
|
+
text: '[',
|
|
63
|
+
length: 1
|
|
64
|
+
};
|
|
65
|
+
}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.parseLink = parseLink;
|
|
9
|
+
exports.parseContentLink = parseContentLink;
|
|
10
|
+
|
|
11
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
+
|
|
13
|
+
var _text = require("../../utils/text");
|
|
14
|
+
|
|
15
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
16
|
+
|
|
17
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
18
|
+
|
|
19
|
+
/*
|
|
20
|
+
* This implementation is ported from JIRA with minimal modifications
|
|
21
|
+
* It uses a mutable "StringBuffer" to parse links. It would be ideal to
|
|
22
|
+
* move this to operating on immutable strings instead if possible
|
|
23
|
+
*
|
|
24
|
+
* TODO: CS-596 Replace string buffer usage with strings
|
|
25
|
+
*/
|
|
26
|
+
function trimIfPossible(s) {
|
|
27
|
+
if (s === null) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return s.trim();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function extractLinkBody(buffer) {
|
|
35
|
+
var indexOfBang = buffer.indexOf('!');
|
|
36
|
+
var indexOfPipe = buffer.indexOf('|');
|
|
37
|
+
var lastIndexOfBang = buffer.lastIndexOf('!');
|
|
38
|
+
var notEscaped = indexOfBang === -1 || indexOfBang > indexOfPipe || indexOfBang === lastIndexOfBang;
|
|
39
|
+
|
|
40
|
+
if (notEscaped) {
|
|
41
|
+
return divideOn(buffer, '|');
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
var body = new _text.StringBuffer();
|
|
45
|
+
var inEscape = false;
|
|
46
|
+
|
|
47
|
+
for (var i = 0; i < buffer.length(); i++) {
|
|
48
|
+
var c = buffer.charAt(i);
|
|
49
|
+
|
|
50
|
+
if (c === '!') {
|
|
51
|
+
inEscape = !inEscape;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (c === '|' && !inEscape) {
|
|
55
|
+
buffer.delete(0, i + 1);
|
|
56
|
+
return body.toString();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
body.append(c);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function divideAfterLast(buffer, divider) {
|
|
66
|
+
if (buffer.length() === 0) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return divideAfter(buffer, buffer.lastIndexOf(divider));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function divideAfter(buffer, index) {
|
|
74
|
+
if (typeof index === 'string') {
|
|
75
|
+
index = buffer.indexOf(index);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (index < 0) {
|
|
79
|
+
return null;
|
|
80
|
+
} else if (index === buffer.length() - 1) {
|
|
81
|
+
buffer.deleteCharAt(buffer.length() - 1);
|
|
82
|
+
return null;
|
|
83
|
+
} else {
|
|
84
|
+
var body = buffer.substring(index + 1);
|
|
85
|
+
buffer.delete(index, buffer.length());
|
|
86
|
+
return body;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Split a StringBuffer on some dividing character. Return everything before the divider,
|
|
91
|
+
* and remove that prefix _and_ the divider from the StringBuffer. If there is no divider,
|
|
92
|
+
* return null.
|
|
93
|
+
* <p/>
|
|
94
|
+
* If the buffer begins with the divider, then the divider will be removed _and_ null returned.
|
|
95
|
+
* If the buffer ends with the divider, everything before the divider is returned and the buffer
|
|
96
|
+
* will remain empty.
|
|
97
|
+
*
|
|
98
|
+
* @param buffer the text we want to divide. Will be modified during the operation
|
|
99
|
+
* @param divider the character to divide the buffer on
|
|
100
|
+
* @return the characters before the divider, or the default if there are none
|
|
101
|
+
*/
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
function divideOn(buffer, divider) {
|
|
105
|
+
if (buffer.length() === 0) {
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
var i = buffer.indexOf(divider);
|
|
110
|
+
|
|
111
|
+
if (i < 0) {
|
|
112
|
+
return null;
|
|
113
|
+
} else if (i === 0) {
|
|
114
|
+
buffer.deleteCharAt(0);
|
|
115
|
+
return null;
|
|
116
|
+
} else {
|
|
117
|
+
var body = buffer.substring(0, i);
|
|
118
|
+
buffer.delete(0, i + 1);
|
|
119
|
+
return body;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function extractNumber(buf) {
|
|
124
|
+
var digits = new _text.StringBuffer();
|
|
125
|
+
var i = 0;
|
|
126
|
+
|
|
127
|
+
for (; i < buf.length() && (0, _text.isDigit)(buf.charAt(i)); i++) {
|
|
128
|
+
digits.append(buf.charAt(i));
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (i > 0) {
|
|
132
|
+
buf.delete(0, i);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
try {
|
|
136
|
+
return parseInt(digits.toString(), 10);
|
|
137
|
+
} catch (e) {
|
|
138
|
+
return 0;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function parseLink(linkText) {
|
|
143
|
+
var originalLinkText = linkText; // we want to decode single quotes (represented by ') back before parsing the link test
|
|
144
|
+
|
|
145
|
+
if (linkText.indexOf(''') !== -1) {
|
|
146
|
+
linkText = linkText.replace(''', "'");
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
var buf = new _text.StringBuffer(linkText);
|
|
150
|
+
var linkBody = extractLinkBody(buf);
|
|
151
|
+
var linkTitle = trimIfPossible(divideAfter(buf, '|'));
|
|
152
|
+
var notLinkBody = buf.toString().trim();
|
|
153
|
+
return {
|
|
154
|
+
originalLinkText: originalLinkText,
|
|
155
|
+
linkBody: linkBody,
|
|
156
|
+
linkTitle: linkTitle,
|
|
157
|
+
notLinkBody: notLinkBody
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function parseContentLink(link) {
|
|
162
|
+
if (typeof link === 'string') {
|
|
163
|
+
link = parseLink(link);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
var _link = link,
|
|
167
|
+
notLinkBody = _link.notLinkBody;
|
|
168
|
+
var shortcutName = null;
|
|
169
|
+
var shortcutValue = null;
|
|
170
|
+
var spaceKey = null;
|
|
171
|
+
var attachmentName = null;
|
|
172
|
+
var anchor = null;
|
|
173
|
+
var destinationTitle = '';
|
|
174
|
+
var contentId = 0; // Don't treat it as a short link when it starts with "~"
|
|
175
|
+
|
|
176
|
+
if (!notLinkBody.startsWith('~')) {
|
|
177
|
+
var shortcutBuf = new _text.StringBuffer(notLinkBody);
|
|
178
|
+
shortcutName = trimIfPossible(divideAfterLast(shortcutBuf, '@'));
|
|
179
|
+
|
|
180
|
+
if ((0, _text.isNotBlank)(shortcutName)) {
|
|
181
|
+
shortcutValue = shortcutBuf.toString();
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
var buf = new _text.StringBuffer(notLinkBody);
|
|
186
|
+
|
|
187
|
+
if ((0, _text.isBlank)(shortcutName)) {
|
|
188
|
+
spaceKey = trimIfPossible(divideOn(buf, ':'));
|
|
189
|
+
|
|
190
|
+
if (buf.indexOf('$') === 0) {
|
|
191
|
+
buf.deleteCharAt(0);
|
|
192
|
+
contentId = extractNumber(buf);
|
|
193
|
+
|
|
194
|
+
if (contentId === 0) {
|
|
195
|
+
return _objectSpread(_objectSpread({}, link), {}, {
|
|
196
|
+
shortcutName: shortcutName,
|
|
197
|
+
shortcutValue: shortcutValue,
|
|
198
|
+
spaceKey: spaceKey,
|
|
199
|
+
contentId: contentId,
|
|
200
|
+
attachmentName: attachmentName,
|
|
201
|
+
anchor: anchor,
|
|
202
|
+
destinationTitle: destinationTitle
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
attachmentName = trimIfPossible(divideAfter(buf, '^'));
|
|
208
|
+
anchor = trimIfPossible(divideAfter(buf, '#'));
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
if (contentId === 0) {
|
|
212
|
+
destinationTitle = buf.toString().trim();
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
return _objectSpread(_objectSpread({}, link), {}, {
|
|
216
|
+
shortcutName: shortcutName,
|
|
217
|
+
shortcutValue: shortcutValue,
|
|
218
|
+
spaceKey: spaceKey,
|
|
219
|
+
contentId: contentId,
|
|
220
|
+
attachmentName: attachmentName,
|
|
221
|
+
anchor: anchor,
|
|
222
|
+
destinationTitle: destinationTitle
|
|
223
|
+
});
|
|
224
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.resolveLink = resolveLink;
|
|
7
|
+
|
|
8
|
+
var _mentionLink = require("./mention-link");
|
|
9
|
+
|
|
10
|
+
var _attachmentLink = require("./attachment-link");
|
|
11
|
+
|
|
12
|
+
var _urlLink = require("./url-link");
|
|
13
|
+
|
|
14
|
+
var _issueLink = require("./issue-link");
|
|
15
|
+
|
|
16
|
+
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; } } }; }
|
|
17
|
+
|
|
18
|
+
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); }
|
|
19
|
+
|
|
20
|
+
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; }
|
|
21
|
+
|
|
22
|
+
// jira-components/jira-core/src/main/resources/system-contentlinkresolvers-plugin.xml
|
|
23
|
+
// attachment resolver: 10
|
|
24
|
+
// anchor resolver: 20 - unsupported
|
|
25
|
+
// jiraissue resolver: 30 - unsupported
|
|
26
|
+
// user profile: 40
|
|
27
|
+
//
|
|
28
|
+
// Fall back to url link resolver
|
|
29
|
+
var linkResolverStrategies = [_attachmentLink.attachmentLinkResolver, _mentionLink.mentionLinkResolver, _issueLink.issueLinkResolver, _urlLink.urlLinkResolver];
|
|
30
|
+
|
|
31
|
+
function resolveLink(link, schema, context) {
|
|
32
|
+
var length = link.originalLinkText.length + 2;
|
|
33
|
+
|
|
34
|
+
var _iterator = _createForOfIteratorHelper(linkResolverStrategies),
|
|
35
|
+
_step;
|
|
36
|
+
|
|
37
|
+
try {
|
|
38
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
39
|
+
var resolver = _step.value;
|
|
40
|
+
var resolvedLink = resolver(link, schema, context);
|
|
41
|
+
|
|
42
|
+
if (resolvedLink) {
|
|
43
|
+
return {
|
|
44
|
+
length: length,
|
|
45
|
+
nodes: resolvedLink,
|
|
46
|
+
type: 'pmnode'
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
} catch (err) {
|
|
51
|
+
_iterator.e(err);
|
|
52
|
+
} finally {
|
|
53
|
+
_iterator.f();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|