Skip to content

Commit

Permalink
fix: Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
acezard committed Dec 20, 2021
1 parent db30b49 commit 34373cf
Show file tree
Hide file tree
Showing 6 changed files with 321 additions and 31 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@
"@material-ui/styles": "4.11.4",
"classnames": "2.3.1",
"cozy-bar": "7.16.0",
"cozy-client": "^24.9.1",
"cozy-client": "^27.6.5",
"cozy-device-helper": "1.12.0",
"cozy-doctypes": "1.82.2",
"cozy-editor-core": "134.0.3",
"cozy-flags": "2.7.2",
"cozy-realtime": "3.13.0",
"cozy-scripts": "eslint7",
"cozy-sharing": "^3.12.2",
"cozy-ui": "^51.12.0",
"cozy-ui": "^58.4.0",
"eslint-config-cozy-app": "1.6.0",
"lodash": "^4.17.15",
"prop-types": "15.7.2",
Expand Down
11 changes: 10 additions & 1 deletion src/components/notes/EditorCorner.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,22 @@ import { useI18n } from 'cozy-ui/transpiled/react/I18n'

import SharingWidget from 'components/notes/sharing'

// https://mui.com/components/tooltips/#custom-child-element
const ForwardedIcon = React.forwardRef(function ForwardedIcon(props, ref) {
return (
<div ref={ref}>
<Icon {...props} />
</div>
)
})

const EditorCorner = ({ doc, isPublic, isReadOnly, title }) => {
const { t } = useI18n()
if (!isPublic) return <SharingWidget file={doc.file} title={title} />
else if (isReadOnly) {
return (
<Tooltip title={t('Notes.Editor.read_only')}>
<Icon icon="lock" color="var(--primaryTextColor)" />
<ForwardedIcon icon="lock" color="var(--primaryTextColor)" />
</Tooltip>
)
} else return null
Expand Down
3 changes: 1 addition & 2 deletions src/components/notes/EditorCorner.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,9 @@ describe('EditorCorner', () => {
<WithStyles(ForwardRef(Tooltip))
title="This note is in read-only mode."
>
<Icon
<ForwardRef(ForwardedIcon)
color="var(--primaryTextColor)"
icon="lock"
spin={false}
/>
</WithStyles(ForwardRef(Tooltip))>
`)
Expand Down
14 changes: 8 additions & 6 deletions src/components/notes/editor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,13 @@ export default function Editor(props) {
headerMenu={
<HeaderMenu
backFromEditing={
<BackFromEditing
returnUrl={returnUrl}
file={doc.file}
requestToLeave={requestToLeave}
/>
returnUrl ? (
<BackFromEditing
returnUrl={returnUrl}
file={doc.file}
requestToLeave={requestToLeave}
/>
) : null
}
editorCorner={
<EditorCorner
Expand Down Expand Up @@ -151,5 +153,5 @@ Editor.propTypes = {
noteId: PropTypes.string.isRequired,
readOnly: PropTypes.bool.isRequired,
userName: PropTypes.string,
returnUrl: PropTypes.string
returnUrl: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]).isRequired
}
2 changes: 1 addition & 1 deletion src/targets/browser/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export const initApp = () => {

const shareCode = getPublicSharecode()
const token = shareCode || data.token
const isPublic = shareCode || !token || token == ''
const isPublic = Boolean(shareCode || !token || token == '')

// initialize the client to interact with the cozy stack
const client = new CozyClient({
Expand Down
Loading

0 comments on commit 34373cf

Please sign in to comment.