Skip to content

Commit

Permalink
add attribute values also as css variables
Browse files Browse the repository at this point in the history
  • Loading branch information
evolkmann committed Jun 1, 2024
1 parent dccc81d commit 5c78640
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js

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

4 changes: 4 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ window[pluginNamespace].functions.isLayoutField = (field) => {
};
window[pluginNamespace].functions.addLayoutAttrs = (layoutField) => {
const columnId = layoutField.columns[0].id;
/**
* @type {HTMLElement} layoutEl
*/
let layoutEl = document.querySelector(
`.k-layout:has(.k-layout-column[id="${columnId}"])`,
);
Expand All @@ -30,6 +33,7 @@ window[pluginNamespace].functions.addLayoutAttrs = (layoutField) => {
for (const key of attrKeys) {
const val = layoutField.attrs[key];
layoutEl.setAttribute(`data-attr-${key}`, val);
layoutEl.style.setProperty(`--attr-${key}`, val);
}
};

Expand Down

0 comments on commit 5c78640

Please sign in to comment.