Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
antSword
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
HuangJunbo
antSword
Commits
62adcaea
Commit
62adcaea
authored
Jan 20, 2019
by
Medicean
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(Add:Module:Setting) 新增默认设置
parent
03c0a0cd
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
130 additions
and
2 deletions
+130
-2
app.entry.js
source/app.entry.js
+1
-1
en.js
source/language/en.js
+20
-0
zh.js
source/language/zh.js
+20
-0
files.js
source/modules/filemanager/files.js
+1
-1
index.js
source/modules/filemanager/index.js
+5
-0
adefault.js
source/modules/settings/adefault.js
+81
-0
index.js
source/modules/settings/index.js
+2
-0
No files found.
source/app.entry.js
View file @
62adcaea
...
...
@@ -73,7 +73,7 @@ const antSword = window.antSword = {
if
(
!
value
)
{
return
localStorage
.
getItem
(
key
)
||
def
;
};
if
(
typeof
(
x
)
===
"object"
)
if
(
typeof
(
value
)
===
"object"
)
value
=
JSON
.
stringify
(
value
);
// 设置
localStorage
.
setItem
(
key
,
value
);
...
...
source/language/en.js
View file @
62adcaea
...
...
@@ -664,6 +664,26 @@ module.exports = {
}
}
}
},
adefault
:
{
title
:
'Default Setting'
,
success
:
'Save default settings successfully!'
,
error
:
'Failed to save the default settings!'
,
confirm
:
{
content
:
'Restart the application to take effect, whether to restart?'
,
title
:
'Change default settings'
},
toolbar
:
{
save
:
'Save'
,
},
filemanager
:
{
title
:
'FileManager'
,
openfileintab
:
{
title
:
'Open File in'
,
window
:
'Window'
,
tab
:
'Tab'
,
},
}
}
},
plugin
:
{
...
...
source/language/zh.js
View file @
62adcaea
...
...
@@ -665,6 +665,26 @@ module.exports = {
}
}
}
},
adefault
:
{
title
:
'默认设置'
,
success
:
'保存成功'
,
error
:
'保存失败!'
,
confirm
:
{
content
:
'重启应用生效,是否重启?'
,
title
:
'更改默认设置'
},
toolbar
:
{
save
:
'保存'
,
},
filemanager
:
{
title
:
'文件管理'
,
openfileintab
:
{
title
:
'文件打开方式'
,
window
:
'窗口打开'
,
tab
:
'标签打开'
,
},
}
}
},
plugin
:
{
...
...
source/modules/filemanager/files.js
View file @
62adcaea
...
...
@@ -383,7 +383,7 @@ class Files {
manager
.
previewFile
(
fname
,
fsize
);
}
else
if
(
fsize
<=
100
*
1024
){
// 双击编辑size < 100kb 文件
manager
.
editFile
(
fname
);
manager
.
editFile
(
fname
,
self
.
manager
.
config
.
openfileintab
);
}
else
{
manager
.
downloadFile
(
fname
,
fsize
);
}
...
...
source/modules/filemanager/index.js
View file @
62adcaea
...
...
@@ -39,6 +39,11 @@ class FileManager {
antSword
[
'modules'
][
'filemanager'
]
=
antSword
[
'modules'
][
'filemanager'
]
||
{};
antSword
[
'modules'
][
'filemanager'
][
hash
]
=
this
;
let
config
=
{
openfileintab
:
false
,
};
this
.
config
=
JSON
.
parse
(
antSword
[
'storage'
](
"adefault_filemanager"
,
false
,
JSON
.
stringify
(
config
)));
this
.
isWin
=
true
;
this
.
path
=
'/'
;
this
.
home
=
'/'
;
...
...
source/modules/settings/adefault.js
0 → 100644
View file @
62adcaea
/**
* 设置中心::默认设置
*/
const
LANG
=
antSword
[
'language'
][
'settings'
][
'adefault'
];
const
LANG_T
=
antSword
[
'language'
][
'toastr'
];
class
ADefault
{
constructor
(
sidebar
)
{
sidebar
.
addItem
({
id
:
'adefault'
,
text
:
`<i class="fa fa-television"></i>
${
LANG
[
'title'
]}
`
});
const
cell
=
sidebar
.
cells
(
'adefault'
);
const
default_config
=
{
filemanager
:
{
openfileintab
:
false
,
},
};
// 读取配置
const
filemanager_settings
=
JSON
.
parse
(
antSword
[
'storage'
](
"adefault_filemanager"
,
false
,
JSON
.
stringify
(
default_config
.
filemanager
)));
const
toolbar
=
cell
.
attachToolbar
();
toolbar
.
loadStruct
([
{
id
:
'save'
,
type
:
'button'
,
text
:
LANG
[
'toolbar'
][
'save'
],
icon
:
'save'
}
]);
// 表单
const
form
=
cell
.
attachForm
([{
type
:
'block'
,
name
:
'filemanager'
,
list
:
[
// {type: "label", label: LANG['filemanager']['title']},
{
type
:
"fieldset"
,
label
:
LANG
[
'filemanager'
][
'title'
],
list
:[
{
type
:
"block"
,
list
:
[
{
type
:
"label"
,
label
:
LANG
[
'filemanager'
][
'openfileintab'
][
'title'
]},
{
type
:
'newcolumn'
,
offset
:
20
},
{
type
:
"radio"
,
label
:
LANG
[
'filemanager'
][
'openfileintab'
][
'window'
],
name
:
'openfileintab'
,
checked
:
filemanager_settings
.
openfileintab
==
false
,
position
:
"label-right"
,
value
:
false
,
},
{
type
:
'newcolumn'
,
offset
:
20
},
{
type
:
"radio"
,
label
:
LANG
[
'filemanager'
][
'openfileintab'
][
'tab'
],
name
:
'openfileintab'
,
checked
:
filemanager_settings
.
openfileintab
==
true
,
position
:
"label-right"
,
value
:
true
,
}
]},
// 后续文件管理其它设置
]
}
]},
// 后续其它模块
],
true
);
form
.
enableLiveValidation
(
true
);
// 保存
toolbar
.
attachEvent
(
'onClick'
,
(
id
)
=>
{
switch
(
id
){
case
'save'
:
if
(
form
.
validate
()){
var
_formvals
=
form
.
getValues
();
let
config
=
default_config
;
config
.
filemanager
.
openfileintab
=
_formvals
[
'openfileintab'
];
// save
// save 文件管理设置
antSword
[
'storage'
](
'adefault_filemanager'
,
config
.
filemanager
);
toastr
.
success
(
LANG
[
'success'
],
LANG_T
[
'success'
]);
// 重启应用
layer
.
confirm
(
LANG
[
'confirm'
][
'content'
],
{
icon
:
2
,
shift
:
6
,
title
:
LANG
[
'confirm'
][
'title'
]
},
(
_
)
=>
{
location
.
reload
();
});
}
else
{
toastr
.
error
(
LANG
[
'error'
],
LANG_T
[
'error'
]);
}
break
;
}
});
}
}
module
.
exports
=
ADefault
;
source/modules/settings/index.js
View file @
62adcaea
...
...
@@ -12,6 +12,7 @@ const Language = require('./language');
const
AProxy
=
require
(
'./aproxy'
);
const
Display
=
require
(
'./display'
);
const
Encoders
=
require
(
'./encoders'
);
const
ADefault
=
require
(
'./adefault'
);
class
Settings
{
...
...
@@ -47,6 +48,7 @@ class Settings {
this
.
display
=
new
Display
(
sidebar
);
// Encoders
this
.
encoders
=
new
Encoders
(
sidebar
);
this
.
adefault
=
new
ADefault
(
sidebar
);
this
.
cell
=
cell
;
this
.
sidebar
=
sidebar
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment