Skip to content

Commit

Permalink
docs(projects): optimize yuque project
Browse files Browse the repository at this point in the history
  • Loading branch information
kagol committed Jan 25, 2025
1 parent 64817e9 commit 11e3c68
Show file tree
Hide file tree
Showing 11 changed files with 334 additions and 56 deletions.
6 changes: 3 additions & 3 deletions packages/fluent-editor/src/config/editor.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
6 changes: 3 additions & 3 deletions packages/fluent-editor/src/modules/custom-clipboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions packages/fluent-editor/src/modules/toolbar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,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]
Expand Down
12 changes: 6 additions & 6 deletions packages/fluent-editor/src/utils/method.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/projects/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + Vue + TS</title>
<title>使用 TinyEditor 搭建的项目</title>
</head>
<body>
<div id="app"></div>
Expand Down
1 change: 1 addition & 0 deletions packages/projects/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions packages/projects/src/style.css
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
@import 'tailwindcss';
@import '@opentiny/fluent-editor/style.css';
@import 'quill-header-list/dist/index.css';
Loading

0 comments on commit 11e3c68

Please sign in to comment.