diff --git a/web/src/assets/icon-font/iconfont.css b/web/src/assets/icon-font/iconfont.css index 7cee96a5..2e741b11 100644 --- a/web/src/assets/icon-font/iconfont.css +++ b/web/src/assets/icon-font/iconfont.css @@ -1,8 +1,8 @@ @font-face { font-family: "iconfont"; /* Project id 2479351 */ - src: url('iconfont.woff2?t=1737722825571') format('woff2'), - url('iconfont.woff?t=1737722825571') format('woff'), - url('iconfont.ttf?t=1737722825571') format('truetype'); + src: url('iconfont.woff2?t=1739152990179') format('woff2'), + url('iconfont.woff?t=1739152990179') format('woff'), + url('iconfont.ttf?t=1739152990179') format('truetype'); } .iconfont { @@ -13,6 +13,14 @@ -moz-osx-font-smoothing: grayscale; } +.iconprinting:before { + content: "\ea28"; +} + +.iconwenjianjia:before { + content: "\e614"; +} + .iconcontentleft:before { content: "\e8c9"; } diff --git a/web/src/assets/icon-font/iconfont.ttf b/web/src/assets/icon-font/iconfont.ttf index f4373704..06a6deea 100644 Binary files a/web/src/assets/icon-font/iconfont.ttf and b/web/src/assets/icon-font/iconfont.ttf differ diff --git a/web/src/assets/icon-font/iconfont.woff b/web/src/assets/icon-font/iconfont.woff index a05e1fdd..b98983ec 100644 Binary files a/web/src/assets/icon-font/iconfont.woff and b/web/src/assets/icon-font/iconfont.woff differ diff --git a/web/src/assets/icon-font/iconfont.woff2 b/web/src/assets/icon-font/iconfont.woff2 index aa7a49fe..09818b06 100644 Binary files a/web/src/assets/icon-font/iconfont.woff2 and b/web/src/assets/icon-font/iconfont.woff2 differ diff --git a/web/src/lang/en_us.js b/web/src/lang/en_us.js index e3107902..875cfd20 100644 --- a/web/src/lang/en_us.js +++ b/web/src/lang/en_us.js @@ -217,7 +217,9 @@ export default { }, outline: { title: 'Outline', - nodeDefaultText: 'Branch node' + nodeDefaultText: 'Branch node', + print: 'Print', + fullscreen: 'Fullscreen' }, scale: { zoomIn: 'Zoom in', diff --git a/web/src/lang/zh_cn.js b/web/src/lang/zh_cn.js index 2a5e3385..fa23e30a 100644 --- a/web/src/lang/zh_cn.js +++ b/web/src/lang/zh_cn.js @@ -213,7 +213,9 @@ export default { }, outline: { title: '大纲', - nodeDefaultText: '分支节点' + nodeDefaultText: '分支节点', + print: '打印', + fullscreen: '全屏' }, scale: { zoomIn: '放大', diff --git a/web/src/lang/zh_tw.js b/web/src/lang/zh_tw.js index 6ef2340a..db516066 100644 --- a/web/src/lang/zh_tw.js +++ b/web/src/lang/zh_tw.js @@ -78,7 +78,8 @@ export default { belowNode: '顯示在節點下方', confirm: '確定', cancel: '取消', - changeRichTextTip: '該操作會清空所有曆史修改記錄,並且修改思維導圖數據,是否繼續?', + changeRichTextTip: + '該操作會清空所有曆史修改記錄,並且修改思維導圖數據,是否繼續?', changeRichTextTip2: '是否切換爲富文本模式?', changeRichTextTip3: '是否切換爲非富文本模式?', enableDragImport: '是否允許直接拖拽文件到頁面進行導入', @@ -214,7 +215,9 @@ export default { }, outline: { title: '大綱', - nodeDefaultText: '分支節點' + nodeDefaultText: '分支節點', + print: '打印', + fullscreen: '全屏' }, scale: { zoomIn: '放大', @@ -268,7 +271,7 @@ export default { bottom: '下', left: '左', right: '右', - tag: '標簽', + tag: '標簽' }, theme: { title: '主題', diff --git a/web/src/pages/Edit/components/OutlineEdit.vue b/web/src/pages/Edit/components/OutlineEdit.vue index 1df83d07..dccfd225 100644 --- a/web/src/pages/Edit/components/OutlineEdit.vue +++ b/web/src/pages/Edit/components/OutlineEdit.vue @@ -5,10 +5,26 @@ ref="outlineEditContainer" v-if="isOutlineEdit" > -
- +
+ +
+ +
+
+
+ +
-
+
-
- +
+ +
+ +
+
+ +
+ +
+
@@ -19,6 +39,7 @@ import Sidebar from './Sidebar' import { mapState, mapMutations } from 'vuex' import Outline from './Outline.vue' +import { printOutline } from '@/utils' // 大纲侧边栏 export default { @@ -62,20 +83,31 @@ export default { if (y > top + height) { container.scrollTo(0, y - height / 2) } + }, + + // 打印 + onPrint() { + printOutline(this.$refs.outlineRef.$el) } } } diff --git a/web/src/utils/index.js b/web/src/utils/index.js index 50ec445f..91eea767 100644 --- a/web/src/utils/index.js +++ b/web/src/utils/index.js @@ -74,3 +74,25 @@ export const setImgToClipboard = img => { navigator.clipboard.write(data) } } + +// 打印大纲 +export const printOutline = el => { + const printContent = el.outerHTML + const iframe = document.createElement('iframe') + iframe.setAttribute('style', 'position: absolute; width: 0; height: 0;') + document.body.appendChild(iframe) + const iframeDoc = iframe.contentWindow.document + // 将当前页面的所有样式添加到iframe中 + const styleList = document.querySelectorAll('style') + Array.from(styleList).forEach(el => { + iframeDoc.write(el.outerHTML) + }) + // 设置打印展示方式 - 纵向展示 + iframeDoc.write('') + // 写入内容 + iframeDoc.write('
' + printContent + '
') + setTimeout(function() { + iframe.contentWindow?.print() + document.body.removeChild(iframe) + }, 500) +}