-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
ParseOptions are not preserved when writing content #78
Comments
The parserOptions can be passed during initialization, doesn't need to be set everytime while calling setContent based on the docs https://tiptap.dev/docs/editor/api/commands/content/set-content unless we are looking to override the defaults? Am I missing something? |
Maybe it is tiptap bug, but when passing parseOptions only during initialization, whitespaces are not preserved,
this.tiptapEditor = new Editor({
...
parseOptions: {
preserveWhitespace: 'full',
},
...
formGroup: FormGroup = this.fb.group({text: ['<p>a b c d</p>']});
<div contenteditable="true" role="textbox" translate="no" class="tiptap ProseMirror" tabindex="0">
<p>a b c d</p>
</div> when i create custom tiptap directive, based on editor.directive.ts, only add third param to the setContent method, then tiptap preserves spaces: <div contenteditable="true" role="textbox" translate="no" class="tiptap ProseMirror" tabindex="0">
<p>a b c d</p>
</div> |
Can you raise an issue in the TipTap repository to get this clarified? If that is how it should be done we can fix it. |
Started discussion ueberdosis/tiptap#5933 |
Thanks @vlad-kuz for creating the discussion. It am running on some tight deadline items, so I couldn't reach and follow up with tiptap myself |
create an instance of the editor with parseOptions (https://tiptap.dev/docs/editor/api/editor#parseoptions)
In editor.directive.ts this options are ignored when setting the content and whitespace is collapsed as per HTML's rules.
To take into account editor configuration, when setting the content, command setContent has third parameter parseOptions.
Code in editor.directive.ts can be changed to.
The text was updated successfully, but these errors were encountered: