Implement clone & fork note functionality 💫
Dimchikkk opened this issue · 0 comments
Dimchikkk commented
Steps to be taken to implement clone & fork note functionality (in the simplest way for milestone 1 of this feature):
- refactor how velo stores notes. Instead of keeping full note data on tabs store reference to note (a.k.a introduce "Notes store"):

- refactor how velo stores docs. Instead of keeping full documents keep document reference (a.k.a. introduce "Docs store"). This feature will allow to have workspaces (a.k.a. "Workspaces store"):
Pseudocode to illustrate idea:
struct Id<T>(PhantomData<T>);
struct Workspace {
docs: Vec<Id<Doc>>,
}
struct Doc {
tabs: Vec<Tab>,
}
struct DocsStore(HashMap<Id<Doc>>, Doc);
struct Tab {
notes: Vec<Id<Note>>,
}
struct NotesStore(HashMap<Id<Note>>, Note);
struct Note(String);
-
add relationships store (to maintain connections between a Note ID and a Doc ID)
-
logic of note creation is changed, view entities have references to text entities:
create NEW note (2):
(1) spawn text entity
(2) spawn note entity referencing (1)
create CLONE of note (2)
(3) spawn note entity referencing (1)
create FORK of note (2)
(4) spawn text entity, cloning text data of (1)
(5) spawn note entity referencing (4)
- implement UI widget similar to current search box + doc list:
By clicking "clone note/fork note" button modal is opened with newly created widget that allows to search for previously created notes, showing context (e.g. which documents hold this note). There should be some sort of checkbox that indicates whether it is a fork or clone operation. By selecting previously created note it appears in current tab.