Skip to content

Commit

Permalink
fix: emit allow attribute on all iframes for the clipboard (related to
Browse files Browse the repository at this point in the history
…#3474)

The unhandled cases were:

- read-only view

- view a past revision

- for completeness, also adapt the iframe in files.js

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
  • Loading branch information
vmiklos committed Feb 20, 2024
1 parent 292ba95 commit 1db78f9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ const documentsMain = {
+ '</form>'

// iframe that contains the Collabora Online Viewer
const frame = '<iframe data-cy="coolframe" id="loleafletframe" name="loleafletframe_viewer" allowfullscreen nonce="' + btoa(getRequestToken()) + '" style="width:100%;height:100%;position:absolute;"/>'
const frame = '<iframe data-cy="coolframe" id="loleafletframe" name="loleafletframe_viewer" allowfullscreen allow="clipboard-read *; clipboard-write *" nonce="' + btoa(getRequestToken()) + '" style="width:100%;height:100%;position:absolute;"/>'

$('#revViewer').append(form)
$('#revViewer').append(frame)
Expand Down Expand Up @@ -266,7 +266,7 @@ const documentsMain = {
+ '</form>'

// iframe that contains the Collabora Online
const frame = '<iframe data-cy="coolframe" id="loleafletframe" name="loleafletframe" nonce="' + btoa(getRequestToken()) + '" scrolling="no" allowfullscreen style="width:100%;height:100%;position:absolute;" />'
const frame = '<iframe data-cy="coolframe" id="loleafletframe" name="loleafletframe" nonce="' + btoa(getRequestToken()) + '" scrolling="no" allowfullscreen allow="clipboard-read *; clipboard-write *" style="width:100%;height:100%;position:absolute;" />'

$('#mainContainer').append(form)
$('#mainContainer').append(frame)
Expand Down
2 changes: 1 addition & 1 deletion src/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const odfViewer = {

$('head').append($('<link rel="stylesheet" type="text/css" href="' + generateFilePath('richdocuments', 'css', 'mobile.css') + '"/>'))

const $iframe = $('<iframe data-cy="documentframe" id="richdocumentsframe" nonce="' + btoa(OC.requestToken) + '" scrolling="no" allowfullscreen src="' + documentUrl + '" />')
const $iframe = $('<iframe data-cy="documentframe" id="richdocumentsframe" nonce="' + btoa(OC.requestToken) + '" scrolling="no" allowfullscreen allow="clipboard-read *; clipboard-write *" src="' + documentUrl + '" />')
odfViewer.loadingTimeout = setTimeout(odfViewer.onTimeout,
(OC.getCapabilities().richdocuments.config.timeout * 1000 || 15000))
$iframe.src = documentUrl
Expand Down

0 comments on commit 1db78f9

Please sign in to comment.