@atlaskit/renderer 107.2.0 → 107.3.0

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.
Files changed (58) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/analytics/enums.js +61 -1
  3. package/dist/cjs/react/index.js +10 -1
  4. package/dist/cjs/react/nodes/codeBlock/codeBlock.js +18 -6
  5. package/dist/cjs/react/nodes/codeBlock/components/codeBlockButtonContainer.js +67 -0
  6. package/dist/cjs/react/nodes/codeBlock/components/codeBlockContainer.js +15 -8
  7. package/dist/cjs/react/nodes/codeBlock/components/codeBlockCopyButton.js +71 -0
  8. package/dist/cjs/react/nodes/codeBlock/components/codeBlockWrapButton.js +76 -0
  9. package/dist/cjs/react/nodes/codeBlock/windowedCodeBlock.js +13 -2
  10. package/dist/cjs/react/nodes/media.js +18 -1
  11. package/dist/cjs/react/nodes/mediaInline.js +19 -4
  12. package/dist/cjs/ui/Renderer/index.js +5 -1
  13. package/dist/cjs/ui/Renderer/style.js +2 -2
  14. package/dist/cjs/version.json +1 -1
  15. package/dist/es2019/analytics/enums.js +55 -1
  16. package/dist/es2019/react/index.js +7 -1
  17. package/dist/es2019/react/nodes/codeBlock/codeBlock.js +10 -3
  18. package/dist/es2019/react/nodes/codeBlock/components/codeBlockButtonContainer.js +59 -0
  19. package/dist/es2019/react/nodes/codeBlock/components/codeBlockContainer.js +25 -8
  20. package/dist/es2019/react/nodes/codeBlock/components/codeBlockCopyButton.js +52 -0
  21. package/dist/es2019/react/nodes/codeBlock/components/codeBlockWrapButton.js +67 -0
  22. package/dist/es2019/react/nodes/codeBlock/windowedCodeBlock.js +9 -4
  23. package/dist/es2019/react/nodes/media.js +18 -1
  24. package/dist/es2019/react/nodes/mediaInline.js +19 -4
  25. package/dist/es2019/ui/Renderer/index.js +5 -1
  26. package/dist/es2019/ui/Renderer/style.js +9 -11
  27. package/dist/es2019/version.json +1 -1
  28. package/dist/esm/analytics/enums.js +55 -1
  29. package/dist/esm/react/index.js +10 -1
  30. package/dist/esm/react/nodes/codeBlock/codeBlock.js +15 -3
  31. package/dist/esm/react/nodes/codeBlock/components/codeBlockButtonContainer.js +58 -0
  32. package/dist/esm/react/nodes/codeBlock/components/codeBlockContainer.js +15 -9
  33. package/dist/esm/react/nodes/codeBlock/components/codeBlockCopyButton.js +59 -0
  34. package/dist/esm/react/nodes/codeBlock/components/codeBlockWrapButton.js +67 -0
  35. package/dist/esm/react/nodes/codeBlock/windowedCodeBlock.js +14 -4
  36. package/dist/esm/react/nodes/media.js +18 -1
  37. package/dist/esm/react/nodes/mediaInline.js +19 -4
  38. package/dist/esm/ui/Renderer/index.js +5 -1
  39. package/dist/esm/ui/Renderer/style.js +2 -2
  40. package/dist/esm/version.json +1 -1
  41. package/dist/types/analytics/enums.d.ts +51 -0
  42. package/dist/types/analytics/events.d.ts +5 -1
  43. package/dist/types/react/index.d.ts +2 -0
  44. package/dist/types/react/nodes/codeBlock/codeBlock.d.ts +1 -0
  45. package/dist/types/react/nodes/codeBlock/components/codeBlockButtonContainer.d.ts +12 -0
  46. package/dist/types/react/nodes/codeBlock/components/codeBlockContainer.d.ts +5 -7
  47. package/dist/types/react/nodes/codeBlock/components/codeBlockWrapButton.d.ts +11 -0
  48. package/dist/types/react/nodes/codeBlock/windowedCodeBlock.d.ts +1 -1
  49. package/dist/types/react/nodes/media.d.ts +3 -2
  50. package/dist/types/react/nodes/mediaInline.d.ts +6 -0
  51. package/dist/types/react/types.d.ts +1 -0
  52. package/dist/types/ui/renderer-props.d.ts +1 -0
  53. package/package.json +11 -11
  54. package/report.api.md +19 -2
  55. package/dist/cjs/react/nodes/codeBlockCopyButton.js +0 -64
  56. package/dist/es2019/react/nodes/codeBlockCopyButton.js +0 -86
  57. package/dist/esm/react/nodes/codeBlockCopyButton.js +0 -54
  58. /package/dist/types/react/nodes/{codeBlockCopyButton.d.ts → codeBlock/components/codeBlockCopyButton.d.ts} +0 -0
