Skip to content

Commit

Permalink
Merge branch 'release/3.40.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
purocean committed Oct 17, 2022
2 parents cdbe388 + b6d4bad commit 0373171
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "yank.note",
"version": "3.40.2",
"version": "3.40.3",
"description": "Yank Note: A hackable markdown note application for programmers",
"main": "dist/main/app.js",
"license": "AGPL-3.0",
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/components/ExtensionManager.vue
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ import XMask from '@fe/components/Mask.vue'
import GroupTabs from '@fe/components/GroupTabs.vue'
import * as extensionManager from '@fe/others/extension'
import type { Extension, ExtensionCompatible } from '@fe/types'
import { forceReload } from '@fe/services/base'
import * as setting from '@fe/services/setting'
import { useModal } from '@fe/support/ui/modal'
import { useToast } from '@fe/support/ui/toast'
Expand Down Expand Up @@ -487,7 +488,7 @@ async function upgrade (extension?: Extension) {
}
function reload () {
window.location.reload()
forceReload()
}
async function enable (extension?: Extension) {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/plugins/custom-styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default {
title: ctx.i18n.t('custom-css.change-confirm.title'),
content: ctx.i18n.t('custom-css.change-confirm.content')
})) {
window.location.reload()
ctx.base.forceReload()
}
}
})
Expand Down
13 changes: 12 additions & 1 deletion src/renderer/services/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { basename, resolve, extname, dirname, relative, isBelongTo } from '@fe/u
import { dayjs } from '@fe/context/lib'
import { useModal } from '@fe/support/ui/modal'
import { useToast } from '@fe/support/ui/toast'
import { isWindows } from '@fe/support/env'
import { isElectron, isWindows } from '@fe/support/env'
import { t } from './i18n'

const logger = getLogger('service-base')
Expand Down Expand Up @@ -115,6 +115,17 @@ export async function trashItem (path: string) {
await api.rpc(`require('electron').shell.trashItem(${quote(path)})`)
}

/**
* Force reload main page
*/
export async function forceReload () {
if (isElectron) {
await api.rpc("require('./action').getAction('reload-main-window')()")
} else {
location.reload()
}
}

/**
* get repo by name
* @param name
Expand Down
13 changes: 10 additions & 3 deletions src/renderer/startup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,16 @@ store.watch(() => store.state.currentRepo, (val) => {
}, { immediate: true })

store.watch(() => store.state.currentFile, (val) => {
document.documentElement.setAttribute('current-file-repo', val?.repo || '')
document.documentElement.setAttribute('current-file-name', val?.name || '')
document.documentElement.setAttribute('current-file-path', val?.path || '')
const setAttrs = (document: Document) => {
document.documentElement.setAttribute('current-file-repo', val?.repo || '')
document.documentElement.setAttribute('current-file-name', val?.name || '')
document.documentElement.setAttribute('current-file-path', val?.path || '')
}

view.getRenderIframe().then(iframe => {
setAttrs(document)
setAttrs(iframe.contentDocument!)
})
}, { immediate: true })

fetchSettings()
Expand Down

1 comment on commit 0373171

@vercel
Copy link

@vercel vercel bot commented on 0373171 Oct 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

yn-api-doc – ./

yn-api-doc.vercel.app
yn-api-doc-git-master-purocean.vercel.app
yn-api-doc-purocean.vercel.app

Please sign in to comment.