Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

headers alignment can't change #60

Open
yanmorinokamca opened this issue Dec 12, 2024 · 0 comments
Open

headers alignment can't change #60

yanmorinokamca opened this issue Dec 12, 2024 · 0 comments
Assignees

Comments

@yanmorinokamca
Copy link

Describe the bug
When updating the alignment of a h1, h2, h3, h4, h5, h6, alignment can't be changed

To Reproduce

  • Create a h1
  • Focus on h1
  • Update alignment to center or right

Flexible Editor Version:
1.8.2

Directus Version:
11.1.0

Code Information

Related to this commit: 9947e50

selection array is a list of extensions like [paragraph, codeBlock, h1, h2, h3, ...] selected from the Field > Interface > Tools.
"heading" is not in this list. So it only filter to types: ["paragraph", "codeBlock"] and doesn't include heading.

Possible solution:
add a condition that set "heading" if selection is "h1" or "h2", ...

const types = [...
  (selection?.filter((extension) => 
   ["h1", "h2", "h3", "h4", "h5", "h6"].includes(extension)
  ).length ? ['heading'] : []),
 ...selection?.filter((extension) =>
	 ["paragraph", "codeBlock"].includes(extension)
  )
]

(with better formatting of course)

TODO: check if tiptap supports "h1" directly as a valid type, or if it only supports heading, because the name is extension-heading:
https://github.com/ueberdosis/tiptap/tree/develop/packages/extension-heading/src

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants