From 54a44ebb612bc4eaf52070c39b120a1d8e885bba Mon Sep 17 00:00:00 2001 From: harry Date: Wed, 25 Mar 2020 14:35:51 +0800 Subject: [PATCH] remove kindeEditor --- public/react/public/index.html | 28 +--- .../react/src/context/TPIContextProvider.js | 24 +--- .../react/src/modules/comment/CommentInput.js | 25 ---- .../modules/comment/CommentItemKEEditor.js | 61 -------- public/react/src/modules/comment/Comments.js | 48 +------ .../src/modules/courses/boards/TopicDetail.js | 136 +++++++++--------- public/react/src/modules/forums/MemoDetail.js | 26 +--- 7 files changed, 81 insertions(+), 267 deletions(-) delete mode 100644 public/react/src/modules/comment/CommentItemKEEditor.js diff --git a/public/react/public/index.html b/public/react/public/index.html index f95b436f6..e2fb0c807 100755 --- a/public/react/public/index.html +++ b/public/react/public/index.html @@ -1,5 +1,6 @@ + @@ -37,7 +38,7 @@ - + @@ -52,31 +53,6 @@ - - - diff --git a/public/react/src/context/TPIContextProvider.js b/public/react/src/context/TPIContextProvider.js index 4afd2c109..6efe4d3e9 100644 --- a/public/react/src/context/TPIContextProvider.js +++ b/public/react/src/context/TPIContextProvider.js @@ -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; diff --git a/public/react/src/modules/comment/CommentInput.js b/public/react/src/modules/comment/CommentInput.js index 13e5a2d53..56d1c0f7a 100644 --- a/public/react/src/modules/comment/CommentInput.js +++ b/public/react/src/modules/comment/CommentInput.js @@ -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 ( diff --git a/public/react/src/modules/comment/CommentItemKEEditor.js b/public/react/src/modules/comment/CommentItemKEEditor.js deleted file mode 100644 index d9fecdc04..000000000 --- a/public/react/src/modules/comment/CommentItemKEEditor.js +++ /dev/null @@ -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(`
\n
\"0?1442652658\"<\/a><\/div>\n
\n
\n
<\/div>\n \n
<\/div>\n