🐛 Fix: fix typeit shotrcode miss space when build with --minify param

This commit is contained in:
Cell
2024-04-20 16:56:02 +08:00
parent 72bd72f5ed
commit bae1678c59
2 changed files with 4 additions and 3 deletions
+3 -2
View File
@@ -682,7 +682,7 @@ class FixIt {
const singleLoop = typeitElement.dataset.loop;
// get the content of the typed element
stagingElement.innerHTML = '';
stagingElement.appendChild(typeitElement.querySelector('template').content);
stagingElement.appendChild(typeitElement.querySelector('template').content.cloneNode(true));
// for shortcodes usage
let targetEle = typeitElement.firstElementChild
// for system elements usage
@@ -690,9 +690,10 @@ class FixIt {
typeitElement.innerHTML = '';
targetEle = typeitElement
}
const typedContents = stagingElement.querySelector('pre')?.innerHTML || stagingElement.innerHTML
// create a new instance of TypeIt for each element
const instance = new TypeIt(targetEle, {
strings: stagingElement.innerHTML,
strings: typedContents,
speed: speed,
lifeLike: true,
cursorSpeed: cursorSpeed,
+1 -1
View File
@@ -36,6 +36,6 @@
<div {{ $wrapperAttrs | safeHTMLAttr }}>
{{- printf `<%v %v></%v>` $tag $innerAttrs $tag | safeHTML -}}
<template>{{ printf "%v" $content | safeHTML }}</template>
<template><pre>{{ printf "%v" $content | safeHTML }}</pre></template>
</div>
{{- .Page.Store.Set "hasTyped" true -}}