🐛 Fix some bugs
#36 https://github.com/justice2001/halo-plugin-vditor/issues/11
This commit is contained in:
parent
12b8d53ceb
commit
921234a50c
|
@ -38,6 +38,9 @@ const generateCode = () => {
|
|||
watch(props, () => {
|
||||
if (props.open) {
|
||||
loadKey.value = props.schema.name;
|
||||
props.schema.formKit.forEach((form: { [key: string]: string }) => {
|
||||
data.value[form.name] = form.value;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -46,12 +49,8 @@ const htmlEncode = (str: string) => {
|
|||
if (str.length === 0) {
|
||||
return "";
|
||||
}
|
||||
s = str.replace(/&/g, "&");
|
||||
s = s.replace(/</g, "<");
|
||||
s = str.replace(/</g, "<");
|
||||
s = s.replace(/>/g, ">");
|
||||
s = s.replace(/ /g, " ");
|
||||
s = s.replace(/'/g, "'");
|
||||
s = s.replace(/"/g, """);
|
||||
return s;
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -37,6 +37,7 @@ const insertValue = (value: string | null) => {
|
|||
if (!value) {
|
||||
vditor.value.tip("未知错误,插入失败", 3000);
|
||||
} else {
|
||||
console.log("Insert" + value);
|
||||
vditor.value.insertValue(value);
|
||||
vditor.value.focus();
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# 自定义插入按钮 设计方案
|
||||
# 快速插入 设计方案
|
||||
|
||||
> Issue https://github.com/justice2001/halo-plugin-vditor/issues/11
|
||||
|
||||
|
@ -15,31 +15,33 @@
|
|||
### 配置格式
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"type": "template",
|
||||
"id": "joe-progress",
|
||||
"icon": "",
|
||||
"name": "Joe Progress Bar",
|
||||
"formkit": [
|
||||
{
|
||||
"type": "template",
|
||||
"id": "joe-progress",
|
||||
"icon": "",
|
||||
"name": "Joe Progress Bar",
|
||||
"formkit": [
|
||||
{
|
||||
"$formkit": "text",
|
||||
"name": "percentage",
|
||||
"label": "Percentage",
|
||||
"help": "This is the percentage for progress bar."
|
||||
},
|
||||
{
|
||||
"$formkit": "text",
|
||||
"name": "color",
|
||||
"label": "Color",
|
||||
"help": "This is the color for progress bar."
|
||||
}
|
||||
],
|
||||
"template": "<joe-progress percentage=\"$percentage$\" color=\"$color$\"></joe-progress>"
|
||||
"$formkit": "text",
|
||||
"name": "percentage",
|
||||
"label": "Percentage",
|
||||
"help": "This is the percentage for progress bar."
|
||||
},
|
||||
{
|
||||
"$formkit": "text",
|
||||
"name": "color",
|
||||
"label": "Color",
|
||||
"help": "This is the color for progress bar."
|
||||
}
|
||||
]
|
||||
],
|
||||
"template": "<joe-progress percentage=\"$percentage$\" color=\"$color$\"></joe-progress>"
|
||||
}
|
||||
```
|
||||
|
||||
### 配置文件示例
|
||||
|
||||
[quick-insert-demo.json](quick-insert-demo.json)
|
||||
|
||||
### 表单方案
|
||||
|
||||
与Halo相同的使用FormKit Schema方案,便于Halo开发者使用,但不应支持特别复杂的语法,应当支持一些较为基础的语法为优。
|
||||
|
|
|
@ -11,18 +11,21 @@
|
|||
"name": "进度条",
|
||||
"formKit": [
|
||||
{
|
||||
"$formkit": "text",
|
||||
"$formkit": "number",
|
||||
"min": 0,
|
||||
"max": 100,
|
||||
"step": 1,
|
||||
"name": "percentage",
|
||||
"label": "进度",
|
||||
"help": "This is the percentage for progress bar.",
|
||||
"value": "0"
|
||||
"value": 50
|
||||
},
|
||||
{
|
||||
"$formkit": "color",
|
||||
"name": "color",
|
||||
"label": "颜色",
|
||||
"help": "This is the color for progress bar.",
|
||||
"value": "#ffffff"
|
||||
"value": "#fb6c28"
|
||||
}
|
||||
],
|
||||
"template": "<joe-progress percentage=\"$percentage$%\" color=\"$color$\"></joe-progress>"
|
Loading…
Reference in New Issue