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