Skip to content

Commit

Permalink
Merge branch 'release/3.73.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
purocean committed Jul 16, 2024
2 parents 7784cdc + 572b344 commit d559a9e
Show file tree
Hide file tree
Showing 34 changed files with 668 additions and 170 deletions.
34 changes: 15 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,25 +76,21 @@ For more information on how to use the following functions, please see [characte

## Changelogs

### [v3.72.2](https://github.com/purocean/yn/releases/tag/v3.72.2) 2024-07-04

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

1. feat: Optimize the experience of using automatic numbering for ordered lists, and support disabling automatic numbering in configuration options.
2. feat: Use the table of contents outline to jump/automatically focus on the editor after displaying the editor.
3. feat: Optimize syntax suggestion completion, distinguish between inline elements and block elements, and support quickly adding table rows.
4. feat: Add a right-click context menu for images in the preview area, supporting operations such as copying images and opening images.
5. feat: Optimize the navigation stack, supporting anchor positioning and maintaining scroll position.
6. feat: Support automatic scrolling to the bottom when running code.
7. feat: Automatically trigger Wiki link suggestions when typing `【【`.
8. feat: Other interaction experience optimizations and bug fixes.
9. dix: Disable automatic updates for the Windows zip version to avoid repeated upgrade failure issues.
10. feat(plugin): The `markdown-link` plugin exposes the `mdRuleConvertLink`, `htmlHandleLink` methods.
11. feat(plugin): `ctx.doc.switchDoc` adds more parameters, supporting jumping to a specified location.
12. feat(plugin): Add the `ctx.routines.changePosition` method to jump to a specified location in the current document.
13. feat(plugin): Add the `ctx.view.highlightAnchor` method to highlight/jump to a specified anchor in the current preview area.
14. feat(plugin): Add the `ctx.view.getScrollTop` method to get the current scroll position of the preview area.
15. feat(plugin): Add the `DOC_SWITCH_SKIPPED` Hook, which is triggered when attempting to switch to the current document.
### [v3.73.1](https://github.com/purocean/yn/releases/tag/v3.73.1) 2024-07-16

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

4. feat: Optimize file creation feature, add file type selection
5. feat: Quick jump/recent documents function supports more file types
6. feat: Add support for the `code-group` container block compatible with [VitePress](https://vitepress.dev/zh/guide/markdown#code-groups) style
7. feat: Support for customizing the repository switch shortcut key. If your keyboard layout is not US, you can clear or change the shortcut key to avoid input interference
8. feat: Optimize the selection of text in the code execution result, now you can select all the output content by double-clicking the execution result area
9. feat: Optimize the function of opening HTML files
10. feat: Support editing `.mjs`, `.mts`, '.cjs', `.cts` files
11. feat: Optimize navigation history
12. fix: Fix the issue of not being able to display directories ending with `git`, such as `testgit`
13. feat(plugin): Add API related to file type registration, such as `ctx.doc.registerDocCategory`
14. feat(plugin): Add API for changing directory tree operation buttons `ctx.tree.tapNodeActionButtons`

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

Expand Down
34 changes: 15 additions & 19 deletions README_ZH-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,25 +76,21 @@

## 更新日志

### [v3.72.2](https://github.com/purocean/yn/releases/tag/v3.72.2) 2024-07-04

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

1. feat: 优化有序列表自动编号使用体验,配置项支持禁用自动编号
2. feat: 使用目录大纲跳转/显示编辑器后自动聚焦编辑器
3. feat: 优化语法建议补全,区分行内元素和块元素,支持快速新增表格行
4. feat: 预览区图片增加右键上下文菜单,支持复制图片、打开图片等操作
5. feat: 优化导航堆栈,支持锚点定位和滚动位置保持
6. feat: 代码运行支持自动滚动到底部
7. feat: 输入 `【【` 时自动触发 Wiki 链接建议
8. feat: 其他交互体验优化和问题修复
9. dix: Windows zip 版本禁用自动更新,避免反复升级失败问题
10. feat(plugin): `markdown-link` 插件暴露 `mdRuleConvertLink`, `htmlHandleLink` 方法
11. feat(plugin): `ctx.doc.switchDoc` 增加更多参数,支持跳转到指定位置
12. feat(plugin): 增加 `ctx.routines.changePosition` 方法,用以跳转到当前文档的指定位置
13. feat(plugin): 增加 `ctx.view.highlightAnchor` 方法,用以高亮/跳转到当前预览区的指定锚点
14. feat(plugin): 增加 `ctx.view.getScrollTop` 方法,用以获取当前预览区的滚动位置
15. feat(plugin): 增加 `DOC_SWITCH_SKIPPED` Hook,尝试切换到当前文档时触发
### [v3.73.1](https://github.com/purocean/yn/releases/tag/v3.73.1) 2024-07-16

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

4. feat: 优化文件创建功能,增加文件类型选择
5. feat: 快速跳转/最近打开文档功能支持更多文件类型
6. feat: 增加兼容[VitePress](https://vitepress.dev/zh/guide/markdown#code-groups) 风格的 `code-group` 容器块
7. feat: 支持自定义切换仓库快捷键。如果你的键盘布局不是 US,可以清除或更改快捷键避免干扰输入
8. feat: 优化运行代码结果文本选择,现在双击运行结果区域即可选中所有的输出内容
9. feat: 优化打开 HTML 文件功能
10. feat: 支持编辑 `.mjs`, `.mts`, '.cjs', `.cts` 文件
11. feat: 优化导航历史记录
12. fix: 修复不能显示 `git` 结尾的目录问题如 `testgit`
13. feat(plugin): 增加注册文件类型相关 Api 如 `ctx.doc.registerDocCategory`
14. feat(plugin): 增加更改目录树操作按钮 Api `ctx.tree.tapNodeActionButtons`

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

Expand Down
13 changes: 12 additions & 1 deletion help/FEATURES.md
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ Support functions similiar to [VuePress Container Block](https://v2.vuepress.vue

`type` is required, `title` and `content` are optional.

The supported `types` are: tip, warning, danger, details, group, group-item, row, col, section, div
The supported `types` are: tip, warning, danger, details, code-group, group, group-item, row, col, section, div

**Example**

Expand Down Expand Up @@ -557,6 +557,17 @@ test 3
:::
::::

::: code-group
```js [test.js]
let a = 1
```

```ts [test.ts]
let a: number = 1
```
:::


::::: row Columns
:::: col TODO
::: warning
Expand Down
12 changes: 11 additions & 1 deletion help/FEATURES_ZH-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ chart.setOption(option, true)

`type` 是必需的, `title``content` 是可选的。

支持的 `type` 有:tip, warning, danger, details, group, group-item, row, col, section, div
支持的 `type` 有:tip, warning, danger, details, code-group, group, group-item, row, col, section, div

**示例**

Expand Down Expand Up @@ -555,6 +555,16 @@ test 3
:::
::::

::: code-group
```js [test.js]
let a = 1
```

```ts [test.ts]
let a: number = 1
```
:::

::::: row 分列示例
:::: col TODO
::: warning
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "yank.note",
"version": "3.72.2",
"version": "3.73.1",
"description": "Yank Note: A highly extensible Markdown editor, designed for productivity.",
"main": "dist/main/app.js",
"license": "AGPL-3.0",
Expand Down Expand Up @@ -57,7 +57,7 @@
"socks": "^2.8.3",
"tar-stream": "^2.2.0",
"transliteration": "^2.2.0",
"undici": "^6.16.1",
"undici": "^6.19.2",
"uuid": "^9.0.0",
"yaml": "^2.2.2",
"yargs": "^15.3.1"
Expand Down Expand Up @@ -133,7 +133,7 @@
"markdown-it-multimd-table": "^4.2.3",
"markdown-it-sub": "^2.0.0",
"markdown-it-sup": "^2.0.0",
"monaco-editor": "^0.47.0",
"monaco-editor": "^0.50.0",
"normalize.css": "^8.0.1",
"parse-author": "^2.0.0",
"path-browserify": "^1.0.1",
Expand Down
27 changes: 24 additions & 3 deletions src/main/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,34 @@ const attachment = async (ctx: any, next: any) => {
await file.upload(repo, buffer, path)
ctx.body = result('ok', 'success', path)
} else if (ctx.method === 'GET') {
const { repo, path } = ctx.query
let { repo, path } = ctx.query

if (!repo || !path) {
const filePath = ctx.path.replace('/api/attachment', '')
const arr = filePath.split('/')
repo = decodeURIComponent(arr[1] || '')
path = decodeURI(arr.slice(2).join('/'))
}

if (!repo || !path) {
throw new Error('Invalid path.')
}

checkPrivateRepo(ctx, repo)

noCache(ctx)
ctx.type = mime.getType(path)
ctx.body = await file.read(repo, path)

try {
ctx.body = await file.read(repo, path)
ctx.type = mime.getType(path)
} catch (error: any) {
if (error.code === 'ENOENT') {
ctx.status = 404
ctx.body = result('error', 'Not found')
} else {
throw error
}
}
}
} else {
await next()
Expand Down
90 changes: 90 additions & 0 deletions src/renderer/components/CreateFilePanel.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<template>
<div class="create-file-panel">
<div class="category-list-wrapper">
<div class="category" v-for="category in xCategories" :key="category.category">
<div v-if="categories.length > 1" class="category-title">{{ category.displayName }}</div>
<div class="category-list">
<template v-for="item in category.types" :key="item.id">
<div
class="category-item"
@click="emits('updateDocType', item)"
>
<input type="radio" :checked="item.id === docType?.id" />
{{ item.displayName }}({{ item.extension[0] }})
</div>
</template>
</div>
</div>
</div>
<div class="current-path">{{ $t('document.current-path', currentPath) }}</div>
</div>
</template>

<script lang="ts" setup>
import { computed } from 'vue'
import type { DocCategory, DocType } from '@fe/types'
import { useI18n } from '@fe/services/i18n'
const { $t } = useI18n()
const props = defineProps<{
currentPath: string;
categories: DocCategory[];
docType?: DocType | null
}>()
const emits = defineEmits<{
'updateDocType': [docType: DocType];
}>()
const xCategories = computed(() => props.categories.map(x => ({
...x,
types: x.types.filter(x => !!x.buildNewContent)
})).filter(x => x.types.length))
</script>

<style lang="scss" scoped>
.create-file-panel {
.category-list-wrapper {
max-height: calc(100vh - 300px);
overflow-y: auto
}
.category {
padding-left: 8px;
margin-bottom: 4px;
.category-title {
font-size: 14px;
font-weight: bold;
margin-bottom: 10px;
}
.category-list {
display: flex;
flex-wrap: wrap;
padding-left: 8px;
}
.category-item {
cursor: pointer;
display: flex;
align-items: center;
margin-right: 10px;
margin-bottom: 10px;
font-size: 14px;
input {
cursor: pointer;
margin-right: 5px;
}
}
}
.current-path {
margin-bottom: 8px;
font-size: 13px;
}
}
</style>
6 changes: 3 additions & 3 deletions src/renderer/components/FileTabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { Alt, CtrlCmd, getKeysLabel, Shift } from '@fe/core/keybinding'
import type { Components, Doc, PathItem } from '@fe/types'
import { registerHook, removeHook } from '@fe/core/hook'
import { registerAction, removeAction } from '@fe/core/action'
import { isEncrypted, isMarkdownFile, isOutOfRepo, isSameFile, isSubOrSameFile, switchDoc, toUri } from '@fe/services/document'
import { isEncrypted, isOutOfRepo, isSameFile, isSubOrSameFile, supported, switchDoc, toUri } from '@fe/services/document'
import store from '@fe/support/store'
import { useI18n } from '@fe/services/i18n'
import { FileTabs } from '@fe/services/workbench'
Expand Down Expand Up @@ -152,7 +152,7 @@ export default defineComponent({
async function handleMoved (payload?: { oldDoc: Doc, newDoc: Doc }) {
if (payload) {
if (
isMarkdownFile(payload.newDoc) &&
supported(payload.newDoc) &&
isSameFile(payload.oldDoc, currentFile.value)
) {
await switchFile(payload.newDoc)
Expand All @@ -162,7 +162,7 @@ export default defineComponent({
}
function handleDocCreated ({ doc }: { doc: Doc | null }) {
if (!doc || isMarkdownFile(doc)) {
if (!doc || supported(doc)) {
switchFile(doc)
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/components/GetStarted.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ import store from '@fe/support/store'
import { showManager as showExtensionManager } from '@fe/others/extension'
import { showPremium, getPurchased } from '@fe/others/premium'
import { showSettingPanel } from '@fe/services/setting'
import { createDoc, isMarkdownFile, switchDoc } from '@fe/services/document'
import { createDoc, supported, switchDoc } from '@fe/services/document'
import { getActionHandler } from '@fe/core/action'
useI18n()
Expand All @@ -89,7 +89,7 @@ const files = computed(() => {
let tmp: any[] = []
tree.forEach((node: any) => {
if (isMarkdownFile(node)) {
if (supported(node)) {
const time = map[`${node.repo}|${node.path}`]
if (time) {
tmp.push({ node, time })
Expand Down
10 changes: 5 additions & 5 deletions src/renderer/components/QuickOpen.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ import { computed, defineComponent, nextTick, onMounted, ref, toRefs, watch } fr
import { useI18n } from '@fe/services/i18n'
import fuzzyMatch from '@fe/others/fuzzy-match'
import { fetchSettings } from '@fe/services/setting'
import { isMarkdownFile, isMarked } from '@fe/services/document'
import { isMarked, supported } from '@fe/services/document'
import store from '@fe/support/store'
import { PathItem } from '@fe/types'
Expand Down Expand Up @@ -101,7 +101,7 @@ export default defineComponent({
let tmp: any[] = []
tree.forEach((node: any) => {
if (isMarkdownFile(node)) {
if (supported(node)) {
tmp.push(node)
}
Expand Down Expand Up @@ -340,7 +340,7 @@ export default defineComponent({
}
.result li {
color: var(--g-color-40);
color: var(--g-color-20);
line-height: 1.5em;
font-size: 18px;
padding: 2px 6px;
Expand All @@ -351,7 +351,7 @@ export default defineComponent({
.result li.selected {
background: var(--g-color-active-a);
color: var(--g-color-10);
color: var(--g-color-2);
}
.result li.marked::after {
Expand Down Expand Up @@ -399,7 +399,7 @@ export default defineComponent({
background: var(--g-color-active-d);;
cursor: pointer;
transition: all .1s ease-in-out;
color: var(--g-color-10);
color: var(--g-color-0);
border-right: 1px var(--g-color-80) solid;
}
Expand Down
Loading

0 comments on commit d559a9e

Please sign in to comment.