web-documentation 1.0.29 → 1.0.31
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 +27 -13
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
|
@@ -438,9 +438,10 @@ export class WebDocumentation<
|
|
|
438
438
|
.createElement('style')
|
|
439
439
|
domNode.setAttribute('type', 'text/css')
|
|
440
440
|
domNode.innerText = code
|
|
441
|
-
} else if (match[2].toLowerCase() === 'hidden')
|
|
442
|
-
domNode = code
|
|
443
|
-
|
|
441
|
+
} else if (match[2].toLowerCase() === 'hidden') {
|
|
442
|
+
domNode = createDomNodes(code)
|
|
443
|
+
reInjectScripts = true
|
|
444
|
+
} else {
|
|
444
445
|
domNode = createDomNodes(format(
|
|
445
446
|
this.options.showExample.htmlWrapper, code
|
|
446
447
|
))
|
|
@@ -455,24 +456,37 @@ export class WebDocumentation<
|
|
|
455
456
|
|
|
456
457
|
codeDomNode.after(domNode)
|
|
457
458
|
|
|
458
|
-
if (reInjectScripts)
|
|
459
|
+
if (reInjectScripts)
|
|
459
460
|
/*
|
|
460
461
|
Injected script tags are not executed by
|
|
461
462
|
default. So we need to reinject those.
|
|
462
463
|
*/
|
|
463
|
-
for (const scriptDomNode of
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
464
|
+
for (const scriptDomNode of
|
|
465
|
+
domNode.querySelectorAll('script')
|
|
466
|
+
) {
|
|
467
|
+
const newScriptDomNode =
|
|
468
|
+
document.createElement('script')
|
|
469
|
+
for (const name of
|
|
470
|
+
scriptDomNode.getAttributeNames()
|
|
471
|
+
)
|
|
472
|
+
newScriptDomNode.setAttribute(
|
|
473
|
+
name,
|
|
474
|
+
scriptDomNode.getAttribute(name) as
|
|
475
|
+
string
|
|
476
|
+
)
|
|
477
|
+
newScriptDomNode.textContent =
|
|
478
|
+
scriptDomNode.textContent
|
|
469
479
|
const promise = new Promise((resolve) => {
|
|
470
|
-
newScriptDomNode.addEventListener(
|
|
480
|
+
newScriptDomNode.addEventListener(
|
|
481
|
+
'load', resolve
|
|
482
|
+
)
|
|
471
483
|
})
|
|
472
|
-
scriptDomNode.parentNode
|
|
484
|
+
if (scriptDomNode.parentNode)
|
|
485
|
+
scriptDomNode.parentNode.replaceChild(
|
|
486
|
+
newScriptDomNode, scriptDomNode
|
|
487
|
+
)
|
|
473
488
|
await promise
|
|
474
489
|
}
|
|
475
|
-
}
|
|
476
490
|
} catch (error) {
|
|
477
491
|
log.critical(
|
|
478
492
|
`Error while integrating code "${code}":`,
|