web-documentation 1.0.29 → 1.0.30
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/package.json +1 -1
- package/source/deploy.ts +1 -2
- package/source/index.ts +24 -11
package/package.json
CHANGED
package/source/deploy.ts
CHANGED
|
@@ -451,8 +451,7 @@ const isFileIgnored = async (filePath: string): Promise<boolean> => (
|
|
|
451
451
|
*/
|
|
452
452
|
const copyRepositoryFile = async (
|
|
453
453
|
sourcePath: string, targetPath: string, file: File
|
|
454
|
-
): Promise<false | undefined> =>
|
|
455
|
-
{
|
|
454
|
+
): Promise<false | undefined> => {
|
|
456
455
|
if (await isFileIgnored(file.path) || basename(file.name) === 'readme.md')
|
|
457
456
|
return false
|
|
458
457
|
|
package/source/index.ts
CHANGED
|
@@ -439,7 +439,7 @@ export class WebDocumentation<
|
|
|
439
439
|
domNode.setAttribute('type', 'text/css')
|
|
440
440
|
domNode.innerText = code
|
|
441
441
|
} else if (match[2].toLowerCase() === 'hidden')
|
|
442
|
-
domNode = code
|
|
442
|
+
domNode = createDomNodes(code)
|
|
443
443
|
else {
|
|
444
444
|
domNode = createDomNodes(format(
|
|
445
445
|
this.options.showExample.htmlWrapper, code
|
|
@@ -455,24 +455,37 @@ export class WebDocumentation<
|
|
|
455
455
|
|
|
456
456
|
codeDomNode.after(domNode)
|
|
457
457
|
|
|
458
|
-
if (reInjectScripts)
|
|
458
|
+
if (reInjectScripts)
|
|
459
459
|
/*
|
|
460
460
|
Injected script tags are not executed by
|
|
461
461
|
default. So we need to reinject those.
|
|
462
462
|
*/
|
|
463
|
-
for (const scriptDomNode of
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
463
|
+
for (const scriptDomNode of
|
|
464
|
+
domNode.querySelectorAll('script')
|
|
465
|
+
) {
|
|
466
|
+
const newScriptDomNode =
|
|
467
|
+
document.createElement('script')
|
|
468
|
+
for (const name of
|
|
469
|
+
scriptDomNode.getAttributeNames()
|
|
470
|
+
)
|
|
471
|
+
newScriptDomNode.setAttribute(
|
|
472
|
+
name,
|
|
473
|
+
scriptDomNode.getAttribute(name) as
|
|
474
|
+
string
|
|
475
|
+
)
|
|
476
|
+
newScriptDomNode.textContent =
|
|
477
|
+
scriptDomNode.textContent
|
|
469
478
|
const promise = new Promise((resolve) => {
|
|
470
|
-
newScriptDomNode.addEventListener(
|
|
479
|
+
newScriptDomNode.addEventListener(
|
|
480
|
+
'load', resolve
|
|
481
|
+
)
|
|
471
482
|
})
|
|
472
|
-
scriptDomNode.parentNode
|
|
483
|
+
if (scriptDomNode.parentNode)
|
|
484
|
+
scriptDomNode.parentNode.replaceChild(
|
|
485
|
+
newScriptDomNode, scriptDomNode
|
|
486
|
+
)
|
|
473
487
|
await promise
|
|
474
488
|
}
|
|
475
|
-
}
|
|
476
489
|
} catch (error) {
|
|
477
490
|
log.critical(
|
|
478
491
|
`Error while integrating code "${code}":`,
|