Support placeholder property for theme setting item.

pull/167/head
ruibaby 2019-05-24 00:49:07 +08:00
parent 58d5a4e6e2
commit de6d3d29b9
4 changed files with 19 additions and 2 deletions

View File

@ -115,6 +115,7 @@ public class YamlThemeConfigResolverImpl implements ThemeConfigResolver {
item.setDataType(DataType.typeOf(dataType));
item.setType(InputType.typeOf(itemMap.get("type")));
item.setDefaultValue(itemMap.get("default"));
item.setPlaceholder(itemMap.getOrDefault("placeholder", "").toString());
// Handle options
item.setOptions(handleOptions(itemMap.get("options")));
@ -140,6 +141,7 @@ public class YamlThemeConfigResolverImpl implements ThemeConfigResolver {
item.setDataType(DataType.typeOf(dataType));
item.setType(InputType.typeOf(itemMap.get("type")));
item.setDefaultValue(itemMap.get("default"));
item.setPlaceholder(itemMap.getOrDefault("placeholder", "").toString());
// Handle options
item.setOptions(handleOptions(itemMap.get("options")));

View File

@ -41,6 +41,11 @@ public class Item {
*/
private Object defaultValue;
/**
* Text item placeholder.
*/
private String placeholder;
/**
* Item's options, default is empty list
*/

View File

@ -16,38 +16,47 @@ sns:
name: twitter
label: Twitter
type: text
placeholder: '只需填入 Twitter 用户名即可'
facebook:
name: facebook
label: Facebook
type: text
placeholder: '只需填入 Facebook 用户名即可'
instagram:
name: instagram
label: Instagram
type: text
placeholder: '只需填入 Instagram 用户名即可'
dribbble:
name: dribbble
label: Dribbble
type: text
placeholder: '只需填入 Dribbble 用户名即可'
weibo:
name: weibo
label: 微博
type: text
placeholder: '只需填入微博 Id 即可'
email:
name: email
label: Email
type: text
placeholder: '只需填入邮箱地址即可'
github:
name: github
label: Github
type: text
placeholder: '只需填入 Github 用户名即可'
qq:
name: qq
label: QQ
type: text
placeholder: '只需填入 QQ 号即可'
telegram:
name: telegram
label: Telegram
type: text
placeholder: '只需填入 Telegram Id 即可'
style:
label: 样式设置
items:
@ -114,3 +123,4 @@ style:
name: custom
label: 自定义样式
type: textarea
placeholder: '不需要 <style></style> 标签'

View File

@ -3,7 +3,7 @@ name: Anatole
author:
name: Caicai
website: https://www.caicai.me
description: A other farbox theme
logo: https://ryanc.cc/anatole/source/images/logo@2x.png
description: A other Halo theme
logo: https://avatars1.githubusercontent.com/u/1811819?s=460&v=4
website: https://github.com/hi-caicai/farbox-theme-Anatole
version: 1.0