diff --git a/ebts-ui/package.json b/ebts-ui/package.json index 0a1a4c8..194e687 100644 --- a/ebts-ui/package.json +++ b/ebts-ui/package.json @@ -37,6 +37,8 @@ ], "dependencies": { "@antv/g6": "^4.2.7", + "@tinymce/tinymce-vue": "^3.0.1", + "tinymce": "^5.0.16", "@riophae/vue-treeselect": "0.4.0", "axios": "0.18.1", "ckeditor4-vue": "^1.4.0", diff --git a/ebts-ui/public/index.html b/ebts-ui/public/index.html index 24c7e86..cb08685 100644 --- a/ebts-ui/public/index.html +++ b/ebts-ui/public/index.html @@ -5,7 +5,7 @@ - + 西南交大信息学院官网后台管理系统 diff --git a/ebts-ui/src/views/sist/navigation/index.vue b/ebts-ui/src/views/sist/navigation/index.vue index 4cc97a8..434ce27 100644 --- a/ebts-ui/src/views/sist/navigation/index.vue +++ b/ebts-ui/src/views/sist/navigation/index.vue @@ -72,14 +72,14 @@ size="mini" type="text" icon="el-icon-edit" - @click="handleUpdateDetails(scope.row.refId)" + @click="handleUpdateDetails(scope.row.refId,scope.row.id)" >修改中文详情 修改英文详情 { - this.formData = res.data - }) + handleUpdateDetails(refId,navId) { + this.$router.push('/navigation/edit/' + refId+'/'+navId) + // this.detailsShow = true + // this.formData = { + // id: id, + // title: '', + // content: '' + // } + // getDetails(id).then(res => { + // this.formData = res.data + // }) }, code(){ let html = this.$refs.editor.getHtml() diff --git a/ebts-ui/src/views/utils/Editor.vue b/ebts-ui/src/views/utils/Editor.vue deleted file mode 100644 index 7ba3322..0000000 --- a/ebts-ui/src/views/utils/Editor.vue +++ /dev/null @@ -1,240 +0,0 @@ - - - - - diff --git a/ebts-ui/src/views/utils/Editor_back.vue b/ebts-ui/src/views/utils/Editor_back.vue index cec7451..39c8503 100644 --- a/ebts-ui/src/views/utils/Editor_back.vue +++ b/ebts-ui/src/views/utils/Editor_back.vue @@ -1,11 +1,33 @@ diff --git a/ebts-ui/src/views/utils/tinymce/Tinymce.vue b/ebts-ui/src/views/utils/tinymce/Tinymce.vue new file mode 100644 index 0000000..1892f7b --- /dev/null +++ b/ebts-ui/src/views/utils/tinymce/Tinymce.vue @@ -0,0 +1,223 @@ + + diff --git a/ebts-ui/src/views/utils/tinymce/plugin/indent/plugin.js b/ebts-ui/src/views/utils/tinymce/plugin/indent/plugin.js new file mode 100644 index 0000000..5e8c8db --- /dev/null +++ b/ebts-ui/src/views/utils/tinymce/plugin/indent/plugin.js @@ -0,0 +1,47 @@ +tinymce.PluginManager.add('indent2em', function(editor, url) { + var pluginName='首行缩进'; + var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools'); + var indent2em_val = editor.getParam('indent2em_val', '2em'); + var doAct = function () { + var dom = editor.dom; + var blocks = editor.selection.getSelectedBlocks(); + var act = ''; + global$1.each(blocks, function (block) { + if(act==''){ + act = dom.getStyle(block,'text-indent')==indent2em_val ? 'remove' : 'add'; + } + if( act=='add' ){ + dom.setStyle(block, 'text-indent', indent2em_val); + }else{ + var style=dom.getAttrib(block,'style'); + style = style.replace(/text-indent:[\s]*2em;/ig,''); + dom.setAttrib(block,'style',style); + } + + }); + }; + + editor.ui.registry.addButton('indent2em', { + text: '', + tooltip: pluginName, + onAction: function () { + doAct(); + } + }); + + editor.ui.registry.addMenuItem('indent2em', { + text: pluginName, + onAction: function() { + doAct(); + } + }); + + return { + getMetadata: function () { + return { + name: pluginName, + url: "http://tinymce.ax-z.cn/more-plugins/indent2em.php", + }; + } + }; +}); diff --git a/ebts-ui/src/views/utils/tinymce/plugin/indent/plugin.min.js b/ebts-ui/src/views/utils/tinymce/plugin/indent/plugin.min.js new file mode 100644 index 0000000..5e8c8db --- /dev/null +++ b/ebts-ui/src/views/utils/tinymce/plugin/indent/plugin.min.js @@ -0,0 +1,47 @@ +tinymce.PluginManager.add('indent2em', function(editor, url) { + var pluginName='首行缩进'; + var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools'); + var indent2em_val = editor.getParam('indent2em_val', '2em'); + var doAct = function () { + var dom = editor.dom; + var blocks = editor.selection.getSelectedBlocks(); + var act = ''; + global$1.each(blocks, function (block) { + if(act==''){ + act = dom.getStyle(block,'text-indent')==indent2em_val ? 'remove' : 'add'; + } + if( act=='add' ){ + dom.setStyle(block, 'text-indent', indent2em_val); + }else{ + var style=dom.getAttrib(block,'style'); + style = style.replace(/text-indent:[\s]*2em;/ig,''); + dom.setAttrib(block,'style',style); + } + + }); + }; + + editor.ui.registry.addButton('indent2em', { + text: '', + tooltip: pluginName, + onAction: function () { + doAct(); + } + }); + + editor.ui.registry.addMenuItem('indent2em', { + text: pluginName, + onAction: function() { + doAct(); + } + }); + + return { + getMetadata: function () { + return { + name: pluginName, + url: "http://tinymce.ax-z.cn/more-plugins/indent2em.php", + }; + } + }; +}); diff --git a/ebts-ui/src/views/utils/tinymce/plugin/letterspacing/plugin.js b/ebts-ui/src/views/utils/tinymce/plugin/letterspacing/plugin.js new file mode 100644 index 0000000..8444803 --- /dev/null +++ b/ebts-ui/src/views/utils/tinymce/plugin/letterspacing/plugin.js @@ -0,0 +1,54 @@ +tinymce.PluginManager.add('letterspacing', function (editor, url) { + var pluginName = '字间距' + var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools') + var letterspacing_val = editor.getParam('letterspacing_val', '1px 2px 3px 4px 5px') + + editor.on('init', function () { + editor.formatter.register({ + letterspacing: {inline: 'span', styles: {'letter-spacing': '%value'}} + }) + }) + + var doAct = function (value) { + editor.formatter.apply('letterspacing', {value: value}) + editor.fire('change', {}) + } + + editor.ui.registry.addMenuButton('letterspacing', { + text: '', + tooltip: pluginName, + fetch: function (callback) { + var dom = editor.dom + var blocks = editor.selection.getSelectedBlocks() + var lhv = 0 + global$1.each(blocks, function (block) { + if (lhv == 0) { + lhv = dom.getStyle(block, 'letterspacing') ? dom.getStyle(block, 'letterspacing') : 0 + } + }) + + var items = letterspacing_val.split(' ').map(function (item) { + var text = item + var value = item + return { + type: 'togglemenuitem', + text: text, + active: lhv == value ? true : false, + onAction: function () { + doAct(value) + } + } + }) + callback(items) + } + }) + + return { + getMetadata: function () { + return { + name: pluginName, + url: 'http://tinymce.ax-z.cn/more-plugins/lineheight.php', + } + } + } +}) diff --git a/ebts-ui/src/views/utils/tinymce/plugin/lineheight/plugin.js b/ebts-ui/src/views/utils/tinymce/plugin/lineheight/plugin.js new file mode 100644 index 0000000..c79c787 --- /dev/null +++ b/ebts-ui/src/views/utils/tinymce/plugin/lineheight/plugin.js @@ -0,0 +1,57 @@ +tinymce.PluginManager.add('lineheight', function(editor, url) { + var pluginName='设置行高'; + var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools'); + var lineheight_val = editor.getParam('lineheight_val', '1 1.5 1.6 1.75 1.8 2 3 4 5'); + + editor.on('init', function() { + editor.formatter.register({ + lineheight: { + selector: 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table', + styles: { 'line-height': '%value' } + } + }); + }); + + var doAct = function (value) { + editor.formatter.apply('lineheight', { value: value }); + editor.fire('change', {}); + }; + + editor.ui.registry.addMenuButton('lineheight', { + text: '', + tooltip: pluginName, + fetch: function(callback) { + var dom = editor.dom; + var blocks = editor.selection.getSelectedBlocks(); + var lhv = 0; + global$1.each(blocks, function(block) { + if(lhv==0){ + lhv = dom.getStyle(block,'line-height') ? dom.getStyle(block,'line-height') : 0; + } + }); + + var items = lineheight_val.split(' ').map(function(item){ + var text = item; + var value = item; + return { + type: 'togglemenuitem', + text: text, + active : lhv==value ? true :false, + onAction: function() { + doAct(value); + } + }; + }); + callback(items); + } + }); + + return { + getMetadata: function () { + return { + name: pluginName, + url: "http://tinymce.ax-z.cn/more-plugins/lineheight.php", + }; + } + }; +}); diff --git a/ebts-ui/src/views/utils/tinymce/plugin/lineheight/plugin.min.js b/ebts-ui/src/views/utils/tinymce/plugin/lineheight/plugin.min.js new file mode 100644 index 0000000..c79c787 --- /dev/null +++ b/ebts-ui/src/views/utils/tinymce/plugin/lineheight/plugin.min.js @@ -0,0 +1,57 @@ +tinymce.PluginManager.add('lineheight', function(editor, url) { + var pluginName='设置行高'; + var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools'); + var lineheight_val = editor.getParam('lineheight_val', '1 1.5 1.6 1.75 1.8 2 3 4 5'); + + editor.on('init', function() { + editor.formatter.register({ + lineheight: { + selector: 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table', + styles: { 'line-height': '%value' } + } + }); + }); + + var doAct = function (value) { + editor.formatter.apply('lineheight', { value: value }); + editor.fire('change', {}); + }; + + editor.ui.registry.addMenuButton('lineheight', { + text: '', + tooltip: pluginName, + fetch: function(callback) { + var dom = editor.dom; + var blocks = editor.selection.getSelectedBlocks(); + var lhv = 0; + global$1.each(blocks, function(block) { + if(lhv==0){ + lhv = dom.getStyle(block,'line-height') ? dom.getStyle(block,'line-height') : 0; + } + }); + + var items = lineheight_val.split(' ').map(function(item){ + var text = item; + var value = item; + return { + type: 'togglemenuitem', + text: text, + active : lhv==value ? true :false, + onAction: function() { + doAct(value); + } + }; + }); + callback(items); + } + }); + + return { + getMetadata: function () { + return { + name: pluginName, + url: "http://tinymce.ax-z.cn/more-plugins/lineheight.php", + }; + } + }; +});