Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/1620 upload new ctd single quates name #1632

Merged
merged 3 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions apps/sensenet/src/components/ContentBreadcrumbs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,16 @@ const useStyles = makeStyles((theme: Theme) => {
marginLeft: 'auto',
display: 'flex',
marginRight: '8px',
height: '40px',
},
buttonsWrapper: {
display: 'flex',
alignItems: 'center',
},
actionButton: {
width: '40px',
marginRight: '2px',
},
})
})

Expand Down Expand Up @@ -87,6 +92,7 @@ export const ContentBreadcrumbs = <T extends GenericContent = GenericContent>(pr
<div className={classes.batchActionWrapper} data-test="batch-actions">
<Tooltip title={localization.batchActions.delete} placement="bottom">
<IconButton
className={classes.actionButton}
data-test="batch-delete"
aria-label="delete"
onClick={() => {
Expand All @@ -101,6 +107,7 @@ export const ContentBreadcrumbs = <T extends GenericContent = GenericContent>(pr
</Tooltip>
<Tooltip title={localization.batchActions.move} placement="bottom">
<IconButton
className={classes.actionButton}
data-test="batch-move"
aria-label="move"
onClick={() => {
Expand All @@ -123,6 +130,7 @@ export const ContentBreadcrumbs = <T extends GenericContent = GenericContent>(pr
</Tooltip>
<Tooltip title={localization.batchActions.copy} placement="bottom">
<IconButton
className={classes.actionButton}
data-test="batch-copy"
aria-label="copy"
onClick={() => {
Expand Down
7 changes: 6 additions & 1 deletion apps/sensenet/src/components/editor/text-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { PathHelper } from '@sensenet/client-utils'
import { ActionModel, GenericContent, Settings, File as SnFile } from '@sensenet/default-content-types'
import { useLogger, useRepository } from '@sensenet/hooks-react'
import React, { useEffect, useState } from 'react'
import { useLocalization } from '../../hooks'
import { useLocalization, useSelectionService } from '../../hooks'
import { getMonacoLanguage } from '../../services/content-context-service'
import { ContentBreadcrumbs } from '../ContentBreadcrumbs'
import { FullScreenLoader } from '../full-screen-loader'
Expand Down Expand Up @@ -50,6 +50,11 @@ export const TextEditor: React.FunctionComponent<TextEditorProps> = (props) => {
const [hasChanges, setHasChanges] = useState(false)
const logger = useLogger('TextEditor')
const [error, setError] = useState<Error | undefined>()
const selectionService = useSelectionService()

useEffect(() => {
selectionService.selection.setValue([props.content])
}, [props, selectionService.selection])

const saveContent = async () => {
try {
Expand Down
3 changes: 2 additions & 1 deletion apps/sensenet/src/components/view-controls/browse-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ export const BrowseView: React.FC<BrowseViewProps> = (props) => {
})
setContent(expanedContentResponse.d)
selectionService.activeContent.setValue(expanedContentResponse.d)
selectionService.selection.setValue([expanedContentResponse.d])
}
getExpandedContent()
}, [repository, props.contentPath, selectionService.activeContent])
}, [repository, props.contentPath, selectionService.activeContent, selectionService.selection])

if (content === undefined) {
return null
Expand Down
3 changes: 2 additions & 1 deletion apps/sensenet/src/components/view-controls/edit-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@ export const EditView: React.FC<EditViewProps> = (props) => {
})
setContent(expanedContentResponse.d)
selectionService.activeContent.setValue(expanedContentResponse.d)
selectionService.selection.setValue([expanedContentResponse.d])
}
getExpandedContent()
}, [repository, props.contentPath, selectionService.activeContent])
}, [repository, props.contentPath, selectionService.activeContent, selectionService.selection])

if (content === undefined) {
return null
Expand Down
2 changes: 1 addition & 1 deletion apps/sensenet/src/components/view-controls/new-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const NewView: React.FC<NewViewProps> = (props) => {
routeMatch={routeMatch}
savePath={PATHS.contentTypes.snPath}
loadContent={loadDefaultContentType}
getFileNameFromText={(text) => text.match(/<ContentType.*name="([^"]*)".*>/m)?.[1] || ''}
getFileNameFromText={(text) => text.match(/<ContentType.*name=['"]([^'"]*)['"].*>/m)?.[1] || ''}
/>
)
} else if (props.contentTypeName === 'Resource') {
Expand Down
Loading