🎨 Site > File Tree > Remove data property
This commit is contained in:
@@ -35,7 +35,7 @@ export default
|
|||||||
if(search !== '')
|
if(search !== '')
|
||||||
{
|
{
|
||||||
// Set up fuzzy search
|
// Set up fuzzy search
|
||||||
const text = this.content.data.path.full.replace(/^\.\//, '')
|
const text = this.content.path.full.replace(/^\.\//, '')
|
||||||
let searchPosition = 0
|
let searchPosition = 0
|
||||||
this.matchingPositions = []
|
this.matchingPositions = []
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ export default
|
|||||||
if(searchPosition < search.length && text[n].toLowerCase() === search[searchPosition])
|
if(searchPosition < search.length && text[n].toLowerCase() === search[searchPosition])
|
||||||
{
|
{
|
||||||
searchPosition += 1
|
searchPosition += 1
|
||||||
this.matchingPositions.push(n - this.content.data.path.directory.length + 1)
|
this.matchingPositions.push(n - this.content.path.directory.length + 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ export default
|
|||||||
{
|
{
|
||||||
onNameClick()
|
onNameClick()
|
||||||
{
|
{
|
||||||
this.$store.commit('setFile', this.content.data.path.full)
|
this.$store.commit('setFile', this.content.path.full)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
<div v-show="visible">
|
<div v-show="visible">
|
||||||
<a href="#" class="name" :style="{ paddingLeft:depth * 20 + 'px' }" @click.prevent="onNameClick">
|
<a href="#" class="name" :style="{ paddingLeft:depth * 20 + 'px' }" @click.prevent="onNameClick">
|
||||||
<file-icon class="icon" :extension="content.data.extension"></file-icon>
|
<file-icon class="icon" :extension="content.extension"></file-icon>
|
||||||
<span class="text">
|
<span class="text">
|
||||||
<template v-for="(letter, key) in content.name">
|
<template v-for="(letter, key) in content.name">
|
||||||
<span :style="matchingPositions.indexOf(key) !== -1 ? 'font-weight:bold;' : ''">{{ letter }}</span>
|
<span :style="matchingPositions.indexOf(key) !== -1 ? 'font-weight:bold;' : ''">{{ letter }}</span>
|
||||||
</template>
|
</template>
|
||||||
</span>
|
</span>
|
||||||
<span v-if="content.data.isNew" class="new">(new)</span>
|
<span v-if="content.isNew" class="new">(new)</span>
|
||||||
<span v-if="content.data.isChanged && !content.data.isNew" class="changed">(changed)</span>
|
<span v-if="content.isChanged && !content.isNew" class="changed">(changed)</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@@ -10,6 +10,6 @@
|
|||||||
</a>
|
</a>
|
||||||
<div v-show="open">
|
<div v-show="open">
|
||||||
<files-tree-folder class="js-child" v-for="folder of content.folders" :key="folder.name" :content="folder" :depth="depth + 1" :directory="fullPath + '/'"></files-tree-folder>
|
<files-tree-folder class="js-child" v-for="folder of content.folders" :key="folder.name" :content="folder" :depth="depth + 1" :directory="fullPath + '/'"></files-tree-folder>
|
||||||
<files-tree-file class="js-child" v-for="file of files" :key="file.data.path.full" :content="file" :depth="depth + 1"></files-tree-file>
|
<files-tree-file class="js-child" v-for="file of files" :key="file.path.full" :content="file" :depth="depth + 1"></files-tree-file>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
{{ project.name }}
|
{{ project.name }}
|
||||||
|
|
||||||
<files-tree></files-tree>
|
<files-tree></files-tree>
|
||||||
<file v-if="file" :content="file.data"></file>
|
<file v-if="file" :content="file"></file>
|
||||||
<landing v-if="!file"></landing>
|
<landing v-if="!file"></landing>
|
||||||
<chat></chat>
|
<chat></chat>
|
||||||
<alert></alert>
|
<alert></alert>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export default
|
|||||||
{
|
{
|
||||||
extension()
|
extension()
|
||||||
{
|
{
|
||||||
return this.$store.state.files.current.data.extension
|
return this.$store.state.files.current.extension
|
||||||
},
|
},
|
||||||
|
|
||||||
version()
|
version()
|
||||||
|
|||||||
@@ -39,11 +39,11 @@ export default {
|
|||||||
{
|
{
|
||||||
const file = state.tree.getFile(data)
|
const file = state.tree.getFile(data)
|
||||||
|
|
||||||
if(!state.current || state.current.data.id !== file.data.id)
|
if(!state.current || state.current.id !== file.id)
|
||||||
{
|
{
|
||||||
state.current = file
|
state.current = file
|
||||||
state.current.data.isNew = false
|
state.current.isNew = false
|
||||||
state.current.data.isChanged = false
|
state.current.isChanged = false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -53,8 +53,8 @@ export default {
|
|||||||
|
|
||||||
if(file)
|
if(file)
|
||||||
{
|
{
|
||||||
file.data.versions.push(data.version)
|
file.versions.push(data.version)
|
||||||
file.data.isChanged = true
|
file.isChanged = true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
+26
-14
@@ -99,8 +99,14 @@ class FileTree
|
|||||||
folder = {
|
folder = {
|
||||||
folders: [],
|
folders: [],
|
||||||
files: [],
|
files: [],
|
||||||
name: _part,
|
name: _part
|
||||||
data: _data
|
}
|
||||||
|
|
||||||
|
// Add data
|
||||||
|
for(const dataKey in _data)
|
||||||
|
{
|
||||||
|
const data = _data[dataKey]
|
||||||
|
folder[dataKey] = data
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
@@ -144,8 +150,14 @@ class FileTree
|
|||||||
|
|
||||||
// Create file
|
// Create file
|
||||||
const file = {
|
const file = {
|
||||||
name: filePart,
|
name: filePart
|
||||||
data: _data
|
}
|
||||||
|
|
||||||
|
// Add data
|
||||||
|
for(const dataKey in _data)
|
||||||
|
{
|
||||||
|
const data = _data[dataKey]
|
||||||
|
file[dataKey] = data
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
@@ -175,9 +187,9 @@ class FileTree
|
|||||||
folder.folders.splice(_folderKey, 1)
|
folder.folders.splice(_folderKey, 1)
|
||||||
|
|
||||||
// Callback
|
// Callback
|
||||||
if(typeof _folder.data.onRemove === 'function')
|
if(typeof _folder.onRemove === 'function')
|
||||||
{
|
{
|
||||||
_folder.data.onRemove.apply(this, [_folder])
|
_folder.onRemove.apply(this, [_folder])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,9 +201,9 @@ class FileTree
|
|||||||
folder.files.splice(_fileKey, 1)
|
folder.files.splice(_fileKey, 1)
|
||||||
|
|
||||||
// Callback
|
// Callback
|
||||||
if(typeof _file.data.onRemove === 'function')
|
if(typeof _file.onRemove === 'function')
|
||||||
{
|
{
|
||||||
_file.data.onRemove.apply(this, [_file])
|
_file.onRemove.apply(this, [_file])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -243,9 +255,9 @@ class FileTree
|
|||||||
folders.splice(index, 1)
|
folders.splice(index, 1)
|
||||||
|
|
||||||
// Callback
|
// Callback
|
||||||
if(typeof folder.data.onRemove === 'function')
|
if(typeof folder.onRemove === 'function')
|
||||||
{
|
{
|
||||||
folder.data.onRemove.apply(this, [folder])
|
folder.onRemove.apply(this, [folder])
|
||||||
}
|
}
|
||||||
|
|
||||||
// Auto wash
|
// Auto wash
|
||||||
@@ -324,9 +336,9 @@ class FileTree
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Callback
|
// Callback
|
||||||
if(typeof file.data.onRemove === 'function')
|
if(typeof file.onRemove === 'function')
|
||||||
{
|
{
|
||||||
file.data.onRemove.apply(this, [file])
|
file.onRemove.apply(this, [file])
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
@@ -466,9 +478,9 @@ class FileTree
|
|||||||
folder.folders.splice(_folderKey, 1)
|
folder.folders.splice(_folderKey, 1)
|
||||||
|
|
||||||
// Callback
|
// Callback
|
||||||
if(typeof _folder.data.onRemove === 'function')
|
if(typeof _folder.onRemove === 'function')
|
||||||
{
|
{
|
||||||
_folder.data.onRemove.apply(this, [_folder])
|
_folder.onRemove.apply(this, [_folder])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user