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