From f963c48e7587fd2faad6e8650581dbaec7032b78 Mon Sep 17 00:00:00 2001 From: Julio Ruiz Date: Sun, 24 May 2026 06:04:50 -0500 Subject: [PATCH 1/4] Added base64 encoding / decoding code --- app/utils/textUtilities.ts | 51 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/app/utils/textUtilities.ts b/app/utils/textUtilities.ts index d3ae1a2..a246a60 100644 --- a/app/utils/textUtilities.ts +++ b/app/utils/textUtilities.ts @@ -1,5 +1,5 @@ /* Copy to Clipboard */ -export async function copyToClipboard(textToCopy: string, type: string) { +export async function copyToClipboard(textToCopy: string, type: string, id: string) { const toast = useToast() try { @@ -13,4 +13,51 @@ export async function copyToClipboard(textToCopy: string, type: string) { } catch (err) { console.error('Failed to copy: ', err) } -} \ No newline at end of file +} + +/* Function to copy url with search parameters into clipboard */ +export function copyParagraphToUrl(id: string) { + console.log('Encoding id', id) + + const highlights = { + highlights: [ + { + id: id, + color: '#f90' + } + ] + } + + const blob = encodeObjectToBase64Url(highlights) + + console.log('Encoded highlights', blob) + + console.log('Decoded highlights object', base64UrlDecode(blob)) +} + +/* Encode JS object to base64Url compatible string */ +function encodeObjectToBase64Url(obj: object) { + // 1. Convert object to JSON string + const jsonString = JSON.stringify(obj) + + // 2. Base64 encode the JSON string + const base64 = btoa(jsonString) + + // 3. Make it URL-safe and remove padding + return base64 + .replace(/\+/g, '-') + .replace(/\//g, '_') + .replace(/=+$/, '') +} + +/* Decode base64URL String to json object */ +function base64UrlDecode(base64Url: string) { + // Replace URL-safe characters and add padding + let base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/'); + while (base64.length % 4 !== 0) { + base64 += '=' + } + return decodeURIComponent(atob(base64).split('').map(function (c) { + return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2) + }).join('')) +} From 09b99985ebe47aae7f5a869da3309bfc9325a57d Mon Sep 17 00:00:00 2001 From: Julio Ruiz Date: Mon, 25 May 2026 18:41:45 -0500 Subject: [PATCH 2/4] Adding basic hover toolbar for all paragraphs --- .../EstudiosTypensenseDetail.vue | 51 +++++++++++++++---- 1 file changed, 42 insertions(+), 9 deletions(-) diff --git a/app/components/estudiosTypensense/EstudiosTypensenseDetail.vue b/app/components/estudiosTypensense/EstudiosTypensenseDetail.vue index 98f52bc..dbc0832 100644 --- a/app/components/estudiosTypensense/EstudiosTypensenseDetail.vue +++ b/app/components/estudiosTypensense/EstudiosTypensenseDetail.vue @@ -843,15 +843,48 @@ function highlightTextNodes(root: HTMLElement, terms: string[]): number {
- + + + +
Date: Mon, 25 May 2026 21:12:42 -0500 Subject: [PATCH 3/4] Fixed copy functionality --- .../EstudiosTypensenseDetail.vue | 45 ++++++++++++------- app/utils/textUtilities.ts | 24 ++++++++-- 2 files changed, 50 insertions(+), 19 deletions(-) diff --git a/app/components/estudiosTypensense/EstudiosTypensenseDetail.vue b/app/components/estudiosTypensense/EstudiosTypensenseDetail.vue index dbc0832..090a04d 100644 --- a/app/components/estudiosTypensense/EstudiosTypensenseDetail.vue +++ b/app/components/estudiosTypensense/EstudiosTypensenseDetail.vue @@ -858,22 +858,35 @@ function highlightTextNodes(root: HTMLElement, terms: string[]): number { />