Commit 15ac76b811507e85bd959982381e764d5eb5b01d
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
Merge branch 'AI3160-fullscreen_for_article' into rails3_stable
Conflicts: public/stylesheets/application.css
Showing
171 changed files
with
15305 additions
and
10781 deletions
Show diff stats
Too many changes.
To preserve performance only 100 of 171 files displayed.
app/helpers/application_helper.rb
... | ... | @@ -1415,4 +1415,26 @@ module ApplicationHelper |
1415 | 1415 | content_tag('ul', article.versions.map {|v| link_to("r#{v.version}", @page.url.merge(:version => v.version))}) |
1416 | 1416 | end |
1417 | 1417 | |
1418 | + def fullscreen_buttons(itemId) | |
1419 | + content=" | |
1420 | + <script>fullscreenPageLoad('#{itemId}')</script> | |
1421 | + " | |
1422 | + content+=content_tag('a', content_tag('span',_("Full screen")), | |
1423 | + { :id=>"fullscreen-btn", | |
1424 | + :onClick=>"toggle_fullwidth('#{itemId}')", | |
1425 | + :class=>"button with-text icon-fullscreen", | |
1426 | + :href=>"#", | |
1427 | + :title=>_("Go to full screen mode") | |
1428 | + }) | |
1429 | + | |
1430 | + content+=content_tag('a', content_tag('span',_("Exit full screen")), | |
1431 | + { :style=>"display: none;", | |
1432 | + :id=>"exit-fullscreen-btn", | |
1433 | + :onClick=>"toggle_fullwidth('#{itemId}')", | |
1434 | + :class=>"button with-text icon-fullscreen", | |
1435 | + :href=>"#", | |
1436 | + :title=>_("Exit full screen mode") | |
1437 | + }) | |
1438 | + end | |
1439 | + | |
1418 | 1440 | end | ... | ... |
app/views/content_viewer/_article_toolbar.html.erb
app/views/shared/tiny_mce.html.erb
... | ... | @@ -2,14 +2,14 @@ |
2 | 2 | <%= javascript_include_tag 'tinymce/jscripts/tiny_mce/tiny_mce.js' %> |
3 | 3 | <%= include_macro_js_files %> |
4 | 4 | <script type="text/javascript"> |
5 | - var myplugins = "searchreplace,print,table,contextmenu,-macrosPlugin"; | |
5 | + var myplugins = "searchreplace,print,table,contextmenu,-macrosPlugin,fullscreen"; | |
6 | 6 | var first_line, second_line; |
7 | 7 | var mode = '<%= mode ||= false %>' |
8 | 8 | <% if mode %> |
9 | - first_line = "fontsizeselect,bold,italic,underline,bullist,numlist,justifyleft,justifycenter,justifyright,link,unlink" | |
9 | + first_line = "fullscreen,fontsizeselect,bold,italic,underline,bullist,numlist,justifyleft,justifycenter,justifyright,link,unlink" | |
10 | 10 | second_line = "" |
11 | 11 | <% else %> |
12 | - first_line = "print,separator,copy,paste,separator,undo,redo,separator,search,replace,separator,forecolor,fontsizeselect,formatselect" | |
12 | + first_line = "fullscreen,print,separator,copy,paste,separator,undo,redo,separator,search,replace,separator,forecolor,fontsizeselect,formatselect" | |
13 | 13 | second_line = "bold,italic,underline,strikethrough,separator,bullist,numlist,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,link,unlink,image,table,separator,cleanup,code,macros" |
14 | 14 | <% macros_with_buttons.each do |macro| %> |
15 | 15 | second_line += ',<%=macro.identifier %>' |
... | ... | @@ -60,6 +60,12 @@ tinyMCE.init({ |
60 | 60 | remove_script_host : false, |
61 | 61 | document_base_url : <%= environment.top_url.to_json %>, |
62 | 62 | plugins: myplugins, |
63 | + theme : "advanced", | |
64 | + mode : "textareas", | |
65 | + fullscreen_new_window : false, | |
66 | + fullscreen_settings : { | |
67 | + theme_advanced_path_location : "top" | |
68 | + }, | |
63 | 69 | theme_advanced_toolbar_location : "top", |
64 | 70 | theme_advanced_layout_manager: 'SimpleLayout', |
65 | 71 | theme_advanced_buttons1 : first_line, | ... | ... |
debian/control
public/designs/icons/tango/style.css
... | ... | @@ -98,6 +98,7 @@ |
98 | 98 | .icon-gallery { background-image: url(Tango/16x16/mimetypes/image-x-generic.png) } |
99 | 99 | .icon-newgallery { background-image: url(Tango/16x16/mimetypes/image-x-generic.png) } |
100 | 100 | .icon-locale { background-image: url(Tango/16x16/apps/preferences-desktop-locale.png) } |
101 | +.icon-fullscreen { background-image: url(Tango/16x16/actions/view-fullscreen.png) } | |
101 | 102 | .icon-user-removed { background-image: url(Tango/16x16/actions/gtk-cancel.png) } |
102 | 103 | .icon-user-unknown { background-image: url(Tango/16x16/status/dialog-error.png) } |
103 | 104 | .icon-alert { background-image: url(Tango/16x16/status/dialog-warning.png) } | ... | ... |
public/javascripts/application.js
... | ... | @@ -1055,8 +1055,44 @@ function showHideTermsOfUse() { |
1055 | 1055 | |
1056 | 1056 | jQuery(document).ready(function(){ |
1057 | 1057 | showHideTermsOfUse(); |
1058 | - | |
1059 | 1058 | jQuery("#article_has_terms_of_use").click(function(){ |
1060 | 1059 | showHideTermsOfUse(); |
1061 | 1060 | }); |
1062 | 1061 | }); |
1062 | + | |
1063 | +function getQueryParams(qs) { | |
1064 | + qs = qs.split("+").join(" "); | |
1065 | + var params = {}, | |
1066 | + tokens, | |
1067 | + re = /[?&]?([^=]+)=([^&]*)/g; | |
1068 | + while (tokens = re.exec(qs)) { | |
1069 | + params[decodeURIComponent(tokens[1])] | |
1070 | + = decodeURIComponent(tokens[2]); | |
1071 | + } | |
1072 | + return params; | |
1073 | +} | |
1074 | + | |
1075 | +var fullwidth=false; | |
1076 | +function toggle_fullwidth(itemId){ | |
1077 | + if(fullwidth){ | |
1078 | + jQuery(itemId).removeClass("fullwidth"); | |
1079 | + jQuery("#fullscreen-btn").show() | |
1080 | + jQuery("#exit-fullscreen-btn").hide() | |
1081 | + fullwidth = false; | |
1082 | + } | |
1083 | + else{ | |
1084 | + jQuery(itemId).addClass("fullwidth"); | |
1085 | + jQuery("#exit-fullscreen-btn").show() | |
1086 | + jQuery("#fullscreen-btn").hide() | |
1087 | + fullwidth = true; | |
1088 | + } | |
1089 | +} | |
1090 | + | |
1091 | +function fullscreenPageLoad(itemId){ | |
1092 | + jQuery(document).ready(function(){ | |
1093 | + var $_GET = getQueryParams(document.location.search); | |
1094 | + if ($_GET['fullscreen']==1){ | |
1095 | + toggle_fullwidth(itemId); | |
1096 | + } | |
1097 | + }); | |
1098 | +} | |
1063 | 1099 | \ No newline at end of file | ... | ... |
public/javascripts/tinymce/examples/accessibility.html
... | ... | @@ -1,101 +0,0 @@ |
1 | -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
2 | -<html xmlns="http://www.w3.org/1999/xhtml"> | |
3 | -<head> | |
4 | -<title>Full featured example</title> | |
5 | - | |
6 | -<!-- TinyMCE --> | |
7 | -<script type="text/javascript" src="../jscripts/tiny_mce/tiny_mce.js"></script> | |
8 | -<script type="text/javascript"> | |
9 | - tinyMCE.init({ | |
10 | - // General options | |
11 | - mode : "textareas", | |
12 | - theme : "advanced", | |
13 | - plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave", | |
14 | - | |
15 | - // Theme options | |
16 | - theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect", | |
17 | - theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor", | |
18 | - theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen", | |
19 | - theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft", | |
20 | - theme_advanced_toolbar_location : "top", | |
21 | - theme_advanced_toolbar_align : "left", | |
22 | - theme_advanced_statusbar_location : "bottom", | |
23 | - theme_advanced_resizing : true, | |
24 | - | |
25 | - // Example content CSS (should be your site CSS) | |
26 | - // using false to ensure that the default browser settings are used for best Accessibility | |
27 | - // ACCESSIBILITY SETTINGS | |
28 | - content_css : false, | |
29 | - // Use browser preferred colors for dialogs. | |
30 | - browser_preferred_colors : true, | |
31 | - detect_highcontrast : true, | |
32 | - | |
33 | - // Drop lists for link/image/media/template dialogs | |
34 | - template_external_list_url : "lists/template_list.js", | |
35 | - external_link_list_url : "lists/link_list.js", | |
36 | - external_image_list_url : "lists/image_list.js", | |
37 | - media_external_list_url : "lists/media_list.js", | |
38 | - | |
39 | - // Style formats | |
40 | - style_formats : [ | |
41 | - {title : 'Bold text', inline : 'b'}, | |
42 | - {title : 'Red text', inline : 'span', styles : {color : '#ff0000'}}, | |
43 | - {title : 'Red header', block : 'h1', styles : {color : '#ff0000'}}, | |
44 | - {title : 'Example 1', inline : 'span', classes : 'example1'}, | |
45 | - {title : 'Example 2', inline : 'span', classes : 'example2'}, | |
46 | - {title : 'Table styles'}, | |
47 | - {title : 'Table row 1', selector : 'tr', classes : 'tablerow1'} | |
48 | - ], | |
49 | - | |
50 | - // Replace values for the template plugin | |
51 | - template_replace_values : { | |
52 | - username : "Some User", | |
53 | - staffid : "991234" | |
54 | - } | |
55 | - }); | |
56 | -</script> | |
57 | -<!-- /TinyMCE --> | |
58 | - | |
59 | -</head> | |
60 | -<body> | |
61 | - | |
62 | -<form method="post" action="http://tinymce.moxiecode.com/dump.php?example=true"> | |
63 | - <div> | |
64 | - <h3>Full featured example, with Accessibility settings enabled</h3> | |
65 | - | |
66 | - <p> | |
67 | - This page has got the TinyMCE set up to work with configurations related to accessiblity enabled. | |
68 | - In particular | |
69 | - <ul> | |
70 | - <li>the <strong>content_css</strong> is set to false, to ensure that all default browser styles are used, </li> | |
71 | - <li>the <strong>browser_preferred_colors</strong> dialog option is used to ensure that default css is used for dialogs, </li> | |
72 | - <li>and the <strong>detect_highcontrast</strong> option has been set to ensure that highcontrast mode in Windows browsers | |
73 | - is detected and the toolbars are displayed in a high contrast mode.</li> | |
74 | - </ul> | |
75 | - </p> | |
76 | - | |
77 | - <!-- Gets replaced with TinyMCE, remember HTML in a textarea should be encoded --> | |
78 | - <div> | |
79 | - <textarea id="elm1" name="elm1" rows="15" cols="80" style="width: 80%"> | |
80 | - <p> | |
81 | - This is some example text that you can edit inside the <strong>TinyMCE editor</strong>. | |
82 | - </p> | |
83 | - <p> | |
84 | - Nam nisi elit, cursus in rhoncus sit amet, pulvinar laoreet leo. Nam sed lectus quam, ut sagittis tellus. Quisque dignissim mauris a augue rutrum tempor. Donec vitae purus nec massa vestibulum ornare sit amet id tellus. Nunc quam mauris, fermentum nec lacinia eget, sollicitudin nec ante. Aliquam molestie volutpat dapibus. Nunc interdum viverra sodales. Morbi laoreet pulvinar gravida. Quisque ut turpis sagittis nunc accumsan vehicula. Duis elementum congue ultrices. Cras faucibus feugiat arcu quis lacinia. In hac habitasse platea dictumst. Pellentesque fermentum magna sit amet tellus varius ullamcorper. Vestibulum at urna augue, eget varius neque. Fusce facilisis venenatis dapibus. Integer non sem at arcu euismod tempor nec sed nisl. Morbi ultricies, mauris ut ultricies adipiscing, felis odio condimentum massa, et luctus est nunc nec eros. | |
85 | - </p> | |
86 | - </textarea> | |
87 | - </div> | |
88 | - | |
89 | - <br /> | |
90 | - <input type="submit" name="save" value="Submit" /> | |
91 | - <input type="reset" name="reset" value="Reset" /> | |
92 | - </div> | |
93 | -</form> | |
94 | - | |
95 | -<script type="text/javascript"> | |
96 | -if (document.location.protocol == 'file:') { | |
97 | - alert("The examples might not work properly on the local file system due to security settings in your browser. Please use a real webserver."); | |
98 | -} | |
99 | -</script> | |
100 | -</body> | |
101 | -</html> |
public/javascripts/tinymce/examples/css/content.css
... | ... | @@ -1,105 +0,0 @@ |
1 | -body { | |
2 | - background-color: #FFFFFF; | |
3 | - font-family: Verdana, Arial, Helvetica, sans-serif; | |
4 | - font-size: 10px; | |
5 | - scrollbar-3dlight-color: #F0F0EE; | |
6 | - scrollbar-arrow-color: #676662; | |
7 | - scrollbar-base-color: #F0F0EE; | |
8 | - scrollbar-darkshadow-color: #DDDDDD; | |
9 | - scrollbar-face-color: #E0E0DD; | |
10 | - scrollbar-highlight-color: #F0F0EE; | |
11 | - scrollbar-shadow-color: #F0F0EE; | |
12 | - scrollbar-track-color: #F5F5F5; | |
13 | -} | |
14 | - | |
15 | -td { | |
16 | - font-family: Verdana, Arial, Helvetica, sans-serif; | |
17 | - font-size: 10px; | |
18 | -} | |
19 | - | |
20 | -pre { | |
21 | - font-family: Verdana, Arial, Helvetica, sans-serif; | |
22 | - font-size: 10px; | |
23 | -} | |
24 | - | |
25 | -.example1 { | |
26 | - font-weight: bold; | |
27 | - font-size: 14px | |
28 | -} | |
29 | - | |
30 | -.example2 { | |
31 | - font-weight: bold; | |
32 | - font-size: 12px; | |
33 | - color: #FF0000 | |
34 | -} | |
35 | - | |
36 | -.tablerow1 { | |
37 | - background-color: #BBBBBB; | |
38 | -} | |
39 | - | |
40 | -thead { | |
41 | - background-color: #FFBBBB; | |
42 | -} | |
43 | - | |
44 | -tfoot { | |
45 | - background-color: #BBBBFF; | |
46 | -} | |
47 | - | |
48 | -th { | |
49 | - font-family: Verdana, Arial, Helvetica, sans-serif; | |
50 | - font-size: 13px; | |
51 | -} | |
52 | - | |
53 | -/* Basic formats */ | |
54 | - | |
55 | -.bold { | |
56 | - font-weight: bold; | |
57 | -} | |
58 | - | |
59 | -.italic { | |
60 | - font-style: italic; | |
61 | -} | |
62 | - | |
63 | -.underline { | |
64 | - text-decoration: underline; | |
65 | -} | |
66 | - | |
67 | -/* Global align classes */ | |
68 | - | |
69 | -.left { | |
70 | - text-align: inherit; | |
71 | -} | |
72 | - | |
73 | -.center { | |
74 | - text-align: center; | |
75 | -} | |
76 | - | |
77 | -.right { | |
78 | - text-align: right; | |
79 | -} | |
80 | - | |
81 | -.full { | |
82 | - text-align: justify | |
83 | -} | |
84 | - | |
85 | -/* Image and table specific aligns */ | |
86 | - | |
87 | -img.left, table.left { | |
88 | - float: left; | |
89 | - text-align: inherit; | |
90 | -} | |
91 | - | |
92 | -img.center, table.center { | |
93 | - margin-left: auto; | |
94 | - margin-right: auto; | |
95 | - text-align: inherit; | |
96 | -} | |
97 | - | |
98 | -img.center { | |
99 | - display: block; | |
100 | -} | |
101 | - | |
102 | -img.right, table.right { | |
103 | - float: right; | |
104 | - text-align: inherit; | |
105 | -} |
public/javascripts/tinymce/examples/css/word.css
... | ... | @@ -1,53 +0,0 @@ |
1 | -body { | |
2 | - background-color: #FFFFFF; | |
3 | - font-family: Verdana, Arial, Helvetica, sans-serif; | |
4 | - font-size: 10px; | |
5 | - scrollbar-3dlight-color: #F0F0EE; | |
6 | - scrollbar-arrow-color: #676662; | |
7 | - scrollbar-base-color: #F0F0EE; | |
8 | - scrollbar-darkshadow-color: #DDDDDD; | |
9 | - scrollbar-face-color: #E0E0DD; | |
10 | - scrollbar-highlight-color: #F0F0EE; | |
11 | - scrollbar-shadow-color: #F0F0EE; | |
12 | - scrollbar-track-color: #F5F5F5; | |
13 | -} | |
14 | - | |
15 | -p {margin:0; padding:0;} | |
16 | - | |
17 | -td { | |
18 | - font-family: Verdana, Arial, Helvetica, sans-serif; | |
19 | - font-size: 10px; | |
20 | -} | |
21 | - | |
22 | -pre { | |
23 | - font-family: Verdana, Arial, Helvetica, sans-serif; | |
24 | - font-size: 10px; | |
25 | -} | |
26 | - | |
27 | -.example1 { | |
28 | - font-weight: bold; | |
29 | - font-size: 14px | |
30 | -} | |
31 | - | |
32 | -.example2 { | |
33 | - font-weight: bold; | |
34 | - font-size: 12px; | |
35 | - color: #FF0000 | |
36 | -} | |
37 | - | |
38 | -.tablerow1 { | |
39 | - background-color: #BBBBBB; | |
40 | -} | |
41 | - | |
42 | -thead { | |
43 | - background-color: #FFBBBB; | |
44 | -} | |
45 | - | |
46 | -tfoot { | |
47 | - background-color: #BBBBFF; | |
48 | -} | |
49 | - | |
50 | -th { | |
51 | - font-family: Verdana, Arial, Helvetica, sans-serif; | |
52 | - font-size: 13px; | |
53 | -} |
public/javascripts/tinymce/examples/custom_formats.html
... | ... | @@ -1,111 +0,0 @@ |
1 | -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
2 | -<html xmlns="http://www.w3.org/1999/xhtml"> | |
3 | -<head> | |
4 | -<title>Custom formats example</title> | |
5 | - | |
6 | -<!-- TinyMCE --> | |
7 | -<script type="text/javascript" src="../jscripts/tiny_mce/tiny_mce.js"></script> | |
8 | -<script type="text/javascript"> | |
9 | - tinyMCE.init({ | |
10 | - // General options | |
11 | - mode : "textareas", | |
12 | - theme : "advanced", | |
13 | - plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave", | |
14 | - | |
15 | - // Theme options | |
16 | - theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect", | |
17 | - theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor", | |
18 | - theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen", | |
19 | - theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft", | |
20 | - theme_advanced_toolbar_location : "top", | |
21 | - theme_advanced_toolbar_align : "left", | |
22 | - theme_advanced_statusbar_location : "bottom", | |
23 | - theme_advanced_resizing : true, | |
24 | - | |
25 | - // Example content CSS (should be your site CSS) | |
26 | - content_css : "css/content.css", | |
27 | - | |
28 | - // Drop lists for link/image/media/template dialogs | |
29 | - template_external_list_url : "lists/template_list.js", | |
30 | - external_link_list_url : "lists/link_list.js", | |
31 | - external_image_list_url : "lists/image_list.js", | |
32 | - media_external_list_url : "lists/media_list.js", | |
33 | - | |
34 | - // Style formats | |
35 | - style_formats : [ | |
36 | - {title : 'Bold text', inline : 'b'}, | |
37 | - {title : 'Red text', inline : 'span', styles : {color : '#ff0000'}}, | |
38 | - {title : 'Red header', block : 'h1', styles : {color : '#ff0000'}}, | |
39 | - {title : 'Example 1', inline : 'span', classes : 'example1'}, | |
40 | - {title : 'Example 2', inline : 'span', classes : 'example2'}, | |
41 | - {title : 'Table styles'}, | |
42 | - {title : 'Table row 1', selector : 'tr', classes : 'tablerow1'} | |
43 | - ], | |
44 | - | |
45 | - formats : { | |
46 | - alignleft : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'left'}, | |
47 | - aligncenter : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'center'}, | |
48 | - alignright : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'right'}, | |
49 | - alignfull : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'full'}, | |
50 | - bold : {inline : 'span', 'classes' : 'bold'}, | |
51 | - italic : {inline : 'span', 'classes' : 'italic'}, | |
52 | - underline : {inline : 'span', 'classes' : 'underline', exact : true}, | |
53 | - strikethrough : {inline : 'del'} | |
54 | - }, | |
55 | - | |
56 | - // Replace values for the template plugin | |
57 | - template_replace_values : { | |
58 | - username : "Some User", | |
59 | - staffid : "991234" | |
60 | - } | |
61 | - }); | |
62 | -</script> | |
63 | -<!-- /TinyMCE --> | |
64 | - | |
65 | -</head> | |
66 | -<body> | |
67 | - | |
68 | -<form method="post" action="http://tinymce.moxiecode.com/dump.php?example=true"> | |
69 | - <div> | |
70 | - <h3>Custom formats example</h3> | |
71 | - | |
72 | - <p> | |
73 | - This example shows you how to override the default formats for bold, italic, underline, strikethough and alignment to use classes instead of inline styles. | |
74 | - There are more examples on how to use TinyMCE in the <a href="http://tinymce.moxiecode.com/examples/">Wiki</a>. | |
75 | - </p> | |
76 | - | |
77 | - <!-- Gets replaced with TinyMCE, remember HTML in a textarea should be encoded --> | |
78 | - <div> | |
79 | - <textarea id="elm1" name="elm1" rows="15" cols="80" style="width: 80%"> | |
80 | - <p> | |
81 | - This is some example text that you can edit inside the <strong>TinyMCE editor</strong>. | |
82 | - </p> | |
83 | - <p> | |
84 | - Nam nisi elit, cursus in rhoncus sit amet, pulvinar laoreet leo. Nam sed lectus quam, ut sagittis tellus. Quisque dignissim mauris a augue rutrum tempor. Donec vitae purus nec massa vestibulum ornare sit amet id tellus. Nunc quam mauris, fermentum nec lacinia eget, sollicitudin nec ante. Aliquam molestie volutpat dapibus. Nunc interdum viverra sodales. Morbi laoreet pulvinar gravida. Quisque ut turpis sagittis nunc accumsan vehicula. Duis elementum congue ultrices. Cras faucibus feugiat arcu quis lacinia. In hac habitasse platea dictumst. Pellentesque fermentum magna sit amet tellus varius ullamcorper. Vestibulum at urna augue, eget varius neque. Fusce facilisis venenatis dapibus. Integer non sem at arcu euismod tempor nec sed nisl. Morbi ultricies, mauris ut ultricies adipiscing, felis odio condimentum massa, et luctus est nunc nec eros. | |
85 | - </p> | |
86 | - </textarea> | |
87 | - </div> | |
88 | - | |
89 | - <!-- Some integration calls --> | |
90 | - <a href="javascript:;" onmousedown="tinyMCE.get('elm1').show();">[Show]</a> | |
91 | - <a href="javascript:;" onmousedown="tinyMCE.get('elm1').hide();">[Hide]</a> | |
92 | - <a href="javascript:;" onmousedown="tinyMCE.get('elm1').execCommand('Bold');">[Bold]</a> | |
93 | - <a href="javascript:;" onmousedown="alert(tinyMCE.get('elm1').getContent());">[Get contents]</a> | |
94 | - <a href="javascript:;" onmousedown="alert(tinyMCE.get('elm1').selection.getContent());">[Get selected HTML]</a> | |
95 | - <a href="javascript:;" onmousedown="alert(tinyMCE.get('elm1').selection.getContent({format : 'text'}));">[Get selected text]</a> | |
96 | - <a href="javascript:;" onmousedown="alert(tinyMCE.get('elm1').selection.getNode().nodeName);">[Get selected element]</a> | |
97 | - <a href="javascript:;" onmousedown="tinyMCE.execCommand('mceInsertContent',false,'<b>Hello world!!</b>');">[Insert HTML]</a> | |
98 | - <a href="javascript:;" onmousedown="tinyMCE.execCommand('mceReplaceContent',false,'<b>{$selection}</b>');">[Replace selection]</a> | |
99 | - | |
100 | - <br /> | |
101 | - <input type="submit" name="save" value="Submit" /> | |
102 | - <input type="reset" name="reset" value="Reset" /> | |
103 | - </div> | |
104 | -</form> | |
105 | -<script type="text/javascript"> | |
106 | -if (document.location.protocol == 'file:') { | |
107 | - alert("The examples might not work properly on the local file system due to security settings in your browser. Please use a real webserver."); | |
108 | -} | |
109 | -</script> | |
110 | -</body> | |
111 | -</html> |
public/javascripts/tinymce/examples/full.html
... | ... | @@ -1,101 +0,0 @@ |
1 | -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
2 | -<html xmlns="http://www.w3.org/1999/xhtml"> | |
3 | -<head> | |
4 | -<title>Full featured example</title> | |
5 | -<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
6 | -<!-- TinyMCE --> | |
7 | -<script type="text/javascript" src="../jscripts/tiny_mce/tiny_mce.js"></script> | |
8 | -<script type="text/javascript"> | |
9 | - tinyMCE.init({ | |
10 | - // General options | |
11 | - mode : "textareas", | |
12 | - theme : "advanced", | |
13 | - plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave", | |
14 | - | |
15 | - // Theme options | |
16 | - theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect", | |
17 | - theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor", | |
18 | - theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen", | |
19 | - theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft", | |
20 | - theme_advanced_toolbar_location : "top", | |
21 | - theme_advanced_toolbar_align : "left", | |
22 | - theme_advanced_statusbar_location : "bottom", | |
23 | - theme_advanced_resizing : true, | |
24 | - | |
25 | - // Example content CSS (should be your site CSS) | |
26 | - content_css : "css/content.css", | |
27 | - | |
28 | - // Drop lists for link/image/media/template dialogs | |
29 | - template_external_list_url : "lists/template_list.js", | |
30 | - external_link_list_url : "lists/link_list.js", | |
31 | - external_image_list_url : "lists/image_list.js", | |
32 | - media_external_list_url : "lists/media_list.js", | |
33 | - | |
34 | - // Style formats | |
35 | - style_formats : [ | |
36 | - {title : 'Bold text', inline : 'b'}, | |
37 | - {title : 'Red text', inline : 'span', styles : {color : '#ff0000'}}, | |
38 | - {title : 'Red header', block : 'h1', styles : {color : '#ff0000'}}, | |
39 | - {title : 'Example 1', inline : 'span', classes : 'example1'}, | |
40 | - {title : 'Example 2', inline : 'span', classes : 'example2'}, | |
41 | - {title : 'Table styles'}, | |
42 | - {title : 'Table row 1', selector : 'tr', classes : 'tablerow1'} | |
43 | - ], | |
44 | - | |
45 | - // Replace values for the template plugin | |
46 | - template_replace_values : { | |
47 | - username : "Some User", | |
48 | - staffid : "991234" | |
49 | - } | |
50 | - }); | |
51 | -</script> | |
52 | -<!-- /TinyMCE --> | |
53 | - | |
54 | -</head> | |
55 | -<body> | |
56 | - | |
57 | -<form method="post" action="http://tinymce.moxiecode.com/dump.php?example=true"> | |
58 | - <div> | |
59 | - <h3>Full featured example</h3> | |
60 | - | |
61 | - <p> | |
62 | - This page shows all available buttons and plugins that are included in the TinyMCE core package. | |
63 | - There are more examples on how to use TinyMCE in the <a href="http://tinymce.moxiecode.com/examples/">Wiki</a>. | |
64 | - </p> | |
65 | - | |
66 | - <!-- Gets replaced with TinyMCE, remember HTML in a textarea should be encoded --> | |
67 | - <div> | |
68 | - <textarea id="elm1" name="elm1" rows="15" cols="80" style="width: 80%"> | |
69 | - <p> | |
70 | - This is some example text that you can edit inside the <strong>TinyMCE editor</strong>. | |
71 | - </p> | |
72 | - <p> | |
73 | - Nam nisi elit, cursus in rhoncus sit amet, pulvinar laoreet leo. Nam sed lectus quam, ut sagittis tellus. Quisque dignissim mauris a augue rutrum tempor. Donec vitae purus nec massa vestibulum ornare sit amet id tellus. Nunc quam mauris, fermentum nec lacinia eget, sollicitudin nec ante. Aliquam molestie volutpat dapibus. Nunc interdum viverra sodales. Morbi laoreet pulvinar gravida. Quisque ut turpis sagittis nunc accumsan vehicula. Duis elementum congue ultrices. Cras faucibus feugiat arcu quis lacinia. In hac habitasse platea dictumst. Pellentesque fermentum magna sit amet tellus varius ullamcorper. Vestibulum at urna augue, eget varius neque. Fusce facilisis venenatis dapibus. Integer non sem at arcu euismod tempor nec sed nisl. Morbi ultricies, mauris ut ultricies adipiscing, felis odio condimentum massa, et luctus est nunc nec eros. | |
74 | - </p> | |
75 | - </textarea> | |
76 | - </div> | |
77 | - | |
78 | - <!-- Some integration calls --> | |
79 | - <a href="javascript:;" onclick="tinyMCE.get('elm1').show();return false;">[Show]</a> | |
80 | - <a href="javascript:;" onclick="tinyMCE.get('elm1').hide();return false;">[Hide]</a> | |
81 | - <a href="javascript:;" onclick="tinyMCE.get('elm1').execCommand('Bold');return false;">[Bold]</a> | |
82 | - <a href="javascript:;" onclick="alert(tinyMCE.get('elm1').getContent());return false;">[Get contents]</a> | |
83 | - <a href="javascript:;" onclick="alert(tinyMCE.get('elm1').selection.getContent());return false;">[Get selected HTML]</a> | |
84 | - <a href="javascript:;" onclick="alert(tinyMCE.get('elm1').selection.getContent({format : 'text'}));return false;">[Get selected text]</a> | |
85 | - <a href="javascript:;" onclick="alert(tinyMCE.get('elm1').selection.getNode().nodeName);return false;">[Get selected element]</a> | |
86 | - <a href="javascript:;" onclick="tinyMCE.execCommand('mceInsertContent',false,'<b>Hello world!!</b>');return false;">[Insert HTML]</a> | |
87 | - <a href="javascript:;" onclick="tinyMCE.execCommand('mceReplaceContent',false,'<b>{$selection}</b>');return false;">[Replace selection]</a> | |
88 | - | |
89 | - <br /> | |
90 | - <input type="submit" name="save" value="Submit" /> | |
91 | - <input type="reset" name="reset" value="Reset" /> | |
92 | - </div> | |
93 | -</form> | |
94 | - | |
95 | -<script type="text/javascript"> | |
96 | -if (document.location.protocol == 'file:') { | |
97 | - alert("The examples might not work properly on the local file system due to security settings in your browser. Please use a real webserver."); | |
98 | -} | |
99 | -</script> | |
100 | -</body> | |
101 | -</html> |
public/javascripts/tinymce/examples/index.html
... | ... | @@ -1,10 +0,0 @@ |
1 | -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd"> | |
2 | -<html> | |
3 | -<head> | |
4 | - <title>TinyMCE examples</title> | |
5 | -</head> | |
6 | -<frameset cols="180,80%"> | |
7 | - <frame src="menu.html" name="menu" /> | |
8 | - <frame src="full.html" name="main" /> | |
9 | -</frameset> | |
10 | -</html> |
public/javascripts/tinymce/examples/lists/image_list.js
... | ... | @@ -1,9 +0,0 @@ |
1 | -// This list may be created by a server logic page PHP/ASP/ASPX/JSP in some backend system. | |
2 | -// There images will be displayed as a dropdown in all image dialogs if the "external_link_image_url" | |
3 | -// option is defined in TinyMCE init. | |
4 | - | |
5 | -var tinyMCEImageList = new Array( | |
6 | - // Name, URL | |
7 | - ["Logo 1", "media/logo.jpg"], | |
8 | - ["Logo 2 Over", "media/logo_over.jpg"] | |
9 | -); |
public/javascripts/tinymce/examples/lists/link_list.js
... | ... | @@ -1,10 +0,0 @@ |
1 | -// This list may be created by a server logic page PHP/ASP/ASPX/JSP in some backend system. | |
2 | -// There links will be displayed as a dropdown in all link dialogs if the "external_link_list_url" | |
3 | -// option is defined in TinyMCE init. | |
4 | - | |
5 | -var tinyMCELinkList = new Array( | |
6 | - // Name, URL | |
7 | - ["Moxiecode", "http://www.moxiecode.com"], | |
8 | - ["Freshmeat", "http://www.freshmeat.com"], | |
9 | - ["Sourceforge", "http://www.sourceforge.com"] | |
10 | -); |
public/javascripts/tinymce/examples/lists/media_list.js
... | ... | @@ -1,14 +0,0 @@ |
1 | -// This list may be created by a server logic page PHP/ASP/ASPX/JSP in some backend system. | |
2 | -// There flash movies will be displayed as a dropdown in all media dialog if the "media_external_list_url" | |
3 | -// option is defined in TinyMCE init. | |
4 | - | |
5 | -var tinyMCEMediaList = [ | |
6 | - // Name, URL | |
7 | - ["Some Flash", "media/sample.swf"], | |
8 | - ["Some Quicktime", "media/sample.mov"], | |
9 | - ["Some AVI", "media/sample.avi"], | |
10 | - ["Some RealMedia", "media/sample.rm"], | |
11 | - ["Some Shockwave", "media/sample.dcr"], | |
12 | - ["Some Video", "media/sample.mp4"], | |
13 | - ["Some FLV", "media/sample.flv"], | |
14 | -]; | |
15 | 0 | \ No newline at end of file |
public/javascripts/tinymce/examples/lists/template_list.js
... | ... | @@ -1,9 +0,0 @@ |
1 | -// This list may be created by a server logic page PHP/ASP/ASPX/JSP in some backend system. | |
2 | -// There templates will be displayed as a dropdown in all media dialog if the "template_external_list_url" | |
3 | -// option is defined in TinyMCE init. | |
4 | - | |
5 | -var tinyMCETemplateList = [ | |
6 | - // Name, URL, Description | |
7 | - ["Simple snippet", "templates/snippet1.htm", "Simple HTML snippet."], | |
8 | - ["Layout", "templates/layout1.htm", "HTML Layout."] | |
9 | -]; | |
10 | 0 | \ No newline at end of file |
public/javascripts/tinymce/examples/media/logo.jpg
2.67 KB
public/javascripts/tinymce/examples/media/logo_over.jpg
6.32 KB
public/javascripts/tinymce/examples/media/sample.avi
No preview for this file type
public/javascripts/tinymce/examples/media/sample.dcr
No preview for this file type
public/javascripts/tinymce/examples/media/sample.flv
No preview for this file type
public/javascripts/tinymce/examples/media/sample.mov
No preview for this file type
public/javascripts/tinymce/examples/media/sample.ram
public/javascripts/tinymce/examples/media/sample.rm
No preview for this file type
public/javascripts/tinymce/examples/media/sample.swf
No preview for this file type
public/javascripts/tinymce/examples/menu.html
... | ... | @@ -1,18 +0,0 @@ |
1 | -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
2 | -<html xmlns="http://www.w3.org/1999/xhtml"> | |
3 | -<head> | |
4 | -<title>Menu</title> | |
5 | -<style> | |
6 | -a {display:block;} | |
7 | -</style> | |
8 | -</head> | |
9 | -<body> | |
10 | -<h3>Examples</h3> | |
11 | -<a href="full.html" target="main">Full featured</a> | |
12 | -<a href="simple.html" target="main">Simple theme</a> | |
13 | -<a href="skins.html" target="main">Skin support</a> | |
14 | -<a href="word.html" target="main">Word processor</a> | |
15 | -<a href="custom_formats.html" target="main">Custom formats</a> | |
16 | -<a href="accessibility.html" target="main">Accessibility Options</a> | |
17 | -</body> | |
18 | -</html> |
public/javascripts/tinymce/examples/simple.html
... | ... | @@ -1,47 +0,0 @@ |
1 | -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
2 | -<html xmlns="http://www.w3.org/1999/xhtml"> | |
3 | -<head> | |
4 | -<title>Simple theme example</title> | |
5 | - | |
6 | -<!-- TinyMCE --> | |
7 | -<script type="text/javascript" src="../jscripts/tiny_mce/tiny_mce.js"></script> | |
8 | -<script type="text/javascript"> | |
9 | - tinyMCE.init({ | |
10 | - mode : "textareas", | |
11 | - theme : "simple" | |
12 | - }); | |
13 | -</script> | |
14 | -<!-- /TinyMCE --> | |
15 | - | |
16 | -</head> | |
17 | -<body> | |
18 | - | |
19 | -<form method="post" action="http://tinymce.moxiecode.com/dump.php?example=true"> | |
20 | - <h3>Simple theme example</h3> | |
21 | - | |
22 | - <p> | |
23 | - This page shows you the simple theme and it's core functionality you can extend it by changing the code use the advanced theme if you need to configure/add more buttons etc. | |
24 | - There are more examples on how to use TinyMCE in the <a href="http://tinymce.moxiecode.com/examples/">Wiki</a>. | |
25 | - </p> | |
26 | - | |
27 | - <!-- Gets replaced with TinyMCE, remember HTML in a textarea should be encoded --> | |
28 | - <textarea id="elm1" name="elm1" rows="15" cols="80" style="width: 80%"> | |
29 | - <p> | |
30 | - This is some example text that you can edit inside the <strong>TinyMCE editor</strong>. | |
31 | - </p> | |
32 | - <p> | |
33 | - Nam nisi elit, cursus in rhoncus sit amet, pulvinar laoreet leo. Nam sed lectus quam, ut sagittis tellus. Quisque dignissim mauris a augue rutrum tempor. Donec vitae purus nec massa vestibulum ornare sit amet id tellus. Nunc quam mauris, fermentum nec lacinia eget, sollicitudin nec ante. Aliquam molestie volutpat dapibus. Nunc interdum viverra sodales. Morbi laoreet pulvinar gravida. Quisque ut turpis sagittis nunc accumsan vehicula. Duis elementum congue ultrices. Cras faucibus feugiat arcu quis lacinia. In hac habitasse platea dictumst. Pellentesque fermentum magna sit amet tellus varius ullamcorper. Vestibulum at urna augue, eget varius neque. Fusce facilisis venenatis dapibus. Integer non sem at arcu euismod tempor nec sed nisl. Morbi ultricies, mauris ut ultricies adipiscing, felis odio condimentum massa, et luctus est nunc nec eros. | |
34 | - </p> | |
35 | - </textarea> | |
36 | - | |
37 | - <br /> | |
38 | - <input type="submit" name="save" value="Submit" /> | |
39 | - <input type="reset" name="reset" value="Reset" /> | |
40 | -</form> | |
41 | -<script type="text/javascript"> | |
42 | -if (document.location.protocol == 'file:') { | |
43 | - alert("The examples might not work properly on the local file system due to security settings in your browser. Please use a real webserver."); | |
44 | -} | |
45 | -</script> | |
46 | -</body> | |
47 | -</html> |
public/javascripts/tinymce/examples/skins.html
... | ... | @@ -1,216 +0,0 @@ |
1 | -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
2 | -<html xmlns="http://www.w3.org/1999/xhtml"> | |
3 | -<head> | |
4 | -<title>Skin support example</title> | |
5 | - | |
6 | -<!-- TinyMCE --> | |
7 | -<script type="text/javascript" src="../jscripts/tiny_mce/tiny_mce.js"></script> | |
8 | -<script type="text/javascript"> | |
9 | - // Default skin | |
10 | - tinyMCE.init({ | |
11 | - // General options | |
12 | - mode : "exact", | |
13 | - elements : "elm1", | |
14 | - theme : "advanced", | |
15 | - plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups,autosave", | |
16 | - | |
17 | - // Theme options | |
18 | - theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect", | |
19 | - theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor", | |
20 | - theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen", | |
21 | - theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft", | |
22 | - theme_advanced_toolbar_location : "top", | |
23 | - theme_advanced_toolbar_align : "left", | |
24 | - theme_advanced_statusbar_location : "bottom", | |
25 | - theme_advanced_resizing : true, | |
26 | - | |
27 | - // Example content CSS (should be your site CSS) | |
28 | - content_css : "css/content.css", | |
29 | - | |
30 | - // Drop lists for link/image/media/template dialogs | |
31 | - template_external_list_url : "lists/template_list.js", | |
32 | - external_link_list_url : "lists/link_list.js", | |
33 | - external_image_list_url : "lists/image_list.js", | |
34 | - media_external_list_url : "lists/media_list.js", | |
35 | - | |
36 | - // Replace values for the template plugin | |
37 | - template_replace_values : { | |
38 | - username : "Some User", | |
39 | - staffid : "991234" | |
40 | - } | |
41 | - }); | |
42 | - | |
43 | - // O2k7 skin | |
44 | - tinyMCE.init({ | |
45 | - // General options | |
46 | - mode : "exact", | |
47 | - elements : "elm2", | |
48 | - theme : "advanced", | |
49 | - skin : "o2k7", | |
50 | - plugins : "lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups,autosave", | |
51 | - | |
52 | - // Theme options | |
53 | - theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect", | |
54 | - theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor", | |
55 | - theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen", | |
56 | - theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft", | |
57 | - theme_advanced_toolbar_location : "top", | |
58 | - theme_advanced_toolbar_align : "left", | |
59 | - theme_advanced_statusbar_location : "bottom", | |
60 | - theme_advanced_resizing : true, | |
61 | - | |
62 | - // Example content CSS (should be your site CSS) | |
63 | - content_css : "css/content.css", | |
64 | - | |
65 | - // Drop lists for link/image/media/template dialogs | |
66 | - template_external_list_url : "lists/template_list.js", | |
67 | - external_link_list_url : "lists/link_list.js", | |
68 | - external_image_list_url : "lists/image_list.js", | |
69 | - media_external_list_url : "lists/media_list.js", | |
70 | - | |
71 | - // Replace values for the template plugin | |
72 | - template_replace_values : { | |
73 | - username : "Some User", | |
74 | - staffid : "991234" | |
75 | - } | |
76 | - }); | |
77 | - | |
78 | - // O2k7 skin (silver) | |
79 | - tinyMCE.init({ | |
80 | - // General options | |
81 | - mode : "exact", | |
82 | - elements : "elm3", | |
83 | - theme : "advanced", | |
84 | - skin : "o2k7", | |
85 | - skin_variant : "silver", | |
86 | - plugins : "lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups,autosave", | |
87 | - | |
88 | - // Theme options | |
89 | - theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect", | |
90 | - theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor", | |
91 | - theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen", | |
92 | - theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft", | |
93 | - theme_advanced_toolbar_location : "top", | |
94 | - theme_advanced_toolbar_align : "left", | |
95 | - theme_advanced_statusbar_location : "bottom", | |
96 | - theme_advanced_resizing : true, | |
97 | - | |
98 | - // Example content CSS (should be your site CSS) | |
99 | - content_css : "css/content.css", | |
100 | - | |
101 | - // Drop lists for link/image/media/template dialogs | |
102 | - template_external_list_url : "lists/template_list.js", | |
103 | - external_link_list_url : "lists/link_list.js", | |
104 | - external_image_list_url : "lists/image_list.js", | |
105 | - media_external_list_url : "lists/media_list.js", | |
106 | - | |
107 | - // Replace values for the template plugin | |
108 | - template_replace_values : { | |
109 | - username : "Some User", | |
110 | - staffid : "991234" | |
111 | - } | |
112 | - }); | |
113 | - | |
114 | - // O2k7 skin (silver) | |
115 | - tinyMCE.init({ | |
116 | - // General options | |
117 | - mode : "exact", | |
118 | - elements : "elm4", | |
119 | - theme : "advanced", | |
120 | - skin : "o2k7", | |
121 | - skin_variant : "black", | |
122 | - plugins : "lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups,autosave", | |
123 | - | |
124 | - // Theme options | |
125 | - theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect", | |
126 | - theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor", | |
127 | - theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen", | |
128 | - theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft", | |
129 | - theme_advanced_toolbar_location : "top", | |
130 | - theme_advanced_toolbar_align : "left", | |
131 | - theme_advanced_statusbar_location : "bottom", | |
132 | - theme_advanced_resizing : true, | |
133 | - | |
134 | - // Example content CSS (should be your site CSS) | |
135 | - content_css : "css/content.css", | |
136 | - | |
137 | - // Drop lists for link/image/media/template dialogs | |
138 | - template_external_list_url : "lists/template_list.js", | |
139 | - external_link_list_url : "lists/link_list.js", | |
140 | - external_image_list_url : "lists/image_list.js", | |
141 | - media_external_list_url : "lists/media_list.js", | |
142 | - | |
143 | - // Replace values for the template plugin | |
144 | - template_replace_values : { | |
145 | - username : "Some User", | |
146 | - staffid : "991234" | |
147 | - } | |
148 | - }); | |
149 | -</script> | |
150 | -<!-- /TinyMCE --> | |
151 | - | |
152 | -</head> | |
153 | -<body> | |
154 | - | |
155 | -<form method="post" action="http://tinymce.moxiecode.com/dump.php?example=true"> | |
156 | - <h3>Skin support example</h3> | |
157 | - | |
158 | - <p> | |
159 | - This page displays the two skins that TinyMCE comes with. You can make your own by creating a CSS file in themes/advanced/skins/<yout skin>/ui.css | |
160 | - There are more examples on how to use TinyMCE in the <a href="http://tinymce.moxiecode.com/examples/">Wiki</a>. | |
161 | - </p> | |
162 | - | |
163 | - <!-- Gets replaced with TinyMCE, remember HTML in a textarea should be encoded --> | |
164 | - <textarea id="elm1" name="elm1" rows="15" cols="80" style="width: 80%"> | |
165 | - <p> | |
166 | - This is some example text that you can edit inside the <strong>TinyMCE editor</strong>. | |
167 | - </p> | |
168 | - <p> | |
169 | - Nam nisi elit, cursus in rhoncus sit amet, pulvinar laoreet leo. Nam sed lectus quam, ut sagittis tellus. Quisque dignissim mauris a augue rutrum tempor. Donec vitae purus nec massa vestibulum ornare sit amet id tellus. Nunc quam mauris, fermentum nec lacinia eget, sollicitudin nec ante. Aliquam molestie volutpat dapibus. Nunc interdum viverra sodales. Morbi laoreet pulvinar gravida. Quisque ut turpis sagittis nunc accumsan vehicula. Duis elementum congue ultrices. Cras faucibus feugiat arcu quis lacinia. In hac habitasse platea dictumst. Pellentesque fermentum magna sit amet tellus varius ullamcorper. Vestibulum at urna augue, eget varius neque. Fusce facilisis venenatis dapibus. Integer non sem at arcu euismod tempor nec sed nisl. Morbi ultricies, mauris ut ultricies adipiscing, felis odio condimentum massa, et luctus est nunc nec eros. | |
170 | - </p> | |
171 | - </textarea> | |
172 | - | |
173 | - <br /> | |
174 | - | |
175 | - <textarea id="elm2" name="elm2" rows="15" cols="80" style="width: 80%"> | |
176 | - <p> | |
177 | - This is some example text that you can edit inside the <strong>TinyMCE editor</strong>. | |
178 | - </p> | |
179 | - <p> | |
180 | - Nam nisi elit, cursus in rhoncus sit amet, pulvinar laoreet leo. Nam sed lectus quam, ut sagittis tellus. Quisque dignissim mauris a augue rutrum tempor. Donec vitae purus nec massa vestibulum ornare sit amet id tellus. Nunc quam mauris, fermentum nec lacinia eget, sollicitudin nec ante. Aliquam molestie volutpat dapibus. Nunc interdum viverra sodales. Morbi laoreet pulvinar gravida. Quisque ut turpis sagittis nunc accumsan vehicula. Duis elementum congue ultrices. Cras faucibus feugiat arcu quis lacinia. In hac habitasse platea dictumst. Pellentesque fermentum magna sit amet tellus varius ullamcorper. Vestibulum at urna augue, eget varius neque. Fusce facilisis venenatis dapibus. Integer non sem at arcu euismod tempor nec sed nisl. Morbi ultricies, mauris ut ultricies adipiscing, felis odio condimentum massa, et luctus est nunc nec eros. | |
181 | - </p> | |
182 | - </textarea> | |
183 | - | |
184 | - <br /> | |
185 | - | |
186 | - <textarea id="elm3" name="elm3" rows="15" cols="80" style="width: 80%"> | |
187 | - <p> | |
188 | - This is some example text that you can edit inside the <strong>TinyMCE editor</strong>. | |
189 | - </p> | |
190 | - <p> | |
191 | - Nam nisi elit, cursus in rhoncus sit amet, pulvinar laoreet leo. Nam sed lectus quam, ut sagittis tellus. Quisque dignissim mauris a augue rutrum tempor. Donec vitae purus nec massa vestibulum ornare sit amet id tellus. Nunc quam mauris, fermentum nec lacinia eget, sollicitudin nec ante. Aliquam molestie volutpat dapibus. Nunc interdum viverra sodales. Morbi laoreet pulvinar gravida. Quisque ut turpis sagittis nunc accumsan vehicula. Duis elementum congue ultrices. Cras faucibus feugiat arcu quis lacinia. In hac habitasse platea dictumst. Pellentesque fermentum magna sit amet tellus varius ullamcorper. Vestibulum at urna augue, eget varius neque. Fusce facilisis venenatis dapibus. Integer non sem at arcu euismod tempor nec sed nisl. Morbi ultricies, mauris ut ultricies adipiscing, felis odio condimentum massa, et luctus est nunc nec eros. | |
192 | - </p> | |
193 | - </textarea> | |
194 | - | |
195 | - <br /> | |
196 | - | |
197 | - <textarea id="elm4" name="elm4" rows="15" cols="80" style="width: 80%"> | |
198 | - <p> | |
199 | - This is some example text that you can edit inside the <strong>TinyMCE editor</strong>. | |
200 | - </p> | |
201 | - <p> | |
202 | - Nam nisi elit, cursus in rhoncus sit amet, pulvinar laoreet leo. Nam sed lectus quam, ut sagittis tellus. Quisque dignissim mauris a augue rutrum tempor. Donec vitae purus nec massa vestibulum ornare sit amet id tellus. Nunc quam mauris, fermentum nec lacinia eget, sollicitudin nec ante. Aliquam molestie volutpat dapibus. Nunc interdum viverra sodales. Morbi laoreet pulvinar gravida. Quisque ut turpis sagittis nunc accumsan vehicula. Duis elementum congue ultrices. Cras faucibus feugiat arcu quis lacinia. In hac habitasse platea dictumst. Pellentesque fermentum magna sit amet tellus varius ullamcorper. Vestibulum at urna augue, eget varius neque. Fusce facilisis venenatis dapibus. Integer non sem at arcu euismod tempor nec sed nisl. Morbi ultricies, mauris ut ultricies adipiscing, felis odio condimentum massa, et luctus est nunc nec eros. | |
203 | - </p> | |
204 | - </textarea> | |
205 | - | |
206 | - <br /> | |
207 | - <input type="submit" name="save" value="Submit" /> | |
208 | - <input type="reset" name="reset" value="Reset" /> | |
209 | -</form> | |
210 | -<script type="text/javascript"> | |
211 | -if (document.location.protocol == 'file:') { | |
212 | - alert("The examples might not work properly on the local file system due to security settings in your browser. Please use a real webserver."); | |
213 | -} | |
214 | -</script> | |
215 | -</body> | |
216 | -</html> |
public/javascripts/tinymce/examples/templates/layout1.htm
public/javascripts/tinymce/examples/templates/snippet1.htm
... | ... | @@ -1 +0,0 @@ |
1 | -This is just some <strong>code</strong>. |
public/javascripts/tinymce/examples/translate.html
... | ... | @@ -1,80 +0,0 @@ |
1 | -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
2 | -<html xmlns="http://www.w3.org/1999/xhtml"> | |
3 | -<head> | |
4 | -<title>Full featured example</title> | |
5 | -<style> | |
6 | -body {font-family:Arial,Verdana; font-size: 12px;} | |
7 | -</style> | |
8 | - | |
9 | -<!-- TinyMCE --> | |
10 | -<script type="text/javascript" src="../jscripts/tiny_mce/tiny_mce_dev.js"></script> | |
11 | -<script type="text/javascript"> | |
12 | - tinyMCE.init({ | |
13 | - // General options | |
14 | - mode : "textareas", | |
15 | - theme : "advanced", | |
16 | - plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template", | |
17 | - | |
18 | - // Theme options | |
19 | - theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect", | |
20 | - theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor", | |
21 | - theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen", | |
22 | - theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak", | |
23 | - theme_advanced_toolbar_location : "top", | |
24 | - theme_advanced_toolbar_align : "left", | |
25 | - theme_advanced_path_location : "bottom", | |
26 | - theme_advanced_resizing : true, | |
27 | - | |
28 | - // Example content CSS (should be your site CSS) | |
29 | - content_css : "css/content.css", | |
30 | - | |
31 | - // Drop lists for link/image/media/template dialogs | |
32 | - template_external_list_url : "lists/template_list.js", | |
33 | - external_link_list_url : "lists/link_list.js", | |
34 | - external_image_list_url : "lists/image_list.js", | |
35 | - media_external_list_url : "lists/media_list.js", | |
36 | - | |
37 | - // Replace values for the template plugin | |
38 | - template_replace_values : { | |
39 | - username : "Some User", | |
40 | - staffid : "991234" | |
41 | - }, | |
42 | - | |
43 | - // Enable translation mode | |
44 | - translate_mode : true, | |
45 | - language : "en" | |
46 | - }); | |
47 | -</script> | |
48 | -<!-- /TinyMCE --> | |
49 | - | |
50 | -</head> | |
51 | -<body> | |
52 | - | |
53 | -<form method="post" action="http://tinymce.moxiecode.com/dump.php?example=true"> | |
54 | - <h3>Translation</h3> | |
55 | - | |
56 | - <p>This page enables you to translate TinyMCE by using XML files.</p> | |
57 | - <p>Steps to translate:</p> | |
58 | - <ol> | |
59 | - <li>Download one of the language XML files from the TinyMCE site.</li> | |
60 | - <li>Place it in /jscripts/tiny_mce/langs directory, for example /jscripts/tiny_mce/langs/sv.xml.</li> | |
61 | - <li>Change the language init option in this file to match the XML file code. For example: sv</li> | |
62 | - <li>TinyMCE will now use the XML file instead of the .js versions.</li> | |
63 | - <li>Modify the XML file until everything is translated</li> | |
64 | - <li>Modify the author information, this is optional.</li> | |
65 | - <li>Upload the XML file to the TinyMCE site to share it with others.</li> | |
66 | - <li>You can now download the .js versions of the language pack from the TinyMCE site.</li> | |
67 | - </ol> | |
68 | - | |
69 | - <textarea id="elm1" name="elm1" rows="15" cols="80" style="width: 80%"> | |
70 | - <p> | |
71 | - This is some example text that you can edit inside the <strong>TinyMCE editor</strong>. | |
72 | - </p> | |
73 | - <p> | |
74 | - Nam nisi elit, cursus in rhoncus sit amet, pulvinar laoreet leo. Nam sed lectus quam, ut sagittis tellus. Quisque dignissim mauris a augue rutrum tempor. Donec vitae purus nec massa vestibulum ornare sit amet id tellus. Nunc quam mauris, fermentum nec lacinia eget, sollicitudin nec ante. Aliquam molestie volutpat dapibus. Nunc interdum viverra sodales. Morbi laoreet pulvinar gravida. Quisque ut turpis sagittis nunc accumsan vehicula. Duis elementum congue ultrices. Cras faucibus feugiat arcu quis lacinia. In hac habitasse platea dictumst. Pellentesque fermentum magna sit amet tellus varius ullamcorper. Vestibulum at urna augue, eget varius neque. Fusce facilisis venenatis dapibus. Integer non sem at arcu euismod tempor nec sed nisl. Morbi ultricies, mauris ut ultricies adipiscing, felis odio condimentum massa, et luctus est nunc nec eros. | |
75 | - </p> | |
76 | - </textarea> | |
77 | -</form> | |
78 | - | |
79 | -</body> | |
80 | -</html> |
public/javascripts/tinymce/examples/word.html
... | ... | @@ -1,72 +0,0 @@ |
1 | -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
2 | -<html xmlns="http://www.w3.org/1999/xhtml"> | |
3 | -<head> | |
4 | -<title>Word processor example</title> | |
5 | -<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
6 | -<!-- TinyMCE --> | |
7 | -<script type="text/javascript" src="../jscripts/tiny_mce/tiny_mce.js"></script> | |
8 | -<script type="text/javascript"> | |
9 | - tinyMCE.init({ | |
10 | - // General options | |
11 | - mode : "textareas", | |
12 | - theme : "advanced", | |
13 | - skin : "o2k7", | |
14 | - plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups,autosave", | |
15 | - | |
16 | - // Theme options | |
17 | - theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect", | |
18 | - theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor", | |
19 | - theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen", | |
20 | - theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft", | |
21 | - theme_advanced_toolbar_location : "top", | |
22 | - theme_advanced_toolbar_align : "left", | |
23 | - theme_advanced_statusbar_location : "bottom", | |
24 | - theme_advanced_resizing : true, | |
25 | - | |
26 | - // Example word content CSS (should be your site CSS) this one removes paragraph margins | |
27 | - content_css : "css/word.css", | |
28 | - | |
29 | - // Drop lists for link/image/media/template dialogs | |
30 | - template_external_list_url : "lists/template_list.js", | |
31 | - external_link_list_url : "lists/link_list.js", | |
32 | - external_image_list_url : "lists/image_list.js", | |
33 | - media_external_list_url : "lists/media_list.js", | |
34 | - | |
35 | - // Replace values for the template plugin | |
36 | - template_replace_values : { | |
37 | - username : "Some User", | |
38 | - staffid : "991234" | |
39 | - } | |
40 | - }); | |
41 | -</script> | |
42 | -<!-- /TinyMCE --> | |
43 | - | |
44 | -</head> | |
45 | -<body> | |
46 | - | |
47 | -<form method="post" action="http://tinymce.moxiecode.com/dump.php?example=true"> | |
48 | - <h3>Word processor example</h3> | |
49 | - | |
50 | - <p> | |
51 | - This page shows you how to configure TinyMCE to work more like common word processors. | |
52 | - There are more examples on how to use TinyMCE in the <a href="http://tinymce.moxiecode.com/examples/">Wiki</a>. | |
53 | - </p> | |
54 | - | |
55 | - <!-- Gets replaced with TinyMCE, remember HTML in a textarea should be encoded --> | |
56 | - <textarea id="elm1" name="elm1" rows="15" cols="80" style="width: 80%"> | |
57 | - <p>This is the first paragraph.</p> | |
58 | - <p>This is the second paragraph.</p> | |
59 | - <p>This is the third paragraph.</p> | |
60 | - </textarea> | |
61 | - | |
62 | - <br /> | |
63 | - <input type="submit" name="save" value="Submit" /> | |
64 | - <input type="reset" name="reset" value="Reset" /> | |
65 | -</form> | |
66 | -<script type="text/javascript"> | |
67 | -if (document.location.protocol == 'file:') { | |
68 | - alert("The examples might not work properly on the local file system due to security settings in your browser. Please use a real webserver."); | |
69 | -} | |
70 | -</script> | |
71 | -</body> | |
72 | -</html> |
public/javascripts/tinymce/jscripts/tiny_mce/editable_selects.js
0 → 100644
... | ... | @@ -0,0 +1,70 @@ |
1 | +/** | |
2 | + * editable_selects.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 | +var TinyMCE_EditableSelects = { | |
12 | + editSelectElm : null, | |
13 | + | |
14 | + init : function() { | |
15 | + var nl = document.getElementsByTagName("select"), i, d = document, o; | |
16 | + | |
17 | + for (i=0; i<nl.length; i++) { | |
18 | + if (nl[i].className.indexOf('mceEditableSelect') != -1) { | |
19 | + o = new Option(tinyMCEPopup.editor.translate('value'), '__mce_add_custom__'); | |
20 | + | |
21 | + o.className = 'mceAddSelectValue'; | |
22 | + | |
23 | + nl[i].options[nl[i].options.length] = o; | |
24 | + nl[i].onchange = TinyMCE_EditableSelects.onChangeEditableSelect; | |
25 | + } | |
26 | + } | |
27 | + }, | |
28 | + | |
29 | + onChangeEditableSelect : function(e) { | |
30 | + var d = document, ne, se = window.event ? window.event.srcElement : e.target; | |
31 | + | |
32 | + if (se.options[se.selectedIndex].value == '__mce_add_custom__') { | |
33 | + ne = d.createElement("input"); | |
34 | + ne.id = se.id + "_custom"; | |
35 | + ne.name = se.name + "_custom"; | |
36 | + ne.type = "text"; | |
37 | + | |
38 | + ne.style.width = se.offsetWidth + 'px'; | |
39 | + se.parentNode.insertBefore(ne, se); | |
40 | + se.style.display = 'none'; | |
41 | + ne.focus(); | |
42 | + ne.onblur = TinyMCE_EditableSelects.onBlurEditableSelectInput; | |
43 | + ne.onkeydown = TinyMCE_EditableSelects.onKeyDown; | |
44 | + TinyMCE_EditableSelects.editSelectElm = se; | |
45 | + } | |
46 | + }, | |
47 | + | |
48 | + onBlurEditableSelectInput : function() { | |
49 | + var se = TinyMCE_EditableSelects.editSelectElm; | |
50 | + | |
51 | + if (se) { | |
52 | + if (se.previousSibling.value != '') { | |
53 | + addSelectValue(document.forms[0], se.id, se.previousSibling.value, se.previousSibling.value); | |
54 | + selectByValue(document.forms[0], se.id, se.previousSibling.value); | |
55 | + } else | |
56 | + selectByValue(document.forms[0], se.id, ''); | |
57 | + | |
58 | + se.style.display = 'inline'; | |
59 | + se.parentNode.removeChild(se.previousSibling); | |
60 | + TinyMCE_EditableSelects.editSelectElm = null; | |
61 | + } | |
62 | + }, | |
63 | + | |
64 | + onKeyDown : function(e) { | |
65 | + e = e || window.event; | |
66 | + | |
67 | + if (e.keyCode == 13) | |
68 | + TinyMCE_EditableSelects.onBlurEditableSelectInput(); | |
69 | + } | |
70 | +}; | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/form_utils.js
0 → 100644
... | ... | @@ -0,0 +1,210 @@ |
1 | +/** | |
2 | + * form_utils.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 | +var themeBaseURL = tinyMCEPopup.editor.baseURI.toAbsolute('themes/' + tinyMCEPopup.getParam("theme")); | |
12 | + | |
13 | +function getColorPickerHTML(id, target_form_element) { | |
14 | + var h = "", dom = tinyMCEPopup.dom; | |
15 | + | |
16 | + if (label = dom.select('label[for=' + target_form_element + ']')[0]) { | |
17 | + label.id = label.id || dom.uniqueId(); | |
18 | + } | |
19 | + | |
20 | + h += '<a role="button" aria-labelledby="' + id + '_label" id="' + id + '_link" href="javascript:;" onclick="tinyMCEPopup.pickColor(event,\'' + target_form_element +'\');" onmousedown="return false;" class="pickcolor">'; | |
21 | + h += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '"> <span id="' + id + '_label" class="mceVoiceLabel mceIconOnly" style="display:none;">' + tinyMCEPopup.getLang('browse') + '</span></span></a>'; | |
22 | + | |
23 | + return h; | |
24 | +} | |
25 | + | |
26 | +function updateColor(img_id, form_element_id) { | |
27 | + document.getElementById(img_id).style.backgroundColor = document.forms[0].elements[form_element_id].value; | |
28 | +} | |
29 | + | |
30 | +function setBrowserDisabled(id, state) { | |
31 | + var img = document.getElementById(id); | |
32 | + var lnk = document.getElementById(id + "_link"); | |
33 | + | |
34 | + if (lnk) { | |
35 | + if (state) { | |
36 | + lnk.setAttribute("realhref", lnk.getAttribute("href")); | |
37 | + lnk.removeAttribute("href"); | |
38 | + tinyMCEPopup.dom.addClass(img, 'disabled'); | |
39 | + } else { | |
40 | + if (lnk.getAttribute("realhref")) | |
41 | + lnk.setAttribute("href", lnk.getAttribute("realhref")); | |
42 | + | |
43 | + tinyMCEPopup.dom.removeClass(img, 'disabled'); | |
44 | + } | |
45 | + } | |
46 | +} | |
47 | + | |
48 | +function getBrowserHTML(id, target_form_element, type, prefix) { | |
49 | + var option = prefix + "_" + type + "_browser_callback", cb, html; | |
50 | + | |
51 | + cb = tinyMCEPopup.getParam(option, tinyMCEPopup.getParam("file_browser_callback")); | |
52 | + | |
53 | + if (!cb) | |
54 | + return ""; | |
55 | + | |
56 | + html = ""; | |
57 | + html += '<a id="' + id + '_link" href="javascript:openBrowser(\'' + id + '\',\'' + target_form_element + '\', \'' + type + '\',\'' + option + '\');" onmousedown="return false;" class="browse">'; | |
58 | + html += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '"> </span></a>'; | |
59 | + | |
60 | + return html; | |
61 | +} | |
62 | + | |
63 | +function openBrowser(img_id, target_form_element, type, option) { | |
64 | + var img = document.getElementById(img_id); | |
65 | + | |
66 | + if (img.className != "mceButtonDisabled") | |
67 | + tinyMCEPopup.openBrowser(target_form_element, type, option); | |
68 | +} | |
69 | + | |
70 | +function selectByValue(form_obj, field_name, value, add_custom, ignore_case) { | |
71 | + if (!form_obj || !form_obj.elements[field_name]) | |
72 | + return; | |
73 | + | |
74 | + if (!value) | |
75 | + value = ""; | |
76 | + | |
77 | + var sel = form_obj.elements[field_name]; | |
78 | + | |
79 | + var found = false; | |
80 | + for (var i=0; i<sel.options.length; i++) { | |
81 | + var option = sel.options[i]; | |
82 | + | |
83 | + if (option.value == value || (ignore_case && option.value.toLowerCase() == value.toLowerCase())) { | |
84 | + option.selected = true; | |
85 | + found = true; | |
86 | + } else | |
87 | + option.selected = false; | |
88 | + } | |
89 | + | |
90 | + if (!found && add_custom && value != '') { | |
91 | + var option = new Option(value, value); | |
92 | + option.selected = true; | |
93 | + sel.options[sel.options.length] = option; | |
94 | + sel.selectedIndex = sel.options.length - 1; | |
95 | + } | |
96 | + | |
97 | + return found; | |
98 | +} | |
99 | + | |
100 | +function getSelectValue(form_obj, field_name) { | |
101 | + var elm = form_obj.elements[field_name]; | |
102 | + | |
103 | + if (elm == null || elm.options == null || elm.selectedIndex === -1) | |
104 | + return ""; | |
105 | + | |
106 | + return elm.options[elm.selectedIndex].value; | |
107 | +} | |
108 | + | |
109 | +function addSelectValue(form_obj, field_name, name, value) { | |
110 | + var s = form_obj.elements[field_name]; | |
111 | + var o = new Option(name, value); | |
112 | + s.options[s.options.length] = o; | |
113 | +} | |
114 | + | |
115 | +function addClassesToList(list_id, specific_option) { | |
116 | + // Setup class droplist | |
117 | + var styleSelectElm = document.getElementById(list_id); | |
118 | + var styles = tinyMCEPopup.getParam('theme_advanced_styles', false); | |
119 | + styles = tinyMCEPopup.getParam(specific_option, styles); | |
120 | + | |
121 | + if (styles) { | |
122 | + var stylesAr = styles.split(';'); | |
123 | + | |
124 | + for (var i=0; i<stylesAr.length; i++) { | |
125 | + if (stylesAr != "") { | |
126 | + var key, value; | |
127 | + | |
128 | + key = stylesAr[i].split('=')[0]; | |
129 | + value = stylesAr[i].split('=')[1]; | |
130 | + | |
131 | + styleSelectElm.options[styleSelectElm.length] = new Option(key, value); | |
132 | + } | |
133 | + } | |
134 | + } else { | |
135 | + tinymce.each(tinyMCEPopup.editor.dom.getClasses(), function(o) { | |
136 | + styleSelectElm.options[styleSelectElm.length] = new Option(o.title || o['class'], o['class']); | |
137 | + }); | |
138 | + } | |
139 | +} | |
140 | + | |
141 | +function isVisible(element_id) { | |
142 | + var elm = document.getElementById(element_id); | |
143 | + | |
144 | + return elm && elm.style.display != "none"; | |
145 | +} | |
146 | + | |
147 | +function convertRGBToHex(col) { | |
148 | + var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi"); | |
149 | + | |
150 | + var rgb = col.replace(re, "$1,$2,$3").split(','); | |
151 | + if (rgb.length == 3) { | |
152 | + r = parseInt(rgb[0]).toString(16); | |
153 | + g = parseInt(rgb[1]).toString(16); | |
154 | + b = parseInt(rgb[2]).toString(16); | |
155 | + | |
156 | + r = r.length == 1 ? '0' + r : r; | |
157 | + g = g.length == 1 ? '0' + g : g; | |
158 | + b = b.length == 1 ? '0' + b : b; | |
159 | + | |
160 | + return "#" + r + g + b; | |
161 | + } | |
162 | + | |
163 | + return col; | |
164 | +} | |
165 | + | |
166 | +function convertHexToRGB(col) { | |
167 | + if (col.indexOf('#') != -1) { | |
168 | + col = col.replace(new RegExp('[^0-9A-F]', 'gi'), ''); | |
169 | + | |
170 | + r = parseInt(col.substring(0, 2), 16); | |
171 | + g = parseInt(col.substring(2, 4), 16); | |
172 | + b = parseInt(col.substring(4, 6), 16); | |
173 | + | |
174 | + return "rgb(" + r + "," + g + "," + b + ")"; | |
175 | + } | |
176 | + | |
177 | + return col; | |
178 | +} | |
179 | + | |
180 | +function trimSize(size) { | |
181 | + return size.replace(/([0-9\.]+)(px|%|in|cm|mm|em|ex|pt|pc)/i, '$1$2'); | |
182 | +} | |
183 | + | |
184 | +function getCSSSize(size) { | |
185 | + size = trimSize(size); | |
186 | + | |
187 | + if (size == "") | |
188 | + return ""; | |
189 | + | |
190 | + // Add px | |
191 | + if (/^[0-9]+$/.test(size)) | |
192 | + size += 'px'; | |
193 | + // Sanity check, IE doesn't like broken values | |
194 | + else if (!(/^[0-9\.]+(px|%|in|cm|mm|em|ex|pt|pc)$/i.test(size))) | |
195 | + return ""; | |
196 | + | |
197 | + return size; | |
198 | +} | |
199 | + | |
200 | +function getStyle(elm, attrib, style) { | |
201 | + var val = tinyMCEPopup.dom.getAttrib(elm, attrib); | |
202 | + | |
203 | + if (val != '') | |
204 | + return '' + val; | |
205 | + | |
206 | + if (typeof(style) == 'undefined') | |
207 | + style = attrib; | |
208 | + | |
209 | + return tinyMCEPopup.dom.getStyle(elm, style); | |
210 | +} | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/langs/en.js
1 | -tinyMCE.addI18n({en:{ | |
2 | -common:{ | |
3 | -edit_confirm:"Do you want to use the WYSIWYG mode for this textarea?", | |
4 | -apply:"Apply", | |
5 | -insert:"Insert", | |
6 | -update:"Update", | |
7 | -cancel:"Cancel", | |
8 | -close:"Close", | |
9 | -browse:"Browse", | |
10 | -class_name:"Class", | |
11 | -not_set:"-- Not set --", | |
12 | -clipboard_msg:"Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?", | |
13 | -clipboard_no_support:"Currently not supported by your browser, use keyboard shortcuts instead.", | |
14 | -popup_blocked:"Sorry, but we have noticed that your popup-blocker has disabled a window that provides application functionality. You will need to disable popup blocking on this site in order to fully utilize this tool.", | |
15 | -invalid_data:"{#field} is invalid", | |
16 | -invalid_data_number:"{#field} must be a number", | |
17 | -invalid_data_min:"{#field} must be a number greater than {#min}", | |
18 | -invalid_data_size:"{#field} must be a number or percentage", | |
19 | -more_colors:"More colors" | |
20 | -}, | |
21 | -colors:{ | |
22 | -'000000':'Black', | |
23 | -'993300':'Burnt orange', | |
24 | -'333300':'Dark olive', | |
25 | -'003300':'Dark green', | |
26 | -'003366':'Dark azure', | |
27 | -'000080':'Navy Blue', | |
28 | -'333399':'Indigo', | |
29 | -'333333':'Very dark gray', | |
30 | -'800000':'Maroon', | |
31 | -'FF6600':'Orange', | |
32 | -'808000':'Olive', | |
33 | -'008000':'Green', | |
34 | -'008080':'Teal', | |
35 | -'0000FF':'Blue', | |
36 | -'666699':'Grayish blue', | |
37 | -'808080':'Gray', | |
38 | -'FF0000':'Red', | |
39 | -'FF9900':'Amber', | |
40 | -'99CC00':'Yellow green', | |
41 | -'339966':'Sea green', | |
42 | -'33CCCC':'Turquoise', | |
43 | -'3366FF':'Royal blue', | |
44 | -'800080':'Purple', | |
45 | -'999999':'Medium gray', | |
46 | -'FF00FF':'Magenta', | |
47 | -'FFCC00':'Gold', | |
48 | -'FFFF00':'Yellow', | |
49 | -'00FF00':'Lime', | |
50 | -'00FFFF':'Aqua', | |
51 | -'00CCFF':'Sky blue', | |
52 | -'993366':'Brown', | |
53 | -'C0C0C0':'Silver', | |
54 | -'FF99CC':'Pink', | |
55 | -'FFCC99':'Peach', | |
56 | -'FFFF99':'Light yellow', | |
57 | -'CCFFCC':'Pale green', | |
58 | -'CCFFFF':'Pale cyan', | |
59 | -'99CCFF':'Light sky blue', | |
60 | -'CC99FF':'Plum', | |
61 | -'FFFFFF':'White' | |
62 | -}, | |
63 | -contextmenu:{ | |
64 | -align:"Alignment", | |
65 | -left:"Left", | |
66 | -center:"Center", | |
67 | -right:"Right", | |
68 | -full:"Full" | |
69 | -}, | |
70 | -insertdatetime:{ | |
71 | -date_fmt:"%Y-%m-%d", | |
72 | -time_fmt:"%H:%M:%S", | |
73 | -insertdate_desc:"Insert date", | |
74 | -inserttime_desc:"Insert time", | |
75 | -months_long:"January,February,March,April,May,June,July,August,September,October,November,December", | |
76 | -months_short:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec", | |
77 | -day_long:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday", | |
78 | -day_short:"Sun,Mon,Tue,Wed,Thu,Fri,Sat,Sun" | |
79 | -}, | |
80 | -print:{ | |
81 | -print_desc:"Print" | |
82 | -}, | |
83 | -preview:{ | |
84 | -preview_desc:"Preview" | |
85 | -}, | |
86 | -directionality:{ | |
87 | -ltr_desc:"Direction left to right", | |
88 | -rtl_desc:"Direction right to left" | |
89 | -}, | |
90 | -layer:{ | |
91 | -insertlayer_desc:"Insert new layer", | |
92 | -forward_desc:"Move forward", | |
93 | -backward_desc:"Move backward", | |
94 | -absolute_desc:"Toggle absolute positioning", | |
95 | -content:"New layer..." | |
96 | -}, | |
97 | -save:{ | |
98 | -save_desc:"Save", | |
99 | -cancel_desc:"Cancel all changes" | |
100 | -}, | |
101 | -nonbreaking:{ | |
102 | -nonbreaking_desc:"Insert non-breaking space character" | |
103 | -}, | |
104 | -iespell:{ | |
105 | -iespell_desc:"Run spell checking", | |
106 | -download:"ieSpell not detected. Do you want to install it now?" | |
107 | -}, | |
108 | -advhr:{ | |
109 | -advhr_desc:"Horizontal rule" | |
110 | -}, | |
111 | -emotions:{ | |
112 | -emotions_desc:"Emotions" | |
113 | -}, | |
114 | -searchreplace:{ | |
115 | -search_desc:"Find", | |
116 | -replace_desc:"Find/Replace" | |
117 | -}, | |
118 | -advimage:{ | |
119 | -image_desc:"Insert/edit image" | |
120 | -}, | |
121 | -advlink:{ | |
122 | -link_desc:"Insert/edit link" | |
123 | -}, | |
124 | -xhtmlxtras:{ | |
125 | -cite_desc:"Citation", | |
126 | -abbr_desc:"Abbreviation", | |
127 | -acronym_desc:"Acronym", | |
128 | -del_desc:"Deletion", | |
129 | -ins_desc:"Insertion", | |
130 | -attribs_desc:"Insert/Edit Attributes" | |
131 | -}, | |
132 | -style:{ | |
133 | -desc:"Edit CSS Style" | |
134 | -}, | |
135 | -paste:{ | |
136 | -paste_text_desc:"Paste as Plain Text", | |
137 | -paste_word_desc:"Paste from Word", | |
138 | -selectall_desc:"Select All", | |
139 | -plaintext_mode_sticky:"Paste is now in plain text mode. Click again to toggle back to regular paste mode. After you paste something you will be returned to regular paste mode.", | |
140 | -plaintext_mode:"Paste is now in plain text mode. Click again to toggle back to regular paste mode." | |
141 | -}, | |
142 | -paste_dlg:{ | |
143 | -text_title:"Use CTRL+V on your keyboard to paste the text into the window.", | |
144 | -text_linebreaks:"Keep linebreaks", | |
145 | -word_title:"Use CTRL+V on your keyboard to paste the text into the window." | |
146 | -}, | |
147 | -table:{ | |
148 | -desc:"Inserts a new table", | |
149 | -row_before_desc:"Insert row before", | |
150 | -row_after_desc:"Insert row after", | |
151 | -delete_row_desc:"Delete row", | |
152 | -col_before_desc:"Insert column before", | |
153 | -col_after_desc:"Insert column after", | |
154 | -delete_col_desc:"Remove column", | |
155 | -split_cells_desc:"Split merged table cells", | |
156 | -merge_cells_desc:"Merge table cells", | |
157 | -row_desc:"Table row properties", | |
158 | -cell_desc:"Table cell properties", | |
159 | -props_desc:"Table properties", | |
160 | -paste_row_before_desc:"Paste table row before", | |
161 | -paste_row_after_desc:"Paste table row after", | |
162 | -cut_row_desc:"Cut table row", | |
163 | -copy_row_desc:"Copy table row", | |
164 | -del:"Delete table", | |
165 | -row:"Row", | |
166 | -col:"Column", | |
167 | -cell:"Cell" | |
168 | -}, | |
169 | -autosave:{ | |
170 | -unload_msg:"The changes you made will be lost if you navigate away from this page.", | |
171 | -restore_content:"Restore auto-saved content.", | |
172 | -warning_message:"If you restore the saved content, you will lose all the content that is currently in the editor.\n\nAre you sure you want to restore the saved content?." | |
173 | -}, | |
174 | -fullscreen:{ | |
175 | -desc:"Toggle fullscreen mode" | |
176 | -}, | |
177 | -media:{ | |
178 | -desc:"Insert / edit embedded media", | |
179 | -edit:"Edit embedded media" | |
180 | -}, | |
181 | -fullpage:{ | |
182 | -desc:"Document properties" | |
183 | -}, | |
184 | -template:{ | |
185 | -desc:"Insert predefined template content" | |
186 | -}, | |
187 | -visualchars:{ | |
188 | -desc:"Visual control characters on/off." | |
189 | -}, | |
190 | -spellchecker:{ | |
191 | -desc:"Toggle spellchecker", | |
192 | -menu:"Spellchecker settings", | |
193 | -ignore_word:"Ignore word", | |
194 | -ignore_words:"Ignore all", | |
195 | -langs:"Languages", | |
196 | -wait:"Please wait...", | |
197 | -sug:"Suggestions", | |
198 | -no_sug:"No suggestions", | |
199 | -no_mpell:"No misspellings found.", | |
200 | -learn_word:"Learn word" | |
201 | -}, | |
202 | -pagebreak:{ | |
203 | -desc:"Insert page break." | |
204 | -}, | |
205 | -advlist:{ | |
206 | -types:"Types", | |
207 | -def:"Default", | |
208 | -lower_alpha:"Lower alpha", | |
209 | -lower_greek:"Lower greek", | |
210 | -lower_roman:"Lower roman", | |
211 | -upper_alpha:"Upper alpha", | |
212 | -upper_roman:"Upper roman", | |
213 | -circle:"Circle", | |
214 | -disc:"Disc", | |
215 | -square:"Square" | |
216 | -}, | |
217 | -aria:{ | |
218 | -rich_text_area:"Rich Text Area" | |
219 | -}, | |
220 | -wordcount:{ | |
221 | -words: 'Words: ' | |
222 | -} | |
223 | -}}); | |
224 | 1 | \ No newline at end of file |
2 | +tinyMCE.addI18n({en:{common:{"more_colors":"More Colors...","invalid_data":"Error: Invalid values entered, these are marked in red.","popup_blocked":"Sorry, but we have noticed that your popup-blocker has disabled a window that provides application functionality. You will need to disable popup blocking on this site in order to fully utilize this tool.","clipboard_no_support":"Currently not supported by your browser, use keyboard shortcuts instead.","clipboard_msg":"Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?","not_set":"-- Not Set --","class_name":"Class",browse:"Browse",close:"Close",cancel:"Cancel",update:"Update",insert:"Insert",apply:"Apply","edit_confirm":"Do you want to use the WYSIWYG mode for this textarea?","invalid_data_number":"{#field} must be a number","invalid_data_min":"{#field} must be a number greater than {#min}","invalid_data_size":"{#field} must be a number or percentage",value:"(value)"},contextmenu:{full:"Full",right:"Right",center:"Center",left:"Left",align:"Alignment"},insertdatetime:{"day_short":"Sun,Mon,Tue,Wed,Thu,Fri,Sat,Sun","day_long":"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday","months_short":"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec","months_long":"January,February,March,April,May,June,July,August,September,October,November,December","inserttime_desc":"Insert Time","insertdate_desc":"Insert Date","time_fmt":"%H:%M:%S","date_fmt":"%Y-%m-%d"},print:{"print_desc":"Print"},preview:{"preview_desc":"Preview"},directionality:{"rtl_desc":"Direction Right to Left","ltr_desc":"Direction Left to Right"},layer:{content:"New layer...","absolute_desc":"Toggle Absolute Positioning","backward_desc":"Move Backward","forward_desc":"Move Forward","insertlayer_desc":"Insert New Layer"},save:{"save_desc":"Save","cancel_desc":"Cancel All Changes"},nonbreaking:{"nonbreaking_desc":"Insert Non-Breaking Space Character"},iespell:{download:"ieSpell not detected. Do you want to install it now?","iespell_desc":"Check Spelling"},advhr:{"delta_height":"","delta_width":"","advhr_desc":"Insert Horizontal Line"},emotions:{"delta_height":"","delta_width":"","emotions_desc":"Emotions"},searchreplace:{"replace_desc":"Find/Replace","delta_width":"","delta_height":"","search_desc":"Find"},advimage:{"delta_width":"","image_desc":"Insert/Edit Image","delta_height":""},advlink:{"delta_height":"","delta_width":"","link_desc":"Insert/Edit Link"},xhtmlxtras:{"attribs_delta_height":"","attribs_delta_width":"","ins_delta_height":"","ins_delta_width":"","del_delta_height":"","del_delta_width":"","acronym_delta_height":"","acronym_delta_width":"","abbr_delta_height":"","abbr_delta_width":"","cite_delta_height":"","cite_delta_width":"","attribs_desc":"Insert/Edit Attributes","ins_desc":"Insertion","del_desc":"Deletion","acronym_desc":"Acronym","abbr_desc":"Abbreviation","cite_desc":"Citation"},style:{"delta_height":"","delta_width":"",desc:"Edit CSS Style"},paste:{"plaintext_mode_stick":"Paste is now in plain text mode. Click again to toggle back to regular paste mode.","plaintext_mode":"Paste is now in plain text mode. Click again to toggle back to regular paste mode. After you paste something you will be returned to regular paste mode.","selectall_desc":"Select All","paste_word_desc":"Paste from Word","paste_text_desc":"Paste as Plain Text"},"paste_dlg":{"word_title":"Use Ctrl+V on your keyboard to paste the text into the window.","text_linebreaks":"Keep Linebreaks","text_title":"Use Ctrl+V on your keyboard to paste the text into the window."},table:{"merge_cells_delta_height":"","merge_cells_delta_width":"","table_delta_height":"","table_delta_width":"","cellprops_delta_height":"","cellprops_delta_width":"","rowprops_delta_height":"","rowprops_delta_width":"",cell:"Cell",col:"Column",row:"Row",del:"Delete Table","copy_row_desc":"Copy Table Row","cut_row_desc":"Cut Table Row","paste_row_after_desc":"Paste Table Row After","paste_row_before_desc":"Paste Table Row Before","props_desc":"Table Properties","cell_desc":"Table Cell Properties","row_desc":"Table Row Properties","merge_cells_desc":"Merge Table Cells","split_cells_desc":"Split Merged Table Cells","delete_col_desc":"Delete Column","col_after_desc":"Insert Column After","col_before_desc":"Insert Column Before","delete_row_desc":"Delete Row","row_after_desc":"Insert Row After","row_before_desc":"Insert Row Before",desc:"Insert/Edit Table"},autosave:{"warning_message":"If you restore the saved content, you will lose all the content that is currently in the editor.\n\nAre you sure you want to restore the saved content?","restore_content":"Restore auto-saved content.","unload_msg":"The changes you made will be lost if you navigate away from this page."},fullscreen:{desc:"Toggle Full Screen Mode"},media:{"delta_height":"","delta_width":"",edit:"Edit Embedded Media",desc:"Insert/Edit Embedded Media"},fullpage:{desc:"Document Properties","delta_width":"","delta_height":""},template:{desc:"Insert Predefined Template Content"},visualchars:{desc:"Show/Hide Visual Control Characters"},spellchecker:{desc:"Toggle Spell Checker",menu:"Spell Checker Settings","ignore_word":"Ignore Word","ignore_words":"Ignore All",langs:"Languages",wait:"Please wait...",sug:"Suggestions","no_sug":"No Suggestions","no_mpell":"No misspellings found.","learn_word":"Learn word"},pagebreak:{desc:"Insert Page Break for Printing"},advlist:{types:"Types",def:"Default","lower_alpha":"Lower Alpha","lower_greek":"Lower Greek","lower_roman":"Lower Roman","upper_alpha":"Upper Alpha","upper_roman":"Upper Roman",circle:"Circle",disc:"Disc",square:"Square"},colors:{"333300":"Dark olive","993300":"Burnt orange","000000":"Black","003300":"Dark green","003366":"Dark azure","000080":"Navy Blue","333399":"Indigo","333333":"Very dark gray","800000":"Maroon",FF6600:"Orange","808000":"Olive","008000":"Green","008080":"Teal","0000FF":"Blue","666699":"Grayish blue","808080":"Gray",FF0000:"Red",FF9900:"Amber","99CC00":"Yellow green","339966":"Sea green","33CCCC":"Turquoise","3366FF":"Royal blue","800080":"Purple","999999":"Medium gray",FF00FF:"Magenta",FFCC00:"Gold",FFFF00:"Yellow","00FF00":"Lime","00FFFF":"Aqua","00CCFF":"Sky blue","993366":"Brown",C0C0C0:"Silver",FF99CC:"Pink",FFCC99:"Peach",FFFF99:"Light yellow",CCFFCC:"Pale green",CCFFFF:"Pale cyan","99CCFF":"Light sky blue",CC99FF:"Plum",FFFFFF:"White"},aria:{"rich_text_area":"Rich Text Area"},wordcount:{words:"Words:"},visualblocks:{desc:'Show/hide block elements'}}}); | |
225 | 3 | \ No newline at end of file | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/license.txt
... | ... | @@ -20,7 +20,7 @@ free software--to make sure the software is free for all its users. |
20 | 20 | This license, the Lesser General Public License, applies to some |
21 | 21 | specially designated software packages--typically libraries--of the |
22 | 22 | Free Software Foundation and other authors who decide to use it. You |
23 | -can use it too, but we suggest you first think carefully about whether | |
23 | +can use it too, but we suggest you first think carefuly about whether | |
24 | 24 | this license or the ordinary General Public License is the better |
25 | 25 | strategy to use in any particular case, based on the explanations below. |
26 | 26 | ... | ... |
... | ... | @@ -0,0 +1,162 @@ |
1 | +/** | |
2 | + * mctabs.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 MCTabs() { | |
12 | + this.settings = []; | |
13 | + this.onChange = tinyMCEPopup.editor.windowManager.createInstance('tinymce.util.Dispatcher'); | |
14 | +}; | |
15 | + | |
16 | +MCTabs.prototype.init = function(settings) { | |
17 | + this.settings = settings; | |
18 | +}; | |
19 | + | |
20 | +MCTabs.prototype.getParam = function(name, default_value) { | |
21 | + var value = null; | |
22 | + | |
23 | + value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name]; | |
24 | + | |
25 | + // Fix bool values | |
26 | + if (value == "true" || value == "false") | |
27 | + return (value == "true"); | |
28 | + | |
29 | + return value; | |
30 | +}; | |
31 | + | |
32 | +MCTabs.prototype.showTab =function(tab){ | |
33 | + tab.className = 'current'; | |
34 | + tab.setAttribute("aria-selected", true); | |
35 | + tab.setAttribute("aria-expanded", true); | |
36 | + tab.tabIndex = 0; | |
37 | +}; | |
38 | + | |
39 | +MCTabs.prototype.hideTab =function(tab){ | |
40 | + var t=this; | |
41 | + | |
42 | + tab.className = ''; | |
43 | + tab.setAttribute("aria-selected", false); | |
44 | + tab.setAttribute("aria-expanded", false); | |
45 | + tab.tabIndex = -1; | |
46 | +}; | |
47 | + | |
48 | +MCTabs.prototype.showPanel = function(panel) { | |
49 | + panel.className = 'current'; | |
50 | + panel.setAttribute("aria-hidden", false); | |
51 | +}; | |
52 | + | |
53 | +MCTabs.prototype.hidePanel = function(panel) { | |
54 | + panel.className = 'panel'; | |
55 | + panel.setAttribute("aria-hidden", true); | |
56 | +}; | |
57 | + | |
58 | +MCTabs.prototype.getPanelForTab = function(tabElm) { | |
59 | + return tinyMCEPopup.dom.getAttrib(tabElm, "aria-controls"); | |
60 | +}; | |
61 | + | |
62 | +MCTabs.prototype.displayTab = function(tab_id, panel_id, avoid_focus) { | |
63 | + var panelElm, panelContainerElm, tabElm, tabContainerElm, selectionClass, nodes, i, t = this; | |
64 | + | |
65 | + tabElm = document.getElementById(tab_id); | |
66 | + | |
67 | + if (panel_id === undefined) { | |
68 | + panel_id = t.getPanelForTab(tabElm); | |
69 | + } | |
70 | + | |
71 | + panelElm= document.getElementById(panel_id); | |
72 | + panelContainerElm = panelElm ? panelElm.parentNode : null; | |
73 | + tabContainerElm = tabElm ? tabElm.parentNode : null; | |
74 | + selectionClass = t.getParam('selection_class', 'current'); | |
75 | + | |
76 | + if (tabElm && tabContainerElm) { | |
77 | + nodes = tabContainerElm.childNodes; | |
78 | + | |
79 | + // Hide all other tabs | |
80 | + for (i = 0; i < nodes.length; i++) { | |
81 | + if (nodes[i].nodeName == "LI") { | |
82 | + t.hideTab(nodes[i]); | |
83 | + } | |
84 | + } | |
85 | + | |
86 | + // Show selected tab | |
87 | + t.showTab(tabElm); | |
88 | + } | |
89 | + | |
90 | + if (panelElm && panelContainerElm) { | |
91 | + nodes = panelContainerElm.childNodes; | |
92 | + | |
93 | + // Hide all other panels | |
94 | + for (i = 0; i < nodes.length; i++) { | |
95 | + if (nodes[i].nodeName == "DIV") | |
96 | + t.hidePanel(nodes[i]); | |
97 | + } | |
98 | + | |
99 | + if (!avoid_focus) { | |
100 | + tabElm.focus(); | |
101 | + } | |
102 | + | |
103 | + // Show selected panel | |
104 | + t.showPanel(panelElm); | |
105 | + } | |
106 | +}; | |
107 | + | |
108 | +MCTabs.prototype.getAnchor = function() { | |
109 | + var pos, url = document.location.href; | |
110 | + | |
111 | + if ((pos = url.lastIndexOf('#')) != -1) | |
112 | + return url.substring(pos + 1); | |
113 | + | |
114 | + return ""; | |
115 | +}; | |
116 | + | |
117 | + | |
118 | +//Global instance | |
119 | +var mcTabs = new MCTabs(); | |
120 | + | |
121 | +tinyMCEPopup.onInit.add(function() { | |
122 | + var tinymce = tinyMCEPopup.getWin().tinymce, dom = tinyMCEPopup.dom, each = tinymce.each; | |
123 | + | |
124 | + each(dom.select('div.tabs'), function(tabContainerElm) { | |
125 | + var keyNav; | |
126 | + | |
127 | + dom.setAttrib(tabContainerElm, "role", "tablist"); | |
128 | + | |
129 | + var items = tinyMCEPopup.dom.select('li', tabContainerElm); | |
130 | + var action = function(id) { | |
131 | + mcTabs.displayTab(id, mcTabs.getPanelForTab(id)); | |
132 | + mcTabs.onChange.dispatch(id); | |
133 | + }; | |
134 | + | |
135 | + each(items, function(item) { | |
136 | + dom.setAttrib(item, 'role', 'tab'); | |
137 | + dom.bind(item, 'click', function(evt) { | |
138 | + action(item.id); | |
139 | + }); | |
140 | + }); | |
141 | + | |
142 | + dom.bind(dom.getRoot(), 'keydown', function(evt) { | |
143 | + if (evt.keyCode === 9 && evt.ctrlKey && !evt.altKey) { // Tab | |
144 | + keyNav.moveFocus(evt.shiftKey ? -1 : 1); | |
145 | + tinymce.dom.Event.cancel(evt); | |
146 | + } | |
147 | + }); | |
148 | + | |
149 | + each(dom.select('a', tabContainerElm), function(a) { | |
150 | + dom.setAttrib(a, 'tabindex', '-1'); | |
151 | + }); | |
152 | + | |
153 | + keyNav = tinyMCEPopup.editor.windowManager.createInstance('tinymce.ui.KeyboardNavigation', { | |
154 | + root: tabContainerElm, | |
155 | + items: items, | |
156 | + onAction: action, | |
157 | + actOnFocus: true, | |
158 | + enableLeftRight: true, | |
159 | + enableUpDown: true | |
160 | + }, tinyMCEPopup.dom); | |
161 | + }); | |
162 | +}); | |
0 | 163 | \ No newline at end of file | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/advhr/langs/en_dlg.js
1 | -tinyMCE.addI18n('en.advhr_dlg',{ | |
2 | -normal:"Normal", | |
3 | -width:"Width", | |
4 | -widthunits:"Units", | |
5 | -size:"Height", | |
6 | -noshade:"No shadow" | |
7 | -}); | |
8 | 1 | \ No newline at end of file |
2 | +tinyMCE.addI18n('en.advhr_dlg',{size:"Height",noshade:"No Shadow",width:"Width",normal:"Normal",widthunits:"Units"}); | |
9 | 3 | \ No newline at end of file | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/advimage/editor_plugin.js
1 | -(function(){tinymce.create("tinymce.plugins.AdvancedImagePlugin",{init:function(a,b){a.addCommand("mceAdvImage",function(){if(a.dom.getAttrib(a.selection.getNode(),"class").indexOf("mceItem")!=-1){return}a.windowManager.open({file:b+"/image.htm",width:480+parseInt(a.getLang("advimage.delta_width",0)),height:385+parseInt(a.getLang("advimage.delta_height",0)),inline:1},{plugin_url:b})});a.addButton("image",{title:"advimage.image_desc",cmd:"mceAdvImage"})},getInfo:function(){return{longname:"Advanced image",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advimage",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("advimage",tinymce.plugins.AdvancedImagePlugin)})(); | |
2 | 1 | \ No newline at end of file |
2 | +(function(){tinymce.create("tinymce.plugins.AdvancedImagePlugin",{init:function(a,b){a.addCommand("mceAdvImage",function(){if(a.dom.getAttrib(a.selection.getNode(),"class","").indexOf("mceItem")!=-1){return}a.windowManager.open({file:b+"/image.htm",width:480+parseInt(a.getLang("advimage.delta_width",0)),height:385+parseInt(a.getLang("advimage.delta_height",0)),inline:1},{plugin_url:b})});a.addButton("image",{title:"advimage.image_desc",cmd:"mceAdvImage"})},getInfo:function(){return{longname:"Advanced image",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advimage",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("advimage",tinymce.plugins.AdvancedImagePlugin)})(); | |
3 | 3 | \ No newline at end of file | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/advimage/editor_plugin_src.js
... | ... | @@ -14,7 +14,7 @@ |
14 | 14 | // Register commands |
15 | 15 | ed.addCommand('mceAdvImage', function() { |
16 | 16 | // Internal image object like a flash placeholder |
17 | - if (ed.dom.getAttrib(ed.selection.getNode(), 'class').indexOf('mceItem') != -1) | |
17 | + if (ed.dom.getAttrib(ed.selection.getNode(), 'class', '').indexOf('mceItem') != -1) | |
18 | 18 | return; |
19 | 19 | |
20 | 20 | ed.windowManager.open({ | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/advimage/js/image.js
... | ... | @@ -9,13 +9,13 @@ var ImageDialog = { |
9 | 9 | }, |
10 | 10 | |
11 | 11 | init : function(ed) { |
12 | - var f = document.forms[0], nl = f.elements, ed = tinyMCEPopup.editor, dom = ed.dom, n = ed.selection.getNode(); | |
12 | + var f = document.forms[0], nl = f.elements, ed = tinyMCEPopup.editor, dom = ed.dom, n = ed.selection.getNode(), fl = tinyMCEPopup.getParam('external_image_list', 'tinyMCEImageList'); | |
13 | 13 | |
14 | 14 | tinyMCEPopup.resizeToInnerSize(); |
15 | 15 | this.fillClassList('class_list'); |
16 | - this.fillFileList('src_list', 'tinyMCEImageList'); | |
17 | - this.fillFileList('over_list', 'tinyMCEImageList'); | |
18 | - this.fillFileList('out_list', 'tinyMCEImageList'); | |
16 | + this.fillFileList('src_list', fl); | |
17 | + this.fillFileList('over_list', fl); | |
18 | + this.fillFileList('out_list', fl); | |
19 | 19 | TinyMCE_EditableSelects.init(); |
20 | 20 | |
21 | 21 | if (n.nodeName == 'IMG') { |
... | ... | @@ -171,9 +171,13 @@ var ImageDialog = { |
171 | 171 | if (el && el.nodeName == 'IMG') { |
172 | 172 | ed.dom.setAttribs(el, args); |
173 | 173 | } else { |
174 | - ed.execCommand('mceInsertContent', false, '<img id="__mce_tmp" />', {skip_undo : 1}); | |
175 | - ed.dom.setAttribs('__mce_tmp', args); | |
176 | - ed.dom.setAttrib('__mce_tmp', 'id', ''); | |
174 | + tinymce.each(args, function(value, name) { | |
175 | + if (value === "") { | |
176 | + delete args[name]; | |
177 | + } | |
178 | + }); | |
179 | + | |
180 | + ed.execCommand('mceInsertContent', false, tinyMCEPopup.editor.dom.createHTML('img', args), {skip_undo : 1}); | |
177 | 181 | ed.undoManager.add(); |
178 | 182 | } |
179 | 183 | |
... | ... | @@ -287,7 +291,7 @@ var ImageDialog = { |
287 | 291 | fillFileList : function(id, l) { |
288 | 292 | var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl; |
289 | 293 | |
290 | - l = window[l]; | |
294 | + l = typeof(l) === 'function' ? l() : window[l]; | |
291 | 295 | lst.options.length = 0; |
292 | 296 | |
293 | 297 | if (l && l.length > 0) { |
... | ... | @@ -391,12 +395,14 @@ var ImageDialog = { |
391 | 395 | if (v == '0') |
392 | 396 | img.style.border = isIE ? '0' : '0 none none'; |
393 | 397 | else { |
394 | - if (b.length == 3 && b[isIE ? 2 : 1]) | |
395 | - bStyle = b[isIE ? 2 : 1]; | |
398 | + var isOldIE = tinymce.isIE && (!document.documentMode || document.documentMode < 9); | |
399 | + | |
400 | + if (b.length == 3 && b[isOldIE ? 2 : 1]) | |
401 | + bStyle = b[isOldIE ? 2 : 1]; | |
396 | 402 | else if (!bStyle || bStyle == 'none') |
397 | 403 | bStyle = 'solid'; |
398 | 404 | if (b.length == 3 && b[isIE ? 0 : 2]) |
399 | - bColor = b[isIE ? 0 : 2]; | |
405 | + bColor = b[isOldIE ? 0 : 2]; | |
400 | 406 | else if (!bColor || bColor == 'none') |
401 | 407 | bColor = 'black'; |
402 | 408 | img.style.border = v + 'px ' + bStyle + ' ' + bColor; | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/advimage/langs/en_dlg.js
1 | -tinyMCE.addI18n('en.advimage_dlg',{ | |
2 | -tab_general:"General", | |
3 | -tab_appearance:"Appearance", | |
4 | -tab_advanced:"Advanced", | |
5 | -general:"General", | |
6 | -title:"Title", | |
7 | -preview:"Preview", | |
8 | -constrain_proportions:"Constrain proportions", | |
9 | -langdir:"Language direction", | |
10 | -langcode:"Language code", | |
11 | -long_desc:"Long description link", | |
12 | -style:"Style", | |
13 | -classes:"Classes", | |
14 | -ltr:"Left to right", | |
15 | -rtl:"Right to left", | |
16 | -id:"Id", | |
17 | -map:"Image map", | |
18 | -swap_image:"Swap image", | |
19 | -alt_image:"Alternative image", | |
20 | -mouseover:"for mouse over", | |
21 | -mouseout:"for mouse out", | |
22 | -misc:"Miscellaneous", | |
23 | -example_img:"Appearance preview image", | |
24 | -missing_alt:"Are you sure you want to continue without including an Image Description? Without it the image may not be accessible to some users with disabilities, or to those using a text browser, or browsing the Web with images turned off.", | |
25 | -dialog_title:"Insert/edit image", | |
26 | -src:"Image URL", | |
27 | -alt:"Image description", | |
28 | -list:"Image list", | |
29 | -border:"Border", | |
30 | -dimensions:"Dimensions", | |
31 | -width:"Width", | |
32 | -height:"Height", | |
33 | -vspace:"Vertical space", | |
34 | -hspace:"Horizontal space", | |
35 | -align:"Alignment", | |
36 | -align_baseline:"Baseline", | |
37 | -align_top:"Top", | |
38 | -align_middle:"Middle", | |
39 | -align_bottom:"Bottom", | |
40 | -align_texttop:"Text top", | |
41 | -align_textbottom:"Text bottom", | |
42 | -align_left:"Left", | |
43 | -align_right:"Right", | |
44 | -image_list:"Image list" | |
45 | -}); | |
46 | 1 | \ No newline at end of file |
2 | +tinyMCE.addI18n('en.advimage_dlg',{"image_list":"Image List","align_right":"Right","align_left":"Left","align_textbottom":"Text Bottom","align_texttop":"Text Top","align_bottom":"Bottom","align_middle":"Middle","align_top":"Top","align_baseline":"Baseline",align:"Alignment",hspace:"Horizontal Space",vspace:"Vertical Space",dimensions:"Dimensions",border:"Border",list:"Image List",alt:"Image Description",src:"Image URL","dialog_title":"Insert/Edit Image","missing_alt":"Are you sure you want to continue without including an Image Description? Without it the image may not be accessible to some users with disabilities, or to those using a text browser, or browsing the Web with images turned off.","example_img":"Appearance Preview Image",misc:"Miscellaneous",mouseout:"For Mouse Out",mouseover:"For Mouse Over","alt_image":"Alternative Image","swap_image":"Swap Image",map:"Image Map",id:"ID",rtl:"Right to Left",ltr:"Left to Right",classes:"Classes",style:"Style","long_desc":"Long Description Link",langcode:"Language Code",langdir:"Language Direction","constrain_proportions":"Constrain Proportions",preview:"Preview",title:"Title",general:"General","tab_advanced":"Advanced","tab_appearance":"Appearance","tab_general":"General",width:"Width",height:"Height"}); | |
47 | 3 | \ No newline at end of file | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/advlink/js/advlink.js
... | ... | @@ -54,16 +54,24 @@ function init() { |
54 | 54 | document.getElementById('popupurl').style.width = '180px'; |
55 | 55 | |
56 | 56 | elm = inst.dom.getParent(elm, "A"); |
57 | + if (elm == null) { | |
58 | + var prospect = inst.dom.create("p", null, inst.selection.getContent()); | |
59 | + if (prospect.childNodes.length === 1) { | |
60 | + elm = prospect.firstChild; | |
61 | + } | |
62 | + } | |
63 | + | |
57 | 64 | if (elm != null && elm.nodeName == "A") |
58 | 65 | action = "update"; |
59 | 66 | |
60 | - formObj.insert.value = tinyMCEPopup.getLang(action, 'Insert', true); | |
67 | + formObj.insert.value = tinyMCEPopup.getLang(action, 'Insert', true); | |
61 | 68 | |
62 | 69 | setPopupControlsDisabled(true); |
63 | 70 | |
64 | 71 | if (action == "update") { |
65 | 72 | var href = inst.dom.getAttrib(elm, 'href'); |
66 | 73 | var onclick = inst.dom.getAttrib(elm, 'onclick'); |
74 | + var linkTarget = inst.dom.getAttrib(elm, 'target') ? inst.dom.getAttrib(elm, 'target') : "_self"; | |
67 | 75 | |
68 | 76 | // Setup form data |
69 | 77 | setFormValue('href', href); |
... | ... | @@ -91,7 +99,7 @@ function init() { |
91 | 99 | setFormValue('onkeypress', inst.dom.getAttrib(elm, 'onkeypress')); |
92 | 100 | setFormValue('onkeydown', inst.dom.getAttrib(elm, 'onkeydown')); |
93 | 101 | setFormValue('onkeyup', inst.dom.getAttrib(elm, 'onkeyup')); |
94 | - setFormValue('target', inst.dom.getAttrib(elm, 'target')); | |
102 | + setFormValue('target', linkTarget); | |
95 | 103 | setFormValue('classes', inst.dom.getAttrib(elm, 'class')); |
96 | 104 | |
97 | 105 | // Parse onclick data |
... | ... | @@ -112,7 +120,7 @@ function init() { |
112 | 120 | addClassesToList('classlist', 'advlink_styles'); |
113 | 121 | |
114 | 122 | selectByValue(formObj, 'classlist', inst.dom.getAttrib(elm, 'class'), true); |
115 | - selectByValue(formObj, 'targetlist', inst.dom.getAttrib(elm, 'target'), true); | |
123 | + selectByValue(formObj, 'targetlist', linkTarget, true); | |
116 | 124 | } else |
117 | 125 | addClassesToList('classlist', 'advlink_styles'); |
118 | 126 | } |
... | ... | @@ -370,6 +378,9 @@ function getAnchorListHTML(id, target) { |
370 | 378 | for (i=0, len=nodes.length; i<len; i++) { |
371 | 379 | if ((name = ed.dom.getAttrib(nodes[i], "name")) != "") |
372 | 380 | html += '<option value="#' + name + '">' + name + '</option>'; |
381 | + | |
382 | + if ((name = nodes[i].id) != "" && !nodes[i].href) | |
383 | + html += '<option value="#' + name + '">' + name + '</option>'; | |
373 | 384 | } |
374 | 385 | |
375 | 386 | if (html == "") |
... | ... | @@ -481,7 +492,7 @@ function getLinkListHTML(elm_id, target_form_element, onchange_func) { |
481 | 492 | var html = ""; |
482 | 493 | |
483 | 494 | html += '<select id="' + elm_id + '" name="' + elm_id + '"'; |
484 | - html += ' class="mceLinkList" onfoc2us="tinyMCE.addSelectAccessibility(event, this, window);" onchange="this.form.' + target_form_element + '.value='; | |
495 | + html += ' class="mceLinkList" onchange="this.form.' + target_form_element + '.value='; | |
485 | 496 | html += 'this.options[this.selectedIndex].value;'; |
486 | 497 | |
487 | 498 | if (typeof(onchange_func) != "undefined") |
... | ... | @@ -503,7 +514,7 @@ function getTargetListHTML(elm_id, target_form_element) { |
503 | 514 | var targets = tinyMCEPopup.getParam('theme_advanced_link_targets', '').split(';'); |
504 | 515 | var html = ''; |
505 | 516 | |
506 | - html += '<select id="' + elm_id + '" name="' + elm_id + '" onf2ocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="this.form.' + target_form_element + '.value='; | |
517 | + html += '<select id="' + elm_id + '" name="' + elm_id + '" onchange="this.form.' + target_form_element + '.value='; | |
507 | 518 | html += 'this.options[this.selectedIndex].value;">'; |
508 | 519 | html += '<option value="_self">' + tinyMCEPopup.getLang('advlink_dlg.target_same') + '</option>'; |
509 | 520 | html += '<option value="_blank">' + tinyMCEPopup.getLang('advlink_dlg.target_blank') + ' (_blank)</option>'; | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/advlink/langs/en_dlg.js
1 | -tinyMCE.addI18n('en.advlink_dlg',{ | |
2 | -title:"Insert/edit link", | |
3 | -url:"Link URL", | |
4 | -target:"Target", | |
5 | -titlefield:"Title", | |
6 | -is_email:"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?", | |
7 | -is_external:"The URL you entered seems to be an external link. Do you want to add the required http:// prefix?", | |
8 | -list:"Link list", | |
9 | -general_tab:"General", | |
10 | -popup_tab:"Popup", | |
11 | -events_tab:"Events", | |
12 | -advanced_tab:"Advanced", | |
13 | -general_props:"General properties", | |
14 | -popup_props:"Popup properties", | |
15 | -event_props:"Events", | |
16 | -advanced_props:"Advanced properties", | |
17 | -popup_opts:"Options", | |
18 | -anchor_names:"Anchors", | |
19 | -target_same:"Open in this window / frame", | |
20 | -target_parent:"Open in parent window / frame", | |
21 | -target_top:"Open in top frame (replaces all frames)", | |
22 | -target_blank:"Open in new window", | |
23 | -popup:"Javascript popup", | |
24 | -popup_url:"Popup URL", | |
25 | -popup_name:"Window name", | |
26 | -popup_return:"Insert 'return false'", | |
27 | -popup_scrollbars:"Show scrollbars", | |
28 | -popup_statusbar:"Show status bar", | |
29 | -popup_toolbar:"Show toolbars", | |
30 | -popup_menubar:"Show menu bar", | |
31 | -popup_location:"Show location bar", | |
32 | -popup_resizable:"Make window resizable", | |
33 | -popup_dependent:"Dependent (Mozilla/Firefox only)", | |
34 | -popup_size:"Size", | |
35 | -width:"Width", | |
36 | -height:"Height", | |
37 | -popup_position:"Position (X/Y)", | |
38 | -id:"Id", | |
39 | -style:"Style", | |
40 | -classes:"Classes", | |
41 | -target_name:"Target name", | |
42 | -langdir:"Language direction", | |
43 | -target_langcode:"Target language", | |
44 | -langcode:"Language code", | |
45 | -encoding:"Target character encoding", | |
46 | -mime:"Target MIME type", | |
47 | -rel:"Relationship page to target", | |
48 | -rev:"Relationship target to page", | |
49 | -tabindex:"Tabindex", | |
50 | -accesskey:"Accesskey", | |
51 | -ltr:"Left to right", | |
52 | -rtl:"Right to left", | |
53 | -link_list:"Link list" | |
54 | -}); | |
55 | 1 | \ No newline at end of file |
2 | +tinyMCE.addI18n('en.advlink_dlg',{"target_name":"Target Name",classes:"Classes",style:"Style",id:"ID","popup_position":"Position (X/Y)",langdir:"Language Direction","popup_size":"Size","popup_dependent":"Dependent (Mozilla/Firefox Only)","popup_resizable":"Make Window Resizable","popup_location":"Show Location Bar","popup_menubar":"Show Menu Bar","popup_toolbar":"Show Toolbars","popup_statusbar":"Show Status Bar","popup_scrollbars":"Show Scrollbars","popup_return":"Insert \'return false\'","popup_name":"Window Name","popup_url":"Popup URL",popup:"JavaScript Popup","target_blank":"Open in New Window","target_top":"Open in Top Frame (Replaces All Frames)","target_parent":"Open in Parent Window/Frame","target_same":"Open in This Window/Frame","anchor_names":"Anchors","popup_opts":"Options","advanced_props":"Advanced Properties","event_props":"Events","popup_props":"Popup Properties","general_props":"General Properties","advanced_tab":"Advanced","events_tab":"Events","popup_tab":"Popup","general_tab":"General",list:"Link List","is_external":"The URL you entered seems to be an external link. Do you want to add the required http:// prefix?","is_email":"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?",titlefield:"Title",target:"Target",url:"Link URL",title:"Insert/Edit Link","link_list":"Link List",rtl:"Right to Left",ltr:"Left to Right",accesskey:"AccessKey",tabindex:"TabIndex",rev:"Relationship Target to Page",rel:"Relationship Page to Target",mime:"Target MIME Type",encoding:"Target Character Encoding",langcode:"Language Code","target_langcode":"Target Language",width:"Width",height:"Height"}); | |
56 | 3 | \ No newline at end of file | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/advlist/editor_plugin.js
1 | -(function(){var a=tinymce.each;tinymce.create("tinymce.plugins.AdvListPlugin",{init:function(b,c){var d=this;d.editor=b;function e(g){var f=[];a(g.split(/,/),function(h){f.push({title:"advlist."+(h=="default"?"def":h.replace(/-/g,"_")),styles:{listStyleType:h=="default"?"":h}})});return f}d.numlist=b.getParam("advlist_number_styles")||e("default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman");d.bullist=b.getParam("advlist_bullet_styles")||e("default,circle,disc,square");if(tinymce.isIE&&/MSIE [2-7]/.test(navigator.userAgent)){d.isIE7=true}},createControl:function(d,b){var f=this,e,h;if(d=="numlist"||d=="bullist"){if(f[d][0].title=="advlist.def"){h=f[d][0]}function c(i,k){var j=true;a(k.styles,function(m,l){if(f.editor.dom.getStyle(i,l)!=m){j=false;return false}});return j}function g(){var k,i=f.editor,l=i.dom,j=i.selection;k=l.getParent(j.getNode(),"ol,ul");if(!k||k.nodeName==(d=="bullist"?"OL":"UL")||c(k,h)){i.execCommand(d=="bullist"?"InsertUnorderedList":"InsertOrderedList")}if(h){k=l.getParent(j.getNode(),"ol,ul");if(k){l.setStyles(k,h.styles);k.removeAttribute("data-mce-style")}}i.focus()}e=b.createSplitButton(d,{title:"advanced."+d+"_desc","class":"mce_"+d,onclick:function(){g()}});e.onRenderMenu.add(function(i,j){j.onShowMenu.add(function(){var m=f.editor.dom,l=m.getParent(f.editor.selection.getNode(),"ol,ul"),k;if(l||h){k=f[d];a(j.items,function(n){var o=true;n.setSelected(0);if(l&&!n.isDisabled()){a(k,function(p){if(p.id==n.id){if(!c(l,p)){o=false;return false}}});if(o){n.setSelected(1)}}});if(!l){j.items[h.id].setSelected(1)}}});j.add({id:f.editor.dom.uniqueId(),title:"advlist.types","class":"mceMenuItemTitle",titleItem:true}).setDisabled(1);a(f[d],function(k){if(f.isIE7&&k.styles.listStyleType=="lower-greek"){return}k.id=f.editor.dom.uniqueId();j.add({id:k.id,title:k.title,onclick:function(){h=k;g()}})})});return e}},getInfo:function(){return{longname:"Advanced lists",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlist",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("advlist",tinymce.plugins.AdvListPlugin)})(); | |
2 | 1 | \ No newline at end of file |
2 | +(function(){var a=tinymce.each;tinymce.create("tinymce.plugins.AdvListPlugin",{init:function(b,c){var d=this;d.editor=b;function e(g){var f=[];a(g.split(/,/),function(h){f.push({title:"advlist."+(h=="default"?"def":h.replace(/-/g,"_")),styles:{listStyleType:h=="default"?"":h}})});return f}d.numlist=b.getParam("advlist_number_styles")||e("default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman");d.bullist=b.getParam("advlist_bullet_styles")||e("default,circle,disc,square");if(tinymce.isIE&&/MSIE [2-7]/.test(navigator.userAgent)){d.isIE7=true}},createControl:function(d,b){var f=this,e,i,g=f.editor;if(d=="numlist"||d=="bullist"){if(f[d][0].title=="advlist.def"){i=f[d][0]}function c(j,l){var k=true;a(l.styles,function(n,m){if(g.dom.getStyle(j,m)!=n){k=false;return false}});return k}function h(){var k,l=g.dom,j=g.selection;k=l.getParent(j.getNode(),"ol,ul");if(!k||k.nodeName==(d=="bullist"?"OL":"UL")||c(k,i)){g.execCommand(d=="bullist"?"InsertUnorderedList":"InsertOrderedList")}if(i){k=l.getParent(j.getNode(),"ol,ul");if(k){l.setStyles(k,i.styles);k.removeAttribute("data-mce-style")}}g.focus()}e=b.createSplitButton(d,{title:"advanced."+d+"_desc","class":"mce_"+d,onclick:function(){h()}});e.onRenderMenu.add(function(j,k){k.onHideMenu.add(function(){if(f.bookmark){g.selection.moveToBookmark(f.bookmark);f.bookmark=0}});k.onShowMenu.add(function(){var n=g.dom,m=n.getParent(g.selection.getNode(),"ol,ul"),l;if(m||i){l=f[d];a(k.items,function(o){var p=true;o.setSelected(0);if(m&&!o.isDisabled()){a(l,function(q){if(q.id==o.id){if(!c(m,q)){p=false;return false}}});if(p){o.setSelected(1)}}});if(!m){k.items[i.id].setSelected(1)}}g.focus();if(tinymce.isIE){f.bookmark=g.selection.getBookmark(1)}});k.add({id:g.dom.uniqueId(),title:"advlist.types","class":"mceMenuItemTitle",titleItem:true}).setDisabled(1);a(f[d],function(l){if(f.isIE7&&l.styles.listStyleType=="lower-greek"){return}l.id=g.dom.uniqueId();k.add({id:l.id,title:l.title,onclick:function(){i=l;h()}})})});return e}},getInfo:function(){return{longname:"Advanced lists",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlist",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("advlist",tinymce.plugins.AdvListPlugin)})(); | |
3 | 3 | \ No newline at end of file | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/advlist/editor_plugin_src.js
... | ... | @@ -41,7 +41,7 @@ |
41 | 41 | }, |
42 | 42 | |
43 | 43 | createControl: function(name, cm) { |
44 | - var t = this, btn, format; | |
44 | + var t = this, btn, format, editor = t.editor; | |
45 | 45 | |
46 | 46 | if (name == 'numlist' || name == 'bullist') { |
47 | 47 | // Default to first item if it's a default item |
... | ... | @@ -53,7 +53,7 @@ |
53 | 53 | |
54 | 54 | each(format.styles, function(value, name) { |
55 | 55 | // Format doesn't match |
56 | - if (t.editor.dom.getStyle(node, name) != value) { | |
56 | + if (editor.dom.getStyle(node, name) != value) { | |
57 | 57 | state = false; |
58 | 58 | return false; |
59 | 59 | } |
... | ... | @@ -63,14 +63,14 @@ |
63 | 63 | }; |
64 | 64 | |
65 | 65 | function applyListFormat() { |
66 | - var list, ed = t.editor, dom = ed.dom, sel = ed.selection; | |
66 | + var list, dom = editor.dom, sel = editor.selection; | |
67 | 67 | |
68 | 68 | // Check for existing list element |
69 | 69 | list = dom.getParent(sel.getNode(), 'ol,ul'); |
70 | 70 | |
71 | 71 | // Switch/add list type if needed |
72 | 72 | if (!list || list.nodeName == (name == 'bullist' ? 'OL' : 'UL') || hasFormat(list, format)) |
73 | - ed.execCommand(name == 'bullist' ? 'InsertUnorderedList' : 'InsertOrderedList'); | |
73 | + editor.execCommand(name == 'bullist' ? 'InsertUnorderedList' : 'InsertOrderedList'); | |
74 | 74 | |
75 | 75 | // Append styles to new list element |
76 | 76 | if (format) { |
... | ... | @@ -80,7 +80,8 @@ |
80 | 80 | list.removeAttribute('data-mce-style'); |
81 | 81 | } |
82 | 82 | } |
83 | - ed.focus(); | |
83 | + | |
84 | + editor.focus(); | |
84 | 85 | }; |
85 | 86 | |
86 | 87 | btn = cm.createSplitButton(name, { |
... | ... | @@ -92,8 +93,15 @@ |
92 | 93 | }); |
93 | 94 | |
94 | 95 | btn.onRenderMenu.add(function(btn, menu) { |
96 | + menu.onHideMenu.add(function() { | |
97 | + if (t.bookmark) { | |
98 | + editor.selection.moveToBookmark(t.bookmark); | |
99 | + t.bookmark = 0; | |
100 | + } | |
101 | + }); | |
102 | + | |
95 | 103 | menu.onShowMenu.add(function() { |
96 | - var dom = t.editor.dom, list = dom.getParent(t.editor.selection.getNode(), 'ol,ul'), fmtList; | |
104 | + var dom = editor.dom, list = dom.getParent(editor.selection.getNode(), 'ol,ul'), fmtList; | |
97 | 105 | |
98 | 106 | if (list || format) { |
99 | 107 | fmtList = t[name]; |
... | ... | @@ -123,16 +131,23 @@ |
123 | 131 | if (!list) |
124 | 132 | menu.items[format.id].setSelected(1); |
125 | 133 | } |
134 | + | |
135 | + editor.focus(); | |
136 | + | |
137 | + // IE looses it's selection so store it away and restore it later | |
138 | + if (tinymce.isIE) { | |
139 | + t.bookmark = editor.selection.getBookmark(1); | |
140 | + } | |
126 | 141 | }); |
127 | 142 | |
128 | - menu.add({id : t.editor.dom.uniqueId(), title : 'advlist.types', 'class' : 'mceMenuItemTitle', titleItem: true}).setDisabled(1); | |
143 | + menu.add({id : editor.dom.uniqueId(), title : 'advlist.types', 'class' : 'mceMenuItemTitle', titleItem: true}).setDisabled(1); | |
129 | 144 | |
130 | 145 | each(t[name], function(item) { |
131 | 146 | // IE<8 doesn't support lower-greek, skip it |
132 | 147 | if (t.isIE7 && item.styles.listStyleType == 'lower-greek') |
133 | 148 | return; |
134 | 149 | |
135 | - item.id = t.editor.dom.uniqueId(); | |
150 | + item.id = editor.dom.uniqueId(); | |
136 | 151 | |
137 | 152 | menu.add({id : item.id, title : item.title, onclick : function() { |
138 | 153 | format = item; | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/autolink/editor_plugin.js
1 | -(function(){tinymce.create("tinymce.plugins.AutolinkPlugin",{init:function(a,b){var c=this;if(tinyMCE.isIE){return}a.onKeyDown.add(function(d,f){if(f.keyCode==13){return c.handleEnter(d)}if(f.shiftKey&&f.keyCode==48){return c.handleEclipse(d)}});a.onKeyUp.add(function(d,f){if(f.keyCode==32){return c.handleSpacebar(d)}})},handleEclipse:function(a){this.parseCurrentLine(a,-1,"(",true)},handleSpacebar:function(a){this.parseCurrentLine(a,0,"",true)},handleEnter:function(a){this.parseCurrentLine(a,-1,"",false)},parseCurrentLine:function(i,d,b,g){var a,f,c,n,k,m,h,e,j;a=i.selection.getRng().cloneRange();if(a.startOffset<5){e=a.endContainer.previousSibling;if(e==null){if(a.endContainer.firstChild==null||a.endContainer.firstChild.nextSibling==null){return}e=a.endContainer.firstChild.nextSibling}j=e.length;a.setStart(e,j);a.setEnd(e,j);if(a.endOffset<5){return}f=a.endOffset;n=e}else{n=a.endContainer;if(n.nodeType!=3&&n.firstChild){while(n.nodeType!=3&&n.firstChild){n=n.firstChild}a.setStart(n,0);a.setEnd(n,n.nodeValue.length)}if(a.endOffset==1){f=2}else{f=a.endOffset-1-d}}c=f;do{a.setStart(n,f-2);a.setEnd(n,f-1);f-=1}while(a.toString()!=" "&&a.toString()!=""&&a.toString().charCodeAt(0)!=160&&(f-2)>=0&&a.toString()!=b);if(a.toString()==b||a.toString().charCodeAt(0)==160){a.setStart(n,f);a.setEnd(n,c);f+=1}else{if(a.startOffset==0){a.setStart(n,0);a.setEnd(n,c)}else{a.setStart(n,f);a.setEnd(n,c)}}m=a.toString();h=m.match(/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.)(.+)$/i);if(h){if(h[1]=="www."){h[1]="http://www."}k=i.selection.getBookmark();i.selection.setRng(a);tinyMCE.execCommand("mceInsertLink",false,h[1]+h[2]);i.selection.moveToBookmark(k);if(tinyMCE.isWebKit){i.selection.collapse(false);var l=Math.min(n.length,c+1);a.setStart(n,l);a.setEnd(n,l);i.selection.setRng(a)}}},getInfo:function(){return{longname:"Autolink",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autolink",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("autolink",tinymce.plugins.AutolinkPlugin)})(); | |
2 | 1 | \ No newline at end of file |
2 | +(function(){tinymce.create("tinymce.plugins.AutolinkPlugin",{init:function(a,b){var c=this;a.onKeyDown.addToTop(function(d,f){if(f.keyCode==13){return c.handleEnter(d)}});if(tinyMCE.isIE){return}a.onKeyPress.add(function(d,f){if(f.which==41){return c.handleEclipse(d)}});a.onKeyUp.add(function(d,f){if(f.keyCode==32){return c.handleSpacebar(d)}})},handleEclipse:function(a){this.parseCurrentLine(a,-1,"(",true)},handleSpacebar:function(a){this.parseCurrentLine(a,0,"",true)},handleEnter:function(a){this.parseCurrentLine(a,-1,"",false)},parseCurrentLine:function(i,d,b,g){var a,f,c,n,k,m,h,e,j;a=i.selection.getRng(true).cloneRange();if(a.startOffset<5){e=a.endContainer.previousSibling;if(e==null){if(a.endContainer.firstChild==null||a.endContainer.firstChild.nextSibling==null){return}e=a.endContainer.firstChild.nextSibling}j=e.length;a.setStart(e,j);a.setEnd(e,j);if(a.endOffset<5){return}f=a.endOffset;n=e}else{n=a.endContainer;if(n.nodeType!=3&&n.firstChild){while(n.nodeType!=3&&n.firstChild){n=n.firstChild}if(n.nodeType==3){a.setStart(n,0);a.setEnd(n,n.nodeValue.length)}}if(a.endOffset==1){f=2}else{f=a.endOffset-1-d}}c=f;do{a.setStart(n,f>=2?f-2:0);a.setEnd(n,f>=1?f-1:0);f-=1}while(a.toString()!=" "&&a.toString()!=""&&a.toString().charCodeAt(0)!=160&&(f-2)>=0&&a.toString()!=b);if(a.toString()==b||a.toString().charCodeAt(0)==160){a.setStart(n,f);a.setEnd(n,c);f+=1}else{if(a.startOffset==0){a.setStart(n,0);a.setEnd(n,c)}else{a.setStart(n,f);a.setEnd(n,c)}}var m=a.toString();if(m.charAt(m.length-1)=="."){a.setEnd(n,c-1)}m=a.toString();h=m.match(/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+-]+@)(.+)$/i);if(h){if(h[1]=="www."){h[1]="http://www."}else{if(/@$/.test(h[1])&&!/^mailto:/.test(h[1])){h[1]="mailto:"+h[1]}}k=i.selection.getBookmark();i.selection.setRng(a);tinyMCE.execCommand("createlink",false,h[1]+h[2]);i.selection.moveToBookmark(k);i.nodeChanged();if(tinyMCE.isWebKit){i.selection.collapse(false);var l=Math.min(n.length,c+1);a.setStart(n,l);a.setEnd(n,l);i.selection.setRng(a)}}},getInfo:function(){return{longname:"Autolink",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autolink",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("autolink",tinymce.plugins.AutolinkPlugin)})(); | |
3 | 3 | \ No newline at end of file | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/autolink/editor_plugin_src.js
... | ... | @@ -22,17 +22,20 @@ |
22 | 22 | init : function(ed, url) { |
23 | 23 | var t = this; |
24 | 24 | |
25 | - // Internet Explorer has built-in automatic linking | |
26 | - if (tinyMCE.isIE) | |
27 | - return; | |
28 | - | |
29 | 25 | // Add a key down handler |
30 | - ed.onKeyDown.add(function(ed, e) { | |
26 | + ed.onKeyDown.addToTop(function(ed, e) { | |
31 | 27 | if (e.keyCode == 13) |
32 | 28 | return t.handleEnter(ed); |
33 | - if (e.shiftKey && e.keyCode == 48) | |
29 | + }); | |
30 | + | |
31 | + // Internet Explorer has built-in automatic linking for most cases | |
32 | + if (tinyMCE.isIE) | |
33 | + return; | |
34 | + | |
35 | + ed.onKeyPress.add(function(ed, e) { | |
36 | + if (e.which == 41) | |
34 | 37 | return t.handleEclipse(ed); |
35 | - }); | |
38 | + }); | |
36 | 39 | |
37 | 40 | // Add a key up handler |
38 | 41 | ed.onKeyUp.add(function(ed, e) { |
... | ... | @@ -58,7 +61,7 @@ |
58 | 61 | |
59 | 62 | // We need at least five characters to form a URL, |
60 | 63 | // hence, at minimum, five characters from the beginning of the line. |
61 | - r = ed.selection.getRng().cloneRange(); | |
64 | + r = ed.selection.getRng(true).cloneRange(); | |
62 | 65 | if (r.startOffset < 5) { |
63 | 66 | // During testing, the caret is placed inbetween two text nodes. |
64 | 67 | // The previous text node contains the URL. |
... | ... | @@ -86,8 +89,11 @@ |
86 | 89 | while (endContainer.nodeType != 3 && endContainer.firstChild) |
87 | 90 | endContainer = endContainer.firstChild; |
88 | 91 | |
89 | - r.setStart(endContainer, 0); | |
90 | - r.setEnd(endContainer, endContainer.nodeValue.length); | |
92 | + // Move range to text node | |
93 | + if (endContainer.nodeType == 3) { | |
94 | + r.setStart(endContainer, 0); | |
95 | + r.setEnd(endContainer, endContainer.nodeValue.length); | |
96 | + } | |
91 | 97 | } |
92 | 98 | |
93 | 99 | if (r.endOffset == 1) |
... | ... | @@ -101,8 +107,8 @@ |
101 | 107 | do |
102 | 108 | { |
103 | 109 | // Move the selection one character backwards. |
104 | - r.setStart(endContainer, end - 2); | |
105 | - r.setEnd(endContainer, end - 1); | |
110 | + r.setStart(endContainer, end >= 2 ? end - 2 : 0); | |
111 | + r.setEnd(endContainer, end >= 1 ? end - 1 : 0); | |
106 | 112 | end -= 1; |
107 | 113 | |
108 | 114 | // Loop until one of the following is found: a blank space, , delimeter, (end-2) >= 0 |
... | ... | @@ -121,19 +127,28 @@ |
121 | 127 | r.setEnd(endContainer, start); |
122 | 128 | } |
123 | 129 | |
130 | + // Exclude last . from word like "www.site.com." | |
131 | + var text = r.toString(); | |
132 | + if (text.charAt(text.length - 1) == '.') { | |
133 | + r.setEnd(endContainer, start - 1); | |
134 | + } | |
135 | + | |
124 | 136 | text = r.toString(); |
125 | - matches = text.match(/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.)(.+)$/i); | |
137 | + matches = text.match(/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+-]+@)(.+)$/i); | |
126 | 138 | |
127 | 139 | if (matches) { |
128 | 140 | if (matches[1] == 'www.') { |
129 | 141 | matches[1] = 'http://www.'; |
142 | + } else if (/@$/.test(matches[1]) && !/^mailto:/.test(matches[1])) { | |
143 | + matches[1] = 'mailto:' + matches[1]; | |
130 | 144 | } |
131 | 145 | |
132 | 146 | bookmark = ed.selection.getBookmark(); |
133 | 147 | |
134 | 148 | ed.selection.setRng(r); |
135 | - tinyMCE.execCommand('mceInsertLink',false, matches[1] + matches[2]); | |
149 | + tinyMCE.execCommand('createlink',false, matches[1] + matches[2]); | |
136 | 150 | ed.selection.moveToBookmark(bookmark); |
151 | + ed.nodeChanged(); | |
137 | 152 | |
138 | 153 | // TODO: Determine if this is still needed. |
139 | 154 | if (tinyMCE.isWebKit) { | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/autoresize/editor_plugin.js
1 | -(function(){tinymce.create("tinymce.plugins.AutoResizePlugin",{init:function(a,c){var d=this,e=0;if(a.getParam("fullscreen_is_enabled")){return}function b(){var i=a.getDoc(),f=i.body,k=i.documentElement,h=tinymce.DOM,j=d.autoresize_min_height,g;g=tinymce.isIE?f.scrollHeight:k.offsetHeight;g=d.bottom_margin+g;if(g>d.autoresize_min_height){j=g}if(j!==e){h.setStyle(h.get(a.id+"_ifr"),"height",j+"px");e=j}if(d.throbbing){a.setProgressState(false);a.setProgressState(true)}}d.editor=a;d.autoresize_min_height=a.getElement().offsetHeight;d.bottom_margin=parseInt(a.getParam("autoresize_bottom_margin",50));a.onChange.add(b);a.onSetContent.add(b);a.onPaste.add(b);a.onKeyUp.add(b);a.onPostRender.add(b);if(a.getParam("autoresize_on_init",true)){a.onInit.add(function(g,f){g.setProgressState(true);d.throbbing=true;g.getBody().style.overflowY="hidden"});a.onLoadContent.add(function(g,f){b();setTimeout(function(){b();g.setProgressState(false);d.throbbing=false},1250)})}a.addCommand("mceAutoResize",b)},getInfo:function(){return{longname:"Auto Resize",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autoresize",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("autoresize",tinymce.plugins.AutoResizePlugin)})(); | |
2 | 1 | \ No newline at end of file |
2 | +(function(){tinymce.create("tinymce.plugins.AutoResizePlugin",{init:function(a,c){var d=this,e=0;if(a.getParam("fullscreen_is_enabled")){return}function b(){var j,i=a.getDoc(),f=i.body,l=i.documentElement,h=tinymce.DOM,k=d.autoresize_min_height,g;g=tinymce.isIE?f.scrollHeight:(tinymce.isWebKit&&f.clientHeight==0?0:f.offsetHeight);if(g>d.autoresize_min_height){k=g}if(d.autoresize_max_height&&g>d.autoresize_max_height){k=d.autoresize_max_height;f.style.overflowY="auto";l.style.overflowY="auto"}else{f.style.overflowY="hidden";l.style.overflowY="hidden";f.scrollTop=0}if(k!==e){j=k-e;h.setStyle(h.get(a.id+"_ifr"),"height",k+"px");e=k;if(tinymce.isWebKit&&j<0){b()}}}d.editor=a;d.autoresize_min_height=parseInt(a.getParam("autoresize_min_height",a.getElement().offsetHeight));d.autoresize_max_height=parseInt(a.getParam("autoresize_max_height",0));a.onInit.add(function(f){f.dom.setStyle(f.getBody(),"paddingBottom",f.getParam("autoresize_bottom_margin",50)+"px")});a.onChange.add(b);a.onSetContent.add(b);a.onPaste.add(b);a.onKeyUp.add(b);a.onPostRender.add(b);if(a.getParam("autoresize_on_init",true)){a.onLoad.add(b);a.onLoadContent.add(b)}a.addCommand("mceAutoResize",b)},getInfo:function(){return{longname:"Auto Resize",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autoresize",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("autoresize",tinymce.plugins.AutoResizePlugin)})(); | |
3 | 3 | \ No newline at end of file | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/autoresize/editor_plugin_src.js
... | ... | @@ -11,7 +11,7 @@ |
11 | 11 | (function() { |
12 | 12 | /** |
13 | 13 | * Auto Resize |
14 | - * | |
14 | + * | |
15 | 15 | * This plugin automatically resizes the content area to fit its content height. |
16 | 16 | * It will retain a minimum height, which is the height of the content area when |
17 | 17 | * it's initialized. |
... | ... | @@ -35,38 +35,51 @@ |
35 | 35 | * This method gets executed each time the editor needs to resize. |
36 | 36 | */ |
37 | 37 | function resize() { |
38 | - var d = ed.getDoc(), b = d.body, de = d.documentElement, DOM = tinymce.DOM, resizeHeight = t.autoresize_min_height, myHeight; | |
38 | + var deltaSize, d = ed.getDoc(), body = d.body, de = d.documentElement, DOM = tinymce.DOM, resizeHeight = t.autoresize_min_height, myHeight; | |
39 | 39 | |
40 | 40 | // Get height differently depending on the browser used |
41 | - myHeight = tinymce.isIE ? b.scrollHeight : de.offsetHeight; | |
42 | - | |
43 | - // Bottom margin | |
44 | - myHeight = t.bottom_margin + myHeight; | |
41 | + myHeight = tinymce.isIE ? body.scrollHeight : (tinymce.isWebKit && body.clientHeight == 0 ? 0 : body.offsetHeight); | |
45 | 42 | |
46 | 43 | // Don't make it smaller than the minimum height |
47 | 44 | if (myHeight > t.autoresize_min_height) |
48 | 45 | resizeHeight = myHeight; |
49 | 46 | |
47 | + // If a maximum height has been defined don't exceed this height | |
48 | + if (t.autoresize_max_height && myHeight > t.autoresize_max_height) { | |
49 | + resizeHeight = t.autoresize_max_height; | |
50 | + body.style.overflowY = "auto"; | |
51 | + de.style.overflowY = "auto"; // Old IE | |
52 | + } else { | |
53 | + body.style.overflowY = "hidden"; | |
54 | + de.style.overflowY = "hidden"; // Old IE | |
55 | + body.scrollTop = 0; | |
56 | + } | |
57 | + | |
50 | 58 | // Resize content element |
51 | - if ( resizeHeight !== oldSize ) { | |
59 | + if (resizeHeight !== oldSize) { | |
60 | + deltaSize = resizeHeight - oldSize; | |
52 | 61 | DOM.setStyle(DOM.get(ed.id + '_ifr'), 'height', resizeHeight + 'px'); |
53 | 62 | oldSize = resizeHeight; |
54 | - } | |
55 | 63 | |
56 | - // if we're throbbing, we'll re-throb to match the new size | |
57 | - if (t.throbbing) { | |
58 | - ed.setProgressState(false); | |
59 | - ed.setProgressState(true); | |
64 | + // WebKit doesn't decrease the size of the body element until the iframe gets resized | |
65 | + // So we need to continue to resize the iframe down until the size gets fixed | |
66 | + if (tinymce.isWebKit && deltaSize < 0) | |
67 | + resize(); | |
60 | 68 | } |
61 | 69 | }; |
62 | 70 | |
63 | 71 | t.editor = ed; |
64 | 72 | |
65 | 73 | // Define minimum height |
66 | - t.autoresize_min_height = ed.getElement().offsetHeight; | |
74 | + t.autoresize_min_height = parseInt(ed.getParam('autoresize_min_height', ed.getElement().offsetHeight)); | |
75 | + | |
76 | + // Define maximum height | |
77 | + t.autoresize_max_height = parseInt(ed.getParam('autoresize_max_height', 0)); | |
67 | 78 | |
68 | - // Add margin at the bottom for better UX | |
69 | - t.bottom_margin = parseInt( ed.getParam('autoresize_bottom_margin', 50) ); | |
79 | + // Add padding at the bottom for better UX | |
80 | + ed.onInit.add(function(ed){ | |
81 | + ed.dom.setStyle(ed.getBody(), 'paddingBottom', ed.getParam('autoresize_bottom_margin', 50) + 'px'); | |
82 | + }); | |
70 | 83 | |
71 | 84 | // Add appropriate listeners for resizing content area |
72 | 85 | ed.onChange.add(resize); |
... | ... | @@ -76,30 +89,8 @@ |
76 | 89 | ed.onPostRender.add(resize); |
77 | 90 | |
78 | 91 | if (ed.getParam('autoresize_on_init', true)) { |
79 | - // Things to do when the editor is ready | |
80 | - ed.onInit.add(function(ed, l) { | |
81 | - // Show throbber until content area is resized properly | |
82 | - ed.setProgressState(true); | |
83 | - t.throbbing = true; | |
84 | - | |
85 | - // Hide scrollbars | |
86 | - ed.getBody().style.overflowY = "hidden"; | |
87 | - }); | |
88 | - | |
89 | - ed.onLoadContent.add(function(ed, l) { | |
90 | - resize(); | |
91 | - | |
92 | - // Because the content area resizes when its content CSS loads, | |
93 | - // and we can't easily add a listener to its onload event, | |
94 | - // we'll just trigger a resize after a short loading period | |
95 | - setTimeout(function() { | |
96 | - resize(); | |
97 | - | |
98 | - // Disable throbber | |
99 | - ed.setProgressState(false); | |
100 | - t.throbbing = false; | |
101 | - }, 1250); | |
102 | - }); | |
92 | + ed.onLoad.add(resize); | |
93 | + ed.onLoadContent.add(resize); | |
103 | 94 | } |
104 | 95 | |
105 | 96 | // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample'); | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/autosave/editor_plugin.js
1 | -(function(e){var c="autosave",g="restoredraft",b=true,f,d,a=e.util.Dispatcher;e.create("tinymce.plugins.AutoSave",{init:function(i,j){var h=this,l=i.settings;h.editor=i;function k(n){var m={s:1000,m:60000};n=/^(\d+)([ms]?)$/.exec(""+n);return(n[2]?m[n[2]]:1)*parseInt(n)}e.each({ask_before_unload:b,interval:"30s",retention:"20m",minlength:50},function(n,m){m=c+"_"+m;if(l[m]===f){l[m]=n}});l.autosave_interval=k(l.autosave_interval);l.autosave_retention=k(l.autosave_retention);i.addButton(g,{title:c+".restore_content",onclick:function(){if(i.getContent({draft:true}).replace(/\s| |<\/?p[^>]*>|<br[^>]*>/gi,"").length>0){i.windowManager.confirm(c+".warning_message",function(m){if(m){h.restoreDraft()}})}else{h.restoreDraft()}}});i.onNodeChange.add(function(){var m=i.controlManager;if(m.get(g)){m.setDisabled(g,!h.hasDraft())}});i.onInit.add(function(){if(i.controlManager.get(g)){h.setupStorage(i);setInterval(function(){h.storeDraft();i.nodeChanged()},l.autosave_interval)}});h.onStoreDraft=new a(h);h.onRestoreDraft=new a(h);h.onRemoveDraft=new a(h);if(!d){window.onbeforeunload=e.plugins.AutoSave._beforeUnloadHandler;d=b}},getInfo:function(){return{longname:"Auto save",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave",version:e.majorVersion+"."+e.minorVersion}},getExpDate:function(){return new Date(new Date().getTime()+this.editor.settings.autosave_retention).toUTCString()},setupStorage:function(i){var h=this,k=c+"_test",j="OK";h.key=c+i.id;e.each([function(){if(localStorage){localStorage.setItem(k,j);if(localStorage.getItem(k)===j){localStorage.removeItem(k);return localStorage}}},function(){if(sessionStorage){sessionStorage.setItem(k,j);if(sessionStorage.getItem(k)===j){sessionStorage.removeItem(k);return sessionStorage}}},function(){if(e.isIE){i.getElement().style.behavior="url('#default#userData')";return{autoExpires:b,setItem:function(l,n){var m=i.getElement();m.setAttribute(l,n);m.expires=h.getExpDate();try{m.save("TinyMCE")}catch(o){}},getItem:function(l){var m=i.getElement();try{m.load("TinyMCE");return m.getAttribute(l)}catch(n){return null}},removeItem:function(l){i.getElement().removeAttribute(l)}}}},],function(l){try{h.storage=l();if(h.storage){return false}}catch(m){}})},storeDraft:function(){var i=this,l=i.storage,j=i.editor,h,k;if(l){if(!l.getItem(i.key)&&!j.isDirty()){return}k=j.getContent({draft:true});if(k.length>j.settings.autosave_minlength){h=i.getExpDate();if(!i.storage.autoExpires){i.storage.setItem(i.key+"_expires",h)}i.storage.setItem(i.key,k);i.onStoreDraft.dispatch(i,{expires:h,content:k})}}},restoreDraft:function(){var h=this,i=h.storage;if(i){content=i.getItem(h.key);if(content){h.editor.setContent(content);h.onRestoreDraft.dispatch(h,{content:content})}}},hasDraft:function(){var h=this,k=h.storage,i,j;if(k){j=!!k.getItem(h.key);if(j){if(!h.storage.autoExpires){i=new Date(k.getItem(h.key+"_expires"));if(new Date().getTime()<i.getTime()){return b}h.removeDraft()}else{return b}}}return false},removeDraft:function(){var h=this,k=h.storage,i=h.key,j;if(k){j=k.getItem(i);k.removeItem(i);k.removeItem(i+"_expires");if(j){h.onRemoveDraft.dispatch(h,{content:j})}}},"static":{_beforeUnloadHandler:function(h){var i;e.each(tinyMCE.editors,function(j){if(j.plugins.autosave){j.plugins.autosave.storeDraft()}if(j.getParam("fullscreen_is_enabled")){return}if(!i&&j.isDirty()&&j.getParam("autosave_ask_before_unload")){i=j.getLang("autosave.unload_msg")}});return i}}});e.PluginManager.add("autosave",e.plugins.AutoSave)})(tinymce); | |
2 | 1 | \ No newline at end of file |
2 | +(function(e){var c="autosave",g="restoredraft",b=true,f,d,a=e.util.Dispatcher;e.create("tinymce.plugins.AutoSave",{init:function(i,j){var h=this,l=i.settings;h.editor=i;function k(n){var m={s:1000,m:60000};n=/^(\d+)([ms]?)$/.exec(""+n);return(n[2]?m[n[2]]:1)*parseInt(n)}e.each({ask_before_unload:b,interval:"30s",retention:"20m",minlength:50},function(n,m){m=c+"_"+m;if(l[m]===f){l[m]=n}});l.autosave_interval=k(l.autosave_interval);l.autosave_retention=k(l.autosave_retention);i.addButton(g,{title:c+".restore_content",onclick:function(){if(i.getContent({draft:true}).replace(/\s| |<\/?p[^>]*>|<br[^>]*>/gi,"").length>0){i.windowManager.confirm(c+".warning_message",function(m){if(m){h.restoreDraft()}})}else{h.restoreDraft()}}});i.onNodeChange.add(function(){var m=i.controlManager;if(m.get(g)){m.setDisabled(g,!h.hasDraft())}});i.onInit.add(function(){if(i.controlManager.get(g)){h.setupStorage(i);setInterval(function(){if(!i.removed){h.storeDraft();i.nodeChanged()}},l.autosave_interval)}});h.onStoreDraft=new a(h);h.onRestoreDraft=new a(h);h.onRemoveDraft=new a(h);if(!d){window.onbeforeunload=e.plugins.AutoSave._beforeUnloadHandler;d=b}},getInfo:function(){return{longname:"Auto save",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave",version:e.majorVersion+"."+e.minorVersion}},getExpDate:function(){return new Date(new Date().getTime()+this.editor.settings.autosave_retention).toUTCString()},setupStorage:function(i){var h=this,k=c+"_test",j="OK";h.key=c+i.id;e.each([function(){if(localStorage){localStorage.setItem(k,j);if(localStorage.getItem(k)===j){localStorage.removeItem(k);return localStorage}}},function(){if(sessionStorage){sessionStorage.setItem(k,j);if(sessionStorage.getItem(k)===j){sessionStorage.removeItem(k);return sessionStorage}}},function(){if(e.isIE){i.getElement().style.behavior="url('#default#userData')";return{autoExpires:b,setItem:function(l,n){var m=i.getElement();m.setAttribute(l,n);m.expires=h.getExpDate();try{m.save("TinyMCE")}catch(o){}},getItem:function(l){var m=i.getElement();try{m.load("TinyMCE");return m.getAttribute(l)}catch(n){return null}},removeItem:function(l){i.getElement().removeAttribute(l)}}}},],function(l){try{h.storage=l();if(h.storage){return false}}catch(m){}})},storeDraft:function(){var i=this,l=i.storage,j=i.editor,h,k;if(l){if(!l.getItem(i.key)&&!j.isDirty()){return}k=j.getContent({draft:true});if(k.length>j.settings.autosave_minlength){h=i.getExpDate();if(!i.storage.autoExpires){i.storage.setItem(i.key+"_expires",h)}i.storage.setItem(i.key,k);i.onStoreDraft.dispatch(i,{expires:h,content:k})}}},restoreDraft:function(){var h=this,j=h.storage,i;if(j){i=j.getItem(h.key);if(i){h.editor.setContent(i);h.onRestoreDraft.dispatch(h,{content:i})}}},hasDraft:function(){var h=this,k=h.storage,i,j;if(k){j=!!k.getItem(h.key);if(j){if(!h.storage.autoExpires){i=new Date(k.getItem(h.key+"_expires"));if(new Date().getTime()<i.getTime()){return b}h.removeDraft()}else{return b}}}return false},removeDraft:function(){var h=this,k=h.storage,i=h.key,j;if(k){j=k.getItem(i);k.removeItem(i);k.removeItem(i+"_expires");if(j){h.onRemoveDraft.dispatch(h,{content:j})}}},"static":{_beforeUnloadHandler:function(h){var i;e.each(tinyMCE.editors,function(j){if(j.plugins.autosave){j.plugins.autosave.storeDraft()}if(j.getParam("fullscreen_is_enabled")){return}if(!i&&j.isDirty()&&j.getParam("autosave_ask_before_unload")){i=j.getLang("autosave.unload_msg")}});return i}}});e.PluginManager.add("autosave",e.plugins.AutoSave)})(tinymce); | |
3 | 3 | \ No newline at end of file | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/autosave/editor_plugin_src.js
... | ... | @@ -136,8 +136,10 @@ |
136 | 136 | |
137 | 137 | // Auto save contents each interval time |
138 | 138 | setInterval(function() { |
139 | - self.storeDraft(); | |
140 | - ed.nodeChanged(); | |
139 | + if (!ed.removed) { | |
140 | + self.storeDraft(); | |
141 | + ed.nodeChanged(); | |
142 | + } | |
141 | 143 | }, settings.autosave_interval); |
142 | 144 | } |
143 | 145 | }); |
... | ... | @@ -335,7 +337,7 @@ |
335 | 337 | * @method restoreDraft |
336 | 338 | */ |
337 | 339 | restoreDraft : function() { |
338 | - var self = this, storage = self.storage; | |
340 | + var self = this, storage = self.storage, content; | |
339 | 341 | |
340 | 342 | if (storage) { |
341 | 343 | content = storage.getItem(self.key); | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/contextmenu/editor_plugin.js
1 | -(function(){var a=tinymce.dom.Event,c=tinymce.each,b=tinymce.DOM;tinymce.create("tinymce.plugins.ContextMenu",{init:function(e){var h=this,f,d,i;h.editor=e;d=e.settings.contextmenu_never_use_native;h.onContextMenu=new tinymce.util.Dispatcher(this);f=e.onContextMenu.add(function(j,k){if((i!==0?i:k.ctrlKey)&&!d){return}a.cancel(k);if(k.target.nodeName=="IMG"){j.selection.select(k.target)}h._getMenu(j).showMenu(k.clientX||k.pageX,k.clientY||k.pageX);a.add(j.getDoc(),"click",function(l){g(j,l)});j.nodeChanged()});e.onRemove.add(function(){if(h._menu){h._menu.removeAll()}});function g(j,k){i=0;if(k&&k.button==2){i=k.ctrlKey;return}if(h._menu){h._menu.removeAll();h._menu.destroy();a.remove(j.getDoc(),"click",g)}}e.onMouseDown.add(g);e.onKeyDown.add(g);e.onKeyDown.add(function(j,k){if(k.shiftKey&&!k.ctrlKey&&!k.altKey&&k.keyCode===121){a.cancel(k);f(j,k)}})},getInfo:function(){return{longname:"Contextmenu",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/contextmenu",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_getMenu:function(h){var l=this,f=l._menu,i=h.selection,e=i.isCollapsed(),d=i.getNode()||h.getBody(),g,k,j;if(f){f.removeAll();f.destroy()}k=b.getPos(h.getContentAreaContainer());j=b.getPos(h.getContainer());f=h.controlManager.createDropMenu("contextmenu",{offset_x:k.x+h.getParam("contextmenu_offset_x",0),offset_y:k.y+h.getParam("contextmenu_offset_y",0),constrain:1,keyboard_focus:true});l._menu=f;f.add({title:"advanced.cut_desc",icon:"cut",cmd:"Cut"}).setDisabled(e);f.add({title:"advanced.copy_desc",icon:"copy",cmd:"Copy"}).setDisabled(e);f.add({title:"advanced.paste_desc",icon:"paste",cmd:"Paste"});if((d.nodeName=="A"&&!h.dom.getAttrib(d,"name"))||!e){f.addSeparator();f.add({title:"advanced.link_desc",icon:"link",cmd:h.plugins.advlink?"mceAdvLink":"mceLink",ui:true});f.add({title:"advanced.unlink_desc",icon:"unlink",cmd:"UnLink"})}f.addSeparator();f.add({title:"advanced.image_desc",icon:"image",cmd:h.plugins.advimage?"mceAdvImage":"mceImage",ui:true});f.addSeparator();g=f.addMenu({title:"contextmenu.align"});g.add({title:"contextmenu.left",icon:"justifyleft",cmd:"JustifyLeft"});g.add({title:"contextmenu.center",icon:"justifycenter",cmd:"JustifyCenter"});g.add({title:"contextmenu.right",icon:"justifyright",cmd:"JustifyRight"});g.add({title:"contextmenu.full",icon:"justifyfull",cmd:"JustifyFull"});l.onContextMenu.dispatch(l,f,d,e);return f}});tinymce.PluginManager.add("contextmenu",tinymce.plugins.ContextMenu)})(); | |
2 | 1 | \ No newline at end of file |
2 | +(function(){var a=tinymce.dom.Event,c=tinymce.each,b=tinymce.DOM;tinymce.create("tinymce.plugins.ContextMenu",{init:function(f){var i=this,g,d,j,e;i.editor=f;d=f.settings.contextmenu_never_use_native;i.onContextMenu=new tinymce.util.Dispatcher(this);e=function(k){h(f,k)};g=f.onContextMenu.add(function(k,l){if((j!==0?j:l.ctrlKey)&&!d){return}a.cancel(l);if(l.target.nodeName=="IMG"){k.selection.select(l.target)}i._getMenu(k).showMenu(l.clientX||l.pageX,l.clientY||l.pageY);a.add(k.getDoc(),"click",e);k.nodeChanged()});f.onRemove.add(function(){if(i._menu){i._menu.removeAll()}});function h(k,l){j=0;if(l&&l.button==2){j=l.ctrlKey;return}if(i._menu){i._menu.removeAll();i._menu.destroy();a.remove(k.getDoc(),"click",e);i._menu=null}}f.onMouseDown.add(h);f.onKeyDown.add(h);f.onKeyDown.add(function(k,l){if(l.shiftKey&&!l.ctrlKey&&!l.altKey&&l.keyCode===121){a.cancel(l);g(k,l)}})},getInfo:function(){return{longname:"Contextmenu",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/contextmenu",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_getMenu:function(e){var g=this,d=g._menu,j=e.selection,f=j.isCollapsed(),h=j.getNode()||e.getBody(),i,k;if(d){d.removeAll();d.destroy()}k=b.getPos(e.getContentAreaContainer());d=e.controlManager.createDropMenu("contextmenu",{offset_x:k.x+e.getParam("contextmenu_offset_x",0),offset_y:k.y+e.getParam("contextmenu_offset_y",0),constrain:1,keyboard_focus:true});g._menu=d;d.add({title:"advanced.cut_desc",icon:"cut",cmd:"Cut"}).setDisabled(f);d.add({title:"advanced.copy_desc",icon:"copy",cmd:"Copy"}).setDisabled(f);d.add({title:"advanced.paste_desc",icon:"paste",cmd:"Paste"});if((h.nodeName=="A"&&!e.dom.getAttrib(h,"name"))||!f){d.addSeparator();d.add({title:"advanced.link_desc",icon:"link",cmd:e.plugins.advlink?"mceAdvLink":"mceLink",ui:true});d.add({title:"advanced.unlink_desc",icon:"unlink",cmd:"UnLink"})}d.addSeparator();d.add({title:"advanced.image_desc",icon:"image",cmd:e.plugins.advimage?"mceAdvImage":"mceImage",ui:true});d.addSeparator();i=d.addMenu({title:"contextmenu.align"});i.add({title:"contextmenu.left",icon:"justifyleft",cmd:"JustifyLeft"});i.add({title:"contextmenu.center",icon:"justifycenter",cmd:"JustifyCenter"});i.add({title:"contextmenu.right",icon:"justifyright",cmd:"JustifyRight"});i.add({title:"contextmenu.full",icon:"justifyfull",cmd:"JustifyFull"});g.onContextMenu.dispatch(g,d,h,f);return d}});tinymce.PluginManager.add("contextmenu",tinymce.plugins.ContextMenu)})(); | |
3 | 3 | \ No newline at end of file | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/contextmenu/editor_plugin_src.js
... | ... | @@ -27,7 +27,7 @@ |
27 | 27 | * @param {string} url Absolute URL to where the plugin is located. |
28 | 28 | */ |
29 | 29 | init : function(ed) { |
30 | - var t = this, showMenu, contextmenuNeverUseNative, realCtrlKey; | |
30 | + var t = this, showMenu, contextmenuNeverUseNative, realCtrlKey, hideMenu; | |
31 | 31 | |
32 | 32 | t.editor = ed; |
33 | 33 | |
... | ... | @@ -42,6 +42,10 @@ |
42 | 42 | */ |
43 | 43 | t.onContextMenu = new tinymce.util.Dispatcher(this); |
44 | 44 | |
45 | + hideMenu = function(e) { | |
46 | + hide(ed, e); | |
47 | + }; | |
48 | + | |
45 | 49 | showMenu = ed.onContextMenu.add(function(ed, e) { |
46 | 50 | // Block TinyMCE menu on ctrlKey and work around Safari issue |
47 | 51 | if ((realCtrlKey !== 0 ? realCtrlKey : e.ctrlKey) && !contextmenuNeverUseNative) |
... | ... | @@ -53,14 +57,12 @@ |
53 | 57 | if (e.target.nodeName == 'IMG') |
54 | 58 | ed.selection.select(e.target); |
55 | 59 | |
56 | - t._getMenu(ed).showMenu(e.clientX || e.pageX, e.clientY || e.pageX); | |
57 | - Event.add(ed.getDoc(), 'click', function(e) { | |
58 | - hide(ed, e); | |
59 | - }); | |
60 | + t._getMenu(ed).showMenu(e.clientX || e.pageX, e.clientY || e.pageY); | |
61 | + Event.add(ed.getDoc(), 'click', hideMenu); | |
60 | 62 | |
61 | 63 | ed.nodeChanged(); |
62 | 64 | }); |
63 | - | |
65 | + | |
64 | 66 | ed.onRemove.add(function() { |
65 | 67 | if (t._menu) |
66 | 68 | t._menu.removeAll(); |
... | ... | @@ -78,8 +80,9 @@ |
78 | 80 | |
79 | 81 | if (t._menu) { |
80 | 82 | t._menu.removeAll(); |
81 | - t._menu.destroy(); | |
82 | - Event.remove(ed.getDoc(), 'click', hide); | |
83 | + t._menu.destroy(); | |
84 | + Event.remove(ed.getDoc(), 'click', hideMenu); | |
85 | + t._menu = null; | |
83 | 86 | } |
84 | 87 | }; |
85 | 88 | |
... | ... | @@ -111,19 +114,18 @@ |
111 | 114 | }, |
112 | 115 | |
113 | 116 | _getMenu : function(ed) { |
114 | - var t = this, m = t._menu, se = ed.selection, col = se.isCollapsed(), el = se.getNode() || ed.getBody(), am, p1, p2; | |
117 | + var t = this, m = t._menu, se = ed.selection, col = se.isCollapsed(), el = se.getNode() || ed.getBody(), am, p; | |
115 | 118 | |
116 | 119 | if (m) { |
117 | 120 | m.removeAll(); |
118 | 121 | m.destroy(); |
119 | 122 | } |
120 | 123 | |
121 | - p1 = DOM.getPos(ed.getContentAreaContainer()); | |
122 | - p2 = DOM.getPos(ed.getContainer()); | |
124 | + p = DOM.getPos(ed.getContentAreaContainer()); | |
123 | 125 | |
124 | 126 | m = ed.controlManager.createDropMenu('contextmenu', { |
125 | - offset_x : p1.x + ed.getParam('contextmenu_offset_x', 0), | |
126 | - offset_y : p1.y + ed.getParam('contextmenu_offset_y', 0), | |
127 | + offset_x : p.x + ed.getParam('contextmenu_offset_x', 0), | |
128 | + offset_y : p.y + ed.getParam('contextmenu_offset_y', 0), | |
127 | 129 | constrain : 1, |
128 | 130 | keyboard_focus: true |
129 | 131 | }); | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/directionality/editor_plugin.js
1 | -(function(){tinymce.create("tinymce.plugins.Directionality",{init:function(a,b){var c=this;c.editor=a;a.addCommand("mceDirectionLTR",function(){var d=a.dom.getParent(a.selection.getNode(),a.dom.isBlock);if(d){if(a.dom.getAttrib(d,"dir")!="ltr"){a.dom.setAttrib(d,"dir","ltr")}else{a.dom.setAttrib(d,"dir","")}}a.nodeChanged()});a.addCommand("mceDirectionRTL",function(){var d=a.dom.getParent(a.selection.getNode(),a.dom.isBlock);if(d){if(a.dom.getAttrib(d,"dir")!="rtl"){a.dom.setAttrib(d,"dir","rtl")}else{a.dom.setAttrib(d,"dir","")}}a.nodeChanged()});a.addButton("ltr",{title:"directionality.ltr_desc",cmd:"mceDirectionLTR"});a.addButton("rtl",{title:"directionality.rtl_desc",cmd:"mceDirectionRTL"});a.onNodeChange.add(c._nodeChange,c)},getInfo:function(){return{longname:"Directionality",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_nodeChange:function(b,a,e){var d=b.dom,c;e=d.getParent(e,d.isBlock);if(!e){a.setDisabled("ltr",1);a.setDisabled("rtl",1);return}c=d.getAttrib(e,"dir");a.setActive("ltr",c=="ltr");a.setDisabled("ltr",0);a.setActive("rtl",c=="rtl");a.setDisabled("rtl",0)}});tinymce.PluginManager.add("directionality",tinymce.plugins.Directionality)})(); | |
2 | 1 | \ No newline at end of file |
2 | +(function(){tinymce.create("tinymce.plugins.Directionality",{init:function(b,c){var d=this;d.editor=b;function a(e){var h=b.dom,g,f=b.selection.getSelectedBlocks();if(f.length){g=h.getAttrib(f[0],"dir");tinymce.each(f,function(i){if(!h.getParent(i.parentNode,"*[dir='"+e+"']",h.getRoot())){if(g!=e){h.setAttrib(i,"dir",e)}else{h.setAttrib(i,"dir",null)}}});b.nodeChanged()}}b.addCommand("mceDirectionLTR",function(){a("ltr")});b.addCommand("mceDirectionRTL",function(){a("rtl")});b.addButton("ltr",{title:"directionality.ltr_desc",cmd:"mceDirectionLTR"});b.addButton("rtl",{title:"directionality.rtl_desc",cmd:"mceDirectionRTL"});b.onNodeChange.add(d._nodeChange,d)},getInfo:function(){return{longname:"Directionality",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_nodeChange:function(b,a,e){var d=b.dom,c;e=d.getParent(e,d.isBlock);if(!e){a.setDisabled("ltr",1);a.setDisabled("rtl",1);return}c=d.getAttrib(e,"dir");a.setActive("ltr",c=="ltr");a.setDisabled("ltr",0);a.setActive("rtl",c=="rtl");a.setDisabled("rtl",0)}});tinymce.PluginManager.add("directionality",tinymce.plugins.Directionality)})(); | |
3 | 3 | \ No newline at end of file | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/directionality/editor_plugin_src.js
... | ... | @@ -15,30 +15,33 @@ |
15 | 15 | |
16 | 16 | t.editor = ed; |
17 | 17 | |
18 | - ed.addCommand('mceDirectionLTR', function() { | |
19 | - var e = ed.dom.getParent(ed.selection.getNode(), ed.dom.isBlock); | |
20 | - | |
21 | - if (e) { | |
22 | - if (ed.dom.getAttrib(e, "dir") != "ltr") | |
23 | - ed.dom.setAttrib(e, "dir", "ltr"); | |
24 | - else | |
25 | - ed.dom.setAttrib(e, "dir", ""); | |
18 | + function setDir(dir) { | |
19 | + var dom = ed.dom, curDir, blocks = ed.selection.getSelectedBlocks(); | |
20 | + | |
21 | + if (blocks.length) { | |
22 | + curDir = dom.getAttrib(blocks[0], "dir"); | |
23 | + | |
24 | + tinymce.each(blocks, function(block) { | |
25 | + // Add dir to block if the parent block doesn't already have that dir | |
26 | + if (!dom.getParent(block.parentNode, "*[dir='" + dir + "']", dom.getRoot())) { | |
27 | + if (curDir != dir) { | |
28 | + dom.setAttrib(block, "dir", dir); | |
29 | + } else { | |
30 | + dom.setAttrib(block, "dir", null); | |
31 | + } | |
32 | + } | |
33 | + }); | |
34 | + | |
35 | + ed.nodeChanged(); | |
26 | 36 | } |
37 | + } | |
27 | 38 | |
28 | - ed.nodeChanged(); | |
39 | + ed.addCommand('mceDirectionLTR', function() { | |
40 | + setDir("ltr"); | |
29 | 41 | }); |
30 | 42 | |
31 | 43 | ed.addCommand('mceDirectionRTL', function() { |
32 | - var e = ed.dom.getParent(ed.selection.getNode(), ed.dom.isBlock); | |
33 | - | |
34 | - if (e) { | |
35 | - if (ed.dom.getAttrib(e, "dir") != "rtl") | |
36 | - ed.dom.setAttrib(e, "dir", "rtl"); | |
37 | - else | |
38 | - ed.dom.setAttrib(e, "dir", ""); | |
39 | - } | |
40 | - | |
41 | - ed.nodeChanged(); | |
44 | + setDir("rtl"); | |
42 | 45 | }); |
43 | 46 | |
44 | 47 | ed.addButton('ltr', {title : 'directionality.ltr_desc', cmd : 'mceDirectionLTR'}); | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/emotions/emotions.htm
... | ... | @@ -10,32 +10,33 @@ |
10 | 10 | <div align="center"> |
11 | 11 | <div class="title">{#emotions_dlg.title}:<br /><br /></div> |
12 | 12 | |
13 | - <table role="presentation" border="0" cellspacing="0" cellpadding="4"> | |
13 | + <table id="emoticon_table" role="presentation" border="0" cellspacing="0" cellpadding="4"> | |
14 | 14 | <tr> |
15 | - <td><a href="javascript:EmotionsDialog.insert('smiley-cool.gif','emotions_dlg.cool');"><img src="img/smiley-cool.gif" width="18" height="18" border="0" alt="{#emotions_dlg.cool}" title="{#emotions_dlg.cool}" /></a></td> | |
16 | - <td><a href="javascript:EmotionsDialog.insert('smiley-cry.gif','emotions_dlg.cry');"><img src="img/smiley-cry.gif" width="18" height="18" border="0" alt="{#emotions_dlg.cry}" title="{#emotions_dlg.cry}" /></a></td> | |
17 | - <td><a href="javascript:EmotionsDialog.insert('smiley-embarassed.gif','emotions_dlg.embarassed');"><img src="img/smiley-embarassed.gif" width="18" height="18" border="0" alt="{#emotions_dlg.embarassed}" title="{#emotions_dlg.embarassed}" /></a></td> | |
18 | - <td><a href="javascript:EmotionsDialog.insert('smiley-foot-in-mouth.gif','emotions_dlg.foot_in_mouth');"><img src="img/smiley-foot-in-mouth.gif" width="18" height="18" border="0" alt="{#emotions_dlg.foot_in_mouth}" title="{#emotions_dlg.foot_in_mouth}" /></a></td> | |
15 | + <td><a class="emoticon_link" role="button" title="{#emotions_dlg.cool}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-cool.gif','emotions_dlg.cool');"><img src="img/smiley-cool.gif" width="18" height="18" border="0" alt="{#emotions_dlg.cool}. {#emotions_dlg.usage}" /></a></td> | |
16 | + <td><a class="emoticon_link" role="button" title="{#emotions_dlg.cry}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-cry.gif','emotions_dlg.cry');"><img src="img/smiley-cry.gif" width="18" height="18" border="0" alt="{#emotions_dlg.cry}. {#emotions_dlg.usage}" /></a></td> | |
17 | + <td><a class="emoticon_link" role="button" title="{#emotions_dlg.embarassed}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-embarassed.gif','emotions_dlg.embarassed');"><img src="img/smiley-embarassed.gif" width="18" height="18" border="0" alt="{#emotions_dlg.embarassed}. {#emotions_dlg.usage}" /></a></td> | |
18 | + <td><a class="emoticon_link" role="button" title="{#emotions_dlg.foot_in_mouth}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-foot-in-mouth.gif','emotions_dlg.foot_in_mouth');"><img src="img/smiley-foot-in-mouth.gif" width="18" height="18" border="0" alt="{#emotions_dlg.foot_in_mouth}. {#emotions_dlg.usage}" /></a></td> | |
19 | 19 | </tr> |
20 | 20 | <tr> |
21 | - <td><a href="javascript:EmotionsDialog.insert('smiley-frown.gif','emotions_dlg.frown');"><img src="img/smiley-frown.gif" width="18" height="18" border="0" alt="{#emotions_dlg.frown}" title="{#emotions_dlg.frown}" /></a></td> | |
22 | - <td><a href="javascript:EmotionsDialog.insert('smiley-innocent.gif','emotions_dlg.innocent');"><img src="img/smiley-innocent.gif" width="18" height="18" border="0" alt="{#emotions_dlg.innocent}" title="{#emotions_dlg.innocent}" /></a></td> | |
23 | - <td><a href="javascript:EmotionsDialog.insert('smiley-kiss.gif','emotions_dlg.kiss');"><img src="img/smiley-kiss.gif" width="18" height="18" border="0" alt="{#emotions_dlg.kiss}" title="{#emotions_dlg.kiss}" /></a></td> | |
24 | - <td><a href="javascript:EmotionsDialog.insert('smiley-laughing.gif','emotions_dlg.laughing');"><img src="img/smiley-laughing.gif" width="18" height="18" border="0" alt="{#emotions_dlg.laughing}" title="{#emotions_dlg.laughing}" /></a></td> | |
21 | + <td><a class="emoticon_link" role="button" title="{#emotions_dlg.frown}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-frown.gif','emotions_dlg.frown');"><img src="img/smiley-frown.gif" width="18" height="18" border="0" alt="{#emotions_dlg.frown}. {#emotions_dlg.usage}" /></a></td> | |
22 | + <td><a class="emoticon_link" role="button" title="{#emotions_dlg.innocent}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-innocent.gif','emotions_dlg.innocent');"><img src="img/smiley-innocent.gif" width="18" height="18" border="0" alt="{#emotions_dlg.innocent}. {#emotions_dlg.usage}" /></a></td> | |
23 | + <td><a class="emoticon_link" role="button" title="{#emotions_dlg.kiss}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-kiss.gif','emotions_dlg.kiss');"><img src="img/smiley-kiss.gif" width="18" height="18" border="0" alt="{#emotions_dlg.kiss}. {#emotions_dlg.usage}" /></a></td> | |
24 | + <td><a class="emoticon_link" role="button" title="{#emotions_dlg.laughing}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-laughing.gif','emotions_dlg.laughing');"><img src="img/smiley-laughing.gif" width="18" height="18" border="0" alt="{#emotions_dlg.laughing}. {#emotions_dlg.usage}" /></a></td> | |
25 | 25 | </tr> |
26 | 26 | <tr> |
27 | - <td><a href="javascript:EmotionsDialog.insert('smiley-money-mouth.gif','emotions_dlg.money_mouth');"><img src="img/smiley-money-mouth.gif" width="18" height="18" border="0" alt="{#emotions_dlg.money_mouth}" title="{#emotions_dlg.money_mouth}" /></a></td> | |
28 | - <td><a href="javascript:EmotionsDialog.insert('smiley-sealed.gif','emotions_dlg.sealed');"><img src="img/smiley-sealed.gif" width="18" height="18" border="0" alt="{#emotions_dlg.sealed}" title="{#emotions_dlg.sealed}" /></a></td> | |
29 | - <td><a href="javascript:EmotionsDialog.insert('smiley-smile.gif','emotions_dlg.smile');"><img src="img/smiley-smile.gif" width="18" height="18" border="0" alt="{#emotions_dlg.smile}" title="{#emotions_dlg.smile}" /></a></td> | |
30 | - <td><a href="javascript:EmotionsDialog.insert('smiley-surprised.gif','emotions_dlg.surprised');"><img src="img/smiley-surprised.gif" width="18" height="18" border="0" alt="{#emotions_dlg.surprised}" title="{#emotions_dlg.surprised}" /></a></td> | |
27 | + <td><a class="emoticon_link" role="button" title="{#emotions_dlg.money_mouth}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-money-mouth.gif','emotions_dlg.money_mouth');"><img src="img/smiley-money-mouth.gif" width="18" height="18" border="0" alt="{#emotions_dlg.money_mouth}. {#emotions_dlg.usage}"/></a></td> | |
28 | + <td><a class="emoticon_link" role="button" title="{#emotions_dlg.sealed}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-sealed.gif','emotions_dlg.sealed');"><img src="img/smiley-sealed.gif" width="18" height="18" border="0" alt="{#emotions_dlg.sealed}. {#emotions_dlg.usage}" /></a></td> | |
29 | + <td><a class="emoticon_link" role="button" title="{#emotions_dlg.smile}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-smile.gif','emotions_dlg.smile');"><img src="img/smiley-smile.gif" width="18" height="18" border="0" alt="{#emotions_dlg.smile}. {#emotions_dlg.usage}" /></a></td> | |
30 | + <td><a class="emoticon_link" role="button" title="{#emotions_dlg.surprised}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-surprised.gif','emotions_dlg.surprised');"><img src="img/smiley-surprised.gif" width="18" height="18" border="0" alt="{#emotions_dlg.surprised}. {#emotions_dlg.usage}" /></a></td> | |
31 | 31 | </tr> |
32 | 32 | <tr> |
33 | - <td><a href="javascript:EmotionsDialog.insert('smiley-tongue-out.gif','emotions_dlg.tongue_out');"><img src="img/smiley-tongue-out.gif" width="18" height="18" border="0" alt="{#emotions_dlg.tongue-out}" title="{#emotions_dlg.tongue_out}" /></a></td> | |
34 | - <td><a href="javascript:EmotionsDialog.insert('smiley-undecided.gif','emotions_dlg.undecided');"><img src="img/smiley-undecided.gif" width="18" height="18" border="0" alt="{#emotions_dlg.undecided}" title="{#emotions_dlg.undecided}" /></a></td> | |
35 | - <td><a href="javascript:EmotionsDialog.insert('smiley-wink.gif','emotions_dlg.wink');"><img src="img/smiley-wink.gif" width="18" height="18" border="0" alt="{#emotions_dlg.wink}" title="{#emotions_dlg.wink}" /></a></td> | |
36 | - <td><a href="javascript:EmotionsDialog.insert('smiley-yell.gif','emotions_dlg.yell');"><img src="img/smiley-yell.gif" width="18" height="18" border="0" alt="{#emotions_dlg.yell}" title="{#emotions_dlg.yell}" /></a></td> | |
33 | + <td><a class="emoticon_link" role="button" title="{#emotions_dlg.tongue_out}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-tongue-out.gif','emotions_dlg.tongue_out');"><img src="img/smiley-tongue-out.gif" width="18" height="18" border="0" alt="{#emotions_dlg.tongue-out}. {#emotions_dlg.usage}" /></a></td> | |
34 | + <td><a class="emoticon_link" role="button" title="{#emotions_dlg.undecided}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-undecided.gif','emotions_dlg.undecided');"><img src="img/smiley-undecided.gif" width="18" height="18" border="0" alt="{#emotions_dlg.undecided}. {#emotions_dlg.usage}" /></a></td> | |
35 | + <td><a class="emoticon_link" role="button" title="{#emotions_dlg.wink}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-wink.gif','emotions_dlg.wink');"><img src="img/smiley-wink.gif" width="18" height="18" border="0" alt="{#emotions_dlg.wink}. {#emotions_dlg.usage}" /></a></td> | |
36 | + <td><a class="emoticon_link" role="button" title="{#emotions_dlg.yell}. {#emotions_dlg.usage}" href="javascript:EmotionsDialog.insert('smiley-yell.gif','emotions_dlg.yell');"><img src="img/smiley-yell.gif" width="18" height="18" border="0" alt="{#emotions_dlg.yell}. {#emotions_dlg.usage}" /></a></td> | |
37 | 37 | </tr> |
38 | 38 | </table> |
39 | + <div>{#emotions_dlg.usage}</div> | |
39 | 40 | </div> |
40 | 41 | </body> |
41 | 42 | </html> | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/emotions/img/smiley-foot-in-mouth.gif
public/javascripts/tinymce/jscripts/tiny_mce/plugins/emotions/img/smiley-laughing.gif
public/javascripts/tinymce/jscripts/tiny_mce/plugins/emotions/img/smiley-sealed.gif
public/javascripts/tinymce/jscripts/tiny_mce/plugins/emotions/img/smiley-smile.gif
public/javascripts/tinymce/jscripts/tiny_mce/plugins/emotions/img/smiley-surprised.gif
public/javascripts/tinymce/jscripts/tiny_mce/plugins/emotions/img/smiley-wink.gif
public/javascripts/tinymce/jscripts/tiny_mce/plugins/emotions/js/emotions.js
1 | 1 | tinyMCEPopup.requireLangPack(); |
2 | 2 | |
3 | 3 | var EmotionsDialog = { |
4 | + addKeyboardNavigation: function(){ | |
5 | + var tableElm, cells, settings; | |
6 | + | |
7 | + cells = tinyMCEPopup.dom.select("a.emoticon_link", "emoticon_table"); | |
8 | + | |
9 | + settings ={ | |
10 | + root: "emoticon_table", | |
11 | + items: cells | |
12 | + }; | |
13 | + cells[0].tabindex=0; | |
14 | + tinyMCEPopup.dom.addClass(cells[0], "mceFocus"); | |
15 | + if (tinymce.isGecko) { | |
16 | + cells[0].focus(); | |
17 | + } else { | |
18 | + setTimeout(function(){ | |
19 | + cells[0].focus(); | |
20 | + }, 100); | |
21 | + } | |
22 | + tinyMCEPopup.editor.windowManager.createInstance('tinymce.ui.KeyboardNavigation', settings, tinyMCEPopup.dom); | |
23 | + }, | |
4 | 24 | init : function(ed) { |
5 | 25 | tinyMCEPopup.resizeToInnerSize(); |
26 | + this.addKeyboardNavigation(); | |
6 | 27 | }, |
7 | 28 | |
8 | 29 | insert : function(file, title) { | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/emotions/langs/en_dlg.js
1 | -tinyMCE.addI18n('en.emotions_dlg',{ | |
2 | -title:"Insert emotion", | |
3 | -desc:"Emotions", | |
4 | -cool:"Cool", | |
5 | -cry:"Cry", | |
6 | -embarassed:"Embarassed", | |
7 | -foot_in_mouth:"Foot in mouth", | |
8 | -frown:"Frown", | |
9 | -innocent:"Innocent", | |
10 | -kiss:"Kiss", | |
11 | -laughing:"Laughing", | |
12 | -money_mouth:"Money mouth", | |
13 | -sealed:"Sealed", | |
14 | -smile:"Smile", | |
15 | -surprised:"Surprised", | |
16 | -tongue_out:"Tongue out", | |
17 | -undecided:"Undecided", | |
18 | -wink:"Wink", | |
19 | -yell:"Yell" | |
20 | -}); | |
21 | 1 | \ No newline at end of file |
2 | +tinyMCE.addI18n('en.emotions_dlg',{cry:"Cry",cool:"Cool",desc:"Emotions",title:"Insert Emotion",usage:"Use left and right arrows to navigate.",yell:"Yell",wink:"Wink",undecided:"Undecided","tongue_out":"Tongue Out",surprised:"Surprised",smile:"Smile",sealed:"Sealed","money_mouth":"Money Mouth",laughing:"Laughing",kiss:"Kiss",innocent:"Innocent",frown:"Frown","foot_in_mouth":"Foot in Mouth",embarassed:"Embarassed"}); | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/example/editor_plugin_src.js
... | ... | @@ -49,7 +49,7 @@ |
49 | 49 | }, |
50 | 50 | |
51 | 51 | /** |
52 | - * Creates control instances based in the incomming name. This method is normally not | |
52 | + * Creates control instances based in the incoming name. This method is normally not | |
53 | 53 | * needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons |
54 | 54 | * but you sometimes need to create more complex controls like listboxes, split buttons etc then this |
55 | 55 | * method can be used to create those. | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/example_dependency/editor_plugin.js
0 → 100644
... | ... | @@ -0,0 +1 @@ |
1 | +(function(){tinymce.create("tinymce.plugins.ExampleDependencyPlugin",{init:function(a,b){},getInfo:function(){return{longname:"Example Dependency plugin",author:"Some author",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/example_dependency",version:"1.0"}}});tinymce.PluginManager.add("example_dependency",tinymce.plugins.ExampleDependencyPlugin,["example"])})(); | |
0 | 2 | \ No newline at end of file | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/example_dependency/editor_plugin_src.js
0 → 100644
... | ... | @@ -0,0 +1,50 @@ |
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 | + | |
13 | + tinymce.create('tinymce.plugins.ExampleDependencyPlugin', { | |
14 | + /** | |
15 | + * Initializes the plugin, this will be executed after the plugin has been created. | |
16 | + * This call is done before the editor instance has finished it's initialization so use the onInit event | |
17 | + * of the editor instance to intercept that event. | |
18 | + * | |
19 | + * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in. | |
20 | + * @param {string} url Absolute URL to where the plugin is located. | |
21 | + */ | |
22 | + init : function(ed, url) { | |
23 | + }, | |
24 | + | |
25 | + | |
26 | + /** | |
27 | + * Returns information about the plugin as a name/value array. | |
28 | + * The current keys are longname, author, authorurl, infourl and version. | |
29 | + * | |
30 | + * @return {Object} Name/value array containing information about the plugin. | |
31 | + */ | |
32 | + getInfo : function() { | |
33 | + return { | |
34 | + longname : 'Example Dependency plugin', | |
35 | + author : 'Some author', | |
36 | + authorurl : 'http://tinymce.moxiecode.com', | |
37 | + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/example_dependency', | |
38 | + version : "1.0" | |
39 | + }; | |
40 | + } | |
41 | + }); | |
42 | + | |
43 | + /** | |
44 | + * Register the plugin, specifying the list of the plugins that this plugin depends on. They are specified in a list, with the list loaded in order. | |
45 | + * plugins in this list will be initialised when this plugin is initialized. (before the init method is called). | |
46 | + * plugins in a depends list should typically be specified using the short name). If neccesary this can be done | |
47 | + * with an object which has the url to the plugin and the shortname. | |
48 | + */ | |
49 | + tinymce.PluginManager.add('example_dependency', tinymce.plugins.ExampleDependencyPlugin, ['example']); | |
50 | +})(); | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/fullpage/editor_plugin.js
1 | -(function(){var b=tinymce.each,a=tinymce.html.Node;tinymce.create("tinymce.plugins.FullPagePlugin",{init:function(c,d){var e=this;e.editor=c;c.addCommand("mceFullPageProperties",function(){c.windowManager.open({file:d+"/fullpage.htm",width:430+parseInt(c.getLang("fullpage.delta_width",0)),height:495+parseInt(c.getLang("fullpage.delta_height",0)),inline:1},{plugin_url:d,data:e._htmlToData()})});c.addButton("fullpage",{title:"fullpage.desc",cmd:"mceFullPageProperties"});c.onBeforeSetContent.add(e._setContent,e);c.onGetContent.add(e._getContent,e)},getInfo:function(){return{longname:"Fullpage",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullpage",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_htmlToData:function(){var f=this._parseHeader(),h={},c,i,g,e=this.editor;function d(l,j){var k=l.attr(j);return k||""}h.fontface=e.getParam("fullpage_default_fontface","");h.fontsize=e.getParam("fullpage_default_fontsize","");i=f.firstChild;if(i.type==7){h.xml_pi=true;g=/encoding="([^"]+)"/.exec(i.value);if(g){h.docencoding=g[1]}}i=f.getAll("#doctype")[0];if(i){h.doctype="<!DOCTYPE"+i.value+">"}i=f.getAll("title")[0];if(i&&i.firstChild){h.metatitle=i.firstChild.value}b(f.getAll("meta"),function(m){var k=m.attr("name"),j=m.attr("http-equiv"),l;if(k){h["meta"+k.toLowerCase()]=m.attr("content")}else{if(j=="Content-Type"){l=/charset\s*=\s*(.*)\s*/gi.exec(m.attr("content"));if(l){h.docencoding=l[1]}}}});i=f.getAll("html")[0];if(i){h.langcode=d(i,"lang")||d(i,"xml:lang")}i=f.getAll("link")[0];if(i&&i.attr("rel")=="stylesheet"){h.stylesheet=i.attr("href")}i=f.getAll("body")[0];if(i){h.langdir=d(i,"dir");h.style=d(i,"style");h.visited_color=d(i,"vlink");h.link_color=d(i,"link");h.active_color=d(i,"alink")}return h},_dataToHtml:function(g){var f,d,h,j,k,e=this.editor.dom;function c(n,l,m){n.attr(l,m?m:undefined)}function i(l){if(d.firstChild){d.insert(l,d.firstChild)}else{d.append(l)}}f=this._parseHeader();d=f.getAll("head")[0];if(!d){j=f.getAll("html")[0];d=new a("head",1);if(j.firstChild){j.insert(d,j.firstChild,true)}else{j.append(d)}}j=f.firstChild;if(g.xml_pi){k='version="1.0"';if(g.docencoding){k+=' encoding="'+g.docencoding+'"'}if(j.type!=7){j=new a("xml",7);f.insert(j,f.firstChild,true)}j.value=k}else{if(j&&j.type==7){j.remove()}}j=f.getAll("#doctype")[0];if(g.doctype){if(!j){j=new a("#doctype",10);if(g.xml_pi){f.insert(j,f.firstChild)}else{i(j)}}j.value=g.doctype.substring(9,g.doctype.length-1)}else{if(j){j.remove()}}j=f.getAll("title")[0];if(g.metatitle){if(!j){j=new a("title",1);j.append(new a("#text",3)).value=g.metatitle;i(j)}}if(g.docencoding){j=null;b(f.getAll("meta"),function(l){if(l.attr("http-equiv")=="Content-Type"){j=l}});if(!j){j=new a("meta",1);j.attr("http-equiv","Content-Type");j.shortEnded=true;i(j)}j.attr("content","text/html; charset="+g.docencoding)}b("keywords,description,author,copyright,robots".split(","),function(m){var l=f.getAll("meta"),n,p,o=g["meta"+m];for(n=0;n<l.length;n++){p=l[n];if(p.attr("name")==m){if(o){p.attr("content",o)}else{p.remove()}return}}if(o){j=new a("meta",1);j.attr("name",m);j.attr("content",o);j.shortEnded=true;i(j)}});j=f.getAll("link")[0];if(j&&j.attr("rel")=="stylesheet"){if(g.stylesheet){j.attr("href",g.stylesheet)}else{j.remove()}}else{if(g.stylesheet){j=new a("link",1);j.attr({rel:"stylesheet",text:"text/css",href:g.stylesheet});j.shortEnded=true;i(j)}}j=f.getAll("body")[0];if(j){c(j,"dir",g.langdir);c(j,"style",g.style);c(j,"vlink",g.visited_color);c(j,"link",g.link_color);c(j,"alink",g.active_color);e.setAttribs(this.editor.getBody(),{style:g.style,dir:g.dir,vLink:g.visited_color,link:g.link_color,aLink:g.active_color})}j=f.getAll("html")[0];if(j){c(j,"lang",g.langcode);c(j,"xml:lang",g.langcode)}h=new tinymce.html.Serializer({validate:false,indent:true,apply_source_formatting:true,indent_before:"head,html,body,meta,title,script,link,style",indent_after:"head,html,body,meta,title,script,link,style"}).serialize(f);this.head=h.substring(0,h.indexOf("</body>"))},_parseHeader:function(){return new tinymce.html.DomParser({validate:false,root_name:"#document"}).parse(this.head)},_setContent:function(g,d){var m=this,i,c,h=d.content,f,l="",e=m.editor.dom,j;function k(n){return n.replace(/<\/?[A-Z]+/g,function(o){return o.toLowerCase()})}if(d.format=="raw"&&m.head){return}if(d.source_view&&g.getParam("fullpage_hide_in_source_view")){return}h=h.replace(/<(\/?)BODY/gi,"<$1body");i=h.indexOf("<body");if(i!=-1){i=h.indexOf(">",i);m.head=k(h.substring(0,i+1));c=h.indexOf("</body",i);if(c==-1){c=h.length}d.content=h.substring(i+1,c);m.foot=k(h.substring(c))}else{m.head=this._getDefaultHeader();m.foot="\n</body>\n</html>"}f=m._parseHeader();b(f.getAll("style"),function(n){if(n.firstChild){l+=n.firstChild.value}});j=f.getAll("body")[0];if(j){e.setAttribs(m.editor.getBody(),{style:j.attr("style")||"",dir:j.attr("dir")||"",vLink:j.attr("vlink")||"",link:j.attr("link")||"",aLink:j.attr("alink")||""})}if(l){e.add(m.editor.getDoc().getElementsByTagName("head")[0],"style",{id:"fullpage_styles"},l)}else{e.remove("fullpage_styles")}},_getDefaultHeader:function(){var f="",c=this.editor,e,d="";if(c.getParam("fullpage_default_xml_pi")){f+='<?xml version="1.0" encoding="'+c.getParam("fullpage_default_encoding","ISO-8859-1")+'" ?>\n'}f+=c.getParam("fullpage_default_doctype",'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');f+="\n<html>\n<head>\n";if(e=c.getParam("fullpage_default_title")){f+="<title>"+v+"</title>\n"}if(e=c.getParam("fullpage_default_encoding")){f+='<meta http-equiv="Content-Type" content="text/html; charset='+e+'" />\n'}if(e=c.getParam("fullpage_default_font_family")){d+="font-family: "+e+";"}if(e=c.getParam("fullpage_default_font_size")){d+="font-size: "+e+";"}if(e=c.getParam("fullpage_default_text_color")){d+="color: "+e+";"}f+="</head>\n<body"+(d?' style="'+d+'"':"")+">\n";return f},_getContent:function(d,e){var c=this;if(!e.source_view||!d.getParam("fullpage_hide_in_source_view")){e.content=tinymce.trim(c.head)+"\n"+tinymce.trim(e.content)+"\n"+tinymce.trim(c.foot)}}});tinymce.PluginManager.add("fullpage",tinymce.plugins.FullPagePlugin)})(); | |
2 | 1 | \ No newline at end of file |
2 | +(function(){var b=tinymce.each,a=tinymce.html.Node;tinymce.create("tinymce.plugins.FullPagePlugin",{init:function(c,d){var e=this;e.editor=c;c.addCommand("mceFullPageProperties",function(){c.windowManager.open({file:d+"/fullpage.htm",width:430+parseInt(c.getLang("fullpage.delta_width",0)),height:495+parseInt(c.getLang("fullpage.delta_height",0)),inline:1},{plugin_url:d,data:e._htmlToData()})});c.addButton("fullpage",{title:"fullpage.desc",cmd:"mceFullPageProperties"});c.onBeforeSetContent.add(e._setContent,e);c.onGetContent.add(e._getContent,e)},getInfo:function(){return{longname:"Fullpage",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullpage",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_htmlToData:function(){var f=this._parseHeader(),h={},c,i,g,e=this.editor;function d(l,j){var k=l.attr(j);return k||""}h.fontface=e.getParam("fullpage_default_fontface","");h.fontsize=e.getParam("fullpage_default_fontsize","");i=f.firstChild;if(i.type==7){h.xml_pi=true;g=/encoding="([^"]+)"/.exec(i.value);if(g){h.docencoding=g[1]}}i=f.getAll("#doctype")[0];if(i){h.doctype="<!DOCTYPE"+i.value+">"}i=f.getAll("title")[0];if(i&&i.firstChild){h.metatitle=i.firstChild.value}b(f.getAll("meta"),function(m){var k=m.attr("name"),j=m.attr("http-equiv"),l;if(k){h["meta"+k.toLowerCase()]=m.attr("content")}else{if(j=="Content-Type"){l=/charset\s*=\s*(.*)\s*/gi.exec(m.attr("content"));if(l){h.docencoding=l[1]}}}});i=f.getAll("html")[0];if(i){h.langcode=d(i,"lang")||d(i,"xml:lang")}i=f.getAll("link")[0];if(i&&i.attr("rel")=="stylesheet"){h.stylesheet=i.attr("href")}i=f.getAll("body")[0];if(i){h.langdir=d(i,"dir");h.style=d(i,"style");h.visited_color=d(i,"vlink");h.link_color=d(i,"link");h.active_color=d(i,"alink")}return h},_dataToHtml:function(g){var f,d,h,j,k,e=this.editor.dom;function c(n,l,m){n.attr(l,m?m:undefined)}function i(l){if(d.firstChild){d.insert(l,d.firstChild)}else{d.append(l)}}f=this._parseHeader();d=f.getAll("head")[0];if(!d){j=f.getAll("html")[0];d=new a("head",1);if(j.firstChild){j.insert(d,j.firstChild,true)}else{j.append(d)}}j=f.firstChild;if(g.xml_pi){k='version="1.0"';if(g.docencoding){k+=' encoding="'+g.docencoding+'"'}if(j.type!=7){j=new a("xml",7);f.insert(j,f.firstChild,true)}j.value=k}else{if(j&&j.type==7){j.remove()}}j=f.getAll("#doctype")[0];if(g.doctype){if(!j){j=new a("#doctype",10);if(g.xml_pi){f.insert(j,f.firstChild)}else{i(j)}}j.value=g.doctype.substring(9,g.doctype.length-1)}else{if(j){j.remove()}}j=f.getAll("title")[0];if(g.metatitle){if(!j){j=new a("title",1);j.append(new a("#text",3)).value=g.metatitle;i(j)}}if(g.docencoding){j=null;b(f.getAll("meta"),function(l){if(l.attr("http-equiv")=="Content-Type"){j=l}});if(!j){j=new a("meta",1);j.attr("http-equiv","Content-Type");j.shortEnded=true;i(j)}j.attr("content","text/html; charset="+g.docencoding)}b("keywords,description,author,copyright,robots".split(","),function(m){var l=f.getAll("meta"),n,p,o=g["meta"+m];for(n=0;n<l.length;n++){p=l[n];if(p.attr("name")==m){if(o){p.attr("content",o)}else{p.remove()}return}}if(o){j=new a("meta",1);j.attr("name",m);j.attr("content",o);j.shortEnded=true;i(j)}});j=f.getAll("link")[0];if(j&&j.attr("rel")=="stylesheet"){if(g.stylesheet){j.attr("href",g.stylesheet)}else{j.remove()}}else{if(g.stylesheet){j=new a("link",1);j.attr({rel:"stylesheet",text:"text/css",href:g.stylesheet});j.shortEnded=true;i(j)}}j=f.getAll("body")[0];if(j){c(j,"dir",g.langdir);c(j,"style",g.style);c(j,"vlink",g.visited_color);c(j,"link",g.link_color);c(j,"alink",g.active_color);e.setAttribs(this.editor.getBody(),{style:g.style,dir:g.dir,vLink:g.visited_color,link:g.link_color,aLink:g.active_color})}j=f.getAll("html")[0];if(j){c(j,"lang",g.langcode);c(j,"xml:lang",g.langcode)}h=new tinymce.html.Serializer({validate:false,indent:true,apply_source_formatting:true,indent_before:"head,html,body,meta,title,script,link,style",indent_after:"head,html,body,meta,title,script,link,style"}).serialize(f);this.head=h.substring(0,h.indexOf("</body>"))},_parseHeader:function(){return new tinymce.html.DomParser({validate:false,root_name:"#document"}).parse(this.head)},_setContent:function(g,d){var m=this,i,c,h=d.content,f,l="",e=m.editor.dom,j;function k(n){return n.replace(/<\/?[A-Z]+/g,function(o){return o.toLowerCase()})}if(d.format=="raw"&&m.head){return}if(d.source_view&&g.getParam("fullpage_hide_in_source_view")){return}h=h.replace(/<(\/?)BODY/gi,"<$1body");i=h.indexOf("<body");if(i!=-1){i=h.indexOf(">",i);m.head=k(h.substring(0,i+1));c=h.indexOf("</body",i);if(c==-1){c=h.length}d.content=h.substring(i+1,c);m.foot=k(h.substring(c))}else{m.head=this._getDefaultHeader();m.foot="\n</body>\n</html>"}f=m._parseHeader();b(f.getAll("style"),function(n){if(n.firstChild){l+=n.firstChild.value}});j=f.getAll("body")[0];if(j){e.setAttribs(m.editor.getBody(),{style:j.attr("style")||"",dir:j.attr("dir")||"",vLink:j.attr("vlink")||"",link:j.attr("link")||"",aLink:j.attr("alink")||""})}e.remove("fullpage_styles");if(l){e.add(m.editor.getDoc().getElementsByTagName("head")[0],"style",{id:"fullpage_styles"},l);j=e.get("fullpage_styles");if(j.styleSheet){j.styleSheet.cssText=l}}},_getDefaultHeader:function(){var f="",c=this.editor,e,d="";if(c.getParam("fullpage_default_xml_pi")){f+='<?xml version="1.0" encoding="'+c.getParam("fullpage_default_encoding","ISO-8859-1")+'" ?>\n'}f+=c.getParam("fullpage_default_doctype",'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');f+="\n<html>\n<head>\n";if(e=c.getParam("fullpage_default_title")){f+="<title>"+e+"</title>\n"}if(e=c.getParam("fullpage_default_encoding")){f+='<meta http-equiv="Content-Type" content="text/html; charset='+e+'" />\n'}if(e=c.getParam("fullpage_default_font_family")){d+="font-family: "+e+";"}if(e=c.getParam("fullpage_default_font_size")){d+="font-size: "+e+";"}if(e=c.getParam("fullpage_default_text_color")){d+="color: "+e+";"}f+="</head>\n<body"+(d?' style="'+d+'"':"")+">\n";return f},_getContent:function(d,e){var c=this;if(!e.source_view||!d.getParam("fullpage_hide_in_source_view")){e.content=tinymce.trim(c.head)+"\n"+tinymce.trim(e.content)+"\n"+tinymce.trim(c.foot)}}});tinymce.PluginManager.add("fullpage",tinymce.plugins.FullPagePlugin)})(); | |
3 | 3 | \ No newline at end of file | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/fullpage/editor_plugin_src.js
... | ... | @@ -351,10 +351,16 @@ |
351 | 351 | }); |
352 | 352 | } |
353 | 353 | |
354 | - if (styles) | |
354 | + dom.remove('fullpage_styles'); | |
355 | + | |
356 | + if (styles) { | |
355 | 357 | dom.add(self.editor.getDoc().getElementsByTagName('head')[0], 'style', {id : 'fullpage_styles'}, styles); |
356 | - else | |
357 | - dom.remove('fullpage_styles'); | |
358 | + | |
359 | + // Needed for IE 6/7 | |
360 | + elm = dom.get('fullpage_styles'); | |
361 | + if (elm.styleSheet) | |
362 | + elm.styleSheet.cssText = styles; | |
363 | + } | |
358 | 364 | }, |
359 | 365 | |
360 | 366 | _getDefaultHeader : function() { |
... | ... | @@ -367,7 +373,7 @@ |
367 | 373 | header += '\n<html>\n<head>\n'; |
368 | 374 | |
369 | 375 | if (value = editor.getParam('fullpage_default_title')) |
370 | - header += '<title>' + v + '</title>\n'; | |
376 | + header += '<title>' + value + '</title>\n'; | |
371 | 377 | |
372 | 378 | if (value = editor.getParam('fullpage_default_encoding')) |
373 | 379 | header += '<meta http-equiv="Content-Type" content="text/html; charset=' + value + '" />\n'; | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/fullpage/langs/en_dlg.js
1 | -tinyMCE.addI18n('en.fullpage_dlg',{ | |
2 | -title:"Document properties", | |
3 | -meta_tab:"General", | |
4 | -appearance_tab:"Appearance", | |
5 | -advanced_tab:"Advanced", | |
6 | -meta_props:"Meta information", | |
7 | -langprops:"Language and encoding", | |
8 | -meta_title:"Title", | |
9 | -meta_keywords:"Keywords", | |
10 | -meta_description:"Description", | |
11 | -meta_robots:"Robots", | |
12 | -doctypes:"Doctype", | |
13 | -langcode:"Language code", | |
14 | -langdir:"Language direction", | |
15 | -ltr:"Left to right", | |
16 | -rtl:"Right to left", | |
17 | -xml_pi:"XML declaration", | |
18 | -encoding:"Character encoding", | |
19 | -appearance_bgprops:"Background properties", | |
20 | -appearance_marginprops:"Body margins", | |
21 | -appearance_linkprops:"Link colors", | |
22 | -appearance_textprops:"Text properties", | |
23 | -bgcolor:"Background color", | |
24 | -bgimage:"Background image", | |
25 | -left_margin:"Left margin", | |
26 | -right_margin:"Right margin", | |
27 | -top_margin:"Top margin", | |
28 | -bottom_margin:"Bottom margin", | |
29 | -text_color:"Text color", | |
30 | -font_size:"Font size", | |
31 | -font_face:"Font face", | |
32 | -link_color:"Link color", | |
33 | -hover_color:"Hover color", | |
34 | -visited_color:"Visited color", | |
35 | -active_color:"Active color", | |
36 | -textcolor:"Color", | |
37 | -fontsize:"Font size", | |
38 | -fontface:"Font family", | |
39 | -meta_index_follow:"Index and follow the links", | |
40 | -meta_index_nofollow:"Index and don't follow the links", | |
41 | -meta_noindex_follow:"Do not index but follow the links", | |
42 | -meta_noindex_nofollow:"Do not index and don\'t follow the links", | |
43 | -appearance_style:"Stylesheet and style properties", | |
44 | -stylesheet:"Stylesheet", | |
45 | -style:"Style", | |
46 | -author:"Author", | |
47 | -copyright:"Copyright", | |
48 | -add:"Add new element", | |
49 | -remove:"Remove selected element", | |
50 | -moveup:"Move selected element up", | |
51 | -movedown:"Move selected element down", | |
52 | -head_elements:"Head elements", | |
53 | -info:"Information", | |
54 | -add_title:"Title element", | |
55 | -add_meta:"Meta element", | |
56 | -add_script:"Script element", | |
57 | -add_style:"Style element", | |
58 | -add_link:"Link element", | |
59 | -add_base:"Base element", | |
60 | -add_comment:"Comment node", | |
61 | -title_element:"Title element", | |
62 | -script_element:"Script element", | |
63 | -style_element:"Style element", | |
64 | -base_element:"Base element", | |
65 | -link_element:"Link element", | |
66 | -meta_element:"Meta element", | |
67 | -comment_element:"Comment", | |
68 | -src:"Src", | |
69 | -language:"Language", | |
70 | -href:"Href", | |
71 | -target:"Target", | |
72 | -type:"Type", | |
73 | -charset:"Charset", | |
74 | -defer:"Defer", | |
75 | -media:"Media", | |
76 | -properties:"Properties", | |
77 | -name:"Name", | |
78 | -value:"Value", | |
79 | -content:"Content", | |
80 | -rel:"Rel", | |
81 | -rev:"Rev", | |
82 | -hreflang:"Href lang", | |
83 | -general_props:"General", | |
84 | -advanced_props:"Advanced" | |
85 | -}); | |
86 | 1 | \ No newline at end of file |
2 | +tinyMCE.addI18n('en.fullpage_dlg',{title:"Document Properties","meta_tab":"General","appearance_tab":"Appearance","advanced_tab":"Advanced","meta_props":"Meta Information",langprops:"Language and Encoding","meta_title":"Title","meta_keywords":"Keywords","meta_description":"Description","meta_robots":"Robots",doctypes:"Doctype",langcode:"Language Code",langdir:"Language Direction",ltr:"Left to Right",rtl:"Right to Left","xml_pi":"XML Declaration",encoding:"Character Encoding","appearance_bgprops":"Background Properties","appearance_marginprops":"Body Margins","appearance_linkprops":"Link Colors","appearance_textprops":"Text Properties",bgcolor:"Background Color",bgimage:"Background Image","left_margin":"Left Margin","right_margin":"Right Margin","top_margin":"Top Margin","bottom_margin":"Bottom Margin","text_color":"Text Color","font_size":"Font Size","font_face":"Font Face","link_color":"Link Color","hover_color":"Hover Color","visited_color":"Visited Color","active_color":"Active Color",textcolor:"Color",fontsize:"Font Size",fontface:"Font Family","meta_index_follow":"Index and Follow the Links","meta_index_nofollow":"Index and Don\'t Follow the Links","meta_noindex_follow":"Do Not Index but Follow the Links","meta_noindex_nofollow":"Do Not Index and Don\'t Follow the Links","appearance_style":"Stylesheet and Style Properties",stylesheet:"Stylesheet",style:"Style",author:"Author",copyright:"Copyright",add:"Add New Element",remove:"Remove Selected Element",moveup:"Move Selected Element Up",movedown:"Move Selected Element Down","head_elements":"Head Elements",info:"Information","add_title":"Title Element","add_meta":"Meta Element","add_script":"Script Element","add_style":"Style Element","add_link":"Link Element","add_base":"Base Element","add_comment":"Comment Node","title_element":"Title Element","script_element":"Script Element","style_element":"Style Element","base_element":"Base Element","link_element":"Link Element","meta_element":"Meta Element","comment_element":"Comment",src:"Source",language:"Language",href:"HREF",target:"Target",type:"Type",charset:"Charset",defer:"Defer",media:"Media",properties:"Properties",name:"Name",value:"Value",content:"Content",rel:"Rel",rev:"Rev",hreflang:"HREF Lang","general_props":"General","advanced_props":"Advanced"}); | |
87 | 3 | \ No newline at end of file | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/fullscreen/editor_plugin.js
1 | -(function(){var a=tinymce.DOM;tinymce.create("tinymce.plugins.FullScreenPlugin",{init:function(d,e){var f=this,g={},c,b;f.editor=d;d.addCommand("mceFullScreen",function(){var i,j=a.doc.documentElement;if(d.getParam("fullscreen_is_enabled")){if(d.getParam("fullscreen_new_window")){closeFullscreen()}else{a.win.setTimeout(function(){tinymce.dom.Event.remove(a.win,"resize",f.resizeFunc);tinyMCE.get(d.getParam("fullscreen_editor_id")).setContent(d.getContent({format:"raw"}),{format:"raw"});tinyMCE.remove(d);a.remove("mce_fullscreen_container");j.style.overflow=d.getParam("fullscreen_html_overflow");a.setStyle(a.doc.body,"overflow",d.getParam("fullscreen_overflow"));a.win.scrollTo(d.getParam("fullscreen_scrollx"),d.getParam("fullscreen_scrolly"));tinyMCE.settings=tinyMCE.oldSettings},10)}return}if(d.getParam("fullscreen_new_window")){i=a.win.open(e+"/fullscreen.htm","mceFullScreenPopup","fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width="+screen.availWidth+",height="+screen.availHeight);try{i.resizeTo(screen.availWidth,screen.availHeight)}catch(h){}}else{tinyMCE.oldSettings=tinyMCE.settings;g.fullscreen_overflow=a.getStyle(a.doc.body,"overflow",1)||"auto";g.fullscreen_html_overflow=a.getStyle(j,"overflow",1);c=a.getViewPort();g.fullscreen_scrollx=c.x;g.fullscreen_scrolly=c.y;if(tinymce.isOpera&&g.fullscreen_overflow=="visible"){g.fullscreen_overflow="auto"}if(tinymce.isIE&&g.fullscreen_overflow=="scroll"){g.fullscreen_overflow="auto"}if(tinymce.isIE&&(g.fullscreen_html_overflow=="visible"||g.fullscreen_html_overflow=="scroll")){g.fullscreen_html_overflow="auto"}if(g.fullscreen_overflow=="0px"){g.fullscreen_overflow=""}a.setStyle(a.doc.body,"overflow","hidden");j.style.overflow="hidden";c=a.getViewPort();a.win.scrollTo(0,0);if(tinymce.isIE){c.h-=1}if(tinymce.isIE6){b="absolute;top:"+c.y}else{b="fixed;top:0"}n=a.add(a.doc.body,"div",{id:"mce_fullscreen_container",style:"position:"+b+";left:0;width:"+c.w+"px;height:"+c.h+"px;z-index:200000;"});a.add(n,"div",{id:"mce_fullscreen"});tinymce.each(d.settings,function(k,l){g[l]=k});g.id="mce_fullscreen";g.width=n.clientWidth;g.height=n.clientHeight-15;g.fullscreen_is_enabled=true;g.fullscreen_editor_id=d.id;g.theme_advanced_resizing=false;g.save_onsavecallback=function(){d.setContent(tinyMCE.get(g.id).getContent({format:"raw"}),{format:"raw"});d.execCommand("mceSave")};tinymce.each(d.getParam("fullscreen_settings"),function(m,l){g[l]=m});if(g.theme_advanced_toolbar_location==="external"){g.theme_advanced_toolbar_location="top"}f.fullscreenEditor=new tinymce.Editor("mce_fullscreen",g);f.fullscreenEditor.onInit.add(function(){f.fullscreenEditor.setContent(d.getContent());f.fullscreenEditor.focus()});f.fullscreenEditor.render();f.fullscreenElement=new tinymce.dom.Element("mce_fullscreen_container");f.fullscreenElement.update();f.resizeFunc=tinymce.dom.Event.add(a.win,"resize",function(){var o=tinymce.DOM.getViewPort(),l=f.fullscreenEditor,k,m;k=l.dom.getSize(l.getContainer().firstChild);m=l.dom.getSize(l.getContainer().getElementsByTagName("iframe")[0]);l.theme.resizeTo(o.w-k.w+m.w,o.h-k.h+m.h)})}});d.addButton("fullscreen",{title:"fullscreen.desc",cmd:"mceFullScreen"});d.onNodeChange.add(function(i,h){h.setActive("fullscreen",i.getParam("fullscreen_is_enabled"))})},getInfo:function(){return{longname:"Fullscreen",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("fullscreen",tinymce.plugins.FullScreenPlugin)})(); | |
2 | 1 | \ No newline at end of file |
2 | +(function(){var b=tinymce.DOM;var a=function(d,f,e){var c=function(g){var i=d.controlManager.get(g);var h=f.controlManager.get(g);if(i&&h){h.displayColor(i.value)}};c("forecolor");c("backcolor");f.setContent(d.getContent({format:"raw"}),{format:"raw"});f.selection.moveToBookmark(e);if(d.plugins.spellchecker&&f.plugins.spellchecker){f.plugins.spellchecker.setLanguage(d.plugins.spellchecker.selectedLang)}};tinymce.create("tinymce.plugins.FullScreenPlugin",{init:function(i,c){var l=this,m={},k=b.doc.documentElement,d,o,h,g,f,e,j;i.addCommand("mceFullScreen",function(){var q,r;if(i.getParam("fullscreen_is_enabled")){if(i.getParam("fullscreen_new_window")){closeFullscreen()}else{b.win.setTimeout(function(){var t=i;var s=tinyMCE.get(t.getParam("fullscreen_editor_id"));s.plugins.fullscreen.saveState(t);tinyMCE.remove(t)},10)}return}if(i.getParam("fullscreen_new_window")){l.fullscreenSettings={bookmark:i.selection.getBookmark()};q=b.win.open(c+"/fullscreen.htm","mceFullScreenPopup","fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width="+screen.availWidth+",height="+screen.availHeight);try{q.resizeTo(screen.availWidth,screen.availHeight)}catch(p){}}else{o=b.getStyle(b.doc.body,"overflow",1)||"auto";h=b.getStyle(k,"overflow",1);d=b.getViewPort();g=d.x;f=d.y;if(tinymce.isOpera&&o=="visible"){o="auto"}if(tinymce.isIE&&o=="scroll"){o="auto"}if(tinymce.isIE&&(h=="visible"||h=="scroll")){h="auto"}if(o=="0px"){o=""}b.setStyle(b.doc.body,"overflow","hidden");k.style.overflow="hidden";d=b.getViewPort();b.win.scrollTo(0,0);if(tinymce.isIE){d.h-=1}if(tinymce.isIE6||document.compatMode=="BackCompat"){e="absolute;top:"+d.y}else{e="fixed;top:0"}n=b.add(b.doc.body,"div",{id:"mce_fullscreen_container",style:"position:"+e+";left:0;width:"+d.w+"px;height:"+d.h+"px;z-index:200000;"});b.add(n,"div",{id:"mce_fullscreen"});tinymce.each(i.settings,function(s,t){m[t]=s});m.id="mce_fullscreen";m.width=n.clientWidth;m.height=n.clientHeight-15;m.fullscreen_is_enabled=true;m.fullscreen_editor_id=i.id;m.theme_advanced_resizing=false;m.save_onsavecallback=function(){i.setContent(tinyMCE.get(m.id).getContent());i.execCommand("mceSave")};tinymce.each(i.getParam("fullscreen_settings"),function(t,s){m[s]=t});l.fullscreenSettings={bookmark:i.selection.getBookmark(),fullscreen_overflow:o,fullscreen_html_overflow:h,fullscreen_scrollx:g,fullscreen_scrolly:f};if(m.theme_advanced_toolbar_location==="external"){m.theme_advanced_toolbar_location="top"}tinyMCE.oldSettings=tinyMCE.settings;l.fullscreenEditor=new tinymce.Editor("mce_fullscreen",m);l.fullscreenEditor.onInit.add(function(){l.loadState(l.fullscreenEditor)});l.fullscreenEditor.render();l.fullscreenElement=new tinymce.dom.Element("mce_fullscreen_container");l.fullscreenElement.update();l.resizeFunc=tinymce.dom.Event.add(b.win,"resize",function(){var v=tinymce.DOM.getViewPort(),t=l.fullscreenEditor,s,u;s=t.dom.getSize(t.getContainer().getElementsByTagName("table")[0]);u=t.dom.getSize(t.getContainer().getElementsByTagName("iframe")[0]);t.theme.resizeTo(v.w-s.w+u.w,v.h-s.h+u.h)})}});i.addButton("fullscreen",{title:"fullscreen.desc",cmd:"mceFullScreen"});i.onNodeChange.add(function(q,p){p.setActive("fullscreen",q.getParam("fullscreen_is_enabled"))});l.loadState=function(p){if(!(p&&l.fullscreenSettings)){throw"No fullscreen editor to load to"}a(i,p,l.fullscreenSettings.bookmark);p.focus()};l.saveState=function(q){if(!(q&&l.fullscreenSettings)){throw"No fullscreen editor to restore from"}var p=l.fullscreenSettings;a(q,i,q.selection.getBookmark());if(!i.getParam("fullscreen_new_window")){tinymce.dom.Event.remove(b.win,"resize",l.resizeFunc);delete l.resizeFunc;b.remove("mce_fullscreen_container");b.doc.documentElement.style.overflow=p.fullscreen_html_overflow;b.setStyle(b.doc.body,"overflow",p.fullscreen_overflow);b.win.scrollTo(p.fullscreen_scrollx,p.fullscreen_scrolly)}tinyMCE.settings=tinyMCE.oldSettings;delete tinyMCE.oldSettings;delete l.fullscreenEditor;delete l.fullscreenElement;delete l.fullscreenSettings;b.win.setTimeout(function(){i.selection.moveToBookmark(j);i.focus()},10)}},getInfo:function(){return{longname:"Fullscreen",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("fullscreen",tinymce.plugins.FullScreenPlugin)})(); | |
3 | 3 | \ No newline at end of file | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/fullscreen/editor_plugin_src.js
... | ... | @@ -11,29 +11,48 @@ |
11 | 11 | (function() { |
12 | 12 | var DOM = tinymce.DOM; |
13 | 13 | |
14 | + // State Transfer function | |
15 | + var transferState = function(oldEditor, newEditor, bookmark) { | |
16 | + var transferColorButtonState = function(swapme) { | |
17 | + var c = oldEditor.controlManager.get(swapme); | |
18 | + var newC = newEditor.controlManager.get(swapme); | |
19 | + | |
20 | + if (c && newC) { | |
21 | + newC.displayColor(c.value); | |
22 | + } | |
23 | + | |
24 | + }; | |
25 | + | |
26 | + transferColorButtonState('forecolor'); | |
27 | + transferColorButtonState('backcolor'); | |
28 | + newEditor.setContent(oldEditor.getContent({format : 'raw'}), {format : 'raw'}); | |
29 | + newEditor.selection.moveToBookmark(bookmark); | |
30 | + | |
31 | + if (oldEditor.plugins.spellchecker && newEditor.plugins.spellchecker) { | |
32 | + newEditor.plugins.spellchecker.setLanguage(oldEditor.plugins.spellchecker.selectedLang); | |
33 | + } | |
34 | + }; | |
35 | + | |
14 | 36 | tinymce.create('tinymce.plugins.FullScreenPlugin', { |
15 | 37 | init : function(ed, url) { |
16 | - var t = this, s = {}, vp, posCss; | |
17 | - | |
18 | - t.editor = ed; | |
38 | + var t = this, s = {}, de = DOM.doc.documentElement, vp, fullscreen_overflow, fullscreen_html_overflow, fullscreen_scrollx, fullscreen_scrolly, posCss, bookmark; | |
19 | 39 | |
20 | 40 | // Register commands |
21 | 41 | ed.addCommand('mceFullScreen', function() { |
22 | - var win, de = DOM.doc.documentElement; | |
42 | + var win, oed; | |
23 | 43 | |
24 | 44 | if (ed.getParam('fullscreen_is_enabled')) { |
25 | 45 | if (ed.getParam('fullscreen_new_window')) |
26 | - closeFullscreen(); // Call to close in new window | |
46 | + closeFullscreen(); // Call to close in fullscreen.htm | |
27 | 47 | else { |
28 | 48 | DOM.win.setTimeout(function() { |
29 | - tinymce.dom.Event.remove(DOM.win, 'resize', t.resizeFunc); | |
30 | - tinyMCE.get(ed.getParam('fullscreen_editor_id')).setContent(ed.getContent({format : 'raw'}), {format : 'raw'}); | |
31 | - tinyMCE.remove(ed); | |
32 | - DOM.remove('mce_fullscreen_container'); | |
33 | - de.style.overflow = ed.getParam('fullscreen_html_overflow'); | |
34 | - DOM.setStyle(DOM.doc.body, 'overflow', ed.getParam('fullscreen_overflow')); | |
35 | - DOM.win.scrollTo(ed.getParam('fullscreen_scrollx'), ed.getParam('fullscreen_scrolly')); | |
36 | - tinyMCE.settings = tinyMCE.oldSettings; // Restore old settings | |
49 | + var fullscreenEditor = ed; | |
50 | + | |
51 | + // find the editor that opened this one, execute restore function there | |
52 | + var originalEditor = tinyMCE.get(fullscreenEditor.getParam('fullscreen_editor_id')); | |
53 | + originalEditor.plugins.fullscreen.saveState(fullscreenEditor); | |
54 | + | |
55 | + tinyMCE.remove(fullscreenEditor); | |
37 | 56 | }, 10); |
38 | 57 | } |
39 | 58 | |
... | ... | @@ -41,6 +60,9 @@ |
41 | 60 | } |
42 | 61 | |
43 | 62 | if (ed.getParam('fullscreen_new_window')) { |
63 | + t.fullscreenSettings = { | |
64 | + bookmark: ed.selection.getBookmark() | |
65 | + }; | |
44 | 66 | win = DOM.win.open(url + "/fullscreen.htm", "mceFullScreenPopup", "fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width=" + screen.availWidth + ",height=" + screen.availHeight); |
45 | 67 | try { |
46 | 68 | win.resizeTo(screen.availWidth, screen.availHeight); |
... | ... | @@ -48,27 +70,26 @@ |
48 | 70 | // Ignore |
49 | 71 | } |
50 | 72 | } else { |
51 | - tinyMCE.oldSettings = tinyMCE.settings; // Store old settings | |
52 | - s.fullscreen_overflow = DOM.getStyle(DOM.doc.body, 'overflow', 1) || 'auto'; | |
53 | - s.fullscreen_html_overflow = DOM.getStyle(de, 'overflow', 1); | |
73 | + fullscreen_overflow = DOM.getStyle(DOM.doc.body, 'overflow', 1) || 'auto'; | |
74 | + fullscreen_html_overflow = DOM.getStyle(de, 'overflow', 1); | |
54 | 75 | vp = DOM.getViewPort(); |
55 | - s.fullscreen_scrollx = vp.x; | |
56 | - s.fullscreen_scrolly = vp.y; | |
76 | + fullscreen_scrollx = vp.x; | |
77 | + fullscreen_scrolly = vp.y; | |
57 | 78 | |
58 | 79 | // Fixes an Opera bug where the scrollbars doesn't reappear |
59 | - if (tinymce.isOpera && s.fullscreen_overflow == 'visible') | |
60 | - s.fullscreen_overflow = 'auto'; | |
80 | + if (tinymce.isOpera && fullscreen_overflow == 'visible') | |
81 | + fullscreen_overflow = 'auto'; | |
61 | 82 | |
62 | 83 | // Fixes an IE bug where horizontal scrollbars would appear |
63 | - if (tinymce.isIE && s.fullscreen_overflow == 'scroll') | |
64 | - s.fullscreen_overflow = 'auto'; | |
84 | + if (tinymce.isIE && fullscreen_overflow == 'scroll') | |
85 | + fullscreen_overflow = 'auto'; | |
65 | 86 | |
66 | 87 | // Fixes an IE bug where the scrollbars doesn't reappear |
67 | - if (tinymce.isIE && (s.fullscreen_html_overflow == 'visible' || s.fullscreen_html_overflow == 'scroll')) | |
68 | - s.fullscreen_html_overflow = 'auto'; | |
88 | + if (tinymce.isIE && (fullscreen_html_overflow == 'visible' || fullscreen_html_overflow == 'scroll')) | |
89 | + fullscreen_html_overflow = 'auto'; | |
69 | 90 | |
70 | - if (s.fullscreen_overflow == '0px') | |
71 | - s.fullscreen_overflow = ''; | |
91 | + if (fullscreen_overflow == '0px') | |
92 | + fullscreen_overflow = ''; | |
72 | 93 | |
73 | 94 | DOM.setStyle(DOM.doc.body, 'overflow', 'hidden'); |
74 | 95 | de.style.overflow = 'hidden'; //Fix for IE6/7 |
... | ... | @@ -79,13 +100,13 @@ |
79 | 100 | vp.h -= 1; |
80 | 101 | |
81 | 102 | // Use fixed position if it exists |
82 | - if (tinymce.isIE6) | |
103 | + if (tinymce.isIE6 || document.compatMode == 'BackCompat') | |
83 | 104 | posCss = 'absolute;top:' + vp.y; |
84 | 105 | else |
85 | 106 | posCss = 'fixed;top:0'; |
86 | 107 | |
87 | 108 | n = DOM.add(DOM.doc.body, 'div', { |
88 | - id : 'mce_fullscreen_container', | |
109 | + id : 'mce_fullscreen_container', | |
89 | 110 | style : 'position:' + posCss + ';left:0;width:' + vp.w + 'px;height:' + vp.h + 'px;z-index:200000;'}); |
90 | 111 | DOM.add(n, 'div', {id : 'mce_fullscreen'}); |
91 | 112 | |
... | ... | @@ -100,7 +121,7 @@ |
100 | 121 | s.fullscreen_editor_id = ed.id; |
101 | 122 | s.theme_advanced_resizing = false; |
102 | 123 | s.save_onsavecallback = function() { |
103 | - ed.setContent(tinyMCE.get(s.id).getContent({format : 'raw'}), {format : 'raw'}); | |
124 | + ed.setContent(tinyMCE.get(s.id).getContent()); | |
104 | 125 | ed.execCommand('mceSave'); |
105 | 126 | }; |
106 | 127 | |
... | ... | @@ -108,13 +129,21 @@ |
108 | 129 | s[k] = v; |
109 | 130 | }); |
110 | 131 | |
132 | + t.fullscreenSettings = { | |
133 | + bookmark: ed.selection.getBookmark(), | |
134 | + fullscreen_overflow: fullscreen_overflow, | |
135 | + fullscreen_html_overflow: fullscreen_html_overflow, | |
136 | + fullscreen_scrollx: fullscreen_scrollx, | |
137 | + fullscreen_scrolly: fullscreen_scrolly | |
138 | + }; | |
139 | + | |
111 | 140 | if (s.theme_advanced_toolbar_location === 'external') |
112 | 141 | s.theme_advanced_toolbar_location = 'top'; |
113 | 142 | |
143 | + tinyMCE.oldSettings = tinyMCE.settings; // Store old settings, the Editor constructor overwrites them | |
114 | 144 | t.fullscreenEditor = new tinymce.Editor('mce_fullscreen', s); |
115 | 145 | t.fullscreenEditor.onInit.add(function() { |
116 | - t.fullscreenEditor.setContent(ed.getContent()); | |
117 | - t.fullscreenEditor.focus(); | |
146 | + t.loadState(t.fullscreenEditor); | |
118 | 147 | }); |
119 | 148 | |
120 | 149 | t.fullscreenEditor.render(); |
... | ... | @@ -127,7 +156,7 @@ |
127 | 156 | var vp = tinymce.DOM.getViewPort(), fed = t.fullscreenEditor, outerSize, innerSize; |
128 | 157 | |
129 | 158 | // Get outer/inner size to get a delta size that can be used to calc the new iframe size |
130 | - outerSize = fed.dom.getSize(fed.getContainer().firstChild); | |
159 | + outerSize = fed.dom.getSize(fed.getContainer().getElementsByTagName('table')[0]); | |
131 | 160 | innerSize = fed.dom.getSize(fed.getContainer().getElementsByTagName('iframe')[0]); |
132 | 161 | |
133 | 162 | fed.theme.resizeTo(vp.w - outerSize.w + innerSize.w, vp.h - outerSize.h + innerSize.h); |
... | ... | @@ -141,6 +170,52 @@ |
141 | 170 | ed.onNodeChange.add(function(ed, cm) { |
142 | 171 | cm.setActive('fullscreen', ed.getParam('fullscreen_is_enabled')); |
143 | 172 | }); |
173 | + | |
174 | + // fullscreenEditor is a param here because in window mode we don't create it | |
175 | + t.loadState = function(fullscreenEditor) { | |
176 | + if (!(fullscreenEditor && t.fullscreenSettings)) { | |
177 | + throw "No fullscreen editor to load to"; | |
178 | + } | |
179 | + | |
180 | + transferState(ed, fullscreenEditor, t.fullscreenSettings.bookmark); | |
181 | + fullscreenEditor.focus(); | |
182 | + | |
183 | + }; | |
184 | + | |
185 | + // fullscreenEditor is a param here because in window mode we don't create it | |
186 | + t.saveState = function(fullscreenEditor) { | |
187 | + if (!(fullscreenEditor && t.fullscreenSettings)) { | |
188 | + throw "No fullscreen editor to restore from"; | |
189 | + } | |
190 | + var settings = t.fullscreenSettings; | |
191 | + | |
192 | + transferState(fullscreenEditor, ed, fullscreenEditor.selection.getBookmark()); | |
193 | + | |
194 | + // cleanup only required if window mode isn't used | |
195 | + if (!ed.getParam('fullscreen_new_window')) { | |
196 | + tinymce.dom.Event.remove(DOM.win, 'resize', t.resizeFunc); | |
197 | + delete t.resizeFunc; | |
198 | + | |
199 | + DOM.remove('mce_fullscreen_container'); | |
200 | + | |
201 | + DOM.doc.documentElement.style.overflow = settings.fullscreen_html_overflow; | |
202 | + DOM.setStyle(DOM.doc.body, 'overflow', settings.fullscreen_overflow); | |
203 | + DOM.win.scrollTo(settings.fullscreen_scrollx, settings.fullscreen_scrolly); | |
204 | + } | |
205 | + tinyMCE.settings = tinyMCE.oldSettings; // Restore old settings | |
206 | + | |
207 | + // clear variables | |
208 | + delete tinyMCE.oldSettings; | |
209 | + delete t.fullscreenEditor; | |
210 | + delete t.fullscreenElement; | |
211 | + delete t.fullscreenSettings; | |
212 | + | |
213 | + // allow the fullscreen editor to be removed before restoring focus and selection | |
214 | + DOM.win.setTimeout(function() { | |
215 | + ed.selection.moveToBookmark(bookmark); | |
216 | + ed.focus(); | |
217 | + }, 10); | |
218 | + }; | |
144 | 219 | }, |
145 | 220 | |
146 | 221 | getInfo : function() { |
... | ... | @@ -156,4 +231,4 @@ |
156 | 231 | |
157 | 232 | // Register plugin |
158 | 233 | tinymce.PluginManager.add('fullscreen', tinymce.plugins.FullScreenPlugin); |
159 | -})(); | |
160 | 234 | \ No newline at end of file |
235 | +})(); | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/fullscreen/fullscreen.htm
1 | -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
1 | +<!DOCTYPE html> | |
2 | 2 | <html xmlns="http://www.w3.org/1999/xhtml"> |
3 | 3 | <head> |
4 | 4 | <title></title> |
5 | + <meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
5 | 6 | <script type="text/javascript" src="../../tiny_mce.js"></script> |
6 | 7 | <script type="text/javascript"> |
7 | 8 | function patchCallback(settings, key) { |
... | ... | @@ -45,7 +46,7 @@ |
45 | 46 | settings['strict_loading_mode'] = true; |
46 | 47 | |
47 | 48 | settings.save_onsavecallback = function() { |
48 | - window.opener.tinyMCE.get(oeID).setContent(tinyMCE.get('fullscreenarea').getContent({format : 'raw'}), {format : 'raw'}); | |
49 | + moveContent(); | |
49 | 50 | window.opener.tinyMCE.get(oeID).execCommand('mceSave'); |
50 | 51 | window.close(); |
51 | 52 | }; |
... | ... | @@ -55,11 +56,15 @@ |
55 | 56 | } |
56 | 57 | |
57 | 58 | function moveContent() { |
58 | - window.opener.tinyMCE.get(oeID).setContent(tinyMCE.activeEditor.getContent()); | |
59 | + // find the original editor, execute restore state in it's plugin instance | |
60 | + window.opener.tinyMCE.get(oeID).plugins.fullscreen.saveState(tinyMCE.activeEditor); | |
61 | + | |
62 | + // prevent moveContent from being called twice - e.g. if the unloadHandler runs after moveContent() | |
63 | + tinymce.dom.Event.remove(window, "beforeunload", unloadHandler); | |
59 | 64 | } |
60 | 65 | |
61 | 66 | function closeFullscreen() { |
62 | - moveContent(); | |
67 | + // moveContent() will be called by the unload handler | |
63 | 68 | window.close(); |
64 | 69 | } |
65 | 70 | |
... | ... | @@ -77,17 +82,20 @@ |
77 | 82 | function render() { |
78 | 83 | var e = document.getElementById('fullscreenarea'), vp, ed, ow, oh, dom = tinymce.DOM; |
79 | 84 | |
80 | - e.value = window.opener.tinyMCE.get(oeID).getContent(); | |
81 | - | |
82 | 85 | vp = dom.getViewPort(); |
83 | 86 | settings.width = vp.w; |
84 | 87 | settings.height = vp.h - 15; |
85 | 88 | |
86 | - tinymce.dom.Event.add(window, 'resize', function() { | |
87 | - var vp = dom.getViewPort(); | |
89 | + settings.oninit = function() { | |
90 | + var ed = tinyMCE.activeEditor; | |
91 | + window.opener.tinyMCE.get(oeID).plugins.fullscreen.loadState(ed); | |
92 | + | |
93 | + tinymce.dom.Event.add(window, 'resize', function() { | |
94 | + var vp = dom.getViewPort(); | |
88 | 95 | |
89 | - tinyMCE.activeEditor.theme.resizeTo(vp.w, vp.h); | |
90 | - }); | |
96 | + tinyMCE.activeEditor.theme.resizeTo(vp.w, vp.h); | |
97 | + }); | |
98 | + } | |
91 | 99 | |
92 | 100 | tinyMCE.init(settings); |
93 | 101 | } | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/inlinepopups/editor_plugin.js
1 | -(function(){var d=tinymce.DOM,b=tinymce.dom.Element,a=tinymce.dom.Event,e=tinymce.each,c=tinymce.is;tinymce.create("tinymce.plugins.InlinePopups",{init:function(f,g){f.onBeforeRenderUI.add(function(){f.windowManager=new tinymce.InlineWindowManager(f);d.loadCSS(g+"/skins/"+(f.settings.inlinepopups_skin||"clearlooks2")+"/window.css")})},getInfo:function(){return{longname:"InlinePopups",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.create("tinymce.InlineWindowManager:tinymce.WindowManager",{InlineWindowManager:function(f){var g=this;g.parent(f);g.zIndex=300000;g.count=0;g.windows={}},open:function(s,j){var z=this,i,k="",r=z.editor,g=0,v=0,h,m,o,q,l,x,y,n;s=s||{};j=j||{};if(!s.inline){return z.parent(s,j)}n=z._frontWindow();if(n&&d.get(n.id+"_ifr")){n.focussedElement=d.get(n.id+"_ifr").contentWindow.document.activeElement}if(!s.type){z.bookmark=r.selection.getBookmark(1)}i=d.uniqueId();h=d.getViewPort();s.width=parseInt(s.width||320);s.height=parseInt(s.height||240)+(tinymce.isIE?8:0);s.min_width=parseInt(s.min_width||150);s.min_height=parseInt(s.min_height||100);s.max_width=parseInt(s.max_width||2000);s.max_height=parseInt(s.max_height||2000);s.left=s.left||Math.round(Math.max(h.x,h.x+(h.w/2)-(s.width/2)));s.top=s.top||Math.round(Math.max(h.y,h.y+(h.h/2)-(s.height/2)));s.movable=s.resizable=true;j.mce_width=s.width;j.mce_height=s.height;j.mce_inline=true;j.mce_window_id=i;j.mce_auto_focus=s.auto_focus;z.features=s;z.params=j;z.onOpen.dispatch(z,s,j);if(s.type){k+=" mceModal";if(s.type){k+=" mce"+s.type.substring(0,1).toUpperCase()+s.type.substring(1)}s.resizable=false}if(s.statusbar){k+=" mceStatusbar"}if(s.resizable){k+=" mceResizable"}if(s.minimizable){k+=" mceMinimizable"}if(s.maximizable){k+=" mceMaximizable"}if(s.movable){k+=" mceMovable"}z._addAll(d.doc.body,["div",{id:i,role:"dialog","aria-labelledby":s.type?i+"_content":i+"_title","class":(r.settings.inlinepopups_skin||"clearlooks2")+(tinymce.isIE&&window.getSelection?" ie9":""),style:"width:100px;height:100px"},["div",{id:i+"_wrapper","class":"mceWrapper"+k},["div",{id:i+"_top","class":"mceTop"},["div",{"class":"mceLeft"}],["div",{"class":"mceCenter"}],["div",{"class":"mceRight"}],["span",{id:i+"_title"},s.title||""]],["div",{id:i+"_middle","class":"mceMiddle"},["div",{id:i+"_left","class":"mceLeft",tabindex:"0"}],["span",{id:i+"_content"}],["div",{id:i+"_right","class":"mceRight",tabindex:"0"}]],["div",{id:i+"_bottom","class":"mceBottom"},["div",{"class":"mceLeft"}],["div",{"class":"mceCenter"}],["div",{"class":"mceRight"}],["span",{id:i+"_status"},"Content"]],["a",{"class":"mceMove",tabindex:"-1",href:"javascript:;"}],["a",{"class":"mceMin",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceMax",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceMed",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceClose",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{id:i+"_resize_n","class":"mceResize mceResizeN",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_s","class":"mceResize mceResizeS",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_w","class":"mceResize mceResizeW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_e","class":"mceResize mceResizeE",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_nw","class":"mceResize mceResizeNW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_ne","class":"mceResize mceResizeNE",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_sw","class":"mceResize mceResizeSW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_se","class":"mceResize mceResizeSE",tabindex:"-1",href:"javascript:;"}]]]);d.setStyles(i,{top:-10000,left:-10000});if(tinymce.isGecko){d.setStyle(i,"overflow","auto")}if(!s.type){g+=d.get(i+"_left").clientWidth;g+=d.get(i+"_right").clientWidth;v+=d.get(i+"_top").clientHeight;v+=d.get(i+"_bottom").clientHeight}d.setStyles(i,{top:s.top,left:s.left,width:s.width+g,height:s.height+v});y=s.url||s.file;if(y){if(tinymce.relaxedDomain){y+=(y.indexOf("?")==-1?"?":"&")+"mce_rdomain="+tinymce.relaxedDomain}y=tinymce._addVer(y)}if(!s.type){d.add(i+"_content","iframe",{id:i+"_ifr",src:'javascript:""',frameBorder:0,style:"border:0;width:10px;height:10px"});d.setStyles(i+"_ifr",{width:s.width,height:s.height});d.setAttrib(i+"_ifr","src",y)}else{d.add(i+"_wrapper","a",{id:i+"_ok","class":"mceButton mceOk",href:"javascript:;",onmousedown:"return false;"},"Ok");if(s.type=="confirm"){d.add(i+"_wrapper","a",{"class":"mceButton mceCancel",href:"javascript:;",onmousedown:"return false;"},"Cancel")}d.add(i+"_middle","div",{"class":"mceIcon"});d.setHTML(i+"_content",s.content.replace("\n","<br />"));a.add(i,"keyup",function(f){var p=27;if(f.keyCode===p){s.button_func(false);return a.cancel(f)}});a.add(i,"keydown",function(f){var t,p=9;if(f.keyCode===p){t=d.select("a.mceCancel",i+"_wrapper")[0];if(t&&t!==f.target){t.focus()}else{d.get(i+"_ok").focus()}return a.cancel(f)}})}o=a.add(i,"mousedown",function(t){var u=t.target,f,p;f=z.windows[i];z.focus(i);if(u.nodeName=="A"||u.nodeName=="a"){if(u.className=="mceMax"){f.oldPos=f.element.getXY();f.oldSize=f.element.getSize();p=d.getViewPort();p.w-=2;p.h-=2;f.element.moveTo(p.x,p.y);f.element.resizeTo(p.w,p.h);d.setStyles(i+"_ifr",{width:p.w-f.deltaWidth,height:p.h-f.deltaHeight});d.addClass(i+"_wrapper","mceMaximized")}else{if(u.className=="mceMed"){f.element.moveTo(f.oldPos.x,f.oldPos.y);f.element.resizeTo(f.oldSize.w,f.oldSize.h);f.iframeElement.resizeTo(f.oldSize.w-f.deltaWidth,f.oldSize.h-f.deltaHeight);d.removeClass(i+"_wrapper","mceMaximized")}else{if(u.className=="mceMove"){return z._startDrag(i,t,u.className)}else{if(d.hasClass(u,"mceResize")){return z._startDrag(i,t,u.className.substring(13))}}}}}});q=a.add(i,"click",function(f){var p=f.target;z.focus(i);if(p.nodeName=="A"||p.nodeName=="a"){switch(p.className){case"mceClose":z.close(null,i);return a.cancel(f);case"mceButton mceOk":case"mceButton mceCancel":s.button_func(p.className=="mceButton mceOk");return a.cancel(f)}}});a.add([i+"_left",i+"_right"],"focus",function(p){var t=d.get(i+"_ifr");if(t){var f=t.contentWindow.document.body;var u=d.select(":input:enabled,*[tabindex=0]",f);if(p.target.id===(i+"_left")){u[u.length-1].focus()}else{u[0].focus()}}else{d.get(i+"_ok").focus()}});x=z.windows[i]={id:i,mousedown_func:o,click_func:q,element:new b(i,{blocker:1,container:r.getContainer()}),iframeElement:new b(i+"_ifr"),features:s,deltaWidth:g,deltaHeight:v};x.iframeElement.on("focus",function(){z.focus(i)});if(z.count==0&&z.editor.getParam("dialog_type","modal")=="modal"){d.add(d.doc.body,"div",{id:"mceModalBlocker","class":(z.editor.settings.inlinepopups_skin||"clearlooks2")+"_modalBlocker",style:{zIndex:z.zIndex-1}});d.show("mceModalBlocker");d.setAttrib(d.doc.body,"aria-hidden","true")}else{d.setStyle("mceModalBlocker","z-index",z.zIndex-1)}if(tinymce.isIE6||/Firefox\/2\./.test(navigator.userAgent)||(tinymce.isIE&&!d.boxModel)){d.setStyles("mceModalBlocker",{position:"absolute",left:h.x,top:h.y,width:h.w-2,height:h.h-2})}d.setAttrib(i,"aria-hidden","false");z.focus(i);z._fixIELayout(i,1);if(d.get(i+"_ok")){d.get(i+"_ok").focus()}z.count++;return x},focus:function(h){var g=this,f;if(f=g.windows[h]){f.zIndex=this.zIndex++;f.element.setStyle("zIndex",f.zIndex);f.element.update();h=h+"_wrapper";d.removeClass(g.lastId,"mceFocus");d.addClass(h,"mceFocus");g.lastId=h;if(f.focussedElement){f.focussedElement.focus()}else{if(d.get(h+"_ok")){d.get(f.id+"_ok").focus()}else{if(d.get(f.id+"_ifr")){d.get(f.id+"_ifr").focus()}}}}},_addAll:function(k,h){var g,l,f=this,j=tinymce.DOM;if(c(h,"string")){k.appendChild(j.doc.createTextNode(h))}else{if(h.length){k=k.appendChild(j.create(h[0],h[1]));for(g=2;g<h.length;g++){f._addAll(k,h[g])}}}},_startDrag:function(v,G,E){var o=this,u,z,C=d.doc,f,l=o.windows[v],h=l.element,y=h.getXY(),x,q,F,g,A,s,r,j,i,m,k,n,B;g={x:0,y:0};A=d.getViewPort();A.w-=2;A.h-=2;j=G.screenX;i=G.screenY;m=k=n=B=0;u=a.add(C,"mouseup",function(p){a.remove(C,"mouseup",u);a.remove(C,"mousemove",z);if(f){f.remove()}h.moveBy(m,k);h.resizeBy(n,B);q=h.getSize();d.setStyles(v+"_ifr",{width:q.w-l.deltaWidth,height:q.h-l.deltaHeight});o._fixIELayout(v,1);return a.cancel(p)});if(E!="Move"){D()}function D(){if(f){return}o._fixIELayout(v,0);d.add(C.body,"div",{id:"mceEventBlocker","class":"mceEventBlocker "+(o.editor.settings.inlinepopups_skin||"clearlooks2"),style:{zIndex:o.zIndex+1}});if(tinymce.isIE6||(tinymce.isIE&&!d.boxModel)){d.setStyles("mceEventBlocker",{position:"absolute",left:A.x,top:A.y,width:A.w-2,height:A.h-2})}f=new b("mceEventBlocker");f.update();x=h.getXY();q=h.getSize();s=g.x+x.x-A.x;r=g.y+x.y-A.y;d.add(f.get(),"div",{id:"mcePlaceHolder","class":"mcePlaceHolder",style:{left:s,top:r,width:q.w,height:q.h}});F=new b("mcePlaceHolder")}z=a.add(C,"mousemove",function(w){var p,H,t;D();p=w.screenX-j;H=w.screenY-i;switch(E){case"ResizeW":m=p;n=0-p;break;case"ResizeE":n=p;break;case"ResizeN":case"ResizeNW":case"ResizeNE":if(E=="ResizeNW"){m=p;n=0-p}else{if(E=="ResizeNE"){n=p}}k=H;B=0-H;break;case"ResizeS":case"ResizeSW":case"ResizeSE":if(E=="ResizeSW"){m=p;n=0-p}else{if(E=="ResizeSE"){n=p}}B=H;break;case"mceMove":m=p;k=H;break}if(n<(t=l.features.min_width-q.w)){if(m!==0){m+=n-t}n=t}if(B<(t=l.features.min_height-q.h)){if(k!==0){k+=B-t}B=t}n=Math.min(n,l.features.max_width-q.w);B=Math.min(B,l.features.max_height-q.h);m=Math.max(m,A.x-(s+A.x));k=Math.max(k,A.y-(r+A.y));m=Math.min(m,(A.w+A.x)-(s+q.w+A.x));k=Math.min(k,(A.h+A.y)-(r+q.h+A.y));if(m+k!==0){if(s+m<0){m=0}if(r+k<0){k=0}F.moveTo(s+m,r+k)}if(n+B!==0){F.resizeTo(q.w+n,q.h+B)}return a.cancel(w)});return a.cancel(G)},resizeBy:function(g,h,i){var f=this.windows[i];if(f){f.element.resizeBy(g,h);f.iframeElement.resizeBy(g,h)}},close:function(i,k){var g=this,f,j=d.doc,h,k;k=g._findId(k||i);if(!g.windows[k]){g.parent(i);return}g.count--;if(g.count==0){d.remove("mceModalBlocker");d.setAttrib(d.doc.body,"aria-hidden","false");g.editor.focus()}if(f=g.windows[k]){g.onClose.dispatch(g);a.remove(j,"mousedown",f.mousedownFunc);a.remove(j,"click",f.clickFunc);a.clear(k);a.clear(k+"_ifr");d.setAttrib(k+"_ifr","src",'javascript:""');f.element.remove();delete g.windows[k];h=g._frontWindow();if(h){g.focus(h.id)}}},_frontWindow:function(){var g,f=0;e(this.windows,function(h){if(h.zIndex>f){g=h;f=h.zIndex}});return g},setTitle:function(f,g){var h;f=this._findId(f);if(h=d.get(f+"_title")){h.innerHTML=d.encode(g)}},alert:function(g,f,j){var i=this,h;h=i.open({title:i,type:"alert",button_func:function(k){if(f){f.call(k||i,k)}i.close(null,h.id)},content:d.encode(i.editor.getLang(g,g)),inline:1,width:400,height:130})},confirm:function(g,f,j){var i=this,h;h=i.open({title:i,type:"confirm",button_func:function(k){if(f){f.call(k||i,k)}i.close(null,h.id)},content:d.encode(i.editor.getLang(g,g)),inline:1,width:400,height:130})},_findId:function(f){var g=this;if(typeof(f)=="string"){return f}e(g.windows,function(h){var i=d.get(h.id+"_ifr");if(i&&f==i.contentWindow){f=h.id;return false}});return f},_fixIELayout:function(i,h){var f,g;if(!tinymce.isIE6){return}e(["n","s","w","e","nw","ne","sw","se"],function(j){var k=d.get(i+"_resize_"+j);d.setStyles(k,{width:h?k.clientWidth:"",height:h?k.clientHeight:"",cursor:d.getStyle(k,"cursor",1)});d.setStyle(i+"_bottom","bottom","-1px");k=0});if(f=this.windows[i]){f.element.hide();f.element.show();e(d.select("div,a",i),function(k,j){if(k.currentStyle.backgroundImage!="none"){g=new Image();g.src=k.currentStyle.backgroundImage.replace(/url\(\"(.+)\"\)/,"$1")}});d.get(i).style.filter=""}}});tinymce.PluginManager.add("inlinepopups",tinymce.plugins.InlinePopups)})(); | |
2 | 1 | \ No newline at end of file |
2 | +(function(){var d=tinymce.DOM,b=tinymce.dom.Element,a=tinymce.dom.Event,e=tinymce.each,c=tinymce.is;tinymce.create("tinymce.plugins.InlinePopups",{init:function(f,g){f.onBeforeRenderUI.add(function(){f.windowManager=new tinymce.InlineWindowManager(f);d.loadCSS(g+"/skins/"+(f.settings.inlinepopups_skin||"clearlooks2")+"/window.css")})},getInfo:function(){return{longname:"InlinePopups",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.create("tinymce.InlineWindowManager:tinymce.WindowManager",{InlineWindowManager:function(f){var g=this;g.parent(f);g.zIndex=300000;g.count=0;g.windows={}},open:function(s,j){var z=this,i,k="",r=z.editor,g=0,v=0,h,m,o,q,l,x,y,n;s=s||{};j=j||{};if(!s.inline){return z.parent(s,j)}n=z._frontWindow();if(n&&d.get(n.id+"_ifr")){n.focussedElement=d.get(n.id+"_ifr").contentWindow.document.activeElement}if(!s.type){z.bookmark=r.selection.getBookmark(1)}i=d.uniqueId("mce_inlinepopups_");h=d.getViewPort();s.width=parseInt(s.width||320);s.height=parseInt(s.height||240)+(tinymce.isIE?8:0);s.min_width=parseInt(s.min_width||150);s.min_height=parseInt(s.min_height||100);s.max_width=parseInt(s.max_width||2000);s.max_height=parseInt(s.max_height||2000);s.left=s.left||Math.round(Math.max(h.x,h.x+(h.w/2)-(s.width/2)));s.top=s.top||Math.round(Math.max(h.y,h.y+(h.h/2)-(s.height/2)));s.movable=s.resizable=true;j.mce_width=s.width;j.mce_height=s.height;j.mce_inline=true;j.mce_window_id=i;j.mce_auto_focus=s.auto_focus;z.features=s;z.params=j;z.onOpen.dispatch(z,s,j);if(s.type){k+=" mceModal";if(s.type){k+=" mce"+s.type.substring(0,1).toUpperCase()+s.type.substring(1)}s.resizable=false}if(s.statusbar){k+=" mceStatusbar"}if(s.resizable){k+=" mceResizable"}if(s.minimizable){k+=" mceMinimizable"}if(s.maximizable){k+=" mceMaximizable"}if(s.movable){k+=" mceMovable"}z._addAll(d.doc.body,["div",{id:i,role:"dialog","aria-labelledby":s.type?i+"_content":i+"_title","class":(r.settings.inlinepopups_skin||"clearlooks2")+(tinymce.isIE&&window.getSelection?" ie9":""),style:"width:100px;height:100px"},["div",{id:i+"_wrapper","class":"mceWrapper"+k},["div",{id:i+"_top","class":"mceTop"},["div",{"class":"mceLeft"}],["div",{"class":"mceCenter"}],["div",{"class":"mceRight"}],["span",{id:i+"_title"},s.title||""]],["div",{id:i+"_middle","class":"mceMiddle"},["div",{id:i+"_left","class":"mceLeft",tabindex:"0"}],["span",{id:i+"_content"}],["div",{id:i+"_right","class":"mceRight",tabindex:"0"}]],["div",{id:i+"_bottom","class":"mceBottom"},["div",{"class":"mceLeft"}],["div",{"class":"mceCenter"}],["div",{"class":"mceRight"}],["span",{id:i+"_status"},"Content"]],["a",{"class":"mceMove",tabindex:"-1",href:"javascript:;"}],["a",{"class":"mceMin",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceMax",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceMed",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceClose",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{id:i+"_resize_n","class":"mceResize mceResizeN",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_s","class":"mceResize mceResizeS",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_w","class":"mceResize mceResizeW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_e","class":"mceResize mceResizeE",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_nw","class":"mceResize mceResizeNW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_ne","class":"mceResize mceResizeNE",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_sw","class":"mceResize mceResizeSW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_se","class":"mceResize mceResizeSE",tabindex:"-1",href:"javascript:;"}]]]);d.setStyles(i,{top:-10000,left:-10000});if(tinymce.isGecko){d.setStyle(i,"overflow","auto")}if(!s.type){g+=d.get(i+"_left").clientWidth;g+=d.get(i+"_right").clientWidth;v+=d.get(i+"_top").clientHeight;v+=d.get(i+"_bottom").clientHeight}d.setStyles(i,{top:s.top,left:s.left,width:s.width+g,height:s.height+v});y=s.url||s.file;if(y){if(tinymce.relaxedDomain){y+=(y.indexOf("?")==-1?"?":"&")+"mce_rdomain="+tinymce.relaxedDomain}y=tinymce._addVer(y)}if(!s.type){d.add(i+"_content","iframe",{id:i+"_ifr",src:'javascript:""',frameBorder:0,style:"border:0;width:10px;height:10px"});d.setStyles(i+"_ifr",{width:s.width,height:s.height});d.setAttrib(i+"_ifr","src",y)}else{d.add(i+"_wrapper","a",{id:i+"_ok","class":"mceButton mceOk",href:"javascript:;",onmousedown:"return false;"},"Ok");if(s.type=="confirm"){d.add(i+"_wrapper","a",{"class":"mceButton mceCancel",href:"javascript:;",onmousedown:"return false;"},"Cancel")}d.add(i+"_middle","div",{"class":"mceIcon"});d.setHTML(i+"_content",s.content.replace("\n","<br />"));a.add(i,"keyup",function(f){var p=27;if(f.keyCode===p){s.button_func(false);return a.cancel(f)}});a.add(i,"keydown",function(f){var t,p=9;if(f.keyCode===p){t=d.select("a.mceCancel",i+"_wrapper")[0];if(t&&t!==f.target){t.focus()}else{d.get(i+"_ok").focus()}return a.cancel(f)}})}o=a.add(i,"mousedown",function(t){var u=t.target,f,p;f=z.windows[i];z.focus(i);if(u.nodeName=="A"||u.nodeName=="a"){if(u.className=="mceClose"){z.close(null,i);return a.cancel(t)}else{if(u.className=="mceMax"){f.oldPos=f.element.getXY();f.oldSize=f.element.getSize();p=d.getViewPort();p.w-=2;p.h-=2;f.element.moveTo(p.x,p.y);f.element.resizeTo(p.w,p.h);d.setStyles(i+"_ifr",{width:p.w-f.deltaWidth,height:p.h-f.deltaHeight});d.addClass(i+"_wrapper","mceMaximized")}else{if(u.className=="mceMed"){f.element.moveTo(f.oldPos.x,f.oldPos.y);f.element.resizeTo(f.oldSize.w,f.oldSize.h);f.iframeElement.resizeTo(f.oldSize.w-f.deltaWidth,f.oldSize.h-f.deltaHeight);d.removeClass(i+"_wrapper","mceMaximized")}else{if(u.className=="mceMove"){return z._startDrag(i,t,u.className)}else{if(d.hasClass(u,"mceResize")){return z._startDrag(i,t,u.className.substring(13))}}}}}}});q=a.add(i,"click",function(f){var p=f.target;z.focus(i);if(p.nodeName=="A"||p.nodeName=="a"){switch(p.className){case"mceClose":z.close(null,i);return a.cancel(f);case"mceButton mceOk":case"mceButton mceCancel":s.button_func(p.className=="mceButton mceOk");return a.cancel(f)}}});a.add([i+"_left",i+"_right"],"focus",function(p){var t=d.get(i+"_ifr");if(t){var f=t.contentWindow.document.body;var u=d.select(":input:enabled,*[tabindex=0]",f);if(p.target.id===(i+"_left")){u[u.length-1].focus()}else{u[0].focus()}}else{d.get(i+"_ok").focus()}});x=z.windows[i]={id:i,mousedown_func:o,click_func:q,element:new b(i,{blocker:1,container:r.getContainer()}),iframeElement:new b(i+"_ifr"),features:s,deltaWidth:g,deltaHeight:v};x.iframeElement.on("focus",function(){z.focus(i)});if(z.count==0&&z.editor.getParam("dialog_type","modal")=="modal"){d.add(d.doc.body,"div",{id:"mceModalBlocker","class":(z.editor.settings.inlinepopups_skin||"clearlooks2")+"_modalBlocker",style:{zIndex:z.zIndex-1}});d.show("mceModalBlocker");d.setAttrib(d.doc.body,"aria-hidden","true")}else{d.setStyle("mceModalBlocker","z-index",z.zIndex-1)}if(tinymce.isIE6||/Firefox\/2\./.test(navigator.userAgent)||(tinymce.isIE&&!d.boxModel)){d.setStyles("mceModalBlocker",{position:"absolute",left:h.x,top:h.y,width:h.w-2,height:h.h-2})}d.setAttrib(i,"aria-hidden","false");z.focus(i);z._fixIELayout(i,1);if(d.get(i+"_ok")){d.get(i+"_ok").focus()}z.count++;return x},focus:function(h){var g=this,f;if(f=g.windows[h]){f.zIndex=this.zIndex++;f.element.setStyle("zIndex",f.zIndex);f.element.update();h=h+"_wrapper";d.removeClass(g.lastId,"mceFocus");d.addClass(h,"mceFocus");g.lastId=h;if(f.focussedElement){f.focussedElement.focus()}else{if(d.get(h+"_ok")){d.get(f.id+"_ok").focus()}else{if(d.get(f.id+"_ifr")){d.get(f.id+"_ifr").focus()}}}}},_addAll:function(k,h){var g,l,f=this,j=tinymce.DOM;if(c(h,"string")){k.appendChild(j.doc.createTextNode(h))}else{if(h.length){k=k.appendChild(j.create(h[0],h[1]));for(g=2;g<h.length;g++){f._addAll(k,h[g])}}}},_startDrag:function(v,G,E){var o=this,u,z,C=d.doc,f,l=o.windows[v],h=l.element,y=h.getXY(),x,q,F,g,A,s,r,j,i,m,k,n,B;g={x:0,y:0};A=d.getViewPort();A.w-=2;A.h-=2;j=G.screenX;i=G.screenY;m=k=n=B=0;u=a.add(C,"mouseup",function(p){a.remove(C,"mouseup",u);a.remove(C,"mousemove",z);if(f){f.remove()}h.moveBy(m,k);h.resizeBy(n,B);q=h.getSize();d.setStyles(v+"_ifr",{width:q.w-l.deltaWidth,height:q.h-l.deltaHeight});o._fixIELayout(v,1);return a.cancel(p)});if(E!="Move"){D()}function D(){if(f){return}o._fixIELayout(v,0);d.add(C.body,"div",{id:"mceEventBlocker","class":"mceEventBlocker "+(o.editor.settings.inlinepopups_skin||"clearlooks2"),style:{zIndex:o.zIndex+1}});if(tinymce.isIE6||(tinymce.isIE&&!d.boxModel)){d.setStyles("mceEventBlocker",{position:"absolute",left:A.x,top:A.y,width:A.w-2,height:A.h-2})}f=new b("mceEventBlocker");f.update();x=h.getXY();q=h.getSize();s=g.x+x.x-A.x;r=g.y+x.y-A.y;d.add(f.get(),"div",{id:"mcePlaceHolder","class":"mcePlaceHolder",style:{left:s,top:r,width:q.w,height:q.h}});F=new b("mcePlaceHolder")}z=a.add(C,"mousemove",function(w){var p,H,t;D();p=w.screenX-j;H=w.screenY-i;switch(E){case"ResizeW":m=p;n=0-p;break;case"ResizeE":n=p;break;case"ResizeN":case"ResizeNW":case"ResizeNE":if(E=="ResizeNW"){m=p;n=0-p}else{if(E=="ResizeNE"){n=p}}k=H;B=0-H;break;case"ResizeS":case"ResizeSW":case"ResizeSE":if(E=="ResizeSW"){m=p;n=0-p}else{if(E=="ResizeSE"){n=p}}B=H;break;case"mceMove":m=p;k=H;break}if(n<(t=l.features.min_width-q.w)){if(m!==0){m+=n-t}n=t}if(B<(t=l.features.min_height-q.h)){if(k!==0){k+=B-t}B=t}n=Math.min(n,l.features.max_width-q.w);B=Math.min(B,l.features.max_height-q.h);m=Math.max(m,A.x-(s+A.x));k=Math.max(k,A.y-(r+A.y));m=Math.min(m,(A.w+A.x)-(s+q.w+A.x));k=Math.min(k,(A.h+A.y)-(r+q.h+A.y));if(m+k!==0){if(s+m<0){m=0}if(r+k<0){k=0}F.moveTo(s+m,r+k)}if(n+B!==0){F.resizeTo(q.w+n,q.h+B)}return a.cancel(w)});return a.cancel(G)},resizeBy:function(g,h,i){var f=this.windows[i];if(f){f.element.resizeBy(g,h);f.iframeElement.resizeBy(g,h)}},close:function(i,k){var g=this,f,j=d.doc,h,k;k=g._findId(k||i);if(!g.windows[k]){g.parent(i);return}g.count--;if(g.count==0){d.remove("mceModalBlocker");d.setAttrib(d.doc.body,"aria-hidden","false");g.editor.focus()}if(f=g.windows[k]){g.onClose.dispatch(g);a.remove(j,"mousedown",f.mousedownFunc);a.remove(j,"click",f.clickFunc);a.clear(k);a.clear(k+"_ifr");d.setAttrib(k+"_ifr","src",'javascript:""');f.element.remove();delete g.windows[k];h=g._frontWindow();if(h){g.focus(h.id)}}},_frontWindow:function(){var g,f=0;e(this.windows,function(h){if(h.zIndex>f){g=h;f=h.zIndex}});return g},setTitle:function(f,g){var h;f=this._findId(f);if(h=d.get(f+"_title")){h.innerHTML=d.encode(g)}},alert:function(g,f,j){var i=this,h;h=i.open({title:i,type:"alert",button_func:function(k){if(f){f.call(k||i,k)}i.close(null,h.id)},content:d.encode(i.editor.getLang(g,g)),inline:1,width:400,height:130})},confirm:function(g,f,j){var i=this,h;h=i.open({title:i,type:"confirm",button_func:function(k){if(f){f.call(k||i,k)}i.close(null,h.id)},content:d.encode(i.editor.getLang(g,g)),inline:1,width:400,height:130})},_findId:function(f){var g=this;if(typeof(f)=="string"){return f}e(g.windows,function(h){var i=d.get(h.id+"_ifr");if(i&&f==i.contentWindow){f=h.id;return false}});return f},_fixIELayout:function(i,h){var f,g;if(!tinymce.isIE6){return}e(["n","s","w","e","nw","ne","sw","se"],function(j){var k=d.get(i+"_resize_"+j);d.setStyles(k,{width:h?k.clientWidth:"",height:h?k.clientHeight:"",cursor:d.getStyle(k,"cursor",1)});d.setStyle(i+"_bottom","bottom","-1px");k=0});if(f=this.windows[i]){f.element.hide();f.element.show();e(d.select("div,a",i),function(k,j){if(k.currentStyle.backgroundImage!="none"){g=new Image();g.src=k.currentStyle.backgroundImage.replace(/url\(\"(.+)\"\)/,"$1")}});d.get(i).style.filter=""}}});tinymce.PluginManager.add("inlinepopups",tinymce.plugins.InlinePopups)})(); | |
3 | 3 | \ No newline at end of file | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/inlinepopups/editor_plugin_src.js
... | ... | @@ -55,12 +55,12 @@ |
55 | 55 | if (parentWindow && DOM.get(parentWindow.id + '_ifr')) { |
56 | 56 | parentWindow.focussedElement = DOM.get(parentWindow.id + '_ifr').contentWindow.document.activeElement; |
57 | 57 | } |
58 | - | |
58 | + | |
59 | 59 | // Only store selection if the type is a normal window |
60 | 60 | if (!f.type) |
61 | 61 | t.bookmark = ed.selection.getBookmark(1); |
62 | 62 | |
63 | - id = DOM.uniqueId(); | |
63 | + id = DOM.uniqueId("mce_inlinepopups_"); // Use a prefix so this can't conflict with other ids | |
64 | 64 | vp = DOM.getViewPort(); |
65 | 65 | f.width = parseInt(f.width || 320); |
66 | 66 | f.height = parseInt(f.height || 240) + (tinymce.isIE ? 8 : 0); |
... | ... | @@ -111,17 +111,17 @@ |
111 | 111 | opt += ' mceMovable'; |
112 | 112 | |
113 | 113 | // Create DOM objects |
114 | - t._addAll(DOM.doc.body, | |
115 | - ['div', {id : id, role : 'dialog', 'aria-labelledby': f.type ? id + '_content' : id + '_title', 'class' : (ed.settings.inlinepopups_skin || 'clearlooks2') + (tinymce.isIE && window.getSelection ? ' ie9' : ''), style : 'width:100px;height:100px'}, | |
114 | + t._addAll(DOM.doc.body, | |
115 | + ['div', {id : id, role : 'dialog', 'aria-labelledby': f.type ? id + '_content' : id + '_title', 'class' : (ed.settings.inlinepopups_skin || 'clearlooks2') + (tinymce.isIE && window.getSelection ? ' ie9' : ''), style : 'width:100px;height:100px'}, | |
116 | 116 | ['div', {id : id + '_wrapper', 'class' : 'mceWrapper' + opt}, |
117 | - ['div', {id : id + '_top', 'class' : 'mceTop'}, | |
117 | + ['div', {id : id + '_top', 'class' : 'mceTop'}, | |
118 | 118 | ['div', {'class' : 'mceLeft'}], |
119 | 119 | ['div', {'class' : 'mceCenter'}], |
120 | 120 | ['div', {'class' : 'mceRight'}], |
121 | 121 | ['span', {id : id + '_title'}, f.title || ''] |
122 | 122 | ], |
123 | 123 | |
124 | - ['div', {id : id + '_middle', 'class' : 'mceMiddle'}, | |
124 | + ['div', {id : id + '_middle', 'class' : 'mceMiddle'}, | |
125 | 125 | ['div', {id : id + '_left', 'class' : 'mceLeft', tabindex : '0'}], |
126 | 126 | ['span', {id : id + '_content'}], |
127 | 127 | ['div', {id : id + '_right', 'class' : 'mceRight', tabindex : '0'}] |
... | ... | @@ -188,7 +188,7 @@ |
188 | 188 | |
189 | 189 | DOM.add(id + '_middle', 'div', {'class' : 'mceIcon'}); |
190 | 190 | DOM.setHTML(id + '_content', f.content.replace('\n', '<br />')); |
191 | - | |
191 | + | |
192 | 192 | Event.add(id, 'keyup', function(evt) { |
193 | 193 | var VK_ESCAPE = 27; |
194 | 194 | if (evt.keyCode === VK_ESCAPE) { |
... | ... | @@ -219,7 +219,10 @@ |
219 | 219 | t.focus(id); |
220 | 220 | |
221 | 221 | if (n.nodeName == 'A' || n.nodeName == 'a') { |
222 | - if (n.className == 'mceMax') { | |
222 | + if (n.className == 'mceClose') { | |
223 | + t.close(null, id); | |
224 | + return Event.cancel(e); | |
225 | + } else if (n.className == 'mceMax') { | |
223 | 226 | w.oldPos = w.element.getXY(); |
224 | 227 | w.oldSize = w.element.getSize(); |
225 | 228 | |
... | ... | @@ -265,7 +268,7 @@ |
265 | 268 | } |
266 | 269 | } |
267 | 270 | }); |
268 | - | |
271 | + | |
269 | 272 | // Make sure the tab order loops within the dialog. |
270 | 273 | Event.add([id + '_left', id + '_right'], 'focus', function(evt) { |
271 | 274 | var iframe = DOM.get(id + '_ifr'); |
... | ... | @@ -281,7 +284,7 @@ |
281 | 284 | DOM.get(id + '_ok').focus(); |
282 | 285 | } |
283 | 286 | }); |
284 | - | |
287 | + | |
285 | 288 | // Add window |
286 | 289 | w = t.windows[id] = { |
287 | 290 | id : id, |
... | ... | @@ -338,7 +341,7 @@ |
338 | 341 | DOM.removeClass(t.lastId, 'mceFocus'); |
339 | 342 | DOM.addClass(id, 'mceFocus'); |
340 | 343 | t.lastId = id; |
341 | - | |
344 | + | |
342 | 345 | if (w.focussedElement) { |
343 | 346 | w.focussedElement.focus(); |
344 | 347 | } else if (DOM.get(id + '_ok')) { |
... | ... | @@ -483,7 +486,7 @@ |
483 | 486 | |
484 | 487 | dw = v; |
485 | 488 | } |
486 | - | |
489 | + | |
487 | 490 | if (dh < (v = w.features.min_height - sz.h)) { |
488 | 491 | if (dy !== 0) |
489 | 492 | dy += dh - v; |
... | ... | @@ -502,7 +505,7 @@ |
502 | 505 | if (dx + dy !== 0) { |
503 | 506 | if (sx + dx < 0) |
504 | 507 | dx = 0; |
505 | - | |
508 | + | |
506 | 509 | if (sy + dy < 0) |
507 | 510 | dy = 0; |
508 | 511 | |
... | ... | @@ -564,7 +567,7 @@ |
564 | 567 | t.focus(fw.id); |
565 | 568 | } |
566 | 569 | }, |
567 | - | |
570 | + | |
568 | 571 | // Find front most window |
569 | 572 | _frontWindow : function() { |
570 | 573 | var fw, ix = 0; | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif
public/javascripts/tinymce/jscripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/button.gif
public/javascripts/tinymce/jscripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif
public/javascripts/tinymce/jscripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif
public/javascripts/tinymce/jscripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif
public/javascripts/tinymce/jscripts/tiny_mce/plugins/layer/editor_plugin.js
1 | -(function(){tinymce.create("tinymce.plugins.Layer",{init:function(a,b){var c=this;c.editor=a;a.addCommand("mceInsertLayer",c._insertLayer,c);a.addCommand("mceMoveForward",function(){c._move(1)});a.addCommand("mceMoveBackward",function(){c._move(-1)});a.addCommand("mceMakeAbsolute",function(){c._toggleAbsolute()});a.addButton("moveforward",{title:"layer.forward_desc",cmd:"mceMoveForward"});a.addButton("movebackward",{title:"layer.backward_desc",cmd:"mceMoveBackward"});a.addButton("absolute",{title:"layer.absolute_desc",cmd:"mceMakeAbsolute"});a.addButton("insertlayer",{title:"layer.insertlayer_desc",cmd:"mceInsertLayer"});a.onInit.add(function(){if(tinymce.isIE){a.getDoc().execCommand("2D-Position",false,true)}});a.onNodeChange.add(c._nodeChange,c);a.onVisualAid.add(c._visualAid,c)},getInfo:function(){return{longname:"Layer",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/layer",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_nodeChange:function(b,a,e){var c,d;c=this._getParentLayer(e);d=b.dom.getParent(e,"DIV,P,IMG");if(!d){a.setDisabled("absolute",1);a.setDisabled("moveforward",1);a.setDisabled("movebackward",1)}else{a.setDisabled("absolute",0);a.setDisabled("moveforward",!c);a.setDisabled("movebackward",!c);a.setActive("absolute",c&&c.style.position.toLowerCase()=="absolute")}},_visualAid:function(a,c,b){var d=a.dom;tinymce.each(d.select("div,p",c),function(f){if(/^(absolute|relative|static)$/i.test(f.style.position)){if(b){d.addClass(f,"mceItemVisualAid")}else{d.removeClass(f,"mceItemVisualAid")}}})},_move:function(h){var b=this.editor,f,g=[],e=this._getParentLayer(b.selection.getNode()),c=-1,j=-1,a;a=[];tinymce.walk(b.getBody(),function(d){if(d.nodeType==1&&/^(absolute|relative|static)$/i.test(d.style.position)){a.push(d)}},"childNodes");for(f=0;f<a.length;f++){g[f]=a[f].style.zIndex?parseInt(a[f].style.zIndex):0;if(c<0&&a[f]==e){c=f}}if(h<0){for(f=0;f<g.length;f++){if(g[f]<g[c]){j=f;break}}if(j>-1){a[c].style.zIndex=g[j];a[j].style.zIndex=g[c]}else{if(g[c]>0){a[c].style.zIndex=g[c]-1}}}else{for(f=0;f<g.length;f++){if(g[f]>g[c]){j=f;break}}if(j>-1){a[c].style.zIndex=g[j];a[j].style.zIndex=g[c]}else{a[c].style.zIndex=g[c]+1}}b.execCommand("mceRepaint")},_getParentLayer:function(a){return this.editor.dom.getParent(a,function(b){return b.nodeType==1&&/^(absolute|relative|static)$/i.test(b.style.position)})},_insertLayer:function(){var a=this.editor,b=a.dom.getPos(a.dom.getParent(a.selection.getNode(),"*"));a.dom.add(a.getBody(),"div",{style:{position:"absolute",left:b.x,top:(b.y>20?b.y:20),width:100,height:100},"class":"mceItemVisualAid"},a.selection.getContent()||a.getLang("layer.content"))},_toggleAbsolute:function(){var a=this.editor,b=this._getParentLayer(a.selection.getNode());if(!b){b=a.dom.getParent(a.selection.getNode(),"DIV,P,IMG")}if(b){if(b.style.position.toLowerCase()=="absolute"){a.dom.setStyles(b,{position:"",left:"",top:"",width:"",height:""});a.dom.removeClass(b,"mceItemVisualAid")}else{if(b.style.left==""){b.style.left=20+"px"}if(b.style.top==""){b.style.top=20+"px"}if(b.style.width==""){b.style.width=b.width?(b.width+"px"):"100px"}if(b.style.height==""){b.style.height=b.height?(b.height+"px"):"100px"}b.style.position="absolute";a.dom.setAttrib(b,"data-mce-style","");a.addVisual(a.getBody())}a.execCommand("mceRepaint");a.nodeChanged()}}});tinymce.PluginManager.add("layer",tinymce.plugins.Layer)})(); | |
2 | 1 | \ No newline at end of file |
2 | +(function(){function a(b){do{if(b.className&&b.className.indexOf("mceItemLayer")!=-1){return b}}while(b=b.parentNode)}tinymce.create("tinymce.plugins.Layer",{init:function(b,c){var d=this;d.editor=b;b.addCommand("mceInsertLayer",d._insertLayer,d);b.addCommand("mceMoveForward",function(){d._move(1)});b.addCommand("mceMoveBackward",function(){d._move(-1)});b.addCommand("mceMakeAbsolute",function(){d._toggleAbsolute()});b.addButton("moveforward",{title:"layer.forward_desc",cmd:"mceMoveForward"});b.addButton("movebackward",{title:"layer.backward_desc",cmd:"mceMoveBackward"});b.addButton("absolute",{title:"layer.absolute_desc",cmd:"mceMakeAbsolute"});b.addButton("insertlayer",{title:"layer.insertlayer_desc",cmd:"mceInsertLayer"});b.onInit.add(function(){var e=b.dom;if(tinymce.isIE){b.getDoc().execCommand("2D-Position",false,true)}});b.onMouseUp.add(function(f,h){var g=a(h.target);if(g){f.dom.setAttrib(g,"data-mce-style","")}});b.onMouseDown.add(function(f,j){var h=j.target,i=f.getDoc(),g;if(tinymce.isGecko){if(a(h)){if(i.designMode!=="on"){i.designMode="on";h=i.body;g=h.parentNode;g.removeChild(h);g.appendChild(h)}}else{if(i.designMode=="on"){i.designMode="off"}}}});b.onNodeChange.add(d._nodeChange,d);b.onVisualAid.add(d._visualAid,d)},getInfo:function(){return{longname:"Layer",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/layer",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_nodeChange:function(c,b,f){var d,e;d=this._getParentLayer(f);e=c.dom.getParent(f,"DIV,P,IMG");if(!e){b.setDisabled("absolute",1);b.setDisabled("moveforward",1);b.setDisabled("movebackward",1)}else{b.setDisabled("absolute",0);b.setDisabled("moveforward",!d);b.setDisabled("movebackward",!d);b.setActive("absolute",d&&d.style.position.toLowerCase()=="absolute")}},_visualAid:function(b,d,c){var f=b.dom;tinymce.each(f.select("div,p",d),function(g){if(/^(absolute|relative|fixed)$/i.test(g.style.position)){if(c){f.addClass(g,"mceItemVisualAid")}else{f.removeClass(g,"mceItemVisualAid")}f.addClass(g,"mceItemLayer")}})},_move:function(j){var c=this.editor,g,h=[],f=this._getParentLayer(c.selection.getNode()),e=-1,k=-1,b;b=[];tinymce.walk(c.getBody(),function(d){if(d.nodeType==1&&/^(absolute|relative|static)$/i.test(d.style.position)){b.push(d)}},"childNodes");for(g=0;g<b.length;g++){h[g]=b[g].style.zIndex?parseInt(b[g].style.zIndex):0;if(e<0&&b[g]==f){e=g}}if(j<0){for(g=0;g<h.length;g++){if(h[g]<h[e]){k=g;break}}if(k>-1){b[e].style.zIndex=h[k];b[k].style.zIndex=h[e]}else{if(h[e]>0){b[e].style.zIndex=h[e]-1}}}else{for(g=0;g<h.length;g++){if(h[g]>h[e]){k=g;break}}if(k>-1){b[e].style.zIndex=h[k];b[k].style.zIndex=h[e]}else{b[e].style.zIndex=h[e]+1}}c.execCommand("mceRepaint")},_getParentLayer:function(b){return this.editor.dom.getParent(b,function(c){return c.nodeType==1&&/^(absolute|relative|static)$/i.test(c.style.position)})},_insertLayer:function(){var c=this.editor,e=c.dom,d=e.getPos(e.getParent(c.selection.getNode(),"*")),b=c.getBody();c.dom.add(b,"div",{style:{position:"absolute",left:d.x,top:(d.y>20?d.y:20),width:100,height:100},"class":"mceItemVisualAid mceItemLayer"},c.selection.getContent()||c.getLang("layer.content"));if(tinymce.isIE){e.setHTML(b,b.innerHTML)}},_toggleAbsolute:function(){var b=this.editor,c=this._getParentLayer(b.selection.getNode());if(!c){c=b.dom.getParent(b.selection.getNode(),"DIV,P,IMG")}if(c){if(c.style.position.toLowerCase()=="absolute"){b.dom.setStyles(c,{position:"",left:"",top:"",width:"",height:""});b.dom.removeClass(c,"mceItemVisualAid");b.dom.removeClass(c,"mceItemLayer")}else{if(c.style.left==""){c.style.left=20+"px"}if(c.style.top==""){c.style.top=20+"px"}if(c.style.width==""){c.style.width=c.width?(c.width+"px"):"100px"}if(c.style.height==""){c.style.height=c.height?(c.height+"px"):"100px"}c.style.position="absolute";b.dom.setAttrib(c,"data-mce-style","");b.addVisual(b.getBody())}b.execCommand("mceRepaint");b.nodeChanged()}}});tinymce.PluginManager.add("layer",tinymce.plugins.Layer)})(); | |
3 | 3 | \ No newline at end of file | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/layer/editor_plugin_src.js
... | ... | @@ -9,6 +9,14 @@ |
9 | 9 | */ |
10 | 10 | |
11 | 11 | (function() { |
12 | + function findParentLayer(node) { | |
13 | + do { | |
14 | + if (node.className && node.className.indexOf('mceItemLayer') != -1) { | |
15 | + return node; | |
16 | + } | |
17 | + } while (node = node.parentNode); | |
18 | + }; | |
19 | + | |
12 | 20 | tinymce.create('tinymce.plugins.Layer', { |
13 | 21 | init : function(ed, url) { |
14 | 22 | var t = this; |
... | ... | @@ -37,10 +45,43 @@ |
37 | 45 | ed.addButton('insertlayer', {title : 'layer.insertlayer_desc', cmd : 'mceInsertLayer'}); |
38 | 46 | |
39 | 47 | ed.onInit.add(function() { |
48 | + var dom = ed.dom; | |
49 | + | |
40 | 50 | if (tinymce.isIE) |
41 | 51 | ed.getDoc().execCommand('2D-Position', false, true); |
42 | 52 | }); |
43 | 53 | |
54 | + // Remove serialized styles when selecting a layer since it might be changed by a drag operation | |
55 | + ed.onMouseUp.add(function(ed, e) { | |
56 | + var layer = findParentLayer(e.target); | |
57 | + | |
58 | + if (layer) { | |
59 | + ed.dom.setAttrib(layer, 'data-mce-style', ''); | |
60 | + } | |
61 | + }); | |
62 | + | |
63 | + // Fixes edit focus issues with layers on Gecko | |
64 | + // This will enable designMode while inside a layer and disable it when outside | |
65 | + ed.onMouseDown.add(function(ed, e) { | |
66 | + var node = e.target, doc = ed.getDoc(), parent; | |
67 | + | |
68 | + if (tinymce.isGecko) { | |
69 | + if (findParentLayer(node)) { | |
70 | + if (doc.designMode !== 'on') { | |
71 | + doc.designMode = 'on'; | |
72 | + | |
73 | + // Repaint caret | |
74 | + node = doc.body; | |
75 | + parent = node.parentNode; | |
76 | + parent.removeChild(node); | |
77 | + parent.appendChild(node); | |
78 | + } | |
79 | + } else if (doc.designMode == 'on') { | |
80 | + doc.designMode = 'off'; | |
81 | + } | |
82 | + } | |
83 | + }); | |
84 | + | |
44 | 85 | ed.onNodeChange.add(t._nodeChange, t); |
45 | 86 | ed.onVisualAid.add(t._visualAid, t); |
46 | 87 | }, |
... | ... | @@ -81,11 +122,13 @@ |
81 | 122 | var dom = ed.dom; |
82 | 123 | |
83 | 124 | tinymce.each(dom.select('div,p', e), function(e) { |
84 | - if (/^(absolute|relative|static)$/i.test(e.style.position)) { | |
125 | + if (/^(absolute|relative|fixed)$/i.test(e.style.position)) { | |
85 | 126 | if (s) |
86 | 127 | dom.addClass(e, 'mceItemVisualAid'); |
87 | 128 | else |
88 | - dom.removeClass(e, 'mceItemVisualAid'); | |
129 | + dom.removeClass(e, 'mceItemVisualAid'); | |
130 | + | |
131 | + dom.addClass(e, 'mceItemLayer'); | |
89 | 132 | } |
90 | 133 | }); |
91 | 134 | }, |
... | ... | @@ -153,9 +196,9 @@ |
153 | 196 | }, |
154 | 197 | |
155 | 198 | _insertLayer : function() { |
156 | - var ed = this.editor, p = ed.dom.getPos(ed.dom.getParent(ed.selection.getNode(), '*')); | |
199 | + var ed = this.editor, dom = ed.dom, p = dom.getPos(dom.getParent(ed.selection.getNode(), '*')), body = ed.getBody(); | |
157 | 200 | |
158 | - ed.dom.add(ed.getBody(), 'div', { | |
201 | + ed.dom.add(body, 'div', { | |
159 | 202 | style : { |
160 | 203 | position : 'absolute', |
161 | 204 | left : p.x, |
... | ... | @@ -163,8 +206,12 @@ |
163 | 206 | width : 100, |
164 | 207 | height : 100 |
165 | 208 | }, |
166 | - 'class' : 'mceItemVisualAid' | |
209 | + 'class' : 'mceItemVisualAid mceItemLayer' | |
167 | 210 | }, ed.selection.getContent() || ed.getLang('layer.content')); |
211 | + | |
212 | + // Workaround for IE where it messes up the JS engine if you insert a layer on IE 6,7 | |
213 | + if (tinymce.isIE) | |
214 | + dom.setHTML(body, body.innerHTML); | |
168 | 215 | }, |
169 | 216 | |
170 | 217 | _toggleAbsolute : function() { |
... | ... | @@ -184,6 +231,7 @@ |
184 | 231 | }); |
185 | 232 | |
186 | 233 | ed.dom.removeClass(le, 'mceItemVisualAid'); |
234 | + ed.dom.removeClass(le, 'mceItemLayer'); | |
187 | 235 | } else { |
188 | 236 | if (le.style.left == "") |
189 | 237 | le.style.left = 20 + 'px'; | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/legacyoutput/editor_plugin.js
1 | -(function(a){a.onAddEditor.addToTop(function(c,b){b.settings.inline_styles=false});a.create("tinymce.plugins.LegacyOutput",{init:function(b){b.onInit.add(function(){var c="p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img",e=a.explode(b.settings.font_size_style_values),d=b.schema;b.formatter.register({alignleft:{selector:c,attributes:{align:"left"}},aligncenter:{selector:c,attributes:{align:"center"}},alignright:{selector:c,attributes:{align:"right"}},alignfull:{selector:c,attributes:{align:"justify"}},bold:[{inline:"b",remove:"all"},{inline:"strong",remove:"all"},{inline:"span",styles:{fontWeight:"bold"}}],italic:[{inline:"i",remove:"all"},{inline:"em",remove:"all"},{inline:"span",styles:{fontStyle:"italic"}}],underline:[{inline:"u",remove:"all"},{inline:"span",styles:{textDecoration:"underline"},exact:true}],strikethrough:[{inline:"strike",remove:"all"},{inline:"span",styles:{textDecoration:"line-through"},exact:true}],fontname:{inline:"font",attributes:{face:"%value"}},fontsize:{inline:"font",attributes:{size:function(f){return a.inArray(e,f.value)+1}}},forecolor:{inline:"font",styles:{color:"%value"}},hilitecolor:{inline:"font",styles:{backgroundColor:"%value"}}});a.each("b,i,u,strike".split(","),function(f){d.addValidElements(f+"[*]")});if(!d.getElementRule("font")){d.addValidElements("font[face|size|color|style]")}a.each(c.split(","),function(f){var h=d.getElementRule(f),g;if(h){if(!h.attributes.align){h.attributes.align={};h.attributesOrder.push("align")}}});b.onNodeChange.add(function(g,k){var j,f,h,i;f=g.dom.getParent(g.selection.getNode(),"font");if(f){h=f.face;i=f.size}if(j=k.get("fontselect")){j.select(function(l){return l==h})}if(j=k.get("fontsizeselect")){j.select(function(m){var l=a.inArray(e,m.fontSize);return l+1==i})}})})},getInfo:function(){return{longname:"LegacyOutput",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/legacyoutput",version:a.majorVersion+"."+a.minorVersion}}});a.PluginManager.add("legacyoutput",a.plugins.LegacyOutput)})(tinymce); | |
2 | 1 | \ No newline at end of file |
2 | +(function(a){a.onAddEditor.addToTop(function(c,b){b.settings.inline_styles=false});a.create("tinymce.plugins.LegacyOutput",{init:function(b){b.onInit.add(function(){var c="p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img",e=a.explode(b.settings.font_size_style_values),d=b.schema;b.formatter.register({alignleft:{selector:c,attributes:{align:"left"}},aligncenter:{selector:c,attributes:{align:"center"}},alignright:{selector:c,attributes:{align:"right"}},alignfull:{selector:c,attributes:{align:"justify"}},bold:[{inline:"b",remove:"all"},{inline:"strong",remove:"all"},{inline:"span",styles:{fontWeight:"bold"}}],italic:[{inline:"i",remove:"all"},{inline:"em",remove:"all"},{inline:"span",styles:{fontStyle:"italic"}}],underline:[{inline:"u",remove:"all"},{inline:"span",styles:{textDecoration:"underline"},exact:true}],strikethrough:[{inline:"strike",remove:"all"},{inline:"span",styles:{textDecoration:"line-through"},exact:true}],fontname:{inline:"font",attributes:{face:"%value"}},fontsize:{inline:"font",attributes:{size:function(f){return a.inArray(e,f.value)+1}}},forecolor:{inline:"font",attributes:{color:"%value"}},hilitecolor:{inline:"font",styles:{backgroundColor:"%value"}}});a.each("b,i,u,strike".split(","),function(f){d.addValidElements(f+"[*]")});if(!d.getElementRule("font")){d.addValidElements("font[face|size|color|style]")}a.each(c.split(","),function(f){var h=d.getElementRule(f),g;if(h){if(!h.attributes.align){h.attributes.align={};h.attributesOrder.push("align")}}});b.onNodeChange.add(function(g,k){var j,f,h,i;f=g.dom.getParent(g.selection.getNode(),"font");if(f){h=f.face;i=f.size}if(j=k.get("fontselect")){j.select(function(l){return l==h})}if(j=k.get("fontsizeselect")){j.select(function(m){var l=a.inArray(e,m.fontSize);return l+1==i})}})})},getInfo:function(){return{longname:"LegacyOutput",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/legacyoutput",version:a.majorVersion+"."+a.minorVersion}}});a.PluginManager.add("legacyoutput",a.plugins.LegacyOutput)})(tinymce); | |
3 | 3 | \ No newline at end of file | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/legacyoutput/editor_plugin_src.js
... | ... | @@ -68,7 +68,7 @@ |
68 | 68 | }, |
69 | 69 | |
70 | 70 | // Setup font elements for colors as well |
71 | - forecolor : {inline : 'font', styles : {color : '%value'}}, | |
71 | + forecolor : {inline : 'font', attributes : {color : '%value'}}, | |
72 | 72 | hilitecolor : {inline : 'font', styles : {backgroundColor : '%value'}} |
73 | 73 | }); |
74 | 74 | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/lists/editor_plugin.js
1 | -(function(){var e=tinymce.each,r=tinymce.dom.Event,g;function p(t,s){while(t&&(t.nodeType===8||(t.nodeType===3&&/^[ \t\n\r]*$/.test(t.nodeValue)))){t=s(t)}return t}function b(s){return p(s,function(t){return t.previousSibling})}function i(s){return p(s,function(t){return t.nextSibling})}function d(s,u,t){return s.dom.getParent(u,function(v){return tinymce.inArray(t,v)!==-1})}function n(s){return s&&(s.tagName==="OL"||s.tagName==="UL")}function c(u,v){var t,w,s;t=b(u.lastChild);while(n(t)){w=t;t=b(w.previousSibling)}if(w){s=v.create("li",{style:"list-style-type: none;"});v.split(u,w);v.insertAfter(s,w);s.appendChild(w);s.appendChild(w);u=s.previousSibling}return u}function m(t,s,u){t=a(t,s,u);return o(t,s,u)}function a(u,s,v){var t=b(u.previousSibling);if(t){return h(t,u,s?t:false,v)}else{return u}}function o(u,t,v){var s=i(u.nextSibling);if(s){return h(u,s,t?s:false,v)}else{return u}}function h(u,s,t,v){if(l(u,s,!!t,v)){return f(u,s,t)}else{if(u&&u.tagName==="LI"&&n(s)){u.appendChild(s)}}return s}function l(u,t,s,v){if(!u||!t){return false}else{if(u.tagName==="LI"&&t.tagName==="LI"){return t.style.listStyleType==="none"||j(t)}else{if(n(u)){return(u.tagName===t.tagName&&(s||u.style.listStyleType===t.style.listStyleType))||q(t)}else{if(v&&u.tagName==="P"&&t.tagName==="P"){return true}else{return false}}}}}function q(t){var s=i(t.firstChild),u=b(t.lastChild);return s&&u&&n(t)&&s===u&&(n(s)||s.style.listStyleType==="none"||j(s))}function j(u){var t=i(u.firstChild),s=b(u.lastChild);return t&&s&&t===s&&n(t)}function f(w,v,s){var u=b(w.lastChild),t=i(v.firstChild);if(w.tagName==="P"){w.appendChild(w.ownerDocument.createElement("br"))}while(v.firstChild){w.appendChild(v.firstChild)}if(s){w.style.listStyleType=s.style.listStyleType}v.parentNode.removeChild(v);h(u,t,false);return w}function k(t,u){var s;if(!u.is(t,"li,ol,ul")){s=u.getParent(t,"li");if(s){t=s}}return t}tinymce.create("tinymce.plugins.Lists",{init:function(u,v){var s=false;function x(y){return y.keyCode===9&&(u.queryCommandState("InsertUnorderedList")||u.queryCommandState("InsertOrderedList"))}function w(y,A){var z=y.selection,B;if(A.keyCode===13){B=z.getStart();s=z.isCollapsed()&&B&&B.tagName==="LI"&&B.childNodes.length===0;return s}}function t(y,z){if(x(z)||w(y,z)){return r.cancel(z)}}this.ed=u;u.addCommand("Indent",this.indent,this);u.addCommand("Outdent",this.outdent,this);u.addCommand("InsertUnorderedList",function(){this.applyList("UL","OL")},this);u.addCommand("InsertOrderedList",function(){this.applyList("OL","UL")},this);u.onInit.add(function(){u.editorCommands.addCommands({outdent:function(){var z=u.selection,A=u.dom;function y(B){B=A.getParent(B,A.isBlock);return B&&(parseInt(u.dom.getStyle(B,"margin-left")||0,10)+parseInt(u.dom.getStyle(B,"padding-left")||0,10))>0}return y(z.getStart())||y(z.getEnd())||u.queryCommandState("InsertOrderedList")||u.queryCommandState("InsertUnorderedList")}},"state")});u.onKeyUp.add(function(z,A){var B,y;if(x(A)){z.execCommand(A.shiftKey?"Outdent":"Indent",true,null);return r.cancel(A)}else{if(s&&w(z,A)){if(z.queryCommandState("InsertOrderedList")){z.execCommand("InsertOrderedList")}else{z.execCommand("InsertUnorderedList")}B=z.selection.getStart();if(B&&B.tagName==="LI"){B=z.dom.getParent(B,"ol,ul").nextSibling;if(B&&B.tagName==="P"){if(!B.firstChild){B.appendChild(z.getDoc().createTextNode(""))}y=z.dom.createRng();y.setStart(B.firstChild,1);y.setEnd(B.firstChild,1);z.selection.setRng(y)}}return r.cancel(A)}}});u.onKeyPress.add(t);u.onKeyDown.add(t)},applyList:function(y,v){var C=this,z=C.ed,I=z.dom,s=[],H=false,u=false,w=false,B,G=z.selection.getSelectedBlocks();function E(t){if(t&&t.tagName==="BR"){I.remove(t)}}function F(M){var N=I.create(y),t;function L(O){if(O.style.marginLeft||O.style.paddingLeft){C.adjustPaddingFunction(false)(O)}}if(M.tagName==="LI"){}else{if(M.tagName==="P"||M.tagName==="DIV"||M.tagName==="BODY"){K(M,function(P,O,Q){J(P,O,M.tagName==="BODY"?null:P.parentNode);t=P.parentNode;L(t);E(O)});if(M.tagName==="P"||G.length>1){I.split(t.parentNode.parentNode,t.parentNode)}m(t.parentNode,true);return}else{t=I.create("li");I.insertAfter(t,M);t.appendChild(M);L(M);M=t}}I.insertAfter(N,M);N.appendChild(M);m(N,true);s.push(M)}function J(Q,L,O){var t,P=Q,N,M;while(!I.isBlock(Q.parentNode)&&Q.parentNode!==I.getRoot()){Q=I.split(Q.parentNode,Q.previousSibling);Q=Q.nextSibling;P=Q}if(O){t=O.cloneNode(true);Q.parentNode.insertBefore(t,Q);while(t.firstChild){I.remove(t.firstChild)}t=I.rename(t,"li")}else{t=I.create("li");Q.parentNode.insertBefore(t,Q)}while(P&&P!=L){N=P.nextSibling;t.appendChild(P);P=N}if(t.childNodes.length===0){t.innerHTML='<br _mce_bogus="1" />'}F(t)}function K(Q,T){var N,R,O=3,L=1,t="br,ul,ol,p,div,h1,h2,h3,h4,h5,h6,table,blockquote,address,pre,form,center,dl";function P(X,U){var V=I.createRng(),W;g.keep=true;z.selection.moveToBookmark(g);g.keep=false;W=z.selection.getRng(true);if(!U){U=X.parentNode.lastChild}V.setStartBefore(X);V.setEndAfter(U);return !(V.compareBoundaryPoints(O,W)>0||V.compareBoundaryPoints(L,W)<=0)}function S(U){if(U.nextSibling){return U.nextSibling}if(!I.isBlock(U.parentNode)&&U.parentNode!==I.getRoot()){return S(U.parentNode)}}N=Q.firstChild;var M=false;e(I.select(t,Q),function(V){var U;if(V.hasAttribute&&V.hasAttribute("_mce_bogus")){return true}if(P(N,V)){I.addClass(V,"_mce_tagged_br");N=S(V)}});M=(N&&P(N,undefined));N=Q.firstChild;e(I.select(t,Q),function(V){var U=S(V);if(V.hasAttribute&&V.hasAttribute("_mce_bogus")){return true}if(I.hasClass(V,"_mce_tagged_br")){T(N,V,R);R=null}else{R=V}N=U});if(M){T(N,undefined,R)}}function D(t){K(t,function(M,L,N){J(M,L);E(L);E(N)})}function A(t){if(tinymce.inArray(s,t)!==-1){return}if(t.parentNode.tagName===v){I.split(t.parentNode,t);F(t);o(t.parentNode,false)}s.push(t)}function x(M){var O,N,L,t;if(tinymce.inArray(s,M)!==-1){return}M=c(M,I);while(I.is(M.parentNode,"ol,ul,li")){I.split(M.parentNode,M)}s.push(M);M=I.rename(M,"p");L=m(M,false,z.settings.force_br_newlines);if(L===M){O=M.firstChild;while(O){if(I.isBlock(O)){O=I.split(O.parentNode,O);t=true;N=O.nextSibling&&O.nextSibling.firstChild}else{N=O.nextSibling;if(t&&O.tagName==="BR"){I.remove(O)}t=false}O=N}}}e(G,function(t){t=k(t,I);if(t.tagName===v||(t.tagName==="LI"&&t.parentNode.tagName===v)){u=true}else{if(t.tagName===y||(t.tagName==="LI"&&t.parentNode.tagName===y)){H=true}else{w=true}}});if(w||u||G.length===0){B={LI:A,H1:F,H2:F,H3:F,H4:F,H5:F,H6:F,P:F,BODY:F,DIV:G.length>1?F:D,defaultAction:D}}else{B={defaultAction:x}}this.process(B)},indent:function(){var u=this.ed,w=u.dom,x=[];function s(z){var y=w.create("li",{style:"list-style-type: none;"});w.insertAfter(y,z);return y}function t(B){var y=s(B),D=w.getParent(B,"ol,ul"),C=D.tagName,E=w.getStyle(D,"list-style-type"),A={},z;if(E!==""){A.style="list-style-type: "+E+";"}z=w.create(C,A);y.appendChild(z);return z}function v(z){if(!d(u,z,x)){z=c(z,w);var y=t(z);y.appendChild(z);m(y.parentNode,false);m(y,false);x.push(z)}}this.process({LI:v,defaultAction:this.adjustPaddingFunction(true)})},outdent:function(){var v=this,u=v.ed,w=u.dom,s=[];function x(t){var z,y,A;if(!d(u,t,s)){if(w.getStyle(t,"margin-left")!==""||w.getStyle(t,"padding-left")!==""){return v.adjustPaddingFunction(false)(t)}A=w.getStyle(t,"text-align",true);if(A==="center"||A==="right"){w.setStyle(t,"text-align","left");return}t=c(t,w);z=t.parentNode;y=t.parentNode.parentNode;if(y.tagName==="P"){w.split(y,t.parentNode)}else{w.split(z,t);if(y.tagName==="LI"){w.split(y,t)}else{if(!w.is(y,"ol,ul")){w.rename(t,"p")}}}s.push(t)}}this.process({LI:x,defaultAction:this.adjustPaddingFunction(false)});e(s,m)},process:function(x){var B=this,v=B.ed.selection,y=B.ed.dom,A,s;function w(t){y.removeClass(t,"_mce_act_on");if(!t||t.nodeType!==1){return}t=k(t,y);var C=x[t.tagName];if(!C){C=x.defaultAction}C(t)}function u(t){B.splitSafeEach(t.childNodes,w)}function z(t,C){return C>=0&&t.hasChildNodes()&&C<t.childNodes.length&&t.childNodes[C].tagName==="BR"}A=v.getSelectedBlocks();if(A.length===0){A=[y.getRoot()]}s=v.getRng(true);if(!s.collapsed){if(z(s.endContainer,s.endOffset-1)){s.setEnd(s.endContainer,s.endOffset-1);v.setRng(s)}if(z(s.startContainer,s.startOffset)){s.setStart(s.startContainer,s.startOffset+1);v.setRng(s)}}g=v.getBookmark();x.OL=x.UL=u;B.splitSafeEach(A,w);v.moveToBookmark(g);g=null;B.ed.execCommand("mceRepaint")},splitSafeEach:function(t,s){if(tinymce.isGecko&&(/Firefox\/[12]\.[0-9]/.test(navigator.userAgent)||/Firefox\/3\.[0-4]/.test(navigator.userAgent))){this.classBasedEach(t,s)}else{e(t,s)}},classBasedEach:function(v,u){var w=this.ed.dom,s,t;e(v,function(x){w.addClass(x,"_mce_act_on")});s=w.select("._mce_act_on");while(s.length>0){t=s.shift();w.removeClass(t,"_mce_act_on");u(t);s=w.select("._mce_act_on")}},adjustPaddingFunction:function(u){var s,v,t=this.ed;s=t.settings.indentation;v=/[a-z%]+/i.exec(s);s=parseInt(s,10);return function(w){var y,x;y=parseInt(t.dom.getStyle(w,"margin-left")||0,10)+parseInt(t.dom.getStyle(w,"padding-left")||0,10);if(u){x=y+s}else{x=y-s}t.dom.setStyle(w,"padding-left","");t.dom.setStyle(w,"margin-left",x>0?x+v:"")}},getInfo:function(){return{longname:"Lists",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/lists",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("lists",tinymce.plugins.Lists)}()); | |
2 | 1 | \ No newline at end of file |
2 | +(function(){var e=tinymce.each,r=tinymce.dom.Event,g;function p(t,s){while(t&&(t.nodeType===8||(t.nodeType===3&&/^[ \t\n\r]*$/.test(t.nodeValue)))){t=s(t)}return t}function b(s){return p(s,function(t){return t.previousSibling})}function i(s){return p(s,function(t){return t.nextSibling})}function d(s,u,t){return s.dom.getParent(u,function(v){return tinymce.inArray(t,v)!==-1})}function n(s){return s&&(s.tagName==="OL"||s.tagName==="UL")}function c(u,v){var t,w,s;t=b(u.lastChild);while(n(t)){w=t;t=b(w.previousSibling)}if(w){s=v.create("li",{style:"list-style-type: none;"});v.split(u,w);v.insertAfter(s,w);s.appendChild(w);s.appendChild(w);u=s.previousSibling}return u}function m(t,s,u){t=a(t,s,u);return o(t,s,u)}function a(u,s,v){var t=b(u.previousSibling);if(t){return h(t,u,s?t:false,v)}else{return u}}function o(u,t,v){var s=i(u.nextSibling);if(s){return h(u,s,t?s:false,v)}else{return u}}function h(u,s,t,v){if(l(u,s,!!t,v)){return f(u,s,t)}else{if(u&&u.tagName==="LI"&&n(s)){u.appendChild(s)}}return s}function l(u,t,s,v){if(!u||!t){return false}else{if(u.tagName==="LI"&&t.tagName==="LI"){return t.style.listStyleType==="none"||j(t)}else{if(n(u)){return(u.tagName===t.tagName&&(s||u.style.listStyleType===t.style.listStyleType))||q(t)}else{return v&&u.tagName==="P"&&t.tagName==="P"}}}}function q(t){var s=i(t.firstChild),u=b(t.lastChild);return s&&u&&n(t)&&s===u&&(n(s)||s.style.listStyleType==="none"||j(s))}function j(u){var t=i(u.firstChild),s=b(u.lastChild);return t&&s&&t===s&&n(t)}function f(w,v,s){var u=b(w.lastChild),t=i(v.firstChild);if(w.tagName==="P"){w.appendChild(w.ownerDocument.createElement("br"))}while(v.firstChild){w.appendChild(v.firstChild)}if(s){w.style.listStyleType=s.style.listStyleType}v.parentNode.removeChild(v);h(u,t,false);return w}function k(t,u){var s;if(!u.is(t,"li,ol,ul")){s=u.getParent(t,"li");if(s){t=s}}return t}tinymce.create("tinymce.plugins.Lists",{init:function(y){var v="TABBING";var s="EMPTY";var J="ESCAPE";var z="PARAGRAPH";var N="UNKNOWN";var x=N;function E(U){return U.keyCode===tinymce.VK.TAB&&!(U.altKey||U.ctrlKey)&&(y.queryCommandState("InsertUnorderedList")||y.queryCommandState("InsertOrderedList"))}function w(){var U=B();var W=U.parentNode.parentNode;var V=U.parentNode.lastChild===U;return V&&!t(W)&&P(U)}function t(U){if(n(U)){return U.parentNode&&U.parentNode.tagName==="LI"}else{return U.tagName==="LI"}}function F(){return y.selection.isCollapsed()&&P(B())}function B(){var U=y.selection.getStart();return((U.tagName=="BR"||U.tagName=="")&&U.parentNode.tagName=="LI")?U.parentNode:U}function P(U){var V=U.childNodes.length;if(U.tagName==="LI"){return V==0?true:V==1&&(U.firstChild.tagName==""||U.firstChild.tagName=="BR"||H(U))}return false}function H(U){var V=tinymce.grep(U.parentNode.childNodes,function(Y){return Y.tagName=="LI"});var W=U==V[V.length-1];var X=U.firstChild;return tinymce.isIE9&&W&&(X.nodeValue==String.fromCharCode(160)||X.nodeValue==String.fromCharCode(32))}function T(U){return U.keyCode===tinymce.VK.ENTER}function A(U){return T(U)&&!U.shiftKey}function M(U){if(E(U)){return v}else{if(A(U)&&w()){return N}else{if(A(U)&&F()){return s}else{return N}}}}function D(U,V){if(x==v||x==s||tinymce.isGecko&&x==J){r.cancel(V)}}function C(){var U=y.selection.getRng(true);var V=U.startContainer;if(V.nodeType==3){var W=V.nodeValue;if(tinymce.isIE9&&W.length>1&&W.charCodeAt(W.length-1)==32){return(U.endOffset==W.length-1)}else{return(U.endOffset==W.length)}}else{if(V.nodeType==1){return U.endOffset==V.childNodes.length}}return false}function I(){var W=y.selection.getNode();var V="h1,h2,h3,h4,h5,h6,p,div";var U=y.dom.is(W,V)&&W.parentNode.tagName==="LI"&&W.parentNode.lastChild===W;return y.selection.isCollapsed()&&U&&C()}function K(W,Y){if(A(Y)&&I()){var X=W.selection.getNode();var V=W.dom.create("li");var U=W.dom.getParent(X,"li");W.dom.insertAfter(V,U);if(tinymce.isIE6||tinymce.isIE7||tinyMCE.isIE8){W.selection.setCursorLocation(V,1)}else{W.selection.setCursorLocation(V,0)}Y.preventDefault()}}function u(X,Z){var ac;if(!tinymce.isGecko){return}var V=X.selection.getStart();if(Z.keyCode!=tinymce.VK.BACKSPACE||V.tagName!=="IMG"){return}function W(ag){var ah=ag.firstChild;var af=null;do{if(!ah){break}if(ah.tagName==="LI"){af=ah}}while(ah=ah.nextSibling);return af}function ae(ag,af){while(ag.childNodes.length>0){af.appendChild(ag.childNodes[0])}}ac=V.parentNode.previousSibling;if(!ac){return}var aa;if(ac.tagName==="UL"||ac.tagName==="OL"){aa=ac}else{if(ac.previousSibling&&(ac.previousSibling.tagName==="UL"||ac.previousSibling.tagName==="OL")){aa=ac.previousSibling}else{return}}var ad=W(aa);var U=X.dom.createRng();U.setStart(ad,1);U.setEnd(ad,1);X.selection.setRng(U);X.selection.collapse(true);var Y=X.selection.getBookmark();var ab=V.parentNode.cloneNode(true);if(ab.tagName==="P"||ab.tagName==="DIV"){ae(ab,ad)}else{ad.appendChild(ab)}V.parentNode.parentNode.removeChild(V.parentNode);X.selection.moveToBookmark(Y)}function G(U){var V=y.dom.getParent(U,"ol,ul");if(V!=null){var W=V.lastChild;y.selection.setCursorLocation(W,0)}}this.ed=y;y.addCommand("Indent",this.indent,this);y.addCommand("Outdent",this.outdent,this);y.addCommand("InsertUnorderedList",function(){this.applyList("UL","OL")},this);y.addCommand("InsertOrderedList",function(){this.applyList("OL","UL")},this);y.onInit.add(function(){y.editorCommands.addCommands({outdent:function(){var V=y.selection,W=y.dom;function U(X){X=W.getParent(X,W.isBlock);return X&&(parseInt(y.dom.getStyle(X,"margin-left")||0,10)+parseInt(y.dom.getStyle(X,"padding-left")||0,10))>0}return U(V.getStart())||U(V.getEnd())||y.queryCommandState("InsertOrderedList")||y.queryCommandState("InsertUnorderedList")}},"state")});y.onKeyUp.add(function(V,W){if(x==v){V.execCommand(W.shiftKey?"Outdent":"Indent",true,null);x=N;return r.cancel(W)}else{if(x==s){var U=B();var Y=V.settings.list_outdent_on_enter===true||W.shiftKey;V.execCommand(Y?"Outdent":"Indent",true,null);if(tinymce.isIE){G(U)}return r.cancel(W)}else{if(x==J){if(tinymce.isIE6||tinymce.isIE7||tinymce.isIE8){var X=V.getDoc().createTextNode("\uFEFF");V.selection.getNode().appendChild(X)}else{if(tinymce.isIE9||tinymce.isGecko){V.execCommand("Outdent");return r.cancel(W)}}}}}});function L(V,U){var W=y.getDoc().createTextNode("\uFEFF");V.insertBefore(W,U);y.selection.setCursorLocation(W,0);y.execCommand("mceRepaint")}function R(V,X){if(T(X)){var U=B();if(U){var W=U.parentNode;var Y=W&&W.parentNode;if(Y&&Y.nodeName=="LI"&&Y.firstChild==W&&U==W.firstChild){L(Y,W)}}}}function S(V,X){if(T(X)){var U=B();if(V.dom.select("ul li",U).length===1){var W=U.firstChild;L(U,W)}}}function Q(W,aa){function X(ab){var ad=[];var ae=new tinymce.dom.TreeWalker(ab.firstChild,ab);for(var ac=ae.current();ac;ac=ae.next()){if(W.dom.is(ac,"ol,ul,li")){ad.push(ac)}}return ad}if(aa.keyCode==tinymce.VK.BACKSPACE){var U=B();if(U){var Z=W.dom.getParent(U,"ol,ul"),V=W.selection.getRng();if(Z&&Z.firstChild===U&&V.startOffset==0){var Y=X(U);Y.unshift(U);W.execCommand("Outdent",false,Y);W.undoManager.add();return r.cancel(aa)}}}}function O(V,X){var U=B();if(X.keyCode===tinymce.VK.BACKSPACE&&V.dom.is(U,"li")&&U.parentNode.firstChild!==U){if(V.dom.select("ul,ol",U).length===1){var Z=U.previousSibling;V.dom.remove(V.dom.select("br",U));V.dom.remove(U,true);var W=tinymce.grep(Z.childNodes,function(aa){return aa.nodeType===3});if(W.length===1){var Y=W[0];V.selection.setCursorLocation(Y,Y.length)}V.undoManager.add();return r.cancel(X)}}}y.onKeyDown.add(function(U,V){x=M(V)});y.onKeyDown.add(D);y.onKeyDown.add(u);y.onKeyDown.add(K);if(tinymce.isGecko){y.onKeyUp.add(R)}if(tinymce.isIE8){y.onKeyUp.add(S)}if(tinymce.isGecko||tinymce.isWebKit){y.onKeyDown.add(Q)}if(tinymce.isWebKit){y.onKeyDown.add(O)}},applyList:function(y,v){var C=this,z=C.ed,I=z.dom,s=[],H=false,u=false,w=false,B,G=z.selection.getSelectedBlocks();function E(t){if(t&&t.tagName==="BR"){I.remove(t)}}function F(M){var N=I.create(y),t;function L(O){if(O.style.marginLeft||O.style.paddingLeft){C.adjustPaddingFunction(false)(O)}}if(M.tagName==="LI"){}else{if(M.tagName==="P"||M.tagName==="DIV"||M.tagName==="BODY"){K(M,function(P,O){J(P,O,M.tagName==="BODY"?null:P.parentNode);t=P.parentNode;L(t);E(O)});if(t){if(t.tagName==="LI"&&(M.tagName==="P"||G.length>1)){I.split(t.parentNode.parentNode,t.parentNode)}m(t.parentNode,true)}return}else{t=I.create("li");I.insertAfter(t,M);t.appendChild(M);L(M);M=t}}I.insertAfter(N,M);N.appendChild(M);m(N,true);s.push(M)}function J(P,L,N){var t,O=P,M;while(!I.isBlock(P.parentNode)&&P.parentNode!==I.getRoot()){P=I.split(P.parentNode,P.previousSibling);P=P.nextSibling;O=P}if(N){t=N.cloneNode(true);P.parentNode.insertBefore(t,P);while(t.firstChild){I.remove(t.firstChild)}t=I.rename(t,"li")}else{t=I.create("li");P.parentNode.insertBefore(t,P)}while(O&&O!=L){M=O.nextSibling;t.appendChild(O);O=M}if(t.childNodes.length===0){t.innerHTML='<br _mce_bogus="1" />'}F(t)}function K(Q,T){var N,R,O=3,L=1,t="br,ul,ol,p,div,h1,h2,h3,h4,h5,h6,table,blockquote,address,pre,form,center,dl";function P(X,U){var V=I.createRng(),W;g.keep=true;z.selection.moveToBookmark(g);g.keep=false;W=z.selection.getRng(true);if(!U){U=X.parentNode.lastChild}V.setStartBefore(X);V.setEndAfter(U);return !(V.compareBoundaryPoints(O,W)>0||V.compareBoundaryPoints(L,W)<=0)}function S(U){if(U.nextSibling){return U.nextSibling}if(!I.isBlock(U.parentNode)&&U.parentNode!==I.getRoot()){return S(U.parentNode)}}N=Q.firstChild;var M=false;e(I.select(t,Q),function(U){if(U.hasAttribute&&U.hasAttribute("_mce_bogus")){return true}if(P(N,U)){I.addClass(U,"_mce_tagged_br");N=S(U)}});M=(N&&P(N,undefined));N=Q.firstChild;e(I.select(t,Q),function(V){var U=S(V);if(V.hasAttribute&&V.hasAttribute("_mce_bogus")){return true}if(I.hasClass(V,"_mce_tagged_br")){T(N,V,R);R=null}else{R=V}N=U});if(M){T(N,undefined,R)}}function D(t){K(t,function(M,L,N){J(M,L);E(L);E(N)})}function A(t){if(tinymce.inArray(s,t)!==-1){return}if(t.parentNode.tagName===v){I.split(t.parentNode,t);F(t);o(t.parentNode,false)}s.push(t)}function x(M){var O,N,L,t;if(tinymce.inArray(s,M)!==-1){return}M=c(M,I);while(I.is(M.parentNode,"ol,ul,li")){I.split(M.parentNode,M)}s.push(M);M=I.rename(M,"p");L=m(M,false,z.settings.force_br_newlines);if(L===M){O=M.firstChild;while(O){if(I.isBlock(O)){O=I.split(O.parentNode,O);t=true;N=O.nextSibling&&O.nextSibling.firstChild}else{N=O.nextSibling;if(t&&O.tagName==="BR"){I.remove(O)}t=false}O=N}}}e(G,function(t){t=k(t,I);if(t.tagName===v||(t.tagName==="LI"&&t.parentNode.tagName===v)){u=true}else{if(t.tagName===y||(t.tagName==="LI"&&t.parentNode.tagName===y)){H=true}else{w=true}}});if(w&&!H||u||G.length===0){B={LI:A,H1:F,H2:F,H3:F,H4:F,H5:F,H6:F,P:F,BODY:F,DIV:G.length>1?F:D,defaultAction:D,elements:this.selectedBlocks()}}else{B={defaultAction:x,elements:this.selectedBlocks(),processEvenIfEmpty:true}}this.process(B)},indent:function(){var u=this.ed,w=u.dom,x=[];function s(z){var y=w.create("li",{style:"list-style-type: none;"});w.insertAfter(y,z);return y}function t(B){var y=s(B),D=w.getParent(B,"ol,ul"),C=D.tagName,E=w.getStyle(D,"list-style-type"),A={},z;if(E!==""){A.style="list-style-type: "+E+";"}z=w.create(C,A);y.appendChild(z);return z}function v(z){if(!d(u,z,x)){z=c(z,w);var y=t(z);y.appendChild(z);m(y.parentNode,false);m(y,false);x.push(z)}}this.process({LI:v,defaultAction:this.adjustPaddingFunction(true),elements:this.selectedBlocks()})},outdent:function(y,x){var w=this,u=w.ed,z=u.dom,s=[];function A(t){var C,B,D;if(!d(u,t,s)){if(z.getStyle(t,"margin-left")!==""||z.getStyle(t,"padding-left")!==""){return w.adjustPaddingFunction(false)(t)}D=z.getStyle(t,"text-align",true);if(D==="center"||D==="right"){z.setStyle(t,"text-align","left");return}t=c(t,z);C=t.parentNode;B=t.parentNode.parentNode;if(B.tagName==="P"){z.split(B,t.parentNode)}else{z.split(C,t);if(B.tagName==="LI"){z.split(B,t)}else{if(!z.is(B,"ol,ul")){z.rename(t,"p")}}}s.push(t)}}var v=x&&tinymce.is(x,"array")?x:this.selectedBlocks();this.process({LI:A,defaultAction:this.adjustPaddingFunction(false),elements:v});e(s,m)},process:function(y){var F=this,w=F.ed.selection,z=F.ed.dom,E,u;function B(t){var s=tinymce.grep(t.childNodes,function(H){return !(H.nodeName==="BR"||H.nodeName==="SPAN"&&z.getAttrib(H,"data-mce-type")=="bookmark"||H.nodeType==3&&(H.nodeValue==String.fromCharCode(160)||H.nodeValue==""))});return s.length===0}function x(s){z.removeClass(s,"_mce_act_on");if(!s||s.nodeType!==1||!y.processEvenIfEmpty&&E.length>1&&B(s)){return}s=k(s,z);var t=y[s.tagName];if(!t){t=y.defaultAction}t(s)}function v(s){F.splitSafeEach(s.childNodes,x,true)}function C(s,t){return t>=0&&s.hasChildNodes()&&t<s.childNodes.length&&s.childNodes[t].tagName==="BR"}function D(){var t=w.getNode();var s=z.getParent(t,"td");return s!==null}E=y.elements;u=w.getRng(true);if(!u.collapsed){if(C(u.endContainer,u.endOffset-1)){u.setEnd(u.endContainer,u.endOffset-1);w.setRng(u)}if(C(u.startContainer,u.startOffset)){u.setStart(u.startContainer,u.startOffset+1);w.setRng(u)}}if(tinymce.isIE8){var G=F.ed.selection.getNode();if(G.tagName==="LI"&&!(G.parentNode.lastChild===G)){var A=F.ed.getDoc().createTextNode("\uFEFF");G.appendChild(A)}}g=w.getBookmark();y.OL=y.UL=v;F.splitSafeEach(E,x);w.moveToBookmark(g);g=null;if(!D()){F.ed.execCommand("mceRepaint")}},splitSafeEach:function(u,t,s){if(s||(tinymce.isGecko&&(/Firefox\/[12]\.[0-9]/.test(navigator.userAgent)||/Firefox\/3\.[0-4]/.test(navigator.userAgent)))){this.classBasedEach(u,t)}else{e(u,t)}},classBasedEach:function(v,u){var w=this.ed.dom,s,t;e(v,function(x){w.addClass(x,"_mce_act_on")});s=w.select("._mce_act_on");while(s.length>0){t=s.shift();w.removeClass(t,"_mce_act_on");u(t);s=w.select("._mce_act_on")}},adjustPaddingFunction:function(u){var s,v,t=this.ed;s=t.settings.indentation;v=/[a-z%]+/i.exec(s);s=parseInt(s,10);return function(w){var y,x;y=parseInt(t.dom.getStyle(w,"margin-left")||0,10)+parseInt(t.dom.getStyle(w,"padding-left")||0,10);if(u){x=y+s}else{x=y-s}t.dom.setStyle(w,"padding-left","");t.dom.setStyle(w,"margin-left",x>0?x+v:"")}},selectedBlocks:function(){var s=this.ed,t=s.selection.getSelectedBlocks();return t.length==0?[s.dom.getRoot()]:t},getInfo:function(){return{longname:"Lists",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/lists",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("lists",tinymce.plugins.Lists)}()); | |
3 | 3 | \ No newline at end of file | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/lists/editor_plugin_src.js
... | ... | @@ -18,25 +18,29 @@ |
18 | 18 | } |
19 | 19 | return e; |
20 | 20 | } |
21 | - | |
21 | + | |
22 | 22 | function skipWhitespaceNodesBackwards(e) { |
23 | - return skipWhitespaceNodes(e, function(e) { return e.previousSibling; }); | |
23 | + return skipWhitespaceNodes(e, function(e) { | |
24 | + return e.previousSibling; | |
25 | + }); | |
24 | 26 | } |
25 | - | |
27 | + | |
26 | 28 | function skipWhitespaceNodesForwards(e) { |
27 | - return skipWhitespaceNodes(e, function(e) { return e.nextSibling; }); | |
29 | + return skipWhitespaceNodes(e, function(e) { | |
30 | + return e.nextSibling; | |
31 | + }); | |
28 | 32 | } |
29 | - | |
33 | + | |
30 | 34 | function hasParentInList(ed, e, list) { |
31 | 35 | return ed.dom.getParent(e, function(p) { |
32 | 36 | return tinymce.inArray(list, p) !== -1; |
33 | 37 | }); |
34 | 38 | } |
35 | - | |
39 | + | |
36 | 40 | function isList(e) { |
37 | 41 | return e && (e.tagName === 'OL' || e.tagName === 'UL'); |
38 | 42 | } |
39 | - | |
43 | + | |
40 | 44 | function splitNestedLists(element, dom) { |
41 | 45 | var tmp, nested, wrapItem; |
42 | 46 | tmp = skipWhitespaceNodesBackwards(element.lastChild); |
... | ... | @@ -54,12 +58,12 @@ |
54 | 58 | } |
55 | 59 | return element; |
56 | 60 | } |
57 | - | |
61 | + | |
58 | 62 | function attemptMergeWithAdjacent(e, allowDifferentListStyles, mergeParagraphs) { |
59 | 63 | e = attemptMergeWithPrevious(e, allowDifferentListStyles, mergeParagraphs); |
60 | 64 | return attemptMergeWithNext(e, allowDifferentListStyles, mergeParagraphs); |
61 | 65 | } |
62 | - | |
66 | + | |
63 | 67 | function attemptMergeWithPrevious(e, allowDifferentListStyles, mergeParagraphs) { |
64 | 68 | var prev = skipWhitespaceNodesBackwards(e.previousSibling); |
65 | 69 | if (prev) { |
... | ... | @@ -68,7 +72,7 @@ |
68 | 72 | return e; |
69 | 73 | } |
70 | 74 | } |
71 | - | |
75 | + | |
72 | 76 | function attemptMergeWithNext(e, allowDifferentListStyles, mergeParagraphs) { |
73 | 77 | var next = skipWhitespaceNodesForwards(e.nextSibling); |
74 | 78 | if (next) { |
... | ... | @@ -77,7 +81,7 @@ |
77 | 81 | return e; |
78 | 82 | } |
79 | 83 | } |
80 | - | |
84 | + | |
81 | 85 | function attemptMerge(e1, e2, differentStylesMasterElement, mergeParagraphs) { |
82 | 86 | if (canMerge(e1, e2, !!differentStylesMasterElement, mergeParagraphs)) { |
83 | 87 | return merge(e1, e2, differentStylesMasterElement); |
... | ... | @@ -87,7 +91,7 @@ |
87 | 91 | } |
88 | 92 | return e2; |
89 | 93 | } |
90 | - | |
94 | + | |
91 | 95 | function canMerge(e1, e2, allowDifferentListStyles, mergeParagraphs) { |
92 | 96 | if (!e1 || !e2) { |
93 | 97 | return false; |
... | ... | @@ -95,23 +99,19 @@ |
95 | 99 | return e2.style.listStyleType === 'none' || containsOnlyAList(e2); |
96 | 100 | } else if (isList(e1)) { |
97 | 101 | return (e1.tagName === e2.tagName && (allowDifferentListStyles || e1.style.listStyleType === e2.style.listStyleType)) || isListForIndent(e2); |
98 | - } else if (mergeParagraphs && e1.tagName === 'P' && e2.tagName === 'P') { | |
99 | - return true; | |
100 | - } else { | |
101 | - return false; | |
102 | - } | |
102 | + } else return mergeParagraphs && e1.tagName === 'P' && e2.tagName === 'P'; | |
103 | 103 | } |
104 | - | |
104 | + | |
105 | 105 | function isListForIndent(e) { |
106 | 106 | var firstLI = skipWhitespaceNodesForwards(e.firstChild), lastLI = skipWhitespaceNodesBackwards(e.lastChild); |
107 | - return firstLI && lastLI && isList(e) && firstLI === lastLI && (isList(firstLI) || firstLI.style.listStyleType === 'none' || containsOnlyAList(firstLI)); | |
107 | + return firstLI && lastLI && isList(e) && firstLI === lastLI && (isList(firstLI) || firstLI.style.listStyleType === 'none' || containsOnlyAList(firstLI)); | |
108 | 108 | } |
109 | - | |
109 | + | |
110 | 110 | function containsOnlyAList(e) { |
111 | 111 | var firstChild = skipWhitespaceNodesForwards(e.firstChild), lastChild = skipWhitespaceNodesBackwards(e.lastChild); |
112 | 112 | return firstChild && lastChild && firstChild === lastChild && isList(firstChild); |
113 | 113 | } |
114 | - | |
114 | + | |
115 | 115 | function merge(e1, e2, masterElement) { |
116 | 116 | var lastOriginal = skipWhitespaceNodesBackwards(e1.lastChild), firstNew = skipWhitespaceNodesForwards(e2.firstChild); |
117 | 117 | if (e1.tagName === 'P') { |
... | ... | @@ -127,7 +127,7 @@ |
127 | 127 | attemptMerge(lastOriginal, firstNew, false); |
128 | 128 | return e1; |
129 | 129 | } |
130 | - | |
130 | + | |
131 | 131 | function findItemToOperateOn(e, dom) { |
132 | 132 | var item; |
133 | 133 | if (!dom.is(e, 'li,ol,ul')) { |
... | ... | @@ -138,27 +138,219 @@ |
138 | 138 | } |
139 | 139 | return e; |
140 | 140 | } |
141 | - | |
141 | + | |
142 | 142 | tinymce.create('tinymce.plugins.Lists', { |
143 | - init: function(ed, url) { | |
144 | - var enterDownInEmptyList = false; | |
145 | - function isTriggerKey(e) { | |
146 | - return e.keyCode === 9 && (ed.queryCommandState('InsertUnorderedList') || ed.queryCommandState('InsertOrderedList')); | |
143 | + init: function(ed) { | |
144 | + var LIST_TABBING = 'TABBING'; | |
145 | + var LIST_EMPTY_ITEM = 'EMPTY'; | |
146 | + var LIST_ESCAPE = 'ESCAPE'; | |
147 | + var LIST_PARAGRAPH = 'PARAGRAPH'; | |
148 | + var LIST_UNKNOWN = 'UNKNOWN'; | |
149 | + var state = LIST_UNKNOWN; | |
150 | + | |
151 | + function isTabInList(e) { | |
152 | + // Don't indent on Ctrl+Tab or Alt+Tab | |
153 | + return e.keyCode === tinymce.VK.TAB && !(e.altKey || e.ctrlKey) && | |
154 | + (ed.queryCommandState('InsertUnorderedList') || ed.queryCommandState('InsertOrderedList')); | |
147 | 155 | } |
148 | - function isEnterInEmptyListItem(ed, e) { | |
149 | - var sel = ed.selection, n; | |
150 | - if (e.keyCode === 13) { | |
151 | - n = sel.getStart(); | |
152 | - enterDownInEmptyList = sel.isCollapsed() && n && n.tagName === 'LI' && n.childNodes.length === 0; | |
153 | - return enterDownInEmptyList; | |
156 | + | |
157 | + function isOnLastListItem() { | |
158 | + var li = getLi(); | |
159 | + var grandParent = li.parentNode.parentNode; | |
160 | + var isLastItem = li.parentNode.lastChild === li; | |
161 | + return isLastItem && !isNestedList(grandParent) && isEmptyListItem(li); | |
162 | + } | |
163 | + | |
164 | + function isNestedList(grandParent) { | |
165 | + if (isList(grandParent)) { | |
166 | + return grandParent.parentNode && grandParent.parentNode.tagName === 'LI'; | |
167 | + } else { | |
168 | + return grandParent.tagName === 'LI'; | |
154 | 169 | } |
155 | 170 | } |
156 | - function cancelKeys(ed, e) { | |
157 | - if (isTriggerKey(e) || isEnterInEmptyListItem(ed, e)) { | |
158 | - return Event.cancel(e); | |
171 | + | |
172 | + function isInEmptyListItem() { | |
173 | + return ed.selection.isCollapsed() && isEmptyListItem(getLi()); | |
174 | + } | |
175 | + | |
176 | + function getLi() { | |
177 | + var n = ed.selection.getStart(); | |
178 | + // Get start will return BR if the LI only contains a BR or an empty element as we use these to fix caret position | |
179 | + return ((n.tagName == 'BR' || n.tagName == '') && n.parentNode.tagName == 'LI') ? n.parentNode : n; | |
180 | + } | |
181 | + | |
182 | + function isEmptyListItem(li) { | |
183 | + var numChildren = li.childNodes.length; | |
184 | + if (li.tagName === 'LI') { | |
185 | + return numChildren == 0 ? true : numChildren == 1 && (li.firstChild.tagName == '' || li.firstChild.tagName == 'BR' || isEmptyIE9Li(li)); | |
186 | + } | |
187 | + return false; | |
188 | + } | |
189 | + | |
190 | + function isEmptyIE9Li(li) { | |
191 | + // only consider this to be last item if there is no list item content or that content is nbsp or space since IE9 creates these | |
192 | + var lis = tinymce.grep(li.parentNode.childNodes, function(n) {return n.tagName == 'LI'}); | |
193 | + var isLastLi = li == lis[lis.length - 1]; | |
194 | + var child = li.firstChild; | |
195 | + return tinymce.isIE9 && isLastLi && (child.nodeValue == String.fromCharCode(160) || child.nodeValue == String.fromCharCode(32)); | |
196 | + } | |
197 | + | |
198 | + function isEnter(e) { | |
199 | + return e.keyCode === tinymce.VK.ENTER; | |
200 | + } | |
201 | + | |
202 | + function isEnterWithoutShift(e) { | |
203 | + return isEnter(e) && !e.shiftKey; | |
204 | + } | |
205 | + | |
206 | + function getListKeyState(e) { | |
207 | + if (isTabInList(e)) { | |
208 | + return LIST_TABBING; | |
209 | + } else if (isEnterWithoutShift(e) && isOnLastListItem()) { | |
210 | + // Returns LIST_UNKNOWN since breaking out of lists is handled by the EnterKey.js logic now | |
211 | + //return LIST_ESCAPE; | |
212 | + return LIST_UNKNOWN; | |
213 | + } else if (isEnterWithoutShift(e) && isInEmptyListItem()) { | |
214 | + return LIST_EMPTY_ITEM; | |
215 | + } else { | |
216 | + return LIST_UNKNOWN; | |
217 | + } | |
218 | + } | |
219 | + | |
220 | + function cancelDefaultEvents(ed, e) { | |
221 | + // list escape is done manually using outdent as it does not create paragraphs correctly in td's | |
222 | + if (state == LIST_TABBING || state == LIST_EMPTY_ITEM || tinymce.isGecko && state == LIST_ESCAPE) { | |
223 | + Event.cancel(e); | |
224 | + } | |
225 | + } | |
226 | + | |
227 | + function isCursorAtEndOfContainer() { | |
228 | + var range = ed.selection.getRng(true); | |
229 | + var startContainer = range.startContainer; | |
230 | + if (startContainer.nodeType == 3) { | |
231 | + var value = startContainer.nodeValue; | |
232 | + if (tinymce.isIE9 && value.length > 1 && value.charCodeAt(value.length-1) == 32) { | |
233 | + // IE9 places a space on the end of the text in some cases so ignore last char | |
234 | + return (range.endOffset == value.length-1); | |
235 | + } else { | |
236 | + return (range.endOffset == value.length); | |
237 | + } | |
238 | + } else if (startContainer.nodeType == 1) { | |
239 | + return range.endOffset == startContainer.childNodes.length; | |
240 | + } | |
241 | + return false; | |
242 | + } | |
243 | + | |
244 | + /* | |
245 | + If we are at the end of a list item surrounded with an element, pressing enter should create a | |
246 | + new list item instead without splitting the element e.g. don't want to create new P or H1 tag | |
247 | + */ | |
248 | + function isEndOfListItem() { | |
249 | + var node = ed.selection.getNode(); | |
250 | + var validElements = 'h1,h2,h3,h4,h5,h6,p,div'; | |
251 | + var isLastParagraphOfLi = ed.dom.is(node, validElements) && node.parentNode.tagName === 'LI' && node.parentNode.lastChild === node; | |
252 | + return ed.selection.isCollapsed() && isLastParagraphOfLi && isCursorAtEndOfContainer(); | |
253 | + } | |
254 | + | |
255 | + // Creates a new list item after the current selection's list item parent | |
256 | + function createNewLi(ed, e) { | |
257 | + if (isEnterWithoutShift(e) && isEndOfListItem()) { | |
258 | + var node = ed.selection.getNode(); | |
259 | + var li = ed.dom.create("li"); | |
260 | + var parentLi = ed.dom.getParent(node, 'li'); | |
261 | + ed.dom.insertAfter(li, parentLi); | |
262 | + | |
263 | + // Move caret to new list element. | |
264 | + if (tinymce.isIE6 || tinymce.isIE7 || tinyMCE.isIE8) { | |
265 | + // Removed this line since it would create an odd < > tag and placing the caret inside an empty LI is handled and should be handled by the selection logic | |
266 | + //li.appendChild(ed.dom.create(" ")); // IE needs an element within the bullet point | |
267 | + ed.selection.setCursorLocation(li, 1); | |
268 | + } else { | |
269 | + ed.selection.setCursorLocation(li, 0); | |
270 | + } | |
271 | + e.preventDefault(); | |
159 | 272 | } |
160 | 273 | } |
161 | - | |
274 | + | |
275 | + function imageJoiningListItem(ed, e) { | |
276 | + var prevSibling; | |
277 | + | |
278 | + if (!tinymce.isGecko) | |
279 | + return; | |
280 | + | |
281 | + var n = ed.selection.getStart(); | |
282 | + if (e.keyCode != tinymce.VK.BACKSPACE || n.tagName !== 'IMG') | |
283 | + return; | |
284 | + | |
285 | + function lastLI(node) { | |
286 | + var child = node.firstChild; | |
287 | + var li = null; | |
288 | + do { | |
289 | + if (!child) | |
290 | + break; | |
291 | + | |
292 | + if (child.tagName === 'LI') | |
293 | + li = child; | |
294 | + } while (child = child.nextSibling); | |
295 | + | |
296 | + return li; | |
297 | + } | |
298 | + | |
299 | + function addChildren(parentNode, destination) { | |
300 | + while (parentNode.childNodes.length > 0) | |
301 | + destination.appendChild(parentNode.childNodes[0]); | |
302 | + } | |
303 | + | |
304 | + // Check if there is a previous sibling | |
305 | + prevSibling = n.parentNode.previousSibling; | |
306 | + if (!prevSibling) | |
307 | + return; | |
308 | + | |
309 | + var ul; | |
310 | + if (prevSibling.tagName === 'UL' || prevSibling.tagName === 'OL') | |
311 | + ul = prevSibling; | |
312 | + else if (prevSibling.previousSibling && (prevSibling.previousSibling.tagName === 'UL' || prevSibling.previousSibling.tagName === 'OL')) | |
313 | + ul = prevSibling.previousSibling; | |
314 | + else | |
315 | + return; | |
316 | + | |
317 | + var li = lastLI(ul); | |
318 | + | |
319 | + // move the caret to the end of the list item | |
320 | + var rng = ed.dom.createRng(); | |
321 | + rng.setStart(li, 1); | |
322 | + rng.setEnd(li, 1); | |
323 | + ed.selection.setRng(rng); | |
324 | + ed.selection.collapse(true); | |
325 | + | |
326 | + // save a bookmark at the end of the list item | |
327 | + var bookmark = ed.selection.getBookmark(); | |
328 | + | |
329 | + // copy the image an its text to the list item | |
330 | + var clone = n.parentNode.cloneNode(true); | |
331 | + if (clone.tagName === 'P' || clone.tagName === 'DIV') | |
332 | + addChildren(clone, li); | |
333 | + else | |
334 | + li.appendChild(clone); | |
335 | + | |
336 | + // remove the old copy of the image | |
337 | + n.parentNode.parentNode.removeChild(n.parentNode); | |
338 | + | |
339 | + // move the caret where we saved the bookmark | |
340 | + ed.selection.moveToBookmark(bookmark); | |
341 | + } | |
342 | + | |
343 | + // fix the cursor position to ensure it is correct in IE | |
344 | + function setCursorPositionToOriginalLi(li) { | |
345 | + var list = ed.dom.getParent(li, 'ol,ul'); | |
346 | + if (list != null) { | |
347 | + var lastLi = list.lastChild; | |
348 | + // Removed this line since IE9 would report an DOM character error and placing the caret inside an empty LI is handled and should be handled by the selection logic | |
349 | + //lastLi.appendChild(ed.getDoc().createElement('')); | |
350 | + ed.selection.setCursorLocation(lastLi, 0); | |
351 | + } | |
352 | + } | |
353 | + | |
162 | 354 | this.ed = ed; |
163 | 355 | ed.addCommand('Indent', this.indent, this); |
164 | 356 | ed.addCommand('Outdent', this.outdent, this); |
... | ... | @@ -168,84 +360,185 @@ |
168 | 360 | ed.addCommand('InsertOrderedList', function() { |
169 | 361 | this.applyList('OL', 'UL'); |
170 | 362 | }, this); |
171 | - | |
363 | + | |
172 | 364 | ed.onInit.add(function() { |
173 | 365 | ed.editorCommands.addCommands({ |
174 | 366 | 'outdent': function() { |
175 | 367 | var sel = ed.selection, dom = ed.dom; |
368 | + | |
176 | 369 | function hasStyleIndent(n) { |
177 | 370 | n = dom.getParent(n, dom.isBlock); |
178 | 371 | return n && (parseInt(ed.dom.getStyle(n, 'margin-left') || 0, 10) + parseInt(ed.dom.getStyle(n, 'padding-left') || 0, 10)) > 0; |
179 | 372 | } |
373 | + | |
180 | 374 | return hasStyleIndent(sel.getStart()) || hasStyleIndent(sel.getEnd()) || ed.queryCommandState('InsertOrderedList') || ed.queryCommandState('InsertUnorderedList'); |
181 | 375 | } |
182 | 376 | }, 'state'); |
183 | 377 | }); |
184 | - | |
378 | + | |
185 | 379 | ed.onKeyUp.add(function(ed, e) { |
186 | - var n, rng; | |
187 | - if (isTriggerKey(e)) { | |
380 | + if (state == LIST_TABBING) { | |
188 | 381 | ed.execCommand(e.shiftKey ? 'Outdent' : 'Indent', true, null); |
382 | + state = LIST_UNKNOWN; | |
189 | 383 | return Event.cancel(e); |
190 | - } else if (enterDownInEmptyList && isEnterInEmptyListItem(ed, e)) { | |
191 | - if (ed.queryCommandState('InsertOrderedList')) { | |
192 | - ed.execCommand('InsertOrderedList'); | |
193 | - } else { | |
194 | - ed.execCommand('InsertUnorderedList'); | |
195 | - } | |
196 | - n = ed.selection.getStart(); | |
197 | - if (n && n.tagName === 'LI') { | |
198 | - // Fix the caret position on IE since it jumps back up to the previous list item. | |
199 | - n = ed.dom.getParent(n, 'ol,ul').nextSibling; | |
200 | - if (n && n.tagName === 'P') { | |
201 | - if (!n.firstChild) { | |
202 | - n.appendChild(ed.getDoc().createTextNode('')); | |
203 | - } | |
204 | - rng = ed.dom.createRng(); | |
205 | - rng.setStart(n.firstChild, 1); | |
206 | - rng.setEnd(n.firstChild, 1); | |
207 | - ed.selection.setRng(rng); | |
208 | - } | |
384 | + } else if (state == LIST_EMPTY_ITEM) { | |
385 | + var li = getLi(); | |
386 | + var shouldOutdent = ed.settings.list_outdent_on_enter === true || e.shiftKey; | |
387 | + ed.execCommand(shouldOutdent ? 'Outdent' : 'Indent', true, null); | |
388 | + if (tinymce.isIE) { | |
389 | + setCursorPositionToOriginalLi(li); | |
209 | 390 | } |
391 | + | |
210 | 392 | return Event.cancel(e); |
393 | + } else if (state == LIST_ESCAPE) { | |
394 | + if (tinymce.isIE6 || tinymce.isIE7 || tinymce.isIE8) { | |
395 | + // append a zero sized nbsp so that caret is positioned correctly in IE after escaping and applying formatting. | |
396 | + // if there is no text then applying formatting for e.g a H1 to the P tag immediately following list after | |
397 | + // escaping from it will cause the caret to be positioned on the last li instead of staying the in P tag. | |
398 | + var n = ed.getDoc().createTextNode('\uFEFF'); | |
399 | + ed.selection.getNode().appendChild(n); | |
400 | + } else if (tinymce.isIE9 || tinymce.isGecko) { | |
401 | + // IE9 does not escape the list so we use outdent to do this and cancel the default behaviour | |
402 | + // Gecko does not create a paragraph outdenting inside a TD so default behaviour is cancelled and we outdent ourselves | |
403 | + ed.execCommand('Outdent'); | |
404 | + return Event.cancel(e); | |
405 | + } | |
211 | 406 | } |
212 | 407 | }); |
213 | - ed.onKeyPress.add(cancelKeys); | |
214 | - ed.onKeyDown.add(cancelKeys); | |
408 | + | |
409 | + function fixListItem(parent, reference) { | |
410 | + // a zero-sized non-breaking space is placed in the empty list item so that the nested list is | |
411 | + // displayed on the below line instead of next to it | |
412 | + var n = ed.getDoc().createTextNode('\uFEFF'); | |
413 | + parent.insertBefore(n, reference); | |
414 | + ed.selection.setCursorLocation(n, 0); | |
415 | + // repaint to remove rendering artifact. only visible when creating new list | |
416 | + ed.execCommand('mceRepaint'); | |
417 | + } | |
418 | + | |
419 | + function fixIndentedListItemForGecko(ed, e) { | |
420 | + if (isEnter(e)) { | |
421 | + var li = getLi(); | |
422 | + if (li) { | |
423 | + var parent = li.parentNode; | |
424 | + var grandParent = parent && parent.parentNode; | |
425 | + if (grandParent && grandParent.nodeName == 'LI' && grandParent.firstChild == parent && li == parent.firstChild) { | |
426 | + fixListItem(grandParent, parent); | |
427 | + } | |
428 | + } | |
429 | + } | |
430 | + } | |
431 | + | |
432 | + function fixIndentedListItemForIE8(ed, e) { | |
433 | + if (isEnter(e)) { | |
434 | + var li = getLi(); | |
435 | + if (ed.dom.select('ul li', li).length === 1) { | |
436 | + var list = li.firstChild; | |
437 | + fixListItem(li, list); | |
438 | + } | |
439 | + } | |
440 | + } | |
441 | + | |
442 | + function fixDeletingFirstCharOfList(ed, e) { | |
443 | + function listElements(li) { | |
444 | + var elements = []; | |
445 | + var walker = new tinymce.dom.TreeWalker(li.firstChild, li); | |
446 | + for (var node = walker.current(); node; node = walker.next()) { | |
447 | + if (ed.dom.is(node, 'ol,ul,li')) { | |
448 | + elements.push(node); | |
449 | + } | |
450 | + } | |
451 | + return elements; | |
452 | + } | |
453 | + | |
454 | + if (e.keyCode == tinymce.VK.BACKSPACE) { | |
455 | + var li = getLi(); | |
456 | + if (li) { | |
457 | + var list = ed.dom.getParent(li, 'ol,ul'), | |
458 | + rng = ed.selection.getRng(); | |
459 | + if (list && list.firstChild === li && rng.startOffset == 0) { | |
460 | + var elements = listElements(li); | |
461 | + elements.unshift(li); | |
462 | + ed.execCommand("Outdent", false, elements); | |
463 | + ed.undoManager.add(); | |
464 | + return Event.cancel(e); | |
465 | + } | |
466 | + } | |
467 | + } | |
468 | + } | |
469 | + | |
470 | + function fixDeletingEmptyLiInWebkit(ed, e) { | |
471 | + var li = getLi(); | |
472 | + if (e.keyCode === tinymce.VK.BACKSPACE && ed.dom.is(li, 'li') && li.parentNode.firstChild!==li) { | |
473 | + if (ed.dom.select('ul,ol', li).length === 1) { | |
474 | + var prevLi = li.previousSibling; | |
475 | + ed.dom.remove(ed.dom.select('br', li)); | |
476 | + ed.dom.remove(li, true); | |
477 | + var textNodes = tinymce.grep(prevLi.childNodes, function(n){ return n.nodeType === 3 }); | |
478 | + if (textNodes.length === 1) { | |
479 | + var textNode = textNodes[0]; | |
480 | + ed.selection.setCursorLocation(textNode, textNode.length); | |
481 | + } | |
482 | + ed.undoManager.add(); | |
483 | + return Event.cancel(e); | |
484 | + } | |
485 | + } | |
486 | + } | |
487 | + | |
488 | + ed.onKeyDown.add(function(_, e) { state = getListKeyState(e); }); | |
489 | + ed.onKeyDown.add(cancelDefaultEvents); | |
490 | + ed.onKeyDown.add(imageJoiningListItem); | |
491 | + ed.onKeyDown.add(createNewLi); | |
492 | + | |
493 | + if (tinymce.isGecko) { | |
494 | + ed.onKeyUp.add(fixIndentedListItemForGecko); | |
495 | + } | |
496 | + if (tinymce.isIE8) { | |
497 | + ed.onKeyUp.add(fixIndentedListItemForIE8); | |
498 | + } | |
499 | + if (tinymce.isGecko || tinymce.isWebKit) { | |
500 | + ed.onKeyDown.add(fixDeletingFirstCharOfList); | |
501 | + } | |
502 | + if (tinymce.isWebKit) { | |
503 | + ed.onKeyDown.add(fixDeletingEmptyLiInWebkit); | |
504 | + } | |
215 | 505 | }, |
216 | - | |
506 | + | |
217 | 507 | applyList: function(targetListType, oppositeListType) { |
218 | 508 | var t = this, ed = t.ed, dom = ed.dom, applied = [], hasSameType = false, hasOppositeType = false, hasNonList = false, actions, |
219 | - selectedBlocks = ed.selection.getSelectedBlocks(); | |
220 | - | |
509 | + selectedBlocks = ed.selection.getSelectedBlocks(); | |
510 | + | |
221 | 511 | function cleanupBr(e) { |
222 | 512 | if (e && e.tagName === 'BR') { |
223 | 513 | dom.remove(e); |
224 | 514 | } |
225 | 515 | } |
226 | - | |
516 | + | |
227 | 517 | function makeList(element) { |
228 | 518 | var list = dom.create(targetListType), li; |
519 | + | |
229 | 520 | function adjustIndentForNewList(element) { |
230 | 521 | // If there's a margin-left, outdent one level to account for the extra list margin. |
231 | 522 | if (element.style.marginLeft || element.style.paddingLeft) { |
232 | 523 | t.adjustPaddingFunction(false)(element); |
233 | 524 | } |
234 | 525 | } |
235 | - | |
526 | + | |
236 | 527 | if (element.tagName === 'LI') { |
237 | 528 | // No change required. |
238 | 529 | } else if (element.tagName === 'P' || element.tagName === 'DIV' || element.tagName === 'BODY') { |
239 | - processBrs(element, function(startSection, br, previousBR) { | |
530 | + processBrs(element, function(startSection, br) { | |
240 | 531 | doWrapList(startSection, br, element.tagName === 'BODY' ? null : startSection.parentNode); |
241 | 532 | li = startSection.parentNode; |
242 | 533 | adjustIndentForNewList(li); |
243 | 534 | cleanupBr(br); |
244 | 535 | }); |
245 | - if (element.tagName === 'P' || selectedBlocks.length > 1) { | |
246 | - dom.split(li.parentNode.parentNode, li.parentNode); | |
536 | + if (li) { | |
537 | + if (li.tagName === 'LI' && (element.tagName === 'P' || selectedBlocks.length > 1)) { | |
538 | + dom.split(li.parentNode.parentNode, li.parentNode); | |
539 | + } | |
540 | + attemptMergeWithAdjacent(li.parentNode, true); | |
247 | 541 | } |
248 | - attemptMergeWithAdjacent(li.parentNode, true); | |
249 | 542 | return; |
250 | 543 | } else { |
251 | 544 | // Put the list around the element. |
... | ... | @@ -260,9 +553,9 @@ |
260 | 553 | attemptMergeWithAdjacent(list, true); |
261 | 554 | applied.push(element); |
262 | 555 | } |
263 | - | |
556 | + | |
264 | 557 | function doWrapList(start, end, template) { |
265 | - var li, n = start, tmp, i; | |
558 | + var li, n = start, tmp; | |
266 | 559 | while (!dom.isBlock(start.parentNode) && start.parentNode !== dom.getRoot()) { |
267 | 560 | start = dom.split(start.parentNode, start.previousSibling); |
268 | 561 | start = start.nextSibling; |
... | ... | @@ -287,10 +580,11 @@ |
287 | 580 | } |
288 | 581 | makeList(li); |
289 | 582 | } |
290 | - | |
583 | + | |
291 | 584 | function processBrs(element, callback) { |
292 | 585 | var startSection, previousBR, END_TO_START = 3, START_TO_END = 1, |
293 | - breakElements = 'br,ul,ol,p,div,h1,h2,h3,h4,h5,h6,table,blockquote,address,pre,form,center,dl'; | |
586 | + breakElements = 'br,ul,ol,p,div,h1,h2,h3,h4,h5,h6,table,blockquote,address,pre,form,center,dl'; | |
587 | + | |
294 | 588 | function isAnyPartSelected(start, end) { |
295 | 589 | var r = dom.createRng(), sel; |
296 | 590 | bookmark.keep = true; |
... | ... | @@ -304,18 +598,19 @@ |
304 | 598 | r.setEndAfter(end); |
305 | 599 | return !(r.compareBoundaryPoints(END_TO_START, sel) > 0 || r.compareBoundaryPoints(START_TO_END, sel) <= 0); |
306 | 600 | } |
601 | + | |
307 | 602 | function nextLeaf(br) { |
308 | 603 | if (br.nextSibling) |
309 | 604 | return br.nextSibling; |
310 | 605 | if (!dom.isBlock(br.parentNode) && br.parentNode !== dom.getRoot()) |
311 | 606 | return nextLeaf(br.parentNode); |
312 | 607 | } |
608 | + | |
313 | 609 | // Split on BRs within the range and process those. |
314 | 610 | startSection = element.firstChild; |
315 | 611 | // First mark the BRs that have any part of the previous section selected. |
316 | 612 | var trailingContentSelected = false; |
317 | 613 | each(dom.select(breakElements, element), function(br) { |
318 | - var b; | |
319 | 614 | if (br.hasAttribute && br.hasAttribute('_mce_bogus')) { |
320 | 615 | return true; // Skip the bogus Brs that are put in to appease Firefox and Safari. |
321 | 616 | } |
... | ... | @@ -344,7 +639,7 @@ |
344 | 639 | callback(startSection, undefined, previousBR); |
345 | 640 | } |
346 | 641 | } |
347 | - | |
642 | + | |
348 | 643 | function wrapList(element) { |
349 | 644 | processBrs(element, function(startSection, br, previousBR) { |
350 | 645 | // Need to indent this part |
... | ... | @@ -353,7 +648,7 @@ |
353 | 648 | cleanupBr(previousBR); |
354 | 649 | }); |
355 | 650 | } |
356 | - | |
651 | + | |
357 | 652 | function changeList(element) { |
358 | 653 | if (tinymce.inArray(applied, element) !== -1) { |
359 | 654 | return; |
... | ... | @@ -365,7 +660,7 @@ |
365 | 660 | } |
366 | 661 | applied.push(element); |
367 | 662 | } |
368 | - | |
663 | + | |
369 | 664 | function convertListItemToParagraph(element) { |
370 | 665 | var child, nextChild, mergedElement, splitLast; |
371 | 666 | if (tinymce.inArray(applied, element) !== -1) { |
... | ... | @@ -387,7 +682,7 @@ |
387 | 682 | if (dom.isBlock(child)) { |
388 | 683 | child = dom.split(child.parentNode, child); |
389 | 684 | splitLast = true; |
390 | - nextChild = child.nextSibling && child.nextSibling.firstChild; | |
685 | + nextChild = child.nextSibling && child.nextSibling.firstChild; | |
391 | 686 | } else { |
392 | 687 | nextChild = child.nextSibling; |
393 | 688 | if (splitLast && child.tagName === 'BR') { |
... | ... | @@ -399,7 +694,7 @@ |
399 | 694 | } |
400 | 695 | } |
401 | 696 | } |
402 | - | |
697 | + | |
403 | 698 | each(selectedBlocks, function(e) { |
404 | 699 | e = findItemToOperateOn(e, dom); |
405 | 700 | if (e.tagName === oppositeListType || (e.tagName === 'LI' && e.parentNode.tagName === oppositeListType)) { |
... | ... | @@ -411,7 +706,7 @@ |
411 | 706 | } |
412 | 707 | }); |
413 | 708 | |
414 | - if (hasNonList || hasOppositeType || selectedBlocks.length === 0) { | |
709 | + if (hasNonList &&!hasSameType || hasOppositeType || selectedBlocks.length === 0) { | |
415 | 710 | actions = { |
416 | 711 | 'LI': changeList, |
417 | 712 | 'H1': makeList, |
... | ... | @@ -423,32 +718,35 @@ |
423 | 718 | 'P': makeList, |
424 | 719 | 'BODY': makeList, |
425 | 720 | 'DIV': selectedBlocks.length > 1 ? makeList : wrapList, |
426 | - defaultAction: wrapList | |
721 | + defaultAction: wrapList, | |
722 | + elements: this.selectedBlocks() | |
427 | 723 | }; |
428 | 724 | } else { |
429 | 725 | actions = { |
430 | - defaultAction: convertListItemToParagraph | |
726 | + defaultAction: convertListItemToParagraph, | |
727 | + elements: this.selectedBlocks(), | |
728 | + processEvenIfEmpty: true | |
431 | 729 | }; |
432 | 730 | } |
433 | 731 | this.process(actions); |
434 | 732 | }, |
435 | - | |
733 | + | |
436 | 734 | indent: function() { |
437 | 735 | var ed = this.ed, dom = ed.dom, indented = []; |
438 | - | |
736 | + | |
439 | 737 | function createWrapItem(element) { |
440 | 738 | var wrapItem = dom.create('li', { style: 'list-style-type: none;'}); |
441 | 739 | dom.insertAfter(wrapItem, element); |
442 | 740 | return wrapItem; |
443 | 741 | } |
444 | - | |
742 | + | |
445 | 743 | function createWrapList(element) { |
446 | 744 | var wrapItem = createWrapItem(element), |
447 | - list = dom.getParent(element, 'ol,ul'), | |
448 | - listType = list.tagName, | |
449 | - listStyle = dom.getStyle(list, 'list-style-type'), | |
450 | - attrs = {}, | |
451 | - wrapList; | |
745 | + list = dom.getParent(element, 'ol,ul'), | |
746 | + listType = list.tagName, | |
747 | + listStyle = dom.getStyle(list, 'list-style-type'), | |
748 | + attrs = {}, | |
749 | + wrapList; | |
452 | 750 | if (listStyle !== '') { |
453 | 751 | attrs.style = 'list-style-type: ' + listStyle + ';'; |
454 | 752 | } |
... | ... | @@ -456,7 +754,7 @@ |
456 | 754 | wrapItem.appendChild(wrapList); |
457 | 755 | return wrapList; |
458 | 756 | } |
459 | - | |
757 | + | |
460 | 758 | function indentLI(element) { |
461 | 759 | if (!hasParentInList(ed, element, indented)) { |
462 | 760 | element = splitNestedLists(element, dom); |
... | ... | @@ -467,17 +765,18 @@ |
467 | 765 | indented.push(element); |
468 | 766 | } |
469 | 767 | } |
470 | - | |
768 | + | |
471 | 769 | this.process({ |
472 | 770 | 'LI': indentLI, |
473 | - defaultAction: this.adjustPaddingFunction(true) | |
771 | + defaultAction: this.adjustPaddingFunction(true), | |
772 | + elements: this.selectedBlocks() | |
474 | 773 | }); |
475 | - | |
774 | + | |
476 | 775 | }, |
477 | - | |
478 | - outdent: function() { | |
776 | + | |
777 | + outdent: function(ui, elements) { | |
479 | 778 | var t = this, ed = t.ed, dom = ed.dom, outdented = []; |
480 | - | |
779 | + | |
481 | 780 | function outdentLI(element) { |
482 | 781 | var listElement, targetParent, align; |
483 | 782 | if (!hasParentInList(ed, element, outdented)) { |
... | ... | @@ -506,20 +805,31 @@ |
506 | 805 | outdented.push(element); |
507 | 806 | } |
508 | 807 | } |
509 | - | |
808 | + | |
809 | + var listElements = elements && tinymce.is(elements, 'array') ? elements : this.selectedBlocks(); | |
510 | 810 | this.process({ |
511 | 811 | 'LI': outdentLI, |
512 | - defaultAction: this.adjustPaddingFunction(false) | |
812 | + defaultAction: this.adjustPaddingFunction(false), | |
813 | + elements: listElements | |
513 | 814 | }); |
514 | - | |
815 | + | |
515 | 816 | each(outdented, attemptMergeWithAdjacent); |
516 | 817 | }, |
517 | - | |
818 | + | |
518 | 819 | process: function(actions) { |
519 | 820 | var t = this, sel = t.ed.selection, dom = t.ed.dom, selectedBlocks, r; |
821 | + | |
822 | + function isEmptyElement(element) { | |
823 | + var excludeBrsAndBookmarks = tinymce.grep(element.childNodes, function(n) { | |
824 | + return !(n.nodeName === 'BR' || n.nodeName === 'SPAN' && dom.getAttrib(n, 'data-mce-type') == 'bookmark' | |
825 | + || n.nodeType == 3 && (n.nodeValue == String.fromCharCode(160) || n.nodeValue == '')); | |
826 | + }); | |
827 | + return excludeBrsAndBookmarks.length === 0; | |
828 | + } | |
829 | + | |
520 | 830 | function processElement(element) { |
521 | 831 | dom.removeClass(element, '_mce_act_on'); |
522 | - if (!element || element.nodeType !== 1) { | |
832 | + if (!element || element.nodeType !== 1 || ! actions.processEvenIfEmpty && selectedBlocks.length > 1 && isEmptyElement(element)) { | |
523 | 833 | return; |
524 | 834 | } |
525 | 835 | element = findItemToOperateOn(element, dom); |
... | ... | @@ -529,18 +839,24 @@ |
529 | 839 | } |
530 | 840 | action(element); |
531 | 841 | } |
842 | + | |
532 | 843 | function recurse(element) { |
533 | - t.splitSafeEach(element.childNodes, processElement); | |
844 | + t.splitSafeEach(element.childNodes, processElement, true); | |
534 | 845 | } |
846 | + | |
535 | 847 | function brAtEdgeOfSelection(container, offset) { |
536 | 848 | return offset >= 0 && container.hasChildNodes() && offset < container.childNodes.length && |
537 | 849 | container.childNodes[offset].tagName === 'BR'; |
538 | 850 | } |
539 | - selectedBlocks = sel.getSelectedBlocks(); | |
540 | - if (selectedBlocks.length === 0) { | |
541 | - selectedBlocks = [ dom.getRoot() ]; | |
851 | + | |
852 | + function isInTable() { | |
853 | + var n = sel.getNode(); | |
854 | + var p = dom.getParent(n, 'td'); | |
855 | + return p !== null; | |
542 | 856 | } |
543 | 857 | |
858 | + selectedBlocks = actions.elements; | |
859 | + | |
544 | 860 | r = sel.getRng(true); |
545 | 861 | if (!r.collapsed) { |
546 | 862 | if (brAtEdgeOfSelection(r.endContainer, r.endOffset - 1)) { |
... | ... | @@ -552,24 +868,41 @@ |
552 | 868 | sel.setRng(r); |
553 | 869 | } |
554 | 870 | } |
871 | + | |
872 | + | |
873 | + if (tinymce.isIE8) { | |
874 | + // append a zero sized nbsp so that caret is restored correctly using bookmark | |
875 | + var s = t.ed.selection.getNode(); | |
876 | + if (s.tagName === 'LI' && !(s.parentNode.lastChild === s)) { | |
877 | + var i = t.ed.getDoc().createTextNode('\uFEFF'); | |
878 | + s.appendChild(i); | |
879 | + } | |
880 | + } | |
881 | + | |
555 | 882 | bookmark = sel.getBookmark(); |
556 | 883 | actions.OL = actions.UL = recurse; |
557 | 884 | t.splitSafeEach(selectedBlocks, processElement); |
558 | 885 | sel.moveToBookmark(bookmark); |
559 | 886 | bookmark = null; |
560 | - // Avoids table or image handles being left behind in Firefox. | |
561 | - t.ed.execCommand('mceRepaint'); | |
887 | + | |
888 | + // we avoid doing repaint in a table as this will move the caret out of the table in Firefox 3.6 | |
889 | + if (!isInTable()) { | |
890 | + // Avoids table or image handles being left behind in Firefox. | |
891 | + t.ed.execCommand('mceRepaint'); | |
892 | + } | |
562 | 893 | }, |
563 | - | |
564 | - splitSafeEach: function(elements, f) { | |
565 | - if (tinymce.isGecko && (/Firefox\/[12]\.[0-9]/.test(navigator.userAgent) || | |
566 | - /Firefox\/3\.[0-4]/.test(navigator.userAgent))) { | |
894 | + | |
895 | + splitSafeEach: function(elements, f, forceClassBase) { | |
896 | + if (forceClassBase || | |
897 | + (tinymce.isGecko && | |
898 | + (/Firefox\/[12]\.[0-9]/.test(navigator.userAgent) || | |
899 | + /Firefox\/3\.[0-4]/.test(navigator.userAgent)))) { | |
567 | 900 | this.classBasedEach(elements, f); |
568 | 901 | } else { |
569 | 902 | each(elements, f); |
570 | 903 | } |
571 | 904 | }, |
572 | - | |
905 | + | |
573 | 906 | classBasedEach: function(elements, f) { |
574 | 907 | var dom = this.ed.dom, nodes, element; |
575 | 908 | // Mark nodes |
... | ... | @@ -584,7 +917,7 @@ |
584 | 917 | nodes = dom.select('._mce_act_on'); |
585 | 918 | } |
586 | 919 | }, |
587 | - | |
920 | + | |
588 | 921 | adjustPaddingFunction: function(isIndent) { |
589 | 922 | var indentAmount, indentUnits, ed = this.ed; |
590 | 923 | indentAmount = ed.settings.indentation; |
... | ... | @@ -602,7 +935,12 @@ |
602 | 935 | ed.dom.setStyle(element, 'margin-left', newIndentAmount > 0 ? newIndentAmount + indentUnits : ''); |
603 | 936 | }; |
604 | 937 | }, |
605 | - | |
938 | + | |
939 | + selectedBlocks: function() { | |
940 | + var ed = this.ed, selectedBlocks = ed.selection.getSelectedBlocks(); | |
941 | + return selectedBlocks.length == 0 ? [ ed.dom.getRoot() ] : selectedBlocks; | |
942 | + }, | |
943 | + | |
606 | 944 | getInfo: function() { |
607 | 945 | return { |
608 | 946 | longname : 'Lists', | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/media/editor_plugin.js
1 | -(function(){var d=tinymce.explode("id,name,width,height,style,align,class,hspace,vspace,bgcolor,type"),h=tinymce.makeMap(d.join(",")),b=tinymce.html.Node,f,a,g=tinymce.util.JSON,e;f=[["Flash","d27cdb6e-ae6d-11cf-96b8-444553540000","application/x-shockwave-flash","http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"],["ShockWave","166b1bca-3f9c-11cf-8075-444553540000","application/x-director","http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0"],["WindowsMedia","6bf52a52-394a-11d3-b153-00c04f79faa6,22d6f312-b0f6-11d0-94ab-0080c74c7e95,05589fa1-c356-11ce-bf01-00aa0055595a","application/x-mplayer2","http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"],["QuickTime","02bf25d5-8c17-4b23-bc80-d3488abddc6b","video/quicktime","http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0"],["RealMedia","cfcdaa03-8be4-11cf-b84b-0020afbbccfa","audio/x-pn-realaudio-plugin","http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"],["Java","8ad9c840-044e-11d1-b3e9-00805f499d93","application/x-java-applet","http://java.sun.com/products/plugin/autodl/jinstall-1_5_0-windows-i586.cab#Version=1,5,0,0"],["Silverlight","dfeaf541-f3e1-4c24-acac-99c30715084a","application/x-silverlight-2"],["Iframe"],["Video"]];function c(m){var l,j,k;if(m&&!m.splice){j=[];for(k=0;true;k++){if(m[k]){j[k]=m[k]}else{break}}return j}return m}tinymce.create("tinymce.plugins.MediaPlugin",{init:function(n,j){var r=this,l={},m,p,q,k;function o(i){return i&&i.nodeName==="IMG"&&n.dom.hasClass(i,"mceItemMedia")}r.editor=n;r.url=j;a="";for(m=0;m<f.length;m++){k=f[m][0];q={name:k,clsids:tinymce.explode(f[m][1]||""),mimes:tinymce.explode(f[m][2]||""),codebase:f[m][3]};for(p=0;p<q.clsids.length;p++){l["clsid:"+q.clsids[p]]=q}for(p=0;p<q.mimes.length;p++){l[q.mimes[p]]=q}l["mceItem"+k]=q;l[k.toLowerCase()]=q;a+=(a?"|":"")+k}tinymce.each(n.getParam("media_types","video=mp4,m4v,ogv,webm;silverlight=xap;flash=swf,flv;shockwave=dcr;quicktime=mov,qt,mpg,mp3,mpeg;shockwave=dcr;windowsmedia=avi,wmv,wm,asf,asx,wmx,wvx;realmedia=rm,ra,ram;java=jar").split(";"),function(v){var s,u,t;v=v.split(/=/);u=tinymce.explode(v[1].toLowerCase());for(s=0;s<u.length;s++){t=l[v[0].toLowerCase()];if(t){l[u[s]]=t}}});a=new RegExp("write("+a+")\\(([^)]+)\\)");r.lookup=l;n.onPreInit.add(function(){n.schema.addValidElements("object[id|style|width|height|classid|codebase|*],param[name|value],embed[id|style|width|height|type|src|*],video[*],audio[*],source[*]");n.parser.addNodeFilter("object,embed,video,audio,script,iframe",function(s){var t=s.length;while(t--){r.objectToImg(s[t])}});n.serializer.addNodeFilter("img",function(s,u,t){var v=s.length,w;while(v--){w=s[v];if((w.attr("class")||"").indexOf("mceItemMedia")!==-1){r.imgToObject(w,t)}}})});n.onInit.add(function(){if(n.theme&&n.theme.onResolveName){n.theme.onResolveName.add(function(i,s){if(s.name==="img"&&n.dom.hasClass(s.node,"mceItemMedia")){s.name="media"}})}if(n&&n.plugins.contextmenu){n.plugins.contextmenu.onContextMenu.add(function(s,t,i){if(i.nodeName==="IMG"&&i.className.indexOf("mceItemMedia")!==-1){t.add({title:"media.edit",icon:"media",cmd:"mceMedia"})}})}});n.addCommand("mceMedia",function(){var s,i;i=n.selection.getNode();if(o(i)){s=g.parse(n.dom.getAttrib(i,"data-mce-json"));tinymce.each(d,function(t){var u=n.dom.getAttrib(i,t);if(u){s[t]=u}});s.type=r.getType(i.className).name.toLowerCase()}if(!s){s={type:"flash",video:{sources:[]},params:{}}}n.windowManager.open({file:j+"/media.htm",width:430+parseInt(n.getLang("media.delta_width",0)),height:500+parseInt(n.getLang("media.delta_height",0)),inline:1},{plugin_url:j,data:s})});n.addButton("media",{title:"media.desc",cmd:"mceMedia"});n.onNodeChange.add(function(s,i,t){i.setActive("media",o(t))})},convertUrl:function(k,n){var j=this,m=j.editor,l=m.settings,o=l.url_converter,i=l.url_converter_scope||j;if(!k){return k}if(n){return m.documentBaseURI.toAbsolute(k)}return o.call(i,k,"src","object")},getInfo:function(){return{longname:"Media",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media",version:tinymce.majorVersion+"."+tinymce.minorVersion}},dataToImg:function(m,k){var r=this,o=r.editor,p=o.documentBaseURI,j,q,n,l;m.params.src=r.convertUrl(m.params.src,k);q=m.video.attrs;if(q){q.src=r.convertUrl(q.src,k)}if(q){q.poster=r.convertUrl(q.poster,k)}j=c(m.video.sources);if(j){for(l=0;l<j.length;l++){j[l].src=r.convertUrl(j[l].src,k)}}n=r.editor.dom.create("img",{id:m.id,style:m.style,align:m.align,src:r.editor.theme.url+"/img/trans.gif","class":"mceItemMedia mceItem"+r.getType(m.type).name,"data-mce-json":g.serialize(m,"'")});n.width=m.width||"320";n.height=m.height||"240";return n},dataToHtml:function(i,j){return this.editor.serializer.serialize(this.dataToImg(i,j),{force_absolute:j})},htmlToData:function(k){var j,i,l;l={type:"flash",video:{sources:[]},params:{}};j=this.editor.parser.parse(k);i=j.getAll("img")[0];if(i){l=g.parse(i.attr("data-mce-json"));l.type=this.getType(i.attr("class")).name.toLowerCase();tinymce.each(d,function(m){var n=i.attr(m);if(n){l[m]=n}})}return l},getType:function(m){var k,j,l;j=tinymce.explode(m," ");for(k=0;k<j.length;k++){l=this.lookup[j[k]];if(l){return l}}},imgToObject:function(x,n){var t=this,o=t.editor,A,E,j,s,F,w,D,u,k,C,r,p,y,B,m,v,l,z;function q(i,G){var K,J,L,I,H;H=o.getParam("flash_video_player_url",t.convertUrl(t.url+"/moxieplayer.swf"));if(H){K=o.documentBaseURI;D.params.src=H;if(o.getParam("flash_video_player_absvideourl",true)){i=K.toAbsolute(i||"",true);G=K.toAbsolute(G||"",true)}L="";J=o.getParam("flash_video_player_flashvars",{url:"$url",poster:"$poster"});tinymce.each(J,function(N,M){N=N.replace(/\$url/,i||"");N=N.replace(/\$poster/,G||"");if(N.length>0){L+=(L?"&":"")+M+"="+escape(N)}});if(L.length){D.params.flashvars=L}I=o.getParam("flash_video_player_params",{allowfullscreen:true,allowscriptaccess:true});tinymce.each(I,function(N,M){D.params[M]=""+N})}}D=g.parse(x.attr("data-mce-json"));p=this.getType(x.attr("class"));z=x.attr("data-mce-style");if(!z){z=x.attr("style");if(z){z=o.dom.serializeStyle(o.dom.parseStyle(z,"img"))}}if(p.name==="Iframe"){v=new b("iframe",1);tinymce.each(d,function(i){var G=x.attr(i);if(i=="class"&&G){G=G.replace(/mceItem.+ ?/g,"")}if(G&&G.length>0){v.attr(i,G)}});for(F in D.params){v.attr(F,D.params[F])}v.attr({style:z,src:D.params.src});x.replace(v);return}if(this.editor.settings.media_use_script){v=new b("script",1).attr("type","text/javascript");w=new b("#text",3);w.value="write"+p.name+"("+g.serialize(tinymce.extend(D.params,{width:x.attr("width"),height:x.attr("height")}))+");";v.append(w);x.replace(v);return}if(p.name==="Video"&&D.video.sources[0]){A=new b("video",1).attr(tinymce.extend({id:x.attr("id"),width:x.attr("width"),height:x.attr("height"),style:z},D.video.attrs));if(D.video.attrs){l=D.video.attrs.poster}k=D.video.sources=c(D.video.sources);for(y=0;y<k.length;y++){if(/\.mp4$/.test(k[y].src)){m=k[y].src}}if(!k[0].type){A.attr("src",k[0].src);k.splice(0,1)}for(y=0;y<k.length;y++){u=new b("source",1).attr(k[y]);u.shortEnded=true;A.append(u)}if(m){q(m,l);p=t.getType("flash")}else{D.params.src=""}}if(D.params.src){if(/\.flv$/i.test(D.params.src)){q(D.params.src,"")}if(n&&n.force_absolute){D.params.src=o.documentBaseURI.toAbsolute(D.params.src)}E=new b("object",1).attr({id:x.attr("id"),width:x.attr("width"),height:x.attr("height"),style:z});tinymce.each(d,function(i){if(D[i]&&i!="type"){E.attr(i,D[i])}});for(F in D.params){r=new b("param",1);r.shortEnded=true;w=D.params[F];if(F==="src"&&p.name==="WindowsMedia"){F="url"}r.attr({name:F,value:w});E.append(r)}if(this.editor.getParam("media_strict",true)){E.attr({data:D.params.src,type:p.mimes[0]})}else{E.attr({classid:"clsid:"+p.clsids[0],codebase:p.codebase});j=new b("embed",1);j.shortEnded=true;j.attr({id:x.attr("id"),width:x.attr("width"),height:x.attr("height"),style:z,type:p.mimes[0]});for(F in D.params){j.attr(F,D.params[F])}tinymce.each(d,function(i){if(D[i]&&i!="type"){j.attr(i,D[i])}});E.append(j)}if(D.object_html){w=new b("#text",3);w.raw=true;w.value=D.object_html;E.append(w)}if(A){A.append(E)}}if(A){if(D.video_html){w=new b("#text",3);w.raw=true;w.value=D.video_html;A.append(w)}}if(A||E){x.replace(A||E)}else{x.remove()}},objectToImg:function(y){var F,j,A,p,G,H,u,w,t,B,z,q,o,D,x,k,E,n,C=this.lookup,l,v,s=this.editor.settings.url_converter,m=this.editor.settings.url_converter_scope;function r(i){return new tinymce.html.Serializer({inner:true,validate:false}).serialize(i)}if(!y.parent){return}if(y.name==="script"){if(y.firstChild){l=a.exec(y.firstChild.value)}if(!l){return}n=l[1];E={video:{},params:g.parse(l[2])};w=E.params.width;t=E.params.height}E=E||{video:{},params:{}};G=new b("img",1);G.attr({src:this.editor.theme.url+"/img/trans.gif"});H=y.name;if(H==="video"){A=y;F=y.getAll("object")[0];j=y.getAll("embed")[0];w=A.attr("width");t=A.attr("height");u=A.attr("id");E.video={attrs:{},sources:[]};v=E.video.attrs;for(H in A.attributes.map){v[H]=A.attributes.map[H]}x=y.attr("src");if(x){E.video.sources.push({src:s.call(m,x,"src","video")})}k=A.getAll("source");for(z=0;z<k.length;z++){x=k[z].remove();E.video.sources.push({src:s.call(m,x.attr("src"),"src","source"),type:x.attr("type"),media:x.attr("media")})}if(v.poster){v.poster=s.call(m,v.poster,"poster","video")}}if(y.name==="object"){F=y;j=y.getAll("embed")[0]}if(y.name==="embed"){j=y}if(y.name==="iframe"){p=y;n="Iframe"}if(F){w=w||F.attr("width");t=t||F.attr("height");B=B||F.attr("style");u=u||F.attr("id");D=F.getAll("param");for(z=0;z<D.length;z++){o=D[z];H=o.remove().attr("name");if(!h[H]){E.params[H]=o.attr("value")}}E.params.src=E.params.src||F.attr("data")}if(j){w=w||j.attr("width");t=t||j.attr("height");B=B||j.attr("style");u=u||j.attr("id");for(H in j.attributes.map){if(!h[H]&&!E.params[H]){E.params[H]=j.attributes.map[H]}}}if(p){w=p.attr("width");t=p.attr("height");B=B||p.attr("style");u=p.attr("id");tinymce.each(d,function(i){G.attr(i,p.attr(i))});for(H in p.attributes.map){if(!h[H]&&!E.params[H]){E.params[H]=p.attributes.map[H]}}}if(E.params.movie){E.params.src=E.params.src||E.params.movie;delete E.params.movie}if(E.params.src){E.params.src=s.call(m,E.params.src,"src","object")}if(A){n=C.video.name}if(F&&!n){n=(C[(F.attr("clsid")||"").toLowerCase()]||C[(F.attr("type")||"").toLowerCase()]||{}).name}if(j&&!n){n=(C[(j.attr("type")||"").toLowerCase()]||{}).name}y.replace(G);if(j){j.remove()}if(F){q=r(F.remove());if(q){E.object_html=q}}if(A){q=r(A.remove());if(q){E.video_html=q}}G.attr({id:u,"class":"mceItemMedia mceItem"+(n||"Flash"),style:B,width:w||"320",height:t||"240","data-mce-json":g.serialize(E,"'")})}});tinymce.PluginManager.add("media",tinymce.plugins.MediaPlugin)})(); | |
2 | 1 | \ No newline at end of file |
2 | +(function(){var b=tinymce.explode("id,name,width,height,style,align,class,hspace,vspace,bgcolor,type"),a=tinymce.makeMap(b.join(",")),f=tinymce.html.Node,d,i,h=tinymce.util.JSON,g;d=[["Flash","d27cdb6e-ae6d-11cf-96b8-444553540000","application/x-shockwave-flash","http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"],["ShockWave","166b1bca-3f9c-11cf-8075-444553540000","application/x-director","http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0"],["WindowsMedia","6bf52a52-394a-11d3-b153-00c04f79faa6,22d6f312-b0f6-11d0-94ab-0080c74c7e95,05589fa1-c356-11ce-bf01-00aa0055595a","application/x-mplayer2","http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"],["QuickTime","02bf25d5-8c17-4b23-bc80-d3488abddc6b","video/quicktime","http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0"],["RealMedia","cfcdaa03-8be4-11cf-b84b-0020afbbccfa","audio/x-pn-realaudio-plugin","http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"],["Java","8ad9c840-044e-11d1-b3e9-00805f499d93","application/x-java-applet","http://java.sun.com/products/plugin/autodl/jinstall-1_5_0-windows-i586.cab#Version=1,5,0,0"],["Silverlight","dfeaf541-f3e1-4c24-acac-99c30715084a","application/x-silverlight-2"],["Iframe"],["Video"],["EmbeddedAudio"],["Audio"]];function e(j){return typeof(j)=="string"?j.replace(/[^0-9%]/g,""):j}function c(m){var l,j,k;if(m&&!m.splice){j=[];for(k=0;true;k++){if(m[k]){j[k]=m[k]}else{break}}return j}return m}tinymce.create("tinymce.plugins.MediaPlugin",{init:function(n,j){var r=this,l={},m,p,q,k;function o(s){return s&&s.nodeName==="IMG"&&n.dom.hasClass(s,"mceItemMedia")}r.editor=n;r.url=j;i="";for(m=0;m<d.length;m++){k=d[m][0];q={name:k,clsids:tinymce.explode(d[m][1]||""),mimes:tinymce.explode(d[m][2]||""),codebase:d[m][3]};for(p=0;p<q.clsids.length;p++){l["clsid:"+q.clsids[p]]=q}for(p=0;p<q.mimes.length;p++){l[q.mimes[p]]=q}l["mceItem"+k]=q;l[k.toLowerCase()]=q;i+=(i?"|":"")+k}tinymce.each(n.getParam("media_types","video=mp4,m4v,ogv,webm;silverlight=xap;flash=swf,flv;shockwave=dcr;quicktime=mov,qt,mpg,mpeg;shockwave=dcr;windowsmedia=avi,wmv,wm,asf,asx,wmx,wvx;realmedia=rm,ra,ram;java=jar;audio=mp3,ogg").split(";"),function(v){var s,u,t;v=v.split(/=/);u=tinymce.explode(v[1].toLowerCase());for(s=0;s<u.length;s++){t=l[v[0].toLowerCase()];if(t){l[u[s]]=t}}});i=new RegExp("write("+i+")\\(([^)]+)\\)");r.lookup=l;n.onPreInit.add(function(){n.schema.addValidElements("object[id|style|width|height|classid|codebase|*],param[name|value],embed[id|style|width|height|type|src|*],video[*],audio[*],source[*]");n.parser.addNodeFilter("object,embed,video,audio,script,iframe",function(s){var t=s.length;while(t--){r.objectToImg(s[t])}});n.serializer.addNodeFilter("img",function(s,u,t){var v=s.length,w;while(v--){w=s[v];if((w.attr("class")||"").indexOf("mceItemMedia")!==-1){r.imgToObject(w,t)}}})});n.onInit.add(function(){if(n.theme&&n.theme.onResolveName){n.theme.onResolveName.add(function(s,t){if(t.name==="img"&&n.dom.hasClass(t.node,"mceItemMedia")){t.name="media"}})}if(n&&n.plugins.contextmenu){n.plugins.contextmenu.onContextMenu.add(function(t,u,s){if(s.nodeName==="IMG"&&s.className.indexOf("mceItemMedia")!==-1){u.add({title:"media.edit",icon:"media",cmd:"mceMedia"})}})}});n.addCommand("mceMedia",function(){var t,s;s=n.selection.getNode();if(o(s)){t=n.dom.getAttrib(s,"data-mce-json");if(t){t=h.parse(t);tinymce.each(b,function(u){var v=n.dom.getAttrib(s,u);if(v){t[u]=v}});t.type=r.getType(s.className).name.toLowerCase()}}if(!t){t={type:"flash",video:{sources:[]},params:{}}}n.windowManager.open({file:j+"/media.htm",width:430+parseInt(n.getLang("media.delta_width",0)),height:500+parseInt(n.getLang("media.delta_height",0)),inline:1},{plugin_url:j,data:t})});n.addButton("media",{title:"media.desc",cmd:"mceMedia"});n.onNodeChange.add(function(t,s,u){s.setActive("media",o(u))})},convertUrl:function(l,o){var k=this,n=k.editor,m=n.settings,p=m.url_converter,j=m.url_converter_scope||k;if(!l){return l}if(o){return n.documentBaseURI.toAbsolute(l)}return p.call(j,l,"src","object")},getInfo:function(){return{longname:"Media",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media",version:tinymce.majorVersion+"."+tinymce.minorVersion}},dataToImg:function(m,k){var r=this,o=r.editor,p=o.documentBaseURI,j,q,n,l;m.params.src=r.convertUrl(m.params.src,k);q=m.video.attrs;if(q){q.src=r.convertUrl(q.src,k)}if(q){q.poster=r.convertUrl(q.poster,k)}j=c(m.video.sources);if(j){for(l=0;l<j.length;l++){j[l].src=r.convertUrl(j[l].src,k)}}n=r.editor.dom.create("img",{id:m.id,style:m.style,align:m.align,hspace:m.hspace,vspace:m.vspace,src:r.editor.theme.url+"/img/trans.gif","class":"mceItemMedia mceItem"+r.getType(m.type).name,"data-mce-json":h.serialize(m,"'")});n.width=m.width=e(m.width||(m.type=="audio"?"300":"320"));n.height=m.height=e(m.height||(m.type=="audio"?"32":"240"));return n},dataToHtml:function(j,k){return this.editor.serializer.serialize(this.dataToImg(j,k),{forced_root_block:"",force_absolute:k})},htmlToData:function(l){var k,j,m;m={type:"flash",video:{sources:[]},params:{}};k=this.editor.parser.parse(l);j=k.getAll("img")[0];if(j){m=h.parse(j.attr("data-mce-json"));m.type=this.getType(j.attr("class")).name.toLowerCase();tinymce.each(b,function(n){var o=j.attr(n);if(o){m[n]=o}})}return m},getType:function(m){var k,j,l;j=tinymce.explode(m," ");for(k=0;k<j.length;k++){l=this.lookup[j[k]];if(l){return l}}},imgToObject:function(z,o){var u=this,p=u.editor,C,H,j,t,I,y,G,w,k,E,s,q,A,D,m,x,l,B,F;function r(n,J){var N,M,O,L,K;K=p.getParam("flash_video_player_url",u.convertUrl(u.url+"/moxieplayer.swf"));if(K){N=p.documentBaseURI;G.params.src=K;if(p.getParam("flash_video_player_absvideourl",true)){n=N.toAbsolute(n||"",true);J=N.toAbsolute(J||"",true)}O="";M=p.getParam("flash_video_player_flashvars",{url:"$url",poster:"$poster"});tinymce.each(M,function(Q,P){Q=Q.replace(/\$url/,n||"");Q=Q.replace(/\$poster/,J||"");if(Q.length>0){O+=(O?"&":"")+P+"="+escape(Q)}});if(O.length){G.params.flashvars=O}L=p.getParam("flash_video_player_params",{allowfullscreen:true,allowscriptaccess:true});tinymce.each(L,function(Q,P){G.params[P]=""+Q})}}G=z.attr("data-mce-json");if(!G){return}G=h.parse(G);q=this.getType(z.attr("class"));B=z.attr("data-mce-style");if(!B){B=z.attr("style");if(B){B=p.dom.serializeStyle(p.dom.parseStyle(B,"img"))}}G.width=z.attr("width")||G.width;G.height=z.attr("height")||G.height;if(q.name==="Iframe"){x=new f("iframe",1);tinymce.each(b,function(n){var J=z.attr(n);if(n=="class"&&J){J=J.replace(/mceItem.+ ?/g,"")}if(J&&J.length>0){x.attr(n,J)}});for(I in G.params){x.attr(I,G.params[I])}x.attr({style:B,src:G.params.src});z.replace(x);return}if(this.editor.settings.media_use_script){x=new f("script",1).attr("type","text/javascript");y=new f("#text",3);y.value="write"+q.name+"("+h.serialize(tinymce.extend(G.params,{width:z.attr("width"),height:z.attr("height")}))+");";x.append(y);z.replace(x);return}if(q.name==="Video"&&G.video.sources[0]){C=new f("video",1).attr(tinymce.extend({id:z.attr("id"),width:e(z.attr("width")),height:e(z.attr("height")),style:B},G.video.attrs));if(G.video.attrs){l=G.video.attrs.poster}k=G.video.sources=c(G.video.sources);for(A=0;A<k.length;A++){if(/\.mp4$/.test(k[A].src)){m=k[A].src}}if(!k[0].type){C.attr("src",k[0].src);k.splice(0,1)}for(A=0;A<k.length;A++){w=new f("source",1).attr(k[A]);w.shortEnded=true;C.append(w)}if(m){r(m,l);q=u.getType("flash")}else{G.params.src=""}}if(q.name==="Audio"&&G.video.sources[0]){F=new f("audio",1).attr(tinymce.extend({id:z.attr("id"),width:e(z.attr("width")),height:e(z.attr("height")),style:B},G.video.attrs));if(G.video.attrs){l=G.video.attrs.poster}k=G.video.sources=c(G.video.sources);if(!k[0].type){F.attr("src",k[0].src);k.splice(0,1)}for(A=0;A<k.length;A++){w=new f("source",1).attr(k[A]);w.shortEnded=true;F.append(w)}G.params.src=""}if(q.name==="EmbeddedAudio"){j=new f("embed",1);j.shortEnded=true;j.attr({id:z.attr("id"),width:e(z.attr("width")),height:e(z.attr("height")),style:B,type:z.attr("type")});for(I in G.params){j.attr(I,G.params[I])}tinymce.each(b,function(n){if(G[n]&&n!="type"){j.attr(n,G[n])}});G.params.src=""}if(G.params.src){if(/\.flv$/i.test(G.params.src)){r(G.params.src,"")}if(o&&o.force_absolute){G.params.src=p.documentBaseURI.toAbsolute(G.params.src)}H=new f("object",1).attr({id:z.attr("id"),width:e(z.attr("width")),height:e(z.attr("height")),style:B});tinymce.each(b,function(n){var J=G[n];if(n=="class"&&J){J=J.replace(/mceItem.+ ?/g,"")}if(J&&n!="type"){H.attr(n,J)}});for(I in G.params){s=new f("param",1);s.shortEnded=true;y=G.params[I];if(I==="src"&&q.name==="WindowsMedia"){I="url"}s.attr({name:I,value:y});H.append(s)}if(this.editor.getParam("media_strict",true)){H.attr({data:G.params.src,type:q.mimes[0]})}else{H.attr({classid:"clsid:"+q.clsids[0],codebase:q.codebase});j=new f("embed",1);j.shortEnded=true;j.attr({id:z.attr("id"),width:e(z.attr("width")),height:e(z.attr("height")),style:B,type:q.mimes[0]});for(I in G.params){j.attr(I,G.params[I])}tinymce.each(b,function(n){if(G[n]&&n!="type"){j.attr(n,G[n])}});H.append(j)}if(G.object_html){y=new f("#text",3);y.raw=true;y.value=G.object_html;H.append(y)}if(C){C.append(H)}}if(C){if(G.video_html){y=new f("#text",3);y.raw=true;y.value=G.video_html;C.append(y)}}if(F){if(G.video_html){y=new f("#text",3);y.raw=true;y.value=G.video_html;F.append(y)}}var v=C||F||H||j;if(v){z.replace(v)}else{z.remove()}},objectToImg:function(C){var L,k,F,s,M,N,y,A,x,G,E,t,q,I,B,l,K,o,H=this.lookup,m,z,v=this.editor.settings.url_converter,n=this.editor.settings.url_converter_scope,w,r,D,j;function u(O){return new tinymce.html.Serializer({inner:true,validate:false}).serialize(O)}function J(P,O){return H[(P.attr(O)||"").toLowerCase()]}function p(P){var O=P.replace(/^.*\.([^.]+)$/,"$1");return H[O.toLowerCase()||""]}if(!C.parent){return}if(C.name==="script"){if(C.firstChild){m=i.exec(C.firstChild.value)}if(!m){return}o=m[1];K={video:{},params:h.parse(m[2])};A=K.params.width;x=K.params.height}K=K||{video:{},params:{}};M=new f("img",1);M.attr({src:this.editor.theme.url+"/img/trans.gif"});N=C.name;if(N==="video"||N=="audio"){F=C;L=C.getAll("object")[0];k=C.getAll("embed")[0];A=F.attr("width");x=F.attr("height");y=F.attr("id");K.video={attrs:{},sources:[]};z=K.video.attrs;for(N in F.attributes.map){z[N]=F.attributes.map[N]}B=C.attr("src");if(B){K.video.sources.push({src:v.call(n,B,"src",C.name)})}l=F.getAll("source");for(E=0;E<l.length;E++){B=l[E].remove();K.video.sources.push({src:v.call(n,B.attr("src"),"src","source"),type:B.attr("type"),media:B.attr("media")})}if(z.poster){z.poster=v.call(n,z.poster,"poster",C.name)}}if(C.name==="object"){L=C;k=C.getAll("embed")[0]}if(C.name==="embed"){k=C}if(C.name==="iframe"){s=C;o="Iframe"}if(L){A=A||L.attr("width");x=x||L.attr("height");G=G||L.attr("style");y=y||L.attr("id");w=w||L.attr("hspace");r=r||L.attr("vspace");D=D||L.attr("align");j=j||L.attr("bgcolor");K.name=L.attr("name");I=L.getAll("param");for(E=0;E<I.length;E++){q=I[E];N=q.remove().attr("name");if(!a[N]){K.params[N]=q.attr("value")}}K.params.src=K.params.src||L.attr("data")}if(k){A=A||k.attr("width");x=x||k.attr("height");G=G||k.attr("style");y=y||k.attr("id");w=w||k.attr("hspace");r=r||k.attr("vspace");D=D||k.attr("align");j=j||k.attr("bgcolor");for(N in k.attributes.map){if(!a[N]&&!K.params[N]){K.params[N]=k.attributes.map[N]}}}if(s){A=e(s.attr("width"));x=e(s.attr("height"));G=G||s.attr("style");y=s.attr("id");w=s.attr("hspace");r=s.attr("vspace");D=s.attr("align");j=s.attr("bgcolor");tinymce.each(b,function(O){M.attr(O,s.attr(O))});for(N in s.attributes.map){if(!a[N]&&!K.params[N]){K.params[N]=s.attributes.map[N]}}}if(K.params.movie){K.params.src=K.params.src||K.params.movie;delete K.params.movie}if(K.params.src){K.params.src=v.call(n,K.params.src,"src","object")}if(F){if(C.name==="video"){o=H.video.name}else{if(C.name==="audio"){o=H.audio.name}}}if(L&&!o){o=(J(L,"clsid")||J(L,"classid")||J(L,"type")||{}).name}if(k&&!o){o=(J(k,"type")||p(K.params.src)||{}).name}if(k&&o=="EmbeddedAudio"){K.params.type=k.attr("type")}C.replace(M);if(k){k.remove()}if(L){t=u(L.remove());if(t){K.object_html=t}}if(F){t=u(F.remove());if(t){K.video_html=t}}K.hspace=w;K.vspace=r;K.align=D;K.bgcolor=j;M.attr({id:y,"class":"mceItemMedia mceItem"+(o||"Flash"),style:G,width:A||(C.name=="audio"?"300":"320"),height:x||(C.name=="audio"?"32":"240"),hspace:w,vspace:r,align:D,bgcolor:j,"data-mce-json":h.serialize(K,"'")})}});tinymce.PluginManager.add("media",tinymce.plugins.MediaPlugin)})(); | |
3 | 3 | \ No newline at end of file | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/media/editor_plugin_src.js
... | ... | @@ -23,9 +23,15 @@ |
23 | 23 | ["Java", "8ad9c840-044e-11d1-b3e9-00805f499d93", "application/x-java-applet", "http://java.sun.com/products/plugin/autodl/jinstall-1_5_0-windows-i586.cab#Version=1,5,0,0"], |
24 | 24 | ["Silverlight", "dfeaf541-f3e1-4c24-acac-99c30715084a", "application/x-silverlight-2"], |
25 | 25 | ["Iframe"], |
26 | - ["Video"] | |
26 | + ["Video"], | |
27 | + ["EmbeddedAudio"], | |
28 | + ["Audio"] | |
27 | 29 | ]; |
28 | 30 | |
31 | + function normalizeSize(size) { | |
32 | + return typeof(size) == "string" ? size.replace(/[^0-9%]/g, '') : size; | |
33 | + } | |
34 | + | |
29 | 35 | function toArray(obj) { |
30 | 36 | var undef, out, i; |
31 | 37 | |
... | ... | @@ -86,11 +92,12 @@ |
86 | 92 | "silverlight=xap;" + |
87 | 93 | "flash=swf,flv;" + |
88 | 94 | "shockwave=dcr;" + |
89 | - "quicktime=mov,qt,mpg,mp3,mpeg;" + | |
95 | + "quicktime=mov,qt,mpg,mpeg;" + | |
90 | 96 | "shockwave=dcr;" + |
91 | 97 | "windowsmedia=avi,wmv,wm,asf,asx,wmx,wvx;" + |
92 | 98 | "realmedia=rm,ra,ram;" + |
93 | - "java=jar" | |
99 | + "java=jar;" + | |
100 | + "audio=mp3,ogg" | |
94 | 101 | ).split(';'), function(item) { |
95 | 102 | var i, extensions, type; |
96 | 103 | |
... | ... | @@ -155,17 +162,20 @@ |
155 | 162 | |
156 | 163 | img = ed.selection.getNode(); |
157 | 164 | if (isMediaImg(img)) { |
158 | - data = JSON.parse(ed.dom.getAttrib(img, 'data-mce-json')); | |
165 | + data = ed.dom.getAttrib(img, 'data-mce-json'); | |
166 | + if (data) { | |
167 | + data = JSON.parse(data); | |
159 | 168 | |
160 | - // Add some extra properties to the data object | |
161 | - tinymce.each(rootAttributes, function(name) { | |
162 | - var value = ed.dom.getAttrib(img, name); | |
169 | + // Add some extra properties to the data object | |
170 | + tinymce.each(rootAttributes, function(name) { | |
171 | + var value = ed.dom.getAttrib(img, name); | |
163 | 172 | |
164 | - if (value) | |
165 | - data[name] = value; | |
166 | - }); | |
173 | + if (value) | |
174 | + data[name] = value; | |
175 | + }); | |
167 | 176 | |
168 | - data.type = self.getType(img.className).name.toLowerCase(); | |
177 | + data.type = self.getType(img.className).name.toLowerCase(); | |
178 | + } | |
169 | 179 | } |
170 | 180 | |
171 | 181 | if (!data) { |
... | ... | @@ -245,13 +255,15 @@ |
245 | 255 | id : data.id, |
246 | 256 | style : data.style, |
247 | 257 | align : data.align, |
258 | + hspace : data.hspace, | |
259 | + vspace : data.vspace, | |
248 | 260 | src : self.editor.theme.url + '/img/trans.gif', |
249 | 261 | 'class' : 'mceItemMedia mceItem' + self.getType(data.type).name, |
250 | 262 | 'data-mce-json' : JSON.serialize(data, "'") |
251 | 263 | }); |
252 | 264 | |
253 | - img.width = data.width || "320"; | |
254 | - img.height = data.height || "240"; | |
265 | + img.width = data.width = normalizeSize(data.width || (data.type == 'audio' ? "300" : "320")); | |
266 | + img.height = data.height = normalizeSize(data.height || (data.type == 'audio' ? "32" : "240")); | |
255 | 267 | |
256 | 268 | return img; |
257 | 269 | }, |
... | ... | @@ -260,7 +272,7 @@ |
260 | 272 | * Converts the JSON data object to a HTML string. |
261 | 273 | */ |
262 | 274 | dataToHtml : function(data, force_absolute) { |
263 | - return this.editor.serializer.serialize(this.dataToImg(data, force_absolute), {force_absolute : force_absolute}); | |
275 | + return this.editor.serializer.serialize(this.dataToImg(data, force_absolute), {forced_root_block : '', force_absolute : force_absolute}); | |
264 | 276 | }, |
265 | 277 | |
266 | 278 | /** |
... | ... | @@ -320,7 +332,7 @@ |
320 | 332 | imgToObject : function(node, args) { |
321 | 333 | var self = this, editor = self.editor, video, object, embed, iframe, name, value, data, |
322 | 334 | source, sources, params, param, typeItem, i, item, mp4Source, replacement, |
323 | - posterSrc, style; | |
335 | + posterSrc, style, audio; | |
324 | 336 | |
325 | 337 | // Adds the flash player |
326 | 338 | function addPlayer(video_src, poster_src) { |
... | ... | @@ -363,10 +375,14 @@ |
363 | 375 | } |
364 | 376 | }; |
365 | 377 | |
366 | - data = JSON.parse(node.attr('data-mce-json')); | |
378 | + data = node.attr('data-mce-json'); | |
379 | + if (!data) | |
380 | + return; | |
381 | + | |
382 | + data = JSON.parse(data); | |
367 | 383 | typeItem = this.getType(node.attr('class')); |
368 | 384 | |
369 | - style = node.attr('data-mce-style') | |
385 | + style = node.attr('data-mce-style'); | |
370 | 386 | if (!style) { |
371 | 387 | style = node.attr('style'); |
372 | 388 | |
... | ... | @@ -374,6 +390,10 @@ |
374 | 390 | style = editor.dom.serializeStyle(editor.dom.parseStyle(style, 'img')); |
375 | 391 | } |
376 | 392 | |
393 | + // Use node width/height to override the data width/height when the placeholder is resized | |
394 | + data.width = node.attr('width') || data.width; | |
395 | + data.height = node.attr('height') || data.height; | |
396 | + | |
377 | 397 | // Handle iframe |
378 | 398 | if (typeItem.name === 'Iframe') { |
379 | 399 | replacement = new Node('iframe', 1); |
... | ... | @@ -422,8 +442,8 @@ |
422 | 442 | // Create new object element |
423 | 443 | video = new Node('video', 1).attr(tinymce.extend({ |
424 | 444 | id : node.attr('id'), |
425 | - width: node.attr('width'), | |
426 | - height: node.attr('height'), | |
445 | + width: normalizeSize(node.attr('width')), | |
446 | + height: normalizeSize(node.attr('height')), | |
427 | 447 | style : style |
428 | 448 | }, data.video.attrs)); |
429 | 449 | |
... | ... | @@ -456,6 +476,57 @@ |
456 | 476 | data.params.src = ''; |
457 | 477 | } |
458 | 478 | |
479 | + // Add HTML5 audio element | |
480 | + if (typeItem.name === 'Audio' && data.video.sources[0]) { | |
481 | + // Create new object element | |
482 | + audio = new Node('audio', 1).attr(tinymce.extend({ | |
483 | + id : node.attr('id'), | |
484 | + width: normalizeSize(node.attr('width')), | |
485 | + height: normalizeSize(node.attr('height')), | |
486 | + style : style | |
487 | + }, data.video.attrs)); | |
488 | + | |
489 | + // Get poster source and use that for flash fallback | |
490 | + if (data.video.attrs) | |
491 | + posterSrc = data.video.attrs.poster; | |
492 | + | |
493 | + sources = data.video.sources = toArray(data.video.sources); | |
494 | + if (!sources[0].type) { | |
495 | + audio.attr('src', sources[0].src); | |
496 | + sources.splice(0, 1); | |
497 | + } | |
498 | + | |
499 | + for (i = 0; i < sources.length; i++) { | |
500 | + source = new Node('source', 1).attr(sources[i]); | |
501 | + source.shortEnded = true; | |
502 | + audio.append(source); | |
503 | + } | |
504 | + | |
505 | + data.params.src = ''; | |
506 | + } | |
507 | + | |
508 | + if (typeItem.name === 'EmbeddedAudio') { | |
509 | + embed = new Node('embed', 1); | |
510 | + embed.shortEnded = true; | |
511 | + embed.attr({ | |
512 | + id: node.attr('id'), | |
513 | + width: normalizeSize(node.attr('width')), | |
514 | + height: normalizeSize(node.attr('height')), | |
515 | + style : style, | |
516 | + type: node.attr('type') | |
517 | + }); | |
518 | + | |
519 | + for (name in data.params) | |
520 | + embed.attr(name, data.params[name]); | |
521 | + | |
522 | + tinymce.each(rootAttributes, function(name) { | |
523 | + if (data[name] && name != 'type') | |
524 | + embed.attr(name, data[name]); | |
525 | + }); | |
526 | + | |
527 | + data.params.src = ''; | |
528 | + } | |
529 | + | |
459 | 530 | // Do we have a params src then we can generate object |
460 | 531 | if (data.params.src) { |
461 | 532 | // Is flv movie add player for it |
... | ... | @@ -468,14 +539,19 @@ |
468 | 539 | // Create new object element |
469 | 540 | object = new Node('object', 1).attr({ |
470 | 541 | id : node.attr('id'), |
471 | - width: node.attr('width'), | |
472 | - height: node.attr('height'), | |
542 | + width: normalizeSize(node.attr('width')), | |
543 | + height: normalizeSize(node.attr('height')), | |
473 | 544 | style : style |
474 | 545 | }); |
475 | 546 | |
476 | 547 | tinymce.each(rootAttributes, function(name) { |
477 | - if (data[name] && name != 'type') | |
478 | - object.attr(name, data[name]); | |
548 | + var value = data[name]; | |
549 | + | |
550 | + if (name == 'class' && value) | |
551 | + value = value.replace(/mceItem.+ ?/g, ''); | |
552 | + | |
553 | + if (value && name != 'type') | |
554 | + object.attr(name, value); | |
479 | 555 | }); |
480 | 556 | |
481 | 557 | // Add params |
... | ... | @@ -508,8 +584,8 @@ |
508 | 584 | embed.shortEnded = true; |
509 | 585 | embed.attr({ |
510 | 586 | id: node.attr('id'), |
511 | - width: node.attr('width'), | |
512 | - height: node.attr('height'), | |
587 | + width: normalizeSize(node.attr('width')), | |
588 | + height: normalizeSize(node.attr('height')), | |
513 | 589 | style : style, |
514 | 590 | type: typeItem.mimes[0] |
515 | 591 | }); |
... | ... | @@ -548,8 +624,19 @@ |
548 | 624 | } |
549 | 625 | } |
550 | 626 | |
551 | - if (video || object) | |
552 | - node.replace(video || object); | |
627 | + if (audio) { | |
628 | + // Insert raw HTML | |
629 | + if (data.video_html) { | |
630 | + value = new Node('#text', 3); | |
631 | + value.raw = true; | |
632 | + value.value = data.video_html; | |
633 | + audio.append(value); | |
634 | + } | |
635 | + } | |
636 | + | |
637 | + var n = video || audio || object || embed; | |
638 | + if (n) | |
639 | + node.replace(n); | |
553 | 640 | else |
554 | 641 | node.remove(); |
555 | 642 | }, |
... | ... | @@ -567,7 +654,8 @@ |
567 | 654 | var object, embed, video, iframe, img, name, id, width, height, style, i, html, |
568 | 655 | param, params, source, sources, data, type, lookup = this.lookup, |
569 | 656 | matches, attrs, urlConverter = this.editor.settings.url_converter, |
570 | - urlConverterScope = this.editor.settings.url_converter_scope; | |
657 | + urlConverterScope = this.editor.settings.url_converter_scope, | |
658 | + hspace, vspace, align, bgcolor; | |
571 | 659 | |
572 | 660 | function getInnerHTML(node) { |
573 | 661 | return new tinymce.html.Serializer({ |
... | ... | @@ -576,6 +664,15 @@ |
576 | 664 | }).serialize(node); |
577 | 665 | }; |
578 | 666 | |
667 | + function lookupAttribute(o, attr) { | |
668 | + return lookup[(o.attr(attr) || '').toLowerCase()]; | |
669 | + } | |
670 | + | |
671 | + function lookupExtension(src) { | |
672 | + var ext = src.replace(/^.*\.([^.]+)$/, '$1'); | |
673 | + return lookup[ext.toLowerCase() || '']; | |
674 | + } | |
675 | + | |
579 | 676 | // If node isn't in document |
580 | 677 | if (!node.parent) |
581 | 678 | return; |
... | ... | @@ -608,7 +705,7 @@ |
608 | 705 | |
609 | 706 | // Video element |
610 | 707 | name = node.name; |
611 | - if (name === 'video') { | |
708 | + if (name === 'video' || name == 'audio') { | |
612 | 709 | video = node; |
613 | 710 | object = node.getAll('object')[0]; |
614 | 711 | embed = node.getAll('embed')[0]; |
... | ... | @@ -624,7 +721,7 @@ |
624 | 721 | |
625 | 722 | source = node.attr('src'); |
626 | 723 | if (source) |
627 | - data.video.sources.push({src : urlConverter.call(urlConverterScope, source, 'src', 'video')}); | |
724 | + data.video.sources.push({src : urlConverter.call(urlConverterScope, source, 'src', node.name)}); | |
628 | 725 | |
629 | 726 | // Get all sources |
630 | 727 | sources = video.getAll("source"); |
... | ... | @@ -640,7 +737,7 @@ |
640 | 737 | |
641 | 738 | // Convert the poster URL |
642 | 739 | if (attrs.poster) |
643 | - attrs.poster = urlConverter.call(urlConverterScope, attrs.poster, 'poster', 'video'); | |
740 | + attrs.poster = urlConverter.call(urlConverterScope, attrs.poster, 'poster', node.name); | |
644 | 741 | } |
645 | 742 | |
646 | 743 | // Object element |
... | ... | @@ -665,6 +762,11 @@ |
665 | 762 | height = height || object.attr('height'); |
666 | 763 | style = style || object.attr('style'); |
667 | 764 | id = id || object.attr('id'); |
765 | + hspace = hspace || object.attr('hspace'); | |
766 | + vspace = vspace || object.attr('vspace'); | |
767 | + align = align || object.attr('align'); | |
768 | + bgcolor = bgcolor || object.attr('bgcolor'); | |
769 | + data.name = object.attr('name'); | |
668 | 770 | |
669 | 771 | // Get all object params |
670 | 772 | params = object.getAll("param"); |
... | ... | @@ -685,6 +787,10 @@ |
685 | 787 | height = height || embed.attr('height'); |
686 | 788 | style = style || embed.attr('style'); |
687 | 789 | id = id || embed.attr('id'); |
790 | + hspace = hspace || embed.attr('hspace'); | |
791 | + vspace = vspace || embed.attr('vspace'); | |
792 | + align = align || embed.attr('align'); | |
793 | + bgcolor = bgcolor || embed.attr('bgcolor'); | |
688 | 794 | |
689 | 795 | // Get all embed attributes |
690 | 796 | for (name in embed.attributes.map) { |
... | ... | @@ -695,10 +801,14 @@ |
695 | 801 | |
696 | 802 | if (iframe) { |
697 | 803 | // Get width/height |
698 | - width = iframe.attr('width'); | |
699 | - height = iframe.attr('height'); | |
804 | + width = normalizeSize(iframe.attr('width')); | |
805 | + height = normalizeSize(iframe.attr('height')); | |
700 | 806 | style = style || iframe.attr('style'); |
701 | 807 | id = iframe.attr('id'); |
808 | + hspace = iframe.attr('hspace'); | |
809 | + vspace = iframe.attr('vspace'); | |
810 | + align = iframe.attr('align'); | |
811 | + bgcolor = iframe.attr('bgcolor'); | |
702 | 812 | |
703 | 813 | tinymce.each(rootAttributes, function(name) { |
704 | 814 | img.attr(name, iframe.attr(name)); |
... | ... | @@ -721,14 +831,23 @@ |
721 | 831 | if (data.params.src) |
722 | 832 | data.params.src = urlConverter.call(urlConverterScope, data.params.src, 'src', 'object'); |
723 | 833 | |
724 | - if (video) | |
725 | - type = lookup.video.name; | |
834 | + if (video) { | |
835 | + if (node.name === 'video') | |
836 | + type = lookup.video.name; | |
837 | + else if (node.name === 'audio') | |
838 | + type = lookup.audio.name; | |
839 | + } | |
726 | 840 | |
727 | 841 | if (object && !type) |
728 | - type = (lookup[(object.attr('clsid') || '').toLowerCase()] || lookup[(object.attr('type') || '').toLowerCase()] || {}).name; | |
842 | + type = (lookupAttribute(object, 'clsid') || lookupAttribute(object, 'classid') || lookupAttribute(object, 'type') || {}).name; | |
729 | 843 | |
730 | 844 | if (embed && !type) |
731 | - type = (lookup[(embed.attr('type') || '').toLowerCase()] || {}).name; | |
845 | + type = (lookupAttribute(embed, 'type') || lookupExtension(data.params.src) || {}).name; | |
846 | + | |
847 | + // for embedded audio we preserve the original specified type | |
848 | + if (embed && type == 'EmbeddedAudio') { | |
849 | + data.params.type = embed.attr('type'); | |
850 | + } | |
732 | 851 | |
733 | 852 | // Replace the video/object/embed element with a placeholder image containing the data |
734 | 853 | node.replace(img); |
... | ... | @@ -753,13 +872,22 @@ |
753 | 872 | data.video_html = html; |
754 | 873 | } |
755 | 874 | |
875 | + data.hspace = hspace; | |
876 | + data.vspace = vspace; | |
877 | + data.align = align; | |
878 | + data.bgcolor = bgcolor; | |
879 | + | |
756 | 880 | // Set width/height of placeholder |
757 | 881 | img.attr({ |
758 | 882 | id : id, |
759 | 883 | 'class' : 'mceItemMedia mceItem' + (type || 'Flash'), |
760 | 884 | style : style, |
761 | - width : width || "320", | |
762 | - height : height || "240", | |
885 | + width : width || (node.name == 'audio' ? "300" : "320"), | |
886 | + height : height || (node.name == 'audio' ? "32" : "240"), | |
887 | + hspace : hspace, | |
888 | + vspace : vspace, | |
889 | + align : align, | |
890 | + bgcolor : bgcolor, | |
763 | 891 | "data-mce-json" : JSON.serialize(data, "'") |
764 | 892 | }); |
765 | 893 | } |
... | ... | @@ -767,4 +895,4 @@ |
767 | 895 | |
768 | 896 | // Register plugin |
769 | 897 | tinymce.PluginManager.add('media', tinymce.plugins.MediaPlugin); |
770 | -})(); | |
771 | 898 | \ No newline at end of file |
899 | +})(); | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/media/js/media.js
... | ... | @@ -8,6 +8,33 @@ |
8 | 8 | return document.getElementById(id); |
9 | 9 | } |
10 | 10 | |
11 | + function clone(obj) { | |
12 | + var i, len, copy, attr; | |
13 | + | |
14 | + if (null == obj || "object" != typeof obj) | |
15 | + return obj; | |
16 | + | |
17 | + // Handle Array | |
18 | + if ('length' in obj) { | |
19 | + copy = []; | |
20 | + | |
21 | + for (i = 0, len = obj.length; i < len; ++i) { | |
22 | + copy[i] = clone(obj[i]); | |
23 | + } | |
24 | + | |
25 | + return copy; | |
26 | + } | |
27 | + | |
28 | + // Handle Object | |
29 | + copy = {}; | |
30 | + for (attr in obj) { | |
31 | + if (obj.hasOwnProperty(attr)) | |
32 | + copy[attr] = clone(obj[attr]); | |
33 | + } | |
34 | + | |
35 | + return copy; | |
36 | + } | |
37 | + | |
11 | 38 | function getVal(id) { |
12 | 39 | var elm = get(id); |
13 | 40 | |
... | ... | @@ -20,17 +47,18 @@ |
20 | 47 | return elm.value; |
21 | 48 | } |
22 | 49 | |
23 | - function setVal(id, value) { | |
24 | - if (typeof(value) != 'undefined') { | |
50 | + function setVal(id, value, name) { | |
51 | + if (typeof(value) != 'undefined' && value != null) { | |
25 | 52 | var elm = get(id); |
26 | 53 | |
27 | 54 | if (elm.nodeName == "SELECT") |
28 | 55 | selectByValue(document.forms[0], id, value); |
29 | 56 | else if (elm.type == "checkbox") { |
30 | - if (typeof(value) == 'string') | |
31 | - elm.checked = value.toLowerCase() === 'true' ? true : false; | |
32 | - else | |
33 | - elm.checked = !!value; | |
57 | + if (typeof(value) == 'string') { | |
58 | + value = value.toLowerCase(); | |
59 | + value = (!name && value === 'true') || (name && value === name.toLowerCase()); | |
60 | + } | |
61 | + elm.checked = !!value; | |
34 | 62 | } else |
35 | 63 | elm.value = value; |
36 | 64 | } |
... | ... | @@ -38,19 +66,21 @@ |
38 | 66 | |
39 | 67 | window.Media = { |
40 | 68 | init : function() { |
41 | - var html, editor; | |
69 | + var html, editor, self = this; | |
42 | 70 | |
43 | - this.editor = editor = tinyMCEPopup.editor; | |
71 | + self.editor = editor = tinyMCEPopup.editor; | |
44 | 72 | |
45 | 73 | // Setup file browsers and color pickers |
46 | 74 | get('filebrowsercontainer').innerHTML = getBrowserHTML('filebrowser','src','media','media'); |
47 | 75 | get('qtsrcfilebrowsercontainer').innerHTML = getBrowserHTML('qtsrcfilebrowser','quicktime_qtsrc','media','media'); |
48 | 76 | get('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor'); |
49 | - get('video_altsource1_filebrowser').innerHTML = getBrowserHTML('filebrowser_altsource1','video_altsource1','media','media'); | |
50 | - get('video_altsource2_filebrowser').innerHTML = getBrowserHTML('filebrowser_altsource2','video_altsource2','media','media'); | |
51 | - get('video_poster_filebrowser').innerHTML = getBrowserHTML('filebrowser_poster','video_poster','media','image'); | |
77 | + get('video_altsource1_filebrowser').innerHTML = getBrowserHTML('video_filebrowser_altsource1','video_altsource1','media','media'); | |
78 | + get('video_altsource2_filebrowser').innerHTML = getBrowserHTML('video_filebrowser_altsource2','video_altsource2','media','media'); | |
79 | + get('audio_altsource1_filebrowser').innerHTML = getBrowserHTML('audio_filebrowser_altsource1','audio_altsource1','media','media'); | |
80 | + get('audio_altsource2_filebrowser').innerHTML = getBrowserHTML('audio_filebrowser_altsource2','audio_altsource2','media','media'); | |
81 | + get('video_poster_filebrowser').innerHTML = getBrowserHTML('filebrowser_poster','video_poster','image','media'); | |
52 | 82 | |
53 | - html = this.getMediaListHTML('medialist', 'src', 'media', 'media'); | |
83 | + html = self.getMediaListHTML('medialist', 'src', 'media', 'media'); | |
54 | 84 | if (html == "") |
55 | 85 | get("linklistrow").style.display = 'none'; |
56 | 86 | else |
... | ... | @@ -59,18 +89,29 @@ |
59 | 89 | if (isVisible('filebrowser')) |
60 | 90 | get('src').style.width = '230px'; |
61 | 91 | |
62 | - if (isVisible('filebrowser_altsource1')) | |
92 | + if (isVisible('video_filebrowser_altsource1')) | |
63 | 93 | get('video_altsource1').style.width = '220px'; |
64 | 94 | |
65 | - if (isVisible('filebrowser_altsource2')) | |
95 | + if (isVisible('video_filebrowser_altsource2')) | |
66 | 96 | get('video_altsource2').style.width = '220px'; |
67 | 97 | |
98 | + if (isVisible('audio_filebrowser_altsource1')) | |
99 | + get('audio_altsource1').style.width = '220px'; | |
100 | + | |
101 | + if (isVisible('audio_filebrowser_altsource2')) | |
102 | + get('audio_altsource2').style.width = '220px'; | |
103 | + | |
68 | 104 | if (isVisible('filebrowser_poster')) |
69 | 105 | get('video_poster').style.width = '220px'; |
70 | 106 | |
71 | - this.data = tinyMCEPopup.getWindowArg('data'); | |
72 | - this.dataToForm(); | |
73 | - this.preview(); | |
107 | + editor.dom.setOuterHTML(get('media_type'), self.getMediaTypeHTML(editor)); | |
108 | + | |
109 | + self.setDefaultDialogSettings(editor); | |
110 | + self.data = clone(tinyMCEPopup.getWindowArg('data')); | |
111 | + self.dataToForm(); | |
112 | + self.preview(); | |
113 | + | |
114 | + updateColor('bgcolor_pick', 'bgcolor'); | |
74 | 115 | }, |
75 | 116 | |
76 | 117 | insert : function() { |
... | ... | @@ -88,7 +129,7 @@ |
88 | 129 | }, |
89 | 130 | |
90 | 131 | moveStates : function(to_form, field) { |
91 | - var data = this.data, editor = this.editor, data = this.data, | |
132 | + var data = this.data, editor = this.editor, | |
92 | 133 | mediaPlugin = editor.plugins.media, ext, src, typeInfo, defaultStates, src; |
93 | 134 | |
94 | 135 | defaultStates = { |
... | ... | @@ -135,23 +176,23 @@ |
135 | 176 | formItemName = type == 'global' ? name : type + '_' + name; |
136 | 177 | |
137 | 178 | if (type == 'global') |
138 | - list = data; | |
139 | - else if (type == 'video') { | |
179 | + list = data; | |
180 | + else if (type == 'video' || type == 'audio') { | |
140 | 181 | list = data.video.attrs; |
141 | 182 | |
142 | 183 | if (!list && !to_form) |
143 | - data.video.attrs = list = {}; | |
184 | + data.video.attrs = list = {}; | |
144 | 185 | } else |
145 | - list = data.params; | |
186 | + list = data.params; | |
146 | 187 | |
147 | 188 | if (list) { |
148 | 189 | if (to_form) { |
149 | - setVal(formItemName, list[name]); | |
190 | + setVal(formItemName, list[name], type == 'video' || type == 'audio' ? name : ''); | |
150 | 191 | } else { |
151 | 192 | delete list[name]; |
152 | 193 | |
153 | 194 | value = getVal(formItemName); |
154 | - if (type == 'video' && value === true) | |
195 | + if ((type == 'video' || type == 'audio') && value === true) | |
155 | 196 | value = name; |
156 | 197 | |
157 | 198 | if (defaultStates[formItemName]) { |
... | ... | @@ -184,7 +225,7 @@ |
184 | 225 | setVal('media_type', data.type); |
185 | 226 | } |
186 | 227 | |
187 | - if (data.type == "video") { | |
228 | + if (data.type == "video" || data.type == "audio") { | |
188 | 229 | if (!data.video.sources) |
189 | 230 | data.video.sources = []; |
190 | 231 | |
... | ... | @@ -194,11 +235,13 @@ |
194 | 235 | |
195 | 236 | // Hide all fieldsets and show the one active |
196 | 237 | get('video_options').style.display = 'none'; |
238 | + get('audio_options').style.display = 'none'; | |
197 | 239 | get('flash_options').style.display = 'none'; |
198 | 240 | get('quicktime_options').style.display = 'none'; |
199 | 241 | get('shockwave_options').style.display = 'none'; |
200 | 242 | get('windowsmedia_options').style.display = 'none'; |
201 | 243 | get('realmedia_options').style.display = 'none'; |
244 | + get('embeddedaudio_options').style.display = 'none'; | |
202 | 245 | |
203 | 246 | if (get(data.type + '_options')) |
204 | 247 | get(data.type + '_options').style.display = 'block'; |
... | ... | @@ -210,7 +253,9 @@ |
210 | 253 | setOptions('shockwave', 'sound,progress,autostart,swliveconnect,swvolume,swstretchstyle,swstretchhalign,swstretchvalign'); |
211 | 254 | setOptions('windowsmedia', 'autostart,enabled,enablecontextmenu,fullscreen,invokeurls,mute,stretchtofit,windowlessvideo,balance,baseurl,captioningid,currentmarker,currentposition,defaultframe,playcount,rate,uimode,volume'); |
212 | 255 | setOptions('realmedia', 'autostart,loop,autogotourl,center,imagestatus,maintainaspect,nojava,prefetch,shuffle,console,controls,numloop,scriptcallbacks'); |
213 | - setOptions('video', 'poster,autoplay,loop,preload,controls'); | |
256 | + setOptions('video', 'poster,autoplay,loop,muted,preload,controls'); | |
257 | + setOptions('audio', 'autoplay,loop,preload,controls'); | |
258 | + setOptions('embeddedaudio', 'autoplay,loop,controls'); | |
214 | 259 | setOptions('global', 'id,name,vspace,hspace,bgcolor,align,width,height'); |
215 | 260 | |
216 | 261 | if (to_form) { |
... | ... | @@ -225,12 +270,23 @@ |
225 | 270 | src = data.video.sources[2]; |
226 | 271 | if (src) |
227 | 272 | setVal('video_altsource2', src.src); |
273 | + } else if (data.type == 'audio') { | |
274 | + if (data.video.sources[0]) | |
275 | + setVal('src', data.video.sources[0].src); | |
276 | + | |
277 | + src = data.video.sources[1]; | |
278 | + if (src) | |
279 | + setVal('audio_altsource1', src.src); | |
280 | + | |
281 | + src = data.video.sources[2]; | |
282 | + if (src) | |
283 | + setVal('audio_altsource2', src.src); | |
228 | 284 | } else { |
229 | 285 | // Check flash vars |
230 | 286 | if (data.type == 'flash') { |
231 | 287 | tinymce.each(editor.getParam('flash_video_player_flashvars', {url : '$url', poster : '$poster'}), function(value, name) { |
232 | 288 | if (value == '$url') |
233 | - data.params.src = parseQueryParams(data.params.flashvars)[name] || data.params.src; | |
289 | + data.params.src = parseQueryParams(data.params.flashvars)[name] || data.params.src || ''; | |
234 | 290 | }); |
235 | 291 | } |
236 | 292 | |
... | ... | @@ -238,20 +294,41 @@ |
238 | 294 | } |
239 | 295 | } else { |
240 | 296 | src = getVal("src"); |
241 | - | |
242 | - // YouTube | |
243 | - if (src.match(/youtube.com(.+)v=([^&]+)/)) { | |
297 | + | |
298 | + // YouTube Embed | |
299 | + if (src.match(/youtube\.com\/embed\/\w+/)) { | |
244 | 300 | data.width = 425; |
245 | 301 | data.height = 350; |
246 | 302 | data.params.frameborder = '0'; |
247 | 303 | data.type = 'iframe'; |
248 | - src = 'http://www.youtube.com/embed/' + src.match(/v=([^&]+)/)[1]; | |
249 | 304 | setVal('src', src); |
250 | 305 | setVal('media_type', data.type); |
306 | + } else { | |
307 | + // YouTube *NEW* | |
308 | + if (src.match(/youtu\.be\/[a-z1-9.-_]+/)) { | |
309 | + data.width = 425; | |
310 | + data.height = 350; | |
311 | + data.params.frameborder = '0'; | |
312 | + data.type = 'iframe'; | |
313 | + src = 'http://www.youtube.com/embed/' + src.match(/youtu.be\/([a-z1-9.-_]+)/)[1]; | |
314 | + setVal('src', src); | |
315 | + setVal('media_type', data.type); | |
316 | + } | |
317 | + | |
318 | + // YouTube | |
319 | + if (src.match(/youtube\.com(.+)v=([^&]+)/)) { | |
320 | + data.width = 425; | |
321 | + data.height = 350; | |
322 | + data.params.frameborder = '0'; | |
323 | + data.type = 'iframe'; | |
324 | + src = 'http://www.youtube.com/embed/' + src.match(/v=([^&]+)/)[1]; | |
325 | + setVal('src', src); | |
326 | + setVal('media_type', data.type); | |
327 | + } | |
251 | 328 | } |
252 | 329 | |
253 | 330 | // Google video |
254 | - if (src.match(/video.google.com(.+)docid=([^&]+)/)) { | |
331 | + if (src.match(/video\.google\.com(.+)docid=([^&]+)/)) { | |
255 | 332 | data.width = 425; |
256 | 333 | data.height = 326; |
257 | 334 | data.type = 'flash'; |
... | ... | @@ -259,6 +336,39 @@ |
259 | 336 | setVal('src', src); |
260 | 337 | setVal('media_type', data.type); |
261 | 338 | } |
339 | + | |
340 | + // Vimeo | |
341 | + if (src.match(/vimeo\.com\/([0-9]+)/)) { | |
342 | + data.width = 425; | |
343 | + data.height = 350; | |
344 | + data.params.frameborder = '0'; | |
345 | + data.type = 'iframe'; | |
346 | + src = 'http://player.vimeo.com/video/' + src.match(/vimeo.com\/([0-9]+)/)[1]; | |
347 | + setVal('src', src); | |
348 | + setVal('media_type', data.type); | |
349 | + } | |
350 | + | |
351 | + // stream.cz | |
352 | + if (src.match(/stream\.cz\/((?!object).)*\/([0-9]+)/)) { | |
353 | + data.width = 425; | |
354 | + data.height = 350; | |
355 | + data.params.frameborder = '0'; | |
356 | + data.type = 'iframe'; | |
357 | + src = 'http://www.stream.cz/object/' + src.match(/stream.cz\/[^/]+\/([0-9]+)/)[1]; | |
358 | + setVal('src', src); | |
359 | + setVal('media_type', data.type); | |
360 | + } | |
361 | + | |
362 | + // Google maps | |
363 | + if (src.match(/maps\.google\.([a-z]{2,3})\/maps\/(.+)msid=(.+)/)) { | |
364 | + data.width = 425; | |
365 | + data.height = 350; | |
366 | + data.params.frameborder = '0'; | |
367 | + data.type = 'iframe'; | |
368 | + src = 'http://maps.google.com/maps/ms?msid=' + src.match(/msid=(.+)/)[1] + "&output=embed"; | |
369 | + setVal('src', src); | |
370 | + setVal('media_type', data.type); | |
371 | + } | |
262 | 372 | |
263 | 373 | if (data.type == 'video') { |
264 | 374 | if (!data.video.sources) |
... | ... | @@ -273,12 +383,25 @@ |
273 | 383 | src = getVal("video_altsource2"); |
274 | 384 | if (src) |
275 | 385 | data.video.sources[2] = {src : src}; |
386 | + } else if (data.type == 'audio') { | |
387 | + if (!data.video.sources) | |
388 | + data.video.sources = []; | |
389 | + | |
390 | + data.video.sources[0] = {src : src}; | |
391 | + | |
392 | + src = getVal("audio_altsource1"); | |
393 | + if (src) | |
394 | + data.video.sources[1] = {src : src}; | |
395 | + | |
396 | + src = getVal("audio_altsource2"); | |
397 | + if (src) | |
398 | + data.video.sources[2] = {src : src}; | |
276 | 399 | } else |
277 | 400 | data.params.src = src; |
278 | 401 | |
279 | 402 | // Set default size |
280 | - setVal('width', data.width || 320); | |
281 | - setVal('height', data.height || 240); | |
403 | + setVal('width', data.width || (data.type == 'audio' ? 300 : 320)); | |
404 | + setVal('height', data.height || (data.type == 'audio' ? 32 : 240)); | |
282 | 405 | } |
283 | 406 | }, |
284 | 407 | |
... | ... | @@ -296,7 +419,7 @@ |
296 | 419 | this.panel = 'source'; |
297 | 420 | } else { |
298 | 421 | if (this.panel == 'source') { |
299 | - this.data = this.editor.plugins.media.htmlToData(getVal('source')); | |
422 | + this.data = clone(this.editor.plugins.media.htmlToData(getVal('source'))); | |
300 | 423 | this.dataToForm(); |
301 | 424 | this.panel = ''; |
302 | 425 | } |
... | ... | @@ -307,16 +430,16 @@ |
307 | 430 | }, |
308 | 431 | |
309 | 432 | beforeResize : function() { |
310 | - this.width = parseInt(getVal('width') || "320", 10); | |
311 | - this.height = parseInt(getVal('height') || "240", 10); | |
433 | + this.width = parseInt(getVal('width') || (this.data.type == 'audio' ? "300" : "320"), 10); | |
434 | + this.height = parseInt(getVal('height') || (this.data.type == 'audio' ? "32" : "240"), 10); | |
312 | 435 | }, |
313 | 436 | |
314 | 437 | changeSize : function(type) { |
315 | 438 | var width, height, scale, size; |
316 | 439 | |
317 | 440 | if (get('constrain').checked) { |
318 | - width = parseInt(getVal('width') || "320", 10); | |
319 | - height = parseInt(getVal('height') || "240", 10); | |
441 | + width = parseInt(getVal('width') || (this.data.type == 'audio' ? "300" : "320"), 10); | |
442 | + height = parseInt(getVal('height') || (this.data.type == 'audio' ? "32" : "240"), 10); | |
320 | 443 | |
321 | 444 | if (type == 'width') { |
322 | 445 | this.height = Math.round((width / this.width) * height); |
... | ... | @@ -344,6 +467,42 @@ |
344 | 467 | } |
345 | 468 | |
346 | 469 | return ""; |
470 | + }, | |
471 | + | |
472 | + getMediaTypeHTML : function(editor) { | |
473 | + function option(media_type, element) { | |
474 | + if (!editor.schema.getElementRule(element || media_type)) { | |
475 | + return ''; | |
476 | + } | |
477 | + | |
478 | + return '<option value="'+media_type+'">'+tinyMCEPopup.editor.translate("media_dlg."+media_type)+'</option>' | |
479 | + } | |
480 | + | |
481 | + var html = ""; | |
482 | + | |
483 | + html += '<select id="media_type" name="media_type" onchange="Media.formToData(\'type\');">'; | |
484 | + html += option("video"); | |
485 | + html += option("audio"); | |
486 | + html += option("flash", "object"); | |
487 | + html += option("quicktime", "object"); | |
488 | + html += option("shockwave", "object"); | |
489 | + html += option("windowsmedia", "object"); | |
490 | + html += option("realmedia", "object"); | |
491 | + html += option("iframe"); | |
492 | + | |
493 | + if (editor.getParam('media_embedded_audio', false)) { | |
494 | + html += option('embeddedaudio', "object"); | |
495 | + } | |
496 | + | |
497 | + html += '</select>'; | |
498 | + return html; | |
499 | + }, | |
500 | + | |
501 | + setDefaultDialogSettings : function(editor) { | |
502 | + var defaultDialogSettings = editor.getParam("media_dialog_defaults", {}); | |
503 | + tinymce.each(defaultDialogSettings, function(v, k) { | |
504 | + setVal(k, v); | |
505 | + }); | |
347 | 506 | } |
348 | 507 | }; |
349 | 508 | |
... | ... | @@ -351,4 +510,4 @@ |
351 | 510 | tinyMCEPopup.onInit.add(function() { |
352 | 511 | Media.init(); |
353 | 512 | }); |
354 | -})(); | |
355 | 513 | \ No newline at end of file |
514 | +})(); | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/media/langs/en_dlg.js
1 | -tinyMCE.addI18n('en.media_dlg',{ | |
2 | -title:"Insert / edit embedded media", | |
3 | -general:"General", | |
4 | -advanced:"Advanced", | |
5 | -file:"File/URL", | |
6 | -list:"List", | |
7 | -size:"Dimensions", | |
8 | -preview:"Preview", | |
9 | -constrain_proportions:"Constrain proportions", | |
10 | -type:"Type", | |
11 | -id:"Id", | |
12 | -name:"Name", | |
13 | -class_name:"Class", | |
14 | -vspace:"V-Space", | |
15 | -hspace:"H-Space", | |
16 | -play:"Auto play", | |
17 | -loop:"Loop", | |
18 | -menu:"Show menu", | |
19 | -quality:"Quality", | |
20 | -scale:"Scale", | |
21 | -align:"Align", | |
22 | -salign:"SAlign", | |
23 | -wmode:"WMode", | |
24 | -bgcolor:"Background", | |
25 | -base:"Base", | |
26 | -flashvars:"Flashvars", | |
27 | -liveconnect:"SWLiveConnect", | |
28 | -autohref:"AutoHREF", | |
29 | -cache:"Cache", | |
30 | -hidden:"Hidden", | |
31 | -controller:"Controller", | |
32 | -kioskmode:"Kiosk mode", | |
33 | -playeveryframe:"Play every frame", | |
34 | -targetcache:"Target cache", | |
35 | -correction:"No correction", | |
36 | -enablejavascript:"Enable JavaScript", | |
37 | -starttime:"Start time", | |
38 | -endtime:"End time", | |
39 | -href:"Href", | |
40 | -qtsrcchokespeed:"Choke speed", | |
41 | -target:"Target", | |
42 | -volume:"Volume", | |
43 | -autostart:"Auto start", | |
44 | -enabled:"Enabled", | |
45 | -fullscreen:"Fullscreen", | |
46 | -invokeurls:"Invoke URLs", | |
47 | -mute:"Mute", | |
48 | -stretchtofit:"Stretch to fit", | |
49 | -windowlessvideo:"Windowless video", | |
50 | -balance:"Balance", | |
51 | -baseurl:"Base URL", | |
52 | -captioningid:"Captioning id", | |
53 | -currentmarker:"Current marker", | |
54 | -currentposition:"Current position", | |
55 | -defaultframe:"Default frame", | |
56 | -playcount:"Play count", | |
57 | -rate:"Rate", | |
58 | -uimode:"UI Mode", | |
59 | -flash_options:"Flash options", | |
60 | -qt_options:"Quicktime options", | |
61 | -wmp_options:"Windows media player options", | |
62 | -rmp_options:"Real media player options", | |
63 | -shockwave_options:"Shockwave options", | |
64 | -autogotourl:"Auto goto URL", | |
65 | -center:"Center", | |
66 | -imagestatus:"Image status", | |
67 | -maintainaspect:"Maintain aspect", | |
68 | -nojava:"No java", | |
69 | -prefetch:"Prefetch", | |
70 | -shuffle:"Shuffle", | |
71 | -console:"Console", | |
72 | -numloop:"Num loops", | |
73 | -controls:"Controls", | |
74 | -scriptcallbacks:"Script callbacks", | |
75 | -swstretchstyle:"Stretch style", | |
76 | -swstretchhalign:"Stretch H-Align", | |
77 | -swstretchvalign:"Stretch V-Align", | |
78 | -sound:"Sound", | |
79 | -progress:"Progress", | |
80 | -qtsrc:"QT Src", | |
81 | -qt_stream_warn:"Streamed rtsp resources should be added to the QT Src field under the advanced tab.\nYou should also add a non streamed version to the Src field..", | |
82 | -align_top:"Top", | |
83 | -align_right:"Right", | |
84 | -align_bottom:"Bottom", | |
85 | -align_left:"Left", | |
86 | -align_center:"Center", | |
87 | -align_top_left:"Top left", | |
88 | -align_top_right:"Top right", | |
89 | -align_bottom_left:"Bottom left", | |
90 | -align_bottom_right:"Bottom right", | |
91 | -flv_options:"Flash video options", | |
92 | -flv_scalemode:"Scale mode", | |
93 | -flv_buffer:"Buffer", | |
94 | -flv_starttime:"Start time", | |
95 | -flv_defaultvolume:"Default volumne", | |
96 | -flv_hiddengui:"Hidden GUI", | |
97 | -flv_autostart:"Auto start", | |
98 | -flv_loop:"Loop", | |
99 | -flv_showscalemodes:"Show scale modes", | |
100 | -flv_smoothvideo:"Smooth video", | |
101 | -flv_jscallback:"JS Callback", | |
102 | -html5_video_options:"HTML5 Video Options", | |
103 | -altsource1:"Alternative source 1", | |
104 | -altsource2:"Alternative source 2", | |
105 | -preload:"Preload", | |
106 | -poster:"Poster", | |
107 | - | |
108 | -source:"Source" | |
109 | -}); | |
110 | 1 | \ No newline at end of file |
2 | +tinyMCE.addI18n('en.media_dlg',{list:"List",file:"File/URL",advanced:"Advanced",general:"General",title:"Insert/Edit Embedded Media","align_top_left":"Top Left","align_center":"Center","align_left":"Left","align_bottom":"Bottom","align_right":"Right","align_top":"Top","qt_stream_warn":"Streamed RTSP resources should be added to the QT Source field under the Advanced tab.\nYou should also add a non-streamed version to the Source field.",qtsrc:"QT Source",progress:"Progress",sound:"Sound",swstretchvalign:"Stretch V-Align",swstretchhalign:"Stretch H-Align",swstretchstyle:"Stretch Style",scriptcallbacks:"Script Callbacks","align_top_right":"Top Right",uimode:"UI Mode",rate:"Rate",playcount:"Play Count",defaultframe:"Default Frame",currentposition:"Current Position",currentmarker:"Current Marker",captioningid:"Captioning ID",baseurl:"Base URL",balance:"Balance",windowlessvideo:"Windowless Video",stretchtofit:"Stretch to Fit",mute:"Mute",invokeurls:"Invoke URLs",fullscreen:"Full Screen",enabled:"Enabled",autostart:"Auto Start",volume:"Volume",target:"Target",qtsrcchokespeed:"Choke Speed",href:"HREF",endtime:"End Time",starttime:"Start Time",enablejavascript:"Enable JavaScript",correction:"No Correction",targetcache:"Target Cache",playeveryframe:"Play Every Frame",kioskmode:"Kiosk Mode",controller:"Controller",menu:"Show Menu",loop:"Loop",play:"Auto Play",hspace:"H-Space",vspace:"V-Space","class_name":"Class",name:"Name",id:"ID",type:"Type",size:"Dimensions",preview:"Preview","constrain_proportions":"Constrain Proportions",controls:"Controls",numloop:"Num Loops",console:"Console",cache:"Cache",autohref:"Auto HREF",liveconnect:"SWLiveConnect",flashvars:"Flash Vars",base:"Base",bgcolor:"Background",wmode:"WMode",salign:"SAlign",align:"Align",scale:"Scale",quality:"Quality",shuffle:"Shuffle",prefetch:"Prefetch",nojava:"No Java",maintainaspect:"Maintain Aspect",imagestatus:"Image Status",center:"Center",autogotourl:"Auto Goto URL","shockwave_options":"Shockwave Options","rmp_options":"Real Media Player Options","wmp_options":"Windows Media Player Options","qt_options":"QuickTime Options","flash_options":"Flash Options",hidden:"Hidden","align_bottom_left":"Bottom Left","align_bottom_right":"Bottom Right","html5_video_options":"HTML5 Video Options",altsource1:"Alternative source 1",altsource2:"Alternative source 2",preload:"Preload",poster:"Poster",source:"Source","html5_audio_options":"Audio Options","preload_none":"Don\'t Preload","preload_metadata":"Preload video metadata","preload_auto":"Let user\'s browser decide", "embedded_audio_options":"Embedded Audio Options", video:"HTML5 Video", audio:"HTML5 Audio", flash:"Flash", quicktime:"QuickTime", shockwave:"Shockwave", windowsmedia:"Windows Media", realmedia:"Real Media", iframe:"Iframe", embeddedaudio:"Embedded Audio" }); | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/media/media.htm
... | ... | @@ -29,15 +29,7 @@ |
29 | 29 | <tr> |
30 | 30 | <td><label for="media_type">{#media_dlg.type}</label></td> |
31 | 31 | <td> |
32 | - <select id="media_type" name="media_type" onchange="Media.formToData('type');"> | |
33 | - <option value="video">HTML5 Video</option> | |
34 | - <option value="flash">Flash</option> | |
35 | - <option value="quicktime">QuickTime</option> | |
36 | - <option value="shockwave">Shockwave</option> | |
37 | - <option value="windowsmedia">Windows Media</option> | |
38 | - <option value="realmedia">Real Media</option> | |
39 | - <option value="iframe">Iframe</option> | |
40 | - </select> | |
32 | + <select id="media_type"></select> | |
41 | 33 | </td> |
42 | 34 | </tr> |
43 | 35 | <tr> |
... | ... | @@ -159,6 +151,17 @@ |
159 | 151 | </table> |
160 | 152 | </td> |
161 | 153 | </tr> |
154 | + | |
155 | + <tr> | |
156 | + <td><label for="video_preload">{#media_dlg.preload}</label></td> | |
157 | + <td> | |
158 | + <select id="video_preload" name="video_preload" onchange="Media.formToData();"> | |
159 | + <option value="none">{#media_dlg.preload_none}</option> | |
160 | + <option value="metadata">{#media_dlg.preload_metadata}</option> | |
161 | + <option value="auto">{#media_dlg.preload_auto}</option> | |
162 | + </select> | |
163 | + </td> | |
164 | + </tr> | |
162 | 165 | </table> |
163 | 166 | |
164 | 167 | <table role="presentation" border="0" cellpadding="4" cellspacing="0"> |
... | ... | @@ -175,26 +178,133 @@ |
175 | 178 | <td> |
176 | 179 | <table role="presentation" border="0" cellpadding="0" cellspacing="0"> |
177 | 180 | <tr> |
178 | - <td><input type="checkbox" class="checkbox" id="video_loop" name="video_loop" onchange="Media.formToData();" /></td> | |
179 | - <td><label for="video_loop">{#media_dlg.loop}</label></td> | |
181 | + <td><input type="checkbox" class="checkbox" id="video_muted" name="video_muted" onchange="Media.formToData();" /></td> | |
182 | + <td><label for="video_muted">{#media_dlg.mute}</label></td> | |
180 | 183 | </tr> |
181 | 184 | </table> |
182 | 185 | </td> |
183 | 186 | |
184 | 187 | <td> |
188 | + <table role="presentation" border="0" cellpadding="0" cellspacing="0"> | |
189 | + <tr> | |
190 | + <td><input type="checkbox" class="checkbox" id="video_loop" name="video_loop" onchange="Media.formToData();" /></td> | |
191 | + <td><label for="video_loop">{#media_dlg.loop}</label></td> | |
192 | + </tr> | |
193 | + </table> | |
194 | + </td> | |
195 | + | |
196 | + <td> | |
185 | 197 | <table role="presentation" border="0" cellpadding="0" cellspacing="0"> |
186 | 198 | <tr> |
187 | - <td><input type="checkbox" class="checkbox" id="video_preload" name="video_preload" onchange="Media.formToData();" /></td> | |
188 | - <td><label for="video_preload">{#media_dlg.preload}</label></td> | |
199 | + <td><input type="checkbox" class="checkbox" id="video_controls" name="video_controls" onchange="Media.formToData();" /></td> | |
200 | + <td><label for="video_controls">{#media_dlg.controls}</label></td> | |
189 | 201 | </tr> |
190 | 202 | </table> |
191 | 203 | </td> |
204 | + </tr> | |
205 | + </table> | |
206 | + </fieldset> | |
207 | + | |
208 | + <fieldset id="embeddedaudio_options"> | |
209 | + <legend>{#media_dlg.embedded_audio_options}</legend> | |
192 | 210 | |
211 | + <table role="presentation" border="0" cellpadding="4" cellspacing="0"> | |
212 | + <tr> | |
193 | 213 | <td> |
194 | 214 | <table role="presentation" border="0" cellpadding="0" cellspacing="0"> |
195 | 215 | <tr> |
196 | - <td><input type="checkbox" class="checkbox" id="video_controls" name="video_controls" onchange="Media.formToData();" /></td> | |
197 | - <td><label for="video_controls">{#media_dlg.controls}</label></td> | |
216 | + <td><input type="checkbox" class="checkbox" id="embeddedaudio_autoplay" name="audio_autoplay" onchange="Media.formToData();" /></td> | |
217 | + <td><label for="audio_autoplay">{#media_dlg.play}</label></td> | |
218 | + </tr> | |
219 | + </table> | |
220 | + </td> | |
221 | + | |
222 | + <td> | |
223 | + <table role="presentation" border="0" cellpadding="0" cellspacing="0"> | |
224 | + <tr> | |
225 | + <td><input type="checkbox" class="checkbox" id="embeddedaudio_loop" name="audio_loop" onchange="Media.formToData();" /></td> | |
226 | + <td><label for="audio_loop">{#media_dlg.loop}</label></td> | |
227 | + </tr> | |
228 | + </table> | |
229 | + </td> | |
230 | + | |
231 | + <td> | |
232 | + <table role="presentation" border="0" cellpadding="0" cellspacing="0"> | |
233 | + <tr> | |
234 | + <td><input type="checkbox" class="checkbox" id="embeddedaudio_controls" name="audio_controls" onchange="Media.formToData();" /></td> | |
235 | + <td><label for="audio_controls">{#media_dlg.controls}</label></td> | |
236 | + </tr> | |
237 | + </table> | |
238 | + </td> | |
239 | + </tr> | |
240 | + </table> | |
241 | + </fieldset> | |
242 | + | |
243 | + <fieldset id="audio_options"> | |
244 | + <legend>{#media_dlg.html5_audio_options}</legend> | |
245 | + | |
246 | + <table role="presentation"> | |
247 | + <tr> | |
248 | + <td><label for="audio_altsource1">{#media_dlg.altsource1}</label></td> | |
249 | + <td> | |
250 | + <table role="presentation" border="0" cellspacing="0" cellpadding="0"> | |
251 | + <tr> | |
252 | + <td><input type="text" id="audio_altsource1" name="audio_altsource1" onchange="Media.formToData();" style="width: 240px" /></td> | |
253 | + <td id="audio_altsource1_filebrowser"> </td> | |
254 | + </tr> | |
255 | + </table> | |
256 | + </td> | |
257 | + </tr> | |
258 | + | |
259 | + <tr> | |
260 | + <td><label for="audio_altsource2">{#media_dlg.altsource2}</label></td> | |
261 | + <td> | |
262 | + <table role="presentation" border="0" cellspacing="0" cellpadding="0"> | |
263 | + <tr> | |
264 | + <td><input type="text" id="audio_altsource2" name="audio_altsource2" onchange="Media.formToData();" style="width: 240px" /></td> | |
265 | + <td id="audio_altsource2_filebrowser"> </td> | |
266 | + </tr> | |
267 | + </table> | |
268 | + </td> | |
269 | + </tr> | |
270 | + | |
271 | + <tr> | |
272 | + <td><label for="audio_preload">{#media_dlg.preload}</label></td> | |
273 | + <td> | |
274 | + <select id="audio_preload" name="audio_preload" onchange="Media.formToData();"> | |
275 | + <option value="none">{#media_dlg.preload_none}</option> | |
276 | + <option value="metadata">{#media_dlg.preload_metadata}</option> | |
277 | + <option value="auto">{#media_dlg.preload_auto}</option> | |
278 | + </select> | |
279 | + </td> | |
280 | + </tr> | |
281 | + </table> | |
282 | + | |
283 | + <table role="presentation" border="0" cellpadding="4" cellspacing="0"> | |
284 | + <tr> | |
285 | + <td> | |
286 | + <table role="presentation" border="0" cellpadding="0" cellspacing="0"> | |
287 | + <tr> | |
288 | + <td><input type="checkbox" class="checkbox" id="audio_autoplay" name="audio_autoplay" onchange="Media.formToData();" /></td> | |
289 | + <td><label for="audio_autoplay">{#media_dlg.play}</label></td> | |
290 | + </tr> | |
291 | + </table> | |
292 | + </td> | |
293 | + | |
294 | + <td> | |
295 | + <table role="presentation" border="0" cellpadding="0" cellspacing="0"> | |
296 | + <tr> | |
297 | + <td><input type="checkbox" class="checkbox" id="audio_loop" name="audio_loop" onchange="Media.formToData();" /></td> | |
298 | + <td><label for="audio_loop">{#media_dlg.loop}</label></td> | |
299 | + </tr> | |
300 | + </table> | |
301 | + </td> | |
302 | + | |
303 | + <td> | |
304 | + <table role="presentation" border="0" cellpadding="0" cellspacing="0"> | |
305 | + <tr> | |
306 | + <td><input type="checkbox" class="checkbox" id="audio_controls" name="audio_controls" onchange="Media.formToData();" /></td> | |
307 | + <td><label for="audio_controls">{#media_dlg.controls}</label></td> | |
198 | 308 | </tr> |
199 | 309 | </table> |
200 | 310 | </td> |
... | ... | @@ -798,7 +908,7 @@ |
798 | 908 | <div id="source_panel" class="panel"> |
799 | 909 | <fieldset> |
800 | 910 | <legend>{#media_dlg.source}</legend> |
801 | - <textarea id="source" style="width: 100%; height: 390px"></textarea> | |
911 | + <textarea id="source" style="width: 99%; height: 390px"></textarea> | |
802 | 912 | </fieldset> |
803 | 913 | </div> |
804 | 914 | </div> | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/media/moxieplayer.swf
No preview for this file type
public/javascripts/tinymce/jscripts/tiny_mce/plugins/nonbreaking/editor_plugin.js
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)})(); | |
2 | 1 | \ No newline at end of file |
2 | +(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(f.keyCode==9){f.preventDefault();d.execCommand("mceNonBreaking");d.execCommand("mceNonBreaking");d.execCommand("mceNonBreaking")}})}},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)})(); | |
3 | 3 | \ No newline at end of file | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/nonbreaking/editor_plugin_src.js
... | ... | @@ -25,11 +25,12 @@ |
25 | 25 | |
26 | 26 | if (ed.getParam('nonbreaking_force_tab')) { |
27 | 27 | ed.onKeyDown.add(function(ed, e) { |
28 | - if (tinymce.isIE && e.keyCode == 9) { | |
28 | + if (e.keyCode == 9) { | |
29 | + e.preventDefault(); | |
30 | + | |
29 | 31 | ed.execCommand('mceNonBreaking'); |
30 | 32 | ed.execCommand('mceNonBreaking'); |
31 | 33 | ed.execCommand('mceNonBreaking'); |
32 | - tinymce.dom.Event.cancel(e); | |
33 | 34 | } |
34 | 35 | }); |
35 | 36 | } | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/noneditable/editor_plugin.js
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);b.onContextMenu.addToTop(c._block)}else{b.onKeyDown.remove(c._block);b.onKeyPress.remove(c._block);b.onKeyUp.remove(c._block);b.onPaste.remove(c._block);b.onContextMenu.remove(c._block)}c.disabled=d}}});tinymce.PluginManager.add("noneditable",tinymce.plugins.NonEditablePlugin)})(); | |
2 | 1 | \ No newline at end of file |
2 | +(function(){var c=tinymce.dom.TreeWalker;var a="contenteditable",d="data-mce-"+a;var e=tinymce.VK;function b(n){var j=n.dom,p=n.selection,r,o="mce_noneditablecaret",r="\uFEFF";function m(t){var s;if(t.nodeType===1){s=t.getAttribute(d);if(s&&s!=="inherit"){return s}s=t.contentEditable;if(s!=="inherit"){return s}}return null}function g(s){var t;while(s){t=m(s);if(t){return t==="false"?s:null}s=s.parentNode}}function l(s){while(s){if(s.id===o){return s}s=s.parentNode}}function k(s){var t;if(s){t=new c(s,s);for(s=t.current();s;s=t.next()){if(s.nodeType===3){return s}}}}function f(v,u){var s,t;if(m(v)==="false"){if(j.isBlock(v)){p.select(v);return}}t=j.createRng();if(m(v)==="true"){if(!v.firstChild){v.appendChild(n.getDoc().createTextNode("\u00a0"))}v=v.firstChild;u=true}s=j.create("span",{id:o,"data-mce-bogus":true},r);if(u){v.parentNode.insertBefore(s,v)}else{j.insertAfter(s,v)}t.setStart(s.firstChild,1);t.collapse(true);p.setRng(t);return s}function i(s){var v,t,u;if(s){rng=p.getRng(true);rng.setStartBefore(s);rng.setEndBefore(s);v=k(s);if(v&&v.nodeValue.charAt(0)==r){v=v.deleteData(0,1)}j.remove(s,true);p.setRng(rng)}else{t=l(p.getStart());while((s=j.get(o))&&s!==u){if(t!==s){v=k(s);if(v&&v.nodeValue.charAt(0)==r){v=v.deleteData(0,1)}j.remove(s,true)}u=s}}}function q(){var s,w,u,t,v;function x(B,D){var A,F,E,C,z;A=t.startContainer;F=t.startOffset;if(A.nodeType==3){z=A.nodeValue.length;if((F>0&&F<z)||(D?F==z:F==0)){return}}else{if(F<A.childNodes.length){var G=!D&&F>0?F-1:F;A=A.childNodes[G];if(A.hasChildNodes()){A=A.firstChild}}else{return !D?B:null}}E=new c(A,B);while(C=E[D?"prev":"next"]()){if(C.nodeType===3&&C.nodeValue.length>0){return}else{if(m(C)==="true"){return C}}}return B}i();u=p.isCollapsed();s=g(p.getStart());w=g(p.getEnd());if(s||w){t=p.getRng(true);if(u){s=s||w;var y=p.getStart();if(v=x(s,true)){f(v,true)}else{if(v=x(s,false)){f(v,false)}else{p.select(s)}}}else{t=p.getRng(true);if(s){t.setStartBefore(s)}if(w){t.setEndAfter(w)}p.setRng(t)}}}function h(z,B){var F=B.keyCode,x,C,D,v;function u(H,G){while(H=H[G?"previousSibling":"nextSibling"]){if(H.nodeType!==3||H.nodeValue.length>0){return H}}}function y(G,H){p.select(G);p.collapse(H)}function t(K){var J,I,M,H;function G(O){var N=I;while(N){if(N===O){return}N=N.parentNode}j.remove(O);q()}function L(){var O,P,N=z.schema.getNonEmptyElements();P=new tinymce.dom.TreeWalker(I,z.getBody());while(O=(K?P.prev():P.next())){if(N[O.nodeName.toLowerCase()]){break}if(O.nodeType===3&&tinymce.trim(O.nodeValue).length>0){break}if(m(O)==="false"){G(O);return true}}if(g(O)){return true}return false}if(p.isCollapsed()){J=p.getRng(true);I=J.startContainer;M=J.startOffset;I=l(I)||I;if(H=g(I)){G(H);return false}if(I.nodeType==3&&(K?M>0:M<I.nodeValue.length)){return true}if(I.nodeType==1){I=I.childNodes[M]||I}if(L()){return false}}return true}D=p.getStart();v=p.getEnd();x=g(D)||g(v);if(x&&(F<112||F>124)&&F!=e.DELETE&&F!=e.BACKSPACE){if((tinymce.isMac?B.metaKey:B.ctrlKey)&&(F==67||F==88||F==86)){return}B.preventDefault();if(F==e.LEFT||F==e.RIGHT){var w=F==e.LEFT;if(z.dom.isBlock(x)){var A=w?x.previousSibling:x.nextSibling;var s=new c(A,A);var E=w?s.prev():s.next();y(E,!w)}else{y(x,w)}}}else{if(F==e.LEFT||F==e.RIGHT||F==e.BACKSPACE||F==e.DELETE){C=l(D);if(C){if(F==e.LEFT||F==e.BACKSPACE){x=u(C,true);if(x&&m(x)==="false"){B.preventDefault();if(F==e.LEFT){y(x,true)}else{j.remove(x);return}}else{i(C)}}if(F==e.RIGHT||F==e.DELETE){x=u(C);if(x&&m(x)==="false"){B.preventDefault();if(F==e.RIGHT){y(x,false)}else{j.remove(x);return}}else{i(C)}}}if((F==e.BACKSPACE||F==e.DELETE)&&!t(F==e.BACKSPACE)){B.preventDefault();return false}}}}n.onMouseDown.addToTop(function(s,u){var t=s.selection.getNode();if(m(t)==="false"&&t==u.target){q()}});n.onMouseUp.addToTop(q);n.onKeyDown.addToTop(h);n.onKeyUp.addToTop(q)}tinymce.create("tinymce.plugins.NonEditablePlugin",{init:function(i,k){var h,g,j;function f(m,n){var o=j.length,p=n.content,l=tinymce.trim(g);if(n.format=="raw"){return}while(o--){p=p.replace(j[o],function(s){var r=arguments,q=r[r.length-2];if(q>0&&p.charAt(q-1)=='"'){return s}return'<span class="'+l+'" data-mce-content="'+m.dom.encode(r[0])+'">'+m.dom.encode(typeof(r[1])==="string"?r[1]:r[0])+"</span>"})}n.content=p}h=" "+tinymce.trim(i.getParam("noneditable_editable_class","mceEditable"))+" ";g=" "+tinymce.trim(i.getParam("noneditable_noneditable_class","mceNonEditable"))+" ";j=i.getParam("noneditable_regexp");if(j&&!j.length){j=[j]}i.onPreInit.add(function(){b(i);if(j){i.selection.onBeforeSetContent.add(f);i.onBeforeSetContent.add(f)}i.parser.addAttributeFilter("class",function(l){var m=l.length,n,o;while(m--){o=l[m];n=" "+o.attr("class")+" ";if(n.indexOf(h)!==-1){o.attr(d,"true")}else{if(n.indexOf(g)!==-1){o.attr(d,"false")}}}});i.serializer.addAttributeFilter(d,function(l,m){var n=l.length,o;while(n--){o=l[n];if(j&&o.attr("data-mce-content")){o.name="#text";o.type=3;o.raw=true;o.value=o.attr("data-mce-content")}else{o.attr(a,null);o.attr(d,null)}}});i.parser.addAttributeFilter(a,function(l,m){var n=l.length,o;while(n--){o=l[n];o.attr(d,o.attr(a));o.attr(a,null)}})})},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}}});tinymce.PluginManager.add("noneditable",tinymce.plugins.NonEditablePlugin)})(); | |
3 | 3 | \ No newline at end of file | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/noneditable/editor_plugin_src.js
... | ... | @@ -9,34 +9,515 @@ |
9 | 9 | */ |
10 | 10 | |
11 | 11 | (function() { |
12 | - var Event = tinymce.dom.Event; | |
12 | + var TreeWalker = tinymce.dom.TreeWalker; | |
13 | + var externalName = 'contenteditable', internalName = 'data-mce-' + externalName; | |
14 | + var VK = tinymce.VK; | |
15 | + | |
16 | + function handleContentEditableSelection(ed) { | |
17 | + var dom = ed.dom, selection = ed.selection, invisibleChar, caretContainerId = 'mce_noneditablecaret', invisibleChar = '\uFEFF'; | |
18 | + | |
19 | + // Returns the content editable state of a node "true/false" or null | |
20 | + function getContentEditable(node) { | |
21 | + var contentEditable; | |
22 | + | |
23 | + // Ignore non elements | |
24 | + if (node.nodeType === 1) { | |
25 | + // Check for fake content editable | |
26 | + contentEditable = node.getAttribute(internalName); | |
27 | + if (contentEditable && contentEditable !== "inherit") { | |
28 | + return contentEditable; | |
29 | + } | |
30 | + | |
31 | + // Check for real content editable | |
32 | + contentEditable = node.contentEditable; | |
33 | + if (contentEditable !== "inherit") { | |
34 | + return contentEditable; | |
35 | + } | |
36 | + } | |
37 | + | |
38 | + return null; | |
39 | + }; | |
40 | + | |
41 | + // Returns the noneditable parent or null if there is a editable before it or if it wasn't found | |
42 | + function getNonEditableParent(node) { | |
43 | + var state; | |
44 | + | |
45 | + while (node) { | |
46 | + state = getContentEditable(node); | |
47 | + if (state) { | |
48 | + return state === "false" ? node : null; | |
49 | + } | |
50 | + | |
51 | + node = node.parentNode; | |
52 | + } | |
53 | + }; | |
54 | + | |
55 | + // Get caret container parent for the specified node | |
56 | + function getParentCaretContainer(node) { | |
57 | + while (node) { | |
58 | + if (node.id === caretContainerId) { | |
59 | + return node; | |
60 | + } | |
61 | + | |
62 | + node = node.parentNode; | |
63 | + } | |
64 | + }; | |
65 | + | |
66 | + // Finds the first text node in the specified node | |
67 | + function findFirstTextNode(node) { | |
68 | + var walker; | |
69 | + | |
70 | + if (node) { | |
71 | + walker = new TreeWalker(node, node); | |
72 | + | |
73 | + for (node = walker.current(); node; node = walker.next()) { | |
74 | + if (node.nodeType === 3) { | |
75 | + return node; | |
76 | + } | |
77 | + } | |
78 | + } | |
79 | + }; | |
80 | + | |
81 | + // Insert caret container before/after target or expand selection to include block | |
82 | + function insertCaretContainerOrExpandToBlock(target, before) { | |
83 | + var caretContainer, rng; | |
84 | + | |
85 | + // Select block | |
86 | + if (getContentEditable(target) === "false") { | |
87 | + if (dom.isBlock(target)) { | |
88 | + selection.select(target); | |
89 | + return; | |
90 | + } | |
91 | + } | |
92 | + | |
93 | + rng = dom.createRng(); | |
94 | + | |
95 | + if (getContentEditable(target) === "true") { | |
96 | + if (!target.firstChild) { | |
97 | + target.appendChild(ed.getDoc().createTextNode('\u00a0')); | |
98 | + } | |
99 | + | |
100 | + target = target.firstChild; | |
101 | + before = true; | |
102 | + } | |
103 | + | |
104 | + //caretContainer = dom.create('span', {id: caretContainerId, 'data-mce-bogus': true, style:'border: 1px solid red'}, invisibleChar); | |
105 | + caretContainer = dom.create('span', {id: caretContainerId, 'data-mce-bogus': true}, invisibleChar); | |
106 | + | |
107 | + if (before) { | |
108 | + target.parentNode.insertBefore(caretContainer, target); | |
109 | + } else { | |
110 | + dom.insertAfter(caretContainer, target); | |
111 | + } | |
112 | + | |
113 | + rng.setStart(caretContainer.firstChild, 1); | |
114 | + rng.collapse(true); | |
115 | + selection.setRng(rng); | |
116 | + | |
117 | + return caretContainer; | |
118 | + }; | |
119 | + | |
120 | + // Removes any caret container except the one we might be in | |
121 | + function removeCaretContainer(caretContainer) { | |
122 | + var child, currentCaretContainer, lastContainer; | |
123 | + | |
124 | + if (caretContainer) { | |
125 | + rng = selection.getRng(true); | |
126 | + rng.setStartBefore(caretContainer); | |
127 | + rng.setEndBefore(caretContainer); | |
128 | + | |
129 | + child = findFirstTextNode(caretContainer); | |
130 | + if (child && child.nodeValue.charAt(0) == invisibleChar) { | |
131 | + child = child.deleteData(0, 1); | |
132 | + } | |
133 | + | |
134 | + dom.remove(caretContainer, true); | |
135 | + | |
136 | + selection.setRng(rng); | |
137 | + } else { | |
138 | + currentCaretContainer = getParentCaretContainer(selection.getStart()); | |
139 | + while ((caretContainer = dom.get(caretContainerId)) && caretContainer !== lastContainer) { | |
140 | + if (currentCaretContainer !== caretContainer) { | |
141 | + child = findFirstTextNode(caretContainer); | |
142 | + if (child && child.nodeValue.charAt(0) == invisibleChar) { | |
143 | + child = child.deleteData(0, 1); | |
144 | + } | |
145 | + | |
146 | + dom.remove(caretContainer, true); | |
147 | + } | |
148 | + | |
149 | + lastContainer = caretContainer; | |
150 | + } | |
151 | + } | |
152 | + }; | |
153 | + | |
154 | + // Modifies the selection to include contentEditable false elements or insert caret containers | |
155 | + function moveSelection() { | |
156 | + var nonEditableStart, nonEditableEnd, isCollapsed, rng, element; | |
157 | + | |
158 | + // Checks if there is any contents to the left/right side of caret returns the noneditable element or any editable element if it finds one inside | |
159 | + function hasSideContent(element, left) { | |
160 | + var container, offset, walker, node, len; | |
161 | + | |
162 | + container = rng.startContainer; | |
163 | + offset = rng.startOffset; | |
164 | + | |
165 | + // If endpoint is in middle of text node then expand to beginning/end of element | |
166 | + if (container.nodeType == 3) { | |
167 | + len = container.nodeValue.length; | |
168 | + if ((offset > 0 && offset < len) || (left ? offset == len : offset == 0)) { | |
169 | + return; | |
170 | + } | |
171 | + } else { | |
172 | + // Can we resolve the node by index | |
173 | + if (offset < container.childNodes.length) { | |
174 | + // Browser represents caret position as the offset at the start of an element. When moving right | |
175 | + // this is the element we are moving into so we consider our container to be child node at offset-1 | |
176 | + var pos = !left && offset > 0 ? offset-1 : offset; | |
177 | + container = container.childNodes[pos]; | |
178 | + if (container.hasChildNodes()) { | |
179 | + container = container.firstChild; | |
180 | + } | |
181 | + } else { | |
182 | + // If not then the caret is at the last position in it's container and the caret container should be inserted after the noneditable element | |
183 | + return !left ? element : null; | |
184 | + } | |
185 | + } | |
186 | + | |
187 | + // Walk left/right to look for contents | |
188 | + walker = new TreeWalker(container, element); | |
189 | + while (node = walker[left ? 'prev' : 'next']()) { | |
190 | + if (node.nodeType === 3 && node.nodeValue.length > 0) { | |
191 | + return; | |
192 | + } else if (getContentEditable(node) === "true") { | |
193 | + // Found contentEditable=true element return this one to we can move the caret inside it | |
194 | + return node; | |
195 | + } | |
196 | + } | |
197 | + | |
198 | + return element; | |
199 | + }; | |
200 | + | |
201 | + // Remove any existing caret containers | |
202 | + removeCaretContainer(); | |
203 | + | |
204 | + // Get noneditable start/end elements | |
205 | + isCollapsed = selection.isCollapsed(); | |
206 | + nonEditableStart = getNonEditableParent(selection.getStart()); | |
207 | + nonEditableEnd = getNonEditableParent(selection.getEnd()); | |
208 | + | |
209 | + // Is any fo the range endpoints noneditable | |
210 | + if (nonEditableStart || nonEditableEnd) { | |
211 | + rng = selection.getRng(true); | |
212 | + | |
213 | + // If it's a caret selection then look left/right to see if we need to move the caret out side or expand | |
214 | + if (isCollapsed) { | |
215 | + nonEditableStart = nonEditableStart || nonEditableEnd; | |
216 | + var start = selection.getStart(); | |
217 | + if (element = hasSideContent(nonEditableStart, true)) { | |
218 | + // We have no contents to the left of the caret then insert a caret container before the noneditable element | |
219 | + insertCaretContainerOrExpandToBlock(element, true); | |
220 | + } else if (element = hasSideContent(nonEditableStart, false)) { | |
221 | + // We have no contents to the right of the caret then insert a caret container after the noneditable element | |
222 | + insertCaretContainerOrExpandToBlock(element, false); | |
223 | + } else { | |
224 | + // We are in the middle of a noneditable so expand to select it | |
225 | + selection.select(nonEditableStart); | |
226 | + } | |
227 | + } else { | |
228 | + rng = selection.getRng(true); | |
229 | + | |
230 | + // Expand selection to include start non editable element | |
231 | + if (nonEditableStart) { | |
232 | + rng.setStartBefore(nonEditableStart); | |
233 | + } | |
234 | + | |
235 | + // Expand selection to include end non editable element | |
236 | + if (nonEditableEnd) { | |
237 | + rng.setEndAfter(nonEditableEnd); | |
238 | + } | |
239 | + | |
240 | + selection.setRng(rng); | |
241 | + } | |
242 | + } | |
243 | + }; | |
244 | + | |
245 | + function handleKey(ed, e) { | |
246 | + var keyCode = e.keyCode, nonEditableParent, caretContainer, startElement, endElement; | |
247 | + | |
248 | + function getNonEmptyTextNodeSibling(node, prev) { | |
249 | + while (node = node[prev ? 'previousSibling' : 'nextSibling']) { | |
250 | + if (node.nodeType !== 3 || node.nodeValue.length > 0) { | |
251 | + return node; | |
252 | + } | |
253 | + } | |
254 | + }; | |
255 | + | |
256 | + function positionCaretOnElement(element, start) { | |
257 | + selection.select(element); | |
258 | + selection.collapse(start); | |
259 | + } | |
260 | + | |
261 | + function canDelete(backspace) { | |
262 | + var rng, container, offset, nonEditableParent; | |
263 | + | |
264 | + function removeNodeIfNotParent(node) { | |
265 | + var parent = container; | |
266 | + | |
267 | + while (parent) { | |
268 | + if (parent === node) { | |
269 | + return; | |
270 | + } | |
271 | + | |
272 | + parent = parent.parentNode; | |
273 | + } | |
274 | + | |
275 | + dom.remove(node); | |
276 | + moveSelection(); | |
277 | + } | |
278 | + | |
279 | + function isNextPrevTreeNodeNonEditable() { | |
280 | + var node, walker, nonEmptyElements = ed.schema.getNonEmptyElements(); | |
281 | + | |
282 | + walker = new tinymce.dom.TreeWalker(container, ed.getBody()); | |
283 | + while (node = (backspace ? walker.prev() : walker.next())) { | |
284 | + // Found IMG/INPUT etc | |
285 | + if (nonEmptyElements[node.nodeName.toLowerCase()]) { | |
286 | + break; | |
287 | + } | |
288 | + | |
289 | + // Found text node with contents | |
290 | + if (node.nodeType === 3 && tinymce.trim(node.nodeValue).length > 0) { | |
291 | + break; | |
292 | + } | |
293 | + | |
294 | + // Found non editable node | |
295 | + if (getContentEditable(node) === "false") { | |
296 | + removeNodeIfNotParent(node); | |
297 | + return true; | |
298 | + } | |
299 | + } | |
300 | + | |
301 | + // Check if the content node is within a non editable parent | |
302 | + if (getNonEditableParent(node)) { | |
303 | + return true; | |
304 | + } | |
305 | + | |
306 | + return false; | |
307 | + } | |
308 | + | |
309 | + if (selection.isCollapsed()) { | |
310 | + rng = selection.getRng(true); | |
311 | + container = rng.startContainer; | |
312 | + offset = rng.startOffset; | |
313 | + container = getParentCaretContainer(container) || container; | |
314 | + | |
315 | + // Is in noneditable parent | |
316 | + if (nonEditableParent = getNonEditableParent(container)) { | |
317 | + removeNodeIfNotParent(nonEditableParent); | |
318 | + return false; | |
319 | + } | |
320 | + | |
321 | + // Check if the caret is in the middle of a text node | |
322 | + if (container.nodeType == 3 && (backspace ? offset > 0 : offset < container.nodeValue.length)) { | |
323 | + return true; | |
324 | + } | |
325 | + | |
326 | + // Resolve container index | |
327 | + if (container.nodeType == 1) { | |
328 | + container = container.childNodes[offset] || container; | |
329 | + } | |
330 | + | |
331 | + // Check if previous or next tree node is non editable then block the event | |
332 | + if (isNextPrevTreeNodeNonEditable()) { | |
333 | + return false; | |
334 | + } | |
335 | + } | |
336 | + | |
337 | + return true; | |
338 | + } | |
339 | + | |
340 | + startElement = selection.getStart() | |
341 | + endElement = selection.getEnd(); | |
342 | + | |
343 | + // Disable all key presses in contentEditable=false except delete or backspace | |
344 | + nonEditableParent = getNonEditableParent(startElement) || getNonEditableParent(endElement); | |
345 | + if (nonEditableParent && (keyCode < 112 || keyCode > 124) && keyCode != VK.DELETE && keyCode != VK.BACKSPACE) { | |
346 | + // Is Ctrl+c, Ctrl+v or Ctrl+x then use default browser behavior | |
347 | + if ((tinymce.isMac ? e.metaKey : e.ctrlKey) && (keyCode == 67 || keyCode == 88 || keyCode == 86)) { | |
348 | + return; | |
349 | + } | |
350 | + | |
351 | + e.preventDefault(); | |
352 | + | |
353 | + // Arrow left/right select the element and collapse left/right | |
354 | + if (keyCode == VK.LEFT || keyCode == VK.RIGHT) { | |
355 | + var left = keyCode == VK.LEFT; | |
356 | + // If a block element find previous or next element to position the caret | |
357 | + if (ed.dom.isBlock(nonEditableParent)) { | |
358 | + var targetElement = left ? nonEditableParent.previousSibling : nonEditableParent.nextSibling; | |
359 | + var walker = new TreeWalker(targetElement, targetElement); | |
360 | + var caretElement = left ? walker.prev() : walker.next(); | |
361 | + positionCaretOnElement(caretElement, !left); | |
362 | + } else { | |
363 | + positionCaretOnElement(nonEditableParent, left); | |
364 | + } | |
365 | + } | |
366 | + } else { | |
367 | + // Is arrow left/right, backspace or delete | |
368 | + if (keyCode == VK.LEFT || keyCode == VK.RIGHT || keyCode == VK.BACKSPACE || keyCode == VK.DELETE) { | |
369 | + caretContainer = getParentCaretContainer(startElement); | |
370 | + if (caretContainer) { | |
371 | + // Arrow left or backspace | |
372 | + if (keyCode == VK.LEFT || keyCode == VK.BACKSPACE) { | |
373 | + nonEditableParent = getNonEmptyTextNodeSibling(caretContainer, true); | |
374 | + | |
375 | + if (nonEditableParent && getContentEditable(nonEditableParent) === "false") { | |
376 | + e.preventDefault(); | |
377 | + | |
378 | + if (keyCode == VK.LEFT) { | |
379 | + positionCaretOnElement(nonEditableParent, true); | |
380 | + } else { | |
381 | + dom.remove(nonEditableParent); | |
382 | + return; | |
383 | + } | |
384 | + } else { | |
385 | + removeCaretContainer(caretContainer); | |
386 | + } | |
387 | + } | |
388 | + | |
389 | + // Arrow right or delete | |
390 | + if (keyCode == VK.RIGHT || keyCode == VK.DELETE) { | |
391 | + nonEditableParent = getNonEmptyTextNodeSibling(caretContainer); | |
392 | + | |
393 | + if (nonEditableParent && getContentEditable(nonEditableParent) === "false") { | |
394 | + e.preventDefault(); | |
395 | + | |
396 | + if (keyCode == VK.RIGHT) { | |
397 | + positionCaretOnElement(nonEditableParent, false); | |
398 | + } else { | |
399 | + dom.remove(nonEditableParent); | |
400 | + return; | |
401 | + } | |
402 | + } else { | |
403 | + removeCaretContainer(caretContainer); | |
404 | + } | |
405 | + } | |
406 | + } | |
407 | + | |
408 | + if ((keyCode == VK.BACKSPACE || keyCode == VK.DELETE) && !canDelete(keyCode == VK.BACKSPACE)) { | |
409 | + e.preventDefault(); | |
410 | + return false; | |
411 | + } | |
412 | + } | |
413 | + } | |
414 | + }; | |
415 | + | |
416 | + ed.onMouseDown.addToTop(function(ed, e) { | |
417 | + var node = ed.selection.getNode(); | |
418 | + | |
419 | + if (getContentEditable(node) === "false" && node == e.target) { | |
420 | + // Expand selection on mouse down we can't block the default event since it's used for drag/drop | |
421 | + moveSelection(); | |
422 | + } | |
423 | + }); | |
424 | + | |
425 | + ed.onMouseUp.addToTop(moveSelection); | |
426 | + ed.onKeyDown.addToTop(handleKey); | |
427 | + ed.onKeyUp.addToTop(moveSelection); | |
428 | + }; | |
13 | 429 | |
14 | 430 | tinymce.create('tinymce.plugins.NonEditablePlugin', { |
15 | 431 | init : function(ed, url) { |
16 | - var t = this, editClass, nonEditClass; | |
432 | + var editClass, nonEditClass, nonEditableRegExps; | |
433 | + | |
434 | + // Converts configured regexps to noneditable span items | |
435 | + function convertRegExpsToNonEditable(ed, args) { | |
436 | + var i = nonEditableRegExps.length, content = args.content, cls = tinymce.trim(nonEditClass); | |
437 | + | |
438 | + // Don't replace the variables when raw is used for example on undo/redo | |
439 | + if (args.format == "raw") { | |
440 | + return; | |
441 | + } | |
442 | + | |
443 | + while (i--) { | |
444 | + content = content.replace(nonEditableRegExps[i], function(match) { | |
445 | + var args = arguments, index = args[args.length - 2]; | |
446 | + | |
447 | + // Is value inside an attribute then don't replace | |
448 | + if (index > 0 && content.charAt(index - 1) == '"') { | |
449 | + return match; | |
450 | + } | |
451 | + | |
452 | + return '<span class="' + cls + '" data-mce-content="' + ed.dom.encode(args[0]) + '">' + ed.dom.encode(typeof(args[1]) === "string" ? args[1] : args[0]) + '</span>'; | |
453 | + }); | |
454 | + } | |
17 | 455 | |
18 | - t.editor = ed; | |
19 | - editClass = ed.getParam("noneditable_editable_class", "mceEditable"); | |
20 | - nonEditClass = ed.getParam("noneditable_noneditable_class", "mceNonEditable"); | |
456 | + args.content = content; | |
457 | + }; | |
458 | + | |
459 | + editClass = " " + tinymce.trim(ed.getParam("noneditable_editable_class", "mceEditable")) + " "; | |
460 | + nonEditClass = " " + tinymce.trim(ed.getParam("noneditable_noneditable_class", "mceNonEditable")) + " "; | |
21 | 461 | |
22 | - ed.onNodeChange.addToTop(function(ed, cm, n) { | |
23 | - var sc, ec; | |
462 | + // Setup noneditable regexps array | |
463 | + nonEditableRegExps = ed.getParam("noneditable_regexp"); | |
464 | + if (nonEditableRegExps && !nonEditableRegExps.length) { | |
465 | + nonEditableRegExps = [nonEditableRegExps]; | |
466 | + } | |
24 | 467 | |
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); | |
468 | + ed.onPreInit.add(function() { | |
469 | + handleContentEditableSelection(ed); | |
470 | + | |
471 | + if (nonEditableRegExps) { | |
472 | + ed.selection.onBeforeSetContent.add(convertRegExpsToNonEditable); | |
473 | + ed.onBeforeSetContent.add(convertRegExpsToNonEditable); | |
474 | + } | |
475 | + | |
476 | + // Apply contentEditable true/false on elements with the noneditable/editable classes | |
477 | + ed.parser.addAttributeFilter('class', function(nodes) { | |
478 | + var i = nodes.length, className, node; | |
479 | + | |
480 | + while (i--) { | |
481 | + node = nodes[i]; | |
482 | + className = " " + node.attr("class") + " "; | |
483 | + | |
484 | + if (className.indexOf(editClass) !== -1) { | |
485 | + node.attr(internalName, "true"); | |
486 | + } else if (className.indexOf(nonEditClass) !== -1) { | |
487 | + node.attr(internalName, "false"); | |
488 | + } | |
489 | + } | |
28 | 490 | }); |
29 | 491 | |
30 | - ec = ed.dom.getParent(ed.selection.getEnd(), function(n) { | |
31 | - return ed.dom.hasClass(n, nonEditClass); | |
492 | + // Remove internal name | |
493 | + ed.serializer.addAttributeFilter(internalName, function(nodes, name) { | |
494 | + var i = nodes.length, node; | |
495 | + | |
496 | + while (i--) { | |
497 | + node = nodes[i]; | |
498 | + | |
499 | + if (nonEditableRegExps && node.attr('data-mce-content')) { | |
500 | + node.name = "#text"; | |
501 | + node.type = 3; | |
502 | + node.raw = true; | |
503 | + node.value = node.attr('data-mce-content'); | |
504 | + } else { | |
505 | + node.attr(externalName, null); | |
506 | + node.attr(internalName, null); | |
507 | + } | |
508 | + } | |
32 | 509 | }); |
33 | 510 | |
34 | - // Block or unblock | |
35 | - if (sc || ec) { | |
36 | - t._setDisabled(1); | |
37 | - return false; | |
38 | - } else | |
39 | - t._setDisabled(0); | |
511 | + // Convert external name into internal name | |
512 | + ed.parser.addAttributeFilter(externalName, function(nodes, name) { | |
513 | + var i = nodes.length, node; | |
514 | + | |
515 | + while (i--) { | |
516 | + node = nodes[i]; | |
517 | + node.attr(internalName, node.attr(externalName)); | |
518 | + node.attr(externalName, null); | |
519 | + } | |
520 | + }); | |
40 | 521 | }); |
41 | 522 | }, |
42 | 523 | |
... | ... | @@ -48,42 +529,6 @@ |
48 | 529 | infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/noneditable', |
49 | 530 | version : tinymce.majorVersion + "." + tinymce.minorVersion |
50 | 531 | }; |
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 | - ed.onContextMenu.addToTop(t._block); | |
77 | - } else { | |
78 | - ed.onKeyDown.remove(t._block); | |
79 | - ed.onKeyPress.remove(t._block); | |
80 | - ed.onKeyUp.remove(t._block); | |
81 | - ed.onPaste.remove(t._block); | |
82 | - ed.onContextMenu.remove(t._block); | |
83 | - } | |
84 | - | |
85 | - t.disabled = s; | |
86 | - } | |
87 | 532 | } |
88 | 533 | }); |
89 | 534 | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/paste/editor_plugin.js
1 | -(function(){var c=tinymce.each,a={paste_auto_cleanup_on_paste:true,paste_enable_default_filters:true,paste_block_drop:false,paste_retain_style_properties:"none",paste_strip_class_attributes:"mso",paste_remove_spans:false,paste_remove_styles:false,paste_remove_styles_if_webkit:true,paste_convert_middot_lists:true,paste_convert_headers_to_strong:false,paste_dialog_width:"450",paste_dialog_height:"400",paste_text_use_dialog:false,paste_text_sticky:false,paste_text_sticky_default:false,paste_text_notifyalways:false,paste_text_linebreaktype:"p",paste_text_replacements:[[/\u2026/g,"..."],[/[\x93\x94\u201c\u201d]/g,'"'],[/[\x60\x91\x92\u2018\u2019]/g,"'"]]};function b(d,e){return d.getParam(e,a[e])}tinymce.create("tinymce.plugins.PastePlugin",{init:function(d,e){var f=this;f.editor=d;f.url=e;f.onPreProcess=new tinymce.util.Dispatcher(f);f.onPostProcess=new tinymce.util.Dispatcher(f);f.onPreProcess.add(f._preProcess);f.onPostProcess.add(f._postProcess);f.onPreProcess.add(function(i,j){d.execCallback("paste_preprocess",i,j)});f.onPostProcess.add(function(i,j){d.execCallback("paste_postprocess",i,j)});d.onKeyDown.addToTop(function(i,j){if(((tinymce.isMac?j.metaKey:j.ctrlKey)&&j.keyCode==86)||(j.shiftKey&&j.keyCode==45)){return false}});d.pasteAsPlainText=b(d,"paste_text_sticky_default");function h(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&&m.content.indexOf("__MCE_ITEM__")===-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,t,k=d.selection,o=d.dom,q=d.getBody(),i,r;if(s.clipboardData||o.doc.dataTransfer){r=(s.clipboardData||o.doc.dataTransfer).getData("Text");if(d.pasteAsPlainText){s.preventDefault();h({content:r.replace(/\r?\n/g,"<br />")});return}}if(o.get("_mcePaste")){return}l=o.add(q,"div",{id:"_mcePaste","class":"mcePaste","data-mce-bogus":"1"},"\uFEFF\uFEFF");if(q!=d.getDoc().body){i=o.getPos(d.selection.getStart(),q).y}else{i=q.scrollTop+o.getViewPort().y}o.setStyles(l,{position:"absolute",left:-10000,top:i,width:1,height:1,overflow:"hidden"});if(tinymce.isIE){t=k.getRng();j=o.doc.body.createTextRange();j.moveToElementText(l);j.execCommand("Paste");o.remove(l);if(l.innerHTML==="\uFEFF\uFEFF"){d.execCommand("mcePasteWord");s.preventDefault();return}k.setRng(t);k.setContent("");setTimeout(function(){h({content:l.innerHTML})},0);return tinymce.dom.Event.cancel(s)}else{function m(n){n.preventDefault()}o.bind(d.getDoc(),"mousedown",m);o.bind(d.getDoc(),"keydown",m);p=d.selection.getRng();l=l.firstChild;j=d.getDoc().createRange();j.setStart(l,0);j.setEnd(l,2);k.setRng(j);window.setTimeout(function(){var u="",n;if(!o.select("div.mcePaste > div.mcePaste").length){n=o.select("div.mcePaste");c(n,function(w){var v=w.firstChild;if(v&&v.nodeName=="DIV"&&v.style.marginTop&&v.style.backgroundColor){o.remove(v,1)}c(o.select("span.Apple-style-span",w),function(x){o.remove(x,1)});c(o.select("br[data-mce-bogus]",w),function(x){o.remove(x)});if(w.parentNode.className!="mcePaste"){u+=w.innerHTML}})}else{u="<pre>"+o.encode(r).replace(/\r?\n/g,"<br />")+"</pre>"}c(o.select("div.mcePaste"),function(v){o.remove(v)});if(p){k.setRng(p)}h({content:u});o.unbind(d.getDoc(),"mousedown",m);o.unbind(d.getDoc(),"keydown",m)},0)}}if(b(d,"paste_auto_cleanup_on_paste")){if(tinymce.isOpera||/Firefox\/2/.test(navigator.userAgent)){d.onKeyDown.addToTop(function(i,j){if(((tinymce.isMac?j.metaKey:j.ctrlKey)&&j.keyCode==86)||(j.shiftKey&&j.keyCode==45)){g(j)}})}else{d.onPaste.addToTop(function(i,j){return g(j)})}}d.onInit.add(function(){d.controlManager.setActive("pastetext",d.pasteAsPlainText);if(b(d,"paste_block_drop")){d.dom.bind(d.getBody(),["dragend","dragover","draggesture","dragdrop","drop","drag"],function(i){i.preventDefault();i.stopPropagation();return false})}});f._legacySupport()},getInfo:function(){return{longname:"Paste text/word",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_preProcess:function(g,e){var k=this.editor,j=e.content,p=tinymce.grep,n=tinymce.explode,f=tinymce.trim,l,i;function d(h){c(h,function(o){if(o.constructor==RegExp){j=j.replace(o,"")}else{j=j.replace(o[0],o[1])}})}if(k.settings.paste_enable_default_filters==false){return}if(tinymce.isIE&&document.documentMode>=9){d([[/(?:<br> [\s\r\n]+|<br>)*(<\/?(h[1-6r]|p|div|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|caption|blockquote|center|dl|dt|dd|dir|fieldset)[^>]*>)(?:<br> [\s\r\n]+|<br>)*/g,"$1"]])}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(e.settings.paste_enable_default_filters==false){return}if(i.wordContent){c(h.select("a",i.node),function(j){if(!j.href||j.href.indexOf("#_Toc")!=-1){h.remove(j,1)}});if(b(e,"paste_convert_middot_lists")){f._convertLists(g,i)}d=b(e,"paste_retain_style_properties");if((tinymce.is(d,"string"))&&(d!=="all")&&(d!=="*")){d=tinymce.explode(d.replace(/^none$/i,""));c(h.select("*",i.node),function(m){var n={},k=0,l,o,j;if(d){for(l=0;l<d.length;l++){o=d[l];j=h.getStyle(m,o);if(j){n[o]=j;k++}}}h.setAttrib(m,"style","");if(d&&k>0){h.setStyles(m,n)}else{if(m.nodeName=="SPAN"&&!m.className){h.remove(m,true)}}})}}if(b(e,"paste_remove_styles")||(b(e,"paste_remove_styles_if_webkit")&&tinymce.isWebKit)){c(h.select("*[style]",i.node),function(j){j.removeAttribute("style");j.removeAttribute("data-mce-style")})}else{if(tinymce.isWebKit){c(h.select("*",i.node),function(j){j.removeAttribute("data-mce-style")})}}},_convertLists:function(g,e){var i=g.editor.dom,h,l,d=-1,f,m=[],k,j;c(i.select("p",e.node),function(t){var q,u="",s,r,n,o;for(q=t.firstChild;q&&q.nodeType==3;q=q.nextSibling){u+=q.nodeValue}u=t.innerHTML.replace(/<\/?\w+[^>]*>/gi,"").replace(/ /g,"\u00a0");if(/^(__MCE_ITEM__)+[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*\u00a0*/.test(u)){s="ul"}if(/^__MCE_ITEM__\s*\w+\.\s*\u00a0+/.test(u)){s="ol"}if(s){f=parseFloat(t.style.marginLeft||0);if(f>d){m.push(f)}if(!h||s!=k){h=i.create(s);i.insertAfter(h,t)}else{if(f>d){h=l.appendChild(i.create(s))}else{if(f<d){n=tinymce.inArray(m,f);o=i.getParents(h.parentNode,s);h=o[o.length-1-n]||h}}}c(i.select("span",t),function(v){var p=v.innerHTML.replace(/<\/?\w+[^>]*>/gi,"");if(s=="ul"&&/^__MCE_ITEM__[\u2022\u00b7\u00a7\u00d8o\u25CF]/.test(p)){i.remove(v)}else{if(/^__MCE_ITEM__[\s\S]*\w+\.( |\u00a0)*\s*/.test(p)){i.remove(v)}}});r=t.innerHTML;if(s=="ul"){r=t.innerHTML.replace(/__MCE_ITEM__/g,"").replace(/^[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*( |\u00a0)+\s*/,"")}else{r=t.innerHTML.replace(/__MCE_ITEM__/g,"").replace(/^\s*\w+\.( |\u00a0)+\s*/,"")}l=h.appendChild(i.create("li",0,r));i.remove(t);d=f;k=s}else{h=d=0}});j=e.node.innerHTML;if(j.indexOf("__MCE_ITEM__")!=-1){e.node.innerHTML=j.replace(/__MCE_ITEM__/g,"")}},_insert:function(f,d){var e=this.editor,g=e.selection.getRng();if(!e.selection.isCollapsed()&&g.startContainer!=g.endContainer){e.getDoc().execCommand("Delete",false,null)}e.execCommand("mceInsertContent",false,f,{skip_undo:d})},_insertPlainText:function(j,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)})(); | |
2 | 1 | \ No newline at end of file |
2 | +(function(){var c=tinymce.each,a={paste_auto_cleanup_on_paste:true,paste_enable_default_filters:true,paste_block_drop:false,paste_retain_style_properties:"none",paste_strip_class_attributes:"mso",paste_remove_spans:false,paste_remove_styles:false,paste_remove_styles_if_webkit:true,paste_convert_middot_lists:true,paste_convert_headers_to_strong:false,paste_dialog_width:"450",paste_dialog_height:"400",paste_max_consecutive_linebreaks:2,paste_text_use_dialog:false,paste_text_sticky:false,paste_text_sticky_default:false,paste_text_notifyalways:false,paste_text_linebreaktype:"combined",paste_text_replacements:[[/\u2026/g,"..."],[/[\x93\x94\u201c\u201d]/g,'"'],[/[\x60\x91\x92\u2018\u2019]/g,"'"]]};function b(d,e){return d.getParam(e,a[e])}tinymce.create("tinymce.plugins.PastePlugin",{init:function(d,e){var f=this;f.editor=d;f.url=e;f.onPreProcess=new tinymce.util.Dispatcher(f);f.onPostProcess=new tinymce.util.Dispatcher(f);f.onPreProcess.add(f._preProcess);f.onPostProcess.add(f._postProcess);f.onPreProcess.add(function(i,j){d.execCallback("paste_preprocess",i,j)});f.onPostProcess.add(function(i,j){d.execCallback("paste_postprocess",i,j)});d.onKeyDown.addToTop(function(i,j){if(((tinymce.isMac?j.metaKey:j.ctrlKey)&&j.keyCode==86)||(j.shiftKey&&j.keyCode==45)){return false}});d.pasteAsPlainText=b(d,"paste_text_sticky_default");function h(l,j){var k=d.dom,i;f.onPreProcess.dispatch(f,l);l.node=k.create("div",0,l.content);if(tinymce.isGecko){i=d.selection.getRng(true);if(i.startContainer==i.endContainer&&i.startContainer.nodeType==3){if(l.node.childNodes.length===1&&/^(p|h[1-6]|pre)$/i.test(l.node.firstChild.nodeName)&&l.content.indexOf("__MCE_ITEM__")===-1){k.remove(l.node.firstChild,true)}}}f.onPostProcess.dispatch(f,l);l.content=d.serializer.serialize(l.node,{getInner:1,forced_root_block:""});if((!j)&&(d.pasteAsPlainText)){f._insertPlainText(l.content);if(!b(d,"paste_text_sticky")){d.pasteAsPlainText=false;d.controlManager.setActive("pastetext",false)}}else{f._insert(l.content)}}d.addCommand("mceInsertClipboardContent",function(i,j){h(j,true)});if(!b(d,"paste_text_use_dialog")){d.addCommand("mcePasteText",function(j,i){var k=tinymce.util.Cookie;d.pasteAsPlainText=!d.pasteAsPlainText;d.controlManager.setActive("pastetext",d.pasteAsPlainText);if((d.pasteAsPlainText)&&(!k.get("tinymcePasteText"))){if(b(d,"paste_text_sticky")){d.windowManager.alert(d.translate("paste.plaintext_mode_sticky"))}else{d.windowManager.alert(d.translate("paste.plaintext_mode"))}if(!b(d,"paste_text_notifyalways")){k.set("tinymcePasteText","1",new Date(new Date().getFullYear()+1,12,31))}}})}d.addButton("pastetext",{title:"paste.paste_text_desc",cmd:"mcePasteText"});d.addButton("selectall",{title:"paste.selectall_desc",cmd:"selectall"});function g(s){var l,p,j,t,k=d.selection,o=d.dom,q=d.getBody(),i,r;if(s.clipboardData||o.doc.dataTransfer){r=(s.clipboardData||o.doc.dataTransfer).getData("Text");if(d.pasteAsPlainText){s.preventDefault();h({content:o.encode(r).replace(/\r?\n/g,"<br />")});return}}if(o.get("_mcePaste")){return}l=o.add(q,"div",{id:"_mcePaste","class":"mcePaste","data-mce-bogus":"1"},"\uFEFF\uFEFF");if(q!=d.getDoc().body){i=o.getPos(d.selection.getStart(),q).y}else{i=q.scrollTop+o.getViewPort(d.getWin()).y}o.setStyles(l,{position:"absolute",left:tinymce.isGecko?-40:0,top:i-25,width:1,height:1,overflow:"hidden"});if(tinymce.isIE){t=k.getRng();j=o.doc.body.createTextRange();j.moveToElementText(l);j.execCommand("Paste");o.remove(l);if(l.innerHTML==="\uFEFF\uFEFF"){d.execCommand("mcePasteWord");s.preventDefault();return}k.setRng(t);k.setContent("");setTimeout(function(){h({content:l.innerHTML})},0);return tinymce.dom.Event.cancel(s)}else{function m(n){n.preventDefault()}o.bind(d.getDoc(),"mousedown",m);o.bind(d.getDoc(),"keydown",m);p=d.selection.getRng();l=l.firstChild;j=d.getDoc().createRange();j.setStart(l,0);j.setEnd(l,2);k.setRng(j);window.setTimeout(function(){var u="",n;if(!o.select("div.mcePaste > div.mcePaste").length){n=o.select("div.mcePaste");c(n,function(w){var v=w.firstChild;if(v&&v.nodeName=="DIV"&&v.style.marginTop&&v.style.backgroundColor){o.remove(v,1)}c(o.select("span.Apple-style-span",w),function(x){o.remove(x,1)});c(o.select("br[data-mce-bogus]",w),function(x){o.remove(x)});if(w.parentNode.className!="mcePaste"){u+=w.innerHTML}})}else{u="<p>"+o.encode(r).replace(/\r?\n\r?\n/g,"</p><p>").replace(/\r?\n/g,"<br />")+"</p>"}c(o.select("div.mcePaste"),function(v){o.remove(v)});if(p){k.setRng(p)}h({content:u});o.unbind(d.getDoc(),"mousedown",m);o.unbind(d.getDoc(),"keydown",m)},0)}}if(b(d,"paste_auto_cleanup_on_paste")){if(tinymce.isOpera||/Firefox\/2/.test(navigator.userAgent)){d.onKeyDown.addToTop(function(i,j){if(((tinymce.isMac?j.metaKey:j.ctrlKey)&&j.keyCode==86)||(j.shiftKey&&j.keyCode==45)){g(j)}})}else{d.onPaste.addToTop(function(i,j){return g(j)})}}d.onInit.add(function(){d.controlManager.setActive("pastetext",d.pasteAsPlainText);if(b(d,"paste_block_drop")){d.dom.bind(d.getBody(),["dragend","dragover","draggesture","dragdrop","drop","drag"],function(i){i.preventDefault();i.stopPropagation();return false})}});f._legacySupport()},getInfo:function(){return{longname:"Paste text/word",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_preProcess:function(g,e){var k=this.editor,j=e.content,p=tinymce.grep,n=tinymce.explode,f=tinymce.trim,l,i;function d(h){c(h,function(o){if(o.constructor==RegExp){j=j.replace(o,"")}else{j=j.replace(o[0],o[1])}})}if(k.settings.paste_enable_default_filters==false){return}if(tinymce.isIE&&document.documentMode>=9&&/<(h[1-6r]|p|div|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|caption|blockquote|center|dl|dt|dd|dir|fieldset)/.test(e.content)){d([[/(?:<br> [\s\r\n]+|<br>)*(<\/?(h[1-6r]|p|div|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|caption|blockquote|center|dl|dt|dd|dir|fieldset)[^>]*>)(?:<br> [\s\r\n]+|<br>)*/g,"$1"]]);d([[/<br><br>/g,"<BR><BR>"],[/<br>/g," "],[/<BR><BR>/g,"<br>"]])}if(/class="?Mso|style="[^"]*\bmso-|w:WordDocument/i.test(j)||e.wordContent){e.wordContent=true;d([/^\s*( )+/gi,/( |<br[^>]*>)+\s*$/gi]);if(b(k,"paste_convert_headers_to_strong")){j=j.replace(/<p [^>]*class="?MsoHeading"?[^>]*>(.*?)<\/p>/gi,"<p><strong>$1</strong></p>")}if(b(k,"paste_convert_middot_lists")){d([[/<!--\[if !supportLists\]-->/gi,"$&__MCE_ITEM__"],[/(<span[^>]+(?:mso-list:|:\s*symbol)[^>]+>)/gi,"$1__MCE_ITEM__"],[/(<p[^>]+(?:MsoListParagraph)[^>]+>)/gi,"$1__MCE_ITEM__"]])}d([/<!--[\s\S]+?-->/gi,/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,[/<(\/?)s>/gi,"<$1strike>"],[/ /gi,"\u00a0"]]);do{l=j.length;j=j.replace(/(<?!(ol|ul)[^>]*\s)(?:id|name|language|type|on\w+|\w+:\w+)=(?:"[^"]*"|\w+)\s?/gi,"$1");j=j.replace(/(<(ol|ul)[^>]*\s)(?:id|name|language|on\w+|\w+:\w+)=(?:"[^"]*"|\w+)\s?/gi,"$1")}while(l!=j.length);if(b(k,"paste_retain_style_properties").replace(/^none$/i,"").length==0){j=j.replace(/<\/?span[^>]*>/gi,"")}else{d([[/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,function(o,h){return(h.length>0)?h.replace(/./," ").slice(Math.floor(h.length/2)).split("").join("\u00a0"):""}],[/(<[a-z][^>]*)\sstyle="([^"]*)"/gi,function(t,h,r){var u=[],o=0,q=n(f(r).replace(/"/gi,"'"),";");c(q,function(s){var w,y,z=n(s,":");function x(A){return A+((A!=="0")&&(/\d$/.test(A)))?"px":""}if(z.length==2){w=z[0].toLowerCase();y=z[1].toLowerCase();switch(w){case"mso-padding-alt":case"mso-padding-top-alt":case"mso-padding-right-alt":case"mso-padding-bottom-alt":case"mso-padding-left-alt":case"mso-margin-alt":case"mso-margin-top-alt":case"mso-margin-right-alt":case"mso-margin-bottom-alt":case"mso-margin-left-alt":case"mso-table-layout-alt":case"mso-height":case"mso-width":case"mso-vertical-align-alt":u[o++]=w.replace(/^mso-|-alt$/g,"")+":"+x(y);return;case"horiz-align":u[o++]="text-align:"+y;return;case"vert-align":u[o++]="vertical-align:"+y;return;case"font-color":case"mso-foreground":u[o++]="color:"+y;return;case"mso-background":case"mso-highlight":u[o++]="background:"+y;return;case"mso-default-height":u[o++]="min-height:"+x(y);return;case"mso-default-width":u[o++]="min-width:"+x(y);return;case"mso-padding-between-alt":u[o++]="border-collapse:separate;border-spacing:"+x(y);return;case"text-line-through":if((y=="single")||(y=="double")){u[o++]="text-decoration:line-through"}return;case"mso-zero-height":if(y=="yes"){u[o++]="display:none"}return}if(/^(mso|column|font-emph|lang|layout|line-break|list-image|nav|panose|punct|row|ruby|sep|size|src|tab-|table-border|text-(?!align|decor|indent|trans)|top-bar|version|vnd|word-break)/.test(w)){return}u[o++]=w+":"+z[1]}});if(o>0){return h+' style="'+u.join(";")+'"'}else{return h}}]])}}if(b(k,"paste_convert_headers_to_strong")){d([[/<h[1-6][^>]*>/gi,"<p><strong>"],[/<\/h[1-6][^>]*>/gi,"</strong></p>"]])}d([[/Version:[\d.]+\nStartHTML:\d+\nEndHTML:\d+\nStartFragment:\d+\nEndFragment:\d+/gi,""]]);i=b(k,"paste_strip_class_attributes");if(i!=="none"){function m(q,o){if(i==="all"){return""}var h=p(n(o.replace(/^(["'])(.*)\1$/,"$2")," "),function(r){return(/^(?!mso)/i.test(r))});return h.length?' class="'+h.join(" ")+'"':""}j=j.replace(/ class="([^"]+)"/gi,m);j=j.replace(/ class=([\-\w]+)/gi,m)}if(b(k,"paste_remove_spans")){j=j.replace(/<\/?span[^>]*>/gi,"")}e.content=j},_postProcess:function(g,i){var f=this,e=f.editor,h=e.dom,d;if(e.settings.paste_enable_default_filters==false){return}if(i.wordContent){c(h.select("a",i.node),function(j){if(!j.href||j.href.indexOf("#_Toc")!=-1){h.remove(j,1)}});if(b(e,"paste_convert_middot_lists")){f._convertLists(g,i)}d=b(e,"paste_retain_style_properties");if((tinymce.is(d,"string"))&&(d!=="all")&&(d!=="*")){d=tinymce.explode(d.replace(/^none$/i,""));c(h.select("*",i.node),function(m){var n={},k=0,l,o,j;if(d){for(l=0;l<d.length;l++){o=d[l];j=h.getStyle(m,o);if(j){n[o]=j;k++}}}h.setAttrib(m,"style","");if(d&&k>0){h.setStyles(m,n)}else{if(m.nodeName=="SPAN"&&!m.className){h.remove(m,true)}}})}}if(b(e,"paste_remove_styles")||(b(e,"paste_remove_styles_if_webkit")&&tinymce.isWebKit)){c(h.select("*[style]",i.node),function(j){j.removeAttribute("style");j.removeAttribute("data-mce-style")})}else{if(tinymce.isWebKit){c(h.select("*",i.node),function(j){j.removeAttribute("data-mce-style")})}}},_convertLists:function(g,e){var i=g.editor.dom,h,l,d=-1,f,m=[],k,j;c(i.select("p",e.node),function(t){var q,u="",s,r,n,o;for(q=t.firstChild;q&&q.nodeType==3;q=q.nextSibling){u+=q.nodeValue}u=t.innerHTML.replace(/<\/?\w+[^>]*>/gi,"").replace(/ /g,"\u00a0");if(/^(__MCE_ITEM__)+[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*\u00a0*/.test(u)){s="ul"}if(/^__MCE_ITEM__\s*\w+\.\s*\u00a0+/.test(u)){s="ol"}if(s){f=parseFloat(t.style.marginLeft||0);if(f>d){m.push(f)}if(!h||s!=k){h=i.create(s);i.insertAfter(h,t)}else{if(f>d){h=l.appendChild(i.create(s))}else{if(f<d){n=tinymce.inArray(m,f);o=i.getParents(h.parentNode,s);h=o[o.length-1-n]||h}}}c(i.select("span",t),function(v){var p=v.innerHTML.replace(/<\/?\w+[^>]*>/gi,"");if(s=="ul"&&/^__MCE_ITEM__[\u2022\u00b7\u00a7\u00d8o\u25CF]/.test(p)){i.remove(v)}else{if(/^__MCE_ITEM__[\s\S]*\w+\.( |\u00a0)*\s*/.test(p)){i.remove(v)}}});r=t.innerHTML;if(s=="ul"){r=t.innerHTML.replace(/__MCE_ITEM__/g,"").replace(/^[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*( |\u00a0)+\s*/,"")}else{r=t.innerHTML.replace(/__MCE_ITEM__/g,"").replace(/^\s*[\w|'<'|'>']+\.( |\u00a0)+\s*/,"")}l=h.appendChild(i.create("li",0,r));i.remove(t);d=f;k=s}else{h=d=0}});j=e.node.innerHTML;if(j.indexOf("__MCE_ITEM__")!=-1){e.node.innerHTML=j.replace(/__MCE_ITEM__/g,"")}},_insert:function(f,d){var e=this.editor,g=e.selection.getRng();if(!e.selection.isCollapsed()&&g.startContainer!=g.endContainer){e.getDoc().execCommand("Delete",false,null)}e.execCommand("mceInsertContent",false,f,{skip_undo:d})},_insertPlainText:function(j){var h=this.editor,f=b(h,"paste_text_linebreaktype"),k=b(h,"paste_text_replacements"),g=tinymce.is;function e(m){c(m,function(n){if(n.constructor==RegExp){j=j.replace(n,"")}else{j=j.replace(n[0],n[1])}})}if((typeof(j)==="string")&&(j.length>0)){if(/<(?:p|br|h[1-6]|ul|ol|dl|table|t[rdh]|div|blockquote|fieldset|pre|address|center)[^>]*>/i.test(j)){e([/[\n\r]+/g])}else{e([/\r+/g])}e([[/<\/(?:p|h[1-6]|ul|ol|dl|table|div|blockquote|fieldset|pre|address|center)>/gi,"\n\n"],[/<br[^>]*>|<\/tr>/gi,"\n"],[/<\/t[dh]>\s*<t[dh][^>]*>/gi,"\t"],/<[a-z!\/?][^>]*>/gi,[/ /gi," "],[/(?:(?!\n)\s)*(\n+)(?:(?!\n)\s)*/gi,"$1"]]);var d=Number(b(h,"paste_max_consecutive_linebreaks"));if(d>-1){var l=new RegExp("\n{"+(d+1)+",}","g");var i="";while(i.length<d){i+="\n"}e([[l,i]])}j=h.dom.decode(tinymce.html.Entities.encodeRaw(j));if(g(k,"array")){e(k)}else{if(g(k,"string")){e(new RegExp(k,"gi"))}}if(f=="none"){e([[/\n+/g," "]])}else{if(f=="br"){e([[/\n/g,"<br />"]])}else{if(f=="p"){e([[/\n+/g,"</p><p>"],[/^(.*<\/p>)(<p>)$/,"<p>$1"]])}else{e([[/\n\n/g,"</p><p>"],[/^(.*<\/p>)(<p>)$/,"<p>$1"],[/\n/g,"<br />"]])}}}h.execCommand("mceInsertContent",false,j)}},_legacySupport:function(){var e=this,d=e.editor;d.addCommand("mcePasteWord",function(){d.windowManager.open({file:e.url+"/pasteword.htm",width:parseInt(b(d,"paste_dialog_width")),height:parseInt(b(d,"paste_dialog_height")),inline:1})});if(b(d,"paste_text_use_dialog")){d.addCommand("mcePasteText",function(){d.windowManager.open({file:e.url+"/pastetext.htm",width:parseInt(b(d,"paste_dialog_width")),height:parseInt(b(d,"paste_dialog_height")),inline:1})})}d.addButton("pasteword",{title:"paste.paste_word_desc",cmd:"mcePasteWord"})}});tinymce.PluginManager.add("paste",tinymce.plugins.PastePlugin)})(); | |
3 | 3 | \ No newline at end of file | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/paste/editor_plugin_src.js
... | ... | @@ -23,11 +23,12 @@ |
23 | 23 | paste_convert_headers_to_strong : false, |
24 | 24 | paste_dialog_width : "450", |
25 | 25 | paste_dialog_height : "400", |
26 | + paste_max_consecutive_linebreaks: 2, | |
26 | 27 | paste_text_use_dialog : false, |
27 | 28 | paste_text_sticky : false, |
28 | 29 | paste_text_sticky_default : false, |
29 | 30 | paste_text_notifyalways : false, |
30 | - paste_text_linebreaktype : "p", | |
31 | + paste_text_linebreaktype : "combined", | |
31 | 32 | paste_text_replacements : [ |
32 | 33 | [/\u2026/g, "..."], |
33 | 34 | [/[\x93\x94\u201c\u201d]/g, '"'], |
... | ... | @@ -76,7 +77,7 @@ |
76 | 77 | // This function executes the process handlers and inserts the contents |
77 | 78 | // force_rich overrides plain text mode set by user, important for pasting with execCommand |
78 | 79 | function process(o, force_rich) { |
79 | - var dom = ed.dom, rng, nodes; | |
80 | + var dom = ed.dom, rng; | |
80 | 81 | |
81 | 82 | // Execute pre process handlers |
82 | 83 | t.onPreProcess.dispatch(t, o); |
... | ... | @@ -89,11 +90,9 @@ |
89 | 90 | if (tinymce.isGecko) { |
90 | 91 | rng = ed.selection.getRng(true); |
91 | 92 | if (rng.startContainer == rng.endContainer && rng.startContainer.nodeType == 3) { |
92 | - nodes = dom.select('p,h1,h2,h3,h4,h5,h6,pre', o.node); | |
93 | - | |
94 | 93 | // Is only one block node and it doesn't contain word stuff |
95 | - if (nodes.length == 1 && o.content.indexOf('__MCE_ITEM__') === -1) | |
96 | - dom.remove(nodes.reverse(), true); | |
94 | + if (o.node.childNodes.length === 1 && /^(p|h[1-6]|pre)$/i.test(o.node.firstChild.nodeName) && o.content.indexOf('__MCE_ITEM__') === -1) | |
95 | + dom.remove(o.node.firstChild, true); | |
97 | 96 | } |
98 | 97 | } |
99 | 98 | |
... | ... | @@ -101,11 +100,11 @@ |
101 | 100 | t.onPostProcess.dispatch(t, o); |
102 | 101 | |
103 | 102 | // Serialize content |
104 | - o.content = ed.serializer.serialize(o.node, {getInner : 1}); | |
103 | + o.content = ed.serializer.serialize(o.node, {getInner : 1, forced_root_block : ''}); | |
105 | 104 | |
106 | 105 | // Plain text option active? |
107 | 106 | if ((!force_rich) && (ed.pasteAsPlainText)) { |
108 | - t._insertPlainText(ed, dom, o.content); | |
107 | + t._insertPlainText(o.content); | |
109 | 108 | |
110 | 109 | if (!getParam(ed, "paste_text_sticky")) { |
111 | 110 | ed.pasteAsPlainText = false; |
... | ... | @@ -132,7 +131,7 @@ |
132 | 131 | if (getParam(ed, "paste_text_sticky")) { |
133 | 132 | ed.windowManager.alert(ed.translate('paste.plaintext_mode_sticky')); |
134 | 133 | } else { |
135 | - ed.windowManager.alert(ed.translate('paste.plaintext_mode_sticky')); | |
134 | + ed.windowManager.alert(ed.translate('paste.plaintext_mode')); | |
136 | 135 | } |
137 | 136 | |
138 | 137 | if (!getParam(ed, "paste_text_notifyalways")) { |
... | ... | @@ -157,7 +156,7 @@ |
157 | 156 | |
158 | 157 | if (ed.pasteAsPlainText) { |
159 | 158 | e.preventDefault(); |
160 | - process({content : textContent.replace(/\r?\n/g, '<br />')}); | |
159 | + process({content : dom.encode(textContent).replace(/\r?\n/g, '<br />')}); | |
161 | 160 | return; |
162 | 161 | } |
163 | 162 | } |
... | ... | @@ -172,13 +171,14 @@ |
172 | 171 | if (body != ed.getDoc().body) |
173 | 172 | posY = dom.getPos(ed.selection.getStart(), body).y; |
174 | 173 | else |
175 | - posY = body.scrollTop + dom.getViewPort().y; | |
174 | + posY = body.scrollTop + dom.getViewPort(ed.getWin()).y; | |
176 | 175 | |
177 | 176 | // Styles needs to be applied after the element is added to the document since WebKit will otherwise remove all styles |
177 | + // If also needs to be in view on IE or the paste would fail | |
178 | 178 | dom.setStyles(n, { |
179 | 179 | position : 'absolute', |
180 | - left : -10000, | |
181 | - top : posY, | |
180 | + left : tinymce.isGecko ? -40 : 0, // Need to move it out of site on Gecko since it will othewise display a ghost resize rect for the div | |
181 | + top : posY - 25, | |
182 | 182 | width : 1, |
183 | 183 | height : 1, |
184 | 184 | overflow : 'hidden' |
... | ... | @@ -268,8 +268,9 @@ |
268 | 268 | h += n.innerHTML; |
269 | 269 | }); |
270 | 270 | } else { |
271 | - // Found WebKit weirdness so force the content into plain text mode | |
272 | - h = '<pre>' + dom.encode(textContent).replace(/\r?\n/g, '<br />') + '</pre>'; | |
271 | + // Found WebKit weirdness so force the content into paragraphs this seems to happen when you paste plain text from Nodepad etc | |
272 | + // So this logic will replace double enter with paragraphs and single enter with br so it kind of looks the same | |
273 | + h = '<p>' + dom.encode(textContent).replace(/\r?\n\r?\n/g, '</p><p>').replace(/\r?\n/g, '<br />') + '</p>'; | |
273 | 274 | } |
274 | 275 | |
275 | 276 | // Remove the nodes |
... | ... | @@ -290,7 +291,7 @@ |
290 | 291 | } |
291 | 292 | } |
292 | 293 | |
293 | - // Check if we should use the new auto process method | |
294 | + // Check if we should use the new auto process method | |
294 | 295 | if (getParam(ed, "paste_auto_cleanup_on_paste")) { |
295 | 296 | // Is it's Opera or older FF use key handler |
296 | 297 | if (tinymce.isOpera || /Firefox\/2/.test(navigator.userAgent)) { |
... | ... | @@ -353,15 +354,24 @@ |
353 | 354 | h = h.replace(v[0], v[1]); |
354 | 355 | }); |
355 | 356 | } |
356 | - | |
357 | + | |
357 | 358 | if (ed.settings.paste_enable_default_filters == false) { |
358 | 359 | return; |
359 | 360 | } |
360 | 361 | |
361 | 362 | // IE9 adds BRs before/after block elements when contents is pasted from word or for example another browser |
362 | - if (tinymce.isIE && document.documentMode >= 9) | |
363 | + if (tinymce.isIE && document.documentMode >= 9 && /<(h[1-6r]|p|div|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|caption|blockquote|center|dl|dt|dd|dir|fieldset)/.test(o.content)) { | |
364 | + // IE9 adds BRs before/after block elements when contents is pasted from word or for example another browser | |
363 | 365 | process([[/(?:<br> [\s\r\n]+|<br>)*(<\/?(h[1-6r]|p|div|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|caption|blockquote|center|dl|dt|dd|dir|fieldset)[^>]*>)(?:<br> [\s\r\n]+|<br>)*/g, '$1']]); |
364 | 366 | |
367 | + // IE9 also adds an extra BR element for each soft-linefeed and it also adds a BR for each word wrap break | |
368 | + process([ | |
369 | + [/<br><br>/g, '<BR><BR>'], // Replace multiple BR elements with uppercase BR to keep them intact | |
370 | + [/<br>/g, ' '], // Replace single br elements with space since they are word wrap BR:s | |
371 | + [/<BR><BR>/g, '<br>'] // Replace back the double brs but into a single BR | |
372 | + ]); | |
373 | + } | |
374 | + | |
365 | 375 | // Detect Word content and process it more aggressive |
366 | 376 | if (/class="?Mso|style="[^"]*\bmso-|w:WordDocument/i.test(h) || o.wordContent) { |
367 | 377 | o.wordContent = true; // Mark the pasted contents as word specific content |
... | ... | @@ -403,7 +413,9 @@ |
403 | 413 | // If JavaScript had a RegExp look-behind, we could have integrated this with the last process() array and got rid of the loop. But alas, it does not, so we cannot. |
404 | 414 | do { |
405 | 415 | len = h.length; |
406 | - h = h.replace(/(<[a-z][^>]*\s)(?:id|name|language|type|on\w+|\w+:\w+)=(?:"[^"]*"|\w+)\s?/gi, "$1"); | |
416 | + // Don't remove the type attribute for lists so that non-default list types display correctly. | |
417 | + h = h.replace(/(<?!(ol|ul)[^>]*\s)(?:id|name|language|type|on\w+|\w+:\w+)=(?:"[^"]*"|\w+)\s?/gi, "$1"); | |
418 | + h = h.replace(/(<(ol|ul)[^>]*\s)(?:id|name|language|on\w+|\w+:\w+)=(?:"[^"]*"|\w+)\s?/gi, "$1"); | |
407 | 419 | } while (len != h.length); |
408 | 420 | |
409 | 421 | // Remove all spans if no styles is to be retained |
... | ... | @@ -579,7 +591,7 @@ |
579 | 591 | if (ed.settings.paste_enable_default_filters == false) { |
580 | 592 | return; |
581 | 593 | } |
582 | - | |
594 | + | |
583 | 595 | if (o.wordContent) { |
584 | 596 | // Remove named anchors or TOC links |
585 | 597 | each(dom.select('a', o.node), function(a) { |
... | ... | @@ -707,7 +719,7 @@ |
707 | 719 | if (type == 'ul') |
708 | 720 | html = p.innerHTML.replace(/__MCE_ITEM__/g, '').replace(/^[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*( |\u00a0)+\s*/, ''); |
709 | 721 | else |
710 | - html = p.innerHTML.replace(/__MCE_ITEM__/g, '').replace(/^\s*\w+\.( |\u00a0)+\s*/, ''); | |
722 | + html = p.innerHTML.replace(/__MCE_ITEM__/g, '').replace(/^\s*[\w|'<'|'>']+\.( |\u00a0)+\s*/, '');; | |
711 | 723 | |
712 | 724 | // Create li and add paragraph data into the new li |
713 | 725 | li = listElm.appendChild(dom.create('li', 0, html)); |
... | ... | @@ -747,28 +759,24 @@ |
747 | 759 | * plugin, and requires minimal changes to add the new functionality. |
748 | 760 | * Speednet - June 2009 |
749 | 761 | */ |
750 | - _insertPlainText : function(ed, dom, h) { | |
751 | - var i, len, pos, rpos, node, breakElms, before, after, | |
752 | - w = ed.getWin(), | |
753 | - d = ed.getDoc(), | |
754 | - sel = ed.selection, | |
755 | - is = tinymce.is, | |
756 | - inArray = tinymce.inArray, | |
762 | + _insertPlainText : function(content) { | |
763 | + var ed = this.editor, | |
757 | 764 | linebr = getParam(ed, "paste_text_linebreaktype"), |
758 | - rl = getParam(ed, "paste_text_replacements"); | |
765 | + rl = getParam(ed, "paste_text_replacements"), | |
766 | + is = tinymce.is; | |
759 | 767 | |
760 | 768 | function process(items) { |
761 | 769 | each(items, function(v) { |
762 | 770 | if (v.constructor == RegExp) |
763 | - h = h.replace(v, ""); | |
771 | + content = content.replace(v, ""); | |
764 | 772 | else |
765 | - h = h.replace(v[0], v[1]); | |
773 | + content = content.replace(v[0], v[1]); | |
766 | 774 | }); |
767 | 775 | }; |
768 | 776 | |
769 | - if ((typeof(h) === "string") && (h.length > 0)) { | |
777 | + if ((typeof(content) === "string") && (content.length > 0)) { | |
770 | 778 | // If HTML content with line-breaking tags, then remove all cr/lf chars because only tags will break a line |
771 | - if (/<(?:p|br|h[1-6]|ul|ol|dl|table|t[rdh]|div|blockquote|fieldset|pre|address|center)[^>]*>/i.test(h)) { | |
779 | + if (/<(?:p|br|h[1-6]|ul|ol|dl|table|t[rdh]|div|blockquote|fieldset|pre|address|center)[^>]*>/i.test(content)) { | |
772 | 780 | process([ |
773 | 781 | /[\n\r]+/g |
774 | 782 | ]); |
... | ... | @@ -785,114 +793,60 @@ |
785 | 793 | [/<\/t[dh]>\s*<t[dh][^>]*>/gi, "\t"], // Table cells get tabs betweem them |
786 | 794 | /<[a-z!\/?][^>]*>/gi, // Delete all remaining tags |
787 | 795 | [/ /gi, " "], // Convert non-break spaces to regular spaces (remember, *plain text*) |
788 | - [/(?:(?!\n)\s)*(\n+)(?:(?!\n)\s)*/gi, "$1"], // Cool little RegExp deletes whitespace around linebreak chars. | |
789 | - [/\n{3,}/g, "\n\n"], // Max. 2 consecutive linebreaks | |
790 | - /^\s+|\s+$/g // Trim the front & back | |
796 | + [/(?:(?!\n)\s)*(\n+)(?:(?!\n)\s)*/gi, "$1"] // Cool little RegExp deletes whitespace around linebreak chars. | |
791 | 797 | ]); |
792 | 798 | |
793 | - h = dom.decode(tinymce.html.Entities.encodeRaw(h)); | |
799 | + var maxLinebreaks = Number(getParam(ed, "paste_max_consecutive_linebreaks")); | |
800 | + if (maxLinebreaks > -1) { | |
801 | + var maxLinebreaksRegex = new RegExp("\n{" + (maxLinebreaks + 1) + ",}", "g"); | |
802 | + var linebreakReplacement = ""; | |
803 | + | |
804 | + while (linebreakReplacement.length < maxLinebreaks) { | |
805 | + linebreakReplacement += "\n"; | |
806 | + } | |
794 | 807 | |
795 | - // Delete any highlighted text before pasting | |
796 | - if (!sel.isCollapsed()) { | |
797 | - d.execCommand("Delete", false, null); | |
808 | + process([ | |
809 | + [maxLinebreaksRegex, linebreakReplacement] // Limit max consecutive linebreaks | |
810 | + ]); | |
798 | 811 | } |
799 | 812 | |
813 | + content = ed.dom.decode(tinymce.html.Entities.encodeRaw(content)); | |
814 | + | |
800 | 815 | // Perform default or custom replacements |
801 | - if (is(rl, "array") || (is(rl, "array"))) { | |
816 | + if (is(rl, "array")) { | |
802 | 817 | process(rl); |
803 | - } | |
804 | - else if (is(rl, "string")) { | |
818 | + } else if (is(rl, "string")) { | |
805 | 819 | process(new RegExp(rl, "gi")); |
806 | 820 | } |
807 | 821 | |
808 | 822 | // Treat paragraphs as specified in the config |
809 | 823 | if (linebr == "none") { |
824 | + // Convert all line breaks to space | |
810 | 825 | process([ |
811 | 826 | [/\n+/g, " "] |
812 | 827 | ]); |
813 | - } | |
814 | - else if (linebr == "br") { | |
828 | + } else if (linebr == "br") { | |
829 | + // Convert all line breaks to <br /> | |
815 | 830 | process([ |
816 | 831 | [/\n/g, "<br />"] |
817 | 832 | ]); |
818 | - } | |
819 | - else { | |
833 | + } else if (linebr == "p") { | |
834 | + // Convert all line breaks to <p>...</p> | |
835 | + process([ | |
836 | + [/\n+/g, "</p><p>"], | |
837 | + [/^(.*<\/p>)(<p>)$/, '<p>$1'] | |
838 | + ]); | |
839 | + } else { | |
840 | + // defaults to "combined" | |
841 | + // Convert single line breaks to <br /> and double line breaks to <p>...</p> | |
820 | 842 | process([ |
821 | - /^\s+|\s+$/g, | |
822 | 843 | [/\n\n/g, "</p><p>"], |
844 | + [/^(.*<\/p>)(<p>)$/, '<p>$1'], | |
823 | 845 | [/\n/g, "<br />"] |
824 | 846 | ]); |
825 | 847 | } |
826 | 848 | |
827 | - // This next piece of code handles the situation where we're pasting more than one paragraph of plain | |
828 | - // text, and we are pasting the content into the middle of a block node in the editor. The block | |
829 | - // node gets split at the selection point into "Para A" and "Para B" (for the purposes of explaining). | |
830 | - // The first paragraph of the pasted text is appended to "Para A", and the last paragraph of the | |
831 | - // pasted text is prepended to "Para B". Any other paragraphs of pasted text are placed between | |
832 | - // "Para A" and "Para B". This code solves a host of problems with the original plain text plugin and | |
833 | - // now handles styles correctly. (Pasting plain text into a styled paragraph is supposed to make the | |
834 | - // plain text take the same style as the existing paragraph.) | |
835 | - if ((pos = h.indexOf("</p><p>")) != -1) { | |
836 | - rpos = h.lastIndexOf("</p><p>"); | |
837 | - node = sel.getNode(); | |
838 | - breakElms = []; // Get list of elements to break | |
839 | - | |
840 | - do { | |
841 | - if (node.nodeType == 1) { | |
842 | - // Don't break tables and break at body | |
843 | - if (node.nodeName == "TD" || node.nodeName == "BODY") { | |
844 | - break; | |
845 | - } | |
846 | - | |
847 | - breakElms[breakElms.length] = node; | |
848 | - } | |
849 | - } while (node = node.parentNode); | |
850 | - | |
851 | - // Are we in the middle of a block node? | |
852 | - if (breakElms.length > 0) { | |
853 | - before = h.substring(0, pos); | |
854 | - after = ""; | |
855 | - | |
856 | - for (i=0, len=breakElms.length; i<len; i++) { | |
857 | - before += "</" + breakElms[i].nodeName.toLowerCase() + ">"; | |
858 | - after += "<" + breakElms[breakElms.length-i-1].nodeName.toLowerCase() + ">"; | |
859 | - } | |
860 | - | |
861 | - if (pos == rpos) { | |
862 | - h = before + after + h.substring(pos+7); | |
863 | - } | |
864 | - else { | |
865 | - h = before + h.substring(pos+4, rpos+4) + after + h.substring(rpos+7); | |
866 | - } | |
867 | - } | |
868 | - } | |
869 | - | |
870 | - // Insert content at the caret, plus add a marker for repositioning the caret | |
871 | - ed.execCommand("mceInsertRawHTML", false, h + '<span id="_plain_text_marker"> </span>'); | |
872 | - | |
873 | - // Reposition the caret to the marker, which was placed immediately after the inserted content. | |
874 | - // Needs to be done asynchronously (in window.setTimeout) or else it doesn't work in all browsers. | |
875 | - // The second part of the code scrolls the content up if the caret is positioned off-screen. | |
876 | - // This is only necessary for WebKit browsers, but it doesn't hurt to use for all. | |
877 | - window.setTimeout(function() { | |
878 | - var marker = dom.get('_plain_text_marker'), | |
879 | - elm, vp, y, elmHeight; | |
880 | - | |
881 | - sel.select(marker, false); | |
882 | - d.execCommand("Delete", false, null); | |
883 | - marker = null; | |
884 | - | |
885 | - // Get element, position and height | |
886 | - elm = sel.getStart(); | |
887 | - vp = dom.getViewPort(w); | |
888 | - y = dom.getPos(elm).y; | |
889 | - elmHeight = elm.clientHeight; | |
890 | - | |
891 | - // Is element within viewport if not then scroll it into view | |
892 | - if ((y < vp.y) || (y + elmHeight > vp.y + vp.h)) { | |
893 | - d.body.scrollTop = y < vp.y ? y : y - vp.h + 25; | |
894 | - } | |
895 | - }, 0); | |
849 | + ed.execCommand('mceInsertContent', false, content); | |
896 | 850 | } |
897 | 851 | }, |
898 | 852 | ... | ... |
public/javascripts/tinymce/jscripts/tiny_mce/plugins/paste/langs/en_dlg.js
1 | -tinyMCE.addI18n('en.paste_dlg',{ | |
2 | -text_title:"Use CTRL+V on your keyboard to paste the text into the window.", | |
3 | -text_linebreaks:"Keep linebreaks", | |
4 | -word_title:"Use CTRL+V on your keyboard to paste the text into the window." | |
5 | -}); | |
6 | 1 | \ No newline at end of file |
2 | +tinyMCE.addI18n('en.paste_dlg',{"word_title":"Use Ctrl+V on your keyboard to paste the text into the window.","text_linebreaks":"Keep Linebreaks","text_title":"Use Ctrl+V on your keyboard to paste the text into the window."}); | |
7 | 3 | \ No newline at end of file | ... | ... |