@@ -80,7 +80,7 @@ export var rendererStyles = function rendererStyles(wrapperProps) {
80
80
  var themeProps = {
81
81
  theme: theme
82
82
  };
83
- return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n font-size: ", "px;\n line-height: 1.5rem;\n color: ", ";\n\n .", "::after {\n // we add a clearfix after ak-renderer-document in order to\n // contain internal floats (such as media images that are \"wrap-left\")\n // to just the renderer (and not spill outside of it)\n content: '';\n visibility: hidden;\n display: block;\n height: 0;\n clear: both;\n }\n\n ", "\n ", "\n\n & h1 {\n ", "\n }\n\n & h2 {\n ", "\n }\n\n & h3 {\n ", "\n }\n\n & h4 {\n ", "\n }\n\n & h5 {\n ", "\n }\n\n & h6 {\n ", "\n }\n\n & span.akActionMark {\n color: ", ";\n text-decoration: none;\n\n &:hover {\n color: ", ";\n text-decoration: underline;\n }\n\n &:active {\n color: ", ";\n }\n }\n\n & span.akActionMark {\n cursor: pointer;\n }\n\n & span[data-placeholder] {\n color: ", ";\n }\n\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", "\n\n & .UnknownBlock {\n font-family: ", ";\n font-size: ", ";\n font-weight: 400;\n white-space: pre-wrap;\n word-wrap: break-word;\n }\n\n & span.date-node {\n background: ", ";\n border-radius: ", "px;\n color: ", ";\n padding: 2px 4px;\n margin: 0 1px;\n transition: background 0.3s;\n }\n\n & span.date-node-highlighted {\n background: ", ";\n color: ", ";\n }\n\n & .renderer-image {\n max-width: 100%;\n display: block;\n margin: ", "px 0;\n }\n\n .", ".rich-media-wrapped\n + .", ":not(.rich-media-wrapped) {\n clear: both;\n }\n\n & .code-block,\n & blockquote,\n & hr,\n & > div > div:not(.rich-media-wrapped),\n .", ".rich-media-wrapped\n + .rich-media-wrapped\n + *:not(.rich-media-wrapped),\n .", ".rich-media-wrapped + div:not(.rich-media-wrapped),\n .", ".image-align-start,\n .", ".image-center,\n .", ".image-align-end {\n clear: both;\n }\n\n & .rich-media-wrapped {\n & + h1,\n & + h2,\n & + h3,\n & + h4,\n & + h5,\n & + h6 {\n margin-top: 8px;\n }\n }\n\n ", "\n /* plugin styles */\n ", " &\n div[class^='image-wrap-'] + div[class^='image-wrap-'] {\n margin-left: 0;\n margin-right: 0;\n }\n\n /* Breakout for tables and extensions */\n .", " > {\n * .", " {\n width: 100% !important;\n left: 0 !important;\n }\n\n * .", " {\n overflow-x: auto;\n }\n\n & .", ":first-child {\n margin-top: 0;\n }\n }\n\n .", " {\n .", " {\n margin-top: ", ";\n }\n\n .", " {\n margin-left: 50%;\n transform: translateX(-50%);\n }\n\n .", " {\n overflow-x: auto;\n }\n\n .", "\n .", " {\n display: flex;\n }\n }\n\n ", "\n\n .", " .", " {\n z-index: 0;\n transition: all 0.1s linear;\n display: flex; /* needed to avoid position: fixed jumpiness in Chrome */\n\n /** Shadow overrides */\n &.", "::after,\n &.", "::before {\n top: ", "px;\n height: calc(100% - ", "px);\n z-index: ", ";\n }\n\n &\n .", ",\n &\n .", " {\n height: calc(100% - ", "px);\n }\n\n /**\n * A hack for making all the <th /> heights equal in case some have shorter\n * content than others.\n *\n * This is done to make sort buttons fill entire <th />.\n */\n table {\n height: 1px; /* will be ignored */\n ", ";\n margin-left: 0;\n margin-right: 0;\n }\n\n table tr:first-of-type {\n height: 100%;\n\n td,\n th {\n position: relative;\n }\n }\n\n table[data-number-column='true'] {\n .", " {\n background-color: ", ";\n border-right: 1px solid\n ", ";\n width: ", "px;\n text-align: center;\n color: ", ";\n font-size: ", ";\n }\n\n .fixed .", " {\n border-right: 0px none;\n }\n }\n }\n\n tr[data-header-row].fixed {\n position: fixed !important;\n display: flex;\n overflow: hidden;\n z-index: ", ";\n\n border-right: 1px solid\n ", ";\n border-bottom: 1px solid\n ", ";\n\n /* this is to compensate for the table border */\n transform: translateX(-1px);\n }\n\n .sticky > th {\n z-index: ", ";\n position: sticky !important;\n top: 0;\n }\n\n /* Make the number column header sticky */\n .sticky > td {\n position: sticky !important;\n top: 0;\n }\n\n /* add border for position: sticky\n and work around background-clip: padding-box\n bug for FF causing box-shadow bug in Chrome */\n .sticky th,\n .sticky td {\n box-shadow: 0px 1px\n ", ",\n 0px -0.5px ", ",\n inset -1px 0px ", ",\n 0px -1px ", ";\n }\n\n /* this will remove jumpiness caused in Chrome for sticky headers */\n .fixed + tr {\n min-height: 0px;\n }\n\n /*\n * We wrap CodeBlock in a grid to prevent it from overflowing the container of the renderer.\n * See ED-4159.\n */\n & .code-block {\n max-width: 100%;\n /* -ms- properties are necessary until MS supports the latest version of the grid spec */\n /* stylelint-disable value-no-vendor-prefix, declaration-block-no-duplicate-properties */\n display: -ms-grid;\n display: grid;\n -ms-grid-columns: auto 1fr;\n /* stylelint-enable */\n\n grid-template-columns: minmax(0, 1fr);\n position: relative;\n border-radius: ", "px;\n\n /*\n * The overall renderer has word-wrap: break; which causes issues with\n * code block line numbers in Safari / iOS.\n */\n word-wrap: normal;\n\n & > span {\n /* stylelint-disable value-no-vendor-prefix */\n -ms-grid-row: 1;\n -ms-grid-column: 2;\n /* stylelint-enable */\n grid-column: 1;\n }\n }\n\n & .MediaGroup,\n & .code-block {\n margin-top: ", ";\n\n &:first-child {\n margin-top: 0;\n }\n\n &:hover button.copy-to-clipboard,\n .copy-to-clipboard:focus {\n opacity: 1;\n position: absolute;\n height: 32px;\n width: 32px;\n right: 6px;\n top: 4px;\n padding: 2px;\n }\n }\n\n ", "\n\n ", ";\n & [data-layout-section] {\n margin-top: ", "px;\n & > div + div {\n margin-left: ", "px;\n }\n\n @media screen and (max-width: ", "px) {\n & > div + div {\n margin-left: 0;\n }\n }\n }\n\n & li {\n > .code-block {\n margin: ", " 0 0 0;\n }\n > .code-block:first-child {\n margin-top: 0;\n }\n\n > div:last-of-type.code-block {\n margin-bottom: ", ";\n }\n }\n\n & :not([data-node-type='decisionList']) > li {\n ", "\n }\n "])), editorFontSize(themeProps), themed({
83
+ return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n font-size: ", "px;\n line-height: 1.5rem;\n color: ", ";\n\n .", "::after {\n // we add a clearfix after ak-renderer-document in order to\n // contain internal floats (such as media images that are \"wrap-left\")\n // to just the renderer (and not spill outside of it)\n content: '';\n visibility: hidden;\n display: block;\n height: 0;\n clear: both;\n }\n\n ", "\n ", "\n\n & h1 {\n ", "\n }\n\n & h2 {\n ", "\n }\n\n & h3 {\n ", "\n }\n\n & h4 {\n ", "\n }\n\n & h5 {\n ", "\n }\n\n & h6 {\n ", "\n }\n\n & span.akActionMark {\n color: ", ";\n text-decoration: none;\n\n &:hover {\n color: ", ";\n text-decoration: underline;\n }\n\n &:active {\n color: ", ";\n }\n }\n\n & span.akActionMark {\n cursor: pointer;\n }\n\n & span[data-placeholder] {\n color: ", ";\n }\n\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", "\n\n & .UnknownBlock {\n font-family: ", ";\n font-size: ", ";\n font-weight: 400;\n white-space: pre-wrap;\n word-wrap: break-word;\n }\n\n & span.date-node {\n background: ", ";\n border-radius: ", "px;\n color: ", ";\n padding: 2px 4px;\n margin: 0 1px;\n transition: background 0.3s;\n }\n\n & span.date-node-highlighted {\n background: ", ";\n color: ", ";\n }\n\n & .renderer-image {\n max-width: 100%;\n display: block;\n margin: ", "px 0;\n }\n\n .", ".rich-media-wrapped\n + .", ":not(.rich-media-wrapped) {\n clear: both;\n }\n\n & .code-block,\n & blockquote,\n & hr,\n & > div > div:not(.rich-media-wrapped),\n .", ".rich-media-wrapped\n + .rich-media-wrapped\n + *:not(.rich-media-wrapped),\n .", ".rich-media-wrapped + div:not(.rich-media-wrapped),\n .", ".image-align-start,\n .", ".image-center,\n .", ".image-align-end {\n clear: both;\n }\n\n & .rich-media-wrapped {\n & + h1,\n & + h2,\n & + h3,\n & + h4,\n & + h5,\n & + h6 {\n margin-top: 8px;\n }\n }\n\n ", "\n /* plugin styles */\n ", " &\n div[class^='image-wrap-'] + div[class^='image-wrap-'] {\n margin-left: 0;\n margin-right: 0;\n }\n\n /* Breakout for tables and extensions */\n .", " > {\n * .", " {\n width: 100% !important;\n left: 0 !important;\n }\n\n * .", " {\n overflow-x: auto;\n }\n\n & .", ":first-child {\n margin-top: 0;\n }\n }\n\n .", " {\n .", " {\n margin-top: ", ";\n }\n\n .", " {\n margin-left: 50%;\n transform: translateX(-50%);\n }\n\n .", " {\n overflow-x: auto;\n }\n\n .", "\n .", " {\n display: flex;\n }\n }\n\n ", "\n\n .", " .", " {\n z-index: 0;\n transition: all 0.1s linear;\n display: flex; /* needed to avoid position: fixed jumpiness in Chrome */\n\n /** Shadow overrides */\n &.", "::after,\n &.", "::before {\n top: ", "px;\n height: calc(100% - ", "px);\n z-index: ", ";\n }\n\n &\n .", ",\n &\n .", " {\n height: calc(100% - ", "px);\n }\n\n /**\n * A hack for making all the <th /> heights equal in case some have shorter\n * content than others.\n *\n * This is done to make sort buttons fill entire <th />.\n */\n table {\n height: 1px; /* will be ignored */\n ", ";\n margin-left: 0;\n margin-right: 0;\n }\n\n table tr:first-of-type {\n height: 100%;\n\n td,\n th {\n position: relative;\n }\n }\n\n table[data-number-column='true'] {\n .", " {\n background-color: ", ";\n border-right: 1px solid\n ", ";\n width: ", "px;\n text-align: center;\n color: ", ";\n font-size: ", ";\n }\n\n .fixed .", " {\n border-right: 0px none;\n }\n }\n }\n\n tr[data-header-row].fixed {\n position: fixed !important;\n display: flex;\n overflow: hidden;\n z-index: ", ";\n\n border-right: 1px solid\n ", ";\n border-bottom: 1px solid\n ", ";\n\n /* this is to compensate for the table border */\n transform: translateX(-1px);\n }\n\n .sticky > th {\n z-index: ", ";\n position: sticky !important;\n top: 0;\n }\n\n /* Make the number column header sticky */\n .sticky > td {\n position: sticky !important;\n top: 0;\n }\n\n /* add border for position: sticky\n and work around background-clip: padding-box\n bug for FF causing box-shadow bug in Chrome */\n .sticky th,\n .sticky td {\n box-shadow: 0px 1px\n ", ",\n 0px -0.5px ", ",\n inset -1px 0px ", ",\n 0px -1px ", ";\n }\n\n /* this will remove jumpiness caused in Chrome for sticky headers */\n .fixed + tr {\n min-height: 0px;\n }\n\n /*\n * We wrap CodeBlock in a grid to prevent it from overflowing the container of the renderer.\n * See ED-4159.\n */\n & .code-block {\n max-width: 100%;\n /* -ms- properties are necessary until MS supports the latest version of the grid spec */\n /* stylelint-disable value-no-vendor-prefix, declaration-block-no-duplicate-properties */\n display: -ms-grid;\n display: grid;\n -ms-grid-columns: auto 1fr;\n /* stylelint-enable */\n\n grid-template-columns: minmax(0, 1fr);\n position: relative;\n border-radius: ", "px;\n\n /*\n * The overall renderer has word-wrap: break; which causes issues with\n * code block line numbers in Safari / iOS.\n */\n word-wrap: normal;\n\n & > span {\n /* stylelint-disable value-no-vendor-prefix */\n -ms-grid-row: 1;\n -ms-grid-column: 2;\n /* stylelint-enable */\n grid-column: 1;\n }\n }\n\n & .MediaGroup,\n & .code-block {\n margin-top: ", ";\n\n &:first-child {\n margin-top: 0;\n }\n }\n\n ", "\n\n ", ";\n & [data-layout-section] {\n margin-top: ", "px;\n & > div + div {\n margin-left: ", "px;\n }\n\n @media screen and (max-width: ", "px) {\n & > div + div {\n margin-left: 0;\n }\n }\n\n & .MediaGroup,\n & .code-block {\n margin-top: ", ";\n\n &:first-child {\n margin-top: 0;\n }\n }\n }\n\n & li {\n > .code-block {\n margin: ", " 0 0 0;\n }\n > .code-block:first-child {\n margin-top: 0;\n }\n\n > div:last-of-type.code-block {\n margin-bottom: ", ";\n }\n }\n\n & :not([data-node-type='decisionList']) > li {\n ", "\n }\n "])), editorFontSize(themeProps), themed({
84
84
  light: "var(--ds-text, ".concat(colors.N800, ")"),
85
85
  dark: "var(--ds-text, #B8C7E0)"
86
86
  })(themeProps), RendererCssClassName.DOCUMENT, fullPageStyles(wrapperProps, themeProps), fullWidthStyles(wrapperProps), headingAnchorStyle('h1'), headingAnchorStyle('h2'), headingAnchorStyle('h3'), headingAnchorStyle('h4'), headingAnchorStyle('h5'), headingAnchorStyle('h6'), "var(--ds-link, ".concat(colors.B400, ")"), "var(--ds-link, ".concat(colors.B300, ")"), "var(--ds-link-pressed, ".concat(colors.B500, ")"), colors.placeholderText(themeProps), whitespaceSharedStyles, blockquoteSharedStyles, headingsSharedStyles(themeProps), ruleSharedStyles(themeProps), paragraphSharedStyles, listsSharedStyles, indentationSharedStyles, blockMarksSharedStyles, codeMarkSharedStyles(themeProps), shadowSharedStyle, dateSharedStyle, textColorStyles, tasksAndDecisionsStyles, smartCardSharedStyles, fontFamily(), relativeFontSizeToBase16(fontSize()), themed({
@@ -116,6 +116,6 @@ export var rendererStyles = function rendererStyles(wrapperProps) {
116
116
  })(themeProps), themed({
117
117
  light: "var(--ds-border, ".concat(akEditorTableToolbar, ")"),
118
118
  dark: "var(--ds-border, ".concat(akEditorTableToolbarDark, ")")
119
- })(themeProps), borderRadius(), blockNodesVerticalMargin, getLightWeightCodeBlockStylesForRootRendererStyleSheet(), columnLayoutSharedStyle, gridSize() * 2.5, gridSize() * 4, gridMediumMaxWidth, blockNodesVerticalMargin, blockNodesVerticalMargin, browser.safari ? codeBlockInListSafariFix : '');
119
+ })(themeProps), borderRadius(), blockNodesVerticalMargin, getLightWeightCodeBlockStylesForRootRendererStyleSheet(), columnLayoutSharedStyle, gridSize() * 2.5, gridSize() * 4, gridMediumMaxWidth, blockNodesVerticalMargin, blockNodesVerticalMargin, blockNodesVerticalMargin, browser.safari ? codeBlockInListSafariFix : '');
120
120
  };
