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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions fastn-js/js/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ let fastn_dom = {};

fastn_dom.styleClasses = "";

fastn_dom.InternalClass = {
FT_COLUMN: 'ft_column',
FT_ROW: 'ft_row',
FT_FULL_SIZE: "ft_full_size",
};

fastn_dom.codeData = {
availableThemes: {},
addedCssFile: []
Expand Down
12 changes: 7 additions & 5 deletions fastn-js/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ let fastn_utils = {
let css = [];
let attributes = {};
if (kind === fastn_dom.ElementKind.Column) {
css.push("ft_column");
css.push(fastn_dom.InternalClass.FT_COLUMN);
} else if (kind === fastn_dom.ElementKind.Document) {
css.push("ft_column");
css.push("full");
css.push(fastn_dom.InternalClass.FT_COLUMN);
css.push(fastn_dom.InternalClass.FT_FULL_SIZE);
} else if (kind === fastn_dom.ElementKind.Row) {
css.push("ft_row");
css.push(fastn_dom.InternalClass.FT_ROW);
} else if (kind === fastn_dom.ElementKind.IFrame) {
node = "iframe";
// To allow fullscreen support
Expand Down Expand Up @@ -101,10 +101,12 @@ let fastn_utils = {
if (ssr) {
iterativeClassList = iterativeClassList.getClasses();
}
const internalClassNames = Object.values(fastn_dom.InternalClass);
const classesToRemove = [];

for (const className of iterativeClassList) {
if (!className.startsWith('__') &&
if (!className.startsWith('__') &&
!internalClassNames.includes(className) &&
className !== extraCodeData?.language &&
className !== extraCodeData?.theme
) {
Expand Down
2 changes: 1 addition & 1 deletion ftd/ftd-js.css
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ pre code {
justify-content: start
}

.full {
.ft_full_size {
width: 100%;
height: 100%;
}
Expand Down
2 changes: 1 addition & 1 deletion ftd/t/js/22-document.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ftd/t/js/41-document-favicon.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ftd/t/js/72-document-breakpoint.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading