@patternfly/quickstarts 5.4.1 → 5.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ConsoleInternal/components/markdown-view.d.ts +1 -1
- package/dist/index.es.js +60 -22
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +59 -21
- package/dist/index.js.map +1 -1
- package/dist/quickstarts-base.css +56 -56
- package/dist/quickstarts-full.es.js +2487 -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 +56 -56
- package/dist/quickstarts.min.css +1 -1
- package/package.json +2 -2
- package/src/ConsoleInternal/components/markdown-view.tsx +46 -23
- package/src/QuickStartPanelContent.tsx +10 -1
- package/src/controller/QuickStartTaskHeader.tsx +11 -1
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var server = require('react-dom/server');
|
|
|
14
14
|
var CopyIcon = require('@patternfly/react-icons/dist/js/icons/copy-icon');
|
|
15
15
|
var LightbulbIcon = require('@patternfly/react-icons/dist/js/icons/lightbulb-icon');
|
|
16
16
|
var FireIcon = require('@patternfly/react-icons/dist/js/icons/fire-icon');
|
|
17
|
-
var
|
|
17
|
+
var marked = require('marked');
|
|
18
18
|
var SyncAltIcon = require('@patternfly/react-icons/dist/js/icons/sync-alt-icon');
|
|
19
19
|
var CheckCircleIcon = require('@patternfly/react-icons/dist/js/icons/check-circle-icon');
|
|
20
20
|
var ExclamationCircleIcon = require('@patternfly/react-icons/dist/js/icons/exclamation-circle-icon');
|
|
@@ -1320,16 +1320,7 @@ const useMultilineCopyClipboardShowdownExtension = () => {
|
|
|
1320
1320
|
|
|
1321
1321
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
1322
1322
|
const DOMPurify = require('dompurify');
|
|
1323
|
-
const markdownConvert = (markdown, extensions) => {
|
|
1324
|
-
const converter = new showdown.Converter({
|
|
1325
|
-
tables: true,
|
|
1326
|
-
openLinksInNewWindow: true,
|
|
1327
|
-
strikethrough: true,
|
|
1328
|
-
emoji: false,
|
|
1329
|
-
});
|
|
1330
|
-
if (extensions) {
|
|
1331
|
-
converter.addExtension(extensions);
|
|
1332
|
-
}
|
|
1323
|
+
const markdownConvert = (markdown, extensions) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
1333
1324
|
DOMPurify.addHook('beforeSanitizeElements', function (node) {
|
|
1334
1325
|
// nodeType 1 = element type
|
|
1335
1326
|
// transform anchor tags
|
|
@@ -1356,16 +1347,43 @@ const markdownConvert = (markdown, extensions) => {
|
|
|
1356
1347
|
node.setAttribute('xlink:show', 'new');
|
|
1357
1348
|
}
|
|
1358
1349
|
});
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1350
|
+
const reverseString = (str) => str.split('').reverse().join('');
|
|
1351
|
+
// replace code fences that end in a double curly brace (which are used by our custom md extensions) with non
|
|
1352
|
+
// markdown formatting related tokens so that marked doesn't try to parse them as code spans
|
|
1353
|
+
//
|
|
1354
|
+
// we want to reverse the string before we do the substitution so that we only match the opening code fence which
|
|
1355
|
+
// corresponds to the closing code fence with the double curly brace
|
|
1356
|
+
const reversedMarkdown = reverseString(markdown);
|
|
1357
|
+
const reverseMarkdownWithSubstitutedCodeFences = reversedMarkdown.replace(/{{```((.|\n)*?)```/g, '{{@@@$1@@@');
|
|
1358
|
+
const markdownWithSubstitutedCodeFences = reverseString(reverseMarkdownWithSubstitutedCodeFences);
|
|
1359
|
+
const parsedMarkdown = yield marked.marked.parse(markdownWithSubstitutedCodeFences);
|
|
1360
|
+
// Swap the temporary tokens back to code fences before we run the extensions
|
|
1361
|
+
let md = parsedMarkdown.replace(/@@@/g, '```');
|
|
1362
|
+
if (extensions) {
|
|
1363
|
+
// Convert code spans back to md format before we run the custom extension regexes
|
|
1364
|
+
md = md.replace(/<code>(.*)<\/code>/g, '`$1`');
|
|
1365
|
+
extensions.forEach(({ regex, replace }) => {
|
|
1366
|
+
if (regex) {
|
|
1367
|
+
md = md.replace(regex, replace);
|
|
1368
|
+
}
|
|
1369
|
+
});
|
|
1370
|
+
// Convert any remaining backticks back into code spans
|
|
1371
|
+
md = md.replace(/`(.*)`/g, '<code>$1</code>');
|
|
1372
|
+
}
|
|
1373
|
+
return DOMPurify.sanitize(md);
|
|
1374
|
+
});
|
|
1366
1375
|
const SyncMarkdownView = ({ content, emptyMsg, extensions, renderExtension, exactHeight, inline, className, }) => {
|
|
1367
1376
|
const { getResource } = React__namespace.useContext(QuickStartContext);
|
|
1368
|
-
const markup = React__namespace.
|
|
1377
|
+
const [markup, setMarkup] = React__namespace.useState('');
|
|
1378
|
+
React__namespace.useEffect(() => {
|
|
1379
|
+
function getMd() {
|
|
1380
|
+
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
1381
|
+
const md = yield markdownConvert(content || emptyMsg || getResource('Not available'), extensions);
|
|
1382
|
+
setMarkup(md);
|
|
1383
|
+
});
|
|
1384
|
+
}
|
|
1385
|
+
getMd();
|
|
1386
|
+
}, [content, emptyMsg, getResource, extensions]);
|
|
1369
1387
|
const innerProps = {
|
|
1370
1388
|
renderExtension: (extensions === null || extensions === void 0 ? void 0 : extensions.length) > 0 ? renderExtension : undefined,
|
|
1371
1389
|
exactHeight,
|
|
@@ -2030,12 +2048,22 @@ const TaskIcon = ({ taskIndex, taskStatus }) => {
|
|
|
2030
2048
|
const QuickStartTaskHeader = ({ title, taskIndex, subtitle, taskStatus, size, isActiveTask, onTaskSelect, children, }) => {
|
|
2031
2049
|
const titleRef = React__namespace.useRef(null);
|
|
2032
2050
|
const { focusOnQuickStart } = React__namespace.useContext(QuickStartContext);
|
|
2051
|
+
const [parsedTitle, setParsedTitle] = React__namespace.useState('');
|
|
2033
2052
|
React__namespace.useEffect(() => {
|
|
2034
2053
|
if (focusOnQuickStart && isActiveTask) {
|
|
2035
2054
|
// Focus the WizardNavItem button element that contains the title
|
|
2036
2055
|
titleRef.current.parentNode.focus();
|
|
2037
2056
|
}
|
|
2038
2057
|
}, [focusOnQuickStart, isActiveTask]);
|
|
2058
|
+
React__namespace.useEffect(() => {
|
|
2059
|
+
function getParsedTitle() {
|
|
2060
|
+
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
2061
|
+
const convertedMdTitle = yield markdownConvert(title);
|
|
2062
|
+
setParsedTitle(removeParagraphWrap(convertedMdTitle));
|
|
2063
|
+
});
|
|
2064
|
+
}
|
|
2065
|
+
getParsedTitle();
|
|
2066
|
+
}, [title]);
|
|
2039
2067
|
const classNames = reactStyles.css('pfext-quick-start-task-header__title', {
|
|
2040
2068
|
'pfext-quick-start-task-header__title-success': taskStatus === exports.QuickStartTaskStatus.SUCCESS,
|
|
2041
2069
|
'pfext-quick-start-task-header__title-failed': taskStatus === (exports.QuickStartTaskStatus.FAILED || exports.QuickStartTaskStatus.VISITED),
|
|
@@ -2051,7 +2079,7 @@ const QuickStartTaskHeader = ({ title, taskIndex, subtitle, taskStatus, size, is
|
|
|
2051
2079
|
const content = (React__namespace.createElement("div", { className: "pfext-quick-start-task-header", ref: titleRef },
|
|
2052
2080
|
React__namespace.createElement(TaskIcon, { taskIndex: taskIndex, taskStatus: taskStatus }),
|
|
2053
2081
|
React__namespace.createElement(reactCore.Title, { headingLevel: "h3", size: size, className: classNames },
|
|
2054
|
-
React__namespace.createElement("span", { dangerouslySetInnerHTML: { __html:
|
|
2082
|
+
React__namespace.createElement("span", { dangerouslySetInnerHTML: { __html: parsedTitle } }),
|
|
2055
2083
|
isActiveTask && subtitle && (React__namespace.createElement("span", { className: "pfext-quick-start-task-header__subtitle", "data-test-id": "quick-start-task-subtitle" },
|
|
2056
2084
|
' ',
|
|
2057
2085
|
subtitle))),
|
|
@@ -2248,6 +2276,7 @@ const QuickStartPanelContent = (_a) => {
|
|
|
2248
2276
|
const titleRef = React__namespace.useRef(null);
|
|
2249
2277
|
const { getResource, activeQuickStartState, focusOnQuickStart } = React__namespace.useContext(QuickStartContext);
|
|
2250
2278
|
const [contentRef, setContentRef] = React__namespace.useState();
|
|
2279
|
+
const [displayName, setDisplayName] = React__namespace.useState('');
|
|
2251
2280
|
const shadows = useScrollShadows(contentRef);
|
|
2252
2281
|
const quickStart = quickStarts.find((qs) => qs.metadata.name === activeQuickStartID);
|
|
2253
2282
|
const taskNumber = activeQuickStartState === null || activeQuickStartState === void 0 ? void 0 : activeQuickStartState.taskNumber;
|
|
@@ -2275,13 +2304,22 @@ const QuickStartPanelContent = (_a) => {
|
|
|
2275
2304
|
titleRef.current.focus();
|
|
2276
2305
|
}
|
|
2277
2306
|
}, [focusOnQuickStart, quickStart]);
|
|
2307
|
+
React__namespace.useEffect(() => {
|
|
2308
|
+
function getDisplayName() {
|
|
2309
|
+
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
2310
|
+
const convertedMdDisplayName = yield markdownConvert(quickStart === null || quickStart === void 0 ? void 0 : quickStart.spec.displayName);
|
|
2311
|
+
setDisplayName(removeParagraphWrap(convertedMdDisplayName));
|
|
2312
|
+
});
|
|
2313
|
+
}
|
|
2314
|
+
getDisplayName();
|
|
2315
|
+
}, [quickStart]);
|
|
2278
2316
|
const content = quickStart ? (React__namespace.createElement(reactCore.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),
|
|
2279
2317
|
React__namespace.createElement("div", { className: headerClasses },
|
|
2280
2318
|
React__namespace.createElement(reactCore.DrawerHead, null,
|
|
2281
2319
|
React__namespace.createElement("div", { className: "pfext-quick-start-panel-content__title", tabIndex: -1, ref: titleRef },
|
|
2282
2320
|
React__namespace.createElement(reactCore.Title, { headingLevel: "h2", size: "xl", className: "pfext-quick-start-panel-content__name", style: { marginRight: 'var(--pf-v5-global--spacer--md)' } },
|
|
2283
2321
|
React__namespace.createElement("span", { dangerouslySetInnerHTML: {
|
|
2284
|
-
__html:
|
|
2322
|
+
__html: displayName,
|
|
2285
2323
|
} }),
|
|
2286
2324
|
' ',
|
|
2287
2325
|
React__namespace.createElement("small", { className: "pfext-quick-start-panel-content__duration" }, (quickStart === null || quickStart === void 0 ? void 0 : quickStart.spec.durationMinutes)
|