refinerycms 0.9.8.5 → 0.9.8.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. data/Gemfile +15 -21
  2. data/bin/refinerycms +9 -12
  3. data/changelog.md +164 -154
  4. data/db/migrate/20100913234704_create_refinery_schema.rb +151 -0
  5. data/db/migrate/20100926142529_add_value_type_to_refinery_settings.rb +9 -0
  6. data/db/migrate/20100929035252_add_missing_indexes_to_roles_users.rb +11 -0
  7. data/db/schema.rb +5 -1
  8. data/db/seeds/pages.rb +0 -39
  9. data/db/seeds/pages_for_inquiries.rb +40 -0
  10. data/vendor/refinerycms/authentication/app/models/roles_users.rb +6 -0
  11. data/vendor/refinerycms/authentication/features/lost_password.feature +1 -0
  12. data/vendor/refinerycms/authentication/features/manage_users.feature +1 -1
  13. data/vendor/refinerycms/authentication/features/step_definitions/lost_password.rb +2 -2
  14. data/vendor/refinerycms/authentication/features/support/factories.rb +1 -0
  15. data/vendor/refinerycms/authentication/spec/models/user_spec.rb +52 -0
  16. data/vendor/refinerycms/core/app/views/admin/_head.html.erb +1 -4
  17. data/vendor/refinerycms/core/app/views/shared/_menu.html.erb +11 -5
  18. data/vendor/refinerycms/core/app/views/shared/_menu_branch.html.erb +8 -8
  19. data/vendor/refinerycms/core/app/views/shared/admin/_make_sortable.html.erb +3 -2
  20. data/vendor/refinerycms/core/app/views/shared/admin/_sortable_list.html.erb +2 -3
  21. data/vendor/refinerycms/core/lib/core.rb +5 -5
  22. data/vendor/refinerycms/core/lib/generators/refinery_engine/refinery_engine_generator.rb +2 -2
  23. data/vendor/refinerycms/core/lib/generators/refinery_engine/templates/app/views/admin/plural_name/index.html.erb +11 -9
  24. data/vendor/refinerycms/core/lib/generators/refinery_engine/templates/db/seeds/plural_name.rb +1 -1
  25. data/vendor/refinerycms/core/lib/generators/refinery_engine/templates/lib/generators/refinerycms_plural_name_generator.rb +3 -3
  26. data/vendor/refinerycms/core/lib/generators/refinery_engine/templates/lib/plural_name.rb +1 -1
  27. data/vendor/refinerycms/core/lib/refinery/crud.rb +48 -28
  28. data/vendor/refinerycms/core/lib/refinery/helpers/menu_helper.rb +34 -4
  29. data/vendor/refinerycms/core/lib/refinery/plugin.rb +5 -5
  30. data/vendor/refinerycms/core/public/javascripts/rails.js +152 -0
  31. data/vendor/refinerycms/core/public/javascripts/refinery/admin.js +33 -13
  32. data/vendor/refinerycms/core/public/javascripts/wymeditor/jquery.refinery.wymeditor.js +191 -175
  33. data/vendor/refinerycms/core/public/stylesheets/refinery/refinery.css +80 -12
  34. data/vendor/refinerycms/dashboard/features/dashboard.feature +3 -1
  35. data/vendor/refinerycms/images/features/support/factories.rb +5 -0
  36. data/vendor/refinerycms/images/lib/images.rb +7 -35
  37. data/vendor/refinerycms/images/spec/models/image_spec.rb +50 -0
  38. data/vendor/refinerycms/images/spec/uploads/beach.jpeg +0 -0
  39. data/vendor/refinerycms/pages/features/manage_pages.feature +1 -1
  40. data/vendor/refinerycms/pages/features/step_definitions/page_steps.rb +19 -3
  41. data/vendor/refinerycms/pages/features/support/paths.rb +9 -1
  42. data/vendor/refinerycms/pages/features/visit_pages.feature +45 -0
  43. data/vendor/refinerycms/pages/spec/models/page_spec.rb +134 -4
  44. data/vendor/refinerycms/refinery.rb +1 -1
  45. data/vendor/refinerycms/resources/features/manage_files.feature +5 -1
  46. data/vendor/refinerycms/resources/features/step_definitions/file_steps.rb +2 -2
  47. data/vendor/refinerycms/resources/lib/resources.rb +8 -37
  48. data/vendor/refinerycms/resources/spec/models/resource_spec.rb +45 -0
  49. data/vendor/refinerycms/resources/spec/uploads/refinery_is_awesome.txt +1 -0
  50. data/vendor/refinerycms/settings/app/models/refinery_setting.rb +26 -12
  51. data/vendor/refinerycms/settings/features/manage_refinery_settings.feature +1 -1
  52. data/vendor/refinerycms/settings/spec/models/refinery_setting_spec.rb +101 -0
  53. metadata +37 -56
  54. data/db/migrate/20091109012126_add_missing_indexes.rb +0 -25
  55. data/db/migrate/20091130040711_add_down_for_maintenance_page.rb +0 -15
  56. data/db/migrate/20091207033335_add_superuser_to_users.rb +0 -12
  57. data/db/migrate/20100114092849_add_themes_table.rb +0 -19
  58. data/db/migrate/20100125003944_rename_title_to_name_on_user_plugins.rb +0 -9
  59. data/db/migrate/20100125033146_migrate_old_plugin_titles_to_plugin_names_for_users.rb +0 -61
  60. data/db/migrate/20100127004649_add_reset_code_to_users.rb +0 -9
  61. data/db/migrate/20100202034802_remove_custom_title_image_id_and_image_id_from_pages.rb +0 -13
  62. data/db/migrate/20100204011654_change_part_titles_to_titleized_version_for_new_format.rb +0 -13
  63. data/db/migrate/20100223211536_remove_themes_table.rb +0 -17
  64. data/db/migrate/20100305023036_change_users_columns_for_authlogic.rb +0 -54
  65. data/db/migrate/20100305023037_remove_unused_users_columns.rb +0 -15
  66. data/db/migrate/20100312155331_make_user_perishable_token_nullable.rb +0 -13
  67. data/db/migrate/20100312160327_make_user_persistence_token_nullable.rb +0 -13
  68. data/db/migrate/20100315203301_remove_state_from_users.rb +0 -9
  69. data/db/migrate/20100419001048_change_image_grid_thumbnail_size_and_regenerate.rb +0 -13
  70. data/db/migrate/20100522020225_rename_permissions_for_resources_plugin_to_files.rb +0 -15
  71. data/db/migrate/20100525084518_remove_take_down_for_maintenance_page.rb +0 -19
  72. data/db/migrate/20100525110237_add_small_and_large_thumbnail_sizes.rb +0 -14
  73. data/db/migrate/20100530205942_update_link_url_on_pages_from_inquiries_new_to_contact.rb +0 -31
  74. data/db/migrate/20100605132138_convert_resource_to_dragonfly.rb +0 -41
  75. data/db/migrate/20100605132208_convert_image_to_dragonfly.rb +0 -51
  76. data/db/migrate/20100606135207_change_thumbnail_sizes_for_dragonfly.rb +0 -17
  77. data/db/migrate/20100608062447_add_scoping_to_refinery_settings.rb +0 -9
  78. data/db/migrate/20100623220402_add_restricted_to_refinery_settings.rb +0 -9
  79. data/db/migrate/20100624024501_add_roles.rb +0 -24
  80. data/db/migrate/20100629081543_add_callback_proc_as_string_to_refinery_settings.rb +0 -9
  81. data/db/migrate/20100701053151_remove_superuser_from_users.rb +0 -20
  82. data/db/migrate/20100702022630_add_spam_to_inquiries.rb +0 -11
  83. data/db/migrate/20100708014636_ensure_user_plugins_use_name_and_not_title.rb +0 -9
  84. data/db/migrate/20100729221735_remove_page_translations_if_present.rb +0 -12
  85. data/db/migrate/20100826232810_move_inquiry_settings_to_refinery_settings.rb +0 -23
  86. data/db/migrate/20100831122919_move_page_to_nested_set.rb +0 -28
  87. data/db/migrate/20100913234704_add_cached_slug_to_pages.rb +0 -12
  88. data/db/seeds/inquiry_settings.rb +0 -2