121
121
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/renderer",
3
- "version": "107.2.0",
3
+ "version": "107.3.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,3 +1,54 @@
1
+ export declare enum EVENT_TYPE {
2
+ OPERATIONAL = "operational",
3
+ SCREEN = "screen",
4
+ TRACK = "track",
5
+ UI = "ui"
6
+ }
7
+ export declare enum ACTION {
8
+ STARTED = "started",
9
+ RENDERED = "rendered",
10
+ RE_RENDERED = "reRendered",
11
+ RENDERER_TTI = "tti",
12
+ CRASHED = "unhandledErrorCaught",
13
+ INVALID_PROSEMIRROR_DOCUMENT = "invalidProsemirrorDocument",
14
+ SELECT_ALL_CAUGHT = "selectAllCaught",
15
+ SELECT_ALL_ESCAPED = "selectAllEscaped",
16
+ CLICKED = "clicked",
17
+ VIEWED = "viewed",
18
+ VISITED = "visited",
19
+ SORT_COLUMN = "sortedColumn",
20
+ SORT_COLUMN_NOT_ALLOWED = "sortColumnNotAllowed",
21
+ TOGGLE_EXPAND = "toggleExpand",
22
+ INSERTED = "inserted",
23
+ OPENED = "opened",
24
+ CLOSED = "closed",
25
+ DELETED = "deleted",
26
+ EDITED = "edited",
27
+ RESOLVED = "resolved",
28
+ CREATE_NOT_ALLOWED = "createNotAllowed",
29
+ UNSUPPORTED_CONTENT_LEVELS_TRACKING_SUCCEEDED = "unsupportedContentLevelsTrackingSucceeded",
30
+ UNSUPPORTED_CONTENT_LEVELS_TRACKING_ERRORED = "unsupportedContentLevelsTrackingErrored",
31
+ MEDIA_LINK_TRANSFORMED = "mediaLinkTransformed"
32
+ }
33
+ export declare enum ACTION_SUBJECT {
34
+ RENDERER = "renderer",
35
+ BUTTON = "button",
36
+ ANCHOR_LINK = "anchorLink",
37
+ TABLE = "table",
38
+ EXPAND = "expand",
39
+ NESTED_EXPAND = "nestedExpand",
40
+ MEDIA_SINGLE = "mediaSingle",
41
+ LINK = "link",
42
+ ANNOTATION = "annotation",
43
+ MEDIA = "media"
44
+ }
45
+ export declare enum ACTION_SUBJECT_ID {
46
+ HEADING_ANCHOR_LINK = "headingAnchorLink",
47
+ LINK = "link",
48
+ INLINE_COMMENT = "inlineComment",
49
+ CODEBLOCK_COPY = "codeBlockCopy",
50
+ CODEBLOCK_WRAP = "codeBlockWrap"
51
+ }
1
52
  export declare type AEP<Action, ActionSubject, ActionSubjectID, Attributes, EventType> = {
2
53
  action: Action;
3
54
  actionSubject: ActionSubject;
@@ -65,6 +65,10 @@ declare type AnchorLinkAEP = UIAEP<ACTION.VIEWED, ACTION_SUBJECT.ANCHOR_LINK, un
65
65
  platform: PLATFORM.WEB;
66
66
  mode: MODE.RENDERER;
67
67
  }>;
