@patternfly/quickstarts 5.4.0 → 5.4.2
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/dist/ConsoleInternal/components/markdown-view.d.ts +1 -1
- package/dist/index.es.js +53 -22
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +52 -21
- package/dist/index.js.map +1 -1
- package/dist/patternfly-docs/quick-starts/design-guidelines/design-guidelines.md +1 -1
- package/dist/quickstarts-base.css +61 -61
- package/dist/quickstarts-full.es.js +2480 -4934
- package/dist/quickstarts-full.es.js.map +1 -1
- package/dist/quickstarts-standalone.css +6 -0
- package/dist/quickstarts-standalone.min.css +1 -1
- package/dist/quickstarts.css +61 -61
- package/dist/quickstarts.min.css +1 -1
- package/package.json +5 -6
- package/src/ConsoleInternal/components/markdown-view.tsx +34 -23
- package/src/QuickStartPanelContent.tsx +10 -1
- package/src/controller/QuickStartTaskHeader.tsx +11 -1
|
@@ -5,7 +5,7 @@ interface ShowdownExtension {
|
|
|
5
5
|
regex?: RegExp;
|
|
6
6
|
replace?: (...args: any[]) => string;
|
|
7
7
|
}
|
|
8
|
-
export declare const markdownConvert: (markdown:
|
|
8
|
+
export declare const markdownConvert: (markdown: string, extensions?: ShowdownExtension[]) => Promise<any>;
|
|
9
9
|
interface SyncMarkdownProps {
|
|
10
10
|
content?: string;
|
|
11
11
|
emptyMsg?: string;
|
package/dist/index.es.js
CHANGED
|
@@ -3,7 +3,7 @@ import React__default, { createContext, useCallback, useEffect, useState } from
|
|
|
3
3
|
import { getUniqueId, Card, CardHeader, CardTitle, CardBody, CardFooter, Modal as Modal$1, useIsomorphicLayoutEffect, Tooltip, Alert, CodeBlock, Accordion, AccordionItem, AccordionToggle, AccordionContent, Popover, PopoverPosition, Button, Icon, Text, TextVariants, TextList, TextListItem, Flex, FlexItem, Title, Label, Gallery, GalleryItem, ToolbarItem, SearchInput, Select, SelectList, SelectOption, MenuToggle, Badge, Toolbar, ToolbarContent, EmptyState, EmptyStateHeader, EmptyStateIcon, EmptyStateBody, EmptyStateFooter, EmptyStateActions, Divider, ModalVariant, WizardNavItem, List, ExpandableSection, ListItem, Radio, DrawerPanelContent, DrawerHead, DrawerActions, DrawerCloseButton, DrawerPanelBody, Drawer, DrawerContent, DrawerContentBody, Stack, StackItem } from '@patternfly/react-core';
|
|
4
4
|
import SearchIcon from '@patternfly/react-icons/dist/js/icons/search-icon';
|
|
5
5
|
import { css } from '@patternfly/react-styles';
|
|
6
|
-
import { __rest } from 'tslib';
|
|
6
|
+
import { __rest, __awaiter } from 'tslib';
|
|
7
7
|
import '@patternfly/react-styles/css/components/Form/form';
|
|
8
8
|
import RocketIcon from '@patternfly/react-icons/dist/js/icons/rocket-icon';
|
|
9
9
|
import * as ReactDOM from 'react-dom';
|
|
@@ -11,7 +11,7 @@ import { renderToStaticMarkup } from 'react-dom/server';
|
|
|
11
11
|
import CopyIcon from '@patternfly/react-icons/dist/js/icons/copy-icon';
|
|
12
12
|
import LightbulbIcon from '@patternfly/react-icons/dist/js/icons/lightbulb-icon';
|
|
13
13
|
import FireIcon from '@patternfly/react-icons/dist/js/icons/fire-icon';
|
|
14
|
-
import {
|
|
14
|
+
import { marked } from 'marked';
|
|
15
15
|
import SyncAltIcon from '@patternfly/react-icons/dist/js/icons/sync-alt-icon';
|
|
16
16
|
import CheckCircleIcon from '@patternfly/react-icons/dist/js/icons/check-circle-icon';
|
|
17
17
|
import ExclamationCircleIcon from '@patternfly/react-icons/dist/js/icons/exclamation-circle-icon';
|
|
@@ -1276,16 +1276,7 @@ const useMultilineCopyClipboardShowdownExtension = () => {
|
|
|
1276
1276
|
|
|
1277
1277
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
1278
1278
|
const DOMPurify = require('dompurify');
|
|
1279
|
-
const markdownConvert = (markdown, extensions) => {
|
|
1280
|
-
const converter = new Converter({
|
|
1281
|
-
tables: true,
|
|
1282
|
-
openLinksInNewWindow: true,
|
|
1283
|
-
strikethrough: true,
|
|
1284
|
-
emoji: false,
|
|
1285
|
-
});
|
|
1286
|
-
if (extensions) {
|
|
1287
|
-
converter.addExtension(extensions);
|
|
1288
|
-
}
|
|
1279
|
+
const markdownConvert = (markdown, extensions) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1289
1280
|
DOMPurify.addHook('beforeSanitizeElements', function (node) {
|
|
1290
1281
|
// nodeType 1 = element type
|
|
1291
1282
|
// transform anchor tags
|
|
@@ -1312,16 +1303,36 @@ const markdownConvert = (markdown, extensions) => {
|
|
|
1312
1303
|
node.setAttribute('xlink:show', 'new');
|
|
1313
1304
|
}
|
|
1314
1305
|
});
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1306
|
+
// Replace code fences with non markdown formatting relates tokens so that marked doesn't try to parse them as code spans
|
|
1307
|
+
const markdownWithSubstitutedCodeFences = markdown.replace(/```/g, '@@@');
|
|
1308
|
+
const parsedMarkdown = yield marked.parse(markdownWithSubstitutedCodeFences);
|
|
1309
|
+
// Swap the temporary tokens back to code fences before we run the extensions
|
|
1310
|
+
let md = parsedMarkdown.replace(/@@@/g, '```');
|
|
1311
|
+
if (extensions) {
|
|
1312
|
+
// Convert code spans back to md format before we run the custom extension regexes
|
|
1313
|
+
md = md.replace(/<code>(.*)<\/code>/g, '`$1`');
|
|
1314
|
+
extensions.forEach(({ regex, replace }) => {
|
|
1315
|
+
if (regex) {
|
|
1316
|
+
md = md.replace(regex, replace);
|
|
1317
|
+
}
|
|
1318
|
+
});
|
|
1319
|
+
// Convert any remaining backticks back into code spans
|
|
1320
|
+
md = md.replace(/`(.*)`/g, '<code>$1</code>');
|
|
1321
|
+
}
|
|
1322
|
+
return DOMPurify.sanitize(md);
|
|
1323
|
+
});
|
|
1322
1324
|
const SyncMarkdownView = ({ content, emptyMsg, extensions, renderExtension, exactHeight, inline, className, }) => {
|
|
1323
1325
|
const { getResource } = React.useContext(QuickStartContext);
|
|
1324
|
-
const markup = React.
|
|
1326
|
+
const [markup, setMarkup] = React.useState('');
|
|
1327
|
+
React.useEffect(() => {
|
|
1328
|
+
function getMd() {
|
|
1329
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1330
|
+
const md = yield markdownConvert(content || emptyMsg || getResource('Not available'), extensions);
|
|
1331
|
+
setMarkup(md);
|
|
1332
|
+
});
|
|
1333
|
+
}
|
|
1334
|
+
getMd();
|
|
1335
|
+
}, [content, emptyMsg, getResource, extensions]);
|
|
1325
1336
|
const innerProps = {
|
|
1326
1337
|
renderExtension: (extensions === null || extensions === void 0 ? void 0 : extensions.length) > 0 ? renderExtension : undefined,
|
|
1327
1338
|
exactHeight,
|
|
@@ -1986,12 +1997,22 @@ const TaskIcon = ({ taskIndex, taskStatus }) => {
|
|
|
1986
1997
|
const QuickStartTaskHeader = ({ title, taskIndex, subtitle, taskStatus, size, isActiveTask, onTaskSelect, children, }) => {
|
|
1987
1998
|
const titleRef = React.useRef(null);
|
|
1988
1999
|
const { focusOnQuickStart } = React.useContext(QuickStartContext);
|
|
2000
|
+
const [parsedTitle, setParsedTitle] = React.useState('');
|
|
1989
2001
|
React.useEffect(() => {
|
|
1990
2002
|
if (focusOnQuickStart && isActiveTask) {
|
|
1991
2003
|
// Focus the WizardNavItem button element that contains the title
|
|
1992
2004
|
titleRef.current.parentNode.focus();
|
|
1993
2005
|
}
|
|
1994
2006
|
}, [focusOnQuickStart, isActiveTask]);
|
|
2007
|
+
React.useEffect(() => {
|
|
2008
|
+
function getParsedTitle() {
|
|
2009
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2010
|
+
const convertedMdTitle = yield markdownConvert(title);
|
|
2011
|
+
setParsedTitle(removeParagraphWrap(convertedMdTitle));
|
|
2012
|
+
});
|
|
2013
|
+
}
|
|
2014
|
+
getParsedTitle();
|
|
2015
|
+
}, [title]);
|
|
1995
2016
|
const classNames = css('pfext-quick-start-task-header__title', {
|
|
1996
2017
|
'pfext-quick-start-task-header__title-success': taskStatus === QuickStartTaskStatus.SUCCESS,
|
|
1997
2018
|
'pfext-quick-start-task-header__title-failed': taskStatus === (QuickStartTaskStatus.FAILED || QuickStartTaskStatus.VISITED),
|
|
@@ -2007,7 +2028,7 @@ const QuickStartTaskHeader = ({ title, taskIndex, subtitle, taskStatus, size, is
|
|
|
2007
2028
|
const content = (React.createElement("div", { className: "pfext-quick-start-task-header", ref: titleRef },
|
|
2008
2029
|
React.createElement(TaskIcon, { taskIndex: taskIndex, taskStatus: taskStatus }),
|
|
2009
2030
|
React.createElement(Title, { headingLevel: "h3", size: size, className: classNames },
|
|
2010
|
-
React.createElement("span", { dangerouslySetInnerHTML: { __html:
|
|
2031
|
+
React.createElement("span", { dangerouslySetInnerHTML: { __html: parsedTitle } }),
|
|
2011
2032
|
isActiveTask && subtitle && (React.createElement("span", { className: "pfext-quick-start-task-header__subtitle", "data-test-id": "quick-start-task-subtitle" },
|
|
2012
2033
|
' ',
|
|
2013
2034
|
subtitle))),
|
|
@@ -2204,6 +2225,7 @@ const QuickStartPanelContent = (_a) => {
|
|
|
2204
2225
|
const titleRef = React.useRef(null);
|
|
2205
2226
|
const { getResource, activeQuickStartState, focusOnQuickStart } = React.useContext(QuickStartContext);
|
|
2206
2227
|
const [contentRef, setContentRef] = React.useState();
|
|
2228
|
+
const [displayName, setDisplayName] = React.useState('');
|
|
2207
2229
|
const shadows = useScrollShadows(contentRef);
|
|
2208
2230
|
const quickStart = quickStarts.find((qs) => qs.metadata.name === activeQuickStartID);
|
|
2209
2231
|
const taskNumber = activeQuickStartState === null || activeQuickStartState === void 0 ? void 0 : activeQuickStartState.taskNumber;
|
|
@@ -2231,13 +2253,22 @@ const QuickStartPanelContent = (_a) => {
|
|
|
2231
2253
|
titleRef.current.focus();
|
|
2232
2254
|
}
|
|
2233
2255
|
}, [focusOnQuickStart, quickStart]);
|
|
2256
|
+
React.useEffect(() => {
|
|
2257
|
+
function getDisplayName() {
|
|
2258
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2259
|
+
const convertedMdDisplayName = yield markdownConvert(quickStart === null || quickStart === void 0 ? void 0 : quickStart.spec.displayName);
|
|
2260
|
+
setDisplayName(removeParagraphWrap(convertedMdDisplayName));
|
|
2261
|
+
});
|
|
2262
|
+
}
|
|
2263
|
+
getDisplayName();
|
|
2264
|
+
}, [quickStart]);
|
|
2234
2265
|
const content = quickStart ? (React.createElement(DrawerPanelContent, Object.assign({ isResizable: isResizable, className: "pfext-quick-start__base", "data-testid": `qs-drawer-${camelize(quickStart.spec.displayName)}`, "data-qs": `qs-step-${getStep()}`, "data-test": "quickstart drawer" }, props),
|
|
2235
2266
|
React.createElement("div", { className: headerClasses },
|
|
2236
2267
|
React.createElement(DrawerHead, null,
|
|
2237
2268
|
React.createElement("div", { className: "pfext-quick-start-panel-content__title", tabIndex: -1, ref: titleRef },
|
|
2238
2269
|
React.createElement(Title, { headingLevel: "h2", size: "xl", className: "pfext-quick-start-panel-content__name", style: { marginRight: 'var(--pf-v5-global--spacer--md)' } },
|
|
2239
2270
|
React.createElement("span", { dangerouslySetInnerHTML: {
|
|
2240
|
-
__html:
|
|
2271
|
+
__html: displayName,
|
|
2241
2272
|
} }),
|
|
2242
2273
|
' ',
|
|
2243
2274
|
React.createElement("small", { className: "pfext-quick-start-panel-content__duration" }, (quickStart === null || quickStart === void 0 ? void 0 : quickStart.spec.durationMinutes)
|