W.I.P. implementing TinyMCE editor and deprecating CKEditor:

- Fix language setting
- Update TinyMCE
This commit is contained in:
Hadi Nategh 2018-10-25 18:18:31 +02:00
parent 78ddd31b71
commit 16fe435de4
11 changed files with 40 additions and 12 deletions

View File

@ -121,7 +121,7 @@ var et2_htmlarea = (function(){ "use strict"; return et2_inputWidget.extend([et2
height: this.options.height,
width: this.options.width,
min_height: 100,
language: egw.preference('lang', 'common'),
language: et2_htmlarea.LANGUAGE_CODE[egw.preference('lang', 'common')],
paste_data_images: true,
browser_spellcheck: true,
contextmenu: false,
@ -360,5 +360,18 @@ jQuery.extend(et2_htmlarea, {
FONT_SIZE_FORMATS: {
pt: "8pt 10pt 12pt 14pt 18pt 24pt 36pt 48pt 72pt",
px:"8px 10px 12px 14px 18px 24px 36px 48px 72px"
},
/**
* language code represention for TinyMCE lang code
*/
LANGUAGE_CODE: {
bg: "bg_BG", ca: "ca", cs: "cs", da: "da", de: "de", en:"en_CA",
el:"el", "es-es":"es", et: "et", eu: "eu" , fa: "fa_IR", fi: "fi",
fr: "fr_FR", hi:"", hr:"hr", hu:"hu_HU", id: "id", it: "it", iw: "",
ja: "ja", ko: "ko_KR", lo: "", lt: "lt", lv: "lv", nl: "nl", no: "nb_NO",
pl: "pl", pt: "pt_PT", "pt-br": "pt_BR", ru: "ru", sk: "sk", sl: "sl_SI",
sv: "sv_SE", th: "th_TH", tr: "tr_TR", uk: "en_GB", vi: "vi_VN", zh: "zh_CN",
"zh-tw": "zh_TW"
}
});

View File

@ -1 +1 @@
!function(){"use strict";var n,t,e,r,o=tinymce.util.Tools.resolve("tinymce.PluginManager"),v=tinymce.util.Tools.resolve("tinymce.util.Tools"),O=function(n,t,e){var r="UL"===t?"InsertUnorderedList":"InsertOrderedList";n.execCommand(r,!1,!1===e?null:{"list-style-type":e})},u=function(e){e.addCommand("ApplyUnorderedListStyle",function(n,t){O(e,"UL",t["list-style-type"])}),e.addCommand("ApplyOrderedListStyle",function(n,t){O(e,"OL",t["list-style-type"])})},i=function(n){var t=n.getParam("advlist_number_styles","default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman");return t?t.split(/[ ,]/):[]},l=function(n){var t=n.getParam("advlist_bullet_styles","default,circle,square");return t?t.split(/[ ,]/):[]},c=function(n){return function(){return n}},s=c(!1),f=c(!0),a=s,d=f,p=function(){return g},g=(r={fold:function(n,t){return n()},is:a,isSome:a,isNone:d,getOr:e=function(n){return n},getOrThunk:t=function(n){return n()},getOrDie:function(n){throw new Error(n||"error: getOrDie called on none.")},getOrNull:function(){return null},getOrUndefined:function(){return undefined},or:e,orThunk:t,map:p,ap:p,each:function(){},bind:p,flatten:p,exists:a,forall:d,filter:p,equals:n=function(n){return n.isNone()},equals_:n,toArray:function(){return[]},toString:c("none()")},Object.freeze&&Object.freeze(r),r),m=function(e){var n=function(){return e},t=function(){return o},r=function(n){return n(e)},o={fold:function(n,t){return t(e)},is:function(n){return e===n},isSome:d,isNone:a,getOr:n,getOrThunk:n,getOrDie:n,getOrNull:n,getOrUndefined:n,or:t,orThunk:t,map:function(n){return m(n(e))},ap:function(n){return n.fold(p,function(n){return m(n(e))})},each:function(n){n(e)},bind:r,flatten:n,exists:r,forall:r,filter:function(n){return n(e)?o:g},equals:function(n){return n.is(e)},equals_:function(n,t){return n.fold(a,function(n){return t(e,n)})},toArray:function(){return[e]},toString:function(){return"some("+e+")"}};return o},y=function(n){return null===n||n===undefined?g:m(n)},h=function(n){return n&&/^(TH|TD)$/.test(n.nodeName)},L=function(r){return function(n){return n&&/^(OL|UL|DL)$/.test(n.nodeName)&&(e=n,(t=r).$.contains(t.getBody(),e));var t,e}},b=function(n){var t=n.dom.getParent(n.selection.getNode(),"ol,ul"),e=n.dom.getStyle(t,"listStyleType");return y(e)},S=function(n,t,e){var r=function(n,t){for(var e=0;e<n.length;e++)if(t(n[e]))return e;return-1}(t.parents,h),o=-1!==r?t.parents.slice(0,r):t.parents,u=v.grep(o,L(n));return 0<u.length&&u[0].nodeName===e},T=function(n,t,e,r,o,u){var i,l,c,s,f,a,d,p,g,m,y;0<u.length?(d=t,p=e,g=r,m=o,y=u,(a=n).ui.registry.addSplitButton(d,{type:"splitbutton",active:!1,tooltip:p,icon:"OL"===m?"ordered-list":"unordered-list",presets:"toolbar",columns:3,fetch:function(n){n(v.map(y,function(n){var t;return{type:"choiceitem",value:"default"===n?"":n,icon:"list-"+("OL"===m?"num":"bull")+"-"+("disc"===n||"decimal"===n?"default":n),text:(t=n,t.replace(/\-/g," ").replace(/\b\w/g,function(n){return n.toUpperCase()}))}}))},onAction:function(){return a.execCommand(g)},onItemAction:function(n,t){O(a,m,t)},select:function(t){return b(a).map(function(n){return t===n}).getOr(!1)},onSetup:function(t){var n=function(n){t.setActive(S(a,n,m))};return a.on("nodeChange",n),function(){return a.off("nodeChange",n)}}})):(l=t,c=e,s=r,f=o,(i=n).ui.registry.addToggleButton(l,{active:!1,tooltip:c,icon:"OL"===f?"ordered-list":"unordered-list",onSetup:function(t){var n=function(n){t.setActive(S(i,n,f))};return i.on("nodeChange",n),function(){return i.off("nodeChange",n)}},onAction:function(){return i.execCommand(s)}}))},A=function(n){T(n,"numlist","Numbered list","InsertOrderedList","OL",i(n)),T(n,"bullist","Bullet list","InsertUnorderedList","UL",l(n))};o.add("advlist",function(n){var t,e,r;e="lists",r=(t=n).settings.plugins?t.settings.plugins:"",-1!==v.inArray(r.split(/[ ,]/),e)&&(A(n),u(n))}),function C(){}}();
!function(){"use strict";var n,t,e,r,o=tinymce.util.Tools.resolve("tinymce.PluginManager"),v=tinymce.util.Tools.resolve("tinymce.util.Tools"),O=function(n,t,e){var r="UL"===t?"InsertUnorderedList":"InsertOrderedList";n.execCommand(r,!1,!1===e?null:{"list-style-type":e})},u=function(e){e.addCommand("ApplyUnorderedListStyle",function(n,t){O(e,"UL",t["list-style-type"])}),e.addCommand("ApplyOrderedListStyle",function(n,t){O(e,"OL",t["list-style-type"])})},i=function(n){var t=n.getParam("advlist_number_styles","default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman");return t?t.split(/[ ,]/):[]},l=function(n){var t=n.getParam("advlist_bullet_styles","default,circle,square");return t?t.split(/[ ,]/):[]},c=function(n){return function(){return n}},s=c(!1),a=c(!0),f=s,d=a,p=function(){return g},g=(r={fold:function(n,t){return n()},is:f,isSome:f,isNone:d,getOr:e=function(n){return n},getOrThunk:t=function(n){return n()},getOrDie:function(n){throw new Error(n||"error: getOrDie called on none.")},getOrNull:function(){return null},getOrUndefined:function(){return undefined},or:e,orThunk:t,map:p,ap:p,each:function(){},bind:p,flatten:p,exists:f,forall:d,filter:p,equals:n=function(n){return n.isNone()},equals_:n,toArray:function(){return[]},toString:c("none()")},Object.freeze&&Object.freeze(r),r),m=function(e){var n=function(){return e},t=function(){return o},r=function(n){return n(e)},o={fold:function(n,t){return t(e)},is:function(n){return e===n},isSome:d,isNone:f,getOr:n,getOrThunk:n,getOrDie:n,getOrNull:n,getOrUndefined:n,or:t,orThunk:t,map:function(n){return m(n(e))},ap:function(n){return n.fold(p,function(n){return m(n(e))})},each:function(n){n(e)},bind:r,flatten:n,exists:r,forall:r,filter:function(n){return n(e)?o:g},equals:function(n){return n.is(e)},equals_:function(n,t){return n.fold(f,function(n){return t(e,n)})},toArray:function(){return[e]},toString:function(){return"some("+e+")"}};return o},y=function(n){return null===n||n===undefined?g:m(n)},h=function(n){return n&&/^(TH|TD)$/.test(n.nodeName)},L=function(r){return function(n){return n&&/^(OL|UL|DL)$/.test(n.nodeName)&&(e=n,(t=r).$.contains(t.getBody(),e));var t,e}},b=function(n){var t=n.dom.getParent(n.selection.getNode(),"ol,ul"),e=n.dom.getStyle(t,"listStyleType");return y(e)},S=function(n,t,e){var r=function(n,t){for(var e=0;e<n.length;e++)if(t(n[e]))return e;return-1}(t.parents,h),o=-1!==r?t.parents.slice(0,r):t.parents,u=v.grep(o,L(n));return 0<u.length&&u[0].nodeName===e},T=function(n,t,e,r,o,u){var i,l,c,s,a,f,d,p,g,m,y;0<u.length?(d=t,p=e,g=r,m=o,y=u,(f=n).ui.registry.addSplitButton(d,{type:"splitbutton",active:!1,tooltip:p,icon:"OL"===m?"ordered-list":"unordered-list",presets:"toolbar",columns:3,fetch:function(n){n(v.map(y,function(n){var t="OL"===m?"num":"bull",e="disc"===n||"decimal"===n?"default":n,r="default"===n?"":n,o=n.replace(/\-/g," ").replace(/\b\w/g,function(n){return n.toUpperCase()});return{type:"choiceitem",value:r,icon:"list-"+t+"-"+e,text:o,ariaLabel:o}}))},onAction:function(){return f.execCommand(g)},onItemAction:function(n,t){O(f,m,t)},select:function(t){return b(f).map(function(n){return t===n}).getOr(!1)},onSetup:function(t){var n=function(n){t.setActive(S(f,n,m))};return f.on("nodeChange",n),function(){return f.off("nodeChange",n)}}})):(l=t,c=e,s=r,a=o,(i=n).ui.registry.addToggleButton(l,{active:!1,tooltip:c,icon:"OL"===a?"ordered-list":"unordered-list",onSetup:function(t){var n=function(n){t.setActive(S(i,n,a))};return i.on("nodeChange",n),function(){return i.off("nodeChange",n)}},onAction:function(){return i.execCommand(s)}}))},A=function(n){T(n,"numlist","Numbered list","InsertOrderedList","OL",i(n)),T(n,"bullist","Bullet list","InsertUnorderedList","UL",l(n))};o.add("advlist",function(n){var t,e,r;e="lists",r=(t=n).settings.plugins?t.settings.plugins:"",-1!==v.inArray(r.split(/[ ,]/),e)&&(A(n),u(n))}),function C(){}}();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
!function(){"use strict";var e,n,t=tinymce.util.Tools.resolve("tinymce.PluginManager"),s=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),f=tinymce.util.Tools.resolve("tinymce.util.I18n"),i=tinymce.util.Tools.resolve("tinymce.util.Tools"),a=function(t){return t.getParam("toc_class","mce-toc")},m=function(t){var e=t.getParam("toc_header","h2");return/^h[1-6]$/.test(e)?e:"h2"},c=function(t){var e=parseInt(t.getParam("toc_depth","3"),10);return 1<=e&&e<=9?e:3},l=(e="mcetoc_",n=0,function(){var t=(new Date).getTime().toString(32);return e+t+(n++).toString(32)}),u=function u(t){var e,n=[];for(e=1;e<=t;e++)n.push("h"+e);return n.join(",")},v=function(n){var o=a(n),t=m(n),e=u(c(n)),r=n.$(e);return r.length&&/^h[1-9]$/i.test(t)&&(r=r.filter(function(t,e){return!n.dom.hasClass(e.parentNode,o)})),i.map(r,function(t){return{id:t.id?t.id:l(),level:parseInt(t.nodeName.replace(/^H/i,""),10),title:n.$.text(t),element:t}})},d=function(t){var e,n,o,r,i,c,a,l="",u=v(t),d=function(t){var e,n=9;for(e=0;e<t.length;e++)if(t[e].level<n&&(n=t[e].level),1===n)return n;return n}(u)-1;if(!u.length)return"";for(l+=(i=m(t),c=f.translate("Table of Contents"),a="</"+i+">","<"+i+' contenteditable="true">'+s.DOM.encode(c)+a),e=0;e<u.length;e++){if((o=u[e]).element.id=o.id,r=u[e+1]&&u[e+1].level,d===o.level)l+="<li>";else for(n=d;n<o.level;n++)l+="<ul><li>";if(l+='<a href="#'+o.id+'">'+o.title+"</a>",r!==o.level&&r)for(n=o.level;r<n;n--)l+="</li></ul><li>";else l+="</li>",r||(l+="</ul>");d=o.level}return l},g=function(t){var e=a(t),n=t.$("."+e);n.length&&t.undoManager.transact(function(){n.html(d(t))})},o={hasHeaders:function(t){return 0<v(t).length},insertToc:function(t){var e,n,o,r,i=a(t),c=t.$("."+i);o=t,!(r=c).length||0<o.dom.getParents(r[0],".mce-offscreen-selection").length?t.insertContent((n=d(e=t),'<div class="'+e.dom.encode(a(e))+'" contenteditable="false">'+n+"</div>")):g(t)},updateToc:g},r=function(t){t.addCommand("mceInsertToc",function(){o.insertToc(t)}),t.addCommand("mceUpdateToc",function(){o.updateToc(t)})},h=function(t){var n=t.$,o=a(t);t.on("PreProcess",function(t){var e=n("."+o,t.node);e.length&&(e.removeAttr("contentEditable"),e.find("[contenteditable]").removeAttr("contentEditable"))}),t.on("SetContent",function(){var t=n("."+o);t.length&&(t.attr("contentEditable",!1),t.children(":first-child").attr("contentEditable",!0))})},p=function(n){return function(t){var e=t.control;n.on("LoadContent SetContent change",function(){e.disabled(n.readonly||!o.hasHeaders(n))})}},T=function(t){var e;t.ui.registry.addButton("toc",{tooltip:"Table of Contents",onAction:function(){return t.execCommand("mceInsertToc")},icon:"toc",onPostRender:p(t)}),t.ui.registry.addButton("tocupdate",{tooltip:"Update",onAction:function(){return t.execCommand("mceUpdateToc")},icon:"reload"}),t.ui.registry.addMenuItem("toc",{text:"Table of Contents",onAction:function(){return t.execCommand("mceInsertToc")},icon:"toc",onPostRender:p(t)}),t.ui.registry.addContextToolbar("toc",{type:"contexttoolbar",items:["tocupdate"],predicate:(e=t,function(t){return t&&e.dom.is(t,"."+a(e))&&e.getBody().contains(t)}),position:"node"})};t.add("toc",function(t){r(t),T(t),h(t)}),function y(){}}();
!function(){"use strict";var e,n,t=tinymce.util.Tools.resolve("tinymce.PluginManager"),s=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),f=tinymce.util.Tools.resolve("tinymce.util.I18n"),i=tinymce.util.Tools.resolve("tinymce.util.Tools"),a=function(t){return t.getParam("toc_class","mce-toc")},m=function(t){var e=t.getParam("toc_header","h2");return/^h[1-6]$/.test(e)?e:"h2"},c=function(t){var e=parseInt(t.getParam("toc_depth","3"),10);return 1<=e&&e<=9?e:3},l=(e="mcetoc_",n=0,function(){var t=(new Date).getTime().toString(32);return e+t+(n++).toString(32)}),u=function u(t){var e,n=[];for(e=1;e<=t;e++)n.push("h"+e);return n.join(",")},v=function(n){var o=a(n),t=m(n),e=u(c(n)),r=n.$(e);return r.length&&/^h[1-9]$/i.test(t)&&(r=r.filter(function(t,e){return!n.dom.hasClass(e.parentNode,o)})),i.map(r,function(t){return{id:t.id?t.id:l(),level:parseInt(t.nodeName.replace(/^H/i,""),10),title:n.$.text(t),element:t}})},d=function(t){var e,n,o,r,i,c,a,l="",u=v(t),d=function(t){var e,n=9;for(e=0;e<t.length;e++)if(t[e].level<n&&(n=t[e].level),1===n)return n;return n}(u)-1;if(!u.length)return"";for(l+=(i=m(t),c=f.translate("Table of Contents"),a="</"+i+">","<"+i+' contenteditable="true">'+s.DOM.encode(c)+a),e=0;e<u.length;e++){if((o=u[e]).element.id=o.id,r=u[e+1]&&u[e+1].level,d===o.level)l+="<li>";else for(n=d;n<o.level;n++)l+="<ul><li>";if(l+='<a href="#'+o.id+'">'+o.title+"</a>",r!==o.level&&r)for(n=o.level;r<n;n--)l+="</li></ul><li>";else l+="</li>",r||(l+="</ul>");d=o.level}return l},g=function(t){var e=a(t),n=t.$("."+e);n.length&&t.undoManager.transact(function(){n.html(d(t))})},o={hasHeaders:function(t){return 0<v(t).length},insertToc:function(t){var e,n,o,r,i=a(t),c=t.$("."+i);o=t,!(r=c).length||0<o.dom.getParents(r[0],".mce-offscreen-selection").length?t.insertContent((n=d(e=t),'<div class="'+e.dom.encode(a(e))+'" contenteditable="false">'+n+"</div>")):g(t)},updateToc:g},r=function(t){t.addCommand("mceInsertToc",function(){o.insertToc(t)}),t.addCommand("mceUpdateToc",function(){o.updateToc(t)})},h=function(t){var n=t.$,o=a(t);t.on("PreProcess",function(t){var e=n("."+o,t.node);e.length&&(e.removeAttr("contentEditable"),e.find("[contenteditable]").removeAttr("contentEditable"))}),t.on("SetContent",function(){var t=n("."+o);t.length&&(t.attr("contentEditable",!1),t.children(":first-child").attr("contentEditable",!0))})},p=function(n){return function(t){var e=function(){return t.setDisabled(n.readonly||!o.hasHeaders(n))};return e(),n.on("LoadContent SetContent change",e),function(){return n.on("LoadContent SetContent change",e)}}},T=function(t){var e;t.ui.registry.addButton("toc",{icon:"toc",tooltip:"Table of Contents",onAction:function(){return t.execCommand("mceInsertToc")},onSetup:p(t)}),t.ui.registry.addButton("tocupdate",{icon:"reload",tooltip:"Update",onAction:function(){return t.execCommand("mceUpdateToc")}}),t.ui.registry.addMenuItem("toc",{icon:"toc",text:"Table of Contents",onAction:function(){return t.execCommand("mceInsertToc")},onSetup:p(t)}),t.ui.registry.addContextToolbar("toc",{items:["tocupdate"],predicate:(e=t,function(t){return t&&e.dom.is(t,"."+a(e))&&e.getBody().contains(t)}),scope:"node",position:"node"})};t.add("toc",function(t){r(t),T(t),h(t)}),function C(){}}();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -479,6 +479,15 @@ var font_size_formats = {
pt: "8pt 10pt 12pt 14pt 18pt 24pt 36pt 48pt 72pt",
px:"8px 10px 12px 14px 18px 24px 36px 48px 72px"
};
var language_code = {
bg: "bg_BG", ca: "ca", cs: "cs", da: "da", de: "de", en:"en_CA",
el:"el", "es-es":"es", et: "et", eu: "eu" , fa: "fa_IR", fi: "fi",
fr: "fr_FR", hi:"", hr:"hr", hu:"hu_HU", id: "id", it: "it", iw: "",
ja: "ja", ko: "ko_KR", lo: "", lt: "lt", lv: "lv", nl: "nl", no: "nb_NO",
pl: "pl", pt: "pt_PT", "pt-br": "pt_BR", ru: "ru", sk: "sk", sl: "sl_SI",
sv: "sv_SE", th: "th_TH", tr: "tr_TR", uk: "en_GB", vi: "vi_VN", zh: "zh_CN",
"zh-tw": "zh_TW"
};
var name = "#"+"'.$_name.'".replace( /(:|\.|\[|\]|,|=|@)/g, "\\\$1" );
var height = "'.$_height.'";
var width = "'.$_width.'";
@ -489,9 +498,9 @@ tinymce.init({
resize: false,
height: height.match(/%/) ? height : parseInt(height),
width: width.match(/%/) ? width : parseInt(width),
min_height: 100,
min_height: 200,
auto_focus: "'.$focusToBody.'",
language:"'. $GLOBALS['egw_info']['user']['preferences']['common']['lang'].'",
language: language_code["'. $GLOBALS['egw_info']['user']['preferences']['common']['lang'].'"],
browser_spellcheck: true,
contextmenu: false,
file_picker_callback: function(_callback, _value, _meta){

View File

@ -297,6 +297,12 @@ class Smime extends Horde_Crypt_Smime
}
if ($acc_smime['acc_smime_password'])
{
$pass = explode('[[smime_passphrase]]', $acc_smime['acc_smime_password']);
if (is_array($pass)) {
$acc_smime['acc_smime_password'] = $pass[0];
$passphrase = $pass[1];
Api\Cache::setSession('mail', 'smime_passphrase', $passphrase);
}
$extracted = self::extractCertPKCS12(
$acc_smime['acc_smime_password'],
$passphrase