PHP Classes

File: Web/scripts/tinymce/plugins/visualchars/plugin.min.js

Recommend this page to a friend!
  Classes of Burge Lab   Burge CMF   Web/scripts/tinymce/plugins/visualchars/plugin.min.js   Download  
File: Web/scripts/tinymce/plugins/visualchars/plugin.min.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Burge CMF
Framework to publish managed content
Author: By
Last change:
Date: 8 years ago
Size: 1,259 bytes
 

Contents

Class file image Download
tinymce.PluginManager.add("visualchars",function(e){function t(t){function n(e){return'<span data-mce-bogus="1" class="mce-'+h[e]+'">'+e+"</span>"}function o(){var e,t="";for(e in h)t+=e;return new RegExp("["+t+"]","g")}function a(){var e,t="";for(e in h)t&&(t+=","),t+="span.mce-"+h[e];return t}var s,l,c,u,d,f,h,m,p=e.getBody(),g=e.selection;if(h={"\xa0":"nbsp","\xad":"shy"},r=!r,i.state=r,e.fire("VisualChars",{state:r}),m=o(),t&&(f=g.getBookmark()),r)for(l=[],tinymce.walk(p,function(e){3==e.nodeType&&e.nodeValue&&m.test(e.nodeValue)&&l.push(e)},"childNodes"),c=0;c<l.length;c++){for(u=l[c].nodeValue,u=u.replace(m,n),d=e.dom.create("div",null,u);s=d.lastChild;)e.dom.insertAfter(s,l[c]);e.dom.remove(l[c])}else for(l=e.dom.select(a(),p),c=l.length-1;c>=0;c--)e.dom.remove(l[c],1);g.moveToBookmark(f)}function n(){var t=this;e.on("VisualChars",function(e){t.active(e.state)})}var r,i=this;e.addCommand("mceVisualChars",t),e.addButton("visualchars",{title:"Show invisible characters",cmd:"mceVisualChars",onPostRender:n}),e.addMenuItem("visualchars",{text:"Show invisible characters",cmd:"mceVisualChars",onPostRender:n,selectable:!0,context:"view",prependToContext:!0}),e.on("beforegetcontent",function(e){r&&"raw"!=e.format&&!e.draft&&(r=!0,t(!1))})});