remove kindeEditor

dev_aliyun2
harry 5 years ago
parent 6706cb5135
commit 54a44ebb61

@ -1,5 +1,6 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name=”Keywords” Content=”EduCoder,信息技术实践教学,精品课程网,慕课MOOC″>
@ -52,31 +53,6 @@
<!-- js css合并 文件优先级的问题 -->
<script type="text/javascript" src="%PUBLIC_URL%/js/js_min_all.js"></script>
<script type="text/javascript" src="%PUBLIC_URL%/js/flv.min.js"></script>
<!-- 在tpi js里加载这3个脚本 -->
<script>
(function () { // Scoping function to avoid globals
var href = location.href;
if (window.location.port === "3007") {
if (href.indexOf('/tasks/') != -1) {
document.write('<script type="text/javascript" src="https://newweb.educoder.net/assets/kindeditor/kindeditor.js"><\/script>');
document.write('<script type="text/javascript" src="/js/create_kindeditor.js"><\/script>');
document.write('<script type="text/javascript" src="https://newweb.educoder.net/javascripts/educoder/edu_application.js"><\/script>');
} else if (href.indexOf('/paths/') != -1) {
document.write('<script type="text/javascript" src="https://newweb.educoder.net/javascripts/educoder/edu_application.js"><\/script>');
}
} else {
if (href.indexOf('/tasks/') != -1) {
document.write('<script type="text/javascript" src="/assets/kindeditor/kindeditor.js"><\/script>');
document.write('<script type="text/javascript" src="%PUBLIC_URL%/js/create_kindeditor.js"><\/script>');
document.write('<script type="text/javascript" src="/javascripts/educoder/edu_application.js"><\/script>');
} else if (href.indexOf('/paths/') != -1) {
document.write('<script type="text/javascript" src="/javascripts/educoder/edu_application.js"><\/script>');
}
}
})();
</script>
<script type="text/javascript" src="https://cdn.bootcss.com/quill/1.3.7/quill.core.min.js"></script>
</body>