@@ -756,38 +756,58 @@ var image_dialog = {
756
756
  }
757
757
 
758
758
  var list_reorder = {
759
- init: function() {
759
+ initialised: false
760
+ , init: function() {
760
761
  $('#reorder_action').click(list_reorder.enable_reordering);
761
762
  $('#reorder_action_done').click(list_reorder.disable_reordering);
763
+ if(list_reorder.tree === false) {
764
+ list_reorder.sortable_list.find('li').addClass('no-nest');
765
+ }
762
766
  list_reorder.sortable_list.nestedSortable({
763
767
  disableNesting: 'no-nest',
764
768
  forcePlaceholderSize: true,
765
- handle: 'div',
769
+ handle: list_reorder.tree ? 'div' : null,
766
770
  items: 'li',
767
771
  opacity: .6,
768
772
  placeholder: 'placeholder',
769
773
  tabSize: 25,
770
774
  tolerance: 'pointer',
771
- toleranceElement: '> div',
775
+ toleranceElement: list_reorder.tree ? '> div' : null,
772
776
  disabled: true,
773
777
  start: function () {
774
778
  },
775
779
  change: function () {
776
- list_reorder.reset_branch_classes(this);
780
+ if (list_reorder.tree) {
781
+ list_reorder.reset_branch_classes(this);
782
+ }
777
783
  },
778
784
  stop: function () {
779
- list_reorder.reset_branch_classes(this);
785
+ if (list_reorder.tree) {
786
+ list_reorder.reset_branch_classes(this);
787
+ } else {
788
+ list_reorder.reset_on_off_classes(this);
789
+ }
780
790
  }
781
791
  });
782
- list_reorder.reset_branch_classes(list_reorder.sortable_list);
792
+ if (list_reorder.tree) {
793
+ list_reorder.reset_branch_classes(list_reorder.sortable_list);
794
+ } else {
795
+ list_reorder.reset_on_off_classes(list_reorder.sortable_list);
796
+ }
797
+ this.initialised = true;
798
+ }
799
+ , reset_on_off_classes: function(ul) {
800
+ $("> li", ul).each(function(i, li) {
801
+ $(li).removeClass('on off on-hover').addClass(i % 2 === 0 ? 'on' : 'off');
802
+ });
783
803
  }
784
804
 
785
- ,reset_branch_classes: function (ul) {
805
+ , reset_branch_classes: function (ul) {
786
806
  $("li.ui-sortable-helper", this).removeClass("record").removeClass("branch_start").removeClass("branch_end");
787
807
  $("li", ul).removeClass("branch_start").removeClass("branch_end");
788
808
 
789
- $("> li:first", ul).addClass("branch_start")
790
- $("> li:last", ul).addClass("branch_end")
809
+ $("> li:first", ul).addClass("branch_start");
810
+ $("> li:last", ul).addClass("branch_end");
791
811
 
792
812
  var nested_ul = $("ul", ul);
793
813
  $("> li:last", nested_ul).addClass("branch_end");
@@ -798,7 +818,7 @@ var list_reorder = {
798
818
  $('#sortable_list').addClass("reordering");
799
819
 
800
820
  $('#sortable_list .actions, #site_bar, header > *:not(script)').fadeTo(500, 0.3);
801
- $('#actions *:not("#reorder_action_done, #reorder_action")').not($('#reorder_action_done').parents('li, ul')).fadeTo(500, 0.55);
821
+ $('#actions *:not("#reorder_action_done, #reorder_action")').not($('#reorder_action_done').parents('li, ul, div')).fadeTo(500, 0.55);
802
822
 
803
823
  list_reorder.sortable_list.nestedSortable("enable");
804
824
  $('#reorder_action').hide();
@@ -829,19 +849,19 @@ var list_reorder = {
829
849
 
830
850
  , restore_controls: function(e) {
831
851
  if (list_reorder.tree && !$.browser.msie) {
832
- list_reorder.sortable_list.add(list_reorder.sortable_list.find('ul, li')).draggable('destroy');
852
+ list_reorder.sortable_list.add(list_reorder.sortable_list.find('ul, li, div')).draggable({ disabled: true });
833
853
  } else {
834
854
  $(list_reorder.sortable_list).sortable('destroy');
835
855
  }
836
856
  $(list_reorder.sortable_list).removeClass('reordering, ui-sortable');
837
857
 
838
858
  $('#sortable_list .actions, #site_bar, header > *:not(script)').fadeTo(250, 1);
839
- $('#actions *:not("#reorder_action_done, #reorder_action")').not($('#reorder_action_done').parents('li, ul')).fadeTo(250, 1, function() {
859
+ $('#actions *:not("#reorder_action_done, #reorder_action")').not($('#reorder_action_done').parents('li, ul, div')).fadeTo(250, 1, function() {
840
860
  $('#reorder_action_done').hide().removeClass('loading');
841
861
  $('#reorder_action').show();
842
862
  });
843
863
  }
844
- }
864
+ };
845
865
 
846
866
  var image_picker = {
847
867
  options: {
@@ -26,7 +26,7 @@
26
26
  Namespace: WYMeditor
27
27
  Global WYMeditor namespace.
28
28
  */
29
- if(!WYMeditor) var WYMeditor = {};
29
+ if(!WYMeditor) { var WYMeditor = {}; }
30
30
 
31
31
  //Wrap the Firebug console in WYMeditor.console
32
32
  (function() {
@@ -36,9 +36,9 @@ if(!WYMeditor) var WYMeditor = {};
36
36
 
37
37
  WYMeditor.console = {};
38
38
  for (var i = 0; i < names.length; ++i)
39
- WYMeditor.console[names[i]] = function() {}
39
+ WYMeditor.console[names[i]] = function() {};
40
40
 
41
- } else WYMeditor.console = window.console;
41
+ } else { WYMeditor.console = window.console; }
42
42
  })();
43
43
  $.extend(WYMeditor, {
44
44
 
@@ -268,7 +268,7 @@ $.extend(WYMeditor, {
268
268
  this._html = $(elem).val();
269
269
 
270
270
  //store the HTML option, if any
271
- if(this._options.html) this._html = this._options.html;
271
+ if(this._options.html) { this._html = this._options.html; }
272
272
 
273
273
  //get or compute the base path (where the main JS file is located)
274
274
  this._options.basePath = this._options.basePath || this.computeBasePath();
@@ -674,7 +674,7 @@ WYMeditor.editor.prototype.init = function() {
674
674
 
675
675
  if(WymClass) {
676
676
 
677
- if($.isFunction(this._options.preInit)) this._options.preInit(this);
677
+ if($.isFunction(this._options.preInit)) { this._options.preInit(this); }
678
678
 
679
679
  var SaxListener = new WYMeditor.XhtmlSaxListener();
680
680
  $.extend(SaxListener, WymClass);
@@ -729,7 +729,7 @@ WYMeditor.editor.prototype.init = function() {
729
729
 
730
730
  for(var i = 0; i < aTools.length; i++) {
731
731
  var oTool = aTools[i];
732
- if(oTool.name && oTool.title)
732
+ if(oTool.name && oTool.title) {
733
733
  var sTool = this._options.toolsItemHtml;
734
734
  var sTool = h.replaceAll(sTool, WYMeditor.TOOL_NAME, oTool.name);
735
735
  sTool = h.replaceAll(sTool, WYMeditor.TOOL_TITLE, this._options.stringDelimiterLeft
@@ -737,6 +737,7 @@ WYMeditor.editor.prototype.init = function() {
737
737
  + this._options.stringDelimiterRight);
738
738
  sTool = h.replaceAll(sTool, WYMeditor.TOOL_CLASS, oTool.css);
739
739
  sTools += sTool;
740
+ }
740
741
  }
741
742
 
742
743
  boxHtml = h.replaceAll(boxHtml, WYMeditor.TOOLS_ITEMS, sTools);
@@ -780,7 +781,7 @@ WYMeditor.editor.prototype.init = function() {
780
781
 
781
782
  for(var i = 0; i < aContainers.length; i++) {
782
783
  var oContainer = aContainers[i];
783
- if(oContainer.name && oContainer.title)
784
+ if(oContainer.name && oContainer.title) {
784
785
  var sContainer = this._options.containersItemHtml;
785
786
  sContainer = h.replaceAll(sContainer, WYMeditor.CONTAINER_NAME, oContainer.name);
786
787
  sContainer = h.replaceAll(sContainer, WYMeditor.CONTAINER_TITLE,
@@ -789,6 +790,7 @@ WYMeditor.editor.prototype.init = function() {
789
790
  + this._options.stringDelimiterRight);
790
791
  sContainer = h.replaceAll(sContainer, WYMeditor.CONTAINER_CLASS, oContainer.css);
791
792
  sContainers += sContainer;
793
+ }
792
794
  }
793
795
 
794
796
  boxHtml = h.replaceAll(boxHtml, WYMeditor.CONTAINERS_ITEMS, sContainers);
@@ -849,7 +851,7 @@ WYMeditor.editor.prototype.bindEvents = function() {
849
851
  }
850
852
  });
851
853
 
852
- oClass = {expr: (classRule.rules[indexOf].expr || null)}
854
+ oClass = {expr: (classRule.rules[indexOf].expr || null)};
853
855
  }
854
856
  }
855
857
  });
@@ -896,8 +898,11 @@ WYMeditor.editor.prototype.box = function() {
896
898
  */
897
899
  WYMeditor.editor.prototype.html = function(html) {
898
900
 
899
- if(typeof html === 'string') $(this._doc.body).html(html);
900
- else return($(this._doc.body).html());
901
+ if(typeof html === 'string') {
902
+ $(this._doc.body).html(html);
903
+ } else {
904
+ return($(this._doc.body).html());
905
+ }
901
906
  };
902
907
 
903
908
  /* @name intercept_paste
@@ -910,7 +915,7 @@ WYMeditor.editor.prototype.intercept_paste = function(e) {
910
915
  if (e) {
911
916
  e.preventDefault();
912
917
  }
913
- }
918
+ };
914
919
 
915
920
  /* @name xhtml
916
921
  * @description Cleans up the HTML
@@ -1040,12 +1045,12 @@ WYMeditor.editor.prototype.container = function(sType) {
1040
1045
  var lgt = nodes.length;
1041
1046
  var firstNode = null;
1042
1047
 
1043
- if(lgt > 0) firstNode = nodes.item(0);
1048
+ if(lgt > 0) { firstNode = nodes.item(0); }
1044
1049
  for(var x=0; x<lgt; x++) {
1045
1050
  blockquote.parentNode.insertBefore(nodes.item(0),blockquote);
1046
1051
  }
1047
1052
  blockquote.parentNode.removeChild(blockquote);
1048
- if(firstNode) this.setFocusToNode(firstNode);
1053
+ if(firstNode) { this.setFocusToNode(firstNode); }
1049
1054
  }
1050
1055
  }
1051
1056
 
@@ -1058,7 +1063,7 @@ WYMeditor.editor.prototype.container = function(sType) {
1058
1063
  }
1059
1064
  }
1060
1065
  }
1061
- else return(this.selected());
1066
+ else { return(this.selected()); }
1062
1067
  };
1063
1068
 
1064
1069
  /* @name toggleClass
@@ -1069,7 +1074,7 @@ WYMeditor.editor.prototype.toggleClass = function(sClass, jqexpr) {
1069
1074
  var container = $((this._selected_image ? this._selected_image : this.selected(true)));
1070
1075
  if (jqexpr != null) { container = $(container.parentsOrSelf(jqexpr)); }
1071
1076
  container.toggleClass(sClass);
1072
- if(!container.attr(WYMeditor.CLASS)) container.removeAttr(this._class);
1077
+ if(!container.attr(WYMeditor.CLASS)) { container.removeAttr(this._class); }
1073
1078
 
1074
1079
  };
1075
1080
 
@@ -1082,9 +1087,9 @@ WYMeditor.editor.prototype.removeClass = function(sClass, jqexpr) {
1082
1087
  if (jqexpr != null) { container = $(container.parentsOrSelf(jqexpr)); }
1083
1088
  container.removeClass(sClass);
1084
1089
 
1085
- if(!container.attr(WYMeditor.CLASS)) container.removeAttr(this._class);
1090
+ if(!container.attr(WYMeditor.CLASS)) { container.removeAttr(this._class); }
1086
1091
 
1087
- }
1092
+ };
1088
1093
 
1089
1094
  /* @name findUp
1090
1095
  * @description Returns the first parent or self container, based on its type
@@ -1123,10 +1128,14 @@ WYMeditor.editor.prototype.findUp = function(node, filter) {
1123
1128
  }
1124
1129
  }
1125
1130
 
1126
- if(tagname != WYMeditor.BODY) return(node);
1127
- else return(null);
1128
-
1129
- } else return(null);
1131
+ if(tagname != WYMeditor.BODY) {
1132
+ return(node);
1133
+ } else {
1134
+ return(null);
1135
+ }
1136
+ } else {
1137
+ return(null);
1138
+ }
1130
1139
  };
1131
1140
 
1132
1141
  /* @name switchTo
@@ -1175,7 +1184,7 @@ WYMeditor.editor.prototype.replaceStrings = function(sVal) {
1175
1184
  //replace all the strings in sVal and return it
1176
1185
  $.each(WYMeditor.STRINGS[wym._options.lang], function(key, value) {
1177
1186
  sVal = WYMeditor.Helper.replaceAll(sVal, wym.encloseString(key), value);
1178
- })
1187
+ });
1179
1188
 
1180
1189
  return(sVal);
1181
1190
  };
@@ -1197,36 +1206,58 @@ WYMeditor.editor.prototype.status = function(sMessage) {
1197
1206
  * @description Updates the element and textarea values
1198
1207
  */
1199
1208
  WYMeditor.editor.prototype.update = function() {
1209
+ var wym = this;
1200
1210
 
1201
1211
  // the replace function below makes the HTML source code easier to read when end users need to use this view.
1202
- var html = this.xhtml().replace(/<\/([A-Za-z0-9]*)></g, function(m){return m.split(">").join(">\n")});
1203
- html = html.replace(/src=\"system\/images/g, 'src="/system/images'); // make system/images calls absolute.
1204
- html = html.replace(/(\ ?id=(\"|\')replace_me_with_wym-[0-9]*(\"|\'))/g, ''); // get rid of replace_me_with_wym id tags that were forgotten about.
1205
- html = html.replace(/(\ ?id=(\"|\')last\_paste(\"|\'))/g, '') // get rid of id='last_page' that were forgotten about.
1212
+ var html = wym.xhtml().replace(/<\/([A-Za-z0-9]*)></g, function(m){
1213
+ return m.split(">").join(">\n");
1214
+ });
1215
+
1216
+ // ensure system/images calls become /system/images.
1217
+ html = html.replace(/src=\"system\/images/g, 'src="/system/images');
1218
+
1219
+ // get rid of wym id tags that were forgotten about by replacing them with their content.
1220
+ $(html).find(bad_spans='span[id|=wym], span[id=undefined]').add($(html).filter(bad_spans)).each(function(i, span) {
1221
+ html_to_replace_with = wym.parser.parse($(span).html());
1222
+ html_to_replace = wym.parser.parse($(span).wrap('<div />').parent().html());
1223
+ if($.browser.msie) {
1224
+ // converts <SPAN id=wym-1231231>foo</SPAN> to <SPAN id="wym-1231231">foo</SPAN> (note the quotes)
1225
+ html_to_replace = new RegExp(html_to_replace.replace(/(\ [^\=]+\=)([^\ >]+)/, '$1"$2"'), "ig");
1226
+ }
1227
+ html = html.replace(html_to_replace, html_to_replace_with);
1228
+ });
1206
1229
 
1207
- $(this._element).val(html);
1208
- $(this._box).find(this._options.htmlValSelector).not('.hasfocus').val(html); //#147
1230
+ // get rid of id='last_paste' tags that were forgotten about.
1231
+ html = html.replace(/(\ ?id=(\"|\')last\_paste(\"|\'))/igm, '');
1232
+
1233
+ // get rid of any temporary text-only interpolation tags we have inserted for cursor position.
1234
+ html = html.replace(/[%$]+wym-[^%$]*[%$]+/igm, '');
1235
+
1236
+ // apply changes/
1237
+ $(wym._element).val(html);
1238
+ $(wym._box).find(wym._options.htmlValSelector).not('.hasfocus').val(html); //#147
1209
1239
  };
1210
1240
 
1211
1241
  /* @name dialog
1212
1242
  * @description Opens a dialog box
1213
1243
  */
1214
1244
  WYMeditor.editor.prototype.dialog = function( dialogType ) {
1215
- this.update();
1216
- var path = this._wym._options.dialogPath + dialogType;
1245
+ var wym = this;
1246
+
1247
+ wym.update();
1248
+ var path = this._wym._options.dialogPath + dialogType + '?wymeditor=true';
1217
1249
 
1218
- this._current_unique_stamp = this.uniqueStamp();
1250
+ wym._current_unique_stamp = wym.uniqueStamp();
1219
1251
  // change undo or redo on cancel to true to have this happen when a user closes (cancels) a dialogue
1220
- this._undo_on_cancel = false;
1221
- this._redo_on_cancel = false;
1252
+ wym._undo_on_cancel = false;
1253
+ wym._redo_on_cancel = false;
1222
1254
 
1223
1255
  var selected = this.selected();
1224
1256
  //set to P if parent = BODY unless it's a table going in there.
1225
1257
  if (dialogType != WYMeditor.DIALOG_TABLE) {
1226
- this.format_block();
1258
+ wym.format_block();
1227
1259
  }
1228
1260
 
1229
- var wym = this;
1230
1261
  if (dialogType == WYMeditor.DIALOG_LINK && $.browser.mozilla) {
1231
1262
  selection = wym._iframe.contentWindow.getSelection();
1232
1263
  matches = $($(selected).html().match(new RegExp(selection.anchorNode.textContent + "(.*)" + selection.focusNode.textContent)));
@@ -1240,70 +1271,81 @@ WYMeditor.editor.prototype.dialog = function( dialogType ) {
1240
1271
  {
1241
1272
  selected = possible_match;
1242
1273
  }
1243
- })
1274
+ });
1244
1275
  }
1245
1276
  }
1246
1277
  }
1247
1278
 
1248
- // set up handlers.
1249
- wym = this;
1250
- ajax_loaded_callback = function(){wym.dialog_ajax_callback(selected)}
1279
+ ajax_loaded_callback = function(){wym.dialog_ajax_callback(selected);};
1251
1280
 
1252
- var parent_node = null;
1253
- if (this._selected_image) {
1254
- parent_node = this._selected_image.parentNode;
1255
- }
1256
- else {
1257
- parent_node = selected;
1258
- }
1281
+ var parent_node = wym._selected_image ? wym._selected_image.parentNode : selected;
1282
+ if (typeof(parent_node) != 'undefined' && parent_node !== null) {
1283
+ if (parent_node.tagName.toLowerCase() != WYMeditor.A) {
1284
+ // wrap the current selection with a funky span.
1285
+ if (wym._selected_image == null)
1286
+ {
1287
+ if (selected != null && selected.tagName.toLowerCase() != WYMeditor.A && wym._iframe.contentWindow.getSelection) {
1288
+ // Fixes webkit issue where it would not paste at cursor.
1289
+ selection = wym._iframe.contentWindow.getSelection();
1290
+ if (selection.focusNode.insertData) {
1291
+ // if you highlight backwards, it reverses the order of the anchorNode and focusNode / anchorOffset and focusOffset.
1292
+ // anchorOffset is where you started the selection, focusOffset is where you ended the selection.
1293
+ // So, if you highlight forwards then {anchorOffset}some text{focusOffset}
1294
+ // But, if you highlight backwards then {focusOffset}some text{anchorOffset}
1295
+ if (selection.anchorOffset > selection.focusOffset) {
1296
+ start_node = selection.focusNode;
1297
+ start = selection.focusOffset;
1298
+
1299
+ end_node = selection.anchorNode;
1300
+ end = selection.anchorOffset;
1301
+ } else {
1302
+ start_node = selection.anchorNode;
1303
+ start = selection.anchorOffset;
1259
1304
 
1260
- if ((parent_node != null) && (parent_node.tagName.toLowerCase() != WYMeditor.A))
1261
- {
1262
- // wrap the current selection with a funky span.
1263
- if (this._selected_image == null)
1264
- {
1265
- if (selected != null && selected.tagName.toLowerCase() != WYMeditor.A && wym._iframe.contentWindow.getSelection) {
1266
- // Fixes webkit issue where it would not paste at cursor.
1267
- selection = wym._iframe.contentWindow.getSelection();
1268
- selected_html = $(selected).html().replace('&nbsp;', ' ');
1305
+ end_node = selection.focusNode;
1306
+ end = selection.focusOffset;
1307
+ }
1269
1308
 
1270
- if ((offset = selected_html.indexOf(selection.focusNode.textContent)) == -1) {
1271
- offset = 0;
1272
- }
1273
- focus = offset + selection.focusOffset;
1274
- anchor = offset + selection.anchorOffset;
1275
- length = (focus - anchor);
1276
-
1277
- if (length > 1) {
1278
- new_html = selected_html.substring(0, anchor)
1279
- + "<span id='replace_me_with_" + this._current_unique_stamp + "'>"
1280
- + selected_html.substring(anchor, focus)
1281
- + "</span>"
1282
- + selected_html.substring(focus);
1309
+ // because .insertData only inserts text, we have to insert some 'meaningful' *text* only interpolation tags (no html).
1310
+ start_tag = '%%' + wym._current_unique_stamp + '%%';
1311
+ end_tag = '$$' + wym._current_unique_stamp + '$$';
1312
+
1313
+ // sometimes we may be crossing multiple "nodes" so a simple test for whether this is the case.
1314
+ // this is important, see this example:
1315
+ // some text <a href='/'>with some link</a> and then more text
1316
+ // {start_node}some text {end_start_node}{anotherNode}<a href='/'>with some link</a>{end_anotherNode}{end_node} and then more text{end_end_node}
1317
+ // the "start_node" is a separate node to the end node and therefore we can't treat them as one long node anymore.
1318
+ if (start_node === end_node) {
1319
+ end = end + start_tag.length;
1320
+ }
1321
+
1322
+ // Insert the 'meaningful' text interpolation tags.
1323
+ start_node.insertData(start, start_tag);
1324
+ end_node.insertData(end, end_tag);
1325
+
1326
+ // Now that we can use HTML again, replace the simple text with a span tag.
1327
+ $(selected).html($(selected).html().replace(start_tag, "<span id='" + wym._current_unique_stamp + "'>")
1328
+ .replace(end_tag, "</span>"));
1329
+ } else {
1330
+ wym.wrap("<span id='" + wym._current_unique_stamp + "'>", "</span>");
1331
+ }
1283
1332
  } else {
1284
- new_html = selected_html.substring(0, focus)
1285
- + "<span id='replace_me_with_" + this._current_unique_stamp + "'></span>"
1286
- + selected_html.substring(focus);
1333
+ wym.wrap("<span id='" + wym._current_unique_stamp + "'>", "</span>");
1287
1334
  }
1288
- new_html = new_html.replace(' ', '&nbsp;');
1289
-
1290
- $(selected).html(new_html);
1291
- } else {
1292
- this.wrap("<span id='replace_me_with_" + this._current_unique_stamp + "'>", "</span>");
1293
1335
  }
1294
1336
  }
1295
- }
1296
- else {
1297
- if (!this._selected_image) {
1298
- parent_node._id_before_replaceable = parent_node.id;
1299
- parent_node.id = 'replace_me_with_' + this._current_unique_stamp;
1300
- }
1337
+ else {
1338
+ if (!wym._selected_image) {
1339
+ parent_node._id_before_replaceable = parent_node.id;
1340
+ parent_node.id = '' + this._current_unique_stamp;
1341
+ }
1301
1342
 
1302
- if (dialogType != WYMeditor.DIALOG_PASTE && dialogType != WYMeditor.DIALOG_TABLE) {
1303
- path += path.indexOf("?") == -1 ? "?" : "&";
1304
- port = (window.location.port.length > 0 ? (":" + window.location.port) : "")
1305
- path += "current_link=" + parent_node.href.replace(window.location.protocol + "//" + window.location.hostname + port, "");
1306
- path += "&target_blank=" + (parent_node.target == "_blank" ? "true" : "false");
1343
+ if (dialogType != WYMeditor.DIALOG_PASTE && dialogType != WYMeditor.DIALOG_TABLE) {
1344
+ path += path.indexOf("?") == -1 ? "?" : "&";
1345
+ port = (window.location.port.length > 0 ? (":" + window.location.port) : "");
1346
+ path += "current_link=" + parent_node.href.replace(window.location.protocol + "//" + window.location.hostname + port, "");
1347
+ path += "&target_blank=" + (parent_node.target == "_blank" ? "true" : "false");
1348
+ }
1307
1349
  }
1308
1350
  }
1309
1351
 
@@ -1311,7 +1353,7 @@ WYMeditor.editor.prototype.dialog = function( dialogType ) {
1311
1353
  dialog_title = wym.replaceStrings(wym.encloseString( dialogType ));
1312
1354
  dialog_container = $("<div id='" + wym._options.dialogId + "' class='editor_dialog'></div>");
1313
1355
  switch(dialogType) {
1314
- case WYMeditor.DIALOG_TABLE: {
1356
+ case WYMeditor.DIALOG_TABLE:
1315
1357
  // create and open dialog
1316
1358
  dialog_container.html(wym.replaceStrings(wym._options.dialogTableHtml))
1317
1359
  .dialog($.extend(wym._options.dialogInlineFeatures, {
@@ -1320,8 +1362,7 @@ WYMeditor.editor.prototype.dialog = function( dialogType ) {
1320
1362
 
1321
1363
  ajax_loaded_callback();
1322
1364
  break;
1323
- }
1324
- case WYMeditor.DIALOG_PASTE: {
1365
+ case WYMeditor.DIALOG_PASTE:
1325
1366
  dialog_container.html(wym.replaceStrings(wym._options.dialogPasteHtml))
1326
1367
  .dialog($.extend(wym._options.dialogInlineFeatures, {
1327
1368
  title: dialog_title
@@ -1329,15 +1370,12 @@ WYMeditor.editor.prototype.dialog = function( dialogType ) {
1329
1370
 
1330
1371
  ajax_loaded_callback();
1331
1372
  break;
1332
- }
1333
1373
  default:
1334
- {
1335
1374
  $("<img id='dialog_loading' src='/images/refinery/dialogLoadingAnimation.gif' width='208' height='13' />").appendTo(dialog_container);
1336
1375
  dialog_container.dialog($.extend(wym._options.dialogFeatures, {
1337
1376
  title: dialog_title
1338
1377
  })).load(path, ajax_loaded_callback);
1339
1378
  break;
1340
- }
1341
1379
  }
1342
1380
 
1343
1381
  };
@@ -1380,7 +1418,7 @@ WYMeditor.editor.prototype.paste = function(sData) {
1380
1418
  wym.format_block();
1381
1419
 
1382
1420
  var sTmp;
1383
- replaceable = $(wym._doc.body).find('#replace_me_with_' + wym._current_unique_stamp);
1421
+ replaceable = $(wym._doc.body).find('#' + wym._current_unique_stamp);
1384
1422
 
1385
1423
  // replaceable doesn't actually get replaced here, it's just used as a marker for where the cursor was.
1386
1424
  container = replaceable.get(0) || this.selected();
@@ -1402,11 +1440,11 @@ WYMeditor.editor.prototype.paste = function(sData) {
1402
1440
  // Only if we placed more items after it (aP.length)
1403
1441
  if (aP.length > 1
1404
1442
  && $(container).get(0).tagName.toLowerCase() == "span"
1405
- && $(container).attr('id') == ('replace_me_with_' + wym._current_unique_stamp)
1443
+ && $(container).attr('id') == ('' + wym._current_unique_stamp)
1406
1444
  && $(container).parent().get(0).tagName.toLowerCase() == "p")
1407
1445
  {
1408
1446
  p = $(container).parent();
1409
- matches = p.html().match(new RegExp("([\\s\\S]*)\<span id=[\'|\"]replace_me_with_" + wym._current_unique_stamp + "[\'|\"]\>.*\<\/span\>"));
1447
+ matches = p.html().match(new RegExp("([\\s\\S]*)\<span id=[\'|\"]" + wym._current_unique_stamp + "[\'|\"]\>.*\<\/span\>"));
1410
1448
  sTmp = matches[1] + sTmp + $(container).html();
1411
1449
  p.html(sTmp);
1412
1450
  if (insertedContentAfterBreak != null && insertedContentAfterBreak.length > 0) {
@@ -1425,7 +1463,7 @@ WYMeditor.editor.prototype.paste = function(sData) {
1425
1463
  }
1426
1464
  } else {
1427
1465
  if ((aP.length -1) == x) {
1428
- contentAfterBreak = $(container).parent().html().match(new RegExp("\<span id=[\'|\"]replace_me_with_" + wym._current_unique_stamp + "[\'|\"]\>.*\<\/span\>([\\s\\S]*)"))[1].split('</p>')[0];
1466
+ contentAfterBreak = $(container).parent().html().match(new RegExp("\<span id=[\'|\"]" + wym._current_unique_stamp + "[\'|\"]\>.*\<\/span\>([\\s\\S]*)"))[1].split('</p>')[0];
1429
1467
  sTmp = "<p id='last_paste'>" + sTmp + "</p>";
1430
1468
  } else {
1431
1469
  sTmp = "<p>" + sTmp + "</p>";
@@ -1501,14 +1539,14 @@ WYMeditor.editor.prototype.setFocusToNode = function(node, toStart) {
1501
1539
  selection.addRange(range);
1502
1540
  selection.collapse(node, toStart);
1503
1541
  this._iframe.contentWindow.focus();
1504
- }
1542
+ };
1505
1543
 
1506
1544
  WYMeditor.editor.prototype.addCssRules = function(doc, aCss) {
1507
1545
  var styles = doc.styleSheets[0];
1508
1546
  if(styles) {
1509
1547
  for(var i = 0; i < aCss.length; i++) {
1510
1548
  var oCss = aCss[i];
1511
- if(oCss.name && oCss.css) this.addCssRule(styles, oCss);
1549
+ if(oCss.name && oCss.css) { this.addCssRule(styles, oCss); }
1512
1550
  }
1513
1551
  }
1514
1552
  };
@@ -1517,7 +1555,6 @@ WYMeditor.editor.prototype.format_block = function(selected) {
1517
1555
 
1518
1556
  //'this' should be the wymeditor instance.
1519
1557
  var wym = this;
1520
-
1521
1558
  var container = selected || wym.selected() || $(wym._iframe).contents().find('body').get(0);
1522
1559
  var name = container.tagName.toLowerCase();
1523
1560
 
@@ -1604,8 +1641,8 @@ WYMeditor.editor.prototype.mousedown = function(e) {
1604
1641
  var wym = WYMeditor.INSTANCES[this.ownerDocument.title];
1605
1642
  wym._selected_image = (e.target.tagName.toLowerCase() == WYMeditor.IMG) ? e.target : null;
1606
1643
  $(wym._iframe).contents().find('.selected_by_wym').removeClass('selected_by_wym');
1607
- if (!$.browser.mozilla) $(wym._selected_image).addClass('selected_by_wym');
1608
- if (!$.browser.webkit) e.stopPropagation();
1644
+ if (!$.browser.mozilla) { $(wym._selected_image).addClass('selected_by_wym'); }
1645
+ if (!$.browser.webkit) { e.stopPropagation(); }
1609
1646
  };
1610
1647
 
1611
1648
  /********** SKINS **********/
@@ -1676,13 +1713,13 @@ WYMeditor.INIT_DIALOG = function(wym, selected, isIframe) {
1676
1713
  if (wym._selected_image) {
1677
1714
  var replaceable = $(wym._selected_image);
1678
1715
  } else {
1679
- var replaceable = $(wym._doc.body).find('#replace_me_with_' + wym._current_unique_stamp);
1716
+ var replaceable = $(wym._doc.body).find('#' + wym._current_unique_stamp);
1680
1717
  }
1681
1718
 
1682
1719
  // focus first textarea or input type text element
1683
1720
  dialog.find('input[type=text], textarea').first().focus();
1684
1721
 
1685
- dialog.find(".close_dialog").click(function(e){
1722
+ doc.find('body').addClass('wym_iframe_body').find('#cancel_button').add(dialog.find('.close_dialog')).click(function(e){
1686
1723
  wym.close_dialog(e, true);
1687
1724
  });
1688
1725
 
@@ -1706,11 +1743,9 @@ WYMeditor.INIT_DIALOG = function(wym, selected, isIframe) {
1706
1743
  {
1707
1744
  // ensure some attributes are copied across to the new link.
1708
1745
  link.attr({'style': replaceable.attr('style'), 'class': replaceable.attr('class')});
1709
- replaceable.after(link);
1710
- link.html(replaceable.html());
1711
1746
 
1712
- // now we can get rid of the replaceable element.
1713
- replaceable.remove();
1747
+ link.html(replaceable.html());
1748
+ replaceable.replaceWith($('<div/>').append(link).html());
1714
1749
  }
1715
1750
  else
1716
1751
  {
@@ -1764,7 +1799,13 @@ WYMeditor.INIT_DIALOG = function(wym, selected, isIframe) {
1764
1799
  .attr(WYMeditor.SRC, url)
1765
1800
  .attr(WYMeditor.TITLE, form.find(wym._options.titleSelector).val())
1766
1801
  .attr(WYMeditor.ALT, form.find(wym._options.titleSelector).val())
1767
- .attr(WYMeditor.REL, form.find(wym._options.sizeSelector).val());
1802
+ .attr(WYMeditor.REL, form.find(wym._options.sizeSelector).val())
1803
+ .load(function(e){
1804
+ $(this).attr({
1805
+ 'width': $(this).width()
1806
+ , 'height': $(this).height()
1807
+ });
1808
+ });
1768
1809
 
1769
1810
  if (replaceable != null) {
1770
1811
  replaceable.after(image).remove();
@@ -1816,11 +1857,12 @@ WYMeditor.editor.prototype.close_dialog = function(e, cancelled) {
1816
1857
  if (cancelled)
1817
1858
  {
1818
1859
  // if replaceable exists, replace it with its own html contents.
1819
- if ((span = $(this._doc.body).find('span#replace_me_with_' + this._current_unique_stamp)).length > 0) {
1860
+ if ((span = $(this._doc.body).find('span#' + this._current_unique_stamp)).length > 0) {
1820
1861
  span.parent().html(span.parent().html().replace(new RegExp(["<span(.+?)", span.attr('id'), "(.+?)<\/span>"].join("")), span.html()));
1821
1862
  }
1822
- (remove_id = $(this._doc.body).find('#replace_me_with_' + this._current_unique_stamp)).attr('id', (remove_id.attr('_id_before_replaceable') || ""));
1823
-
1863
+ (remove_id = $(this._doc.body).find('#' + this._current_unique_stamp))
1864
+ .attr('id', (remove_id.attr('_id_before_replaceable') || ""))
1865
+ .replaceWith(remove_id.html());
1824
1866
  if (this._undo_on_cancel == true) {
1825
1867
  this._exec("undo");
1826
1868
  }
@@ -1842,7 +1884,7 @@ WYMeditor.editor.prototype.close_dialog = function(e, cancelled) {
1842
1884
  if (e) {
1843
1885
  e.preventDefault();
1844
1886
  }
1845
- }
1887
+ };
1846
1888
 
1847
1889
  /********** XHTML LEXER/PARSER **********/
1848
1890
 
@@ -4178,6 +4220,25 @@ WYMeditor.WymClassExplorer = function(wym) {
4178
4220
 
4179
4221
  };
4180
4222
 
4223
+ WYMeditor.WymClassExplorer.prototype.format_block = function(selected) {
4224
+
4225
+ //'this' should be the wymeditor instance.
4226
+ var wym = this;
4227
+ var container = selected || wym.selected() || $(wym._iframe).contents().find('body').get(0);
4228
+ var name = container.tagName.toLowerCase();
4229
+
4230
+ //fix forbidden main containers
4231
+ if($.inArray(name, ['strong', 'b', 'em', 'i', 'sub', 'sup', 'a']) > -1) {
4232
+ name = container.parentNode.tagName.toLowerCase();
4233
+ }
4234
+
4235
+ if(name == WYMeditor.BODY) {
4236
+ wym._selected_image = null;
4237
+ $(wym._iframe).contents().find('.selected_by_wym').removeClass('selected_by_wym');
4238
+ wym._exec(WYMeditor.FORMAT_BLOCK, "<" + WYMeditor.P + ">");
4239
+ }
4240
+ };
4241
+
4181
4242
  WYMeditor.WymClassExplorer.prototype.initIframe = function(iframe) {
4182
4243
 
4183
4244
  //This function is executed twice, though it is called once!
@@ -4340,13 +4401,16 @@ WYMeditor.WymClassExplorer.prototype.unwrap = function() {
4340
4401
  };
4341
4402
 
4342
4403
  //keyup handler
4343
- WYMeditor.WymClassExplorer.prototype.keyup = function() {
4344
- this._selected_image = null;
4345
- $(this._iframe).contents().find('.selected_by_wym').removeClass('selected_by_wym');
4404
+ WYMeditor.WymClassExplorer.prototype.keyup = function(e) {
4405
+
4406
+ (wym = this)._selected_image = null;
4407
+ $(wym._iframe).contents().find('.selected_by_wym').removeClass('selected_by_wym');
4408
+ wym.format_block();
4346
4409
  };
4347
4410
 
4348
4411
  WYMeditor.WymClassExplorer.prototype.setFocusToNode = function(node, toStart) {
4349
- var range = this._doc.selection.createRange();
4412
+ (wym = this)._iframe.contentWindow.focus();
4413
+ var range = wym._doc.selection.createRange();
4350
4414
  toStart = toStart ? true : false;
4351
4415
 
4352
4416
  range.moveToElementText(node);
@@ -4832,54 +4896,6 @@ WYMeditor.WymClassSafari.prototype.initIframe = function(iframe) {
4832
4896
  this.listen();
4833
4897
  };
4834
4898
 
4835
- WYMeditor.WymClassSafari.prototype.paste = function(sData) {
4836
-
4837
- (wym = this).format_block();
4838
- replaceable = $(wym._doc.body).find('#replace_me_with_' + wym._current_unique_stamp);
4839
-
4840
- // replaceable doesn't actually get replaced here, it's just used as a marker for where the cursor was.
4841
- var container = replaceable.get(0) || this.selected();
4842
-
4843
- //split the data, using double newlines as the separator
4844
- var aP = sData.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;")
4845
- .split(wym._newLine + wym._newLine);
4846
- var rExp = new RegExp(wym._newLine, "g");
4847
-
4848
- //add a P for each item
4849
- var sTmp;
4850
- if(container && container.tagName.toLowerCase() != WYMeditor.BODY) {
4851
- for(x = aP.length - 1; x >= 0; x--) {
4852
- sTmp = aP[x];
4853
- //simple newlines are replaced by a break
4854
- sTmp = sTmp.replace(rExp, "<br />");
4855
- if (x == 0 && $(container).html().replace(/<br\ ?\/?>/, "").length == 0) {
4856
- $(container).html(sTmp);
4857
- }
4858
- else {
4859
- $(container).after("<p>" + sTmp + "</p>");
4860
- }
4861
- }
4862
- }
4863
-
4864
- else {
4865
- for(x = 0; x < aP.length; x++) {
4866
- sTmp = aP[x];
4867
- //simple newlines are replaced by a break
4868
- sTmp = sTmp.replace(rExp, "<br />");
4869
- if (x == 0 && $(container).html().replace(/<br\ ?\/?>/, "").length == 0) {
4870
- $(container).html(sTmp);
4871
- } else {
4872
- $(wym._doc.body).append("<p>" + sTmp + "</p>");
4873
- }
4874
- }
4875
- }
4876
-
4877
- if (replaceable.get(0) != null) {
4878
- // set the id of the container back.
4879
- replaceable.get(0).id = replaceable.get(0)._id_before_replaceable;
4880
- }
4881
- };
4882
-
4883
4899
  WYMeditor.WymClassSafari.prototype._exec = function(cmd,param) {
4884
4900
 
4885
4901
  if(!this.selected()) return(false);
@@ -4964,9 +4980,9 @@ WYMeditor.WymClassSafari.prototype.selected = function(upgrade_text_nodes) {
4964
4980
  return node.parentNode;
4965
4981
  }
4966
4982
  }
4967
- else return(node);
4983
+ else { return(node); }
4968
4984
  }
4969
- else return(null);
4985
+ else { return(null); }
4970
4986
  };
4971
4987
 
4972
4988
  /* @name toggleClass
@@ -5046,15 +5062,15 @@ WYMeditor.WymClassSafari.prototype.keyup = function(e) {
5046
5062
  //text nodes replaced by P
5047
5063
 
5048
5064
  container = wym.selected();
5049
- var name = container.tagName.toLowerCase();
5050
-
5051
- //fix forbidden main containers
5052
- if($.inArray(name, ['strong', 'b', 'em', 'i', 'sub', 'sup', 'a', 'span']) > -1) {
5053
- name = container.parentNode.tagName.toLowerCase();
5054
- }
5065
+ if (container && (name = container.tagName.toLowerCase())) {
5066
+ //fix forbidden main containers
5067
+ if($.inArray(name, ['strong', 'b', 'em', 'i', 'sub', 'sup', 'a', 'span']) > -1) {
5068
+ name = container.parentNode.tagName.toLowerCase();
5069
+ }
5055
5070
 
5056
- if(name == WYMeditor.BODY || name == WYMeditor.DIV) {
5057
- wym._exec(WYMeditor.FORMAT_BLOCK, WYMeditor.P); //fix #110 for DIV
5071
+ if(name == WYMeditor.BODY || name == WYMeditor.DIV) {
5072
+ wym._exec(WYMeditor.FORMAT_BLOCK, WYMeditor.P); //fix #110 for DIV
5073
+ }
5058
5074
  }
5059
5075
  }
5060
5076
  };