Skip to content

fix(vue-renderless/fluent-editor): Fix lineheight formatting to use '…#4212

Open
cfljue wants to merge 1 commit into
opentiny:devfrom
cfljue:cfl/fix-rich-editor-line-height
Open

fix(vue-renderless/fluent-editor): Fix lineheight formatting to use '…#4212
cfljue wants to merge 1 commit into
opentiny:devfrom
cfljue:cfl/fix-rich-editor-line-height

Conversation

@cfljue

@cfljue cfljue commented May 18, 2026

Copy link
Copy Markdown

Fix the issue where the line height setting for the rich text editor does not take effect

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: 4211

What is the new behavior?

Fix the bug

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • Bug Fixes
    • Fixed line height formatting functionality to apply correctly when adjusting text line heights.

Review Change Stack

…line-height'

Fix the issue where the line height setting for the rich text editor does not take effect
@github-actions github-actions Bot added the bug Something isn't working label May 18, 2026
@coderabbitai

coderabbitai Bot commented May 18, 2026

Copy link
Copy Markdown

Walkthrough

Single-line change: the lineheightHandler in the fluent editor now uses the standard Quill format key 'line-height' instead of 'lineheight' when applying line height formatting.

Changes

Line-height formatting key update

Layer / File(s) Summary
Line-height handler format key
packages/renderless/src/fluent-editor/index.ts
lineheightHandler applies Quill line-height formatting using the standard 'line-height' format key instead of 'lineheight'.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

A rabbit hops through hyphens true,
From lineheight to line-height we flew,
Standards aligned with a dash so bright,
One little change, one perfect height. 🐰✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically identifies the main change: fixing lineheight formatting in fluent-editor by updating the Quill format key from 'lineheight' to 'line-height'.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

packages/renderless/src/fluent-editor/index.ts

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-vue".

