From 25df7eba8d1889b509ed4cef624d1bfaf739bea3 Mon Sep 17 00:00:00 2001 From: zakialvi-e64 Date: Tue, 28 Nov 2023 18:15:04 +0500 Subject: [PATCH] [SWIF-263] [Toast message 'Sign In' text highlighted and Entire Toast Message made Clickable] --- src/main.ts | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/src/main.ts b/src/main.ts index cb1d3e8..12b449b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -100,35 +100,38 @@ export default class Transcription extends Plugin { } // If the user is still null, prompt them to sign in - if (this.user == null) { - const notice = new Notice("Transcription: You are signed out. Please click to Sign In", 16 * 1000); + // if (this.user == null) { + // const notice = new Notice("Transcription: You are signed out. Please click to Sign In", 16 * 1000); - notice.noticeEl.addEventListener('click', () => { - window.open(SWIFTINK_AUTH_CALLBACK, '_blank'); - }); + // notice.noticeEl.addEventListener('click', () => { + // window.open(SWIFTINK_AUTH_CALLBACK, '_blank'); + // }); - } + // } - // if (this.user == null) { - // const noticeContent = document.createDocumentFragment(); + if (this.user == null) { + const noticeContent = document.createDocumentFragment(); - // // Create the text node - // const textNode = document.createTextNode("Transcription: You are signed out. Please "); + // Create the text node + const textNode = document.createTextNode("Transcription: You are signed out. Please "); - // // Create the hyperlink - // const signInLink = document.createElement('a'); - // signInLink.href = SWIFTINK_AUTH_CALLBACK; - // signInLink.target = '_blank'; - // signInLink.textContent = 'Sign In'; + // Create the hyperlink + const signInLink = document.createElement('a'); + //signInLink.href = SWIFTINK_AUTH_CALLBACK; + signInLink.target = '_blank'; + signInLink.textContent = 'Sign In'; - // // Append the text and link to the document fragment - // noticeContent.appendChild(textNode); - // noticeContent.appendChild(signInLink); + // Append the text and link to the document fragment + noticeContent.appendChild(textNode); + noticeContent.appendChild(signInLink); - // // Create the notice with the content - // new Notice(noticeContent, 16 * 1000); - // } + // Create the notice with the content + const notice = new Notice(noticeContent, 16 * 1000); + notice.noticeEl.addEventListener('click', () => { + window.open(SWIFTINK_AUTH_CALLBACK, '_blank'); + }); + }