From 65f725e4b3e9ad9ca9a3f4c08a2b91fc13a0a03b Mon Sep 17 00:00:00 2001 From: Kagol Date: Sat, 25 Jan 2025 17:40:21 +0800 Subject: [PATCH 1/2] docs(projects): optimize yuque project --- packages/projects/index.html | 2 +- packages/projects/package.json | 1 + packages/projects/src/style.css | 1 + packages/projects/src/views/yuque/YuQue.vue | 320 +++++++++++++++++++- pnpm-lock.yaml | 29 +- 5 files changed, 316 insertions(+), 37 deletions(-) diff --git a/packages/projects/index.html b/packages/projects/index.html index dde16aa..20f5156 100644 --- a/packages/projects/index.html +++ b/packages/projects/index.html @@ -4,7 +4,7 @@ - Vite + Vue + TS + 使用 TinyEditor 搭建的项目
diff --git a/packages/projects/package.json b/packages/projects/package.json index ddd71e2..2e4c5ba 100644 --- a/packages/projects/package.json +++ b/packages/projects/package.json @@ -11,6 +11,7 @@ "dependencies": { "@opentiny/fluent-editor": "3.25.0", "@tailwindcss/vite": "^4.0.0", + "quill-header-list": "0.0.2", "sass": "^1.47.0", "tailwindcss": "^4.0.0", "vue": "^3.5.13", diff --git a/packages/projects/src/style.css b/packages/projects/src/style.css index 2c4e3d7..9ce54df 100644 --- a/packages/projects/src/style.css +++ b/packages/projects/src/style.css @@ -1,2 +1,3 @@ @import 'tailwindcss'; @import '@opentiny/fluent-editor/style.css'; +@import 'quill-header-list/dist/index.css'; diff --git a/packages/projects/src/views/yuque/YuQue.vue b/packages/projects/src/views/yuque/YuQue.vue index 44877be..fd1d33f 100644 --- a/packages/projects/src/views/yuque/YuQue.vue +++ b/packages/projects/src/views/yuque/YuQue.vue @@ -1,8 +1,12 @@ diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 099985d..5ec4f10 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -139,6 +139,9 @@ importers: '@tailwindcss/vite': specifier: ^4.0.0 version: 4.0.0(vite@6.0.11(@types/node@22.10.9)(jiti@2.4.2)(less@4.2.2)(lightningcss@1.29.1)(sass@1.83.4)(yaml@2.7.0)) + quill-header-list: + specifier: 0.0.2 + version: 0.0.2(quill@2.0.3) sass: specifier: ^1.47.0 version: 1.83.4 @@ -1012,42 +1015,36 @@ packages: engines: {node: '>= 10.0.0'} cpu: [arm] os: [linux] - libc: [glibc] '@parcel/watcher-linux-arm-musl@2.5.0': resolution: {integrity: sha512-6uHywSIzz8+vi2lAzFeltnYbdHsDm3iIB57d4g5oaB9vKwjb6N6dRIgZMujw4nm5r6v9/BQH0noq6DzHrqr2pA==} engines: {node: '>= 10.0.0'} cpu: [arm] os: [linux] - libc: [musl] '@parcel/watcher-linux-arm64-glibc@2.5.0': resolution: {integrity: sha512-BfNjXwZKxBy4WibDb/LDCriWSKLz+jJRL3cM/DllnHH5QUyoiUNEp3GmL80ZqxeumoADfCCP19+qiYiC8gUBjA==} engines: {node: '>= 10.0.0'} cpu: [arm64] os: [linux] - libc: [glibc] '@parcel/watcher-linux-arm64-musl@2.5.0': resolution: {integrity: sha512-S1qARKOphxfiBEkwLUbHjCY9BWPdWnW9j7f7Hb2jPplu8UZ3nes7zpPOW9bkLbHRvWM0WDTsjdOTUgW0xLBN1Q==} engines: {node: '>= 10.0.0'} cpu: [arm64] os: [linux] - libc: [musl] '@parcel/watcher-linux-x64-glibc@2.5.0': resolution: {integrity: sha512-d9AOkusyXARkFD66S6zlGXyzx5RvY+chTP9Jp0ypSTC9d4lzyRs9ovGf/80VCxjKddcUvnsGwCHWuF2EoPgWjw==} engines: {node: '>= 10.0.0'} cpu: [x64] os: [linux] - libc: [glibc] '@parcel/watcher-linux-x64-musl@2.5.0': resolution: {integrity: sha512-iqOC+GoTDoFyk/VYSFHwjHhYrk8bljW6zOhPuhi5t9ulqiYq1togGJB5e3PwYVFFfeVgc6pbz3JdQyDoBszVaA==} engines: {node: '>= 10.0.0'} cpu: [x64] os: [linux] - libc: [musl] '@parcel/watcher-win32-arm64@2.5.0': resolution: {integrity: sha512-twtft1d+JRNkM5YbmexfcH/N4znDtjgysFaV9zvZmmJezQsKpkfLYJ+JFV3uygugK6AtIM2oADPkB2AdhBrNig==} @@ -1123,61 +1120,51 @@ packages: resolution: {integrity: sha512-0O8ViX+QcBd3ZmGlcFTnYXZKGbFu09EhgD27tgTdGnkcYXLat4KIsBBQeKLR2xZDCXdIBAlWLkiXE1+rJpCxFw==} cpu: [arm] os: [linux] - libc: [glibc] '@rollup/rollup-linux-arm-musleabihf@4.31.0': resolution: {integrity: sha512-w5IzG0wTVv7B0/SwDnMYmbr2uERQp999q8FMkKG1I+j8hpPX2BYFjWe69xbhbP6J9h2gId/7ogesl9hwblFwwg==} cpu: [arm] os: [linux] - libc: [musl] '@rollup/rollup-linux-arm64-gnu@4.31.0': resolution: {integrity: sha512-JyFFshbN5xwy6fulZ8B/8qOqENRmDdEkcIMF0Zz+RsfamEW+Zabl5jAb0IozP/8UKnJ7g2FtZZPEUIAlUSX8cA==} cpu: [arm64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-arm64-musl@4.31.0': resolution: {integrity: sha512-kpQXQ0UPFeMPmPYksiBL9WS/BDiQEjRGMfklVIsA0Sng347H8W2iexch+IEwaR7OVSKtr2ZFxggt11zVIlZ25g==} cpu: [arm64] os: [linux] - libc: [musl] '@rollup/rollup-linux-loongarch64-gnu@4.31.0': resolution: {integrity: sha512-pMlxLjt60iQTzt9iBb3jZphFIl55a70wexvo8p+vVFK+7ifTRookdoXX3bOsRdmfD+OKnMozKO6XM4zR0sHRrQ==} cpu: [loong64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-powerpc64le-gnu@4.31.0': resolution: {integrity: sha512-D7TXT7I/uKEuWiRkEFbed1UUYZwcJDU4vZQdPTcepK7ecPhzKOYk4Er2YR4uHKme4qDeIh6N3XrLfpuM7vzRWQ==} cpu: [ppc64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-riscv64-gnu@4.31.0': resolution: {integrity: sha512-wal2Tc8O5lMBtoePLBYRKj2CImUCJ4UNGJlLwspx7QApYny7K1cUYlzQ/4IGQBLmm+y0RS7dwc3TDO/pmcneTw==} cpu: [riscv64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-s390x-gnu@4.31.0': resolution: {integrity: sha512-O1o5EUI0+RRMkK9wiTVpk2tyzXdXefHtRTIjBbmFREmNMy7pFeYXCFGbhKFwISA3UOExlo5GGUuuj3oMKdK6JQ==} cpu: [s390x] os: [linux] - libc: [glibc] '@rollup/rollup-linux-x64-gnu@4.31.0': resolution: {integrity: sha512-zSoHl356vKnNxwOWnLd60ixHNPRBglxpv2g7q0Cd3Pmr561gf0HiAcUBRL3S1vPqRC17Zo2CX/9cPkqTIiai1g==} cpu: [x64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-x64-musl@4.31.0': resolution: {integrity: sha512-ypB/HMtcSGhKUQNiFwqgdclWNRrAYDH8iMYH4etw/ZlGwiTVxBz2tDrGRrPlfZu6QjXwtd+C3Zib5pFqID97ZA==} cpu: [x64] os: [linux] - libc: [musl] '@rollup/rollup-win32-arm64-msvc@4.31.0': resolution: {integrity: sha512-JuhN2xdI/m8Hr+aVO3vspO7OQfUFO6bKLIRTAy0U15vmWjnZDLrEgCZ2s6+scAYaQVpYSh9tZtRijApw9IXyMw==} @@ -1290,28 +1277,24 @@ packages: engines: {node: '>= 10'} cpu: [arm64] os: [linux] - libc: [glibc] '@tailwindcss/oxide-linux-arm64-musl@4.0.0': resolution: {integrity: sha512-abhusswkduYWuezkBmgo0K0/erGq3M4Se5xP0fhc/0dKs0X/rJUYYCFWntHb3IGh3aVzdQ0SXJs93P76DbUqtw==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] - libc: [musl] '@tailwindcss/oxide-linux-x64-gnu@4.0.0': resolution: {integrity: sha512-hGtRYIUEx377/HlU49+jvVKKwU1MDSKYSMMs0JFO2Wp7LGxk5+0j5+RBk9NFnmp/lbp32yPTgIOO5m1BmDq36A==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - libc: [glibc] '@tailwindcss/oxide-linux-x64-musl@4.0.0': resolution: {integrity: sha512-7xgQgSAThs0I14VAgmxpJnK6XFSZBxHMGoDXkLyYkEnu+8WRQMbCP93dkCUn2PIv+Q+JulRgc00PJ09uORSLXQ==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - libc: [musl] '@tailwindcss/oxide-win32-arm64-msvc@4.0.0': resolution: {integrity: sha512-qEcgTIPcWY5ZE7f6VxQ/JPrSFMcehzVIlZj7sGE3mVd5YWreAT+Fl1vSP8q2pjnWXn0avZG3Iw7a2hJQAm+fTQ==} @@ -2004,7 +1987,7 @@ packages: resolution: {integrity: sha512-T0+barUSQRTUQASh8bx02dl+DhF54GtIDY13Y3m9oWTklKbb3Wv974meRpeZ3lp1JpLVECWWNHC4vaG2XHXouQ==} concat-map@0.0.1: - resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} + resolution: {integrity: sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=} confbox@0.1.8: resolution: {integrity: sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==} @@ -3278,28 +3261,24 @@ packages: engines: {node: '>= 12.0.0'} cpu: [arm64] os: [linux] - libc: [glibc] lightningcss-linux-arm64-musl@1.29.1: resolution: {integrity: sha512-UKMFrG4rL/uHNgelBsDwJcBqVpzNJbzsKkbI3Ja5fg00sgQnHw/VrzUTEc4jhZ+AN2BvQYz/tkHu4vt1kLuJyw==} engines: {node: '>= 12.0.0'} cpu: [arm64] os: [linux] - libc: [musl] lightningcss-linux-x64-gnu@1.29.1: resolution: {integrity: sha512-u1S+xdODy/eEtjADqirA774y3jLcm8RPtYztwReEXoZKdzgsHYPl0s5V52Tst+GKzqjebkULT86XMSxejzfISw==} engines: {node: '>= 12.0.0'} cpu: [x64] os: [linux] - libc: [glibc] lightningcss-linux-x64-musl@1.29.1: resolution: {integrity: sha512-L0Tx0DtaNUTzXv0lbGCLB/c/qEADanHbu4QdcNOXLIe1i8i22rZRpbT3gpWYsCh9aSL9zFujY/WmEXIatWvXbw==} engines: {node: '>= 12.0.0'} cpu: [x64] os: [linux] - libc: [musl] lightningcss-win32-arm64-msvc@1.29.1: resolution: {integrity: sha512-QoOVnkIEFfbW4xPi+dpdft/zAKmgLgsRHfJalEPYuJDOWf7cLQzYg0DEh8/sn737FaeMJxHZRc1oBreiwZCjog==} From e8e7426b1fe8a9d112e99d1843d1107e377a2192 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Sat, 25 Jan 2025 09:44:18 +0000 Subject: [PATCH 2/2] [autofix.ci] apply automated fixes --- .../fluent-editor/src/config/editor.utils.ts | 6 +- .../src/modules/custom-clipboard.ts | 6 +- .../actions/CustomResizeAction.ts | 4 +- .../modules/table/modules/table-selection.ts | 6 +- .../src/modules/toolbar/better-picker.ts | 2 +- .../src/modules/toolbar/index.ts | 8 +- packages/fluent-editor/src/utils/method.ts | 12 +- packages/projects/src/views/yuque/YuQue.vue | 345 +++++++++--------- 8 files changed, 194 insertions(+), 195 deletions(-) diff --git a/packages/fluent-editor/src/config/editor.utils.ts b/packages/fluent-editor/src/config/editor.utils.ts index f5de587..bcc02f5 100644 --- a/packages/fluent-editor/src/config/editor.utils.ts +++ b/packages/fluent-editor/src/config/editor.utils.ts @@ -196,9 +196,9 @@ export function isInside(position, dom) { } = areaPosition const inside = left > areaLeft - && left < areaLeft + areaWidth - && top > areaTop - && top < areaTop + areaHeight + && left < areaLeft + areaWidth + && top > areaTop + && top < areaTop + areaHeight return inside } diff --git a/packages/fluent-editor/src/modules/custom-clipboard.ts b/packages/fluent-editor/src/modules/custom-clipboard.ts index 58393d9..8d10354 100644 --- a/packages/fluent-editor/src/modules/custom-clipboard.ts +++ b/packages/fluent-editor/src/modules/custom-clipboard.ts @@ -446,9 +446,9 @@ class CustomClipboard extends Clipboard { const hexImage = hexImages.length && hexImages.shift() const newImage = hexImage - && `data:${hexImage.type};base64,${this.convertHexToBase64( - hexImage.hex, - )}` + && `data:${hexImage.type};base64,${this.convertHexToBase64( + hexImage.hex, + )}` imageIndex = index file = await imageUrlToFile(newImage || image.src || image) } diff --git a/packages/fluent-editor/src/modules/custom-image/actions/CustomResizeAction.ts b/packages/fluent-editor/src/modules/custom-image/actions/CustomResizeAction.ts index 6e928a0..d035a03 100644 --- a/packages/fluent-editor/src/modules/custom-image/actions/CustomResizeAction.ts +++ b/packages/fluent-editor/src/modules/custom-image/actions/CustomResizeAction.ts @@ -131,8 +131,8 @@ export default class CustomResizeAction extends Action { rootStyle = getElementStyle(root) } this.maxWidth = root.clientWidth - - Number.parseFloat(rootStyle.paddingRight) - - Number.parseFloat(rootStyle.paddingLeft) + - Number.parseFloat(rootStyle.paddingRight) + - Number.parseFloat(rootStyle.paddingLeft) document.addEventListener('mousemove', this.onDrag) document.addEventListener('mouseup', this.onMouseUp) diff --git a/packages/fluent-editor/src/modules/table/modules/table-selection.ts b/packages/fluent-editor/src/modules/table/modules/table-selection.ts index c871237..db3b8db 100644 --- a/packages/fluent-editor/src/modules/table/modules/table-selection.ts +++ b/packages/fluent-editor/src/modules/table/modules/table-selection.ts @@ -251,9 +251,9 @@ export default class TableSelection { const { x, y, width, height } = getRelativeRect(tableCell.domNode.getBoundingClientRect(), this.quill.root.parentNode) const isCellIncluded = x + ERROR_LIMIT >= this.boundary.x - && x - ERROR_LIMIT + width <= this.boundary.x1 - && y + ERROR_LIMIT >= this.boundary.y - && y - ERROR_LIMIT + height <= this.boundary.y1 + && x - ERROR_LIMIT + width <= this.boundary.x1 + && y + ERROR_LIMIT >= this.boundary.y + && y - ERROR_LIMIT + height <= this.boundary.y1 if (isCellIncluded) { selectedCells.push(tableCell) diff --git a/packages/fluent-editor/src/modules/toolbar/better-picker.ts b/packages/fluent-editor/src/modules/toolbar/better-picker.ts index 5ddf1f6..a035135 100644 --- a/packages/fluent-editor/src/modules/toolbar/better-picker.ts +++ b/packages/fluent-editor/src/modules/toolbar/better-picker.ts @@ -196,7 +196,7 @@ class Picker { } const isActive = !isNullOrUndefined(option) - && option !== this.select.querySelector('option[selected]') + && option !== this.select.querySelector('option[selected]') if (isActive) { this.label.classList.add('ql-active') diff --git a/packages/fluent-editor/src/modules/toolbar/index.ts b/packages/fluent-editor/src/modules/toolbar/index.ts index cd9630a..4bc26bd 100644 --- a/packages/fluent-editor/src/modules/toolbar/index.ts +++ b/packages/fluent-editor/src/modules/toolbar/index.ts @@ -67,10 +67,10 @@ class BetterToolbar extends Toolbar { // '1' should match with 1 (headers) let isActive = formats[format] === input.getAttribute('value') - || (!isNullOrUndefined(formats[format]) - && (formats[format].value === input.getAttribute('value') - || formats[format].toString() === input.getAttribute('value'))) - || (isNullOrUndefined(formats[format]) && !input.getAttribute('value')) + || (!isNullOrUndefined(formats[format]) + && (formats[format].value === input.getAttribute('value') + || formats[format].toString() === input.getAttribute('value'))) + || (isNullOrUndefined(formats[format]) && !input.getAttribute('value')) if (!isActive) { const checkFormat = formats[format] diff --git a/packages/fluent-editor/src/utils/method.ts b/packages/fluent-editor/src/utils/method.ts index c542a05..fff42da 100644 --- a/packages/fluent-editor/src/utils/method.ts +++ b/packages/fluent-editor/src/utils/method.ts @@ -1,16 +1,16 @@ /** Detect free variable `global` from Node.js. */ const freeGlobal = typeof global === 'object' - && global !== null - && global.Object === Object - && global + && global !== null + && global.Object === Object + && global /** Detect free variable `globalThis` */ const freeGlobalThis = typeof globalThis === 'object' - && globalThis !== null - && globalThis.Object == Object - && globalThis + && globalThis !== null + && globalThis.Object == Object + && globalThis /** Detect free variable `self`. */ const freeSelf diff --git a/packages/projects/src/views/yuque/YuQue.vue b/packages/projects/src/views/yuque/YuQue.vue index fd1d33f..dd807f0 100644 --- a/packages/projects/src/views/yuque/YuQue.vue +++ b/packages/projects/src/views/yuque/YuQue.vue @@ -12,7 +12,7 @@ onMounted(() => { editor = new FluentEditor('#editor', { theme: 'snow', modules: { - toolbar: { + 'toolbar': { container: '#toolbar', handlers: { 'header-list': HeaderList.toolbarHandle, @@ -30,7 +30,9 @@ onMounted(() => {
- <返回 + + <返回 +
{ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
@@ -230,8 +232,7 @@ onMounted(() => { class="ql-normal-link" href="https://opentiny.github.io/tiny-editor/" target="_blank" - >测试文档 + >测试文档

这是粗体

这是斜体

@@ -241,123 +242,121 @@ onMounted(() => {

这是文本色背景色 + >背景色

  1. - 这是一个无序列表 + 这是一个无序列表
  2. - 这是一个无序列表 + 这是一个无序列表
  3. - 这是一个有序列表 + 这是一个有序列表
  4. - 这是一个有序列表 + 这是一个有序列表
  5. - 这是一个任务项 + 这是一个任务项
  6. - 这是一个任务项 + 这是一个任务项
这是一段引用
这是一段引用

- 这是一段行内代码。 + 这是一段行内代码

-
+

标题1

标题2

标题3

标题4

标题5
标题6
-


-


-


-


-


-


-


-


-


-


-


+


+


+


+


+


+


+


+


+


+


+


标题2

正文

-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


-


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


+


这是测试文档的底部。