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

Persist Quill alignment options #1557

Open
salomoneb opened this issue Jan 9, 2023 · 0 comments
Open

Persist Quill alignment options #1557

salomoneb opened this issue Jan 9, 2023 · 0 comments

Comments

@salomoneb
Copy link
Contributor

Description

Quill has an align option. Specifying this creates a button which allows you to choose a text alignment.

I added this to my inline form input like so:

overrideHeadline:
  _label: Headline
  _publish: articleHeadline
  _placeholder:
    height: 40px
  _has:
    input: inline
    buttons:
      - italic
      - strike
      # https://github.com/quilljs/quill/issues/1969#issuecomment-389697111
      - align: ["", "center", "right"]

I can align the text through the editor, but the alignment doesn't persist on save. Demo:

alignment.mov

There's a ql-align-* class that gets added to the Quill wrapper class while editing, but which gets stripped on save in inputs/wysiwyg-sanitize.js.

@james-owen and I talked over Slack about adding a transformTags function to wysiwyg-sanitize.js that would look for the special Quill alignment classes and add the alignment preferences as inline styles to the parent text element:

grab all paragraphs, grab their styles, if they match our list add them to parent element, strip p tags.

Expected Behavior

Kiln should save my alignment preference.

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

1 participant