kuaifan 5 anni fa
parent
commit
2b63846c34

File diff suppressed because it is too large
+ 2455 - 1029
package-lock.json


+ 8 - 8
package.json

@@ -12,26 +12,26 @@
         "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
     },
     "devDependencies": {
-        "axios": "^0.19",
-        "cross-env": "^7.0",
+        "axios": "^0.19.2",
+        "cross-env": "^7.0.2",
         "css-loader": "^3.5.3",
-        "laravel-mix": "^5.0.1",
-        "lodash": "^4.17.13",
-        "resolve-url-loader": "^3.1.0",
+        "laravel-mix": "^5.0.4",
+        "lodash": "^4.17.15",
+        "resolve-url-loader": "^3.1.1",
         "sass": "^1.26.5",
         "sass-loader": "^8.0.2",
         "node-sass": "^4.14.1",
-        "jquery": "^3.5.0",
+        "jquery": "^3.5.1",
         "stylus": "^0.54.7",
         "stylus-loader": "^3.0.2",
         "vue": "^2.6.11",
         "vue-loader": "^15.9.2",
-        "vue-router": "^3.1.6",
+        "vue-router": "^3.2.0",
         "vue-style-loader": "^4.1.2",
         "vue-template-compiler": "^2.6.11"
     },
     "dependencies": {
-        "tinymce": "^5.2.2",
+        "tinymce": "^5.3.0",
         "view-design": "^4.2.0",
         "vuedraggable": "^2.23.2",
         "vue-clipboard2": "^0.3.1",

+ 48 - 102
resources/assets/js/main/components/docs/minder/minder.vue

@@ -17,12 +17,12 @@
                 <i class="ft icon" title="图形">&#xE621;</i>
                 <div slot="content">
                     <ul class="quickul mold">
-                        <li @click="setTemplate('default')"><span class="default"></span></li>
-                        <li @click="setTemplate('structure')"><span class="structure"></span></li>
-                        <li @click="setTemplate('filetree')"><span class="filetree"></span></li>
-                        <li @click="setTemplate('right')"><span class="right"></span></li>
-                        <li @click="setTemplate('fish-bone')"><span class="fish-bone"></span></li>
-                        <li @click="setTemplate('tianpan')"><span class="tianpan"></span></li>
+                        <li @click="minder.execCommand('template', 'default')"><span class="default"></span></li>
+                        <li @click="minder.execCommand('template', 'structure')"><span class="structure"></span></li>
+                        <li @click="minder.execCommand('template', 'filetree')"><span class="filetree"></span></li>
+                        <li @click="minder.execCommand('template', 'right')"><span class="right"></span></li>
+                        <li @click="minder.execCommand('template', 'fish-bone')"><span class="fish-bone"></span></li>
+                        <li @click="minder.execCommand('template', 'tianpan')"><span class="tianpan"></span></li>
                     </ul>
                 </div>
             </Tooltip>
@@ -30,15 +30,15 @@
                 <i class="ft icon" title="样式">&#xE678;</i>
                 <div slot="content">
                     <ul class="quickul">
-                        <li @click="setTheme('fresh-blue')">天空蓝</li>
-                        <li @click="setTheme('wire')">线框</li>
-                        <li @click="setTheme('fish')">鱼骨图</li>
-                        <li @click="setTheme('classic')">脑图经典</li>
-                        <li @click="setTheme('classic-compact')">紧凑经典</li>
-                        <li @click="setTheme('snow')">温柔冷光</li>
-                        <li @click="setTheme('snow-compact')">紧凑冷光</li>
-                        <li @click="setTheme('tianpan')">经典天盘</li>
-                        <li @click="setTheme('tianpan-compact')">紧凑天盘</li>
+                        <li @click="minder.execCommand('theme', 'fresh-blue')">天空蓝</li>
+                        <li @click="minder.execCommand('theme', 'wire')">线框</li>
+                        <li @click="minder.execCommand('theme', 'fish')">鱼骨图</li>
+                        <li @click="minder.execCommand('theme', 'classic')">脑图经典</li>
+                        <li @click="minder.execCommand('theme', 'classic-compact')">紧凑经典</li>
+                        <li @click="minder.execCommand('theme', 'snow')">温柔冷光</li>
+                        <li @click="minder.execCommand('theme', 'snow-compact')">紧凑冷光</li>
+                        <li @click="minder.execCommand('theme', 'tianpan')">经典天盘</li>
+                        <li @click="minder.execCommand('theme', 'tianpan-compact')">紧凑天盘</li>
                     </ul>
                 </div>
             </Tooltip>
@@ -177,7 +177,7 @@
     export default {
         name: 'mind-editor',
         props: {
-            importData: {
+            value: {
                 type: Object,
                 default: function () {
                     return {}
@@ -203,60 +203,28 @@
                 type: Boolean,
                 default: true
             },
-            template: {
-                type: String,
-                default: 'right'
-            },
-            theme: {
-                type: String,
-                default: 'fresh-blue'
-            },
             saveShow: {
                 type: Boolean,
                 default: true
             },
             id: {
                 type: String,
-                default: generateMixed(12)
+                default: 'minder-component-' + generateMixed(12)
             },
         },
         data() {
             return {
                 minder: null,
-                navIndex: 0,
                 isHand: false,
-                rootData: {
-                    root: {
-                        data: {
-                            text: "默认节点",
-                            id: generateMixed(12)
-                        },
-                        children: [],
-                    },
-                    theme: 'fresh-blue',
-                    template: 'default',
-                }
             };
         },
         methods: {
-            getJson() {
-                return this.minder.exportJson();
-            },
-            setTheme(val) {
-                this.$set(this.rootData, 'theme', val);
-                this.minder.execCommand('theme', val);
-            },
-            setTemplate(val) {
-                this.$set(this.rootData, 'template', val);
-                this.minder.execCommand('template', val);
-            },
             exportHandle(n) {
-                let that = this;
                 if (n === 0) {
-                    that.minder.exportData('png').then(content => {
+                    this.minder.exportData('png').then((content) => {
                         let element = document.createElement('a');
                         element.setAttribute('href', content);
-                        let filename = that.rootData.root.data.text || '无标题';
+                        let filename = this.value.root.data.text || '无标题';
                         element.setAttribute('download', filename);
                         element.style.display = 'none';
                         document.body.appendChild(element);
@@ -264,76 +232,54 @@
                         document.body.removeChild(element);
                     });
                 } else if (n === 1) {
-                    this.minder.exportData('png').then(content => {
+                    this.minder.exportData('png').then((content) => {
                         var doc = new JSPDF();
                         doc.addImage(content, 'PNG', 0, 0, 0, 0);
-                        doc.save(`${this.rootData.root.data.text || '无标题'}.pdf`);
+                        doc.save(`${this.value.root.data.text || '无标题'}.pdf`);
                     });
                 }
             },
             rendData() {
-                let that = this;
-                that.$nextTick(() => {
-                    const getId = document.getElementById(that.id);
-                    setTimeout(function () {
-                        that.minder = window.editor = new Editor(getId).minder;
-                        that.$set(that.rootData, 'root', that.rootData.root);
-                        that.minder.importJson(that.rootData);
-                        that.$emit('minderHandle', that.minder);
-                        that.minder.on('contentchange', val => {
-                            /* 内容改变时 */
-                            var json = that.minder.exportJson();
-                            that.$emit('exportData', json);
-                        });
-                        that.minder.on('selectionchange', function (e) {
-                            that.minder = e.minder;
-                            var node = e.minder.getSelectedNode();
-                            that.currentNode = node;
-                            if (node && node.parent) {
-                                setTimeout(function () {
-                                    node.parent.layout();
-                                }, 0);
-                            }
-                            if (that.lock && node) {
-                            }
-                            that.lock = true;
-                        });
-                        that.minder.on('beforeExecCommand', function (e) {
-                            /* 按钮触发 */
-                            if (/arrange/i.test(e.commandName)) {
-                            } else if (/append/i.test(e.commandName)) {
-                            } else if (
-                                /remove/i.test(e.commandName)) {
-                            }
+                this.$nextTick(() => {
+                    setTimeout(() => {
+                        if (this.minder !== null) {
+                            return;
+                        }
+                        this.minder = window.editor = new Editor(document.getElementById(this.id)).minder;
+                        this.minder.importJson(this.value);
+                        this.$emit('minderHandle', this.minder);
+                        this.minder.on('contentchange', val => {
+                            this.$emit('input', this.minder.exportJson());
                         });
-                        that.minder.on('AfterExecCommand', function (e) {
-                            if (/append/i.test(e.commandName)) {
-                            } else if (/remove/i.test(e.commandName)) {
-                            }
-                        })
                     }, 300)
                 });
             }
         },
         watch: {
-            importData: {
-                handler: function () {
-                    if (this.importData != '' && this.importData != null) {
-                        this.rootData.root = this.importData
+            value: {
+                handler: function (newObj) {
+                    if (typeof newObj !== "object" || newObj === null) {
+                        newObj = {
+                            root: newObj,
+                            theme: "fresh-blue",
+                            template: "default",
+                        };
                     }
-                    if (this.theme != null && this.theme != '') {
-                        this.rootData.theme = this.theme
-                    }
-                    let arr = Object.keys(this.rootData.root);
-                    if (arr.length == 0) {
-                        this.rootData.root = {
+                    if (typeof newObj.root !== "object" || newObj.root === null || newObj.root.length == 0) {
+                        newObj.root = {
                             data: {
+                                id: generateMixed(12),
                                 text: '默认节点',
-                                id: generateMixed(12)
                             },
                             children: []
                         }
                     }
+                    if (typeof newObj.theme !== "string") {
+                        newObj.theme = "fresh-blue";
+                    }
+                    if (typeof newObj.template !== "string") {
+                        newObj.template = "default";
+                    }
                     this.rendData();
                 },
                 deep: true,

+ 31 - 1
resources/assets/js/main/pages/docs.vue

@@ -266,10 +266,40 @@
         },
 
         watch: {
-
+            addBookShow(val) {
+                if (val && this.addBookId > 0) {
+                    let tempLists = this.bookLists.filter((res) => { return res.id == this.addBookId });
+                    if (tempLists.length === 1) {
+                        this.$set(this.formBookAdd, 'title', tempLists[0].title);
+                    } else {
+                        this.$set(this.formBookAdd, 'title', '');
+                    }
+                }
+            },
+            addSectionShow(val) {
+                if (val && this.addSectionId > 0) {
+                    let tempLists = this.children2lists(this.sectionLists).filter((res) => { return res.id == this.addSectionId });
+                    if (tempLists.length === 1) {
+                        this.$set(this.formSectionAdd, 'title', tempLists[0].title);
+                    } else {
+                        this.$set(this.formSectionAdd, 'title', '');
+                    }
+                }
+            }
         },
 
         methods: {
+            children2lists(lists) {
+                let array = [];
+                lists.forEach((item) => {
+                    array.push({
+                        id: item.id,
+                        title: item.title
+                    });
+                    array = array.concat(this.children2lists(item.children))
+                });
+                return array;
+            },
 
             getBookLists(resetLoad) {
                 if (resetLoad === true) {

+ 6 - 5
resources/assets/js/main/pages/docs/edit.vue

@@ -16,7 +16,7 @@
             </div>
             <div class="docs-body">
                 <t-editor v-if="docDetail.type=='document'" class="body-text" v-model="docContent.content" height="100%"></t-editor>
-                <minder v-else-if="docDetail.type=='mind'" class="body-mind" @exportData="exportMindData" :template="docContent.template" :theme="docContent.theme" :importData="docContent.root"></minder>
+                <minder v-else-if="docDetail.type=='mind'" class="body-mind" v-model="docContent"></minder>
                 <sheet v-else-if="docDetail.type=='sheet'" class="body-sheet" v-model="docContent.content"></sheet>
                 <flow v-else-if="docDetail.type=='flow'" class="body-flow" v-model="docContent.content"></flow>
             </div>
@@ -42,15 +42,16 @@
                     padding: 0 12%;
                     background: #f9f9f9;
                 }
+                .tox-toolbar__overflow,
                 .tox-toolbar__primary {
-                    background: none;
-                    border-top: 1px solid #eaeaea;
+                    background: none !important;
+                    border-top: 1px solid #eaeaea !important;
                 }
                 .tox-toolbar-overlord {
-                    border-bottom: 1px solid #E9E9E9;
+                    border-bottom: 1px solid #E9E9E9 !important;
                 }
                 .tox-toolbar__group:not(:last-of-type) {
-                    border-right: 1px solid #eaeaea;
+                    border-right: 1px solid #eaeaea !important;
                 }
                 .tox-sidebar-wrap {
                     margin: 22px 12%;