tinymce_rails 3.4.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/README.md +14 -0
- data/Rakefile +1 -0
- data/lib/tinymce_rails.rb +11 -0
- data/lib/tinymce_rails/version.rb +3 -0
- data/tinymce_rails.gemspec +24 -0
- data/vendor/assets/javascripts/tiny_mce/jquery.tinymce.js +1 -0
- data/vendor/assets/javascripts/tiny_mce/langs/en.js +218 -0
- data/vendor/assets/javascripts/tiny_mce/license.txt +504 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/advhr/css/advhr.css +5 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/advhr/editor_plugin.js +1 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/advhr/editor_plugin_src.js +57 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/advhr/js/rule.js +43 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/advhr/langs/en_dlg.js +7 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/advhr/rule.htm +58 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/advimage/css/advimage.css +13 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/advimage/editor_plugin.js +1 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/advimage/editor_plugin_src.js +50 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/advimage/image.htm +235 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/advimage/img/sample.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/advimage/js/image.js +445 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/advimage/langs/en_dlg.js +45 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/advlink/css/advlink.css +8 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/advlink/editor_plugin.js +1 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/advlink/editor_plugin_src.js +61 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/advlink/js/advlink.js +528 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/advlink/langs/en_dlg.js +54 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/advlink/link.htm +338 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/advlist/editor_plugin.js +1 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/advlist/editor_plugin_src.js +154 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/autolink/editor_plugin.js +1 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/autolink/editor_plugin_src.js +156 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/autoresize/editor_plugin.js +1 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/autoresize/editor_plugin_src.js +119 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/autosave/editor_plugin.js +1 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/autosave/editor_plugin_src.js +422 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/autosave/langs/en.js +4 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/bbcode/editor_plugin.js +1 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/bbcode/editor_plugin_src.js +120 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/contextmenu/editor_plugin.js +1 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/contextmenu/editor_plugin_src.js +156 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/directionality/editor_plugin.js +1 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/directionality/editor_plugin_src.js +82 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/emotions/editor_plugin.js +1 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/emotions/editor_plugin_src.js +43 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/emotions/emotions.htm +41 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-cool.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-cry.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-embarassed.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-foot-in-mouth.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-frown.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-innocent.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-kiss.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-laughing.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-money-mouth.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-sealed.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-smile.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-surprised.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-tongue-out.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-undecided.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-wink.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/emotions/img/smiley-yell.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/emotions/js/emotions.js +22 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/emotions/langs/en_dlg.js +20 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/example/dialog.htm +22 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/example/editor_plugin.js +1 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/example/editor_plugin_src.js +84 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/example/img/example.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/example/js/dialog.js +19 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/example/langs/en.js +3 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/example/langs/en_dlg.js +3 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/fullpage/css/fullpage.css +182 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/fullpage/editor_plugin.js +1 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/fullpage/editor_plugin_src.js +182 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/fullpage/fullpage.htm +571 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/fullpage/js/fullpage.js +471 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/fullpage/langs/en_dlg.js +85 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/fullscreen/editor_plugin.js +1 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/fullscreen/editor_plugin_src.js +151 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/fullscreen/fullscreen.htm +109 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/iespell/editor_plugin.js +1 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/iespell/editor_plugin_src.js +54 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/inlinepopups/editor_plugin.js +1 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/inlinepopups/editor_plugin_src.js +696 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/button.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/window.css +100 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/inlinepopups/template.htm +387 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/insertdatetime/editor_plugin.js +1 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/insertdatetime/editor_plugin_src.js +83 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/layer/editor_plugin.js +1 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/layer/editor_plugin_src.js +212 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/legacyoutput/editor_plugin.js +1 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/legacyoutput/editor_plugin_src.js +136 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/lists/editor_plugin.js +1 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/lists/editor_plugin_src.js +617 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/media/css/content.css +6 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/media/css/media.css +16 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/media/editor_plugin.js +1 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/media/editor_plugin_src.js +414 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/media/img/flash.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/media/img/flv_player.swf +0 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/media/img/quicktime.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/media/img/realmedia.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/media/img/shockwave.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/media/img/trans.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/media/img/windowsmedia.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/media/js/embed.js +73 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/media/js/media.js +630 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/media/langs/en_dlg.js +103 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/media/media.htm +818 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/nonbreaking/editor_plugin.js +1 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/nonbreaking/editor_plugin_src.js +53 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/noneditable/editor_plugin.js +1 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/noneditable/editor_plugin_src.js +90 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/pagebreak/css/content.css +1 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/pagebreak/editor_plugin.js +1 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/pagebreak/editor_plugin_src.js +77 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/pagebreak/img/pagebreak.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/pagebreak/img/trans.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/paste/editor_plugin.js +1 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/paste/editor_plugin_src.js +1035 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/paste/js/pastetext.js +36 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/paste/js/pasteword.js +51 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/paste/langs/en_dlg.js +5 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/paste/pastetext.htm +27 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/paste/pasteword.htm +21 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/preview/editor_plugin.js +1 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/preview/editor_plugin_src.js +53 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/preview/example.html +28 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/preview/jscripts/embed.js +73 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/preview/preview.html +17 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/print/editor_plugin.js +1 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/print/editor_plugin_src.js +34 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/save/editor_plugin.js +1 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/save/editor_plugin_src.js +101 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/searchreplace/css/searchreplace.css +6 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/searchreplace/editor_plugin.js +1 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/searchreplace/editor_plugin_src.js +57 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/searchreplace/js/searchreplace.js +140 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/searchreplace/langs/en_dlg.js +16 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/searchreplace/searchreplace.htm +100 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/spellchecker/css/content.css +1 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/spellchecker/editor_plugin.js +1 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/spellchecker/editor_plugin_src.js +417 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/spellchecker/img/wline.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/style/css/props.css +13 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/style/editor_plugin.js +1 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/style/editor_plugin_src.js +55 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/style/js/props.js +641 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/style/langs/en_dlg.js +70 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/style/props.htm +838 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/tabfocus/editor_plugin.js +1 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/tabfocus/editor_plugin_src.js +114 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/table/cell.htm +178 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/table/css/cell.css +17 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/table/css/row.css +25 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/table/css/table.css +13 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/table/editor_plugin.js +1 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/table/editor_plugin_src.js +1139 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/table/js/cell.js +286 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/table/js/merge_cells.js +27 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/table/js/row.js +237 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/table/js/table.js +454 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/table/langs/en_dlg.js +74 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/table/merge_cells.htm +32 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/table/row.htm +157 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/table/table.htm +188 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/template/blank.htm +12 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/template/css/template.css +23 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/template/editor_plugin.js +1 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/template/editor_plugin_src.js +159 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/template/js/template.js +106 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/template/langs/en_dlg.js +15 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/template/template.htm +31 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/visualchars/editor_plugin.js +1 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/visualchars/editor_plugin_src.js +83 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/wordcount/editor_plugin.js +1 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/wordcount/editor_plugin_src.js +98 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/xhtmlxtras/abbr.htm +142 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/xhtmlxtras/acronym.htm +142 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/xhtmlxtras/attributes.htm +149 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/xhtmlxtras/cite.htm +142 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/xhtmlxtras/css/attributes.css +11 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/xhtmlxtras/css/popup.css +9 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/xhtmlxtras/del.htm +162 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/xhtmlxtras/editor_plugin.js +1 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/xhtmlxtras/editor_plugin_src.js +132 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/xhtmlxtras/ins.htm +162 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/xhtmlxtras/js/abbr.js +28 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/xhtmlxtras/js/acronym.js +28 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/xhtmlxtras/js/attributes.js +126 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/xhtmlxtras/js/cite.js +28 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/xhtmlxtras/js/del.js +53 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/xhtmlxtras/js/element_common.js +231 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/xhtmlxtras/js/ins.js +52 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/xhtmlxtras/langs/en_dlg.js +32 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/about.htm +48 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/anchor.htm +26 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/charmap.htm +53 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/color_picker.htm +74 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/editor_template.js +1 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/editor_template_src.js +1326 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/image.htm +80 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/img/colorpicker.jpg +0 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/img/icons.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/js/about.js +73 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/js/anchor.js +37 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/js/charmap.js +353 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/js/color_picker.js +329 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/js/image.js +247 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/js/link.js +156 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/js/source_editor.js +56 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/langs/en.js +68 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/langs/en_dlg.js +53 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/link.htm +58 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/shortcuts.htm +47 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/default/content.css +37 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/default/dialog.css +117 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/default/img/buttons.png +0 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/default/img/items.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/default/img/menu_arrow.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/default/img/menu_check.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/default/img/progress.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/default/img/tabs.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/default/ui.css +213 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/highcontrast/content.css +23 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/highcontrast/dialog.css +105 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/highcontrast/ui.css +101 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/o2k7/content.css +36 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/o2k7/dialog.css +116 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg.png +0 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_black.png +0 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_silver.png +0 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/o2k7/ui.css +215 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/o2k7/ui_black.css +8 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/o2k7/ui_silver.css +5 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/source_editor.htm +25 -0
- data/vendor/assets/javascripts/tiny_mce/themes/simple/editor_template.js +1 -0
- data/vendor/assets/javascripts/tiny_mce/themes/simple/editor_template_src.js +85 -0
- data/vendor/assets/javascripts/tiny_mce/themes/simple/img/icons.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/themes/simple/langs/en.js +11 -0
- data/vendor/assets/javascripts/tiny_mce/themes/simple/skins/default/content.css +25 -0
- data/vendor/assets/javascripts/tiny_mce/themes/simple/skins/default/ui.css +32 -0
- data/vendor/assets/javascripts/tiny_mce/themes/simple/skins/o2k7/content.css +17 -0
- data/vendor/assets/javascripts/tiny_mce/themes/simple/skins/o2k7/img/button_bg.png +0 -0
- data/vendor/assets/javascripts/tiny_mce/themes/simple/skins/o2k7/ui.css +35 -0
- data/vendor/assets/javascripts/tiny_mce/tiny_mce.js +1 -0
- data/vendor/assets/javascripts/tiny_mce/tiny_mce_popup.js +5 -0
- data/vendor/assets/javascripts/tiny_mce/tiny_mce_src.js +13913 -0
- data/vendor/assets/javascripts/tiny_mce/utils/editable_selects.js +70 -0
- data/vendor/assets/javascripts/tiny_mce/utils/form_utils.js +206 -0
- data/vendor/assets/javascripts/tiny_mce/utils/mctabs.js +151 -0
- data/vendor/assets/javascripts/tiny_mce/utils/validate.js +252 -0
- metadata +305 -0
@@ -0,0 +1 @@
|
|
1
|
+
(function(){tinymce.create("tinymce.plugins.Nonbreaking",{init:function(a,b){var c=this;c.editor=a;a.addCommand("mceNonBreaking",function(){a.execCommand("mceInsertContent",false,(a.plugins.visualchars&&a.plugins.visualchars.state)?'<span _mce_bogus="1" class="mceItemHidden mceItemNbsp"> </span>':" ")});a.addButton("nonbreaking",{title:"nonbreaking.nonbreaking_desc",cmd:"mceNonBreaking"});if(a.getParam("nonbreaking_force_tab")){a.onKeyDown.add(function(d,f){if(tinymce.isIE&&f.keyCode==9){d.execCommand("mceNonBreaking");d.execCommand("mceNonBreaking");d.execCommand("mceNonBreaking");tinymce.dom.Event.cancel(f)}})}},getInfo:function(){return{longname:"Nonbreaking space",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/nonbreaking",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("nonbreaking",tinymce.plugins.Nonbreaking)})();
|
@@ -0,0 +1,53 @@
|
|
1
|
+
/**
|
2
|
+
* editor_plugin_src.js
|
3
|
+
*
|
4
|
+
* Copyright 2009, 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
|
+
tinymce.create('tinymce.plugins.Nonbreaking', {
|
13
|
+
init : function(ed, url) {
|
14
|
+
var t = this;
|
15
|
+
|
16
|
+
t.editor = ed;
|
17
|
+
|
18
|
+
// Register commands
|
19
|
+
ed.addCommand('mceNonBreaking', function() {
|
20
|
+
ed.execCommand('mceInsertContent', false, (ed.plugins.visualchars && ed.plugins.visualchars.state) ? '<span _mce_bogus="1" class="mceItemHidden mceItemNbsp"> </span>' : ' ');
|
21
|
+
});
|
22
|
+
|
23
|
+
// Register buttons
|
24
|
+
ed.addButton('nonbreaking', {title : 'nonbreaking.nonbreaking_desc', cmd : 'mceNonBreaking'});
|
25
|
+
|
26
|
+
if (ed.getParam('nonbreaking_force_tab')) {
|
27
|
+
ed.onKeyDown.add(function(ed, e) {
|
28
|
+
if (tinymce.isIE && e.keyCode == 9) {
|
29
|
+
ed.execCommand('mceNonBreaking');
|
30
|
+
ed.execCommand('mceNonBreaking');
|
31
|
+
ed.execCommand('mceNonBreaking');
|
32
|
+
tinymce.dom.Event.cancel(e);
|
33
|
+
}
|
34
|
+
});
|
35
|
+
}
|
36
|
+
},
|
37
|
+
|
38
|
+
getInfo : function() {
|
39
|
+
return {
|
40
|
+
longname : 'Nonbreaking space',
|
41
|
+
author : 'Moxiecode Systems AB',
|
42
|
+
authorurl : 'http://tinymce.moxiecode.com',
|
43
|
+
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/nonbreaking',
|
44
|
+
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
45
|
+
};
|
46
|
+
}
|
47
|
+
|
48
|
+
// Private methods
|
49
|
+
});
|
50
|
+
|
51
|
+
// Register plugin
|
52
|
+
tinymce.PluginManager.add('nonbreaking', tinymce.plugins.Nonbreaking);
|
53
|
+
})();
|
@@ -0,0 +1 @@
|
|
1
|
+
(function(){var a=tinymce.dom.Event;tinymce.create("tinymce.plugins.NonEditablePlugin",{init:function(d,e){var f=this,c,b;f.editor=d;c=d.getParam("noneditable_editable_class","mceEditable");b=d.getParam("noneditable_noneditable_class","mceNonEditable");d.onNodeChange.addToTop(function(h,g,k){var j,i;j=h.dom.getParent(h.selection.getStart(),function(l){return h.dom.hasClass(l,b)});i=h.dom.getParent(h.selection.getEnd(),function(l){return h.dom.hasClass(l,b)});if(j||i){f._setDisabled(1);return false}else{f._setDisabled(0)}})},getInfo:function(){return{longname:"Non editable elements",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/noneditable",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_block:function(c,d){var b=d.keyCode;if((b>32&&b<41)||(b>111&&b<124)){return}return a.cancel(d)},_setDisabled:function(d){var c=this,b=c.editor;tinymce.each(b.controlManager.controls,function(e){e.setDisabled(d)});if(d!==c.disabled){if(d){b.onKeyDown.addToTop(c._block);b.onKeyPress.addToTop(c._block);b.onKeyUp.addToTop(c._block);b.onPaste.addToTop(c._block)}else{b.onKeyDown.remove(c._block);b.onKeyPress.remove(c._block);b.onKeyUp.remove(c._block);b.onPaste.remove(c._block)}c.disabled=d}}});tinymce.PluginManager.add("noneditable",tinymce.plugins.NonEditablePlugin)})();
|
@@ -0,0 +1,90 @@
|
|
1
|
+
/**
|
2
|
+
* editor_plugin_src.js
|
3
|
+
*
|
4
|
+
* Copyright 2009, 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 Event = tinymce.dom.Event;
|
13
|
+
|
14
|
+
tinymce.create('tinymce.plugins.NonEditablePlugin', {
|
15
|
+
init : function(ed, url) {
|
16
|
+
var t = this, editClass, nonEditClass;
|
17
|
+
|
18
|
+
t.editor = ed;
|
19
|
+
editClass = ed.getParam("noneditable_editable_class", "mceEditable");
|
20
|
+
nonEditClass = ed.getParam("noneditable_noneditable_class", "mceNonEditable");
|
21
|
+
|
22
|
+
ed.onNodeChange.addToTop(function(ed, cm, n) {
|
23
|
+
var sc, ec;
|
24
|
+
|
25
|
+
// Block if start or end is inside a non editable element
|
26
|
+
sc = ed.dom.getParent(ed.selection.getStart(), function(n) {
|
27
|
+
return ed.dom.hasClass(n, nonEditClass);
|
28
|
+
});
|
29
|
+
|
30
|
+
ec = ed.dom.getParent(ed.selection.getEnd(), function(n) {
|
31
|
+
return ed.dom.hasClass(n, nonEditClass);
|
32
|
+
});
|
33
|
+
|
34
|
+
// Block or unblock
|
35
|
+
if (sc || ec) {
|
36
|
+
t._setDisabled(1);
|
37
|
+
return false;
|
38
|
+
} else
|
39
|
+
t._setDisabled(0);
|
40
|
+
});
|
41
|
+
},
|
42
|
+
|
43
|
+
getInfo : function() {
|
44
|
+
return {
|
45
|
+
longname : 'Non editable elements',
|
46
|
+
author : 'Moxiecode Systems AB',
|
47
|
+
authorurl : 'http://tinymce.moxiecode.com',
|
48
|
+
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/noneditable',
|
49
|
+
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
50
|
+
};
|
51
|
+
},
|
52
|
+
|
53
|
+
_block : function(ed, e) {
|
54
|
+
var k = e.keyCode;
|
55
|
+
|
56
|
+
// Don't block arrow keys, pg up/down, and F1-F12
|
57
|
+
if ((k > 32 && k < 41) || (k > 111 && k < 124))
|
58
|
+
return;
|
59
|
+
|
60
|
+
return Event.cancel(e);
|
61
|
+
},
|
62
|
+
|
63
|
+
_setDisabled : function(s) {
|
64
|
+
var t = this, ed = t.editor;
|
65
|
+
|
66
|
+
tinymce.each(ed.controlManager.controls, function(c) {
|
67
|
+
c.setDisabled(s);
|
68
|
+
});
|
69
|
+
|
70
|
+
if (s !== t.disabled) {
|
71
|
+
if (s) {
|
72
|
+
ed.onKeyDown.addToTop(t._block);
|
73
|
+
ed.onKeyPress.addToTop(t._block);
|
74
|
+
ed.onKeyUp.addToTop(t._block);
|
75
|
+
ed.onPaste.addToTop(t._block);
|
76
|
+
} else {
|
77
|
+
ed.onKeyDown.remove(t._block);
|
78
|
+
ed.onKeyPress.remove(t._block);
|
79
|
+
ed.onKeyUp.remove(t._block);
|
80
|
+
ed.onPaste.remove(t._block);
|
81
|
+
}
|
82
|
+
|
83
|
+
t.disabled = s;
|
84
|
+
}
|
85
|
+
}
|
86
|
+
});
|
87
|
+
|
88
|
+
// Register plugin
|
89
|
+
tinymce.PluginManager.add('noneditable', tinymce.plugins.NonEditablePlugin);
|
90
|
+
})();
|
@@ -0,0 +1 @@
|
|
1
|
+
.mcePageBreak {display:block;border:0;width:100%;height:12px;border-top:1px dotted #ccc;margin-top:15px;background:#fff url(../img/pagebreak.gif) no-repeat center top;}
|
@@ -0,0 +1 @@
|
|
1
|
+
(function(){tinymce.create("tinymce.plugins.PageBreakPlugin",{init:function(b,d){var f='<img src="'+d+'/img/trans.gif" class="mcePageBreak mceItemNoResize" />',a="mcePageBreak",c=b.getParam("pagebreak_separator","<!-- pagebreak -->"),e;e=new RegExp(c.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g,function(g){return"\\"+g}),"g");b.addCommand("mcePageBreak",function(){b.execCommand("mceInsertContent",0,f)});b.addButton("pagebreak",{title:"pagebreak.desc",cmd:a});b.onInit.add(function(){if(b.settings.content_css!==false){b.dom.loadCSS(d+"/css/content.css")}if(b.theme.onResolveName){b.theme.onResolveName.add(function(g,h){if(h.node.nodeName=="IMG"&&b.dom.hasClass(h.node,a)){h.name="pagebreak"}})}});b.onClick.add(function(g,h){h=h.target;if(h.nodeName==="IMG"&&g.dom.hasClass(h,a)){g.selection.select(h)}});b.onNodeChange.add(function(h,g,i){g.setActive("pagebreak",i.nodeName==="IMG"&&h.dom.hasClass(i,a))});b.onBeforeSetContent.add(function(g,h){h.content=h.content.replace(e,f)});b.onPostProcess.add(function(g,h){if(h.get){h.content=h.content.replace(/<img[^>]+>/g,function(i){if(i.indexOf('class="mcePageBreak')!==-1){i=c}return i})}})},getInfo:function(){return{longname:"PageBreak",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/pagebreak",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("pagebreak",tinymce.plugins.PageBreakPlugin)})();
|
@@ -0,0 +1,77 @@
|
|
1
|
+
/**
|
2
|
+
* editor_plugin_src.js
|
3
|
+
*
|
4
|
+
* Copyright 2009, 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
|
+
tinymce.create('tinymce.plugins.PageBreakPlugin', {
|
13
|
+
init : function(ed, url) {
|
14
|
+
var pb = '<img src="' + url + '/img/trans.gif" class="mcePageBreak mceItemNoResize" />', cls = 'mcePageBreak', sep = ed.getParam('pagebreak_separator', '<!-- pagebreak -->'), pbRE;
|
15
|
+
|
16
|
+
pbRE = new RegExp(sep.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g, function(a) {return '\\' + a;}), 'g');
|
17
|
+
|
18
|
+
// Register commands
|
19
|
+
ed.addCommand('mcePageBreak', function() {
|
20
|
+
ed.execCommand('mceInsertContent', 0, pb);
|
21
|
+
});
|
22
|
+
|
23
|
+
// Register buttons
|
24
|
+
ed.addButton('pagebreak', {title : 'pagebreak.desc', cmd : cls});
|
25
|
+
|
26
|
+
ed.onInit.add(function() {
|
27
|
+
if (ed.settings.content_css !== false)
|
28
|
+
ed.dom.loadCSS(url + "/css/content.css");
|
29
|
+
|
30
|
+
if (ed.theme.onResolveName) {
|
31
|
+
ed.theme.onResolveName.add(function(th, o) {
|
32
|
+
if (o.node.nodeName == 'IMG' && ed.dom.hasClass(o.node, cls))
|
33
|
+
o.name = 'pagebreak';
|
34
|
+
});
|
35
|
+
}
|
36
|
+
});
|
37
|
+
|
38
|
+
ed.onClick.add(function(ed, e) {
|
39
|
+
e = e.target;
|
40
|
+
|
41
|
+
if (e.nodeName === 'IMG' && ed.dom.hasClass(e, cls))
|
42
|
+
ed.selection.select(e);
|
43
|
+
});
|
44
|
+
|
45
|
+
ed.onNodeChange.add(function(ed, cm, n) {
|
46
|
+
cm.setActive('pagebreak', n.nodeName === 'IMG' && ed.dom.hasClass(n, cls));
|
47
|
+
});
|
48
|
+
|
49
|
+
ed.onBeforeSetContent.add(function(ed, o) {
|
50
|
+
o.content = o.content.replace(pbRE, pb);
|
51
|
+
});
|
52
|
+
|
53
|
+
ed.onPostProcess.add(function(ed, o) {
|
54
|
+
if (o.get)
|
55
|
+
o.content = o.content.replace(/<img[^>]+>/g, function(im) {
|
56
|
+
if (im.indexOf('class="mcePageBreak') !== -1)
|
57
|
+
im = sep;
|
58
|
+
|
59
|
+
return im;
|
60
|
+
});
|
61
|
+
});
|
62
|
+
},
|
63
|
+
|
64
|
+
getInfo : function() {
|
65
|
+
return {
|
66
|
+
longname : 'PageBreak',
|
67
|
+
author : 'Moxiecode Systems AB',
|
68
|
+
authorurl : 'http://tinymce.moxiecode.com',
|
69
|
+
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/pagebreak',
|
70
|
+
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
71
|
+
};
|
72
|
+
}
|
73
|
+
});
|
74
|
+
|
75
|
+
// Register plugin
|
76
|
+
tinymce.PluginManager.add('pagebreak', tinymce.plugins.PageBreakPlugin);
|
77
|
+
})();
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
(function(){var c=tinymce.each,d=null,a={paste_auto_cleanup_on_paste:true,paste_enable_default_filters:true,paste_block_drop:false,paste_retain_style_properties:"none",paste_strip_class_attributes:"mso",paste_remove_spans:false,paste_remove_styles:false,paste_remove_styles_if_webkit:true,paste_convert_middot_lists:true,paste_convert_headers_to_strong:false,paste_dialog_width:"450",paste_dialog_height:"400",paste_text_use_dialog:false,paste_text_sticky:false,paste_text_sticky_default:false,paste_text_notifyalways:false,paste_text_linebreaktype:"p",paste_text_replacements:[[/\u2026/g,"..."],[/[\x93\x94\u201c\u201d]/g,'"'],[/[\x60\x91\x92\u2018\u2019]/g,"'"]]};function b(e,f){return e.getParam(f,a[f])}tinymce.create("tinymce.plugins.PastePlugin",{init:function(e,f){var g=this;g.editor=e;g.url=f;g.onPreProcess=new tinymce.util.Dispatcher(g);g.onPostProcess=new tinymce.util.Dispatcher(g);g.onPreProcess.add(g._preProcess);g.onPostProcess.add(g._postProcess);g.onPreProcess.add(function(j,k){e.execCallback("paste_preprocess",j,k)});g.onPostProcess.add(function(j,k){e.execCallback("paste_postprocess",j,k)});e.onKeyDown.addToTop(function(j,k){if(((tinymce.isMac?k.metaKey:k.ctrlKey)&&k.keyCode==86)||(k.shiftKey&&k.keyCode==45)){return false}});e.pasteAsPlainText=b(e,"paste_text_sticky_default");function i(n,l){var m=e.dom,j,k;g.onPreProcess.dispatch(g,n);n.node=m.create("div",0,n.content);if(tinymce.isGecko){j=e.selection.getRng(true);if(j.startContainer==j.endContainer&&j.startContainer.nodeType==3){k=m.select("p,h1,h2,h3,h4,h5,h6,pre",n.node);if(k.length==1&&n.content.indexOf("__MCE_ITEM__")===-1){m.remove(k.reverse(),true)}}}g.onPostProcess.dispatch(g,n);n.content=e.serializer.serialize(n.node,{getInner:1});if((!l)&&(e.pasteAsPlainText)){g._insertPlainText(e,m,n.content);if(!b(e,"paste_text_sticky")){e.pasteAsPlainText=false;e.controlManager.setActive("pastetext",false)}}else{if(/<(p|h[1-6]|ul|ol)/.test(n.content)){g._insertBlockContent(e,m,n.content)}else{g._insert(n.content)}}}e.addCommand("mceInsertClipboardContent",function(j,k){i(k,true)});if(!b(e,"paste_text_use_dialog")){e.addCommand("mcePasteText",function(k,j){var l=tinymce.util.Cookie;e.pasteAsPlainText=!e.pasteAsPlainText;e.controlManager.setActive("pastetext",e.pasteAsPlainText);if((e.pasteAsPlainText)&&(!l.get("tinymcePasteText"))){if(b(e,"paste_text_sticky")){e.windowManager.alert(e.translate("paste.plaintext_mode_sticky"))}else{e.windowManager.alert(e.translate("paste.plaintext_mode_sticky"))}if(!b(e,"paste_text_notifyalways")){l.set("tinymcePasteText","1",new Date(new Date().getFullYear()+1,12,31))}}})}e.addButton("pastetext",{title:"paste.paste_text_desc",cmd:"mcePasteText"});e.addButton("selectall",{title:"paste.selectall_desc",cmd:"selectall"});function h(t){var m,q,k,u,l=e.selection,p=e.dom,r=e.getBody(),j,s;if(t.clipboardData||p.doc.dataTransfer){s=(t.clipboardData||p.doc.dataTransfer).getData("Text");if(e.pasteAsPlainText){t.preventDefault();i({content:s.replace(/\r?\n/g,"<br />")});return}}if(p.get("_mcePaste")){return}m=p.add(r,"div",{id:"_mcePaste","class":"mcePaste"},'\uFEFF<br _mce_bogus="1">');if(r!=e.getDoc().body){j=p.getPos(e.selection.getStart(),r).y}else{j=r.scrollTop+p.getViewPort().y}p.setStyles(m,{position:"absolute",left:-10000,top:j,width:1,height:1,overflow:"hidden"});if(tinymce.isIE){u=l.getRng();k=p.doc.body.createTextRange();k.moveToElementText(m);k.execCommand("Paste");p.remove(m);if(m.innerHTML==="\uFEFF"){e.execCommand("mcePasteWord");t.preventDefault();return}l.setRng(u);l.setContent("");setTimeout(function(){i({content:m.innerHTML})},0);return tinymce.dom.Event.cancel(t)}else{function o(n){n.preventDefault()}p.bind(e.getDoc(),"mousedown",o);p.bind(e.getDoc(),"keydown",o);q=e.selection.getRng();m=m.firstChild;k=e.getDoc().createRange();k.setStart(m,0);k.setEnd(m,1);l.setRng(k);window.setTimeout(function(){var v="",n;if(!p.select("div.mcePaste > div.mcePaste").length){n=p.select("div.mcePaste");c(n,function(x){var w=x.firstChild;if(w&&w.nodeName=="DIV"&&w.style.marginTop&&w.style.backgroundColor){p.remove(w,1)}c(p.select("span.Apple-style-span",x),function(y){p.remove(y,1)});c(p.select("br[_mce_bogus]",x),function(y){p.remove(y)});if(x.parentNode.className!="mcePaste"){v+=x.innerHTML}})}else{v="<pre>"+p.encode(s).replace(/\r?\n/g,"<br />")+"</pre>"}c(p.select("div.mcePaste"),function(w){p.remove(w)});if(q){l.setRng(q)}i({content:v});p.unbind(e.getDoc(),"mousedown",o);p.unbind(e.getDoc(),"keydown",o)},0)}}if(b(e,"paste_auto_cleanup_on_paste")){if(tinymce.isOpera||/Firefox\/2/.test(navigator.userAgent)){e.onKeyDown.addToTop(function(j,k){if(((tinymce.isMac?k.metaKey:k.ctrlKey)&&k.keyCode==86)||(k.shiftKey&&k.keyCode==45)){h(k)}})}else{e.onPaste.addToTop(function(j,k){return h(k)})}}if(b(e,"paste_block_drop")){e.onInit.add(function(){e.dom.bind(e.getBody(),["dragend","dragover","draggesture","dragdrop","drop","drag"],function(j){j.preventDefault();j.stopPropagation();return false})})}g._legacySupport()},getInfo:function(){return{longname:"Paste text/word",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_preProcess:function(i,f){var l=this.editor,k=f.content,q=tinymce.grep,p=tinymce.explode,g=tinymce.trim,m,j;function e(h){c(h,function(o){if(o.constructor==RegExp){k=k.replace(o,"")}else{k=k.replace(o[0],o[1])}})}if(l.settings.paste_enable_default_filters==false){return}if(tinymce.isIE&&document.documentMode>=9){e([[/(?:<br> [\s\r\n]+|<br>)*(<\/?(h[1-6r]|p|div|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|caption|blockquote|center|dl|dt|dd|dir|fieldset)[^>]*>)(?:<br> [\s\r\n]+|<br>)*/g,"$1"]])}if(/class="?Mso|style="[^"]*\bmso-|w:WordDocument/i.test(k)||f.wordContent){f.wordContent=true;e([/^\s*( )+/gi,/( |<br[^>]*>)+\s*$/gi]);if(b(l,"paste_convert_headers_to_strong")){k=k.replace(/<p [^>]*class="?MsoHeading"?[^>]*>(.*?)<\/p>/gi,"<p><strong>$1</strong></p>")}if(b(l,"paste_convert_middot_lists")){e([[/<!--\[if !supportLists\]-->/gi,"$&__MCE_ITEM__"],[/(<span[^>]+(?:mso-list:|:\s*symbol)[^>]+>)/gi,"$1__MCE_ITEM__"],[/(<p[^>]+(?:MsoListParagraph)[^>]+>)/gi,"$1__MCE_ITEM__"]])}e([/<!--[\s\S]+?-->/gi,/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,[/<(\/?)s>/gi,"<$1strike>"],[/ /gi,"\u00a0"]]);do{m=k.length;k=k.replace(/(<[a-z][^>]*\s)(?:id|name|language|type|on\w+|\w+:\w+)=(?:"[^"]*"|\w+)\s?/gi,"$1")}while(m!=k.length);if(b(l,"paste_retain_style_properties").replace(/^none$/i,"").length==0){k=k.replace(/<\/?span[^>]*>/gi,"")}else{e([[/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,function(o,h){return(h.length>0)?h.replace(/./," ").slice(Math.floor(h.length/2)).split("").join("\u00a0"):""}],[/(<[a-z][^>]*)\sstyle="([^"]*)"/gi,function(u,h,t){var v=[],o=0,r=p(g(t).replace(/"/gi,"'"),";");c(r,function(s){var w,y,z=p(s,":");function x(A){return A+((A!=="0")&&(/\d$/.test(A)))?"px":""}if(z.length==2){w=z[0].toLowerCase();y=z[1].toLowerCase();switch(w){case"mso-padding-alt":case"mso-padding-top-alt":case"mso-padding-right-alt":case"mso-padding-bottom-alt":case"mso-padding-left-alt":case"mso-margin-alt":case"mso-margin-top-alt":case"mso-margin-right-alt":case"mso-margin-bottom-alt":case"mso-margin-left-alt":case"mso-table-layout-alt":case"mso-height":case"mso-width":case"mso-vertical-align-alt":v[o++]=w.replace(/^mso-|-alt$/g,"")+":"+x(y);return;case"horiz-align":v[o++]="text-align:"+y;return;case"vert-align":v[o++]="vertical-align:"+y;return;case"font-color":case"mso-foreground":v[o++]="color:"+y;return;case"mso-background":case"mso-highlight":v[o++]="background:"+y;return;case"mso-default-height":v[o++]="min-height:"+x(y);return;case"mso-default-width":v[o++]="min-width:"+x(y);return;case"mso-padding-between-alt":v[o++]="border-collapse:separate;border-spacing:"+x(y);return;case"text-line-through":if((y=="single")||(y=="double")){v[o++]="text-decoration:line-through"}return;case"mso-zero-height":if(y=="yes"){v[o++]="display:none"}return}if(/^(mso|column|font-emph|lang|layout|line-break|list-image|nav|panose|punct|row|ruby|sep|size|src|tab-|table-border|text-(?!align|decor|indent|trans)|top-bar|version|vnd|word-break)/.test(w)){return}v[o++]=w+":"+z[1]}});if(o>0){return h+' style="'+v.join(";")+'"'}else{return h}}]])}}if(b(l,"paste_convert_headers_to_strong")){e([[/<h[1-6][^>]*>/gi,"<p><strong>"],[/<\/h[1-6][^>]*>/gi,"</strong></p>"]])}e([[/Version:[\d.]+\nStartHTML:\d+\nEndHTML:\d+\nStartFragment:\d+\nEndFragment:\d+/gi,""]]);j=b(l,"paste_strip_class_attributes");if(j!=="none"){function n(r,o){if(j==="all"){return""}var h=q(p(o.replace(/^(["'])(.*)\1$/,"$2")," "),function(s){return(/^(?!mso)/i.test(s))});return h.length?' class="'+h.join(" ")+'"':""}k=k.replace(/ class="([^"]+)"/gi,n);k=k.replace(/ class=(\w+)/gi,n)}if(b(l,"paste_remove_spans")){k=k.replace(/<\/?span[^>]*>/gi,"")}f.content=k},_postProcess:function(h,j){var g=this,f=g.editor,i=f.dom,e;if(f.settings.paste_enable_default_filters==false){return}if(j.wordContent){c(i.select("a",j.node),function(k){if(!k.href||k.href.indexOf("#_Toc")!=-1){i.remove(k,1)}});if(b(f,"paste_convert_middot_lists")){g._convertLists(h,j)}e=b(f,"paste_retain_style_properties");if((tinymce.is(e,"string"))&&(e!=="all")&&(e!=="*")){e=tinymce.explode(e.replace(/^none$/i,""));c(i.select("*",j.node),function(n){var o={},l=0,m,p,k;if(e){for(m=0;m<e.length;m++){p=e[m];k=i.getStyle(n,p);if(k){o[p]=k;l++}}}i.setAttrib(n,"style","");if(e&&l>0){i.setStyles(n,o)}else{if(n.nodeName=="SPAN"&&!n.className){i.remove(n,true)}}})}}if(b(f,"paste_remove_styles")||(b(f,"paste_remove_styles_if_webkit")&&tinymce.isWebKit)){c(i.select("*[style]",j.node),function(k){k.removeAttribute("style");k.removeAttribute("_mce_style")})}else{if(tinymce.isWebKit){c(i.select("*",j.node),function(k){k.removeAttribute("_mce_style")})}}g._fixListItems(h,j)},_fixListItems:function(g,j){var f,e,k,h=this.editor.dom;for(e=0;e<j.node.childNodes.length;e++){k=j.node.childNodes[e];if(k.tagName==="LI"){if(!f){f=h.create("UL");k.parentNode.insertBefore(f,k);e++}f.appendChild(k);e--}else{f=null}}},_convertLists:function(h,f){var j=h.editor.dom,i,m,e=-1,g,n=[],l,k;c(j.select("p",f.node),function(u){var r,v="",t,s,o,q;for(r=u.firstChild;r&&r.nodeType==3;r=r.nextSibling){v+=r.nodeValue}v=u.innerHTML.replace(/<\/?\w+[^>]*>/gi,"").replace(/ /g,"\u00a0");if(/^(__MCE_ITEM__)+[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*\u00a0*/.test(v)){t="ul"}if(/^__MCE_ITEM__\s*\w+\.\s*\u00a0{2,}/.test(v)){t="ol"}if(t){g=parseFloat(u.style.marginLeft||0);if(g>e){n.push(g)}if(!i||t!=l){i=j.create(t);j.insertAfter(i,u)}else{if(g>e){i=m.appendChild(j.create(t))}else{if(g<e){o=tinymce.inArray(n,g);q=j.getParents(i.parentNode,t);i=q[q.length-1-o]||i}}}c(j.select("span",u),function(w){var p=w.innerHTML.replace(/<\/?\w+[^>]*>/gi,"");if(t=="ul"&&/^__MCE_ITEM__[\u2022\u00b7\u00a7\u00d8o\u25CF]/.test(p)){j.remove(w)}else{if(/^__MCE_ITEM__[\s\S]*\w+\.( |\u00a0)*\s*/.test(p)){j.remove(w)}}});s=u.innerHTML;if(t=="ul"){s=u.innerHTML.replace(/__MCE_ITEM__/g,"").replace(/^[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*( |\u00a0)+\s*/,"")}else{s=u.innerHTML.replace(/__MCE_ITEM__/g,"").replace(/^\s*\w+\.( |\u00a0)+\s*/,"")}m=i.appendChild(j.create("li",0,s));j.remove(u);e=g;l=t}else{i=e=0}});k=f.node.innerHTML;if(k.indexOf("__MCE_ITEM__")!=-1){f.node.innerHTML=k.replace(/__MCE_ITEM__/g,"")}},_insertBlockContent:function(l,h,m){var f,j,g=l.selection,q,n,e,o,i,k="mce_marker";function p(t){var s;if(tinymce.isIE){s=l.getDoc().body.createTextRange();s.moveToElementText(t);s.collapse(false);s.select()}else{g.select(t,1);g.collapse(false)}}this._insert('<span id="'+k+'"></span>',1);j=h.get(k);f=h.getParent(j,"p,h1,h2,h3,h4,h5,h6,ul,ol,th,td");if(f&&!/TD|TH/.test(f.nodeName)){j=h.split(f,j);c(h.create("div",0,m).childNodes,function(r){q=j.parentNode.insertBefore(r.cloneNode(true),j)});p(q)}else{h.setOuterHTML(j,m);g.select(l.getBody(),1);g.collapse(0)}while(n=h.get(k)){h.remove(n)}n=g.getStart();e=h.getViewPort(l.getWin());o=l.dom.getPos(n).y;i=n.clientHeight;if(o<e.y||o+i>e.y+e.h){l.getDoc().body.scrollTop=o<e.y?o:o-e.h+25}},_insert:function(g,e){var f=this.editor,i=f.selection.getRng();if(!f.selection.isCollapsed()&&i.startContainer!=i.endContainer){f.getDoc().execCommand("Delete",false,null)}f.execCommand(tinymce.isGecko?"insertHTML":"mceInsertContent",false,g,{skip_undo:e})},_insertPlainText:function(j,x,v){var t,u,l,k,r,e,p,f,n=j.getWin(),z=j.getDoc(),s=j.selection,m=tinymce.is,y=tinymce.inArray,g=b(j,"paste_text_linebreaktype"),o=b(j,"paste_text_replacements");function q(h){c(h,function(i){if(i.constructor==RegExp){v=v.replace(i,"")}else{v=v.replace(i[0],i[1])}})}if((typeof(v)==="string")&&(v.length>0)){if(!d){d=("34,quot,38,amp,39,apos,60,lt,62,gt,"+j.serializer.settings.entities).split(",")}if(/<(?:p|br|h[1-6]|ul|ol|dl|table|t[rdh]|div|blockquote|fieldset|pre|address|center)[^>]*>/i.test(v)){q([/[\n\r]+/g])}else{q([/\r+/g])}q([[/<\/(?:p|h[1-6]|ul|ol|dl|table|div|blockquote|fieldset|pre|address|center)>/gi,"\n\n"],[/<br[^>]*>|<\/tr>/gi,"\n"],[/<\/t[dh]>\s*<t[dh][^>]*>/gi,"\t"],/<[a-z!\/?][^>]*>/gi,[/ /gi," "],[/&(#\d+|[a-z0-9]{1,10});/gi,function(i,h){if(h.charAt(0)==="#"){return String.fromCharCode(h.slice(1))}else{return((i=y(d,h))>0)?String.fromCharCode(d[i-1]):" "}}],[/(?:(?!\n)\s)*(\n+)(?:(?!\n)\s)*/gi,"$1"],[/\n{3,}/g,"\n\n"],/^\s+|\s+$/g]);v=x.encode(v);if(!s.isCollapsed()){z.execCommand("Delete",false,null)}if(m(o,"array")||(m(o,"array"))){q(o)}else{if(m(o,"string")){q(new RegExp(o,"gi"))}}if(g=="none"){q([[/\n+/g," "]])}else{if(g=="br"){q([[/\n/g,"<br />"]])}else{q([/^\s+|\s+$/g,[/\n\n/g,"</p><p>"],[/\n/g,"<br />"]])}}if((l=v.indexOf("</p><p>"))!=-1){k=v.lastIndexOf("</p><p>");r=s.getNode();e=[];do{if(r.nodeType==1){if(r.nodeName=="TD"||r.nodeName=="BODY"){break}e[e.length]=r}}while(r=r.parentNode);if(e.length>0){p=v.substring(0,l);f="";for(t=0,u=e.length;t<u;t++){p+="</"+e[t].nodeName.toLowerCase()+">";f+="<"+e[e.length-t-1].nodeName.toLowerCase()+">"}if(l==k){v=p+f+v.substring(l+7)}else{v=p+v.substring(l+4,k+4)+f+v.substring(k+7)}}}j.execCommand("mceInsertRawHTML",false,v+'<span id="_plain_text_marker"> </span>');window.setTimeout(function(){var h=x.get("_plain_text_marker"),B,i,A,w;s.select(h,false);z.execCommand("Delete",false,null);h=null;B=s.getStart();i=x.getViewPort(n);A=x.getPos(B).y;w=B.clientHeight;if((A<i.y)||(A+w>i.y+i.h)){z.body.scrollTop=A<i.y?A:A-i.h+25}},0)}},_legacySupport:function(){var f=this,e=f.editor;e.addCommand("mcePasteWord",function(){e.windowManager.open({file:f.url+"/pasteword.htm",width:parseInt(b(e,"paste_dialog_width")),height:parseInt(b(e,"paste_dialog_height")),inline:1})});if(b(e,"paste_text_use_dialog")){e.addCommand("mcePasteText",function(){e.windowManager.open({file:f.url+"/pastetext.htm",width:parseInt(b(e,"paste_dialog_width")),height:parseInt(b(e,"paste_dialog_height")),inline:1})})}e.addButton("pasteword",{title:"paste.paste_word_desc",cmd:"mcePasteWord"})}});tinymce.PluginManager.add("paste",tinymce.plugins.PastePlugin)})();
|
@@ -0,0 +1,1035 @@
|
|
1
|
+
/**
|
2
|
+
* editor_plugin_src.js
|
3
|
+
*
|
4
|
+
* Copyright 2009, 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,
|
13
|
+
entities = null,
|
14
|
+
defs = {
|
15
|
+
paste_auto_cleanup_on_paste : true,
|
16
|
+
paste_enable_default_filters : true,
|
17
|
+
paste_block_drop : false,
|
18
|
+
paste_retain_style_properties : "none",
|
19
|
+
paste_strip_class_attributes : "mso",
|
20
|
+
paste_remove_spans : false,
|
21
|
+
paste_remove_styles : false,
|
22
|
+
paste_remove_styles_if_webkit : true,
|
23
|
+
paste_convert_middot_lists : true,
|
24
|
+
paste_convert_headers_to_strong : false,
|
25
|
+
paste_dialog_width : "450",
|
26
|
+
paste_dialog_height : "400",
|
27
|
+
paste_text_use_dialog : false,
|
28
|
+
paste_text_sticky : false,
|
29
|
+
paste_text_sticky_default : false,
|
30
|
+
paste_text_notifyalways : false,
|
31
|
+
paste_text_linebreaktype : "p",
|
32
|
+
paste_text_replacements : [
|
33
|
+
[/\u2026/g, "..."],
|
34
|
+
[/[\x93\x94\u201c\u201d]/g, '"'],
|
35
|
+
[/[\x60\x91\x92\u2018\u2019]/g, "'"]
|
36
|
+
]
|
37
|
+
};
|
38
|
+
|
39
|
+
function getParam(ed, name) {
|
40
|
+
return ed.getParam(name, defs[name]);
|
41
|
+
}
|
42
|
+
tinymce.create('tinymce.plugins.PastePlugin', {
|
43
|
+
init : function(ed, url) {
|
44
|
+
var t = this;
|
45
|
+
|
46
|
+
t.editor = ed;
|
47
|
+
t.url = url;
|
48
|
+
|
49
|
+
// Setup plugin events
|
50
|
+
t.onPreProcess = new tinymce.util.Dispatcher(t);
|
51
|
+
t.onPostProcess = new tinymce.util.Dispatcher(t);
|
52
|
+
|
53
|
+
// Register default handlers
|
54
|
+
t.onPreProcess.add(t._preProcess);
|
55
|
+
t.onPostProcess.add(t._postProcess);
|
56
|
+
|
57
|
+
// Register optional preprocess handler
|
58
|
+
t.onPreProcess.add(function(pl, o) {
|
59
|
+
ed.execCallback('paste_preprocess', pl, o);
|
60
|
+
});
|
61
|
+
|
62
|
+
// Register optional postprocess
|
63
|
+
t.onPostProcess.add(function(pl, o) {
|
64
|
+
ed.execCallback('paste_postprocess', pl, o);
|
65
|
+
});
|
66
|
+
|
67
|
+
ed.onKeyDown.addToTop(function(ed, e) {
|
68
|
+
// Block ctrl+v from adding an undo level since the default logic in tinymce.Editor will add that
|
69
|
+
if (((tinymce.isMac ? e.metaKey : e.ctrlKey) && e.keyCode == 86) || (e.shiftKey && e.keyCode == 45))
|
70
|
+
return false; // Stop other listeners
|
71
|
+
});
|
72
|
+
|
73
|
+
// Initialize plain text flag
|
74
|
+
ed.pasteAsPlainText = getParam(ed, 'paste_text_sticky_default');
|
75
|
+
|
76
|
+
// This function executes the process handlers and inserts the contents
|
77
|
+
// force_rich overrides plain text mode set by user, important for pasting with execCommand
|
78
|
+
function process(o, force_rich) {
|
79
|
+
var dom = ed.dom, rng, nodes;
|
80
|
+
|
81
|
+
// Execute pre process handlers
|
82
|
+
t.onPreProcess.dispatch(t, o);
|
83
|
+
|
84
|
+
// Create DOM structure
|
85
|
+
o.node = dom.create('div', 0, o.content);
|
86
|
+
|
87
|
+
// If pasting inside the same element and the contents is only one block
|
88
|
+
// remove the block and keep the text since Firefox will copy parts of pre and h1-h6 as a pre element
|
89
|
+
if (tinymce.isGecko) {
|
90
|
+
rng = ed.selection.getRng(true);
|
91
|
+
if (rng.startContainer == rng.endContainer && rng.startContainer.nodeType == 3) {
|
92
|
+
nodes = dom.select('p,h1,h2,h3,h4,h5,h6,pre', o.node);
|
93
|
+
|
94
|
+
// Is only one block node and it doesn't contain word stuff
|
95
|
+
if (nodes.length == 1 && o.content.indexOf('__MCE_ITEM__') === -1)
|
96
|
+
dom.remove(nodes.reverse(), true);
|
97
|
+
}
|
98
|
+
}
|
99
|
+
|
100
|
+
// Execute post process handlers
|
101
|
+
t.onPostProcess.dispatch(t, o);
|
102
|
+
|
103
|
+
// Serialize content
|
104
|
+
o.content = ed.serializer.serialize(o.node, {getInner : 1});
|
105
|
+
|
106
|
+
// Plain text option active?
|
107
|
+
if ((!force_rich) && (ed.pasteAsPlainText)) {
|
108
|
+
t._insertPlainText(ed, dom, o.content);
|
109
|
+
|
110
|
+
if (!getParam(ed, "paste_text_sticky")) {
|
111
|
+
ed.pasteAsPlainText = false;
|
112
|
+
ed.controlManager.setActive("pastetext", false);
|
113
|
+
}
|
114
|
+
} else if (/<(p|h[1-6]|ul|ol)/.test(o.content)) {
|
115
|
+
// Handle insertion of contents containing block elements separately
|
116
|
+
t._insertBlockContent(ed, dom, o.content);
|
117
|
+
} else {
|
118
|
+
t._insert(o.content);
|
119
|
+
}
|
120
|
+
}
|
121
|
+
|
122
|
+
// Add command for external usage
|
123
|
+
ed.addCommand('mceInsertClipboardContent', function(u, o) {
|
124
|
+
process(o, true);
|
125
|
+
});
|
126
|
+
|
127
|
+
if (!getParam(ed, "paste_text_use_dialog")) {
|
128
|
+
ed.addCommand('mcePasteText', function(u, v) {
|
129
|
+
var cookie = tinymce.util.Cookie;
|
130
|
+
|
131
|
+
ed.pasteAsPlainText = !ed.pasteAsPlainText;
|
132
|
+
ed.controlManager.setActive('pastetext', ed.pasteAsPlainText);
|
133
|
+
|
134
|
+
if ((ed.pasteAsPlainText) && (!cookie.get("tinymcePasteText"))) {
|
135
|
+
if (getParam(ed, "paste_text_sticky")) {
|
136
|
+
ed.windowManager.alert(ed.translate('paste.plaintext_mode_sticky'));
|
137
|
+
} else {
|
138
|
+
ed.windowManager.alert(ed.translate('paste.plaintext_mode_sticky'));
|
139
|
+
}
|
140
|
+
|
141
|
+
if (!getParam(ed, "paste_text_notifyalways")) {
|
142
|
+
cookie.set("tinymcePasteText", "1", new Date(new Date().getFullYear() + 1, 12, 31))
|
143
|
+
}
|
144
|
+
}
|
145
|
+
});
|
146
|
+
}
|
147
|
+
|
148
|
+
ed.addButton('pastetext', {title: 'paste.paste_text_desc', cmd: 'mcePasteText'});
|
149
|
+
ed.addButton('selectall', {title: 'paste.selectall_desc', cmd: 'selectall'});
|
150
|
+
|
151
|
+
// This function grabs the contents from the clipboard by adding a
|
152
|
+
// hidden div and placing the caret inside it and after the browser paste
|
153
|
+
// is done it grabs that contents and processes that
|
154
|
+
function grabContent(e) {
|
155
|
+
var n, or, rng, oldRng, sel = ed.selection, dom = ed.dom, body = ed.getBody(), posY, textContent;
|
156
|
+
|
157
|
+
// Check if browser supports direct plaintext access
|
158
|
+
if (e.clipboardData || dom.doc.dataTransfer) {
|
159
|
+
textContent = (e.clipboardData || dom.doc.dataTransfer).getData('Text');
|
160
|
+
|
161
|
+
if (ed.pasteAsPlainText) {
|
162
|
+
e.preventDefault();
|
163
|
+
process({content : textContent.replace(/\r?\n/g, '<br />')});
|
164
|
+
return;
|
165
|
+
}
|
166
|
+
}
|
167
|
+
|
168
|
+
if (dom.get('_mcePaste'))
|
169
|
+
return;
|
170
|
+
|
171
|
+
// Create container to paste into
|
172
|
+
n = dom.add(body, 'div', {id : '_mcePaste', 'class' : 'mcePaste'}, '\uFEFF<br _mce_bogus="1">');
|
173
|
+
|
174
|
+
// If contentEditable mode we need to find out the position of the closest element
|
175
|
+
if (body != ed.getDoc().body)
|
176
|
+
posY = dom.getPos(ed.selection.getStart(), body).y;
|
177
|
+
else
|
178
|
+
posY = body.scrollTop + dom.getViewPort().y;
|
179
|
+
|
180
|
+
// Styles needs to be applied after the element is added to the document since WebKit will otherwise remove all styles
|
181
|
+
dom.setStyles(n, {
|
182
|
+
position : 'absolute',
|
183
|
+
left : -10000,
|
184
|
+
top : posY,
|
185
|
+
width : 1,
|
186
|
+
height : 1,
|
187
|
+
overflow : 'hidden'
|
188
|
+
});
|
189
|
+
|
190
|
+
if (tinymce.isIE) {
|
191
|
+
// Store away the old range
|
192
|
+
oldRng = sel.getRng();
|
193
|
+
|
194
|
+
// Select the container
|
195
|
+
rng = dom.doc.body.createTextRange();
|
196
|
+
rng.moveToElementText(n);
|
197
|
+
rng.execCommand('Paste');
|
198
|
+
|
199
|
+
// Remove container
|
200
|
+
dom.remove(n);
|
201
|
+
|
202
|
+
// Check if the contents was changed, if it wasn't then clipboard extraction failed probably due
|
203
|
+
// to IE security settings so we pass the junk though better than nothing right
|
204
|
+
if (n.innerHTML === '\uFEFF') {
|
205
|
+
ed.execCommand('mcePasteWord');
|
206
|
+
e.preventDefault();
|
207
|
+
return;
|
208
|
+
}
|
209
|
+
|
210
|
+
// Restore the old range and clear the contents before pasting
|
211
|
+
sel.setRng(oldRng);
|
212
|
+
sel.setContent('');
|
213
|
+
|
214
|
+
// For some odd reason we need to detach the the mceInsertContent call from the paste event
|
215
|
+
// It's like IE has a reference to the parent element that you paste in and the selection gets messed up
|
216
|
+
// when it tries to restore the selection
|
217
|
+
setTimeout(function() {
|
218
|
+
// Process contents
|
219
|
+
process({content : n.innerHTML});
|
220
|
+
}, 0);
|
221
|
+
|
222
|
+
// Block the real paste event
|
223
|
+
return tinymce.dom.Event.cancel(e);
|
224
|
+
} else {
|
225
|
+
function block(e) {
|
226
|
+
e.preventDefault();
|
227
|
+
};
|
228
|
+
|
229
|
+
// Block mousedown and click to prevent selection change
|
230
|
+
dom.bind(ed.getDoc(), 'mousedown', block);
|
231
|
+
dom.bind(ed.getDoc(), 'keydown', block);
|
232
|
+
|
233
|
+
or = ed.selection.getRng();
|
234
|
+
|
235
|
+
// Move caret into hidden div
|
236
|
+
n = n.firstChild;
|
237
|
+
rng = ed.getDoc().createRange();
|
238
|
+
rng.setStart(n, 0);
|
239
|
+
rng.setEnd(n, 1);
|
240
|
+
sel.setRng(rng);
|
241
|
+
|
242
|
+
// Wait a while and grab the pasted contents
|
243
|
+
window.setTimeout(function() {
|
244
|
+
var h = '', nl;
|
245
|
+
|
246
|
+
// Paste divs duplicated in paste divs seems to happen when you paste plain text so lets first look for that broken behavior in WebKit
|
247
|
+
if (!dom.select('div.mcePaste > div.mcePaste').length) {
|
248
|
+
nl = dom.select('div.mcePaste');
|
249
|
+
|
250
|
+
// WebKit will split the div into multiple ones so this will loop through then all and join them to get the whole HTML string
|
251
|
+
each(nl, function(n) {
|
252
|
+
var child = n.firstChild;
|
253
|
+
|
254
|
+
// WebKit inserts a DIV container with lots of odd styles
|
255
|
+
if (child && child.nodeName == 'DIV' && child.style.marginTop && child.style.backgroundColor) {
|
256
|
+
dom.remove(child, 1);
|
257
|
+
}
|
258
|
+
|
259
|
+
// Remove apply style spans
|
260
|
+
each(dom.select('span.Apple-style-span', n), function(n) {
|
261
|
+
dom.remove(n, 1);
|
262
|
+
});
|
263
|
+
|
264
|
+
// Remove bogus br elements
|
265
|
+
each(dom.select('br[_mce_bogus]', n), function(n) {
|
266
|
+
dom.remove(n);
|
267
|
+
});
|
268
|
+
|
269
|
+
// WebKit will make a copy of the DIV for each line of plain text pasted and insert them into the DIV
|
270
|
+
if (n.parentNode.className != 'mcePaste')
|
271
|
+
h += n.innerHTML;
|
272
|
+
});
|
273
|
+
} else {
|
274
|
+
// Found WebKit weirdness so force the content into plain text mode
|
275
|
+
h = '<pre>' + dom.encode(textContent).replace(/\r?\n/g, '<br />') + '</pre>';
|
276
|
+
}
|
277
|
+
|
278
|
+
// Remove the nodes
|
279
|
+
each(dom.select('div.mcePaste'), function(n) {
|
280
|
+
dom.remove(n);
|
281
|
+
});
|
282
|
+
|
283
|
+
// Restore the old selection
|
284
|
+
if (or)
|
285
|
+
sel.setRng(or);
|
286
|
+
|
287
|
+
process({content : h});
|
288
|
+
|
289
|
+
// Unblock events ones we got the contents
|
290
|
+
dom.unbind(ed.getDoc(), 'mousedown', block);
|
291
|
+
dom.unbind(ed.getDoc(), 'keydown', block);
|
292
|
+
}, 0);
|
293
|
+
}
|
294
|
+
}
|
295
|
+
|
296
|
+
// Check if we should use the new auto process method
|
297
|
+
if (getParam(ed, "paste_auto_cleanup_on_paste")) {
|
298
|
+
// Is it's Opera or older FF use key handler
|
299
|
+
if (tinymce.isOpera || /Firefox\/2/.test(navigator.userAgent)) {
|
300
|
+
ed.onKeyDown.addToTop(function(ed, e) {
|
301
|
+
if (((tinymce.isMac ? e.metaKey : e.ctrlKey) && e.keyCode == 86) || (e.shiftKey && e.keyCode == 45))
|
302
|
+
grabContent(e);
|
303
|
+
});
|
304
|
+
} else {
|
305
|
+
// Grab contents on paste event on Gecko and WebKit
|
306
|
+
ed.onPaste.addToTop(function(ed, e) {
|
307
|
+
return grabContent(e);
|
308
|
+
});
|
309
|
+
}
|
310
|
+
}
|
311
|
+
|
312
|
+
// Block all drag/drop events
|
313
|
+
if (getParam(ed, "paste_block_drop")) {
|
314
|
+
ed.onInit.add(function() {
|
315
|
+
ed.dom.bind(ed.getBody(), ['dragend', 'dragover', 'draggesture', 'dragdrop', 'drop', 'drag'], function(e) {
|
316
|
+
e.preventDefault();
|
317
|
+
e.stopPropagation();
|
318
|
+
|
319
|
+
return false;
|
320
|
+
});
|
321
|
+
});
|
322
|
+
}
|
323
|
+
|
324
|
+
// Add legacy support
|
325
|
+
t._legacySupport();
|
326
|
+
},
|
327
|
+
|
328
|
+
getInfo : function() {
|
329
|
+
return {
|
330
|
+
longname : 'Paste text/word',
|
331
|
+
author : 'Moxiecode Systems AB',
|
332
|
+
authorurl : 'http://tinymce.moxiecode.com',
|
333
|
+
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste',
|
334
|
+
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
335
|
+
};
|
336
|
+
},
|
337
|
+
|
338
|
+
_preProcess : function(pl, o) {
|
339
|
+
//console.log('Before preprocess:' + o.content);
|
340
|
+
|
341
|
+
var ed = this.editor,
|
342
|
+
h = o.content,
|
343
|
+
grep = tinymce.grep,
|
344
|
+
explode = tinymce.explode,
|
345
|
+
trim = tinymce.trim,
|
346
|
+
len, stripClass;
|
347
|
+
|
348
|
+
function process(items) {
|
349
|
+
each(items, function(v) {
|
350
|
+
// Remove or replace
|
351
|
+
if (v.constructor == RegExp)
|
352
|
+
h = h.replace(v, '');
|
353
|
+
else
|
354
|
+
h = h.replace(v[0], v[1]);
|
355
|
+
});
|
356
|
+
}
|
357
|
+
|
358
|
+
if (ed.settings.paste_enable_default_filters == false) {
|
359
|
+
return;
|
360
|
+
}
|
361
|
+
|
362
|
+
// IE9 adds BRs before/after block elements when contents is pasted from word or for example another browser
|
363
|
+
if (tinymce.isIE && document.documentMode >= 9)
|
364
|
+
process([[/(?:<br> [\s\r\n]+|<br>)*(<\/?(h[1-6r]|p|div|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|caption|blockquote|center|dl|dt|dd|dir|fieldset)[^>]*>)(?:<br> [\s\r\n]+|<br>)*/g, '$1']]);
|
365
|
+
|
366
|
+
// Detect Word content and process it more aggressive
|
367
|
+
if (/class="?Mso|style="[^"]*\bmso-|w:WordDocument/i.test(h) || o.wordContent) {
|
368
|
+
o.wordContent = true; // Mark the pasted contents as word specific content
|
369
|
+
//console.log('Word contents detected.');
|
370
|
+
|
371
|
+
// Process away some basic content
|
372
|
+
process([
|
373
|
+
/^\s*( )+/gi, // entities at the start of contents
|
374
|
+
/( |<br[^>]*>)+\s*$/gi // entities at the end of contents
|
375
|
+
]);
|
376
|
+
|
377
|
+
if (getParam(ed, "paste_convert_headers_to_strong")) {
|
378
|
+
h = h.replace(/<p [^>]*class="?MsoHeading"?[^>]*>(.*?)<\/p>/gi, "<p><strong>$1</strong></p>");
|
379
|
+
}
|
380
|
+
|
381
|
+
if (getParam(ed, "paste_convert_middot_lists")) {
|
382
|
+
process([
|
383
|
+
[/<!--\[if !supportLists\]-->/gi, '$&__MCE_ITEM__'], // Convert supportLists to a list item marker
|
384
|
+
[/(<span[^>]+(?:mso-list:|:\s*symbol)[^>]+>)/gi, '$1__MCE_ITEM__'], // Convert mso-list and symbol spans to item markers
|
385
|
+
[/(<p[^>]+(?:MsoListParagraph)[^>]+>)/gi, '$1__MCE_ITEM__'] // Convert mso-list and symbol paragraphs to item markers (FF)
|
386
|
+
]);
|
387
|
+
}
|
388
|
+
|
389
|
+
process([
|
390
|
+
// Word comments like conditional comments etc
|
391
|
+
/<!--[\s\S]+?-->/gi,
|
392
|
+
|
393
|
+
// Remove comments, scripts (e.g., msoShowComment), XML tag, VML content, MS Office namespaced tags, and a few other tags
|
394
|
+
/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,
|
395
|
+
|
396
|
+
// Convert <s> into <strike> for line-though
|
397
|
+
[/<(\/?)s>/gi, "<$1strike>"],
|
398
|
+
|
399
|
+
// Replace nsbp entites to char since it's easier to handle
|
400
|
+
[/ /gi, "\u00a0"]
|
401
|
+
]);
|
402
|
+
|
403
|
+
// Remove bad attributes, with or without quotes, ensuring that attribute text is really inside a tag.
|
404
|
+
// If JavaScript had a RegExp look-behind, we could have integrated this with the last process() array and got rid of the loop. But alas, it does not, so we cannot.
|
405
|
+
do {
|
406
|
+
len = h.length;
|
407
|
+
h = h.replace(/(<[a-z][^>]*\s)(?:id|name|language|type|on\w+|\w+:\w+)=(?:"[^"]*"|\w+)\s?/gi, "$1");
|
408
|
+
} while (len != h.length);
|
409
|
+
|
410
|
+
// Remove all spans if no styles is to be retained
|
411
|
+
if (getParam(ed, "paste_retain_style_properties").replace(/^none$/i, "").length == 0) {
|
412
|
+
h = h.replace(/<\/?span[^>]*>/gi, "");
|
413
|
+
} else {
|
414
|
+
// We're keeping styles, so at least clean them up.
|
415
|
+
// CSS Reference: http://msdn.microsoft.com/en-us/library/aa155477.aspx
|
416
|
+
|
417
|
+
process([
|
418
|
+
// Convert <span style="mso-spacerun:yes">___</span> to string of alternating breaking/non-breaking spaces of same length
|
419
|
+
[/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,
|
420
|
+
function(str, spaces) {
|
421
|
+
return (spaces.length > 0)? spaces.replace(/./, " ").slice(Math.floor(spaces.length/2)).split("").join("\u00a0") : "";
|
422
|
+
}
|
423
|
+
],
|
424
|
+
|
425
|
+
// Examine all styles: delete junk, transform some, and keep the rest
|
426
|
+
[/(<[a-z][^>]*)\sstyle="([^"]*)"/gi,
|
427
|
+
function(str, tag, style) {
|
428
|
+
var n = [],
|
429
|
+
i = 0,
|
430
|
+
s = explode(trim(style).replace(/"/gi, "'"), ";");
|
431
|
+
|
432
|
+
// Examine each style definition within the tag's style attribute
|
433
|
+
each(s, function(v) {
|
434
|
+
var name, value,
|
435
|
+
parts = explode(v, ":");
|
436
|
+
|
437
|
+
function ensureUnits(v) {
|
438
|
+
return v + ((v !== "0") && (/\d$/.test(v)))? "px" : "";
|
439
|
+
}
|
440
|
+
|
441
|
+
if (parts.length == 2) {
|
442
|
+
name = parts[0].toLowerCase();
|
443
|
+
value = parts[1].toLowerCase();
|
444
|
+
|
445
|
+
// Translate certain MS Office styles into their CSS equivalents
|
446
|
+
switch (name) {
|
447
|
+
case "mso-padding-alt":
|
448
|
+
case "mso-padding-top-alt":
|
449
|
+
case "mso-padding-right-alt":
|
450
|
+
case "mso-padding-bottom-alt":
|
451
|
+
case "mso-padding-left-alt":
|
452
|
+
case "mso-margin-alt":
|
453
|
+
case "mso-margin-top-alt":
|
454
|
+
case "mso-margin-right-alt":
|
455
|
+
case "mso-margin-bottom-alt":
|
456
|
+
case "mso-margin-left-alt":
|
457
|
+
case "mso-table-layout-alt":
|
458
|
+
case "mso-height":
|
459
|
+
case "mso-width":
|
460
|
+
case "mso-vertical-align-alt":
|
461
|
+
n[i++] = name.replace(/^mso-|-alt$/g, "") + ":" + ensureUnits(value);
|
462
|
+
return;
|
463
|
+
|
464
|
+
case "horiz-align":
|
465
|
+
n[i++] = "text-align:" + value;
|
466
|
+
return;
|
467
|
+
|
468
|
+
case "vert-align":
|
469
|
+
n[i++] = "vertical-align:" + value;
|
470
|
+
return;
|
471
|
+
|
472
|
+
case "font-color":
|
473
|
+
case "mso-foreground":
|
474
|
+
n[i++] = "color:" + value;
|
475
|
+
return;
|
476
|
+
|
477
|
+
case "mso-background":
|
478
|
+
case "mso-highlight":
|
479
|
+
n[i++] = "background:" + value;
|
480
|
+
return;
|
481
|
+
|
482
|
+
case "mso-default-height":
|
483
|
+
n[i++] = "min-height:" + ensureUnits(value);
|
484
|
+
return;
|
485
|
+
|
486
|
+
case "mso-default-width":
|
487
|
+
n[i++] = "min-width:" + ensureUnits(value);
|
488
|
+
return;
|
489
|
+
|
490
|
+
case "mso-padding-between-alt":
|
491
|
+
n[i++] = "border-collapse:separate;border-spacing:" + ensureUnits(value);
|
492
|
+
return;
|
493
|
+
|
494
|
+
case "text-line-through":
|
495
|
+
if ((value == "single") || (value == "double")) {
|
496
|
+
n[i++] = "text-decoration:line-through";
|
497
|
+
}
|
498
|
+
return;
|
499
|
+
|
500
|
+
case "mso-zero-height":
|
501
|
+
if (value == "yes") {
|
502
|
+
n[i++] = "display:none";
|
503
|
+
}
|
504
|
+
return;
|
505
|
+
}
|
506
|
+
|
507
|
+
// Eliminate all MS Office style definitions that have no CSS equivalent by examining the first characters in the name
|
508
|
+
if (/^(mso|column|font-emph|lang|layout|line-break|list-image|nav|panose|punct|row|ruby|sep|size|src|tab-|table-border|text-(?!align|decor|indent|trans)|top-bar|version|vnd|word-break)/.test(name)) {
|
509
|
+
return;
|
510
|
+
}
|
511
|
+
|
512
|
+
// If it reached this point, it must be a valid CSS style
|
513
|
+
n[i++] = name + ":" + parts[1]; // Lower-case name, but keep value case
|
514
|
+
}
|
515
|
+
});
|
516
|
+
|
517
|
+
// If style attribute contained any valid styles the re-write it; otherwise delete style attribute.
|
518
|
+
if (i > 0) {
|
519
|
+
return tag + ' style="' + n.join(';') + '"';
|
520
|
+
} else {
|
521
|
+
return tag;
|
522
|
+
}
|
523
|
+
}
|
524
|
+
]
|
525
|
+
]);
|
526
|
+
}
|
527
|
+
}
|
528
|
+
|
529
|
+
// Replace headers with <strong>
|
530
|
+
if (getParam(ed, "paste_convert_headers_to_strong")) {
|
531
|
+
process([
|
532
|
+
[/<h[1-6][^>]*>/gi, "<p><strong>"],
|
533
|
+
[/<\/h[1-6][^>]*>/gi, "</strong></p>"]
|
534
|
+
]);
|
535
|
+
}
|
536
|
+
|
537
|
+
process([
|
538
|
+
// Copy paste from Java like Open Office will produce this junk on FF
|
539
|
+
[/Version:[\d.]+\nStartHTML:\d+\nEndHTML:\d+\nStartFragment:\d+\nEndFragment:\d+/gi, '']
|
540
|
+
]);
|
541
|
+
|
542
|
+
// Class attribute options are: leave all as-is ("none"), remove all ("all"), or remove only those starting with mso ("mso").
|
543
|
+
// Note:- paste_strip_class_attributes: "none", verify_css_classes: true is also a good variation.
|
544
|
+
stripClass = getParam(ed, "paste_strip_class_attributes");
|
545
|
+
|
546
|
+
if (stripClass !== "none") {
|
547
|
+
function removeClasses(match, g1) {
|
548
|
+
if (stripClass === "all")
|
549
|
+
return '';
|
550
|
+
|
551
|
+
var cls = grep(explode(g1.replace(/^(["'])(.*)\1$/, "$2"), " "),
|
552
|
+
function(v) {
|
553
|
+
return (/^(?!mso)/i.test(v));
|
554
|
+
}
|
555
|
+
);
|
556
|
+
|
557
|
+
return cls.length ? ' class="' + cls.join(" ") + '"' : '';
|
558
|
+
};
|
559
|
+
|
560
|
+
h = h.replace(/ class="([^"]+)"/gi, removeClasses);
|
561
|
+
h = h.replace(/ class=(\w+)/gi, removeClasses);
|
562
|
+
}
|
563
|
+
|
564
|
+
// Remove spans option
|
565
|
+
if (getParam(ed, "paste_remove_spans")) {
|
566
|
+
h = h.replace(/<\/?span[^>]*>/gi, "");
|
567
|
+
}
|
568
|
+
|
569
|
+
//console.log('After preprocess:' + h);
|
570
|
+
|
571
|
+
o.content = h;
|
572
|
+
},
|
573
|
+
|
574
|
+
/**
|
575
|
+
* Various post process items.
|
576
|
+
*/
|
577
|
+
_postProcess : function(pl, o) {
|
578
|
+
var t = this, ed = t.editor, dom = ed.dom, styleProps;
|
579
|
+
|
580
|
+
if (ed.settings.paste_enable_default_filters == false) {
|
581
|
+
return;
|
582
|
+
}
|
583
|
+
|
584
|
+
if (o.wordContent) {
|
585
|
+
// Remove named anchors or TOC links
|
586
|
+
each(dom.select('a', o.node), function(a) {
|
587
|
+
if (!a.href || a.href.indexOf('#_Toc') != -1)
|
588
|
+
dom.remove(a, 1);
|
589
|
+
});
|
590
|
+
|
591
|
+
if (getParam(ed, "paste_convert_middot_lists")) {
|
592
|
+
t._convertLists(pl, o);
|
593
|
+
}
|
594
|
+
|
595
|
+
// Process styles
|
596
|
+
styleProps = getParam(ed, "paste_retain_style_properties"); // retained properties
|
597
|
+
|
598
|
+
// Process only if a string was specified and not equal to "all" or "*"
|
599
|
+
if ((tinymce.is(styleProps, "string")) && (styleProps !== "all") && (styleProps !== "*")) {
|
600
|
+
styleProps = tinymce.explode(styleProps.replace(/^none$/i, ""));
|
601
|
+
|
602
|
+
// Retains some style properties
|
603
|
+
each(dom.select('*', o.node), function(el) {
|
604
|
+
var newStyle = {}, npc = 0, i, sp, sv;
|
605
|
+
|
606
|
+
// Store a subset of the existing styles
|
607
|
+
if (styleProps) {
|
608
|
+
for (i = 0; i < styleProps.length; i++) {
|
609
|
+
sp = styleProps[i];
|
610
|
+
sv = dom.getStyle(el, sp);
|
611
|
+
|
612
|
+
if (sv) {
|
613
|
+
newStyle[sp] = sv;
|
614
|
+
npc++;
|
615
|
+
}
|
616
|
+
}
|
617
|
+
}
|
618
|
+
|
619
|
+
// Remove all of the existing styles
|
620
|
+
dom.setAttrib(el, 'style', '');
|
621
|
+
|
622
|
+
if (styleProps && npc > 0)
|
623
|
+
dom.setStyles(el, newStyle); // Add back the stored subset of styles
|
624
|
+
else // Remove empty span tags that do not have class attributes
|
625
|
+
if (el.nodeName == 'SPAN' && !el.className)
|
626
|
+
dom.remove(el, true);
|
627
|
+
});
|
628
|
+
}
|
629
|
+
}
|
630
|
+
|
631
|
+
// Remove all style information or only specifically on WebKit to avoid the style bug on that browser
|
632
|
+
if (getParam(ed, "paste_remove_styles") || (getParam(ed, "paste_remove_styles_if_webkit") && tinymce.isWebKit)) {
|
633
|
+
each(dom.select('*[style]', o.node), function(el) {
|
634
|
+
el.removeAttribute('style');
|
635
|
+
el.removeAttribute('_mce_style');
|
636
|
+
});
|
637
|
+
} else {
|
638
|
+
if (tinymce.isWebKit) {
|
639
|
+
// We need to compress the styles on WebKit since if you paste <img border="0" /> it will become <img border="0" style="... lots of junk ..." />
|
640
|
+
// Removing the mce_style that contains the real value will force the Serializer engine to compress the styles
|
641
|
+
each(dom.select('*', o.node), function(el) {
|
642
|
+
el.removeAttribute('_mce_style');
|
643
|
+
});
|
644
|
+
}
|
645
|
+
}
|
646
|
+
|
647
|
+
t._fixListItems(pl, o);
|
648
|
+
},
|
649
|
+
|
650
|
+
/**
|
651
|
+
* Detects any LI elements pasted outside of a UL or OL and fixes the nesting. This happens when copying part of a list in IE.
|
652
|
+
*/
|
653
|
+
_fixListItems : function(pl, o) {
|
654
|
+
var ul, i, n, dom = this.editor.dom;
|
655
|
+
for (i = 0; i < o.node.childNodes.length; i++) {
|
656
|
+
n = o.node.childNodes[i];
|
657
|
+
|
658
|
+
if (n.tagName === 'LI') {
|
659
|
+
if (!ul) {
|
660
|
+
ul = dom.create('UL');
|
661
|
+
n.parentNode.insertBefore(ul, n);
|
662
|
+
i++;
|
663
|
+
}
|
664
|
+
ul.appendChild(n);
|
665
|
+
i--;
|
666
|
+
} else {
|
667
|
+
ul = null;
|
668
|
+
}
|
669
|
+
}
|
670
|
+
},
|
671
|
+
|
672
|
+
/**
|
673
|
+
* Converts the most common bullet and number formats in Office into a real semantic UL/LI list.
|
674
|
+
*/
|
675
|
+
_convertLists : function(pl, o) {
|
676
|
+
var dom = pl.editor.dom, listElm, li, lastMargin = -1, margin, levels = [], lastType, html;
|
677
|
+
|
678
|
+
// Convert middot lists into real semantic lists
|
679
|
+
each(dom.select('p', o.node), function(p) {
|
680
|
+
var sib, val = '', type, html, idx, parents;
|
681
|
+
|
682
|
+
// Get text node value at beginning of paragraph
|
683
|
+
for (sib = p.firstChild; sib && sib.nodeType == 3; sib = sib.nextSibling)
|
684
|
+
val += sib.nodeValue;
|
685
|
+
|
686
|
+
val = p.innerHTML.replace(/<\/?\w+[^>]*>/gi, '').replace(/ /g, '\u00a0');
|
687
|
+
|
688
|
+
// Detect unordered lists look for bullets
|
689
|
+
if (/^(__MCE_ITEM__)+[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*\u00a0*/.test(val))
|
690
|
+
type = 'ul';
|
691
|
+
|
692
|
+
// Detect ordered lists 1., a. or ixv.
|
693
|
+
if (/^__MCE_ITEM__\s*\w+\.\s*\u00a0{2,}/.test(val))
|
694
|
+
type = 'ol';
|
695
|
+
|
696
|
+
// Check if node value matches the list pattern: o
|
697
|
+
if (type) {
|
698
|
+
margin = parseFloat(p.style.marginLeft || 0);
|
699
|
+
|
700
|
+
if (margin > lastMargin)
|
701
|
+
levels.push(margin);
|
702
|
+
|
703
|
+
if (!listElm || type != lastType) {
|
704
|
+
listElm = dom.create(type);
|
705
|
+
dom.insertAfter(listElm, p);
|
706
|
+
} else {
|
707
|
+
// Nested list element
|
708
|
+
if (margin > lastMargin) {
|
709
|
+
listElm = li.appendChild(dom.create(type));
|
710
|
+
} else if (margin < lastMargin) {
|
711
|
+
// Find parent level based on margin value
|
712
|
+
idx = tinymce.inArray(levels, margin);
|
713
|
+
parents = dom.getParents(listElm.parentNode, type);
|
714
|
+
listElm = parents[parents.length - 1 - idx] || listElm;
|
715
|
+
}
|
716
|
+
}
|
717
|
+
|
718
|
+
// Remove middot or number spans if they exists
|
719
|
+
each(dom.select('span', p), function(span) {
|
720
|
+
var html = span.innerHTML.replace(/<\/?\w+[^>]*>/gi, '');
|
721
|
+
|
722
|
+
// Remove span with the middot or the number
|
723
|
+
if (type == 'ul' && /^__MCE_ITEM__[\u2022\u00b7\u00a7\u00d8o\u25CF]/.test(html))
|
724
|
+
dom.remove(span);
|
725
|
+
else if (/^__MCE_ITEM__[\s\S]*\w+\.( |\u00a0)*\s*/.test(html))
|
726
|
+
dom.remove(span);
|
727
|
+
});
|
728
|
+
|
729
|
+
html = p.innerHTML;
|
730
|
+
|
731
|
+
// Remove middot/list items
|
732
|
+
if (type == 'ul')
|
733
|
+
html = p.innerHTML.replace(/__MCE_ITEM__/g, '').replace(/^[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*( |\u00a0)+\s*/, '');
|
734
|
+
else
|
735
|
+
html = p.innerHTML.replace(/__MCE_ITEM__/g, '').replace(/^\s*\w+\.( |\u00a0)+\s*/, '');
|
736
|
+
|
737
|
+
// Create li and add paragraph data into the new li
|
738
|
+
li = listElm.appendChild(dom.create('li', 0, html));
|
739
|
+
dom.remove(p);
|
740
|
+
|
741
|
+
lastMargin = margin;
|
742
|
+
lastType = type;
|
743
|
+
} else
|
744
|
+
listElm = lastMargin = 0; // End list element
|
745
|
+
});
|
746
|
+
|
747
|
+
// Remove any left over makers
|
748
|
+
html = o.node.innerHTML;
|
749
|
+
if (html.indexOf('__MCE_ITEM__') != -1)
|
750
|
+
o.node.innerHTML = html.replace(/__MCE_ITEM__/g, '');
|
751
|
+
},
|
752
|
+
|
753
|
+
/**
|
754
|
+
* This method will split the current block parent and insert the contents inside the split position.
|
755
|
+
* This logic can be improved so text nodes at the start/end remain in the start/end block elements
|
756
|
+
*/
|
757
|
+
_insertBlockContent : function(ed, dom, content) {
|
758
|
+
var parentBlock, marker, sel = ed.selection, last, elm, vp, y, elmHeight, markerId = 'mce_marker';
|
759
|
+
|
760
|
+
function select(n) {
|
761
|
+
var r;
|
762
|
+
|
763
|
+
if (tinymce.isIE) {
|
764
|
+
r = ed.getDoc().body.createTextRange();
|
765
|
+
r.moveToElementText(n);
|
766
|
+
r.collapse(false);
|
767
|
+
r.select();
|
768
|
+
} else {
|
769
|
+
sel.select(n, 1);
|
770
|
+
sel.collapse(false);
|
771
|
+
}
|
772
|
+
}
|
773
|
+
|
774
|
+
// Insert a marker for the caret position
|
775
|
+
this._insert('<span id="' + markerId + '"></span>', 1);
|
776
|
+
marker = dom.get(markerId);
|
777
|
+
parentBlock = dom.getParent(marker, 'p,h1,h2,h3,h4,h5,h6,ul,ol,th,td');
|
778
|
+
|
779
|
+
// If it's a parent block but not a table cell
|
780
|
+
if (parentBlock && !/TD|TH/.test(parentBlock.nodeName)) {
|
781
|
+
// Split parent block
|
782
|
+
marker = dom.split(parentBlock, marker);
|
783
|
+
|
784
|
+
// Insert nodes before the marker
|
785
|
+
each(dom.create('div', 0, content).childNodes, function(n) {
|
786
|
+
last = marker.parentNode.insertBefore(n.cloneNode(true), marker);
|
787
|
+
});
|
788
|
+
|
789
|
+
// Move caret after marker
|
790
|
+
select(last);
|
791
|
+
} else {
|
792
|
+
dom.setOuterHTML(marker, content);
|
793
|
+
sel.select(ed.getBody(), 1);
|
794
|
+
sel.collapse(0);
|
795
|
+
}
|
796
|
+
|
797
|
+
// Remove marker if it's left
|
798
|
+
while (elm = dom.get(markerId))
|
799
|
+
dom.remove(elm);
|
800
|
+
|
801
|
+
// Get element, position and height
|
802
|
+
elm = sel.getStart();
|
803
|
+
vp = dom.getViewPort(ed.getWin());
|
804
|
+
y = ed.dom.getPos(elm).y;
|
805
|
+
elmHeight = elm.clientHeight;
|
806
|
+
|
807
|
+
// Is element within viewport if not then scroll it into view
|
808
|
+
if (y < vp.y || y + elmHeight > vp.y + vp.h)
|
809
|
+
ed.getDoc().body.scrollTop = y < vp.y ? y : y - vp.h + 25;
|
810
|
+
},
|
811
|
+
|
812
|
+
/**
|
813
|
+
* Inserts the specified contents at the caret position.
|
814
|
+
*/
|
815
|
+
_insert : function(h, skip_undo) {
|
816
|
+
var ed = this.editor, r = ed.selection.getRng();
|
817
|
+
|
818
|
+
// First delete the contents seems to work better on WebKit when the selection spans multiple list items or multiple table cells.
|
819
|
+
if (!ed.selection.isCollapsed() && r.startContainer != r.endContainer)
|
820
|
+
ed.getDoc().execCommand('Delete', false, null);
|
821
|
+
|
822
|
+
// It's better to use the insertHTML method on Gecko since it will combine paragraphs correctly before inserting the contents
|
823
|
+
ed.execCommand(tinymce.isGecko ? 'insertHTML' : 'mceInsertContent', false, h, {skip_undo : skip_undo});
|
824
|
+
},
|
825
|
+
|
826
|
+
/**
|
827
|
+
* Instead of the old plain text method which tried to re-create a paste operation, the
|
828
|
+
* new approach adds a plain text mode toggle switch that changes the behavior of paste.
|
829
|
+
* This function is passed the same input that the regular paste plugin produces.
|
830
|
+
* It performs additional scrubbing and produces (and inserts) the plain text.
|
831
|
+
* This approach leverages all of the great existing functionality in the paste
|
832
|
+
* plugin, and requires minimal changes to add the new functionality.
|
833
|
+
* Speednet - June 2009
|
834
|
+
*/
|
835
|
+
_insertPlainText : function(ed, dom, h) {
|
836
|
+
var i, len, pos, rpos, node, breakElms, before, after,
|
837
|
+
w = ed.getWin(),
|
838
|
+
d = ed.getDoc(),
|
839
|
+
sel = ed.selection,
|
840
|
+
is = tinymce.is,
|
841
|
+
inArray = tinymce.inArray,
|
842
|
+
linebr = getParam(ed, "paste_text_linebreaktype"),
|
843
|
+
rl = getParam(ed, "paste_text_replacements");
|
844
|
+
|
845
|
+
function process(items) {
|
846
|
+
each(items, function(v) {
|
847
|
+
if (v.constructor == RegExp)
|
848
|
+
h = h.replace(v, "");
|
849
|
+
else
|
850
|
+
h = h.replace(v[0], v[1]);
|
851
|
+
});
|
852
|
+
};
|
853
|
+
|
854
|
+
if ((typeof(h) === "string") && (h.length > 0)) {
|
855
|
+
if (!entities)
|
856
|
+
entities = ("34,quot,38,amp,39,apos,60,lt,62,gt," + ed.serializer.settings.entities).split(",");
|
857
|
+
|
858
|
+
// If HTML content with line-breaking tags, then remove all cr/lf chars because only tags will break a line
|
859
|
+
if (/<(?:p|br|h[1-6]|ul|ol|dl|table|t[rdh]|div|blockquote|fieldset|pre|address|center)[^>]*>/i.test(h)) {
|
860
|
+
process([
|
861
|
+
/[\n\r]+/g
|
862
|
+
]);
|
863
|
+
} else {
|
864
|
+
// Otherwise just get rid of carriage returns (only need linefeeds)
|
865
|
+
process([
|
866
|
+
/\r+/g
|
867
|
+
]);
|
868
|
+
}
|
869
|
+
|
870
|
+
process([
|
871
|
+
[/<\/(?:p|h[1-6]|ul|ol|dl|table|div|blockquote|fieldset|pre|address|center)>/gi, "\n\n"], // Block tags get a blank line after them
|
872
|
+
[/<br[^>]*>|<\/tr>/gi, "\n"], // Single linebreak for <br /> tags and table rows
|
873
|
+
[/<\/t[dh]>\s*<t[dh][^>]*>/gi, "\t"], // Table cells get tabs betweem them
|
874
|
+
/<[a-z!\/?][^>]*>/gi, // Delete all remaining tags
|
875
|
+
[/ /gi, " "], // Convert non-break spaces to regular spaces (remember, *plain text*)
|
876
|
+
[
|
877
|
+
// HTML entity
|
878
|
+
/&(#\d+|[a-z0-9]{1,10});/gi,
|
879
|
+
|
880
|
+
// Replace with actual character
|
881
|
+
function(e, s) {
|
882
|
+
if (s.charAt(0) === "#") {
|
883
|
+
return String.fromCharCode(s.slice(1));
|
884
|
+
}
|
885
|
+
else {
|
886
|
+
return ((e = inArray(entities, s)) > 0)? String.fromCharCode(entities[e-1]) : " ";
|
887
|
+
}
|
888
|
+
}
|
889
|
+
],
|
890
|
+
[/(?:(?!\n)\s)*(\n+)(?:(?!\n)\s)*/gi, "$1"], // Cool little RegExp deletes whitespace around linebreak chars.
|
891
|
+
[/\n{3,}/g, "\n\n"], // Max. 2 consecutive linebreaks
|
892
|
+
/^\s+|\s+$/g // Trim the front & back
|
893
|
+
]);
|
894
|
+
|
895
|
+
h = dom.encode(h);
|
896
|
+
|
897
|
+
// Delete any highlighted text before pasting
|
898
|
+
if (!sel.isCollapsed()) {
|
899
|
+
d.execCommand("Delete", false, null);
|
900
|
+
}
|
901
|
+
|
902
|
+
// Perform default or custom replacements
|
903
|
+
if (is(rl, "array") || (is(rl, "array"))) {
|
904
|
+
process(rl);
|
905
|
+
}
|
906
|
+
else if (is(rl, "string")) {
|
907
|
+
process(new RegExp(rl, "gi"));
|
908
|
+
}
|
909
|
+
|
910
|
+
// Treat paragraphs as specified in the config
|
911
|
+
if (linebr == "none") {
|
912
|
+
process([
|
913
|
+
[/\n+/g, " "]
|
914
|
+
]);
|
915
|
+
}
|
916
|
+
else if (linebr == "br") {
|
917
|
+
process([
|
918
|
+
[/\n/g, "<br />"]
|
919
|
+
]);
|
920
|
+
}
|
921
|
+
else {
|
922
|
+
process([
|
923
|
+
/^\s+|\s+$/g,
|
924
|
+
[/\n\n/g, "</p><p>"],
|
925
|
+
[/\n/g, "<br />"]
|
926
|
+
]);
|
927
|
+
}
|
928
|
+
|
929
|
+
// This next piece of code handles the situation where we're pasting more than one paragraph of plain
|
930
|
+
// text, and we are pasting the content into the middle of a block node in the editor. The block
|
931
|
+
// node gets split at the selection point into "Para A" and "Para B" (for the purposes of explaining).
|
932
|
+
// The first paragraph of the pasted text is appended to "Para A", and the last paragraph of the
|
933
|
+
// pasted text is prepended to "Para B". Any other paragraphs of pasted text are placed between
|
934
|
+
// "Para A" and "Para B". This code solves a host of problems with the original plain text plugin and
|
935
|
+
// now handles styles correctly. (Pasting plain text into a styled paragraph is supposed to make the
|
936
|
+
// plain text take the same style as the existing paragraph.)
|
937
|
+
if ((pos = h.indexOf("</p><p>")) != -1) {
|
938
|
+
rpos = h.lastIndexOf("</p><p>");
|
939
|
+
node = sel.getNode();
|
940
|
+
breakElms = []; // Get list of elements to break
|
941
|
+
|
942
|
+
do {
|
943
|
+
if (node.nodeType == 1) {
|
944
|
+
// Don't break tables and break at body
|
945
|
+
if (node.nodeName == "TD" || node.nodeName == "BODY") {
|
946
|
+
break;
|
947
|
+
}
|
948
|
+
|
949
|
+
breakElms[breakElms.length] = node;
|
950
|
+
}
|
951
|
+
} while (node = node.parentNode);
|
952
|
+
|
953
|
+
// Are we in the middle of a block node?
|
954
|
+
if (breakElms.length > 0) {
|
955
|
+
before = h.substring(0, pos);
|
956
|
+
after = "";
|
957
|
+
|
958
|
+
for (i=0, len=breakElms.length; i<len; i++) {
|
959
|
+
before += "</" + breakElms[i].nodeName.toLowerCase() + ">";
|
960
|
+
after += "<" + breakElms[breakElms.length-i-1].nodeName.toLowerCase() + ">";
|
961
|
+
}
|
962
|
+
|
963
|
+
if (pos == rpos) {
|
964
|
+
h = before + after + h.substring(pos+7);
|
965
|
+
}
|
966
|
+
else {
|
967
|
+
h = before + h.substring(pos+4, rpos+4) + after + h.substring(rpos+7);
|
968
|
+
}
|
969
|
+
}
|
970
|
+
}
|
971
|
+
|
972
|
+
// Insert content at the caret, plus add a marker for repositioning the caret
|
973
|
+
ed.execCommand("mceInsertRawHTML", false, h + '<span id="_plain_text_marker"> </span>');
|
974
|
+
|
975
|
+
// Reposition the caret to the marker, which was placed immediately after the inserted content.
|
976
|
+
// Needs to be done asynchronously (in window.setTimeout) or else it doesn't work in all browsers.
|
977
|
+
// The second part of the code scrolls the content up if the caret is positioned off-screen.
|
978
|
+
// This is only necessary for WebKit browsers, but it doesn't hurt to use for all.
|
979
|
+
window.setTimeout(function() {
|
980
|
+
var marker = dom.get('_plain_text_marker'),
|
981
|
+
elm, vp, y, elmHeight;
|
982
|
+
|
983
|
+
sel.select(marker, false);
|
984
|
+
d.execCommand("Delete", false, null);
|
985
|
+
marker = null;
|
986
|
+
|
987
|
+
// Get element, position and height
|
988
|
+
elm = sel.getStart();
|
989
|
+
vp = dom.getViewPort(w);
|
990
|
+
y = dom.getPos(elm).y;
|
991
|
+
elmHeight = elm.clientHeight;
|
992
|
+
|
993
|
+
// Is element within viewport if not then scroll it into view
|
994
|
+
if ((y < vp.y) || (y + elmHeight > vp.y + vp.h)) {
|
995
|
+
d.body.scrollTop = y < vp.y ? y : y - vp.h + 25;
|
996
|
+
}
|
997
|
+
}, 0);
|
998
|
+
}
|
999
|
+
},
|
1000
|
+
|
1001
|
+
/**
|
1002
|
+
* This method will open the old style paste dialogs. Some users might want the old behavior but still use the new cleanup engine.
|
1003
|
+
*/
|
1004
|
+
_legacySupport : function() {
|
1005
|
+
var t = this, ed = t.editor;
|
1006
|
+
|
1007
|
+
// Register command(s) for backwards compatibility
|
1008
|
+
ed.addCommand("mcePasteWord", function() {
|
1009
|
+
ed.windowManager.open({
|
1010
|
+
file: t.url + "/pasteword.htm",
|
1011
|
+
width: parseInt(getParam(ed, "paste_dialog_width")),
|
1012
|
+
height: parseInt(getParam(ed, "paste_dialog_height")),
|
1013
|
+
inline: 1
|
1014
|
+
});
|
1015
|
+
});
|
1016
|
+
|
1017
|
+
if (getParam(ed, "paste_text_use_dialog")) {
|
1018
|
+
ed.addCommand("mcePasteText", function() {
|
1019
|
+
ed.windowManager.open({
|
1020
|
+
file : t.url + "/pastetext.htm",
|
1021
|
+
width: parseInt(getParam(ed, "paste_dialog_width")),
|
1022
|
+
height: parseInt(getParam(ed, "paste_dialog_height")),
|
1023
|
+
inline : 1
|
1024
|
+
});
|
1025
|
+
});
|
1026
|
+
}
|
1027
|
+
|
1028
|
+
// Register button for backwards compatibility
|
1029
|
+
ed.addButton("pasteword", {title : "paste.paste_word_desc", cmd : "mcePasteWord"});
|
1030
|
+
}
|
1031
|
+
});
|
1032
|
+
|
1033
|
+
// Register plugin
|
1034
|
+
tinymce.PluginManager.add("paste", tinymce.plugins.PastePlugin);
|
1035
|
+
})();
|