PluginProbe
Polylang / trunk
Polylang vtrunk
3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 2.7 2.7.0.1 2.7.1 2.7.2 2.7.3 2.7.4 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.9 2.9.1 2.9.2 3.0 3.0.1 3.0.2 3.0.3 All 233 releases
← All changes | js/build/block-editor.min.js +1 -1 3.0 → trunk View file →
@@ -1 +1 @@
1 -"use strict";const{__}=wp.i18n,languagesList=jQuery(".post_lang_choice"),initializeConfimationModal=()=>{const t=jQuery("<div/>",{id:"pll-dialog",style:"display:none;"}).text(__("Are you sure you want to change the language of the current content?","polylang"));languagesList.after(t);const a=new Promise(((a,e)=>{const n=n=>{switch(n){case"yes":languagesList.data("old-value",languagesList.children(":selected")[0].value),a();break;case"no":languagesList.val(languagesList.data("old-value")),e("Cancel")}t.dialog("close")};t.dialog({autoOpen:!1,modal:!0,draggable:!1,resizable:!1,title:__("Change language","polylang"),minWidth:600,maxWidth:"100%",classes:{"ui-dialog":"pll-confirmation-modal"},open:function(t,a){jQuery("body").hasClass("rtl")&&jQuery(this).parent().css({right:jQuery(this).parent().css("left"),left:"auto"})},close:function(t,a){n("no")},buttons:[{text:__("OK","polylang"),click:function(t){n("yes")}},{text:__("Cancel","polylang"),click:function(t){n("no")}}]})}));return{dialogContainer:t,dialogResult:a}},initializeLanguageOldValue=()=>{languagesList.attr("data-old-value",languagesList.children(":selected")[0].value)};function getCurrentLanguage(){return document.querySelector("[name=post_lang_choice]").value}wp.apiFetch.use((function(t,a){return void 0===t.url&&(void 0===t.data||null===t.data?t.path+=(t.path.indexOf("?")>=0?"&lang=":"?lang=")+getCurrentLanguage():t.data.lang=getCurrentLanguage()),a(t)})),jQuery((function(t){function a(){t(".tr_lang").each((function(){var a=t(this).attr("id").substring(8),e=t(this).parent().parent().siblings(".pll-edit-column");t(this).autocomplete({minLength:0,source:ajaxurl+"?action=pll_posts_not_translated&post_language="+t(".post_lang_choice").val()+"&translation_language="+a+"&post_type="+t("#post_type").val()+"&_pll_nonce="+t("#_pll_nonce").val(),select:function(n,l){t("#htr_lang_"+a).val(l.item.id),e.html(l.item.link)}}),t(this).on("blur",(function(){t(this).val()||(t("#htr_lang_"+a).val(0),e.html(e.siblings(".hidden").children().clone()))}))}))}initializeLanguageOldValue(),t(".post_lang_choice").on("change",(function(e){const n=wp.data.select,l=wp.data.dispatch,i=wp.data.subscribe,o=function(){const t=wp.data.select("core/editor"),a=t.getEditedPostAttribute("title").trim(),e=t.getEditedPostAttribute("content").trim(),n=t.getEditedPostAttribute("excerpt").trim();return!a&&!e&&!n}(),s=initializeConfimationModal(),{dialogContainer:c}=s;let{dialogResult:u}=s;const r=e.target;var g;location.pathname.match(/post-new.php/gi)&&o&&(g=r.value,-1!=location.search.indexOf("new_lang")?window.location.search=window.location.search.replace(/(?:new_lang=[^&]*)(&)?(.*)/,"new_lang="+g+"$1$2"):window.location.search=window.location.search+(-1!=window.location.search.indexOf("?")?"&":"?")+"new_lang="+g),t(this).data("old-value")===r.value||o?(initializeLanguageOldValue(),u=Promise.resolve()):c.dialog("open"),u.then((()=>{var e={action:"post_lang_choice",lang:r.value,post_type:t("#post_type").val(),post_id:t("#post_ID").val(),_pll_nonce:t("#_pll_nonce").val()};t.post(ajaxurl,e,(function(e){var o=wpAjax.parseAjaxResponse(e,"ajax-response");t.each(o.responses,(function(){switch(this.what){case"translations":t(".translations").html(this.data),a();break;case"flag":t(".pll-select-flag").html(this.data)}})),function(){let t=null;const a=new Promise((function(a,e){t=i((function(){const t=n("core/editor").didPostSaveRequestSucceed(),l=n("core/editor").didPostSaveRequestFail();(t||l)&&(l?e():a())}))}));l("core/editor").savePost(),a.then((function(){window.location.reload()}),(function(){t()})).catch((function(){t()}))}()}))}),(()=>{}))})),a()}));
1 +(()=>{var t={631(t){t.exports=function(){return this.wp.apiFetch}()}};const e={};function n(o){const a=e[o];if(void 0!==a)return a.exports;const l=e[o]={exports:{}};return t[o](l,l.exports,n),l.exports}n.n=t=>{const e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var o in e)n.o(e,o)&&!n.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);(()=>{"use strict";const t=jQuery(".post_lang_choice"),e=()=>{const{__:e}=wp.i18n,n=jQuery("<div/>",{id:"pll-dialog",style:"display:none;"}).text(e("Are you sure you want to change the language of the current content?","polylang"));t.after(n);const o=new Promise((o,a)=>{const l=e=>{switch(e){case"yes":t.data("old-value",t.children(":selected").first().val()),o();break;case"no":t.val(t.data("old-value")),a("Cancel")}n.dialog("close")},i={autoOpen:!1,modal:!0,draggable:!1,resizable:!1,title:e("Change language","polylang"),minWidth:600,maxWidth:"100%",open:function(t,e){jQuery("body").hasClass("rtl")&&jQuery(this).parent().css({right:jQuery(this).parent().css("left"),left:"auto"})},close:function(t,e){l("no")},buttons:[{text:e("OK","polylang"),click:function(t){l("yes")}},{text:e("Cancel","polylang"),click:function(t){l("no")}}]};jQuery.ui.version>="1.12.0"?Object.assign(i,{classes:{"ui-dialog":"pll-confirmation-modal"}}):Object.assign(i,{dialogClass:"pll-confirmation-modal"}),n.dialog(i)});return{dialogContainer:n,dialogResult:o}},o=()=>{t.attr("data-old-value",t.children(":selected").first().val())};var a=n(631),l=n.n(a);const i=(t,e,n)=>{const o=t.path.split("?")[0].replace(/^\/+|\/+$/g,"");return Object.values(e).find(t=>o===t)?n(t):t};function r(){const t=document.querySelector("[name=post_lang_choice]");return null===t?pllDefaultLanguage:t.value}(t=>{l().use((e,n)=>void 0!==e.url||void 0===window.pllFilteredRoutes?n(e):n(i(e,window.pllFilteredRoutes,t)))})(function(t){return void 0===t.data||null===t.data?t.path+=(t.path.indexOf("?")>=0?"&lang=":"?lang=")+r():t.data.lang=r(),t}),jQuery(function(t){o(),t(".post_lang_choice").on("change",function(n){const{select:a,dispatch:l,subscribe:i}=wp.data,r=function(){const t=a("core/editor");return!t.getEditedPostAttribute("title")?.trim()&&!t.getEditedPostContent()&&!t.getEditedPostAttribute("excerpt")?.trim()}(),{addQueryArgs:s}=wp.url,c=e(),{dialogContainer:u}=c;let{dialogResult:d}=c;const p=n.target;var g;location.pathname.match(/post-new.php/gi)&&r&&(g=p.value,-1!=location.search.indexOf("new_lang")?window.location.search=window.location.search.replace(/(?:new_lang=[^&]*)(&)?(.*)/,"new_lang="+g+"$1$2"):window.location.search=window.location.search+(-1!=window.location.search.indexOf("?")?"&":"?")+"new_lang="+g),t(this).data("old-value")===p.value||r?(o(),d=Promise.resolve()):u.dialog("open"),d.then(()=>{let e={action:"post_lang_choice",lang:p.value,post_type:t("#post_type").val(),post_id:t("#post_ID").val(),_pll_nonce:t("#_pll_nonce").val()};t.post(ajaxurl,e,function(){!function(){let t=null;const e=a("core/editor").getCurrentPost(),n=new Promise(function(n,o){t=i(function(){const t=a("core/editor").getCurrentPost(),{id:l,status:i,type:r}=t;a("core").getLastEntitySaveError("postType",r,l)&&o(),e.modified!==t.modified&&(location.pathname.match(/post-new.php/gi)&&"auto-draft"!==i&&l&&window.history.replaceState({id:l},"Post "+l,s("post.php",{post:l,action:"edit"})),n())})});l("core/editor").savePost(),n.then(function(){window.location.reload()},function(){t()}).catch(function(){t()})}()})},()=>{})}),jQuery(".tr_lang").each(function(){var t=jQuery(this).attr("id").substring(8),e=jQuery(this).parent().parent().siblings(".pll-edit-column");jQuery(this).autocomplete({minLength:0,source:ajaxurl+"?action=pll_posts_not_translated&post_language="+jQuery(".post_lang_choice").val()+"&translation_language="+t+"&post_type="+jQuery("#post_type").val()+"&_pll_nonce="+jQuery("#_pll_nonce").val(),select:function(n,o){jQuery("#htr_lang_"+t).val(o.item.id),e.html(o.item.link)}}),jQuery(this).on("blur",function(){jQuery(this).val()||(jQuery("#htr_lang_"+t).val(0),e.html(e.siblings(".hidden").children().clone()))})})})})(),this.polylang={}})();