Copy button notification (#9355)

Signed-off-by: Rostislav Nagimov <rostislav.nagimov@gmail.com>
This commit is contained in:
Rostislav Nagimov
2025-06-30 15:38:16 +07:00
committed by GitHub
parent d5950c33cf
commit 8fba1e3db1
24 changed files with 64 additions and 5 deletions
+1
View File
@@ -41,6 +41,7 @@
"ColorRemove": "Odstraňte předvolbu barev",
"ColorReset": "Resetovat předvolby barev",
"Copy": "Kopírovat",
"DocumentUrlCopied": "Zkopírováno!",
"CopyLink": "Zkopírovat odkaz",
"AccessDenied": "Objekt neexistuje nebo k němu nemáte oprávnění.",
"UnableToFollowMention": "Nelze otevřít zmíněný objekt"
+1
View File
@@ -41,6 +41,7 @@
"ColorRemove": "Farbvoreinstellung entfernen",
"ColorReset": "Farbvoreinstellungen zurücksetzen",
"Copy": "Kopieren",
"DocumentUrlCopied": "Kopiert!",
"CopyLink": "Link kopieren",
"AccessDenied": "Das Objekt existiert nicht oder Sie haben keinen Zugriff darauf.",
"UnableToFollowMention": "Das erwähnte Objekt kann nicht geöffnet werden"
+1
View File
@@ -41,6 +41,7 @@
"ColorRemove": "Remove color preset",
"ColorReset": "Reset color presets",
"Copy": "Copy",
"DocumentUrlCopied": "Copied!",
"CopyLink": "Copy link",
"AccessDenied": "Object doesn't exist or you are not permitted to access it.",
"UnableToFollowMention": "Unable to open mentioned object"
+1
View File
@@ -41,6 +41,7 @@
"ColorRemove": "Eliminar el ajuste preestablecido de color",
"ColorReset": "Restablecer ajustes preestablecidos de color",
"Copy": "Copiar",
"DocumentUrlCopied": "¡Copiado!",
"CopyLink": "Copiar enlace",
"AccessDenied": "El objeto no existe o no tienes permiso para acceder a él.",
"UnableToFollowMention": "No se puede abrir el objeto mencionado"
+1
View File
@@ -41,6 +41,7 @@
"ColorRemove": "Supprimer le préréglage de couleur",
"ColorReset": "Réinitialiser les préréglages de couleur",
"Copy": "Copier",
"DocumentUrlCopied": "Copié !",
"CopyLink": "Copier le lien",
"AccessDenied": "L’objet n’existe pas ou vous n’êtes pas autorisé à y accéder.",
"UnableToFollowMention": "Impossible d’ouvrir l’objet mentionné"
+1
View File
@@ -41,6 +41,7 @@
"ColorRemove": "Rimuovi preimpostazione colore",
"ColorReset": "Ripristina i preset colore",
"Copy": "Copia",
"DocumentUrlCopied": "Copiato!",
"CopyLink": "Copia collegamento",
"AccessDenied": "L'oggetto non esiste oppure non hai i permessi per accedervi.",
"UnableToFollowMention": "Impossibile aprire l'oggetto menzionato"
+1
View File
@@ -41,6 +41,7 @@
"ColorRemove": "カラープリセットを削除",
"ColorReset": "カラープリセットをリセット",
"Copy": "コピー",
"DocumentUrlCopied": "コピーしました",
"CopyLink": "リンクをコピー",
"AccessDenied": "オブジェクトが存在しないか、アクセス権限がありません。",
"UnableToFollowMention": "言及されたオブジェクトを開くことができません"
+2 -1
View File
@@ -40,7 +40,8 @@
"ColorAdd": "Adicionar predefinição de cor",
"ColorRemove": "Remover predefinição de cor",
"ColorReset": "Repor predefinições de cores",
"Copiar": "Copiar",
"Copy": "Copiar",
"DocumentUrlCopied": "Copiado!",
"CopyLink": "Copiar link",
"AccessDenied": "O objeto não existe ou você não tem permissão para acessá-lo.",
"UnableToFollowMention": "Não foi possível abrir o objeto mencionado"
+1
View File
@@ -41,6 +41,7 @@
"ColorRemove": "Удалить предустановленный цвет",
"ColorReset": "Сбросить предустановленные цвета",
"Copy": "Копировать",
"DocumentUrlCopied": "Скопировано!",
"CopyLink": "Копировать ссылку",
"AccessDenied": "Объект не существует или у вас нет прав доступа.",
"UnableToFollowMention": "Не удалось открыть упомянутый объект"
+1
View File
@@ -41,6 +41,7 @@
"ColorRemove": "删除颜色预设",
"ColorReset": "重置颜色预设",
"Copy": "复制",
"DocumentUrlCopied": "已复制",
"CopyLink": "复制链接",
"AccessDenied": "对象不存在或您无权访问。",
"UnableToFollowMention": "无法打开提及的对象"
+1
View File
@@ -142,6 +142,7 @@ export default plugin(presentationId, {
ColorRemove: '' as IntlString,
ColorReset: '' as IntlString,
Copy: '' as IntlString,
DocumentUrlCopied: '' as IntlString,
CopyLink: '' as IntlString,
UnableToFollowMention: '' as IntlString,
AccessDenied: '' as IntlString
@@ -30,6 +30,15 @@
const dispatch = createEventDispatcher()
let isServerUrlCopied = false
let serverUrlCopyTimeout: ReturnType<typeof setTimeout> | undefined
let isAccountCopied = false
let accountCopyTimeout: ReturnType<typeof setTimeout> | undefined
let isPasswordCopied = false
let passwordCopyTimeout: ReturnType<typeof setTimeout> | undefined
$: wasAccessEnabled = integrationGlobal !== null && integrationWs !== null
$: canSave = !!(
!loading &&
@@ -150,14 +159,29 @@
async function copyServer (): Promise<void> {
await copyTextToClipboard(serverUrl ?? '')
isServerUrlCopied = true
clearTimeout(serverUrlCopyTimeout)
serverUrlCopyTimeout = setTimeout(() => {
isServerUrlCopied = false
}, 2000)
}
async function copyAccount (): Promise<void> {
await copyTextToClipboard(selectedSocialId?.value ?? '')
isAccountCopied = true
clearTimeout(accountCopyTimeout)
accountCopyTimeout = setTimeout(() => {
isAccountCopied = false
}, 2000)
}
async function copyPassword (): Promise<void> {
await copyTextToClipboard(password)
isPasswordCopied = true
clearTimeout(passwordCopyTimeout)
passwordCopyTimeout = setTimeout(() => {
isPasswordCopied = false
}, 2000)
}
</script>
@@ -202,7 +226,7 @@
size="small"
kind="ghost"
disabled={!accessEnabled}
showTooltip={{ label: presentation.string.Copy }}
showTooltip={{ label: isServerUrlCopied ? presentation.string.DocumentUrlCopied : presentation.string.Copy }}
on:click={copyServer}
/>
</div>
@@ -216,7 +240,7 @@
icon={IconCopy}
size="small"
kind="ghost"
showTooltip={{ label: presentation.string.Copy }}
showTooltip={{ label: isServerUrlCopied ? presentation.string.DocumentUrlCopied : presentation.string.Copy }}
disabled={!accessEnabled}
on:click={copyAccount}
/>
@@ -237,7 +261,9 @@
size="small"
kind="ghost"
disabled={!accessEnabled}
showTooltip={{ label: presentation.string.Copy }}
showTooltip={{
label: isServerUrlCopied ? presentation.string.DocumentUrlCopied : presentation.string.Copy
}}
on:click={copyPassword}
/>
</div>
+1
View File
@@ -39,6 +39,7 @@
"Description": "Popis",
"CopyDocumentUrl": "Kopírovat URL dokumentu do schránky",
"DocumentUrlCopied": "Zkopírováno!",
"ViewMode": "Zobrazit",
"EditMode": "Upravit",
+1
View File
@@ -37,6 +37,7 @@
"Untitled": "Unbenannt",
"Description": "Beschreibung",
"CopyDocumentUrl": "Dokument-URL in die Zwischenablage kopieren",
"DocumentUrlCopied": "Kopiert!",
"ViewMode": "Ansicht",
"EditMode": "Bearbeiten",
"SuggestMode": "Vorschlagen",
+1
View File
@@ -39,6 +39,7 @@
"Description": "Description",
"CopyDocumentUrl": "Copy document URL to clipboard",
"DocumentUrlCopied": "Copied!",
"ViewMode": "View",
"EditMode": "Edit",
+1
View File
@@ -37,6 +37,7 @@
"Untitled": "Sin título",
"Description": "Descripción",
"CopyDocumentUrl": "Copiar URL del documento al portapapeles",
"DocumentUrlCopied": "¡Copiado!",
"ViewMode": "Vista",
"EditMode": "Editar",
"SuggestMode": "Sugerir",
+1
View File
@@ -37,6 +37,7 @@
"Untitled": "Sans titre",
"Description": "Description",
"CopyDocumentUrl": "Copier l'URL du document dans le presse-papiers",
"DocumentUrlCopied": "Copié !",
"ViewMode": "Visualiser",
"EditMode": "Éditer",
"SuggestMode": "Suggérer",
+1
View File
@@ -37,6 +37,7 @@
"Untitled": "Senza titolo",
"Description": "Descrizione",
"CopyDocumentUrl": "Copia l'URL del documento negli appunti",
"DocumentUrlCopied": "Copiato!",
"ViewMode": "Visualizzazione",
"EditMode": "Modifica",
"SuggestMode": "Suggerisci",
+1
View File
@@ -37,6 +37,7 @@
"Untitled": "無題",
"Description": "説明",
"CopyDocumentUrl": "ドキュメントのURLをクリップボードにコピー",
"DocumentUrlCopied": "コピーしました",
"ViewMode": "表示",
"EditMode": "編集",
"SuggestMode": "提案",
+1
View File
@@ -37,6 +37,7 @@
"Untitled": "Sin título",
"Description": "Descrição",
"CopyDocumentUrl": "Copiar URL do documento para a área de transferência",
"DocumentUrlCopied": "Copiado!",
"ViewMode": "Visualização",
"EditMode": "Edição",
"SuggestMode": "Sugestão",
+1
View File
@@ -39,6 +39,7 @@
"Description": "Описание",
"CopyDocumentUrl": "Копировать URL-адрес документа в буфер обмена",
"DocumentUrlCopied": "Скопировано!",
"ViewMode": "Просмотр",
"EditMode": "Редактирование",
+1
View File
@@ -39,6 +39,7 @@
"Description": "描述",
"CopyDocumentUrl": "复制文档 URL 到剪贴板",
"DocumentUrlCopied": "已复制",
"ViewMode": "查看",
"EditMode": "编辑",
@@ -83,6 +83,9 @@
let title = ''
let innerWidth: number
let isCopied = false
let copyTimeout: ReturnType<typeof setTimeout>
let headings: Heading[] = []
let loadedDocumentContent = false
@@ -101,6 +104,7 @@
onDestroy(async () => {
void notificationClient.then((client) => client.readDoc(_id))
clearTimeout(copyTimeout)
})
const starredQuery = createQuery()
@@ -230,10 +234,17 @@
$: actions = [
{
icon: view.icon.CopyId,
label: document.string.CopyDocumentUrl,
label: isCopied ? document.string.DocumentUrlCopied : document.string.CopyDocumentUrl,
action: () => {
if (doc !== undefined) {
void copyTextToClipboard(getDocumentUrl(doc))
isCopied = true
clearTimeout(copyTimeout)
copyTimeout = setTimeout(() => {
isCopied = false
}, 2000)
}
}
},
+1
View File
@@ -72,6 +72,7 @@ export default mergeIds(documentId, document, {
Star: '' as IntlString,
Unstar: '' as IntlString,
CopyDocumentUrl: '' as IntlString,
DocumentUrlCopied: '' as IntlString,
Lock: '' as IntlString,
Unlock: '' as IntlString,