Skip to content

Commit

Permalink
add quill toolbar option "align"
Browse files Browse the repository at this point in the history
  • Loading branch information
lebalz committed Nov 27, 2024
1 parent b7283e9 commit 675e0c7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Es sind folgende Optionen verfügbar:
- `ol`
- `code`
- `image`
- `align`

### Beispiel
Nur die Buttons für Bilder und Code werden angezeigt
Expand Down
1 change: 1 addition & 0 deletions src/css/custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ div.flex {
flex-grow: 1;
flex-shrink: 1;
flex-basis: 10px;
max-width: 100%;

&.noFlex {
flex-grow: unset;
Expand Down
7 changes: 7 additions & 0 deletions src/models/documents/QuillV2/helpers/toolbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface ToolbarOptions {
// formula?: boolean;
code?: boolean;
image?: boolean;
align?: boolean;
}

/**
Expand Down Expand Up @@ -39,6 +40,9 @@ export type ToolbarModule = (
| {
list: string;
}[]
| {
align: never[];
}[]
)[];

export const TOOLBAR_BASE: ToolbarModule = [['bold', 'italic', 'underline', 'code-block']];
Expand Down Expand Up @@ -100,6 +104,9 @@ export const getToolbar = (options: ToolbarOptions): ToolbarModule => {
}
toolbar.push(l);
}
if (options.align) {
toolbar.push([{ align: [] }]);
}
if (options.image) {
// || options.formula
const visuals = [];
Expand Down

0 comments on commit 675e0c7

Please sign in to comment.