-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(admin): Support form multi file component & fixed richtext error
- Loading branch information
cg33
committed
Mar 8, 2020
1 parent
34bf64a
commit 121621f
Showing
13 changed files
with
162 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{{define "form_multi_file"}} | ||
<input type="file" class="{{.Field}}" name="{{.Field}}" multiple data-initial-preview="{{.Value2}}" | ||
data-initial-caption="{{.Value}}"> | ||
<input type="hidden" value="0" name="{{.Field}}__delete_flag" class="{{.Field}}__delete_flag"> | ||
<script> | ||
$("input.{{.Field}}").fileinput({{.OptionExt}}); | ||
$(".preview-{{.Field}} .close.fileinput-remove").on("click", function (e) { | ||
$(".{{.Field}}__delete_flag").val("1") | ||
}); | ||
</script> | ||
{{end}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,21 @@ | ||
{{define "form_rich_text"}} | ||
<div id="{{.Field}}-editor"> | ||
<p>欢迎使用 <b>wangEditor</b> 富文本编辑器</p> | ||
</div> | ||
<input type="hidden" id="{{.Field}}" name="{{.Field}}" value='{{.Value}}' | ||
placeholder="{{.Placeholder}}"> | ||
<script type="text/javascript"> | ||
editor = new window.wangEditor('#{{.Field}}-editor'); | ||
editor.customConfig.onchange = function (html) { | ||
{{$field := (js .Field)}} | ||
{{$field}}editor = new window.wangEditor('#{{.Field}}-editor'); | ||
{{$field}}editor.customConfig.onchange = function (html) { | ||
$('#{{.Field}}').val(html) | ||
}; | ||
editor.create(); | ||
editor.txt.html('{{.Value}}'); | ||
{{$field}}editor.customConfig.uploadImgServer = '/editor/imgs/upload'; | ||
{{$field}}editor.customConfig.uploadImgMaxSize = 3 * 1024 * 1024; | ||
{{$field}}editor.customConfig.uploadImgMaxLength = 5; | ||
{{$field}}editor.create(); | ||
{{$field}}editor.txt.html('{{.Value}}'); | ||
{{if not .Editable}} | ||
editor.$textElem.attr('contenteditable', false); | ||
{{$field}}editor.$textElem.attr('contenteditable', false); | ||
{{end}} | ||
</script> | ||
{{end}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters