I'm Ahmed, an undergraduate student from Egypt. I'm excited to work through the summer on a plugin that improves the process of conflict resolution on Joplin.
A plugin will be created that adds a context menu option on conflict notes to open a merge menu. Once clicked a diff viewer will be shown to aid in merging the notes together. I'll potentially also add a way to auto-merge the two conflicting notes using revision data.
Since the project doesn't have a set-in-stone spec yet, most of the implementation details is still under discussion and could change.
- The plugin will add a context menu button to conflict notes in order to open the diff window. The plugin system will be extended to support this if it doesn't already.
- A notification will be shown to the user to open the diff window when a conflict occurs.
- CodeMirrors addon
merge/merge.js. It'll hook to the event of clicking the context menu button and a dialog will be shown with the local and remote files visible in a 3-way diff. The user will be able to input the merged file in the middle editor. Arrow buttons will exist to aid the process.
- User will be able to either Save or Cancel.
In the basic plugin, the middle note will initially be clear and user have to manually merge both notes part by part copying over the interesting part.
An option will be added in Settings to either enable or disable this feature. Since I've been told that this feature may be a bit resource intensive. (Unless we find a better idea)
packages\lib\Synchronizer.ts will be modified to make sure a patch is created for every
note before sync. This way every sync push is guaranteed to include patches for all local changes.
The ID of the latest revision of each note before sync will be saved, and then later on in the plugin, the 2 "latest revisions" could be used to reconstruct a suggested note.
A new endpoint
revisions will be added over at the folder
with modifications to
packages\lib\services\rest\Api.ts . The endpoint will provide access to
Revision data via id of revision and also ability to query all revisions of a certain note id.
The basic plugin discussed above will be modified to do the following:
- Using the latest local revision and the latest revision received from remote, an algorithm could be done to find the first common ancestor between the two revisions which will be used as a base. Then revisions from local will be applied first and then revisions from remote will be applied next. (All using google's match-patch-diff plugin).
- The suggested note will simply be placed into the diff editor as a default for the merged notes. User can still go over it, make changes and then save!
- Discuss implementation plan with mentor.
- Setup blog where I'll be reporting progress.
- Possibly start work in order to be ahead of schedule. (It's better if the project is done early than late! Nothing will be rushed however.)
- Start work on plugin user interface.
- Add conflict menu event and button to open the plugin window.
- Create a notification that shows to the user when a conflict occurs in order to open the plugin window directly.
- Create plugin initial behavior for loading the notes.
- Add Save and Cancel behaviors.
- Write tests to make sure basic plugin works as intended.
- Submission of the first evaluation.
- Create revisions for changed files on sync saving its ID for later use in case of conflicts.
- University final exams period
- Data API revisions endpoint will be added for plugins to access.
- Unit tests for revision data API.
- Implement algorithm to merge notes together using revision data.
- Heavy tests on the algorithms.
- Modify the plugin to show the merged note text by default
- Do any leftover work. Extra week just in case.
- Review all code and cleanup.
- Code delivery.
- Mentor Evaluation.
Please don't hesitate to give me feedback, whether technical or not! As I said earlier, there isn't any spec that's ready and such a feature was almost never discussed before GSoC, so the more feedback the better this feature will be! Maybe I've missed something or there's something not consistent. Please do let me know.