@patternfly/quickstarts 2.4.3 → 2.4.5
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 +63 -24
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +62 -23
- package/dist/index.js.map +1 -1
- package/dist/quickstarts-base.css +69 -69
- package/dist/quickstarts-full.es.js +2553 -4692
- 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 +69 -69
- package/dist/quickstarts.min.css +1 -1
- package/package.json +2 -2
- package/src/ConsoleInternal/components/markdown-view.tsx +50 -50
- package/src/QuickStartPanelContent.tsx +10 -1
- package/src/controller/QuickStartTaskHeader.tsx +12 -1
- package/src/declaration.d.ts +1 -0
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@ var server = require('react-dom/server');
|
|
|
13
13
|
var CopyIcon = require('@patternfly/react-icons/dist/js/icons/copy-icon');
|
|
14
14
|
var LightbulbIcon = require('@patternfly/react-icons/dist/js/icons/lightbulb-icon');
|
|
15
15
|
var FireIcon = require('@patternfly/react-icons/dist/js/icons/fire-icon');
|
|
16
|
-
var
|
|
16
|
+
var marked = require('marked');
|
|
17
17
|
var SyncAltIcon = require('@patternfly/react-icons/dist/js/icons/sync-alt-icon');
|
|
18
18
|
var CheckCircleIcon = require('@patternfly/react-icons/dist/js/icons/check-circle-icon');
|
|
19
19
|
var ExclamationCircleIcon = require('@patternfly/react-icons/dist/js/icons/exclamation-circle-icon');
|
|
@@ -1329,16 +1329,7 @@ const useMultilineCopyClipboardShowdownExtension = () => {
|
|
|
1329
1329
|
|
|
1330
1330
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
1331
1331
|
const DOMPurify = require('dompurify');
|
|
1332
|
-
const markdownConvert = (markdown, extensions) => {
|
|
1333
|
-
const converter = new showdown.Converter({
|
|
1334
|
-
tables: true,
|
|
1335
|
-
openLinksInNewWindow: true,
|
|
1336
|
-
strikethrough: true,
|
|
1337
|
-
emoji: false,
|
|
1338
|
-
});
|
|
1339
|
-
if (extensions) {
|
|
1340
|
-
converter.addExtension(extensions);
|
|
1341
|
-
}
|
|
1332
|
+
const markdownConvert = (markdown, extensions) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
1342
1333
|
DOMPurify.addHook('beforeSanitizeElements', function (node) {
|
|
1343
1334
|
// nodeType 1 = element type
|
|
1344
1335
|
// transform anchor tags
|
|
@@ -1365,20 +1356,48 @@ const markdownConvert = (markdown, extensions) => {
|
|
|
1365
1356
|
node.setAttribute('xlink:show', 'new');
|
|
1366
1357
|
}
|
|
1367
1358
|
});
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1359
|
+
const reverseString = (str) => str
|
|
1360
|
+
.split('')
|
|
1361
|
+
.reverse()
|
|
1362
|
+
.join('');
|
|
1363
|
+
// replace code fences that end in a double curly brace (which are used by our custom md extensions) with non
|
|
1364
|
+
// markdown formatting related tokens so that marked doesn't try to parse them as code spans
|
|
1365
|
+
//
|
|
1366
|
+
// we want to reverse the string before we do the substitution so that we only match the opening code fence which
|
|
1367
|
+
// corresponds to the closing code fence with the double curly brace
|
|
1368
|
+
const reversedMarkdown = reverseString(markdown);
|
|
1369
|
+
const reverseMarkdownWithSubstitutedCodeFences = reversedMarkdown.replace(/{{```((.|\n)*?)```/g, '{{@@@$1@@@');
|
|
1370
|
+
const markdownWithSubstitutedCodeFences = reverseString(reverseMarkdownWithSubstitutedCodeFences);
|
|
1371
|
+
const parsedMarkdown = yield marked.marked.parse(markdownWithSubstitutedCodeFences);
|
|
1372
|
+
// Swap the temporary tokens back to code fences before we run the extensions
|
|
1373
|
+
let md = parsedMarkdown.replace(/@@@/g, '```');
|
|
1374
|
+
if (extensions) {
|
|
1375
|
+
// Convert code spans back to md format before we run the custom extension regexes
|
|
1376
|
+
md = md.replace(/<code>(.*)<\/code>/g, '`$1`');
|
|
1377
|
+
extensions.forEach(({ regex, replace }) => {
|
|
1378
|
+
if (regex) {
|
|
1379
|
+
md = md.replace(regex, replace);
|
|
1380
|
+
}
|
|
1381
|
+
});
|
|
1382
|
+
// Convert any remaining backticks back into code spans
|
|
1383
|
+
md = md.replace(/`(.*)`/g, '<code>$1</code>');
|
|
1384
|
+
}
|
|
1385
|
+
return DOMPurify.sanitize(md);
|
|
1386
|
+
});
|
|
1375
1387
|
const SyncMarkdownView = ({
|
|
1376
1388
|
// truncateContent,
|
|
1377
1389
|
content, emptyMsg, extensions, renderExtension, exactHeight, inline, className, }) => {
|
|
1378
1390
|
const { getResource } = React__namespace.useContext(QuickStartContext);
|
|
1379
|
-
const markup = React__namespace.
|
|
1380
|
-
|
|
1381
|
-
|
|
1391
|
+
const [markup, setMarkup] = React__namespace.useState('');
|
|
1392
|
+
React__namespace.useEffect(() => {
|
|
1393
|
+
function getMd() {
|
|
1394
|
+
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
1395
|
+
const md = yield markdownConvert(content || emptyMsg || getResource('Not available'), extensions);
|
|
1396
|
+
setMarkup(md);
|
|
1397
|
+
});
|
|
1398
|
+
}
|
|
1399
|
+
getMd();
|
|
1400
|
+
}, [content, emptyMsg, getResource, extensions]);
|
|
1382
1401
|
const innerProps = {
|
|
1383
1402
|
renderExtension: (extensions === null || extensions === void 0 ? void 0 : extensions.length) > 0 ? renderExtension : undefined,
|
|
1384
1403
|
exactHeight,
|
|
@@ -2045,12 +2064,22 @@ const TaskIcon = ({ taskIndex, taskStatus }) => {
|
|
|
2045
2064
|
};
|
|
2046
2065
|
const QuickStartTaskHeader = ({ title, taskIndex, subtitle, taskStatus, size, isActiveTask, onTaskSelect, children, }) => {
|
|
2047
2066
|
const titleRef = React__namespace.useRef(null);
|
|
2067
|
+
const [parsedTitle, setParsedTitle] = React__namespace.useState('');
|
|
2048
2068
|
React__namespace.useEffect(() => {
|
|
2049
2069
|
if (isActiveTask) {
|
|
2050
2070
|
// Focus the WizardNavItem button element that contains the title
|
|
2051
2071
|
titleRef.current.parentNode.focus();
|
|
2052
2072
|
}
|
|
2053
2073
|
}, [isActiveTask]);
|
|
2074
|
+
React__namespace.useEffect(() => {
|
|
2075
|
+
function getParsedTitle() {
|
|
2076
|
+
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
2077
|
+
const convertedMdTitle = yield markdownConvert(title);
|
|
2078
|
+
setParsedTitle(removeParagraphWrap(convertedMdTitle));
|
|
2079
|
+
});
|
|
2080
|
+
}
|
|
2081
|
+
getParsedTitle();
|
|
2082
|
+
}, [title]);
|
|
2054
2083
|
const classNames = reactStyles.css('pfext-quick-start-task-header__title', {
|
|
2055
2084
|
'pfext-quick-start-task-header__title-success': taskStatus === exports.QuickStartTaskStatus.SUCCESS,
|
|
2056
2085
|
'pfext-quick-start-task-header__title-failed': taskStatus === (exports.QuickStartTaskStatus.FAILED || exports.QuickStartTaskStatus.VISITED),
|
|
@@ -2066,7 +2095,7 @@ const QuickStartTaskHeader = ({ title, taskIndex, subtitle, taskStatus, size, is
|
|
|
2066
2095
|
const content = (React__namespace.createElement("div", { className: "pfext-quick-start-task-header", ref: titleRef },
|
|
2067
2096
|
React__namespace.createElement(TaskIcon, { taskIndex: taskIndex, taskStatus: taskStatus }),
|
|
2068
2097
|
React__namespace.createElement(reactCore.Title, { headingLevel: "h3", size: size, className: classNames },
|
|
2069
|
-
React__namespace.createElement("span", { dangerouslySetInnerHTML: { __html:
|
|
2098
|
+
React__namespace.createElement("span", { dangerouslySetInnerHTML: { __html: parsedTitle } }),
|
|
2070
2099
|
isActiveTask && subtitle && (React__namespace.createElement("span", { className: "pfext-quick-start-task-header__subtitle", "data-test-id": "quick-start-task-subtitle" },
|
|
2071
2100
|
' ',
|
|
2072
2101
|
subtitle))),
|
|
@@ -2273,6 +2302,7 @@ const QuickStartPanelContent = (_a) => {
|
|
|
2273
2302
|
const titleRef = React__namespace.useRef(null);
|
|
2274
2303
|
const { getResource, activeQuickStartState } = React__namespace.useContext(QuickStartContext);
|
|
2275
2304
|
const [contentRef, setContentRef] = React__namespace.useState();
|
|
2305
|
+
const [displayName, setDisplayName] = React__namespace.useState('');
|
|
2276
2306
|
const shadows = useScrollShadows(contentRef);
|
|
2277
2307
|
const quickStart = quickStarts.find((qs) => qs.metadata.name === activeQuickStartID);
|
|
2278
2308
|
const taskNumber = activeQuickStartState === null || activeQuickStartState === void 0 ? void 0 : activeQuickStartState.taskNumber;
|
|
@@ -2300,13 +2330,22 @@ const QuickStartPanelContent = (_a) => {
|
|
|
2300
2330
|
titleRef.current.focus();
|
|
2301
2331
|
}
|
|
2302
2332
|
}, [quickStart]);
|
|
2333
|
+
React__namespace.useEffect(() => {
|
|
2334
|
+
function getDisplayName() {
|
|
2335
|
+
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
2336
|
+
const convertedMdDisplayName = yield markdownConvert(quickStart === null || quickStart === void 0 ? void 0 : quickStart.spec.displayName);
|
|
2337
|
+
setDisplayName(removeParagraphWrap(convertedMdDisplayName));
|
|
2338
|
+
});
|
|
2339
|
+
}
|
|
2340
|
+
getDisplayName();
|
|
2341
|
+
}, [quickStart]);
|
|
2303
2342
|
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),
|
|
2304
2343
|
React__namespace.createElement("div", { className: headerClasses },
|
|
2305
2344
|
React__namespace.createElement(reactCore.DrawerHead, null,
|
|
2306
2345
|
React__namespace.createElement("div", { className: "pfext-quick-start-panel-content__title", tabIndex: -1, ref: titleRef },
|
|
2307
2346
|
React__namespace.createElement(reactCore.Title, { headingLevel: "h2", size: "xl", className: "pfext-quick-start-panel-content__name", style: { marginRight: 'var(--pf-global--spacer--md)' } },
|
|
2308
2347
|
React__namespace.createElement("span", { dangerouslySetInnerHTML: {
|
|
2309
|
-
__html:
|
|
2348
|
+
__html: displayName,
|
|
2310
2349
|
} }),
|
|
2311
2350
|
' ',
|
|
2312
2351
|
React__namespace.createElement("small", { className: "pfext-quick-start-panel-content__duration" }, (quickStart === null || quickStart === void 0 ? void 0 : quickStart.spec.durationMinutes) ? getResource('{{type}} • {{duration, number}} minutes', quickStart === null || quickStart === void 0 ? void 0 : quickStart.spec.durationMinutes)
|