From 07ca2d96c6f38a2a38f958d1771b6b9848f0ce0d Mon Sep 17 00:00:00 2001 From: zhouwenxuan <1175765986@qq.com> Date: 星期五, 15 十二月 2023 15:43:11 +0800 Subject: [PATCH] bug修改 --- public/tinymce/plugins/upfile/upfiles.html | 47 +++++++++++++++++++++++++++++++++++------------ 1 files changed, 35 insertions(+), 12 deletions(-) diff --git a/public/tinymce/plugins/upfile/upfiles.html b/public/tinymce/plugins/upfile/upfiles.html index bfe17d2..6279855 100644 --- a/public/tinymce/plugins/upfile/upfiles.html +++ b/public/tinymce/plugins/upfile/upfiles.html @@ -276,6 +276,12 @@ box-shadow: none; color: #222f3e; } +.hide-btn{ + display: none; +} +.show-btn{ + width: 80%;position: absolute;bottom:10px;left: 55px; margin: 0 auto;letter-spacing: 2px; display: block; +} </style> </head> @@ -286,12 +292,12 @@ <button class="removeall">清空列表</button></div> --> <ul id="file_list" class="tox"> <div role="tabpanel" class="tox-dialog__body-content" style="height: 336px; flex-basis: 210px;" aria-labelledby="aria_5965197812761603939544315"> - <div class="tox-form"> + <div class="tox-form" > <div class="tox-form__group"> <label class="tox-label" for="form-field_8471486645261603941857554">链接</label> <div class="tox-form__controls-h-stack"> <div class="tox-control-wrap"> - <input type="url" aria-errormessage="aria-invalid_348682591591603941621447" role="combobox" aria-autocomplete="list" aria-haspopup="true" tabindex="-1" data-alloy-tabstop="true" class="tox-textfield" aria-expanded="false" id="upFileUrlID"> + <input readonly type="url" aria-errormessage="aria-invalid_348682591591603941621447" role="combobox" aria-autocomplete="list" aria-haspopup="true" tabindex="-1" data-alloy-tabstop="true" class="tox-textfield" aria-expanded="false" id="upFileUrlID"> </div> </div> </div> @@ -310,7 +316,8 @@ </div> </div> </div> - <button title="上传文件" type="button" onclick="sendUpFile()" style="width: 80%;position: absolute;bottom:10px;left: 55px; margin: 0 auto;letter-spacing: 2px; display: block;" class="tox-button"><svg width="24" height="24" style="margin-top:5px;" ><path fill="#fff" d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-4v-2h4V8H5v10h4v2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zm-8 9.4l-2.3 2.3a1 1 0 1 1-1.4-1.4l4-4a1 1 0 0 1 1.4 0l4 4a1 1 0 0 1-1.4 1.4L13 13.4V20a1 1 0 0 1-2 0v-6.6z" fill-rule="nonzero"></path></svg><span style="top:-6px; position: relative; margin-left:5px;">开始上传</span></button> + <label class="hide-btn" ><span style="color: #207ab7;margin-left: 40%">附件上传中.....</span></label> + <button title="上传文件" type="button" onclick="sendUpFile()" class="tox-button show-btn"><svg width="24" height="24" style="margin-top:5px;" ><path fill="#fff" d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-4v-2h4V8H5v10h4v2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zm-8 9.4l-2.3 2.3a1 1 0 1 1-1.4-1.4l4-4a1 1 0 0 1 1.4 0l4 4a1 1 0 0 1-1.4 1.4L13 13.4V20a1 1 0 0 1-2 0v-6.6z" fill-rule="nonzero"></path></svg><span style="top:-6px; position: relative; margin-left:5px;">开始上传</span></button> </div> </ul> </div> @@ -321,6 +328,10 @@ var upload_handler = upfile.file_callback; var upfileData = "" var upfileUrl = null + var loading = false; + var hideBtn = document.querySelector('.hide-btn') + var showBtn = document.querySelector('.show-btn') + function addFile(file){ upfileData = file[0]; document.getElementById('upfileNameID').value=file[0].name; @@ -328,14 +339,26 @@ let inputUrl = document.getElementById('upFileUrlID'); let inputText = document.getElementById('upFileTextID'); function sendUpFile(){ + console.log(upfileData,'upfileData') + if(upfileData != ""){ + showBtn.style.display = 'none' + hideBtn.style.display = 'block' + } upload_handler(upfileData,function(url,_obj){ - inputUrl.value = url; - inputText.value ?'': inputText.value = url; - _obj&&_obj.text?inputText.value=_obj.text:''; - upfile.res.url = upfileUrl = url; - upfile.res.text = inputText.value; - + if(url!='失败'){ + inputUrl.value = url; + inputText.value ?'': inputText.value = url; + _obj&&_obj.originName?inputText.value=_obj.originName:''; + upfile.res.url = upfileUrl = url; + upfile.res.text = inputText.value; + hideBtn.style.display = 'none' + showBtn.style.display = 'block' + }else { + hideBtn.style.display = 'none' + showBtn.style.display = 'block' + } }) + } inputUrl.oninput = function(){upfile.res.url = inputUrl.value; upfileUrl=== null?inputText.value=inputUrl.value:'' } @@ -354,14 +377,14 @@ if(!(dropfiles.length>0)){return false;} addFile(dropfiles); }); - + var global$1 = upfile.tinymce.util.Tools.resolve('tinymce.util.Promise');var global$2 = upfile.tinymce.util.Tools.resolve('tinymce.Env');var global$3 = upfile.tinymce.util.Tools.resolve('tinymce.util.Delay'); var pickFile=function(a){return new global$1(function(e){var c=document.createElement("input");c.type="file";c.style.position="fixed";c.style.left="0";c.style.top="0";c.style.opacity="0.001";document.body.appendChild(c);var b=function(f){e(Array.prototype.slice.call(f.target.files))};c.addEventListener("change",b);var d=function(g){var f=function(){e([]);c.parentNode.removeChild(c)};if(global$2.os.isAndroid()&&g.type!=="remove"){global$3.setEditorTimeout(a,f,0)}else{f()}a.off("focusin remove",d)};a.on("focusin remove",d);c.click()})}; function getFile(){ - + pickFile(editor).then(function (files){ addFile(files); - }) + }) } </script> </body> -- Gitblit v1.9.2