Skip to content

Commit

Permalink
chore: merge upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
Clovis committed Jan 5, 2025
2 parents 152ad22 + 154fdaa commit a721451
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 8 deletions.
36 changes: 30 additions & 6 deletions elk/composables/content-render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,40 @@ export function nodeToVNode(node: Node): VNode | string | null {
}

if ('children' in node) {
if (node.name === 'a' && (node.attributes.href?.startsWith('/') || node.attributes.href?.startsWith('.'))) {
node.attributes.to = node.attributes.href
if (node.name === 'a') {
if (node.attributes.href?.startsWith('/') || node.attributes.href?.startsWith('.')) {
node.attributes.to = node.attributes.href

const { href: _href, target: _target, ...attrs } = node.attributes
return h(
RouterLink as any,
attrs,
() => node.children.map(treeToVNode),
)
}

const { href: _href, target: _target, ...attrs } = node.attributes
// fix #3122
return h(
RouterLink as any,
attrs,
() => node.children.map(treeToVNode),
node.name,
node.attributes,
node.children.map((n: Node) => {
// replace span.ellipsis with bdi.ellipsis inside links
if (n && n.type === ELEMENT_NODE && n.name !== 'bdi' && n.attributes?.class?.includes('ellipsis')) {
const children = n.children.splice(0, n.children.length)
const bdi = {
...n,
name: 'bdi',
children,
} satisfies ElementNode
children.forEach((n: Node) => n.parent = bdi)
return treeToVNode(bdi)
}

return treeToVNode(n)
}),
)
}

return h(
node.name,
node.attributes,
Expand Down
1 change: 1 addition & 0 deletions elk/locales/es-419.json
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@
"attachments_limit_video_error": "Tamaño máximo de video excedido: {0}"
},
"status": {
"pinned": "Publicaciones ancladas",
"spoiler_show_less": "Menos"
},
"tab": {
Expand Down
2 changes: 2 additions & 0 deletions elk/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,7 @@
"dismiss": "Descartar",
"read": "Leer la descripción de la imagen {0}"
},
"pinned": "Publicaciones fijadas",
"poll": {
"count": "{0} votos|{0} voto|{0} votos",
"ends": "finaliza {0}",
Expand Down Expand Up @@ -713,6 +714,7 @@
"year_past": "hace 0 años|el año pasado|hace {n} años"
},
"timeline": {
"no_posts": "¡No hay publicaciones aquí!",
"show_new_items": "Mostrar {v} nuevas publicaciones|Mostrar {v} nueva publicación|Mostrar {v} nuevas publicaciones",
"view_older_posts": "Es posible que no se muestren las publicaciones antiguas de otras instancias."
},
Expand Down
1 change: 1 addition & 0 deletions elk/locales/eu-ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,7 @@
"dismiss": "Baztertu",
"read": "Irakurri {0} deskribapena"
},
"pinned": "Finkatutako bidalketa",
"poll": {
"count": "{0} boto|boto {0}|{0} boto",
"ends": "epemuga: {0}",
Expand Down
2 changes: 1 addition & 1 deletion elk/server/utils/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export async function deleteApp(server: string) {
export async function listServers() {
const keys = await storage.getKeys('servers:v3:')
const servers = new Set<string>()
for await (const key of keys) {
for (const key of keys) {
const id = key.split(':')[2]
if (id)
servers.add(id.toLocaleLowerCase())
Expand Down
2 changes: 1 addition & 1 deletion elk/tests/nuxt/__snapshots__/content-rich.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ exports[`content-rich > link + mention 1`] = `
rel="nofollow noopener noreferrer"
target="_blank"
><span class="invisible">https://</span
><span class="ellipsis">github.com/ayoayco/astro-react</span
><bdi class="ellipsis">github.com/ayoayco/astro-react</bdi
><span class="invisible">ive-library/pull/203</span></a
>
</p>
Expand Down

0 comments on commit a721451

Please sign in to comment.