You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
5.9 KiB
JavaScript

!function n(o,r,s){function a(i,e){if(!r[i]){if(!o[i]){var t="function"==typeof require&&require;if(!e&&t)return t(i,!0);if(c)return c(i,!0);throw new Error("Cannot find module '"+i+"'")}e=r[i]={exports:{}};o[i][0].call(e.exports,function(e){var t=o[i][1][e];return a(t||e)},e,e.exports,n,o,r,s)}return r[i].exports}for(var c="function"==typeof require&&require,e=0;e<s.length;e++)a(s[e]);return a}({1:[function(e,t,i){"use strict";function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,o,r,s,a=[],c=!0,u=!1;try{if(r=(i=i.call(e)).next,0===t){if(Object(i)!==i)return;c=!1}else for(;!(c=(n=r.call(i)).done)&&(a.push(n.value),a.length!==t);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=i.return&&(s=i.return(),Object(s)!==s))return}finally{if(u)throw o}}return a}}(e,t)||function(e,t){var i;if(e)return"string"==typeof e?n(e,t):"Map"===(i="Object"===(i=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:i)||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?n(e,t):void 0}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}var o,r,s,c;(window.WPFormsEditPostEducation||(o=document,r=window,s=jQuery,c={isNoticeVisible:!1,init:function(){s(r).on("load",function(){"function"==typeof s.ready.then?s.ready.then(c.load):c.load()})},load:function(){var e;c.isGutenbergEditor()?e=setInterval(function(){var t,i;o.querySelector('.editor-post-title__input, iframe[name="editor-canvas"]')&&(clearInterval(e),c.isFse()?(t=o.querySelector('iframe[name="editor-canvas"]'),(i=new MutationObserver(function(){var e=t.contentDocument||t.contentWindow.document||{};"complete"===e.readyState&&e.querySelector(".editor-post-title__input")&&(c.maybeShowGutenbergNotice(),c.bindFseEvents(),i.disconnect())})).observe(o.body,{subtree:!0,childList:!0})):(c.maybeShowGutenbergNotice(),c.bindGutenbergEvents()))},200):(c.maybeShowClassicNotice(),c.bindClassicEvents())},bindClassicEvents:function(){var e=s(o);c.isNoticeVisible||e.on("input","#title",c.maybeShowClassicNotice),e.on("click",".wpforms-edit-post-education-notice-close",c.closeNotice)},bindGutenbergEvents:function(){var e=s(o);e.on("DOMSubtreeModified",".edit-post-layout",c.distractionFreeModeToggle),c.isNoticeVisible||e.on("input",".editor-post-title__input",c.maybeShowGutenbergNotice).on("DOMSubtreeModified",".editor-post-title__input",c.maybeShowGutenbergNotice)},bindFseEvents:function(){var e=s('iframe[name="editor-canvas"]');s(o).on("DOMSubtreeModified",".edit-post-layout",c.distractionFreeModeToggle),e.contents().on("DOMSubtreeModified",".editor-post-title__input",c.maybeShowGutenbergNotice)},isGutenbergEditor:function(){return"undefined"!=typeof wp&&void 0!==wp.blocks},isFse:function(){return Boolean(s('iframe[name="editor-canvas"]').length)},showGutenbergNotice:function(){wp.data.dispatch("core/notices").createInfoNotice(wpforms_edit_post_education.gutenberg_notice.template,c.getGutenbergNoticeSettings());var t=setInterval(function(){var e=s(".wpforms-edit-post-education-notice-body");e.length&&((e=e.closest(".components-notice")).addClass("wpforms-edit-post-education-notice"),e.find(".is-secondary, .is-link").removeClass("is-secondary").removeClass("is-link").addClass("is-primary"),clearInterval(t))},100)},getGutenbergNoticeSettings:function(){var n,o,e,r,t,s="wpforms-edit-post-product-education-guide",i={id:s,isDismissible:!0,HTML:!0,__unstableHTML:!0,actions:[{className:"wpforms-edit-post-education-notice-guide-button",variant:"primary",label:wpforms_edit_post_education.gutenberg_notice.button}]};return wpforms_edit_post_education.gutenberg_guide?(n=wp.components.Guide,o=wp.element.useState,e=wp.plugins.registerPlugin,r=wp.plugins.unregisterPlugin,t=function(){var e=a(o(!0