68
+ declare type CodeBlockCopyAEP = ButtonAEP<ACTION_SUBJECT_ID.CODEBLOCK_COPY, undefined>;
69
+ declare type CodeBlockWrapAEP = ButtonAEP<ACTION_SUBJECT_ID.CODEBLOCK_WRAP, {
70
+ wrapped: boolean;
71
+ }>;
68
72
  declare type HeadingAnchorLinkButtonAEP = ButtonAEP<ACTION_SUBJECT_ID.HEADING_ANCHOR_LINK, undefined>;
69
73
  declare type TableSortColumnNotAllowedAEP = AEP<ACTION.SORT_COLUMN_NOT_ALLOWED, ACTION_SUBJECT.TABLE, undefined, {
70
74
  platform: PLATFORM.WEB;
@@ -110,5 +114,5 @@ declare type RendererTTIAEP = AEP<ACTION.RENDERER_TTI, ACTION_SUBJECT.RENDERER,
110
114
  ttiFromInvocation: number;
111
115
  canceled: boolean;
112
116
  }, EVENT_TYPE.OPERATIONAL>;
113
- export declare type AnalyticsEventPayload<T = void> = RendererStartAEP | RendererRenderedAEP | RendererReRenderedAEP<T> | ComponentCrashErrorAEP | RendererUnsupportedContentLevelsTrackingSucceeded | RendererUnsupportedContentLevelsTrackingErrored | RendererSelectAllCaughtAEP | RendererSelectAllEscapedAEP | HeadingAnchorLinkButtonAEP | AnchorLinkAEP | TableSortColumnNotAllowedAEP | TableSortColumnAEP | VisitLinkAEP | VisitMediaLinkAEP | ExpandAEP | UnsupportedContentPayload | UnsupportedContentTooltipPayload | AnnotationAEP | AnnotationDeleteAEP | MediaLnkTransformedAEP | InvalidProsemirrorDocumentErrorAEP | RendererTTIAEP;
117
+ export declare type AnalyticsEventPayload<T = void> = RendererStartAEP | RendererRenderedAEP | RendererReRenderedAEP<T> | ComponentCrashErrorAEP | RendererUnsupportedContentLevelsTrackingSucceeded | RendererUnsupportedContentLevelsTrackingErrored | RendererSelectAllCaughtAEP | RendererSelectAllEscapedAEP | CodeBlockCopyAEP | CodeBlockWrapAEP | HeadingAnchorLinkButtonAEP | AnchorLinkAEP | TableSortColumnNotAllowedAEP | TableSortColumnAEP | VisitLinkAEP | VisitMediaLinkAEP | ExpandAEP | UnsupportedContentPayload | UnsupportedContentTooltipPayload | AnnotationAEP | AnnotationDeleteAEP | MediaLnkTransformedAEP | InvalidProsemirrorDocumentErrorAEP | RendererTTIAEP;
114
118
  export {};
