Skip to content

Commit

Permalink
[fix]: fix unsaved dot color in windows and disable export png in no-…
Browse files Browse the repository at this point in the history
…current note
  • Loading branch information
TankNee committed Jul 8, 2021
1 parent 7c2a4e9 commit 75b3521
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
13 changes: 11 additions & 2 deletions src/components/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,12 @@
<div
v-if="!$q.platform.is.mac && dataLoaded"
class="header-note-title animated fadeIn q-electron-drag--exception"
:class="{ 'mac': $q.platform.is.mac }"
style="cursor: pointer;"
@click="$refs.tagDialog.toggle"
>
<q-icon v-show="noteState !== 'default'" class="note-state-icon" key="icon" name="fiber_manual_record" size="16px" />
<span class="save-dot" :class="{'show': noteState !== 'default'}"></span>
<!-- <q-icon v-show="noteState !== 'default'" class="note-state-icon" key="icon" name="fiber_manual_record" size="16px" /> -->
<q-tooltip
v-if="tags.length > 0"
:offset="[20, 10]"
Expand Down Expand Up @@ -178,7 +180,7 @@
<div v-if="!$q.platform.is.mac">
<q-btn dense flat icon="minimize" @click="minimize" />
<q-btn dense flat icon="crop_square" @click="maximize" />
<q-btn dense flat icon="close" @click="closeApp" />
<q-btn dense flat icon="close" class="close-button" @click="closeApp" />
</div>
<LoginDialog ref="loginDialog" />
<SettingsDialog ref="settingsDialog" />
Expand Down Expand Up @@ -347,6 +349,9 @@ export default {
.header-note-title {
display: flex;
align-items: center;
margin-left: 0;
}
.header-note-title.mac {
margin-left: 10%;
}
.header-note-title > span {
Expand All @@ -356,4 +361,8 @@ export default {
font-weight: 600;
}
.close-button:hover {
background-color: rgba(255, 0, 0, .6);
}
</style>
5 changes: 3 additions & 2 deletions src/components/NoteList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export default {
return this.tags?.map(t => t.tagGuid).includes(this.currentCategory)
},
...mapServerGetters(['activeNote', 'currentNotes']),
...mapServerState(['isCurrentNotesLoading', 'currentCategory', 'isLogin', 'tags']),
...mapServerState(['isCurrentNotesLoading', 'currentCategory', 'isLogin', 'tags', 'currentNote']),
...mapClientState(['rightClickCategoryItem', 'rightClickNoteItem'])
},
methods: {
Expand Down Expand Up @@ -271,8 +271,9 @@ export default {
this.exportPng()
},
noteItemContextMenuHandler: function (e, noteField) {
const isCurrentNote = noteField.docGuid === this.currentNote.info.docGuid
this.setRightClickNoteItem(noteField)
showNoteItemContextMenu(e)
showNoteItemContextMenu(e, isCurrentNote)
},
...mapServerActions([
'createNote',
Expand Down
4 changes: 3 additions & 1 deletion src/contextMenu/noteList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ const {
* Show editor context menu.
*
* @param {MouseEvent} event The native mouse event.
* @param {string} isCurrentNote
*/
export const showContextMenu = (event) => {
export const showContextMenu = (event, isCurrentNote) => {
const menu = new Menu()
const win = remote.getCurrentWindow()
const ITEMS = [RENAME, COPY, SEPARATOR, MOVE, EXPORT, SEPARATOR, DELETE]
EXPORT.submenu.find(v => v.label === 'PNG').enabled = isCurrentNote
const MENU_ITEM = ITEMS.map(item => {
if (item.type === 'separator') return item
return {
Expand Down
2 changes: 1 addition & 1 deletion src/store/server/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function () {
userGuid: '',
isLogin: false,
currentNotes: [], // current notes summary information,
currentNote: {}, // current note which will be rendered on vditor,
currentNote: {}, // current note which will be rendered on editor,
isCurrentNoteLoading: false, // current notes list loading state,
isCurrentNotesLoading: false, // current notes loading state,
categories: [],
Expand Down

0 comments on commit 75b3521

Please sign in to comment.