Bump version, refine element hydration, fix animation, fix title in blog post
This commit is contained in:
parent
858142f09a
commit
4543680a92
|
@ -654,7 +654,10 @@ onMounted(() => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<canvas id="ecmaportal" class="fixed top-0 left-0 opacity-0 parallax -z-10">
|
<canvas
|
||||||
|
id="ecmaportal"
|
||||||
|
class="fixed top-0 left-0 opacity-0 transition-portal -z-10"
|
||||||
|
>
|
||||||
<span>
|
<span>
|
||||||
Your browser does not support the <canvas /> element, which is
|
Your browser does not support the <canvas /> element, which is
|
||||||
required for parallax animation.
|
required for parallax animation.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
title: The hidden features of the Windows OOBE
|
title: The Hidden Features of the Windows OOBE
|
||||||
description: The Windows 11 OOBE is a mess, but it's excellent for bulk deployment and has some hidden features and customization options!
|
description: The Windows 11 OOBE is a mess, but it's excellent for bulk deployment and has some hidden features and customization options!
|
||||||
authors: ['Enderman']
|
authors: ['Enderman']
|
||||||
created: 2024-03-01T23:30:10Z
|
created: 2024-03-01T23:30:10Z
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "enderapp",
|
"name": "enderapp",
|
||||||
"version": "0.2.5",
|
"version": "0.3.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { formatDate } from 'date-fns'
|
import { formatDate } from 'date-fns'
|
||||||
import chestAnimation from '~/assets/images/chest.webp'
|
import chestAnimation from '~/assets/images/chest.webp'
|
||||||
|
import { render } from 'vue'
|
||||||
|
|
||||||
const config = useAppConfig()
|
const config = useAppConfig()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
@ -37,6 +38,20 @@ useSeoMeta({
|
||||||
twitterCard: 'summary_large_image',
|
twitterCard: 'summary_large_image',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const clipboard = (el: HTMLElement) => {
|
||||||
|
if (el.textContent)
|
||||||
|
navigator.clipboard
|
||||||
|
.writeText(el.textContent)
|
||||||
|
.then(() => {
|
||||||
|
alert(`successfully copied ${el.textContent}`)
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
alert('something went wrong')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const content = ref<Element | null>(null)
|
||||||
|
|
||||||
if (data.value) {
|
if (data.value) {
|
||||||
thumbnail =
|
thumbnail =
|
||||||
data.value.thumbnail ??
|
data.value.thumbnail ??
|
||||||
|
@ -60,52 +75,21 @@ if (data.value) {
|
||||||
|
|
||||||
// Hydrate the rendered items.
|
// Hydrate the rendered items.
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
document.querySelectorAll('pre').forEach((pre) => {
|
content.value
|
||||||
const icon = document.createElement('iconify-icon')
|
?.querySelectorAll('code:not(pre *)')
|
||||||
|
.forEach((code: Element) => {
|
||||||
icon.setAttribute('icon', 'mdi:content-copy')
|
if (code instanceof HTMLElement) code.onclick = () => clipboard(code)
|
||||||
icon.setAttribute('inline', 'true')
|
|
||||||
|
|
||||||
icon.classList.add('button')
|
|
||||||
|
|
||||||
pre.appendChild(icon)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
document
|
content.value?.querySelectorAll('pre').forEach((pre: HTMLElement) => {
|
||||||
.querySelectorAll('code:not(pre *), pre > iconify-icon.button')
|
const icon = h('iconify-icon', {
|
||||||
.forEach((code) => {
|
icon: 'mdi:content-copy',
|
||||||
if (code instanceof HTMLElement) {
|
inline: true,
|
||||||
code.onclick = () => {
|
class: 'button',
|
||||||
const area = document.createElement('textarea')
|
onClick: () => clipboard(pre),
|
||||||
|
|
||||||
area.textContent =
|
|
||||||
code.nodeName && code.nodeName.toLowerCase() === 'code'
|
|
||||||
? code.textContent
|
|
||||||
: code.parentElement!.textContent
|
|
||||||
|
|
||||||
// It's necessary to create the textarea element every time you copy to get access to the select() method.
|
|
||||||
area.setSelectionRange(0, 99999) // An iOS gotcha.
|
|
||||||
area.select()
|
|
||||||
|
|
||||||
// Copy the text inside the textarea.
|
|
||||||
navigator.clipboard.writeText(area.value)
|
|
||||||
|
|
||||||
// TODO: Alert the user text has been successfully copied.
|
|
||||||
|
|
||||||
// Remove the textarea element.
|
|
||||||
area.remove()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
onUnmounted(() => {
|
render(icon, pre)
|
||||||
document.querySelectorAll('code').forEach((code) => {
|
|
||||||
code.onclick = null
|
|
||||||
})
|
|
||||||
|
|
||||||
document.querySelectorAll('pre').forEach((pre) => {
|
|
||||||
pre.querySelector('.clipboard')?.remove()
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -127,7 +111,7 @@ useHead({
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
v-if="status === 'pending'"
|
v-if="!data"
|
||||||
class="flex flex-col items-center justify-center gap-4 w-full select-none text-center"
|
class="flex flex-col items-center justify-center gap-4 w-full select-none text-center"
|
||||||
>
|
>
|
||||||
<img draggable="false" :src="chestAnimation" alt="The Ender Chest" />
|
<img draggable="false" :src="chestAnimation" alt="The Ender Chest" />
|
||||||
|
@ -139,7 +123,7 @@ useHead({
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<article
|
<article
|
||||||
v-else-if="status === 'success' && data"
|
v-else-if="data"
|
||||||
class="flex-grow post snap-normal fade-mask-sm flex flex-col gap-4 overflow-x-hidden overflow-y-auto sm:py-4 sm:pe-4"
|
class="flex-grow post snap-normal fade-mask-sm flex flex-col gap-4 overflow-x-hidden overflow-y-auto sm:py-4 sm:pe-4"
|
||||||
>
|
>
|
||||||
<div class="grid-thumbnail grid max-w-[768px] snap-end">
|
<div class="grid-thumbnail grid max-w-[768px] snap-end">
|
||||||
|
@ -189,7 +173,7 @@ useHead({
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<section class="page snap-start">
|
<section ref="content" class="page snap-start">
|
||||||
<ContentRenderer :value="data" />
|
<ContentRenderer :value="data" />
|
||||||
</section>
|
</section>
|
||||||
</article>
|
</article>
|
||||||
|
|
Loading…
Reference in New Issue