Update TinyMCE to 3.5.6
|
|
@ -10,13 +10,13 @@
|
|||
// General options
|
||||
mode : "textareas",
|
||||
theme : "advanced",
|
||||
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",
|
||||
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,visualblocks",
|
||||
|
||||
// Theme options
|
||||
theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
|
||||
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",
|
||||
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
|
||||
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft",
|
||||
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft,visualblocks",
|
||||
theme_advanced_toolbar_location : "top",
|
||||
theme_advanced_toolbar_align : "left",
|
||||
theme_advanced_statusbar_location : "bottom",
|
||||
|
|
@ -52,7 +52,7 @@
|
|||
<!-- /TinyMCE -->
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<body role="application">
|
||||
|
||||
<form method="post" action="http://tinymce.moxiecode.com/dump.php?example=true">
|
||||
<div>
|
||||
|
|
|
|||
|
|
@ -10,5 +10,5 @@ var tinyMCEMediaList = [
|
|||
["Some RealMedia", "media/sample.rm"],
|
||||
["Some Shockwave", "media/sample.dcr"],
|
||||
["Some Video", "media/sample.mp4"],
|
||||
["Some FLV", "media/sample.flv"],
|
||||
["Some FLV", "media/sample.flv"]
|
||||
];
|
||||
|
|
@ -1 +1 @@
|
|||
tinyMCE.addI18n('en.advhr_dlg',{size:"Height",noshade:"No shadow",width:"Width"});
|
||||
tinyMCE.addI18n('en.advhr_dlg',{size:"Height",noshade:"No Shadow",width:"Width",normal:"Normal",widthunits:"Units"});
|
||||
|
|
@ -1 +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)})();
|
||||
(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)})();
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
// Register commands
|
||||
ed.addCommand('mceAdvImage', function() {
|
||||
// Internal image object like a flash placeholder
|
||||
if (ed.dom.getAttrib(ed.selection.getNode(), 'class').indexOf('mceItem') != -1)
|
||||
if (ed.dom.getAttrib(ed.selection.getNode(), 'class', '').indexOf('mceItem') != -1)
|
||||
return;
|
||||
|
||||
ed.windowManager.open({
|
||||
|
|
|
|||
|
|
@ -9,13 +9,13 @@ var ImageDialog = {
|
|||
},
|
||||
|
||||
init : function(ed) {
|
||||
var f = document.forms[0], nl = f.elements, ed = tinyMCEPopup.editor, dom = ed.dom, n = ed.selection.getNode();
|
||||
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');
|
||||
|
||||
tinyMCEPopup.resizeToInnerSize();
|
||||
this.fillClassList('class_list');
|
||||
this.fillFileList('src_list', 'tinyMCEImageList');
|
||||
this.fillFileList('over_list', 'tinyMCEImageList');
|
||||
this.fillFileList('out_list', 'tinyMCEImageList');
|
||||
this.fillFileList('src_list', fl);
|
||||
this.fillFileList('over_list', fl);
|
||||
this.fillFileList('out_list', fl);
|
||||
TinyMCE_EditableSelects.init();
|
||||
|
||||
if (n.nodeName == 'IMG') {
|
||||
|
|
@ -171,9 +171,13 @@ var ImageDialog = {
|
|||
if (el && el.nodeName == 'IMG') {
|
||||
ed.dom.setAttribs(el, args);
|
||||
} else {
|
||||
ed.execCommand('mceInsertContent', false, '<img id="__mce_tmp" />', {skip_undo : 1});
|
||||
ed.dom.setAttribs('__mce_tmp', args);
|
||||
ed.dom.setAttrib('__mce_tmp', 'id', '');
|
||||
tinymce.each(args, function(value, name) {
|
||||
if (value === "") {
|
||||
delete args[name];
|
||||
}
|
||||
});
|
||||
|
||||
ed.execCommand('mceInsertContent', false, tinyMCEPopup.editor.dom.createHTML('img', args), {skip_undo : 1});
|
||||
ed.undoManager.add();
|
||||
}
|
||||
|
||||
|
|
@ -287,7 +291,7 @@ var ImageDialog = {
|
|||
fillFileList : function(id, l) {
|
||||
var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl;
|
||||
|
||||
l = window[l];
|
||||
l = typeof(l) === 'function' ? l() : window[l];
|
||||
lst.options.length = 0;
|
||||
|
||||
if (l && l.length > 0) {
|
||||
|
|
@ -391,12 +395,14 @@ var ImageDialog = {
|
|||
if (v == '0')
|
||||
img.style.border = isIE ? '0' : '0 none none';
|
||||
else {
|
||||
if (b.length == 3 && b[isIE ? 2 : 1])
|
||||
bStyle = b[isIE ? 2 : 1];
|
||||
var isOldIE = tinymce.isIE && (!document.documentMode || document.documentMode < 9);
|
||||
|
||||
if (b.length == 3 && b[isOldIE ? 2 : 1])
|
||||
bStyle = b[isOldIE ? 2 : 1];
|
||||
else if (!bStyle || bStyle == 'none')
|
||||
bStyle = 'solid';
|
||||
if (b.length == 3 && b[isIE ? 0 : 2])
|
||||
bColor = b[isIE ? 0 : 2];
|
||||
bColor = b[isOldIE ? 0 : 2];
|
||||
else if (!bColor || bColor == 'none')
|
||||
bColor = 'black';
|
||||
img.style.border = v + 'px ' + bStyle + ' ' + bColor;
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
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"});
|
||||
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"});
|
||||
|
|
@ -54,6 +54,13 @@ function init() {
|
|||
document.getElementById('popupurl').style.width = '180px';
|
||||
|
||||
elm = inst.dom.getParent(elm, "A");
|
||||
if (elm == null) {
|
||||
var prospect = inst.dom.create("p", null, inst.selection.getContent());
|
||||
if (prospect.childNodes.length === 1) {
|
||||
elm = prospect.firstChild;
|
||||
}
|
||||
}
|
||||
|
||||
if (elm != null && elm.nodeName == "A")
|
||||
action = "update";
|
||||
|
||||
|
|
@ -481,7 +488,7 @@ function getLinkListHTML(elm_id, target_form_element, onchange_func) {
|
|||
var html = "";
|
||||
|
||||
html += '<select id="' + elm_id + '" name="' + elm_id + '"';
|
||||
html += ' class="mceLinkList" onfoc2us="tinyMCE.addSelectAccessibility(event, this, window);" onchange="this.form.' + target_form_element + '.value=';
|
||||
html += ' class="mceLinkList" onchange="this.form.' + target_form_element + '.value=';
|
||||
html += 'this.options[this.selectedIndex].value;';
|
||||
|
||||
if (typeof(onchange_func) != "undefined")
|
||||
|
|
@ -503,7 +510,7 @@ function getTargetListHTML(elm_id, target_form_element) {
|
|||
var targets = tinyMCEPopup.getParam('theme_advanced_link_targets', '').split(';');
|
||||
var html = '';
|
||||
|
||||
html += '<select id="' + elm_id + '" name="' + elm_id + '" onf2ocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="this.form.' + target_form_element + '.value=';
|
||||
html += '<select id="' + elm_id + '" name="' + elm_id + '" onchange="this.form.' + target_form_element + '.value=';
|
||||
html += 'this.options[this.selectedIndex].value;">';
|
||||
html += '<option value="_self">' + tinyMCEPopup.getLang('advlink_dlg.target_same') + '</option>';
|
||||
html += '<option value="_blank">' + tinyMCEPopup.getLang('advlink_dlg.target_blank') + ' (_blank)</option>';
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
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 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"});
|
||||
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"});
|
||||
|
|
@ -1 +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)})();
|
||||
(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)})();
|
||||
|
|
@ -41,7 +41,7 @@
|
|||
},
|
||||
|
||||
createControl: function(name, cm) {
|
||||
var t = this, btn, format;
|
||||
var t = this, btn, format, editor = t.editor;
|
||||
|
||||
if (name == 'numlist' || name == 'bullist') {
|
||||
// Default to first item if it's a default item
|
||||
|
|
@ -53,7 +53,7 @@
|
|||
|
||||
each(format.styles, function(value, name) {
|
||||
// Format doesn't match
|
||||
if (t.editor.dom.getStyle(node, name) != value) {
|
||||
if (editor.dom.getStyle(node, name) != value) {
|
||||
state = false;
|
||||
return false;
|
||||
}
|
||||
|
|
@ -63,14 +63,14 @@
|
|||
};
|
||||
|
||||
function applyListFormat() {
|
||||
var list, ed = t.editor, dom = ed.dom, sel = ed.selection;
|
||||
var list, dom = editor.dom, sel = editor.selection;
|
||||
|
||||
// Check for existing list element
|
||||
list = dom.getParent(sel.getNode(), 'ol,ul');
|
||||
|
||||
// Switch/add list type if needed
|
||||
if (!list || list.nodeName == (name == 'bullist' ? 'OL' : 'UL') || hasFormat(list, format))
|
||||
ed.execCommand(name == 'bullist' ? 'InsertUnorderedList' : 'InsertOrderedList');
|
||||
editor.execCommand(name == 'bullist' ? 'InsertUnorderedList' : 'InsertOrderedList');
|
||||
|
||||
// Append styles to new list element
|
||||
if (format) {
|
||||
|
|
@ -80,7 +80,8 @@
|
|||
list.removeAttribute('data-mce-style');
|
||||
}
|
||||
}
|
||||
ed.focus();
|
||||
|
||||
editor.focus();
|
||||
};
|
||||
|
||||
btn = cm.createSplitButton(name, {
|
||||
|
|
@ -92,8 +93,15 @@
|
|||
});
|
||||
|
||||
btn.onRenderMenu.add(function(btn, menu) {
|
||||
menu.onHideMenu.add(function() {
|
||||
if (t.bookmark) {
|
||||
editor.selection.moveToBookmark(t.bookmark);
|
||||
t.bookmark = 0;
|
||||
}
|
||||
});
|
||||
|
||||
menu.onShowMenu.add(function() {
|
||||
var dom = t.editor.dom, list = dom.getParent(t.editor.selection.getNode(), 'ol,ul'), fmtList;
|
||||
var dom = editor.dom, list = dom.getParent(editor.selection.getNode(), 'ol,ul'), fmtList;
|
||||
|
||||
if (list || format) {
|
||||
fmtList = t[name];
|
||||
|
|
@ -123,16 +131,23 @@
|
|||
if (!list)
|
||||
menu.items[format.id].setSelected(1);
|
||||
}
|
||||
|
||||
editor.focus();
|
||||
|
||||
// IE looses it's selection so store it away and restore it later
|
||||
if (tinymce.isIE) {
|
||||
t.bookmark = editor.selection.getBookmark(1);
|
||||
}
|
||||
});
|
||||
|
||||
menu.add({id : t.editor.dom.uniqueId(), title : 'advlist.types', 'class' : 'mceMenuItemTitle', titleItem: true}).setDisabled(1);
|
||||
menu.add({id : editor.dom.uniqueId(), title : 'advlist.types', 'class' : 'mceMenuItemTitle', titleItem: true}).setDisabled(1);
|
||||
|
||||
each(t[name], function(item) {
|
||||
// IE<8 doesn't support lower-greek, skip it
|
||||
if (t.isIE7 && item.styles.listStyleType == 'lower-greek')
|
||||
return;
|
||||
|
||||
item.id = t.editor.dom.uniqueId();
|
||||
item.id = editor.dom.uniqueId();
|
||||
|
||||
menu.add({id : item.id, title : item.title, onclick : function() {
|
||||
format = item;
|
||||
|
|
|
|||
|
|
@ -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)}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)})();
|
||||
(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);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)}}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)})();
|
||||
|
|
@ -22,17 +22,20 @@
|
|||
init : function(ed, url) {
|
||||
var t = this;
|
||||
|
||||
// Internet Explorer has built-in automatic linking
|
||||
// Add a key down handler
|
||||
ed.onKeyDown.addToTop(function(ed, e) {
|
||||
if (e.keyCode == 13)
|
||||
return t.handleEnter(ed);
|
||||
});
|
||||
|
||||
// Internet Explorer has built-in automatic linking for most cases
|
||||
if (tinyMCE.isIE)
|
||||
return;
|
||||
|
||||
// Add a key down handler
|
||||
ed.onKeyDown.add(function(ed, e) {
|
||||
if (e.keyCode == 13)
|
||||
return t.handleEnter(ed);
|
||||
if (e.shiftKey && e.keyCode == 48)
|
||||
ed.onKeyPress.add(function(ed, e) {
|
||||
if (e.which == 41)
|
||||
return t.handleEclipse(ed);
|
||||
});
|
||||
});
|
||||
|
||||
// Add a key up handler
|
||||
ed.onKeyUp.add(function(ed, e) {
|
||||
|
|
@ -58,7 +61,7 @@
|
|||
|
||||
// We need at least five characters to form a URL,
|
||||
// hence, at minimum, five characters from the beginning of the line.
|
||||
r = ed.selection.getRng().cloneRange();
|
||||
r = ed.selection.getRng(true).cloneRange();
|
||||
if (r.startOffset < 5) {
|
||||
// During testing, the caret is placed inbetween two text nodes.
|
||||
// The previous text node contains the URL.
|
||||
|
|
@ -86,8 +89,11 @@
|
|||
while (endContainer.nodeType != 3 && endContainer.firstChild)
|
||||
endContainer = endContainer.firstChild;
|
||||
|
||||
r.setStart(endContainer, 0);
|
||||
r.setEnd(endContainer, endContainer.nodeValue.length);
|
||||
// Move range to text node
|
||||
if (endContainer.nodeType == 3) {
|
||||
r.setStart(endContainer, 0);
|
||||
r.setEnd(endContainer, endContainer.nodeValue.length);
|
||||
}
|
||||
}
|
||||
|
||||
if (r.endOffset == 1)
|
||||
|
|
@ -121,19 +127,28 @@
|
|||
r.setEnd(endContainer, start);
|
||||
}
|
||||
|
||||
// Exclude last . from word like "www.site.com."
|
||||
var text = r.toString();
|
||||
if (text.charAt(text.length - 1) == '.') {
|
||||
r.setEnd(endContainer, start - 1);
|
||||
}
|
||||
|
||||
text = r.toString();
|
||||
matches = text.match(/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.)(.+)$/i);
|
||||
matches = text.match(/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+-]+@)(.+)$/i);
|
||||
|
||||
if (matches) {
|
||||
if (matches[1] == 'www.') {
|
||||
matches[1] = 'http://www.';
|
||||
} else if (/@$/.test(matches[1]) && !/^mailto:/.test(matches[1])) {
|
||||
matches[1] = 'mailto:' + matches[1];
|
||||
}
|
||||
|
||||
bookmark = ed.selection.getBookmark();
|
||||
|
||||
ed.selection.setRng(r);
|
||||
tinyMCE.execCommand('mceInsertLink',false, matches[1] + matches[2]);
|
||||
tinyMCE.execCommand('createlink',false, matches[1] + matches[2]);
|
||||
ed.selection.moveToBookmark(bookmark);
|
||||
ed.nodeChanged();
|
||||
|
||||
// TODO: Determine if this is still needed.
|
||||
if (tinyMCE.isWebKit) {
|
||||
|
|
|
|||
|
|
@ -1 +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)})();
|
||||
(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)})();
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
(function() {
|
||||
/**
|
||||
* Auto Resize
|
||||
*
|
||||
*
|
||||
* This plugin automatically resizes the content area to fit its content height.
|
||||
* It will retain a minimum height, which is the height of the content area when
|
||||
* it's initialized.
|
||||
|
|
@ -35,38 +35,51 @@
|
|||
* This method gets executed each time the editor needs to resize.
|
||||
*/
|
||||
function resize() {
|
||||
var d = ed.getDoc(), b = d.body, de = d.documentElement, DOM = tinymce.DOM, resizeHeight = t.autoresize_min_height, myHeight;
|
||||
var deltaSize, d = ed.getDoc(), body = d.body, de = d.documentElement, DOM = tinymce.DOM, resizeHeight = t.autoresize_min_height, myHeight;
|
||||
|
||||
// Get height differently depending on the browser used
|
||||
myHeight = tinymce.isIE ? b.scrollHeight : de.offsetHeight;
|
||||
|
||||
// Bottom margin
|
||||
myHeight = t.bottom_margin + myHeight;
|
||||
myHeight = tinymce.isIE ? body.scrollHeight : (tinymce.isWebKit && body.clientHeight == 0 ? 0 : body.offsetHeight);
|
||||
|
||||
// Don't make it smaller than the minimum height
|
||||
if (myHeight > t.autoresize_min_height)
|
||||
resizeHeight = myHeight;
|
||||
|
||||
// Resize content element
|
||||
if ( resizeHeight !== oldSize ) {
|
||||
DOM.setStyle(DOM.get(ed.id + '_ifr'), 'height', resizeHeight + 'px');
|
||||
oldSize = resizeHeight;
|
||||
// If a maximum height has been defined don't exceed this height
|
||||
if (t.autoresize_max_height && myHeight > t.autoresize_max_height) {
|
||||
resizeHeight = t.autoresize_max_height;
|
||||
body.style.overflowY = "auto";
|
||||
de.style.overflowY = "auto"; // Old IE
|
||||
} else {
|
||||
body.style.overflowY = "hidden";
|
||||
de.style.overflowY = "hidden"; // Old IE
|
||||
body.scrollTop = 0;
|
||||
}
|
||||
|
||||
// if we're throbbing, we'll re-throb to match the new size
|
||||
if (t.throbbing) {
|
||||
ed.setProgressState(false);
|
||||
ed.setProgressState(true);
|
||||
// Resize content element
|
||||
if (resizeHeight !== oldSize) {
|
||||
deltaSize = resizeHeight - oldSize;
|
||||
DOM.setStyle(DOM.get(ed.id + '_ifr'), 'height', resizeHeight + 'px');
|
||||
oldSize = resizeHeight;
|
||||
|
||||
// WebKit doesn't decrease the size of the body element until the iframe gets resized
|
||||
// So we need to continue to resize the iframe down until the size gets fixed
|
||||
if (tinymce.isWebKit && deltaSize < 0)
|
||||
resize();
|
||||
}
|
||||
};
|
||||
|
||||
t.editor = ed;
|
||||
|
||||
// Define minimum height
|
||||
t.autoresize_min_height = ed.getElement().offsetHeight;
|
||||
t.autoresize_min_height = parseInt(ed.getParam('autoresize_min_height', ed.getElement().offsetHeight));
|
||||
|
||||
// Add margin at the bottom for better UX
|
||||
t.bottom_margin = parseInt( ed.getParam('autoresize_bottom_margin', 50) );
|
||||
// Define maximum height
|
||||
t.autoresize_max_height = parseInt(ed.getParam('autoresize_max_height', 0));
|
||||
|
||||
// Add padding at the bottom for better UX
|
||||
ed.onInit.add(function(ed){
|
||||
ed.dom.setStyle(ed.getBody(), 'paddingBottom', ed.getParam('autoresize_bottom_margin', 50) + 'px');
|
||||
});
|
||||
|
||||
// Add appropriate listeners for resizing content area
|
||||
ed.onChange.add(resize);
|
||||
|
|
@ -76,30 +89,8 @@
|
|||
ed.onPostRender.add(resize);
|
||||
|
||||
if (ed.getParam('autoresize_on_init', true)) {
|
||||
// Things to do when the editor is ready
|
||||
ed.onInit.add(function(ed, l) {
|
||||
// Show throbber until content area is resized properly
|
||||
ed.setProgressState(true);
|
||||
t.throbbing = true;
|
||||
|
||||
// Hide scrollbars
|
||||
ed.getBody().style.overflowY = "hidden";
|
||||
});
|
||||
|
||||
ed.onLoadContent.add(function(ed, l) {
|
||||
resize();
|
||||
|
||||
// Because the content area resizes when its content CSS loads,
|
||||
// and we can't easily add a listener to its onload event,
|
||||
// we'll just trigger a resize after a short loading period
|
||||
setTimeout(function() {
|
||||
resize();
|
||||
|
||||
// Disable throbber
|
||||
ed.setProgressState(false);
|
||||
t.throbbing = false;
|
||||
}, 1250);
|
||||
});
|
||||
ed.onLoad.add(resize);
|
||||
ed.onLoadContent.add(resize);
|
||||
}
|
||||
|
||||
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
|
||||
|
|
|
|||
|
|
@ -1 +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);
|
||||
(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);
|
||||
|
|
@ -136,8 +136,10 @@
|
|||
|
||||
// Auto save contents each interval time
|
||||
setInterval(function() {
|
||||
self.storeDraft();
|
||||
ed.nodeChanged();
|
||||
if (!ed.removed) {
|
||||
self.storeDraft();
|
||||
ed.nodeChanged();
|
||||
}
|
||||
}, settings.autosave_interval);
|
||||
}
|
||||
});
|
||||
|
|
@ -335,7 +337,7 @@
|
|||
* @method restoreDraft
|
||||
*/
|
||||
restoreDraft : function() {
|
||||
var self = this, storage = self.storage;
|
||||
var self = this, storage = self.storage, content;
|
||||
|
||||
if (storage) {
|
||||
content = storage.getItem(self.key);
|
||||
|
|
|
|||
|
|
@ -1 +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)})();
|
||||
(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)})();
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
* @param {string} url Absolute URL to where the plugin is located.
|
||||
*/
|
||||
init : function(ed) {
|
||||
var t = this, showMenu, contextmenuNeverUseNative, realCtrlKey;
|
||||
var t = this, showMenu, contextmenuNeverUseNative, realCtrlKey, hideMenu;
|
||||
|
||||
t.editor = ed;
|
||||
|
||||
|
|
@ -42,6 +42,10 @@
|
|||
*/
|
||||
t.onContextMenu = new tinymce.util.Dispatcher(this);
|
||||
|
||||
hideMenu = function(e) {
|
||||
hide(ed, e);
|
||||
};
|
||||
|
||||
showMenu = ed.onContextMenu.add(function(ed, e) {
|
||||
// Block TinyMCE menu on ctrlKey and work around Safari issue
|
||||
if ((realCtrlKey !== 0 ? realCtrlKey : e.ctrlKey) && !contextmenuNeverUseNative)
|
||||
|
|
@ -53,14 +57,12 @@
|
|||
if (e.target.nodeName == 'IMG')
|
||||
ed.selection.select(e.target);
|
||||
|
||||
t._getMenu(ed).showMenu(e.clientX || e.pageX, e.clientY || e.pageX);
|
||||
Event.add(ed.getDoc(), 'click', function(e) {
|
||||
hide(ed, e);
|
||||
});
|
||||
t._getMenu(ed).showMenu(e.clientX || e.pageX, e.clientY || e.pageY);
|
||||
Event.add(ed.getDoc(), 'click', hideMenu);
|
||||
|
||||
ed.nodeChanged();
|
||||
});
|
||||
|
||||
|
||||
ed.onRemove.add(function() {
|
||||
if (t._menu)
|
||||
t._menu.removeAll();
|
||||
|
|
@ -78,8 +80,9 @@
|
|||
|
||||
if (t._menu) {
|
||||
t._menu.removeAll();
|
||||
t._menu.destroy();
|
||||
Event.remove(ed.getDoc(), 'click', hide);
|
||||
t._menu.destroy();
|
||||
Event.remove(ed.getDoc(), 'click', hideMenu);
|
||||
t._menu = null;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -111,19 +114,18 @@
|
|||
},
|
||||
|
||||
_getMenu : function(ed) {
|
||||
var t = this, m = t._menu, se = ed.selection, col = se.isCollapsed(), el = se.getNode() || ed.getBody(), am, p1, p2;
|
||||
var t = this, m = t._menu, se = ed.selection, col = se.isCollapsed(), el = se.getNode() || ed.getBody(), am, p;
|
||||
|
||||
if (m) {
|
||||
m.removeAll();
|
||||
m.destroy();
|
||||
}
|
||||
|
||||
p1 = DOM.getPos(ed.getContentAreaContainer());
|
||||
p2 = DOM.getPos(ed.getContainer());
|
||||
p = DOM.getPos(ed.getContentAreaContainer());
|
||||
|
||||
m = ed.controlManager.createDropMenu('contextmenu', {
|
||||
offset_x : p1.x + ed.getParam('contextmenu_offset_x', 0),
|
||||
offset_y : p1.y + ed.getParam('contextmenu_offset_y', 0),
|
||||
offset_x : p.x + ed.getParam('contextmenu_offset_x', 0),
|
||||
offset_y : p.y + ed.getParam('contextmenu_offset_y', 0),
|
||||
constrain : 1,
|
||||
keyboard_focus: true
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1 +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)})();
|
||||
(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)})();
|
||||
|
|
@ -15,30 +15,33 @@
|
|||
|
||||
t.editor = ed;
|
||||
|
||||
ed.addCommand('mceDirectionLTR', function() {
|
||||
var e = ed.dom.getParent(ed.selection.getNode(), ed.dom.isBlock);
|
||||
function setDir(dir) {
|
||||
var dom = ed.dom, curDir, blocks = ed.selection.getSelectedBlocks();
|
||||
|
||||
if (e) {
|
||||
if (ed.dom.getAttrib(e, "dir") != "ltr")
|
||||
ed.dom.setAttrib(e, "dir", "ltr");
|
||||
else
|
||||
ed.dom.setAttrib(e, "dir", "");
|
||||
if (blocks.length) {
|
||||
curDir = dom.getAttrib(blocks[0], "dir");
|
||||
|
||||
tinymce.each(blocks, function(block) {
|
||||
// Add dir to block if the parent block doesn't already have that dir
|
||||
if (!dom.getParent(block.parentNode, "*[dir='" + dir + "']", dom.getRoot())) {
|
||||
if (curDir != dir) {
|
||||
dom.setAttrib(block, "dir", dir);
|
||||
} else {
|
||||
dom.setAttrib(block, "dir", null);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
ed.nodeChanged();
|
||||
}
|
||||
}
|
||||
|
||||
ed.nodeChanged();
|
||||
ed.addCommand('mceDirectionLTR', function() {
|
||||
setDir("ltr");
|
||||
});
|
||||
|
||||
ed.addCommand('mceDirectionRTL', function() {
|
||||
var e = ed.dom.getParent(ed.selection.getNode(), ed.dom.isBlock);
|
||||
|
||||
if (e) {
|
||||
if (ed.dom.getAttrib(e, "dir") != "rtl")
|
||||
ed.dom.setAttrib(e, "dir", "rtl");
|
||||
else
|
||||
ed.dom.setAttrib(e, "dir", "");
|
||||
}
|
||||
|
||||
ed.nodeChanged();
|
||||
setDir("rtl");
|
||||
});
|
||||
|
||||
ed.addButton('ltr', {title : 'directionality.ltr_desc', cmd : 'mceDirectionLTR'});
|
||||
|
|
|
|||
|
|
@ -10,32 +10,33 @@
|
|||
<div align="center">
|
||||
<div class="title">{#emotions_dlg.title}:<br /><br /></div>
|
||||
|
||||
<table role="presentation" border="0" cellspacing="0" cellpadding="4">
|
||||
<table id="emoticon_table" role="presentation" border="0" cellspacing="0" cellpadding="4">
|
||||
<tr>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
</tr>
|
||||
<tr>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
</tr>
|
||||
<tr>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
</tr>
|
||||
<tr>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
</tr>
|
||||
</table>
|
||||
<div>{#emotions_dlg.usage}</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 344 B After Width: | Height: | Size: 342 B |
|
Before Width: | Height: | Size: 344 B After Width: | Height: | Size: 343 B |
|
Before Width: | Height: | Size: 325 B After Width: | Height: | Size: 323 B |
|
Before Width: | Height: | Size: 345 B After Width: | Height: | Size: 344 B |
|
Before Width: | Height: | Size: 342 B After Width: | Height: | Size: 338 B |
|
Before Width: | Height: | Size: 351 B After Width: | Height: | Size: 350 B |
|
|
@ -1,8 +1,29 @@
|
|||
tinyMCEPopup.requireLangPack();
|
||||
|
||||
var EmotionsDialog = {
|
||||
addKeyboardNavigation: function(){
|
||||
var tableElm, cells, settings;
|
||||
|
||||
cells = tinyMCEPopup.dom.select("a.emoticon_link", "emoticon_table");
|
||||
|
||||
settings ={
|
||||
root: "emoticon_table",
|
||||
items: cells
|
||||
};
|
||||
cells[0].tabindex=0;
|
||||
tinyMCEPopup.dom.addClass(cells[0], "mceFocus");
|
||||
if (tinymce.isGecko) {
|
||||
cells[0].focus();
|
||||
} else {
|
||||
setTimeout(function(){
|
||||
cells[0].focus();
|
||||
}, 100);
|
||||
}
|
||||
tinyMCEPopup.editor.windowManager.createInstance('tinymce.ui.KeyboardNavigation', settings, tinyMCEPopup.dom);
|
||||
},
|
||||
init : function(ed) {
|
||||
tinyMCEPopup.resizeToInnerSize();
|
||||
this.addKeyboardNavigation();
|
||||
},
|
||||
|
||||
insert : function(file, title) {
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
tinyMCE.addI18n('en.emotions_dlg',{cry:"Cry",cool:"Cool",desc:"Emotions",title:"Insert emotion",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"});
|
||||
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"});
|
||||
|
|
|
|||
1
www/extras/tinymce/jscripts/tiny_mce/plugins/example_dependency/editor_plugin.js
vendored
Normal file
|
|
@ -0,0 +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"])})();
|
||||
50
www/extras/tinymce/jscripts/tiny_mce/plugins/example_dependency/editor_plugin_src.js
vendored
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
/**
|
||||
* editor_plugin_src.js
|
||||
*
|
||||
* Copyright 2009, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
*
|
||||
* License: http://tinymce.moxiecode.com/license
|
||||
* Contributing: http://tinymce.moxiecode.com/contributing
|
||||
*/
|
||||
|
||||
(function() {
|
||||
|
||||
tinymce.create('tinymce.plugins.ExampleDependencyPlugin', {
|
||||
/**
|
||||
* Initializes the plugin, this will be executed after the plugin has been created.
|
||||
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
||||
* of the editor instance to intercept that event.
|
||||
*
|
||||
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
||||
* @param {string} url Absolute URL to where the plugin is located.
|
||||
*/
|
||||
init : function(ed, url) {
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Returns information about the plugin as a name/value array.
|
||||
* The current keys are longname, author, authorurl, infourl and version.
|
||||
*
|
||||
* @return {Object} Name/value array containing information about the plugin.
|
||||
*/
|
||||
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"
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* plugins in this list will be initialised when this plugin is initialized. (before the init method is called).
|
||||
* plugins in a depends list should typically be specified using the short name). If neccesary this can be done
|
||||
* with an object which has the url to the plugin and the shortname.
|
||||
*/
|
||||
tinymce.PluginManager.add('example_dependency', tinymce.plugins.ExampleDependencyPlugin, ['example']);
|
||||
})();
|
||||
|
|
@ -351,10 +351,16 @@
|
|||
});
|
||||
}
|
||||
|
||||
if (styles)
|
||||
dom.remove('fullpage_styles');
|
||||
|
||||
if (styles) {
|
||||
dom.add(self.editor.getDoc().getElementsByTagName('head')[0], 'style', {id : 'fullpage_styles'}, styles);
|
||||
else
|
||||
dom.remove('fullpage_styles');
|
||||
|
||||
// Needed for IE 6/7
|
||||
elm = dom.get('fullpage_styles');
|
||||
if (elm.styleSheet)
|
||||
elm.styleSheet.cssText = styles;
|
||||
}
|
||||
},
|
||||
|
||||
_getDefaultHeader : function() {
|
||||
|
|
@ -367,7 +373,7 @@
|
|||
header += '\n<html>\n<head>\n';
|
||||
|
||||
if (value = editor.getParam('fullpage_default_title'))
|
||||
header += '<title>' + v + '</title>\n';
|
||||
header += '<title>' + value + '</title>\n';
|
||||
|
||||
if (value = editor.getParam('fullpage_default_encoding'))
|
||||
header += '<meta http-equiv="Content-Type" content="text/html; charset=' + value + '" />\n';
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
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:"Src",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"});
|
||||
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"});
|
||||
|
|
@ -1 +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)})();
|
||||
(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());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||document.compatMode=="BackCompat"){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());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().getElementsByTagName("table")[0]);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)})();
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
else {
|
||||
DOM.win.setTimeout(function() {
|
||||
tinymce.dom.Event.remove(DOM.win, 'resize', t.resizeFunc);
|
||||
tinyMCE.get(ed.getParam('fullscreen_editor_id')).setContent(ed.getContent({format : 'raw'}), {format : 'raw'});
|
||||
tinyMCE.get(ed.getParam('fullscreen_editor_id')).setContent(ed.getContent());
|
||||
tinyMCE.remove(ed);
|
||||
DOM.remove('mce_fullscreen_container');
|
||||
de.style.overflow = ed.getParam('fullscreen_html_overflow');
|
||||
|
|
@ -65,7 +65,7 @@
|
|||
|
||||
// Fixes an IE bug where the scrollbars doesn't reappear
|
||||
if (tinymce.isIE && (s.fullscreen_html_overflow == 'visible' || s.fullscreen_html_overflow == 'scroll'))
|
||||
s.fullscreen_html_overflow = 'auto';
|
||||
s.fullscreen_html_overflow = 'auto';
|
||||
|
||||
if (s.fullscreen_overflow == '0px')
|
||||
s.fullscreen_overflow = '';
|
||||
|
|
@ -79,13 +79,13 @@
|
|||
vp.h -= 1;
|
||||
|
||||
// Use fixed position if it exists
|
||||
if (tinymce.isIE6)
|
||||
if (tinymce.isIE6 || document.compatMode == 'BackCompat')
|
||||
posCss = 'absolute;top:' + vp.y;
|
||||
else
|
||||
posCss = 'fixed;top:0';
|
||||
|
||||
n = DOM.add(DOM.doc.body, 'div', {
|
||||
id : 'mce_fullscreen_container',
|
||||
id : 'mce_fullscreen_container',
|
||||
style : 'position:' + posCss + ';left:0;width:' + vp.w + 'px;height:' + vp.h + 'px;z-index:200000;'});
|
||||
DOM.add(n, 'div', {id : 'mce_fullscreen'});
|
||||
|
||||
|
|
@ -100,7 +100,7 @@
|
|||
s.fullscreen_editor_id = ed.id;
|
||||
s.theme_advanced_resizing = false;
|
||||
s.save_onsavecallback = function() {
|
||||
ed.setContent(tinyMCE.get(s.id).getContent({format : 'raw'}), {format : 'raw'});
|
||||
ed.setContent(tinyMCE.get(s.id).getContent());
|
||||
ed.execCommand('mceSave');
|
||||
};
|
||||
|
||||
|
|
@ -127,7 +127,7 @@
|
|||
var vp = tinymce.DOM.getViewPort(), fed = t.fullscreenEditor, outerSize, innerSize;
|
||||
|
||||
// Get outer/inner size to get a delta size that can be used to calc the new iframe size
|
||||
outerSize = fed.dom.getSize(fed.getContainer().firstChild);
|
||||
outerSize = fed.dom.getSize(fed.getContainer().getElementsByTagName('table')[0]);
|
||||
innerSize = fed.dom.getSize(fed.getContainer().getElementsByTagName('iframe')[0]);
|
||||
|
||||
fed.theme.resizeTo(vp.w - outerSize.w + innerSize.w, vp.h - outerSize.h + innerSize.h);
|
||||
|
|
@ -156,4 +156,4 @@
|
|||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('fullscreen', tinymce.plugins.FullScreenPlugin);
|
||||
})();
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title></title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<script type="text/javascript" src="../../tiny_mce.js"></script>
|
||||
<script type="text/javascript">
|
||||
function patchCallback(settings, key) {
|
||||
|
|
|
|||
|
|
@ -219,7 +219,10 @@
|
|||
t.focus(id);
|
||||
|
||||
if (n.nodeName == 'A' || n.nodeName == 'a') {
|
||||
if (n.className == 'mceMax') {
|
||||
if (n.className == 'mceClose') {
|
||||
t.close(null, id);
|
||||
return Event.cancel(e);
|
||||
} else if (n.className == 'mceMax') {
|
||||
w.oldPos = w.element.getXY();
|
||||
w.oldSize = w.element.getSize();
|
||||
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 818 B After Width: | Height: | Size: 810 B |
|
Before Width: | Height: | Size: 280 B After Width: | Height: | Size: 272 B |
|
Before Width: | Height: | Size: 915 B After Width: | Height: | Size: 907 B |
|
Before Width: | Height: | Size: 911 B After Width: | Height: | Size: 909 B |
|
Before Width: | Height: | Size: 92 B After Width: | Height: | Size: 84 B |
|
|
@ -1 +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)})();
|
||||
(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)})();
|
||||
|
|
@ -9,6 +9,14 @@
|
|||
*/
|
||||
|
||||
(function() {
|
||||
function findParentLayer(node) {
|
||||
do {
|
||||
if (node.className && node.className.indexOf('mceItemLayer') != -1) {
|
||||
return node;
|
||||
}
|
||||
} while (node = node.parentNode);
|
||||
};
|
||||
|
||||
tinymce.create('tinymce.plugins.Layer', {
|
||||
init : function(ed, url) {
|
||||
var t = this;
|
||||
|
|
@ -37,10 +45,43 @@
|
|||
ed.addButton('insertlayer', {title : 'layer.insertlayer_desc', cmd : 'mceInsertLayer'});
|
||||
|
||||
ed.onInit.add(function() {
|
||||
var dom = ed.dom;
|
||||
|
||||
if (tinymce.isIE)
|
||||
ed.getDoc().execCommand('2D-Position', false, true);
|
||||
});
|
||||
|
||||
// Remove serialized styles when selecting a layer since it might be changed by a drag operation
|
||||
ed.onMouseUp.add(function(ed, e) {
|
||||
var layer = findParentLayer(e.target);
|
||||
|
||||
if (layer) {
|
||||
ed.dom.setAttrib(layer, 'data-mce-style', '');
|
||||
}
|
||||
});
|
||||
|
||||
// Fixes edit focus issues with layers on Gecko
|
||||
// This will enable designMode while inside a layer and disable it when outside
|
||||
ed.onMouseDown.add(function(ed, e) {
|
||||
var node = e.target, doc = ed.getDoc(), parent;
|
||||
|
||||
if (tinymce.isGecko) {
|
||||
if (findParentLayer(node)) {
|
||||
if (doc.designMode !== 'on') {
|
||||
doc.designMode = 'on';
|
||||
|
||||
// Repaint caret
|
||||
node = doc.body;
|
||||
parent = node.parentNode;
|
||||
parent.removeChild(node);
|
||||
parent.appendChild(node);
|
||||
}
|
||||
} else if (doc.designMode == 'on') {
|
||||
doc.designMode = 'off';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
ed.onNodeChange.add(t._nodeChange, t);
|
||||
ed.onVisualAid.add(t._visualAid, t);
|
||||
},
|
||||
|
|
@ -81,11 +122,13 @@
|
|||
var dom = ed.dom;
|
||||
|
||||
tinymce.each(dom.select('div,p', e), function(e) {
|
||||
if (/^(absolute|relative|static)$/i.test(e.style.position)) {
|
||||
if (/^(absolute|relative|fixed)$/i.test(e.style.position)) {
|
||||
if (s)
|
||||
dom.addClass(e, 'mceItemVisualAid');
|
||||
else
|
||||
dom.removeClass(e, 'mceItemVisualAid');
|
||||
dom.removeClass(e, 'mceItemVisualAid');
|
||||
|
||||
dom.addClass(e, 'mceItemLayer');
|
||||
}
|
||||
});
|
||||
},
|
||||
|
|
@ -153,9 +196,9 @@
|
|||
},
|
||||
|
||||
_insertLayer : function() {
|
||||
var ed = this.editor, p = ed.dom.getPos(ed.dom.getParent(ed.selection.getNode(), '*'));
|
||||
var ed = this.editor, dom = ed.dom, p = dom.getPos(dom.getParent(ed.selection.getNode(), '*')), body = ed.getBody();
|
||||
|
||||
ed.dom.add(ed.getBody(), 'div', {
|
||||
ed.dom.add(body, 'div', {
|
||||
style : {
|
||||
position : 'absolute',
|
||||
left : p.x,
|
||||
|
|
@ -163,8 +206,12 @@
|
|||
width : 100,
|
||||
height : 100
|
||||
},
|
||||
'class' : 'mceItemVisualAid'
|
||||
'class' : 'mceItemVisualAid mceItemLayer'
|
||||
}, ed.selection.getContent() || ed.getLang('layer.content'));
|
||||
|
||||
// Workaround for IE where it messes up the JS engine if you insert a layer on IE 6,7
|
||||
if (tinymce.isIE)
|
||||
dom.setHTML(body, body.innerHTML);
|
||||
},
|
||||
|
||||
_toggleAbsolute : function() {
|
||||
|
|
@ -184,6 +231,7 @@
|
|||
});
|
||||
|
||||
ed.dom.removeClass(le, 'mceItemVisualAid');
|
||||
ed.dom.removeClass(le, 'mceItemLayer');
|
||||
} else {
|
||||
if (le.style.left == "")
|
||||
le.style.left = 20 + 'px';
|
||||
|
|
|
|||
|
|
@ -1 +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);
|
||||
(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);
|
||||
|
|
@ -68,7 +68,7 @@
|
|||
},
|
||||
|
||||
// Setup font elements for colors as well
|
||||
forecolor : {inline : 'font', styles : {color : '%value'}},
|
||||
forecolor : {inline : 'font', attributes : {color : '%value'}},
|
||||
hilitecolor : {inline : 'font', styles : {backgroundColor : '%value'}}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -18,25 +18,29 @@
|
|||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
|
||||
function skipWhitespaceNodesBackwards(e) {
|
||||
return skipWhitespaceNodes(e, function(e) { return e.previousSibling; });
|
||||
return skipWhitespaceNodes(e, function(e) {
|
||||
return e.previousSibling;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function skipWhitespaceNodesForwards(e) {
|
||||
return skipWhitespaceNodes(e, function(e) { return e.nextSibling; });
|
||||
return skipWhitespaceNodes(e, function(e) {
|
||||
return e.nextSibling;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function hasParentInList(ed, e, list) {
|
||||
return ed.dom.getParent(e, function(p) {
|
||||
return tinymce.inArray(list, p) !== -1;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function isList(e) {
|
||||
return e && (e.tagName === 'OL' || e.tagName === 'UL');
|
||||
}
|
||||
|
||||
|
||||
function splitNestedLists(element, dom) {
|
||||
var tmp, nested, wrapItem;
|
||||
tmp = skipWhitespaceNodesBackwards(element.lastChild);
|
||||
|
|
@ -54,12 +58,12 @@
|
|||
}
|
||||
return element;
|
||||
}
|
||||
|
||||
|
||||
function attemptMergeWithAdjacent(e, allowDifferentListStyles, mergeParagraphs) {
|
||||
e = attemptMergeWithPrevious(e, allowDifferentListStyles, mergeParagraphs);
|
||||
return attemptMergeWithNext(e, allowDifferentListStyles, mergeParagraphs);
|
||||
}
|
||||
|
||||
|
||||
function attemptMergeWithPrevious(e, allowDifferentListStyles, mergeParagraphs) {
|
||||
var prev = skipWhitespaceNodesBackwards(e.previousSibling);
|
||||
if (prev) {
|
||||
|
|
@ -68,7 +72,7 @@
|
|||
return e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function attemptMergeWithNext(e, allowDifferentListStyles, mergeParagraphs) {
|
||||
var next = skipWhitespaceNodesForwards(e.nextSibling);
|
||||
if (next) {
|
||||
|
|
@ -77,7 +81,7 @@
|
|||
return e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function attemptMerge(e1, e2, differentStylesMasterElement, mergeParagraphs) {
|
||||
if (canMerge(e1, e2, !!differentStylesMasterElement, mergeParagraphs)) {
|
||||
return merge(e1, e2, differentStylesMasterElement);
|
||||
|
|
@ -87,7 +91,7 @@
|
|||
}
|
||||
return e2;
|
||||
}
|
||||
|
||||
|
||||
function canMerge(e1, e2, allowDifferentListStyles, mergeParagraphs) {
|
||||
if (!e1 || !e2) {
|
||||
return false;
|
||||
|
|
@ -95,23 +99,19 @@
|
|||
return e2.style.listStyleType === 'none' || containsOnlyAList(e2);
|
||||
} else if (isList(e1)) {
|
||||
return (e1.tagName === e2.tagName && (allowDifferentListStyles || e1.style.listStyleType === e2.style.listStyleType)) || isListForIndent(e2);
|
||||
} else if (mergeParagraphs && e1.tagName === 'P' && e2.tagName === 'P') {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else return mergeParagraphs && e1.tagName === 'P' && e2.tagName === 'P';
|
||||
}
|
||||
|
||||
|
||||
function isListForIndent(e) {
|
||||
var firstLI = skipWhitespaceNodesForwards(e.firstChild), lastLI = skipWhitespaceNodesBackwards(e.lastChild);
|
||||
return firstLI && lastLI && isList(e) && firstLI === lastLI && (isList(firstLI) || firstLI.style.listStyleType === 'none' || containsOnlyAList(firstLI));
|
||||
return firstLI && lastLI && isList(e) && firstLI === lastLI && (isList(firstLI) || firstLI.style.listStyleType === 'none' || containsOnlyAList(firstLI));
|
||||
}
|
||||
|
||||
|
||||
function containsOnlyAList(e) {
|
||||
var firstChild = skipWhitespaceNodesForwards(e.firstChild), lastChild = skipWhitespaceNodesBackwards(e.lastChild);
|
||||
return firstChild && lastChild && firstChild === lastChild && isList(firstChild);
|
||||
}
|
||||
|
||||
|
||||
function merge(e1, e2, masterElement) {
|
||||
var lastOriginal = skipWhitespaceNodesBackwards(e1.lastChild), firstNew = skipWhitespaceNodesForwards(e2.firstChild);
|
||||
if (e1.tagName === 'P') {
|
||||
|
|
@ -127,7 +127,7 @@
|
|||
attemptMerge(lastOriginal, firstNew, false);
|
||||
return e1;
|
||||
}
|
||||
|
||||
|
||||
function findItemToOperateOn(e, dom) {
|
||||
var item;
|
||||
if (!dom.is(e, 'li,ol,ul')) {
|
||||
|
|
@ -138,27 +138,219 @@
|
|||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
|
||||
tinymce.create('tinymce.plugins.Lists', {
|
||||
init: function(ed, url) {
|
||||
var enterDownInEmptyList = false;
|
||||
function isTriggerKey(e) {
|
||||
return e.keyCode === 9 && (ed.queryCommandState('InsertUnorderedList') || ed.queryCommandState('InsertOrderedList'));
|
||||
init: function(ed) {
|
||||
var LIST_TABBING = 'TABBING';
|
||||
var LIST_EMPTY_ITEM = 'EMPTY';
|
||||
var LIST_ESCAPE = 'ESCAPE';
|
||||
var LIST_PARAGRAPH = 'PARAGRAPH';
|
||||
var LIST_UNKNOWN = 'UNKNOWN';
|
||||
var state = LIST_UNKNOWN;
|
||||
|
||||
function isTabInList(e) {
|
||||
// Don't indent on Ctrl+Tab or Alt+Tab
|
||||
return e.keyCode === tinymce.VK.TAB && !(e.altKey || e.ctrlKey) &&
|
||||
(ed.queryCommandState('InsertUnorderedList') || ed.queryCommandState('InsertOrderedList'));
|
||||
}
|
||||
function isEnterInEmptyListItem(ed, e) {
|
||||
var sel = ed.selection, n;
|
||||
if (e.keyCode === 13) {
|
||||
n = sel.getStart();
|
||||
enterDownInEmptyList = sel.isCollapsed() && n && n.tagName === 'LI' && n.childNodes.length === 0;
|
||||
return enterDownInEmptyList;
|
||||
|
||||
function isOnLastListItem() {
|
||||
var li = getLi();
|
||||
var grandParent = li.parentNode.parentNode;
|
||||
var isLastItem = li.parentNode.lastChild === li;
|
||||
return isLastItem && !isNestedList(grandParent) && isEmptyListItem(li);
|
||||
}
|
||||
|
||||
function isNestedList(grandParent) {
|
||||
if (isList(grandParent)) {
|
||||
return grandParent.parentNode && grandParent.parentNode.tagName === 'LI';
|
||||
} else {
|
||||
return grandParent.tagName === 'LI';
|
||||
}
|
||||
}
|
||||
function cancelKeys(ed, e) {
|
||||
if (isTriggerKey(e) || isEnterInEmptyListItem(ed, e)) {
|
||||
return Event.cancel(e);
|
||||
|
||||
function isInEmptyListItem() {
|
||||
return ed.selection.isCollapsed() && isEmptyListItem(getLi());
|
||||
}
|
||||
|
||||
function getLi() {
|
||||
var n = ed.selection.getStart();
|
||||
// Get start will return BR if the LI only contains a BR or an empty element as we use these to fix caret position
|
||||
return ((n.tagName == 'BR' || n.tagName == '') && n.parentNode.tagName == 'LI') ? n.parentNode : n;
|
||||
}
|
||||
|
||||
function isEmptyListItem(li) {
|
||||
var numChildren = li.childNodes.length;
|
||||
if (li.tagName === 'LI') {
|
||||
return numChildren == 0 ? true : numChildren == 1 && (li.firstChild.tagName == '' || li.firstChild.tagName == 'BR' || isEmptyIE9Li(li));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function isEmptyIE9Li(li) {
|
||||
// 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
|
||||
var lis = tinymce.grep(li.parentNode.childNodes, function(n) {return n.tagName == 'LI'});
|
||||
var isLastLi = li == lis[lis.length - 1];
|
||||
var child = li.firstChild;
|
||||
return tinymce.isIE9 && isLastLi && (child.nodeValue == String.fromCharCode(160) || child.nodeValue == String.fromCharCode(32));
|
||||
}
|
||||
|
||||
function isEnter(e) {
|
||||
return e.keyCode === tinymce.VK.ENTER;
|
||||
}
|
||||
|
||||
function isEnterWithoutShift(e) {
|
||||
return isEnter(e) && !e.shiftKey;
|
||||
}
|
||||
|
||||
function getListKeyState(e) {
|
||||
if (isTabInList(e)) {
|
||||
return LIST_TABBING;
|
||||
} else if (isEnterWithoutShift(e) && isOnLastListItem()) {
|
||||
// Returns LIST_UNKNOWN since breaking out of lists is handled by the EnterKey.js logic now
|
||||
//return LIST_ESCAPE;
|
||||
return LIST_UNKNOWN;
|
||||
} else if (isEnterWithoutShift(e) && isInEmptyListItem()) {
|
||||
return LIST_EMPTY_ITEM;
|
||||
} else {
|
||||
return LIST_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function cancelDefaultEvents(ed, e) {
|
||||
// list escape is done manually using outdent as it does not create paragraphs correctly in td's
|
||||
if (state == LIST_TABBING || state == LIST_EMPTY_ITEM || tinymce.isGecko && state == LIST_ESCAPE) {
|
||||
Event.cancel(e);
|
||||
}
|
||||
}
|
||||
|
||||
function isCursorAtEndOfContainer() {
|
||||
var range = ed.selection.getRng(true);
|
||||
var startContainer = range.startContainer;
|
||||
if (startContainer.nodeType == 3) {
|
||||
var value = startContainer.nodeValue;
|
||||
if (tinymce.isIE9 && value.length > 1 && value.charCodeAt(value.length-1) == 32) {
|
||||
// IE9 places a space on the end of the text in some cases so ignore last char
|
||||
return (range.endOffset == value.length-1);
|
||||
} else {
|
||||
return (range.endOffset == value.length);
|
||||
}
|
||||
} else if (startContainer.nodeType == 1) {
|
||||
return range.endOffset == startContainer.childNodes.length;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
If we are at the end of a list item surrounded with an element, pressing enter should create a
|
||||
new list item instead without splitting the element e.g. don't want to create new P or H1 tag
|
||||
*/
|
||||
function isEndOfListItem() {
|
||||
var node = ed.selection.getNode();
|
||||
var validElements = 'h1,h2,h3,h4,h5,h6,p,div';
|
||||
var isLastParagraphOfLi = ed.dom.is(node, validElements) && node.parentNode.tagName === 'LI' && node.parentNode.lastChild === node;
|
||||
return ed.selection.isCollapsed() && isLastParagraphOfLi && isCursorAtEndOfContainer();
|
||||
}
|
||||
|
||||
// Creates a new list item after the current selection's list item parent
|
||||
function createNewLi(ed, e) {
|
||||
if (isEnterWithoutShift(e) && isEndOfListItem()) {
|
||||
var node = ed.selection.getNode();
|
||||
var li = ed.dom.create("li");
|
||||
var parentLi = ed.dom.getParent(node, 'li');
|
||||
ed.dom.insertAfter(li, parentLi);
|
||||
|
||||
// Move caret to new list element.
|
||||
if (tinymce.isIE6 || tinymce.isIE7 || tinyMCE.isIE8) {
|
||||
// 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
|
||||
//li.appendChild(ed.dom.create(" ")); // IE needs an element within the bullet point
|
||||
ed.selection.setCursorLocation(li, 1);
|
||||
} else {
|
||||
ed.selection.setCursorLocation(li, 0);
|
||||
}
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
function imageJoiningListItem(ed, e) {
|
||||
var prevSibling;
|
||||
|
||||
if (!tinymce.isGecko)
|
||||
return;
|
||||
|
||||
var n = ed.selection.getStart();
|
||||
if (e.keyCode != tinymce.VK.BACKSPACE || n.tagName !== 'IMG')
|
||||
return;
|
||||
|
||||
function lastLI(node) {
|
||||
var child = node.firstChild;
|
||||
var li = null;
|
||||
do {
|
||||
if (!child)
|
||||
break;
|
||||
|
||||
if (child.tagName === 'LI')
|
||||
li = child;
|
||||
} while (child = child.nextSibling);
|
||||
|
||||
return li;
|
||||
}
|
||||
|
||||
function addChildren(parentNode, destination) {
|
||||
while (parentNode.childNodes.length > 0)
|
||||
destination.appendChild(parentNode.childNodes[0]);
|
||||
}
|
||||
|
||||
// Check if there is a previous sibling
|
||||
prevSibling = n.parentNode.previousSibling;
|
||||
if (!prevSibling)
|
||||
return;
|
||||
|
||||
var ul;
|
||||
if (prevSibling.tagName === 'UL' || prevSibling.tagName === 'OL')
|
||||
ul = prevSibling;
|
||||
else if (prevSibling.previousSibling && (prevSibling.previousSibling.tagName === 'UL' || prevSibling.previousSibling.tagName === 'OL'))
|
||||
ul = prevSibling.previousSibling;
|
||||
else
|
||||
return;
|
||||
|
||||
var li = lastLI(ul);
|
||||
|
||||
// move the caret to the end of the list item
|
||||
var rng = ed.dom.createRng();
|
||||
rng.setStart(li, 1);
|
||||
rng.setEnd(li, 1);
|
||||
ed.selection.setRng(rng);
|
||||
ed.selection.collapse(true);
|
||||
|
||||
// save a bookmark at the end of the list item
|
||||
var bookmark = ed.selection.getBookmark();
|
||||
|
||||
// copy the image an its text to the list item
|
||||
var clone = n.parentNode.cloneNode(true);
|
||||
if (clone.tagName === 'P' || clone.tagName === 'DIV')
|
||||
addChildren(clone, li);
|
||||
else
|
||||
li.appendChild(clone);
|
||||
|
||||
// remove the old copy of the image
|
||||
n.parentNode.parentNode.removeChild(n.parentNode);
|
||||
|
||||
// move the caret where we saved the bookmark
|
||||
ed.selection.moveToBookmark(bookmark);
|
||||
}
|
||||
|
||||
// fix the cursor position to ensure it is correct in IE
|
||||
function setCursorPositionToOriginalLi(li) {
|
||||
var list = ed.dom.getParent(li, 'ol,ul');
|
||||
if (list != null) {
|
||||
var lastLi = list.lastChild;
|
||||
// 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
|
||||
//lastLi.appendChild(ed.getDoc().createElement(''));
|
||||
ed.selection.setCursorLocation(lastLi, 0);
|
||||
}
|
||||
}
|
||||
|
||||
this.ed = ed;
|
||||
ed.addCommand('Indent', this.indent, this);
|
||||
ed.addCommand('Outdent', this.outdent, this);
|
||||
|
|
@ -168,84 +360,185 @@
|
|||
ed.addCommand('InsertOrderedList', function() {
|
||||
this.applyList('OL', 'UL');
|
||||
}, this);
|
||||
|
||||
|
||||
ed.onInit.add(function() {
|
||||
ed.editorCommands.addCommands({
|
||||
'outdent': function() {
|
||||
var sel = ed.selection, dom = ed.dom;
|
||||
|
||||
function hasStyleIndent(n) {
|
||||
n = dom.getParent(n, dom.isBlock);
|
||||
return n && (parseInt(ed.dom.getStyle(n, 'margin-left') || 0, 10) + parseInt(ed.dom.getStyle(n, 'padding-left') || 0, 10)) > 0;
|
||||
}
|
||||
|
||||
return hasStyleIndent(sel.getStart()) || hasStyleIndent(sel.getEnd()) || ed.queryCommandState('InsertOrderedList') || ed.queryCommandState('InsertUnorderedList');
|
||||
}
|
||||
}, 'state');
|
||||
});
|
||||
|
||||
|
||||
ed.onKeyUp.add(function(ed, e) {
|
||||
var n, rng;
|
||||
if (isTriggerKey(e)) {
|
||||
if (state == LIST_TABBING) {
|
||||
ed.execCommand(e.shiftKey ? 'Outdent' : 'Indent', true, null);
|
||||
state = LIST_UNKNOWN;
|
||||
return Event.cancel(e);
|
||||
} else if (enterDownInEmptyList && isEnterInEmptyListItem(ed, e)) {
|
||||
if (ed.queryCommandState('InsertOrderedList')) {
|
||||
ed.execCommand('InsertOrderedList');
|
||||
} else {
|
||||
ed.execCommand('InsertUnorderedList');
|
||||
}
|
||||
n = ed.selection.getStart();
|
||||
if (n && n.tagName === 'LI') {
|
||||
// Fix the caret position on IE since it jumps back up to the previous list item.
|
||||
n = ed.dom.getParent(n, 'ol,ul').nextSibling;
|
||||
if (n && n.tagName === 'P') {
|
||||
if (!n.firstChild) {
|
||||
n.appendChild(ed.getDoc().createTextNode(''));
|
||||
}
|
||||
rng = ed.dom.createRng();
|
||||
rng.setStart(n.firstChild, 1);
|
||||
rng.setEnd(n.firstChild, 1);
|
||||
ed.selection.setRng(rng);
|
||||
}
|
||||
} else if (state == LIST_EMPTY_ITEM) {
|
||||
var li = getLi();
|
||||
var shouldOutdent = ed.settings.list_outdent_on_enter === true || e.shiftKey;
|
||||
ed.execCommand(shouldOutdent ? 'Outdent' : 'Indent', true, null);
|
||||
if (tinymce.isIE) {
|
||||
setCursorPositionToOriginalLi(li);
|
||||
}
|
||||
|
||||
return Event.cancel(e);
|
||||
} else if (state == LIST_ESCAPE) {
|
||||
if (tinymce.isIE6 || tinymce.isIE7 || tinymce.isIE8) {
|
||||
// append a zero sized nbsp so that caret is positioned correctly in IE after escaping and applying formatting.
|
||||
// if there is no text then applying formatting for e.g a H1 to the P tag immediately following list after
|
||||
// escaping from it will cause the caret to be positioned on the last li instead of staying the in P tag.
|
||||
var n = ed.getDoc().createTextNode('\uFEFF');
|
||||
ed.selection.getNode().appendChild(n);
|
||||
} else if (tinymce.isIE9 || tinymce.isGecko) {
|
||||
// IE9 does not escape the list so we use outdent to do this and cancel the default behaviour
|
||||
// Gecko does not create a paragraph outdenting inside a TD so default behaviour is cancelled and we outdent ourselves
|
||||
ed.execCommand('Outdent');
|
||||
return Event.cancel(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
ed.onKeyPress.add(cancelKeys);
|
||||
ed.onKeyDown.add(cancelKeys);
|
||||
|
||||
function fixListItem(parent, reference) {
|
||||
// a zero-sized non-breaking space is placed in the empty list item so that the nested list is
|
||||
// displayed on the below line instead of next to it
|
||||
var n = ed.getDoc().createTextNode('\uFEFF');
|
||||
parent.insertBefore(n, reference);
|
||||
ed.selection.setCursorLocation(n, 0);
|
||||
// repaint to remove rendering artifact. only visible when creating new list
|
||||
ed.execCommand('mceRepaint');
|
||||
}
|
||||
|
||||
function fixIndentedListItemForGecko(ed, e) {
|
||||
if (isEnter(e)) {
|
||||
var li = getLi();
|
||||
if (li) {
|
||||
var parent = li.parentNode;
|
||||
var grandParent = parent && parent.parentNode;
|
||||
if (grandParent && grandParent.nodeName == 'LI' && grandParent.firstChild == parent && li == parent.firstChild) {
|
||||
fixListItem(grandParent, parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function fixIndentedListItemForIE8(ed, e) {
|
||||
if (isEnter(e)) {
|
||||
var li = getLi();
|
||||
if (ed.dom.select('ul li', li).length === 1) {
|
||||
var list = li.firstChild;
|
||||
fixListItem(li, list);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function fixDeletingFirstCharOfList(ed, e) {
|
||||
function listElements(li) {
|
||||
var elements = [];
|
||||
var walker = new tinymce.dom.TreeWalker(li.firstChild, li);
|
||||
for (var node = walker.current(); node; node = walker.next()) {
|
||||
if (ed.dom.is(node, 'ol,ul,li')) {
|
||||
elements.push(node);
|
||||
}
|
||||
}
|
||||
return elements;
|
||||
}
|
||||
|
||||
if (e.keyCode == tinymce.VK.BACKSPACE) {
|
||||
var li = getLi();
|
||||
if (li) {
|
||||
var list = ed.dom.getParent(li, 'ol,ul'),
|
||||
rng = ed.selection.getRng();
|
||||
if (list && list.firstChild === li && rng.startOffset == 0) {
|
||||
var elements = listElements(li);
|
||||
elements.unshift(li);
|
||||
ed.execCommand("Outdent", false, elements);
|
||||
ed.undoManager.add();
|
||||
return Event.cancel(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function fixDeletingEmptyLiInWebkit(ed, e) {
|
||||
var li = getLi();
|
||||
if (e.keyCode === tinymce.VK.BACKSPACE && ed.dom.is(li, 'li') && li.parentNode.firstChild!==li) {
|
||||
if (ed.dom.select('ul,ol', li).length === 1) {
|
||||
var prevLi = li.previousSibling;
|
||||
ed.dom.remove(ed.dom.select('br', li));
|
||||
ed.dom.remove(li, true);
|
||||
var textNodes = tinymce.grep(prevLi.childNodes, function(n){ return n.nodeType === 3 });
|
||||
if (textNodes.length === 1) {
|
||||
var textNode = textNodes[0];
|
||||
ed.selection.setCursorLocation(textNode, textNode.length);
|
||||
}
|
||||
ed.undoManager.add();
|
||||
return Event.cancel(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ed.onKeyDown.add(function(_, e) { state = getListKeyState(e); });
|
||||
ed.onKeyDown.add(cancelDefaultEvents);
|
||||
ed.onKeyDown.add(imageJoiningListItem);
|
||||
ed.onKeyDown.add(createNewLi);
|
||||
|
||||
if (tinymce.isGecko) {
|
||||
ed.onKeyUp.add(fixIndentedListItemForGecko);
|
||||
}
|
||||
if (tinymce.isIE8) {
|
||||
ed.onKeyUp.add(fixIndentedListItemForIE8);
|
||||
}
|
||||
if (tinymce.isGecko || tinymce.isWebKit) {
|
||||
ed.onKeyDown.add(fixDeletingFirstCharOfList);
|
||||
}
|
||||
if (tinymce.isWebKit) {
|
||||
ed.onKeyDown.add(fixDeletingEmptyLiInWebkit);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
applyList: function(targetListType, oppositeListType) {
|
||||
var t = this, ed = t.ed, dom = ed.dom, applied = [], hasSameType = false, hasOppositeType = false, hasNonList = false, actions,
|
||||
selectedBlocks = ed.selection.getSelectedBlocks();
|
||||
|
||||
selectedBlocks = ed.selection.getSelectedBlocks();
|
||||
|
||||
function cleanupBr(e) {
|
||||
if (e && e.tagName === 'BR') {
|
||||
dom.remove(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function makeList(element) {
|
||||
var list = dom.create(targetListType), li;
|
||||
|
||||
function adjustIndentForNewList(element) {
|
||||
// If there's a margin-left, outdent one level to account for the extra list margin.
|
||||
if (element.style.marginLeft || element.style.paddingLeft) {
|
||||
t.adjustPaddingFunction(false)(element);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (element.tagName === 'LI') {
|
||||
// No change required.
|
||||
} else if (element.tagName === 'P' || element.tagName === 'DIV' || element.tagName === 'BODY') {
|
||||
processBrs(element, function(startSection, br, previousBR) {
|
||||
processBrs(element, function(startSection, br) {
|
||||
doWrapList(startSection, br, element.tagName === 'BODY' ? null : startSection.parentNode);
|
||||
li = startSection.parentNode;
|
||||
adjustIndentForNewList(li);
|
||||
cleanupBr(br);
|
||||
});
|
||||
if (element.tagName === 'P' || selectedBlocks.length > 1) {
|
||||
dom.split(li.parentNode.parentNode, li.parentNode);
|
||||
if (li) {
|
||||
if (li.tagName === 'LI' && (element.tagName === 'P' || selectedBlocks.length > 1)) {
|
||||
dom.split(li.parentNode.parentNode, li.parentNode);
|
||||
}
|
||||
attemptMergeWithAdjacent(li.parentNode, true);
|
||||
}
|
||||
attemptMergeWithAdjacent(li.parentNode, true);
|
||||
return;
|
||||
} else {
|
||||
// Put the list around the element.
|
||||
|
|
@ -260,9 +553,9 @@
|
|||
attemptMergeWithAdjacent(list, true);
|
||||
applied.push(element);
|
||||
}
|
||||
|
||||
|
||||
function doWrapList(start, end, template) {
|
||||
var li, n = start, tmp, i;
|
||||
var li, n = start, tmp;
|
||||
while (!dom.isBlock(start.parentNode) && start.parentNode !== dom.getRoot()) {
|
||||
start = dom.split(start.parentNode, start.previousSibling);
|
||||
start = start.nextSibling;
|
||||
|
|
@ -287,10 +580,11 @@
|
|||
}
|
||||
makeList(li);
|
||||
}
|
||||
|
||||
|
||||
function processBrs(element, callback) {
|
||||
var startSection, previousBR, END_TO_START = 3, START_TO_END = 1,
|
||||
breakElements = 'br,ul,ol,p,div,h1,h2,h3,h4,h5,h6,table,blockquote,address,pre,form,center,dl';
|
||||
breakElements = 'br,ul,ol,p,div,h1,h2,h3,h4,h5,h6,table,blockquote,address,pre,form,center,dl';
|
||||
|
||||
function isAnyPartSelected(start, end) {
|
||||
var r = dom.createRng(), sel;
|
||||
bookmark.keep = true;
|
||||
|
|
@ -304,18 +598,19 @@
|
|||
r.setEndAfter(end);
|
||||
return !(r.compareBoundaryPoints(END_TO_START, sel) > 0 || r.compareBoundaryPoints(START_TO_END, sel) <= 0);
|
||||
}
|
||||
|
||||
function nextLeaf(br) {
|
||||
if (br.nextSibling)
|
||||
return br.nextSibling;
|
||||
if (!dom.isBlock(br.parentNode) && br.parentNode !== dom.getRoot())
|
||||
return nextLeaf(br.parentNode);
|
||||
}
|
||||
|
||||
// Split on BRs within the range and process those.
|
||||
startSection = element.firstChild;
|
||||
// First mark the BRs that have any part of the previous section selected.
|
||||
var trailingContentSelected = false;
|
||||
each(dom.select(breakElements, element), function(br) {
|
||||
var b;
|
||||
if (br.hasAttribute && br.hasAttribute('_mce_bogus')) {
|
||||
return true; // Skip the bogus Brs that are put in to appease Firefox and Safari.
|
||||
}
|
||||
|
|
@ -344,7 +639,7 @@
|
|||
callback(startSection, undefined, previousBR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function wrapList(element) {
|
||||
processBrs(element, function(startSection, br, previousBR) {
|
||||
// Need to indent this part
|
||||
|
|
@ -353,7 +648,7 @@
|
|||
cleanupBr(previousBR);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function changeList(element) {
|
||||
if (tinymce.inArray(applied, element) !== -1) {
|
||||
return;
|
||||
|
|
@ -365,7 +660,7 @@
|
|||
}
|
||||
applied.push(element);
|
||||
}
|
||||
|
||||
|
||||
function convertListItemToParagraph(element) {
|
||||
var child, nextChild, mergedElement, splitLast;
|
||||
if (tinymce.inArray(applied, element) !== -1) {
|
||||
|
|
@ -387,7 +682,7 @@
|
|||
if (dom.isBlock(child)) {
|
||||
child = dom.split(child.parentNode, child);
|
||||
splitLast = true;
|
||||
nextChild = child.nextSibling && child.nextSibling.firstChild;
|
||||
nextChild = child.nextSibling && child.nextSibling.firstChild;
|
||||
} else {
|
||||
nextChild = child.nextSibling;
|
||||
if (splitLast && child.tagName === 'BR') {
|
||||
|
|
@ -399,7 +694,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
each(selectedBlocks, function(e) {
|
||||
e = findItemToOperateOn(e, dom);
|
||||
if (e.tagName === oppositeListType || (e.tagName === 'LI' && e.parentNode.tagName === oppositeListType)) {
|
||||
|
|
@ -411,7 +706,7 @@
|
|||
}
|
||||
});
|
||||
|
||||
if (hasNonList || hasOppositeType || selectedBlocks.length === 0) {
|
||||
if (hasNonList &&!hasSameType || hasOppositeType || selectedBlocks.length === 0) {
|
||||
actions = {
|
||||
'LI': changeList,
|
||||
'H1': makeList,
|
||||
|
|
@ -423,32 +718,35 @@
|
|||
'P': makeList,
|
||||
'BODY': makeList,
|
||||
'DIV': selectedBlocks.length > 1 ? makeList : wrapList,
|
||||
defaultAction: wrapList
|
||||
defaultAction: wrapList,
|
||||
elements: this.selectedBlocks()
|
||||
};
|
||||
} else {
|
||||
actions = {
|
||||
defaultAction: convertListItemToParagraph
|
||||
defaultAction: convertListItemToParagraph,
|
||||
elements: this.selectedBlocks(),
|
||||
processEvenIfEmpty: true
|
||||
};
|
||||
}
|
||||
this.process(actions);
|
||||
},
|
||||
|
||||
|
||||
indent: function() {
|
||||
var ed = this.ed, dom = ed.dom, indented = [];
|
||||
|
||||
|
||||
function createWrapItem(element) {
|
||||
var wrapItem = dom.create('li', { style: 'list-style-type: none;'});
|
||||
dom.insertAfter(wrapItem, element);
|
||||
return wrapItem;
|
||||
}
|
||||
|
||||
|
||||
function createWrapList(element) {
|
||||
var wrapItem = createWrapItem(element),
|
||||
list = dom.getParent(element, 'ol,ul'),
|
||||
listType = list.tagName,
|
||||
listStyle = dom.getStyle(list, 'list-style-type'),
|
||||
attrs = {},
|
||||
wrapList;
|
||||
list = dom.getParent(element, 'ol,ul'),
|
||||
listType = list.tagName,
|
||||
listStyle = dom.getStyle(list, 'list-style-type'),
|
||||
attrs = {},
|
||||
wrapList;
|
||||
if (listStyle !== '') {
|
||||
attrs.style = 'list-style-type: ' + listStyle + ';';
|
||||
}
|
||||
|
|
@ -456,7 +754,7 @@
|
|||
wrapItem.appendChild(wrapList);
|
||||
return wrapList;
|
||||
}
|
||||
|
||||
|
||||
function indentLI(element) {
|
||||
if (!hasParentInList(ed, element, indented)) {
|
||||
element = splitNestedLists(element, dom);
|
||||
|
|
@ -467,17 +765,18 @@
|
|||
indented.push(element);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.process({
|
||||
'LI': indentLI,
|
||||
defaultAction: this.adjustPaddingFunction(true)
|
||||
defaultAction: this.adjustPaddingFunction(true),
|
||||
elements: this.selectedBlocks()
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
|
||||
outdent: function() {
|
||||
|
||||
outdent: function(ui, elements) {
|
||||
var t = this, ed = t.ed, dom = ed.dom, outdented = [];
|
||||
|
||||
|
||||
function outdentLI(element) {
|
||||
var listElement, targetParent, align;
|
||||
if (!hasParentInList(ed, element, outdented)) {
|
||||
|
|
@ -506,20 +805,31 @@
|
|||
outdented.push(element);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var listElements = elements && tinymce.is(elements, 'array') ? elements : this.selectedBlocks();
|
||||
this.process({
|
||||
'LI': outdentLI,
|
||||
defaultAction: this.adjustPaddingFunction(false)
|
||||
defaultAction: this.adjustPaddingFunction(false),
|
||||
elements: listElements
|
||||
});
|
||||
|
||||
|
||||
each(outdented, attemptMergeWithAdjacent);
|
||||
},
|
||||
|
||||
|
||||
process: function(actions) {
|
||||
var t = this, sel = t.ed.selection, dom = t.ed.dom, selectedBlocks, r;
|
||||
|
||||
function isEmptyElement(element) {
|
||||
var excludeBrsAndBookmarks = tinymce.grep(element.childNodes, function(n) {
|
||||
return !(n.nodeName === 'BR' || n.nodeName === 'SPAN' && dom.getAttrib(n, 'data-mce-type') == 'bookmark'
|
||||
|| n.nodeType == 3 && (n.nodeValue == String.fromCharCode(160) || n.nodeValue == ''));
|
||||
});
|
||||
return excludeBrsAndBookmarks.length === 0;
|
||||
}
|
||||
|
||||
function processElement(element) {
|
||||
dom.removeClass(element, '_mce_act_on');
|
||||
if (!element || element.nodeType !== 1) {
|
||||
if (!element || element.nodeType !== 1 || ! actions.processEvenIfEmpty && selectedBlocks.length > 1 && isEmptyElement(element)) {
|
||||
return;
|
||||
}
|
||||
element = findItemToOperateOn(element, dom);
|
||||
|
|
@ -529,18 +839,24 @@
|
|||
}
|
||||
action(element);
|
||||
}
|
||||
|
||||
function recurse(element) {
|
||||
t.splitSafeEach(element.childNodes, processElement);
|
||||
t.splitSafeEach(element.childNodes, processElement, true);
|
||||
}
|
||||
|
||||
function brAtEdgeOfSelection(container, offset) {
|
||||
return offset >= 0 && container.hasChildNodes() && offset < container.childNodes.length &&
|
||||
container.childNodes[offset].tagName === 'BR';
|
||||
}
|
||||
selectedBlocks = sel.getSelectedBlocks();
|
||||
if (selectedBlocks.length === 0) {
|
||||
selectedBlocks = [ dom.getRoot() ];
|
||||
|
||||
function isInTable() {
|
||||
var n = sel.getNode();
|
||||
var p = dom.getParent(n, 'td');
|
||||
return p !== null;
|
||||
}
|
||||
|
||||
selectedBlocks = actions.elements;
|
||||
|
||||
r = sel.getRng(true);
|
||||
if (!r.collapsed) {
|
||||
if (brAtEdgeOfSelection(r.endContainer, r.endOffset - 1)) {
|
||||
|
|
@ -552,24 +868,41 @@
|
|||
sel.setRng(r);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (tinymce.isIE8) {
|
||||
// append a zero sized nbsp so that caret is restored correctly using bookmark
|
||||
var s = t.ed.selection.getNode();
|
||||
if (s.tagName === 'LI' && !(s.parentNode.lastChild === s)) {
|
||||
var i = t.ed.getDoc().createTextNode('\uFEFF');
|
||||
s.appendChild(i);
|
||||
}
|
||||
}
|
||||
|
||||
bookmark = sel.getBookmark();
|
||||
actions.OL = actions.UL = recurse;
|
||||
t.splitSafeEach(selectedBlocks, processElement);
|
||||
sel.moveToBookmark(bookmark);
|
||||
bookmark = null;
|
||||
// Avoids table or image handles being left behind in Firefox.
|
||||
t.ed.execCommand('mceRepaint');
|
||||
|
||||
// we avoid doing repaint in a table as this will move the caret out of the table in Firefox 3.6
|
||||
if (!isInTable()) {
|
||||
// Avoids table or image handles being left behind in Firefox.
|
||||
t.ed.execCommand('mceRepaint');
|
||||
}
|
||||
},
|
||||
|
||||
splitSafeEach: function(elements, f) {
|
||||
if (tinymce.isGecko && (/Firefox\/[12]\.[0-9]/.test(navigator.userAgent) ||
|
||||
/Firefox\/3\.[0-4]/.test(navigator.userAgent))) {
|
||||
|
||||
splitSafeEach: function(elements, f, forceClassBase) {
|
||||
if (forceClassBase ||
|
||||
(tinymce.isGecko &&
|
||||
(/Firefox\/[12]\.[0-9]/.test(navigator.userAgent) ||
|
||||
/Firefox\/3\.[0-4]/.test(navigator.userAgent)))) {
|
||||
this.classBasedEach(elements, f);
|
||||
} else {
|
||||
each(elements, f);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
classBasedEach: function(elements, f) {
|
||||
var dom = this.ed.dom, nodes, element;
|
||||
// Mark nodes
|
||||
|
|
@ -584,7 +917,7 @@
|
|||
nodes = dom.select('._mce_act_on');
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
adjustPaddingFunction: function(isIndent) {
|
||||
var indentAmount, indentUnits, ed = this.ed;
|
||||
indentAmount = ed.settings.indentation;
|
||||
|
|
@ -602,7 +935,12 @@
|
|||
ed.dom.setStyle(element, 'margin-left', newIndentAmount > 0 ? newIndentAmount + indentUnits : '');
|
||||
};
|
||||
},
|
||||
|
||||
|
||||
selectedBlocks: function() {
|
||||
var ed = this.ed, selectedBlocks = ed.selection.getSelectedBlocks();
|
||||
return selectedBlocks.length == 0 ? [ ed.dom.getRoot() ] : selectedBlocks;
|
||||
},
|
||||
|
||||
getInfo: function() {
|
||||
return {
|
||||
longname : 'Lists',
|
||||
|
|
|
|||
|
|
@ -23,9 +23,15 @@
|
|||
["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"]
|
||||
["Video"],
|
||||
["EmbeddedAudio"],
|
||||
["Audio"]
|
||||
];
|
||||
|
||||
function normalizeSize(size) {
|
||||
return typeof(size) == "string" ? size.replace(/[^0-9%]/g, '') : size;
|
||||
}
|
||||
|
||||
function toArray(obj) {
|
||||
var undef, out, i;
|
||||
|
||||
|
|
@ -86,11 +92,12 @@
|
|||
"silverlight=xap;" +
|
||||
"flash=swf,flv;" +
|
||||
"shockwave=dcr;" +
|
||||
"quicktime=mov,qt,mpg,mp3,mpeg;" +
|
||||
"quicktime=mov,qt,mpg,mpeg;" +
|
||||
"shockwave=dcr;" +
|
||||
"windowsmedia=avi,wmv,wm,asf,asx,wmx,wvx;" +
|
||||
"realmedia=rm,ra,ram;" +
|
||||
"java=jar"
|
||||
"java=jar;" +
|
||||
"audio=mp3,ogg"
|
||||
).split(';'), function(item) {
|
||||
var i, extensions, type;
|
||||
|
||||
|
|
@ -155,17 +162,20 @@
|
|||
|
||||
img = ed.selection.getNode();
|
||||
if (isMediaImg(img)) {
|
||||
data = JSON.parse(ed.dom.getAttrib(img, 'data-mce-json'));
|
||||
data = ed.dom.getAttrib(img, 'data-mce-json');
|
||||
if (data) {
|
||||
data = JSON.parse(data);
|
||||
|
||||
// Add some extra properties to the data object
|
||||
tinymce.each(rootAttributes, function(name) {
|
||||
var value = ed.dom.getAttrib(img, name);
|
||||
// Add some extra properties to the data object
|
||||
tinymce.each(rootAttributes, function(name) {
|
||||
var value = ed.dom.getAttrib(img, name);
|
||||
|
||||
if (value)
|
||||
data[name] = value;
|
||||
});
|
||||
if (value)
|
||||
data[name] = value;
|
||||
});
|
||||
|
||||
data.type = self.getType(img.className).name.toLowerCase();
|
||||
data.type = self.getType(img.className).name.toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
if (!data) {
|
||||
|
|
@ -245,13 +255,15 @@
|
|||
id : data.id,
|
||||
style : data.style,
|
||||
align : data.align,
|
||||
hspace : data.hspace,
|
||||
vspace : data.vspace,
|
||||
src : self.editor.theme.url + '/img/trans.gif',
|
||||
'class' : 'mceItemMedia mceItem' + self.getType(data.type).name,
|
||||
'data-mce-json' : JSON.serialize(data, "'")
|
||||
});
|
||||
|
||||
img.width = data.width || "320";
|
||||
img.height = data.height || "240";
|
||||
img.width = data.width = normalizeSize(data.width || (data.type == 'audio' ? "300" : "320"));
|
||||
img.height = data.height = normalizeSize(data.height || (data.type == 'audio' ? "32" : "240"));
|
||||
|
||||
return img;
|
||||
},
|
||||
|
|
@ -260,7 +272,7 @@
|
|||
* Converts the JSON data object to a HTML string.
|
||||
*/
|
||||
dataToHtml : function(data, force_absolute) {
|
||||
return this.editor.serializer.serialize(this.dataToImg(data, force_absolute), {force_absolute : force_absolute});
|
||||
return this.editor.serializer.serialize(this.dataToImg(data, force_absolute), {forced_root_block : '', force_absolute : force_absolute});
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
@ -320,7 +332,7 @@
|
|||
imgToObject : function(node, args) {
|
||||
var self = this, editor = self.editor, video, object, embed, iframe, name, value, data,
|
||||
source, sources, params, param, typeItem, i, item, mp4Source, replacement,
|
||||
posterSrc, style;
|
||||
posterSrc, style, audio;
|
||||
|
||||
// Adds the flash player
|
||||
function addPlayer(video_src, poster_src) {
|
||||
|
|
@ -363,10 +375,14 @@
|
|||
}
|
||||
};
|
||||
|
||||
data = JSON.parse(node.attr('data-mce-json'));
|
||||
data = node.attr('data-mce-json');
|
||||
if (!data)
|
||||
return;
|
||||
|
||||
data = JSON.parse(data);
|
||||
typeItem = this.getType(node.attr('class'));
|
||||
|
||||
style = node.attr('data-mce-style')
|
||||
style = node.attr('data-mce-style');
|
||||
if (!style) {
|
||||
style = node.attr('style');
|
||||
|
||||
|
|
@ -374,6 +390,10 @@
|
|||
style = editor.dom.serializeStyle(editor.dom.parseStyle(style, 'img'));
|
||||
}
|
||||
|
||||
// Use node width/height to override the data width/height when the placeholder is resized
|
||||
data.width = node.attr('width') || data.width;
|
||||
data.height = node.attr('height') || data.height;
|
||||
|
||||
// Handle iframe
|
||||
if (typeItem.name === 'Iframe') {
|
||||
replacement = new Node('iframe', 1);
|
||||
|
|
@ -422,8 +442,8 @@
|
|||
// Create new object element
|
||||
video = new Node('video', 1).attr(tinymce.extend({
|
||||
id : node.attr('id'),
|
||||
width: node.attr('width'),
|
||||
height: node.attr('height'),
|
||||
width: normalizeSize(node.attr('width')),
|
||||
height: normalizeSize(node.attr('height')),
|
||||
style : style
|
||||
}, data.video.attrs));
|
||||
|
||||
|
|
@ -456,6 +476,57 @@
|
|||
data.params.src = '';
|
||||
}
|
||||
|
||||
// Add HTML5 audio element
|
||||
if (typeItem.name === 'Audio' && data.video.sources[0]) {
|
||||
// Create new object element
|
||||
audio = new Node('audio', 1).attr(tinymce.extend({
|
||||
id : node.attr('id'),
|
||||
width: normalizeSize(node.attr('width')),
|
||||
height: normalizeSize(node.attr('height')),
|
||||
style : style
|
||||
}, data.video.attrs));
|
||||
|
||||
// Get poster source and use that for flash fallback
|
||||
if (data.video.attrs)
|
||||
posterSrc = data.video.attrs.poster;
|
||||
|
||||
sources = data.video.sources = toArray(data.video.sources);
|
||||
if (!sources[0].type) {
|
||||
audio.attr('src', sources[0].src);
|
||||
sources.splice(0, 1);
|
||||
}
|
||||
|
||||
for (i = 0; i < sources.length; i++) {
|
||||
source = new Node('source', 1).attr(sources[i]);
|
||||
source.shortEnded = true;
|
||||
audio.append(source);
|
||||
}
|
||||
|
||||
data.params.src = '';
|
||||
}
|
||||
|
||||
if (typeItem.name === 'EmbeddedAudio') {
|
||||
embed = new Node('embed', 1);
|
||||
embed.shortEnded = true;
|
||||
embed.attr({
|
||||
id: node.attr('id'),
|
||||
width: normalizeSize(node.attr('width')),
|
||||
height: normalizeSize(node.attr('height')),
|
||||
style : style,
|
||||
type: node.attr('type')
|
||||
});
|
||||
|
||||
for (name in data.params)
|
||||
embed.attr(name, data.params[name]);
|
||||
|
||||
tinymce.each(rootAttributes, function(name) {
|
||||
if (data[name] && name != 'type')
|
||||
embed.attr(name, data[name]);
|
||||
});
|
||||
|
||||
data.params.src = '';
|
||||
}
|
||||
|
||||
// Do we have a params src then we can generate object
|
||||
if (data.params.src) {
|
||||
// Is flv movie add player for it
|
||||
|
|
@ -468,14 +539,19 @@
|
|||
// Create new object element
|
||||
object = new Node('object', 1).attr({
|
||||
id : node.attr('id'),
|
||||
width: node.attr('width'),
|
||||
height: node.attr('height'),
|
||||
width: normalizeSize(node.attr('width')),
|
||||
height: normalizeSize(node.attr('height')),
|
||||
style : style
|
||||
});
|
||||
|
||||
tinymce.each(rootAttributes, function(name) {
|
||||
if (data[name] && name != 'type')
|
||||
object.attr(name, data[name]);
|
||||
var value = data[name];
|
||||
|
||||
if (name == 'class' && value)
|
||||
value = value.replace(/mceItem.+ ?/g, '');
|
||||
|
||||
if (value && name != 'type')
|
||||
object.attr(name, value);
|
||||
});
|
||||
|
||||
// Add params
|
||||
|
|
@ -508,8 +584,8 @@
|
|||
embed.shortEnded = true;
|
||||
embed.attr({
|
||||
id: node.attr('id'),
|
||||
width: node.attr('width'),
|
||||
height: node.attr('height'),
|
||||
width: normalizeSize(node.attr('width')),
|
||||
height: normalizeSize(node.attr('height')),
|
||||
style : style,
|
||||
type: typeItem.mimes[0]
|
||||
});
|
||||
|
|
@ -548,8 +624,19 @@
|
|||
}
|
||||
}
|
||||
|
||||
if (video || object)
|
||||
node.replace(video || object);
|
||||
if (audio) {
|
||||
// Insert raw HTML
|
||||
if (data.video_html) {
|
||||
value = new Node('#text', 3);
|
||||
value.raw = true;
|
||||
value.value = data.video_html;
|
||||
audio.append(value);
|
||||
}
|
||||
}
|
||||
|
||||
var n = video || audio || object || embed;
|
||||
if (n)
|
||||
node.replace(n);
|
||||
else
|
||||
node.remove();
|
||||
},
|
||||
|
|
@ -567,7 +654,8 @@
|
|||
var object, embed, video, iframe, img, name, id, width, height, style, i, html,
|
||||
param, params, source, sources, data, type, lookup = this.lookup,
|
||||
matches, attrs, urlConverter = this.editor.settings.url_converter,
|
||||
urlConverterScope = this.editor.settings.url_converter_scope;
|
||||
urlConverterScope = this.editor.settings.url_converter_scope,
|
||||
hspace, vspace, align, bgcolor;
|
||||
|
||||
function getInnerHTML(node) {
|
||||
return new tinymce.html.Serializer({
|
||||
|
|
@ -576,6 +664,15 @@
|
|||
}).serialize(node);
|
||||
};
|
||||
|
||||
function lookupAttribute(o, attr) {
|
||||
return lookup[(o.attr(attr) || '').toLowerCase()];
|
||||
}
|
||||
|
||||
function lookupExtension(src) {
|
||||
var ext = src.replace(/^.*\.([^.]+)$/, '$1');
|
||||
return lookup[ext.toLowerCase() || ''];
|
||||
}
|
||||
|
||||
// If node isn't in document
|
||||
if (!node.parent)
|
||||
return;
|
||||
|
|
@ -608,7 +705,7 @@
|
|||
|
||||
// Video element
|
||||
name = node.name;
|
||||
if (name === 'video') {
|
||||
if (name === 'video' || name == 'audio') {
|
||||
video = node;
|
||||
object = node.getAll('object')[0];
|
||||
embed = node.getAll('embed')[0];
|
||||
|
|
@ -624,7 +721,7 @@
|
|||
|
||||
source = node.attr('src');
|
||||
if (source)
|
||||
data.video.sources.push({src : urlConverter.call(urlConverterScope, source, 'src', 'video')});
|
||||
data.video.sources.push({src : urlConverter.call(urlConverterScope, source, 'src', node.name)});
|
||||
|
||||
// Get all sources
|
||||
sources = video.getAll("source");
|
||||
|
|
@ -640,7 +737,7 @@
|
|||
|
||||
// Convert the poster URL
|
||||
if (attrs.poster)
|
||||
attrs.poster = urlConverter.call(urlConverterScope, attrs.poster, 'poster', 'video');
|
||||
attrs.poster = urlConverter.call(urlConverterScope, attrs.poster, 'poster', node.name);
|
||||
}
|
||||
|
||||
// Object element
|
||||
|
|
@ -665,6 +762,11 @@
|
|||
height = height || object.attr('height');
|
||||
style = style || object.attr('style');
|
||||
id = id || object.attr('id');
|
||||
hspace = hspace || object.attr('hspace');
|
||||
vspace = vspace || object.attr('vspace');
|
||||
align = align || object.attr('align');
|
||||
bgcolor = bgcolor || object.attr('bgcolor');
|
||||
data.name = object.attr('name');
|
||||
|
||||
// Get all object params
|
||||
params = object.getAll("param");
|
||||
|
|
@ -685,6 +787,10 @@
|
|||
height = height || embed.attr('height');
|
||||
style = style || embed.attr('style');
|
||||
id = id || embed.attr('id');
|
||||
hspace = hspace || embed.attr('hspace');
|
||||
vspace = vspace || embed.attr('vspace');
|
||||
align = align || embed.attr('align');
|
||||
bgcolor = bgcolor || embed.attr('bgcolor');
|
||||
|
||||
// Get all embed attributes
|
||||
for (name in embed.attributes.map) {
|
||||
|
|
@ -695,10 +801,14 @@
|
|||
|
||||
if (iframe) {
|
||||
// Get width/height
|
||||
width = iframe.attr('width');
|
||||
height = iframe.attr('height');
|
||||
width = normalizeSize(iframe.attr('width'));
|
||||
height = normalizeSize(iframe.attr('height'));
|
||||
style = style || iframe.attr('style');
|
||||
id = iframe.attr('id');
|
||||
hspace = iframe.attr('hspace');
|
||||
vspace = iframe.attr('vspace');
|
||||
align = iframe.attr('align');
|
||||
bgcolor = iframe.attr('bgcolor');
|
||||
|
||||
tinymce.each(rootAttributes, function(name) {
|
||||
img.attr(name, iframe.attr(name));
|
||||
|
|
@ -721,14 +831,23 @@
|
|||
if (data.params.src)
|
||||
data.params.src = urlConverter.call(urlConverterScope, data.params.src, 'src', 'object');
|
||||
|
||||
if (video)
|
||||
type = lookup.video.name;
|
||||
if (video) {
|
||||
if (node.name === 'video')
|
||||
type = lookup.video.name;
|
||||
else if (node.name === 'audio')
|
||||
type = lookup.audio.name;
|
||||
}
|
||||
|
||||
if (object && !type)
|
||||
type = (lookup[(object.attr('clsid') || '').toLowerCase()] || lookup[(object.attr('type') || '').toLowerCase()] || {}).name;
|
||||
type = (lookupAttribute(object, 'clsid') || lookupAttribute(object, 'classid') || lookupAttribute(object, 'type') || {}).name;
|
||||
|
||||
if (embed && !type)
|
||||
type = (lookup[(embed.attr('type') || '').toLowerCase()] || {}).name;
|
||||
type = (lookupAttribute(embed, 'type') || lookupExtension(data.params.src) || {}).name;
|
||||
|
||||
// for embedded audio we preserve the original specified type
|
||||
if (embed && type == 'EmbeddedAudio') {
|
||||
data.params.type = embed.attr('type');
|
||||
}
|
||||
|
||||
// Replace the video/object/embed element with a placeholder image containing the data
|
||||
node.replace(img);
|
||||
|
|
@ -753,13 +872,22 @@
|
|||
data.video_html = html;
|
||||
}
|
||||
|
||||
data.hspace = hspace;
|
||||
data.vspace = vspace;
|
||||
data.align = align;
|
||||
data.bgcolor = bgcolor;
|
||||
|
||||
// Set width/height of placeholder
|
||||
img.attr({
|
||||
id : id,
|
||||
'class' : 'mceItemMedia mceItem' + (type || 'Flash'),
|
||||
style : style,
|
||||
width : width || "320",
|
||||
height : height || "240",
|
||||
width : width || (node.name == 'audio' ? "300" : "320"),
|
||||
height : height || (node.name == 'audio' ? "32" : "240"),
|
||||
hspace : hspace,
|
||||
vspace : vspace,
|
||||
align : align,
|
||||
bgcolor : bgcolor,
|
||||
"data-mce-json" : JSON.serialize(data, "'")
|
||||
});
|
||||
}
|
||||
|
|
@ -767,4 +895,4 @@
|
|||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('media', tinymce.plugins.MediaPlugin);
|
||||
})();
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -8,6 +8,33 @@
|
|||
return document.getElementById(id);
|
||||
}
|
||||
|
||||
function clone(obj) {
|
||||
var i, len, copy, attr;
|
||||
|
||||
if (null == obj || "object" != typeof obj)
|
||||
return obj;
|
||||
|
||||
// Handle Array
|
||||
if ('length' in obj) {
|
||||
copy = [];
|
||||
|
||||
for (i = 0, len = obj.length; i < len; ++i) {
|
||||
copy[i] = clone(obj[i]);
|
||||
}
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
// Handle Object
|
||||
copy = {};
|
||||
for (attr in obj) {
|
||||
if (obj.hasOwnProperty(attr))
|
||||
copy[attr] = clone(obj[attr]);
|
||||
}
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
function getVal(id) {
|
||||
var elm = get(id);
|
||||
|
||||
|
|
@ -20,17 +47,18 @@
|
|||
return elm.value;
|
||||
}
|
||||
|
||||
function setVal(id, value) {
|
||||
if (typeof(value) != 'undefined') {
|
||||
function setVal(id, value, name) {
|
||||
if (typeof(value) != 'undefined' && value != null) {
|
||||
var elm = get(id);
|
||||
|
||||
if (elm.nodeName == "SELECT")
|
||||
selectByValue(document.forms[0], id, value);
|
||||
else if (elm.type == "checkbox") {
|
||||
if (typeof(value) == 'string')
|
||||
elm.checked = value.toLowerCase() === 'true' ? true : false;
|
||||
else
|
||||
elm.checked = !!value;
|
||||
if (typeof(value) == 'string') {
|
||||
value = value.toLowerCase();
|
||||
value = (!name && value === 'true') || (name && value === name.toLowerCase());
|
||||
}
|
||||
elm.checked = !!value;
|
||||
} else
|
||||
elm.value = value;
|
||||
}
|
||||
|
|
@ -38,19 +66,21 @@
|
|||
|
||||
window.Media = {
|
||||
init : function() {
|
||||
var html, editor;
|
||||
var html, editor, self = this;
|
||||
|
||||
this.editor = editor = tinyMCEPopup.editor;
|
||||
self.editor = editor = tinyMCEPopup.editor;
|
||||
|
||||
// Setup file browsers and color pickers
|
||||
get('filebrowsercontainer').innerHTML = getBrowserHTML('filebrowser','src','media','media');
|
||||
get('qtsrcfilebrowsercontainer').innerHTML = getBrowserHTML('qtsrcfilebrowser','quicktime_qtsrc','media','media');
|
||||
get('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');
|
||||
get('video_altsource1_filebrowser').innerHTML = getBrowserHTML('filebrowser_altsource1','video_altsource1','media','media');
|
||||
get('video_altsource2_filebrowser').innerHTML = getBrowserHTML('filebrowser_altsource2','video_altsource2','media','media');
|
||||
get('video_poster_filebrowser').innerHTML = getBrowserHTML('filebrowser_poster','video_poster','media','image');
|
||||
get('video_altsource1_filebrowser').innerHTML = getBrowserHTML('video_filebrowser_altsource1','video_altsource1','media','media');
|
||||
get('video_altsource2_filebrowser').innerHTML = getBrowserHTML('video_filebrowser_altsource2','video_altsource2','media','media');
|
||||
get('audio_altsource1_filebrowser').innerHTML = getBrowserHTML('audio_filebrowser_altsource1','audio_altsource1','media','media');
|
||||
get('audio_altsource2_filebrowser').innerHTML = getBrowserHTML('audio_filebrowser_altsource2','audio_altsource2','media','media');
|
||||
get('video_poster_filebrowser').innerHTML = getBrowserHTML('filebrowser_poster','video_poster','image','media');
|
||||
|
||||
html = this.getMediaListHTML('medialist', 'src', 'media', 'media');
|
||||
html = self.getMediaListHTML('medialist', 'src', 'media', 'media');
|
||||
if (html == "")
|
||||
get("linklistrow").style.display = 'none';
|
||||
else
|
||||
|
|
@ -59,18 +89,29 @@
|
|||
if (isVisible('filebrowser'))
|
||||
get('src').style.width = '230px';
|
||||
|
||||
if (isVisible('filebrowser_altsource1'))
|
||||
if (isVisible('video_filebrowser_altsource1'))
|
||||
get('video_altsource1').style.width = '220px';
|
||||
|
||||
if (isVisible('filebrowser_altsource2'))
|
||||
if (isVisible('video_filebrowser_altsource2'))
|
||||
get('video_altsource2').style.width = '220px';
|
||||
|
||||
if (isVisible('audio_filebrowser_altsource1'))
|
||||
get('audio_altsource1').style.width = '220px';
|
||||
|
||||
if (isVisible('audio_filebrowser_altsource2'))
|
||||
get('audio_altsource2').style.width = '220px';
|
||||
|
||||
if (isVisible('filebrowser_poster'))
|
||||
get('video_poster').style.width = '220px';
|
||||
|
||||
this.data = tinyMCEPopup.getWindowArg('data');
|
||||
this.dataToForm();
|
||||
this.preview();
|
||||
editor.dom.setOuterHTML(get('media_type'), self.getMediaTypeHTML(editor));
|
||||
|
||||
self.setDefaultDialogSettings(editor);
|
||||
self.data = clone(tinyMCEPopup.getWindowArg('data'));
|
||||
self.dataToForm();
|
||||
self.preview();
|
||||
|
||||
updateColor('bgcolor_pick', 'bgcolor');
|
||||
},
|
||||
|
||||
insert : function() {
|
||||
|
|
@ -88,7 +129,7 @@
|
|||
},
|
||||
|
||||
moveStates : function(to_form, field) {
|
||||
var data = this.data, editor = this.editor, data = this.data,
|
||||
var data = this.data, editor = this.editor,
|
||||
mediaPlugin = editor.plugins.media, ext, src, typeInfo, defaultStates, src;
|
||||
|
||||
defaultStates = {
|
||||
|
|
@ -135,23 +176,23 @@
|
|||
formItemName = type == 'global' ? name : type + '_' + name;
|
||||
|
||||
if (type == 'global')
|
||||
list = data;
|
||||
else if (type == 'video') {
|
||||
list = data;
|
||||
else if (type == 'video' || type == 'audio') {
|
||||
list = data.video.attrs;
|
||||
|
||||
if (!list && !to_form)
|
||||
data.video.attrs = list = {};
|
||||
data.video.attrs = list = {};
|
||||
} else
|
||||
list = data.params;
|
||||
list = data.params;
|
||||
|
||||
if (list) {
|
||||
if (to_form) {
|
||||
setVal(formItemName, list[name]);
|
||||
setVal(formItemName, list[name], type == 'video' || type == 'audio' ? name : '');
|
||||
} else {
|
||||
delete list[name];
|
||||
|
||||
value = getVal(formItemName);
|
||||
if (type == 'video' && value === true)
|
||||
if ((type == 'video' || type == 'audio') && value === true)
|
||||
value = name;
|
||||
|
||||
if (defaultStates[formItemName]) {
|
||||
|
|
@ -184,7 +225,7 @@
|
|||
setVal('media_type', data.type);
|
||||
}
|
||||
|
||||
if (data.type == "video") {
|
||||
if (data.type == "video" || data.type == "audio") {
|
||||
if (!data.video.sources)
|
||||
data.video.sources = [];
|
||||
|
||||
|
|
@ -194,11 +235,13 @@
|
|||
|
||||
// Hide all fieldsets and show the one active
|
||||
get('video_options').style.display = 'none';
|
||||
get('audio_options').style.display = 'none';
|
||||
get('flash_options').style.display = 'none';
|
||||
get('quicktime_options').style.display = 'none';
|
||||
get('shockwave_options').style.display = 'none';
|
||||
get('windowsmedia_options').style.display = 'none';
|
||||
get('realmedia_options').style.display = 'none';
|
||||
get('embeddedaudio_options').style.display = 'none';
|
||||
|
||||
if (get(data.type + '_options'))
|
||||
get(data.type + '_options').style.display = 'block';
|
||||
|
|
@ -210,7 +253,9 @@
|
|||
setOptions('shockwave', 'sound,progress,autostart,swliveconnect,swvolume,swstretchstyle,swstretchhalign,swstretchvalign');
|
||||
setOptions('windowsmedia', 'autostart,enabled,enablecontextmenu,fullscreen,invokeurls,mute,stretchtofit,windowlessvideo,balance,baseurl,captioningid,currentmarker,currentposition,defaultframe,playcount,rate,uimode,volume');
|
||||
setOptions('realmedia', 'autostart,loop,autogotourl,center,imagestatus,maintainaspect,nojava,prefetch,shuffle,console,controls,numloop,scriptcallbacks');
|
||||
setOptions('video', 'poster,autoplay,loop,preload,controls');
|
||||
setOptions('video', 'poster,autoplay,loop,muted,preload,controls');
|
||||
setOptions('audio', 'autoplay,loop,preload,controls');
|
||||
setOptions('embeddedaudio', 'autoplay,loop,controls');
|
||||
setOptions('global', 'id,name,vspace,hspace,bgcolor,align,width,height');
|
||||
|
||||
if (to_form) {
|
||||
|
|
@ -225,12 +270,23 @@
|
|||
src = data.video.sources[2];
|
||||
if (src)
|
||||
setVal('video_altsource2', src.src);
|
||||
} else if (data.type == 'audio') {
|
||||
if (data.video.sources[0])
|
||||
setVal('src', data.video.sources[0].src);
|
||||
|
||||
src = data.video.sources[1];
|
||||
if (src)
|
||||
setVal('audio_altsource1', src.src);
|
||||
|
||||
src = data.video.sources[2];
|
||||
if (src)
|
||||
setVal('audio_altsource2', src.src);
|
||||
} else {
|
||||
// Check flash vars
|
||||
if (data.type == 'flash') {
|
||||
tinymce.each(editor.getParam('flash_video_player_flashvars', {url : '$url', poster : '$poster'}), function(value, name) {
|
||||
if (value == '$url')
|
||||
data.params.src = parseQueryParams(data.params.flashvars)[name] || data.params.src;
|
||||
data.params.src = parseQueryParams(data.params.flashvars)[name] || data.params.src || '';
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -238,7 +294,18 @@
|
|||
}
|
||||
} else {
|
||||
src = getVal("src");
|
||||
|
||||
|
||||
// YouTube *NEW*
|
||||
if (src.match(/youtu.be\/[a-z1-9.-_]+/)) {
|
||||
data.width = 425;
|
||||
data.height = 350;
|
||||
data.params.frameborder = '0';
|
||||
data.type = 'iframe';
|
||||
src = 'http://www.youtube.com/embed/' + src.match(/youtu.be\/([a-z1-9.-_]+)/)[1];
|
||||
setVal('src', src);
|
||||
setVal('media_type', data.type);
|
||||
}
|
||||
|
||||
// YouTube
|
||||
if (src.match(/youtube.com(.+)v=([^&]+)/)) {
|
||||
data.width = 425;
|
||||
|
|
@ -259,6 +326,39 @@
|
|||
setVal('src', src);
|
||||
setVal('media_type', data.type);
|
||||
}
|
||||
|
||||
// Vimeo
|
||||
if (src.match(/vimeo.com\/([0-9]+)/)) {
|
||||
data.width = 425;
|
||||
data.height = 350;
|
||||
data.params.frameborder = '0';
|
||||
data.type = 'iframe';
|
||||
src = 'http://player.vimeo.com/video/' + src.match(/vimeo.com\/([0-9]+)/)[1];
|
||||
setVal('src', src);
|
||||
setVal('media_type', data.type);
|
||||
}
|
||||
|
||||
// stream.cz
|
||||
if (src.match(/stream.cz\/((?!object).)*\/([0-9]+)/)) {
|
||||
data.width = 425;
|
||||
data.height = 350;
|
||||
data.params.frameborder = '0';
|
||||
data.type = 'iframe';
|
||||
src = 'http://www.stream.cz/object/' + src.match(/stream.cz\/[^/]+\/([0-9]+)/)[1];
|
||||
setVal('src', src);
|
||||
setVal('media_type', data.type);
|
||||
}
|
||||
|
||||
// Google maps
|
||||
if (src.match(/maps.google.([a-z]{2,3})\/maps\/(.+)msid=(.+)/)) {
|
||||
data.width = 425;
|
||||
data.height = 350;
|
||||
data.params.frameborder = '0';
|
||||
data.type = 'iframe';
|
||||
src = 'http://maps.google.com/maps/ms?msid=' + src.match(/msid=(.+)/)[1] + "&output=embed";
|
||||
setVal('src', src);
|
||||
setVal('media_type', data.type);
|
||||
}
|
||||
|
||||
if (data.type == 'video') {
|
||||
if (!data.video.sources)
|
||||
|
|
@ -273,12 +373,25 @@
|
|||
src = getVal("video_altsource2");
|
||||
if (src)
|
||||
data.video.sources[2] = {src : src};
|
||||
} else if (data.type == 'audio') {
|
||||
if (!data.video.sources)
|
||||
data.video.sources = [];
|
||||
|
||||
data.video.sources[0] = {src : src};
|
||||
|
||||
src = getVal("audio_altsource1");
|
||||
if (src)
|
||||
data.video.sources[1] = {src : src};
|
||||
|
||||
src = getVal("audio_altsource2");
|
||||
if (src)
|
||||
data.video.sources[2] = {src : src};
|
||||
} else
|
||||
data.params.src = src;
|
||||
|
||||
// Set default size
|
||||
setVal('width', data.width || 320);
|
||||
setVal('height', data.height || 240);
|
||||
setVal('width', data.width || (data.type == 'audio' ? 300 : 320));
|
||||
setVal('height', data.height || (data.type == 'audio' ? 32 : 240));
|
||||
}
|
||||
},
|
||||
|
||||
|
|
@ -296,7 +409,7 @@
|
|||
this.panel = 'source';
|
||||
} else {
|
||||
if (this.panel == 'source') {
|
||||
this.data = this.editor.plugins.media.htmlToData(getVal('source'));
|
||||
this.data = clone(this.editor.plugins.media.htmlToData(getVal('source')));
|
||||
this.dataToForm();
|
||||
this.panel = '';
|
||||
}
|
||||
|
|
@ -307,16 +420,16 @@
|
|||
},
|
||||
|
||||
beforeResize : function() {
|
||||
this.width = parseInt(getVal('width') || "320", 10);
|
||||
this.height = parseInt(getVal('height') || "240", 10);
|
||||
this.width = parseInt(getVal('width') || (this.data.type == 'audio' ? "300" : "320"), 10);
|
||||
this.height = parseInt(getVal('height') || (this.data.type == 'audio' ? "32" : "240"), 10);
|
||||
},
|
||||
|
||||
changeSize : function(type) {
|
||||
var width, height, scale, size;
|
||||
|
||||
if (get('constrain').checked) {
|
||||
width = parseInt(getVal('width') || "320", 10);
|
||||
height = parseInt(getVal('height') || "240", 10);
|
||||
width = parseInt(getVal('width') || (this.data.type == 'audio' ? "300" : "320"), 10);
|
||||
height = parseInt(getVal('height') || (this.data.type == 'audio' ? "32" : "240"), 10);
|
||||
|
||||
if (type == 'width') {
|
||||
this.height = Math.round((width / this.width) * height);
|
||||
|
|
@ -344,6 +457,42 @@
|
|||
}
|
||||
|
||||
return "";
|
||||
},
|
||||
|
||||
getMediaTypeHTML : function(editor) {
|
||||
function option(media_type, element) {
|
||||
if (!editor.schema.getElementRule(element || media_type)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return '<option value="'+media_type+'">'+tinyMCEPopup.editor.translate("media_dlg."+media_type)+'</option>'
|
||||
}
|
||||
|
||||
var html = "";
|
||||
|
||||
html += '<select id="media_type" name="media_type" onchange="Media.formToData(\'type\');">';
|
||||
html += option("video");
|
||||
html += option("audio");
|
||||
html += option("flash", "object");
|
||||
html += option("quicktime", "object");
|
||||
html += option("shockwave", "object");
|
||||
html += option("windowsmedia", "object");
|
||||
html += option("realmedia", "object");
|
||||
html += option("iframe");
|
||||
|
||||
if (editor.getParam('media_embedded_audio', false)) {
|
||||
html += option('embeddedaudio', "object");
|
||||
}
|
||||
|
||||
html += '</select>';
|
||||
return html;
|
||||
},
|
||||
|
||||
setDefaultDialogSettings : function(editor) {
|
||||
var defaultDialogSettings = editor.getParam("media_dialog_defaults", {});
|
||||
tinymce.each(defaultDialogSettings, function(v, k) {
|
||||
setVal(k, v);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -351,4 +500,4 @@
|
|||
tinyMCEPopup.onInit.add(function() {
|
||||
Media.init();
|
||||
});
|
||||
})();
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
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 Src field under the advanced tab.\\nYou should also add a non streamed version to the Src field..",qtsrc:"QT Src",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:"Fullscreen",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:"AutoHREF",liveconnect:"SWLiveConnect",flashvars:"Flashvars",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","flv_options":"Flash video options","flv_scalemode":"Scale mode","flv_buffer":"Buffer","flv_startimage":"Start image","flv_starttime":"Start time","flv_defaultvolume":"Default volumne","flv_hiddengui":"Hidden GUI","flv_autostart":"Auto start","flv_loop":"Loop","flv_showscalemodes":"Show scale modes","flv_smoothvideo":"Smooth video","flv_jscallback":"JS Callback","html5_video_options":"HTML5 Video Options",altsource1:"Alternative source 1",altsource2:"Alternative source 2",preload:"Preload",poster:"Poster",source:"Source"});
|
||||
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" });
|
||||
|
|
|
|||
|
|
@ -29,15 +29,7 @@
|
|||
<tr>
|
||||
<td><label for="media_type">{#media_dlg.type}</label></td>
|
||||
<td>
|
||||
<select id="media_type" name="media_type" onchange="Media.formToData('type');">
|
||||
<option value="video">HTML5 Video</option>
|
||||
<option value="flash">Flash</option>
|
||||
<option value="quicktime">QuickTime</option>
|
||||
<option value="shockwave">Shockwave</option>
|
||||
<option value="windowsmedia">Windows Media</option>
|
||||
<option value="realmedia">Real Media</option>
|
||||
<option value="iframe">Iframe</option>
|
||||
</select>
|
||||
<select id="media_type"></select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
@ -159,6 +151,17 @@
|
|||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="video_preload">{#media_dlg.preload}</label></td>
|
||||
<td>
|
||||
<select id="video_preload" name="video_preload" onchange="Media.formToData();">
|
||||
<option value="none">{#media_dlg.preload_none}</option>
|
||||
<option value="metadata">{#media_dlg.preload_metadata}</option>
|
||||
<option value="auto">{#media_dlg.preload_auto}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table role="presentation" border="0" cellpadding="4" cellspacing="0">
|
||||
|
|
@ -175,19 +178,19 @@
|
|||
<td>
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="video_loop" name="video_loop" onchange="Media.formToData();" /></td>
|
||||
<td><label for="video_loop">{#media_dlg.loop}</label></td>
|
||||
<td><input type="checkbox" class="checkbox" id="video_muted" name="video_muted" onchange="Media.formToData();" /></td>
|
||||
<td><label for="video_muted">{#media_dlg.mute}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="video_preload" name="video_preload" onchange="Media.formToData();" /></td>
|
||||
<td><label for="video_preload">{#media_dlg.preload}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="video_loop" name="video_loop" onchange="Media.formToData();" /></td>
|
||||
<td><label for="video_loop">{#media_dlg.loop}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
|
|
@ -202,6 +205,113 @@
|
|||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="embeddedaudio_options">
|
||||
<legend>{#media_dlg.embedded_audio_options}</legend>
|
||||
|
||||
<table role="presentation" border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td>
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="embeddedaudio_autoplay" name="audio_autoplay" onchange="Media.formToData();" /></td>
|
||||
<td><label for="audio_autoplay">{#media_dlg.play}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="embeddedaudio_loop" name="audio_loop" onchange="Media.formToData();" /></td>
|
||||
<td><label for="audio_loop">{#media_dlg.loop}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="embeddedaudio_controls" name="audio_controls" onchange="Media.formToData();" /></td>
|
||||
<td><label for="audio_controls">{#media_dlg.controls}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="audio_options">
|
||||
<legend>{#media_dlg.html5_audio_options}</legend>
|
||||
|
||||
<table role="presentation">
|
||||
<tr>
|
||||
<td><label for="audio_altsource1">{#media_dlg.altsource1}</label></td>
|
||||
<td>
|
||||
<table role="presentation" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td><input type="text" id="audio_altsource1" name="audio_altsource1" onchange="Media.formToData();" style="width: 240px" /></td>
|
||||
<td id="audio_altsource1_filebrowser"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="audio_altsource2">{#media_dlg.altsource2}</label></td>
|
||||
<td>
|
||||
<table role="presentation" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td><input type="text" id="audio_altsource2" name="audio_altsource2" onchange="Media.formToData();" style="width: 240px" /></td>
|
||||
<td id="audio_altsource2_filebrowser"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="audio_preload">{#media_dlg.preload}</label></td>
|
||||
<td>
|
||||
<select id="audio_preload" name="audio_preload" onchange="Media.formToData();">
|
||||
<option value="none">{#media_dlg.preload_none}</option>
|
||||
<option value="metadata">{#media_dlg.preload_metadata}</option>
|
||||
<option value="auto">{#media_dlg.preload_auto}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table role="presentation" border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td>
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="audio_autoplay" name="audio_autoplay" onchange="Media.formToData();" /></td>
|
||||
<td><label for="audio_autoplay">{#media_dlg.play}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="audio_loop" name="audio_loop" onchange="Media.formToData();" /></td>
|
||||
<td><label for="audio_loop">{#media_dlg.loop}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="audio_controls" name="audio_controls" onchange="Media.formToData();" /></td>
|
||||
<td><label for="audio_controls">{#media_dlg.controls}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="flash_options">
|
||||
<legend>{#media_dlg.flash_options}</legend>
|
||||
|
||||
|
|
@ -798,7 +908,7 @@
|
|||
<div id="source_panel" class="panel">
|
||||
<fieldset>
|
||||
<legend>{#media_dlg.source}</legend>
|
||||
<textarea id="source" style="width: 100%; height: 390px"></textarea>
|
||||
<textarea id="source" style="width: 99%; height: 390px"></textarea>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
(function(){tinymce.create("tinymce.plugins.Nonbreaking",{init:function(a,b){var c=this;c.editor=a;a.addCommand("mceNonBreaking",function(){a.execCommand("mceInsertContent",false,(a.plugins.visualchars&&a.plugins.visualchars.state)?'<span 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)})();
|
||||
(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)})();
|
||||
|
|
@ -25,11 +25,12 @@
|
|||
|
||||
if (ed.getParam('nonbreaking_force_tab')) {
|
||||
ed.onKeyDown.add(function(ed, e) {
|
||||
if (tinymce.isIE && e.keyCode == 9) {
|
||||
if (e.keyCode == 9) {
|
||||
e.preventDefault();
|
||||
|
||||
ed.execCommand('mceNonBreaking');
|
||||
ed.execCommand('mceNonBreaking');
|
||||
ed.execCommand('mceNonBreaking');
|
||||
tinymce.dom.Event.cancel(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,34 +9,515 @@
|
|||
*/
|
||||
|
||||
(function() {
|
||||
var Event = tinymce.dom.Event;
|
||||
var TreeWalker = tinymce.dom.TreeWalker;
|
||||
var externalName = 'contenteditable', internalName = 'data-mce-' + externalName;
|
||||
var VK = tinymce.VK;
|
||||
|
||||
function handleContentEditableSelection(ed) {
|
||||
var dom = ed.dom, selection = ed.selection, invisibleChar, caretContainerId = 'mce_noneditablecaret', invisibleChar = '\uFEFF';
|
||||
|
||||
// Returns the content editable state of a node "true/false" or null
|
||||
function getContentEditable(node) {
|
||||
var contentEditable;
|
||||
|
||||
// Ignore non elements
|
||||
if (node.nodeType === 1) {
|
||||
// Check for fake content editable
|
||||
contentEditable = node.getAttribute(internalName);
|
||||
if (contentEditable && contentEditable !== "inherit") {
|
||||
return contentEditable;
|
||||
}
|
||||
|
||||
// Check for real content editable
|
||||
contentEditable = node.contentEditable;
|
||||
if (contentEditable !== "inherit") {
|
||||
return contentEditable;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
// Returns the noneditable parent or null if there is a editable before it or if it wasn't found
|
||||
function getNonEditableParent(node) {
|
||||
var state;
|
||||
|
||||
while (node) {
|
||||
state = getContentEditable(node);
|
||||
if (state) {
|
||||
return state === "false" ? node : null;
|
||||
}
|
||||
|
||||
node = node.parentNode;
|
||||
}
|
||||
};
|
||||
|
||||
// Get caret container parent for the specified node
|
||||
function getParentCaretContainer(node) {
|
||||
while (node) {
|
||||
if (node.id === caretContainerId) {
|
||||
return node;
|
||||
}
|
||||
|
||||
node = node.parentNode;
|
||||
}
|
||||
};
|
||||
|
||||
// Finds the first text node in the specified node
|
||||
function findFirstTextNode(node) {
|
||||
var walker;
|
||||
|
||||
if (node) {
|
||||
walker = new TreeWalker(node, node);
|
||||
|
||||
for (node = walker.current(); node; node = walker.next()) {
|
||||
if (node.nodeType === 3) {
|
||||
return node;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Insert caret container before/after target or expand selection to include block
|
||||
function insertCaretContainerOrExpandToBlock(target, before) {
|
||||
var caretContainer, rng;
|
||||
|
||||
// Select block
|
||||
if (getContentEditable(target) === "false") {
|
||||
if (dom.isBlock(target)) {
|
||||
selection.select(target);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
rng = dom.createRng();
|
||||
|
||||
if (getContentEditable(target) === "true") {
|
||||
if (!target.firstChild) {
|
||||
target.appendChild(ed.getDoc().createTextNode('\u00a0'));
|
||||
}
|
||||
|
||||
target = target.firstChild;
|
||||
before = true;
|
||||
}
|
||||
|
||||
//caretContainer = dom.create('span', {id: caretContainerId, 'data-mce-bogus': true, style:'border: 1px solid red'}, invisibleChar);
|
||||
caretContainer = dom.create('span', {id: caretContainerId, 'data-mce-bogus': true}, invisibleChar);
|
||||
|
||||
if (before) {
|
||||
target.parentNode.insertBefore(caretContainer, target);
|
||||
} else {
|
||||
dom.insertAfter(caretContainer, target);
|
||||
}
|
||||
|
||||
rng.setStart(caretContainer.firstChild, 1);
|
||||
rng.collapse(true);
|
||||
selection.setRng(rng);
|
||||
|
||||
return caretContainer;
|
||||
};
|
||||
|
||||
// Removes any caret container except the one we might be in
|
||||
function removeCaretContainer(caretContainer) {
|
||||
var child, currentCaretContainer, lastContainer;
|
||||
|
||||
if (caretContainer) {
|
||||
rng = selection.getRng(true);
|
||||
rng.setStartBefore(caretContainer);
|
||||
rng.setEndBefore(caretContainer);
|
||||
|
||||
child = findFirstTextNode(caretContainer);
|
||||
if (child && child.nodeValue.charAt(0) == invisibleChar) {
|
||||
child = child.deleteData(0, 1);
|
||||
}
|
||||
|
||||
dom.remove(caretContainer, true);
|
||||
|
||||
selection.setRng(rng);
|
||||
} else {
|
||||
currentCaretContainer = getParentCaretContainer(selection.getStart());
|
||||
while ((caretContainer = dom.get(caretContainerId)) && caretContainer !== lastContainer) {
|
||||
if (currentCaretContainer !== caretContainer) {
|
||||
child = findFirstTextNode(caretContainer);
|
||||
if (child && child.nodeValue.charAt(0) == invisibleChar) {
|
||||
child = child.deleteData(0, 1);
|
||||
}
|
||||
|
||||
dom.remove(caretContainer, true);
|
||||
}
|
||||
|
||||
lastContainer = caretContainer;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Modifies the selection to include contentEditable false elements or insert caret containers
|
||||
function moveSelection() {
|
||||
var nonEditableStart, nonEditableEnd, isCollapsed, rng, element;
|
||||
|
||||
// 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
|
||||
function hasSideContent(element, left) {
|
||||
var container, offset, walker, node, len;
|
||||
|
||||
container = rng.startContainer;
|
||||
offset = rng.startOffset;
|
||||
|
||||
// If endpoint is in middle of text node then expand to beginning/end of element
|
||||
if (container.nodeType == 3) {
|
||||
len = container.nodeValue.length;
|
||||
if ((offset > 0 && offset < len) || (left ? offset == len : offset == 0)) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// Can we resolve the node by index
|
||||
if (offset < container.childNodes.length) {
|
||||
// Browser represents caret position as the offset at the start of an element. When moving right
|
||||
// this is the element we are moving into so we consider our container to be child node at offset-1
|
||||
var pos = !left && offset > 0 ? offset-1 : offset;
|
||||
container = container.childNodes[pos];
|
||||
if (container.hasChildNodes()) {
|
||||
container = container.firstChild;
|
||||
}
|
||||
} else {
|
||||
// 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
|
||||
return !left ? element : null;
|
||||
}
|
||||
}
|
||||
|
||||
// Walk left/right to look for contents
|
||||
walker = new TreeWalker(container, element);
|
||||
while (node = walker[left ? 'prev' : 'next']()) {
|
||||
if (node.nodeType === 3 && node.nodeValue.length > 0) {
|
||||
return;
|
||||
} else if (getContentEditable(node) === "true") {
|
||||
// Found contentEditable=true element return this one to we can move the caret inside it
|
||||
return node;
|
||||
}
|
||||
}
|
||||
|
||||
return element;
|
||||
};
|
||||
|
||||
// Remove any existing caret containers
|
||||
removeCaretContainer();
|
||||
|
||||
// Get noneditable start/end elements
|
||||
isCollapsed = selection.isCollapsed();
|
||||
nonEditableStart = getNonEditableParent(selection.getStart());
|
||||
nonEditableEnd = getNonEditableParent(selection.getEnd());
|
||||
|
||||
// Is any fo the range endpoints noneditable
|
||||
if (nonEditableStart || nonEditableEnd) {
|
||||
rng = selection.getRng(true);
|
||||
|
||||
// If it's a caret selection then look left/right to see if we need to move the caret out side or expand
|
||||
if (isCollapsed) {
|
||||
nonEditableStart = nonEditableStart || nonEditableEnd;
|
||||
var start = selection.getStart();
|
||||
if (element = hasSideContent(nonEditableStart, true)) {
|
||||
// We have no contents to the left of the caret then insert a caret container before the noneditable element
|
||||
insertCaretContainerOrExpandToBlock(element, true);
|
||||
} else if (element = hasSideContent(nonEditableStart, false)) {
|
||||
// We have no contents to the right of the caret then insert a caret container after the noneditable element
|
||||
insertCaretContainerOrExpandToBlock(element, false);
|
||||
} else {
|
||||
// We are in the middle of a noneditable so expand to select it
|
||||
selection.select(nonEditableStart);
|
||||
}
|
||||
} else {
|
||||
rng = selection.getRng(true);
|
||||
|
||||
// Expand selection to include start non editable element
|
||||
if (nonEditableStart) {
|
||||
rng.setStartBefore(nonEditableStart);
|
||||
}
|
||||
|
||||
// Expand selection to include end non editable element
|
||||
if (nonEditableEnd) {
|
||||
rng.setEndAfter(nonEditableEnd);
|
||||
}
|
||||
|
||||
selection.setRng(rng);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function handleKey(ed, e) {
|
||||
var keyCode = e.keyCode, nonEditableParent, caretContainer, startElement, endElement;
|
||||
|
||||
function getNonEmptyTextNodeSibling(node, prev) {
|
||||
while (node = node[prev ? 'previousSibling' : 'nextSibling']) {
|
||||
if (node.nodeType !== 3 || node.nodeValue.length > 0) {
|
||||
return node;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function positionCaretOnElement(element, start) {
|
||||
selection.select(element);
|
||||
selection.collapse(start);
|
||||
}
|
||||
|
||||
function canDelete(backspace) {
|
||||
var rng, container, offset, nonEditableParent;
|
||||
|
||||
function removeNodeIfNotParent(node) {
|
||||
var parent = container;
|
||||
|
||||
while (parent) {
|
||||
if (parent === node) {
|
||||
return;
|
||||
}
|
||||
|
||||
parent = parent.parentNode;
|
||||
}
|
||||
|
||||
dom.remove(node);
|
||||
moveSelection();
|
||||
}
|
||||
|
||||
function isNextPrevTreeNodeNonEditable() {
|
||||
var node, walker, nonEmptyElements = ed.schema.getNonEmptyElements();
|
||||
|
||||
walker = new tinymce.dom.TreeWalker(container, ed.getBody());
|
||||
while (node = (backspace ? walker.prev() : walker.next())) {
|
||||
// Found IMG/INPUT etc
|
||||
if (nonEmptyElements[node.nodeName.toLowerCase()]) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Found text node with contents
|
||||
if (node.nodeType === 3 && tinymce.trim(node.nodeValue).length > 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Found non editable node
|
||||
if (getContentEditable(node) === "false") {
|
||||
removeNodeIfNotParent(node);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the content node is within a non editable parent
|
||||
if (getNonEditableParent(node)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (selection.isCollapsed()) {
|
||||
rng = selection.getRng(true);
|
||||
container = rng.startContainer;
|
||||
offset = rng.startOffset;
|
||||
container = getParentCaretContainer(container) || container;
|
||||
|
||||
// Is in noneditable parent
|
||||
if (nonEditableParent = getNonEditableParent(container)) {
|
||||
removeNodeIfNotParent(nonEditableParent);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if the caret is in the middle of a text node
|
||||
if (container.nodeType == 3 && (backspace ? offset > 0 : offset < container.nodeValue.length)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Resolve container index
|
||||
if (container.nodeType == 1) {
|
||||
container = container.childNodes[offset] || container;
|
||||
}
|
||||
|
||||
// Check if previous or next tree node is non editable then block the event
|
||||
if (isNextPrevTreeNodeNonEditable()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
startElement = selection.getStart()
|
||||
endElement = selection.getEnd();
|
||||
|
||||
// Disable all key presses in contentEditable=false except delete or backspace
|
||||
nonEditableParent = getNonEditableParent(startElement) || getNonEditableParent(endElement);
|
||||
if (nonEditableParent && (keyCode < 112 || keyCode > 124) && keyCode != VK.DELETE && keyCode != VK.BACKSPACE) {
|
||||
// Is Ctrl+c, Ctrl+v or Ctrl+x then use default browser behavior
|
||||
if ((tinymce.isMac ? e.metaKey : e.ctrlKey) && (keyCode == 67 || keyCode == 88 || keyCode == 86)) {
|
||||
return;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
// Arrow left/right select the element and collapse left/right
|
||||
if (keyCode == VK.LEFT || keyCode == VK.RIGHT) {
|
||||
var left = keyCode == VK.LEFT;
|
||||
// If a block element find previous or next element to position the caret
|
||||
if (ed.dom.isBlock(nonEditableParent)) {
|
||||
var targetElement = left ? nonEditableParent.previousSibling : nonEditableParent.nextSibling;
|
||||
var walker = new TreeWalker(targetElement, targetElement);
|
||||
var caretElement = left ? walker.prev() : walker.next();
|
||||
positionCaretOnElement(caretElement, !left);
|
||||
} else {
|
||||
positionCaretOnElement(nonEditableParent, left);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Is arrow left/right, backspace or delete
|
||||
if (keyCode == VK.LEFT || keyCode == VK.RIGHT || keyCode == VK.BACKSPACE || keyCode == VK.DELETE) {
|
||||
caretContainer = getParentCaretContainer(startElement);
|
||||
if (caretContainer) {
|
||||
// Arrow left or backspace
|
||||
if (keyCode == VK.LEFT || keyCode == VK.BACKSPACE) {
|
||||
nonEditableParent = getNonEmptyTextNodeSibling(caretContainer, true);
|
||||
|
||||
if (nonEditableParent && getContentEditable(nonEditableParent) === "false") {
|
||||
e.preventDefault();
|
||||
|
||||
if (keyCode == VK.LEFT) {
|
||||
positionCaretOnElement(nonEditableParent, true);
|
||||
} else {
|
||||
dom.remove(nonEditableParent);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
removeCaretContainer(caretContainer);
|
||||
}
|
||||
}
|
||||
|
||||
// Arrow right or delete
|
||||
if (keyCode == VK.RIGHT || keyCode == VK.DELETE) {
|
||||
nonEditableParent = getNonEmptyTextNodeSibling(caretContainer);
|
||||
|
||||
if (nonEditableParent && getContentEditable(nonEditableParent) === "false") {
|
||||
e.preventDefault();
|
||||
|
||||
if (keyCode == VK.RIGHT) {
|
||||
positionCaretOnElement(nonEditableParent, false);
|
||||
} else {
|
||||
dom.remove(nonEditableParent);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
removeCaretContainer(caretContainer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((keyCode == VK.BACKSPACE || keyCode == VK.DELETE) && !canDelete(keyCode == VK.BACKSPACE)) {
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ed.onMouseDown.addToTop(function(ed, e) {
|
||||
var node = ed.selection.getNode();
|
||||
|
||||
if (getContentEditable(node) === "false" && node == e.target) {
|
||||
// Expand selection on mouse down we can't block the default event since it's used for drag/drop
|
||||
moveSelection();
|
||||
}
|
||||
});
|
||||
|
||||
ed.onMouseUp.addToTop(moveSelection);
|
||||
ed.onKeyDown.addToTop(handleKey);
|
||||
ed.onKeyUp.addToTop(moveSelection);
|
||||
};
|
||||
|
||||
tinymce.create('tinymce.plugins.NonEditablePlugin', {
|
||||
init : function(ed, url) {
|
||||
var t = this, editClass, nonEditClass;
|
||||
var editClass, nonEditClass, nonEditableRegExps;
|
||||
|
||||
t.editor = ed;
|
||||
editClass = ed.getParam("noneditable_editable_class", "mceEditable");
|
||||
nonEditClass = ed.getParam("noneditable_noneditable_class", "mceNonEditable");
|
||||
// Converts configured regexps to noneditable span items
|
||||
function convertRegExpsToNonEditable(ed, args) {
|
||||
var i = nonEditableRegExps.length, content = args.content, cls = tinymce.trim(nonEditClass);
|
||||
|
||||
ed.onNodeChange.addToTop(function(ed, cm, n) {
|
||||
var sc, ec;
|
||||
// Don't replace the variables when raw is used for example on undo/redo
|
||||
if (args.format == "raw") {
|
||||
return;
|
||||
}
|
||||
|
||||
// Block if start or end is inside a non editable element
|
||||
sc = ed.dom.getParent(ed.selection.getStart(), function(n) {
|
||||
return ed.dom.hasClass(n, nonEditClass);
|
||||
while (i--) {
|
||||
content = content.replace(nonEditableRegExps[i], function(match) {
|
||||
var args = arguments, index = args[args.length - 2];
|
||||
|
||||
// Is value inside an attribute then don't replace
|
||||
if (index > 0 && content.charAt(index - 1) == '"') {
|
||||
return match;
|
||||
}
|
||||
|
||||
return '<span class="' + cls + '" data-mce-content="' + ed.dom.encode(args[0]) + '">' + ed.dom.encode(typeof(args[1]) === "string" ? args[1] : args[0]) + '</span>';
|
||||
});
|
||||
}
|
||||
|
||||
args.content = content;
|
||||
};
|
||||
|
||||
editClass = " " + tinymce.trim(ed.getParam("noneditable_editable_class", "mceEditable")) + " ";
|
||||
nonEditClass = " " + tinymce.trim(ed.getParam("noneditable_noneditable_class", "mceNonEditable")) + " ";
|
||||
|
||||
// Setup noneditable regexps array
|
||||
nonEditableRegExps = ed.getParam("noneditable_regexp");
|
||||
if (nonEditableRegExps && !nonEditableRegExps.length) {
|
||||
nonEditableRegExps = [nonEditableRegExps];
|
||||
}
|
||||
|
||||
ed.onPreInit.add(function() {
|
||||
handleContentEditableSelection(ed);
|
||||
|
||||
if (nonEditableRegExps) {
|
||||
ed.selection.onBeforeSetContent.add(convertRegExpsToNonEditable);
|
||||
ed.onBeforeSetContent.add(convertRegExpsToNonEditable);
|
||||
}
|
||||
|
||||
// Apply contentEditable true/false on elements with the noneditable/editable classes
|
||||
ed.parser.addAttributeFilter('class', function(nodes) {
|
||||
var i = nodes.length, className, node;
|
||||
|
||||
while (i--) {
|
||||
node = nodes[i];
|
||||
className = " " + node.attr("class") + " ";
|
||||
|
||||
if (className.indexOf(editClass) !== -1) {
|
||||
node.attr(internalName, "true");
|
||||
} else if (className.indexOf(nonEditClass) !== -1) {
|
||||
node.attr(internalName, "false");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
ec = ed.dom.getParent(ed.selection.getEnd(), function(n) {
|
||||
return ed.dom.hasClass(n, nonEditClass);
|
||||
// Remove internal name
|
||||
ed.serializer.addAttributeFilter(internalName, function(nodes, name) {
|
||||
var i = nodes.length, node;
|
||||
|
||||
while (i--) {
|
||||
node = nodes[i];
|
||||
|
||||
if (nonEditableRegExps && node.attr('data-mce-content')) {
|
||||
node.name = "#text";
|
||||
node.type = 3;
|
||||
node.raw = true;
|
||||
node.value = node.attr('data-mce-content');
|
||||
} else {
|
||||
node.attr(externalName, null);
|
||||
node.attr(internalName, null);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Block or unblock
|
||||
if (sc || ec) {
|
||||
t._setDisabled(1);
|
||||
return false;
|
||||
} else
|
||||
t._setDisabled(0);
|
||||
// Convert external name into internal name
|
||||
ed.parser.addAttributeFilter(externalName, function(nodes, name) {
|
||||
var i = nodes.length, node;
|
||||
|
||||
while (i--) {
|
||||
node = nodes[i];
|
||||
node.attr(internalName, node.attr(externalName));
|
||||
node.attr(externalName, null);
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
|
|
@ -48,42 +529,6 @@
|
|||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/noneditable',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
},
|
||||
|
||||
_block : function(ed, e) {
|
||||
var k = e.keyCode;
|
||||
|
||||
// Don't block arrow keys, pg up/down, and F1-F12
|
||||
if ((k > 32 && k < 41) || (k > 111 && k < 124))
|
||||
return;
|
||||
|
||||
return Event.cancel(e);
|
||||
},
|
||||
|
||||
_setDisabled : function(s) {
|
||||
var t = this, ed = t.editor;
|
||||
|
||||
tinymce.each(ed.controlManager.controls, function(c) {
|
||||
c.setDisabled(s);
|
||||
});
|
||||
|
||||
if (s !== t.disabled) {
|
||||
if (s) {
|
||||
ed.onKeyDown.addToTop(t._block);
|
||||
ed.onKeyPress.addToTop(t._block);
|
||||
ed.onKeyUp.addToTop(t._block);
|
||||
ed.onPaste.addToTop(t._block);
|
||||
ed.onContextMenu.addToTop(t._block);
|
||||
} else {
|
||||
ed.onKeyDown.remove(t._block);
|
||||
ed.onKeyPress.remove(t._block);
|
||||
ed.onKeyUp.remove(t._block);
|
||||
ed.onPaste.remove(t._block);
|
||||
ed.onContextMenu.remove(t._block);
|
||||
}
|
||||
|
||||
t.disabled = s;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
paste_text_sticky : false,
|
||||
paste_text_sticky_default : false,
|
||||
paste_text_notifyalways : false,
|
||||
paste_text_linebreaktype : "p",
|
||||
paste_text_linebreaktype : "combined",
|
||||
paste_text_replacements : [
|
||||
[/\u2026/g, "..."],
|
||||
[/[\x93\x94\u201c\u201d]/g, '"'],
|
||||
|
|
@ -76,7 +76,7 @@
|
|||
// This function executes the process handlers and inserts the contents
|
||||
// force_rich overrides plain text mode set by user, important for pasting with execCommand
|
||||
function process(o, force_rich) {
|
||||
var dom = ed.dom, rng, nodes;
|
||||
var dom = ed.dom, rng;
|
||||
|
||||
// Execute pre process handlers
|
||||
t.onPreProcess.dispatch(t, o);
|
||||
|
|
@ -89,11 +89,9 @@
|
|||
if (tinymce.isGecko) {
|
||||
rng = ed.selection.getRng(true);
|
||||
if (rng.startContainer == rng.endContainer && rng.startContainer.nodeType == 3) {
|
||||
nodes = dom.select('p,h1,h2,h3,h4,h5,h6,pre', o.node);
|
||||
|
||||
// Is only one block node and it doesn't contain word stuff
|
||||
if (nodes.length == 1 && o.content.indexOf('__MCE_ITEM__') === -1)
|
||||
dom.remove(nodes.reverse(), true);
|
||||
if (o.node.childNodes.length === 1 && /^(p|h[1-6]|pre)$/i.test(o.node.firstChild.nodeName) && o.content.indexOf('__MCE_ITEM__') === -1)
|
||||
dom.remove(o.node.firstChild, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -101,11 +99,11 @@
|
|||
t.onPostProcess.dispatch(t, o);
|
||||
|
||||
// Serialize content
|
||||
o.content = ed.serializer.serialize(o.node, {getInner : 1});
|
||||
o.content = ed.serializer.serialize(o.node, {getInner : 1, forced_root_block : ''});
|
||||
|
||||
// Plain text option active?
|
||||
if ((!force_rich) && (ed.pasteAsPlainText)) {
|
||||
t._insertPlainText(ed, dom, o.content);
|
||||
t._insertPlainText(o.content);
|
||||
|
||||
if (!getParam(ed, "paste_text_sticky")) {
|
||||
ed.pasteAsPlainText = false;
|
||||
|
|
@ -132,7 +130,7 @@
|
|||
if (getParam(ed, "paste_text_sticky")) {
|
||||
ed.windowManager.alert(ed.translate('paste.plaintext_mode_sticky'));
|
||||
} else {
|
||||
ed.windowManager.alert(ed.translate('paste.plaintext_mode_sticky'));
|
||||
ed.windowManager.alert(ed.translate('paste.plaintext_mode'));
|
||||
}
|
||||
|
||||
if (!getParam(ed, "paste_text_notifyalways")) {
|
||||
|
|
@ -157,7 +155,7 @@
|
|||
|
||||
if (ed.pasteAsPlainText) {
|
||||
e.preventDefault();
|
||||
process({content : textContent.replace(/\r?\n/g, '<br />')});
|
||||
process({content : dom.encode(textContent).replace(/\r?\n/g, '<br />')});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -172,13 +170,14 @@
|
|||
if (body != ed.getDoc().body)
|
||||
posY = dom.getPos(ed.selection.getStart(), body).y;
|
||||
else
|
||||
posY = body.scrollTop + dom.getViewPort().y;
|
||||
posY = body.scrollTop + dom.getViewPort(ed.getWin()).y;
|
||||
|
||||
// Styles needs to be applied after the element is added to the document since WebKit will otherwise remove all styles
|
||||
// If also needs to be in view on IE or the paste would fail
|
||||
dom.setStyles(n, {
|
||||
position : 'absolute',
|
||||
left : -10000,
|
||||
top : posY,
|
||||
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
|
||||
top : posY - 25,
|
||||
width : 1,
|
||||
height : 1,
|
||||
overflow : 'hidden'
|
||||
|
|
@ -268,8 +267,9 @@
|
|||
h += n.innerHTML;
|
||||
});
|
||||
} else {
|
||||
// Found WebKit weirdness so force the content into plain text mode
|
||||
h = '<pre>' + dom.encode(textContent).replace(/\r?\n/g, '<br />') + '</pre>';
|
||||
// Found WebKit weirdness so force the content into paragraphs this seems to happen when you paste plain text from Nodepad etc
|
||||
// So this logic will replace double enter with paragraphs and single enter with br so it kind of looks the same
|
||||
h = '<p>' + dom.encode(textContent).replace(/\r?\n\r?\n/g, '</p><p>').replace(/\r?\n/g, '<br />') + '</p>';
|
||||
}
|
||||
|
||||
// Remove the nodes
|
||||
|
|
@ -359,9 +359,18 @@
|
|||
}
|
||||
|
||||
// IE9 adds BRs before/after block elements when contents is pasted from word or for example another browser
|
||||
if (tinymce.isIE && document.documentMode >= 9)
|
||||
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)) {
|
||||
// IE9 adds BRs before/after block elements when contents is pasted from word or for example another browser
|
||||
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']]);
|
||||
|
||||
// IE9 also adds an extra BR element for each soft-linefeed and it also adds a BR for each word wrap break
|
||||
process([
|
||||
[/<br><br>/g, '<BR><BR>'], // Replace multiple BR elements with uppercase BR to keep them intact
|
||||
[/<br>/g, ' '], // Replace single br elements with space since they are word wrap BR:s
|
||||
[/<BR><BR>/g, '<br>'] // Replace back the double brs but into a single BR
|
||||
]);
|
||||
}
|
||||
|
||||
// Detect Word content and process it more aggressive
|
||||
if (/class="?Mso|style="[^"]*\bmso-|w:WordDocument/i.test(h) || o.wordContent) {
|
||||
o.wordContent = true; // Mark the pasted contents as word specific content
|
||||
|
|
@ -747,28 +756,24 @@
|
|||
* plugin, and requires minimal changes to add the new functionality.
|
||||
* Speednet - June 2009
|
||||
*/
|
||||
_insertPlainText : function(ed, dom, h) {
|
||||
var i, len, pos, rpos, node, breakElms, before, after,
|
||||
w = ed.getWin(),
|
||||
d = ed.getDoc(),
|
||||
sel = ed.selection,
|
||||
is = tinymce.is,
|
||||
inArray = tinymce.inArray,
|
||||
_insertPlainText : function(content) {
|
||||
var ed = this.editor,
|
||||
linebr = getParam(ed, "paste_text_linebreaktype"),
|
||||
rl = getParam(ed, "paste_text_replacements");
|
||||
rl = getParam(ed, "paste_text_replacements"),
|
||||
is = tinymce.is;
|
||||
|
||||
function process(items) {
|
||||
each(items, function(v) {
|
||||
if (v.constructor == RegExp)
|
||||
h = h.replace(v, "");
|
||||
content = content.replace(v, "");
|
||||
else
|
||||
h = h.replace(v[0], v[1]);
|
||||
content = content.replace(v[0], v[1]);
|
||||
});
|
||||
};
|
||||
|
||||
if ((typeof(h) === "string") && (h.length > 0)) {
|
||||
if ((typeof(content) === "string") && (content.length > 0)) {
|
||||
// If HTML content with line-breaking tags, then remove all cr/lf chars because only tags will break a line
|
||||
if (/<(?:p|br|h[1-6]|ul|ol|dl|table|t[rdh]|div|blockquote|fieldset|pre|address|center)[^>]*>/i.test(h)) {
|
||||
if (/<(?:p|br|h[1-6]|ul|ol|dl|table|t[rdh]|div|blockquote|fieldset|pre|address|center)[^>]*>/i.test(content)) {
|
||||
process([
|
||||
/[\n\r]+/g
|
||||
]);
|
||||
|
|
@ -785,114 +790,47 @@
|
|||
[/<\/t[dh]>\s*<t[dh][^>]*>/gi, "\t"], // Table cells get tabs betweem them
|
||||
/<[a-z!\/?][^>]*>/gi, // Delete all remaining tags
|
||||
[/ /gi, " "], // Convert non-break spaces to regular spaces (remember, *plain text*)
|
||||
[/(?:(?!\n)\s)*(\n+)(?:(?!\n)\s)*/gi, "$1"], // Cool little RegExp deletes whitespace around linebreak chars.
|
||||
[/\n{3,}/g, "\n\n"], // Max. 2 consecutive linebreaks
|
||||
/^\s+|\s+$/g // Trim the front & back
|
||||
[/(?:(?!\n)\s)*(\n+)(?:(?!\n)\s)*/gi, "$1"],// Cool little RegExp deletes whitespace around linebreak chars.
|
||||
[/\n{3,}/g, "\n\n"] // Max. 2 consecutive linebreaks
|
||||
]);
|
||||
|
||||
h = dom.decode(tinymce.html.Entities.encodeRaw(h));
|
||||
|
||||
// Delete any highlighted text before pasting
|
||||
if (!sel.isCollapsed()) {
|
||||
d.execCommand("Delete", false, null);
|
||||
}
|
||||
content = ed.dom.decode(tinymce.html.Entities.encodeRaw(content));
|
||||
|
||||
// Perform default or custom replacements
|
||||
if (is(rl, "array") || (is(rl, "array"))) {
|
||||
if (is(rl, "array")) {
|
||||
process(rl);
|
||||
}
|
||||
else if (is(rl, "string")) {
|
||||
} else if (is(rl, "string")) {
|
||||
process(new RegExp(rl, "gi"));
|
||||
}
|
||||
|
||||
// Treat paragraphs as specified in the config
|
||||
if (linebr == "none") {
|
||||
// Convert all line breaks to space
|
||||
process([
|
||||
[/\n+/g, " "]
|
||||
]);
|
||||
}
|
||||
else if (linebr == "br") {
|
||||
} else if (linebr == "br") {
|
||||
// Convert all line breaks to <br />
|
||||
process([
|
||||
[/\n/g, "<br />"]
|
||||
]);
|
||||
}
|
||||
else {
|
||||
} else if (linebr == "p") {
|
||||
// Convert all line breaks to <p>...</p>
|
||||
process([
|
||||
[/\n+/g, "</p><p>"],
|
||||
[/^(.*<\/p>)(<p>)$/, '<p>$1']
|
||||
]);
|
||||
} else {
|
||||
// defaults to "combined"
|
||||
// Convert single line breaks to <br /> and double line breaks to <p>...</p>
|
||||
process([
|
||||
/^\s+|\s+$/g,
|
||||
[/\n\n/g, "</p><p>"],
|
||||
[/^(.*<\/p>)(<p>)$/, '<p>$1'],
|
||||
[/\n/g, "<br />"]
|
||||
]);
|
||||
}
|
||||
|
||||
// This next piece of code handles the situation where we're pasting more than one paragraph of plain
|
||||
// text, and we are pasting the content into the middle of a block node in the editor. The block
|
||||
// node gets split at the selection point into "Para A" and "Para B" (for the purposes of explaining).
|
||||
// The first paragraph of the pasted text is appended to "Para A", and the last paragraph of the
|
||||
// pasted text is prepended to "Para B". Any other paragraphs of pasted text are placed between
|
||||
// "Para A" and "Para B". This code solves a host of problems with the original plain text plugin and
|
||||
// now handles styles correctly. (Pasting plain text into a styled paragraph is supposed to make the
|
||||
// plain text take the same style as the existing paragraph.)
|
||||
if ((pos = h.indexOf("</p><p>")) != -1) {
|
||||
rpos = h.lastIndexOf("</p><p>");
|
||||
node = sel.getNode();
|
||||
breakElms = []; // Get list of elements to break
|
||||
|
||||
do {
|
||||
if (node.nodeType == 1) {
|
||||
// Don't break tables and break at body
|
||||
if (node.nodeName == "TD" || node.nodeName == "BODY") {
|
||||
break;
|
||||
}
|
||||
|
||||
breakElms[breakElms.length] = node;
|
||||
}
|
||||
} while (node = node.parentNode);
|
||||
|
||||
// Are we in the middle of a block node?
|
||||
if (breakElms.length > 0) {
|
||||
before = h.substring(0, pos);
|
||||
after = "";
|
||||
|
||||
for (i=0, len=breakElms.length; i<len; i++) {
|
||||
before += "</" + breakElms[i].nodeName.toLowerCase() + ">";
|
||||
after += "<" + breakElms[breakElms.length-i-1].nodeName.toLowerCase() + ">";
|
||||
}
|
||||
|
||||
if (pos == rpos) {
|
||||
h = before + after + h.substring(pos+7);
|
||||
}
|
||||
else {
|
||||
h = before + h.substring(pos+4, rpos+4) + after + h.substring(rpos+7);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Insert content at the caret, plus add a marker for repositioning the caret
|
||||
ed.execCommand("mceInsertRawHTML", false, h + '<span id="_plain_text_marker"> </span>');
|
||||
|
||||
// Reposition the caret to the marker, which was placed immediately after the inserted content.
|
||||
// Needs to be done asynchronously (in window.setTimeout) or else it doesn't work in all browsers.
|
||||
// The second part of the code scrolls the content up if the caret is positioned off-screen.
|
||||
// This is only necessary for WebKit browsers, but it doesn't hurt to use for all.
|
||||
window.setTimeout(function() {
|
||||
var marker = dom.get('_plain_text_marker'),
|
||||
elm, vp, y, elmHeight;
|
||||
|
||||
sel.select(marker, false);
|
||||
d.execCommand("Delete", false, null);
|
||||
marker = null;
|
||||
|
||||
// Get element, position and height
|
||||
elm = sel.getStart();
|
||||
vp = dom.getViewPort(w);
|
||||
y = dom.getPos(elm).y;
|
||||
elmHeight = elm.clientHeight;
|
||||
|
||||
// Is element within viewport if not then scroll it into view
|
||||
if ((y < vp.y) || (y + elmHeight > vp.y + vp.h)) {
|
||||
d.body.scrollTop = y < vp.y ? y : y - vp.h + 25;
|
||||
}
|
||||
}, 0);
|
||||
ed.execCommand('mceInsertContent', false, content);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
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."});
|
||||
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."});
|
||||
|
|
@ -1 +1 @@
|
|||
tinyMCE.addI18n('en.searchreplace_dlg',{findwhat:"Find what",replacewith:"Replace with",direction:"Direction",up:"Up",down:"Down",mcase:"Match case",findnext:"Find next",allreplaced:"All occurrences of the search string were replaced.","searchnext_desc":"Find again",notfound:"The search has been completed. The search string could not be found.","search_title":"Find","replace_title":"Find/Replace",replaceall:"Replace all",replace:"Replace"});
|
||||
tinyMCE.addI18n('en.searchreplace_dlg',{findwhat:"Find What",replacewith:"Replace with",direction:"Direction",up:"Up",down:"Down",mcase:"Match Case",findnext:"Find Next",allreplaced:"All occurrences of the search string were replaced.","searchnext_desc":"Find Again",notfound:"The search has been completed. The search string could not be found.","search_title":"Find","replace_title":"Find/Replace",replaceall:"Replace All",replace:"Replace"});
|
||||
|
|
@ -93,7 +93,7 @@
|
|||
<input type="submit" id="insert" name="insert" value="{#searchreplace_dlg.findnext}" />
|
||||
<input type="button" class="button" id="replaceBtn" name="replaceBtn" value="{#searchreplace_dlg.replace}" onclick="SearchReplaceDialog.searchNext('current');" />
|
||||
<input type="button" class="button" id="replaceAllBtn" name="replaceAllBtn" value="{#searchreplace_dlg.replaceall}" onclick="SearchReplaceDialog.searchNext('all');" />
|
||||
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
|
||||
<input type="button" id="cancel" name="close" value="{#close}" onclick="tinyMCEPopup.close();" />
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@
|
|||
},
|
||||
|
||||
_removeWords : function(w) {
|
||||
var ed = this.editor, dom = ed.dom, se = ed.selection, b = se.getBookmark();
|
||||
var ed = this.editor, dom = ed.dom, se = ed.selection, r = se.getRng(true);
|
||||
|
||||
each(dom.select('span').reverse(), function(n) {
|
||||
if (n && (dom.hasClass(n, 'mceItemHiddenSpellWord') || dom.hasClass(n, 'mceItemHidden'))) {
|
||||
|
|
@ -217,11 +217,11 @@
|
|||
}
|
||||
});
|
||||
|
||||
se.moveToBookmark(b);
|
||||
se.setRng(r);
|
||||
},
|
||||
|
||||
_markWords : function(wl) {
|
||||
var ed = this.editor, dom = ed.dom, doc = ed.getDoc(), se = ed.selection, b = se.getBookmark(), nl = [],
|
||||
var ed = this.editor, dom = ed.dom, doc = ed.getDoc(), se = ed.selection, r = se.getRng(true), nl = [],
|
||||
w = wl.join('|'), re = this._getSeparators(), rx = new RegExp('(^|[' + re + '])(' + w + ')(?=[' + re + ']|$)', 'g');
|
||||
|
||||
// Collect all text nodes
|
||||
|
|
@ -279,7 +279,7 @@
|
|||
}
|
||||
});
|
||||
|
||||
se.moveToBookmark(b);
|
||||
se.setRng(r);
|
||||
},
|
||||
|
||||
_showMenu : function(ed, e) {
|
||||
|
|
@ -314,43 +314,44 @@
|
|||
} else
|
||||
m.add({title : 'spellchecker.no_sug', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
|
||||
|
||||
ignoreRpc = t.editor.getParam("spellchecker_enable_ignore_rpc", '');
|
||||
m.add({
|
||||
title : 'spellchecker.ignore_word',
|
||||
onclick : function() {
|
||||
var word = wordSpan.innerHTML;
|
||||
if (ed.getParam('show_ignore_words', true)) {
|
||||
ignoreRpc = t.editor.getParam("spellchecker_enable_ignore_rpc", '');
|
||||
m.add({
|
||||
title : 'spellchecker.ignore_word',
|
||||
onclick : function() {
|
||||
var word = wordSpan.innerHTML;
|
||||
|
||||
dom.remove(wordSpan, 1);
|
||||
t._checkDone();
|
||||
dom.remove(wordSpan, 1);
|
||||
t._checkDone();
|
||||
|
||||
// tell the server if we need to
|
||||
if (ignoreRpc) {
|
||||
ed.setProgressState(1);
|
||||
t._sendRPC('ignoreWord', [t.selectedLang, word], function(r) {
|
||||
ed.setProgressState(0);
|
||||
});
|
||||
// tell the server if we need to
|
||||
if (ignoreRpc) {
|
||||
ed.setProgressState(1);
|
||||
t._sendRPC('ignoreWord', [t.selectedLang, word], function(r) {
|
||||
ed.setProgressState(0);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
m.add({
|
||||
title : 'spellchecker.ignore_words',
|
||||
onclick : function() {
|
||||
var word = wordSpan.innerHTML;
|
||||
m.add({
|
||||
title : 'spellchecker.ignore_words',
|
||||
onclick : function() {
|
||||
var word = wordSpan.innerHTML;
|
||||
|
||||
t._removeWords(dom.decode(word));
|
||||
t._checkDone();
|
||||
t._removeWords(dom.decode(word));
|
||||
t._checkDone();
|
||||
|
||||
// tell the server if we need to
|
||||
if (ignoreRpc) {
|
||||
ed.setProgressState(1);
|
||||
t._sendRPC('ignoreWords', [t.selectedLang, word], function(r) {
|
||||
ed.setProgressState(0);
|
||||
});
|
||||
// tell the server if we need to
|
||||
if (ignoreRpc) {
|
||||
ed.setProgressState(1);
|
||||
t._sendRPC('ignoreWords', [t.selectedLang, word], function(r) {
|
||||
ed.setProgressState(0);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
if (t.editor.getParam("spellchecker_enable_learn_rpc")) {
|
||||
m.add({
|
||||
|
|
@ -372,7 +373,7 @@
|
|||
m.update();
|
||||
});
|
||||
|
||||
p1 = dom.getPos(ed.getContentAreaContainer());
|
||||
p1 = DOM.getPos(ed.getContentAreaContainer());
|
||||
m.settings.offset_x = p1.x;
|
||||
m.settings.offset_y = p1.y;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ select, #block_text_indent, #box_width, #box_height, #box_padding_top, #box_padd
|
|||
#box_margin_top, #box_margin_right, #box_margin_bottom, #box_margin_left, #positioning_width, #positioning_height, #positioning_zindex {width:70px;}
|
||||
#positioning_placement_top, #positioning_placement_right, #positioning_placement_bottom, #positioning_placement_left {width:70px;}
|
||||
#positioning_clip_top, #positioning_clip_right, #positioning_clip_bottom, #positioning_clip_left {width:70px;}
|
||||
.panel_toggle_insert_span {padding-top:10px;}
|
||||
.panel_wrapper div.current {padding-top:10px;height:230px;}
|
||||
.delim {border-left:1px solid gray;}
|
||||
.tdelim {border-bottom:1px solid gray;}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
(function(){tinymce.create("tinymce.plugins.StylePlugin",{init:function(a,b){a.addCommand("mceStyleProps",function(){a.windowManager.open({file:b+"/props.htm",width:480+parseInt(a.getLang("style.delta_width",0)),height:320+parseInt(a.getLang("style.delta_height",0)),inline:1},{plugin_url:b,style_text:a.selection.getNode().style.cssText})});a.addCommand("mceSetElementStyle",function(d,c){if(e=a.selection.getNode()){a.dom.setAttrib(e,"style",c);a.execCommand("mceRepaint")}});a.onNodeChange.add(function(d,c,f){c.setDisabled("styleprops",f.nodeName==="BODY")});a.addButton("styleprops",{title:"style.desc",cmd:"mceStyleProps"})},getInfo:function(){return{longname:"Style",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("style",tinymce.plugins.StylePlugin)})();
|
||||
(function(){tinymce.create("tinymce.plugins.StylePlugin",{init:function(a,b){a.addCommand("mceStyleProps",function(){var c=false;var f=a.selection.getSelectedBlocks();var d=[];if(f.length===1){d.push(a.selection.getNode().style.cssText)}else{tinymce.each(f,function(g){d.push(a.dom.getAttrib(g,"style"))});c=true}a.windowManager.open({file:b+"/props.htm",width:480+parseInt(a.getLang("style.delta_width",0)),height:340+parseInt(a.getLang("style.delta_height",0)),inline:1},{applyStyleToBlocks:c,plugin_url:b,styles:d})});a.addCommand("mceSetElementStyle",function(d,c){if(e=a.selection.getNode()){a.dom.setAttrib(e,"style",c);a.execCommand("mceRepaint")}});a.onNodeChange.add(function(d,c,f){c.setDisabled("styleprops",f.nodeName==="BODY")});a.addButton("styleprops",{title:"style.desc",cmd:"mceStyleProps"})},getInfo:function(){return{longname:"Style",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("style",tinymce.plugins.StylePlugin)})();
|
||||
|
|
@ -13,14 +13,30 @@
|
|||
init : function(ed, url) {
|
||||
// Register commands
|
||||
ed.addCommand('mceStyleProps', function() {
|
||||
|
||||
var applyStyleToBlocks = false;
|
||||
var blocks = ed.selection.getSelectedBlocks();
|
||||
var styles = [];
|
||||
|
||||
if (blocks.length === 1) {
|
||||
styles.push(ed.selection.getNode().style.cssText);
|
||||
}
|
||||
else {
|
||||
tinymce.each(blocks, function(block) {
|
||||
styles.push(ed.dom.getAttrib(block, 'style'));
|
||||
});
|
||||
applyStyleToBlocks = true;
|
||||
}
|
||||
|
||||
ed.windowManager.open({
|
||||
file : url + '/props.htm',
|
||||
width : 480 + parseInt(ed.getLang('style.delta_width', 0)),
|
||||
height : 320 + parseInt(ed.getLang('style.delta_height', 0)),
|
||||
height : 340 + parseInt(ed.getLang('style.delta_height', 0)),
|
||||
inline : 1
|
||||
}, {
|
||||
applyStyleToBlocks : applyStyleToBlocks,
|
||||
plugin_url : url,
|
||||
style_text : ed.selection.getNode().style.cssText
|
||||
styles : styles
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -52,4 +68,4 @@
|
|||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('style', tinymce.plugins.StylePlugin);
|
||||
})();
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -27,10 +27,41 @@ var defaultBorderStyle = "none;solid;dashed;dotted;double;groove;ridge;inset;out
|
|||
var defaultBorderWidth = "thin;medium;thick";
|
||||
var defaultListType = "disc;circle;square;decimal;lower-roman;upper-roman;lower-alpha;upper-alpha;none";
|
||||
|
||||
function init() {
|
||||
function aggregateStyles(allStyles) {
|
||||
var mergedStyles = {};
|
||||
|
||||
tinymce.each(allStyles, function(style) {
|
||||
if (style !== '') {
|
||||
var parsedStyles = tinyMCEPopup.editor.dom.parseStyle(style);
|
||||
for (var name in parsedStyles) {
|
||||
if (parsedStyles.hasOwnProperty(name)) {
|
||||
if (mergedStyles[name] === undefined) {
|
||||
mergedStyles[name] = parsedStyles[name];
|
||||
}
|
||||
else if (name === 'text-decoration') {
|
||||
if (mergedStyles[name].indexOf(parsedStyles[name]) === -1) {
|
||||
mergedStyles[name] = mergedStyles[name] +' '+ parsedStyles[name];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return mergedStyles;
|
||||
}
|
||||
|
||||
var applyActionIsInsert;
|
||||
var existingStyles;
|
||||
|
||||
function init(ed) {
|
||||
var ce = document.getElementById('container'), h;
|
||||
|
||||
ce.style.cssText = tinyMCEPopup.getWindowArg('style_text');
|
||||
existingStyles = aggregateStyles(tinyMCEPopup.getWindowArg('styles'));
|
||||
ce.style.cssText = tinyMCEPopup.editor.dom.serializeStyle(existingStyles);
|
||||
|
||||
applyActionIsInsert = ed.getParam("edit_css_style_insert_span", false);
|
||||
document.getElementById('toggle_insert_span').checked = applyActionIsInsert;
|
||||
|
||||
h = getBrowserHTML('background_image_browser','background_image','image','advimage');
|
||||
document.getElementById("background_image_browser").innerHTML = h;
|
||||
|
|
@ -144,6 +175,8 @@ function setupFormData() {
|
|||
f.text_overline.checked = inStr(ce.style.textDecoration, 'overline');
|
||||
f.text_linethrough.checked = inStr(ce.style.textDecoration, 'line-through');
|
||||
f.text_blink.checked = inStr(ce.style.textDecoration, 'blink');
|
||||
f.text_none.checked = inStr(ce.style.textDecoration, 'none');
|
||||
updateTextDecorations();
|
||||
|
||||
// Setup background fields
|
||||
|
||||
|
|
@ -366,13 +399,41 @@ function hasEqualValues(a) {
|
|||
return true;
|
||||
}
|
||||
|
||||
function toggleApplyAction() {
|
||||
applyActionIsInsert = ! applyActionIsInsert;
|
||||
}
|
||||
|
||||
function applyAction() {
|
||||
var ce = document.getElementById('container'), ed = tinyMCEPopup.editor;
|
||||
|
||||
generateCSS();
|
||||
|
||||
tinyMCEPopup.restoreSelection();
|
||||
ed.dom.setAttrib(ed.selection.getNode(), 'style', tinyMCEPopup.editor.dom.serializeStyle(tinyMCEPopup.editor.dom.parseStyle(ce.style.cssText)));
|
||||
|
||||
var newStyles = tinyMCEPopup.editor.dom.parseStyle(ce.style.cssText);
|
||||
|
||||
if (applyActionIsInsert) {
|
||||
ed.formatter.register('plugin_style', {
|
||||
inline: 'span', styles: existingStyles
|
||||
});
|
||||
ed.formatter.remove('plugin_style');
|
||||
|
||||
ed.formatter.register('plugin_style', {
|
||||
inline: 'span', styles: newStyles
|
||||
});
|
||||
ed.formatter.apply('plugin_style');
|
||||
} else {
|
||||
var nodes;
|
||||
|
||||
if (tinyMCEPopup.getWindowArg('applyStyleToBlocks')) {
|
||||
nodes = ed.selection.getSelectedBlocks();
|
||||
}
|
||||
else {
|
||||
nodes = ed.selection.getNode();
|
||||
}
|
||||
|
||||
ed.dom.setAttrib(nodes, 'style', tinyMCEPopup.editor.dom.serializeStyle(newStyles));
|
||||
}
|
||||
}
|
||||
|
||||
function updateAction() {
|
||||
|
|
@ -632,4 +693,17 @@ function synch(fr, to) {
|
|||
selectByValue(f, to + "_measurement", f.elements[fr + "_measurement"].value);
|
||||
}
|
||||
|
||||
function updateTextDecorations(){
|
||||
var el = document.forms[0].elements;
|
||||
|
||||
var textDecorations = ["text_underline", "text_overline", "text_linethrough", "text_blink"];
|
||||
var noneChecked = el["text_none"].checked;
|
||||
tinymce.each(textDecorations, function(id) {
|
||||
el[id].disabled = noneChecked;
|
||||
if (noneChecked) {
|
||||
el[id].checked = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
tinyMCEPopup.onInit.add(init);
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
tinyMCE.addI18n('en.style_dlg',{"text_lineheight":"Line height","text_variant":"Variant","text_style":"Style","text_weight":"Weight","text_size":"Size","text_font":"Font","text_props":"Text","positioning_tab":"Positioning","list_tab":"List","border_tab":"Border","box_tab":"Box","block_tab":"Block","background_tab":"Background","text_tab":"Text",apply:"Apply",title:"Edit CSS Style",clip:"Clip",placement:"Placement",overflow:"Overflow",zindex:"Z-index",visibility:"Visibility","positioning_type":"Type",position:"Position","bullet_image":"Bullet image","list_type":"Type",color:"Color",height:"Height",width:"Width",style:"Style",margin:"Margin",left:"Left",bottom:"Bottom",right:"Right",top:"Top",same:"Same for all",padding:"Padding","box_clear":"Clear","box_float":"Float","box_height":"Height","box_width":"Width","block_display":"Display","block_whitespace":"Whitespace","block_text_indent":"Text indent","block_text_align":"Text align","block_vertical_alignment":"Vertical alignment","block_letterspacing":"Letter spacing","block_wordspacing":"Word spacing","background_vpos":"Vertical position","background_hpos":"Horizontal position","background_attachment":"Attachment","background_repeat":"Repeat","background_image":"Background image","background_color":"Background color","text_none":"none","text_blink":"blink","text_case":"Case","text_striketrough":"strikethrough","text_underline":"underline","text_overline":"overline","text_decoration":"Decoration","text_color":"Color"});
|
||||
tinyMCE.addI18n('en.style_dlg',{"text_lineheight":"Line Height","text_variant":"Variant","text_style":"Style","text_weight":"Weight","text_size":"Size","text_font":"Font","text_props":"Text","positioning_tab":"Positioning","list_tab":"List","border_tab":"Border","box_tab":"Box","block_tab":"Block","background_tab":"Background","text_tab":"Text",apply:"Apply",toggle_insert_span:"Insert span at selection",title:"Edit CSS Style",clip:"Clip",placement:"Placement",overflow:"Overflow",zindex:"Z-index",visibility:"Visibility","positioning_type":"Type",position:"Position","bullet_image":"Bullet Image","list_type":"Type",color:"Color",height:"Height",width:"Width",style:"Style",margin:"Margin",left:"Left",bottom:"Bottom",right:"Right",top:"Top",same:"Same for All",padding:"Padding","box_clear":"Clear","box_float":"Float","box_height":"Height","box_width":"Width","block_display":"Display","block_whitespace":"Whitespace","block_text_indent":"Text Indent","block_text_align":"Text Align","block_vertical_alignment":"Vertical Alignment","block_letterspacing":"Letter Spacing","block_wordspacing":"Word Spacing","background_vpos":"Vertical Position","background_hpos":"Horizontal Position","background_attachment":"Attachment","background_repeat":"Repeat","background_image":"Background Image","background_color":"Background Color","text_none":"None","text_blink":"Blink","text_case":"Case","text_striketrough":"Strikethrough","text_underline":"Underline","text_overline":"Overline","text_decoration":"Decoration","text_color":"Color",text:"Text",background:"Background",block:"Block",box:"Box",border:"Border",list:"List"});
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@
|
|||
<td><label for="text_blink">{#style_dlg.text_blink}</label></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input id="text_none" name="text_none" class="checkbox" type="checkbox" /></td>
|
||||
<td><input id="text_none" name="text_none" class="checkbox" type="checkbox" onclick="updateTextDecorations();"/></td>
|
||||
<td><label for="text_none">{#style_dlg.text_none}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
|
@ -316,6 +316,8 @@
|
|||
<td><select id="box_clear" name="box_clear" class="mceEditableSelect"></select></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<div style="float: left; width: 49%">
|
||||
<fieldset>
|
||||
<legend>{#style_dlg.padding}</legend>
|
||||
|
|
@ -672,6 +674,7 @@
|
|||
<td><select id="positioning_overflow" name="positioning_overflow" class="mceEditableSelect"></select></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<div style="float: left; width: 49%">
|
||||
<fieldset>
|
||||
|
|
@ -820,7 +823,11 @@
|
|||
</div>
|
||||
<br style="clear: both" />
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div class="panel_toggle_insert_span">
|
||||
<input type="checkbox" class="checkbox" id="toggle_insert_span" name="toggle_insert_span" onClick="toggleApplyAction();" />
|
||||
<label for="toggle_insert_span">{#style_dlg.toggle_insert_span}</label>
|
||||
</div>
|
||||
|
||||
<div class="mceActionPanel">
|
||||
|
|
|
|||
19
www/extras/tinymce/jscripts/tiny_mce/plugins/style/readme.txt
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
Edit CSS Style plug-in notes
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Unlike WYSIWYG editor functionality that operates only on the selected text,
|
||||
typically by inserting new HTML elements with the specified styles.
|
||||
This plug-in operates on the HTML blocks surrounding the selected text.
|
||||
No new HTML elements are created.
|
||||
|
||||
This plug-in only operates on the surrounding blocks and not the nearest
|
||||
parent node. This means that if a block encapsulates a node,
|
||||
e.g <p><span>text</span></p>, then only the styles in the block are
|
||||
recognized, not those in the span.
|
||||
|
||||
When selecting text that includes multiple blocks at the same level (peers),
|
||||
this plug-in accumulates the specified styles in all of the surrounding blocks
|
||||
and populates the dialogue checkboxes accordingly. There is no differentiation
|
||||
between styles set in all the blocks versus styles set in some of the blocks.
|
||||
|
||||
When the [Update] or [Apply] buttons are pressed, the styles selected in the
|
||||
checkboxes are applied to all blocks that surround the selected text.
|
||||
|
|
@ -1 +1 @@
|
|||
(function(){var c=tinymce.DOM,a=tinymce.dom.Event,d=tinymce.each,b=tinymce.explode;tinymce.create("tinymce.plugins.TabFocusPlugin",{init:function(f,g){function e(i,j){if(j.keyCode===9){return a.cancel(j)}}function h(l,p){var j,m,o,n,k;function q(r){n=c.select(":input:enabled,*[tabindex]");function i(s){return s.type!="hidden"&&s.tabIndex!="-1"&&!(n[m].style.display=="none")&&!(n[m].style.visibility=="hidden")}d(n,function(t,s){if(t.id==l.id){j=s;return false}});if(r>0){for(m=j+1;m<n.length;m++){if(i(n[m])){return n[m]}}}else{for(m=j-1;m>=0;m--){if(i(n[m])){return n[m]}}}return null}if(p.keyCode===9){k=b(l.getParam("tab_focus",l.getParam("tabfocus_elements",":prev,:next")));if(k.length==1){k[1]=k[0];k[0]=":prev"}if(p.shiftKey){if(k[0]==":prev"){n=q(-1)}else{n=c.get(k[0])}}else{if(k[1]==":next"){n=q(1)}else{n=c.get(k[1])}}if(n){if(n.id&&(l=tinymce.get(n.id||n.name))){l.focus()}else{window.setTimeout(function(){if(!tinymce.isWebKit){window.focus()}n.focus()},10)}return a.cancel(p)}}}f.onKeyUp.add(e);if(tinymce.isGecko){f.onKeyPress.add(h);f.onKeyDown.add(e)}else{f.onKeyDown.add(h)}},getInfo:function(){return{longname:"Tabfocus",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/tabfocus",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("tabfocus",tinymce.plugins.TabFocusPlugin)})();
|
||||
(function(){var c=tinymce.DOM,a=tinymce.dom.Event,d=tinymce.each,b=tinymce.explode;tinymce.create("tinymce.plugins.TabFocusPlugin",{init:function(f,g){function e(i,j){if(j.keyCode===9){return a.cancel(j)}}function h(l,p){var j,m,o,n,k;function q(t){n=c.select(":input:enabled,*[tabindex]:not(iframe)");function s(v){return v.nodeName==="BODY"||(v.type!="hidden"&&!(v.style.display=="none")&&!(v.style.visibility=="hidden")&&s(v.parentNode))}function i(v){return v.attributes.tabIndex.specified||v.nodeName=="INPUT"||v.nodeName=="TEXTAREA"}function u(){return tinymce.isIE6||tinymce.isIE7}function r(v){return((!u()||i(v)))&&v.getAttribute("tabindex")!="-1"&&s(v)}d(n,function(w,v){if(w.id==l.id){j=v;return false}});if(t>0){for(m=j+1;m<n.length;m++){if(r(n[m])){return n[m]}}}else{for(m=j-1;m>=0;m--){if(r(n[m])){return n[m]}}}return null}if(p.keyCode===9){k=b(l.getParam("tab_focus",l.getParam("tabfocus_elements",":prev,:next")));if(k.length==1){k[1]=k[0];k[0]=":prev"}if(p.shiftKey){if(k[0]==":prev"){n=q(-1)}else{n=c.get(k[0])}}else{if(k[1]==":next"){n=q(1)}else{n=c.get(k[1])}}if(n){if(n.id&&(l=tinymce.get(n.id||n.name))){l.focus()}else{window.setTimeout(function(){if(!tinymce.isWebKit){window.focus()}n.focus()},10)}return a.cancel(p)}}}f.onKeyUp.add(e);if(tinymce.isGecko){f.onKeyPress.add(h);f.onKeyDown.add(e)}else{f.onKeyDown.add(h)}},getInfo:function(){return{longname:"Tabfocus",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/tabfocus",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("tabfocus",tinymce.plugins.TabFocusPlugin)})();
|
||||
|
|
@ -1,114 +1,122 @@
|
|||
/**
|
||||
* editor_plugin_src.js
|
||||
*
|
||||
* Copyright 2009, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
*
|
||||
* License: http://tinymce.moxiecode.com/license
|
||||
* Contributing: http://tinymce.moxiecode.com/contributing
|
||||
*/
|
||||
|
||||
(function() {
|
||||
var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, explode = tinymce.explode;
|
||||
|
||||
tinymce.create('tinymce.plugins.TabFocusPlugin', {
|
||||
init : function(ed, url) {
|
||||
function tabCancel(ed, e) {
|
||||
if (e.keyCode === 9)
|
||||
return Event.cancel(e);
|
||||
};
|
||||
|
||||
function tabHandler(ed, e) {
|
||||
var x, i, f, el, v;
|
||||
|
||||
function find(d) {
|
||||
el = DOM.select(':input:enabled,*[tabindex]');
|
||||
function canSelect(e) {
|
||||
return e.type != 'hidden' &&
|
||||
e.tabIndex != '-1' &&
|
||||
!(el[i].style.display == "none") &&
|
||||
!(el[i].style.visibility == "hidden");
|
||||
}
|
||||
|
||||
each(el, function(e, i) {
|
||||
if (e.id == ed.id) {
|
||||
x = i;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
if (d > 0) {
|
||||
for (i = x + 1; i < el.length; i++) {
|
||||
if (canSelect(el[i]))
|
||||
return el[i];
|
||||
}
|
||||
} else {
|
||||
for (i = x - 1; i >= 0; i--) {
|
||||
if (canSelect(el[i]))
|
||||
return el[i];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
if (e.keyCode === 9) {
|
||||
v = explode(ed.getParam('tab_focus', ed.getParam('tabfocus_elements', ':prev,:next')));
|
||||
|
||||
if (v.length == 1) {
|
||||
v[1] = v[0];
|
||||
v[0] = ':prev';
|
||||
}
|
||||
|
||||
// Find element to focus
|
||||
if (e.shiftKey) {
|
||||
if (v[0] == ':prev')
|
||||
el = find(-1);
|
||||
else
|
||||
el = DOM.get(v[0]);
|
||||
} else {
|
||||
if (v[1] == ':next')
|
||||
el = find(1);
|
||||
else
|
||||
el = DOM.get(v[1]);
|
||||
}
|
||||
|
||||
if (el) {
|
||||
if (el.id && (ed = tinymce.get(el.id || el.name)))
|
||||
ed.focus();
|
||||
else
|
||||
window.setTimeout(function() {
|
||||
if (!tinymce.isWebKit)
|
||||
window.focus();
|
||||
el.focus();
|
||||
}, 10);
|
||||
|
||||
return Event.cancel(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ed.onKeyUp.add(tabCancel);
|
||||
|
||||
if (tinymce.isGecko) {
|
||||
ed.onKeyPress.add(tabHandler);
|
||||
ed.onKeyDown.add(tabCancel);
|
||||
} else
|
||||
ed.onKeyDown.add(tabHandler);
|
||||
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Tabfocus',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/tabfocus',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('tabfocus', tinymce.plugins.TabFocusPlugin);
|
||||
})();
|
||||
/**
|
||||
* editor_plugin_src.js
|
||||
*
|
||||
* Copyright 2009, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
*
|
||||
* License: http://tinymce.moxiecode.com/license
|
||||
* Contributing: http://tinymce.moxiecode.com/contributing
|
||||
*/
|
||||
|
||||
(function() {
|
||||
var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, explode = tinymce.explode;
|
||||
|
||||
tinymce.create('tinymce.plugins.TabFocusPlugin', {
|
||||
init : function(ed, url) {
|
||||
function tabCancel(ed, e) {
|
||||
if (e.keyCode === 9)
|
||||
return Event.cancel(e);
|
||||
}
|
||||
|
||||
function tabHandler(ed, e) {
|
||||
var x, i, f, el, v;
|
||||
|
||||
function find(d) {
|
||||
el = DOM.select(':input:enabled,*[tabindex]:not(iframe)');
|
||||
|
||||
function canSelectRecursive(e) {
|
||||
return e.nodeName==="BODY" || (e.type != 'hidden' &&
|
||||
!(e.style.display == "none") &&
|
||||
!(e.style.visibility == "hidden") && canSelectRecursive(e.parentNode));
|
||||
}
|
||||
function canSelectInOldIe(el) {
|
||||
return el.attributes["tabIndex"].specified || el.nodeName == "INPUT" || el.nodeName == "TEXTAREA";
|
||||
}
|
||||
function isOldIe() {
|
||||
return tinymce.isIE6 || tinymce.isIE7;
|
||||
}
|
||||
function canSelect(el) {
|
||||
return ((!isOldIe() || canSelectInOldIe(el))) && el.getAttribute("tabindex") != '-1' && canSelectRecursive(el);
|
||||
}
|
||||
|
||||
each(el, function(e, i) {
|
||||
if (e.id == ed.id) {
|
||||
x = i;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if (d > 0) {
|
||||
for (i = x + 1; i < el.length; i++) {
|
||||
if (canSelect(el[i]))
|
||||
return el[i];
|
||||
}
|
||||
} else {
|
||||
for (i = x - 1; i >= 0; i--) {
|
||||
if (canSelect(el[i]))
|
||||
return el[i];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
if (e.keyCode === 9) {
|
||||
v = explode(ed.getParam('tab_focus', ed.getParam('tabfocus_elements', ':prev,:next')));
|
||||
|
||||
if (v.length == 1) {
|
||||
v[1] = v[0];
|
||||
v[0] = ':prev';
|
||||
}
|
||||
|
||||
// Find element to focus
|
||||
if (e.shiftKey) {
|
||||
if (v[0] == ':prev')
|
||||
el = find(-1);
|
||||
else
|
||||
el = DOM.get(v[0]);
|
||||
} else {
|
||||
if (v[1] == ':next')
|
||||
el = find(1);
|
||||
else
|
||||
el = DOM.get(v[1]);
|
||||
}
|
||||
|
||||
if (el) {
|
||||
if (el.id && (ed = tinymce.get(el.id || el.name)))
|
||||
ed.focus();
|
||||
else
|
||||
window.setTimeout(function() {
|
||||
if (!tinymce.isWebKit)
|
||||
window.focus();
|
||||
el.focus();
|
||||
}, 10);
|
||||
|
||||
return Event.cancel(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ed.onKeyUp.add(tabCancel);
|
||||
|
||||
if (tinymce.isGecko) {
|
||||
ed.onKeyPress.add(tabHandler);
|
||||
ed.onKeyDown.add(tabCancel);
|
||||
} else
|
||||
ed.onKeyDown.add(tabHandler);
|
||||
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Tabfocus',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/tabfocus',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('tabfocus', tinymce.plugins.TabFocusPlugin);
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
|
||||
<script type="text/javascript" src="../../utils/mctabs.js"></script>
|
||||
<script type="text/javascript" src="../../utils/form_utils.js"></script>
|
||||
<script type="text/javascript" src="../../utils/validate.js"></script>
|
||||
<script type="text/javascript" src="../../utils/editable_selects.js"></script>
|
||||
<script type="text/javascript" src="js/cell.js"></script>
|
||||
<link href="css/cell.css" rel="stylesheet" type="text/css" />
|
||||
|
|
@ -70,10 +71,10 @@
|
|||
|
||||
<tr>
|
||||
<td><label for="width">{#table_dlg.width}</label></td>
|
||||
<td><input id="width" name="width" type="text" value="" size="4" maxlength="4" onchange="changedSize();" /></td>
|
||||
<td><input id="width" name="width" type="text" value="" size="7" maxlength="7" onchange="changedSize();" class="size" /></td>
|
||||
|
||||
<td><label for="height">{#table_dlg.height}</label></td>
|
||||
<td><input id="height" name="height" type="text" value="" size="4" maxlength="4" onchange="changedSize();" /></td>
|
||||
<td><input id="height" name="height" type="text" value="" size="7" maxlength="7" onchange="changedSize();" class="size" /></td>
|
||||
</tr>
|
||||
|
||||
<tr id="styleSelectRow">
|
||||
|
|
@ -166,6 +167,7 @@
|
|||
<select id="action" name="action">
|
||||
<option value="cell">{#table_dlg.cell_cell}</option>
|
||||
<option value="row">{#table_dlg.cell_row}</option>
|
||||
<option value="col">{#table_dlg.cell_col}</option>
|
||||
<option value="all">{#table_dlg.cell_all}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -63,6 +63,11 @@ function init() {
|
|||
function updateAction() {
|
||||
var el, inst = ed, tdElm, trElm, tableElm, formObj = document.forms[0];
|
||||
|
||||
if (!AutoValidator.validate(formObj)) {
|
||||
tinyMCEPopup.alert(AutoValidator.getErrorMessages(formObj).join('. ') + '.');
|
||||
return false;
|
||||
}
|
||||
|
||||
tinyMCEPopup.restoreSelection();
|
||||
el = ed.selection.getStart();
|
||||
tdElm = ed.dom.getParent(el, "td,th");
|
||||
|
|
@ -123,6 +128,36 @@ function updateAction() {
|
|||
|
||||
break;
|
||||
|
||||
case "col":
|
||||
var curr, col = 0, cell = trElm.firstChild, rows = tableElm.getElementsByTagName("tr");
|
||||
|
||||
if (cell.nodeName != "TD" && cell.nodeName != "TH")
|
||||
cell = nextCell(cell);
|
||||
|
||||
do {
|
||||
if (cell == tdElm)
|
||||
break;
|
||||
col += cell.getAttribute("colspan")?cell.getAttribute("colspan"):1;
|
||||
} while ((cell = nextCell(cell)) != null);
|
||||
|
||||
for (var i=0; i<rows.length; i++) {
|
||||
cell = rows[i].firstChild;
|
||||
|
||||
if (cell.nodeName != "TD" && cell.nodeName != "TH")
|
||||
cell = nextCell(cell);
|
||||
|
||||
curr = 0;
|
||||
do {
|
||||
if (curr == col) {
|
||||
cell = updateCell(cell, true);
|
||||
break;
|
||||
}
|
||||
curr += cell.getAttribute("colspan")?cell.getAttribute("colspan"):1;
|
||||
} while ((cell = nextCell(cell)) != null);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "all":
|
||||
var rows = tableElm.getElementsByTagName("tr");
|
||||
|
||||
|
|
|
|||
|
|
@ -56,6 +56,11 @@ function updateAction() {
|
|||
var inst = tinyMCEPopup.editor, dom = inst.dom, trElm, tableElm, formObj = document.forms[0];
|
||||
var action = getSelectValue(formObj, 'action');
|
||||
|
||||
if (!AutoValidator.validate(formObj)) {
|
||||
tinyMCEPopup.alert(AutoValidator.getErrorMessages(formObj).join('. ') + '.');
|
||||
return false;
|
||||
}
|
||||
|
||||
tinyMCEPopup.restoreSelection();
|
||||
trElm = dom.getParent(inst.selection.getStart(), "tr");
|
||||
tableElm = dom.getParent(inst.selection.getStart(), "table");
|
||||
|
|
|
|||
|
|
@ -60,7 +60,19 @@ function insertTable() {
|
|||
if (action == "update") {
|
||||
dom.setAttrib(elm, 'cellPadding', cellpadding, true);
|
||||
dom.setAttrib(elm, 'cellSpacing', cellspacing, true);
|
||||
dom.setAttrib(elm, 'border', border);
|
||||
|
||||
if (!isCssSize(border)) {
|
||||
dom.setAttrib(elm, 'border', border);
|
||||
} else {
|
||||
dom.setAttrib(elm, 'border', '');
|
||||
}
|
||||
|
||||
if (border == '') {
|
||||
dom.setStyle(elm, 'border-width', '');
|
||||
dom.setStyle(elm, 'border', '');
|
||||
dom.setAttrib(elm, 'border', '');
|
||||
}
|
||||
|
||||
dom.setAttrib(elm, 'align', align);
|
||||
dom.setAttrib(elm, 'frame', frame);
|
||||
dom.setAttrib(elm, 'rules', rules);
|
||||
|
|
@ -119,7 +131,7 @@ function insertTable() {
|
|||
if (bordercolor != "") {
|
||||
elm.style.borderColor = bordercolor;
|
||||
elm.style.borderStyle = elm.style.borderStyle == "" ? "solid" : elm.style.borderStyle;
|
||||
elm.style.borderWidth = border == "" ? "1px" : border;
|
||||
elm.style.borderWidth = cssSize(border);
|
||||
} else
|
||||
elm.style.borderColor = '';
|
||||
|
||||
|
|
@ -132,7 +144,7 @@ function insertTable() {
|
|||
//elm.outerHTML = elm.outerHTML;
|
||||
|
||||
inst.nodeChanged();
|
||||
inst.execCommand('mceEndUndoLevel');
|
||||
inst.execCommand('mceEndUndoLevel', false, {}, {skip_undo: true});
|
||||
|
||||
// Repaint if dimensions changed
|
||||
if (formObj.width.value != orgTableWidth || formObj.height.value != orgTableHeight)
|
||||
|
|
@ -146,7 +158,10 @@ function insertTable() {
|
|||
html += '<table';
|
||||
|
||||
html += makeAttrib('id', id);
|
||||
html += makeAttrib('border', border);
|
||||
if (!isCssSize(border)) {
|
||||
html += makeAttrib('border', border);
|
||||
}
|
||||
|
||||
html += makeAttrib('cellpadding', cellpadding);
|
||||
html += makeAttrib('cellspacing', cellspacing);
|
||||
html += makeAttrib('data-mce-new', '1');
|
||||
|
|
@ -227,13 +242,20 @@ function insertTable() {
|
|||
} else
|
||||
inst.execCommand('mceInsertContent', false, html);
|
||||
|
||||
tinymce.each(dom.select('table[data-mce-new]'), function(node) {
|
||||
var td = dom.select('td', node);
|
||||
tinymce.each(dom.select('table[data-mce-new]'), function(node) {
|
||||
var tdorth = dom.select('td,th', node);
|
||||
|
||||
// Fixes a bug in IE where the caret cannot be placed after the table if the table is at the end of the document
|
||||
if (tinymce.isIE && node.nextSibling == null) {
|
||||
if (inst.settings.forced_root_block)
|
||||
dom.insertAfter(dom.create(inst.settings.forced_root_block), node);
|
||||
else
|
||||
dom.insertAfter(dom.create('br', {'data-mce-bogus': '1'}), node);
|
||||
}
|
||||
|
||||
try {
|
||||
// IE9 might fail to do this selection
|
||||
inst.selection.select(td[0], true);
|
||||
inst.selection.collapse();
|
||||
// IE9 might fail to do this selection
|
||||
inst.selection.setCursorLocation(tdorth[0], 0);
|
||||
} catch (ex) {
|
||||
// Ignore
|
||||
}
|
||||
|
|
@ -242,7 +264,7 @@ function insertTable() {
|
|||
});
|
||||
|
||||
inst.addVisual();
|
||||
inst.execCommand('mceEndUndoLevel');
|
||||
inst.execCommand('mceEndUndoLevel', false, {}, {skip_undo: true});
|
||||
|
||||
tinyMCEPopup.close();
|
||||
}
|
||||
|
|
@ -285,6 +307,15 @@ function init() {
|
|||
var formObj = document.forms[0];
|
||||
var elm = dom.getParent(inst.selection.getNode(), "table");
|
||||
|
||||
// Hide advanced fields that isn't available in the schema
|
||||
tinymce.each("summary id rules dir style frame".split(" "), function(name) {
|
||||
var tr = tinyMCEPopup.dom.getParent(name, "tr") || tinyMCEPopup.dom.getParent("t" + name, "tr");
|
||||
|
||||
if (tr && !tinyMCEPopup.editor.schema.isValid("table", name)) {
|
||||
tr.style.display = 'none';
|
||||
}
|
||||
});
|
||||
|
||||
action = tinyMCEPopup.getWindowArg('action');
|
||||
|
||||
if (!action)
|
||||
|
|
@ -384,6 +415,20 @@ function changedSize() {
|
|||
formObj.style.value = dom.serializeStyle(st);
|
||||
}
|
||||
|
||||
function isCssSize(value) {
|
||||
return /^[0-9.]+(%|in|cm|mm|em|ex|pt|pc|px)$/.test(value);
|
||||
}
|
||||
|
||||
function cssSize(value, def) {
|
||||
value = tinymce.trim(value || def);
|
||||
|
||||
if (!isCssSize(value)) {
|
||||
return parseInt(value, 10) + 'px';
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
function changedBackgroundImage() {
|
||||
var formObj = document.forms[0];
|
||||
var st = dom.parseStyle(formObj.style.value);
|
||||
|
|
@ -398,8 +443,14 @@ function changedBorder() {
|
|||
var st = dom.parseStyle(formObj.style.value);
|
||||
|
||||
// Update border width if the element has a color
|
||||
if (formObj.border.value != "" && formObj.bordercolor.value != "")
|
||||
st['border-width'] = formObj.border.value + "px";
|
||||
if (formObj.border.value != "" && (isCssSize(formObj.border.value) || formObj.bordercolor.value != ""))
|
||||
st['border-width'] = cssSize(formObj.border.value);
|
||||
else {
|
||||
if (!formObj.border.value) {
|
||||
st['border'] = '';
|
||||
st['border-width'] = '';
|
||||
}
|
||||
}
|
||||
|
||||
formObj.style.value = dom.serializeStyle(st);
|
||||
}
|
||||
|
|
@ -415,7 +466,7 @@ function changedColor() {
|
|||
|
||||
// Add border-width if it's missing
|
||||
if (!st['border-width'])
|
||||
st['border-width'] = formObj.border.value == "" ? "1px" : formObj.border.value + "px";
|
||||
st['border-width'] = cssSize(formObj.border.value, 1);
|
||||
}
|
||||
|
||||
formObj.style.value = dom.serializeStyle(st);
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
tinyMCE.addI18n('en.table_dlg',{"rules_border":"border","rules_box":"box","rules_vsides":"vsides","rules_rhs":"rhs","rules_lhs":"lhs","rules_hsides":"hsides","rules_below":"below","rules_above":"above","rules_void":"void",rules:"Rules","frame_all":"all","frame_cols":"cols","frame_rows":"rows","frame_groups":"groups","frame_none":"none",frame:"Frame",caption:"Table caption","missing_scope":"Are you sure you want to continue without specifying a scope for this table header cell. Without it, it may be difficult for some users with disabilities to understand the content or data displayed of the table.","cell_limit":"You\'ve exceeded the maximum number of cells of {$cells}.","row_limit":"You\'ve exceeded the maximum number of rows of {$rows}.","col_limit":"You\'ve exceeded the maximum number of columns of {$cols}.",colgroup:"Col Group",rowgroup:"Row Group",scope:"Scope",tfoot:"Table Foot",tbody:"Table Body",thead:"Table Head","row_all":"Update all rows in table","row_even":"Update even rows in table","row_odd":"Update odd rows in table","row_row":"Update current row","cell_all":"Update all cells in table","cell_row":"Update all cells in row","cell_cell":"Update current cell",th:"Header",td:"Data",summary:"Summary",bgimage:"Background image",rtl:"Right to left",ltr:"Left to right",mime:"Target MIME type",langcode:"Language code",langdir:"Language direction",style:"Style",id:"Id","merge_cells_title":"Merge table cells",bgcolor:"Background color",bordercolor:"Border color","align_bottom":"Bottom","align_top":"Top",valign:"Vertical alignment","cell_type":"Cell type","cell_title":"Table cell properties","row_title":"Table row properties","align_middle":"Center","align_right":"Right","align_left":"Left","align_default":"Default",align:"Alignment",border:"Border",cellpadding:"Cellpadding",cellspacing:"Cellspacing",rows:"Rows",cols:"Cols",height:"Height",width:"Width",title:"Insert/Modify table",rowtype:"Row in table part","advanced_props":"Advanced properties","general_props":"General properties","advanced_tab":"Advanced","general_tab":"General"});
|
||||
tinyMCE.addI18n('en.table_dlg',{"rules_border":"border","rules_box":"box","rules_vsides":"vsides","rules_rhs":"rhs","rules_lhs":"lhs","rules_hsides":"hsides","rules_below":"below","rules_above":"above","rules_void":"void",rules:"Rules","frame_all":"all","frame_cols":"cols","frame_rows":"rows","frame_groups":"groups","frame_none":"none",frame:"Frame",caption:"Table Caption","missing_scope":"Are you sure you want to continue without specifying a scope for this table header cell. Without it, it may be difficult for some users with disabilities to understand the content or data displayed of the table.","cell_limit":"You\'ve exceeded the maximum number of cells of {$cells}.","row_limit":"You\'ve exceeded the maximum number of rows of {$rows}.","col_limit":"You\'ve exceeded the maximum number of columns of {$cols}.",colgroup:"Col Group",rowgroup:"Row Group",scope:"Scope",tfoot:"Footer",tbody:"Body",thead:"Header","row_all":"Update All Rows in Table","row_even":"Update Even Rows in Table","row_odd":"Update Odd Rows in Table","row_row":"Update Current Row","cell_all":"Update All Cells in Table","cell_row":"Update All Cells in Row","cell_cell":"Update Current Cell",th:"Header",td:"Data",summary:"Summary",bgimage:"Background Image",rtl:"Right to Left",ltr:"Left to Right",mime:"Target MIME Type",langcode:"Language Code",langdir:"Language Direction",style:"Style",id:"ID","merge_cells_title":"Merge Table Cells",bgcolor:"Background Color",bordercolor:"Border Color","align_bottom":"Bottom","align_top":"Top",valign:"Vertical Alignment","cell_type":"Cell Type","cell_title":"Table Cell Properties","row_title":"Table Row Properties","align_middle":"Center","align_right":"Right","align_left":"Left","align_default":"Default",align:"Alignment",border:"Border",cellpadding:"Cell Padding",cellspacing:"Cell Spacing",rows:"Rows",cols:"Columns",height:"Height",width:"Width",title:"Insert/Edit Table",rowtype:"Row Type","advanced_props":"Advanced Properties","general_props":"General Properties","advanced_tab":"Advanced","general_tab":"General","cell_col":"Update all cells in column"});
|
||||
|
|
@ -5,6 +5,7 @@
|
|||
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
|
||||
<script type="text/javascript" src="../../utils/mctabs.js"></script>
|
||||
<script type="text/javascript" src="../../utils/form_utils.js"></script>
|
||||
<script type="text/javascript" src="../../utils/validate.js"></script>
|
||||
<script type="text/javascript" src="../../utils/editable_selects.js"></script>
|
||||
<script type="text/javascript" src="js/row.js"></script>
|
||||
<link href="css/row.css" rel="stylesheet" type="text/css" />
|
||||
|
|
@ -70,7 +71,7 @@
|
|||
|
||||
<tr>
|
||||
<td><label for="height">{#table_dlg.height}</label></td>
|
||||
<td class="col2"><input name="height" type="text" id="height" value="" size="4" maxlength="4" onchange="changedSize();" /></td>
|
||||
<td class="col2"><input name="height" type="text" id="height" value="" size="7" maxlength="7" onchange="changedSize();" class="size" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
|
|
|||
|
|
@ -46,13 +46,13 @@
|
|||
<option value="right">{#table_dlg.align_right}</option>
|
||||
</select></td>
|
||||
<td><label id="borderlabel" for="border">{#table_dlg.border}</label></td>
|
||||
<td><input id="border" name="border" type="text" value="" size="3" maxlength="3" onchange="changedBorder();" class="number" /></td>
|
||||
<td><input id="border" name="border" type="text" value="" size="3" maxlength="5" onchange="changedBorder();" class="size" /></td>
|
||||
</tr>
|
||||
<tr id="width_row">
|
||||
<td><label id="widthlabel" for="width">{#table_dlg.width}</label></td>
|
||||
<td><input name="width" type="text" id="width" value="" size="4" maxlength="4" onchange="changedSize();" class="size" /></td>
|
||||
<td><input name="width" type="text" id="width" value="" size="7" maxlength="7" onchange="changedSize();" class="size" /></td>
|
||||
<td><label id="heightlabel" for="height">{#table_dlg.height}</label></td>
|
||||
<td><input name="height" type="text" id="height" value="" size="4" maxlength="4" onchange="changedSize();" class="size" /></td>
|
||||
<td><input name="height" type="text" id="height" value="" size="7" maxlength="7" onchange="changedSize();" class="size" /></td>
|
||||
</tr>
|
||||
<tr id="styleSelectRow" >
|
||||
<td><label id="classlabel" for="class">{#class_name}</label></td>
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
tinyMCE.addI18n('en.template_dlg',{title:"Templates",label:"Template","desc_label":"Description",desc:"Insert predefined template content",select:"Select a template",preview:"Preview",warning:"Warning: Updating a template with a different one may cause data loss.","mdate_format":"%Y-%m-%d %H:%M:%S","cdate_format":"%Y-%m-%d %H:%M:%S","months_long":"January,February,March,April,May,June,July,August,September,October,November,December","months_short":"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec","day_long":"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday","day_short":"Sun,Mon,Tue,Wed,Thu,Fri,Sat,Sun"});
|
||||
tinyMCE.addI18n('en.template_dlg',{title:"Templates",label:"Template","desc_label":"Description",desc:"Insert Predefined Template Content",select:"Select a Template",preview:"Preview",warning:"Warning: Updating a template with a different one may cause data loss.","mdate_format":"%Y-%m-%d %H:%M:%S","cdate_format":"%Y-%m-%d %H:%M:%S","months_long":"January,February,March,April,May,June,July,August,September,October,November,December","months_short":"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec","day_long":"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday","day_short":"Sun,Mon,Tue,Wed,Thu,Fri,Sat,Sun"});
|
||||
21
www/extras/tinymce/jscripts/tiny_mce/plugins/visualblocks/css/visualblocks.css
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
p, h1, h2, h3, h4, h5, h6, hgroup, aside, div, section, article, blockquote, address, pre, figure {display: block; padding-top: 10px; border: 1px dashed #BBB; background: transparent no-repeat}
|
||||
p, h1, h2, h3, h4, h5, h6, hgroup, aside, div, section, article, address, pre, figure {margin-left: 3px}
|
||||
section, article, address, hgroup, aside, figure {margin: 0 0 1em 3px}
|
||||
|
||||
p {background-image: url(data:image/gif;base64,R0lGODlhCQAJAJEAAAAAAP///7u7u////yH5BAEAAAMALAAAAAAJAAkAAAIQnG+CqCN/mlyvsRUpThG6AgA7)}
|
||||
h1 {background-image: url(data:image/gif;base64,R0lGODlhDQAKAIABALu7u////yH5BAEAAAEALAAAAAANAAoAAAIXjI8GybGu1JuxHoAfRNRW3TWXyF2YiRUAOw==)}
|
||||
h2 {background-image: url(data:image/gif;base64,R0lGODlhDgAKAIABALu7u////yH5BAEAAAEALAAAAAAOAAoAAAIajI8Hybbx4oOuqgTynJd6bGlWg3DkJzoaUAAAOw==)}
|
||||
h3 {background-image: url(data:image/gif;base64,R0lGODlhDgAKAIABALu7u////yH5BAEAAAEALAAAAAAOAAoAAAIZjI8Hybbx4oOuqgTynJf2Ln2NOHpQpmhAAQA7)}
|
||||
h4 {background-image: url(data:image/gif;base64,R0lGODlhDgAKAIABALu7u////yH5BAEAAAEALAAAAAAOAAoAAAIajI8HybbxInR0zqeAdhtJlXwV1oCll2HaWgAAOw==)}
|
||||
h5 {background-image: url(data:image/gif;base64,R0lGODlhDgAKAIABALu7u////yH5BAEAAAEALAAAAAAOAAoAAAIajI8HybbxIoiuwjane4iq5GlW05GgIkIZUAAAOw==)}
|
||||
h6 {background-image: url(data:image/gif;base64,R0lGODlhDgAKAIABALu7u////yH5BAEAAAEALAAAAAAOAAoAAAIajI8HybbxIoiuwjan04jep1iZ1XRlAo5bVgAAOw==)}
|
||||
div {background-image: url(data:image/gif;base64,R0lGODlhEgAKAIABALu7u////yH5BAEAAAEALAAAAAASAAoAAAIfjI9poI0cgDywrhuxfbrzDEbQM2Ei5aRjmoySW4pAAQA7)}
|
||||
section {background-image: url(data:image/gif;base64,R0lGODlhKAAKAIABALu7u////yH5BAEAAAEALAAAAAAoAAoAAAI5jI+pywcNY3sBWHdNrplytD2ellDeSVbp+GmWqaDqDMepc8t17Y4vBsK5hDyJMcI6KkuYU+jpjLoKADs=)}
|
||||
article {background-image: url(data:image/gif;base64,R0lGODlhKgAKAIABALu7u////yH5BAEAAAEALAAAAAAqAAoAAAI6jI+pywkNY3wG0GBvrsd2tXGYSGnfiF7ikpXemTpOiJScasYoDJJrjsG9gkCJ0ag6KhmaIe3pjDYBBQA7)}
|
||||
blockquote {background-image: url(data:image/gif;base64,R0lGODlhPgAKAIABALu7u////yH5BAEAAAEALAAAAAA+AAoAAAJPjI+py+0Knpz0xQDyuUhvfoGgIX5iSKZYgq5uNL5q69asZ8s5rrf0yZmpNkJZzFesBTu8TOlDVAabUyatguVhWduud3EyiUk45xhTTgMBBQA7)}
|
||||
address {background-image: url(data:image/gif;base64,R0lGODlhLQAKAIABALu7u////yH5BAEAAAEALAAAAAAtAAoAAAI/jI+pywwNozSP1gDyyZcjb3UaRpXkWaXmZW4OqKLhBmLs+K263DkJK7OJeifh7FicKD9A1/IpGdKkyFpNmCkAADs=)}
|
||||
pre {background-image: url(data:image/gif;base64,R0lGODlhFQAKAIABALu7uwAAACH5BAEAAAEALAAAAAAVAAoAAAIjjI+ZoN0cgDwSmnpz1NCueYERhnibZVKLNnbOq8IvKpJtVQAAOw==)}
|
||||
hgroup {background-image: url(data:image/gif;base64,R0lGODlhJwAKAIABALu7uwAAACH5BAEAAAEALAAAAAAnAAoAAAI3jI+pywYNI3uB0gpsRtt5fFnfNZaVSYJil4Wo03Hv6Z62uOCgiXH1kZIIJ8NiIxRrAZNMZAtQAAA7)}
|
||||
aside {background-image: url(data:image/gif;base64,R0lGODlhHgAKAIABAKqqqv///yH5BAEAAAEALAAAAAAeAAoAAAItjI+pG8APjZOTzgtqy7I3f1yehmQcFY4WKZbqByutmW4aHUd6vfcVbgudgpYCADs=)}
|
||||
figure {background-image: url(data:image/gif;base64,R0lGODlhJAAKAIAAALu7u////yH5BAEAAAEALAAAAAAkAAoAAAI0jI+py+2fwAHUSFvD3RlvG4HIp4nX5JFSpnZUJ6LlrM52OE7uSWosBHScgkSZj7dDKnWAAgA7)}
|
||||
figcaption {border: 1px dashed #BBB}
|
||||
1
www/extras/tinymce/jscripts/tiny_mce/plugins/visualblocks/editor_plugin.js
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
(function(){tinymce.create("tinymce.plugins.VisualBlocks",{init:function(a,b){var c;if(!window.NodeList){return}a.addCommand("mceVisualBlocks",function(){var e=a.dom,d;if(!c){c=e.uniqueId();d=e.create("link",{id:c,rel:"stylesheet",href:b+"/css/visualblocks.css"});a.getDoc().getElementsByTagName("head")[0].appendChild(d)}else{d=e.get(c);d.disabled=!d.disabled}a.controlManager.setActive("visualblocks",!d.disabled)});a.addButton("visualblocks",{title:"visualblocks.desc",cmd:"mceVisualBlocks"});a.onInit.add(function(){if(a.settings.visualblocks_default_state){a.execCommand("mceVisualBlocks",false,null,{skip_focus:true})}})},getInfo:function(){return{longname:"Visual blocks",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/visualblocks",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("visualblocks",tinymce.plugins.VisualBlocks)})();
|
||||
63
www/extras/tinymce/jscripts/tiny_mce/plugins/visualblocks/editor_plugin_src.js
vendored
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/**
|
||||
* editor_plugin_src.js
|
||||
*
|
||||
* Copyright 2012, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
*
|
||||
* License: http://tinymce.moxiecode.com/license
|
||||
* Contributing: http://tinymce.moxiecode.com/contributing
|
||||
*/
|
||||
|
||||
(function() {
|
||||
tinymce.create('tinymce.plugins.VisualBlocks', {
|
||||
init : function(ed, url) {
|
||||
var cssId;
|
||||
|
||||
// We don't support older browsers like IE6/7 and they don't provide prototypes for DOM objects
|
||||
if (!window.NodeList) {
|
||||
return;
|
||||
}
|
||||
|
||||
ed.addCommand('mceVisualBlocks', function() {
|
||||
var dom = ed.dom, linkElm;
|
||||
|
||||
if (!cssId) {
|
||||
cssId = dom.uniqueId();
|
||||
linkElm = dom.create('link', {
|
||||
id: cssId,
|
||||
rel : 'stylesheet',
|
||||
href : url + '/css/visualblocks.css'
|
||||
});
|
||||
|
||||
ed.getDoc().getElementsByTagName('head')[0].appendChild(linkElm);
|
||||
} else {
|
||||
linkElm = dom.get(cssId);
|
||||
linkElm.disabled = !linkElm.disabled;
|
||||
}
|
||||
|
||||
ed.controlManager.setActive('visualblocks', !linkElm.disabled);
|
||||
});
|
||||
|
||||
ed.addButton('visualblocks', {title : 'visualblocks.desc', cmd : 'mceVisualBlocks'});
|
||||
|
||||
ed.onInit.add(function() {
|
||||
if (ed.settings.visualblocks_default_state) {
|
||||
ed.execCommand('mceVisualBlocks', false, null, {skip_focus : true});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Visual blocks',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/visualblocks',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('visualblocks', tinymce.plugins.VisualBlocks);
|
||||
})();
|
||||
|
|
@ -1 +1 @@
|
|||
(function(){tinymce.create("tinymce.plugins.WordCount",{block:0,id:null,countre:null,cleanre:null,init:function(a,b){var c=this,d=0;c.countre=a.getParam("wordcount_countregex",/[\w\u2019\'-]+/g);c.cleanre=a.getParam("wordcount_cleanregex",/[0-9.(),;:!?%#$?\'\"_+=\\\/-]*/g);c.id=a.id+"-word-count";a.onPostRender.add(function(f,e){var g,h;h=f.getParam("wordcount_target_id");if(!h){g=tinymce.DOM.get(f.id+"_path_row");if(g){tinymce.DOM.add(g.parentNode,"div",{style:"float: right"},f.getLang("wordcount.words","Words: ")+'<span id="'+c.id+'">0</span>')}}else{tinymce.DOM.add(h,"span",{},'<span id="'+c.id+'">0</span>')}});a.onInit.add(function(e){e.selection.onSetContent.add(function(){c._count(e)});c._count(e)});a.onSetContent.add(function(e){c._count(e)});a.onKeyUp.add(function(f,g){if(g.keyCode==d){return}if(13==g.keyCode||8==d||46==d){c._count(f)}d=g.keyCode})},_getCount:function(c){var a=0;var b=c.getContent({format:"raw"});if(b){b=b.replace(/\.\.\./g," ");b=b.replace(/<.[^<>]*?>/g," ").replace(/ | /gi," ");b=b.replace(/(\w+)(&.+?;)+(\w+)/,"$1$3").replace(/&.+?;/g," ");b=b.replace(this.cleanre,"");var d=b.match(this.countre);if(d){a=d.length}}return a},_count:function(a){var b=this;if(b.block){return}b.block=1;setTimeout(function(){var c=b._getCount(a);tinymce.DOM.setHTML(b.id,c.toString());setTimeout(function(){b.block=0},2000)},1)},getInfo:function(){return{longname:"Word Count plugin",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/wordcount",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("wordcount",tinymce.plugins.WordCount)})();
|
||||
(function(){tinymce.create("tinymce.plugins.WordCount",{block:0,id:null,countre:null,cleanre:null,init:function(c,d){var e=this,f=0,g=tinymce.VK;e.countre=c.getParam("wordcount_countregex",/[\w\u2019\'-]+/g);e.cleanre=c.getParam("wordcount_cleanregex",/[0-9.(),;:!?%#$?\'\"_+=\\\/-]*/g);e.update_rate=c.getParam("wordcount_update_rate",2000);e.update_on_delete=c.getParam("wordcount_update_on_delete",false);e.id=c.id+"-word-count";c.onPostRender.add(function(i,h){var j,k;k=i.getParam("wordcount_target_id");if(!k){j=tinymce.DOM.get(i.id+"_path_row");if(j){tinymce.DOM.add(j.parentNode,"div",{style:"float: right"},i.getLang("wordcount.words","Words: ")+'<span id="'+e.id+'">0</span>')}}else{tinymce.DOM.add(k,"span",{},'<span id="'+e.id+'">0</span>')}});c.onInit.add(function(h){h.selection.onSetContent.add(function(){e._count(h)});e._count(h)});c.onSetContent.add(function(h){e._count(h)});function b(h){return h!==f&&(h===g.ENTER||f===g.SPACEBAR||a(f))}function a(h){return h===g.DELETE||h===g.BACKSPACE}c.onKeyUp.add(function(h,i){if(b(i.keyCode)||e.update_on_delete&&a(i.keyCode)){e._count(h)}f=i.keyCode})},_getCount:function(c){var a=0;var b=c.getContent({format:"raw"});if(b){b=b.replace(/\.\.\./g," ");b=b.replace(/<.[^<>]*?>/g," ").replace(/ | /gi," ");b=b.replace(/(\w+)(&.+?;)+(\w+)/,"$1$3").replace(/&.+?;/g," ");b=b.replace(this.cleanre,"");var d=b.match(this.countre);if(d){a=d.length}}return a},_count:function(a){var b=this;if(b.block){return}b.block=1;setTimeout(function(){if(!a.destroyed){var c=b._getCount(a);tinymce.DOM.setHTML(b.id,c.toString());setTimeout(function(){b.block=0},b.update_rate)}},1)},getInfo:function(){return{longname:"Word Count plugin",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/wordcount",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("wordcount",tinymce.plugins.WordCount)})();
|
||||
|
|
@ -16,10 +16,12 @@
|
|||
cleanre : null,
|
||||
|
||||
init : function(ed, url) {
|
||||
var t = this, last = 0;
|
||||
var t = this, last = 0, VK = tinymce.VK;
|
||||
|
||||
t.countre = ed.getParam('wordcount_countregex', /[\w\u2019\'-]+/g); // u2019 == ’
|
||||
t.cleanre = ed.getParam('wordcount_cleanregex', /[0-9.(),;:!?%#$?\'\"_+=\\\/-]*/g);
|
||||
t.update_rate = ed.getParam('wordcount_update_rate', 2000);
|
||||
t.update_on_delete = ed.getParam('wordcount_update_on_delete', false);
|
||||
t.id = ed.id + '-word-count';
|
||||
|
||||
ed.onPostRender.add(function(ed, cm) {
|
||||
|
|
@ -49,12 +51,18 @@
|
|||
t._count(ed);
|
||||
});
|
||||
|
||||
ed.onKeyUp.add(function(ed, e) {
|
||||
if (e.keyCode == last)
|
||||
return;
|
||||
function checkKeys(key) {
|
||||
return key !== last && (key === VK.ENTER || last === VK.SPACEBAR || checkDelOrBksp(last));
|
||||
}
|
||||
|
||||
if (13 == e.keyCode || 8 == last || 46 == last)
|
||||
function checkDelOrBksp(key) {
|
||||
return key === VK.DELETE || key === VK.BACKSPACE;
|
||||
}
|
||||
|
||||
ed.onKeyUp.add(function(ed, e) {
|
||||
if (checkKeys(e.keyCode) || t.update_on_delete && checkDelOrBksp(e.keyCode)) {
|
||||
t._count(ed);
|
||||
}
|
||||
|
||||
last = e.keyCode;
|
||||
});
|
||||
|
|
@ -91,11 +99,11 @@
|
|||
t.block = 1;
|
||||
|
||||
setTimeout(function() {
|
||||
if (!ed.destroyed) {
|
||||
var tc = t._getCount(ed);
|
||||
|
||||
tinymce.DOM.setHTML(t.id, tc.toString());
|
||||
|
||||
setTimeout(function() {t.block = 0;}, 2000);
|
||||
setTimeout(function() {t.block = 0;}, t.update_rate);
|
||||
}
|
||||
}, 1);
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
tinyMCE.addI18n('en.xhtmlxtras_dlg',{"attribs_title":"Insert/Edit Attributes","option_rtl":"Right to left","option_ltr":"Left to right","insert_date":"Insert current date/time",remove:"Remove","title_cite_element":"Citation Element","title_abbr_element":"Abbreviation Element","title_acronym_element":"Acronym Element","title_del_element":"Deletion Element","title_ins_element":"Insertion Element","fieldset_events_tab":"Element Events","fieldset_attrib_tab":"Element Attributes","fieldset_general_tab":"General Settings","events_tab":"Events","attrib_tab":"Attributes","general_tab":"General","attribute_attrib_tab":"Attributes","attribute_events_tab":"Events","attribute_label_accesskey":"AccessKey","attribute_label_tabindex":"TabIndex","attribute_label_langcode":"Language","attribute_option_rtl":"Right to left","attribute_option_ltr":"Left to right","attribute_label_langdir":"Text Direction","attribute_label_datetime":"Date/Time","attribute_label_cite":"Cite","attribute_label_style":"Style","attribute_label_class":"Class","attribute_label_id":"ID","attribute_label_title":"Title"});
|
||||
tinyMCE.addI18n('en.xhtmlxtras_dlg',{"attribs_title":"Insert/Edit Attributes","option_rtl":"Right to Left","option_ltr":"Left to Right","insert_date":"Insert Current Date/Time",remove:"Remove","title_cite_element":"Citation Element","title_abbr_element":"Abbreviation Element","title_acronym_element":"Acronym Element","title_del_element":"Deletion Element","title_ins_element":"Insertion Element","fieldset_events_tab":"Element Events","fieldset_attrib_tab":"Element Attributes","fieldset_general_tab":"General Settings","events_tab":"Events","attrib_tab":"Attributes","general_tab":"General","attribute_attrib_tab":"Attributes","attribute_events_tab":"Events","attribute_label_accesskey":"AccessKey","attribute_label_tabindex":"TabIndex","attribute_label_langcode":"Language","attribute_option_rtl":"Right to Left","attribute_option_ltr":"Left to Right","attribute_label_langdir":"Text Direction","attribute_label_datetime":"Date/Time","attribute_label_cite":"Cite","attribute_label_style":"Style","attribute_label_class":"Class","attribute_label_id":"ID","attribute_label_title":"Title"});
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
|
||||
<script type="text/javascript" src="js/charmap.js"></script>
|
||||
</head>
|
||||
<body id="charmap" style="display:none">
|
||||
<body id="charmap" style="display:none" role="application">
|
||||
<table align="center" border="0" cellspacing="0" cellpadding="2" role="presentation">
|
||||
<tr>
|
||||
<td colspan="2" class="title" ><label for="charmapView" id="charmap_label">{#advanced_dlg.charmap_title}</label></td>
|
||||
|
|
@ -46,6 +46,10 @@
|
|||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" id="charmap_usage">{#advanced_dlg.charmap_usage}</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -62,12 +62,8 @@
|
|||
|
||||
<div class="mceActionPanel">
|
||||
<input type="submit" id="insert" name="insert" value="{#apply}" />
|
||||
|
||||
<div id="preview"></div>
|
||||
|
||||
<div id="previewblock">
|
||||
<label for="color">{#advanced_dlg.colorpicker_color}</label> <input id="color" type="text" size="8" class="text mceFocus" aria-required="true" />
|
||||
</div>
|
||||
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();"/>
|
||||
<div id="preview_wrapper"><div id="previewblock"><label for="color">{#advanced_dlg.colorpicker_color}</label> <input id="color" type="text" size="8" class="text mceFocus" aria-required="true" /></div><span id="preview"></span></div>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -11,6 +11,95 @@
|
|||
(function(tinymce) {
|
||||
var DOM = tinymce.DOM, Event = tinymce.dom.Event, extend = tinymce.extend, each = tinymce.each, Cookie = tinymce.util.Cookie, lastExtID, explode = tinymce.explode;
|
||||
|
||||
// Generates a preview for a format
|
||||
function getPreviewCss(ed, fmt) {
|
||||
var name, previewElm, dom = ed.dom, previewCss = '', parentFontSize, previewStylesName;
|
||||
|
||||
previewStyles = ed.settings.preview_styles;
|
||||
|
||||
// No preview forced
|
||||
if (previewStyles === false)
|
||||
return '';
|
||||
|
||||
// Default preview
|
||||
if (!previewStyles)
|
||||
previewStyles = 'font-family font-size font-weight text-decoration text-transform color background-color';
|
||||
|
||||
// Removes any variables since these can't be previewed
|
||||
function removeVars(val) {
|
||||
return val.replace(/%(\w+)/g, '');
|
||||
};
|
||||
|
||||
// Create block/inline element to use for preview
|
||||
name = fmt.block || fmt.inline || 'span';
|
||||
previewElm = dom.create(name);
|
||||
|
||||
// Add format styles to preview element
|
||||
each(fmt.styles, function(value, name) {
|
||||
value = removeVars(value);
|
||||
|
||||
if (value)
|
||||
dom.setStyle(previewElm, name, value);
|
||||
});
|
||||
|
||||
// Add attributes to preview element
|
||||
each(fmt.attributes, function(value, name) {
|
||||
value = removeVars(value);
|
||||
|
||||
if (value)
|
||||
dom.setAttrib(previewElm, name, value);
|
||||
});
|
||||
|
||||
// Add classes to preview element
|
||||
each(fmt.classes, function(value) {
|
||||
value = removeVars(value);
|
||||
|
||||
if (!dom.hasClass(previewElm, value))
|
||||
dom.addClass(previewElm, value);
|
||||
});
|
||||
|
||||
// Add the previewElm outside the visual area
|
||||
dom.setStyles(previewElm, {position: 'absolute', left: -0xFFFF});
|
||||
ed.getBody().appendChild(previewElm);
|
||||
|
||||
// Get parent container font size so we can compute px values out of em/% for older IE:s
|
||||
parentFontSize = dom.getStyle(ed.getBody(), 'fontSize', true);
|
||||
parentFontSize = /px$/.test(parentFontSize) ? parseInt(parentFontSize, 10) : 0;
|
||||
|
||||
each(previewStyles.split(' '), function(name) {
|
||||
var value = dom.getStyle(previewElm, name, true);
|
||||
|
||||
// If background is transparent then check if the body has a background color we can use
|
||||
if (name == 'background-color' && /transparent|rgba\s*\([^)]+,\s*0\)/.test(value)) {
|
||||
value = dom.getStyle(ed.getBody(), name, true);
|
||||
|
||||
// Ignore white since it's the default color, not the nicest fix
|
||||
if (dom.toHex(value).toLowerCase() == '#ffffff') {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Old IE won't calculate the font size so we need to do that manually
|
||||
if (name == 'font-size') {
|
||||
if (/em|%$/.test(value)) {
|
||||
if (parentFontSize === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Convert font size from em/% to px
|
||||
value = parseFloat(value, 10) / (/%$/.test(value) ? 100 : 1);
|
||||
value = (value * parentFontSize) + 'px';
|
||||
}
|
||||
}
|
||||
|
||||
previewCss += name + ':' + value + ';';
|
||||
});
|
||||
|
||||
dom.remove(previewElm);
|
||||
|
||||
return previewCss;
|
||||
};
|
||||
|
||||
// Tell it to load theme specific language pack(s)
|
||||
tinymce.ThemeManager.requireLangPack('advanced');
|
||||
|
||||
|
|
@ -65,19 +154,27 @@
|
|||
t.editor = ed;
|
||||
t.url = url;
|
||||
t.onResolveName = new tinymce.util.Dispatcher(this);
|
||||
s = ed.settings;
|
||||
|
||||
ed.forcedHighContrastMode = ed.settings.detect_highcontrast && t._isHighContrast();
|
||||
ed.settings.skin = ed.forcedHighContrastMode ? 'highcontrast' : ed.settings.skin;
|
||||
|
||||
// Setup default buttons
|
||||
if (!s.theme_advanced_buttons1) {
|
||||
s = extend({
|
||||
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect",
|
||||
theme_advanced_buttons2 : "bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code",
|
||||
theme_advanced_buttons3 : "hr,removeformat,visualaid,|,sub,sup,|,charmap"
|
||||
}, s);
|
||||
}
|
||||
|
||||
// Default settings
|
||||
t.settings = s = extend({
|
||||
theme_advanced_path : true,
|
||||
theme_advanced_toolbar_location : 'bottom',
|
||||
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect",
|
||||
theme_advanced_buttons2 : "bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code",
|
||||
theme_advanced_buttons3 : "hr,removeformat,visualaid,|,sub,sup,|,charmap",
|
||||
theme_advanced_toolbar_location : 'top',
|
||||
theme_advanced_blockformats : "p,address,pre,h1,h2,h3,h4,h5,h6",
|
||||
theme_advanced_toolbar_align : "center",
|
||||
theme_advanced_toolbar_align : "left",
|
||||
theme_advanced_statusbar_location : "bottom",
|
||||
theme_advanced_fonts : "Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",
|
||||
theme_advanced_more_colors : 1,
|
||||
theme_advanced_row_height : 23,
|
||||
|
|
@ -87,7 +184,7 @@
|
|||
theme_advanced_font_selector : "span",
|
||||
theme_advanced_show_current_color: 0,
|
||||
readonly : ed.settings.readonly
|
||||
}, ed.settings);
|
||||
}, s);
|
||||
|
||||
// Setup default font_size_style_values
|
||||
if (!s.font_size_style_values)
|
||||
|
|
@ -219,15 +316,21 @@
|
|||
|
||||
if (ctrl.getLength() == 0) {
|
||||
each(ed.dom.getClasses(), function(o, idx) {
|
||||
var name = 'style_' + idx;
|
||||
var name = 'style_' + idx, fmt;
|
||||
|
||||
ed.formatter.register(name, {
|
||||
fmt = {
|
||||
inline : 'span',
|
||||
attributes : {'class' : o['class']},
|
||||
selector : '*'
|
||||
});
|
||||
};
|
||||
|
||||
ctrl.add(o['class'], name);
|
||||
ed.formatter.register(name, fmt);
|
||||
|
||||
ctrl.add(o['class'], name, {
|
||||
style: function() {
|
||||
return getPreviewCss(ed, fmt);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
@ -239,7 +342,7 @@
|
|||
ctrl = ctrlMan.createListBox('styleselect', {
|
||||
title : 'advanced.style_select',
|
||||
onselect : function(name) {
|
||||
var matches, formatNames = [];
|
||||
var matches, formatNames = [], removedFormat;
|
||||
|
||||
each(ctrl.items, function(item) {
|
||||
formatNames.push(item.value);
|
||||
|
|
@ -248,12 +351,18 @@
|
|||
ed.focus();
|
||||
ed.undoManager.add();
|
||||
|
||||
// Toggle off the current format
|
||||
// Toggle off the current format(s)
|
||||
matches = ed.formatter.matchAll(formatNames);
|
||||
if (!name || matches[0] == name) {
|
||||
if (matches[0])
|
||||
ed.formatter.remove(matches[0]);
|
||||
} else
|
||||
tinymce.each(matches, function(match) {
|
||||
if (!name || match == name) {
|
||||
if (match)
|
||||
ed.formatter.remove(match);
|
||||
|
||||
removedFormat = true;
|
||||
}
|
||||
});
|
||||
|
||||
if (!removedFormat)
|
||||
ed.formatter.apply(name);
|
||||
|
||||
ed.undoManager.add();
|
||||
|
|
@ -264,7 +373,7 @@
|
|||
});
|
||||
|
||||
// Handle specified format
|
||||
ed.onInit.add(function() {
|
||||
ed.onPreInit.add(function() {
|
||||
var counter = 0, formats = ed.getParam('style_formats');
|
||||
|
||||
if (formats) {
|
||||
|
|
@ -276,24 +385,32 @@
|
|||
if (keys > 1) {
|
||||
name = fmt.name = fmt.name || 'style_' + (counter++);
|
||||
ed.formatter.register(name, fmt);
|
||||
ctrl.add(fmt.title, name);
|
||||
ctrl.add(fmt.title, name, {
|
||||
style: function() {
|
||||
return getPreviewCss(ed, fmt);
|
||||
}
|
||||
});
|
||||
} else
|
||||
ctrl.add(fmt.title);
|
||||
});
|
||||
} else {
|
||||
each(ed.getParam('theme_advanced_styles', '', 'hash'), function(val, key) {
|
||||
var name;
|
||||
var name, fmt;
|
||||
|
||||
if (val) {
|
||||
name = 'style_' + (counter++);
|
||||
|
||||
ed.formatter.register(name, {
|
||||
fmt = {
|
||||
inline : 'span',
|
||||
classes : val,
|
||||
selector : '*'
|
||||
});
|
||||
};
|
||||
|
||||
ctrl.add(t.editor.translate(key), name);
|
||||
ed.formatter.register(name, fmt);
|
||||
ctrl.add(t.editor.translate(key), name, {
|
||||
style: function() {
|
||||
return getPreviewCss(ed, fmt);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -386,7 +503,7 @@
|
|||
return v == sv;
|
||||
});
|
||||
|
||||
if (cur && (cur.value.fontSize == v.fontSize || cur.value['class'] == v['class'])) {
|
||||
if (cur && (cur.value.fontSize == v.fontSize || cur.value['class'] && cur.value['class'] == v['class'])) {
|
||||
c.select(null);
|
||||
}
|
||||
|
||||
|
|
@ -433,7 +550,9 @@
|
|||
|
||||
if (c) {
|
||||
each(t.editor.getParam('theme_advanced_blockformats', t.settings.theme_advanced_blockformats, 'hash'), function(v, k) {
|
||||
c.add(t.editor.translate(k != v ? k : fmts[v]), v, {'class' : 'mce_formatPreview mce_' + v});
|
||||
c.add(t.editor.translate(k != v ? k : fmts[v]), v, {'class' : 'mce_formatPreview mce_' + v, style: function() {
|
||||
return getPreviewCss(t.editor, {block: v});
|
||||
}});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -507,7 +626,7 @@
|
|||
|
||||
// TODO: ACC Should have an aria-describedby attribute which is user-configurable to describe what this field is actually for.
|
||||
// Maybe actually inherit it from the original textara?
|
||||
n = p = DOM.create('span', {role : 'application', 'aria-labelledby' : ed.id + '_voice', id : ed.id + '_parent', 'class' : 'mceEditor ' + ed.settings.skin + 'Skin' + (s.skin_variant ? ' ' + ed.settings.skin + 'Skin' + t._ufirst(s.skin_variant) : '')});
|
||||
n = p = DOM.create('span', {role : 'application', 'aria-labelledby' : ed.id + '_voice', id : ed.id + '_parent', 'class' : 'mceEditor ' + ed.settings.skin + 'Skin' + (s.skin_variant ? ' ' + ed.settings.skin + 'Skin' + t._ufirst(s.skin_variant) : '') + (ed.settings.directionality == "rtl" ? ' mceRtl' : '')});
|
||||
DOM.add(n, 'span', {'class': 'mceVoiceLabel', 'style': 'display:none;', id: ed.id + '_voice'}, s.aria_label);
|
||||
|
||||
if (!DOM.boxModel)
|
||||
|
|
@ -552,8 +671,7 @@
|
|||
|
||||
if (e.nodeName == 'A') {
|
||||
t._sel(e.className.replace(/^.*mcePath_([0-9]+).*$/, '$1'));
|
||||
|
||||
return Event.cancel(e);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
/*
|
||||
|
|
@ -593,6 +711,11 @@
|
|||
|
||||
if (evt.altKey) {
|
||||
if (evt.keyCode === DOM_VK_F10) {
|
||||
// Make sure focus is given to toolbar in Safari.
|
||||
// We can't do this in IE as it prevents giving focus to toolbar when editor is in a frame
|
||||
if (tinymce.isWebKit) {
|
||||
window.focus();
|
||||
}
|
||||
t.toolbarGroup.focus();
|
||||
return Event.cancel(evt);
|
||||
} else if (evt.keyCode === DOM_VK_F11) {
|
||||
|
|
@ -708,6 +831,7 @@
|
|||
var f = Event.add(ed.id + '_external_close', 'click', function() {
|
||||
DOM.hide(ed.id + '_external');
|
||||
Event.remove(ed.id + '_external_close', 'click', f);
|
||||
return false;
|
||||
});
|
||||
|
||||
DOM.show(e);
|
||||
|
|
@ -820,7 +944,7 @@
|
|||
},
|
||||
|
||||
_addToolbars : function(c, o) {
|
||||
var t = this, i, tb, ed = t.editor, s = t.settings, v, cf = ed.controlManager, di, n, h = [], a, toolbarGroup;
|
||||
var t = this, i, tb, ed = t.editor, s = t.settings, v, cf = ed.controlManager, di, n, h = [], a, toolbarGroup, toolbarsExist = false;
|
||||
|
||||
toolbarGroup = cf.createToolbarGroup('toolbargroup', {
|
||||
'name': ed.getLang('advanced.toolbar'),
|
||||
|
|
@ -836,6 +960,7 @@
|
|||
|
||||
// Create toolbar and add the controls
|
||||
for (i=1; (v = s['theme_advanced_buttons' + i]); i++) {
|
||||
toolbarsExist = true;
|
||||
tb = cf.createToolbar("toolbar" + i, {'class' : 'mceToolbarRow' + i});
|
||||
|
||||
if (s['theme_advanced_buttons' + i + '_add'])
|
||||
|
|
@ -849,6 +974,9 @@
|
|||
|
||||
o.deltaHeight -= s.theme_advanced_row_height;
|
||||
}
|
||||
// Handle case when there are no toolbar buttons and ensure editor height is adjusted accordingly
|
||||
if (!toolbarsExist)
|
||||
o.deltaHeight -= s.theme_advanced_row_height;
|
||||
h.push(toolbarGroup.renderHTML());
|
||||
h.push(DOM.createHTML('a', {href : '#', accesskey : 'z', title : ed.getLang("advanced.toolbar_focus"), onfocus : 'tinyMCE.getInstanceById(\'' + ed.id + '\').focus();'}, '<!-- IE -->'));
|
||||
DOM.setHTML(n, h.join(''));
|
||||
|
|
@ -869,7 +997,7 @@
|
|||
|
||||
|
||||
if (s.theme_advanced_resizing) {
|
||||
DOM.add(td, 'a', {id : ed.id + '_resize', href : 'javascript:;', onclick : "return false;", 'class' : 'mceResize'});
|
||||
DOM.add(td, 'a', {id : ed.id + '_resize', href : 'javascript:;', onclick : "return false;", 'class' : 'mceResize', tabIndex:"-1"});
|
||||
|
||||
if (s.theme_advanced_resizing_use_cookie) {
|
||||
ed.onPostRender.add(function() {
|
||||
|
|
@ -911,6 +1039,8 @@
|
|||
width = startWidth + (e.screenX - startX);
|
||||
height = startHeight + (e.screenY - startY);
|
||||
t.resizeTo(width, height, true);
|
||||
|
||||
ed.nodeChanged();
|
||||
};
|
||||
|
||||
e.preventDefault();
|
||||
|
|
@ -936,10 +1066,10 @@
|
|||
},
|
||||
|
||||
_updateUndoStatus : function(ed) {
|
||||
var cm = ed.controlManager;
|
||||
var cm = ed.controlManager, um = ed.undoManager;
|
||||
|
||||
cm.setDisabled('undo', !ed.undoManager.hasUndo() && !ed.typing);
|
||||
cm.setDisabled('redo', !ed.undoManager.hasRedo());
|
||||
cm.setDisabled('undo', !um.hasUndo() && !um.typing);
|
||||
cm.setDisabled('redo', !um.hasRedo());
|
||||
},
|
||||
|
||||
_nodeChanged : function(ed, cm, n, co, ob) {
|
||||
|
|
@ -970,19 +1100,17 @@
|
|||
|
||||
p = getParent('A');
|
||||
if (c = cm.get('link')) {
|
||||
if (!p || !p.name) {
|
||||
c.setDisabled(!p && co);
|
||||
c.setActive(!!p);
|
||||
}
|
||||
c.setDisabled((!p && co) || (p && !p.href));
|
||||
c.setActive(!!p && (!p.name && !p.id));
|
||||
}
|
||||
|
||||
if (c = cm.get('unlink')) {
|
||||
c.setDisabled(!p && co);
|
||||
c.setActive(!!p && !p.name);
|
||||
c.setActive(!!p && !p.name && !p.id);
|
||||
}
|
||||
|
||||
if (c = cm.get('anchor')) {
|
||||
c.setActive(!co && !!p && p.name);
|
||||
c.setActive(!co && !!p && (p.name || (p.id && !p.href)));
|
||||
}
|
||||
|
||||
p = getParent('IMG');
|
||||
|
|
@ -999,10 +1127,15 @@
|
|||
|
||||
matches = ed.formatter.matchAll(formatNames);
|
||||
c.select(matches[0]);
|
||||
tinymce.each(matches, function(match, index) {
|
||||
if (index > 0) {
|
||||
c.mark(match);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (c = cm.get('formatselect')) {
|
||||
p = getParent(DOM.isBlock);
|
||||
p = getParent(ed.dom.isBlock);
|
||||
|
||||
if (p)
|
||||
c.select(p.nodeName.toLowerCase());
|
||||
|
|
@ -1095,15 +1228,12 @@
|
|||
getParent(function(n) {
|
||||
var na = n.nodeName.toLowerCase(), u, pi, ti = '';
|
||||
|
||||
if (n.getAttribute('data-mce-bogus'))
|
||||
return;
|
||||
|
||||
// Ignore non element and hidden elements
|
||||
if (n.nodeType != 1 || n.nodeName === 'BR' || (DOM.hasClass(n, 'mceItemHidden') || DOM.hasClass(n, 'mceItemRemoved')))
|
||||
// Ignore non element and bogus/hidden elements
|
||||
if (n.nodeType != 1 || na === 'br' || n.getAttribute('data-mce-bogus') || DOM.hasClass(n, 'mceItemHidden') || DOM.hasClass(n, 'mceItemRemoved'))
|
||||
return;
|
||||
|
||||
// Handle prefix
|
||||
if (tinymce.isIE && n.scopeName !== 'HTML')
|
||||
if (tinymce.isIE && n.scopeName !== 'HTML' && n.scopeName)
|
||||
na = n.scopeName + ':' + na;
|
||||
|
||||
// Remove internal prefix
|
||||
|
|
@ -1159,12 +1289,12 @@
|
|||
ti += 'id: ' + v + ' ';
|
||||
|
||||
if (v = n.className) {
|
||||
v = v.replace(/\b\s*(webkit|mce|Apple-)\w+\s*\b/g, '')
|
||||
v = v.replace(/\b\s*(webkit|mce|Apple-)\w+\s*\b/g, '');
|
||||
|
||||
if (v) {
|
||||
ti += 'class: ' + v + ' ';
|
||||
|
||||
if (DOM.isBlock(n) || na == 'img' || na == 'span')
|
||||
if (ed.dom.isBlock(n) || na == 'img' || na == 'span')
|
||||
na += '.' + v;
|
||||
}
|
||||
}
|
||||
|
|
@ -1223,7 +1353,7 @@
|
|||
ed.windowManager.open({
|
||||
url : this.url + '/charmap.htm',
|
||||
width : 550 + parseInt(ed.getLang('advanced.charmap_delta_width', 0)),
|
||||
height : 250 + parseInt(ed.getLang('advanced.charmap_delta_height', 0)),
|
||||
height : 265 + parseInt(ed.getLang('advanced.charmap_delta_height', 0)),
|
||||
inline : true
|
||||
}, {
|
||||
theme_url : this.url
|
||||
|
|
@ -1292,7 +1422,7 @@
|
|||
var ed = this.editor;
|
||||
|
||||
// Internal image object like a flash placeholder
|
||||
if (ed.dom.getAttrib(ed.selection.getNode(), 'class').indexOf('mceItem') != -1)
|
||||
if (ed.dom.getAttrib(ed.selection.getNode(), 'class', '').indexOf('mceItem') != -1)
|
||||
return;
|
||||
|
||||
ed.windowManager.open({
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 2.5 KiB |