Skip to content

feat: 当前视窗预览文档 #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 22 additions & 5 deletions bpmn/src/pages/edit/components/Save.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

<script setup>
import { ref, watch, computed } from 'vue'
import { ElMessage } from 'element-plus'
import { ElMessage, ElMessageBox } from 'element-plus'
import {
Back,
CircleCloseFilled,
Expand All @@ -60,11 +60,28 @@ const props = defineProps({
})

// 返回工作台
const back = () => {
if (process.env.NODE_ENV === 'production') {
location.href = '/'
const back = async () => {
if (window.top !== window.self && window.parent) {
// 如果是 iframe 中运行,通知上层 window 后退
if (store.autoSaveStatus !== 'success') {
await ElMessageBox.confirm(`系统可能不会保存您所做的更改。`, '警告', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning'
})
}
try {
window.parent.history.back()
} catch (e) {
window.parent.postMessage('history-back', '*')
}
} else {
location.href = 'http://' + location.hostname + ':9090'
// 如果是新窗口打开,跳到工作台标签页并且关闭当前标签页
const href = process.env.NODE_ENV === 'production' ? '/' : 'http://' + location.hostname + ':9090'
const workspaceWindow = window.open(href, 'lx-doc')
if (window !== workspaceWindow) {
window.close()
}
}
}

Expand Down
26 changes: 22 additions & 4 deletions doc/src/pages/edit/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
import { useStore } from '../../store'
import { useRoute, useRouter } from 'vue-router'
import { computed, ref, watch, shallowRef, onBeforeUnmount } from 'vue'
import { ElMessageBox } from 'element-plus'
import {
ArrowLeft,
CircleCloseFilled,
Expand All @@ -84,11 +85,28 @@ const store = useStore()
const route = useRoute()
const router = useRouter()

const onBack = () => {
if (process.env.NODE_ENV === 'production') {
location.href = '/'
const onBack = async () => {
if (window.top !== window.self && window.parent) {
// 如果是 iframe 中运行,通知上层 window 后退
if (store.autoSaveStatus !== 'success') {
await ElMessageBox.confirm(`系统可能不会保存您所做的更改。`, '警告', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning'
})
}
try {
window.parent.history.back()
} catch (e) {
window.parent.postMessage('history-back', '*')
}
} else {
location.href = 'http://' + location.hostname + ':9090'
// 如果是新窗口打开,跳到工作台标签页并且关闭当前标签页
const href = process.env.NODE_ENV === 'production' ? '/' : 'http://' + location.hostname + ':9090'
const workspaceWindow = window.open(href, 'lx-doc')
if (window !== workspaceWindow) {
window.close()
}
}
}

Expand Down
22 changes: 20 additions & 2 deletions flowchart/src/main/webapp/js/ui/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,26 @@
this.showMask = false
},
methods: {
back() {
location.href = '/'
async back() {
if (window.top !== window.self && window.parent) {
// 如果是 iframe 中运行,通知上层 window 后退
if (this.autoSaveStatus !== 'success') {
const answer = window.confirm('系统可能不会保存您所做的更改。')
if (!answer) return false
}
try {
window.parent.history.back()
} catch (e) {
window.parent.postMessage('history-back', '*')
}
} else {
// 如果是新窗口打开,跳到工作台标签页并且关闭当前标签页
const href = process.env.NODE_ENV === 'production' ? '/' : 'http://' + location.hostname + ':9090'
const workspaceWindow = window.open(href, 'lx-doc')
if (window !== workspaceWindow) {
window.close()
}
}
},
// 设置当前自动保存状态
setAutoSaveStatus(data) {
Expand Down
27 changes: 22 additions & 5 deletions markdown/src/pages/edit/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ import { Emoji } from '@vavt/v3-extension'
import '@vavt/v3-extension/lib/asset/Emoji.css'
import { ExportPDF } from '@vavt/v3-extension'
import '@vavt/v3-extension/lib/asset/ExportPDF.css'
import { ElMessage } from 'element-plus'
import { ElMessage, ElMessageBox } from 'element-plus'
import screenfull from 'screenfull'
import katex from 'katex'
import 'katex/dist/katex.min.css'
Expand All @@ -115,11 +115,28 @@ const store = useStore()
const route = useRoute()
const router = useRouter()

const onBack = () => {
if (process.env.NODE_ENV === 'production') {
location.href = '/'
const onBack = async () => {
if (window.top !== window.self && window.parent) {
// 如果是 iframe 中运行,通知上层 window 后退
if (store.autoSaveStatus !== 'success') {
await ElMessageBox.confirm(`系统可能不会保存您所做的更改。`, '警告', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning'
})
}
try {
window.parent.history.back()
} catch (e) {
window.parent.postMessage('history-back', '*')
}
} else {
location.href = 'http://' + location.hostname + ':9090'
// 如果是新窗口打开,跳到工作台标签页并且关闭当前标签页
const href = process.env.NODE_ENV === 'production' ? '/' : 'http://' + location.hostname + ':9090'
const workspaceWindow = window.open(href, 'lx-doc')
if (window !== workspaceWindow) {
window.close()
}
}
}

Expand Down
25 changes: 21 additions & 4 deletions mind-map/src/pages/Edit/components/Toolbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,28 @@ export default {
...mapActions(['storeFileInfo']),

// 返回工作台页面
onBack() {
if (process.env.NODE_ENV === 'production') {
location.href = '/'
async onBack() {
if (window.top !== window.self && window.parent) {
// 如果是 iframe 中运行,通知上层 window 后退
if (this.autoSaveStatus !== 'success') {
await this.$confirm(`系统可能不会保存您所做的更改。`, '警告', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning'
})
}
try {
window.parent.history.back()
} catch (e) {
window.parent.postMessage('history-back', '*')
}
} else {
location.href = 'http://' + location.hostname + ':9090'
// 如果是新窗口打开,跳到工作台标签页并且关闭当前标签页
const href = process.env.NODE_ENV === 'production' ? '/' : 'http://' + location.hostname + ':9090'
const workspaceWindow = window.open(href, 'lx-doc')
if (window !== workspaceWindow) {
window.close()
}
}
},

Expand Down
26 changes: 22 additions & 4 deletions note/src/pages/edit/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import { useStore } from '../../store'
import { useRoute, useRouter } from 'vue-router'
import { computed, onMounted, ref, watch } from 'vue'
import { ElMessageBox } from 'element-plus'
import {
ArrowLeft,
CircleCloseFilled,
Expand All @@ -65,11 +66,28 @@ const store = useStore()
const route = useRoute()
const router = useRouter()

const onBack = () => {
if (process.env.NODE_ENV === 'production') {
location.href = '/'
const onBack = async () => {
if (window.top !== window.self && window.parent) {
// 如果是 iframe 中运行,通知上层 window 后退
if (store.autoSaveStatus !== 'success') {
await ElMessageBox.confirm(`系统可能不会保存您所做的更改。`, '警告', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning'
})
}
try {
window.parent.history.back()
} catch (e) {
window.parent.postMessage('history-back', '*')
}
} else {
location.href = 'http://' + location.hostname + ':9090'
// 如果是新窗口打开,跳到工作台标签页并且关闭当前标签页
const href = process.env.NODE_ENV === 'production' ? '/' : 'http://' + location.hostname + ':9090'
const workspaceWindow = window.open(href, 'lx-doc')
if (window !== workspaceWindow) {
window.close()
}
}
}

Expand Down
22 changes: 18 additions & 4 deletions ppt/src/views/Editor/EditorHeader/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,25 @@ const editingTitle = ref(false)
const titleInputRef = ref<InstanceType<typeof Input>>()
const titleValue = ref('')

const onBack = () => {
if (process.env.NODE_ENV === 'production') {
location.href = '/'
const onBack = async () => {
if (window.top !== window.self && window.parent) {
// 如果是 iframe 中运行,通知上层 window 后退
if (mainStore.autoSaveStatus !== 'success') {
const answer = window.confirm('系统可能不会保存您所做的更改。')
if (!answer) return false
}
try {
window.parent.history.back()
} catch (e) {
window.parent.postMessage('history-back', '*')
}
} else {
location.href = 'http://' + location.hostname + ':9090'
// 如果是新窗口打开,跳到工作台标签页并且关闭当前标签页
const href = process.env.NODE_ENV === 'production' ? '/' : 'http://' + location.hostname + ':9090'
const workspaceWindow = window.open(href, 'lx-doc')
if (window !== workspaceWindow) {
window.close()
}
}
}

Expand Down
26 changes: 22 additions & 4 deletions sheet/src/pages/edit/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import { useStore } from '../../store'
import { useRoute, useRouter } from 'vue-router'
import { computed, ref, watch, onMounted } from 'vue'
import { ElMessageBox } from 'element-plus'
import {
ArrowLeft,
CircleCloseFilled,
Expand All @@ -51,11 +52,28 @@ const store = useStore()
const route = useRoute()
const router = useRouter()

const onBack = () => {
if (process.env.NODE_ENV === 'production') {
location.href = '/'
const onBack = async () => {
if (window.top !== window.self && window.parent) {
// 如果是 iframe 中运行,通知上层 window 后退
if (store.autoSaveStatus !== 'success') {
await ElMessageBox.confirm(`系统可能不会保存您所做的更改。`, '警告', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning'
})
}
try {
window.parent.history.back()
} catch (e) {
window.parent.postMessage('history-back', '*')
}
} else {
location.href = 'http://' + location.hostname + ':9090'
// 如果是新窗口打开,跳到工作台标签页并且关闭当前标签页
const href = process.env.NODE_ENV === 'production' ? '/' : 'http://' + location.hostname + ':9090'
const workspaceWindow = window.open(href, 'lx-doc')
if (window !== workspaceWindow) {
window.close()
}
}
}

Expand Down
25 changes: 20 additions & 5 deletions whiteboard/src/components/header/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,29 @@ const uploadFilesMap = {}
let isSaving = false
let hasWaitSaveTask = false


function Header({ excalidrawAPI }) {
// 返回工作台
const onBack = () => {
if (process.env.NODE_ENV === 'production') {
location.href = '/'
} else {
location.href = 'http://' + location.hostname + ':9090'
const onBack = async () => {
if (window.top !== window.self && window.parent) {
// 如果是 iframe 中运行,通知上层 window 后退
if (store.autoSaveStatus !== 'success') {
const answer = window.confirm('系统可能不会保存您所做的更改。')
if (!answer) return false
}
try {
window.parent.history.back()
} catch (e) {
window.parent.postMessage('history-back', '*')
}
} else {
// 如果是新窗口打开,跳到工作台标签页并且关闭当前标签页
const href = process.env.NODE_ENV === 'production' ? '/' : 'http://' + location.hostname + ':9090'
const workspaceWindow = window.open(href, 'lx-doc')
if (window !== workspaceWindow) {
window.close()
}
}
}

// 文件名
Expand Down
Loading