瀏覽代碼

提交前段代码。

weiwenhai 6 年之前
父節點
當前提交
fd4682692f

+ 24 - 6
src/modules/questions/component/ckeditor.vue

@@ -32,10 +32,6 @@ export default {
       type: String,
       default: "500px"
     },
-    toolbar: {
-      type: [String, Array],
-      default: null
-    },
     language: {
       type: String,
       default: "zh-cn"
@@ -57,12 +53,34 @@ export default {
   },
   mounted() {
     let config = {
-      toolbar: this.toolbar,
       language: this.language,
       height: this.height,
       width: this.width,
       extraPlugins: this.extraplugins,
-      removeButtons: "Cut,Copy,Paste,Undo,Redo,Anchor"
+      toolbarGroups: [
+        { name: "clipboard", groups: ["clipboard", "undo"] },
+        {
+          name: "editing",
+          groups: ["find", "selection", "spellchecker", "editing"]
+        },
+        { name: "links", groups: ["links"] },
+        { name: "insert", groups: ["insert"] },
+        { name: "forms", groups: ["forms"] },
+        { name: "tools", groups: ["tools"] },
+        { name: "document", groups: ["mode", "document", "doctools"] },
+        { name: "others", groups: ["others"] },
+        "/",
+        { name: "basicstyles", groups: ["basicstyles", "cleanup"] },
+        {
+          name: "paragraph",
+          groups: ["list", "indent", "blocks", "align", "bidi", "paragraph"]
+        },
+        { name: "styles", groups: ["styles"] },
+        { name: "colors", groups: ["colors"] },
+        { name: "about", groups: ["about"] }
+      ],
+      removeButtons:
+        "Underline,Subscript,Superscript,Image,HorizontalRule,Unlink,Link,Scayt,Cut,Copy,Paste,PasteText,PasteFromWord,Maximize,Italic,Bold,NumberedList,BulletedList,Indent,Outdent,Blockquote,Styles,Format,About,RemoveFormat,Strike"
     };
     if (this.display !== "inline") {
       window.CKEDITOR.replace(this.id, config);

+ 5 - 24
src/modules/questions/views/EditOtherQuestion.vue

@@ -159,11 +159,7 @@
             <el-row :gutter="10">
               <el-col :xs="30" :sm="30" :md="30" :lg="30">
                 <el-form-item label="题干" prop="quesBody">
-                  <ckeditor
-                    :editor="editor"
-                    v-model="quesModel.quesBody"
-                    :config="editorConfig"
-                  ></ckeditor>
+                  <ckeditor v-model="quesModel.quesBody"></ckeditor>
                 </el-form-item>
               </el-col>
             </el-row>
@@ -175,11 +171,7 @@
             >
               <el-col :xs="30" :sm="30" :md="30" :lg="30">
                 <el-form-item :label="quesOption.number">
-                  <ckeditor
-                    :editor="editor"
-                    v-model="quesOption.quesBody"
-                    :config="editorConfig"
-                  ></ckeditor>
+                  <ckeditor v-model="quesOption.quesBody"></ckeditor>
                 </el-form-item>
               </el-col>
             </el-row>
@@ -192,11 +184,7 @@
               "
             >
               <el-form-item label="答案" prop="quesAnswer">
-                <ckeditor
-                  :editor="editor"
-                  v-model="quesModel.quesAnswer"
-                  :config="editorConfig"
-                ></ckeditor>
+                <ckeditor v-model="quesModel.quesAnswer"></ckeditor>
               </el-form-item>
             </div>
             <div v-if="quesModel.questionType == 'BOOL_ANSWER_QUESTION'">
@@ -241,19 +229,12 @@
 <script>
 import { CORE_API } from "@/constants/constants";
 import { QUESTION_TYPES } from "../constants/constants";
-import CKEditor from "@ckeditor/ckeditor5-vue";
-import ClassicEditor from "@ckeditor/ckeditor5-build-inline";
+import ckeditor from "../component/ckeditor.vue";
 export default {
   name: "editOtherApp",
-  components: {
-    ckeditor: CKEditor.component
-  },
+  components: { ckeditor },
   data() {
     return {
-      editor: ClassicEditor,
-      editorConfig: {
-        // The configuration of the editor.
-      },
       fullscreenLoading: false,
       questionTypes: QUESTION_TYPES,
       courseName: "",

+ 7 - 32
src/modules/questions/views/EditPaper.vue

@@ -5,11 +5,7 @@
     element-loading-text="拼命加载中。。。"
     id="editPaperApp"
   >
-    <ckeditor
-      :editor="editor"
-      v-model="examRemark"
-      :config="editorConfig"
-    ></ckeditor>
+    <ckeditor v-model="examRemark"></ckeditor>
     <div class="edit-paper-top">
       <div class="edit-paper-top-inline">
         <div class="paper-top-div">
@@ -511,11 +507,7 @@
             <el-row>
               <el-col>
                 <el-form-item label="题目">
-                  <ckeditor
-                    :editor="editor"
-                    v-model="quesModel.quesBody"
-                    :config="editorConfig"
-                  ></ckeditor>
+                  <ckeditor v-model="quesModel.quesBody"></ckeditor>
                 </el-form-item>
               </el-col>
             </el-row>
@@ -536,11 +528,7 @@
                 ></el-checkbox>
               </el-col>
               <el-col :span="20">
-                <ckeditor
-                  :editor="editor"
-                  v-model="quesOption.optionBody"
-                  :config="editorConfig"
-                ></ckeditor>
+                <ckeditor v-model="quesOption.optionBody"></ckeditor>
               </el-col>
               <el-col :span="2">
                 <i
@@ -559,11 +547,7 @@
               "
             >
               <el-form-item label="答案">
-                <ckeditor
-                  :editor="editor"
-                  v-model="quesModel.quesAnswer"
-                  :config="editorConfig"
-                ></ckeditor>
+                <ckeditor v-model="quesModel.quesAnswer"></ckeditor>
               </el-form-item>
             </div>
             <!-- 单选或多选 -->
@@ -625,11 +609,7 @@
             <el-col :xs="10" :sm="10" :md="10" :lg="10">
               <el-form-item label="考试说明">
                 <div style="width:550px;">
-                  <ckeditor
-                    :editor="editor"
-                    v-model="examRemark"
-                    :config="editorConfig"
-                  ></ckeditor>
+                  <ckeditor v-model="examRemark"></ckeditor>
                 </div>
               </el-form-item>
             </el-col>
@@ -688,22 +668,17 @@ import { QUESTION_TYPES } from "../constants/constants";
 import { mapState } from "vuex";
 import reduplicate_mark from "../component/reduplicate_mark.vue";
 import randomColor from "randomcolor";
-import CKEditor from "@ckeditor/ckeditor5-vue";
-import ClassicEditor from "@ckeditor/ckeditor5-build-inline";
+import ckeditor from "../component/ckeditor.vue";
 export default {
   name: "editPaperApp",
   components: {
     reduplicate_mark,
-    ckeditor: CKEditor.component
+    ckeditor
   },
   data() {
     return {
       uploadAction: "",
       fileList: [],
-      editor: ClassicEditor,
-      editorConfig: {
-        // The configuration of the editor.
-      },
       paperId: "",
       paperDetailId: "",
       editPaperDetailUnit: "",

+ 4 - 19
src/modules/questions/views/EditSelectQuestion.vue

@@ -160,11 +160,7 @@
             </el-row>
             <!-- end -->
             <el-form-item label="题干" prop="quesBody">
-              <ckeditor
-                :editor="editor"
-                v-model="quesModel.quesBody"
-                :config="editorConfig"
-              ></ckeditor>
+              <ckeditor v-model="quesModel.quesBody"></ckeditor>
             </el-form-item>
             <el-form-item
               v-for="(option, index) in quesModel.quesOptions"
@@ -183,11 +179,7 @@
                 ></el-checkbox>
               </el-col>
               <el-col :span="20">
-                <ckeditor
-                  :editor="editor"
-                  v-model="option.optionBody"
-                  :config="editorConfig"
-                ></ckeditor>
+                <ckeditor v-model="option.optionBody"></ckeditor>
               </el-col>
               <el-col :span="2">
                 <i
@@ -228,19 +220,12 @@
 <script>
 import { QUESTION_API } from "@/constants/constants";
 import { QUESTION_TYPES } from "../constants/constants";
-import CKEditor from "@ckeditor/ckeditor5-vue";
-import ClassicEditor from "@ckeditor/ckeditor5-build-inline";
+import ckeditor from "../component/ckeditor.vue";
 export default {
   name: "editSelectApp",
-  components: {
-    ckeditor: CKEditor.component
-  },
+  components: { ckeditor },
   data() {
     return {
-      editor: ClassicEditor,
-      editorConfig: {
-        // The configuration of the editor.
-      },
       questionTypes: QUESTION_TYPES,
       fullscreenLoading: false,
       paperId: "",

+ 4 - 13
src/modules/questions/views/InsertBluePaperStructure.vue

@@ -119,11 +119,7 @@
           </el-row>
           <el-form-item label="考试说明">
             <div style="width:550px;">
-              <ckeditor
-                :editor="editor"
-                v-model="blueStruct.examRemark"
-                :config="editorConfig"
-              ></ckeditor>
+              <ckeditor v-model="blueStruct.examRemark"></ckeditor>
             </div>
           </el-form-item>
         </el-form>
@@ -226,23 +222,18 @@
   </div>
 </template>
 <script>
-import { CORE_API, QUESTION_API } from "@/constants/constants";
 import { QUESTION_TYPES } from "../constants/constants";
-import CKEditor from "@ckeditor/ckeditor5-vue";
-import ClassicEditor from "@ckeditor/ckeditor5-build-inline";
+import { CORE_API, QUESTION_API } from "@/constants/constants";
+import ckeditor from "../component/ckeditor.vue";
 import LinkTitlesCustom from "@/components/LinkTitlesCustom.vue";
 export default {
   name: "insertBlueApp",
   components: {
-    ckeditor: CKEditor.component,
+    ckeditor,
     LinkTitlesCustom
   },
   data() {
     return {
-      editor: ClassicEditor,
-      editorConfig: {
-        // The configuration of the editor.
-      },
       blueStruct: {
         name: "",
         totalScore: 0, //结构总分