Skip to content

Commit

Permalink
Update index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitry-kurmanov authored Dec 9, 2024
1 parent 0212883 commit 4bcb8b5
Showing 1 changed file with 25 additions and 23 deletions.
48 changes: 25 additions & 23 deletions icons/index.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
if (typeof SurveyCreatorCore !== "undefined") {
new SurveyCreatorCore.SurveyCreatorModel({}); // Register Survey Creator icons
}

function renderIcons() {
let iconsDiv = document.createElement("div");
iconsDiv.id = "sv-icon-holder-global-container";
iconsDiv.innerHTML = "<svg>" + Survey.SvgRegistry.iconsRenderedHtml() + "</svg>";
iconsDiv.style.display = "none";
document.head.appendChild(iconsDiv);
}
renderIcons();

Object.keys(Survey.SvgRegistry.icons).map(name => {
if (name.indexOf("pg-v1") > -1) return;
const element = document.createElement("div");
element.classList.add("container")
element.innerHTML = `
<svg>
<use xlink:href="#icon-` + name + `\"></use>
</svg>
<span class="icon-name">icon-` + name + `</span>`;
document.getElementById("icons").appendChild(element);
document.addEventListener("DOMContentLoaded", (event) => {
if (typeof SurveyCreatorCore !== "undefined") {
new SurveyCreatorCore.SurveyCreatorModel({}); // Register Survey Creator icons
}

function renderIcons() {
let iconsDiv = document.createElement("div");
iconsDiv.id = "sv-icon-holder-global-container";
iconsDiv.innerHTML = "<svg>" + Survey.SvgRegistry.iconsRenderedHtml() + "</svg>";
iconsDiv.style.display = "none";
document.head.appendChild(iconsDiv);
}
renderIcons();

Object.keys(Survey.SvgRegistry.icons).map(name => {
if (name.indexOf("pg-v1") > -1) return;
const element = document.createElement("div");
element.classList.add("container")
element.innerHTML = `
<svg>
<use xlink:href="#icon-` + name + `\"></use>
</svg>
<span class="icon-name">icon-` + name + `</span>`;
document.getElementById("icons").appendChild(element);
});
});

0 comments on commit 4bcb8b5

Please sign in to comment.