From: Anthony Talarico Date: Mon, 11 Feb 2019 13:30:12 +0000 (-0500) Subject: finishing core functionality, still need minor styles and adjustments X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=2217da01f7fc6ca69b471576c1665e1570c13f53;p=WP-Plugins%2Fglm-member-db.git finishing core functionality, still need minor styles and adjustments --- diff --git a/js/shortcodeBuilder.js b/js/shortcodeBuilder.js index e4de8eb3..71d589ba 100644 --- a/js/shortcodeBuilder.js +++ b/js/shortcodeBuilder.js @@ -19,6 +19,10 @@ jQuery(function ($) { views : {list:[], isList: false}, blankstart : {list:[], isList: false}, } + function replaceNbsp(str) { + var re = new RegExp(String.fromCharCode(160), "g"); + return str.replace(re, " "); + } function generateShortCodeAttribute(state){ var attribute = $("
", { text : state.attribute, @@ -27,7 +31,7 @@ jQuery(function ($) { attribute.attr("data-"+state.type, state.id); attribute.attr("data-type", state.type); $("#"+state.type+"-string").empty(); - attribute.prepend( $("").html(" ")); + attribute.prepend( $("").html(" ")); $("#"+state.type+"-string").html(attribute); } function createShortcodeTile(state, elHook){ @@ -107,11 +111,12 @@ jQuery(function ($) { if( $(this).attr("id") == "copy-to-clipboard" ){ var tempInput = document.createElement("input"); tempInput.style = "position: absolute; left: -1000px; top: -1000px"; - tempInput.value = $("#shortcode-preview").text(); + tempInput.value = replaceNbsp($("#shortcode-preview").text()); document.body.appendChild(tempInput); tempInput.select(); document.execCommand("copy"); document.body.removeChild(tempInput); + $("#shortcode-no-space").children("span.shortcode-space").remove(); }else{ setupAttributes(); }