spud_core 0.8.4 → 0.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/app/assets/libs/tiny_mce/jquery.tinymce.js +1 -1
- data/app/assets/libs/tiny_mce/langs/en.js +1 -1
- data/app/assets/libs/tiny_mce/plugins/advlink/js/advlink.js +2 -2
- data/app/assets/libs/tiny_mce/plugins/autolink/editor_plugin.js +1 -1
- data/app/assets/libs/tiny_mce/plugins/autolink/editor_plugin_src.js +3 -1
- data/app/assets/libs/tiny_mce/plugins/lists/editor_plugin.js +1 -1
- data/app/assets/libs/tiny_mce/plugins/lists/editor_plugin_src.js +60 -55
- data/app/assets/libs/tiny_mce/plugins/media/js/media.js +14 -8
- data/app/assets/libs/tiny_mce/plugins/noneditable/editor_plugin.js +1 -1
- data/app/assets/libs/tiny_mce/plugins/noneditable/editor_plugin_src.js +416 -57
- data/app/assets/libs/tiny_mce/plugins/paste/editor_plugin.js +1 -1
- data/app/assets/libs/tiny_mce/plugins/paste/editor_plugin_src.js +1 -1
- data/app/assets/libs/tiny_mce/plugins/spellchecker/editor_plugin.js +1 -1
- data/app/assets/libs/tiny_mce/plugins/spellchecker/editor_plugin_src.js +6 -6
- data/app/assets/libs/tiny_mce/plugins/style/css/props.css +1 -0
- data/app/assets/libs/tiny_mce/plugins/style/editor_plugin.js +1 -1
- data/app/assets/libs/tiny_mce/plugins/style/editor_plugin_src.js +19 -3
- data/app/assets/libs/tiny_mce/plugins/style/js/props.js +77 -3
- data/app/assets/libs/tiny_mce/plugins/style/langs/en_dlg.js +1 -1
- data/app/assets/libs/tiny_mce/plugins/style/props.htm +6 -1
- data/app/assets/libs/tiny_mce/plugins/style/readme.txt +19 -0
- data/app/assets/libs/tiny_mce/plugins/tabfocus/editor_plugin.js +1 -1
- data/app/assets/libs/tiny_mce/plugins/tabfocus/editor_plugin_src.js +1 -1
- data/app/assets/libs/tiny_mce/plugins/table/editor_plugin.js +1 -1
- data/app/assets/libs/tiny_mce/plugins/table/editor_plugin_src.js +21 -1
- data/app/assets/libs/tiny_mce/plugins/table/js/cell.js +2 -2
- data/app/assets/libs/tiny_mce/plugins/table/js/table.js +6 -5
- data/app/assets/libs/tiny_mce/plugins/visualblocks/css/visualblocks.css +21 -0
- data/app/assets/libs/tiny_mce/plugins/visualblocks/editor_plugin.js +1 -0
- data/app/assets/libs/tiny_mce/plugins/visualblocks/editor_plugin_src.js +63 -0
- data/app/assets/libs/tiny_mce/plugins/wordcount/editor_plugin.js +1 -1
- data/app/assets/libs/tiny_mce/plugins/wordcount/editor_plugin_src.js +14 -6
- data/app/assets/libs/tiny_mce/themes/advanced/color_picker.htm +2 -6
- data/app/assets/libs/tiny_mce/themes/advanced/editor_template.js +1 -1
- data/app/assets/libs/tiny_mce/themes/advanced/editor_template_src.js +129 -24
- data/app/assets/libs/tiny_mce/themes/advanced/img/icons.gif +0 -0
- data/app/assets/libs/tiny_mce/themes/advanced/js/anchor.js +2 -1
- data/app/assets/libs/tiny_mce/themes/advanced/js/color_picker.js +345 -329
- data/app/assets/libs/tiny_mce/themes/advanced/js/source_editor.js +27 -5
- data/app/assets/libs/tiny_mce/themes/advanced/langs/en_dlg.js +1 -1
- data/app/assets/libs/tiny_mce/themes/advanced/skins/default/content.css +1 -0
- data/app/assets/libs/tiny_mce/themes/advanced/skins/default/dialog.css +3 -2
- data/app/assets/libs/tiny_mce/themes/advanced/skins/default/ui.css +1 -0
- data/app/assets/libs/tiny_mce/themes/advanced/skins/highcontrast/content.css +1 -0
- data/app/assets/libs/tiny_mce/themes/advanced/skins/highcontrast/dialog.css +4 -3
- data/app/assets/libs/tiny_mce/themes/advanced/skins/o2k7/content.css +1 -0
- data/app/assets/libs/tiny_mce/themes/advanced/skins/o2k7/dialog.css +3 -2
- data/app/assets/libs/tiny_mce/themes/advanced/skins/o2k7/ui.css +1 -0
- data/app/assets/libs/tiny_mce/tiny_mce.js +1 -1
- data/app/assets/libs/tiny_mce/tiny_mce_popup.js +1 -1
- data/app/assets/libs/tiny_mce/tiny_mce_src.js +3822 -3048
- data/lib/spud_core/version.rb +1 -1
- metadata +32 -28
@@ -1 +1 @@
|
|
1
|
-
(function(
|
1
|
+
(function(c){var b,e,a=[],d=window;c.fn.tinymce=function(j){var p=this,g,k,h,m,i,l="",n="";if(!p.length){return p}if(!j){return tinyMCE.get(p[0].id)}p.css("visibility","hidden");function o(){var r=[],q=0;if(f){f();f=null}p.each(function(t,u){var s,w=u.id,v=j.oninit;if(!w){u.id=w=tinymce.DOM.uniqueId()}s=new tinymce.Editor(w,j);r.push(s);s.onInit.add(function(){var x,y=v;p.css("visibility","");if(v){if(++q==r.length){if(tinymce.is(y,"string")){x=(y.indexOf(".")===-1)?null:tinymce.resolve(y.replace(/\.\w+$/,""));y=tinymce.resolve(y)}y.apply(x||tinymce,r)}}})});c.each(r,function(t,s){s.render()})}if(!d.tinymce&&!e&&(g=j.script_url)){e=1;h=g.substring(0,g.lastIndexOf("/"));if(/_(src|dev)\.js/g.test(g)){n="_src"}m=g.lastIndexOf("?");if(m!=-1){l=g.substring(m+1)}d.tinyMCEPreInit=d.tinyMCEPreInit||{base:h,suffix:n,query:l};if(g.indexOf("gzip")!=-1){i=j.language||"en";g=g+(/\?/.test(g)?"&":"?")+"js=true&core=true&suffix="+escape(n)+"&themes="+escape(j.theme)+"&plugins="+escape(j.plugins)+"&languages="+i;if(!d.tinyMCE_GZ){tinyMCE_GZ={start:function(){tinymce.suffix=n;function q(r){tinymce.ScriptLoader.markDone(tinyMCE.baseURI.toAbsolute(r))}q("langs/"+i+".js");q("themes/"+j.theme+"/editor_template"+n+".js");q("themes/"+j.theme+"/langs/"+i+".js");c.each(j.plugins.split(","),function(s,r){if(r){q("plugins/"+r+"/editor_plugin"+n+".js");q("plugins/"+r+"/langs/"+i+".js")}})},end:function(){}}}}c.ajax({type:"GET",url:g,dataType:"script",cache:true,success:function(){tinymce.dom.Event.domLoaded=1;e=2;if(j.script_loaded){j.script_loaded()}o();c.each(a,function(q,r){r()})}})}else{if(e===1){a.push(o)}else{o()}}return p};c.extend(c.expr[":"],{tinymce:function(g){return !!(g.id&&tinyMCE.get(g.id))}});function f(){function i(l){if(l==="remove"){this.each(function(n,o){var m=h(o);if(m){m.remove()}})}this.find("span.mceEditor,div.mceEditor").each(function(n,o){var m=tinyMCE.get(o.id.replace(/_parent$/,""));if(m){m.remove()}})}function k(n){var m=this,l;if(n!==b){i.call(m);m.each(function(p,q){var o;if(o=tinyMCE.get(q.id)){o.setContent(n)}})}else{if(m.length>0){if(l=tinyMCE.get(m[0].id)){return l.getContent()}}}}function h(m){var l=null;(m)&&(m.id)&&(d.tinymce)&&(l=tinyMCE.get(m.id));return l}function g(l){return !!((l)&&(l.length)&&(d.tinymce)&&(l.is(":tinymce")))}var j={};c.each(["text","html","val"],function(n,l){var o=j[l]=c.fn[l],m=(l==="text");c.fn[l]=function(s){var p=this;if(!g(p)){return o.apply(p,arguments)}if(s!==b){k.call(p.filter(":tinymce"),s);o.apply(p.not(":tinymce"),arguments);return p}else{var r="";var q=arguments;(m?p:p.eq(0)).each(function(u,v){var t=h(v);r+=t?(m?t.getContent().replace(/<(?:"[^"]*"|'[^']*'|[^'">])*>/g,""):t.getContent()):o.apply(c(v),q)});return r}}});c.each(["append","prepend"],function(n,m){var o=j[m]=c.fn[m],l=(m==="prepend");c.fn[m]=function(q){var p=this;if(!g(p)){return o.apply(p,arguments)}if(q!==b){p.filter(":tinymce").each(function(s,t){var r=h(t);r&&r.setContent(l?q+r.getContent():r.getContent()+q)});o.apply(p.not(":tinymce"),arguments);return p}}});c.each(["remove","replaceWith","replaceAll","empty"],function(m,l){var n=j[l]=c.fn[l];c.fn[l]=function(){i.call(this,l);return n.apply(this,arguments)}});j.attr=c.fn.attr;c.fn.attr=function(n,p){var m=this;if((!n)||(n!=="value")||(!g(m))){if(p!==b){return j.attr.call(m,n,p)}else{return j.attr.call(m,n)}}if(p!==b){k.call(m.filter(":tinymce"),p);j.attr.call(m.not(":tinymce"),n,p);return m}else{var o=m[0],l=h(o);return l?l.getContent():j.attr.call(c(o),n,p)}}}})(jQuery);
|
@@ -1 +1 @@
|
|
1
|
-
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:"}}});
|
1
|
+
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'}}});
|
@@ -488,7 +488,7 @@ function getLinkListHTML(elm_id, target_form_element, onchange_func) {
|
|
488
488
|
var html = "";
|
489
489
|
|
490
490
|
html += '<select id="' + elm_id + '" name="' + elm_id + '"';
|
491
|
-
html += ' class="mceLinkList"
|
491
|
+
html += ' class="mceLinkList" onchange="this.form.' + target_form_element + '.value=';
|
492
492
|
html += 'this.options[this.selectedIndex].value;';
|
493
493
|
|
494
494
|
if (typeof(onchange_func) != "undefined")
|
@@ -510,7 +510,7 @@ function getTargetListHTML(elm_id, target_form_element) {
|
|
510
510
|
var targets = tinyMCEPopup.getParam('theme_advanced_link_targets', '').split(';');
|
511
511
|
var html = '';
|
512
512
|
|
513
|
-
html += '<select id="' + elm_id + '" name="' + elm_id + '"
|
513
|
+
html += '<select id="' + elm_id + '" name="' + elm_id + '" onchange="this.form.' + target_form_element + '.value=';
|
514
514
|
html += 'this.options[this.selectedIndex].value;">';
|
515
515
|
html += '<option value="_self">' + tinyMCEPopup.getLang('advlink_dlg.target_same') + '</option>';
|
516
516
|
html += '<option value="_blank">' + tinyMCEPopup.getLang('advlink_dlg.target_blank') + ' (_blank)</option>';
|
@@ -1 +1 @@
|
|
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)}});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().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
|
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)}});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().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\.|[A-Z0-9._%+-]+@)(.+)$/i);if(h){if(h[1]=="www."){h[1]="http://www."}else{if(/@$/.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);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)})();
|
@@ -125,11 +125,13 @@
|
|
125
125
|
}
|
126
126
|
|
127
127
|
text = r.toString();
|
128
|
-
matches = text.match(/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www
|
128
|
+
matches = text.match(/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|[A-Z0-9._%+-]+@)(.+)$/i);
|
129
129
|
|
130
130
|
if (matches) {
|
131
131
|
if (matches[1] == 'www.') {
|
132
132
|
matches[1] = 'http://www.';
|
133
|
+
} else if (/@$/.test(matches[1])) {
|
134
|
+
matches[1] = 'mailto:' + matches[1];
|
133
135
|
}
|
134
136
|
|
135
137
|
bookmark = ed.selection.getBookmark();
|
@@ -1 +1 @@
|
|
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{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 I="ESCAPE";var z="PARAGRAPH";var M="UNKNOWN";var x=M;function E(U){return U.keyCode===tinymce.VK.TAB&&!(U.altKey||U.ctrlKey)&&(y.queryCommandState("InsertUnorderedList")||y.queryCommandState("InsertOrderedList"))}function D(){var U=y.selection.getRng();var V=U.startContainer;if(V.nodeType==3){return(U.endOffset==V.nodeValue.length)}else{if(V.nodeType==1){return U.endOffset==V.childNodes.length}}return false}function N(){var V=y.selection.getNode();var U=V.tagName==="P"&&V.parentNode.tagName==="LI"&&V.parentNode.lastChild===V;return y.selection.isCollapsed()&&U&&D()}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 L(U){if(E(U)){return v}else{if(A(U)&&w()){return I}else{if(A(U)&&F()){return s}else{if(A(U)&&N()){return z}else{return M}}}}}function C(U,V){if(x==v||x==s||tinymce.isGecko&&x==I){r.cancel(V)}}function J(W,Y){if(x==z){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.isIE8){V.appendChild(W.dom.create(" "));W.selection.setCursorLocation(V,1)}else{if(tinyMCE.isGecko){setTimeout(function(){var Z=W.getDoc().createTextNode("\uFEFF");V.appendChild(Z);W.selection.setCursorLocation(V,0)},0)}else{W.selection.setCursorLocation(V,0)}}r.cancel(Y)}}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;W.appendChild(y.getDoc().createElement(""));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=M;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==I){if(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 K(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){K(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;K(U,W)}}}function Q(V,Z){function W(ad,aa){var ac=[];var ae=new tinymce.dom.TreeWalker(aa,ad);for(var ab=ae.current();ab;ab=ae.next()){if(V.dom.is(ab,"ol,ul,li")){ac.push(ab)}}return ac}if(Z.keyCode==tinymce.VK.BACKSPACE){var U=B();if(U){var Y=V.dom.getParent(U,"ol,ul");if(Y&&Y.firstChild===U){var X=W(Y,U);V.execCommand("Outdent",false,X);V.undoManager.add();return r.cancel(Z)}}}}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=L(V)});y.onKeyDown.add(C);y.onKeyDown.add(u);y.onKeyDown.add(J);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()}}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||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)}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(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:"")}},selectedBlocks:function(){var s=this.ed;var 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)}());
|
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{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(V,Z){function W(ad,aa){var ac=[];var ae=new tinymce.dom.TreeWalker(aa,ad);for(var ab=ae.current();ab;ab=ae.next()){if(V.dom.is(ab,"ol,ul,li")){ac.push(ab)}}return ac}if(Z.keyCode==tinymce.VK.BACKSPACE){var U=B();if(U){var Y=V.dom.getParent(U,"ol,ul");if(Y&&Y.firstChild===U){var X=W(Y,U);V.execCommand("Outdent",false,X);V.undoManager.add();return r.cancel(Z)}}}}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()}}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||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)}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(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:"")}},selectedBlocks:function(){var s=this.ed;var 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)}());
|
@@ -149,29 +149,11 @@
|
|
149
149
|
var state = LIST_UNKNOWN;
|
150
150
|
|
151
151
|
function isTabInList(e) {
|
152
|
-
|
152
|
+
// Don't indent on Ctrl+Tab or Alt+Tab
|
153
153
|
return e.keyCode === tinymce.VK.TAB && !(e.altKey || e.ctrlKey) &&
|
154
154
|
(ed.queryCommandState('InsertUnorderedList') || ed.queryCommandState('InsertOrderedList'));
|
155
155
|
}
|
156
156
|
|
157
|
-
function isCursorAtEndOfContainer() {
|
158
|
-
var range = ed.selection.getRng();
|
159
|
-
var startContainer = range.startContainer;
|
160
|
-
if (startContainer.nodeType == 3) {
|
161
|
-
return (range.endOffset == startContainer.nodeValue.length);
|
162
|
-
} else if (startContainer.nodeType == 1) {
|
163
|
-
return range.endOffset == startContainer.childNodes.length;
|
164
|
-
}
|
165
|
-
return false;
|
166
|
-
}
|
167
|
-
|
168
|
-
// If we are at the end of a paragraph in a list item, pressing enter should create a new list item instead of a new paragraph.
|
169
|
-
function isEndOfParagraph() {
|
170
|
-
var node = ed.selection.getNode();
|
171
|
-
var isLastParagraphOfLi = node.tagName === 'P' && node.parentNode.tagName === 'LI' && node.parentNode.lastChild === node;
|
172
|
-
return ed.selection.isCollapsed() && isLastParagraphOfLi && isCursorAtEndOfContainer();
|
173
|
-
}
|
174
|
-
|
175
157
|
function isOnLastListItem() {
|
176
158
|
var li = getLi();
|
177
159
|
var grandParent = li.parentNode.parentNode;
|
@@ -215,22 +197,22 @@
|
|
215
197
|
|
216
198
|
function isEnter(e) {
|
217
199
|
return e.keyCode === tinymce.VK.ENTER;
|
218
|
-
|
200
|
+
}
|
219
201
|
|
220
|
-
|
221
|
-
|
222
|
-
|
202
|
+
function isEnterWithoutShift(e) {
|
203
|
+
return isEnter(e) && !e.shiftKey;
|
204
|
+
}
|
223
205
|
|
224
206
|
function getListKeyState(e) {
|
225
207
|
if (isTabInList(e)) {
|
226
208
|
return LIST_TABBING;
|
227
209
|
} else if (isEnterWithoutShift(e) && isOnLastListItem()) {
|
228
|
-
|
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;
|
229
213
|
} else if (isEnterWithoutShift(e) && isInEmptyListItem()) {
|
230
214
|
return LIST_EMPTY_ITEM;
|
231
|
-
} else
|
232
|
-
return LIST_PARAGRAPH;
|
233
|
-
} else {
|
215
|
+
} else {
|
234
216
|
return LIST_UNKNOWN;
|
235
217
|
}
|
236
218
|
}
|
@@ -241,32 +223,54 @@
|
|
241
223
|
Event.cancel(e);
|
242
224
|
}
|
243
225
|
}
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
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()) {
|
248
258
|
var node = ed.selection.getNode();
|
249
259
|
var li = ed.dom.create("li");
|
250
260
|
var parentLi = ed.dom.getParent(node, 'li');
|
251
261
|
ed.dom.insertAfter(li, parentLi);
|
252
262
|
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
ed.selection.setCursorLocation(li, 0);
|
263
|
-
}, 0);
|
264
|
-
} else {
|
265
|
-
ed.selection.setCursorLocation(li, 0);
|
266
|
-
}
|
267
|
-
Event.cancel(e);
|
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();
|
268
272
|
}
|
269
|
-
|
273
|
+
}
|
270
274
|
|
271
275
|
function imageJoiningListItem(ed, e) {
|
272
276
|
var prevSibling;
|
@@ -341,7 +345,8 @@
|
|
341
345
|
var list = ed.dom.getParent(li, 'ol,ul');
|
342
346
|
if (list != null) {
|
343
347
|
var lastLi = list.lastChild;
|
344
|
-
|
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(''));
|
345
350
|
ed.selection.setCursorLocation(lastLi, 0);
|
346
351
|
}
|
347
352
|
}
|
@@ -374,8 +379,8 @@
|
|
374
379
|
ed.onKeyUp.add(function(ed, e) {
|
375
380
|
if (state == LIST_TABBING) {
|
376
381
|
ed.execCommand(e.shiftKey ? 'Outdent' : 'Indent', true, null);
|
377
|
-
|
378
|
-
|
382
|
+
state = LIST_UNKNOWN;
|
383
|
+
return Event.cancel(e);
|
379
384
|
} else if (state == LIST_EMPTY_ITEM) {
|
380
385
|
var li = getLi();
|
381
386
|
var shouldOutdent = ed.settings.list_outdent_on_enter === true || e.shiftKey;
|
@@ -386,8 +391,8 @@
|
|
386
391
|
|
387
392
|
return Event.cancel(e);
|
388
393
|
} else if (state == LIST_ESCAPE) {
|
389
|
-
if (tinymce.isIE8) {
|
390
|
-
// append a zero sized nbsp so that caret is positioned correctly in
|
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.
|
391
396
|
// if there is no text then applying formatting for e.g a H1 to the P tag immediately following list after
|
392
397
|
// escaping from it will cause the caret to be positioned on the last li instead of staying the in P tag.
|
393
398
|
var n = ed.getDoc().createTextNode('\uFEFF');
|
@@ -397,7 +402,7 @@
|
|
397
402
|
// Gecko does not create a paragraph outdenting inside a TD so default behaviour is cancelled and we outdent ourselves
|
398
403
|
ed.execCommand('Outdent');
|
399
404
|
return Event.cancel(e);
|
400
|
-
|
405
|
+
}
|
401
406
|
}
|
402
407
|
});
|
403
408
|
|
@@ -481,7 +486,7 @@
|
|
481
486
|
ed.onKeyDown.add(function(_, e) { state = getListKeyState(e); });
|
482
487
|
ed.onKeyDown.add(cancelDefaultEvents);
|
483
488
|
ed.onKeyDown.add(imageJoiningListItem);
|
484
|
-
|
489
|
+
ed.onKeyDown.add(createNewLi);
|
485
490
|
|
486
491
|
if (tinymce.isGecko) {
|
487
492
|
ed.onKeyUp.add(fixIndentedListItemForGecko);
|
@@ -563,7 +568,7 @@
|
|
563
568
|
li = dom.create('li');
|
564
569
|
start.parentNode.insertBefore(li, start);
|
565
570
|
}
|
566
|
-
|
571
|
+
while (n && n != end) {
|
567
572
|
tmp = n.nextSibling;
|
568
573
|
li.appendChild(n);
|
569
574
|
n = tmp;
|
@@ -427,24 +427,30 @@
|
|
427
427
|
},
|
428
428
|
|
429
429
|
getMediaTypeHTML : function(editor) {
|
430
|
-
function option(media_type){
|
430
|
+
function option(media_type, element) {
|
431
|
+
if (!editor.schema.getElementRule(element || media_type)) {
|
432
|
+
return '';
|
433
|
+
}
|
434
|
+
|
431
435
|
return '<option value="'+media_type+'">'+tinyMCEPopup.editor.translate("media_dlg."+media_type)+'</option>'
|
432
436
|
}
|
437
|
+
|
433
438
|
var html = "";
|
439
|
+
|
434
440
|
html += '<select id="media_type" name="media_type" onchange="Media.formToData(\'type\');">';
|
435
441
|
html += option("video");
|
436
442
|
html += option("audio");
|
437
|
-
html += option("flash");
|
438
|
-
html += option("quicktime");
|
439
|
-
html += option("shockwave");
|
440
|
-
html += option("windowsmedia");
|
441
|
-
html += option("realmedia");
|
443
|
+
html += option("flash", "object");
|
444
|
+
html += option("quicktime", "object");
|
445
|
+
html += option("shockwave", "object");
|
446
|
+
html += option("windowsmedia", "object");
|
447
|
+
html += option("realmedia", "object");
|
442
448
|
html += option("iframe");
|
443
449
|
|
444
450
|
if (editor.getParam('media_embedded_audio', false)) {
|
445
|
-
html += option('embeddedaudio');
|
451
|
+
html += option('embeddedaudio', "object");
|
446
452
|
}
|
447
|
-
|
453
|
+
|
448
454
|
html += '</select>';
|
449
455
|
return html;
|
450
456
|
},
|
@@ -1 +1 @@
|
|
1
|
-
(function(){var
|
1
|
+
(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=tinymce.isGecko?"\u200B":"\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(y,A){var E=A.keyCode,w,B,C,u;function t(G,F){while(G=G[F?"previousSibling":"nextSibling"]){if(G.nodeType!==3||G.nodeValue.length>0){return G}}}function x(F,G){p.select(F);p.collapse(G)}C=p.getStart();u=p.getEnd();w=g(C)||g(u);if(w&&(E<112||E>124)&&E!=e.DELETE&&E!=e.BACKSPACE){if((tinymce.isMac?A.metaKey:A.ctrlKey)&&(E==67||E==88||E==86)){return}A.preventDefault();if(E==e.LEFT||E==e.RIGHT){var v=E==e.LEFT;if(y.dom.isBlock(w)){var z=v?w.previousSibling:w.nextSibling;var s=new c(z,z);var D=v?s.prev():s.next();x(D,!v)}else{x(w,v)}}}else{if(E==e.LEFT||E==e.RIGHT||E==e.BACKSPACE||E==e.DELETE){B=l(C);if(B){if(E==e.LEFT||E==e.BACKSPACE){w=t(B,true);if(w&&m(w)==="false"){A.preventDefault();if(E==e.LEFT){x(w,true)}else{j.remove(w)}}else{i(B)}}if(E==e.RIGHT||E==e.DELETE){w=t(B);if(w&&m(w)==="false"){A.preventDefault();if(E==e.RIGHT){x(w,false)}else{j.remove(w)}}else{i(B)}}}}}}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)})();
|
@@ -9,37 +9,432 @@
|
|
9
9
|
*/
|
10
10
|
|
11
11
|
(function() {
|
12
|
-
var
|
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';
|
18
|
+
|
19
|
+
// Setup invisible character use zero width space on Gecko since it doesn't change the height of the container
|
20
|
+
invisibleChar = tinymce.isGecko ? '\u200B' : '\uFEFF';
|
21
|
+
|
22
|
+
// Returns the content editable state of a node "true/false" or null
|
23
|
+
function getContentEditable(node) {
|
24
|
+
var contentEditable;
|
25
|
+
|
26
|
+
// Ignore non elements
|
27
|
+
if (node.nodeType === 1) {
|
28
|
+
// Check for fake content editable
|
29
|
+
contentEditable = node.getAttribute(internalName);
|
30
|
+
if (contentEditable && contentEditable !== "inherit") {
|
31
|
+
return contentEditable;
|
32
|
+
}
|
33
|
+
|
34
|
+
// Check for real content editable
|
35
|
+
contentEditable = node.contentEditable;
|
36
|
+
if (contentEditable !== "inherit") {
|
37
|
+
return contentEditable;
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
return null;
|
42
|
+
};
|
43
|
+
|
44
|
+
// Returns the noneditable parent or null if there is a editable before it or if it wasn't found
|
45
|
+
function getNonEditableParent(node) {
|
46
|
+
var state;
|
47
|
+
|
48
|
+
while (node) {
|
49
|
+
state = getContentEditable(node);
|
50
|
+
if (state) {
|
51
|
+
return state === "false" ? node : null;
|
52
|
+
}
|
53
|
+
|
54
|
+
node = node.parentNode;
|
55
|
+
}
|
56
|
+
};
|
57
|
+
|
58
|
+
// Get caret container parent for the specified node
|
59
|
+
function getParentCaretContainer(node) {
|
60
|
+
while (node) {
|
61
|
+
if (node.id === caretContainerId) {
|
62
|
+
return node;
|
63
|
+
}
|
64
|
+
|
65
|
+
node = node.parentNode;
|
66
|
+
}
|
67
|
+
};
|
68
|
+
|
69
|
+
// Finds the first text node in the specified node
|
70
|
+
function findFirstTextNode(node) {
|
71
|
+
var walker;
|
72
|
+
|
73
|
+
if (node) {
|
74
|
+
walker = new TreeWalker(node, node);
|
75
|
+
|
76
|
+
for (node = walker.current(); node; node = walker.next()) {
|
77
|
+
if (node.nodeType === 3) {
|
78
|
+
return node;
|
79
|
+
}
|
80
|
+
}
|
81
|
+
}
|
82
|
+
};
|
83
|
+
|
84
|
+
// Insert caret container before/after target or expand selection to include block
|
85
|
+
function insertCaretContainerOrExpandToBlock(target, before) {
|
86
|
+
var caretContainer, rng;
|
87
|
+
|
88
|
+
// Select block
|
89
|
+
if (getContentEditable(target) === "false") {
|
90
|
+
if (dom.isBlock(target)) {
|
91
|
+
selection.select(target);
|
92
|
+
return;
|
93
|
+
}
|
94
|
+
}
|
95
|
+
|
96
|
+
rng = dom.createRng();
|
97
|
+
|
98
|
+
if (getContentEditable(target) === "true") {
|
99
|
+
if (!target.firstChild) {
|
100
|
+
target.appendChild(ed.getDoc().createTextNode('\u00a0'));
|
101
|
+
}
|
102
|
+
|
103
|
+
target = target.firstChild;
|
104
|
+
before = true;
|
105
|
+
}
|
106
|
+
|
107
|
+
//caretContainer = dom.create('span', {id: caretContainerId, 'data-mce-bogus': true, style:'border: 1px solid red'}, invisibleChar);
|
108
|
+
caretContainer = dom.create('span', {id: caretContainerId, 'data-mce-bogus': true}, invisibleChar);
|
109
|
+
|
110
|
+
if (before) {
|
111
|
+
target.parentNode.insertBefore(caretContainer, target);
|
112
|
+
} else {
|
113
|
+
dom.insertAfter(caretContainer, target);
|
114
|
+
}
|
115
|
+
|
116
|
+
rng.setStart(caretContainer.firstChild, 1);
|
117
|
+
rng.collapse(true);
|
118
|
+
selection.setRng(rng);
|
119
|
+
|
120
|
+
return caretContainer;
|
121
|
+
};
|
122
|
+
|
123
|
+
// Removes any caret container except the one we might be in
|
124
|
+
function removeCaretContainer(caretContainer) {
|
125
|
+
var child, currentCaretContainer, lastContainer;
|
126
|
+
|
127
|
+
if (caretContainer) {
|
128
|
+
rng = selection.getRng(true);
|
129
|
+
rng.setStartBefore(caretContainer);
|
130
|
+
rng.setEndBefore(caretContainer);
|
131
|
+
|
132
|
+
child = findFirstTextNode(caretContainer);
|
133
|
+
if (child && child.nodeValue.charAt(0) == invisibleChar) {
|
134
|
+
child = child.deleteData(0, 1);
|
135
|
+
}
|
136
|
+
|
137
|
+
dom.remove(caretContainer, true);
|
138
|
+
|
139
|
+
selection.setRng(rng);
|
140
|
+
} else {
|
141
|
+
currentCaretContainer = getParentCaretContainer(selection.getStart());
|
142
|
+
while ((caretContainer = dom.get(caretContainerId)) && caretContainer !== lastContainer) {
|
143
|
+
if (currentCaretContainer !== caretContainer) {
|
144
|
+
child = findFirstTextNode(caretContainer);
|
145
|
+
if (child && child.nodeValue.charAt(0) == invisibleChar) {
|
146
|
+
child = child.deleteData(0, 1);
|
147
|
+
}
|
148
|
+
|
149
|
+
dom.remove(caretContainer, true);
|
150
|
+
}
|
151
|
+
|
152
|
+
lastContainer = caretContainer;
|
153
|
+
}
|
154
|
+
}
|
155
|
+
};
|
156
|
+
|
157
|
+
// Modifies the selection to include contentEditable false elements or insert caret containers
|
158
|
+
function moveSelection() {
|
159
|
+
var nonEditableStart, nonEditableEnd, isCollapsed, rng, element;
|
160
|
+
|
161
|
+
// 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
|
162
|
+
function hasSideContent(element, left) {
|
163
|
+
var container, offset, walker, node, len;
|
164
|
+
|
165
|
+
container = rng.startContainer;
|
166
|
+
offset = rng.startOffset;
|
167
|
+
|
168
|
+
// If endpoint is in middle of text node then expand to beginning/end of element
|
169
|
+
if (container.nodeType == 3) {
|
170
|
+
len = container.nodeValue.length;
|
171
|
+
if ((offset > 0 && offset < len) || (left ? offset == len : offset == 0)) {
|
172
|
+
return;
|
173
|
+
}
|
174
|
+
} else {
|
175
|
+
// Can we resolve the node by index
|
176
|
+
if (offset < container.childNodes.length) {
|
177
|
+
// Browser represents caret position as the offset at the start of an element. When moving right
|
178
|
+
// this is the element we are moving into so we consider our container to be child node at offset-1
|
179
|
+
var pos = !left && offset > 0 ? offset-1 : offset;
|
180
|
+
container = container.childNodes[pos];
|
181
|
+
if (container.hasChildNodes()) {
|
182
|
+
container = container.firstChild;
|
183
|
+
}
|
184
|
+
} else {
|
185
|
+
// 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
|
186
|
+
return !left ? element : null;
|
187
|
+
}
|
188
|
+
}
|
189
|
+
|
190
|
+
// Walk left/right to look for contents
|
191
|
+
walker = new TreeWalker(container, element);
|
192
|
+
while (node = walker[left ? 'prev' : 'next']()) {
|
193
|
+
if (node.nodeType === 3 && node.nodeValue.length > 0) {
|
194
|
+
return;
|
195
|
+
} else if (getContentEditable(node) === "true") {
|
196
|
+
// Found contentEditable=true element return this one to we can move the caret inside it
|
197
|
+
return node;
|
198
|
+
}
|
199
|
+
}
|
200
|
+
|
201
|
+
return element;
|
202
|
+
};
|
203
|
+
|
204
|
+
// Remove any existing caret containers
|
205
|
+
removeCaretContainer();
|
206
|
+
|
207
|
+
// Get noneditable start/end elements
|
208
|
+
isCollapsed = selection.isCollapsed();
|
209
|
+
nonEditableStart = getNonEditableParent(selection.getStart());
|
210
|
+
nonEditableEnd = getNonEditableParent(selection.getEnd());
|
211
|
+
|
212
|
+
// Is any fo the range endpoints noneditable
|
213
|
+
if (nonEditableStart || nonEditableEnd) {
|
214
|
+
rng = selection.getRng(true);
|
215
|
+
|
216
|
+
// If it's a caret selection then look left/right to see if we need to move the caret out side or expand
|
217
|
+
if (isCollapsed) {
|
218
|
+
nonEditableStart = nonEditableStart || nonEditableEnd;
|
219
|
+
var start = selection.getStart();
|
220
|
+
if (element = hasSideContent(nonEditableStart, true)) {
|
221
|
+
// We have no contents to the left of the caret then insert a caret container before the noneditable element
|
222
|
+
insertCaretContainerOrExpandToBlock(element, true);
|
223
|
+
} else if (element = hasSideContent(nonEditableStart, false)) {
|
224
|
+
// We have no contents to the right of the caret then insert a caret container after the noneditable element
|
225
|
+
insertCaretContainerOrExpandToBlock(element, false);
|
226
|
+
} else {
|
227
|
+
// We are in the middle of a noneditable so expand to select it
|
228
|
+
selection.select(nonEditableStart);
|
229
|
+
}
|
230
|
+
} else {
|
231
|
+
rng = selection.getRng(true);
|
232
|
+
|
233
|
+
// Expand selection to include start non editable element
|
234
|
+
if (nonEditableStart) {
|
235
|
+
rng.setStartBefore(nonEditableStart);
|
236
|
+
}
|
237
|
+
|
238
|
+
// Expand selection to include end non editable element
|
239
|
+
if (nonEditableEnd) {
|
240
|
+
rng.setEndAfter(nonEditableEnd);
|
241
|
+
}
|
242
|
+
|
243
|
+
selection.setRng(rng);
|
244
|
+
}
|
245
|
+
}
|
246
|
+
};
|
247
|
+
|
248
|
+
function handleKey(ed, e) {
|
249
|
+
var keyCode = e.keyCode, nonEditableParent, caretContainer, startElement, endElement;
|
250
|
+
|
251
|
+
function getNonEmptyTextNodeSibling(node, prev) {
|
252
|
+
while (node = node[prev ? 'previousSibling' : 'nextSibling']) {
|
253
|
+
if (node.nodeType !== 3 || node.nodeValue.length > 0) {
|
254
|
+
return node;
|
255
|
+
}
|
256
|
+
}
|
257
|
+
};
|
258
|
+
|
259
|
+
function positionCaretOnElement(element, start) {
|
260
|
+
selection.select(element);
|
261
|
+
selection.collapse(start);
|
262
|
+
}
|
263
|
+
|
264
|
+
startElement = selection.getStart()
|
265
|
+
endElement = selection.getEnd();
|
266
|
+
|
267
|
+
// Disable all key presses in contentEditable=false except delete or backspace
|
268
|
+
nonEditableParent = getNonEditableParent(startElement) || getNonEditableParent(endElement);
|
269
|
+
if (nonEditableParent && (keyCode < 112 || keyCode > 124) && keyCode != VK.DELETE && keyCode != VK.BACKSPACE) {
|
270
|
+
// Is Ctrl+c, Ctrl+v or Ctrl+x then use default browser behavior
|
271
|
+
if ((tinymce.isMac ? e.metaKey : e.ctrlKey) && (keyCode == 67 || keyCode == 88 || keyCode == 86)) {
|
272
|
+
return;
|
273
|
+
}
|
274
|
+
|
275
|
+
e.preventDefault();
|
276
|
+
|
277
|
+
// Arrow left/right select the element and collapse left/right
|
278
|
+
if (keyCode == VK.LEFT || keyCode == VK.RIGHT) {
|
279
|
+
var left = keyCode == VK.LEFT;
|
280
|
+
// If a block element find previous or next element to position the caret
|
281
|
+
if (ed.dom.isBlock(nonEditableParent)) {
|
282
|
+
var targetElement = left ? nonEditableParent.previousSibling : nonEditableParent.nextSibling;
|
283
|
+
var walker = new TreeWalker(targetElement, targetElement);
|
284
|
+
var caretElement = left ? walker.prev() : walker.next();
|
285
|
+
positionCaretOnElement(caretElement, !left);
|
286
|
+
} else {
|
287
|
+
positionCaretOnElement(nonEditableParent, left);
|
288
|
+
}
|
289
|
+
}
|
290
|
+
} else {
|
291
|
+
// Is arrow left/right, backspace or delete
|
292
|
+
if (keyCode == VK.LEFT || keyCode == VK.RIGHT || keyCode == VK.BACKSPACE || keyCode == VK.DELETE) {
|
293
|
+
caretContainer = getParentCaretContainer(startElement);
|
294
|
+
if (caretContainer) {
|
295
|
+
// Arrow left or backspace
|
296
|
+
if (keyCode == VK.LEFT || keyCode == VK.BACKSPACE) {
|
297
|
+
nonEditableParent = getNonEmptyTextNodeSibling(caretContainer, true);
|
298
|
+
|
299
|
+
if (nonEditableParent && getContentEditable(nonEditableParent) === "false") {
|
300
|
+
e.preventDefault();
|
301
|
+
|
302
|
+
if (keyCode == VK.LEFT) {
|
303
|
+
positionCaretOnElement(nonEditableParent, true);
|
304
|
+
} else {
|
305
|
+
dom.remove(nonEditableParent);
|
306
|
+
}
|
307
|
+
} else {
|
308
|
+
removeCaretContainer(caretContainer);
|
309
|
+
}
|
310
|
+
}
|
311
|
+
|
312
|
+
// Arrow right or delete
|
313
|
+
if (keyCode == VK.RIGHT || keyCode == VK.DELETE) {
|
314
|
+
nonEditableParent = getNonEmptyTextNodeSibling(caretContainer);
|
315
|
+
|
316
|
+
if (nonEditableParent && getContentEditable(nonEditableParent) === "false") {
|
317
|
+
e.preventDefault();
|
318
|
+
|
319
|
+
if (keyCode == VK.RIGHT) {
|
320
|
+
positionCaretOnElement(nonEditableParent, false);
|
321
|
+
} else {
|
322
|
+
dom.remove(nonEditableParent);
|
323
|
+
}
|
324
|
+
} else {
|
325
|
+
removeCaretContainer(caretContainer);
|
326
|
+
}
|
327
|
+
}
|
328
|
+
}
|
329
|
+
}
|
330
|
+
}
|
331
|
+
};
|
332
|
+
|
333
|
+
ed.onMouseDown.addToTop(function(ed, e) {
|
334
|
+
var node = ed.selection.getNode();
|
335
|
+
|
336
|
+
if (getContentEditable(node) === "false" && node == e.target) {
|
337
|
+
// Expand selection on mouse down we can't block the default event since it's used for drag/drop
|
338
|
+
moveSelection();
|
339
|
+
}
|
340
|
+
});
|
341
|
+
|
342
|
+
ed.onMouseUp.addToTop(moveSelection);
|
343
|
+
ed.onKeyDown.addToTop(handleKey);
|
344
|
+
ed.onKeyUp.addToTop(moveSelection);
|
345
|
+
};
|
13
346
|
|
14
347
|
tinymce.create('tinymce.plugins.NonEditablePlugin', {
|
15
348
|
init : function(ed, url) {
|
16
|
-
var
|
349
|
+
var editClass, nonEditClass, nonEditableRegExps;
|
350
|
+
|
351
|
+
// Converts configured regexps to noneditable span items
|
352
|
+
function convertRegExpsToNonEditable(ed, args) {
|
353
|
+
var i = nonEditableRegExps.length, content = args.content, cls = tinymce.trim(nonEditClass);
|
354
|
+
|
355
|
+
// Don't replace the variables when raw is used for example on undo/redo
|
356
|
+
if (args.format == "raw") {
|
357
|
+
return;
|
358
|
+
}
|
359
|
+
|
360
|
+
while (i--) {
|
361
|
+
content = content.replace(nonEditableRegExps[i], function(match) {
|
362
|
+
var args = arguments, index = args[args.length - 2];
|
363
|
+
|
364
|
+
// Is value inside an attribute then don't replace
|
365
|
+
if (index > 0 && content.charAt(index - 1) == '"') {
|
366
|
+
return match;
|
367
|
+
}
|
368
|
+
|
369
|
+
return '<span class="' + cls + '" data-mce-content="' + ed.dom.encode(args[0]) + '">' + ed.dom.encode(typeof(args[1]) === "string" ? args[1] : args[0]) + '</span>';
|
370
|
+
});
|
371
|
+
}
|
372
|
+
|
373
|
+
args.content = content;
|
374
|
+
};
|
375
|
+
|
376
|
+
editClass = " " + tinymce.trim(ed.getParam("noneditable_editable_class", "mceEditable")) + " ";
|
377
|
+
nonEditClass = " " + tinymce.trim(ed.getParam("noneditable_noneditable_class", "mceNonEditable")) + " ";
|
17
378
|
|
18
|
-
|
19
|
-
|
20
|
-
|
379
|
+
// Setup noneditable regexps array
|
380
|
+
nonEditableRegExps = ed.getParam("noneditable_regexp");
|
381
|
+
if (nonEditableRegExps && !nonEditableRegExps.length) {
|
382
|
+
nonEditableRegExps = [nonEditableRegExps];
|
383
|
+
}
|
21
384
|
|
22
|
-
ed.
|
23
|
-
|
385
|
+
ed.onPreInit.add(function() {
|
386
|
+
handleContentEditableSelection(ed);
|
24
387
|
|
25
|
-
|
26
|
-
|
27
|
-
|
388
|
+
if (nonEditableRegExps) {
|
389
|
+
ed.selection.onBeforeSetContent.add(convertRegExpsToNonEditable);
|
390
|
+
ed.onBeforeSetContent.add(convertRegExpsToNonEditable);
|
391
|
+
}
|
392
|
+
|
393
|
+
// Apply contentEditable true/false on elements with the noneditable/editable classes
|
394
|
+
ed.parser.addAttributeFilter('class', function(nodes) {
|
395
|
+
var i = nodes.length, className, node;
|
396
|
+
|
397
|
+
while (i--) {
|
398
|
+
node = nodes[i];
|
399
|
+
className = " " + node.attr("class") + " ";
|
400
|
+
|
401
|
+
if (className.indexOf(editClass) !== -1) {
|
402
|
+
node.attr(internalName, "true");
|
403
|
+
} else if (className.indexOf(nonEditClass) !== -1) {
|
404
|
+
node.attr(internalName, "false");
|
405
|
+
}
|
406
|
+
}
|
28
407
|
});
|
29
408
|
|
30
|
-
|
31
|
-
|
409
|
+
// Remove internal name
|
410
|
+
ed.serializer.addAttributeFilter(internalName, function(nodes, name) {
|
411
|
+
var i = nodes.length, node;
|
412
|
+
|
413
|
+
while (i--) {
|
414
|
+
node = nodes[i];
|
415
|
+
|
416
|
+
if (nonEditableRegExps && node.attr('data-mce-content')) {
|
417
|
+
node.name = "#text";
|
418
|
+
node.type = 3;
|
419
|
+
node.raw = true;
|
420
|
+
node.value = node.attr('data-mce-content');
|
421
|
+
} else {
|
422
|
+
node.attr(externalName, null);
|
423
|
+
node.attr(internalName, null);
|
424
|
+
}
|
425
|
+
}
|
32
426
|
});
|
33
427
|
|
34
|
-
//
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
428
|
+
// Convert external name into internal name
|
429
|
+
ed.parser.addAttributeFilter(externalName, function(nodes, name) {
|
430
|
+
var i = nodes.length, node;
|
431
|
+
|
432
|
+
while (i--) {
|
433
|
+
node = nodes[i];
|
434
|
+
node.attr(internalName, node.attr(externalName));
|
435
|
+
node.attr(externalName, null);
|
436
|
+
}
|
437
|
+
});
|
43
438
|
});
|
44
439
|
},
|
45
440
|
|
@@ -51,42 +446,6 @@
|
|
51
446
|
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/noneditable',
|
52
447
|
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
53
448
|
};
|
54
|
-
},
|
55
|
-
|
56
|
-
_block : function(ed, e) {
|
57
|
-
var k = e.keyCode;
|
58
|
-
|
59
|
-
// Don't block arrow keys, pg up/down, and F1-F12
|
60
|
-
if ((k > 32 && k < 41) || (k > 111 && k < 124))
|
61
|
-
return;
|
62
|
-
|
63
|
-
return Event.cancel(e);
|
64
|
-
},
|
65
|
-
|
66
|
-
_setDisabled : function(s) {
|
67
|
-
var t = this, ed = t.editor;
|
68
|
-
|
69
|
-
tinymce.each(ed.controlManager.controls, function(c) {
|
70
|
-
c.setDisabled(s);
|
71
|
-
});
|
72
|
-
|
73
|
-
if (s !== t.disabled) {
|
74
|
-
if (s) {
|
75
|
-
ed.onKeyDown.addToTop(t._block);
|
76
|
-
ed.onKeyPress.addToTop(t._block);
|
77
|
-
ed.onKeyUp.addToTop(t._block);
|
78
|
-
ed.onPaste.addToTop(t._block);
|
79
|
-
ed.onContextMenu.addToTop(t._block);
|
80
|
-
} else {
|
81
|
-
ed.onKeyDown.remove(t._block);
|
82
|
-
ed.onKeyPress.remove(t._block);
|
83
|
-
ed.onKeyUp.remove(t._block);
|
84
|
-
ed.onPaste.remove(t._block);
|
85
|
-
ed.onContextMenu.remove(t._block);
|
86
|
-
}
|
87
|
-
|
88
|
-
t.disabled = s;
|
89
|
-
}
|
90
449
|
}
|
91
450
|
});
|
92
451
|
|