Skip to content

Commit

Permalink
convert ftClassNames into a map
Browse files Browse the repository at this point in the history
  • Loading branch information
harshdoesdev authored and Arpita-Jaiswal committed Nov 8, 2023
1 parent a6ca3bb commit a50cbf5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
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',
FULL: "full",
};

fastn_dom.codeData = {
availableThemes: {},
addedCssFile: []
Expand Down
12 changes: 6 additions & 6 deletions fastn-js/js/utils.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
let fastn_utils = {
ftClassNames: ["ft_column", "ft_row"],
htmlNode(kind) {
let node = "div";
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.FULL);
} 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 @@ -102,11 +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('__') &&
!this.ftClassNames.includes(className) &&
!internalClassNames.includes(className) &&
className !== extraCodeData?.language &&
className !== extraCodeData?.theme
) {
Expand Down

0 comments on commit a50cbf5

Please sign in to comment.