Skip to content

Commit

Permalink
Fixes #4492 - Keyboard combination Ctrl+Shift+... doesnt work in Firefox
Browse files Browse the repository at this point in the history
Co-authored-by: Rolf Schmidt <rolf.schmidt@zammad.com>
  • Loading branch information
zammad-sync and rolfschmidt committed Jan 25, 2024
1 parent baba6c4 commit 9975485
Showing 1 changed file with 20 additions and 13 deletions.
Expand Up @@ -290,19 +290,26 @@ App.Config.set(

url = window.location.toString()
if lastKey && lastKey.count is 3
item = new window.ClipboardItem(
{
'text/plain': new Blob(
["#{text}: #{title}\n#{url}"],
{ type: 'text/plain' }
),
'text/html': new Blob(
["<a href=\"#{url}\">#{text}</a>: #{title}"],
{ type: 'text/html' }
),
}
)
clipboard.write([item])

# in firefox `new window.ClipboardItem` may not work
# https://github.com/zammad/zammad/issues/4492
try
item = new window.ClipboardItem(
{
'text/plain': new Blob(
["#{text}: #{title}\n#{url}"],
{ type: 'text/plain' }
),
'text/html': new Blob(
["<a href=\"#{url}\">#{text}</a>: #{title}"],
{ type: 'text/html' }
),
}
)
clipboard.write([item])
catch e
text = "#{text}: #{title}\n#{url}"
clipboard.writeText(text)
}
{
keyPrefix: '2x'
Expand Down

0 comments on commit 9975485

Please sign in to comment.