spree_editor 0.50.0 → 0.50.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (150) hide show
  1. data/Versionfile +3 -0
  2. data/app/controllers/admin/editor_settings_controller.rb +5 -11
  3. data/app/views/admin/editor_settings/edit.html.erb +20 -19
  4. data/app/views/shared/editor_engines/_tiny_mce.html.erb +16 -33
  5. data/app/views/shared/editor_engines/_yui_rich_editor.html.erb +60 -7
  6. data/config/locales/en.yml +1 -0
  7. data/config/locales/es.yml +45 -0
  8. data/config/locales/ru.yml +2 -0
  9. data/lib/editor_configuration.rb +2 -2
  10. data/public/images/html_editor.gif +0 -0
  11. data/public/javascripts/tinymce/langs/en.js +56 -3
  12. data/public/javascripts/tinymce/plugins/advhr/langs/en_dlg.js +2 -0
  13. data/public/javascripts/tinymce/plugins/advhr/rule.htm +30 -29
  14. data/public/javascripts/tinymce/plugins/advimage/image.htm +34 -31
  15. data/public/javascripts/tinymce/plugins/advimage/js/image.js +20 -5
  16. data/public/javascripts/tinymce/plugins/advimage/langs/en_dlg.js +2 -0
  17. data/public/javascripts/tinymce/plugins/advlink/js/advlink.js +21 -17
  18. data/public/javascripts/tinymce/plugins/advlink/langs/en_dlg.js +4 -2
  19. data/public/javascripts/tinymce/plugins/advlink/link.htm +35 -30
  20. data/public/javascripts/tinymce/plugins/advlist/editor_plugin.js +1 -1
  21. data/public/javascripts/tinymce/plugins/advlist/editor_plugin_src.js +10 -3
  22. data/public/javascripts/tinymce/plugins/autolink/editor_plugin.js +1 -0
  23. data/public/javascripts/tinymce/plugins/autolink/editor_plugin_src.js +169 -0
  24. data/public/javascripts/tinymce/plugins/autoresize/editor_plugin.js +1 -1
  25. data/public/javascripts/tinymce/plugins/autoresize/editor_plugin_src.js +12 -3
  26. data/public/javascripts/tinymce/plugins/autosave/editor_plugin.js +1 -1
  27. data/public/javascripts/tinymce/plugins/autosave/editor_plugin_src.js +13 -4
  28. data/public/javascripts/tinymce/plugins/bbcode/editor_plugin.js +1 -1
  29. data/public/javascripts/tinymce/plugins/bbcode/editor_plugin_src.js +1 -1
  30. data/public/javascripts/tinymce/plugins/contextmenu/editor_plugin.js +1 -1
  31. data/public/javascripts/tinymce/plugins/contextmenu/editor_plugin_src.js +30 -16
  32. data/public/javascripts/tinymce/plugins/emotions/emotions.htm +15 -14
  33. data/public/javascripts/tinymce/plugins/fullpage/css/fullpage.css +3 -42
  34. data/public/javascripts/tinymce/plugins/fullpage/editor_plugin.js +1 -1
  35. data/public/javascripts/tinymce/plugins/fullpage/editor_plugin_src.js +309 -63
  36. data/public/javascripts/tinymce/plugins/fullpage/fullpage.htm +18 -330
  37. data/public/javascripts/tinymce/plugins/fullpage/js/fullpage.js +199 -438
  38. data/public/javascripts/tinymce/plugins/fullscreen/editor_plugin.js +1 -1
  39. data/public/javascripts/tinymce/plugins/fullscreen/editor_plugin_src.js +10 -2
  40. data/public/javascripts/tinymce/plugins/inlinepopups/editor_plugin.js +1 -1
  41. data/public/javascripts/tinymce/plugins/inlinepopups/editor_plugin_src.js +76 -15
  42. data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/window.css +0 -10
  43. data/public/javascripts/tinymce/plugins/layer/editor_plugin.js +1 -1
  44. data/public/javascripts/tinymce/plugins/layer/editor_plugin_src.js +2 -0
  45. data/public/javascripts/tinymce/plugins/legacyoutput/editor_plugin.js +1 -1
  46. data/public/javascripts/tinymce/plugins/legacyoutput/editor_plugin_src.js +31 -28
  47. data/public/javascripts/tinymce/plugins/lists/editor_plugin.js +1 -0
  48. data/public/javascripts/tinymce/plugins/lists/editor_plugin_src.js +617 -0
  49. data/public/javascripts/tinymce/plugins/media/css/media.css +5 -4
  50. data/public/javascripts/tinymce/plugins/media/editor_plugin.js +1 -1
  51. data/public/javascripts/tinymce/plugins/media/editor_plugin_src.js +652 -296
  52. data/public/javascripts/tinymce/plugins/media/js/media.js +327 -603
  53. data/public/javascripts/tinymce/plugins/media/langs/en_dlg.js +8 -2
  54. data/public/javascripts/tinymce/plugins/media/media.htm +283 -288
  55. data/public/javascripts/tinymce/plugins/media/moxieplayer.swf +0 -0
  56. data/public/javascripts/tinymce/plugins/nonbreaking/editor_plugin.js +1 -1
  57. data/public/javascripts/tinymce/plugins/nonbreaking/editor_plugin_src.js +1 -1
  58. data/public/javascripts/tinymce/plugins/noneditable/editor_plugin.js +1 -1
  59. data/public/javascripts/tinymce/plugins/noneditable/editor_plugin_src.js +2 -0
  60. data/public/javascripts/tinymce/plugins/pagebreak/editor_plugin.js +1 -1
  61. data/public/javascripts/tinymce/plugins/pagebreak/editor_plugin_src.js +1 -4
  62. data/public/javascripts/tinymce/plugins/paste/editor_plugin.js +1 -1
  63. data/public/javascripts/tinymce/plugins/paste/editor_plugin_src.js +118 -137
  64. data/public/javascripts/tinymce/plugins/searchreplace/editor_plugin.js +1 -1
  65. data/public/javascripts/tinymce/plugins/searchreplace/editor_plugin_src.js +4 -0
  66. data/public/javascripts/tinymce/plugins/searchreplace/js/searchreplace.js +14 -10
  67. data/public/javascripts/tinymce/plugins/searchreplace/searchreplace.htm +17 -16
  68. data/public/javascripts/tinymce/plugins/spellchecker/editor_plugin.js +1 -1
  69. data/public/javascripts/tinymce/plugins/spellchecker/editor_plugin_src.js +55 -37
  70. data/public/javascripts/tinymce/plugins/style/js/props.js +2 -8
  71. data/public/javascripts/tinymce/plugins/style/langs/en_dlg.js +8 -1
  72. data/public/javascripts/tinymce/plugins/style/props.htm +513 -398
  73. data/public/javascripts/tinymce/plugins/tabfocus/editor_plugin.js +1 -1
  74. data/public/javascripts/tinymce/plugins/tabfocus/editor_plugin_src.js +30 -28
  75. data/public/javascripts/tinymce/plugins/table/cell.htm +12 -12
  76. data/public/javascripts/tinymce/plugins/table/editor_plugin.js +1 -1
  77. data/public/javascripts/tinymce/plugins/table/editor_plugin_src.js +97 -34
  78. data/public/javascripts/tinymce/plugins/table/js/cell.js +9 -11
  79. data/public/javascripts/tinymce/plugins/table/js/row.js +13 -18
  80. data/public/javascripts/tinymce/plugins/table/js/table.js +8 -12
  81. data/public/javascripts/tinymce/plugins/table/langs/en_dlg.js +1 -1
  82. data/public/javascripts/tinymce/plugins/table/merge_cells.htm +11 -11
  83. data/public/javascripts/tinymce/plugins/table/row.htm +10 -8
  84. data/public/javascripts/tinymce/plugins/table/table.htm +54 -53
  85. data/public/javascripts/tinymce/plugins/template/js/template.js +1 -1
  86. data/public/javascripts/tinymce/plugins/visualchars/editor_plugin.js +1 -1
  87. data/public/javascripts/tinymce/plugins/visualchars/editor_plugin_src.js +1 -1
  88. data/public/javascripts/tinymce/plugins/wordcount/editor_plugin.js +1 -1
  89. data/public/javascripts/tinymce/plugins/wordcount/editor_plugin_src.js +35 -19
  90. data/public/javascripts/tinymce/plugins/xhtmlxtras/abbr.htm +6 -5
  91. data/public/javascripts/tinymce/plugins/xhtmlxtras/acronym.htm +6 -5
  92. data/public/javascripts/tinymce/plugins/xhtmlxtras/attributes.htm +6 -5
  93. data/public/javascripts/tinymce/plugins/xhtmlxtras/cite.htm +5 -4
  94. data/public/javascripts/tinymce/plugins/xhtmlxtras/del.htm +9 -8
  95. data/public/javascripts/tinymce/plugins/xhtmlxtras/editor_plugin.js +1 -1
  96. data/public/javascripts/tinymce/plugins/xhtmlxtras/editor_plugin_src.js +6 -6
  97. data/public/javascripts/tinymce/plugins/xhtmlxtras/ins.htm +11 -10
  98. data/public/javascripts/tinymce/plugins/xhtmlxtras/js/attributes.js +1 -16
  99. data/public/javascripts/tinymce/plugins/xhtmlxtras/js/del.js +2 -2
  100. data/public/javascripts/tinymce/plugins/xhtmlxtras/js/element_common.js +3 -5
  101. data/public/javascripts/tinymce/plugins/xhtmlxtras/js/ins.js +4 -3
  102. data/public/javascripts/tinymce/themes/advanced/about.htm +3 -5
  103. data/public/javascripts/tinymce/themes/advanced/anchor.htm +5 -5
  104. data/public/javascripts/tinymce/themes/advanced/charmap.htm +39 -40
  105. data/public/javascripts/tinymce/themes/advanced/color_picker.htm +10 -9
  106. data/public/javascripts/tinymce/themes/advanced/editor_template.js +1 -1
  107. data/public/javascripts/tinymce/themes/advanced/editor_template_src.js +172 -41
  108. data/public/javascripts/tinymce/themes/advanced/image.htm +51 -51
  109. data/public/javascripts/tinymce/themes/advanced/img/flash.gif +0 -0
  110. data/public/javascripts/tinymce/themes/advanced/img/iframe.gif +0 -0
  111. data/public/javascripts/tinymce/themes/advanced/img/pagebreak.gif +0 -0
  112. data/public/javascripts/tinymce/themes/advanced/img/quicktime.gif +0 -0
  113. data/public/javascripts/tinymce/themes/advanced/img/realmedia.gif +0 -0
  114. data/public/javascripts/tinymce/themes/advanced/img/shockwave.gif +0 -0
  115. data/public/javascripts/tinymce/themes/advanced/img/trans.gif +0 -0
  116. data/public/javascripts/tinymce/themes/advanced/img/video.gif +0 -0
  117. data/public/javascripts/tinymce/themes/advanced/img/windowsmedia.gif +0 -0
  118. data/public/javascripts/tinymce/themes/advanced/js/about.js +1 -0
  119. data/public/javascripts/tinymce/themes/advanced/js/anchor.js +5 -0
  120. data/public/javascripts/tinymce/themes/advanced/js/charmap.js +26 -6
  121. data/public/javascripts/tinymce/themes/advanced/js/color_picker.js +108 -32
  122. data/public/javascripts/tinymce/themes/advanced/js/image.js +3 -1
  123. data/public/javascripts/tinymce/themes/advanced/js/link.js +4 -7
  124. data/public/javascripts/tinymce/themes/advanced/js/source_editor.js +1 -1
  125. data/public/javascripts/tinymce/themes/advanced/langs/en.js +8 -2
  126. data/public/javascripts/tinymce/themes/advanced/langs/en_dlg.js +6 -3
  127. data/public/javascripts/tinymce/themes/advanced/link.htm +27 -28
  128. data/public/javascripts/tinymce/themes/advanced/shortcuts.htm +47 -0
  129. data/public/javascripts/tinymce/themes/advanced/skins/default/content.css +11 -0
  130. data/public/javascripts/tinymce/themes/advanced/skins/default/ui.css +4 -4
  131. data/public/javascripts/tinymce/themes/advanced/skins/highcontrast/content.css +23 -0
  132. data/public/javascripts/tinymce/themes/advanced/skins/highcontrast/dialog.css +105 -0
  133. data/public/javascripts/tinymce/themes/advanced/skins/highcontrast/ui.css +101 -0
  134. data/public/javascripts/tinymce/themes/advanced/skins/o2k7/content.css +10 -0
  135. data/public/javascripts/tinymce/themes/advanced/skins/o2k7/dialog.css +1 -0
  136. data/public/javascripts/tinymce/themes/advanced/skins/o2k7/ui.css +5 -4
  137. data/public/javascripts/tinymce/themes/advanced/skins/o2k7/ui_black.css +1 -1
  138. data/public/javascripts/tinymce/themes/advanced/skins/o2k7/ui_silver.css +1 -1
  139. data/public/javascripts/tinymce/themes/advanced/source_editor.htm +3 -3
  140. data/public/javascripts/tinymce/themes/simple/editor_template.js +1 -1
  141. data/public/javascripts/tinymce/themes/simple/editor_template_src.js +1 -2
  142. data/public/javascripts/tinymce/tiny_mce.js +1 -1
  143. data/public/javascripts/tinymce/tiny_mce_popup.js +1 -1
  144. data/public/javascripts/tinymce/tiny_mce_src.js +6488 -4070
  145. data/public/javascripts/tinymce/utils/form_utils.js +14 -4
  146. data/public/javascripts/tinymce/utils/mctabs.js +95 -10
  147. data/public/javascripts/tinymce/utils/validate.js +35 -3
  148. data/public/stylesheets/editor.css +23 -0
  149. data/spree_editor.gemspec +2 -2
  150. metadata +25 -4
