diff --git a/app/controllers/admins/department_applies_controller.rb b/app/controllers/admins/department_applies_controller.rb index b6dece1de..458721e34 100644 --- a/app/controllers/admins/department_applies_controller.rb +++ b/app/controllers/admins/department_applies_controller.rb @@ -74,7 +74,10 @@ class Admins::DepartmentAppliesController < Admins::BaseController @depart_apply&.applied_messages&.update_all(status:3) if params[:tip] == 'unapplied' #未审批时候删除 - UserExtension.where(department_id: @depart_apply.department_id).update_all(department_id:nil) + user_extens = UserExtension.where(department_id: @depart_apply.department_id) + user_extens.update_all(department_id:nil) + User.where(id: user_extens.pluck(:user_id)).update_all(profile_completed:false) + tiding_params = { user_id: @depart_apply.user_id, trigger_user_id: 0, diff --git a/app/views/admins/department_applies/shared/_list.html.erb b/app/views/admins/department_applies/shared/_list.html.erb index bdd518a8f..0a1d803be 100644 --- a/app/views/admins/department_applies/shared/_list.html.erb +++ b/app/views/admins/department_applies/shared/_list.html.erb @@ -16,7 +16,7 @@ <%= apply.id %> <%= apply.name %> <%= apply.school.try(:name) %> - <%= apply.user.show_real_name %> + <%= apply&.user&.real_name %> <%= format_time apply.created_at %> <%= agree_link '批准', agree_admins_department_apply_path(apply, element: ".department-apply-#{apply.id}"), 'data-confirm': '确认批准通过?' %> diff --git a/app/views/admins/library_applies/shared/_list.html.erb b/app/views/admins/library_applies/shared/_list.html.erb index c6f9825dc..783d0db30 100644 --- a/app/views/admins/library_applies/shared/_list.html.erb +++ b/app/views/admins/library_applies/shared/_list.html.erb @@ -27,7 +27,7 @@ <% end %> - <%= user.real_name %> + <%= link_to user&.real_name,"/users/#{user&.login}", target: "_blank" %> <%= link_to library.title, library_path(library), :target => "_blank" %> <%= overflow_hidden_span library.content[0..50]%> <%= apply.updated_at.strftime('%Y-%m-%d %H:%M') %> diff --git a/app/views/admins/project_package_applies/shared/_list.html.erb b/app/views/admins/project_package_applies/shared/_list.html.erb index 736d939f9..d94c96184 100644 --- a/app/views/admins/project_package_applies/shared/_list.html.erb +++ b/app/views/admins/project_package_applies/shared/_list.html.erb @@ -27,7 +27,7 @@ <% end %> - <%= user.real_name %> + <%= link_to user&.real_name,"/users/#{user&.login}", target: "_blank" %> <%= link_to package.title, "/crowdsourcing/#{package.id}", :target => "_blank" %> <%= overflow_hidden_span package.content[0..50] %> <%= apply.updated_at.strftime('%Y-%m-%d %H:%M') %> diff --git a/app/views/admins/shixun_authorizations/shared/_list.html.erb b/app/views/admins/shixun_authorizations/shared/_list.html.erb index ce3b4ca43..042e4096e 100644 --- a/app/views/admins/shixun_authorizations/shared/_list.html.erb +++ b/app/views/admins/shixun_authorizations/shared/_list.html.erb @@ -27,7 +27,7 @@ <% end %> - <%= user.real_name %> + <%= link_to user&.real_name,"/users/#{user&.login}", target: "_blank" %> <%= link_to "/shixuns/#{shixun.identifier}", target: '_blank' do %> <%= overflow_hidden_span shixun.name, width: 300 %> diff --git a/app/views/admins/shixun_settings/shared/_td.html.erb b/app/views/admins/shixun_settings/shared/_td.html.erb index efdec4f8d..f72dc8a38 100644 --- a/app/views/admins/shixun_settings/shared/_td.html.erb +++ b/app/views/admins/shixun_settings/shared/_td.html.erb @@ -21,7 +21,7 @@ <%= image_tag(imageUrl, width: 60, height: 40, class: "preview-image shixun-image-#{shixun.id}", data: { toggle: 'tooltip', title: '点击预览' }, style: imageExists ? '' : 'display:none') %> <%= javascript_void_link imageExists ? '重新上传' : '上传图片', class: 'action upload-shixun-image-action', data: { source_id: shixun.id, source_type: 'Shixun', toggle: 'modal', target: '.admin-upload-file-modal' } %> -<%= link_to shixun.owner.try(:show_real_name),"/users/#{shixun.owner.login}",target:'_blank' %> +<%= link_to shixun.owner.try(:real_name),"/users/#{shixun.owner.login}",target:'_blank' %> <% if shixun.status.to_i < 3 %> <%= link_to "关闭", admins_shixun_setting_path(shixun,status:3,page_no:page_no),method: :put, :class => "", :remote => true %> diff --git a/app/views/admins/shixuns/shared/_list.html.erb b/app/views/admins/shixuns/shared/_list.html.erb index 64fb32d56..b5c7cec3b 100644 --- a/app/views/admins/shixuns/shared/_list.html.erb +++ b/app/views/admins/shixuns/shared/_list.html.erb @@ -33,7 +33,7 @@ <%= shixun.challenges.where(:st => 0).size %> <%= shixun.challenges.where(:st => 1).size %> <%= shixun_authentication_status shixun %> - <%= link_to shixun.owner.try(:show_real_name),"/users/#{shixun.owner.try(:login)}",target:'_blank' %> + <%= link_to shixun.owner.try(:real_name),"/users/#{shixun.owner.try(:login)}",target:'_blank' %> <%= format_time shixun.created_at %> class="ml-3 mr5 magic-checkbox" id="join_teacher_homepage_<%= shixun.id %>"> diff --git a/app/views/admins/subject_authorizations/shared/_list.html.erb b/app/views/admins/subject_authorizations/shared/_list.html.erb index 7b8da800d..28a699e22 100644 --- a/app/views/admins/subject_authorizations/shared/_list.html.erb +++ b/app/views/admins/subject_authorizations/shared/_list.html.erb @@ -29,7 +29,7 @@ <% end %> - <%= user.real_name %> + <%= link_to user&.real_name,"/users/#{user&.login}", target: "_blank" %> <%= link_to "/paths/#{subject.id}", target: '_blank' do %> <%= overflow_hidden_span subject.name, width: 300 %> diff --git a/app/views/admins/unit_applies/shared/_apply_item.html.erb b/app/views/admins/unit_applies/shared/_apply_item.html.erb index d8a2bdcc4..084826d72 100644 --- a/app/views/admins/unit_applies/shared/_apply_item.html.erb +++ b/app/views/admins/unit_applies/shared/_apply_item.html.erb @@ -4,7 +4,7 @@ <%= "#{apply&.province.to_s}"+"#{apply&.city.to_s}" %> <%= overflow_hidden_span apply.address %> -<%= apply.user.try(:show_real_name) %> +<%= link_to apply&.user&.real_name, "/users/#{apply&.user&.login}", target: "_blank" %> <%= format_time apply.created_at %> <%= agree_link '批准', agree_admins_unit_apply_path(apply, element: ".unit-apply-#{apply.id}"), 'data-confirm': '确认批准通过?' %> diff --git a/app/views/admins/video_applies/shared/_list.html.erb b/app/views/admins/video_applies/shared/_list.html.erb index 8ddbfb3ca..5e472bd4b 100644 --- a/app/views/admins/video_applies/shared/_list.html.erb +++ b/app/views/admins/video_applies/shared/_list.html.erb @@ -28,7 +28,7 @@ <% end %> - <%= user.real_name %> + <%= link_to user&.real_name,"/users/#{user&.login}", target: "_blank" %> <%= link_to video.title, video.file_url, :target => "_blank" %> <%= video.filesize&.to_s(:human_size) %> <%= link_to "播放视频",video.file_url, target: "_blank" %> diff --git a/public/react/src/modules/courses/busyWork/CommonWorkAppraise.js b/public/react/src/modules/courses/busyWork/CommonWorkAppraise.js index 698fbd398..04ccb3ea1 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkAppraise.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkAppraise.js @@ -254,7 +254,7 @@ class CommonWorkAppraise extends Component{ 关联项目
- {project_info.name} + {project_info.name}
} diff --git a/public/react/src/modules/courses/busyWork/NewWork.js b/public/react/src/modules/courses/busyWork/NewWork.js index a17dc8ed2..411cb351b 100644 --- a/public/react/src/modules/courses/busyWork/NewWork.js +++ b/public/react/src/modules/courses/busyWork/NewWork.js @@ -7,7 +7,6 @@ import { WordsBtn, getUrl, ConditionToolTip, appendFileSizeToUploadFile, appendF , getUploadActionUrl } from 'educoder' import TPMMDEditor from '../../tpm/challengesnew/TPMMDEditor'; import CBreadcrumb from '../common/CBreadcrumb' -import NewWorkForm from './NewWorkForm' const confirm = Modal.confirm; const $ = window.$ @@ -19,8 +18,15 @@ class NewWork extends Component{ this.answerMdRef = React.createRef(); this.state={ + title_value:"", + title_num: 0, + contentFileList: [], + answerFileList: [], + workLoaded: false, + base_on_project: true, category: {}, - course_name: '' + min_num: 2, + max_num: 10, } } componentDidMount () { @@ -60,13 +66,56 @@ class NewWork extends Component{ .then((response) => { if (response.data.name) { const data = response.data; - data.isEdit = this.isEdit + + const contentFileList = data.attachments.map(item => { + return { + id: item.id, + uid: item.id, + name: appendFileSizeToUploadFile(item), + url: item.url, + filesize: item.filesize, + status: 'done' + } + }) + const answerFileList = data.ref_attachments.map(item => { + return { + id: item.id, + uid: item.id, + name: appendFileSizeToUploadFile(item), + url: item.url, + filesize: item.filesize, + status: 'done' + } + }) + this.setState({ - course_id: data.course_id, - course_name: data.course_name, - category: data.category, + ...data, + // course_id: data.course_id, + // course_name: data.course_name, + // category: data.category, + title_num: parseInt(data.name.length), + workLoaded: true, + init_min_num: data.min_num, + init_max_num: data.max_num, + // description: data.description, + reference_answer: data.reference_answer, + contentFileList, + answerFileList, + }, () => { + setTimeout(() => { + this.contentMdRef.current.setValue(data.description || '') + this.answerMdRef.current.setValue(data.reference_answer || '') + + }, 2000) + + this.props.form.setFieldsValue({ + title: data.name, + description: data.description || '', + reference_answer: data.reference_answer || '', + }); + }) - this.newWorkFormRef.initValue(response.data) + } }) .catch(function (error) { @@ -74,15 +123,72 @@ class NewWork extends Component{ }); } - onCancel = () => { - this.props.toListPage(this.props.match.params, this.state.category.category_id) + // 输入title + changeTitle=(e)=>{ + console.log(e.target.value.length); + this.setState({ + title_num: parseInt(e.target.value.length) + }) } + handleSubmit = () => { + const courseId = this.state.course_id || this.props.match.params.coursesId ; + + this.props.form.validateFieldsAndScroll((err, values) => { + console.log(values) + const mdContnet = this.contentMdRef.current.getValue().trim(); + console.log(mdContnet) + values.description = mdContnet; + // return; + + {/* max={has_commit ? init_min_num : null } */} + {/* min={has_commit ? init_max_num : (min_num == undefined ? 2 : min_num + 1) } */} + // 已有提交作品,人数范围只能扩大 + const { has_commit, max_num, init_max_num, min_num, init_min_num } = this.state; + if (has_commit) { + if (max_num < init_max_num || min_num > init_min_num) { + this.props.showNotification(`已有提交作品,人数范围只能扩大(原设置为:${init_min_num} - ${init_max_num})`) + return; + } + } - doEdit = (params) => { + // const errKeys = Object.keys(err); // || errKeys.length == 1 && errKeys[0] == 'content' && mdContnet + if (!err) { + if (this.isEdit) { + this.doEdit(courseId, values) + } else { + this.doNew(courseId, values) + } + + } else { + $("html").animate({ scrollTop: $('html').scrollTop() - 100 }) + } + }) + } + doEdit = (courseId, values) => { const workId = this.props.match.params.workId const newUrl = `/homework_commons/${workId}.json` - axios.put(newUrl, params) + let attachment_ids = this.state.contentFileList.map(item => { + return item.response ? item.response.id : item.id + }) + let reference_attachment_ids = this.state.answerFileList.map(item => { + return item.response ? item.response.id : item.id + }) + + const { min_num, max_num, base_on_project, category } = this.state + const isGroup = this.props.isGroup() + axios.put(newUrl, { + type: isGroup ? 3 : 1, + name: values.title, + description: values.description, + reference_answer: values.reference_answer, + attachment_ids, + reference_attachment_ids, + + min_num, + max_num, + base_on_project + }) .then((response) => { if (response.data.status == 0) { this.props.showNotification('保存成功') @@ -93,11 +199,30 @@ class NewWork extends Component{ console.log(error); }); } - doNew = (params) => { - const coursesId = this.props.match.params.coursesId - const newUrl = `/courses/${coursesId}/homework_commons.json` + doNew = (courseId, values) => { + const newUrl = `/courses/${courseId}/homework_commons.json` - axios.post(newUrl, params) + let attachment_ids = this.state.contentFileList.map(item => { + return item.response ? item.response.id : item.id + }) + let reference_attachment_ids = this.state.answerFileList.map(item => { + return item.response ? item.response.id : item.id + }) + const isGroup = this.props.isGroup() + const { min_num, max_num, base_on_project, category } = this.state + + axios.post(newUrl, { + type: isGroup ? 3 : 1, + name: values.title, + description: values.description, + reference_answer: values.reference_answer, + attachment_ids, + reference_attachment_ids, + + min_num, + max_num, + base_on_project + }) .then((response) => { if (response.data.status == 0) { this.props.showNotification('保存成功') @@ -140,31 +265,119 @@ class NewWork extends Component{ } } + deleteAttachment = (file, stateName) => { + // 初次上传不能直接取uid + const url = `/attachments/${file.response ? file.response.id : file.uid}.json` + axios.delete(url, { + }) + .then((response) => { + if (response.data) { + const { status } = response.data; + if (status == 0) { + console.log('--- success') + + this.setState((state) => { + const index = state[stateName].indexOf(file); + const newFileList = state[stateName].slice(); + newFileList.splice(index, 1); + return { + [stateName]: newFileList, + }; + }); + } + } + }) + .catch(function (error) { + console.log(error); + }); + } + max_num_change = (val) => { + if (val < 2) { + this.setState({ + max_num: 2, + }) + return; + } + const { min_num } = this.state; + this.setState({ + max_num: val, + min_num: val <= min_num ? val - 1 : min_num + }) + } + min_num_change = (val) => { + this.setState({ min_num: val }) + } + base_on_project_change = () => { + this.setState({ base_on_project: !this.state.base_on_project }) + } render(){ let {typeId,coursesId,pageType}=this.props.match.params; - + const { getFieldDecorator } = this.props.form; const isGroup = this.props.isGroup() const moduleName = !isGroup? "普通作业":"分组作业"; const moduleEngName = this.props.getModuleName() let{ - course_name, category + title_value, contentFileList, answerFileList, max_num, min_num, base_on_project, + init_max_num, init_min_num, + title_num, course_name, category, has_commit, has_project }=this.state const { current_user } = this.props - const courseId = this.state.course_id || coursesId ; + const courseId = this.state.course_id || this.props.match.params.coursesId ; const isEdit = this.isEdit; - - const common = { - onCancel:this.onCancel, - isGroup: this.props.isGroup, - doNew: this.doNew, - doEdit: this.doEdit, - } + if ((isEdit == undefined || isEdit) && !this.state.workLoaded) { + return '' + } + const uploadProps = { + width: 600, + fileList: contentFileList, + multiple: true, + // https://github.com/ant-design/ant-design/issues/15505 + // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。 + // showUploadList: false, + action: `${getUploadActionUrl()}`, + onChange: this.handleContentUploadChange, + onRemove: (file) => this.onAttachmentRemove(file, 'contentFileList'), + beforeUpload: (file) => { + console.log('beforeUpload', file.name); + const isLt150M = file.size / 1024 / 1024 < 150; + if (!isLt150M) { + this.props.showNotification('文件大小必须小于150MB!'); + } + return isLt150M; + }, + }; + const answerUploadProps = { + width: 600, + fileList: answerFileList, + multiple: true, + // https://github.com/ant-design/ant-design/issues/15505 + // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。 + // showUploadList: false, + action: `${getUrl()}/api/attachments.json`, + onChange: this.handleAnswerUploadChange, + onRemove: (file) => this.onAttachmentRemove(file, 'answerFileList'), + beforeUpload: (file) => { + console.log('beforeUpload', file.name); + const isLt150M = file.size / 1024 / 1024 < 150; + if (!isLt150M) { + this.props.showNotification('文件大小必须小于150MB!'); + } + return isLt150M; + }, + }; return(
+ {/*

+ {course_name} + > + {typeId==1 ?"普通作业":"分组作业"} + > + {pageType==="new"?"新建":"编辑"} +

*/} {this.isEdit ?"编辑":"新建"}{ moduleName } + {/* history.goBack() + this.props.toListPage(this.props.match.params, category.category_id)} + */} this.props.history.goBack()}> 返回

+ {/* onSubmit={this.handleSubmit} */} - {this.newWorkFormRef = ref}} - > +
+ + {getFieldDecorator('title', { + rules: [{ + required: true, message: '请输入标题' + }], + })( + + )} + + + + {/* TpmQuestionEdit 这个没出现抖动 */} + { + {getFieldDecorator('description', { + rules: [{ + required: true, message: '请输入作业内容和要求' + }], + })( + + )} + } + + + (单个文件150M以内) + + + + { isGroup && + + {getFieldDecorator('personNum', { + rules: [{ + required: false + // required: true, message: '请输入最小人数和最大人数' + }], + })( +
+

+ + {/* max={has_commit ? init_min_num : null } */} + + + + ~ + {/* min={has_commit ? init_max_num : (min_num == undefined ? 2 : min_num + 1) } */} + + + + +

+

+ + 基于项目实施 + + + +

+
+ )} +
+ } + + {getFieldDecorator('reference_answer', { + rules: [{ + required: false + }], + })( + + )} + + + (单个文件150M以内) + + + + + +
) } } - -export default NewWork; \ No newline at end of file +const WrappedBoardsNew = Form.create({ name: 'NewWork' })(NewWork); +export default WrappedBoardsNew; \ No newline at end of file diff --git a/public/react/src/modules/courses/coursesPublic/CoursesMarkdown.js b/public/react/src/modules/courses/coursesPublic/CoursesMarkdown.js index 3538aaf57..4510a7080 100644 --- a/public/react/src/modules/courses/coursesPublic/CoursesMarkdown.js +++ b/public/react/src/modules/courses/coursesPublic/CoursesMarkdown.js @@ -139,7 +139,7 @@ function create_editorMD(id, width, high, placeholder, imageUrl, callback, initV }); $("#" + _id + " [type=\"inline\"]").bind("click", function () { - _editorName.cm.replaceSelection("$$$$"); + _editorName.cm.replaceSelection("`$$$$`"); var __Cursor = _editorName.cm.getDoc().getCursor(); _editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 2); _editorName.cm.focus(); diff --git a/public/react/src/modules/courses/new/CoursesNew.js b/public/react/src/modules/courses/new/CoursesNew.js index ec73cc17d..a2cc45916 100644 --- a/public/react/src/modules/courses/new/CoursesNew.js +++ b/public/react/src/modules/courses/new/CoursesNew.js @@ -335,11 +335,19 @@ class CoursesNew extends Component { // this.props.history.push(this.props.current_user.first_category_url); // } // window.history.go(-1) - if(id===undefined){ - this.props.history.goBack() - }else{ - this.props.history.push(this.props.current_user.first_category_url); - } + try { + if(id===undefined){ + this.props.history.push("/"); + }else{ + if(this.props.current_user.first_category_url===undefined){ + this.props.history.push("/"); + }else{ + this.props.history.push(this.props.current_user.first_category_url); + } + } + }catch (e) { + this.props.history.push("/"); + } } diff --git a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js index e74627c03..11a9b2f34 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js @@ -168,27 +168,29 @@ class ShixunWorkReport extends Component { // }) // // } + let{work_comment,work_comment_hidden}=this.state; this.setState({ showAppraiseModaltype:true, + work_comment_hidden:work_comment===null||work_comment===undefined?this.state.work_type?true:false:work_comment_hidden, }) } hideAppraiseModal=()=>{ - let{data,work_comment}=this.state; + let{work_comment,work_comment_hidden}=this.state; this.setState({ showAppraiseModaltype:false, - work_comment_hidden:data&&data.work_comment_hidden===true?true:work_comment!=null?true:false, + work_comment_hidden:work_comment===null||work_comment===undefined?this.state.work_type===1?true:false:work_comment_hidden, }) } showAppraiseModals=(list,type)=>{ - let{data,work_comment}=this.state; + this.setState({ showAppraiseModaltype:false, - work_comment_hidden:data&&data.work_comment_hidden===true?true:work_comment!=null?true:false, + work_comment_hidden:type===0?false:true, work_comment:list, work_type:type, showAppraiseModals:true, - showAppraiseModalsshow:true + showAppraiseModalsshow:true, }) } isdeleteModal=()=>{ @@ -258,7 +260,7 @@ class ShixunWorkReport extends Component { Cancel={()=>this.hideAppraiseModal()} showCancel={(list,type)=>this.showAppraiseModals(list,type)} work_comment={this.state.work_comment} - work_type={this.state.work_type} + work_type={work_comment===null||work_comment===undefined?this.state.work_type:work_comment_hidden===true?1:0} />:""}
diff --git a/public/react/src/modules/courses/shixunHomework/shixunreport/ConclusionEvaluation.js b/public/react/src/modules/courses/shixunHomework/shixunreport/ConclusionEvaluation.js index 3ae69dfaa..d5c8aa57f 100644 --- a/public/react/src/modules/courses/shixunHomework/shixunreport/ConclusionEvaluation.js +++ b/public/react/src/modules/courses/shixunHomework/shixunreport/ConclusionEvaluation.js @@ -81,7 +81,7 @@ class ConclusionEvaluation extends Component { ), }, { - title: '耗时', + title: '实战耗时', key: 'elapsed', dataIndex: 'elapsed', diff --git a/public/react/src/modules/courses/shixunHomework/shixunreport/OfficialAcademicTranscript.js b/public/react/src/modules/courses/shixunHomework/shixunreport/OfficialAcademicTranscript.js index 2195228e1..2a79ce829 100644 --- a/public/react/src/modules/courses/shixunHomework/shixunreport/OfficialAcademicTranscript.js +++ b/public/react/src/modules/courses/shixunHomework/shixunreport/OfficialAcademicTranscript.js @@ -150,7 +150,7 @@ class OfficialAcademicTranscript extends Component { ), }, { - title: '耗时', + title: '实战耗时', key: 'elapsedtime', dataIndex: 'elapsedtime', diff --git a/public/react/src/modules/projectPackages/MDEditors.js b/public/react/src/modules/projectPackages/MDEditors.js index 2c11e0895..61e26db23 100644 --- a/public/react/src/modules/projectPackages/MDEditors.js +++ b/public/react/src/modules/projectPackages/MDEditors.js @@ -166,7 +166,7 @@ function create_editorMD(id, width, high, placeholder, imageUrl, callback, initV }); $("#" + _id + " [type=\"inline\"]").bind("click", function () { - _editorName.cm.replaceSelection("$$$$"); + _editorName.cm.replaceSelection("`$$$$`"); var __Cursor = _editorName.cm.getDoc().getCursor(); _editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 2); _editorName.cm.focus(); diff --git a/public/react/src/modules/tpm/challengesnew/TPMMDEditor.js b/public/react/src/modules/tpm/challengesnew/TPMMDEditor.js index 10cddfd31..ba4f1bc21 100644 --- a/public/react/src/modules/tpm/challengesnew/TPMMDEditor.js +++ b/public/react/src/modules/tpm/challengesnew/TPMMDEditor.js @@ -62,7 +62,7 @@ window.md_rec_data = md_rec_data; function md_elocalStorage(editor,mdu,id){ if (window.sessionStorage){ var oc = window.sessionStorage.getItem('content'+mdu); - if(oc !== null ){ + if(oc !== null && oc != editor.getValue()){ console.log("#e_tips_"+id) $("#e_tips_"+id).data('editor', editor); var h = '您上次有已保存的数据,是否恢复 ? / 不恢复'; @@ -169,7 +169,7 @@ function create_editorMD(id, width, high, placeholder, imageUrl, callback, initV }); $("#" + _id + " [type=\"inline\"]").bind("click", function () { - _editorName.cm.replaceSelection("$$$$"); + _editorName.cm.replaceSelection("`$$$$`"); var __Cursor = _editorName.cm.getDoc().getCursor(); _editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 2); _editorName.cm.focus();