(The package "eslint-plugin-vue" was not found when loaded as a Node module from the directory "".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-vue@latest --save-dev

The plugin "eslint-plugin-vue" was referenced from the config file in ".eslintrc.js » @antfu/eslint-config » @antfu/eslint-config-vue".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/renderless/src/fluent-editor/index.ts`:
- Around line 291-295: The handler lineheightHandler currently calls
state.quill.format('line-height', ...) which doesn't match the toolbar format
key (lineheight) used in the toolbar config; update the format key so they match
— either change the format call in lineheightHandler to
state.quill.format('lineheight', value, FluentEditor.sources.USER) or change the
toolbar config to use 'line-height' instead of lineheight; after making the
change, confirm the chosen name matches the Parchment Attributor registered on
the FluentEditor instance so the format is recognized.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 09a05962-92f5-40bf-bd58-e9c1525f91e3

📥 Commits

Reviewing files that changed from the base of the PR and between fff845b and aeac88b.

📒 Files selected for processing (1)
  • packages/renderless/src/fluent-editor/index.ts

Comment on lines 291 to 295
export const lineheightHandler =
({ state, FluentEditor }) =>
(value) => {
state.quill.format('lineheight', value, FluentEditor.sources.USER)
state.quill.format('line-height', value, FluentEditor.sources.USER)
}

@coderabbitai coderabbitai Bot May 18, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search for Quill format registrations and line-height/lineheight usage

echo "=== Searching for line-height or lineheight format registrations ==="
rg -n -C3 -P "(register|format|Quill\.(import|register)).*(line-?height|lineHeight)" --type=ts --type=js

echo -e "\n=== Searching for toolbar configuration with lineheight ==="
rg -n -C2 "lineheight.*:" --type=ts --type=js

echo -e "\n=== Searching for Quill format calls with line-height ==="
rg -n -P "\.format\s*\(\s*['\"]line-?height" --type=ts --type=js

echo -e "\n=== Searching for CSS lineHeight or line-height in Quill modules ==="
rg -n -C2 "lineHeight|line-height" --glob "**/fluent-editor/**" --type=ts --type=js

Repository: opentiny/tiny-vue

Length of output: 6246


🌐 Web query:

Quill.js line-height format registration and usage

💡 Result:

Quill.js does not include a built-in line-height format, so you must implement it using Parchment, Quill's document model [1][2]. To add this functionality, you need to create a custom Attributor and register it with Quill [3][2]. Implementation Steps 1. Define the Attributor: Use Parchment's StyleAttributor to map a format name (e.g., 'line-height') to the CSS 'line-height' property [3][2]. const Parchment = Quill.import('parchment'); const LineHeightStyle = new Parchment.Attributor.Style('line-height', 'line-height', { scope: Parchment.Scope.INLINE, whitelist: ['1.0', '1.2', '1.5', '1.6', '1.8', '2.0'] // Define allowed values }); 2. Register the Format: Register the new attributor with Quill so it can be recognized in the editor [1][2]. Quill.register(LineHeightStyle, true); 3. Configure the Toolbar: To allow users to select line-height, add it to your toolbar configuration [3][4]. const quill = new Quill('#editor', { modules: { toolbar: [ [{ 'line-height': ['1.0', '1.2', '1.5', '1.6', '1.8', '2.0'] }] ] } }); Usage Notes - Scope: Line-height is typically applied as an inline format [3][2]. Ensure your CSS handles the resulting span elements correctly, as applying line-height to inline elements may require setting display: inline-block or adjusting parent block styles to avoid layout issues [5][4]. - Customization: You can extend the whitelist to include any valid CSS line-height values [3][2]. If you need to handle specific DOM-to-Delta conversions (e.g., converting style strings to numbers), you can extend the Attributor class and override the value method [3]. - Toolbar Integration: If using a custom toolbar, ensure you have a handler that triggers the format command using the Quill API, such as quill.format('line-height', value) [4][6].

Citations:


🌐 Web query:

tiny-vue fluent-editor Quill format registration line-height or lineheight custom Parchment

💡 Result:

To implement custom line-height support in a Quill-based editor like Fluent Editor, you must define a custom Parchment Attributor and register it with the Quill instance [1][2]. 1. Define the Attributor: Create a custom class extending Parchment.StyleAttributor to manage the line-height style [1]. This allows the editor to apply the CSS line-height property to inline elements [1]. import { Parchment } from 'fluent-editor'; // or 'quill' const LineHeightStyle = new Parchment.Attributor.Style('line-height', 'line-height', { scope: Parchment.Scope.INLINE, whitelist: ['1', '1.5', '2', '2.5'] // Define your allowed values }); 2. Register the Format: Register this attributor with your Quill/Fluent Editor instance so the editor recognizes the new format [1][2]. import { Quill } from 'fluent-editor'; Quill.register(LineHeightStyle, true); 3. Integration: Once registered, you can add a custom dropdown or button to your toolbar that triggers the format command [3]. When the user selects a value, use the editor API to apply it: quill.format('line-height', '1.5'); Note: Fluent Editor (part of OpenTiny) has already implemented a LineHeightStyle attributor in its codebase [1]. If you are using Fluent Editor, check if you can leverage the existing implementation in packages/fluent-editor/src/attributors/line-height.ts rather than creating a new one [1]. If you are using standard Quill, the steps above are the standard approach for extending the document model [2]. Ensure your CSS handles the applied styles correctly, as Quill often wraps content in spans that may require display: inline-block for line-height to take effect on specific elements [4][3].

Citations:


🏁 Script executed:

# Search for Quill registration, import, or module setup for line-height/lineheight
rg -n "Quill\.(import|register|modules)" packages/renderless/src/fluent-editor/ --type=ts --type=js
rg -n "Parchment|register.*line" packages/renderless/src/fluent-editor/ --type=ts --type=js
rg -n "modules.*:.*\{" packages/renderless/src/fluent-editor/ -A 10 --type=ts --type=js

Repository: opentiny/tiny-vue

Length of output: 965


🏁 Script executed:

# Search for attributor definitions and registrations in fluent-editor
find packages/renderless/src/fluent-editor -name "*.ts" -o -name "*.js" | head -20
rg -n "attributor|Attributor|register" packages/renderless/src/fluent-editor --type=ts --type=js -B2 -A2
rg -n "line.*height|lineheight" packages/renderless/src/fluent-editor/index.ts --type=ts -B5 -A5

Repository: opentiny/tiny-vue

Length of output: 1777


🏁 Script executed:

# Search for where FluentEditor is imported and initialized - might show attributor registration
rg -n "FluentEditor" packages/renderless/src/fluent-editor/index.ts -B3 -A3
# Also look for any Quill import or initialization that might register attributors
rg -n "import.*Quill|new Quill|Quill\.register" packages/renderless/src/fluent-editor -A5
# Check if there's an attributor file mentioned in web search result
find packages -name "*attributor*" -o -name "*line-height*" 2>/dev/null

Repository: opentiny/tiny-vue

Length of output: 5009


🏁 Script executed:

# Search for where FluentEditor is imported from
rg -n "import.*FluentEditor|from.*fluent-editor" packages/renderless/src/fluent-editor/ --type=ts --type=js
# Check the vue.ts file to see how FluentEditor is passed in
head -50 packages/renderless/src/fluent-editor/vue.ts
# Search for any Quill format registration or module setup
rg -n "\.register\(|register.*format|Quill\.import" packages/ --type=ts --type=js -i

Repository: opentiny/tiny-vue

Length of output: 3687


🏁 Script executed:

# Look for FluentEditor module definition - it's passed as a parameter
rg -n "class FluentEditor|new FluentEditor\|function FluentEditor" packages/renderless/src/fluent-editor --type=ts --type=js
# Check the options file more thoroughly for toolbar format definitions
cat packages/renderless/src/fluent-editor/options.ts | head -80
# Search for lineheight (no hyphen) format calls in the entire codebase
rg -n "format\('lineheight'|\.lineheight" packages/ --type=ts --type=js

Repository: opentiny/tiny-vue

Length of output: 1900


🏁 Script executed:

# Search for any Quill format registration for lineheight or line-height in the fluent-editor package
rg -n "register.*format\|register.*lineheight\|register.*line-height" packages/renderless/src/fluent-editor -A5 -B5 --type=ts --type=js
# Check if there's a custom Quill initialization or module setup
rg -n "FluentEditor.import\|FluentEditor.register" packages/renderless/src/fluent-editor --type=ts --type=js -B2 -A2
# Look at git history or comments around the change
cat packages/renderless/src/fluent-editor/index.ts | sed -n '285,305p'

Repository: opentiny/tiny-vue

Length of output: 485


Fix the format key mismatch between toolbar configuration and format call.

The toolbar configuration (line 69) defines the format as lineheight (no hyphen): { lineheight: lineHeightConfig }, but the handler at line 294 applies 'line-height' (with hyphen): state.quill.format('line-height', ...). In Quill, these keys must match exactly. Either:

  • Change line 294 to use 'lineheight' to match the toolbar config, or
  • Update the toolbar config at line 69 to use { 'line-height': lineHeightConfig } to match the format call

Additionally, verify that the format name aligns with how the line-height Parchment Attributor is registered in the FluentEditor instance.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/renderless/src/fluent-editor/index.ts` around lines 291 - 295, The
handler lineheightHandler currently calls state.quill.format('line-height', ...)
which doesn't match the toolbar format key (lineheight) used in the toolbar
config; update the format key so they match — either change the format call in
lineheightHandler to state.quill.format('lineheight', value,
FluentEditor.sources.USER) or change the toolbar config to use 'line-height'
instead of lineheight; after making the change, confirm the chosen name matches
the Parchment Attributor registered on the FluentEditor instance so the format
is recognized.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cfljue 机器人有个检视意见,可以看下哈

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zzcr 好的,我这边补充下关注点:当前主要是确认这次改成 line-height 后,是否和编辑器里实际注册的格式名一致。

具体看这 3 处是否统一即可:

  • lineheightHandler 里调用的 format key
  • toolbar/handlers 里使用的 key(当前还是 lineheight
  • FluentEditor / Parchment 注册的 line-height 格式名

如果底层注册名就是 line-height,那这次修改方向是对的,但最好确认 toolbar 配置链路也能正确命中;如果注册名仍是 lineheight,那这里就需要保持一致。作者更新后我也可以再帮忙复看。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants