Skip to content
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

fwdata text with runs (styles/ws spans) in it will be overwritten if changed #1307

Open
hahn-kev opened this issue Dec 6, 2024 · 0 comments
Assignees
Labels
bug Something isn't working 📖 MiniLcm issues related to miniLcm library code, includes fwdat bridge and lcmCrdt
Milestone

Comments

@hahn-kev
Copy link
Collaborator

hahn-kev commented Dec 6, 2024

Describe the bug
Some fields can contain complex text data, we want to make data that is complex read only on the client. This is not a field by field setting, but for each string of data from a project. In FwDataMiniLcm we have the method FromLcmMultiString which converts from Lcm to MiniLcm, we want to augment it like this to detect if the data should be readonly:

private MultiString FromLcmMultiString(ITsMultiString multiString)
{
    var result = new MultiString(multiString.StringCount);
    for (var i = 0; i < multiString.StringCount; i++)
    {
        var tsString = multiString.GetStringFromIndex(i, out var ws);
        if (tsString.RunCount == 1)
        {
            result.Values.Add(GetWritingSystemId(ws), tsString.Text);
        }
        else
        {
            //todo, mark this value as read only so we don't edit it and overwrite text
        }
    }

    return result;
}

note checking that RunCount is 1. I'm not sure how we want to mark a value as read only. One option would be to add another ws key "{wsId}-ro": "true", or we could modify the text itself, but that would be more complicated as it would require escaping. The frontend could then respect this configuration and make those text fields readonly. Later on once we model and support runs we can change this and the frontend won't be readonly anymore.

@hahn-kev hahn-kev added the bug Something isn't working label Dec 6, 2024
@hahn-kev hahn-kev added this to the FW Lite PoC milestone Dec 9, 2024
@hahn-kev hahn-kev self-assigned this Dec 9, 2024
@hahn-kev hahn-kev added the 📖 MiniLcm issues related to miniLcm library code, includes fwdat bridge and lcmCrdt label Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 📖 MiniLcm issues related to miniLcm library code, includes fwdat bridge and lcmCrdt
Projects
None yet
Development

No branches or pull requests

1 participant