Skip to content

Commit

Permalink
Merge branch 'release/3.56.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
purocean committed Jul 23, 2023
2 parents 80414b2 + cc0b1e4 commit 2d8d5f2
Show file tree
Hide file tree
Showing 24 changed files with 1,285 additions and 579 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ jobs:
# platform: 'linux'
runs-on: ${{ matrix.os }}
env:
npm_config_disturl: https://electronjs.org/headers
npm_config_target: 15.4.1
npm_config_runtime: "electron"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
Expand All @@ -42,6 +39,7 @@ jobs:
- name: Install
run: |
yarn install
yarn electron-rebuild
node scripts/download-pandoc.js
- name: Set env
Expand Down Expand Up @@ -69,7 +67,7 @@ jobs:
yarn run electron-builder --${{ matrix.platform }} --x64 -p never | sed 's/identityName=.*$//'
find ./out -regex '.*app.asar.unpacked/node_modules/node-pty/build/Release/pty.node$' | grep pty.node
mv out/latest-mac.yml out/latest-mac-x64.yml
cp ./files/m1*pty.node ./node_modules/node-pty/build/Release/pty.node
yarn electron-rebuild --arch=arm64
sed -i '' 's/out\/mac\/Yank Note.app/out\/mac-arm64\/Yank Note.app/' electron-builder.json
yarn run electron-builder --${{ matrix.platform }} --arm64 -p never | sed 's/identityName=.*$//'
mv out/latest-mac.yml out/latest-mac-arm64.yml
Expand All @@ -87,7 +85,7 @@ jobs:
export npm_config_arch=arm64
node "./node_modules/@vscode/ripgrep/lib/postinstall.js" --force
node scripts/download-pandoc.js --force-arm64
cp ./files/linux-arm64*pty.node ./node_modules/node-pty/build/Release/pty.node
yarn electron-rebuild --arch=arm64
yarn run electron-builder --${{ matrix.platform }} --arm64 -p never | sed 's/identityName=.*$//'
- name: Rename Artifact for Ubuntu-18.04
Expand Down
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,16 @@ For more information on how to use the following functions, please see [characte

## Changelogs

### [v3.55.1](https://github.com/purocean/yn/releases/tag/v3.55.1) 2023-07-12
### [v3.56.2](https://github.com/purocean/yn/releases/tag/v3.56.2) 2023-07-23

[Windows](https://github.com/purocean/yn/releases/download/v3.55.1/Yank-Note-win-x64-3.55.1.exe) | [macOS arm64](https://github.com/purocean/yn/releases/download/v3.55.1/Yank-Note-mac-arm64-3.55.1.dmg) | [macOS x64](https://github.com/purocean/yn/releases/download/v3.55.1/Yank-Note-mac-x64-3.55.1.dmg) | [Linux AppImage](https://github.com/purocean/yn/releases/download/v3.55.1/Yank-Note-linux-x86_64-3.55.1.AppImage) | [Linux deb](https://github.com/purocean/yn/releases/download/v3.55.1/Yank-Note-linux-amd64-3.55.1.deb)
[Windows](https://github.com/purocean/yn/releases/download/v3.56.2/Yank-Note-win-x64-3.56.2.exe) | [macOS arm64](https://github.com/purocean/yn/releases/download/v3.56.2/Yank-Note-mac-arm64-3.56.2.dmg) | [macOS x64](https://github.com/purocean/yn/releases/download/v3.56.2/Yank-Note-mac-x64-3.56.2.dmg) | [Linux AppImage](https://github.com/purocean/yn/releases/download/v3.56.2/Yank-Note-linux-x86_64-3.56.2.AppImage) | [Linux deb](https://github.com/purocean/yn/releases/download/v3.56.2/Yank-Note-linux-amd64-3.56.2.deb)

1. feat: upgrade Monaco editor to 0.40.0
2. feat: support outputting HTML results when running js code blocks
3. fix: fix the scope problem of running js code block
4. fix: fix the problem that the startup `--readonly` parameter is invalid
1. feat: upgrade Electron to 22.3.17
2. feat: optimize the popup position of context menu when space is limited
3. feat: add file-related operations to the context menu of file tabs
4. feat: Prompt whether to create a new file when switching to a non-existent file
5. feat(plugin): add `file-tabs.close-tabs` Action
6. feat(plugin): add extension methods to the context menu of file tabs

[More release notes](https://github.com/purocean/yn/releases)

Expand Down
14 changes: 8 additions & 6 deletions README_ZH-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,16 @@

## 更新日志

### [v3.55.1](https://github.com/purocean/yn/releases/tag/v3.55.1) 2023-07-12
### [v3.56.2](https://github.com/purocean/yn/releases/tag/v3.56.2) 2023-07-23

[Windows](https://github.com/purocean/yn/releases/download/v3.55.1/Yank-Note-win-x64-3.55.1.exe) | [macOS arm64](https://github.com/purocean/yn/releases/download/v3.55.1/Yank-Note-mac-arm64-3.55.1.dmg) | [macOS x64](https://github.com/purocean/yn/releases/download/v3.55.1/Yank-Note-mac-x64-3.55.1.dmg) | [Linux AppImage](https://github.com/purocean/yn/releases/download/v3.55.1/Yank-Note-linux-x86_64-3.55.1.AppImage) | [Linux deb](https://github.com/purocean/yn/releases/download/v3.55.1/Yank-Note-linux-amd64-3.55.1.deb)
[Windows](https://github.com/purocean/yn/releases/download/v3.56.2/Yank-Note-win-x64-3.56.2.exe) | [macOS arm64](https://github.com/purocean/yn/releases/download/v3.56.2/Yank-Note-mac-arm64-3.56.2.dmg) | [macOS x64](https://github.com/purocean/yn/releases/download/v3.56.2/Yank-Note-mac-x64-3.56.2.dmg) | [Linux AppImage](https://github.com/purocean/yn/releases/download/v3.56.2/Yank-Note-linux-x86_64-3.56.2.AppImage) | [Linux deb](https://github.com/purocean/yn/releases/download/v3.56.2/Yank-Note-linux-amd64-3.56.2.deb)

1. feat: 升级 Monaco editor 到 0.40.0
2. feat: 运行 js 代码块时支持输出 HTML 结果
3. fix: 修复运行 js 代码块作用域问题
4. fix: 修复启动 `--readonly` 参数无效问题
1. feat: 升级 Electron 到 22.3.17
1. feat: 优化当空间不够时上下文菜单弹出位置
1. feat: 文件选项卡上下文菜单增加文件相关操作
1. feat: 切换到一个不存在的文件时,提示是否创建
1. feat(plugin): 增加 `file-tabs.close-tabs` Action
1. feat(plugin): 增加文件选项卡上下文菜单拓展方法

[更多发布说明](https://github.com/purocean/yn/releases)

Expand Down
Binary file removed files/linux-arm64-15.4.1-pty.node
Binary file not shown.
Binary file removed files/m1-15.4.1-pty.node
Binary file not shown.
26 changes: 14 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "yank.note",
"version": "3.55.1",
"version": "3.56.2",
"description": "Yank Note: A highly extensible Markdown editor, designed for productivity.",
"main": "dist/main/app.js",
"license": "AGPL-3.0",
Expand All @@ -14,7 +14,7 @@
"build:fe": "vue-tsc --noEmit --esModuleInterop true && vite build",
"build:fe-demo": "node scripts/install-demo-extensions.js && yarn run build:fe --mode=demo && node scripts/copy-assets.js && cp help/* dist/renderer/ && cp src/main/resources/github.css dist/renderer/",
"serve:fe": "vite preview",
"build:main": "tsc --esModuleInterop true --target ES2018 --moduleResolution node --module commonjs src/main/app.ts --outDir ./dist && node ./scripts/copy-assets.js",
"build:main": "tsc --esModuleInterop true --target es2021 --moduleResolution node --module commonjs src/main/app.ts --outDir ./dist && node ./scripts/copy-assets.js",
"build": "npm run build:fe && npm run build:main",
"lint": "vue-tsc --noEmit --esModuleInterop true && eslint src/ --ext .tsx,.ts,.vue",
"test": "yarn run jest --coverage --coverage-reporters=text --silent",
Expand All @@ -23,19 +23,19 @@
"rebuild-pty": "electron-rebuild -f -w node-pty"
},
"dependencies": {
"@electron/remote": "^2.0.1",
"@electron/remote": "^2.0.10",
"@vscode/ripgrep": "^1.14.2",
"adm-zip": "^0.5.9",
"app-license": "^0.2.4",
"async-lock": "^1.4.0",
"chokidar": "^3.5.3",
"command-exists": "^1.2.9",
"dayjs": "^1.10.5",
"electron-context-menu": "^3.1.1",
"electron-log": "^4.4.3",
"electron-progressbar": "^2.0.1",
"electron-store": "^5.2.0",
"electron-updater": "^4.6.1",
"electron-context-menu": "^3.6.1",
"electron-log": "^4.4.8",
"electron-progressbar": "^2.1.0",
"electron-store": "^8.1.0",
"electron-updater": "^6.1.1",
"fs-extra": "^10.0.0",
"glob": "^8.0.3",
"http-proxy-agent": "^5.0.0",
Expand All @@ -47,7 +47,7 @@
"lodash": "^4.17.21",
"mime": "^2.5.2",
"mitt": "^2.1.0",
"node-pty": "^0.10.1",
"node-pty": "^1.0.0",
"pako": "^2.0.4",
"plantuml-pipe": "^1.4.0",
"request": "^2.88.2",
Expand All @@ -64,6 +64,7 @@
"devDependencies": {
"@commitlint/cli": "^16.2.4",
"@commitlint/config-conventional": "^16.2.4",
"@electron/rebuild": "^3.2.13",
"@json-editor/json-editor": "^2.5.4",
"@types/adm-zip": "^0.4.34",
"@types/async-lock": "^1.3.0",
Expand All @@ -72,6 +73,7 @@
"@types/crypto-js": "^4.0.1",
"@types/dom-to-image": "^2.6.4",
"@types/fs-extra": "^9.0.11",
"@types/glob": "^8.1.0",
"@types/ip": "^1.1.0",
"@types/jest": "^27.0.3",
"@types/jsonwebtoken": "^8.5.8",
Expand Down Expand Up @@ -100,8 +102,8 @@
"canvas-confetti": "^1.6.0",
"crypto-js": "^3.3.0",
"dom-to-image": "^2.6.0",
"electron": "15.4.1",
"electron-builder": "^23.6.0",
"electron": "22.3.17",
"electron-builder": "^24.4.0",
"electron-notarize": "^1.2.2",
"eslint": "^7.11.0",
"eslint-plugin-import": "^2.20.2",
Expand All @@ -120,7 +122,7 @@
"lodash-es": "^4.17.21",
"markdown-it": "^13.0.1",
"markdown-it-abbr": "^1.0.4",
"markdown-it-attributes": "^1.0.0",
"markdown-it-attributes": "^1.1.1",
"markdown-it-container": "^3.0.0",
"markdown-it-emoji": "^2.0.2",
"markdown-it-mark": "^3.0.1",
Expand Down
5 changes: 0 additions & 5 deletions scripts/install.bat

This file was deleted.

7 changes: 0 additions & 7 deletions scripts/install.sh

This file was deleted.

2 changes: 1 addition & 1 deletion src/main/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const hideWindow = () => {
}

const restoreWindowBounds = () => {
const state: WindowState = store.get('window.state', null)
const state: WindowState | null = store.get('window.state', null) as any
if (state) {
if (state.maximized) {
win!.maximize()
Expand Down
21 changes: 20 additions & 1 deletion src/main/config.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,35 @@
import * as fs from 'fs-extra'
import cloneDeep from 'lodash/cloneDeep'
import { CONFIG_FILE } from './constant'
import store from './storage'

const configFile = CONFIG_FILE

const writeJson = (data: any) => {
if (!data) return

data = cloneDeep(data)
// save license to store
if (data.license) {
store.set('license', data.license)
delete data.license
}

fs.ensureFileSync(configFile)
fs.writeJsonSync(configFile, data, { spaces: 4 })
}

const readJson = () => {
try {
return fs.readJSONSync(configFile)
const result = fs.readJSONSync(configFile)

// get license from store
const license = store.get('license', '')
if (license) {
result.license = license
}

return result
} catch (error) {
console.error(error)
return null
Expand Down
3 changes: 2 additions & 1 deletion src/main/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,8 @@ const server = (port = 3000) => {
cols: 80,
rows: 24,
cwd: socket.handshake.query.cwd || HOME_DIR,
env: process.env
env: process.env,
useConpty: false,
})
ptyProcess.onData((data: any) => socket.emit('output', data))
ptyProcess.onExit(() => socket.disconnect())
Expand Down
10 changes: 3 additions & 7 deletions src/main/updater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class UpdateProvider extends GitHubProvider {
}
}

const init = (call: () => void) => {
const init = (call?: () => void) => {
if (disabled) {
return
}
Expand Down Expand Up @@ -153,7 +153,7 @@ const init = (call: () => void) => {
if (result.response === 0) {
setTimeout(() => {
autoUpdater.quitAndInstall()
call()
call?.()
}, 500)
}
})
Expand Down Expand Up @@ -192,11 +192,7 @@ export function changeSource () {
}

app.whenReady().then(() => {
init(() => {
setTimeout(() => {
app.exit(0)
}, process.platform === 'darwin' ? 3500 : 0)
})
init()

setTimeout(() => {
autoCheckForUpdates()
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/ContextMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default defineComponent({
const y = _mouseY + menuHeight > windowHeight ? _mouseY - menuHeight : _mouseY
refMenu.value.style.left = x + 'px'
refMenu.value.style.height = y < 0 ? `${menuHeight + y}px` : 'unset'
refMenu.value.style.height = y < 0 ? `${Math.min(Math.max(menuHeight + y, windowHeight - 30), menuHeight)}px` : 'unset'
refMenu.value.style.top = y < 0 ? '0px' : y + 'px'
}
Expand Down
21 changes: 20 additions & 1 deletion src/renderer/components/FileTabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
:value="current"
:filter-btn-title="filterBtnTitle"
:action-btns="actionBtns"
:hook-context-menu="hookContextMenu"
@remove="removeTabs"
@switch="switchTab"
@change-list="setTabs"
Expand Down Expand Up @@ -74,7 +75,7 @@ export default defineComponent({
switchFile(item.payload.file)
}
async function removeTabs (items: Components.FileTabs.Item[]) {
async function removeTabs (items: {key: string}[]) {
if (items.find(x => x.key === current.value)) {
await ensureCurrentFileSaved()
}
Expand Down Expand Up @@ -206,6 +207,17 @@ export default defineComponent({
actionBtns.value = arr
}
function closeTabs (keys: string[]) {
removeTabs(keys.map(key => ({ key })))
}
function hookContextMenu (item: Components.Tabs.Item, menus: Components.ContextMenu.Item[]) {
const appendMenus = FileTabs.getTabContextMenus(item)
if (appendMenus.length) {
menus.push({ type: 'separator' }, ...appendMenus)
}
}
onBeforeMount(() => {
registerHook('DOC_MOVED', handleMoved)
registerHook('DOC_CREATED', handleDocCreated)
Expand Down Expand Up @@ -257,6 +269,11 @@ export default defineComponent({
name: 'file-tabs.refresh-action-btns',
handler: refreshActionBtns,
})
registerAction({
name: 'file-tabs.close-tabs',
handler: closeTabs,
})
})
onBeforeUnmount(() => {
Expand All @@ -271,6 +288,7 @@ export default defineComponent({
removeAction('file-tabs.search-tabs')
removeAction('file-tabs.refresh-action-btns')
removeAction('file-tabs.show-welcome')
removeAction('file-tabs.close-tabs')
})
watch(currentFile, file => {
Expand Down Expand Up @@ -338,6 +356,7 @@ export default defineComponent({
filterBtnTitle,
makeTabPermanent,
onDblclickBlank,
hookContextMenu,
}
},
})
Expand Down
12 changes: 10 additions & 2 deletions src/renderer/components/Tabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ export default defineComponent({
type: Array as () => Components.Tabs.ActionBtn[],
default: () => [],
},
hookContextMenu: {
type: Function as unknown as () => ((item: Components.Tabs.Item, menus: Components.ContextMenu.Item[]) => void),
default: () => undefined,
}
},
emits: ['input', 'remove', 'switch', 'change-list', 'dblclick-blank', 'dblclick-item'],
setup (props, { emit }) {
Expand Down Expand Up @@ -159,15 +163,19 @@ export default defineComponent({
}
function showContextMenu (item: Components.Tabs.Item) {
contextMenu.show([
const items: Components.ContextMenu.Item[] = [
{ id: 'close', label: t('close'), onClick: () => removeTabs([item]) },
{ id: 'close-others', label: t('tabs.close-others'), onClick: () => removeOther(item) },
{ id: 'close-right', label: t('tabs.close-right'), onClick: () => removeRight(item) },
{ id: 'close-left', label: t('tabs.close-left'), onClick: () => removeLeft(item) },
{ id: 'close-all', label: t('tabs.close-all'), onClick: () => removeAll() },
{ type: 'separator' },
{ id: 'fix', label: item.fixed ? t('tabs.unpin') : t('tabs.pin'), onClick: () => toggleFix(item) },
])
]
props.hookContextMenu?.(item, items)
contextMenu.show(items)
}
function showQuickFilter () {
Expand Down
13 changes: 12 additions & 1 deletion src/renderer/components/TreeNode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,18 @@ summary > .item {
}
.marked {
color: #569bd5;
position: relative;
}
.marked::after {
content: '';
width: 10px;
height: 10px;
background: #569bd5;
border-radius: 50%;
position: absolute;
left: -5px;
top: 34%;
}
.name {
Expand Down
Loading

1 comment on commit 2d8d5f2

@vercel
Copy link

@vercel vercel bot commented on 2d8d5f2 Jul 23, 2023

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-purocean.vercel.app
yn-api-doc.vercel.app
yn-api-doc-git-master-purocean.vercel.app

Please sign in to comment.