-
Notifications
You must be signed in to change notification settings - Fork 126
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
Consistent JSON Output Format #188
Conversation
removed serializing of JSON in output, added Object type to v-model prop
src/components/TiptapVuetify.vue
Outdated
|
||
@Prop({ type: String, default: '' }) | ||
readonly [PROPS.VALUE]: string | ||
@Prop({ type: [String, Object], default: "" }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is first key moment.
src/components/TiptapVuetify.vue
Outdated
} else { | ||
output = JSON.stringify(info.getJSON()) | ||
output = info.getJSON(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is second key moment.
Hello! First of all, thanks for a very detailed description of the problem and its solution. It was very informative and I immediately understood the essence of the problem. It seems like a funny situation arose when your IDE changed the style of the code that does not correspond to my project, which caused ESLint errors on CI. I see two ways out of the situation:
What will we choose? Thank you for contributing to the project. |
Oops! I had Prettier enabled on save, and it must have changed the styling. I ran |
Now much better, but still removed a lot of line breaks that I would like to see + CSS styles affected. I suggest copying the source file to return to its original state and add your changes to it. Only a couple of lines will need to be changed again. |
Hmm, that's what I did last time, but I tried it again, and it seems to have worked. Hope that does it for you. Thanks for working through it with me. |
Hi, just bumping this to check and see if it's in an acceptable state to be merged. Thanks! |
LGTM, TY! |
🎉 This PR is included in version 2.24.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Fixes #94
Problem
Currently usage of JSON requires
Raw JSON in -> TipTap v-model -> Serialized JSON out
. The type of the content is object up until the first TipTap edit is made, at which point it becomes a string. My team is using TipTap-Vuetify in our ERP project, and we've previously had to write code to get around this that checks to see whether it is a string or object on save.Purpose
This PR is intended to make the behavior of output-format="json" more consistent, namely:
Raw JSON in -> TipTap v-model -> Raw JSON out.
Current behavior of TipTap-Vuetify with
output-format="json"
is inconsistent. V-model input expects a raw JSON object, but causes [Vue warn] type error and changes output to a serialized JSON object.Expected behavior is that when
output-format="json"
, TipTap-Vuetify accepts a raw JSON object as v-model input with proper type checking and outputs raw JSON object. This PR makes that behavior consistent.Replication
Replication - Replication has some issues due to codesandbox's platform limitations. Instructions in the sandbox demonstrate the inconsistent behavior.
Any comments, questions, or recommendations are appreciated. Thank you for your work maintaining this project! It's been very useful in our own project.