tinymce-rails 3.5.11.1 → 4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +1 -1
- data/README.md +40 -103
- data/Rakefile +10 -15
- data/app/assets/javascripts/tinymce-jquery.js +1 -1
- data/app/assets/javascripts/tinymce.js +1 -1
- data/app/assets/javascripts/tinymce/preinit.js.erb +1 -2
- data/lib/tasks/tinymce-assets.rake +3 -6
- data/lib/tinymce/rails.rb +1 -1
- data/lib/tinymce/rails/asset_installer.rb +36 -34
- data/lib/tinymce/rails/asset_manifest.rb +89 -108
- data/lib/tinymce/rails/configuration.rb +36 -29
- data/lib/tinymce/rails/engine.rb +1 -40
- data/lib/tinymce/rails/helper.rb +5 -9
- data/lib/tinymce/rails/version.rb +2 -2
- data/vendor/assets/javascripts/tinymce/jquery.tinymce.js +1 -1
- data/vendor/assets/javascripts/tinymce/langs/readme.md +3 -0
- data/vendor/assets/javascripts/tinymce/license.txt +504 -504
- data/vendor/assets/javascripts/tinymce/plugins/advlist/plugin.js +1 -0
- data/vendor/assets/javascripts/tinymce/plugins/anchor/plugin.js +1 -0
- data/vendor/assets/javascripts/tinymce/plugins/autolink/plugin.js +1 -0
- data/vendor/assets/javascripts/tinymce/plugins/autoresize/plugin.js +1 -0
- data/vendor/assets/javascripts/tinymce/plugins/autosave/plugin.js +1 -0
- data/vendor/assets/javascripts/tinymce/plugins/bbcode/plugin.js +1 -0
- data/vendor/assets/javascripts/tinymce/plugins/charmap/plugin.js +1 -0
- data/vendor/assets/javascripts/tinymce/plugins/code/plugin.js +1 -0
- data/vendor/assets/javascripts/tinymce/{utils → plugins/compat3x}/editable_selects.js +70 -70
- data/vendor/assets/javascripts/tinymce/{utils → plugins/compat3x}/form_utils.js +210 -210
- data/vendor/assets/javascripts/tinymce/{utils → plugins/compat3x}/mctabs.js +161 -161
- data/vendor/assets/javascripts/tinymce/plugins/compat3x/tiny_mce_popup.js +435 -0
- data/vendor/assets/javascripts/tinymce/{utils → plugins/compat3x}/validate.js +252 -252
- data/vendor/assets/javascripts/tinymce/plugins/contextmenu/plugin.js +1 -0
- data/vendor/assets/javascripts/tinymce/plugins/directionality/plugin.js +1 -0
- data/vendor/assets/javascripts/tinymce/plugins/{emotions → emoticons}/img/smiley-cool.gif +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/{emotions → emoticons}/img/smiley-cry.gif +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/{emotions → emoticons}/img/smiley-embarassed.gif +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/{emotions → emoticons}/img/smiley-foot-in-mouth.gif +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/{emotions → emoticons}/img/smiley-frown.gif +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/{emotions → emoticons}/img/smiley-innocent.gif +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/{emotions → emoticons}/img/smiley-kiss.gif +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/{emotions → emoticons}/img/smiley-laughing.gif +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/{emotions → emoticons}/img/smiley-money-mouth.gif +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/{emotions → emoticons}/img/smiley-sealed.gif +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/{emotions → emoticons}/img/smiley-smile.gif +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/{emotions → emoticons}/img/smiley-surprised.gif +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/{emotions → emoticons}/img/smiley-tongue-out.gif +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/{emotions → emoticons}/img/smiley-undecided.gif +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/{emotions → emoticons}/img/smiley-wink.gif +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/{emotions → emoticons}/img/smiley-yell.gif +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/emoticons/plugin.js +1 -0
- data/vendor/assets/javascripts/tinymce/plugins/example/plugin.js +1 -0
- data/vendor/assets/javascripts/tinymce/plugins/example_dependency/plugin.js +1 -0
- data/vendor/assets/javascripts/tinymce/plugins/fullpage/plugin.js +1 -0
- data/vendor/assets/javascripts/tinymce/plugins/fullscreen/plugin.js +1 -0
- data/vendor/assets/javascripts/tinymce/plugins/hr/plugin.js +1 -0
- data/vendor/assets/javascripts/tinymce/plugins/image/plugin.js +1 -0
- data/vendor/assets/javascripts/tinymce/plugins/insertdatetime/plugin.js +1 -0
- data/vendor/assets/javascripts/tinymce/plugins/layer/plugin.js +1 -0
- data/vendor/assets/javascripts/tinymce/plugins/legacyoutput/plugin.js +1 -0
- data/vendor/assets/javascripts/tinymce/plugins/link/plugin.js +1 -0
- data/vendor/assets/javascripts/tinymce/plugins/lists/plugin.js +1 -0
- data/vendor/assets/javascripts/tinymce/plugins/media/plugin.js +1 -0
- data/vendor/assets/javascripts/tinymce/plugins/nonbreaking/plugin.js +1 -0
- data/vendor/assets/javascripts/tinymce/plugins/noneditable/plugin.js +1 -0
- data/vendor/assets/javascripts/tinymce/plugins/pagebreak/plugin.js +1 -0
- data/vendor/assets/javascripts/tinymce/plugins/paste/plugin.js +1 -0
- data/vendor/assets/javascripts/tinymce/plugins/preview/plugin.js +1 -0
- data/vendor/assets/javascripts/tinymce/plugins/print/plugin.js +1 -0
- data/vendor/assets/javascripts/tinymce/plugins/save/plugin.js +1 -0
- data/vendor/assets/javascripts/tinymce/plugins/searchreplace/plugin.js +1 -0
- data/vendor/assets/javascripts/tinymce/plugins/spellchecker/plugin.js +1 -0
- data/vendor/assets/javascripts/tinymce/plugins/tabfocus/plugin.js +1 -0
- data/vendor/assets/javascripts/tinymce/plugins/table/plugin.js +1 -0
- data/vendor/assets/javascripts/tinymce/plugins/template/plugin.js +1 -0
- data/vendor/assets/javascripts/tinymce/plugins/textcolor/plugin.js +1 -0
- data/vendor/assets/javascripts/tinymce/plugins/visualblocks/css/visualblocks.css +114 -21
- data/vendor/assets/javascripts/tinymce/plugins/visualblocks/plugin.js +1 -0
- data/vendor/assets/javascripts/tinymce/plugins/visualchars/plugin.js +1 -0
- data/vendor/assets/javascripts/tinymce/plugins/wordcount/plugin.js +1 -0
- data/vendor/assets/javascripts/tinymce/skins/lightgray/content.inline.min.css +1 -0
- data/vendor/assets/javascripts/tinymce/skins/lightgray/content.min.css +1 -0
- data/vendor/assets/javascripts/tinymce/skins/lightgray/fonts/icomoon-small.eot +0 -0
- data/vendor/assets/javascripts/tinymce/skins/lightgray/fonts/icomoon-small.svg +166 -0
- data/vendor/assets/javascripts/tinymce/skins/lightgray/fonts/icomoon-small.ttf +0 -0
- data/vendor/assets/javascripts/tinymce/skins/lightgray/fonts/icomoon-small.woff +0 -0
- data/vendor/assets/javascripts/tinymce/skins/lightgray/fonts/icomoon.eot +0 -0
- data/vendor/assets/javascripts/tinymce/skins/lightgray/fonts/icomoon.svg +150 -0
- data/vendor/assets/javascripts/tinymce/skins/lightgray/fonts/icomoon.ttf +0 -0
- data/vendor/assets/javascripts/tinymce/skins/lightgray/fonts/icomoon.woff +0 -0
- data/vendor/assets/javascripts/tinymce/skins/lightgray/fonts/readme.md +1 -0
- data/vendor/assets/javascripts/tinymce/skins/lightgray/img/anchor.gif +0 -0
- data/vendor/assets/javascripts/tinymce/skins/lightgray/img/loader.gif +0 -0
- data/vendor/assets/javascripts/tinymce/skins/lightgray/img/object.gif +0 -0
- data/vendor/assets/javascripts/tinymce/{themes/advanced → skins/lightgray}/img/trans.gif +0 -0
- data/vendor/assets/javascripts/tinymce/{plugins/spellchecker → skins/lightgray}/img/wline.gif +0 -0
- data/vendor/assets/javascripts/tinymce/skins/lightgray/skin.ie7.min.css +1 -0
- data/vendor/assets/javascripts/tinymce/skins/lightgray/skin.min.css +1 -0
- data/vendor/assets/javascripts/tinymce/themes/modern/theme.js +1 -0
- data/vendor/assets/javascripts/tinymce/tinymce.js +10 -0
- data/vendor/assets/javascripts/tinymce/tinymce_jquery.js +9 -0
- metadata +100 -272
- checksums.yaml +0 -7
- data/lib/tinymce/rails/asset_installer/compile.rb +0 -44
- data/lib/tinymce/rails/asset_installer/copy.rb +0 -52
- data/vendor/assets/javascripts/tinymce/langs/en.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/advhr/css/advhr.css +0 -5
- data/vendor/assets/javascripts/tinymce/plugins/advhr/editor_plugin.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/advhr/editor_plugin_src.js +0 -57
- data/vendor/assets/javascripts/tinymce/plugins/advhr/js/rule.js +0 -43
- data/vendor/assets/javascripts/tinymce/plugins/advhr/langs/en_dlg.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/advhr/rule.htm +0 -58
- data/vendor/assets/javascripts/tinymce/plugins/advimage/css/advimage.css +0 -13
- data/vendor/assets/javascripts/tinymce/plugins/advimage/editor_plugin.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/advimage/editor_plugin_src.js +0 -50
- data/vendor/assets/javascripts/tinymce/plugins/advimage/image.htm +0 -235
- data/vendor/assets/javascripts/tinymce/plugins/advimage/img/sample.gif +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/advimage/js/image.js +0 -464
- data/vendor/assets/javascripts/tinymce/plugins/advimage/langs/en_dlg.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/advlink/css/advlink.css +0 -8
- data/vendor/assets/javascripts/tinymce/plugins/advlink/editor_plugin.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/advlink/editor_plugin_src.js +0 -61
- data/vendor/assets/javascripts/tinymce/plugins/advlink/js/advlink.js +0 -543
- data/vendor/assets/javascripts/tinymce/plugins/advlink/langs/en_dlg.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/advlink/link.htm +0 -338
- data/vendor/assets/javascripts/tinymce/plugins/advlist/editor_plugin.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/advlist/editor_plugin_src.js +0 -176
- data/vendor/assets/javascripts/tinymce/plugins/autolink/editor_plugin.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/autolink/editor_plugin_src.js +0 -184
- data/vendor/assets/javascripts/tinymce/plugins/autoresize/editor_plugin.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/autoresize/editor_plugin_src.js +0 -119
- data/vendor/assets/javascripts/tinymce/plugins/autosave/editor_plugin.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/autosave/editor_plugin_src.js +0 -433
- data/vendor/assets/javascripts/tinymce/plugins/bbcode/editor_plugin.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/bbcode/editor_plugin_src.js +0 -120
- data/vendor/assets/javascripts/tinymce/plugins/contextmenu/editor_plugin.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/contextmenu/editor_plugin_src.js +0 -163
- data/vendor/assets/javascripts/tinymce/plugins/directionality/editor_plugin.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/directionality/editor_plugin_src.js +0 -85
- data/vendor/assets/javascripts/tinymce/plugins/emotions/editor_plugin.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/emotions/editor_plugin_src.js +0 -43
- data/vendor/assets/javascripts/tinymce/plugins/emotions/emotions.htm +0 -42
- data/vendor/assets/javascripts/tinymce/plugins/emotions/js/emotions.js +0 -43
- data/vendor/assets/javascripts/tinymce/plugins/emotions/langs/en_dlg.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/example/dialog.htm +0 -22
- data/vendor/assets/javascripts/tinymce/plugins/example/editor_plugin.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/example/editor_plugin_src.js +0 -84
- data/vendor/assets/javascripts/tinymce/plugins/example/img/example.gif +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/example/js/dialog.js +0 -19
- data/vendor/assets/javascripts/tinymce/plugins/example/langs/en.js +0 -3
- data/vendor/assets/javascripts/tinymce/plugins/example/langs/en_dlg.js +0 -3
- data/vendor/assets/javascripts/tinymce/plugins/example_dependency/editor_plugin.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/example_dependency/editor_plugin_src.js +0 -50
- data/vendor/assets/javascripts/tinymce/plugins/fullpage/css/fullpage.css +0 -143
- data/vendor/assets/javascripts/tinymce/plugins/fullpage/editor_plugin.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/fullpage/editor_plugin_src.js +0 -405
- data/vendor/assets/javascripts/tinymce/plugins/fullpage/fullpage.htm +0 -259
- data/vendor/assets/javascripts/tinymce/plugins/fullpage/js/fullpage.js +0 -232
- data/vendor/assets/javascripts/tinymce/plugins/fullpage/langs/en_dlg.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/fullscreen/editor_plugin.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/fullscreen/editor_plugin_src.js +0 -234
- data/vendor/assets/javascripts/tinymce/plugins/fullscreen/fullscreen.htm +0 -117
- data/vendor/assets/javascripts/tinymce/plugins/iespell/editor_plugin.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/iespell/editor_plugin_src.js +0 -54
- data/vendor/assets/javascripts/tinymce/plugins/inlinepopups/editor_plugin.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/inlinepopups/editor_plugin_src.js +0 -699
- data/vendor/assets/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/button.gif +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/window.css +0 -90
- data/vendor/assets/javascripts/tinymce/plugins/inlinepopups/template.htm +0 -387
- data/vendor/assets/javascripts/tinymce/plugins/insertdatetime/editor_plugin.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/insertdatetime/editor_plugin_src.js +0 -83
- data/vendor/assets/javascripts/tinymce/plugins/layer/editor_plugin.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/layer/editor_plugin_src.js +0 -262
- data/vendor/assets/javascripts/tinymce/plugins/legacyoutput/editor_plugin.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/legacyoutput/editor_plugin_src.js +0 -139
- data/vendor/assets/javascripts/tinymce/plugins/lists/editor_plugin.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/lists/editor_plugin_src.js +0 -955
- data/vendor/assets/javascripts/tinymce/plugins/media/css/media.css +0 -17
- data/vendor/assets/javascripts/tinymce/plugins/media/editor_plugin.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/media/editor_plugin_src.js +0 -898
- data/vendor/assets/javascripts/tinymce/plugins/media/js/embed.js +0 -73
- data/vendor/assets/javascripts/tinymce/plugins/media/js/media.js +0 -513
- data/vendor/assets/javascripts/tinymce/plugins/media/langs/en_dlg.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/media/media.htm +0 -922
- data/vendor/assets/javascripts/tinymce/plugins/nonbreaking/editor_plugin.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/nonbreaking/editor_plugin_src.js +0 -54
- data/vendor/assets/javascripts/tinymce/plugins/noneditable/editor_plugin.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/noneditable/editor_plugin_src.js +0 -537
- data/vendor/assets/javascripts/tinymce/plugins/pagebreak/editor_plugin.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/pagebreak/editor_plugin_src.js +0 -74
- data/vendor/assets/javascripts/tinymce/plugins/paste/editor_plugin.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/paste/editor_plugin_src.js +0 -887
- data/vendor/assets/javascripts/tinymce/plugins/paste/js/pastetext.js +0 -36
- data/vendor/assets/javascripts/tinymce/plugins/paste/js/pasteword.js +0 -51
- data/vendor/assets/javascripts/tinymce/plugins/paste/langs/en_dlg.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/paste/pastetext.htm +0 -27
- data/vendor/assets/javascripts/tinymce/plugins/paste/pasteword.htm +0 -21
- data/vendor/assets/javascripts/tinymce/plugins/preview/editor_plugin.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/preview/editor_plugin_src.js +0 -53
- data/vendor/assets/javascripts/tinymce/plugins/preview/example.html +0 -28
- data/vendor/assets/javascripts/tinymce/plugins/preview/jscripts/embed.js +0 -73
- data/vendor/assets/javascripts/tinymce/plugins/preview/preview.html +0 -17
- data/vendor/assets/javascripts/tinymce/plugins/print/editor_plugin.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/print/editor_plugin_src.js +0 -34
- data/vendor/assets/javascripts/tinymce/plugins/save/editor_plugin.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/save/editor_plugin_src.js +0 -101
- data/vendor/assets/javascripts/tinymce/plugins/searchreplace/css/searchreplace.css +0 -6
- data/vendor/assets/javascripts/tinymce/plugins/searchreplace/editor_plugin.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/searchreplace/editor_plugin_src.js +0 -61
- data/vendor/assets/javascripts/tinymce/plugins/searchreplace/js/searchreplace.js +0 -152
- data/vendor/assets/javascripts/tinymce/plugins/searchreplace/langs/en_dlg.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/searchreplace/searchreplace.htm +0 -100
- data/vendor/assets/javascripts/tinymce/plugins/spellchecker/css/content.css +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/spellchecker/editor_plugin.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/spellchecker/editor_plugin_src.js +0 -471
- data/vendor/assets/javascripts/tinymce/plugins/style/css/props.css +0 -14
- data/vendor/assets/javascripts/tinymce/plugins/style/editor_plugin.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/style/editor_plugin_src.js +0 -71
- data/vendor/assets/javascripts/tinymce/plugins/style/js/props.js +0 -709
- data/vendor/assets/javascripts/tinymce/plugins/style/langs/en_dlg.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/style/props.htm +0 -845
- data/vendor/assets/javascripts/tinymce/plugins/style/readme.txt +0 -19
- data/vendor/assets/javascripts/tinymce/plugins/tabfocus/editor_plugin.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/tabfocus/editor_plugin_src.js +0 -122
- data/vendor/assets/javascripts/tinymce/plugins/table/cell.htm +0 -180
- data/vendor/assets/javascripts/tinymce/plugins/table/css/cell.css +0 -17
- data/vendor/assets/javascripts/tinymce/plugins/table/css/row.css +0 -25
- data/vendor/assets/javascripts/tinymce/plugins/table/css/table.css +0 -13
- data/vendor/assets/javascripts/tinymce/plugins/table/editor_plugin.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/table/editor_plugin_src.js +0 -1456
- data/vendor/assets/javascripts/tinymce/plugins/table/js/cell.js +0 -319
- data/vendor/assets/javascripts/tinymce/plugins/table/js/merge_cells.js +0 -27
- data/vendor/assets/javascripts/tinymce/plugins/table/js/row.js +0 -254
- data/vendor/assets/javascripts/tinymce/plugins/table/js/table.js +0 -501
- data/vendor/assets/javascripts/tinymce/plugins/table/langs/en_dlg.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/table/merge_cells.htm +0 -32
- data/vendor/assets/javascripts/tinymce/plugins/table/row.htm +0 -158
- data/vendor/assets/javascripts/tinymce/plugins/table/table.htm +0 -188
- data/vendor/assets/javascripts/tinymce/plugins/template/blank.htm +0 -12
- data/vendor/assets/javascripts/tinymce/plugins/template/css/template.css +0 -23
- data/vendor/assets/javascripts/tinymce/plugins/template/editor_plugin.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/template/editor_plugin_src.js +0 -159
- data/vendor/assets/javascripts/tinymce/plugins/template/js/template.js +0 -106
- data/vendor/assets/javascripts/tinymce/plugins/template/langs/en_dlg.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/template/template.htm +0 -31
- data/vendor/assets/javascripts/tinymce/plugins/visualblocks/editor_plugin.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/visualblocks/editor_plugin_src.js +0 -63
- data/vendor/assets/javascripts/tinymce/plugins/visualchars/editor_plugin.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/visualchars/editor_plugin_src.js +0 -83
- data/vendor/assets/javascripts/tinymce/plugins/wordcount/editor_plugin.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/wordcount/editor_plugin_src.js +0 -122
- data/vendor/assets/javascripts/tinymce/plugins/xhtmlxtras/abbr.htm +0 -142
- data/vendor/assets/javascripts/tinymce/plugins/xhtmlxtras/acronym.htm +0 -142
- data/vendor/assets/javascripts/tinymce/plugins/xhtmlxtras/attributes.htm +0 -149
- data/vendor/assets/javascripts/tinymce/plugins/xhtmlxtras/cite.htm +0 -142
- data/vendor/assets/javascripts/tinymce/plugins/xhtmlxtras/css/attributes.css +0 -11
- data/vendor/assets/javascripts/tinymce/plugins/xhtmlxtras/css/popup.css +0 -9
- data/vendor/assets/javascripts/tinymce/plugins/xhtmlxtras/del.htm +0 -162
- data/vendor/assets/javascripts/tinymce/plugins/xhtmlxtras/editor_plugin.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/xhtmlxtras/editor_plugin_src.js +0 -132
- data/vendor/assets/javascripts/tinymce/plugins/xhtmlxtras/ins.htm +0 -162
- data/vendor/assets/javascripts/tinymce/plugins/xhtmlxtras/js/abbr.js +0 -28
- data/vendor/assets/javascripts/tinymce/plugins/xhtmlxtras/js/acronym.js +0 -28
- data/vendor/assets/javascripts/tinymce/plugins/xhtmlxtras/js/attributes.js +0 -111
- data/vendor/assets/javascripts/tinymce/plugins/xhtmlxtras/js/cite.js +0 -28
- data/vendor/assets/javascripts/tinymce/plugins/xhtmlxtras/js/del.js +0 -53
- data/vendor/assets/javascripts/tinymce/plugins/xhtmlxtras/js/element_common.js +0 -229
- data/vendor/assets/javascripts/tinymce/plugins/xhtmlxtras/js/ins.js +0 -53
- data/vendor/assets/javascripts/tinymce/plugins/xhtmlxtras/langs/en_dlg.js +0 -1
- data/vendor/assets/javascripts/tinymce/themes/advanced/about.htm +0 -52
- data/vendor/assets/javascripts/tinymce/themes/advanced/anchor.htm +0 -26
- data/vendor/assets/javascripts/tinymce/themes/advanced/charmap.htm +0 -55
- data/vendor/assets/javascripts/tinymce/themes/advanced/color_picker.htm +0 -70
- data/vendor/assets/javascripts/tinymce/themes/advanced/editor_template.js +0 -1
- data/vendor/assets/javascripts/tinymce/themes/advanced/editor_template_src.js +0 -1490
- data/vendor/assets/javascripts/tinymce/themes/advanced/image.htm +0 -80
- data/vendor/assets/javascripts/tinymce/themes/advanced/img/colorpicker.jpg +0 -0
- data/vendor/assets/javascripts/tinymce/themes/advanced/img/flash.gif +0 -0
- data/vendor/assets/javascripts/tinymce/themes/advanced/img/icons.gif +0 -0
- data/vendor/assets/javascripts/tinymce/themes/advanced/img/iframe.gif +0 -0
- data/vendor/assets/javascripts/tinymce/themes/advanced/img/pagebreak.gif +0 -0
- data/vendor/assets/javascripts/tinymce/themes/advanced/img/quicktime.gif +0 -0
- data/vendor/assets/javascripts/tinymce/themes/advanced/img/realmedia.gif +0 -0
- data/vendor/assets/javascripts/tinymce/themes/advanced/img/shockwave.gif +0 -0
- data/vendor/assets/javascripts/tinymce/themes/advanced/img/video.gif +0 -0
- data/vendor/assets/javascripts/tinymce/themes/advanced/img/windowsmedia.gif +0 -0
- data/vendor/assets/javascripts/tinymce/themes/advanced/js/about.js +0 -73
- data/vendor/assets/javascripts/tinymce/themes/advanced/js/anchor.js +0 -56
- data/vendor/assets/javascripts/tinymce/themes/advanced/js/charmap.js +0 -363
- data/vendor/assets/javascripts/tinymce/themes/advanced/js/color_picker.js +0 -345
- data/vendor/assets/javascripts/tinymce/themes/advanced/js/image.js +0 -253
- data/vendor/assets/javascripts/tinymce/themes/advanced/js/link.js +0 -159
- data/vendor/assets/javascripts/tinymce/themes/advanced/js/source_editor.js +0 -78
- data/vendor/assets/javascripts/tinymce/themes/advanced/langs/en.js +0 -1
- data/vendor/assets/javascripts/tinymce/themes/advanced/langs/en_dlg.js +0 -1
- data/vendor/assets/javascripts/tinymce/themes/advanced/link.htm +0 -57
- data/vendor/assets/javascripts/tinymce/themes/advanced/shortcuts.htm +0 -47
- data/vendor/assets/javascripts/tinymce/themes/advanced/skins/default/content.css +0 -50
- data/vendor/assets/javascripts/tinymce/themes/advanced/skins/default/dialog.css +0 -118
- data/vendor/assets/javascripts/tinymce/themes/advanced/skins/default/img/buttons.png +0 -0
- data/vendor/assets/javascripts/tinymce/themes/advanced/skins/default/img/items.gif +0 -0
- data/vendor/assets/javascripts/tinymce/themes/advanced/skins/default/img/menu_arrow.gif +0 -0
- data/vendor/assets/javascripts/tinymce/themes/advanced/skins/default/img/menu_check.gif +0 -0
- data/vendor/assets/javascripts/tinymce/themes/advanced/skins/default/img/progress.gif +0 -0
- data/vendor/assets/javascripts/tinymce/themes/advanced/skins/default/img/tabs.gif +0 -0
- data/vendor/assets/javascripts/tinymce/themes/advanced/skins/default/ui.css +0 -219
- data/vendor/assets/javascripts/tinymce/themes/advanced/skins/highcontrast/content.css +0 -24
- data/vendor/assets/javascripts/tinymce/themes/advanced/skins/highcontrast/dialog.css +0 -106
- data/vendor/assets/javascripts/tinymce/themes/advanced/skins/highcontrast/ui.css +0 -106
- data/vendor/assets/javascripts/tinymce/themes/advanced/skins/o2k7/content.css +0 -48
- data/vendor/assets/javascripts/tinymce/themes/advanced/skins/o2k7/dialog.css +0 -118
- data/vendor/assets/javascripts/tinymce/themes/advanced/skins/o2k7/img/button_bg.png +0 -0
- data/vendor/assets/javascripts/tinymce/themes/advanced/skins/o2k7/img/button_bg_black.png +0 -0
- data/vendor/assets/javascripts/tinymce/themes/advanced/skins/o2k7/img/button_bg_silver.png +0 -0
- data/vendor/assets/javascripts/tinymce/themes/advanced/skins/o2k7/ui.css +0 -222
- data/vendor/assets/javascripts/tinymce/themes/advanced/skins/o2k7/ui_black.css +0 -8
- data/vendor/assets/javascripts/tinymce/themes/advanced/skins/o2k7/ui_silver.css +0 -5
- data/vendor/assets/javascripts/tinymce/themes/advanced/source_editor.htm +0 -25
- data/vendor/assets/javascripts/tinymce/themes/simple/editor_template.js +0 -1
- data/vendor/assets/javascripts/tinymce/themes/simple/editor_template_src.js +0 -84
- data/vendor/assets/javascripts/tinymce/themes/simple/img/icons.gif +0 -0
- data/vendor/assets/javascripts/tinymce/themes/simple/langs/en.js +0 -1
- data/vendor/assets/javascripts/tinymce/themes/simple/skins/default/content.css +0 -25
- data/vendor/assets/javascripts/tinymce/themes/simple/skins/default/ui.css +0 -32
- data/vendor/assets/javascripts/tinymce/themes/simple/skins/o2k7/content.css +0 -17
- data/vendor/assets/javascripts/tinymce/themes/simple/skins/o2k7/img/button_bg.png +0 -0
- data/vendor/assets/javascripts/tinymce/themes/simple/skins/o2k7/ui.css +0 -35
- data/vendor/assets/javascripts/tinymce/tiny_mce.js +0 -1
- data/vendor/assets/javascripts/tinymce/tiny_mce_jquery.js +0 -1
- data/vendor/assets/javascripts/tinymce/tiny_mce_jquery_src.js +0 -17942
- data/vendor/assets/javascripts/tinymce/tiny_mce_popup.js +0 -5
- data/vendor/assets/javascripts/tinymce/tiny_mce_src.js +0 -19156
@@ -1 +0,0 @@
|
|
1
|
-
(function(){tinymce.create("tinymce.plugins.PageBreakPlugin",{init:function(b,d){var f='<img src="'+b.theme.url+'/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.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)})();
|
@@ -1,74 +0,0 @@
|
|
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="' + ed.theme.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.theme.onResolveName) {
|
28
|
-
ed.theme.onResolveName.add(function(th, o) {
|
29
|
-
if (o.node.nodeName == 'IMG' && ed.dom.hasClass(o.node, cls))
|
30
|
-
o.name = 'pagebreak';
|
31
|
-
});
|
32
|
-
}
|
33
|
-
});
|
34
|
-
|
35
|
-
ed.onClick.add(function(ed, e) {
|
36
|
-
e = e.target;
|
37
|
-
|
38
|
-
if (e.nodeName === 'IMG' && ed.dom.hasClass(e, cls))
|
39
|
-
ed.selection.select(e);
|
40
|
-
});
|
41
|
-
|
42
|
-
ed.onNodeChange.add(function(ed, cm, n) {
|
43
|
-
cm.setActive('pagebreak', n.nodeName === 'IMG' && ed.dom.hasClass(n, cls));
|
44
|
-
});
|
45
|
-
|
46
|
-
ed.onBeforeSetContent.add(function(ed, o) {
|
47
|
-
o.content = o.content.replace(pbRE, pb);
|
48
|
-
});
|
49
|
-
|
50
|
-
ed.onPostProcess.add(function(ed, o) {
|
51
|
-
if (o.get)
|
52
|
-
o.content = o.content.replace(/<img[^>]+>/g, function(im) {
|
53
|
-
if (im.indexOf('class="mcePageBreak') !== -1)
|
54
|
-
im = sep;
|
55
|
-
|
56
|
-
return im;
|
57
|
-
});
|
58
|
-
});
|
59
|
-
},
|
60
|
-
|
61
|
-
getInfo : function() {
|
62
|
-
return {
|
63
|
-
longname : 'PageBreak',
|
64
|
-
author : 'Moxiecode Systems AB',
|
65
|
-
authorurl : 'http://tinymce.moxiecode.com',
|
66
|
-
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/pagebreak',
|
67
|
-
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
68
|
-
};
|
69
|
-
}
|
70
|
-
});
|
71
|
-
|
72
|
-
// Register plugin
|
73
|
-
tinymce.PluginManager.add('pagebreak', tinymce.plugins.PageBreakPlugin);
|
74
|
-
})();
|
@@ -1 +0,0 @@
|
|
1
|
-
(function(){var c=tinymce.each,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_max_consecutive_linebreaks:2,paste_text_use_dialog:false,paste_text_sticky:false,paste_text_sticky_default:false,paste_text_notifyalways:false,paste_text_linebreaktype:"combined",paste_text_replacements:[[/\u2026/g,"..."],[/[\x93\x94\u201c\u201d]/g,'"'],[/[\x60\x91\x92\u2018\u2019]/g,"'"]]};function b(d,e){return d.getParam(e,a[e])}tinymce.create("tinymce.plugins.PastePlugin",{init:function(d,e){var f=this;f.editor=d;f.url=e;f.onPreProcess=new tinymce.util.Dispatcher(f);f.onPostProcess=new tinymce.util.Dispatcher(f);f.onPreProcess.add(f._preProcess);f.onPostProcess.add(f._postProcess);f.onPreProcess.add(function(i,j){d.execCallback("paste_preprocess",i,j)});f.onPostProcess.add(function(i,j){d.execCallback("paste_postprocess",i,j)});d.onKeyDown.addToTop(function(i,j){if(((tinymce.isMac?j.metaKey:j.ctrlKey)&&j.keyCode==86)||(j.shiftKey&&j.keyCode==45)){return false}});d.pasteAsPlainText=b(d,"paste_text_sticky_default");function h(l,j){var k=d.dom,i;f.onPreProcess.dispatch(f,l);l.node=k.create("div",0,l.content);if(tinymce.isGecko){i=d.selection.getRng(true);if(i.startContainer==i.endContainer&&i.startContainer.nodeType==3){if(l.node.childNodes.length===1&&/^(p|h[1-6]|pre)$/i.test(l.node.firstChild.nodeName)&&l.content.indexOf("__MCE_ITEM__")===-1){k.remove(l.node.firstChild,true)}}}f.onPostProcess.dispatch(f,l);l.content=d.serializer.serialize(l.node,{getInner:1,forced_root_block:""});if((!j)&&(d.pasteAsPlainText)){f._insertPlainText(l.content);if(!b(d,"paste_text_sticky")){d.pasteAsPlainText=false;d.controlManager.setActive("pastetext",false)}}else{f._insert(l.content)}}d.addCommand("mceInsertClipboardContent",function(i,j){h(j,true)});if(!b(d,"paste_text_use_dialog")){d.addCommand("mcePasteText",function(j,i){var k=tinymce.util.Cookie;d.pasteAsPlainText=!d.pasteAsPlainText;d.controlManager.setActive("pastetext",d.pasteAsPlainText);if((d.pasteAsPlainText)&&(!k.get("tinymcePasteText"))){if(b(d,"paste_text_sticky")){d.windowManager.alert(d.translate("paste.plaintext_mode_sticky"))}else{d.windowManager.alert(d.translate("paste.plaintext_mode"))}if(!b(d,"paste_text_notifyalways")){k.set("tinymcePasteText","1",new Date(new Date().getFullYear()+1,12,31))}}})}d.addButton("pastetext",{title:"paste.paste_text_desc",cmd:"mcePasteText"});d.addButton("selectall",{title:"paste.selectall_desc",cmd:"selectall"});function g(s){var l,p,j,t,k=d.selection,o=d.dom,q=d.getBody(),i,r;if(s.clipboardData||o.doc.dataTransfer){r=(s.clipboardData||o.doc.dataTransfer).getData("Text");if(d.pasteAsPlainText){s.preventDefault();h({content:o.encode(r).replace(/\r?\n/g,"<br />")});return}}if(o.get("_mcePaste")){return}l=o.add(q,"div",{id:"_mcePaste","class":"mcePaste","data-mce-bogus":"1"},"\uFEFF\uFEFF");if(q!=d.getDoc().body){i=o.getPos(d.selection.getStart(),q).y}else{i=q.scrollTop+o.getViewPort(d.getWin()).y}o.setStyles(l,{position:"absolute",left:tinymce.isGecko?-40:0,top:i-25,width:1,height:1,overflow:"hidden"});if(tinymce.isIE){t=k.getRng();j=o.doc.body.createTextRange();j.moveToElementText(l);j.execCommand("Paste");o.remove(l);if(l.innerHTML==="\uFEFF\uFEFF"){d.execCommand("mcePasteWord");s.preventDefault();return}k.setRng(t);k.setContent("");setTimeout(function(){h({content:l.innerHTML})},0);return tinymce.dom.Event.cancel(s)}else{function m(n){n.preventDefault()}o.bind(d.getDoc(),"mousedown",m);o.bind(d.getDoc(),"keydown",m);p=d.selection.getRng();l=l.firstChild;j=d.getDoc().createRange();j.setStart(l,0);j.setEnd(l,2);k.setRng(j);window.setTimeout(function(){var u="",n;if(!o.select("div.mcePaste > div.mcePaste").length){n=o.select("div.mcePaste");c(n,function(w){var v=w.firstChild;if(v&&v.nodeName=="DIV"&&v.style.marginTop&&v.style.backgroundColor){o.remove(v,1)}c(o.select("span.Apple-style-span",w),function(x){o.remove(x,1)});c(o.select("br[data-mce-bogus]",w),function(x){o.remove(x)});if(w.parentNode.className!="mcePaste"){u+=w.innerHTML}})}else{u="<p>"+o.encode(r).replace(/\r?\n\r?\n/g,"</p><p>").replace(/\r?\n/g,"<br />")+"</p>"}c(o.select("div.mcePaste"),function(v){o.remove(v)});if(p){k.setRng(p)}h({content:u});o.unbind(d.getDoc(),"mousedown",m);o.unbind(d.getDoc(),"keydown",m)},0)}}if(b(d,"paste_auto_cleanup_on_paste")){if(tinymce.isOpera||/Firefox\/2/.test(navigator.userAgent)){d.onKeyDown.addToTop(function(i,j){if(((tinymce.isMac?j.metaKey:j.ctrlKey)&&j.keyCode==86)||(j.shiftKey&&j.keyCode==45)){g(j)}})}else{d.onPaste.addToTop(function(i,j){return g(j)})}}d.onInit.add(function(){d.controlManager.setActive("pastetext",d.pasteAsPlainText);if(b(d,"paste_block_drop")){d.dom.bind(d.getBody(),["dragend","dragover","draggesture","dragdrop","drop","drag"],function(i){i.preventDefault();i.stopPropagation();return false})}});f._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(g,e){var k=this.editor,j=e.content,p=tinymce.grep,n=tinymce.explode,f=tinymce.trim,l,i;function d(h){c(h,function(o){if(o.constructor==RegExp){j=j.replace(o,"")}else{j=j.replace(o[0],o[1])}})}if(k.settings.paste_enable_default_filters==false){return}if(tinymce.isIE&&document.documentMode>=9&&/<(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)/.test(e.content)){d([[/(?:<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"]]);d([[/<br><br>/g,"<BR><BR>"],[/<br>/g," "],[/<BR><BR>/g,"<br>"]])}if(/class="?Mso|style="[^"]*\bmso-|w:WordDocument/i.test(j)||e.wordContent){e.wordContent=true;d([/^\s*( )+/gi,/( |<br[^>]*>)+\s*$/gi]);if(b(k,"paste_convert_headers_to_strong")){j=j.replace(/<p [^>]*class="?MsoHeading"?[^>]*>(.*?)<\/p>/gi,"<p><strong>$1</strong></p>")}if(b(k,"paste_convert_middot_lists")){d([[/<!--\[if !supportLists\]-->/gi,"$&__MCE_ITEM__"],[/(<span[^>]+(?:mso-list:|:\s*symbol)[^>]+>)/gi,"$1__MCE_ITEM__"],[/(<p[^>]+(?:MsoListParagraph)[^>]+>)/gi,"$1__MCE_ITEM__"]])}d([/<!--[\s\S]+?-->/gi,/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,[/<(\/?)s>/gi,"<$1strike>"],[/ /gi,"\u00a0"]]);do{l=j.length;j=j.replace(/(<?!(ol|ul)[^>]*\s)(?:id|name|language|type|on\w+|\w+:\w+)=(?:"[^"]*"|\w+)\s?/gi,"$1");j=j.replace(/(<(ol|ul)[^>]*\s)(?:id|name|language|on\w+|\w+:\w+)=(?:"[^"]*"|\w+)\s?/gi,"$1")}while(l!=j.length);if(b(k,"paste_retain_style_properties").replace(/^none$/i,"").length==0){j=j.replace(/<\/?span[^>]*>/gi,"")}else{d([[/<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(t,h,r){var u=[],o=0,q=n(f(r).replace(/"/gi,"'"),";");c(q,function(s){var w,y,z=n(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":u[o++]=w.replace(/^mso-|-alt$/g,"")+":"+x(y);return;case"horiz-align":u[o++]="text-align:"+y;return;case"vert-align":u[o++]="vertical-align:"+y;return;case"font-color":case"mso-foreground":u[o++]="color:"+y;return;case"mso-background":case"mso-highlight":u[o++]="background:"+y;return;case"mso-default-height":u[o++]="min-height:"+x(y);return;case"mso-default-width":u[o++]="min-width:"+x(y);return;case"mso-padding-between-alt":u[o++]="border-collapse:separate;border-spacing:"+x(y);return;case"text-line-through":if((y=="single")||(y=="double")){u[o++]="text-decoration:line-through"}return;case"mso-zero-height":if(y=="yes"){u[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}u[o++]=w+":"+z[1]}});if(o>0){return h+' style="'+u.join(";")+'"'}else{return h}}]])}}if(b(k,"paste_convert_headers_to_strong")){d([[/<h[1-6][^>]*>/gi,"<p><strong>"],[/<\/h[1-6][^>]*>/gi,"</strong></p>"]])}d([[/Version:[\d.]+\nStartHTML:\d+\nEndHTML:\d+\nStartFragment:\d+\nEndFragment:\d+/gi,""]]);i=b(k,"paste_strip_class_attributes");if(i!=="none"){function m(q,o){if(i==="all"){return""}var h=p(n(o.replace(/^(["'])(.*)\1$/,"$2")," "),function(r){return(/^(?!mso)/i.test(r))});return h.length?' class="'+h.join(" ")+'"':""}j=j.replace(/ class="([^"]+)"/gi,m);j=j.replace(/ class=([\-\w]+)/gi,m)}if(b(k,"paste_remove_spans")){j=j.replace(/<\/?span[^>]*>/gi,"")}e.content=j},_postProcess:function(g,i){var f=this,e=f.editor,h=e.dom,d;if(e.settings.paste_enable_default_filters==false){return}if(i.wordContent){c(h.select("a",i.node),function(j){if(!j.href||j.href.indexOf("#_Toc")!=-1){h.remove(j,1)}});if(b(e,"paste_convert_middot_lists")){f._convertLists(g,i)}d=b(e,"paste_retain_style_properties");if((tinymce.is(d,"string"))&&(d!=="all")&&(d!=="*")){d=tinymce.explode(d.replace(/^none$/i,""));c(h.select("*",i.node),function(m){var n={},k=0,l,o,j;if(d){for(l=0;l<d.length;l++){o=d[l];j=h.getStyle(m,o);if(j){n[o]=j;k++}}}h.setAttrib(m,"style","");if(d&&k>0){h.setStyles(m,n)}else{if(m.nodeName=="SPAN"&&!m.className){h.remove(m,true)}}})}}if(b(e,"paste_remove_styles")||(b(e,"paste_remove_styles_if_webkit")&&tinymce.isWebKit)){c(h.select("*[style]",i.node),function(j){j.removeAttribute("style");j.removeAttribute("data-mce-style")})}else{if(tinymce.isWebKit){c(h.select("*",i.node),function(j){j.removeAttribute("data-mce-style")})}}},_convertLists:function(g,e){var i=g.editor.dom,h,l,d=-1,f,m=[],k,j;c(i.select("p",e.node),function(t){var q,u="",s,r,n,o;for(q=t.firstChild;q&&q.nodeType==3;q=q.nextSibling){u+=q.nodeValue}u=t.innerHTML.replace(/<\/?\w+[^>]*>/gi,"").replace(/ /g,"\u00a0");if(/^(__MCE_ITEM__)+[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*\u00a0*/.test(u)){s="ul"}if(/^__MCE_ITEM__\s*\w+\.\s*\u00a0+/.test(u)){s="ol"}if(s){f=parseFloat(t.style.marginLeft||0);if(f>d){m.push(f)}if(!h||s!=k){h=i.create(s);i.insertAfter(h,t)}else{if(f>d){h=l.appendChild(i.create(s))}else{if(f<d){n=tinymce.inArray(m,f);o=i.getParents(h.parentNode,s);h=o[o.length-1-n]||h}}}c(i.select("span",t),function(v){var p=v.innerHTML.replace(/<\/?\w+[^>]*>/gi,"");if(s=="ul"&&/^__MCE_ITEM__[\u2022\u00b7\u00a7\u00d8o\u25CF]/.test(p)){i.remove(v)}else{if(/^__MCE_ITEM__[\s\S]*\w+\.( |\u00a0)*\s*/.test(p)){i.remove(v)}}});r=t.innerHTML;if(s=="ul"){r=t.innerHTML.replace(/__MCE_ITEM__/g,"").replace(/^[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*( |\u00a0)+\s*/,"")}else{r=t.innerHTML.replace(/__MCE_ITEM__/g,"").replace(/^\s*[\w|'<'|'>']+\.( |\u00a0)+\s*/,"")}l=h.appendChild(i.create("li",0,r));i.remove(t);d=f;k=s}else{h=d=0}});j=e.node.innerHTML;if(j.indexOf("__MCE_ITEM__")!=-1){e.node.innerHTML=j.replace(/__MCE_ITEM__/g,"")}},_insert:function(f,d){var e=this.editor,g=e.selection.getRng();if(!e.selection.isCollapsed()&&g.startContainer!=g.endContainer){e.getDoc().execCommand("Delete",false,null)}e.execCommand("mceInsertContent",false,f,{skip_undo:d})},_insertPlainText:function(j){var h=this.editor,f=b(h,"paste_text_linebreaktype"),k=b(h,"paste_text_replacements"),g=tinymce.is;function e(m){c(m,function(n){if(n.constructor==RegExp){j=j.replace(n,"")}else{j=j.replace(n[0],n[1])}})}if((typeof(j)==="string")&&(j.length>0)){if(/<(?:p|br|h[1-6]|ul|ol|dl|table|t[rdh]|div|blockquote|fieldset|pre|address|center)[^>]*>/i.test(j)){e([/[\n\r]+/g])}else{e([/\r+/g])}e([[/<\/(?: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," "],[/(?:(?!\n)\s)*(\n+)(?:(?!\n)\s)*/gi,"$1"]]);var d=Number(b(h,"paste_max_consecutive_linebreaks"));if(d>-1){var l=new RegExp("\n{"+(d+1)+",}","g");var i="";while(i.length<d){i+="\n"}e([[l,i]])}j=h.dom.decode(tinymce.html.Entities.encodeRaw(j));if(g(k,"array")){e(k)}else{if(g(k,"string")){e(new RegExp(k,"gi"))}}if(f=="none"){e([[/\n+/g," "]])}else{if(f=="br"){e([[/\n/g,"<br />"]])}else{if(f=="p"){e([[/\n+/g,"</p><p>"],[/^(.*<\/p>)(<p>)$/,"<p>$1"]])}else{e([[/\n\n/g,"</p><p>"],[/^(.*<\/p>)(<p>)$/,"<p>$1"],[/\n/g,"<br />"]])}}}h.execCommand("mceInsertContent",false,j)}},_legacySupport:function(){var e=this,d=e.editor;d.addCommand("mcePasteWord",function(){d.windowManager.open({file:e.url+"/pasteword.htm",width:parseInt(b(d,"paste_dialog_width")),height:parseInt(b(d,"paste_dialog_height")),inline:1})});if(b(d,"paste_text_use_dialog")){d.addCommand("mcePasteText",function(){d.windowManager.open({file:e.url+"/pastetext.htm",width:parseInt(b(d,"paste_dialog_width")),height:parseInt(b(d,"paste_dialog_height")),inline:1})})}d.addButton("pasteword",{title:"paste.paste_word_desc",cmd:"mcePasteWord"})}});tinymce.PluginManager.add("paste",tinymce.plugins.PastePlugin)})();
|
@@ -1,887 +0,0 @@
|
|
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
|
-
defs = {
|
14
|
-
paste_auto_cleanup_on_paste : true,
|
15
|
-
paste_enable_default_filters : true,
|
16
|
-
paste_block_drop : false,
|
17
|
-
paste_retain_style_properties : "none",
|
18
|
-
paste_strip_class_attributes : "mso",
|
19
|
-
paste_remove_spans : false,
|
20
|
-
paste_remove_styles : false,
|
21
|
-
paste_remove_styles_if_webkit : true,
|
22
|
-
paste_convert_middot_lists : true,
|
23
|
-
paste_convert_headers_to_strong : false,
|
24
|
-
paste_dialog_width : "450",
|
25
|
-
paste_dialog_height : "400",
|
26
|
-
paste_max_consecutive_linebreaks: 2,
|
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 : "combined",
|
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
|
-
|
43
|
-
tinymce.create('tinymce.plugins.PastePlugin', {
|
44
|
-
init : function(ed, url) {
|
45
|
-
var t = this;
|
46
|
-
|
47
|
-
t.editor = ed;
|
48
|
-
t.url = url;
|
49
|
-
|
50
|
-
// Setup plugin events
|
51
|
-
t.onPreProcess = new tinymce.util.Dispatcher(t);
|
52
|
-
t.onPostProcess = new tinymce.util.Dispatcher(t);
|
53
|
-
|
54
|
-
// Register default handlers
|
55
|
-
t.onPreProcess.add(t._preProcess);
|
56
|
-
t.onPostProcess.add(t._postProcess);
|
57
|
-
|
58
|
-
// Register optional preprocess handler
|
59
|
-
t.onPreProcess.add(function(pl, o) {
|
60
|
-
ed.execCallback('paste_preprocess', pl, o);
|
61
|
-
});
|
62
|
-
|
63
|
-
// Register optional postprocess
|
64
|
-
t.onPostProcess.add(function(pl, o) {
|
65
|
-
ed.execCallback('paste_postprocess', pl, o);
|
66
|
-
});
|
67
|
-
|
68
|
-
ed.onKeyDown.addToTop(function(ed, e) {
|
69
|
-
// Block ctrl+v from adding an undo level since the default logic in tinymce.Editor will add that
|
70
|
-
if (((tinymce.isMac ? e.metaKey : e.ctrlKey) && e.keyCode == 86) || (e.shiftKey && e.keyCode == 45))
|
71
|
-
return false; // Stop other listeners
|
72
|
-
});
|
73
|
-
|
74
|
-
// Initialize plain text flag
|
75
|
-
ed.pasteAsPlainText = getParam(ed, 'paste_text_sticky_default');
|
76
|
-
|
77
|
-
// This function executes the process handlers and inserts the contents
|
78
|
-
// force_rich overrides plain text mode set by user, important for pasting with execCommand
|
79
|
-
function process(o, force_rich) {
|
80
|
-
var dom = ed.dom, rng;
|
81
|
-
|
82
|
-
// Execute pre process handlers
|
83
|
-
t.onPreProcess.dispatch(t, o);
|
84
|
-
|
85
|
-
// Create DOM structure
|
86
|
-
o.node = dom.create('div', 0, o.content);
|
87
|
-
|
88
|
-
// If pasting inside the same element and the contents is only one block
|
89
|
-
// remove the block and keep the text since Firefox will copy parts of pre and h1-h6 as a pre element
|
90
|
-
if (tinymce.isGecko) {
|
91
|
-
rng = ed.selection.getRng(true);
|
92
|
-
if (rng.startContainer == rng.endContainer && rng.startContainer.nodeType == 3) {
|
93
|
-
// Is only one block node and it doesn't contain word stuff
|
94
|
-
if (o.node.childNodes.length === 1 && /^(p|h[1-6]|pre)$/i.test(o.node.firstChild.nodeName) && o.content.indexOf('__MCE_ITEM__') === -1)
|
95
|
-
dom.remove(o.node.firstChild, true);
|
96
|
-
}
|
97
|
-
}
|
98
|
-
|
99
|
-
// Execute post process handlers
|
100
|
-
t.onPostProcess.dispatch(t, o);
|
101
|
-
|
102
|
-
// Serialize content
|
103
|
-
o.content = ed.serializer.serialize(o.node, {getInner : 1, forced_root_block : ''});
|
104
|
-
|
105
|
-
// Plain text option active?
|
106
|
-
if ((!force_rich) && (ed.pasteAsPlainText)) {
|
107
|
-
t._insertPlainText(o.content);
|
108
|
-
|
109
|
-
if (!getParam(ed, "paste_text_sticky")) {
|
110
|
-
ed.pasteAsPlainText = false;
|
111
|
-
ed.controlManager.setActive("pastetext", false);
|
112
|
-
}
|
113
|
-
} else {
|
114
|
-
t._insert(o.content);
|
115
|
-
}
|
116
|
-
}
|
117
|
-
|
118
|
-
// Add command for external usage
|
119
|
-
ed.addCommand('mceInsertClipboardContent', function(u, o) {
|
120
|
-
process(o, true);
|
121
|
-
});
|
122
|
-
|
123
|
-
if (!getParam(ed, "paste_text_use_dialog")) {
|
124
|
-
ed.addCommand('mcePasteText', function(u, v) {
|
125
|
-
var cookie = tinymce.util.Cookie;
|
126
|
-
|
127
|
-
ed.pasteAsPlainText = !ed.pasteAsPlainText;
|
128
|
-
ed.controlManager.setActive('pastetext', ed.pasteAsPlainText);
|
129
|
-
|
130
|
-
if ((ed.pasteAsPlainText) && (!cookie.get("tinymcePasteText"))) {
|
131
|
-
if (getParam(ed, "paste_text_sticky")) {
|
132
|
-
ed.windowManager.alert(ed.translate('paste.plaintext_mode_sticky'));
|
133
|
-
} else {
|
134
|
-
ed.windowManager.alert(ed.translate('paste.plaintext_mode'));
|
135
|
-
}
|
136
|
-
|
137
|
-
if (!getParam(ed, "paste_text_notifyalways")) {
|
138
|
-
cookie.set("tinymcePasteText", "1", new Date(new Date().getFullYear() + 1, 12, 31))
|
139
|
-
}
|
140
|
-
}
|
141
|
-
});
|
142
|
-
}
|
143
|
-
|
144
|
-
ed.addButton('pastetext', {title: 'paste.paste_text_desc', cmd: 'mcePasteText'});
|
145
|
-
ed.addButton('selectall', {title: 'paste.selectall_desc', cmd: 'selectall'});
|
146
|
-
|
147
|
-
// This function grabs the contents from the clipboard by adding a
|
148
|
-
// hidden div and placing the caret inside it and after the browser paste
|
149
|
-
// is done it grabs that contents and processes that
|
150
|
-
function grabContent(e) {
|
151
|
-
var n, or, rng, oldRng, sel = ed.selection, dom = ed.dom, body = ed.getBody(), posY, textContent;
|
152
|
-
|
153
|
-
// Check if browser supports direct plaintext access
|
154
|
-
if (e.clipboardData || dom.doc.dataTransfer) {
|
155
|
-
textContent = (e.clipboardData || dom.doc.dataTransfer).getData('Text');
|
156
|
-
|
157
|
-
if (ed.pasteAsPlainText) {
|
158
|
-
e.preventDefault();
|
159
|
-
process({content : dom.encode(textContent).replace(/\r?\n/g, '<br />')});
|
160
|
-
return;
|
161
|
-
}
|
162
|
-
}
|
163
|
-
|
164
|
-
if (dom.get('_mcePaste'))
|
165
|
-
return;
|
166
|
-
|
167
|
-
// Create container to paste into
|
168
|
-
n = dom.add(body, 'div', {id : '_mcePaste', 'class' : 'mcePaste', 'data-mce-bogus' : '1'}, '\uFEFF\uFEFF');
|
169
|
-
|
170
|
-
// If contentEditable mode we need to find out the position of the closest element
|
171
|
-
if (body != ed.getDoc().body)
|
172
|
-
posY = dom.getPos(ed.selection.getStart(), body).y;
|
173
|
-
else
|
174
|
-
posY = body.scrollTop + dom.getViewPort(ed.getWin()).y;
|
175
|
-
|
176
|
-
// Styles needs to be applied after the element is added to the document since WebKit will otherwise remove all styles
|
177
|
-
// If also needs to be in view on IE or the paste would fail
|
178
|
-
dom.setStyles(n, {
|
179
|
-
position : 'absolute',
|
180
|
-
left : tinymce.isGecko ? -40 : 0, // Need to move it out of site on Gecko since it will othewise display a ghost resize rect for the div
|
181
|
-
top : posY - 25,
|
182
|
-
width : 1,
|
183
|
-
height : 1,
|
184
|
-
overflow : 'hidden'
|
185
|
-
});
|
186
|
-
|
187
|
-
if (tinymce.isIE) {
|
188
|
-
// Store away the old range
|
189
|
-
oldRng = sel.getRng();
|
190
|
-
|
191
|
-
// Select the container
|
192
|
-
rng = dom.doc.body.createTextRange();
|
193
|
-
rng.moveToElementText(n);
|
194
|
-
rng.execCommand('Paste');
|
195
|
-
|
196
|
-
// Remove container
|
197
|
-
dom.remove(n);
|
198
|
-
|
199
|
-
// Check if the contents was changed, if it wasn't then clipboard extraction failed probably due
|
200
|
-
// to IE security settings so we pass the junk though better than nothing right
|
201
|
-
if (n.innerHTML === '\uFEFF\uFEFF') {
|
202
|
-
ed.execCommand('mcePasteWord');
|
203
|
-
e.preventDefault();
|
204
|
-
return;
|
205
|
-
}
|
206
|
-
|
207
|
-
// Restore the old range and clear the contents before pasting
|
208
|
-
sel.setRng(oldRng);
|
209
|
-
sel.setContent('');
|
210
|
-
|
211
|
-
// For some odd reason we need to detach the the mceInsertContent call from the paste event
|
212
|
-
// It's like IE has a reference to the parent element that you paste in and the selection gets messed up
|
213
|
-
// when it tries to restore the selection
|
214
|
-
setTimeout(function() {
|
215
|
-
// Process contents
|
216
|
-
process({content : n.innerHTML});
|
217
|
-
}, 0);
|
218
|
-
|
219
|
-
// Block the real paste event
|
220
|
-
return tinymce.dom.Event.cancel(e);
|
221
|
-
} else {
|
222
|
-
function block(e) {
|
223
|
-
e.preventDefault();
|
224
|
-
};
|
225
|
-
|
226
|
-
// Block mousedown and click to prevent selection change
|
227
|
-
dom.bind(ed.getDoc(), 'mousedown', block);
|
228
|
-
dom.bind(ed.getDoc(), 'keydown', block);
|
229
|
-
|
230
|
-
or = ed.selection.getRng();
|
231
|
-
|
232
|
-
// Move select contents inside DIV
|
233
|
-
n = n.firstChild;
|
234
|
-
rng = ed.getDoc().createRange();
|
235
|
-
rng.setStart(n, 0);
|
236
|
-
rng.setEnd(n, 2);
|
237
|
-
sel.setRng(rng);
|
238
|
-
|
239
|
-
// Wait a while and grab the pasted contents
|
240
|
-
window.setTimeout(function() {
|
241
|
-
var h = '', nl;
|
242
|
-
|
243
|
-
// Paste divs duplicated in paste divs seems to happen when you paste plain text so lets first look for that broken behavior in WebKit
|
244
|
-
if (!dom.select('div.mcePaste > div.mcePaste').length) {
|
245
|
-
nl = dom.select('div.mcePaste');
|
246
|
-
|
247
|
-
// WebKit will split the div into multiple ones so this will loop through then all and join them to get the whole HTML string
|
248
|
-
each(nl, function(n) {
|
249
|
-
var child = n.firstChild;
|
250
|
-
|
251
|
-
// WebKit inserts a DIV container with lots of odd styles
|
252
|
-
if (child && child.nodeName == 'DIV' && child.style.marginTop && child.style.backgroundColor) {
|
253
|
-
dom.remove(child, 1);
|
254
|
-
}
|
255
|
-
|
256
|
-
// Remove apply style spans
|
257
|
-
each(dom.select('span.Apple-style-span', n), function(n) {
|
258
|
-
dom.remove(n, 1);
|
259
|
-
});
|
260
|
-
|
261
|
-
// Remove bogus br elements
|
262
|
-
each(dom.select('br[data-mce-bogus]', n), function(n) {
|
263
|
-
dom.remove(n);
|
264
|
-
});
|
265
|
-
|
266
|
-
// WebKit will make a copy of the DIV for each line of plain text pasted and insert them into the DIV
|
267
|
-
if (n.parentNode.className != 'mcePaste')
|
268
|
-
h += n.innerHTML;
|
269
|
-
});
|
270
|
-
} else {
|
271
|
-
// Found WebKit weirdness so force the content into paragraphs this seems to happen when you paste plain text from Nodepad etc
|
272
|
-
// So this logic will replace double enter with paragraphs and single enter with br so it kind of looks the same
|
273
|
-
h = '<p>' + dom.encode(textContent).replace(/\r?\n\r?\n/g, '</p><p>').replace(/\r?\n/g, '<br />') + '</p>';
|
274
|
-
}
|
275
|
-
|
276
|
-
// Remove the nodes
|
277
|
-
each(dom.select('div.mcePaste'), function(n) {
|
278
|
-
dom.remove(n);
|
279
|
-
});
|
280
|
-
|
281
|
-
// Restore the old selection
|
282
|
-
if (or)
|
283
|
-
sel.setRng(or);
|
284
|
-
|
285
|
-
process({content : h});
|
286
|
-
|
287
|
-
// Unblock events ones we got the contents
|
288
|
-
dom.unbind(ed.getDoc(), 'mousedown', block);
|
289
|
-
dom.unbind(ed.getDoc(), 'keydown', block);
|
290
|
-
}, 0);
|
291
|
-
}
|
292
|
-
}
|
293
|
-
|
294
|
-
// Check if we should use the new auto process method
|
295
|
-
if (getParam(ed, "paste_auto_cleanup_on_paste")) {
|
296
|
-
// Is it's Opera or older FF use key handler
|
297
|
-
if (tinymce.isOpera || /Firefox\/2/.test(navigator.userAgent)) {
|
298
|
-
ed.onKeyDown.addToTop(function(ed, e) {
|
299
|
-
if (((tinymce.isMac ? e.metaKey : e.ctrlKey) && e.keyCode == 86) || (e.shiftKey && e.keyCode == 45))
|
300
|
-
grabContent(e);
|
301
|
-
});
|
302
|
-
} else {
|
303
|
-
// Grab contents on paste event on Gecko and WebKit
|
304
|
-
ed.onPaste.addToTop(function(ed, e) {
|
305
|
-
return grabContent(e);
|
306
|
-
});
|
307
|
-
}
|
308
|
-
}
|
309
|
-
|
310
|
-
ed.onInit.add(function() {
|
311
|
-
ed.controlManager.setActive("pastetext", ed.pasteAsPlainText);
|
312
|
-
|
313
|
-
// Block all drag/drop events
|
314
|
-
if (getParam(ed, "paste_block_drop")) {
|
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
|
-
var ed = this.editor,
|
340
|
-
h = o.content,
|
341
|
-
grep = tinymce.grep,
|
342
|
-
explode = tinymce.explode,
|
343
|
-
trim = tinymce.trim,
|
344
|
-
len, stripClass;
|
345
|
-
|
346
|
-
//console.log('Before preprocess:' + o.content);
|
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 && /<(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)/.test(o.content)) {
|
364
|
-
// IE9 adds BRs before/after block elements when contents is pasted from word or for example another browser
|
365
|
-
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']]);
|
366
|
-
|
367
|
-
// IE9 also adds an extra BR element for each soft-linefeed and it also adds a BR for each word wrap break
|
368
|
-
process([
|
369
|
-
[/<br><br>/g, '<BR><BR>'], // Replace multiple BR elements with uppercase BR to keep them intact
|
370
|
-
[/<br>/g, ' '], // Replace single br elements with space since they are word wrap BR:s
|
371
|
-
[/<BR><BR>/g, '<br>'] // Replace back the double brs but into a single BR
|
372
|
-
]);
|
373
|
-
}
|
374
|
-
|
375
|
-
// Detect Word content and process it more aggressive
|
376
|
-
if (/class="?Mso|style="[^"]*\bmso-|w:WordDocument/i.test(h) || o.wordContent) {
|
377
|
-
o.wordContent = true; // Mark the pasted contents as word specific content
|
378
|
-
//console.log('Word contents detected.');
|
379
|
-
|
380
|
-
// Process away some basic content
|
381
|
-
process([
|
382
|
-
/^\s*( )+/gi, // entities at the start of contents
|
383
|
-
/( |<br[^>]*>)+\s*$/gi // entities at the end of contents
|
384
|
-
]);
|
385
|
-
|
386
|
-
if (getParam(ed, "paste_convert_headers_to_strong")) {
|
387
|
-
h = h.replace(/<p [^>]*class="?MsoHeading"?[^>]*>(.*?)<\/p>/gi, "<p><strong>$1</strong></p>");
|
388
|
-
}
|
389
|
-
|
390
|
-
if (getParam(ed, "paste_convert_middot_lists")) {
|
391
|
-
process([
|
392
|
-
[/<!--\[if !supportLists\]-->/gi, '$&__MCE_ITEM__'], // Convert supportLists to a list item marker
|
393
|
-
[/(<span[^>]+(?:mso-list:|:\s*symbol)[^>]+>)/gi, '$1__MCE_ITEM__'], // Convert mso-list and symbol spans to item markers
|
394
|
-
[/(<p[^>]+(?:MsoListParagraph)[^>]+>)/gi, '$1__MCE_ITEM__'] // Convert mso-list and symbol paragraphs to item markers (FF)
|
395
|
-
]);
|
396
|
-
}
|
397
|
-
|
398
|
-
process([
|
399
|
-
// Word comments like conditional comments etc
|
400
|
-
/<!--[\s\S]+?-->/gi,
|
401
|
-
|
402
|
-
// Remove comments, scripts (e.g., msoShowComment), XML tag, VML content, MS Office namespaced tags, and a few other tags
|
403
|
-
/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,
|
404
|
-
|
405
|
-
// Convert <s> into <strike> for line-though
|
406
|
-
[/<(\/?)s>/gi, "<$1strike>"],
|
407
|
-
|
408
|
-
// Replace nsbp entites to char since it's easier to handle
|
409
|
-
[/ /gi, "\u00a0"]
|
410
|
-
]);
|
411
|
-
|
412
|
-
// Remove bad attributes, with or without quotes, ensuring that attribute text is really inside a tag.
|
413
|
-
// 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.
|
414
|
-
do {
|
415
|
-
len = h.length;
|
416
|
-
// Don't remove the type attribute for lists so that non-default list types display correctly.
|
417
|
-
h = h.replace(/(<?!(ol|ul)[^>]*\s)(?:id|name|language|type|on\w+|\w+:\w+)=(?:"[^"]*"|\w+)\s?/gi, "$1");
|
418
|
-
h = h.replace(/(<(ol|ul)[^>]*\s)(?:id|name|language|on\w+|\w+:\w+)=(?:"[^"]*"|\w+)\s?/gi, "$1");
|
419
|
-
} while (len != h.length);
|
420
|
-
|
421
|
-
// Remove all spans if no styles is to be retained
|
422
|
-
if (getParam(ed, "paste_retain_style_properties").replace(/^none$/i, "").length == 0) {
|
423
|
-
h = h.replace(/<\/?span[^>]*>/gi, "");
|
424
|
-
} else {
|
425
|
-
// We're keeping styles, so at least clean them up.
|
426
|
-
// CSS Reference: http://msdn.microsoft.com/en-us/library/aa155477.aspx
|
427
|
-
|
428
|
-
process([
|
429
|
-
// Convert <span style="mso-spacerun:yes">___</span> to string of alternating breaking/non-breaking spaces of same length
|
430
|
-
[/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,
|
431
|
-
function(str, spaces) {
|
432
|
-
return (spaces.length > 0)? spaces.replace(/./, " ").slice(Math.floor(spaces.length/2)).split("").join("\u00a0") : "";
|
433
|
-
}
|
434
|
-
],
|
435
|
-
|
436
|
-
// Examine all styles: delete junk, transform some, and keep the rest
|
437
|
-
[/(<[a-z][^>]*)\sstyle="([^"]*)"/gi,
|
438
|
-
function(str, tag, style) {
|
439
|
-
var n = [],
|
440
|
-
i = 0,
|
441
|
-
s = explode(trim(style).replace(/"/gi, "'"), ";");
|
442
|
-
|
443
|
-
// Examine each style definition within the tag's style attribute
|
444
|
-
each(s, function(v) {
|
445
|
-
var name, value,
|
446
|
-
parts = explode(v, ":");
|
447
|
-
|
448
|
-
function ensureUnits(v) {
|
449
|
-
return v + ((v !== "0") && (/\d$/.test(v)))? "px" : "";
|
450
|
-
}
|
451
|
-
|
452
|
-
if (parts.length == 2) {
|
453
|
-
name = parts[0].toLowerCase();
|
454
|
-
value = parts[1].toLowerCase();
|
455
|
-
|
456
|
-
// Translate certain MS Office styles into their CSS equivalents
|
457
|
-
switch (name) {
|
458
|
-
case "mso-padding-alt":
|
459
|
-
case "mso-padding-top-alt":
|
460
|
-
case "mso-padding-right-alt":
|
461
|
-
case "mso-padding-bottom-alt":
|
462
|
-
case "mso-padding-left-alt":
|
463
|
-
case "mso-margin-alt":
|
464
|
-
case "mso-margin-top-alt":
|
465
|
-
case "mso-margin-right-alt":
|
466
|
-
case "mso-margin-bottom-alt":
|
467
|
-
case "mso-margin-left-alt":
|
468
|
-
case "mso-table-layout-alt":
|
469
|
-
case "mso-height":
|
470
|
-
case "mso-width":
|
471
|
-
case "mso-vertical-align-alt":
|
472
|
-
n[i++] = name.replace(/^mso-|-alt$/g, "") + ":" + ensureUnits(value);
|
473
|
-
return;
|
474
|
-
|
475
|
-
case "horiz-align":
|
476
|
-
n[i++] = "text-align:" + value;
|
477
|
-
return;
|
478
|
-
|
479
|
-
case "vert-align":
|
480
|
-
n[i++] = "vertical-align:" + value;
|
481
|
-
return;
|
482
|
-
|
483
|
-
case "font-color":
|
484
|
-
case "mso-foreground":
|
485
|
-
n[i++] = "color:" + value;
|
486
|
-
return;
|
487
|
-
|
488
|
-
case "mso-background":
|
489
|
-
case "mso-highlight":
|
490
|
-
n[i++] = "background:" + value;
|
491
|
-
return;
|
492
|
-
|
493
|
-
case "mso-default-height":
|
494
|
-
n[i++] = "min-height:" + ensureUnits(value);
|
495
|
-
return;
|
496
|
-
|
497
|
-
case "mso-default-width":
|
498
|
-
n[i++] = "min-width:" + ensureUnits(value);
|
499
|
-
return;
|
500
|
-
|
501
|
-
case "mso-padding-between-alt":
|
502
|
-
n[i++] = "border-collapse:separate;border-spacing:" + ensureUnits(value);
|
503
|
-
return;
|
504
|
-
|
505
|
-
case "text-line-through":
|
506
|
-
if ((value == "single") || (value == "double")) {
|
507
|
-
n[i++] = "text-decoration:line-through";
|
508
|
-
}
|
509
|
-
return;
|
510
|
-
|
511
|
-
case "mso-zero-height":
|
512
|
-
if (value == "yes") {
|
513
|
-
n[i++] = "display:none";
|
514
|
-
}
|
515
|
-
return;
|
516
|
-
}
|
517
|
-
|
518
|
-
// Eliminate all MS Office style definitions that have no CSS equivalent by examining the first characters in the name
|
519
|
-
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)) {
|
520
|
-
return;
|
521
|
-
}
|
522
|
-
|
523
|
-
// If it reached this point, it must be a valid CSS style
|
524
|
-
n[i++] = name + ":" + parts[1]; // Lower-case name, but keep value case
|
525
|
-
}
|
526
|
-
});
|
527
|
-
|
528
|
-
// If style attribute contained any valid styles the re-write it; otherwise delete style attribute.
|
529
|
-
if (i > 0) {
|
530
|
-
return tag + ' style="' + n.join(';') + '"';
|
531
|
-
} else {
|
532
|
-
return tag;
|
533
|
-
}
|
534
|
-
}
|
535
|
-
]
|
536
|
-
]);
|
537
|
-
}
|
538
|
-
}
|
539
|
-
|
540
|
-
// Replace headers with <strong>
|
541
|
-
if (getParam(ed, "paste_convert_headers_to_strong")) {
|
542
|
-
process([
|
543
|
-
[/<h[1-6][^>]*>/gi, "<p><strong>"],
|
544
|
-
[/<\/h[1-6][^>]*>/gi, "</strong></p>"]
|
545
|
-
]);
|
546
|
-
}
|
547
|
-
|
548
|
-
process([
|
549
|
-
// Copy paste from Java like Open Office will produce this junk on FF
|
550
|
-
[/Version:[\d.]+\nStartHTML:\d+\nEndHTML:\d+\nStartFragment:\d+\nEndFragment:\d+/gi, '']
|
551
|
-
]);
|
552
|
-
|
553
|
-
// Class attribute options are: leave all as-is ("none"), remove all ("all"), or remove only those starting with mso ("mso").
|
554
|
-
// Note:- paste_strip_class_attributes: "none", verify_css_classes: true is also a good variation.
|
555
|
-
stripClass = getParam(ed, "paste_strip_class_attributes");
|
556
|
-
|
557
|
-
if (stripClass !== "none") {
|
558
|
-
function removeClasses(match, g1) {
|
559
|
-
if (stripClass === "all")
|
560
|
-
return '';
|
561
|
-
|
562
|
-
var cls = grep(explode(g1.replace(/^(["'])(.*)\1$/, "$2"), " "),
|
563
|
-
function(v) {
|
564
|
-
return (/^(?!mso)/i.test(v));
|
565
|
-
}
|
566
|
-
);
|
567
|
-
|
568
|
-
return cls.length ? ' class="' + cls.join(" ") + '"' : '';
|
569
|
-
};
|
570
|
-
|
571
|
-
h = h.replace(/ class="([^"]+)"/gi, removeClasses);
|
572
|
-
h = h.replace(/ class=([\-\w]+)/gi, removeClasses);
|
573
|
-
}
|
574
|
-
|
575
|
-
// Remove spans option
|
576
|
-
if (getParam(ed, "paste_remove_spans")) {
|
577
|
-
h = h.replace(/<\/?span[^>]*>/gi, "");
|
578
|
-
}
|
579
|
-
|
580
|
-
//console.log('After preprocess:' + h);
|
581
|
-
|
582
|
-
o.content = h;
|
583
|
-
},
|
584
|
-
|
585
|
-
/**
|
586
|
-
* Various post process items.
|
587
|
-
*/
|
588
|
-
_postProcess : function(pl, o) {
|
589
|
-
var t = this, ed = t.editor, dom = ed.dom, styleProps;
|
590
|
-
|
591
|
-
if (ed.settings.paste_enable_default_filters == false) {
|
592
|
-
return;
|
593
|
-
}
|
594
|
-
|
595
|
-
if (o.wordContent) {
|
596
|
-
// Remove named anchors or TOC links
|
597
|
-
each(dom.select('a', o.node), function(a) {
|
598
|
-
if (!a.href || a.href.indexOf('#_Toc') != -1)
|
599
|
-
dom.remove(a, 1);
|
600
|
-
});
|
601
|
-
|
602
|
-
if (getParam(ed, "paste_convert_middot_lists")) {
|
603
|
-
t._convertLists(pl, o);
|
604
|
-
}
|
605
|
-
|
606
|
-
// Process styles
|
607
|
-
styleProps = getParam(ed, "paste_retain_style_properties"); // retained properties
|
608
|
-
|
609
|
-
// Process only if a string was specified and not equal to "all" or "*"
|
610
|
-
if ((tinymce.is(styleProps, "string")) && (styleProps !== "all") && (styleProps !== "*")) {
|
611
|
-
styleProps = tinymce.explode(styleProps.replace(/^none$/i, ""));
|
612
|
-
|
613
|
-
// Retains some style properties
|
614
|
-
each(dom.select('*', o.node), function(el) {
|
615
|
-
var newStyle = {}, npc = 0, i, sp, sv;
|
616
|
-
|
617
|
-
// Store a subset of the existing styles
|
618
|
-
if (styleProps) {
|
619
|
-
for (i = 0; i < styleProps.length; i++) {
|
620
|
-
sp = styleProps[i];
|
621
|
-
sv = dom.getStyle(el, sp);
|
622
|
-
|
623
|
-
if (sv) {
|
624
|
-
newStyle[sp] = sv;
|
625
|
-
npc++;
|
626
|
-
}
|
627
|
-
}
|
628
|
-
}
|
629
|
-
|
630
|
-
// Remove all of the existing styles
|
631
|
-
dom.setAttrib(el, 'style', '');
|
632
|
-
|
633
|
-
if (styleProps && npc > 0)
|
634
|
-
dom.setStyles(el, newStyle); // Add back the stored subset of styles
|
635
|
-
else // Remove empty span tags that do not have class attributes
|
636
|
-
if (el.nodeName == 'SPAN' && !el.className)
|
637
|
-
dom.remove(el, true);
|
638
|
-
});
|
639
|
-
}
|
640
|
-
}
|
641
|
-
|
642
|
-
// Remove all style information or only specifically on WebKit to avoid the style bug on that browser
|
643
|
-
if (getParam(ed, "paste_remove_styles") || (getParam(ed, "paste_remove_styles_if_webkit") && tinymce.isWebKit)) {
|
644
|
-
each(dom.select('*[style]', o.node), function(el) {
|
645
|
-
el.removeAttribute('style');
|
646
|
-
el.removeAttribute('data-mce-style');
|
647
|
-
});
|
648
|
-
} else {
|
649
|
-
if (tinymce.isWebKit) {
|
650
|
-
// 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 ..." />
|
651
|
-
// Removing the mce_style that contains the real value will force the Serializer engine to compress the styles
|
652
|
-
each(dom.select('*', o.node), function(el) {
|
653
|
-
el.removeAttribute('data-mce-style');
|
654
|
-
});
|
655
|
-
}
|
656
|
-
}
|
657
|
-
},
|
658
|
-
|
659
|
-
/**
|
660
|
-
* Converts the most common bullet and number formats in Office into a real semantic UL/LI list.
|
661
|
-
*/
|
662
|
-
_convertLists : function(pl, o) {
|
663
|
-
var dom = pl.editor.dom, listElm, li, lastMargin = -1, margin, levels = [], lastType, html;
|
664
|
-
|
665
|
-
// Convert middot lists into real semantic lists
|
666
|
-
each(dom.select('p', o.node), function(p) {
|
667
|
-
var sib, val = '', type, html, idx, parents;
|
668
|
-
|
669
|
-
// Get text node value at beginning of paragraph
|
670
|
-
for (sib = p.firstChild; sib && sib.nodeType == 3; sib = sib.nextSibling)
|
671
|
-
val += sib.nodeValue;
|
672
|
-
|
673
|
-
val = p.innerHTML.replace(/<\/?\w+[^>]*>/gi, '').replace(/ /g, '\u00a0');
|
674
|
-
|
675
|
-
// Detect unordered lists look for bullets
|
676
|
-
if (/^(__MCE_ITEM__)+[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*\u00a0*/.test(val))
|
677
|
-
type = 'ul';
|
678
|
-
|
679
|
-
// Detect ordered lists 1., a. or ixv.
|
680
|
-
if (/^__MCE_ITEM__\s*\w+\.\s*\u00a0+/.test(val))
|
681
|
-
type = 'ol';
|
682
|
-
|
683
|
-
// Check if node value matches the list pattern: o
|
684
|
-
if (type) {
|
685
|
-
margin = parseFloat(p.style.marginLeft || 0);
|
686
|
-
|
687
|
-
if (margin > lastMargin)
|
688
|
-
levels.push(margin);
|
689
|
-
|
690
|
-
if (!listElm || type != lastType) {
|
691
|
-
listElm = dom.create(type);
|
692
|
-
dom.insertAfter(listElm, p);
|
693
|
-
} else {
|
694
|
-
// Nested list element
|
695
|
-
if (margin > lastMargin) {
|
696
|
-
listElm = li.appendChild(dom.create(type));
|
697
|
-
} else if (margin < lastMargin) {
|
698
|
-
// Find parent level based on margin value
|
699
|
-
idx = tinymce.inArray(levels, margin);
|
700
|
-
parents = dom.getParents(listElm.parentNode, type);
|
701
|
-
listElm = parents[parents.length - 1 - idx] || listElm;
|
702
|
-
}
|
703
|
-
}
|
704
|
-
|
705
|
-
// Remove middot or number spans if they exists
|
706
|
-
each(dom.select('span', p), function(span) {
|
707
|
-
var html = span.innerHTML.replace(/<\/?\w+[^>]*>/gi, '');
|
708
|
-
|
709
|
-
// Remove span with the middot or the number
|
710
|
-
if (type == 'ul' && /^__MCE_ITEM__[\u2022\u00b7\u00a7\u00d8o\u25CF]/.test(html))
|
711
|
-
dom.remove(span);
|
712
|
-
else if (/^__MCE_ITEM__[\s\S]*\w+\.( |\u00a0)*\s*/.test(html))
|
713
|
-
dom.remove(span);
|
714
|
-
});
|
715
|
-
|
716
|
-
html = p.innerHTML;
|
717
|
-
|
718
|
-
// Remove middot/list items
|
719
|
-
if (type == 'ul')
|
720
|
-
html = p.innerHTML.replace(/__MCE_ITEM__/g, '').replace(/^[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*( |\u00a0)+\s*/, '');
|
721
|
-
else
|
722
|
-
html = p.innerHTML.replace(/__MCE_ITEM__/g, '').replace(/^\s*[\w|'<'|'>']+\.( |\u00a0)+\s*/, '');;
|
723
|
-
|
724
|
-
// Create li and add paragraph data into the new li
|
725
|
-
li = listElm.appendChild(dom.create('li', 0, html));
|
726
|
-
dom.remove(p);
|
727
|
-
|
728
|
-
lastMargin = margin;
|
729
|
-
lastType = type;
|
730
|
-
} else
|
731
|
-
listElm = lastMargin = 0; // End list element
|
732
|
-
});
|
733
|
-
|
734
|
-
// Remove any left over makers
|
735
|
-
html = o.node.innerHTML;
|
736
|
-
if (html.indexOf('__MCE_ITEM__') != -1)
|
737
|
-
o.node.innerHTML = html.replace(/__MCE_ITEM__/g, '');
|
738
|
-
},
|
739
|
-
|
740
|
-
/**
|
741
|
-
* Inserts the specified contents at the caret position.
|
742
|
-
*/
|
743
|
-
_insert : function(h, skip_undo) {
|
744
|
-
var ed = this.editor, r = ed.selection.getRng();
|
745
|
-
|
746
|
-
// First delete the contents seems to work better on WebKit when the selection spans multiple list items or multiple table cells.
|
747
|
-
if (!ed.selection.isCollapsed() && r.startContainer != r.endContainer)
|
748
|
-
ed.getDoc().execCommand('Delete', false, null);
|
749
|
-
|
750
|
-
ed.execCommand('mceInsertContent', false, h, {skip_undo : skip_undo});
|
751
|
-
},
|
752
|
-
|
753
|
-
/**
|
754
|
-
* Instead of the old plain text method which tried to re-create a paste operation, the
|
755
|
-
* new approach adds a plain text mode toggle switch that changes the behavior of paste.
|
756
|
-
* This function is passed the same input that the regular paste plugin produces.
|
757
|
-
* It performs additional scrubbing and produces (and inserts) the plain text.
|
758
|
-
* This approach leverages all of the great existing functionality in the paste
|
759
|
-
* plugin, and requires minimal changes to add the new functionality.
|
760
|
-
* Speednet - June 2009
|
761
|
-
*/
|
762
|
-
_insertPlainText : function(content) {
|
763
|
-
var ed = this.editor,
|
764
|
-
linebr = getParam(ed, "paste_text_linebreaktype"),
|
765
|
-
rl = getParam(ed, "paste_text_replacements"),
|
766
|
-
is = tinymce.is;
|
767
|
-
|
768
|
-
function process(items) {
|
769
|
-
each(items, function(v) {
|
770
|
-
if (v.constructor == RegExp)
|
771
|
-
content = content.replace(v, "");
|
772
|
-
else
|
773
|
-
content = content.replace(v[0], v[1]);
|
774
|
-
});
|
775
|
-
};
|
776
|
-
|
777
|
-
if ((typeof(content) === "string") && (content.length > 0)) {
|
778
|
-
// If HTML content with line-breaking tags, then remove all cr/lf chars because only tags will break a line
|
779
|
-
if (/<(?:p|br|h[1-6]|ul|ol|dl|table|t[rdh]|div|blockquote|fieldset|pre|address|center)[^>]*>/i.test(content)) {
|
780
|
-
process([
|
781
|
-
/[\n\r]+/g
|
782
|
-
]);
|
783
|
-
} else {
|
784
|
-
// Otherwise just get rid of carriage returns (only need linefeeds)
|
785
|
-
process([
|
786
|
-
/\r+/g
|
787
|
-
]);
|
788
|
-
}
|
789
|
-
|
790
|
-
process([
|
791
|
-
[/<\/(?: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
|
792
|
-
[/<br[^>]*>|<\/tr>/gi, "\n"], // Single linebreak for <br /> tags and table rows
|
793
|
-
[/<\/t[dh]>\s*<t[dh][^>]*>/gi, "\t"], // Table cells get tabs betweem them
|
794
|
-
/<[a-z!\/?][^>]*>/gi, // Delete all remaining tags
|
795
|
-
[/ /gi, " "], // Convert non-break spaces to regular spaces (remember, *plain text*)
|
796
|
-
[/(?:(?!\n)\s)*(\n+)(?:(?!\n)\s)*/gi, "$1"] // Cool little RegExp deletes whitespace around linebreak chars.
|
797
|
-
]);
|
798
|
-
|
799
|
-
var maxLinebreaks = Number(getParam(ed, "paste_max_consecutive_linebreaks"));
|
800
|
-
if (maxLinebreaks > -1) {
|
801
|
-
var maxLinebreaksRegex = new RegExp("\n{" + (maxLinebreaks + 1) + ",}", "g");
|
802
|
-
var linebreakReplacement = "";
|
803
|
-
|
804
|
-
while (linebreakReplacement.length < maxLinebreaks) {
|
805
|
-
linebreakReplacement += "\n";
|
806
|
-
}
|
807
|
-
|
808
|
-
process([
|
809
|
-
[maxLinebreaksRegex, linebreakReplacement] // Limit max consecutive linebreaks
|
810
|
-
]);
|
811
|
-
}
|
812
|
-
|
813
|
-
content = ed.dom.decode(tinymce.html.Entities.encodeRaw(content));
|
814
|
-
|
815
|
-
// Perform default or custom replacements
|
816
|
-
if (is(rl, "array")) {
|
817
|
-
process(rl);
|
818
|
-
} else if (is(rl, "string")) {
|
819
|
-
process(new RegExp(rl, "gi"));
|
820
|
-
}
|
821
|
-
|
822
|
-
// Treat paragraphs as specified in the config
|
823
|
-
if (linebr == "none") {
|
824
|
-
// Convert all line breaks to space
|
825
|
-
process([
|
826
|
-
[/\n+/g, " "]
|
827
|
-
]);
|
828
|
-
} else if (linebr == "br") {
|
829
|
-
// Convert all line breaks to <br />
|
830
|
-
process([
|
831
|
-
[/\n/g, "<br />"]
|
832
|
-
]);
|
833
|
-
} else if (linebr == "p") {
|
834
|
-
// Convert all line breaks to <p>...</p>
|
835
|
-
process([
|
836
|
-
[/\n+/g, "</p><p>"],
|
837
|
-
[/^(.*<\/p>)(<p>)$/, '<p>$1']
|
838
|
-
]);
|
839
|
-
} else {
|
840
|
-
// defaults to "combined"
|
841
|
-
// Convert single line breaks to <br /> and double line breaks to <p>...</p>
|
842
|
-
process([
|
843
|
-
[/\n\n/g, "</p><p>"],
|
844
|
-
[/^(.*<\/p>)(<p>)$/, '<p>$1'],
|
845
|
-
[/\n/g, "<br />"]
|
846
|
-
]);
|
847
|
-
}
|
848
|
-
|
849
|
-
ed.execCommand('mceInsertContent', false, content);
|
850
|
-
}
|
851
|
-
},
|
852
|
-
|
853
|
-
/**
|
854
|
-
* This method will open the old style paste dialogs. Some users might want the old behavior but still use the new cleanup engine.
|
855
|
-
*/
|
856
|
-
_legacySupport : function() {
|
857
|
-
var t = this, ed = t.editor;
|
858
|
-
|
859
|
-
// Register command(s) for backwards compatibility
|
860
|
-
ed.addCommand("mcePasteWord", function() {
|
861
|
-
ed.windowManager.open({
|
862
|
-
file: t.url + "/pasteword.htm",
|
863
|
-
width: parseInt(getParam(ed, "paste_dialog_width")),
|
864
|
-
height: parseInt(getParam(ed, "paste_dialog_height")),
|
865
|
-
inline: 1
|
866
|
-
});
|
867
|
-
});
|
868
|
-
|
869
|
-
if (getParam(ed, "paste_text_use_dialog")) {
|
870
|
-
ed.addCommand("mcePasteText", function() {
|
871
|
-
ed.windowManager.open({
|
872
|
-
file : t.url + "/pastetext.htm",
|
873
|
-
width: parseInt(getParam(ed, "paste_dialog_width")),
|
874
|
-
height: parseInt(getParam(ed, "paste_dialog_height")),
|
875
|
-
inline : 1
|
876
|
-
});
|
877
|
-
});
|
878
|
-
}
|
879
|
-
|
880
|
-
// Register button for backwards compatibility
|
881
|
-
ed.addButton("pasteword", {title : "paste.paste_word_desc", cmd : "mcePasteWord"});
|
882
|
-
}
|
883
|
-
});
|
884
|
-
|
885
|
-
// Register plugin
|
886
|
-
tinymce.PluginManager.add("paste", tinymce.plugins.PastePlugin);
|
887
|
-
})();
|