@@ -1 +1 @@
1
- (function(){var a=tinymce.DOM;tinymce.create("tinymce.plugins.FullScreenPlugin",{init:function(c,d){var e=this,f={},b;e.editor=c;c.addCommand("mceFullScreen",function(){var h,i=a.doc.documentElement;if(c.getParam("fullscreen_is_enabled")){if(c.getParam("fullscreen_new_window")){closeFullscreen()}else{a.win.setTimeout(function(){tinymce.dom.Event.remove(a.win,"resize",e.resizeFunc);tinyMCE.get(c.getParam("fullscreen_editor_id")).setContent(c.getContent({format:"raw"}),{format:"raw"});tinyMCE.remove(c);a.remove("mce_fullscreen_container");i.style.overflow=c.getParam("fullscreen_html_overflow");a.setStyle(a.doc.body,"overflow",c.getParam("fullscreen_overflow"));a.win.scrollTo(c.getParam("fullscreen_scrollx"),c.getParam("fullscreen_scrolly"));tinyMCE.settings=tinyMCE.oldSettings},10)}return}if(c.getParam("fullscreen_new_window")){h=a.win.open(d+"/fullscreen.htm","mceFullScreenPopup","fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width="+screen.availWidth+",height="+screen.availHeight);try{h.resizeTo(screen.availWidth,screen.availHeight)}catch(g){}}else{tinyMCE.oldSettings=tinyMCE.settings;f.fullscreen_overflow=a.getStyle(a.doc.body,"overflow",1)||"auto";f.fullscreen_html_overflow=a.getStyle(i,"overflow",1);b=a.getViewPort();f.fullscreen_scrollx=b.x;f.fullscreen_scrolly=b.y;if(tinymce.isOpera&&f.fullscreen_overflow=="visible"){f.fullscreen_overflow="auto"}if(tinymce.isIE&&f.fullscreen_overflow=="scroll"){f.fullscreen_overflow="auto"}if(tinymce.isIE&&(f.fullscreen_html_overflow=="visible"||f.fullscreen_html_overflow=="scroll")){f.fullscreen_html_overflow="auto"}if(f.fullscreen_overflow=="0px"){f.fullscreen_overflow=""}a.setStyle(a.doc.body,"overflow","hidden");i.style.overflow="hidden";b=a.getViewPort();a.win.scrollTo(0,0);if(tinymce.isIE){b.h-=1}n=a.add(a.doc.body,"div",{id:"mce_fullscreen_container",style:"position:"+(tinymce.isIE6||(tinymce.isIE&&!a.boxModel)?"absolute":"fixed")+";top:0;left:0;width:"+b.w+"px;height:"+b.h+"px;z-index:200000;"});a.add(n,"div",{id:"mce_fullscreen"});tinymce.each(c.settings,function(j,k){f[k]=j});f.id="mce_fullscreen";f.width=n.clientWidth;f.height=n.clientHeight-15;f.fullscreen_is_enabled=true;f.fullscreen_editor_id=c.id;f.theme_advanced_resizing=false;f.save_onsavecallback=function(){c.setContent(tinyMCE.get(f.id).getContent({format:"raw"}),{format:"raw"});c.execCommand("mceSave")};tinymce.each(c.getParam("fullscreen_settings"),function(l,j){f[j]=l});if(f.theme_advanced_toolbar_location==="external"){f.theme_advanced_toolbar_location="top"}e.fullscreenEditor=new tinymce.Editor("mce_fullscreen",f);e.fullscreenEditor.onInit.add(function(){e.fullscreenEditor.setContent(c.getContent());e.fullscreenEditor.focus()});e.fullscreenEditor.render();e.fullscreenElement=new tinymce.dom.Element("mce_fullscreen_container");e.fullscreenElement.update();e.resizeFunc=tinymce.dom.Event.add(a.win,"resize",function(){var m=tinymce.DOM.getViewPort(),k=e.fullscreenEditor,j,l;j=k.dom.getSize(k.getContainer().firstChild);l=k.dom.getSize(k.getContainer().getElementsByTagName("iframe")[0]);k.theme.resizeTo(m.w-j.w+l.w,m.h-j.h+l.h)})}});c.addButton("fullscreen",{title:"fullscreen.desc",cmd:"mceFullScreen"});c.onNodeChange.add(function(h,g){g.setActive("fullscreen",h.getParam("fullscreen_is_enabled"))})},getInfo:function(){return{longname:"Fullscreen",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("fullscreen",tinymce.plugins.FullScreenPlugin)})();
1
+ (function(){var a=tinymce.DOM;tinymce.create("tinymce.plugins.FullScreenPlugin",{init:function(d,e){var f=this,g={},c,b;f.editor=d;d.addCommand("mceFullScreen",function(){var i,j=a.doc.documentElement;if(d.getParam("fullscreen_is_enabled")){if(d.getParam("fullscreen_new_window")){closeFullscreen()}else{a.win.setTimeout(function(){tinymce.dom.Event.remove(a.win,"resize",f.resizeFunc);tinyMCE.get(d.getParam("fullscreen_editor_id")).setContent(d.getContent({format:"raw"}),{format:"raw"});tinyMCE.remove(d);a.remove("mce_fullscreen_container");j.style.overflow=d.getParam("fullscreen_html_overflow");a.setStyle(a.doc.body,"overflow",d.getParam("fullscreen_overflow"));a.win.scrollTo(d.getParam("fullscreen_scrollx"),d.getParam("fullscreen_scrolly"));tinyMCE.settings=tinyMCE.oldSettings},10)}return}if(d.getParam("fullscreen_new_window")){i=a.win.open(e+"/fullscreen.htm","mceFullScreenPopup","fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width="+screen.availWidth+",height="+screen.availHeight);try{i.resizeTo(screen.availWidth,screen.availHeight)}catch(h){}}else{tinyMCE.oldSettings=tinyMCE.settings;g.fullscreen_overflow=a.getStyle(a.doc.body,"overflow",1)||"auto";g.fullscreen_html_overflow=a.getStyle(j,"overflow",1);c=a.getViewPort();g.fullscreen_scrollx=c.x;g.fullscreen_scrolly=c.y;if(tinymce.isOpera&&g.fullscreen_overflow=="visible"){g.fullscreen_overflow="auto"}if(tinymce.isIE&&g.fullscreen_overflow=="scroll"){g.fullscreen_overflow="auto"}if(tinymce.isIE&&(g.fullscreen_html_overflow=="visible"||g.fullscreen_html_overflow=="scroll")){g.fullscreen_html_overflow="auto"}if(g.fullscreen_overflow=="0px"){g.fullscreen_overflow=""}a.setStyle(a.doc.body,"overflow","hidden");j.style.overflow="hidden";c=a.getViewPort();a.win.scrollTo(0,0);if(tinymce.isIE){c.h-=1}if(tinymce.isIE6){b="absolute;top:"+c.y}else{b="fixed;top:0"}n=a.add(a.doc.body,"div",{id:"mce_fullscreen_container",style:"position:"+b+";left:0;width:"+c.w+"px;height:"+c.h+"px;z-index:200000;"});a.add(n,"div",{id:"mce_fullscreen"});tinymce.each(d.settings,function(k,l){g[l]=k});g.id="mce_fullscreen";g.width=n.clientWidth;g.height=n.clientHeight-15;g.fullscreen_is_enabled=true;g.fullscreen_editor_id=d.id;g.theme_advanced_resizing=false;g.save_onsavecallback=function(){d.setContent(tinyMCE.get(g.id).getContent({format:"raw"}),{format:"raw"});d.execCommand("mceSave")};tinymce.each(d.getParam("fullscreen_settings"),function(m,l){g[l]=m});if(g.theme_advanced_toolbar_location==="external"){g.theme_advanced_toolbar_location="top"}f.fullscreenEditor=new tinymce.Editor("mce_fullscreen",g);f.fullscreenEditor.onInit.add(function(){f.fullscreenEditor.setContent(d.getContent());f.fullscreenEditor.focus()});f.fullscreenEditor.render();f.fullscreenElement=new tinymce.dom.Element("mce_fullscreen_container");f.fullscreenElement.update();f.resizeFunc=tinymce.dom.Event.add(a.win,"resize",function(){var o=tinymce.DOM.getViewPort(),l=f.fullscreenEditor,k,m;k=l.dom.getSize(l.getContainer().firstChild);m=l.dom.getSize(l.getContainer().getElementsByTagName("iframe")[0]);l.theme.resizeTo(o.w-k.w+m.w,o.h-k.h+m.h)})}});d.addButton("fullscreen",{title:"fullscreen.desc",cmd:"mceFullScreen"});d.onNodeChange.add(function(i,h){h.setActive("fullscreen",i.getParam("fullscreen_is_enabled"))})},getInfo:function(){return{longname:"Fullscreen",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("fullscreen",tinymce.plugins.FullScreenPlugin)})();
@@ -13,7 +13,7 @@
13
13
 
14
14
  tinymce.create('tinymce.plugins.FullScreenPlugin', {
15
15
  init : function(ed, url) {
16
- var t = this, s = {}, vp;
16
+ var t = this, s = {}, vp, posCss;
17
17
 
18
18
  t.editor = ed;
19
19
 
@@ -78,7 +78,15 @@
78
78
  if (tinymce.isIE)
79
79
  vp.h -= 1;
80
80
 
81
- n = DOM.add(DOM.doc.body, 'div', {id : 'mce_fullscreen_container', style : 'position:' + (tinymce.isIE6 || (tinymce.isIE && !DOM.boxModel) ? 'absolute' : 'fixed') + ';top:0;left:0;width:' + vp.w + 'px;height:' + vp.h + 'px;z-index:200000;'});
81
+ // Use fixed position if it exists
82
+ if (tinymce.isIE6)
83
+ posCss = 'absolute;top:' + vp.y;
84
+ else
85
+ posCss = 'fixed;top:0';
86
+
87
+ n = DOM.add(DOM.doc.body, 'div', {
88
+ id : 'mce_fullscreen_container',
89
+ style : 'position:' + posCss + ';left:0;width:' + vp.w + 'px;height:' + vp.h + 'px;z-index:200000;'});
82
90
  DOM.add(n, 'div', {id : 'mce_fullscreen'});
83
91
 
84
92
  tinymce.each(ed.settings, function(v, n) {
@@ -1 +1 @@
1
- (function(){var d=tinymce.DOM,b=tinymce.dom.Element,a=tinymce.dom.Event,e=tinymce.each,c=tinymce.is;tinymce.create("tinymce.plugins.InlinePopups",{init:function(f,g){f.onBeforeRenderUI.add(function(){f.windowManager=new tinymce.InlineWindowManager(f);d.loadCSS(g+"/skins/"+(f.settings.inlinepopups_skin||"clearlooks2")+"/window.css")})},getInfo:function(){return{longname:"InlinePopups",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.create("tinymce.InlineWindowManager:tinymce.WindowManager",{InlineWindowManager:function(f){var g=this;g.parent(f);g.zIndex=300000;g.count=0;g.windows={}},open:function(r,j){var y=this,i,k="",q=y.editor,g=0,s=0,h,m,n,o,l,v,x;r=r||{};j=j||{};if(!r.inline){return y.parent(r,j)}if(!r.type){y.bookmark=q.selection.getBookmark(1)}i=d.uniqueId();h=d.getViewPort();r.width=parseInt(r.width||320);r.height=parseInt(r.height||240)+(tinymce.isIE?8:0);r.min_width=parseInt(r.min_width||150);r.min_height=parseInt(r.min_height||100);r.max_width=parseInt(r.max_width||2000);r.max_height=parseInt(r.max_height||2000);r.left=r.left||Math.round(Math.max(h.x,h.x+(h.w/2)-(r.width/2)));r.top=r.top||Math.round(Math.max(h.y,h.y+(h.h/2)-(r.height/2)));r.movable=r.resizable=true;j.mce_width=r.width;j.mce_height=r.height;j.mce_inline=true;j.mce_window_id=i;j.mce_auto_focus=r.auto_focus;y.features=r;y.params=j;y.onOpen.dispatch(y,r,j);if(r.type){k+=" mceModal";if(r.type){k+=" mce"+r.type.substring(0,1).toUpperCase()+r.type.substring(1)}r.resizable=false}if(r.statusbar){k+=" mceStatusbar"}if(r.resizable){k+=" mceResizable"}if(r.minimizable){k+=" mceMinimizable"}if(r.maximizable){k+=" mceMaximizable"}if(r.movable){k+=" mceMovable"}y._addAll(d.doc.body,["div",{id:i,"class":(q.settings.inlinepopups_skin||"clearlooks2")+(tinymce.isIE&&window.getSelection?" ie9":""),style:"width:100px;height:100px"},["div",{id:i+"_wrapper","class":"mceWrapper"+k},["div",{id:i+"_top","class":"mceTop"},["div",{"class":"mceLeft"}],["div",{"class":"mceCenter"}],["div",{"class":"mceRight"}],["span",{id:i+"_title"},r.title||""]],["div",{id:i+"_middle","class":"mceMiddle"},["div",{id:i+"_left","class":"mceLeft"}],["span",{id:i+"_content"}],["div",{id:i+"_right","class":"mceRight"}]],["div",{id:i+"_bottom","class":"mceBottom"},["div",{"class":"mceLeft"}],["div",{"class":"mceCenter"}],["div",{"class":"mceRight"}],["span",{id:i+"_status"},"Content"]],["a",{"class":"mceMove",tabindex:"-1",href:"javascript:;"}],["a",{"class":"mceMin",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceMax",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceMed",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceClose",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{id:i+"_resize_n","class":"mceResize mceResizeN",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_s","class":"mceResize mceResizeS",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_w","class":"mceResize mceResizeW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_e","class":"mceResize mceResizeE",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_nw","class":"mceResize mceResizeNW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_ne","class":"mceResize mceResizeNE",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_sw","class":"mceResize mceResizeSW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_se","class":"mceResize mceResizeSE",tabindex:"-1",href:"javascript:;"}]]]);d.setStyles(i,{top:-10000,left:-10000});if(tinymce.isGecko){d.setStyle(i,"overflow","auto")}if(!r.type){g+=d.get(i+"_left").clientWidth;g+=d.get(i+"_right").clientWidth;s+=d.get(i+"_top").clientHeight;s+=d.get(i+"_bottom").clientHeight}d.setStyles(i,{top:r.top,left:r.left,width:r.width+g,height:r.height+s});x=r.url||r.file;if(x){if(tinymce.relaxedDomain){x+=(x.indexOf("?")==-1?"?":"&")+"mce_rdomain="+tinymce.relaxedDomain}x=tinymce._addVer(x)}if(!r.type){d.add(i+"_content","iframe",{id:i+"_ifr",src:'javascript:""',frameBorder:0,style:"border:0;width:10px;height:10px"});d.setStyles(i+"_ifr",{width:r.width,height:r.height});d.setAttrib(i+"_ifr","src",x)}else{d.add(i+"_wrapper","a",{id:i+"_ok","class":"mceButton mceOk",href:"javascript:;",onmousedown:"return false;"},"Ok");if(r.type=="confirm"){d.add(i+"_wrapper","a",{"class":"mceButton mceCancel",href:"javascript:;",onmousedown:"return false;"},"Cancel")}d.add(i+"_middle","div",{"class":"mceIcon"});d.setHTML(i+"_content",r.content.replace("\n","<br />"))}n=a.add(i,"mousedown",function(t){var u=t.target,f,p;f=y.windows[i];y.focus(i);if(u.nodeName=="A"||u.nodeName=="a"){if(u.className=="mceMax"){f.oldPos=f.element.getXY();f.oldSize=f.element.getSize();p=d.getViewPort();p.w-=2;p.h-=2;f.element.moveTo(p.x,p.y);f.element.resizeTo(p.w,p.h);d.setStyles(i+"_ifr",{width:p.w-f.deltaWidth,height:p.h-f.deltaHeight});d.addClass(i+"_wrapper","mceMaximized")}else{if(u.className=="mceMed"){f.element.moveTo(f.oldPos.x,f.oldPos.y);f.element.resizeTo(f.oldSize.w,f.oldSize.h);f.iframeElement.resizeTo(f.oldSize.w-f.deltaWidth,f.oldSize.h-f.deltaHeight);d.removeClass(i+"_wrapper","mceMaximized")}else{if(u.className=="mceMove"){return y._startDrag(i,t,u.className)}else{if(d.hasClass(u,"mceResize")){return y._startDrag(i,t,u.className.substring(13))}}}}}});o=a.add(i,"click",function(f){var p=f.target;y.focus(i);if(p.nodeName=="A"||p.nodeName=="a"){switch(p.className){case"mceClose":y.close(null,i);return a.cancel(f);case"mceButton mceOk":case"mceButton mceCancel":r.button_func(p.className=="mceButton mceOk");return a.cancel(f)}}});v=y.windows[i]={id:i,mousedown_func:n,click_func:o,element:new b(i,{blocker:1,container:q.getContainer()}),iframeElement:new b(i+"_ifr"),features:r,deltaWidth:g,deltaHeight:s};v.iframeElement.on("focus",function(){y.focus(i)});if(y.count==0&&y.editor.getParam("dialog_type","modal")=="modal"){d.add(d.doc.body,"div",{id:"mceModalBlocker","class":(y.editor.settings.inlinepopups_skin||"clearlooks2")+"_modalBlocker",style:{zIndex:y.zIndex-1}});d.show("mceModalBlocker")}else{d.setStyle("mceModalBlocker","z-index",y.zIndex-1)}if(tinymce.isIE6||/Firefox\/2\./.test(navigator.userAgent)||(tinymce.isIE&&!d.boxModel)){d.setStyles("mceModalBlocker",{position:"absolute",left:h.x,top:h.y,width:h.w-2,height:h.h-2})}y.focus(i);y._fixIELayout(i,1);if(d.get(i+"_ok")){d.get(i+"_ok").focus()}y.count++;return v},focus:function(h){var g=this,f;if(f=g.windows[h]){f.zIndex=this.zIndex++;f.element.setStyle("zIndex",f.zIndex);f.element.update();h=h+"_wrapper";d.removeClass(g.lastId,"mceFocus");d.addClass(h,"mceFocus");g.lastId=h}},_addAll:function(k,h){var g,l,f=this,j=tinymce.DOM;if(c(h,"string")){k.appendChild(j.doc.createTextNode(h))}else{if(h.length){k=k.appendChild(j.create(h[0],h[1]));for(g=2;g<h.length;g++){f._addAll(k,h[g])}}}},_startDrag:function(v,G,E){var o=this,u,z,C=d.doc,f,l=o.windows[v],h=l.element,y=h.getXY(),x,q,F,g,A,s,r,j,i,m,k,n,B;g={x:0,y:0};A=d.getViewPort();A.w-=2;A.h-=2;j=G.screenX;i=G.screenY;m=k=n=B=0;u=a.add(C,"mouseup",function(p){a.remove(C,"mouseup",u);a.remove(C,"mousemove",z);if(f){f.remove()}h.moveBy(m,k);h.resizeBy(n,B);q=h.getSize();d.setStyles(v+"_ifr",{width:q.w-l.deltaWidth,height:q.h-l.deltaHeight});o._fixIELayout(v,1);return a.cancel(p)});if(E!="Move"){D()}function D(){if(f){return}o._fixIELayout(v,0);d.add(C.body,"div",{id:"mceEventBlocker","class":"mceEventBlocker "+(o.editor.settings.inlinepopups_skin||"clearlooks2"),style:{zIndex:o.zIndex+1}});if(tinymce.isIE6||(tinymce.isIE&&!d.boxModel)){d.setStyles("mceEventBlocker",{position:"absolute",left:A.x,top:A.y,width:A.w-2,height:A.h-2})}f=new b("mceEventBlocker");f.update();x=h.getXY();q=h.getSize();s=g.x+x.x-A.x;r=g.y+x.y-A.y;d.add(f.get(),"div",{id:"mcePlaceHolder","class":"mcePlaceHolder",style:{left:s,top:r,width:q.w,height:q.h}});F=new b("mcePlaceHolder")}z=a.add(C,"mousemove",function(w){var p,H,t;D();p=w.screenX-j;H=w.screenY-i;switch(E){case"ResizeW":m=p;n=0-p;break;case"ResizeE":n=p;break;case"ResizeN":case"ResizeNW":case"ResizeNE":if(E=="ResizeNW"){m=p;n=0-p}else{if(E=="ResizeNE"){n=p}}k=H;B=0-H;break;case"ResizeS":case"ResizeSW":case"ResizeSE":if(E=="ResizeSW"){m=p;n=0-p}else{if(E=="ResizeSE"){n=p}}B=H;break;case"mceMove":m=p;k=H;break}if(n<(t=l.features.min_width-q.w)){if(m!==0){m+=n-t}n=t}if(B<(t=l.features.min_height-q.h)){if(k!==0){k+=B-t}B=t}n=Math.min(n,l.features.max_width-q.w);B=Math.min(B,l.features.max_height-q.h);m=Math.max(m,A.x-(s+A.x));k=Math.max(k,A.y-(r+A.y));m=Math.min(m,(A.w+A.x)-(s+q.w+A.x));k=Math.min(k,(A.h+A.y)-(r+q.h+A.y));if(m+k!==0){if(s+m<0){m=0}if(r+k<0){k=0}F.moveTo(s+m,r+k)}if(n+B!==0){F.resizeTo(q.w+n,q.h+B)}return a.cancel(w)});return a.cancel(G)},resizeBy:function(g,h,i){var f=this.windows[i];if(f){f.element.resizeBy(g,h);f.iframeElement.resizeBy(g,h)}},close:function(j,l){var h=this,g,k=d.doc,f=0,i,l;l=h._findId(l||j);if(!h.windows[l]){h.parent(j);return}h.count--;if(h.count==0){d.remove("mceModalBlocker")}if(g=h.windows[l]){h.onClose.dispatch(h);a.remove(k,"mousedown",g.mousedownFunc);a.remove(k,"click",g.clickFunc);a.clear(l);a.clear(l+"_ifr");d.setAttrib(l+"_ifr","src",'javascript:""');g.element.remove();delete h.windows[l];e(h.windows,function(m){if(m.zIndex>f){i=m;f=m.zIndex}});if(i){h.focus(i.id)}}},setTitle:function(f,g){var h;f=this._findId(f);if(h=d.get(f+"_title")){h.innerHTML=d.encode(g)}},alert:function(g,f,j){var i=this,h;h=i.open({title:i,type:"alert",button_func:function(k){if(f){f.call(k||i,k)}i.close(null,h.id)},content:d.encode(i.editor.getLang(g,g)),inline:1,width:400,height:130})},confirm:function(g,f,j){var i=this,h;h=i.open({title:i,type:"confirm",button_func:function(k){if(f){f.call(k||i,k)}i.close(null,h.id)},content:d.encode(i.editor.getLang(g,g)),inline:1,width:400,height:130})},_findId:function(f){var g=this;if(typeof(f)=="string"){return f}e(g.windows,function(h){var i=d.get(h.id+"_ifr");if(i&&f==i.contentWindow){f=h.id;return false}});return f},_fixIELayout:function(i,h){var f,g;if(!tinymce.isIE6){return}e(["n","s","w","e","nw","ne","sw","se"],function(j){var k=d.get(i+"_resize_"+j);d.setStyles(k,{width:h?k.clientWidth:"",height:h?k.clientHeight:"",cursor:d.getStyle(k,"cursor",1)});d.setStyle(i+"_bottom","bottom","-1px");k=0});if(f=this.windows[i]){f.element.hide();f.element.show();e(d.select("div,a",i),function(k,j){if(k.currentStyle.backgroundImage!="none"){g=new Image();g.src=k.currentStyle.backgroundImage.replace(/url\(\"(.+)\"\)/,"$1")}});d.get(i).style.filter=""}}});tinymce.PluginManager.add("inlinepopups",tinymce.plugins.InlinePopups)})();
1
+ (function(){var d=tinymce.DOM,b=tinymce.dom.Element,a=tinymce.dom.Event,e=tinymce.each,c=tinymce.is;tinymce.create("tinymce.plugins.InlinePopups",{init:function(f,g){f.onBeforeRenderUI.add(function(){f.windowManager=new tinymce.InlineWindowManager(f);d.loadCSS(g+"/skins/"+(f.settings.inlinepopups_skin||"clearlooks2")+"/window.css")})},getInfo:function(){return{longname:"InlinePopups",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.create("tinymce.InlineWindowManager:tinymce.WindowManager",{InlineWindowManager:function(f){var g=this;g.parent(f);g.zIndex=300000;g.count=0;g.windows={}},open:function(s,j){var z=this,i,k="",r=z.editor,g=0,v=0,h,m,o,q,l,x,y,n;s=s||{};j=j||{};if(!s.inline){return z.parent(s,j)}n=z._frontWindow();if(n&&d.get(n.id+"_ifr")){n.focussedElement=d.get(n.id+"_ifr").contentWindow.document.activeElement}if(!s.type){z.bookmark=r.selection.getBookmark(1)}i=d.uniqueId();h=d.getViewPort();s.width=parseInt(s.width||320);s.height=parseInt(s.height||240)+(tinymce.isIE?8:0);s.min_width=parseInt(s.min_width||150);s.min_height=parseInt(s.min_height||100);s.max_width=parseInt(s.max_width||2000);s.max_height=parseInt(s.max_height||2000);s.left=s.left||Math.round(Math.max(h.x,h.x+(h.w/2)-(s.width/2)));s.top=s.top||Math.round(Math.max(h.y,h.y+(h.h/2)-(s.height/2)));s.movable=s.resizable=true;j.mce_width=s.width;j.mce_height=s.height;j.mce_inline=true;j.mce_window_id=i;j.mce_auto_focus=s.auto_focus;z.features=s;z.params=j;z.onOpen.dispatch(z,s,j);if(s.type){k+=" mceModal";if(s.type){k+=" mce"+s.type.substring(0,1).toUpperCase()+s.type.substring(1)}s.resizable=false}if(s.statusbar){k+=" mceStatusbar"}if(s.resizable){k+=" mceResizable"}if(s.minimizable){k+=" mceMinimizable"}if(s.maximizable){k+=" mceMaximizable"}if(s.movable){k+=" mceMovable"}z._addAll(d.doc.body,["div",{id:i,role:"dialog","aria-labelledby":s.type?i+"_content":i+"_title","class":(r.settings.inlinepopups_skin||"clearlooks2")+(tinymce.isIE&&window.getSelection?" ie9":""),style:"width:100px;height:100px"},["div",{id:i+"_wrapper","class":"mceWrapper"+k},["div",{id:i+"_top","class":"mceTop"},["div",{"class":"mceLeft"}],["div",{"class":"mceCenter"}],["div",{"class":"mceRight"}],["span",{id:i+"_title"},s.title||""]],["div",{id:i+"_middle","class":"mceMiddle"},["div",{id:i+"_left","class":"mceLeft",tabindex:"0"}],["span",{id:i+"_content"}],["div",{id:i+"_right","class":"mceRight",tabindex:"0"}]],["div",{id:i+"_bottom","class":"mceBottom"},["div",{"class":"mceLeft"}],["div",{"class":"mceCenter"}],["div",{"class":"mceRight"}],["span",{id:i+"_status"},"Content"]],["a",{"class":"mceMove",tabindex:"-1",href:"javascript:;"}],["a",{"class":"mceMin",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceMax",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceMed",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceClose",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{id:i+"_resize_n","class":"mceResize mceResizeN",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_s","class":"mceResize mceResizeS",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_w","class":"mceResize mceResizeW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_e","class":"mceResize mceResizeE",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_nw","class":"mceResize mceResizeNW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_ne","class":"mceResize mceResizeNE",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_sw","class":"mceResize mceResizeSW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_se","class":"mceResize mceResizeSE",tabindex:"-1",href:"javascript:;"}]]]);d.setStyles(i,{top:-10000,left:-10000});if(tinymce.isGecko){d.setStyle(i,"overflow","auto")}if(!s.type){g+=d.get(i+"_left").clientWidth;g+=d.get(i+"_right").clientWidth;v+=d.get(i+"_top").clientHeight;v+=d.get(i+"_bottom").clientHeight}d.setStyles(i,{top:s.top,left:s.left,width:s.width+g,height:s.height+v});y=s.url||s.file;if(y){if(tinymce.relaxedDomain){y+=(y.indexOf("?")==-1?"?":"&")+"mce_rdomain="+tinymce.relaxedDomain}y=tinymce._addVer(y)}if(!s.type){d.add(i+"_content","iframe",{id:i+"_ifr",src:'javascript:""',frameBorder:0,style:"border:0;width:10px;height:10px"});d.setStyles(i+"_ifr",{width:s.width,height:s.height});d.setAttrib(i+"_ifr","src",y)}else{d.add(i+"_wrapper","a",{id:i+"_ok","class":"mceButton mceOk",href:"javascript:;",onmousedown:"return false;"},"Ok");if(s.type=="confirm"){d.add(i+"_wrapper","a",{"class":"mceButton mceCancel",href:"javascript:;",onmousedown:"return false;"},"Cancel")}d.add(i+"_middle","div",{"class":"mceIcon"});d.setHTML(i+"_content",s.content.replace("\n","<br />"));a.add(i,"keyup",function(f){var p=27;if(f.keyCode===p){s.button_func(false);return a.cancel(f)}});a.add(i,"keydown",function(f){var t,p=9;if(f.keyCode===p){t=d.select("a.mceCancel",i+"_wrapper")[0];if(t&&t!==f.target){t.focus()}else{d.get(i+"_ok").focus()}return a.cancel(f)}})}o=a.add(i,"mousedown",function(t){var u=t.target,f,p;f=z.windows[i];z.focus(i);if(u.nodeName=="A"||u.nodeName=="a"){if(u.className=="mceMax"){f.oldPos=f.element.getXY();f.oldSize=f.element.getSize();p=d.getViewPort();p.w-=2;p.h-=2;f.element.moveTo(p.x,p.y);f.element.resizeTo(p.w,p.h);d.setStyles(i+"_ifr",{width:p.w-f.deltaWidth,height:p.h-f.deltaHeight});d.addClass(i+"_wrapper","mceMaximized")}else{if(u.className=="mceMed"){f.element.moveTo(f.oldPos.x,f.oldPos.y);f.element.resizeTo(f.oldSize.w,f.oldSize.h);f.iframeElement.resizeTo(f.oldSize.w-f.deltaWidth,f.oldSize.h-f.deltaHeight);d.removeClass(i+"_wrapper","mceMaximized")}else{if(u.className=="mceMove"){return z._startDrag(i,t,u.className)}else{if(d.hasClass(u,"mceResize")){return z._startDrag(i,t,u.className.substring(13))}}}}}});q=a.add(i,"click",function(f){var p=f.target;z.focus(i);if(p.nodeName=="A"||p.nodeName=="a"){switch(p.className){case"mceClose":z.close(null,i);return a.cancel(f);case"mceButton mceOk":case"mceButton mceCancel":s.button_func(p.className=="mceButton mceOk");return a.cancel(f)}}});a.add([i+"_left",i+"_right"],"focus",function(p){var t=d.get(i+"_ifr");if(t){var f=t.contentWindow.document.body;var u=d.select(":input:enabled,*[tabindex=0]",f);if(p.target.id===(i+"_left")){u[u.length-1].focus()}else{u[0].focus()}}else{d.get(i+"_ok").focus()}});x=z.windows[i]={id:i,mousedown_func:o,click_func:q,element:new b(i,{blocker:1,container:r.getContainer()}),iframeElement:new b(i+"_ifr"),features:s,deltaWidth:g,deltaHeight:v};x.iframeElement.on("focus",function(){z.focus(i)});if(z.count==0&&z.editor.getParam("dialog_type","modal")=="modal"){d.add(d.doc.body,"div",{id:"mceModalBlocker","class":(z.editor.settings.inlinepopups_skin||"clearlooks2")+"_modalBlocker",style:{zIndex:z.zIndex-1}});d.show("mceModalBlocker");d.setAttrib(d.doc.body,"aria-hidden","true")}else{d.setStyle("mceModalBlocker","z-index",z.zIndex-1)}if(tinymce.isIE6||/Firefox\/2\./.test(navigator.userAgent)||(tinymce.isIE&&!d.boxModel)){d.setStyles("mceModalBlocker",{position:"absolute",left:h.x,top:h.y,width:h.w-2,height:h.h-2})}d.setAttrib(i,"aria-hidden","false");z.focus(i);z._fixIELayout(i,1);if(d.get(i+"_ok")){d.get(i+"_ok").focus()}z.count++;return x},focus:function(h){var g=this,f;if(f=g.windows[h]){f.zIndex=this.zIndex++;f.element.setStyle("zIndex",f.zIndex);f.element.update();h=h+"_wrapper";d.removeClass(g.lastId,"mceFocus");d.addClass(h,"mceFocus");g.lastId=h;if(f.focussedElement){f.focussedElement.focus()}else{if(d.get(h+"_ok")){d.get(f.id+"_ok").focus()}else{if(d.get(f.id+"_ifr")){d.get(f.id+"_ifr").focus()}}}}},_addAll:function(k,h){var g,l,f=this,j=tinymce.DOM;if(c(h,"string")){k.appendChild(j.doc.createTextNode(h))}else{if(h.length){k=k.appendChild(j.create(h[0],h[1]));for(g=2;g<h.length;g++){f._addAll(k,h[g])}}}},_startDrag:function(v,G,E){var o=this,u,z,C=d.doc,f,l=o.windows[v],h=l.element,y=h.getXY(),x,q,F,g,A,s,r,j,i,m,k,n,B;g={x:0,y:0};A=d.getViewPort();A.w-=2;A.h-=2;j=G.screenX;i=G.screenY;m=k=n=B=0;u=a.add(C,"mouseup",function(p){a.remove(C,"mouseup",u);a.remove(C,"mousemove",z);if(f){f.remove()}h.moveBy(m,k);h.resizeBy(n,B);q=h.getSize();d.setStyles(v+"_ifr",{width:q.w-l.deltaWidth,height:q.h-l.deltaHeight});o._fixIELayout(v,1);return a.cancel(p)});if(E!="Move"){D()}function D(){if(f){return}o._fixIELayout(v,0);d.add(C.body,"div",{id:"mceEventBlocker","class":"mceEventBlocker "+(o.editor.settings.inlinepopups_skin||"clearlooks2"),style:{zIndex:o.zIndex+1}});if(tinymce.isIE6||(tinymce.isIE&&!d.boxModel)){d.setStyles("mceEventBlocker",{position:"absolute",left:A.x,top:A.y,width:A.w-2,height:A.h-2})}f=new b("mceEventBlocker");f.update();x=h.getXY();q=h.getSize();s=g.x+x.x-A.x;r=g.y+x.y-A.y;d.add(f.get(),"div",{id:"mcePlaceHolder","class":"mcePlaceHolder",style:{left:s,top:r,width:q.w,height:q.h}});F=new b("mcePlaceHolder")}z=a.add(C,"mousemove",function(w){var p,H,t;D();p=w.screenX-j;H=w.screenY-i;switch(E){case"ResizeW":m=p;n=0-p;break;case"ResizeE":n=p;break;case"ResizeN":case"ResizeNW":case"ResizeNE":if(E=="ResizeNW"){m=p;n=0-p}else{if(E=="ResizeNE"){n=p}}k=H;B=0-H;break;case"ResizeS":case"ResizeSW":case"ResizeSE":if(E=="ResizeSW"){m=p;n=0-p}else{if(E=="ResizeSE"){n=p}}B=H;break;case"mceMove":m=p;k=H;break}if(n<(t=l.features.min_width-q.w)){if(m!==0){m+=n-t}n=t}if(B<(t=l.features.min_height-q.h)){if(k!==0){k+=B-t}B=t}n=Math.min(n,l.features.max_width-q.w);B=Math.min(B,l.features.max_height-q.h);m=Math.max(m,A.x-(s+A.x));k=Math.max(k,A.y-(r+A.y));m=Math.min(m,(A.w+A.x)-(s+q.w+A.x));k=Math.min(k,(A.h+A.y)-(r+q.h+A.y));if(m+k!==0){if(s+m<0){m=0}if(r+k<0){k=0}F.moveTo(s+m,r+k)}if(n+B!==0){F.resizeTo(q.w+n,q.h+B)}return a.cancel(w)});return a.cancel(G)},resizeBy:function(g,h,i){var f=this.windows[i];if(f){f.element.resizeBy(g,h);f.iframeElement.resizeBy(g,h)}},close:function(i,k){var g=this,f,j=d.doc,h,k;k=g._findId(k||i);if(!g.windows[k]){g.parent(i);return}g.count--;if(g.count==0){d.remove("mceModalBlocker");d.setAttrib(d.doc.body,"aria-hidden","false");g.editor.focus()}if(f=g.windows[k]){g.onClose.dispatch(g);a.remove(j,"mousedown",f.mousedownFunc);a.remove(j,"click",f.clickFunc);a.clear(k);a.clear(k+"_ifr");d.setAttrib(k+"_ifr","src",'javascript:""');f.element.remove();delete g.windows[k];h=g._frontWindow();if(h){g.focus(h.id)}}},_frontWindow:function(){var g,f=0;e(this.windows,function(h){if(h.zIndex>f){g=h;f=h.zIndex}});return g},setTitle:function(f,g){var h;f=this._findId(f);if(h=d.get(f+"_title")){h.innerHTML=d.encode(g)}},alert:function(g,f,j){var i=this,h;h=i.open({title:i,type:"alert",button_func:function(k){if(f){f.call(k||i,k)}i.close(null,h.id)},content:d.encode(i.editor.getLang(g,g)),inline:1,width:400,height:130})},confirm:function(g,f,j){var i=this,h;h=i.open({title:i,type:"confirm",button_func:function(k){if(f){f.call(k||i,k)}i.close(null,h.id)},content:d.encode(i.editor.getLang(g,g)),inline:1,width:400,height:130})},_findId:function(f){var g=this;if(typeof(f)=="string"){return f}e(g.windows,function(h){var i=d.get(h.id+"_ifr");if(i&&f==i.contentWindow){f=h.id;return false}});return f},_fixIELayout:function(i,h){var f,g;if(!tinymce.isIE6){return}e(["n","s","w","e","nw","ne","sw","se"],function(j){var k=d.get(i+"_resize_"+j);d.setStyles(k,{width:h?k.clientWidth:"",height:h?k.clientHeight:"",cursor:d.getStyle(k,"cursor",1)});d.setStyle(i+"_bottom","bottom","-1px");k=0});if(f=this.windows[i]){f.element.hide();f.element.show();e(d.select("div,a",i),function(k,j){if(k.currentStyle.backgroundImage!="none"){g=new Image();g.src=k.currentStyle.backgroundImage.replace(/url\(\"(.+)\"\)/,"$1")}});d.get(i).style.filter=""}}});tinymce.PluginManager.add("inlinepopups",tinymce.plugins.InlinePopups)})();
@@ -42,7 +42,7 @@
42
42
  },
43
43
 
44
44
  open : function(f, p) {
45
- var t = this, id, opt = '', ed = t.editor, dw = 0, dh = 0, vp, po, mdf, clf, we, w, u;
45
+ var t = this, id, opt = '', ed = t.editor, dw = 0, dh = 0, vp, po, mdf, clf, we, w, u, parentWindow;
46
46
 
47
47
  f = f || {};
48
48
  p = p || {};
@@ -51,6 +51,11 @@
51
51
  if (!f.inline)
52
52
  return t.parent(f, p);
53
53
 
54
+ parentWindow = t._frontWindow();
55
+ if (parentWindow && DOM.get(parentWindow.id + '_ifr')) {
56
+ parentWindow.focussedElement = DOM.get(parentWindow.id + '_ifr').contentWindow.document.activeElement;
57
+ }
58
+
54
59
  // Only store selection if the type is a normal window
55
60
  if (!f.type)
56
61
  t.bookmark = ed.selection.getBookmark(1);
@@ -107,7 +112,7 @@
107
112
 
108
113
  // Create DOM objects
109
114
  t._addAll(DOM.doc.body,
110
- ['div', {id : id, 'class' : (ed.settings.inlinepopups_skin || 'clearlooks2') + (tinymce.isIE && window.getSelection ? ' ie9' : ''), style : 'width:100px;height:100px'},
115
+ ['div', {id : id, role : 'dialog', 'aria-labelledby': f.type ? id + '_content' : id + '_title', 'class' : (ed.settings.inlinepopups_skin || 'clearlooks2') + (tinymce.isIE && window.getSelection ? ' ie9' : ''), style : 'width:100px;height:100px'},
111
116
  ['div', {id : id + '_wrapper', 'class' : 'mceWrapper' + opt},
112
117
  ['div', {id : id + '_top', 'class' : 'mceTop'},
113
118
  ['div', {'class' : 'mceLeft'}],
@@ -117,9 +122,9 @@
117
122
  ],
118
123
 
119
124
  ['div', {id : id + '_middle', 'class' : 'mceMiddle'},
120
- ['div', {id : id + '_left', 'class' : 'mceLeft'}],
125
+ ['div', {id : id + '_left', 'class' : 'mceLeft', tabindex : '0'}],
121
126
  ['span', {id : id + '_content'}],
122
- ['div', {id : id + '_right', 'class' : 'mceRight'}]
127
+ ['div', {id : id + '_right', 'class' : 'mceRight', tabindex : '0'}]
123
128
  ],
124
129
 
125
130
  ['div', {id : id + '_bottom', 'class' : 'mceBottom'},
@@ -183,6 +188,27 @@
183
188
 
184
189
  DOM.add(id + '_middle', 'div', {'class' : 'mceIcon'});
185
190
  DOM.setHTML(id + '_content', f.content.replace('\n', '<br />'));
191
+
192
+ Event.add(id, 'keyup', function(evt) {
193
+ var VK_ESCAPE = 27;
194
+ if (evt.keyCode === VK_ESCAPE) {
195
+ f.button_func(false);
196
+ return Event.cancel(evt);
197
+ }
198
+ });
199
+
200
+ Event.add(id, 'keydown', function(evt) {
201
+ var cancelButton, VK_TAB = 9;
202
+ if (evt.keyCode === VK_TAB) {
203
+ cancelButton = DOM.select('a.mceCancel', id + '_wrapper')[0];
204
+ if (cancelButton && cancelButton !== evt.target) {
205
+ cancelButton.focus();
206
+ } else {
207
+ DOM.get(id + '_ok').focus();
208
+ }
209
+ return Event.cancel(evt);
210
+ }
211
+ });
186
212
  }
187
213
 
188
214
  // Register events
@@ -239,7 +265,23 @@
239
265
  }
240
266
  }
241
267
  });
242
-
268
+
269
+ // Make sure the tab order loops within the dialog.
270
+ Event.add([id + '_left', id + '_right'], 'focus', function(evt) {
271
+ var iframe = DOM.get(id + '_ifr');
272
+ if (iframe) {
273
+ var body = iframe.contentWindow.document.body;
274
+ var focusable = DOM.select(':input:enabled,*[tabindex=0]', body);
275
+ if (evt.target.id === (id + '_left')) {
276
+ focusable[focusable.length - 1].focus();
277
+ } else {
278
+ focusable[0].focus();
279
+ }
280
+ } else {
281
+ DOM.get(id + '_ok').focus();
282
+ }
283
+ });
284
+
243
285
  // Add window
244
286
  w = t.windows[id] = {
245
287
  id : id,
@@ -265,19 +307,20 @@
265
307
  });
266
308
 
267
309
  DOM.show('mceModalBlocker'); // Reduces flicker in IE
310
+ DOM.setAttrib(DOM.doc.body, 'aria-hidden', 'true');
268
311
  } else
269
312
  DOM.setStyle('mceModalBlocker', 'z-index', t.zIndex - 1);
270
313
 
271
314
  if (tinymce.isIE6 || /Firefox\/2\./.test(navigator.userAgent) || (tinymce.isIE && !DOM.boxModel))
272
315
  DOM.setStyles('mceModalBlocker', {position : 'absolute', left : vp.x, top : vp.y, width : vp.w - 2, height : vp.h - 2});
273
316
 
317
+ DOM.setAttrib(id, 'aria-hidden', 'false');
274
318
  t.focus(id);
275
319
  t._fixIELayout(id, 1);
276
320
 
277
321
  // Focus ok button
278
322
  if (DOM.get(id + '_ok'))
279
323
  DOM.get(id + '_ok').focus();
280
-
281
324
  t.count++;
282
325
 
283
326
  return w;
@@ -295,6 +338,14 @@
295
338
  DOM.removeClass(t.lastId, 'mceFocus');
296
339
  DOM.addClass(id, 'mceFocus');
297
340
  t.lastId = id;
341
+
342
+ if (w.focussedElement) {
343
+ w.focussedElement.focus();
344
+ } else if (DOM.get(id + '_ok')) {
345
+ DOM.get(w.id + '_ok').focus();
346
+ } else if (DOM.get(w.id + '_ifr')) {
347
+ DOM.get(w.id + '_ifr').focus();
348
+ }
298
349
  }
299
350
  },
300
351
 
@@ -478,7 +529,7 @@
478
529
  },
479
530
 
480
531
  close : function(win, id) {
481
- var t = this, w, d = DOM.doc, ix = 0, fw, id;
532
+ var t = this, w, d = DOM.doc, fw, id;
482
533
 
483
534
  id = t._findId(id || win);
484
535
 
@@ -490,8 +541,11 @@
490
541
 
491
542
  t.count--;
492
543
 
493
- if (t.count == 0)
544
+ if (t.count == 0) {
494
545
  DOM.remove('mceModalBlocker');
546
+ DOM.setAttrib(DOM.doc.body, 'aria-hidden', 'false');
547
+ t.editor.focus();
548
+ }
495
549
 
496
550
  if (w = t.windows[id]) {
497
551
  t.onClose.dispatch(t);
@@ -504,18 +558,25 @@
504
558
  w.element.remove();
505
559
  delete t.windows[id];
506
560
 
507
- // Find front most window and focus that
508
- each (t.windows, function(w) {
509
- if (w.zIndex > ix) {
510
- fw = w;
511
- ix = w.zIndex;
512
- }
513
- });
561
+ fw = t._frontWindow();
514
562
 
515
563
  if (fw)
516
564
  t.focus(fw.id);
517
565
  }
518
566
  },
567
+
568
+ // Find front most window
569
+ _frontWindow : function() {
570
+ var fw, ix = 0;
571
+ // Find front most window and focus that
572
+ each (this.windows, function(w) {
573
+ if (w.zIndex > ix) {
574
+ fw = w;
575
+ ix = w.zIndex;
576
+ }
577
+ });
578
+ return fw;
579
+ },
519
580
 
520
581
  setTitle : function(w, ti) {
521
582
  var e;
@@ -88,13 +88,3 @@
88
88
  .clearlooks2 .mceConfirm .mceOk {left:50%; top:auto; margin-left: -90px}
89
89
  .clearlooks2 .mceConfirm .mceCancel {left:50%; top:auto}
90
90
  .clearlooks2 .mceConfirm .mceIcon {background:url(img/confirm.gif)}
91
-
92
- /* IE9 fixes */
93
- .clearlooks2.ie9 .mceTop .mceCenter {clip:auto;}
94
- .clearlooks2.ie9 .mceMiddle {clip:auto;}
95
- .clearlooks2.ie9 .mceMiddle .mceLeft, .clearlooks2.ie9 .mceMiddle .mceRight {top: 23px;}
96
- .clearlooks2.ie9 .mceAlert .mceMiddle span, .clearlooks2.ie9 .mceConfirm .mceMiddle span {top:13px;}
97
- .clearlooks2.ie9 .mceModal .mceMiddle {top:23px}
98
- .clearlooks2.ie9 .mceModal .mceMiddle .mceLeft, .clearlooks2.ie9 .mceModal .mceMiddle .mceRight {top: 0}
99
- .clearlooks2.ie9 .mceMiddle .mceIcon {top:13px}
100
- .clearlooks2.ie9 .mceTop .mceCenter {top:0; right:auto; left:6px; width:calc(100%-12px)}
@@ -1 +1 @@
1
- (function(){tinymce.create("tinymce.plugins.Layer",{init:function(a,b){var c=this;c.editor=a;a.addCommand("mceInsertLayer",c._insertLayer,c);a.addCommand("mceMoveForward",function(){c._move(1)});a.addCommand("mceMoveBackward",function(){c._move(-1)});a.addCommand("mceMakeAbsolute",function(){c._toggleAbsolute()});a.addButton("moveforward",{title:"layer.forward_desc",cmd:"mceMoveForward"});a.addButton("movebackward",{title:"layer.backward_desc",cmd:"mceMoveBackward"});a.addButton("absolute",{title:"layer.absolute_desc",cmd:"mceMakeAbsolute"});a.addButton("insertlayer",{title:"layer.insertlayer_desc",cmd:"mceInsertLayer"});a.onInit.add(function(){if(tinymce.isIE){a.getDoc().execCommand("2D-Position",false,true)}});a.onNodeChange.add(c._nodeChange,c);a.onVisualAid.add(c._visualAid,c)},getInfo:function(){return{longname:"Layer",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/layer",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_nodeChange:function(b,a,e){var c,d;c=this._getParentLayer(e);d=b.dom.getParent(e,"DIV,P,IMG");if(!d){a.setDisabled("absolute",1);a.setDisabled("moveforward",1);a.setDisabled("movebackward",1)}else{a.setDisabled("absolute",0);a.setDisabled("moveforward",!c);a.setDisabled("movebackward",!c);a.setActive("absolute",c&&c.style.position.toLowerCase()=="absolute")}},_visualAid:function(a,c,b){var d=a.dom;tinymce.each(d.select("div,p",c),function(f){if(/^(absolute|relative|static)$/i.test(f.style.position)){if(b){d.addClass(f,"mceItemVisualAid")}else{d.removeClass(f,"mceItemVisualAid")}}})},_move:function(h){var b=this.editor,f,g=[],e=this._getParentLayer(b.selection.getNode()),c=-1,j=-1,a;a=[];tinymce.walk(b.getBody(),function(d){if(d.nodeType==1&&/^(absolute|relative|static)$/i.test(d.style.position)){a.push(d)}},"childNodes");for(f=0;f<a.length;f++){g[f]=a[f].style.zIndex?parseInt(a[f].style.zIndex):0;if(c<0&&a[f]==e){c=f}}if(h<0){for(f=0;f<g.length;f++){if(g[f]<g[c]){j=f;break}}if(j>-1){a[c].style.zIndex=g[j];a[j].style.zIndex=g[c]}else{if(g[c]>0){a[c].style.zIndex=g[c]-1}}}else{for(f=0;f<g.length;f++){if(g[f]>g[c]){j=f;break}}if(j>-1){a[c].style.zIndex=g[j];a[j].style.zIndex=g[c]}else{a[c].style.zIndex=g[c]+1}}b.execCommand("mceRepaint")},_getParentLayer:function(a){return this.editor.dom.getParent(a,function(b){return b.nodeType==1&&/^(absolute|relative|static)$/i.test(b.style.position)})},_insertLayer:function(){var a=this.editor,b=a.dom.getPos(a.dom.getParent(a.selection.getNode(),"*"));a.dom.add(a.getBody(),"div",{style:{position:"absolute",left:b.x,top:(b.y>20?b.y:20),width:100,height:100},"class":"mceItemVisualAid"},a.selection.getContent()||a.getLang("layer.content"))},_toggleAbsolute:function(){var a=this.editor,b=this._getParentLayer(a.selection.getNode());if(!b){b=a.dom.getParent(a.selection.getNode(),"DIV,P,IMG")}if(b){if(b.style.position.toLowerCase()=="absolute"){a.dom.setStyles(b,{position:"",left:"",top:"",width:"",height:""});a.dom.removeClass(b,"mceItemVisualAid")}else{if(b.style.left==""){b.style.left=20+"px"}if(b.style.top==""){b.style.top=20+"px"}if(b.style.width==""){b.style.width=b.width?(b.width+"px"):"100px"}if(b.style.height==""){b.style.height=b.height?(b.height+"px"):"100px"}b.style.position="absolute";a.addVisual(a.getBody())}a.execCommand("mceRepaint");a.nodeChanged()}}});tinymce.PluginManager.add("layer",tinymce.plugins.Layer)})();
1
+ (function(){tinymce.create("tinymce.plugins.Layer",{init:function(a,b){var c=this;c.editor=a;a.addCommand("mceInsertLayer",c._insertLayer,c);a.addCommand("mceMoveForward",function(){c._move(1)});a.addCommand("mceMoveBackward",function(){c._move(-1)});a.addCommand("mceMakeAbsolute",function(){c._toggleAbsolute()});a.addButton("moveforward",{title:"layer.forward_desc",cmd:"mceMoveForward"});a.addButton("movebackward",{title:"layer.backward_desc",cmd:"mceMoveBackward"});a.addButton("absolute",{title:"layer.absolute_desc",cmd:"mceMakeAbsolute"});a.addButton("insertlayer",{title:"layer.insertlayer_desc",cmd:"mceInsertLayer"});a.onInit.add(function(){if(tinymce.isIE){a.getDoc().execCommand("2D-Position",false,true)}});a.onNodeChange.add(c._nodeChange,c);a.onVisualAid.add(c._visualAid,c)},getInfo:function(){return{longname:"Layer",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/layer",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_nodeChange:function(b,a,e){var c,d;c=this._getParentLayer(e);d=b.dom.getParent(e,"DIV,P,IMG");if(!d){a.setDisabled("absolute",1);a.setDisabled("moveforward",1);a.setDisabled("movebackward",1)}else{a.setDisabled("absolute",0);a.setDisabled("moveforward",!c);a.setDisabled("movebackward",!c);a.setActive("absolute",c&&c.style.position.toLowerCase()=="absolute")}},_visualAid:function(a,c,b){var d=a.dom;tinymce.each(d.select("div,p",c),function(f){if(/^(absolute|relative|static)$/i.test(f.style.position)){if(b){d.addClass(f,"mceItemVisualAid")}else{d.removeClass(f,"mceItemVisualAid")}}})},_move:function(h){var b=this.editor,f,g=[],e=this._getParentLayer(b.selection.getNode()),c=-1,j=-1,a;a=[];tinymce.walk(b.getBody(),function(d){if(d.nodeType==1&&/^(absolute|relative|static)$/i.test(d.style.position)){a.push(d)}},"childNodes");for(f=0;f<a.length;f++){g[f]=a[f].style.zIndex?parseInt(a[f].style.zIndex):0;if(c<0&&a[f]==e){c=f}}if(h<0){for(f=0;f<g.length;f++){if(g[f]<g[c]){j=f;break}}if(j>-1){a[c].style.zIndex=g[j];a[j].style.zIndex=g[c]}else{if(g[c]>0){a[c].style.zIndex=g[c]-1}}}else{for(f=0;f<g.length;f++){if(g[f]>g[c]){j=f;break}}if(j>-1){a[c].style.zIndex=g[j];a[j].style.zIndex=g[c]}else{a[c].style.zIndex=g[c]+1}}b.execCommand("mceRepaint")},_getParentLayer:function(a){return this.editor.dom.getParent(a,function(b){return b.nodeType==1&&/^(absolute|relative|static)$/i.test(b.style.position)})},_insertLayer:function(){var a=this.editor,b=a.dom.getPos(a.dom.getParent(a.selection.getNode(),"*"));a.dom.add(a.getBody(),"div",{style:{position:"absolute",left:b.x,top:(b.y>20?b.y:20),width:100,height:100},"class":"mceItemVisualAid"},a.selection.getContent()||a.getLang("layer.content"))},_toggleAbsolute:function(){var a=this.editor,b=this._getParentLayer(a.selection.getNode());if(!b){b=a.dom.getParent(a.selection.getNode(),"DIV,P,IMG")}if(b){if(b.style.position.toLowerCase()=="absolute"){a.dom.setStyles(b,{position:"",left:"",top:"",width:"",height:""});a.dom.removeClass(b,"mceItemVisualAid")}else{if(b.style.left==""){b.style.left=20+"px"}if(b.style.top==""){b.style.top=20+"px"}if(b.style.width==""){b.style.width=b.width?(b.width+"px"):"100px"}if(b.style.height==""){b.style.height=b.height?(b.height+"px"):"100px"}b.style.position="absolute";a.dom.setAttrib(b,"data-mce-style","");a.addVisual(a.getBody())}a.execCommand("mceRepaint");a.nodeChanged()}}});tinymce.PluginManager.add("layer",tinymce.plugins.Layer)})();
@@ -198,6 +198,8 @@
198
198
  le.style.height = le.height ? (le.height + 'px') : '100px';
199
199
 
200
200
  le.style.position = "absolute";
201
+
202
+ ed.dom.setAttrib(le, 'data-mce-style', '');
201
203
  ed.addVisual(ed.getBody());
202
204
  }
203
205
 
@@ -1 +1 @@
1
- (function(a){a.onAddEditor.addToTop(function(c,b){b.settings.inline_styles=false});a.create("tinymce.plugins.LegacyOutput",{init:function(b){b.onInit.add(function(){var c="p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img",e=a.explode(b.settings.font_size_style_values),d=b.serializer;b.formatter.register({alignleft:{selector:c,attributes:{align:"left"}},aligncenter:{selector:c,attributes:{align:"center"}},alignright:{selector:c,attributes:{align:"right"}},alignfull:{selector:c,attributes:{align:"full"}},bold:{inline:"b"},italic:{inline:"i"},underline:{inline:"u"},strikethrough:{inline:"strike"},fontname:{inline:"font",attributes:{face:"%value"}},fontsize:{inline:"font",attributes:{size:function(f){return a.inArray(e,f.value)+1}}},forecolor:{inline:"font",styles:{color:"%value"}},hilitecolor:{inline:"font",styles:{backgroundColor:"%value"}}});d._setup();a.each("b,i,u,strike".split(","),function(f){var g=d.rules[f];if(!g){d.addRules(f)}});if(!d.rules.font){d.addRules("font[face|size|color|style]")}a.each(c.split(","),function(f){var h=d.rules[f],g;if(h){a.each(h.attribs,function(j,i){if(i.name=="align"){g=true;return false}});if(!g){h.attribs.push({name:"align"})}}});b.onNodeChange.add(function(g,k){var j,f,h,i;f=g.dom.getParent(g.selection.getNode(),"font");if(f){h=f.face;i=f.size}if(j=k.get("fontselect")){j.select(function(l){return l==h})}if(j=k.get("fontsizeselect")){j.select(function(m){var l=a.inArray(e,m.fontSize);return l+1==i})}})})},getInfo:function(){return{longname:"LegacyOutput",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/legacyoutput",version:a.majorVersion+"."+a.minorVersion}}});a.PluginManager.add("legacyoutput",a.plugins.LegacyOutput)})(tinymce);
1
+ (function(a){a.onAddEditor.addToTop(function(c,b){b.settings.inline_styles=false});a.create("tinymce.plugins.LegacyOutput",{init:function(b){b.onInit.add(function(){var c="p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img",e=a.explode(b.settings.font_size_style_values),d=b.schema;b.formatter.register({alignleft:{selector:c,attributes:{align:"left"}},aligncenter:{selector:c,attributes:{align:"center"}},alignright:{selector:c,attributes:{align:"right"}},alignfull:{selector:c,attributes:{align:"justify"}},bold:[{inline:"b",remove:"all"},{inline:"strong",remove:"all"},{inline:"span",styles:{fontWeight:"bold"}}],italic:[{inline:"i",remove:"all"},{inline:"em",remove:"all"},{inline:"span",styles:{fontStyle:"italic"}}],underline:[{inline:"u",remove:"all"},{inline:"span",styles:{textDecoration:"underline"},exact:true}],strikethrough:[{inline:"strike",remove:"all"},{inline:"span",styles:{textDecoration:"line-through"},exact:true}],fontname:{inline:"font",attributes:{face:"%value"}},fontsize:{inline:"font",attributes:{size:function(f){return a.inArray(e,f.value)+1}}},forecolor:{inline:"font",styles:{color:"%value"}},hilitecolor:{inline:"font",styles:{backgroundColor:"%value"}}});a.each("b,i,u,strike".split(","),function(f){d.addValidElements(f+"[*]")});if(!d.getElementRule("font")){d.addValidElements("font[face|size|color|style]")}a.each(c.split(","),function(f){var h=d.getElementRule(f),g;if(h){if(!h.attributes.align){h.attributes.align={};h.attributesOrder.push("align")}}});b.onNodeChange.add(function(g,k){var j,f,h,i;f=g.dom.getParent(g.selection.getNode(),"font");if(f){h=f.face;i=f.size}if(j=k.get("fontselect")){j.select(function(l){return l==h})}if(j=k.get("fontsizeselect")){j.select(function(m){var l=a.inArray(e,m.fontSize);return l+1==i})}})})},getInfo:function(){return{longname:"LegacyOutput",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/legacyoutput",version:a.majorVersion+"."+a.minorVersion}}});a.PluginManager.add("legacyoutput",a.plugins.LegacyOutput)})(tinymce);
@@ -26,7 +26,7 @@
26
26
  editor.onInit.add(function() {
27
27
  var alignElements = 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img',
28
28
  fontSizes = tinymce.explode(editor.settings.font_size_style_values),
29
- serializer = editor.serializer;
29
+ schema = editor.schema;
30
30
 
31
31
  // Override some internal formats to produce legacy elements and attributes
32
32
  editor.formatter.register({
@@ -34,13 +34,27 @@
34
34
  alignleft : {selector : alignElements, attributes : {align : 'left'}},
35
35
  aligncenter : {selector : alignElements, attributes : {align : 'center'}},
36
36
  alignright : {selector : alignElements, attributes : {align : 'right'}},
37
- alignfull : {selector : alignElements, attributes : {align : 'full'}},
38
-
39
- // Change the basic formatting elements to use deprecated element types
40
- bold : {inline : 'b'},
41
- italic : {inline : 'i'},
42
- underline : {inline : 'u'},
43
- strikethrough : {inline : 'strike'},
37
+ alignfull : {selector : alignElements, attributes : {align : 'justify'}},
38
+
39
+ // Change the basic formatting elements to use deprecated element types
40
+ bold : [
41
+ {inline : 'b', remove : 'all'},
42
+ {inline : 'strong', remove : 'all'},
43
+ {inline : 'span', styles : {fontWeight : 'bold'}}
44
+ ],
45
+ italic : [
46
+ {inline : 'i', remove : 'all'},
47
+ {inline : 'em', remove : 'all'},
48
+ {inline : 'span', styles : {fontStyle : 'italic'}}
49
+ ],
50
+ underline : [
51
+ {inline : 'u', remove : 'all'},
52
+ {inline : 'span', styles : {textDecoration : 'underline'}, exact : true}
53
+ ],
54
+ strikethrough : [
55
+ {inline : 'strike', remove : 'all'},
56
+ {inline : 'span', styles : {textDecoration: 'line-through'}, exact : true}
57
+ ],
44
58
 
45
59
  // Change font size and font family to use the deprecated font element
46
60
  fontname : {inline : 'font', attributes : {face : '%value'}},
@@ -58,35 +72,24 @@
58
72
  hilitecolor : {inline : 'font', styles : {backgroundColor : '%value'}}
59
73
  });
60
74
 
61
- // Force parsing of the serializer rules
62
- serializer._setup();
63
-
64
75
  // Check that deprecated elements are allowed if not add them
65
76
  tinymce.each('b,i,u,strike'.split(','), function(name) {
66
- var rule = serializer.rules[name];
67
-
68
- if (!rule)
69
- serializer.addRules(name);
77
+ schema.addValidElements(name + '[*]');
70
78
  });
71
79
 
72
80
  // Add font element if it's missing
73
- if (!serializer.rules["font"])
74
- serializer.addRules("font[face|size|color|style]");
81
+ if (!schema.getElementRule("font"))
82
+ schema.addValidElements("font[face|size|color|style]");
75
83
 
76
84
  // Add the missing and depreacted align attribute for the serialization engine
77
85
  tinymce.each(alignElements.split(','), function(name) {
78
- var rule = serializer.rules[name], found;
86
+ var rule = schema.getElementRule(name), found;
79
87
 
80
88
  if (rule) {
81
- tinymce.each(rule.attribs, function(name, attr) {
82
- if (attr.name == 'align') {
83
- found = true;
84
- return false;
85
- }
86
- });
87
-
88
- if (!found)
89
- rule.attribs.push({name : 'align'});
89
+ if (!rule.attributes.align) {
90
+ rule.attributes.align = {};
91
+ rule.attributesOrder.push('align');
92
+ }
90
93
  }
91
94
  });
92
95
 
@@ -133,4 +136,4 @@
133
136
 
134
137
  // Register plugin
135
138
  tinymce.PluginManager.add('legacyoutput', tinymce.plugins.LegacyOutput);
136
- })(tinymce);
139
+ })(tinymce);
@@ -0,0 +1 @@
1
+ (function(){var e=tinymce.each,r=tinymce.dom.Event,g;function p(t,s){while(t&&(t.nodeType===8||(t.nodeType===3&&/^[ \t\n\r]*$/.test(t.nodeValue)))){t=s(t)}return t}function b(s){return p(s,function(t){return t.previousSibling})}function i(s){return p(s,function(t){return t.nextSibling})}function d(s,u,t){return s.dom.getParent(u,function(v){return tinymce.inArray(t,v)!==-1})}function n(s){return s&&(s.tagName==="OL"||s.tagName==="UL")}function c(u,v){var t,w,s;t=b(u.lastChild);while(n(t)){w=t;t=b(w.previousSibling)}if(w){s=v.create("li",{style:"list-style-type: none;"});v.split(u,w);v.insertAfter(s,w);s.appendChild(w);s.appendChild(w);u=s.previousSibling}return u}function m(t,s,u){t=a(t,s,u);return o(t,s,u)}function a(u,s,v){var t=b(u.previousSibling);if(t){return h(t,u,s?t:false,v)}else{return u}}function o(u,t,v){var s=i(u.nextSibling);if(s){return h(u,s,t?s:false,v)}else{return u}}function h(u,s,t,v){if(l(u,s,!!t,v)){return f(u,s,t)}else{if(u&&u.tagName==="LI"&&n(s)){u.appendChild(s)}}return s}function l(u,t,s,v){if(!u||!t){return false}else{if(u.tagName==="LI"&&t.tagName==="LI"){return t.style.listStyleType==="none"||j(t)}else{if(n(u)){return(u.tagName===t.tagName&&(s||u.style.listStyleType===t.style.listStyleType))||q(t)}else{if(v&&u.tagName==="P"&&t.tagName==="P"){return true}else{return false}}}}}function q(t){var s=i(t.firstChild),u=b(t.lastChild);return s&&u&&n(t)&&s===u&&(n(s)||s.style.listStyleType==="none"||j(s))}function j(u){var t=i(u.firstChild),s=b(u.lastChild);return t&&s&&t===s&&n(t)}function f(w,v,s){var u=b(w.lastChild),t=i(v.firstChild);if(w.tagName==="P"){w.appendChild(w.ownerDocument.createElement("br"))}while(v.firstChild){w.appendChild(v.firstChild)}if(s){w.style.listStyleType=s.style.listStyleType}v.parentNode.removeChild(v);h(u,t,false);return w}function k(t,u){var s;if(!u.is(t,"li,ol,ul")){s=u.getParent(t,"li");if(s){t=s}}return t}tinymce.create("tinymce.plugins.Lists",{init:function(u,v){var s=false;function x(y){return y.keyCode===9&&(u.queryCommandState("InsertUnorderedList")||u.queryCommandState("InsertOrderedList"))}function w(y,A){var z=y.selection,B;if(A.keyCode===13){B=z.getStart();s=z.isCollapsed()&&B&&B.tagName==="LI"&&B.childNodes.length===0;return s}}function t(y,z){if(x(z)||w(y,z)){return r.cancel(z)}}this.ed=u;u.addCommand("Indent",this.indent,this);u.addCommand("Outdent",this.outdent,this);u.addCommand("InsertUnorderedList",function(){this.applyList("UL","OL")},this);u.addCommand("InsertOrderedList",function(){this.applyList("OL","UL")},this);u.onInit.add(function(){u.editorCommands.addCommands({outdent:function(){var z=u.selection,A=u.dom;function y(B){B=A.getParent(B,A.isBlock);return B&&(parseInt(u.dom.getStyle(B,"margin-left")||0,10)+parseInt(u.dom.getStyle(B,"padding-left")||0,10))>0}return y(z.getStart())||y(z.getEnd())||u.queryCommandState("InsertOrderedList")||u.queryCommandState("InsertUnorderedList")}},"state")});u.onKeyUp.add(function(z,A){var B,y;if(x(A)){z.execCommand(A.shiftKey?"Outdent":"Indent",true,null);return r.cancel(A)}else{if(s&&w(z,A)){if(z.queryCommandState("InsertOrderedList")){z.execCommand("InsertOrderedList")}else{z.execCommand("InsertUnorderedList")}B=z.selection.getStart();if(B&&B.tagName==="LI"){B=z.dom.getParent(B,"ol,ul").nextSibling;if(B&&B.tagName==="P"){if(!B.firstChild){B.appendChild(z.getDoc().createTextNode(""))}y=z.dom.createRng();y.setStart(B.firstChild,1);y.setEnd(B.firstChild,1);z.selection.setRng(y)}}return r.cancel(A)}}});u.onKeyPress.add(t);u.onKeyDown.add(t)},applyList:function(y,v){var C=this,z=C.ed,I=z.dom,s=[],H=false,u=false,w=false,B,G=z.selection.getSelectedBlocks();function E(t){if(t&&t.tagName==="BR"){I.remove(t)}}function F(M){var N=I.create(y),t;function L(O){if(O.style.marginLeft||O.style.paddingLeft){C.adjustPaddingFunction(false)(O)}}if(M.tagName==="LI"){}else{if(M.tagName==="P"||M.tagName==="DIV"||M.tagName==="BODY"){K(M,function(P,O,Q){J(P,O,M.tagName==="BODY"?null:P.parentNode);t=P.parentNode;L(t);E(O)});if(M.tagName==="P"||G.length>1){I.split(t.parentNode.parentNode,t.parentNode)}m(t.parentNode,true);return}else{t=I.create("li");I.insertAfter(t,M);t.appendChild(M);L(M);M=t}}I.insertAfter(N,M);N.appendChild(M);m(N,true);s.push(M)}function J(Q,L,O){var t,P=Q,N,M;while(!I.isBlock(Q.parentNode)&&Q.parentNode!==I.getRoot()){Q=I.split(Q.parentNode,Q.previousSibling);Q=Q.nextSibling;P=Q}if(O){t=O.cloneNode(true);Q.parentNode.insertBefore(t,Q);while(t.firstChild){I.remove(t.firstChild)}t=I.rename(t,"li")}else{t=I.create("li");Q.parentNode.insertBefore(t,Q)}while(P&&P!=L){N=P.nextSibling;t.appendChild(P);P=N}if(t.childNodes.length===0){t.innerHTML='<br _mce_bogus="1" />'}F(t)}function K(Q,T){var N,R,O=3,L=1,t="br,ul,ol,p,div,h1,h2,h3,h4,h5,h6,table,blockquote,address,pre,form,center,dl";function P(X,U){var V=I.createRng(),W;g.keep=true;z.selection.moveToBookmark(g);g.keep=false;W=z.selection.getRng(true);if(!U){U=X.parentNode.lastChild}V.setStartBefore(X);V.setEndAfter(U);return !(V.compareBoundaryPoints(O,W)>0||V.compareBoundaryPoints(L,W)<=0)}function S(U){if(U.nextSibling){return U.nextSibling}if(!I.isBlock(U.parentNode)&&U.parentNode!==I.getRoot()){return S(U.parentNode)}}N=Q.firstChild;var M=false;e(I.select(t,Q),function(V){var U;if(V.hasAttribute&&V.hasAttribute("_mce_bogus")){return true}if(P(N,V)){I.addClass(V,"_mce_tagged_br");N=S(V)}});M=(N&&P(N,undefined));N=Q.firstChild;e(I.select(t,Q),function(V){var U=S(V);if(V.hasAttribute&&V.hasAttribute("_mce_bogus")){return true}if(I.hasClass(V,"_mce_tagged_br")){T(N,V,R);R=null}else{R=V}N=U});if(M){T(N,undefined,R)}}function D(t){K(t,function(M,L,N){J(M,L);E(L);E(N)})}function A(t){if(tinymce.inArray(s,t)!==-1){return}if(t.parentNode.tagName===v){I.split(t.parentNode,t);F(t);o(t.parentNode,false)}s.push(t)}function x(M){var O,N,L,t;if(tinymce.inArray(s,M)!==-1){return}M=c(M,I);while(I.is(M.parentNode,"ol,ul,li")){I.split(M.parentNode,M)}s.push(M);M=I.rename(M,"p");L=m(M,false,z.settings.force_br_newlines);if(L===M){O=M.firstChild;while(O){if(I.isBlock(O)){O=I.split(O.parentNode,O);t=true;N=O.nextSibling&&O.nextSibling.firstChild}else{N=O.nextSibling;if(t&&O.tagName==="BR"){I.remove(O)}t=false}O=N}}}e(G,function(t){t=k(t,I);if(t.tagName===v||(t.tagName==="LI"&&t.parentNode.tagName===v)){u=true}else{if(t.tagName===y||(t.tagName==="LI"&&t.parentNode.tagName===y)){H=true}else{w=true}}});if(w||u||G.length===0){B={LI:A,H1:F,H2:F,H3:F,H4:F,H5:F,H6:F,P:F,BODY:F,DIV:G.length>1?F:D,defaultAction:D}}else{B={defaultAction:x}}this.process(B)},indent:function(){var u=this.ed,w=u.dom,x=[];function s(z){var y=w.create("li",{style:"list-style-type: none;"});w.insertAfter(y,z);return y}function t(B){var y=s(B),D=w.getParent(B,"ol,ul"),C=D.tagName,E=w.getStyle(D,"list-style-type"),A={},z;if(E!==""){A.style="list-style-type: "+E+";"}z=w.create(C,A);y.appendChild(z);return z}function v(z){if(!d(u,z,x)){z=c(z,w);var y=t(z);y.appendChild(z);m(y.parentNode,false);m(y,false);x.push(z)}}this.process({LI:v,defaultAction:this.adjustPaddingFunction(true)})},outdent:function(){var v=this,u=v.ed,w=u.dom,s=[];function x(t){var z,y,A;if(!d(u,t,s)){if(w.getStyle(t,"margin-left")!==""||w.getStyle(t,"padding-left")!==""){return v.adjustPaddingFunction(false)(t)}A=w.getStyle(t,"text-align",true);if(A==="center"||A==="right"){w.setStyle(t,"text-align","left");return}t=c(t,w);z=t.parentNode;y=t.parentNode.parentNode;if(y.tagName==="P"){w.split(y,t.parentNode)}else{w.split(z,t);if(y.tagName==="LI"){w.split(y,t)}else{if(!w.is(y,"ol,ul")){w.rename(t,"p")}}}s.push(t)}}this.process({LI:x,defaultAction:this.adjustPaddingFunction(false)});e(s,m)},process:function(x){var B=this,v=B.ed.selection,y=B.ed.dom,A,s;function w(t){y.removeClass(t,"_mce_act_on");if(!t||t.nodeType!==1){return}t=k(t,y);var C=x[t.tagName];if(!C){C=x.defaultAction}C(t)}function u(t){B.splitSafeEach(t.childNodes,w)}function z(t,C){return C>=0&&t.hasChildNodes()&&C<t.childNodes.length&&t.childNodes[C].tagName==="BR"}A=v.getSelectedBlocks();if(A.length===0){A=[y.getRoot()]}s=v.getRng(true);if(!s.collapsed){if(z(s.endContainer,s.endOffset-1)){s.setEnd(s.endContainer,s.endOffset-1);v.setRng(s)}if(z(s.startContainer,s.startOffset)){s.setStart(s.startContainer,s.startOffset+1);v.setRng(s)}}g=v.getBookmark();x.OL=x.UL=u;B.splitSafeEach(A,w);v.moveToBookmark(g);g=null;B.ed.execCommand("mceRepaint")},splitSafeEach:function(t,s){if(tinymce.isGecko&&(/Firefox\/[12]\.[0-9]/.test(navigator.userAgent)||/Firefox\/3\.[0-4]/.test(navigator.userAgent))){this.classBasedEach(t,s)}else{e(t,s)}},classBasedEach:function(v,u){var w=this.ed.dom,s,t;e(v,function(x){w.addClass(x,"_mce_act_on")});s=w.select("._mce_act_on");while(s.length>0){t=s.shift();w.removeClass(t,"_mce_act_on");u(t);s=w.select("._mce_act_on")}},adjustPaddingFunction:function(u){var s,v,t=this.ed;s=t.settings.indentation;v=/[a-z%]+/i.exec(s);s=parseInt(s,10);return function(w){var y,x;y=parseInt(t.dom.getStyle(w,"margin-left")||0,10)+parseInt(t.dom.getStyle(w,"padding-left")||0,10);if(u){x=y+s}else{x=y-s}t.dom.setStyle(w,"padding-left","");t.dom.setStyle(w,"margin-left",x>0?x+v:"")}},getInfo:function(){return{longname:"Lists",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/lists",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("lists",tinymce.plugins.Lists)}());
@@ -0,0 +1,617 @@
1
+ /**
2
+ * editor_plugin_src.js
3
+ *
4
+ * Copyright 2011, Moxiecode Systems AB
5
+ * Released under LGPL License.
6
+ *
7
+ * License: http://tinymce.moxiecode.com/license
8
+ * Contributing: http://tinymce.moxiecode.com/contributing
9
+ */
10
+
11
+ (function() {
12
+ var each = tinymce.each, Event = tinymce.dom.Event, bookmark;
13
+
14
+ // Skips text nodes that only contain whitespace since they aren't semantically important.
15
+ function skipWhitespaceNodes(e, next) {
16
+ while (e && (e.nodeType === 8 || (e.nodeType === 3 && /^[ \t\n\r]*$/.test(e.nodeValue)))) {
17
+ e = next(e);
18
+ }
19
+ return e;
20
+ }
21
+
22
+ function skipWhitespaceNodesBackwards(e) {
23
+ return skipWhitespaceNodes(e, function(e) { return e.previousSibling; });
24
+ }
25
+
26
+ function skipWhitespaceNodesForwards(e) {
27
+ return skipWhitespaceNodes(e, function(e) { return e.nextSibling; });
28
+ }
29
+
30
+ function hasParentInList(ed, e, list) {
31
+ return ed.dom.getParent(e, function(p) {
32
+ return tinymce.inArray(list, p) !== -1;
33
+ });
34
+ }
35
+
36
+ function isList(e) {
37
+ return e && (e.tagName === 'OL' || e.tagName === 'UL');
38
+ }
39
+
40
+ function splitNestedLists(element, dom) {
41
+ var tmp, nested, wrapItem;
42
+ tmp = skipWhitespaceNodesBackwards(element.lastChild);
43
+ while (isList(tmp)) {
44
+ nested = tmp;
45
+ tmp = skipWhitespaceNodesBackwards(nested.previousSibling);
46
+ }
47
+ if (nested) {
48
+ wrapItem = dom.create('li', { style: 'list-style-type: none;'});
49
+ dom.split(element, nested);
50
+ dom.insertAfter(wrapItem, nested);
51
+ wrapItem.appendChild(nested);
52
+ wrapItem.appendChild(nested);
53
+ element = wrapItem.previousSibling;
54
+ }
55
+ return element;
56
+ }
57
+
58
+ function attemptMergeWithAdjacent(e, allowDifferentListStyles, mergeParagraphs) {
59
+ e = attemptMergeWithPrevious(e, allowDifferentListStyles, mergeParagraphs);
60
+ return attemptMergeWithNext(e, allowDifferentListStyles, mergeParagraphs);
61
+ }
62
+
63
+ function attemptMergeWithPrevious(e, allowDifferentListStyles, mergeParagraphs) {
64
+ var prev = skipWhitespaceNodesBackwards(e.previousSibling);
65
+ if (prev) {
66
+ return attemptMerge(prev, e, allowDifferentListStyles ? prev : false, mergeParagraphs);
67
+ } else {
68
+ return e;
69
+ }
70
+ }
71
+
72
+ function attemptMergeWithNext(e, allowDifferentListStyles, mergeParagraphs) {
73
+ var next = skipWhitespaceNodesForwards(e.nextSibling);
74
+ if (next) {
75
+ return attemptMerge(e, next, allowDifferentListStyles ? next : false, mergeParagraphs);
76
+ } else {
77
+ return e;
78
+ }
79
+ }
80
+
81
+ function attemptMerge(e1, e2, differentStylesMasterElement, mergeParagraphs) {
82
+ if (canMerge(e1, e2, !!differentStylesMasterElement, mergeParagraphs)) {
83
+ return merge(e1, e2, differentStylesMasterElement);
84
+ } else if (e1 && e1.tagName === 'LI' && isList(e2)) {
85
+ // Fix invalidly nested lists.
86
+ e1.appendChild(e2);
87
+ }
88
+ return e2;
89
+ }
90
+
91
+ function canMerge(e1, e2, allowDifferentListStyles, mergeParagraphs) {
92
+ if (!e1 || !e2) {
93
+ return false;
94
+ } else if (e1.tagName === 'LI' && e2.tagName === 'LI') {
95
+ return e2.style.listStyleType === 'none' || containsOnlyAList(e2);
96
+ } else if (isList(e1)) {
97
+ return (e1.tagName === e2.tagName && (allowDifferentListStyles || e1.style.listStyleType === e2.style.listStyleType)) || isListForIndent(e2);
98
+ } else if (mergeParagraphs && e1.tagName === 'P' && e2.tagName === 'P') {
99
+ return true;
100
+ } else {
101
+ return false;
102
+ }
103
+ }
104
+
105
+ function isListForIndent(e) {
106
+ var firstLI = skipWhitespaceNodesForwards(e.firstChild), lastLI = skipWhitespaceNodesBackwards(e.lastChild);
107
+ return firstLI && lastLI && isList(e) && firstLI === lastLI && (isList(firstLI) || firstLI.style.listStyleType === 'none' || containsOnlyAList(firstLI));
108
+ }
109
+
110
+ function containsOnlyAList(e) {
111
+ var firstChild = skipWhitespaceNodesForwards(e.firstChild), lastChild = skipWhitespaceNodesBackwards(e.lastChild);
112
+ return firstChild && lastChild && firstChild === lastChild && isList(firstChild);
113
+ }
114
+
115
+ function merge(e1, e2, masterElement) {
116
+ var lastOriginal = skipWhitespaceNodesBackwards(e1.lastChild), firstNew = skipWhitespaceNodesForwards(e2.firstChild);
117
+ if (e1.tagName === 'P') {
118
+ e1.appendChild(e1.ownerDocument.createElement('br'));
119
+ }
120
+ while (e2.firstChild) {
121
+ e1.appendChild(e2.firstChild);
122
+ }
123
+ if (masterElement) {
124
+ e1.style.listStyleType = masterElement.style.listStyleType;
125
+ }
126
+ e2.parentNode.removeChild(e2);
127
+ attemptMerge(lastOriginal, firstNew, false);
128
+ return e1;
129
+ }
130
+
131
+ function findItemToOperateOn(e, dom) {
132
+ var item;
133
+ if (!dom.is(e, 'li,ol,ul')) {
134
+ item = dom.getParent(e, 'li');
135
+ if (item) {
136
+ e = item;
137
+ }
138
+ }
139
+ return e;
140
+ }
141
+
142
+ tinymce.create('tinymce.plugins.Lists', {
143
+ init: function(ed, url) {
144
+ var enterDownInEmptyList = false;
145
+ function isTriggerKey(e) {
146
+ return e.keyCode === 9 && (ed.queryCommandState('InsertUnorderedList') || ed.queryCommandState('InsertOrderedList'));
147
+ }
148
+ function isEnterInEmptyListItem(ed, e) {
149
+ var sel = ed.selection, n;
150
+ if (e.keyCode === 13) {
151
+ n = sel.getStart();
152
+ enterDownInEmptyList = sel.isCollapsed() && n && n.tagName === 'LI' && n.childNodes.length === 0;
153
+ return enterDownInEmptyList;
154
+ }
155
+ }
156
+ function cancelKeys(ed, e) {
157
+ if (isTriggerKey(e) || isEnterInEmptyListItem(ed, e)) {
158
+ return Event.cancel(e);
159
+ }
160
+ }
161
+
162
+ this.ed = ed;
163
+ ed.addCommand('Indent', this.indent, this);
164
+ ed.addCommand('Outdent', this.outdent, this);
165
+ ed.addCommand('InsertUnorderedList', function() {
166
+ this.applyList('UL', 'OL');
167
+ }, this);
168
+ ed.addCommand('InsertOrderedList', function() {
169
+ this.applyList('OL', 'UL');
170
+ }, this);
171
+
172
+ ed.onInit.add(function() {
173
+ ed.editorCommands.addCommands({
174
+ 'outdent': function() {
175
+ var sel = ed.selection, dom = ed.dom;
176
+ function hasStyleIndent(n) {
177
+ n = dom.getParent(n, dom.isBlock);
178
+ return n && (parseInt(ed.dom.getStyle(n, 'margin-left') || 0, 10) + parseInt(ed.dom.getStyle(n, 'padding-left') || 0, 10)) > 0;
179
+ }
180
+ return hasStyleIndent(sel.getStart()) || hasStyleIndent(sel.getEnd()) || ed.queryCommandState('InsertOrderedList') || ed.queryCommandState('InsertUnorderedList');
181
+ }
182
+ }, 'state');
183
+ });
184
+
185
+ ed.onKeyUp.add(function(ed, e) {
186
+ var n, rng;
187
+ if (isTriggerKey(e)) {
188
+ ed.execCommand(e.shiftKey ? 'Outdent' : 'Indent', true, null);
189
+ return Event.cancel(e);
190
+ } else if (enterDownInEmptyList && isEnterInEmptyListItem(ed, e)) {
191
+ if (ed.queryCommandState('InsertOrderedList')) {
192
+ ed.execCommand('InsertOrderedList');
193
+ } else {
194
+ ed.execCommand('InsertUnorderedList');
195
+ }
196
+ n = ed.selection.getStart();
197
+ if (n && n.tagName === 'LI') {
198
+ // Fix the caret position on IE since it jumps back up to the previous list item.
199
+ n = ed.dom.getParent(n, 'ol,ul').nextSibling;
200
+ if (n && n.tagName === 'P') {
201
+ if (!n.firstChild) {
202
+ n.appendChild(ed.getDoc().createTextNode(''));
203
+ }
204
+ rng = ed.dom.createRng();
205
+ rng.setStart(n.firstChild, 1);
206
+ rng.setEnd(n.firstChild, 1);
207
+ ed.selection.setRng(rng);
208
+ }
209
+ }
210
+ return Event.cancel(e);
211
+ }
212
+ });
213
+ ed.onKeyPress.add(cancelKeys);
214
+ ed.onKeyDown.add(cancelKeys);
215
+ },
216
+
217
+ applyList: function(targetListType, oppositeListType) {
218
+ var t = this, ed = t.ed, dom = ed.dom, applied = [], hasSameType = false, hasOppositeType = false, hasNonList = false, actions,
219
+ selectedBlocks = ed.selection.getSelectedBlocks();
220
+
221
+ function cleanupBr(e) {
222
+ if (e && e.tagName === 'BR') {
223
+ dom.remove(e);
224
+ }
225
+ }
226
+
227
+ function makeList(element) {
228
+ var list = dom.create(targetListType), li;
229
+ function adjustIndentForNewList(element) {
230
+ // If there's a margin-left, outdent one level to account for the extra list margin.
231
+ if (element.style.marginLeft || element.style.paddingLeft) {
232
+ t.adjustPaddingFunction(false)(element);
233
+ }
234
+ }
235
+
236
+ if (element.tagName === 'LI') {
237
+ // No change required.
238
+ } else if (element.tagName === 'P' || element.tagName === 'DIV' || element.tagName === 'BODY') {
239
+ processBrs(element, function(startSection, br, previousBR) {
240
+ doWrapList(startSection, br, element.tagName === 'BODY' ? null : startSection.parentNode);
241
+ li = startSection.parentNode;
242
+ adjustIndentForNewList(li);
243
+ cleanupBr(br);
244
+ });
245
+ if (element.tagName === 'P' || selectedBlocks.length > 1) {
246
+ dom.split(li.parentNode.parentNode, li.parentNode);
247
+ }
248
+ attemptMergeWithAdjacent(li.parentNode, true);
249
+ return;
250
+ } else {
251
+ // Put the list around the element.
252
+ li = dom.create('li');
253
+ dom.insertAfter(li, element);
254
+ li.appendChild(element);
255
+ adjustIndentForNewList(element);
256
+ element = li;
257
+ }
258
+ dom.insertAfter(list, element);
259
+ list.appendChild(element);
260
+ attemptMergeWithAdjacent(list, true);
261
+ applied.push(element);
262
+ }
263
+
264
+ function doWrapList(start, end, template) {
265
+ var li, n = start, tmp, i;
266
+ while (!dom.isBlock(start.parentNode) && start.parentNode !== dom.getRoot()) {
267
+ start = dom.split(start.parentNode, start.previousSibling);
268
+ start = start.nextSibling;
269
+ n = start;
270
+ }
271
+ if (template) {
272
+ li = template.cloneNode(true);
273
+ start.parentNode.insertBefore(li, start);
274
+ while (li.firstChild) dom.remove(li.firstChild);
275
+ li = dom.rename(li, 'li');
276
+ } else {
277
+ li = dom.create('li');
278
+ start.parentNode.insertBefore(li, start);
279
+ }
280
+ while (n && n != end) {
281
+ tmp = n.nextSibling;
282
+ li.appendChild(n);
283
+ n = tmp;
284
+ }
285
+ if (li.childNodes.length === 0) {
286
+ li.innerHTML = '<br _mce_bogus="1" />';
287
+ }
288
+ makeList(li);
289
+ }
290
+
291
+ function processBrs(element, callback) {
292
+ var startSection, previousBR, END_TO_START = 3, START_TO_END = 1,
293
+ breakElements = 'br,ul,ol,p,div,h1,h2,h3,h4,h5,h6,table,blockquote,address,pre,form,center,dl';
294
+ function isAnyPartSelected(start, end) {
295
+ var r = dom.createRng(), sel;
296
+ bookmark.keep = true;
297
+ ed.selection.moveToBookmark(bookmark);
298
+ bookmark.keep = false;
299
+ sel = ed.selection.getRng(true);
300
+ if (!end) {
301
+ end = start.parentNode.lastChild;
302
+ }
303
+ r.setStartBefore(start);
304
+ r.setEndAfter(end);
305
+ return !(r.compareBoundaryPoints(END_TO_START, sel) > 0 || r.compareBoundaryPoints(START_TO_END, sel) <= 0);
306
+ }
307
+ function nextLeaf(br) {
308
+ if (br.nextSibling)
309
+ return br.nextSibling;
310
+ if (!dom.isBlock(br.parentNode) && br.parentNode !== dom.getRoot())
311
+ return nextLeaf(br.parentNode);
312
+ }
313
+ // Split on BRs within the range and process those.
314
+ startSection = element.firstChild;
315
+ // First mark the BRs that have any part of the previous section selected.
316
+ var trailingContentSelected = false;
317
+ each(dom.select(breakElements, element), function(br) {
318
+ var b;
319
+ if (br.hasAttribute && br.hasAttribute('_mce_bogus')) {
320
+ return true; // Skip the bogus Brs that are put in to appease Firefox and Safari.
321
+ }
322
+ if (isAnyPartSelected(startSection, br)) {
323
+ dom.addClass(br, '_mce_tagged_br');
324
+ startSection = nextLeaf(br);
325
+ }
326
+ });
327
+ trailingContentSelected = (startSection && isAnyPartSelected(startSection, undefined));
328
+ startSection = element.firstChild;
329
+ each(dom.select(breakElements, element), function(br) {
330
+ // Got a section from start to br.
331
+ var tmp = nextLeaf(br);
332
+ if (br.hasAttribute && br.hasAttribute('_mce_bogus')) {
333
+ return true; // Skip the bogus Brs that are put in to appease Firefox and Safari.
334
+ }
335
+ if (dom.hasClass(br, '_mce_tagged_br')) {
336
+ callback(startSection, br, previousBR);
337
+ previousBR = null;
338
+ } else {
339
+ previousBR = br;
340
+ }
341
+ startSection = tmp;
342
+ });
343
+ if (trailingContentSelected) {
344
+ callback(startSection, undefined, previousBR);
345
+ }
346
+ }
347
+
348
+ function wrapList(element) {
349
+ processBrs(element, function(startSection, br, previousBR) {
350
+ // Need to indent this part
351
+ doWrapList(startSection, br);
352
+ cleanupBr(br);
353
+ cleanupBr(previousBR);
354
+ });
355
+ }
356
+
357
+ function changeList(element) {
358
+ if (tinymce.inArray(applied, element) !== -1) {
359
+ return;
360
+ }
361
+ if (element.parentNode.tagName === oppositeListType) {
362
+ dom.split(element.parentNode, element);
363
+ makeList(element);
364
+ attemptMergeWithNext(element.parentNode, false);
365
+ }
366
+ applied.push(element);
367
+ }
368
+
369
+ function convertListItemToParagraph(element) {
370
+ var child, nextChild, mergedElement, splitLast;
371
+ if (tinymce.inArray(applied, element) !== -1) {
372
+ return;
373
+ }
374
+ element = splitNestedLists(element, dom);
375
+ while (dom.is(element.parentNode, 'ol,ul,li')) {
376
+ dom.split(element.parentNode, element);
377
+ }
378
+ // Push the original element we have from the selection, not the renamed one.
379
+ applied.push(element);
380
+ element = dom.rename(element, 'p');
381
+ mergedElement = attemptMergeWithAdjacent(element, false, ed.settings.force_br_newlines);
382
+ if (mergedElement === element) {
383
+ // Now split out any block elements that can't be contained within a P.
384
+ // Manually iterate to ensure we handle modifications correctly (doesn't work with tinymce.each)
385
+ child = element.firstChild;
386
+ while (child) {
387
+ if (dom.isBlock(child)) {
388
+ child = dom.split(child.parentNode, child);
389
+ splitLast = true;
390
+ nextChild = child.nextSibling && child.nextSibling.firstChild;
391
+ } else {
392
+ nextChild = child.nextSibling;
393
+ if (splitLast && child.tagName === 'BR') {
394
+ dom.remove(child);
395
+ }
396
+ splitLast = false;
397
+ }
398
+ child = nextChild;
399
+ }
400
+ }
401
+ }
402
+
403
+ each(selectedBlocks, function(e) {
404
+ e = findItemToOperateOn(e, dom);
405
+ if (e.tagName === oppositeListType || (e.tagName === 'LI' && e.parentNode.tagName === oppositeListType)) {
406
+ hasOppositeType = true;
407
+ } else if (e.tagName === targetListType || (e.tagName === 'LI' && e.parentNode.tagName === targetListType)) {
408
+ hasSameType = true;
409
+ } else {
410
+ hasNonList = true;
411
+ }
412
+ });
413
+
414
+ if (hasNonList || hasOppositeType || selectedBlocks.length === 0) {
415
+ actions = {
416
+ 'LI': changeList,
417
+ 'H1': makeList,
418
+ 'H2': makeList,
419
+ 'H3': makeList,
420
+ 'H4': makeList,
421
+ 'H5': makeList,
422
+ 'H6': makeList,
423
+ 'P': makeList,
424
+ 'BODY': makeList,
425
+ 'DIV': selectedBlocks.length > 1 ? makeList : wrapList,
426
+ defaultAction: wrapList
427
+ };
428
+ } else {
429
+ actions = {
430
+ defaultAction: convertListItemToParagraph
431
+ };
432
+ }
433
+ this.process(actions);
434
+ },
435
+
436
+ indent: function() {
437
+ var ed = this.ed, dom = ed.dom, indented = [];
438
+
439
+ function createWrapItem(element) {
440
+ var wrapItem = dom.create('li', { style: 'list-style-type: none;'});
441
+ dom.insertAfter(wrapItem, element);
442
+ return wrapItem;
443
+ }
444
+
445
+ function createWrapList(element) {
446
+ var wrapItem = createWrapItem(element),
447
+ list = dom.getParent(element, 'ol,ul'),
448
+ listType = list.tagName,
449
+ listStyle = dom.getStyle(list, 'list-style-type'),
450
+ attrs = {},
451
+ wrapList;
452
+ if (listStyle !== '') {
453
+ attrs.style = 'list-style-type: ' + listStyle + ';';
454
+ }
455
+ wrapList = dom.create(listType, attrs);
456
+ wrapItem.appendChild(wrapList);
457
+ return wrapList;
458
+ }
459
+
460
+ function indentLI(element) {
461
+ if (!hasParentInList(ed, element, indented)) {
462
+ element = splitNestedLists(element, dom);
463
+ var wrapList = createWrapList(element);
464
+ wrapList.appendChild(element);
465
+ attemptMergeWithAdjacent(wrapList.parentNode, false);
466
+ attemptMergeWithAdjacent(wrapList, false);
467
+ indented.push(element);
468
+ }
469
+ }
470
+
471
+ this.process({
472
+ 'LI': indentLI,
473
+ defaultAction: this.adjustPaddingFunction(true)
474
+ });
475
+
476
+ },
477
+
478
+ outdent: function() {
479
+ var t = this, ed = t.ed, dom = ed.dom, outdented = [];
480
+
481
+ function outdentLI(element) {
482
+ var listElement, targetParent, align;
483
+ if (!hasParentInList(ed, element, outdented)) {
484
+ if (dom.getStyle(element, 'margin-left') !== '' || dom.getStyle(element, 'padding-left') !== '') {
485
+ return t.adjustPaddingFunction(false)(element);
486
+ }
487
+ align = dom.getStyle(element, 'text-align', true);
488
+ if (align === 'center' || align === 'right') {
489
+ dom.setStyle(element, 'text-align', 'left');
490
+ return;
491
+ }
492
+ element = splitNestedLists(element, dom);
493
+ listElement = element.parentNode;
494
+ targetParent = element.parentNode.parentNode;
495
+ if (targetParent.tagName === 'P') {
496
+ dom.split(targetParent, element.parentNode);
497
+ } else {
498
+ dom.split(listElement, element);
499
+ if (targetParent.tagName === 'LI') {
500
+ // Nested list, need to split the LI and go back out to the OL/UL element.
501
+ dom.split(targetParent, element);
502
+ } else if (!dom.is(targetParent, 'ol,ul')) {
503
+ dom.rename(element, 'p');
504
+ }
505
+ }
506
+ outdented.push(element);
507
+ }
508
+ }
509
+
510
+ this.process({
511
+ 'LI': outdentLI,
512
+ defaultAction: this.adjustPaddingFunction(false)
513
+ });
514
+
515
+ each(outdented, attemptMergeWithAdjacent);
516
+ },
517
+
518
+ process: function(actions) {
519
+ var t = this, sel = t.ed.selection, dom = t.ed.dom, selectedBlocks, r;
520
+ function processElement(element) {
521
+ dom.removeClass(element, '_mce_act_on');
522
+ if (!element || element.nodeType !== 1) {
523
+ return;
524
+ }
525
+ element = findItemToOperateOn(element, dom);
526
+ var action = actions[element.tagName];
527
+ if (!action) {
528
+ action = actions.defaultAction;
529
+ }
530
+ action(element);
531
+ }
532
+ function recurse(element) {
533
+ t.splitSafeEach(element.childNodes, processElement);
534
+ }
535
+ function brAtEdgeOfSelection(container, offset) {
536
+ return offset >= 0 && container.hasChildNodes() && offset < container.childNodes.length &&
537
+ container.childNodes[offset].tagName === 'BR';
538
+ }
539
+ selectedBlocks = sel.getSelectedBlocks();
540
+ if (selectedBlocks.length === 0) {
541
+ selectedBlocks = [ dom.getRoot() ];
542
+ }
543
+
544
+ r = sel.getRng(true);
545
+ if (!r.collapsed) {
546
+ if (brAtEdgeOfSelection(r.endContainer, r.endOffset - 1)) {
547
+ r.setEnd(r.endContainer, r.endOffset - 1);
548
+ sel.setRng(r);
549
+ }
550
+ if (brAtEdgeOfSelection(r.startContainer, r.startOffset)) {
551
+ r.setStart(r.startContainer, r.startOffset + 1);
552
+ sel.setRng(r);
553
+ }
554
+ }
555
+ bookmark = sel.getBookmark();
556
+ actions.OL = actions.UL = recurse;
557
+ t.splitSafeEach(selectedBlocks, processElement);
558
+ sel.moveToBookmark(bookmark);
559
+ bookmark = null;
560
+ // Avoids table or image handles being left behind in Firefox.
561
+ t.ed.execCommand('mceRepaint');
562
+ },
563
+
564
+ splitSafeEach: function(elements, f) {
565
+ if (tinymce.isGecko && (/Firefox\/[12]\.[0-9]/.test(navigator.userAgent) ||
566
+ /Firefox\/3\.[0-4]/.test(navigator.userAgent))) {
567
+ this.classBasedEach(elements, f);
568
+ } else {
569
+ each(elements, f);
570
+ }
571
+ },
572
+
573
+ classBasedEach: function(elements, f) {
574
+ var dom = this.ed.dom, nodes, element;
575
+ // Mark nodes
576
+ each(elements, function(element) {
577
+ dom.addClass(element, '_mce_act_on');
578
+ });
579
+ nodes = dom.select('._mce_act_on');
580
+ while (nodes.length > 0) {
581
+ element = nodes.shift();
582
+ dom.removeClass(element, '_mce_act_on');
583
+ f(element);
584
+ nodes = dom.select('._mce_act_on');
585
+ }
586
+ },
587
+
588
+ adjustPaddingFunction: function(isIndent) {
589
+ var indentAmount, indentUnits, ed = this.ed;
590
+ indentAmount = ed.settings.indentation;
591
+ indentUnits = /[a-z%]+/i.exec(indentAmount);
592
+ indentAmount = parseInt(indentAmount, 10);
593
+ return function(element) {
594
+ var currentIndent, newIndentAmount;
595
+ currentIndent = parseInt(ed.dom.getStyle(element, 'margin-left') || 0, 10) + parseInt(ed.dom.getStyle(element, 'padding-left') || 0, 10);
596
+ if (isIndent) {
597
+ newIndentAmount = currentIndent + indentAmount;
598
+ } else {
599
+ newIndentAmount = currentIndent - indentAmount;
600
+ }
601
+ ed.dom.setStyle(element, 'padding-left', '');
602
+ ed.dom.setStyle(element, 'margin-left', newIndentAmount > 0 ? newIndentAmount + indentUnits : '');
603
+ };
604
+ },
605
+
606
+ getInfo: function() {
607
+ return {
608
+ longname : 'Lists',
609
+ author : 'Moxiecode Systems AB',
610
+ authorurl : 'http://tinymce.moxiecode.com',
611
+ infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/lists',
612
+ version : tinymce.majorVersion + "." + tinymce.minorVersion
613
+ };
614
+ }
615
+ });
616
+ tinymce.PluginManager.add("lists", tinymce.plugins.Lists);
617
+ }());