105 lines
35 KiB
JavaScript
105 lines
35 KiB
JavaScript
|
window.yoast=window.yoast||{},window.yoast.components=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=401)}({0:function(e,t){e.exports=window.yoast.propTypes},1:function(e,t){e.exports=window.wp.element},10:function(e,t){e.exports=window.yoast.helpers},110:function(e,t){e.exports=window.yoast.jed},12:function(e,t){function n(){return e.exports=n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},e.exports.default=e.exports,e.exports.__esModule=!0,n.apply(this,arguments)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},16:function(e,t){e.exports=window.yoast.replacementVariableEditor},19:function(e,t){e.exports=window.yoast.redux},195:function(e,t,n){var r,o,i;o=[e,n(324),n(326),n(327)],void 0===(i="function"==typeof(r=function(e,t,n,r){"use strict";var o=a(t),i=a(n),s=a(r);function a(e){return e&&e.__esModule?e:{default:e}}var l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=function(e){function t(e,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return r.resolveOptions(n),r.listenClick(e),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),u(t,[{key:"resolveOptions",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof e.action?e.action:this.defaultAction,this.target="function"==typeof e.target?e.target:this.defaultTarget,this.text="function"==typeof e.text?e.text:this.defaultText,this.container="object"===l(e.container)?e.container:document.body}},{key:"listenClick",value:function(e){var t=this;this.listener=(0,s.default)(e,"click",(function(e){return t.onClick(e)}))}},{key:"onClick",value:function(e){var t=e.delegateTarget||e.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new o.default({action:this.action(t),target:this.target(t),text:this.text(t),container:this.container,trigger:t,emitter:this})}},{key:"defaultAction",value:function(e){return d("action",e)}},{key:"defaultTarget",value:function(e){var t=d("target",e);if(t)return document.querySelector(t)}},{key:"defaultText",value:function(e){return d("text",e)}},{key:"destroy",value:function(){this.listener.destroy(),this.clipboardAction&&(this.clipboardActi
|
||
|
display: flex;
|
||
|
margin-top: 8px;
|
||
|
`;class v extends c.a.Component{render(){return Object(s.createElement)(m,null,Object(s.createElement)(i.Toggle,{id:this.props.id,labelText:Object(b.__)("Mark as cornerstone content","wordpress-seo"),isEnabled:this.props.isEnabled,onSetToggleState:this.props.onToggle,onToggleDisabled:this.props.onToggleDisabled}))}}v.propTypes={id:l.a.string,isEnabled:l.a.bool,onSetToggleState:l.a.func,onToggle:l.a.func,disable:l.a.bool,onToggleDisabled:l.a.func},v.defaultProps={id:"cornerstone-toggle"};var S=v,E=n(12),w=n.n(E);const x=y.a.div`
|
||
|
display: flex;
|
||
|
align-items: center;
|
||
|
min-height: 40px;
|
||
|
margin-bottom: 5px;
|
||
|
`,O=y.a.button`
|
||
|
box-sizing: border-box;
|
||
|
height: 30px;
|
||
|
width: 30px;
|
||
|
background-color: ${o.colors.$color_button};
|
||
|
border-radius: 5px;
|
||
|
cursor: pointer;
|
||
|
outline:none;
|
||
|
margin-right: 8px;
|
||
|
border: 1px solid ${o.colors.$color_button_border};
|
||
|
|
||
|
&:focus {
|
||
|
box-shadow: 0 0 0 1px #5b9dd9, 0 0 2px 1px rgba(30, 140, 190, 0.8);
|
||
|
}
|
||
|
`,_=Object(r.makeOutboundLink)(y.a.a`
|
||
|
max-width: 128px;
|
||
|
padding: 6px 0;
|
||
|
margin-right: 8px;
|
||
|
`),T=y.a.span`
|
||
|
max-width: 75px;
|
||
|
white-space: nowrap;
|
||
|
overflow: hidden;
|
||
|
text-overflow: ellipsis;
|
||
|
text-align: center;
|
||
|
display: block;
|
||
|
padding: 3px 8px;
|
||
|
margin-left: auto;
|
||
|
font-size: 0.85em;
|
||
|
background-color: #f3f4f5;
|
||
|
border-radius: 2px;
|
||
|
`,k=e=>{let{value:t,url:n,isActive:r,type:a}=e;const l=Object(b.__)("Copy link","wordpress-seo"),u=Object(b.sprintf)(
|
||
|
/* translators: %s expands to the link value */
|
||
|
Object(b.__)("Copy link to suggested article: %s","wordpress-seo"),t);let c="clipboard";return r&&(c="check"),Object(s.createElement)(x,null,Object(s.createElement)(O,{type:"button",className:"yoast-link-suggestion__copy yoast-tooltip yoast-tooltip-alt yoast-tooltip-s",onBlur:e=>{e.nativeEvent.target.setAttribute("aria-label",u),e.nativeEvent.target.setAttribute("data-label",l)},"data-clipboard-text":n,"aria-label":u,"data-label":l},Object(s.createElement)(i.SvgIcon,{icon:c,color:o.colors.$color_grey_dark}),Object(s.createElement)(i.ScreenReaderText,null,l)),Object(s.createElement)(_,{href:n},t),Object(s.createElement)(T,{title:a},a))};k.propTypes={value:l.a.string.isRequired,url:l.a.string.isRequired,isActive:l.a.bool,type:l.a.string.isRequired},k.defaultProps={isActive:!1};var A=k,j=n(195),L=n.n(j),C=n(26),R=n.n(C),N=n(36);const I=Object(r.makeOutboundLink)(),M=y.a.div`
|
||
|
display: table-cell;
|
||
|
`,P=Object(b.__)("We could not find any relevant articles on your website that you could link to from your post.","wordpress-seo"),F=Object(b.__)("{{a}}Read our article about site structure{{/a}} to learn more about how internal linking can help improve your SEO.","wordpress-seo"),U=Object(b.__)("Consider linking to these {{a}}cornerstone articles:{{/a}}","wordpress-seo"),D=Object(b.__)("Consider linking to these articles:","wordpress-seo");class Y extends c.a.Component{constructor(e){super(e),this.state={clipboard:new L.a(".yoast-link-suggestion__copy")},this.state.clipboard.on("success",this.handleSuccess.bind(this)),this.state.clipboard.on("error",this.handleError.bind(this))}handleSuccess(e){const t=Object(b.__)("Copied!","wordpress-seo");e.trigger.focus(),e.trigger.setAttribute("aria-label",t),e.trigger.setAttribute("data-label",t),Object(N.speak)(t,"assertive")}handleError(e){const t=Object(b.__)("Not supported!","wordpress-seo");e.trigger.el.setAttribute("aria-label",t),e.trigger.setAttribute("data-label",t),Object(N.speak)(t,"assertive")}renderEmptyList(){let e=this.props.customMessages.lengthMessage;return e=""===e?P:e,Object(s.createElement)("div",null,Object(s.createElement)("p",null,e),Object(s.createElement)("p",null,this.props.customMessages.metaMessage),Object(s.createElement)("p",null,this.getArticleLink()))}render(){const e=this.props.suggestions,t=this.props.maxSuggestions;if(0===e.length)return this.renderEmptyList();e.length>t&&(e.length=t);const n=this.getCornerstoneSuggestions(),r=this.getDefaultSuggestions();return Object(s.createElement)(M,null,n,r,Object(s.createElement)("p",null,this.getArticleLink()),Object(s.createElement)("p",null,this.props.customMessages.metaMessage))}getCornerstoneSuggestions(){const e=this.filterSuggestionsByCornerstone(!0);if(0===e.length)return null;const t=R()({mixedString:U,components:{a:Object(s.createElement)(I,{href:"https://yoa.st/metabox-ls-help-cornerstone"})}});return this.getSuggestionsList(t,e)}getDefaultSuggestions(){const e=this.filterSuggestionsByCornerstone(!1);return 0===e.length?null:this.getSuggestionsList(D,e)}getArticleLink(){return R()({mixedString:F,components:{a:Object(s.createElement)(I,{href:"https://yoa.st/site-structure-metabox"})}})}getSuggestionsList(e,t){return Object(s.createElement)("div",null,Object(s.createElement)("p",null,e),t.map((e,t)=>Object(s.createElement)(A,w()({key:t},e))))}filterSuggestionsByCornerstone(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.props.suggestions.filter(t=>t.isCornerstone===e)}}Y.propTypes={suggestions:l.a.array.isRequired,maxSuggestions:l.a.number,customMessages:l.a.object},Y.defaultProps={maxSuggestions:10,customMessages:{lengthMessage:"",metaMessage:""}};var B=Y,W=n(47),H=n(16),$=n(2),V={getFeed:r.getFeed,getCourseFeed:r.getCourseFeed,getPostFeed:r.getPostFeed,makeOutboundLink:r.makeOutboundLink,buildStructuredUrl:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=Object.keys(t);let r=e;return n.forEach(e=>{const n=t[e],o=Object($.isArray)(n)?n.join("/"):n,i=`%${e}%`;r=r.replace(new RegExp(i,"g"),o)}),r}},z=n(110),K=n.n(z),q=n(196),G=n.n(q),X=null;function J(e){X=new K.a(e)}function Q(){return null===X&&(X=new K.a({})),X}function Z(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const r=Q();return""===t?r.gettext(e):r.ngettext(e,t,n)}function ee(e){const t=e.displayName||e.name||"",n={translate:Z};class r extends c.a.Component{constructor(e){super(e),this.displayName="Localized"+t}render(){const t=G()({},this.props,n);return Object(s.createElement)(e,t)}}return r}function te(e,t){return{type:"CONTENT_ANALYSIS_SET_SEO_RESULTS_FOR_KEYWORD",keyword:e,results:t}}function ne(e){return{type:"CONTENT_ANALYSIS_SET_READABILITY_RESULTS",results:e}}function re(e){return{type:"CONTENT_ANALYSIS_SET_INCLUSIVE_LANGUAGE_RESULTS",results:e}}function oe(e){return{type:"CONTENT_ANALYSIS_SET_OVERALL_READABILITY_SCORE",overallScore:e}}function ie(e,t){return{type:"CONTENT_ANALYSIS_S
|
||
|
display: flex;
|
||
|
flex-direction: column;
|
||
|
`,Ie=y.a.label`
|
||
|
font-size: var(--yoast-font-size-default);
|
||
|
font-weight: var(--yoast-font-weight-bold);
|
||
|
${Object(r.getDirectionalStyle)("margin-right: 4px","margin-left: 4px")};
|
||
|
`,Me=y.a.span`
|
||
|
margin-bottom: 0.5em;
|
||
|
`,Pe=y()(i.InputField)`
|
||
|
flex: 1 !important;
|
||
|
box-sizing: border-box;
|
||
|
max-width: 100%;
|
||
|
margin: 0; // Reset margins inherited from WordPress.
|
||
|
|
||
|
// Hide native X in Edge and IE11.
|
||
|
&::-ms-clear {
|
||
|
display: none;
|
||
|
}
|
||
|
|
||
|
&.has-error {
|
||
|
border-color: ${je} !important;
|
||
|
background-color: ${Le} !important;
|
||
|
|
||
|
&:focus {
|
||
|
box-shadow: 0 0 2px ${je} !important;
|
||
|
}
|
||
|
}
|
||
|
`,Fe=y.a.ul`
|
||
|
color: ${Re};
|
||
|
list-style-type: disc;
|
||
|
list-style-position: outside;
|
||
|
margin: 0;
|
||
|
margin-left: 1.2em;
|
||
|
`,Ue=y.a.li`
|
||
|
color: ${Re};
|
||
|
margin: 0 0 0.5em 0;
|
||
|
`,De=Object(i.addFocusStyle)(y.a.button`
|
||
|
border: 1px solid transparent;
|
||
|
box-shadow: none;
|
||
|
background: none;
|
||
|
flex: 0 0 32px;
|
||
|
height: 32px;
|
||
|
max-width: 32px;
|
||
|
padding: 0;
|
||
|
cursor: pointer;
|
||
|
`);De.propTypes={type:l.a.string,focusColor:l.a.string,focusBackgroundColor:l.a.string,focusBorderColor:l.a.string},De.defaultProps={type:"button",focusColor:o.colors.$color_button_text_hover,focusBackgroundColor:"transparent",focusBorderColor:o.colors.$color_blue};const Ye=y()(i.SvgIcon)`
|
||
|
margin-top: 4px;
|
||
|
`,Be=y.a.div`
|
||
|
display: flex;
|
||
|
flex-direction: row;
|
||
|
align-items: center;
|
||
|
|
||
|
&.has-remove-keyword-button {
|
||
|
${Pe} {
|
||
|
${Object(r.getDirectionalStyle)("padding-right: 40px","padding-left: 40px")};
|
||
|
}
|
||
|
|
||
|
${De} {
|
||
|
${Object(r.getDirectionalStyle)("margin-left: -32px","margin-right: -32px")};
|
||
|
}
|
||
|
}
|
||
|
`;class We extends c.a.Component{constructor(e){super(e),this.handleChange=this.handleChange.bind(this)}handleChange(e){this.props.onChange(e.target.value)}renderLabel(){const{id:e,label:t,helpLink:n}=this.props;return Object(s.createElement)(Me,null,Object(s.createElement)(Ie,{htmlFor:e},t),n)}renderErrorMessages(){const e=[...this.props.errorMessages];return!Object($.isEmpty)(e)&&Object(s.createElement)(Fe,null,e.map((e,t)=>Object(s.createElement)(Ue,{key:t},Object(s.createElement)("span",{role:"alert"},e))))}render(){const{id:e,showLabel:t,keyword:n,onRemoveKeyword:r,onBlurKeyword:o,onFocusKeyword:i,hasError:a}=this.props,l=!t,u=r!==$.noop;return Object(s.createElement)(Ne,null,t&&this.renderLabel(),a&&this.renderErrorMessages(),Object(s.createElement)(Be,{className:u?"has-remove-keyword-button":null},Object(s.createElement)(Pe,{"aria-label":l?this.props.label:null,type:"text",id:e,className:a?"has-error":null,onChange:this.handleChange,onFocus:i,onBlur:o,value:n,autoComplete:"off"}),u&&Object(s.createElement)(De,{onClick:r,focusBoxShadowColor:"#084A67"},Object(s.createElement)(Ye,{size:"18px",icon:"times-circle",color:Ce}))))}}We.propTypes={id:l.a.string.isRequired,showLabel:l.a.bool,keyword:l.a.string,onChange:l.a.func.isRequired,onRemoveKeyword:l.a.func,onBlurKeyword:l.a.func,onFocusKeyword:l.a.func,label:l.a.string.isRequired,helpLink:l.a.node,hasError:l.a.bool,errorMessages:l.a.arrayOf(l.a.string)},We.defaultProps={showLabel:!0,keyword:"",onRemoveKeyword:$.noop,onBlurKeyword:$.noop,onFocusKeyword:$.noop,helpLink:null,hasError:!1,errorMessages:[]};var He=We;function $e(e){return{type:"SET_WORDS_FOR_INSIGHTS",wordsForInsights:e}}const Ve=[],ze=Object(ke.combineReducers)({prominentWords:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ve,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SET_WORDS_FOR_INSIGHTS":return t.wordsForInsights;default:return e}}}),Ke=r.getDirectionalStyle,qe=()=>(console.warn("Deprecation Warning: Deprecated since 5.13.1. Use the `OnboardingWizard` from the `@yoast/configuration-wizard` package instead."),null),Ge=()=>(console.warn("Deprecation Warning: Deprecated since 5.13.1. Use the `MessageBox` from the `@yoast/configuration-wizard` package instead."),null),Xe=()=>(console.warn("Deprecation Warning: Deprecated since 5.13.1. Use the `LoadingIndicator` from the `@yoast/configuration-wizard` package instead."),null)},47:function(e,t){e.exports=window.yoast.searchMetadataPreviews},5:function(e,t){e.exports=window.yoast.styledComponents},53:function(e,t,n){"use strict";var r=n(3),o="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,i=n(37),s=n(54),a=n(55),l="function"==typeof Symbol&&Symbol.iterator;function u(e,t){return e&&"object"==typeof e&&null!=e.key?(n=e.key,r={"=":"=0",":":"=2"},"$"+(""+n).replace(/[=:]/g,(function(e){return r[e]}))):t.toString(36);var n,r}var c=/\/+/g;function d(e){return(""+e).replace(c,"$&/")}var f,p,g=h,h=function(e){if(this.instancePool.length){var t=this.instancePool.pop();return this.call(t,e),t}return new this(e)};function y(e,t,n,r){this.result=e,this.keyPrefix=t,this.func=n,this.context=r,this.count=0}function b(e,t,n){var o,s,a=e.result,l=e.keyPrefix,u=e.func,c=e.context,f=u.call(c,t,e.count++);Array.isArray(f)?m(f,a,n,i.thatReturnsArgument):null!=f&&(r.isValidElement(f)&&(o=f,s=l+(!f.key||t&&t.key===f.key?"":d(f.key)+"/")+n,f=r.cloneElement(o,{key:s},void 0!==o.props?o.props.children:void 0)),a.push(f))}function m(e,t,n,r,i){var a="";null!=n&&(a=d(n)+"/");var c=y.getPooled(t,a,r,i);!function(e,t,n){null==e||function e(t,n,r,i){var a,c=typeof t;if("undefined"!==c&&"boolean"!==c||(t=null),null===t||"string"===c||"number"===c||"object"===c&&t.$$typeof===o)return r(i,t,""===n?"."+u(t,0):n),1;var d=0,f=""===n?".":n+":";if(Array.isArray(t))for(var p=0;p<t.length;p++)d+=e(a=t[p],f+u(a,p),r,i);else{var g=function(e){var t=e&&(l&&e[l]||e["@@iterator"]);if("function"==typeof t)return t}(t);if(g)for(var h,y=g.call(t),b=0;!(h=y.next()).done;)d+=e(a=h.value,f+u(a,b++),r,i);else if("object"===c){var m=""+t;s(!1,
|