@@ -32,6 +32,7 @@ export interface ReactSerializerInit {
32
32
  emojiResourceConfig?: EmojiResourceConfig;
33
33
  smartLinks?: SmartLinksOptions;
34
34
  allowCopyToClipboard?: boolean;
35
+ allowWrapCodeBlock?: boolean;
35
36
  allowPlaceholderText?: boolean;
36
37
  allowCustomPanels?: boolean;
37
38
  allowAnnotations?: boolean;
@@ -66,6 +67,7 @@ export default class ReactSerializer implements Serializer<JSX.Element> {
66
67
  private allowHeadingAnchorLinks?;
67
68
  private allowColumnSorting?;
68
69
  private allowCopyToClipboard?;
70
+ private allowWrapCodeBlock?;
69
71
  private allowPlaceholderText?;
70
72
  private allowCustomPanels?;
71
73
  private fireAnalyticsEvent?;
@@ -5,6 +5,7 @@ export interface Props {
5
5
  text: string;
6
6
  language: SupportedLanguages;
7
7
  allowCopyToClipboard?: boolean;
8
+ allowWrapCodeBlock?: boolean;
8
9
  codeBidiWarningTooltipEnabled: boolean;
9
10
  className?: string;
10
11
  }
@@ -0,0 +1,12 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import type { Dispatch, SetStateAction } from 'react';
4
+ export interface CodeBlockButtonContainerProps {
5
+ allowCopyToClipboard?: boolean;
6
+ allowWrapCodeBlock?: boolean;
7
+ setWrapLongLines: Dispatch<SetStateAction<boolean>>;
8
+ text: string;
9
+ wrapLongLines: boolean;
10
+ }
11
+ declare const CodeBlockButtonContainer: ({ allowCopyToClipboard, allowWrapCodeBlock, setWrapLongLines, text, wrapLongLines, }: CodeBlockButtonContainerProps) => jsx.JSX.Element;
12
+ export default CodeBlockButtonContainer;
@@ -1,12 +1,10 @@
1
1
  /** @jsx jsx */
2
- import type { ReactNode } from 'react';
3
2
  import { jsx } from '@emotion/react';
4
- import { Props as CodeBlockProps } from '../codeBlock';
5
- interface ContainerProps {
6
- className?: string;
7
- text: CodeBlockProps['text'];
3
+ import type { ReactNode } from 'react';
4
+ import type { CodeBlockButtonContainerProps } from './codeBlockButtonContainer';
5
+ interface ContainerProps extends CodeBlockButtonContainerProps {
8
6
  children: ReactNode;
9
- allowCopyToClipboard?: boolean;
7
+ className?: string;
10
8
  }
11
- declare const CodeBlockContainer: ({ text, className, allowCopyToClipboard, children, }: ContainerProps) => jsx.JSX.Element;
9
+ declare const CodeBlockContainer: ({ allowCopyToClipboard, allowWrapCodeBlock, children, className, setWrapLongLines, text, wrapLongLines, }: ContainerProps) => jsx.JSX.Element;
12
10
  export default CodeBlockContainer;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import type { Dispatch, SetStateAction } from 'react';
3
+ import { WrappedComponentProps } from 'react-intl-next';
4
+ declare type Props = {
5
+ setWrapLongLines: Dispatch<SetStateAction<boolean>>;
6
+ wrapLongLines?: boolean;
7
+ };
8
+ declare const _default: React.FC<import("react-intl-next").WithIntlProps<Props & WrappedComponentProps<"intl">>> & {
9
+ WrappedComponent: React.ComponentType<Props & WrappedComponentProps<"intl">>;
10
+ };
11
+ export default _default;
@@ -1,4 +1,4 @@
1
1
  import { jsx } from '@emotion/react';
2
2
  import type { Props as CodeBlockProps } from './codeBlock';
3
- declare const WindowedCodeBlock: ({ text, language, allowCopyToClipboard, codeBidiWarningTooltipEnabled, className: rootClassName, }: CodeBlockProps) => jsx.JSX.Element;
3
+ declare const WindowedCodeBlock: ({ text, language, allowCopyToClipboard, allowWrapCodeBlock, codeBidiWarningTooltipEnabled, className: rootClassName, }: CodeBlockProps) => jsx.JSX.Element;
4
4
  export default WindowedCodeBlock;
@@ -5,7 +5,7 @@ import { jsx } from '@emotion/react';
5
5
  import type { EventHandlers } from '@atlaskit/editor-common/ui';
6
6
  import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
7
7
  import { MediaCardProps } from '../../ui/MediaCard';
8
- import { LinkDefinition } from '@atlaskit/adf-schema';
8
+ import { LinkDefinition, BorderMarkDefinition } from '@atlaskit/adf-schema';
9
9
  import type { MediaFeatureFlags } from '@atlaskit/media-common';
10
10
  import { AnalyticsEventPayload } from '../../analytics/events';
11
11
  export declare type MediaProps = MediaCardProps & {
@@ -13,7 +13,8 @@ export declare type MediaProps = MediaCardProps & {
13
13
  allowAltTextOnImages?: boolean;
14
14
  children?: React.ReactNode;
15
15
  isInsideOfBlockNode?: boolean;
16
- marks: Array<LinkDefinition>;
16
+ marks: Array<LinkDefinition | BorderMarkDefinition>;
17
+ isBorderMark: () => boolean;
17
18
  isLinkMark: () => boolean;
18
19
  fireAnalyticsEvent?: (event: AnalyticsEventPayload) => void;
19
20
  featureFlags?: MediaFeatureFlags;
@@ -3,15 +3,21 @@ import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
3
3
  import { FileIdentifier } from '@atlaskit/media-client';
4
4
  import { MediaProvider } from '../../ui/MediaCard';
5
5
  import { WrappedComponentProps } from 'react-intl-next';
6
+ import type { EventHandlers } from '@atlaskit/editor-common/ui';
7
+ import { RendererAppearance } from '../../ui/Renderer/types';
6
8
  export declare type RenderMediaInlineProps = {
7
9
  identifier: FileIdentifier;
8
10
  mediaProvider: Promise<MediaProvider>;
9
11
  children?: React.ReactNode;
12
+ eventHandlers?: EventHandlers;
13
+ rendererAppearance?: RendererAppearance;
10
14
  };
11
15
  export declare type MediaInlineProps = {
12
16
  id: string;
13
17
  collection?: string;
14
18
  providers: ProviderFactory;
19
+ eventHandlers?: EventHandlers;
20
+ rendererAppearance?: RendererAppearance;
15
21
  };
16
22
  export declare const RenderMediaInline: React.FC<RenderMediaInlineProps>;
17
23
  declare const _default: React.FC<import("react-intl-next").WithIntlProps<MediaInlineProps & WrappedComponentProps<"intl">>> & {
@@ -26,6 +26,7 @@ export interface NodeMeta {
26
26
  } | null;
27
27
  allowHeadingAnchorLinks?: HeadingAnchorLinksProps;
28
28
  allowCopyToClipboard?: boolean;
29
+ allowWrapCodeBlock?: boolean;
29
30
  allowPlaceholderText?: boolean;
30
31
  allowCustomPanels?: boolean;
31
32
  rendererAppearance?: RendererAppearance;
@@ -59,6 +59,7 @@ export interface RendererProps {
59
59
  innerRef?: React.RefObject<HTMLDivElement>;
60
60
  useSpecBasedValidator?: boolean;
61
61
  allowCopyToClipboard?: boolean;
62
+ allowWrapCodeBlock?: boolean;
62
63
  allowCustomPanels?: boolean;
63
64
  analyticsEventSeverityTracking?: {
64
65
  enabled: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/renderer",
3
- "version": "107.2.0",
3
+ "version": "107.3.0",
4
4
  "description": "Renderer component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -24,18 +24,18 @@
24
24
  }
25
25
  },
26
26
  "dependencies": {
27
- "@atlaskit/adf-schema": "^25.3.0",
28
- "@atlaskit/adf-utils": "^18.0.0",
27
+ "@atlaskit/adf-schema": "^25.4.0",
28
+ "@atlaskit/adf-utils": "^18.1.0",
29
29
  "@atlaskit/analytics-listeners": "^8.5.0",
30
30
  "@atlaskit/analytics-namespaced-context": "^6.6.0",
31
31
  "@atlaskit/analytics-next": "^9.0.0",
32
32
  "@atlaskit/button": "^16.6.0",
33
- "@atlaskit/code": "^14.5.0",
34
- "@atlaskit/editor-common": "^72.6.0",
33
+ "@atlaskit/code": "^14.5.3",
34
+ "@atlaskit/editor-common": "^72.7.0",
35
35
  "@atlaskit/editor-json-transformer": "^8.8.0",
36
- "@atlaskit/editor-palette": "1.1.0",
36
+ "@atlaskit/editor-palette": "1.2.0",
37
37
  "@atlaskit/editor-shared-styles": "^2.3.0",
38
- "@atlaskit/emoji": "^67.2.0",
38
+ "@atlaskit/emoji": "^67.3.0",
39
39
  "@atlaskit/icon": "^21.11.0",
40
40
  "@atlaskit/media-card": "^74.7.0",
41
41
  "@atlaskit/media-client": "^20.2.0",
@@ -43,7 +43,7 @@
43
43
  "@atlaskit/media-filmstrip": "^46.1.0",
44
44
  "@atlaskit/media-ui": "^22.3.0",
45
45
  "@atlaskit/media-viewer": "^47.5.0",
46
- "@atlaskit/smart-card": "^25.1.0",
46
+ "@atlaskit/smart-card": "^25.2.0",
47
47
  "@atlaskit/status": "^1.2.0",
48
48
  "@atlaskit/task-decision": "^17.5.0",
49
49
  "@atlaskit/theme": "^12.3.0",
@@ -71,8 +71,8 @@
71
71
  "@atlaskit/avatar": "^21.2.0",
72
72
  "@atlaskit/css-reset": "^6.3.0",
73
73
  "@atlaskit/docs": "*",
74
- "@atlaskit/editor-core": "^181.0.0",
75
- "@atlaskit/editor-test-helpers": "^18.1.0",
74
+ "@atlaskit/editor-core": "^182.0.0",
75
+ "@atlaskit/editor-test-helpers": "^18.2.0",
76
76
  "@atlaskit/link-provider": "^1.5.0",
77
77
  "@atlaskit/logo": "^13.11.0",
78
78
  "@atlaskit/media-core": "^34.0.0",
@@ -119,4 +119,4 @@
119
119
  ]
120
120
  }
121
121
  }
122
- }
122
+ }
package/report.api.md CHANGED
@@ -69,6 +69,8 @@ type AnalyticsEventPayload<T = void> =
69
69
  | AnchorLinkAEP
70
70
  | AnnotationAEP
71
71
  | AnnotationDeleteAEP
72
+ | CodeBlockCopyAEP
73
+ | CodeBlockWrapAEP
72
74
  | ComponentCrashErrorAEP
73
75
  | ExpandAEP
74
76
  | HeadingAnchorLinkButtonAEP
@@ -152,6 +154,17 @@ type ButtonAEP<ActionSubjectID, Attributes> = UIAEP<
152
154
  Attributes
153
155
  >;
154
156
 
157
+ // @public (undocumented)
158
+ type CodeBlockCopyAEP = ButtonAEP<ACTION_SUBJECT_ID.CODEBLOCK_COPY, undefined>;
159
+
160
+ // @public (undocumented)
161
+ type CodeBlockWrapAEP = ButtonAEP<
162
+ ACTION_SUBJECT_ID.CODEBLOCK_WRAP,
163
+ {
164
+ wrapped: boolean;
165
+ }
166
+ >;
167
+
155
168
  // @public (undocumented)
156
169
  type ComponentCrashErrorAEP = OperationalAEP<
157
170
  ACTION.CRASHED,
@@ -325,6 +338,8 @@ interface ReactSerializerInit {
325
338
  // (undocumented)
326
339
  allowWindowedCodeBlock?: boolean;
327
340
  // (undocumented)
341
+ allowWrapCodeBlock?: boolean;
342
+ // (undocumented)
328
343
  appearance?: RendererAppearance;
329
344
  // (undocumented)
330
345
  disableActions?: boolean;
@@ -416,6 +431,8 @@ export interface RendererProps {
416
431
  // (undocumented)
417
432
  allowUgcScrubber?: boolean;
418
433
  // (undocumented)
434
+ allowWrapCodeBlock?: boolean;
435
+ // (undocumented)
419
436
  analyticsEventSeverityTracking?: {
420
437
  enabled: boolean;
421
438
  severityNormalThreshold: number;
@@ -742,8 +759,8 @@ type VisitMediaLinkAEP = AEP<
742
759
 
743
760
  ```json
744
761
  {
745
- "@atlaskit/link-provider": "^1.5.0",
746
- "@atlaskit/media-core": "^34.0.1",
762
+ "@atlaskit/link-provider": "^1.5.1",
763
+ "@atlaskit/media-core": "^34.0.2",
747
764
  "react": "^16.8.0",
748
765
  "react-dom": "^16.8.0"
749
766
  }
@@ -1,64 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
11
- var _react = require("@emotion/react");
12
- var _react2 = _interopRequireWildcard(require("react"));
13
- var _reactIntlNext = require("react-intl-next");
14
- var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
15
- var _button = _interopRequireDefault(require("@atlaskit/button"));
16
- var _copy = _interopRequireDefault(require("@atlaskit/icon/glyph/copy"));
17
- var _colors = require("@atlaskit/theme/colors");
18
- var _clipboard = require("../utils/clipboard");
19
- var _messages = require("@atlaskit/editor-common/messages");
20
- var _templateObject;
21
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
22
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
- var copyButtonWrapperStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n position: sticky;\n justify-content: flex-end;\n top: 0;\n\n button {\n position: absolute;\n display: flex;\n justify-content: center;\n height: 32px;\n width: 32px;\n right: 6px;\n top: 4px;\n padding: 2px;\n opacity: 0;\n transition: opacity 0.2s ease 0s;\n border: 2px solid ", ";\n border-radius: 4px;\n background-color: ", ";\n color: ", " !important;\n }\n\n button:hover {\n border: 2px solid ", ";\n background-color: ", ";\n }\n\n button:active {\n border: 2px solid ", ";\n background-color: ", ";\n }\n\n button.clicked {\n background-color: ", ";\n color: ", " !important;\n }\n button.clicked:hover {\n background-color: ", ";\n }\n"])), "var(--ds-border, #fff)", "var(--ds-surface-overlay, ".concat(_colors.N20, ")"), "var(--ds-text, rgb(66, 82, 110))", "var(--ds-border, transparent)", "var(--ds-surface-overlay-hovered, ".concat(_colors.N30, ")"), "var(--ds-border, transparent)", "var(--ds-surface-overlay-pressed, ".concat(_colors.N30, ")"), "var(--ds-surface-overlay, ".concat(_colors.N700, ")"), "var(--ds-text, #fff)", "var(--ds-surface-overlay-hovered, ".concat(_colors.N700, ")"));
24
- var CopyButton = function CopyButton(_ref) {
25
- var content = _ref.content,
26
- intl = _ref.intl;
27
- var _useState = (0, _react2.useState)(intl.formatMessage(_messages.codeBlockCopyButtonMessages.copyCodeToClipboard)),
28
- _useState2 = (0, _slicedToArray2.default)(_useState, 2),
29
- tooltip = _useState2[0],
30
- setTooltip = _useState2[1];
31
- var _useState3 = (0, _react2.useState)('copy-to-clipboard'),
32
- _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
33
- className = _useState4[0],
34
- setClassName = _useState4[1];
35
- var onMouseLeave = function onMouseLeave() {
36
- setTooltip(intl.formatMessage(_messages.codeBlockCopyButtonMessages.copyCodeToClipboard));
37
- setClassName('copy-to-clipboard');
38
- };
39
- return (0, _react.jsx)("span", {
40
- css: copyButtonWrapperStyles
41
- }, (0, _react.jsx)(_tooltip.default, {
42
- content: tooltip,
43
- hideTooltipOnClick: false,
44
- position: "top"
45
- }, (0, _react.jsx)("div", {
46
- onMouseLeave: onMouseLeave
47
- }, (0, _react.jsx)(_button.default, {
48
- className: className,
49
- "aria-label": tooltip,
50
- spacing: "compact",
51
- appearance: "subtle",
52
- "aria-haspopup": true,
53
- iconBefore: (0, _react.jsx)(_copy.default, {
54
- label: tooltip
55
- }),
56
- onClick: function onClick() {
57
- (0, _clipboard.copyTextToClipboard)(content);
58
- setTooltip(intl.formatMessage(_messages.codeBlockCopyButtonMessages.copiedCodeToClipboard));
59
- setClassName('copy-to-clipboard clicked');
60
- }
61
- }))));
62
- };
63
- var _default = (0, _reactIntlNext.injectIntl)(CopyButton);
64
- exports.default = _default;
@@ -1,86 +0,0 @@
1
- /** @jsx jsx */
2
- import { css, jsx } from '@emotion/react';
3
- import React, { useState } from 'react';
4
- import { injectIntl } from 'react-intl-next';
5
- import Tooltip from '@atlaskit/tooltip';
6
- import Button from '@atlaskit/button';
7
- import CopyIcon from '@atlaskit/icon/glyph/copy';
8
- import { N20, N30, N700 } from '@atlaskit/theme/colors';
9
- import { copyTextToClipboard } from '../utils/clipboard';
10
- import { codeBlockCopyButtonMessages } from '@atlaskit/editor-common/messages';
11
- const copyButtonWrapperStyles = css`
12
- display: flex;
13
- position: sticky;
14
- justify-content: flex-end;
15
- top: 0;
16
-
17
- button {
18
- position: absolute;
19
- display: flex;
20
- justify-content: center;
21
- height: 32px;
22
- width: 32px;
23
- right: 6px;
24
- top: 4px;
25
- padding: 2px;
26
- opacity: 0;
27
- transition: opacity 0.2s ease 0s;
28
- border: 2px solid ${"var(--ds-border, #fff)"};
29
- border-radius: 4px;
30
- background-color: ${`var(--ds-surface-overlay, ${N20})`};
31
- color: ${"var(--ds-text, rgb(66, 82, 110))"} !important;
32
- }
33
-
34
- button:hover {
35
- border: 2px solid ${"var(--ds-border, transparent)"};
36
- background-color: ${`var(--ds-surface-overlay-hovered, ${N30})`};
37
- }
38
-
39
- button:active {
40
- border: 2px solid ${"var(--ds-border, transparent)"};
41
- background-color: ${`var(--ds-surface-overlay-pressed, ${N30})`};
42
- }
43
-
44
- button.clicked {
45
- background-color: ${`var(--ds-surface-overlay, ${N700})`};
46
- color: ${"var(--ds-text, #fff)"} !important;
47
- }
48
- button.clicked:hover {
49
- background-color: ${`var(--ds-surface-overlay-hovered, ${N700})`};
50
- }
51
- `;
52
- const CopyButton = ({
53
- content,
54
- intl
55
- }) => {
56
- const [tooltip, setTooltip] = useState(intl.formatMessage(codeBlockCopyButtonMessages.copyCodeToClipboard));
57
- const [className, setClassName] = useState('copy-to-clipboard');
58
- const onMouseLeave = () => {
59
- setTooltip(intl.formatMessage(codeBlockCopyButtonMessages.copyCodeToClipboard));
60
- setClassName('copy-to-clipboard');
61
- };
62
- return jsx("span", {
63
- css: copyButtonWrapperStyles
64
- }, jsx(Tooltip, {
65
- content: tooltip,
66
- hideTooltipOnClick: false,
67
- position: "top"
68
- }, jsx("div", {
69
- onMouseLeave: onMouseLeave
70
- }, jsx(Button, {
71
- className: className,
72
- "aria-label": tooltip,
73
- spacing: "compact",
74
- appearance: "subtle",
75
- "aria-haspopup": true,
76
- iconBefore: jsx(CopyIcon, {
77
- label: tooltip
78
- }),
79
- onClick: () => {
80
- copyTextToClipboard(content);
81
- setTooltip(intl.formatMessage(codeBlockCopyButtonMessages.copiedCodeToClipboard));
82
- setClassName('copy-to-clipboard clicked');
83
- }
84
- }))));
85
- };
86
- export default injectIntl(CopyButton);
@@ -1,54 +0,0 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
3
- var _templateObject;
4
- /** @jsx jsx */
5
- import { css, jsx } from '@emotion/react';
6
- import React, { useState } from 'react';
7
- import { injectIntl } from 'react-intl-next';
8
- import Tooltip from '@atlaskit/tooltip';
9
- import Button from '@atlaskit/button';
10
- import CopyIcon from '@atlaskit/icon/glyph/copy';
11
- import { N20, N30, N700 } from '@atlaskit/theme/colors';
12
- import { copyTextToClipboard } from '../utils/clipboard';
13
- import { codeBlockCopyButtonMessages } from '@atlaskit/editor-common/messages';
14
- var copyButtonWrapperStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n position: sticky;\n justify-content: flex-end;\n top: 0;\n\n button {\n position: absolute;\n display: flex;\n justify-content: center;\n height: 32px;\n width: 32px;\n right: 6px;\n top: 4px;\n padding: 2px;\n opacity: 0;\n transition: opacity 0.2s ease 0s;\n border: 2px solid ", ";\n border-radius: 4px;\n background-color: ", ";\n color: ", " !important;\n }\n\n button:hover {\n border: 2px solid ", ";\n background-color: ", ";\n }\n\n button:active {\n border: 2px solid ", ";\n background-color: ", ";\n }\n\n button.clicked {\n background-color: ", ";\n color: ", " !important;\n }\n button.clicked:hover {\n background-color: ", ";\n }\n"])), "var(--ds-border, #fff)", "var(--ds-surface-overlay, ".concat(N20, ")"), "var(--ds-text, rgb(66, 82, 110))", "var(--ds-border, transparent)", "var(--ds-surface-overlay-hovered, ".concat(N30, ")"), "var(--ds-border, transparent)", "var(--ds-surface-overlay-pressed, ".concat(N30, ")"), "var(--ds-surface-overlay, ".concat(N700, ")"), "var(--ds-text, #fff)", "var(--ds-surface-overlay-hovered, ".concat(N700, ")"));
15
- var CopyButton = function CopyButton(_ref) {
16
- var content = _ref.content,
17
- intl = _ref.intl;
18
- var _useState = useState(intl.formatMessage(codeBlockCopyButtonMessages.copyCodeToClipboard)),
19
- _useState2 = _slicedToArray(_useState, 2),
20
- tooltip = _useState2[0],
21
- setTooltip = _useState2[1];
22
- var _useState3 = useState('copy-to-clipboard'),
23
- _useState4 = _slicedToArray(_useState3, 2),
24
- className = _useState4[0],
25
- setClassName = _useState4[1];
26
- var onMouseLeave = function onMouseLeave() {
27
- setTooltip(intl.formatMessage(codeBlockCopyButtonMessages.copyCodeToClipboard));
28
- setClassName('copy-to-clipboard');
29
- };
30
- return jsx("span", {
31
- css: copyButtonWrapperStyles
32
- }, jsx(Tooltip, {
33
- content: tooltip,
34
- hideTooltipOnClick: false,
35
- position: "top"
36
- }, jsx("div", {
37
- onMouseLeave: onMouseLeave
38
- }, jsx(Button, {
39
- className: className,
40
- "aria-label": tooltip,
41
- spacing: "compact",
42
- appearance: "subtle",
43
- "aria-haspopup": true,
44
- iconBefore: jsx(CopyIcon, {
45
- label: tooltip
46
- }),
47
- onClick: function onClick() {
48
- copyTextToClipboard(content);
49
- setTooltip(intl.formatMessage(codeBlockCopyButtonMessages.copiedCodeToClipboard));
50
- setClassName('copy-to-clipboard clicked');
51
- }
52
- }))));
53
- };
54
- export default injectIntl(CopyButton);