mirror of
https://github.com/marktext/marktext.git
synced 2025-05-02 07:31:18 +08:00
Allow exiting full screen with maximize button on windows (#109)
This commit is contained in:
parent
12fa87fa99
commit
723fec398b
@ -17,6 +17,9 @@ const createWindow = (pathname, options = {}) => {
|
|||||||
|
|
||||||
const { x, y, width, height } = mainWindowState
|
const { x, y, width, height } = mainWindowState
|
||||||
const winOpt = Object.assign({ x, y, width, height }, {
|
const winOpt = Object.assign({ x, y, width, height }, {
|
||||||
|
icon: path.join(__static, 'logo-96px.png'),
|
||||||
|
minWidth: 450,
|
||||||
|
minHeight: 220,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
webSecurity: false
|
webSecurity: false
|
||||||
},
|
},
|
||||||
|
@ -13,14 +13,22 @@
|
|||||||
<span class="save-dot" :class="{'show': !isSaved}"></span>
|
<span class="save-dot" :class="{'show': !isSaved}"></span>
|
||||||
</div>
|
</div>
|
||||||
<div :class="platform === 'win32' ? 'left-toolbar' : 'right-toolbar'">
|
<div :class="platform === 'win32' ? 'left-toolbar' : 'right-toolbar'">
|
||||||
<div v-if="platform === 'win32'" class="windows-titlebar-menu title-no-drag" @click.stop="handleMenuClick">☰</div>
|
<div
|
||||||
|
v-if="platform === 'win32'"
|
||||||
|
class="windows-titlebar-menu title-no-drag"
|
||||||
|
@click.stop="handleMenuClick"
|
||||||
|
>☰</div>
|
||||||
<div
|
<div
|
||||||
class="word-count"
|
class="word-count"
|
||||||
:class="[{ 'title-no-drag': platform === 'win32' }]"
|
:class="[{ 'title-no-drag': platform === 'win32' }]"
|
||||||
@click.stop="handleWordClick"
|
@click.stop="handleWordClick"
|
||||||
>{{ `${HASH[show]} ${wordCount[show]}` }}</div>
|
>{{ `${HASH[show]} ${wordCount[show]}` }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="platform === 'win32'" class="right-toolbar" :class="[{ 'title-no-drag': platform === 'win32' }]">
|
<div
|
||||||
|
v-if="platform === 'win32'"
|
||||||
|
class="right-toolbar"
|
||||||
|
:class="[{ 'title-no-drag': platform === 'win32' }]"
|
||||||
|
>
|
||||||
<div class="windows-titlebar-close" @click.stop="handleCloseClick">×</div>
|
<div class="windows-titlebar-close" @click.stop="handleCloseClick">×</div>
|
||||||
<div class="windows-titlebar-toggle" @click.stop="handleMaximizeClick">□</div>
|
<div class="windows-titlebar-toggle" @click.stop="handleMaximizeClick">□</div>
|
||||||
<div class="windows-titlebar-minimize" @click.stop="handleMinimizeClick">−</div>
|
<div class="windows-titlebar-minimize" @click.stop="handleMinimizeClick">−</div>
|
||||||
@ -67,20 +75,26 @@
|
|||||||
if (index >= len) index = 0
|
if (index >= len) index = 0
|
||||||
this.show = ITEMS[index]
|
this.show = ITEMS[index]
|
||||||
},
|
},
|
||||||
|
|
||||||
handleCloseClick () {
|
handleCloseClick () {
|
||||||
remote.getCurrentWindow().close()
|
remote.getCurrentWindow().close()
|
||||||
},
|
},
|
||||||
|
|
||||||
handleMaximizeClick () {
|
handleMaximizeClick () {
|
||||||
const win = remote.getCurrentWindow()
|
const win = remote.getCurrentWindow()
|
||||||
if (win.isMaximized()) {
|
if (win.isFullScreen()) {
|
||||||
|
win.setFullScreen(false)
|
||||||
|
} else if (win.isMaximized()) {
|
||||||
win.unmaximize()
|
win.unmaximize()
|
||||||
} else {
|
} else {
|
||||||
win.maximize()
|
win.maximize()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
handleMinimizeClick () {
|
handleMinimizeClick () {
|
||||||
remote.getCurrentWindow().minimize()
|
remote.getCurrentWindow().minimize()
|
||||||
},
|
},
|
||||||
|
|
||||||
handleMenuClick () {
|
handleMenuClick () {
|
||||||
const win = remote.getCurrentWindow()
|
const win = remote.getCurrentWindow()
|
||||||
remote
|
remote
|
||||||
@ -137,7 +151,7 @@
|
|||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
}
|
}
|
||||||
.active .save-dot.show {
|
.active .save-dot.show {
|
||||||
visibility: visible;
|
visibility: visible;
|
||||||
}
|
}
|
||||||
.title:hover {
|
.title:hover {
|
||||||
color: #303133;
|
color: #303133;
|
||||||
|
BIN
static/logo-96px.png
Normal file
BIN
static/logo-96px.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.7 KiB |
Loading…
Reference in New Issue
Block a user