@rh-support/components 2.5.178 → 2.5.181
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/lib/esm/MarkdownEditor/MarkdownEditor.d.ts +1 -0
- package/lib/esm/MarkdownEditor/MarkdownEditor.d.ts.map +1 -1
- package/lib/esm/MarkdownEditor/MarkdownEditor.js +4 -3
- package/lib/esm/hooks/useCopyToClipboard.d.ts +1 -1
- package/lib/esm/hooks/useCopyToClipboard.d.ts.map +1 -1
- package/lib/esm/hooks/useCopyToClipboard.js +3 -1
- package/package.json +4 -4
|
@@ -32,6 +32,7 @@ export interface IMDEditorProps extends Omit<HTMLProps<HTMLTextAreaElement>, 'on
|
|
|
32
32
|
markedownOptions?: IMarkdownOptions;
|
|
33
33
|
showMarkdownPlainTextToggle?: boolean;
|
|
34
34
|
editorMode?: EditorMode;
|
|
35
|
+
hideToolbars?: boolean;
|
|
35
36
|
charLimit?: number;
|
|
36
37
|
minCharsForCounter?: number;
|
|
37
38
|
onCommentExceedCharsLimit: (val: boolean) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarkdownEditor.d.ts","sourceRoot":"","sources":["../../../src/MarkdownEditor/MarkdownEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAwB,MAAM,qBAAqB,CAAC;AAiC7E,OAAO,KAAK,EAAE,EAAE,SAAS,EAA+B,MAAM,OAAO,CAAC;AAMtE,oBAAY,UAAU;IAClB,KAAK,cAAc;IACnB,QAAQ,aAAa;CACxB;AAED,UAAU,kBAAkB;IACxB,yBAAyB,EAAE,OAAO,CAAC;IACnC,SAAS,EAAE,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;IAClC,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,WAAW,CAAC,KAAK,IAAI,C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GAAG,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAClD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,yBAAyB,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;IAClD,iBAAiB,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;CACnD;AA4BD,eAAO,MAAM,YAAY,GAAI,MAAM,OAAO,CAAC,WAAW,CAAC,KAAG;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAiB7F,CAAC;AAEF,iBAAS,cAAc,CAAC,KAAK,EAAE,cAAc,qBAo8B5C;kBAp8BQ,cAAc;;;AAw8BvB,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -46,6 +46,7 @@ const defaultProps = {
|
|
|
46
46
|
hideHeadingOptions: false,
|
|
47
47
|
showMarkdownPlainTextToggle: false,
|
|
48
48
|
editorMode: EditorMode.PLAIN,
|
|
49
|
+
hideToolbars: false,
|
|
49
50
|
charLimit: 32000,
|
|
50
51
|
minCharsForCounter: 31800,
|
|
51
52
|
fileSelectorProps: {
|
|
@@ -72,7 +73,7 @@ export const validateFile = (file) => {
|
|
|
72
73
|
};
|
|
73
74
|
function MarkdownEditor(props) {
|
|
74
75
|
const { t } = useTranslation();
|
|
75
|
-
const { hidePreviewText, showPreviewText, mdPlaceholder, plainTextPlaceholder, textAreaClassName, bindTextArea, markedownOptions, allowEmoji, hideHeadingOptions, rows, showMarkdownPlainTextToggle, editorMode, className, charLimit, minCharsForCounter, id, value, onCommentExceedCharsLimit, fileSelectorProps: { onClipboardPaste, onFileSelect, isSupportedFile, showFileSelectorInToolbar = false, isUploadingFile = false, filesList = [], attachFileBtn, } } = props, textAreaProps = __rest(props, ["hidePreviewText", "showPreviewText", "mdPlaceholder", "plainTextPlaceholder", "textAreaClassName", "bindTextArea", "markedownOptions", "allowEmoji", "hideHeadingOptions", "rows", "showMarkdownPlainTextToggle", "editorMode", "className", "charLimit", "minCharsForCounter", "id", "value", "onCommentExceedCharsLimit", "fileSelectorProps"]);
|
|
76
|
+
const { hidePreviewText, showPreviewText, mdPlaceholder, plainTextPlaceholder, textAreaClassName, bindTextArea, markedownOptions, allowEmoji, hideHeadingOptions, rows, showMarkdownPlainTextToggle, editorMode, className, charLimit, minCharsForCounter, id, value, hideToolbars, onCommentExceedCharsLimit, fileSelectorProps: { onClipboardPaste, onFileSelect, isSupportedFile, showFileSelectorInToolbar = false, isUploadingFile = false, filesList = [], attachFileBtn, } } = props, textAreaProps = __rest(props, ["hidePreviewText", "showPreviewText", "mdPlaceholder", "plainTextPlaceholder", "textAreaClassName", "bindTextArea", "markedownOptions", "allowEmoji", "hideHeadingOptions", "rows", "showMarkdownPlainTextToggle", "editorMode", "className", "charLimit", "minCharsForCounter", "id", "value", "hideToolbars", "onCommentExceedCharsLimit", "fileSelectorProps"]);
|
|
76
77
|
const [isPreview, setIsPreview] = useState(false);
|
|
77
78
|
const [mdValue, setMdValue] = useState(props.value || '');
|
|
78
79
|
const previousFileList = usePrevious(filesList);
|
|
@@ -528,7 +529,7 @@ function MarkdownEditor(props) {
|
|
|
528
529
|
return (React.createElement("div", { id: "markdown-editor" },
|
|
529
530
|
!isPlainModeEnabled && React.createElement("div", { className: "markdown-guidance-container" }, markdownGuidanceBtn),
|
|
530
531
|
React.createElement("div", { className: `markdown-editor-container ${props.className}`, id: props.id, "data-tracking-id": "md-editor-container", onDrop: onDrop, onPaste: onPaste },
|
|
531
|
-
React.createElement("div", { className: "toolbar-container border-bottom" }, !isPlainModeEnabled && (React.createElement(React.Fragment, null,
|
|
532
|
+
React.createElement("div", { className: "toolbar-container border-bottom", style: hideToolbars ? { display: 'none' } : undefined }, !isPlainModeEnabled && (React.createElement(React.Fragment, null,
|
|
532
533
|
React.createElement(Toolbar, { className: "desktop-markdown-toolbar pf-v6-l-flex" },
|
|
533
534
|
React.createElement(ToolbarGroup, { "data-tracking-id": "md-editor-toolbar", className: "markdown-toolbar-left-section pf-m-wrap" },
|
|
534
535
|
React.createElement(Button, { icon: "B", variant: ButtonVariant.plain, tabIndex: -1, isDisabled: props.disabled || isPreview, onClick: bold, "data-tracking-id": "md-editor-toolbar-b", title: "Bold" }),
|
|
@@ -580,7 +581,7 @@ function MarkdownEditor(props) {
|
|
|
580
581
|
React.createElement("div", { dangerouslySetInnerHTML: {
|
|
581
582
|
__html: DOMPurify.sanitize(previewMDText(mdValue)),
|
|
582
583
|
} }))))),
|
|
583
|
-
React.createElement("div",
|
|
584
|
+
React.createElement("div", { style: hideToolbars ? { display: 'none' } : undefined }, props.showMarkdownPlainTextToggle && (React.createElement("div", { className: `markdown-toggle-toolbar pf-v6-l-flex` },
|
|
584
585
|
React.createElement("span", { className: "markdown-toolbar-left-section pf-m-wrap" },
|
|
585
586
|
!isPlainModeEnabled && (React.createElement(Button, { className: "markdown-preview-btn", tabIndex: -1, variant: ButtonVariant.plain, onClick: preview, title: "Show preview", "data-tracking-id": `md-preview-${isPreview ? 'hide' : 'show'}`, isDisabled: disablePreviewButton, icon: React.createElement(Trans, null, isPreview ? (React.createElement("span", null,
|
|
586
587
|
" ",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCopyToClipboard.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCopyToClipboard.ts"],"names":[],"mappings":"AAGA,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"useCopyToClipboard.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCopyToClipboard.ts"],"names":[],"mappings":"AAGA,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC;;;EA6BnE"}
|
|
@@ -14,9 +14,11 @@ export function useCopyToClipboard(ref) {
|
|
|
14
14
|
// @ts-ignore
|
|
15
15
|
const { t } = useTranslation();
|
|
16
16
|
const copyToClipboard = () => __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
var _a;
|
|
17
18
|
if (!ref.current)
|
|
18
19
|
return;
|
|
19
|
-
const
|
|
20
|
+
const el = ref.current;
|
|
21
|
+
const textToCopy = el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement ? el.value : (_a = el.textContent) !== null && _a !== void 0 ? _a : '';
|
|
20
22
|
try {
|
|
21
23
|
yield navigator.clipboard.writeText(textToCopy);
|
|
22
24
|
setClipboardText(t('Copied!'));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/components",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.181",
|
|
4
4
|
"description": "Contains all reusabel components for support app",
|
|
5
5
|
"author": "Vikas Rathee <vrathee@redhat.com>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
"@patternfly/react-table": "6.2.1",
|
|
65
65
|
"@patternfly/react-tokens": "6.2.1",
|
|
66
66
|
"@rh-support/types": "2.0.26",
|
|
67
|
-
"@rh-support/user-permissions": "2.5.
|
|
68
|
-
"@rh-support/utils": "2.5.
|
|
67
|
+
"@rh-support/user-permissions": "2.5.127",
|
|
68
|
+
"@rh-support/utils": "2.5.110",
|
|
69
69
|
"dompurify": "^2.2.6",
|
|
70
70
|
"js-worker-search": "^1.4.1",
|
|
71
71
|
"lazysizes": "^5.3.2",
|
|
@@ -102,5 +102,5 @@
|
|
|
102
102
|
"defaults and supports es6-module",
|
|
103
103
|
"maintained node versions"
|
|
104
104
|
],
|
|
105
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "d1a226af32eb5997a31c34001b6146be141c8911"
|
|
106
106
|
}
|