This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
auth: { | |
globalMiddleware: true, | |
redirectStrategy: 'query', // IMPORTANT! Otherwise, there will be an infinite logout loop. | |
watchLoggedIn: true, | |
cookie: { | |
prefix: 'auth.', | |
options: { | |
path: '/', | |
secure: process.env.NODE_ENV === 'production', // Enable only in production. | |
sameSite: 'lax', // IMPORTANT! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Get absolute xy position of caret in px. | |
* Time to execute: ~2.5ms on a 2018 MacBook Pro. | |
* Inpired by: https://medium.com/@jh3y/how-to-where-s-the-caret-getting-the-xy-position-of-the-caret-a24ba372990a | |
* @param {object} element - the textarea element to obtain coordinates for | |
*/ | |
export function getCaretXY(element: HTMLTextAreaElement): { x: number, top: number, bottom: number } { | |
const { top: textElementTop, left: textElementLeft } = element.getBoundingClientRect() | |
const selectionPoint = element.selectionEnd | |
// Create a dummy element, copy style and populate with content up to the caret. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<span class="timeago">{{ timeago }}</span> | |
</template> | |
<script setup lang="ts"> | |
interface Props { | |
datetime: Date | |
refreshInterval?: number | |
timeFormat?: string | |
dateFormat?: any |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/([0-9a-zA-ZáàâäãåąāăçćčďđðéèêëęěēėģğíìîïīįıķłļñńňņŋóòôöõőøřśšşťŧþţúùûüůűūýÿźżžßæœÁÀÂÄÃÅĄĀĂÇĆČĎĐÉÈÊËĘĒĖĢĞÍÌÎÏĪĮIĶŁĻÑŃŇŅŊÓÒÔÖÕŐØŘŚŠŞŤŦÞŢÚÙÛÜŰŪÝŸŹŻŽÆŒ_-]+)/gi |