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

Prevent internal class names from being removed #1467

Merged
merged 3 commits into from
Nov 8, 2023
Merged

Conversation

harshdoesdev
Copy link
Contributor

@harshdoesdev harshdoesdev commented Nov 8, 2023

What's the Issue?

The issue is that when using the classes header to set custom CSS class names, the class names of the kernel elements are being removed.

How to Replicate

fastn code:

-- ftd.column:
css: styles.css
classes: red

-- ftd.text: Hello World

-- end: ftd.column

Expected Output:

<div class="ft_column red"><div>Hello World</div></div>

Actual Output:

<div class="red"><div>Hello World</div></div>

Proposed Solution

In fastn-js/js/dom.js, we can create a map of class names called fastn_dom.InternalClass that will be used by kernel components. Then, in the fastn_utils.removeNonFastnClasses function, we can check if the className that is going to be removed is not one of those class names.

@harshdoesdev harshdoesdev changed the title Prevent ft class names from being removed Prevent internal class names from being removed Nov 8, 2023
fastn-js/js/utils.js Outdated Show resolved Hide resolved
fastn-js/js/dom.js Outdated Show resolved Hide resolved
@Arpita-Jaiswal Arpita-Jaiswal merged commit 875cb77 into main Nov 8, 2023
1 check passed
@Arpita-Jaiswal Arpita-Jaiswal deleted the classes-fix branch November 8, 2023 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants