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

Fix for editorial conventions #218

Merged
merged 1 commit into from
Sep 19, 2023
Merged

Conversation

davivcu
Copy link
Collaborator

@davivcu davivcu commented Aug 28, 2023

EVT is only loading the last rule of each item because getLayouts() overwrites the object at every cycle with the default values from editorial-conventions.service.ts.

Below the json used for the test. It's taken from the readme with minimum editing.
For example without this fix, the first group of rules stored in "diplomatic" for element 'add' are ignored and the default rules hardcoded applied instead.

{
    "additions": {
        "markup": {
            "element": "add"
        },
        "layouts": {
            "diplomatic": {
                "style": {
                    "background-color": "red"
                }
            },
            "interpretative": {
                "pre": "\\",
                "post": "/",
                "style": {
                    "background-color": "blue"
                }
            }
        }
    },
    "deletions": {
        "markup": {
            "element": "del"
        },
        "layouts": {
            "interpretative": {
                "style": {
                   "background-color": "green"
                }
            }
        }
    }
}

FIX:

Since default keys are already placed in the output layout at its initialization
let layouts: Partial<EditorialConventionLayouts> = defaultKeys;
there's no need to load them again at every cycle and we can simply spread the new properties from external layout.

@giuliac89 giuliac89 merged commit 0da0773 into develop Sep 19, 2023
@giuliac89 giuliac89 deleted the bugfix/editorial_conventions_rules branch September 19, 2023 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants