1.1.9 • Published 5 years ago

cloudstudio-lite v1.1.9

Weekly downloads
3
License
MIT
Repository
-
Last release
5 years ago

Cloud-Studio-Lite SDK文档

API

ISDKOptions

参数说明类型是否必填
rootNode宿主根节点HTMLElementtrue
funcName函数名Stringfalse
applyStatistics申请数据统计IStatisticsParamsfalse
helpDocLink帮助文档链接Stringfalse

如:

const CSLite = new CloudStudioLiteSDK({
    rootNode: document.querySelector('#root'),
    funcName: 'workspace',
    helpDocLink: 'https://studio.dev.tencent.com/',
    applyStatistics: {
        appId: 'appId-1',
        appKey: 'appKey-1',
        channel: 'channel-1',
        uid: 'uid-1'
    } as IStatisticsParams
});

IStatisticsParams

参数说明类型是否必填
appIdappIdStringtrue
appKeyappKeyStringtrue
channelchannelStringtrue
uiduidStringtrue

FileTreeModel

参数说明类型是否必填
isFile是否是文件类型Booleantrue
path文件路径(唯一)Stringtrue
fileName文件名称Stringtrue
parentPath父级文件路径(唯一)Stringtrue

方法

参数说明参数类型返回值类型
getFileList获取所有文件列表(未保存文件返回原始内容)-IFileValue[]
onOpenFileListen监听要读取的某文件文本内容的方法(data: { path: string }) => Promise<{ content: string }>void
onSaveFileListen监听要保存的某文件文本内容的方法(data: { path: string, content: string }) => Promise<boolean>void
onAddFileListen监听要新增的文件的方法(data: { path: string, content: string }) => Promise<boolean>void
onAddFolderListen监听要新增的文件夹的方法(data: { path: string }) => Promise<boolean>void
onDelFileListen监听要删除的文件的方法(data: { path: string }) => Promise<boolean>void
onDelFolderListen监听要删除的文件夹的方法(data: { path: string }) => Promise<boolean>void
onRenameFileOrFolderListen监听要重命名的文件或文件夹的方法(data: { newPath: string, oldPath: string }) => Promise<boolean>void
onExpandFolderListen监听要展开的某文件夹的方法(data: { path: string }) => Promise<FileTreeModel[]>void

如:

CSLite.onOpenFileListen((data: { path: string }) => {
    const { path } = data;
    return new Promise((res, rej) => {
        // ...TUDO
        res( {content} )
    })
})

CSLite.getFileList() // 返回 IFileValue 类型数组

接口

IFileValue

参数说明类型默认值
fileName文件名称String''
isFile是否是文件类型Booleanfalse
level层级Number0
content文件内容String''
path文件路径String''
parentPath父级文件路径String''
1.1.9

5 years ago

1.1.8

5 years ago

1.1.7

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.22

5 years ago

1.0.21

5 years ago

1.0.20

5 years ago

1.0.19

5 years ago

1.0.18

5 years ago

1.0.17

5 years ago

1.0.16

5 years ago

1.0.15

5 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago