提交 0cfb8e85 编写于 作者: huangxuan258's avatar huangxuan258

修复web端编辑器被替换成移动端编辑器问题

上级 09ee8e79
{if $setting['editor_choose']==0}
<!--引入wangEditor.css--> <!--引入wangEditor.css-->
<link rel="stylesheet" type="text/css" href="{SITE_URL}static/js/wangeditor/pcwangeditor/css/wangEditor.min.css"> <link rel="stylesheet" type="text/css" href="{SITE_URL}static/js/wangeditor/pcwangeditor/css/wangEditor.min.css">
<!--引入jquery和wangEditor.js--> <!--注意javascript必须放在body最后否则可能会出现问题--> <!--引入jquery和wangEditor.js--> <!--注意javascript必须放在body最后否则可能会出现问题-->
<script src="{SITE_URL}static/js/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="{SITE_URL}static/js/wangeditor/pcwangeditor/js/wangEditor.js"></script> <script type="text/javascript" src="{SITE_URL}static/js/wangeditor/pcwangeditor/js/wangEditor.js"></script>
<script>
$.noConflict() <textarea id="editor" name="content" style="width:100%;height:200px;">
</script> {if $this->uri->segment ( 2 )!='view'&&$this->uri->segment ( 1 )=='question'||$this->uri->segment ( 2 )=='editxinzhi'}
<style>
.editor_container {
{if $navtitle=='编辑问题'} {$question['description']} {/if}
height:auto;
background-color: #fff;
text-align: left;
text-shadow: none;
margin:10px 10px;
}
.wangEditor-drop-panel{
left:0px;
margin-left:0px;
width:100%;
}
</style>
<div class="editor_container">
<textarea id="editor" name="content" style="width:100%;height:100px;">
{if $this->uri->segment ( 2 )!='view'&&$this->uri->segment ( 1 )=='question'||$this->uri->segment ( 2 )=='editxinzhi'}
{if $navtitle=='编辑问题'} {eval echo htmlspecialchars_decode(htmlspecialchars_decode($question['description']));} {/if}
{if $this->uri->segment ( 1 )!='question'} {if $this->uri->segment ( 1 )!='question'}
{eval echo replacewords($topic['describtion']);} {eval echo replacewords($topic['describtion']);}
{/if} {/if}
{if $user['groupid']==1||$user['uid']==$answer['authorid']&&$this->uri->segment ( 2 )=='editanswer'&&$this->uri->segment ( 1 )=='question'} {eval echo htmlspecialchars_decode($answer['content']);} {/if} {if $user['groupid']==1||$user['uid']==$answer['authorid']&&$this->uri->segment ( 2 )=='editanswer'&&$this->uri->segment ( 1 )=='question'} {eval echo htmlspecialchars_decode($answer['content']);} {/if}
{/if} {/if}
</textarea> </textarea>
<div style="margin:10px auto;position:relative;">
<input id="upvedio" type="file" onchange="uploadVedio(this)" accept="video/*" capture="camcorder" style="position:absolute;width:70px;left:0px;top:3px;cursor:pointer;opacity:0;">
<span style="color:#0084ff;font-size: 13px;" class="uploadvedio">本地上传视频</span>
</div>
</div>
<script type="text/javascript"> <script type="text/javascript">
var testeditor='999';
var editor=null;
var isueditor=0;
// 初始化编辑器的内容
// 初始化编辑器的内容 var editor = new wangEditor('editor');
editor = new wangEditor('editor'); // 自定义配置
// 自定义配置 editor.config.uploadImgUrl = g_site_url+"index.php?attach/upimg" ;
editor.config.uploadImgUrl = "{url attach/upimg}" ; editor.config.uploadImgFileName = 'wangEditorMobileFile';
editor.config.uploadImgFileName = 'wangEditorMobileFile'; // 阻止输出log
// 阻止输出log wangEditor.config.printLog = false;
editor.config.printLog = true; // 普通的自定义菜单
editor.config.menus = [
editor.config.hideLinkImg = true;
// 普通的自定义菜单 {$setting['editor_wtoolbars']}
// 普通的自定义菜单 ];
editor.config.menus = [ // 将全屏时z-index修改为20000
// editor.config.zindex =-1;
editor.create();
'eraser', $(".wangEditor-container").css("z-index","1");
'quote',
'emotion', </script>
'|', {else}
'img', <script type="text/javascript" src="{SITE_URL}static/js/neweditor/ueditor.config.js"></script>
<script type="text/javascript" src="{SITE_URL}static/js/neweditor/ueditor.all.js"></script>
<script type="text/plain" id="editor" name="content" style="width:100%;height:200px;">{if $this->uri->segment ( 2 )!='view'&&$this->uri->segment ( 1 )=='question'||$this->uri->segment ( 2 )=='editxinzhi'}{if $navtitle=='编辑问题'}{$question['description']} {/if}{if $this->uri->segment ( 1 )!='question'}{eval echo replacewords($topic['describtion']);}{/if}{if $user['groupid']==1||$user['uid']==$answer['authorid']&&$this->uri->segment ( 2 )=='editanswer'&&$this->uri->segment ( 1 )=='question'} {eval echo htmlspecialchars_decode($answer['content']);}{/if}{/if}</script>
'undo', <script type="text/javascript">
'redo', var isueditor=1;
'fullscreen' ]; var editor = UE.getEditor('editor',{
//这里可以选择自己需要的工具按钮名称,此处仅选择如下五个
// 将全屏时z-index修改为20000 toolbars:[[{$setting['editor_toolbars']}]],
// editor.config.zindex =-1;
initialContent:'',
editor.create();
$(".wangEditor-container").css("z-index","1");
$(".wangEditor-txt").css("height","auto"); //关闭字数统计
function uploadVedio(file){ wordCount:false,
//关闭elementPath
if (file.files && file.files[0]) elementPathEnabled:false,
{ //默认的编辑区域高度
initialFrameHeight:250
$(".uploadvedio").html("视频上传中...."); //更多其他参数,请参考ueditor.config.js中的配置项
$("#upvedio").attr("disabled","disabled"); //更多其他参数,请参考ueditor.config.js中的配置项
var type = "file"; });
var ischeck=0;
</script>
var formData = new FormData();
formData.append(type, $("#upvedio")[0].files[0]);
formData.append("addvedio",0); {/if}
\ No newline at end of file
$.ajax({
type: "POST",
url: '{url attach/uploadvedio}',
data: formData,
processData: false,
contentType: false,
//返回数据的格式
datatype: "json",//"xml", "html", "script", "json", "jsonp", "text".
beforeSend: function () {
ajaxloading("提交中...");
},
success: function (data) {
var data=eval("("+data+")");
if(data.code==200){
var _strinfo=data.fileurl;
$(".wangEditor-txt").append( '<video style="max-width:100%;" controls> <source src="'+_strinfo+'" type="video/mp4"> </video>');
}else{
alert(data.msg)
}
},
complete: function () {
$(".uploadvedio").html("本地上传视频");
$("#upvedio").removeAttr("disabled");
removeajaxloading();
},
//调用出错执行的函数
error: function(){
removeajaxloading();
$("#upvedio").removeAttr("disabled");
//请求出错处理
alert("上传出错");
}
});
}
}
</script>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册