Skip to content

Commit

Permalink
Deploy to GitHub pages
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Oct 31, 2023
0 parents commit 0a4c587
Show file tree
Hide file tree
Showing 10 changed files with 444 additions and 0 deletions.
117 changes: 117 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<div align="center">
<img alt="icon" src="https://cdn.jsdelivr.net/gh/Zuoqiu-Yingyi/siyuan-plugin-typewriter/public/icon.png" style="width: 8em; height: 8em;">

---
[![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/Zuoqiu-Yingyi/siyuan-plugin-typewriter?include_prereleases&style=flat-square)](https://github.com/Zuoqiu-Yingyi/siyuan-plugin-typewriter/releases/latest)
[![GitHub Release Date](https://img.shields.io/github/release-date/Zuoqiu-Yingyi/siyuan-plugin-typewriter?style=flat-square)](https://github.com/Zuoqiu-Yingyi/siyuan-plugin-typewriter/releases/latest)
[![GitHub License](https://img.shields.io/github/license/Zuoqiu-Yingyi/siyuan-plugin-typewriter?style=flat-square)](https://github.com/Zuoqiu-Yingyi/siyuan-plugin-typewriter/blob/main/LICENSE)
[![GitHub last commit](https://img.shields.io/github/last-commit/Zuoqiu-Yingyi/siyuan-plugin-typewriter?style=flat-square)](https://github.com/Zuoqiu-Yingyi/siyuan-plugin-typewriter/commits/main)
![GitHub repo size](https://img.shields.io/github/repo-size/Zuoqiu-Yingyi/siyuan-plugin-typewriter?style=flat-square)
![hits](https://hits.b3log.org/Zuoqiu-Yingyi/siyuan-plugin-typewriter.svg)
<!-- ![jsDelivr hits (GitHub)](https://img.shields.io/jsdelivr/gh/hy/Zuoqiu-Yingyi/siyuan-packages-typewriter?style=flat-square) -->
[![GitHub all releases](https://img.shields.io/github/downloads/Zuoqiu-Yingyi/siyuan-plugin-typewriter/total?style=flat-square)](https://github.com/Zuoqiu-Yingyi/siyuan-plugin-typewriter/releases)

---
[简体中文](./README_zh_CN.md) \| English

---
</div>

# Typewriter Mode Plugin for SiYuan

This is a plug-in for [SiYuan Note](https://github.com/siyuan-note/siyuan) that can highlight the currently edited block and automatically scroll it to the center of the editing area.

## Preview

![Preview Image](https://cdn.jsdelivr.net/gh/Zuoqiu-Yingyi/siyuan-plugin-typewriter/public/preview.png)

## Frequently Asked Questions

## Introduction

### Features

* `Focus Display`

* Show the currently edited block (block where the cursor is located) in the editor

* Each currently edited block (cell in a table) in the editor will have the attribute `data-plugin-focus="true"`
* The currently edited block (cell where the cursor is located) will have the `id` attribute `plugin-focus-unique-id`
* `CSS` style variables can be modified in <kbd>SiYuan Settings &gt; Appearance &gt; Code Snippet</kbd>

* ```css
:root {
/* Focus shadow blur radius */
--custom-focus-shadow-blur: 0.25em;
/* Focus shadow color */
--custom-focus-shadow-color: var(--b3-theme-secondary);

/* Global unique focus shadow color */
--custom-focus-unique-shadow-color: var(--b3-theme-primary);

/* Outline width of the table row with focus */
--custom-focus-table-row-outline-width: 1px;
/* Outline color of the table row with focus */
--custom-focus-table-row-outline-color: var(--b3-theme-on-surface);

/* Shadow blur radius of the table cell with focus */
--custom-focus-table-cell-shadow-blur: 0.25em;
}
```
* `Typewriter Mode`

* Keep the currently edited block (block where the cursor is located) in the middle of the editor

* If the cursor is in a table block, the cell where the cursor is located can be kept in the middle of the editor
* If the cursor is in a code block, the line where the cursor is located can be kept in the middle of the editor
* This mode can be enabled/disabled in the following ways

* <kbd>This Plugin Settings Panel &gt; Typewriter Settings &gt; Enable Typewriter Mode</kbd>
* `Typewriter Mode` button in the top-right corner of the menu bar
* Shortcut key <kbd>Shift + Alt + T</kbd>
* Command Palette option `Toggle Typewriter Mode`

### Settings

* General Settings

* `Reset Settings`

* This button will reset all settings to their default values
* The page will be refreshed after resetting
* Focus Settings

* `Display Current Focus`

* When enabled, the currently edited block will be highlighted in the editor (outline will be added to the currently edited block)

* The element of the currently edited block will have attributes `data-plugin-focus="true"` and `id="plugin-focus-unique-id"`
* When disabled, the currently edited block will no longer be highlighted

* All attributes `data-plugin-focus="true"` and `id="plugin-focus-unique-id"` will be removed
* This option does not apply the features of Typewriter Mode
* Typewriter Settings

* `Enable Typewriter Mode`

* When enabled, the block where the cursor is located will automatically scroll to the middle of the editor while editing
* `Code Block Line Focus Follow`

* When enabled, the line of code where the cursor is located will be scrolled to the middle of the editor while editing a code block
* When disabled, the code block will be scrolled to the middle of the editor while editing a code block
* `Table Block Cell Focus Follow`

* When enabled, the table cell where the cursor is located will be scrolled to the middle of the editor while editing a table block
* When disabled, the table block will be scrolled to the middle of the editor while editing a table block
* `Database Block Cell Focus Follow`

* When enabled, the cell where the cursor is located will be scrolled to the middle of the editor while editing a database block (property view).
* When disabled, the entire database block will be scrolled to the middle of the editor while editing a database block (property view).
* `Scroll Delay`

* After the cursor moves to another block, the block where the cursor is located will scroll to the middle of the editor after a certain delay
* Unit: Milliseconds

## Changelog

[CHANGELOG.md](https://github.com/Zuoqiu-Yingyi/siyuan-plugin-typewriter/blob/main/CHANGELOG.md)
117 changes: 117 additions & 0 deletions README_zh_CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<div align="center">
<img alt="图标" src="https://cdn.jsdelivr.net/gh/Zuoqiu-Yingyi/siyuan-plugin-typewriter/public/icon.png" style="width: 8em; height: 8em;">

---
[![GitHub 最新发行版本 (最新一次发行/预发行)](https://img.shields.io/github/v/release/Zuoqiu-Yingyi/siyuan-plugin-typewriter?include_prereleases&style=flat-square)](https://github.com/Zuoqiu-Yingyi/siyuan-plugin-typewriter/releases/latest)
[![GitHub 最新发行时间](https://img.shields.io/github/release-date/Zuoqiu-Yingyi/siyuan-plugin-typewriter?style=flat-square)](https://github.com/Zuoqiu-Yingyi/siyuan-plugin-typewriter/releases/latest)
[![GitHub 许可证](https://img.shields.io/github/license/Zuoqiu-Yingyi/siyuan-plugin-typewriter?style=flat-square)](https://github.com/Zuoqiu-Yingyi/siyuan-plugin-typewriter/blob/main/LICENSE)
[![GitHub 最后一次提交时间](https://img.shields.io/github/last-commit/Zuoqiu-Yingyi/siyuan-plugin-typewriter?style=flat-square)](https://github.com/Zuoqiu-Yingyi/siyuan-plugin-typewriter/commits/main)
![GitHub 仓库大小](https://img.shields.io/github/repo-size/Zuoqiu-Yingyi/siyuan-plugin-typewriter?style=flat-square)
![查看次数](https://hits.b3log.org/Zuoqiu-Yingyi/siyuan-plugin-typewriter.svg)
<!-- ![jsDelivr 查看次數 (GitHub)](https://img.shields.io/jsdelivr/gh/hy/Zuoqiu-Yingyi/siyuan-packages-typewriter?style=flat-square) -->
[![GitHub 发行版本下载次数](https://img.shields.io/github/downloads/Zuoqiu-Yingyi/siyuan-plugin-typewriter/total?style=flat-square)](https://github.com/Zuoqiu-Yingyi/siyuan-plugin-typewriter/releases)

---
简体中文 \| [English](./README.md)

---
</div>

# 思源打字机模式插件

这是一款可以突出显示当前正在编辑的块, 并将其自动滚动至编辑区中间的[思源笔记](https://github.com/siyuan-note/siyuan)插件。

## 预览

![预览图片](https://cdn.jsdelivr.net/gh/Zuoqiu-Yingyi/siyuan-plugin-typewriter/public/preview.png)

## 常见问题

## 介绍

### 功能介绍

* `焦点显示`

* 在编辑器中显示当前正在编辑的块 (光标所在的块)

* 每个编辑器中当前正在编辑的块 (表格中当前正在编辑的单元格) 元素会设置属性 `data-plugin-focus="true"`
* 当前光标所在的块 (表格中当前光标所在的单元格) 元素会设置 `id` 属性 `plugin-focus-unique-id`
* `CSS` 样式变量, 可以在 <kbd>思源设置 &gt; 外观 &gt; 代码片段</kbd> 中修改

* ```css
:root {
/* 焦点阴影模糊半径 */
--custom-focus-shadow-blur: 0.25em;
/* 焦点阴影的颜色 */
--custom-focus-shadow-color: var(--b3-theme-secondary);

/* 全局唯一焦点阴影的颜色 */
--custom-focus-unique-shadow-color: var(--b3-theme-primary);

/* 焦点所在表格行的轮廓宽度 */
--custom-focus-table-row-outline-width: 1px;
/* 焦点所在表格行的轮廓颜色 */
--custom-focus-table-row-outline-color: var(--b3-theme-on-surface);

/* 焦点所在表格单元格的阴影模糊半径 */
--custom-focus-table-cell-shadow-blur: 0.25em;
}
```
* `打字机模式`

* 将当前正在编辑的块 (光标所在的块) 保持在编辑区中间

* 若光标位于表格块中, 可以将光标所在的单元格保持在编辑区中间
* 若光标位于代码块中, 可以将光标所在的行保持在编辑区中间
* 可以通过如下方式打开/关闭该模式

* <kbd>本插件设置面板 &gt; 打字机设置 &gt; 启用打字机模式</kbd>
* 右上角顶部菜单栏中的 `打字机模式` 按钮
* 快捷键 <kbd>Shift + Alt + T</kbd>
* 命令面板 `打开/关闭打字机模式` 选项

### 设置项介绍

* 常规设置

* `重置设置选项`

* 该按钮将重置所有设置选项为默认选项
* 重置后将刷新页面
* 焦点设置

* `显示当前焦点`

* 开启后将在编辑器中显示当前正在编辑的块 (为当前正在编辑的块添加一个轮廓)

* 当前正在编辑的块元素将设置属性 `data-plugin-focus="true"` 与 `id="plugin-focus-unique-id"`
* 关闭后将不再突出显示当前正在编辑的块

* 移除所有的属性 `data-plugin-focus="true"` 与 `id="plugin-focus-unique-id"`
* 该选项不会应用打字机模式的功能
* 打字机设置

* `启用打字机模式`

* 开启后在编辑时焦点所在块将自动滚动至编辑区中间
* `代码块焦点跟随行`

* 开启后在编辑代码块时, 将光标所在的代码行滚动至编辑区中间
* 关闭后在编辑代码块时, 将该代码块滚动至编辑区中间
* `表格块焦点跟随单元格`

* 开启后在编辑表格块时, 将光标所在的表格单元格滚动至编辑区中间
* 关闭后在编辑表格块时, 将该表格块滚动至编辑区中间
* `数据库焦点跟随单元格`

* 开启后在编辑数据库块(属性视图)时, 将光标所在的单元格滚动至编辑区中间
* 关闭后在编辑数据库块(属性视图)时, 将该数据库块滚动至编辑区中间
* `滚动延时时间`

* 当光标位置移动至其他块时, 经过一定延时后光标所在的块再滚动至编辑区中间
* 单位: 毫秒

## 更改日志

[CHANGELOG.md](https://github.com/Zuoqiu-Yingyi/siyuan-plugin-typewriter/blob/main/CHANGELOG.md)
52 changes: 52 additions & 0 deletions i18n/en_US.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"menu": {
"switch": {
"command": {
"text": "Toggle Typewriter Mode"
},
"disabled": "Typewriter Mode 🚫",
"enabled": "Typewriter Mode ✅",
"title": "Typewriter Mode"
}
},
"settings": {
"focusSettings": {
"enable": {
"description": "Enable to display the currently edited block in the editor",
"title": "Display current focus"
},
"title": "Focus"
},
"generalSettings": {
"reset": {
"description": "Reset all settings options to default options (refresh page after reset)",
"text": "Reset",
"title": "Reset settings options"
},
"title": "General"
},
"typewriterSettings": {
"code": {
"description": "Scroll in lines when focus is inside a code block",
"title": "Code Block Line Focus Follow"
},
"enable": {
"description": "When Typewriter Mode is enabled, the block with focus will automatically scroll to the middle of the editing area",
"title": "Enable Typewriter Mode"
},
"table": {
"description": "Scroll in cells when focus is inside a table block",
"title": "Table Block Cell Focus Follow"
},
"timeout": {
"description": "Set the time interval between edit actions and the start of scrolling.<br/>Unit: milliseconds",
"title": "Scroll Delay Time"
},
"title": "Typewriter",
"view": {
"description": "Scroll in cells when the focus is inside the database block",
"title": "Database Block Cell Focus"
}
}
}
}
52 changes: 52 additions & 0 deletions i18n/zh_CHT.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"menu": {
"switch": {
"command": {
"text": "開啟/關閉打字機模式"
},
"disabled": "打字機模式 🚫",
"enabled": "打字機模式 ✅",
"title": "打字機模式"
}
},
"settings": {
"focusSettings": {
"enable": {
"description": "開啟後在編輯器中顯示當前正在編輯的塊",
"title": "顯示當前焦點"
},
"title": "焦點設置"
},
"generalSettings": {
"reset": {
"description": "重置所有設置選項為默認選項(重置後將刷新頁面)",
"text": "重置",
"title": "重置設置選項"
},
"title": "常規設置"
},
"typewriterSettings": {
"code": {
"description": "焦點位於代碼塊內部時以行為單位進行滾動",
"title": "代碼塊焦點跟隨行"
},
"enable": {
"description": "開啟打字機模式後,編輯時焦點所在塊將自動滾動至編輯區中間",
"title": "啟用打字機模式"
},
"table": {
"description": "焦點位於表格塊內部時以單元格為單位進行滾動",
"title": "表格塊焦點跟隨單元格"
},
"timeout": {
"description": "設置編輯操作與開始滾動之間的時間間隔<br/>單位:毫秒",
"title": "滾動延時時間"
},
"title": "打字機設置",
"view": {
"description": "焦點位於數據庫塊內部時以單元格為單位進行滾動",
"title": "數據庫焦點跟隨單元格"
}
}
}
}
52 changes: 52 additions & 0 deletions i18n/zh_CN.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"menu": {
"switch": {
"command": {
"text": "开启/关闭打字机模式"
},
"disabled": "打字机模式 🚫",
"enabled": "打字机模式 ✅",
"title": "打字机模式"
}
},
"settings": {
"focusSettings": {
"enable": {
"description": "开启后在编辑器中显示当前正在编辑的块",
"title": "显示当前焦点"
},
"title": "焦点设置"
},
"generalSettings": {
"reset": {
"description": "重置所有设置选项为默认选项(重置后将刷新页面)",
"text": "重置",
"title": "重置设置选项"
},
"title": "常规设置"
},
"typewriterSettings": {
"code": {
"description": "焦点位于代码块内部时以行为单位进行滚动",
"title": "代码块焦点跟随行"
},
"enable": {
"description": "开启打字机模式后,编辑时焦点所在块将自动滚动至编辑区中间",
"title": "启用打字机模式"
},
"table": {
"description": "焦点位于表格块内部时以单元格为单位进行滚动",
"title": "表格块焦点跟随单元格"
},
"timeout": {
"description": "设置编辑操作与开始滚动之间的时间间隔<br/>单位:毫秒",
"title": "滚动延时时间"
},
"title": "打字机设置",
"view": {
"description": "焦点位于数据库块内部时以单元格为单位进行滚动",
"title": "数据库焦点跟随单元格"
}
}
}
}
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions index.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions index.js

Large diffs are not rendered by default.

Loading

0 comments on commit 0a4c587

Please # to comment.