fix(Print): support textarea html element (#3867)

* fix: support textarea element print view

* chore: bump version 8.7.3-beta02
This commit is contained in:
Argo Zhang
2024-07-17 14:34:47 +08:00
committed by GitHub
parent c253ee84b5
commit e88fee9da0
2 changed files with 18 additions and 14 deletions

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<Version>8.7.3-beta01</Version>
<Version>8.7.3-beta02</Version>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net5.0'">

View File

@@ -40,21 +40,25 @@ const print = el => {
body.appendChild(dialog)
// assign value
dialog.querySelectorAll("input").forEach(ele => {
const id = ele.getAttribute('id')
const vEl = document.getElementById(id)
if (vEl) {
if (ele.getAttribute('type') === 'checkbox') {
const v1 = vEl.checked
if (v1 === true) {
ele.setAttribute('checked', 'checked')
const elements = ["input", "textarea"];
elements.forEach(tag => {
console.log(tag);
dialog.querySelectorAll(tag).forEach(ele => {
const id = ele.getAttribute('id')
const vEl = document.getElementById(id)
if (vEl) {
if (ele.getAttribute('type') === 'checkbox') {
const v1 = vEl.checked
if (v1 === true) {
ele.setAttribute('checked', 'checked')
}
}
else {
ele.value = vEl.value
}
}
else {
ele.value = vEl.value
}
}
})
});
});
const handler = setTimeout(() => {
clearTimeout(handler)