feat: add format type 'YAML' and 'XML' #110
This commit is contained in:
parent
4c9d75303c
commit
4dc8839a51
|
@ -2,6 +2,8 @@ package types
|
|||
|
||||
const FORMAT_RAW = "Raw"
|
||||
const FORMAT_JSON = "JSON"
|
||||
const FORMAT_YAML = "YAML"
|
||||
const FORMAT_XML = "XML"
|
||||
const FORMAT_HEX = "Hex"
|
||||
const FORMAT_BINARY = "Binary"
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ func autoDecode(str string) (value, resultDecode string) {
|
|||
func viewAs(str, formatType string) (value, resultFormat string) {
|
||||
if len(formatType) > 0 {
|
||||
switch formatType {
|
||||
case types.FORMAT_RAW:
|
||||
case types.FORMAT_RAW, types.FORMAT_YAML, types.FORMAT_XML:
|
||||
value = str
|
||||
resultFormat = formatType
|
||||
return
|
||||
|
|
|
@ -97,6 +97,10 @@ const viewLanguage = computed(() => {
|
|||
switch (viewAs.format) {
|
||||
case formatTypes.JSON:
|
||||
return 'json'
|
||||
case formatTypes.YAML:
|
||||
return 'yaml'
|
||||
case formatTypes.XML:
|
||||
return 'xml'
|
||||
default:
|
||||
return 'plaintext'
|
||||
}
|
||||
|
@ -129,11 +133,6 @@ const onFormatChanged = async (decode = null, format = null) => {
|
|||
}
|
||||
}
|
||||
|
||||
const onUpdateValue = (value) => {
|
||||
// emit('update:value', value)
|
||||
viewAs.value = value
|
||||
}
|
||||
|
||||
const onInput = (content) => {
|
||||
editingContent.value = content
|
||||
}
|
||||
|
|
|
@ -53,6 +53,10 @@ const viewLanguage = computed(() => {
|
|||
switch (viewAs.format) {
|
||||
case formatTypes.JSON:
|
||||
return 'json'
|
||||
case formatTypes.YAML:
|
||||
return 'yaml'
|
||||
case formatTypes.XML:
|
||||
return 'xml'
|
||||
default:
|
||||
return 'plaintext'
|
||||
}
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
export const formatTypes = {
|
||||
RAW: 'Raw',
|
||||
JSON: 'JSON',
|
||||
// XML: 'XML',
|
||||
// YML: 'YML',
|
||||
YAML: 'YAML',
|
||||
XML: 'XML',
|
||||
HEX: 'Hex',
|
||||
BINARY: 'Binary',
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue