/*! * froala_editor v1.1.7 (http://editor.froala.com) * Copyright 2014-2014 Froala */ $.Editable.prototype.fontExec=function(a,b,c){document.execCommand("fontSize",!1,1),this.saveSelectionByMarkers();var d=[];this.$element.find("font").each(function(b,e){var f=$("").attr("data-font",a).css(a,c).html($(e).html());0===$(e).parents("font").length&&d.push(f),$(e).replaceWith(f)});for(var e=function(b,c){$(c).css(a,"")},f=0;f span[data-font="'+a+'"]').each(function(b,c){$(c).attr("style")&&($(c).before(''),$(c).after(''))});var h=this.$element.html();h=h.replace(new RegExp('',"g"),""),h=h.replace(new RegExp('data-open="true">',"g"),">"),this.$element.html(h),this.beautifyFont(a),this.$element.find('span[style=""]').each(function(a,b){$(b).replaceWith($(b).html())}),this.$element.find('span[data-font="'+a+'"]').each(function(b,c){$(c).css(a)==$(c).parent().css(a)&&$(c).replaceWith($(c).html())}),this.$element.find('span[data-font="'+a+'"]').each(function(a,b){""===$(b).text()&&$(b).replaceWith($(b).html())}),this.beautifyFont(a),this.restoreSelectionByMarkers(),this.repositionEditor(),this.callback(b,[c])},$.Editable.prototype.beautifyFont=function(a){for(var b=!0,c=$.proxy(function(){this.$element.find('span[data-font="'+a+'"] + span[data-font="'+a+'"]').each(function(c,d){$(d).css(a)==$(d).prev().css(a)&&d.previousSibling&&"SPAN"==d.previousSibling.tagName&&($(d).prepend($(d).prev().html()),$(d).prev().remove(),b=!0)}),this.$element.find('span[data-font="'+a+'"] + span.f-marker[data-type="true"] + span[data-font="'+a+'"], span[data-font="'+a+'"] + span.f-marker[data-type="false"] + span[data-font="'+a+'"]').each(function(c,d){$(d).css(a)==$(d).prev().prev().css(a)&&d.previousSibling&&"SPAN"==d.previousSibling.tagName&&d.previousSibling.previousSibling&&"SPAN"==d.previousSibling.previousSibling.tagName&&($(d).prepend($(d).prev().clone()),$(d).prepend($(d).prev().prev().html()),$(d).prev().prev().remove(),$(d).prev().remove(),b=!0)})},this);b;)b=!1,c()};