-
Notifications
You must be signed in to change notification settings - Fork 113
Add Collaborative Operator Property Form Editor #1712
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zuozhiw
approved these changes
Nov 4, 2022
Contributor
zuozhiw
left a comment
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.
looks good, three minor bugs:
- password field shows "***"
- new line when pasting into a string field
- bug when console has coeditor error message, model could be inconsitent with view
Contributor
Author
Made changes for 1 and 2. I could not reproduce 3 at the moment, will fix this bug in another PR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Content
This PR adds real-time collaborative form editing to operator property editor. Only
stringtype is affected, i.e., other field types like number or enum will remain the same. The result looks like the below demo:This also automatically solves the input flickering issue with previous text editors for property editor.
Implementation
updateYTypeFromObjectwhich updates a YType, in particularOperatorPredicate.OperatorProperties, which insharedModelisYType<Readonly<{ [key: string]: any }>>. Previously inupdateOperatorProperty(), we usedcreateYTypeFromObjectto create a new shared object based on the updated form data. That makes collaborative form editing impossible since the form fields will never be able to connect to the same shared object.updateYTypeFromObjectrecursively infers which shared fields need to be updated instead of replaced, in particularY.TextandY.ArrayandY.Maptypes.stringtype have default values ("").CollabWrapperComponent. Compatible withPresetWrapperComponentand will be applied to allstringandtexeareatypes. The new wrapper replaces the default input editor withquilleditor, and infers the shared type that it needs to use based on itsoperatorID,field, andparents. Then it connects to shared text usingy-quill.coeditorinUserStatetype touser. This is becausey-quillexpectsusertype in its awareness states, to enable color for cursors.Limitations
sharedModelthere is no shared type fornumbersince it is considered a primitive type. To enable collaborative editing would requireY.Texttype. B. Even if we convert the type on-the-fly, the conversion is not elegant and the new editor does not support theincrementanddecrementbuttons we normally see for numerical form field editors.Compatibilities
PresetWrapper. BTW I also located the problems right now with preset wrapper, which is withajvcompiling (line 297 inpreset.service.ts,const fitsSchema = PresetService.ajv.compile(presetSchema)(preset);) when validating the preset to apply.