Issue #2667πŸ’¬ AnsweredOpened March 19, 2020by sampathrajs0 reactions

Link element not append in head element in ediot.canvas #firefox #grapesjs

Quick answerby artf

I've made the issue template for a reason

Read full answer below ↓

Question

Code SnippetTEXT
am trying to add google fonts in web-builder to change the font style for that to import am adding cdn in editor the code works in chrome and safari but firefox not working 

createLinkElement(fontFamily) {
        let link = document.createElement("LINK");
        link.setAttribute("rel", "stylesheet");
        link.setAttribute("href", `https://fonts.googleapis.com/css?family=${fontFamily}`);
        return link;
    }


editor.Canvas.getDocument().head.append(this.createLinkElement(fontFamily));

element also not appending

Answers (3)

artfβ€’ March 20, 2020

I've made the issue template for a reason

sampathrajsβ€’ March 20, 2020

I've made the issue template for a reason

i want to add custom fonts in web builder could you please help me out

RutujaBadbeβ€’ February 27, 2021
Code SnippetTEXT
Hi! might be very late to comment but have you tried this? -
const link1 = document.createElement('link');
link1.rel = 'stylesheet';
link1.href = '/page-builder-assets/css/style.css';
canvas.getDocument().head.appendChild(link1);

it worked for me

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins β†’
Premium option

Premium plugins ship with support, regular updates, and production-ready features β€” save days of integration work.

Browse premium plugins β†’

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.