mirror of
https://github.com/harness/drone.git
synced 2025-05-12 23:20:10 +08:00
Merge branch 'ui-fix-markdown-edit' of _OKE5H2PQKOUfzFFDuD4FA/default/CODE/gitness (#166)
This commit is contained in:
commit
14f6c2460f
@ -53,7 +53,7 @@ export function FileContent({
|
||||
const { routes } = useAppContext()
|
||||
const { getString } = useStrings()
|
||||
const downloadFile = useDownloadRawFile()
|
||||
const { category, isFileTooLarge, isViewable, filename, extension, size, base64Data, rawURL } =
|
||||
const { category, isText, isFileTooLarge, isViewable, filename, extension, size, base64Data, rawURL } =
|
||||
useFileContentViewerDecision({ repoMetadata, gitRef, resourcePath, resourceContent })
|
||||
const history = useHistory()
|
||||
const [activeTab, setActiveTab] = React.useState<string>(FileSection.CONTENT)
|
||||
@ -91,7 +91,6 @@ export function FileContent({
|
||||
const { standalone } = useAppContext()
|
||||
const { hooks } = useAppContext()
|
||||
const space = useGetSpaceParam()
|
||||
const isATextFile = category === FileCategory.TEXT
|
||||
const permPushResult = hooks?.usePermissionTranslate?.(
|
||||
{
|
||||
resource: {
|
||||
@ -177,7 +176,7 @@ export function FileContent({
|
||||
icon="code-edit"
|
||||
tooltipProps={{ isDark: true }}
|
||||
tooltip={permsFinal.tooltip}
|
||||
disabled={permsFinal.disabled || !isATextFile}
|
||||
disabled={permsFinal.disabled || !isText}
|
||||
onClick={() => {
|
||||
history.push(
|
||||
routes.toCODEFileEdit({
|
||||
|
@ -60,14 +60,12 @@ export function useFileContentViewerDecision({
|
||||
const isFileTooLarge = resourceData?.size !== resourceData?.data_size
|
||||
const rawURL = `/code/api/v1/repos/${repoMetadata?.path}/+/raw/${resourcePath}?routingId=${routingId}&git_ref=${gitRef}`
|
||||
|
||||
// TODO: TEST ONLY
|
||||
// const rawURL = `https://localhost:8181/rawfile/${filename}`
|
||||
|
||||
return {
|
||||
category,
|
||||
|
||||
isFileTooLarge,
|
||||
isViewable,
|
||||
isText,
|
||||
|
||||
filename,
|
||||
extension,
|
||||
@ -439,7 +437,21 @@ const TextExtensions = [
|
||||
'yml',
|
||||
'zsh',
|
||||
'zshrc',
|
||||
'ics'
|
||||
'ics',
|
||||
|
||||
'rego',
|
||||
'tf',
|
||||
'hcl',
|
||||
'mod',
|
||||
'sum',
|
||||
'rst',
|
||||
'toml',
|
||||
'abap',
|
||||
'uos',
|
||||
'uot',
|
||||
'ahk',
|
||||
'asciidoc',
|
||||
'slk'
|
||||
]
|
||||
|
||||
const SpecialTextFiles = [
|
||||
|
Loading…
Reference in New Issue
Block a user