@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.
- package/CHANGELOG.md +12 -0
- package/dist/cjs/analytics/enums.js +61 -1
- package/dist/cjs/react/index.js +10 -1
- package/dist/cjs/react/nodes/codeBlock/codeBlock.js +18 -6
- package/dist/cjs/react/nodes/codeBlock/components/codeBlockButtonContainer.js +67 -0
- package/dist/cjs/react/nodes/codeBlock/components/codeBlockContainer.js +15 -8
- package/dist/cjs/react/nodes/codeBlock/components/codeBlockCopyButton.js +71 -0
- package/dist/cjs/react/nodes/codeBlock/components/codeBlockWrapButton.js +76 -0
- package/dist/cjs/react/nodes/codeBlock/windowedCodeBlock.js +13 -2
- package/dist/cjs/react/nodes/media.js +18 -1
- package/dist/cjs/react/nodes/mediaInline.js +19 -4
- package/dist/cjs/ui/Renderer/index.js +5 -1
- package/dist/cjs/ui/Renderer/style.js +2 -2
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/analytics/enums.js +55 -1
- package/dist/es2019/react/index.js +7 -1
- package/dist/es2019/react/nodes/codeBlock/codeBlock.js +10 -3
- package/dist/es2019/react/nodes/codeBlock/components/codeBlockButtonContainer.js +59 -0
- package/dist/es2019/react/nodes/codeBlock/components/codeBlockContainer.js +25 -8
- package/dist/es2019/react/nodes/codeBlock/components/codeBlockCopyButton.js +52 -0
- package/dist/es2019/react/nodes/codeBlock/components/codeBlockWrapButton.js +67 -0
- package/dist/es2019/react/nodes/codeBlock/windowedCodeBlock.js +9 -4
- package/dist/es2019/react/nodes/media.js +18 -1
- package/dist/es2019/react/nodes/mediaInline.js +19 -4
- package/dist/es2019/ui/Renderer/index.js +5 -1
- package/dist/es2019/ui/Renderer/style.js +9 -11
- package/dist/es2019/version.json +1 -1
- package/dist/esm/analytics/enums.js +55 -1
- package/dist/esm/react/index.js +10 -1
- package/dist/esm/react/nodes/codeBlock/codeBlock.js +15 -3
- package/dist/esm/react/nodes/codeBlock/components/codeBlockButtonContainer.js +58 -0
- package/dist/esm/react/nodes/codeBlock/components/codeBlockContainer.js +15 -9
- package/dist/esm/react/nodes/codeBlock/components/codeBlockCopyButton.js +59 -0
- package/dist/esm/react/nodes/codeBlock/components/codeBlockWrapButton.js +67 -0
- package/dist/esm/react/nodes/codeBlock/windowedCodeBlock.js +14 -4
- package/dist/esm/react/nodes/media.js +18 -1
- package/dist/esm/react/nodes/mediaInline.js +19 -4
- package/dist/esm/ui/Renderer/index.js +5 -1
- package/dist/esm/ui/Renderer/style.js +2 -2
- package/dist/esm/version.json +1 -1
- package/dist/types/analytics/enums.d.ts +51 -0
- package/dist/types/analytics/events.d.ts +5 -1
- package/dist/types/react/index.d.ts +2 -0
- package/dist/types/react/nodes/codeBlock/codeBlock.d.ts +1 -0
- package/dist/types/react/nodes/codeBlock/components/codeBlockButtonContainer.d.ts +12 -0
- package/dist/types/react/nodes/codeBlock/components/codeBlockContainer.d.ts +5 -7
- package/dist/types/react/nodes/codeBlock/components/codeBlockWrapButton.d.ts +11 -0
- package/dist/types/react/nodes/codeBlock/windowedCodeBlock.d.ts +1 -1
- package/dist/types/react/nodes/media.d.ts +3 -2
- package/dist/types/react/nodes/mediaInline.d.ts +6 -0
- package/dist/types/react/types.d.ts +1 -0
- package/dist/types/ui/renderer-props.d.ts +1 -0
- package/package.json +11 -11
- package/report.api.md +19 -2
- package/dist/cjs/react/nodes/codeBlockCopyButton.js +0 -64
- package/dist/es2019/react/nodes/codeBlockCopyButton.js +0 -86
- package/dist/esm/react/nodes/codeBlockCopyButton.js +0 -54
- /package/dist/types/react/nodes/{codeBlockCopyButton.d.ts → codeBlock/components/codeBlockCopyButton.d.ts} +0 -0
|
@@ -91,7 +91,7 @@ var rendererStyles = function rendererStyles(wrapperProps) {
|
|
|
91
91
|
var themeProps = {
|
|
92
92
|
theme: theme
|
|
93
93
|
};
|
|
94
|
-
return (0, _react.css)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\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
|
|
94
|
+
return (0, _react.css)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\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 "])), (0, _editorSharedStyles.editorFontSize)(themeProps), (0, _components.themed)({
|
|
95
95
|
light: "var(--ds-text, ".concat(colors.N800, ")"),
|
|
96
96
|
dark: "var(--ds-text, #B8C7E0)"
|
|
97
97
|
})(themeProps), _consts.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), _styles.whitespaceSharedStyles, _styles.blockquoteSharedStyles, (0, _styles.headingsSharedStyles)(themeProps), (0, _styles.ruleSharedStyles)(themeProps), _styles.paragraphSharedStyles, _styles.listsSharedStyles, _styles.indentationSharedStyles, _styles.blockMarksSharedStyles, (0, _styles.codeMarkSharedStyles)(themeProps), _styles.shadowSharedStyle, _styles.dateSharedStyle, _styles.textColorStyles, _styles.tasksAndDecisionsStyles, _styles.smartCardSharedStyles, (0, _constants.fontFamily)(), (0, _editorSharedStyles.relativeFontSizeToBase16)((0, _constants.fontSize)()), (0, _components.themed)({
|
|
@@ -127,7 +127,7 @@ var rendererStyles = function rendererStyles(wrapperProps) {
|
|
|
127
127
|
})(themeProps), (0, _components.themed)({
|
|
128
128
|
light: "var(--ds-border, ".concat(_editorSharedStyles.akEditorTableToolbar, ")"),
|
|
129
129
|
dark: "var(--ds-border, ".concat(_editorSharedStyles.akEditorTableToolbarDark, ")")
|
|
130
|
-
})(themeProps), (0, _constants.borderRadius)(), _editorSharedStyles.blockNodesVerticalMargin, (0, _lightWeightCodeBlock.getLightWeightCodeBlockStylesForRootRendererStyleSheet)(), _styles.columnLayoutSharedStyle, (0, _constants.gridSize)() * 2.5, (0, _constants.gridSize)() * 4, _editorSharedStyles.gridMediumMaxWidth, _editorSharedStyles.blockNodesVerticalMargin, _editorSharedStyles.blockNodesVerticalMargin, _utils.browser.safari ? _styles.codeBlockInListSafariFix : '');
|
|
130
|
+
})(themeProps), (0, _constants.borderRadius)(), _editorSharedStyles.blockNodesVerticalMargin, (0, _lightWeightCodeBlock.getLightWeightCodeBlockStylesForRootRendererStyleSheet)(), _styles.columnLayoutSharedStyle, (0, _constants.gridSize)() * 2.5, (0, _constants.gridSize)() * 4, _editorSharedStyles.gridMediumMaxWidth, _editorSharedStyles.blockNodesVerticalMargin, _editorSharedStyles.blockNodesVerticalMargin, _editorSharedStyles.blockNodesVerticalMargin, _utils.browser.safari ? _styles.codeBlockInListSafariFix : '');
|
|
131
131
|
};
|
|
132
132
|
};
|
|
133
133
|
exports.rendererStyles = rendererStyles;
|
package/dist/cjs/version.json
CHANGED
|
@@ -1 +1,55 @@
|
|
|
1
|
-
export
|
|
1
|
+
export let EVENT_TYPE;
|
|
2
|
+
(function (EVENT_TYPE) {
|
|
3
|
+
EVENT_TYPE["OPERATIONAL"] = "operational";
|
|
4
|
+
EVENT_TYPE["SCREEN"] = "screen";
|
|
5
|
+
EVENT_TYPE["TRACK"] = "track";
|
|
6
|
+
EVENT_TYPE["UI"] = "ui";
|
|
7
|
+
})(EVENT_TYPE || (EVENT_TYPE = {}));
|
|
8
|
+
export let ACTION;
|
|
9
|
+
(function (ACTION) {
|
|
10
|
+
ACTION["STARTED"] = "started";
|
|
11
|
+
ACTION["RENDERED"] = "rendered";
|
|
12
|
+
ACTION["RE_RENDERED"] = "reRendered";
|
|
13
|
+
ACTION["RENDERER_TTI"] = "tti";
|
|
14
|
+
ACTION["CRASHED"] = "unhandledErrorCaught";
|
|
15
|
+
ACTION["INVALID_PROSEMIRROR_DOCUMENT"] = "invalidProsemirrorDocument";
|
|
16
|
+
ACTION["SELECT_ALL_CAUGHT"] = "selectAllCaught";
|
|
17
|
+
ACTION["SELECT_ALL_ESCAPED"] = "selectAllEscaped";
|
|
18
|
+
ACTION["CLICKED"] = "clicked";
|
|
19
|
+
ACTION["VIEWED"] = "viewed";
|
|
20
|
+
ACTION["VISITED"] = "visited";
|
|
21
|
+
ACTION["SORT_COLUMN"] = "sortedColumn";
|
|
22
|
+
ACTION["SORT_COLUMN_NOT_ALLOWED"] = "sortColumnNotAllowed";
|
|
23
|
+
ACTION["TOGGLE_EXPAND"] = "toggleExpand";
|
|
24
|
+
ACTION["INSERTED"] = "inserted";
|
|
25
|
+
ACTION["OPENED"] = "opened";
|
|
26
|
+
ACTION["CLOSED"] = "closed";
|
|
27
|
+
ACTION["DELETED"] = "deleted";
|
|
28
|
+
ACTION["EDITED"] = "edited";
|
|
29
|
+
ACTION["RESOLVED"] = "resolved";
|
|
30
|
+
ACTION["CREATE_NOT_ALLOWED"] = "createNotAllowed";
|
|
31
|
+
ACTION["UNSUPPORTED_CONTENT_LEVELS_TRACKING_SUCCEEDED"] = "unsupportedContentLevelsTrackingSucceeded";
|
|
32
|
+
ACTION["UNSUPPORTED_CONTENT_LEVELS_TRACKING_ERRORED"] = "unsupportedContentLevelsTrackingErrored";
|
|
33
|
+
ACTION["MEDIA_LINK_TRANSFORMED"] = "mediaLinkTransformed";
|
|
34
|
+
})(ACTION || (ACTION = {}));
|
|
35
|
+
export let ACTION_SUBJECT;
|
|
36
|
+
(function (ACTION_SUBJECT) {
|
|
37
|
+
ACTION_SUBJECT["RENDERER"] = "renderer";
|
|
38
|
+
ACTION_SUBJECT["BUTTON"] = "button";
|
|
39
|
+
ACTION_SUBJECT["ANCHOR_LINK"] = "anchorLink";
|
|
40
|
+
ACTION_SUBJECT["TABLE"] = "table";
|
|
41
|
+
ACTION_SUBJECT["EXPAND"] = "expand";
|
|
42
|
+
ACTION_SUBJECT["NESTED_EXPAND"] = "nestedExpand";
|
|
43
|
+
ACTION_SUBJECT["MEDIA_SINGLE"] = "mediaSingle";
|
|
44
|
+
ACTION_SUBJECT["LINK"] = "link";
|
|
45
|
+
ACTION_SUBJECT["ANNOTATION"] = "annotation";
|
|
46
|
+
ACTION_SUBJECT["MEDIA"] = "media";
|
|
47
|
+
})(ACTION_SUBJECT || (ACTION_SUBJECT = {}));
|
|
48
|
+
export let ACTION_SUBJECT_ID;
|
|
49
|
+
(function (ACTION_SUBJECT_ID) {
|
|
50
|
+
ACTION_SUBJECT_ID["HEADING_ANCHOR_LINK"] = "headingAnchorLink";
|
|
51
|
+
ACTION_SUBJECT_ID["LINK"] = "link";
|
|
52
|
+
ACTION_SUBJECT_ID["INLINE_COMMENT"] = "inlineComment";
|
|
53
|
+
ACTION_SUBJECT_ID["CODEBLOCK_COPY"] = "codeBlockCopy";
|
|
54
|
+
ACTION_SUBJECT_ID["CODEBLOCK_WRAP"] = "codeBlockWrap";
|
|
55
|
+
})(ACTION_SUBJECT_ID || (ACTION_SUBJECT_ID = {}));
|
|
@@ -37,6 +37,7 @@ export default class ReactSerializer {
|
|
|
37
37
|
_defineProperty(this, "headingIds", []);
|
|
38
38
|
_defineProperty(this, "expandHeadingIds", []);
|
|
39
39
|
_defineProperty(this, "allowCopyToClipboard", false);
|
|
40
|
+
_defineProperty(this, "allowWrapCodeBlock", false);
|
|
40
41
|
_defineProperty(this, "allowPlaceholderText", true);
|
|
41
42
|
_defineProperty(this, "allowCustomPanels", false);
|
|
42
43
|
_defineProperty(this, "startPos", 1);
|
|
@@ -145,6 +146,7 @@ export default class ReactSerializer {
|
|
|
145
146
|
this.disableActions = init.disableActions;
|
|
146
147
|
this.allowHeadingAnchorLinks = init.allowHeadingAnchorLinks;
|
|
147
148
|
this.allowCopyToClipboard = init.allowCopyToClipboard;
|
|
149
|
+
this.allowWrapCodeBlock = init.allowWrapCodeBlock;
|
|
148
150
|
this.allowPlaceholderText = init.allowPlaceholderText;
|
|
149
151
|
this.allowCustomPanels = init.allowCustomPanels;
|
|
150
152
|
this.allowColumnSorting = init.allowColumnSorting;
|
|
@@ -336,14 +338,17 @@ export default class ReactSerializer {
|
|
|
336
338
|
var _this$media;
|
|
337
339
|
const {
|
|
338
340
|
marks: {
|
|
339
|
-
link
|
|
341
|
+
link,
|
|
342
|
+
border
|
|
340
343
|
}
|
|
341
344
|
} = node.type.schema;
|
|
342
345
|
const isLinkMark = mark => mark.type === link;
|
|
346
|
+
const isBorderMark = mark => mark.type === border;
|
|
343
347
|
return {
|
|
344
348
|
...this.getProps(node),
|
|
345
349
|
marks: node.marks.filter(m => !isLinkMark(m) || this.allowMediaLinking === true),
|
|
346
350
|
isLinkMark,
|
|
351
|
+
isBorderMark,
|
|
347
352
|
allowAltTextOnImages: this.allowAltTextOnImages,
|
|
348
353
|
featureFlags: this.media && this.media.featureFlags,
|
|
349
354
|
shouldOpenMediaViewer: this.shouldOpenMediaViewer,
|
|
@@ -436,6 +441,7 @@ export default class ReactSerializer {
|
|
|
436
441
|
content: node.content ? node.content.toJSON() : undefined,
|
|
437
442
|
allowHeadingAnchorLinks: this.allowHeadingAnchorLinks,
|
|
438
443
|
allowCopyToClipboard: this.allowCopyToClipboard,
|
|
444
|
+
allowWrapCodeBlock: this.allowWrapCodeBlock,
|
|
439
445
|
allowPlaceholderText: this.allowPlaceholderText,
|
|
440
446
|
rendererAppearance: this.appearance,
|
|
441
447
|
fireAnalyticsEvent: this.fireAnalyticsEvent,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
+
import { useState } from 'react';
|
|
2
3
|
import { jsx } from '@emotion/react';
|
|
3
4
|
import { injectIntl } from 'react-intl-next';
|
|
4
5
|
import { CodeBlockSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
@@ -10,19 +11,25 @@ function CodeBlock(props) {
|
|
|
10
11
|
text,
|
|
11
12
|
language,
|
|
12
13
|
allowCopyToClipboard = false,
|
|
14
|
+
allowWrapCodeBlock = false,
|
|
13
15
|
codeBidiWarningTooltipEnabled
|
|
14
16
|
} = props;
|
|
15
17
|
const codeBidiWarningLabel = props.intl.formatMessage(codeBidiWarningMessages.label);
|
|
16
18
|
const className = [CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER, props.className].join(' ');
|
|
19
|
+
const [wrapLongLines, setWrapLongLines] = useState(false);
|
|
17
20
|
return jsx(CodeBlockContainer, {
|
|
18
|
-
|
|
21
|
+
allowCopyToClipboard: allowCopyToClipboard,
|
|
22
|
+
allowWrapCodeBlock: allowWrapCodeBlock,
|
|
19
23
|
className: className,
|
|
20
|
-
|
|
24
|
+
setWrapLongLines: setWrapLongLines,
|
|
25
|
+
text: text,
|
|
26
|
+
wrapLongLines: wrapLongLines
|
|
21
27
|
}, jsx(AkCodeBlock, {
|
|
22
28
|
language: language,
|
|
23
29
|
text: text,
|
|
24
30
|
codeBidiWarningLabel: codeBidiWarningLabel,
|
|
25
|
-
codeBidiWarningTooltipEnabled: codeBidiWarningTooltipEnabled
|
|
31
|
+
codeBidiWarningTooltipEnabled: codeBidiWarningTooltipEnabled,
|
|
32
|
+
shouldWrapLongLines: allowWrapCodeBlock && wrapLongLines
|
|
26
33
|
}));
|
|
27
34
|
}
|
|
28
35
|
export default injectIntl(CodeBlock);
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx, css } from '@emotion/react';
|
|
3
|
+
import CopyButton from './codeBlockCopyButton';
|
|
4
|
+
import CodeWrapButton from './codeBlockWrapButton';
|
|
5
|
+
import { N0, N20, N30, N700 } from '@atlaskit/theme/colors';
|
|
6
|
+
const codeBlockButtonsWrapper = css({
|
|
7
|
+
position: 'sticky',
|
|
8
|
+
top: '0px'
|
|
9
|
+
});
|
|
10
|
+
const codeBlockButtonsStyle = css({
|
|
11
|
+
display: 'flex',
|
|
12
|
+
justifyContent: 'flex-end',
|
|
13
|
+
position: 'absolute',
|
|
14
|
+
height: '0',
|
|
15
|
+
width: '100%',
|
|
16
|
+
right: '6px',
|
|
17
|
+
top: '4px',
|
|
18
|
+
padding: '2px',
|
|
19
|
+
button: {
|
|
20
|
+
height: '32px',
|
|
21
|
+
width: '32px',
|
|
22
|
+
border: `2px solid ${`var(--ds-border-inverse, ${N0})`}`,
|
|
23
|
+
borderRadius: '4px',
|
|
24
|
+
marginLeft: '4px',
|
|
25
|
+
padding: '2px',
|
|
26
|
+
background: `${`var(--ds-background-neutral-subtle, ${N20})`}`,
|
|
27
|
+
color: `${"var(--ds-icon, rgb(66, 82, 110))"}`,
|
|
28
|
+
'&:hover': {
|
|
29
|
+
borderWidth: '2px',
|
|
30
|
+
backgroundColor: `${`var(--ds-background-neutral-hovered, ${N30})`}`,
|
|
31
|
+
height: '32px',
|
|
32
|
+
width: '32px'
|
|
33
|
+
},
|
|
34
|
+
'&.clicked': {
|
|
35
|
+
backgroundColor: `${`var(--ds-background-neutral-bold-pressed, ${N700})`}`,
|
|
36
|
+
borderRadius: '4px',
|
|
37
|
+
color: `${`var(--ds-icon-inverse, ${N0})`} !important`
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
const CodeBlockButtonContainer = ({
|
|
42
|
+
allowCopyToClipboard,
|
|
43
|
+
allowWrapCodeBlock,
|
|
44
|
+
setWrapLongLines,
|
|
45
|
+
text,
|
|
46
|
+
wrapLongLines
|
|
47
|
+
}) => {
|
|
48
|
+
return jsx("div", {
|
|
49
|
+
css: codeBlockButtonsWrapper
|
|
50
|
+
}, jsx("div", {
|
|
51
|
+
css: codeBlockButtonsStyle
|
|
52
|
+
}, allowWrapCodeBlock && jsx(CodeWrapButton, {
|
|
53
|
+
setWrapLongLines: setWrapLongLines,
|
|
54
|
+
wrapLongLines: wrapLongLines
|
|
55
|
+
}), allowCopyToClipboard && jsx(CopyButton, {
|
|
56
|
+
content: text
|
|
57
|
+
})));
|
|
58
|
+
};
|
|
59
|
+
export default CodeBlockButtonContainer;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
|
|
3
2
|
import { jsx, css } from '@emotion/react';
|
|
4
3
|
import { overflowShadow, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
5
4
|
import { N20, DN50 } from '@atlaskit/theme/colors';
|
|
6
5
|
import { themed } from '@atlaskit/theme/components';
|
|
7
6
|
import { fontSize, gridSize } from '@atlaskit/theme/constants';
|
|
8
7
|
import { CodeBlockSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
9
|
-
import
|
|
8
|
+
import CodeBlockButtonContainer from './codeBlockButtonContainer';
|
|
10
9
|
const codeBlockStyleOverrides = props => css`
|
|
11
10
|
tab-size: 4;
|
|
12
11
|
background-color: ${themed({
|
|
@@ -14,6 +13,17 @@ const codeBlockStyleOverrides = props => css`
|
|
|
14
13
|
dark: `var(--ds-surface-raised, ${DN50})`
|
|
15
14
|
})(props)};
|
|
16
15
|
|
|
16
|
+
&:hover {
|
|
17
|
+
button {
|
|
18
|
+
opacity: 1;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
button {
|
|
23
|
+
opacity: 0;
|
|
24
|
+
transition: opacity 0.2s ease 0s;
|
|
25
|
+
}
|
|
26
|
+
|
|
17
27
|
${CodeBlockSharedCssClassName.DS_CODEBLOCK} {
|
|
18
28
|
font-size: ${relativeFontSizeToBase16(fontSize())};
|
|
19
29
|
line-height: 1.5rem;
|
|
@@ -30,16 +40,23 @@ const codeBlockStyleOverrides = props => css`
|
|
|
30
40
|
}
|
|
31
41
|
`;
|
|
32
42
|
const CodeBlockContainer = ({
|
|
33
|
-
text,
|
|
34
|
-
className,
|
|
35
43
|
allowCopyToClipboard,
|
|
36
|
-
|
|
44
|
+
allowWrapCodeBlock,
|
|
45
|
+
children,
|
|
46
|
+
className,
|
|
47
|
+
setWrapLongLines,
|
|
48
|
+
text,
|
|
49
|
+
wrapLongLines
|
|
37
50
|
}) => {
|
|
38
51
|
return jsx("div", {
|
|
39
52
|
className: className,
|
|
40
53
|
css: codeBlockStyleOverrides
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
|
|
54
|
+
}, jsx(CodeBlockButtonContainer, {
|
|
55
|
+
allowCopyToClipboard: allowCopyToClipboard,
|
|
56
|
+
allowWrapCodeBlock: allowWrapCodeBlock,
|
|
57
|
+
setWrapLongLines: setWrapLongLines,
|
|
58
|
+
text: text,
|
|
59
|
+
wrapLongLines: wrapLongLines
|
|
60
|
+
}), children);
|
|
44
61
|
};
|
|
45
62
|
export default CodeBlockContainer;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { 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/custom-theme-button';
|
|
7
|
+
import CopyIcon from '@atlaskit/icon/glyph/copy';
|
|
8
|
+
import { copyTextToClipboard } from '../../../utils/clipboard';
|
|
9
|
+
import { codeBlockButtonMessages } from '@atlaskit/editor-common/messages';
|
|
10
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../../../../analytics/enums';
|
|
11
|
+
import AnalyticsContext from '../../../../analytics/analyticsContext';
|
|
12
|
+
const CopyButton = ({
|
|
13
|
+
content,
|
|
14
|
+
intl
|
|
15
|
+
}) => {
|
|
16
|
+
const [tooltip, setTooltip] = useState(intl.formatMessage(codeBlockButtonMessages.copyCodeToClipboard));
|
|
17
|
+
const [className, setClassName] = useState('copy-to-clipboard');
|
|
18
|
+
const onMouseLeave = () => {
|
|
19
|
+
setTooltip(intl.formatMessage(codeBlockButtonMessages.copyCodeToClipboard));
|
|
20
|
+
setClassName('copy-to-clipboard');
|
|
21
|
+
};
|
|
22
|
+
return jsx(AnalyticsContext.Consumer, null, ({
|
|
23
|
+
fireAnalyticsEvent
|
|
24
|
+
}) => jsx("span", null, jsx(Tooltip, {
|
|
25
|
+
content: tooltip,
|
|
26
|
+
hideTooltipOnClick: false,
|
|
27
|
+
position: "top"
|
|
28
|
+
}, jsx("div", {
|
|
29
|
+
onMouseLeave: onMouseLeave
|
|
30
|
+
}, jsx(Button, {
|
|
31
|
+
appearance: "subtle",
|
|
32
|
+
"aria-haspopup": true,
|
|
33
|
+
"aria-label": tooltip,
|
|
34
|
+
className: className,
|
|
35
|
+
iconBefore: jsx(CopyIcon, {
|
|
36
|
+
label: tooltip
|
|
37
|
+
}),
|
|
38
|
+
onClick: () => {
|
|
39
|
+
fireAnalyticsEvent({
|
|
40
|
+
action: ACTION.CLICKED,
|
|
41
|
+
actionSubject: ACTION_SUBJECT.BUTTON,
|
|
42
|
+
actionSubjectId: ACTION_SUBJECT_ID.CODEBLOCK_COPY,
|
|
43
|
+
eventType: EVENT_TYPE.UI
|
|
44
|
+
});
|
|
45
|
+
copyTextToClipboard(content);
|
|
46
|
+
setTooltip(intl.formatMessage(codeBlockButtonMessages.copiedCodeToClipboard));
|
|
47
|
+
setClassName('copy-to-clipboard clicked');
|
|
48
|
+
},
|
|
49
|
+
spacing: "compact"
|
|
50
|
+
})))));
|
|
51
|
+
};
|
|
52
|
+
export default injectIntl(CopyButton);
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { injectIntl } from 'react-intl-next';
|
|
5
|
+
import Tooltip from '@atlaskit/tooltip';
|
|
6
|
+
import Button from '@atlaskit/button/custom-theme-button';
|
|
7
|
+
import Icon from '@atlaskit/icon';
|
|
8
|
+
import { codeBlockButtonMessages } from '@atlaskit/editor-common/messages';
|
|
9
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../../../../analytics/enums';
|
|
10
|
+
import AnalyticsContext from '../../../../analytics/analyticsContext';
|
|
11
|
+
const WrapIcon = () => {
|
|
12
|
+
return jsx("svg", {
|
|
13
|
+
width: "24",
|
|
14
|
+
height: "24",
|
|
15
|
+
fill: "none",
|
|
16
|
+
viewBox: "0 0 24 24"
|
|
17
|
+
}, jsx("g", {
|
|
18
|
+
fill: "currentColor",
|
|
19
|
+
clipPath: "url(#clip0_654_431)"
|
|
20
|
+
}, jsx("rect", {
|
|
21
|
+
width: "24",
|
|
22
|
+
height: "24",
|
|
23
|
+
fillOpacity: "0.01"
|
|
24
|
+
}), jsx("path", {
|
|
25
|
+
d: "M20 4h-1v16h1V4ZM3 8a1 1 0 0 1 1-1h9.5a4.5 4.5 0 1 1 0 9h-2.086l.293.293a1 1 0 0 1-1.414 1.414l-2-2a1 1 0 0 1 0-1.414l2-2a1 1 0 0 1 1.414 1.414l-.293.293H13.5a2.5 2.5 0 0 0 0-5H4a1 1 0 0 1-1-1Z",
|
|
26
|
+
clipRule: "evenodd",
|
|
27
|
+
fillRule: "evenodd"
|
|
28
|
+
})));
|
|
29
|
+
};
|
|
30
|
+
const CodeBlockWrapButton = ({
|
|
31
|
+
setWrapLongLines,
|
|
32
|
+
wrapLongLines,
|
|
33
|
+
intl
|
|
34
|
+
}) => {
|
|
35
|
+
const wrapMessage = intl.formatMessage(wrapLongLines ? codeBlockButtonMessages.unwrapCode : codeBlockButtonMessages.wrapCode);
|
|
36
|
+
return jsx(AnalyticsContext.Consumer, null, ({
|
|
37
|
+
fireAnalyticsEvent
|
|
38
|
+
}) => jsx("span", null, jsx(Tooltip, {
|
|
39
|
+
content: wrapMessage,
|
|
40
|
+
hideTooltipOnClick: false,
|
|
41
|
+
position: "top"
|
|
42
|
+
}, jsx(Button, {
|
|
43
|
+
appearance: "subtle",
|
|
44
|
+
"aria-haspopup": true,
|
|
45
|
+
"aria-label": wrapMessage,
|
|
46
|
+
className: `wrap-code ${wrapLongLines ? 'clicked' : ''}`,
|
|
47
|
+
iconBefore: jsx(Icon, {
|
|
48
|
+
glyph: WrapIcon,
|
|
49
|
+
label: ""
|
|
50
|
+
}),
|
|
51
|
+
isSelected: wrapLongLines,
|
|
52
|
+
onClick: () => {
|
|
53
|
+
fireAnalyticsEvent({
|
|
54
|
+
action: ACTION.CLICKED,
|
|
55
|
+
actionSubject: ACTION_SUBJECT.BUTTON,
|
|
56
|
+
actionSubjectId: ACTION_SUBJECT_ID.CODEBLOCK_WRAP,
|
|
57
|
+
attributes: {
|
|
58
|
+
wrapped: !wrapLongLines
|
|
59
|
+
},
|
|
60
|
+
eventType: EVENT_TYPE.UI
|
|
61
|
+
});
|
|
62
|
+
setWrapLongLines(!wrapLongLines);
|
|
63
|
+
},
|
|
64
|
+
spacing: "compact"
|
|
65
|
+
}))));
|
|
66
|
+
};
|
|
67
|
+
export default injectIntl(CodeBlockWrapButton);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { Fragment, memo } from 'react';
|
|
3
|
-
import { lazy, Suspense } from 'react';
|
|
2
|
+
import { Fragment, lazy, memo, Suspense, useState } from 'react';
|
|
4
3
|
import { jsx } from '@emotion/react';
|
|
5
4
|
import { CodeBlockSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
6
5
|
import { useInViewport } from '../../hooks/use-in-viewport';
|
|
@@ -15,6 +14,7 @@ const WindowedCodeBlock = ({
|
|
|
15
14
|
text,
|
|
16
15
|
language,
|
|
17
16
|
allowCopyToClipboard,
|
|
17
|
+
allowWrapCodeBlock = false,
|
|
18
18
|
codeBidiWarningTooltipEnabled,
|
|
19
19
|
className: rootClassName
|
|
20
20
|
}) => {
|
|
@@ -34,17 +34,22 @@ const WindowedCodeBlock = ({
|
|
|
34
34
|
codeBidiWarningTooltipEnabled: codeBidiWarningTooltipEnabled,
|
|
35
35
|
className: rootClassName
|
|
36
36
|
});
|
|
37
|
+
const [wrapLongLines, setWrapLongLines] = useState(false);
|
|
37
38
|
return isInViewport ? jsx(Fragment, null, jsx(Suspense, {
|
|
38
39
|
fallback: memoizedLightWeightCodeBlock
|
|
39
40
|
}, jsx(CodeBlockContainer, {
|
|
41
|
+
allowCopyToClipboard: allowCopyToClipboard,
|
|
42
|
+
allowWrapCodeBlock: allowWrapCodeBlock,
|
|
40
43
|
className: className,
|
|
44
|
+
setWrapLongLines: setWrapLongLines,
|
|
41
45
|
text: text,
|
|
42
|
-
|
|
46
|
+
wrapLongLines: wrapLongLines
|
|
43
47
|
}, jsx(LazyAkCodeBlock, {
|
|
44
48
|
language: language,
|
|
45
49
|
text: text,
|
|
46
50
|
codeBidiWarningLabel: warningLabel,
|
|
47
|
-
codeBidiWarningTooltipEnabled: codeBidiWarningTooltipEnabled
|
|
51
|
+
codeBidiWarningTooltipEnabled: codeBidiWarningTooltipEnabled,
|
|
52
|
+
shouldWrapLongLines: allowWrapCodeBlock && wrapLongLines
|
|
48
53
|
})))) : memoizedLightWeightCodeBlock;
|
|
49
54
|
};
|
|
50
55
|
export default WindowedCodeBlock;
|
|
@@ -7,6 +7,7 @@ import { jsx } from '@emotion/react';
|
|
|
7
7
|
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
8
8
|
import { mediaLinkStyle } from '@atlaskit/editor-common/ui';
|
|
9
9
|
import { MediaCard } from '../../ui/MediaCard';
|
|
10
|
+
import { hexToEditorBorderPaletteColor } from '@atlaskit/editor-palette';
|
|
10
11
|
import { getEventHandler } from '../../utils';
|
|
11
12
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
12
13
|
import { MODE, PLATFORM } from '../../analytics/events';
|
|
@@ -14,6 +15,7 @@ export default class Media extends PureComponent {
|
|
|
14
15
|
constructor(...args) {
|
|
15
16
|
super(...args);
|
|
16
17
|
_defineProperty(this, "renderCard", (providers = {}) => {
|
|
18
|
+
var _borderMark$attrs$col, _borderMark$attrs$siz;
|
|
17
19
|
const {
|
|
18
20
|
mediaProvider,
|
|
19
21
|
contextIdentifierProvider
|
|
@@ -26,6 +28,9 @@ export default class Media extends PureComponent {
|
|
|
26
28
|
enableDownloadButton,
|
|
27
29
|
ssr
|
|
28
30
|
} = this.props;
|
|
31
|
+
const borderMark = this.props.marks.find(this.props.isBorderMark);
|
|
32
|
+
const borderColor = (_borderMark$attrs$col = borderMark === null || borderMark === void 0 ? void 0 : borderMark.attrs.color) !== null && _borderMark$attrs$col !== void 0 ? _borderMark$attrs$col : '';
|
|
33
|
+
const borderWidth = (_borderMark$attrs$siz = borderMark === null || borderMark === void 0 ? void 0 : borderMark.attrs.size) !== null && _borderMark$attrs$siz !== void 0 ? _borderMark$attrs$siz : 0;
|
|
29
34
|
const linkMark = this.props.marks.find(this.props.isLinkMark);
|
|
30
35
|
const linkHref = linkMark === null || linkMark === void 0 ? void 0 : linkMark.attrs.href;
|
|
31
36
|
const eventHandlers = linkHref ? undefined : this.props.eventHandlers;
|
|
@@ -41,13 +46,25 @@ export default class Media extends PureComponent {
|
|
|
41
46
|
shouldEnableDownloadButton: enableDownloadButton,
|
|
42
47
|
ssr: ssr
|
|
43
48
|
}));
|
|
49
|
+
const paletteColorValue = hexToEditorBorderPaletteColor(borderColor) || borderColor;
|
|
50
|
+
const mediaComponentWithBorder = borderMark ? jsx("div", {
|
|
51
|
+
"data-mark-type": "border",
|
|
52
|
+
"data-color": borderColor,
|
|
53
|
+
"data-size": borderWidth,
|
|
54
|
+
style: {
|
|
55
|
+
borderColor: paletteColorValue,
|
|
56
|
+
borderWidth: `${borderWidth}px`,
|
|
57
|
+
borderStyle: 'solid',
|
|
58
|
+
borderRadius: `${borderWidth * 2}px`
|
|
59
|
+
}
|
|
60
|
+
}, mediaComponent) : mediaComponent;
|
|
44
61
|
return linkHref ? jsx("a", {
|
|
45
62
|
href: linkHref,
|
|
46
63
|
rel: "noreferrer noopener",
|
|
47
64
|
onClick: this.handleMediaLinkClick,
|
|
48
65
|
"data-block-link": linkHref,
|
|
49
66
|
css: mediaLinkStyle
|
|
50
|
-
},
|
|
67
|
+
}, mediaComponentWithBorder) : mediaComponentWithBorder;
|
|
51
68
|
});
|
|
52
69
|
_defineProperty(this, "handleMediaLinkClick", event => {
|
|
53
70
|
const {
|
|
@@ -7,7 +7,8 @@ import { getClipboardAttrs } from '../../ui/MediaCard';
|
|
|
7
7
|
import { createIntl, injectIntl } from 'react-intl-next';
|
|
8
8
|
export const RenderMediaInline = props => {
|
|
9
9
|
const {
|
|
10
|
-
mediaProvider
|
|
10
|
+
mediaProvider,
|
|
11
|
+
rendererAppearance
|
|
11
12
|
} = props;
|
|
12
13
|
const [viewMediaClientConfigState, setViewMediaClientConfigState] = useState();
|
|
13
14
|
useEffect(() => {
|
|
@@ -30,9 +31,20 @@ export const RenderMediaInline = props => {
|
|
|
30
31
|
isSelected: false
|
|
31
32
|
});
|
|
32
33
|
}
|
|
34
|
+
const handleMediaInlineClick = result => {
|
|
35
|
+
var _props$eventHandlers, _props$eventHandlers$;
|
|
36
|
+
if ((_props$eventHandlers = props.eventHandlers) !== null && _props$eventHandlers !== void 0 && (_props$eventHandlers$ = _props$eventHandlers.media) !== null && _props$eventHandlers$ !== void 0 && _props$eventHandlers$.onClick) {
|
|
37
|
+
var _props$eventHandlers2, _props$eventHandlers3;
|
|
38
|
+
(_props$eventHandlers2 = props.eventHandlers) === null || _props$eventHandlers2 === void 0 ? void 0 : (_props$eventHandlers3 = _props$eventHandlers2.media) === null || _props$eventHandlers3 === void 0 ? void 0 : _props$eventHandlers3.onClick(result);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
const shouldOpenMediaViewer = rendererAppearance !== 'mobile';
|
|
42
|
+
const shouldDisplayToolTip = rendererAppearance !== 'mobile';
|
|
33
43
|
return /*#__PURE__*/React.createElement(MediaInlineCard, {
|
|
34
44
|
identifier: props.identifier,
|
|
35
|
-
|
|
45
|
+
onClick: handleMediaInlineClick,
|
|
46
|
+
shouldOpenMediaViewer: shouldOpenMediaViewer,
|
|
47
|
+
shouldDisplayToolTip: shouldDisplayToolTip,
|
|
36
48
|
mediaClientConfig: viewMediaClientConfigState
|
|
37
49
|
});
|
|
38
50
|
};
|
|
@@ -41,7 +53,8 @@ const MediaInline = props => {
|
|
|
41
53
|
collection,
|
|
42
54
|
id,
|
|
43
55
|
providers,
|
|
44
|
-
intl
|
|
56
|
+
intl,
|
|
57
|
+
rendererAppearance
|
|
45
58
|
} = props;
|
|
46
59
|
const identifier = {
|
|
47
60
|
id,
|
|
@@ -70,7 +83,9 @@ const MediaInline = props => {
|
|
|
70
83
|
}
|
|
71
84
|
return /*#__PURE__*/React.createElement(RenderMediaInline, {
|
|
72
85
|
identifier: identifier,
|
|
73
|
-
mediaProvider: mediaProvider
|
|
86
|
+
mediaProvider: mediaProvider,
|
|
87
|
+
eventHandlers: props.eventHandlers,
|
|
88
|
+
rendererAppearance: rendererAppearance
|
|
74
89
|
});
|
|
75
90
|
}
|
|
76
91
|
}));
|
|
@@ -35,7 +35,7 @@ import { RenderTracking } from '../../react/utils/performance/RenderTracking';
|
|
|
35
35
|
export const NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
36
36
|
export const DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
37
37
|
const packageName = "@atlaskit/renderer";
|
|
38
|
-
const packageVersion = "107.
|
|
38
|
+
const packageVersion = "107.3.0";
|
|
39
39
|
export class Renderer extends PureComponent {
|
|
40
40
|
/**
|
|
41
41
|
* This is used in measuring the Renderer Mount time and is then
|
|
@@ -245,6 +245,7 @@ export class Renderer extends PureComponent {
|
|
|
245
245
|
emojiResourceConfig: props.emojiResourceConfig,
|
|
246
246
|
smartLinks: props.smartLinks,
|
|
247
247
|
allowCopyToClipboard: props.allowCopyToClipboard,
|
|
248
|
+
allowWrapCodeBlock: props.allowWrapCodeBlock,
|
|
248
249
|
allowCustomPanels: props.allowCustomPanels,
|
|
249
250
|
allowAnnotations: props.allowAnnotations,
|
|
250
251
|
allowSelectAllTrap: props.allowSelectAllTrap,
|
|
@@ -269,6 +270,7 @@ export class Renderer extends PureComponent {
|
|
|
269
270
|
allowPlaceholderText,
|
|
270
271
|
allowColumnSorting,
|
|
271
272
|
allowCopyToClipboard,
|
|
273
|
+
allowWrapCodeBlock,
|
|
272
274
|
allowCustomPanels
|
|
273
275
|
} = this.props;
|
|
274
276
|
const allowNestedHeaderLinks = isNestedHeaderLinksEnabled(allowHeadingAnchorLinks);
|
|
@@ -341,6 +343,7 @@ export class Renderer extends PureComponent {
|
|
|
341
343
|
allowNestedHeaderLinks: allowNestedHeaderLinks,
|
|
342
344
|
allowColumnSorting: allowColumnSorting,
|
|
343
345
|
allowCopyToClipboard: allowCopyToClipboard,
|
|
346
|
+
allowWrapCodeBlock: allowWrapCodeBlock,
|
|
344
347
|
allowCustomPanels: allowCustomPanels,
|
|
345
348
|
allowPlaceholderText: allowPlaceholderText,
|
|
346
349
|
innerRef: this.editorRef,
|
|
@@ -371,6 +374,7 @@ export class Renderer extends PureComponent {
|
|
|
371
374
|
return jsx(RendererWrapper, {
|
|
372
375
|
appearance: appearance,
|
|
373
376
|
allowCopyToClipboard: allowCopyToClipboard,
|
|
377
|
+
allowWrapCodeBlock: allowWrapCodeBlock,
|
|
374
378
|
allowPlaceholderText: allowPlaceholderText,
|
|
375
379
|
allowColumnSorting: allowColumnSorting,
|
|
376
380
|
allowNestedHeaderLinks: allowNestedHeaderLinks,
|