Skip to content

Can't config this thing #175

@ciokan

Description

@ciokan

I tried putting those settings (markMap or even alwaysEncodeBreakingEntities) everywhere with no effect:

export const Serialize = ({content, config = {}}: { content: any, config?: SlateToReactConfig }) => {
	return (
		<SlateToReact
			node={content}
			config={{
				...payloadSlateToReactConfig,
				markMap: {
					strikethrough: ['s'],
					bold         : ['strong'],
					underline    : ['u'],
					italic       : ['i'],
					code         : ['code'],
				},
				react  : {
					...payloadSlateToReactConfig.react,
					markMap          : {
						strikethrough: ['s'],
						bold         : ['strong'],
						underline    : ['u'],
						italic       : ['i'],
						code         : ['code'],
					},
					elementTransforms: {
						...payloadSlateToReactConfig.elementTransforms,
						upload: ({node, attribs, children}) => {
							if (node.value?.mimeType && node.value?.url) {
								if (node.value?.mimeType.match(/^image/)) {
									return (
										<img
											src={node.value.url}
											alt={node.value.alt || node.value.filename}
											className={"w-full border-2"}
										/>
									);
								}
							}
							return;
						}
					},
				},
				...config,
				alwaysEncodeBreakingEntities: false,
				html                        : {
					...payloadSlateToReactConfig.html,
					markMap                     : {
						strikethrough: ['s'],
						bold         : ['strong'],
						underline    : ['u'],
						italic       : ['i'],
						code         : ['code'],
					},
					alwaysEncodeBreakingEntities: false,
				}
			}}
		/>
	);
};

What is the correct way?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions