JSFiddle - React, Tailwind, and code Playground

JavaScript

var ckeditorHTMLString = '<span style="font-family:actor;">Hello world</span> <span style="font-family:allerta stencil;">It&#39;s nice to meet you.&nbsp;</span><link href="https://fonts.googleapis.com/css?family=Actor" rel="stylesheet" type="text/css" /><link href="https://fonts.googleapis.com/css?family=Allerta Stencil" rel="stylesheet" type="text/css" />',
    googleFontsBaseURI = "https://fonts.googleapis.com/css?family=";

var families = [];

function getFontFamily(inString, callback){
    
    var firstIndex = inString.indexOf(googleFontsBaseURI);
    
    if(firstIndex != -1){
        
        var rest = inString.substring(firstIndex+googleFontsBaseURI.length);
        console.log(rest);
        var fontFamilyEnd = rest.indexOf("\"");
    
        families.push(rest.substring(0, fontFamilyEnd));
        getFontFamily(rest.substring(fontFamilyEnd), callback);
    }
    else {
        callback(families);
    }
}

getFontFamily(ckeditorHTMLString, function(data){
    //Do something here to persist the font-families
    console.log(data);
});