@ -109,16 +109,13 @@ class TPIContextProvider extends Component {
}
componentWillUnmount() {
this._updateCostTime();
this.costTimeInterval && window.clearInterval(this.costTimeInterval)
}
componentDidMount() {
window.$(window).unload( ()=>{
console.log(12321)
});
// TODO 登录状态的判断?
// request
// var shixunId = this.props.match.params.shixunId;
var stageId = this.props.match.params.stageId;
window.__fetchAllFlag = false;
@ -135,25 +132,8 @@ class TPIContextProvider extends Component {
})
}
}, 1000)
// 页面离开时存下用户的任务耗时
window.$(window).bind('beforeunload', function (e) {
console.log(111111)
this._updateCostTime();
})
// // 页面离开时存下用户的任务耗时
// window.$(window).unload( ()=>{
// this._updateCostTime();
// });
}
// force 评测通过后异步执行该方法强制同步costTime到服务端
_updateCostTime(async = false, force) {
const { game, loading } = this.state;

@ -2,34 +2,9 @@ import React, { Component } from 'react'
import { Tooltip } from 'antd'
import './Comment.css'
const $ = window.$
function pasteListener(event) {
if (event.clipboardData.types[0] === 'Files') {
event.preventDefault();
}
}
class CommentInput extends Component {
componentWillReceiveProps(newProps, newContext) {
// TODO 暂没有切实训的场景
if (newProps.challenge && newProps.challenge.shixun_id
&& (!this.props.challenge.shixun_id || newProps.challenge.shixun_id != this.props.challenge.shixun_id)) {
setTimeout(() => {
window.sd_create_editor_from_shixun_data(newProps.challenge.shixun_id, null, "100%", "Shixun");
if ($.browser.mozilla) {
setTimeout(() => {
const _body = $('.ke-edit-iframe')[0].contentWindow.document.body;
_body.removeEventListener('paste', pasteListener)
_body.addEventListener('paste', pasteListener)
}, 4200)
}
}, 100)
}
}
render() {
const { createNewComment, editedComment, commentOnChange, challenge, shixun, loading, praisePlus, gotNewReply, showNewReply } = this.props;
return (

@ -1,61 +0,0 @@
import React, { Component } from 'react';
const _origin = window.location.origin;
class CommentItemKEEditor extends Component {
componentDidUpdate(prevProps) {
const { item, currentReplyComment } = this.props;
if (prevProps.showReplyEditorFlag != this.props.showReplyEditorFlag &&
currentReplyComment && currentReplyComment.id == item.id) {
this.showOrHideEditor(currentReplyComment)
}
}
// 如果未初始化,会先初始化
showOrHideEditor = (comment) => {
const { user } = this.props;
console.log('initReply ', comment)
const $ = window.$;
var id = comment.id
var reply_message_el = `#reply_message_${id}`
var reply_iconup_el = `#reply_iconup_${id}`
if ($(reply_message_el).html() == "") {
$(".reply_to_message").html("");
$(reply_message_el).html(`<div className=\"orig_reply_box borderBottomNone reply_to_message\" id=\"reply_to_message_${id}\">\n <div class=\"homepagePostReplyPortrait mr15 imageFuzzy fl\" id=\"reply_image_${id}\"><a href=\"${user.user_url}\" target=\"_blank\" alt=\"用户头像\"><img alt=\"0?1442652658\" height=\"33\" src=\"${_origin}/images/${user.image_url}\" width=\"33\" /><\/a><\/div>\n <div class=\"orig_textarea fl\" style=\"margin-bottom: 0px\">\n <div nhname=\'new_message_${id}\'>\n <form accept-charset=\"UTF-8\" action=\"/discusses?challenge_id=118&amp;dis_id=61&amp;dis_type=Shixun\" data-remote=\"true\" id=\"new_comment_form\" method=\"post\"><div style=\"margin:0;padding:0;display:inline\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" /><input name=\"authenticity_token\" type=\"hidden\" value=\"HJTbMpfI8LKUpwghfkvgB2SaMmcIVyVdAezyKmzJ7FU=\" /><\/div>\n <input type=\"hidden\" id=\"dis_reply_id\" name=\"reply_id\" value=\"${id}\">\n <div nhname=\'toolbar_container_${id}\'><\/div>\n <textarea placeholder=\"有问题或有建议,请直接给我留言吧!\" id=\"comment_news_${id}\" style=\"display: none\" nhname=\'new_message_textarea_${id}\' name=\"content\"><\/textarea>\n <a id=\"new_message_submit_btn_${id}\" href=\"javascript:void(0)\" onclick=\"this.style.display=\'none\'\" class=\"mt10 task-btn task-btn-orange fr\">发送<\/a>\n <div class=\"cl\"><\/div>\n <p nhname=\'contentmsg_${id}\'><\/p>\n<\/form> <\/div>\n <div class=\"cl\"><\/div>\n <\/div>\n <div class=\"cl\"><\/div>\n<\/div>\n`); //" ide语法识别
$(reply_iconup_el).show();
$(function () {
window.sd_create_editor_from_data(id, null, "100%", "Discuss");
});
} else {
if ($(reply_message_el).is(':visible')) {
$(reply_message_el).hide();
} else {
$(reply_message_el).show();
}
}
// 自动focus
setTimeout(() => {
var iframe = $(`#reply_to_message_${id}`).find('iframe')[0]
iframe && iframe.contentDocument.body.focus()
}, 200)
}
render() {
const { match, history, item, user } = this.props
if (!item) {
return <div></div>
}
return (
<div>
<div className="cl"></div>
<div id={`reply_message_${item.id}`} className="reply_to_message"></div>
</div>
);
}
}
export default (CommentItemKEEditor);

@ -2,7 +2,6 @@ import React, { Component } from 'react';
import { Tooltip, Modal } from 'antd'
import { getImageUrl } from 'educoder';
import CommentItemKEEditor from './CommentItemKEEditor';
import CommentItemMDEditor from './CommentItemMDEditor';
import './Comment.css'
@ -101,36 +100,11 @@ class Comments extends Component {
}
initReply(comment) {
this.props.initReply && this.props.initReply(comment)
// 如果配置的使用kindEditor
if (window.__useKindEditor === true) {
const { user } = this.props;
console.log('initReply ', comment)
const $ = window.$;
var id = comment.id
var reply_message_el = `#reply_message_${id}`
var reply_iconup_el = `#reply_iconup_${id}`
if ($(reply_message_el).html() == "") {
$(".reply_to_message").html("");
$(reply_message_el).html(`<div className=\"orig_reply_box borderBottomNone reply_to_message\" id=\"reply_to_message_${id}\">\n <div class=\"homepagePostReplyPortrait mr15 imageFuzzy fl\" id=\"reply_image_${id}\"><a href=\"${user.user_url}\" target=\"_blank\" alt=\"用户头像\"><img alt=\"0?1442652658\" height=\"33\" src=\"${_origin}/images/${user.image_url}\" width=\"33\" /><\/a><\/div>\n <div class=\"orig_textarea fl\" style=\"margin-bottom: 0px\">\n <div nhname=\'new_message_${id}\'>\n <form accept-charset=\"UTF-8\" action=\"/discusses?challenge_id=118&amp;dis_id=61&amp;dis_type=Shixun\" data-remote=\"true\" id=\"new_comment_form\" method=\"post\"><div style=\"margin:0;padding:0;display:inline\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" /><input name=\"authenticity_token\" type=\"hidden\" value=\"HJTbMpfI8LKUpwghfkvgB2SaMmcIVyVdAezyKmzJ7FU=\" /><\/div>\n <input type=\"hidden\" id=\"dis_reply_id\" name=\"reply_id\" value=\"${id}\">\n <div nhname=\'toolbar_container_${id}\'><\/div>\n <textarea placeholder=\"有问题或有建议,请直接给我留言吧!\" id=\"comment_news_${id}\" style=\"display: none\" nhname=\'new_message_textarea_${id}\' name=\"content\"><\/textarea>\n <a id=\"new_message_submit_btn_${id}\" href=\"javascript:void(0)\" onclick=\"this.style.display=\'none\'\" class=\"mt10 task-btn task-btn-orange fr\">${this.props.buttonText || '发送'}<\/a>\n <div class=\"cl\"><\/div>\n <p nhname=\'contentmsg_${id}\'><\/p>\n<\/form> <\/div>\n <div class=\"cl\"><\/div>\n <\/div>\n <div class=\"cl\"><\/div>\n<\/div>\n`); //" ide语法识别
$(reply_iconup_el).show();
$(function () {
window.sd_create_editor_from_data(id, null, "100%", "Discuss");
});
} else {
if ($(reply_message_el).is(':visible')) {
$(reply_message_el).hide();
} else {
$(reply_message_el).show();
}
}
} else { // MD
this.setState({
currentReplyComment: comment,
showReplyEditorFlag: !this.state.showReplyEditorFlag
})
}
}
renderChildenComments(comment) {
if (!comment.children || comment.children.length === 0) {
@ -353,13 +327,6 @@ class Comments extends Component {
</span>
</p>
{/* __useKindEditor暂时没用到了TODO 可以去掉 */}
{window.__useKindEditor ? <CommentItemKEEditor showReplyEditorFlag={showReplyEditorFlag}
currentReplyComment={currentReplyComment}
item={item}
user={user}
>
</CommentItemKEEditor>
:
<CommentItemMDEditor showReplyEditorFlag={showReplyEditorFlag}
currentReplyComment={currentReplyComment}
item={item}
@ -367,7 +334,6 @@ class Comments extends Component {
buttonText={this.props.buttonText}
>
</CommentItemMDEditor>
}
</div>
</div>

@ -492,11 +492,7 @@ class TopicDetail extends Component {
}
// --------------------------------------------------------------------------------------------帖子獎勵 END
showCommentInput = () => {
if (window.__useKindEditor === true) {
this.refs.editor.showEditor();
} else {
this.refs.editor.showEditor();
}
}
initReply = (parent) => {
if (!parent.isAllChildrenLoaded) {

@ -655,17 +655,10 @@ class MemoDetail extends Component {
}
// --------------------------------------------------------------------------------------------帖子獎勵 END
showCommentInput = () => {
if (window.__useKindEditor === true) {
this.refs.editor.showEditor();
} else {
this.refs.editor.showEditor();
}
}
render() {
const { match, history } = this.props
const { memo, recommend_shixun, current_user, author_info } = this.props;
const { memo, author_info } = this.props;
const { comments, hasMoreComments, goldRewardDialogOpen } = this.state;
document.title = memo && memo.subject != undefined ? memo && memo.subject : "交流问答";
if (!memo || this.state.memoLoading) {
@ -673,14 +666,8 @@ class MemoDetail extends Component {
}
// --------------------------------------------------------------------------------------------帖子獎勵 END
showCommentInput = () => {
if (window.__useKindEditor === true) {
this.refs.editor.showEditor();
} else {
this.refs.editor.showEditor();
}
}
(_current_user.user_url = `/users/${_current_user.login}`);
memo.isDetailPage = true;
// TODO 图片上传地址
@ -809,12 +796,7 @@ class MemoDetail extends Component {
</div>
}
</div>
{window.__useKindEditor === true ?
<MemoDetailKEEditor ref="editor" memo={memo} {...this.props}></MemoDetailKEEditor>
:
<MemoDetailMDEditor ref="editor" memo={memo} {...this.props}></MemoDetailMDEditor>
}
{/* onClick={ this.createNewComment } */}
<div className="padding40 bor-bottom-greyE memoReplies commentsDelegateParent"
style={{ display: (comments && !!comments.length) ? 'block' : 'none' }}>

Loading…
Cancel
Save