feat: text alignment for richtext editor (#2803)
* Update isActive.tsx This change allows us to define toggling of custom types in Slate. Specifically, this fixes the ability to toggle Alignment on nodes that use other active elements. isElementActive(editor, format, TEXT_ALIGN_TYPES.includes(format) ? 'align' : 'type'); Type is the default for elements, allowing us to use a custom field lets us greater extend the functionality of Slate in Payload without causing any breaking changes * Update toggle.tsx Added to toggleElement public function * Update isActive.tsx * Update toggle.tsx Added Rich Text Alignment, updated toggle function, added tests and doc updates * added margin to void elements * fix: list alignment * removed textAlign from elements and added docs * chore: fix typo --------- Co-authored-by: Alessio Gravili <alessio@gravili.de>
This commit is contained in:
@@ -715,6 +715,19 @@ describe('Fields', () => {
|
||||
expect(workingRichTextQuery.docs).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('should show center alignment', async () => {
|
||||
const query = await payload.find({
|
||||
collection: 'rich-text-fields',
|
||||
where: {
|
||||
'richText.children.text': {
|
||||
like: 'hello',
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
expect(query.docs[0].richText[0].textAlign).toEqual('center');
|
||||
});
|
||||
|
||||
it('should populate link relationship', async () => {
|
||||
const query = await payload.find({
|
||||
collection: 'rich-text-fields',
|
||||
|
||||
Reference in New Issue
Block a user