-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use office.vue for public shares
Signed-off-by: Elizabeth Danzberger <[email protected]>
- Loading branch information
Showing
8 changed files
with
61 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { getCapabilities } from '@nextcloud/capabilities' | ||
|
||
/** @type Array.<String> */ | ||
const mimetypes = getCapabilities().richdocuments.mimetypes | ||
|
||
/** | ||
* Determines if the mimetype of the resource is supported by richdocuments | ||
* @return {boolean} | ||
*/ | ||
function isDocument() { | ||
/** @type HTMLInputElement */ | ||
const mimetypeElement = document.getElementById('mimetype') | ||
|
||
return Boolean(mimetypeElement) && mimetypes.includes(mimetypeElement.value) | ||
} | ||
|
||
export default isDocument |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** | ||
* Determines if the resource is a public share | ||
* @return {boolean} | ||
*/ | ||
function isPublic() { | ||
/** @type HTMLInputElement */ | ||
const publicElement = document.getElementById('isPublic') | ||
|
||
return Boolean(publicElement) && publicElement.value === '1' | ||
} | ||
|
||
export default isPublic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import isPublic from './helpers/isPublicPage.js' | ||
import isDocument from './helpers/isDocument.js' | ||
|
||
document.addEventListener('DOMContentLoaded', () => { | ||
|
||
// Public share, but not a supported mimetype - do nothing | ||
if (isPublic() && !isDocument()) { | ||
return | ||
} | ||
|
||
// Public share, and is a supported mimetype - open viewer | ||
if (isPublic() && isDocument()) { | ||
if (OCA.Viewer) { | ||
OCA.Viewer.open({ path: '/' }) | ||
} | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters