use_tinymce 0.0.15 → 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +34 -25
- data/Rakefile +13 -3
- data/assets/tinymce_jquery_4_0_2/tinymce/LICENSE.TXT +504 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/changelog.txt +157 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/jquery.tinymce.min.js +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/langs/readme.md +3 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/license.txt +504 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/advlist/plugin.min.js +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/anchor/plugin.min.js +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/autolink/plugin.min.js +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/autoresize/plugin.min.js +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/autosave/plugin.min.js +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/bbcode/plugin.min.js +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/charmap/plugin.min.js +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/code/plugin.min.js +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/compat3x/editable_selects.js +70 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/compat3x/form_utils.js +210 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/compat3x/mctabs.js +162 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/compat3x/tiny_mce_popup.js +435 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/compat3x/validate.js +252 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/contextmenu/plugin.min.js +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/directionality/plugin.min.js +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/emoticons/img/smiley-cool.gif +0 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/emoticons/img/smiley-cry.gif +0 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/emoticons/img/smiley-embarassed.gif +0 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/emoticons/img/smiley-foot-in-mouth.gif +0 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/emoticons/img/smiley-frown.gif +0 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/emoticons/img/smiley-innocent.gif +0 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/emoticons/img/smiley-kiss.gif +0 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/emoticons/img/smiley-laughing.gif +0 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/emoticons/img/smiley-money-mouth.gif +0 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/emoticons/img/smiley-sealed.gif +0 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/emoticons/img/smiley-smile.gif +0 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/emoticons/img/smiley-surprised.gif +0 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/emoticons/img/smiley-tongue-out.gif +0 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/emoticons/img/smiley-undecided.gif +0 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/emoticons/img/smiley-wink.gif +0 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/emoticons/img/smiley-yell.gif +0 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/emoticons/plugin.min.js +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/example/plugin.min.js +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/example_dependency/plugin.min.js +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/fullpage/plugin.min.js +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/fullscreen/plugin.min.js +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/hr/plugin.min.js +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/image/plugin.min.js +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/insertdatetime/plugin.min.js +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/layer/plugin.min.js +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/legacyoutput/plugin.min.js +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/link/plugin.min.js +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/lists/plugin.min.js +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/media/moxieplayer.swf +0 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/media/plugin.min.js +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/nonbreaking/plugin.min.js +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/noneditable/plugin.min.js +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/pagebreak/plugin.min.js +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/paste/plugin.min.js +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/preview/plugin.min.js +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/print/plugin.min.js +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/save/plugin.min.js +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/searchreplace/plugin.min.js +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/spellchecker/plugin.min.js +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/tabfocus/plugin.min.js +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/table/plugin.min.js +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/template/plugin.min.js +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/textcolor/plugin.min.js +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/visualblocks/css/visualblocks.css +114 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/visualblocks/plugin.min.js +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/visualchars/plugin.min.js +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/plugins/wordcount/plugin.min.js +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/skins/lightgray/content.inline.min.css +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/skins/lightgray/content.min.css +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/skins/lightgray/fonts/icomoon-small.eot +0 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/skins/lightgray/fonts/icomoon-small.svg +166 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/skins/lightgray/fonts/icomoon-small.ttf +0 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/skins/lightgray/fonts/icomoon-small.woff +0 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/skins/lightgray/fonts/icomoon.eot +0 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/skins/lightgray/fonts/icomoon.svg +150 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/skins/lightgray/fonts/icomoon.ttf +0 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/skins/lightgray/fonts/icomoon.woff +0 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/skins/lightgray/fonts/readme.md +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/skins/lightgray/img/anchor.gif +0 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/skins/lightgray/img/loader.gif +0 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/skins/lightgray/img/object.gif +0 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/skins/lightgray/img/trans.gif +0 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/skins/lightgray/img/wline.gif +0 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/skins/lightgray/skin.ie7.min.css +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/skins/lightgray/skin.min.css +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/themes/modern/theme.min.js +1 -0
- data/assets/tinymce_jquery_4_0_2/tinymce/js/tinymce/tinymce.min.js +9 -0
- data/lib/tasks/use_tinymce.rake +14 -1
- data/lib/use_tinymce/railengine.rb +1 -1
- data/lib/use_tinymce/use_tinymce.rb +15 -6
- data/lib/use_tinymce/version.rb +1 -0
- metadata +474 -386
@@ -0,0 +1 @@
|
|
1
|
+
tinymce.PluginManager.add("advlist",function(t){function e(t,e){var n=[];return tinymce.each(e.split(/[ ,]/),function(t){n.push({text:t.replace(/\-/g," ").replace(/\b\w/g,function(t){return t.toUpperCase()}),data:"default"==t?"":t})}),n}function n(e,n){var i,r=t.dom,a=t.selection;i=r.getParent(a.getNode(),"ol,ul"),i&&i.nodeName==e&&n!==!1||t.execCommand("UL"==e?"InsertUnorderedList":"InsertOrderedList"),n=n===!1?o[e]:n,o[e]=n,i=r.getParent(a.getNode(),"ol,ul"),i&&(r.setStyle(i,"listStyleType",n),i.removeAttribute("data-mce-style")),t.focus()}function i(e){var n=t.dom.getStyle(t.dom.getParent(t.selection.getNode(),"ol,ul"),"listStyleType")||"";e.control.items().each(function(t){t.active(t.settings.data===n)})}var r,a,o={};r=e("OL",t.getParam("advlist_number_styles","default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman")),a=e("UL",t.getParam("advlist_bullet_styles","default,circle,disc,square")),t.addButton("numlist",{type:"splitbutton",tooltip:"Numbered list",menu:r,onshow:i,onselect:function(t){n("OL",t.control.settings.data)},onclick:function(){n("OL",!1)}}),t.addButton("bullist",{type:"splitbutton",tooltip:"Bullet list",menu:a,onshow:i,onselect:function(t){n("UL",t.control.settings.data)},onclick:function(){n("UL",!1)}})});
|
@@ -0,0 +1 @@
|
|
1
|
+
tinymce.PluginManager.add("anchor",function(n){function e(){var e=n.selection.getNode();n.windowManager.open({title:"Anchor",body:{type:"textbox",name:"name",size:40,label:"Name",value:e.name||e.id},onsubmit:function(e){n.execCommand("mceInsertContent",!1,n.dom.createHTML("a",{id:e.data.name}))}})}n.addButton("anchor",{icon:"anchor",tooltip:"Anchor",onclick:e,stateSelector:"a:not([href])"}),n.addMenuItem("anchor",{icon:"anchor",text:"Anchor",context:"insert",onclick:e})});
|
@@ -0,0 +1 @@
|
|
1
|
+
tinymce.PluginManager.add("autolink",function(t){function e(t){o(t,-1,"(",!0)}function n(t){o(t,0,"",!0)}function i(t){o(t,-1,"",!1)}function o(t,e,n){var i,o,r,a,s,l,c,u,d;if(i=t.selection.getRng(!0).cloneRange(),i.startOffset<5){if(u=i.endContainer.previousSibling,!u){if(!i.endContainer.firstChild||!i.endContainer.firstChild.nextSibling)return;u=i.endContainer.firstChild.nextSibling}if(d=u.length,i.setStart(u,d),i.setEnd(u,d),i.endOffset<5)return;o=i.endOffset,a=u}else{if(a=i.endContainer,3!=a.nodeType&&a.firstChild){for(;3!=a.nodeType&&a.firstChild;)a=a.firstChild;3==a.nodeType&&(i.setStart(a,0),i.setEnd(a,a.nodeValue.length))}o=1==i.endOffset?2:i.endOffset-1-e}r=o;do i.setStart(a,o>=2?o-2:0),i.setEnd(a,o>=1?o-1:0),o-=1;while(" "!=i.toString()&&""!==i.toString()&&160!=i.toString().charCodeAt(0)&&o-2>=0&&i.toString()!=n);if(i.toString()==n||160==i.toString().charCodeAt(0)?(i.setStart(a,o),i.setEnd(a,r),o+=1):0===i.startOffset?(i.setStart(a,0),i.setEnd(a,r)):(i.setStart(a,o),i.setEnd(a,r)),l=i.toString(),"."==l.charAt(l.length-1)&&i.setEnd(a,r-1),l=i.toString(),c=l.match(/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+\-]+@)(.+)$/i),c&&("www."==c[1]?c[1]="http://www.":/@$/.test(c[1])&&!/^mailto:/.test(c[1])&&(c[1]="mailto:"+c[1]),s=t.selection.getBookmark(),t.selection.setRng(i),t.execCommand("createlink",!1,c[1]+c[2]),t.selection.moveToBookmark(s),t.nodeChanged(),tinymce.Env.webkit)){t.selection.collapse(!1);var m=Math.min(a.length,r+1);i.setStart(a,m),i.setEnd(a,m),t.selection.setRng(i)}}t.on("keydown",function(e){return 13==e.keyCode?i(t):void 0}),tinymce.Env.ie||(t.on("keypress",function(n){return 41==n.which?e(t):void 0}),t.on("keyup",function(e){return 32==e.keyCode?n(t):void 0}))});
|
@@ -0,0 +1 @@
|
|
1
|
+
tinymce.PluginManager.add("autoresize",function(e){function t(a){var r,o,c=e.getDoc(),s=c.body,u=c.documentElement,l=tinymce.DOM,m=n.autoresize_min_height;"setcontent"==a.type&&a.initial||e.plugins.fullscreen&&e.plugins.fullscreen.isFullscreen()||(o=tinymce.Env.ie?s.scrollHeight:tinymce.Env.webkit&&0===s.clientHeight?0:s.offsetHeight,o>n.autoresize_min_height&&(m=o),n.autoresize_max_height&&o>n.autoresize_max_height?(m=n.autoresize_max_height,s.style.overflowY="auto",u.style.overflowY="auto"):(s.style.overflowY="hidden",u.style.overflowY="hidden",s.scrollTop=0),m!==i&&(r=m-i,l.setStyle(l.get(e.id+"_ifr"),"height",m+"px"),i=m,tinymce.isWebKit&&0>r&&t(a)))}var n=e.settings,i=0;e.settings.inline||(n.autoresize_min_height=parseInt(e.getParam("autoresize_min_height",e.getElement().offsetHeight),10),n.autoresize_max_height=parseInt(e.getParam("autoresize_max_height",0),10),e.on("init",function(){e.dom.setStyle(e.getBody(),"paddingBottom",e.getParam("autoresize_bottom_margin",50)+"px")}),e.on("change setcontent paste keyup",t),e.getParam("autoresize_on_init",!0)&&e.on("load",t),e.addCommand("mceAutoResize",t))});
|
@@ -0,0 +1 @@
|
|
1
|
+
tinymce.PluginManager.add("autosave",function(t){function e(t,e){var n={s:1e3,m:6e4};return t=/^(\d+)([ms]?)$/.exec(""+(t||e)),(t[2]?n[t[2]]:1)*parseInt(t,10)}function n(){var t=parseInt(m.getItem(f+"autosave.time"),10)||0;return(new Date).getTime()-t>d.autosave_retention?(i(),!1):!0}function i(){m.removeItem(f+"autosave.draft"),m.removeItem(f+"autosave.time")}function a(){c&&t.isDirty()&&(m.setItem(f+"autosave.draft",t.getContent({format:"raw",no_events:!0})),m.setItem(f+"autosave.time",(new Date).getTime()),t.fire("StoreDraft"))}function r(){n()&&(t.setContent(m.getItem(f+"autosave.draft"),{format:"raw"}),i(),t.fire("RestoreDraft"))}function o(){c||(setInterval(function(){t.removed||a()},d.autosave_interval),c=!0)}function s(){var e=this;e.disabled(!n()),t.on("StoreDraft RestoreDraft",function(){e.disabled(!n())}),o()}function l(){t.undoManager.beforeChange(),r(),t.undoManager.add()}function u(){var t;return tinymce.each(tinymce.editors,function(e){e.plugins.autosave&&e.plugins.autosave.storeDraft(),!t&&e.isDirty()&&e.getParam("autosave_ask_before_unload",!0)&&(t=e.translate("You have unsaved changes are you sure you want to navigate away?"))}),t}var c,d=t.settings,m=tinymce.util.LocalStorage,f=t.id;d.autosave_interval=e(d.autosave_interval,"30s"),d.autosave_retention=e(d.autosave_retention,"20m"),t.addButton("restoredraft",{title:"Restore last draft",onclick:l,onPostRender:s}),t.addMenuItem("restoredraft",{text:"Restore last draft",onclick:l,onPostRender:s,context:"file"}),this.storeDraft=a,window.onbeforeunload=u});
|
@@ -0,0 +1 @@
|
|
1
|
+
!function(){tinymce.create("tinymce.plugins.BBCodePlugin",{init:function(e){var t=this,n=e.getParam("bbcode_dialect","punbb").toLowerCase();e.on("beforeSetContent",function(e){e.content=t["_"+n+"_bbcode2html"](e.content)}),e.on("postProcess",function(e){e.set&&(e.content=t["_"+n+"_bbcode2html"](e.content)),e.get&&(e.content=t["_"+n+"_html2bbcode"](e.content))})},getInfo:function(){return{longname:"BBCode Plugin",author:"Moxiecode Systems AB",authorurl:"http://www.tinymce.com",infourl:"http://www.tinymce.com/wiki.php/Plugin:bbcode"}},_punbb_html2bbcode:function(e){function t(t,n){e=e.replace(t,n)}return e=tinymce.trim(e),t(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]"),t(/<font.*?color=\"(.*?)\".*?class=\"codeStyle\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),t(/<font.*?color=\"(.*?)\".*?class=\"quoteStyle\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),t(/<font.*?class=\"codeStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),t(/<font.*?class=\"quoteStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),t(/<span style=\"color: ?(.*?);\">(.*?)<\/span>/gi,"[color=$1]$2[/color]"),t(/<font.*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[color=$1]$2[/color]"),t(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi,"[size=$1]$2[/size]"),t(/<font>(.*?)<\/font>/gi,"$1"),t(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]"),t(/<span class=\"codeStyle\">(.*?)<\/span>/gi,"[code]$1[/code]"),t(/<span class=\"quoteStyle\">(.*?)<\/span>/gi,"[quote]$1[/quote]"),t(/<strong class=\"codeStyle\">(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]"),t(/<strong class=\"quoteStyle\">(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]"),t(/<em class=\"codeStyle\">(.*?)<\/em>/gi,"[code][i]$1[/i][/code]"),t(/<em class=\"quoteStyle\">(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]"),t(/<u class=\"codeStyle\">(.*?)<\/u>/gi,"[code][u]$1[/u][/code]"),t(/<u class=\"quoteStyle\">(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]"),t(/<\/(strong|b)>/gi,"[/b]"),t(/<(strong|b)>/gi,"[b]"),t(/<\/(em|i)>/gi,"[/i]"),t(/<(em|i)>/gi,"[i]"),t(/<\/u>/gi,"[/u]"),t(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi,"[u]$1[/u]"),t(/<u>/gi,"[u]"),t(/<blockquote[^>]*>/gi,"[quote]"),t(/<\/blockquote>/gi,"[/quote]"),t(/<br \/>/gi,"\n"),t(/<br\/>/gi,"\n"),t(/<br>/gi,"\n"),t(/<p>/gi,""),t(/<\/p>/gi,"\n"),t(/ |\u00a0/gi," "),t(/"/gi,'"'),t(/</gi,"<"),t(/>/gi,">"),t(/&/gi,"&"),e},_punbb_bbcode2html:function(e){function t(t,n){e=e.replace(t,n)}return e=tinymce.trim(e),t(/\n/gi,"<br />"),t(/\[b\]/gi,"<strong>"),t(/\[\/b\]/gi,"</strong>"),t(/\[i\]/gi,"<em>"),t(/\[\/i\]/gi,"</em>"),t(/\[u\]/gi,"<u>"),t(/\[\/u\]/gi,"</u>"),t(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,'<a href="$1">$2</a>'),t(/\[url\](.*?)\[\/url\]/gi,'<a href="$1">$1</a>'),t(/\[img\](.*?)\[\/img\]/gi,'<img src="$1" />'),t(/\[color=(.*?)\](.*?)\[\/color\]/gi,'<font color="$1">$2</font>'),t(/\[code\](.*?)\[\/code\]/gi,'<span class="codeStyle">$1</span> '),t(/\[quote.*?\](.*?)\[\/quote\]/gi,'<span class="quoteStyle">$1</span> '),e}}),tinymce.PluginManager.add("bbcode",tinymce.plugins.BBCodePlugin)}();
|
@@ -0,0 +1 @@
|
|
1
|
+
tinymce.PluginManager.add("charmap",function(e){function t(){function t(e){for(;e;){if("TD"==e.nodeName)return e;e=e.parentNode}}var i,a,r,o;i='<table role="presentation" cellspacing="0" class="mce-charmap"><tbody>';var s=25;for(r=0;10>r;r++){for(i+="<tr>",a=0;s>a;a++){var l=n[r*s+a],c="g"+(r*s+a);i+='<td title="'+l[1]+'"><div id="'+c+'" tabIndex="-1">'+(l?String.fromCharCode(parseInt(l[0],10)):" ")+"</div></td>"}i+="</tr>"}i+="</tbody></table>";var u={type:"container",html:i,onclick:function(t){var n=t.target;"DIV"==n.nodeName&&e.execCommand("mceInsertContent",!1,n.firstChild.nodeValue)},onmouseover:function(e){var n=t(e.target);n&&o.find("#preview").text(n.firstChild.firstChild.data)}};o=e.windowManager.open({title:"Special character",spacing:10,padding:10,items:[u,{type:"label",name:"preview",text:" ",style:"font-size: 40px; text-align: center",border:1,minWidth:100,minHeight:80}],buttons:[{text:"Close",onclick:function(){o.close()}}]})}var n=[["160","no-break space"],["38","ampersand"],["34","quotation mark"],["162","cent sign"],["8364","euro sign"],["163","pound sign"],["165","yen sign"],["169","copyright sign"],["174","registered sign"],["8482","trade mark sign"],["8240","per mille sign"],["181","micro sign"],["183","middle dot"],["8226","bullet"],["8230","three dot leader"],["8242","minutes / feet"],["8243","seconds / inches"],["167","section sign"],["182","paragraph sign"],["223","sharp s / ess-zed"],["8249","single left-pointing angle quotation mark"],["8250","single right-pointing angle quotation mark"],["171","left pointing guillemet"],["187","right pointing guillemet"],["8216","left single quotation mark"],["8217","right single quotation mark"],["8220","left double quotation mark"],["8221","right double quotation mark"],["8218","single low-9 quotation mark"],["8222","double low-9 quotation mark"],["60","less-than sign"],["62","greater-than sign"],["8804","less-than or equal to"],["8805","greater-than or equal to"],["8211","en dash"],["8212","em dash"],["175","macron"],["8254","overline"],["164","currency sign"],["166","broken bar"],["168","diaeresis"],["161","inverted exclamation mark"],["191","turned question mark"],["710","circumflex accent"],["732","small tilde"],["176","degree sign"],["8722","minus sign"],["177","plus-minus sign"],["247","division sign"],["8260","fraction slash"],["215","multiplication sign"],["185","superscript one"],["178","superscript two"],["179","superscript three"],["188","fraction one quarter"],["189","fraction one half"],["190","fraction three quarters"],["402","function / florin"],["8747","integral"],["8721","n-ary sumation"],["8734","infinity"],["8730","square root"],["8764","similar to"],["8773","approximately equal to"],["8776","almost equal to"],["8800","not equal to"],["8801","identical to"],["8712","element of"],["8713","not an element of"],["8715","contains as member"],["8719","n-ary product"],["8743","logical and"],["8744","logical or"],["172","not sign"],["8745","intersection"],["8746","union"],["8706","partial differential"],["8704","for all"],["8707","there exists"],["8709","diameter"],["8711","backward difference"],["8727","asterisk operator"],["8733","proportional to"],["8736","angle"],["180","acute accent"],["184","cedilla"],["170","feminine ordinal indicator"],["186","masculine ordinal indicator"],["8224","dagger"],["8225","double dagger"],["192","A - grave"],["193","A - acute"],["194","A - circumflex"],["195","A - tilde"],["196","A - diaeresis"],["197","A - ring above"],["198","ligature AE"],["199","C - cedilla"],["200","E - grave"],["201","E - acute"],["202","E - circumflex"],["203","E - diaeresis"],["204","I - grave"],["205","I - acute"],["206","I - circumflex"],["207","I - diaeresis"],["208","ETH"],["209","N - tilde"],["210","O - grave"],["211","O - acute"],["212","O - circumflex"],["213","O - tilde"],["214","O - diaeresis"],["216","O - slash"],["338","ligature OE"],["352","S - caron"],["217","U - grave"],["218","U - acute"],["219","U - circumflex"],["220","U - diaeresis"],["221","Y - acute"],["376","Y - diaeresis"],["222","THORN"],["224","a - grave"],["225","a - acute"],["226","a - circumflex"],["227","a - tilde"],["228","a - diaeresis"],["229","a - ring above"],["230","ligature ae"],["231","c - cedilla"],["232","e - grave"],["233","e - acute"],["234","e - circumflex"],["235","e - diaeresis"],["236","i - grave"],["237","i - acute"],["238","i - circumflex"],["239","i - diaeresis"],["240","eth"],["241","n - tilde"],["242","o - grave"],["243","o - acute"],["244","o - circumflex"],["245","o - tilde"],["246","o - diaeresis"],["248","o slash"],["339","ligature oe"],["353","s - caron"],["249","u - grave"],["250","u - acute"],["251","u - circumflex"],["252","u - diaeresis"],["253","y - acute"],["254","thorn"],["255","y - diaeresis"],["913","Alpha"],["914","Beta"],["915","Gamma"],["916","Delta"],["917","Epsilon"],["918","Zeta"],["919","Eta"],["920","Theta"],["921","Iota"],["922","Kappa"],["923","Lambda"],["924","Mu"],["925","Nu"],["926","Xi"],["927","Omicron"],["928","Pi"],["929","Rho"],["931","Sigma"],["932","Tau"],["933","Upsilon"],["934","Phi"],["935","Chi"],["936","Psi"],["937","Omega"],["945","alpha"],["946","beta"],["947","gamma"],["948","delta"],["949","epsilon"],["950","zeta"],["951","eta"],["952","theta"],["953","iota"],["954","kappa"],["955","lambda"],["956","mu"],["957","nu"],["958","xi"],["959","omicron"],["960","pi"],["961","rho"],["962","final sigma"],["963","sigma"],["964","tau"],["965","upsilon"],["966","phi"],["967","chi"],["968","psi"],["969","omega"],["8501","alef symbol"],["982","pi symbol"],["8476","real part symbol"],["978","upsilon - hook symbol"],["8472","Weierstrass p"],["8465","imaginary part"],["8592","leftwards arrow"],["8593","upwards arrow"],["8594","rightwards arrow"],["8595","downwards arrow"],["8596","left right arrow"],["8629","carriage return"],["8656","leftwards double arrow"],["8657","upwards double arrow"],["8658","rightwards double arrow"],["8659","downwards double arrow"],["8660","left right double arrow"],["8756","therefore"],["8834","subset of"],["8835","superset of"],["8836","not a subset of"],["8838","subset of or equal to"],["8839","superset of or equal to"],["8853","circled plus"],["8855","circled times"],["8869","perpendicular"],["8901","dot operator"],["8968","left ceiling"],["8969","right ceiling"],["8970","left floor"],["8971","right floor"],["9001","left-pointing angle bracket"],["9002","right-pointing angle bracket"],["9674","lozenge"],["9824","black spade suit"],["9827","black club suit"],["9829","black heart suit"],["9830","black diamond suit"],["8194","en space"],["8195","em space"],["8201","thin space"],["8204","zero width non-joiner"],["8205","zero width joiner"],["8206","left-to-right mark"],["8207","right-to-left mark"],["173","soft hyphen"]];e.addButton("charmap",{icon:"charmap",tooltip:"Special character",onclick:t}),e.addMenuItem("charmap",{icon:"charmap",text:"Special character",onclick:t,context:"insert"})});
|
@@ -0,0 +1 @@
|
|
1
|
+
tinymce.PluginManager.add("code",function(e){function t(){e.windowManager.open({title:"Source code",body:{type:"textbox",name:"code",multiline:!0,minWidth:600,minHeight:500,value:e.getContent({source_view:!0}),spellcheck:!1},onSubmit:function(t){e.setContent(t.data.code)}})}e.addButton("code",{icon:"code",tooltip:"Source code",onclick:t}),e.addMenuItem("code",{icon:"code",text:"Source code",context:"tools",onclick:t})});
|
@@ -0,0 +1,70 @@
|
|
1
|
+
/**
|
2
|
+
* editable_selects.js
|
3
|
+
*
|
4
|
+
* Copyright, Moxiecode Systems AB
|
5
|
+
* Released under LGPL License.
|
6
|
+
*
|
7
|
+
* License: http://www.tinymce.com/license
|
8
|
+
* Contributing: http://www.tinymce.com/contributing
|
9
|
+
*/
|
10
|
+
|
11
|
+
var TinyMCE_EditableSelects = {
|
12
|
+
editSelectElm : null,
|
13
|
+
|
14
|
+
init : function() {
|
15
|
+
var nl = document.getElementsByTagName("select"), i, d = document, o;
|
16
|
+
|
17
|
+
for (i=0; i<nl.length; i++) {
|
18
|
+
if (nl[i].className.indexOf('mceEditableSelect') != -1) {
|
19
|
+
o = new Option(tinyMCEPopup.editor.translate('value'), '__mce_add_custom__');
|
20
|
+
|
21
|
+
o.className = 'mceAddSelectValue';
|
22
|
+
|
23
|
+
nl[i].options[nl[i].options.length] = o;
|
24
|
+
nl[i].onchange = TinyMCE_EditableSelects.onChangeEditableSelect;
|
25
|
+
}
|
26
|
+
}
|
27
|
+
},
|
28
|
+
|
29
|
+
onChangeEditableSelect : function(e) {
|
30
|
+
var d = document, ne, se = window.event ? window.event.srcElement : e.target;
|
31
|
+
|
32
|
+
if (se.options[se.selectedIndex].value == '__mce_add_custom__') {
|
33
|
+
ne = d.createElement("input");
|
34
|
+
ne.id = se.id + "_custom";
|
35
|
+
ne.name = se.name + "_custom";
|
36
|
+
ne.type = "text";
|
37
|
+
|
38
|
+
ne.style.width = se.offsetWidth + 'px';
|
39
|
+
se.parentNode.insertBefore(ne, se);
|
40
|
+
se.style.display = 'none';
|
41
|
+
ne.focus();
|
42
|
+
ne.onblur = TinyMCE_EditableSelects.onBlurEditableSelectInput;
|
43
|
+
ne.onkeydown = TinyMCE_EditableSelects.onKeyDown;
|
44
|
+
TinyMCE_EditableSelects.editSelectElm = se;
|
45
|
+
}
|
46
|
+
},
|
47
|
+
|
48
|
+
onBlurEditableSelectInput : function() {
|
49
|
+
var se = TinyMCE_EditableSelects.editSelectElm;
|
50
|
+
|
51
|
+
if (se) {
|
52
|
+
if (se.previousSibling.value != '') {
|
53
|
+
addSelectValue(document.forms[0], se.id, se.previousSibling.value, se.previousSibling.value);
|
54
|
+
selectByValue(document.forms[0], se.id, se.previousSibling.value);
|
55
|
+
} else
|
56
|
+
selectByValue(document.forms[0], se.id, '');
|
57
|
+
|
58
|
+
se.style.display = 'inline';
|
59
|
+
se.parentNode.removeChild(se.previousSibling);
|
60
|
+
TinyMCE_EditableSelects.editSelectElm = null;
|
61
|
+
}
|
62
|
+
},
|
63
|
+
|
64
|
+
onKeyDown : function(e) {
|
65
|
+
e = e || window.event;
|
66
|
+
|
67
|
+
if (e.keyCode == 13)
|
68
|
+
TinyMCE_EditableSelects.onBlurEditableSelectInput();
|
69
|
+
}
|
70
|
+
};
|
@@ -0,0 +1,210 @@
|
|
1
|
+
/**
|
2
|
+
* form_utils.js
|
3
|
+
*
|
4
|
+
* Copyright, Moxiecode Systems AB
|
5
|
+
* Released under LGPL License.
|
6
|
+
*
|
7
|
+
* License: http://www.tinymce.com/license
|
8
|
+
* Contributing: http://www.tinymce.com/contributing
|
9
|
+
*/
|
10
|
+
|
11
|
+
var themeBaseURL = tinyMCEPopup.editor.baseURI.toAbsolute('themes/' + tinyMCEPopup.getParam("theme"));
|
12
|
+
|
13
|
+
function getColorPickerHTML(id, target_form_element) {
|
14
|
+
var h = "", dom = tinyMCEPopup.dom;
|
15
|
+
|
16
|
+
if (label = dom.select('label[for=' + target_form_element + ']')[0]) {
|
17
|
+
label.id = label.id || dom.uniqueId();
|
18
|
+
}
|
19
|
+
|
20
|
+
h += '<a role="button" aria-labelledby="' + id + '_label" id="' + id + '_link" href="javascript:;" onclick="tinyMCEPopup.pickColor(event,\'' + target_form_element +'\');" onmousedown="return false;" class="pickcolor">';
|
21
|
+
h += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '"> <span id="' + id + '_label" class="mceVoiceLabel mceIconOnly" style="display:none;">' + tinyMCEPopup.getLang('browse') + '</span></span></a>';
|
22
|
+
|
23
|
+
return h;
|
24
|
+
}
|
25
|
+
|
26
|
+
function updateColor(img_id, form_element_id) {
|
27
|
+
document.getElementById(img_id).style.backgroundColor = document.forms[0].elements[form_element_id].value;
|
28
|
+
}
|
29
|
+
|
30
|
+
function setBrowserDisabled(id, state) {
|
31
|
+
var img = document.getElementById(id);
|
32
|
+
var lnk = document.getElementById(id + "_link");
|
33
|
+
|
34
|
+
if (lnk) {
|
35
|
+
if (state) {
|
36
|
+
lnk.setAttribute("realhref", lnk.getAttribute("href"));
|
37
|
+
lnk.removeAttribute("href");
|
38
|
+
tinyMCEPopup.dom.addClass(img, 'disabled');
|
39
|
+
} else {
|
40
|
+
if (lnk.getAttribute("realhref"))
|
41
|
+
lnk.setAttribute("href", lnk.getAttribute("realhref"));
|
42
|
+
|
43
|
+
tinyMCEPopup.dom.removeClass(img, 'disabled');
|
44
|
+
}
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
function getBrowserHTML(id, target_form_element, type, prefix) {
|
49
|
+
var option = prefix + "_" + type + "_browser_callback", cb, html;
|
50
|
+
|
51
|
+
cb = tinyMCEPopup.getParam(option, tinyMCEPopup.getParam("file_browser_callback"));
|
52
|
+
|
53
|
+
if (!cb)
|
54
|
+
return "";
|
55
|
+
|
56
|
+
html = "";
|
57
|
+
html += '<a id="' + id + '_link" href="javascript:openBrowser(\'' + id + '\',\'' + target_form_element + '\', \'' + type + '\',\'' + option + '\');" onmousedown="return false;" class="browse">';
|
58
|
+
html += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '"> </span></a>';
|
59
|
+
|
60
|
+
return html;
|
61
|
+
}
|
62
|
+
|
63
|
+
function openBrowser(img_id, target_form_element, type, option) {
|
64
|
+
var img = document.getElementById(img_id);
|
65
|
+
|
66
|
+
if (img.className != "mceButtonDisabled")
|
67
|
+
tinyMCEPopup.openBrowser(target_form_element, type, option);
|
68
|
+
}
|
69
|
+
|
70
|
+
function selectByValue(form_obj, field_name, value, add_custom, ignore_case) {
|
71
|
+
if (!form_obj || !form_obj.elements[field_name])
|
72
|
+
return;
|
73
|
+
|
74
|
+
if (!value)
|
75
|
+
value = "";
|
76
|
+
|
77
|
+
var sel = form_obj.elements[field_name];
|
78
|
+
|
79
|
+
var found = false;
|
80
|
+
for (var i=0; i<sel.options.length; i++) {
|
81
|
+
var option = sel.options[i];
|
82
|
+
|
83
|
+
if (option.value == value || (ignore_case && option.value.toLowerCase() == value.toLowerCase())) {
|
84
|
+
option.selected = true;
|
85
|
+
found = true;
|
86
|
+
} else
|
87
|
+
option.selected = false;
|
88
|
+
}
|
89
|
+
|
90
|
+
if (!found && add_custom && value != '') {
|
91
|
+
var option = new Option(value, value);
|
92
|
+
option.selected = true;
|
93
|
+
sel.options[sel.options.length] = option;
|
94
|
+
sel.selectedIndex = sel.options.length - 1;
|
95
|
+
}
|
96
|
+
|
97
|
+
return found;
|
98
|
+
}
|
99
|
+
|
100
|
+
function getSelectValue(form_obj, field_name) {
|
101
|
+
var elm = form_obj.elements[field_name];
|
102
|
+
|
103
|
+
if (elm == null || elm.options == null || elm.selectedIndex === -1)
|
104
|
+
return "";
|
105
|
+
|
106
|
+
return elm.options[elm.selectedIndex].value;
|
107
|
+
}
|
108
|
+
|
109
|
+
function addSelectValue(form_obj, field_name, name, value) {
|
110
|
+
var s = form_obj.elements[field_name];
|
111
|
+
var o = new Option(name, value);
|
112
|
+
s.options[s.options.length] = o;
|
113
|
+
}
|
114
|
+
|
115
|
+
function addClassesToList(list_id, specific_option) {
|
116
|
+
// Setup class droplist
|
117
|
+
var styleSelectElm = document.getElementById(list_id);
|
118
|
+
var styles = tinyMCEPopup.getParam('theme_advanced_styles', false);
|
119
|
+
styles = tinyMCEPopup.getParam(specific_option, styles);
|
120
|
+
|
121
|
+
if (styles) {
|
122
|
+
var stylesAr = styles.split(';');
|
123
|
+
|
124
|
+
for (var i=0; i<stylesAr.length; i++) {
|
125
|
+
if (stylesAr != "") {
|
126
|
+
var key, value;
|
127
|
+
|
128
|
+
key = stylesAr[i].split('=')[0];
|
129
|
+
value = stylesAr[i].split('=')[1];
|
130
|
+
|
131
|
+
styleSelectElm.options[styleSelectElm.length] = new Option(key, value);
|
132
|
+
}
|
133
|
+
}
|
134
|
+
} else {
|
135
|
+
tinymce.each(tinyMCEPopup.editor.dom.getClasses(), function(o) {
|
136
|
+
styleSelectElm.options[styleSelectElm.length] = new Option(o.title || o['class'], o['class']);
|
137
|
+
});
|
138
|
+
}
|
139
|
+
}
|
140
|
+
|
141
|
+
function isVisible(element_id) {
|
142
|
+
var elm = document.getElementById(element_id);
|
143
|
+
|
144
|
+
return elm && elm.style.display != "none";
|
145
|
+
}
|
146
|
+
|
147
|
+
function convertRGBToHex(col) {
|
148
|
+
var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi");
|
149
|
+
|
150
|
+
var rgb = col.replace(re, "$1,$2,$3").split(',');
|
151
|
+
if (rgb.length == 3) {
|
152
|
+
r = parseInt(rgb[0]).toString(16);
|
153
|
+
g = parseInt(rgb[1]).toString(16);
|
154
|
+
b = parseInt(rgb[2]).toString(16);
|
155
|
+
|
156
|
+
r = r.length == 1 ? '0' + r : r;
|
157
|
+
g = g.length == 1 ? '0' + g : g;
|
158
|
+
b = b.length == 1 ? '0' + b : b;
|
159
|
+
|
160
|
+
return "#" + r + g + b;
|
161
|
+
}
|
162
|
+
|
163
|
+
return col;
|
164
|
+
}
|
165
|
+
|
166
|
+
function convertHexToRGB(col) {
|
167
|
+
if (col.indexOf('#') != -1) {
|
168
|
+
col = col.replace(new RegExp('[^0-9A-F]', 'gi'), '');
|
169
|
+
|
170
|
+
r = parseInt(col.substring(0, 2), 16);
|
171
|
+
g = parseInt(col.substring(2, 4), 16);
|
172
|
+
b = parseInt(col.substring(4, 6), 16);
|
173
|
+
|
174
|
+
return "rgb(" + r + "," + g + "," + b + ")";
|
175
|
+
}
|
176
|
+
|
177
|
+
return col;
|
178
|
+
}
|
179
|
+
|
180
|
+
function trimSize(size) {
|
181
|
+
return size.replace(/([0-9\.]+)(px|%|in|cm|mm|em|ex|pt|pc)/i, '$1$2');
|
182
|
+
}
|
183
|
+
|
184
|
+
function getCSSSize(size) {
|
185
|
+
size = trimSize(size);
|
186
|
+
|
187
|
+
if (size == "")
|
188
|
+
return "";
|
189
|
+
|
190
|
+
// Add px
|
191
|
+
if (/^[0-9]+$/.test(size))
|
192
|
+
size += 'px';
|
193
|
+
// Sanity check, IE doesn't like broken values
|
194
|
+
else if (!(/^[0-9\.]+(px|%|in|cm|mm|em|ex|pt|pc)$/i.test(size)))
|
195
|
+
return "";
|
196
|
+
|
197
|
+
return size;
|
198
|
+
}
|
199
|
+
|
200
|
+
function getStyle(elm, attrib, style) {
|
201
|
+
var val = tinyMCEPopup.dom.getAttrib(elm, attrib);
|
202
|
+
|
203
|
+
if (val != '')
|
204
|
+
return '' + val;
|
205
|
+
|
206
|
+
if (typeof(style) == 'undefined')
|
207
|
+
style = attrib;
|
208
|
+
|
209
|
+
return tinyMCEPopup.dom.getStyle(elm, style);
|
210
|
+
}
|
@@ -0,0 +1,162 @@
|
|
1
|
+
/**
|
2
|
+
* mctabs.js
|
3
|
+
*
|
4
|
+
* Copyright, Moxiecode Systems AB
|
5
|
+
* Released under LGPL License.
|
6
|
+
*
|
7
|
+
* License: http://www.tinymce.com/license
|
8
|
+
* Contributing: http://www.tinymce.com/contributing
|
9
|
+
*/
|
10
|
+
|
11
|
+
function MCTabs() {
|
12
|
+
this.settings = [];
|
13
|
+
this.onChange = tinyMCEPopup.editor.windowManager.createInstance('tinymce.util.Dispatcher');
|
14
|
+
};
|
15
|
+
|
16
|
+
MCTabs.prototype.init = function(settings) {
|
17
|
+
this.settings = settings;
|
18
|
+
};
|
19
|
+
|
20
|
+
MCTabs.prototype.getParam = function(name, default_value) {
|
21
|
+
var value = null;
|
22
|
+
|
23
|
+
value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];
|
24
|
+
|
25
|
+
// Fix bool values
|
26
|
+
if (value == "true" || value == "false")
|
27
|
+
return (value == "true");
|
28
|
+
|
29
|
+
return value;
|
30
|
+
};
|
31
|
+
|
32
|
+
MCTabs.prototype.showTab =function(tab){
|
33
|
+
tab.className = 'current';
|
34
|
+
tab.setAttribute("aria-selected", true);
|
35
|
+
tab.setAttribute("aria-expanded", true);
|
36
|
+
tab.tabIndex = 0;
|
37
|
+
};
|
38
|
+
|
39
|
+
MCTabs.prototype.hideTab =function(tab){
|
40
|
+
var t=this;
|
41
|
+
|
42
|
+
tab.className = '';
|
43
|
+
tab.setAttribute("aria-selected", false);
|
44
|
+
tab.setAttribute("aria-expanded", false);
|
45
|
+
tab.tabIndex = -1;
|
46
|
+
};
|
47
|
+
|
48
|
+
MCTabs.prototype.showPanel = function(panel) {
|
49
|
+
panel.className = 'current';
|
50
|
+
panel.setAttribute("aria-hidden", false);
|
51
|
+
};
|
52
|
+
|
53
|
+
MCTabs.prototype.hidePanel = function(panel) {
|
54
|
+
panel.className = 'panel';
|
55
|
+
panel.setAttribute("aria-hidden", true);
|
56
|
+
};
|
57
|
+
|
58
|
+
MCTabs.prototype.getPanelForTab = function(tabElm) {
|
59
|
+
return tinyMCEPopup.dom.getAttrib(tabElm, "aria-controls");
|
60
|
+
};
|
61
|
+
|
62
|
+
MCTabs.prototype.displayTab = function(tab_id, panel_id, avoid_focus) {
|
63
|
+
var panelElm, panelContainerElm, tabElm, tabContainerElm, selectionClass, nodes, i, t = this;
|
64
|
+
|
65
|
+
tabElm = document.getElementById(tab_id);
|
66
|
+
|
67
|
+
if (panel_id === undefined) {
|
68
|
+
panel_id = t.getPanelForTab(tabElm);
|
69
|
+
}
|
70
|
+
|
71
|
+
panelElm= document.getElementById(panel_id);
|
72
|
+
panelContainerElm = panelElm ? panelElm.parentNode : null;
|
73
|
+
tabContainerElm = tabElm ? tabElm.parentNode : null;
|
74
|
+
selectionClass = t.getParam('selection_class', 'current');
|
75
|
+
|
76
|
+
if (tabElm && tabContainerElm) {
|
77
|
+
nodes = tabContainerElm.childNodes;
|
78
|
+
|
79
|
+
// Hide all other tabs
|
80
|
+
for (i = 0; i < nodes.length; i++) {
|
81
|
+
if (nodes[i].nodeName == "LI") {
|
82
|
+
t.hideTab(nodes[i]);
|
83
|
+
}
|
84
|
+
}
|
85
|
+
|
86
|
+
// Show selected tab
|
87
|
+
t.showTab(tabElm);
|
88
|
+
}
|
89
|
+
|
90
|
+
if (panelElm && panelContainerElm) {
|
91
|
+
nodes = panelContainerElm.childNodes;
|
92
|
+
|
93
|
+
// Hide all other panels
|
94
|
+
for (i = 0; i < nodes.length; i++) {
|
95
|
+
if (nodes[i].nodeName == "DIV")
|
96
|
+
t.hidePanel(nodes[i]);
|
97
|
+
}
|
98
|
+
|
99
|
+
if (!avoid_focus) {
|
100
|
+
tabElm.focus();
|
101
|
+
}
|
102
|
+
|
103
|
+
// Show selected panel
|
104
|
+
t.showPanel(panelElm);
|
105
|
+
}
|
106
|
+
};
|
107
|
+
|
108
|
+
MCTabs.prototype.getAnchor = function() {
|
109
|
+
var pos, url = document.location.href;
|
110
|
+
|
111
|
+
if ((pos = url.lastIndexOf('#')) != -1)
|
112
|
+
return url.substring(pos + 1);
|
113
|
+
|
114
|
+
return "";
|
115
|
+
};
|
116
|
+
|
117
|
+
|
118
|
+
//Global instance
|
119
|
+
var mcTabs = new MCTabs();
|
120
|
+
|
121
|
+
tinyMCEPopup.onInit.add(function() {
|
122
|
+
var tinymce = tinyMCEPopup.getWin().tinymce, dom = tinyMCEPopup.dom, each = tinymce.each;
|
123
|
+
|
124
|
+
each(dom.select('div.tabs'), function(tabContainerElm) {
|
125
|
+
var keyNav;
|
126
|
+
|
127
|
+
dom.setAttrib(tabContainerElm, "role", "tablist");
|
128
|
+
|
129
|
+
var items = tinyMCEPopup.dom.select('li', tabContainerElm);
|
130
|
+
var action = function(id) {
|
131
|
+
mcTabs.displayTab(id, mcTabs.getPanelForTab(id));
|
132
|
+
mcTabs.onChange.dispatch(id);
|
133
|
+
};
|
134
|
+
|
135
|
+
each(items, function(item) {
|
136
|
+
dom.setAttrib(item, 'role', 'tab');
|
137
|
+
dom.bind(item, 'click', function(evt) {
|
138
|
+
action(item.id);
|
139
|
+
});
|
140
|
+
});
|
141
|
+
|
142
|
+
dom.bind(dom.getRoot(), 'keydown', function(evt) {
|
143
|
+
if (evt.keyCode === 9 && evt.ctrlKey && !evt.altKey) { // Tab
|
144
|
+
keyNav.moveFocus(evt.shiftKey ? -1 : 1);
|
145
|
+
tinymce.dom.Event.cancel(evt);
|
146
|
+
}
|
147
|
+
});
|
148
|
+
|
149
|
+
each(dom.select('a', tabContainerElm), function(a) {
|
150
|
+
dom.setAttrib(a, 'tabindex', '-1');
|
151
|
+
});
|
152
|
+
|
153
|
+
keyNav = tinyMCEPopup.editor.windowManager.createInstance('tinymce.ui.KeyboardNavigation', {
|
154
|
+
root: tabContainerElm,
|
155
|
+
items: items,
|
156
|
+
onAction: action,
|
157
|
+
actOnFocus: true,
|
158
|
+
enableLeftRight: true,
|
159
|
+
enableUpDown: true
|
160
|
+
}, tinyMCEPopup.dom);
|
161
|
+
});
|
162
|
+
});
|