Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
blackforestboi committed Mar 3, 2022
2 parents 8d41931 + 7ffb862 commit e6a8093
Show file tree
Hide file tree
Showing 23 changed files with 252 additions and 113 deletions.
6 changes: 3 additions & 3 deletions img/lockFine.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions img/personFine.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "worldbrain-extension",
"version": "3.1.9",
"version": "3.1.10",
"homepage": "https://worldbrain.io",
"repository": "https://github.com/WorldBrain/Memex",
"scripts": {
Expand Down
43 changes: 31 additions & 12 deletions src/annotations/components/AnnotationCreate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import TagsSegment from 'src/common-ui/components/result-item-tags-segment'
import type { NoteResultHoverState, FocusableComponent } from './types'
import type { AnnotationFooterEventProps } from 'src/annotations/components/AnnotationFooter'
import { getKeyboardShortcutsState } from 'src/in-page-ui/keyboard-shortcuts/content_script/detection'
import { browser } from 'webextension-polyfill-ts'

interface State {
isTagPickerShown: boolean
Expand Down Expand Up @@ -130,22 +131,39 @@ export class AnnotationCreate extends React.Component<Props, State>
// If we don't have this, events will bubble up, out of the content script into the parent page!
e.stopPropagation()

if (e.key === 'Enter' && e.shiftKey && e.metaKey) {
return this.handleSave(true, false)
}
if (navigator.platform === 'MacIntel') {
if (e.key === 'Enter' && e.shiftKey && e.metaKey) {
return this.handleSave(true, false)
}

if (e.key === 'Enter' && e.shiftKey && e.altKey) {
return this.handleSave(true, true)
}
if (e.key === 'Enter' && e.shiftKey && e.altKey) {
return this.handleSave(true, true)
}

if (e.key === 'Enter' && e.altKey) {
return this.handleSave(false, true)
}
if (e.key === 'Enter' && e.altKey) {
return this.handleSave(false, true)
}

if (e.key === 'Enter' && e.metaKey) {
return this.handleSave(false, false)
}
if (e.key === 'Enter' && e.metaKey) {
return this.handleSave(false, false)
}
} else {
if (e.key === 'Enter' && e.shiftKey && e.ctrlKey) {
return this.handleSave(true, false)
}

if (e.key === 'Enter' && e.shiftKey && e.altKey) {
return this.handleSave(true, true)
}

if (e.key === 'Enter' && e.altKey) {
return this.handleSave(false, true)
}

if (e.key === 'Enter' && e.ctrlKey) {
return this.handleSave(false, false)
}
}
// if (e.key === 'Tab' && !e.shiftKey) {
// e.preventDefault()
// insertTab({ el: this.textAreaRef.current })
Expand Down Expand Up @@ -305,6 +323,7 @@ const FooterContainer = styled.div`
justify-content: space-between;
align-items: center;
padding: 5px 15px 5px 15px;
z-index: 1001;
`

const SaveActionBar = styled.div`
Expand Down
55 changes: 38 additions & 17 deletions src/annotations/components/AnnotationEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,23 +47,44 @@ class AnnotationEdit extends React.Component<Props> {
private handleInputKeyDown: React.KeyboardEventHandler = (e) => {
e.stopPropagation()

if (e.key === 'Enter' && e.shiftKey && e.metaKey) {
return this.saveEdit(true, false)
}

if (e.key === 'Enter' && e.shiftKey && e.altKey) {
return this.saveEdit(true, true)
}

if (e.key === 'Enter' && e.altKey) {
return this.saveEdit(false, true)
}

if (e.key === 'Enter' && e.metaKey) {
return this.saveEdit(
this.props.isShared,
this.props.isBulkShareProtected,
)
if (navigator.platform === 'MacIntel') {
if (e.key === 'Enter' && e.shiftKey && e.metaKey) {
return this.saveEdit(true, false)
}

if (e.key === 'Enter' && e.shiftKey && e.altKey) {
return this.saveEdit(true, true)
}

if (e.key === 'Enter' && e.altKey) {
return this.saveEdit(false, true)
}

if (e.key === 'Enter' && e.metaKey) {
return this.saveEdit(
this.props.isShared,
this.props.isBulkShareProtected,
)
}
} else {
if (e.key === 'Enter' && e.shiftKey && e.ctrlKey) {
return this.saveEdit(true, false)
}

if (e.key === 'Enter' && e.shiftKey && e.altKey) {
return this.saveEdit(true, true)
}

if (e.key === 'Enter' && e.altKey) {
return this.saveEdit(false, true)
}

if (e.key === 'Enter' && e.ctrlKey) {
return this.saveEdit(
this.props.isShared,
this.props.isBulkShareProtected,
)
}
}

if (e.key === 'Escape') {
Expand Down
22 changes: 16 additions & 6 deletions src/annotations/components/AnnotationEditable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ export default class AnnotationEditable extends React.Component<Props> {
if (!footerDeps) {
return [
repliesLoadingState === 'running'
? { node: <LoadingIndicator /> }
? { node: <LoadingIndicator size={16} /> }
: {
key: 'replies-btn',
onClick: onReplyBtnClick,
Expand All @@ -319,7 +319,13 @@ export default class AnnotationEditable extends React.Component<Props> {
]
}

return [{ node: <></> }]
return [
{
key: 'share-note-btn',
isDisabled: true,
image: shareIconData.icon,
},
]
}

if (hoverState === 'footer') {
Expand Down Expand Up @@ -450,7 +456,7 @@ export default class AnnotationEditable extends React.Component<Props> {

return (
<ThemeProvider theme={this.theme}>
<Margin top="5px" bottom="5px">
<AnnotationBox top="5px" bottom="2px">
<ItemBox
firstDivProps={{
id: this.props.url,
Expand Down Expand Up @@ -500,7 +506,7 @@ export default class AnnotationEditable extends React.Component<Props> {
)}
</AnnotationStyled>
</ItemBox>
</Margin>
</AnnotationBox>
{this.state.showQuickTutorial && (
<ClickAway
onClickAway={() =>
Expand Down Expand Up @@ -576,6 +582,11 @@ const EditNoteIconBox = styled.div`
}
`

const AnnotationBox = styled(Margin)`
width: 99%;
align-self: center;
`

const EditNoteIcon = styled.div`
display: flex;
border: none;
Expand Down Expand Up @@ -843,6 +854,5 @@ const DeletionBox = styled.div`
justify-content: space-between;
align-items: center;
border-top: 1px solid #f0f0f0;
padding: 5px;
}
padding: 5px 15px 5px 15px;
`
29 changes: 25 additions & 4 deletions src/annotations/components/save-btn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,35 @@ export default class AnnotationSaveBtn extends React.PureComponent<
)
}
>
{this.props.isShared ||
(this.props.isProtected && (
{this.props.isShared && this.props.isProtected && (
<Icon
hoverOff
filePath={this.saveIcon}
heightAndWidth="14px"
/>
)}{' '}
{!this.props.isShared && this.props.isProtected && (
<Icon
hoverOff
filePath={icons.lockFine}
heightAndWidth="14px"
/>
)}{' '}
{!this.props.isShared &&
!this.props.isProtected && (
<Icon
hoverOff
filePath={this.saveIcon}
filePath={icons.personFine}
heightAndWidth="14px"
/>
))}{' '}
)}{' '}
{this.props.isShared && !this.props.isProtected && (
<Icon
hoverOff
filePath={icons.globe}
heightAndWidth="14px"
/>
)}{' '}
Save
</SaveBtnText>
</ButtonTooltip>
Expand Down
6 changes: 3 additions & 3 deletions src/annotations/sharing-utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ export function getShareButtonData(
),
}
} else if (isShared && !isBulkShareProtected) {
return { icon: icons.webLogo, label: 'Public' }
return { icon: icons.globe, label: 'Public' }
} else if (isBulkShareProtected && !isShared) {
return {
icon: icons.lock,
icon: icons.lockFine,
label: (
<span>
Private
Expand All @@ -28,5 +28,5 @@ export function getShareButtonData(
),
}
}
return { icon: icons.link, label: 'Share' }
return { icon: icons.personFine, label: 'Share' }
}
22 changes: 15 additions & 7 deletions src/authentication/components/AuthDialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,12 @@ export default class AuthDialog extends StatefulUIElement<Props, State, Event> {
label={'Sign Up'}
fontSize={'14px'}
/>
{this.state.error && (
<AuthErrorMessage>
{this.renderAuthError()}
</AuthErrorMessage>
)}
</ConfirmContainer>
{this.state.error && (
<AuthErrorMessage>
{this.renderAuthError()}
</AuthErrorMessage>
)}
{this.renderLoginTypeSwitcher()}
</EmailPasswordLogin>
</AuthenticationMethods>
Expand Down Expand Up @@ -288,8 +288,12 @@ export default class AuthDialog extends StatefulUIElement<Props, State, Event> {
label={'Login'}
fontSize={'14px'}
/>
{this.renderAuthError()}
</ConfirmContainer>
{this.state.error && (
<AuthErrorMessage>
{this.renderAuthError()}
</AuthErrorMessage>
)}
{this.renderLoginTypeSwitcher()}
</EmailPasswordLogin>
</AuthenticationMethods>
Expand Down Expand Up @@ -353,8 +357,12 @@ export default class AuthDialog extends StatefulUIElement<Props, State, Event> {
label={'Login'}
fontSize={'14px'}
/>
{this.renderAuthError()}
</ConfirmContainer>
{this.state.error && (
<AuthErrorMessage>
{this.renderAuthError()}
</AuthErrorMessage>
)}
{this.renderLoginTypeSwitcher()}
</EmailPasswordLogin>
</AuthenticationMethods>
Expand Down
1 change: 1 addition & 0 deletions src/common-ui/GenericPicker/components/SearchInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ const SearchBox = styled.div`
margin-bottom: 4px;
grid-gap: 5px;
min-height: 20px;
height: 24px;
`

const SearchInput = styled(TextInputControlled)`
Expand Down
2 changes: 1 addition & 1 deletion src/dashboard-refactor/components/DragElement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default (props: Props) => {
isHoveringOverListItem={props.isHoveringOverListItem}
>
{' '}
Drop into Collection
Drop into Space
</DragElement>
)
}
Expand Down
Loading

0 comments on commit e6a8093

Please sign in to comment.