2022-04-11 14:04:30 +02:00
/******/ ( function ( ) { // webpackBootstrap
/******/ var _ _webpack _modules _ _ = ( {
2021-11-08 15:29:21 +01:00
2022-04-11 14:04:30 +02:00
/***/ 6411 :
/***/ ( function ( module , exports ) {
2021-11-08 15:29:21 +01:00
2022-04-11 14:04:30 +02:00
var _ _WEBPACK _AMD _DEFINE _FACTORY _ _ , _ _WEBPACK _AMD _DEFINE _ARRAY _ _ , _ _WEBPACK _AMD _DEFINE _RESULT _ _ ; / * !
autosize 4.0 . 4
license : MIT
http : //www.jacklmoore.com/autosize
* /
( function ( global , factory ) {
if ( true ) {
! ( _ _WEBPACK _AMD _DEFINE _ARRAY _ _ = [ module , exports ] , _ _WEBPACK _AMD _DEFINE _FACTORY _ _ = ( factory ) ,
_ _WEBPACK _AMD _DEFINE _RESULT _ _ = ( typeof _ _WEBPACK _AMD _DEFINE _FACTORY _ _ === 'function' ?
( _ _WEBPACK _AMD _DEFINE _FACTORY _ _ . apply ( exports , _ _WEBPACK _AMD _DEFINE _ARRAY _ _ ) ) : _ _WEBPACK _AMD _DEFINE _FACTORY _ _ ) ,
_ _WEBPACK _AMD _DEFINE _RESULT _ _ !== undefined && ( module . exports = _ _WEBPACK _AMD _DEFINE _RESULT _ _ ) ) ;
} else { var mod ; }
} ) ( this , function ( module , exports ) {
'use strict' ;
2021-11-08 15:29:21 +01:00
2022-04-11 14:04:30 +02:00
var map = typeof Map === "function" ? new Map ( ) : function ( ) {
var keys = [ ] ;
var values = [ ] ;
2021-11-08 15:29:21 +01:00
2022-04-11 14:04:30 +02:00
return {
has : function has ( key ) {
return keys . indexOf ( key ) > - 1 ;
} ,
get : function get ( key ) {
return values [ keys . indexOf ( key ) ] ;
} ,
set : function set ( key , value ) {
if ( keys . indexOf ( key ) === - 1 ) {
keys . push ( key ) ;
values . push ( value ) ;
}
} ,
delete : function _delete ( key ) {
var index = keys . indexOf ( key ) ;
if ( index > - 1 ) {
keys . splice ( index , 1 ) ;
values . splice ( index , 1 ) ;
}
}
} ;
} ( ) ;
2021-11-08 15:29:21 +01:00
2022-04-11 14:04:30 +02:00
var createEvent = function createEvent ( name ) {
return new Event ( name , { bubbles : true } ) ;
} ;
try {
new Event ( 'test' ) ;
} catch ( e ) {
// IE does not support `new Event()`
createEvent = function createEvent ( name ) {
var evt = document . createEvent ( 'Event' ) ;
evt . initEvent ( name , true , false ) ;
return evt ;
} ;
}
2021-11-08 15:29:21 +01:00
2022-04-11 14:04:30 +02:00
function assign ( ta ) {
if ( ! ta || ! ta . nodeName || ta . nodeName !== 'TEXTAREA' || map . has ( ta ) ) return ;
2020-06-26 15:33:47 +02:00
2022-04-11 14:04:30 +02:00
var heightOffset = null ;
var clientWidth = null ;
var cachedHeight = null ;
2020-06-26 15:33:47 +02:00
2022-04-11 14:04:30 +02:00
function init ( ) {
var style = window . getComputedStyle ( ta , null ) ;
2020-02-10 23:33:27 +01:00
2022-04-11 14:04:30 +02:00
if ( style . resize === 'vertical' ) {
ta . style . resize = 'none' ;
} else if ( style . resize === 'both' ) {
ta . style . resize = 'horizontal' ;
}
2020-02-10 23:33:27 +01:00
2022-04-11 14:04:30 +02:00
if ( style . boxSizing === 'content-box' ) {
heightOffset = - ( parseFloat ( style . paddingTop ) + parseFloat ( style . paddingBottom ) ) ;
} else {
heightOffset = parseFloat ( style . borderTopWidth ) + parseFloat ( style . borderBottomWidth ) ;
}
// Fix when a textarea is not on document body and heightOffset is Not a Number
if ( isNaN ( heightOffset ) ) {
heightOffset = 0 ;
}
2020-02-10 23:33:27 +01:00
2022-04-11 14:04:30 +02:00
update ( ) ;
}
2020-01-08 12:57:23 +01:00
2022-04-11 14:04:30 +02:00
function changeOverflow ( value ) {
{
// Chrome/Safari-specific fix:
// When the textarea y-overflow is hidden, Chrome/Safari do not reflow the text to account for the space
// made available by removing the scrollbar. The following forces the necessary text reflow.
var width = ta . style . width ;
ta . style . width = '0px' ;
// Force reflow:
/* jshint ignore:start */
ta . offsetWidth ;
/* jshint ignore:end */
ta . style . width = width ;
}
2020-01-08 12:57:23 +01:00
2022-04-11 14:04:30 +02:00
ta . style . overflowY = value ;
}
2020-01-08 12:57:23 +01:00
2022-04-11 14:04:30 +02:00
function getParentOverflows ( el ) {
var arr = [ ] ;
2019-10-15 18:17:12 +02:00
2022-04-11 14:04:30 +02:00
while ( el && el . parentNode && el . parentNode instanceof Element ) {
if ( el . parentNode . scrollTop ) {
arr . push ( {
node : el . parentNode ,
scrollTop : el . parentNode . scrollTop
} ) ;
}
el = el . parentNode ;
}
2019-10-15 18:17:12 +02:00
2022-04-11 14:04:30 +02:00
return arr ;
}
2021-04-15 17:19:43 +02:00
2022-04-11 14:04:30 +02:00
function resize ( ) {
if ( ta . scrollHeight === 0 ) {
// If the scrollHeight is 0, then the element probably has display:none or is detached from the DOM.
return ;
}
2021-04-15 17:19:43 +02:00
2022-04-11 14:04:30 +02:00
var overflows = getParentOverflows ( ta ) ;
var docTop = document . documentElement && document . documentElement . scrollTop ; // Needed for Mobile IE (ticket #240)
2021-04-15 17:19:43 +02:00
2022-04-11 14:04:30 +02:00
ta . style . height = '' ;
ta . style . height = ta . scrollHeight + heightOffset + 'px' ;
2020-07-07 16:43:35 +02:00
2022-04-11 14:04:30 +02:00
// used to check if an update is actually necessary on window.resize
clientWidth = ta . clientWidth ;
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
// prevents scroll-position jumping
overflows . forEach ( function ( el ) {
el . node . scrollTop = el . scrollTop ;
} ) ;
2020-10-13 15:10:30 +02:00
2022-04-11 14:04:30 +02:00
if ( docTop ) {
document . documentElement . scrollTop = docTop ;
}
}
2020-10-13 15:10:30 +02:00
2022-04-11 14:04:30 +02:00
function update ( ) {
resize ( ) ;
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
var styleHeight = Math . round ( parseFloat ( ta . style . height ) ) ;
var computed = window . getComputedStyle ( ta , null ) ;
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
// Using offsetHeight as a replacement for computed.height in IE, because IE does not account use of border-box
var actualHeight = computed . boxSizing === 'content-box' ? Math . round ( parseFloat ( computed . height ) ) : ta . offsetHeight ;
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
// The actual height not matching the style height (set via the resize method) indicates that
// the max-height has been exceeded, in which case the overflow should be allowed.
if ( actualHeight < styleHeight ) {
if ( computed . overflowY === 'hidden' ) {
changeOverflow ( 'scroll' ) ;
resize ( ) ;
actualHeight = computed . boxSizing === 'content-box' ? Math . round ( parseFloat ( window . getComputedStyle ( ta , null ) . height ) ) : ta . offsetHeight ;
}
} else {
// Normally keep overflow set to hidden, to avoid flash of scrollbar as the textarea expands.
if ( computed . overflowY !== 'hidden' ) {
changeOverflow ( 'hidden' ) ;
resize ( ) ;
actualHeight = computed . boxSizing === 'content-box' ? Math . round ( parseFloat ( window . getComputedStyle ( ta , null ) . height ) ) : ta . offsetHeight ;
}
}
2021-05-07 13:48:27 +02:00
2022-04-11 14:04:30 +02:00
if ( cachedHeight !== actualHeight ) {
cachedHeight = actualHeight ;
var evt = createEvent ( 'autosize:resized' ) ;
try {
ta . dispatchEvent ( evt ) ;
} catch ( err ) {
// Firefox will throw an error on dispatchEvent for a detached element
// https://bugzilla.mozilla.org/show_bug.cgi?id=889376
}
}
}
2021-05-07 13:48:27 +02:00
2022-04-11 14:04:30 +02:00
var pageResize = function pageResize ( ) {
if ( ta . clientWidth !== clientWidth ) {
update ( ) ;
}
} ;
2018-12-14 05:41:57 +01:00
2021-05-21 12:14:23 +02:00
var destroy = function ( style ) {
window . removeEventListener ( 'resize' , pageResize , false ) ;
ta . removeEventListener ( 'input' , update , false ) ;
ta . removeEventListener ( 'keyup' , update , false ) ;
ta . removeEventListener ( 'autosize:destroy' , destroy , false ) ;
ta . removeEventListener ( 'autosize:update' , update , false ) ;
2019-03-07 10:09:59 +01:00
2021-05-21 12:14:23 +02:00
Object . keys ( style ) . forEach ( function ( key ) {
ta . style [ key ] = style [ key ] ;
} ) ;
2019-03-07 10:09:59 +01:00
2021-05-21 12:14:23 +02:00
map . delete ( ta ) ;
} . bind ( ta , {
height : ta . style . height ,
resize : ta . style . resize ,
overflowY : ta . style . overflowY ,
overflowX : ta . style . overflowX ,
wordWrap : ta . style . wordWrap
} ) ;
2019-03-07 10:09:59 +01:00
2021-05-21 12:14:23 +02:00
ta . addEventListener ( 'autosize:destroy' , destroy , false ) ;
2019-03-07 10:09:59 +01:00
2021-05-21 12:14:23 +02:00
// IE9 does not fire onpropertychange or oninput for deletions,
// so binding to onkeyup to catch most of those events.
// There is no way that I know of to detect something like 'cut' in IE9.
if ( 'onpropertychange' in ta && 'oninput' in ta ) {
ta . addEventListener ( 'keyup' , update , false ) ;
}
2019-03-07 10:09:59 +01:00
2021-05-21 12:14:23 +02:00
window . addEventListener ( 'resize' , pageResize , false ) ;
ta . addEventListener ( 'input' , update , false ) ;
ta . addEventListener ( 'autosize:update' , update , false ) ;
ta . style . overflowX = 'hidden' ;
ta . style . wordWrap = 'break-word' ;
2018-12-18 04:14:52 +01:00
2021-05-21 12:14:23 +02:00
map . set ( ta , {
destroy : destroy ,
update : update
} ) ;
2018-12-14 05:41:57 +01:00
2021-05-21 12:14:23 +02:00
init ( ) ;
}
2018-12-14 05:41:57 +01:00
2021-05-21 12:14:23 +02:00
function destroy ( ta ) {
var methods = map . get ( ta ) ;
if ( methods ) {
methods . destroy ( ) ;
}
}
2021-05-19 17:09:27 +02:00
2021-05-21 12:14:23 +02:00
function update ( ta ) {
var methods = map . get ( ta ) ;
if ( methods ) {
methods . update ( ) ;
}
}
2021-05-19 17:09:27 +02:00
2021-05-21 12:14:23 +02:00
var autosize = null ;
2021-05-19 17:09:27 +02:00
2021-05-21 12:14:23 +02:00
// Do nothing in Node.js environment and IE8 (or lower)
if ( typeof window === 'undefined' || typeof window . getComputedStyle !== 'function' ) {
autosize = function autosize ( el ) {
return el ;
} ;
autosize . destroy = function ( el ) {
return el ;
} ;
autosize . update = function ( el ) {
return el ;
} ;
2022-04-11 14:04:30 +02:00
} else {
autosize = function autosize ( el , options ) {
if ( el ) {
Array . prototype . forEach . call ( el . length ? el : [ el ] , function ( x ) {
return assign ( x , options ) ;
} ) ;
}
return el ;
} ;
autosize . destroy = function ( el ) {
if ( el ) {
Array . prototype . forEach . call ( el . length ? el : [ el ] , destroy ) ;
}
return el ;
} ;
autosize . update = function ( el ) {
if ( el ) {
Array . prototype . forEach . call ( el . length ? el : [ el ] , update ) ;
}
return el ;
} ;
}
2020-10-20 15:36:16 +02:00
2022-04-11 14:04:30 +02:00
exports . default = autosize ;
module . exports = exports [ 'default' ] ;
} ) ;
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
/***/ } ) ,
2021-11-15 13:50:17 +01:00
2022-04-11 14:04:30 +02:00
/***/ 4403 :
/***/ ( function ( module , exports ) {
2020-10-20 15:36:16 +02:00
2022-04-11 14:04:30 +02:00
var _ _WEBPACK _AMD _DEFINE _ARRAY _ _ , _ _WEBPACK _AMD _DEFINE _RESULT _ _ ; / * !
Copyright ( c ) 2018 Jed Watson .
Licensed under the MIT License ( MIT ) , see
http : //jedwatson.github.io/classnames
* /
/* global define */
2021-11-15 13:50:17 +01:00
2022-04-11 14:04:30 +02:00
( function ( ) {
'use strict' ;
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
var hasOwn = { } . hasOwnProperty ;
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
function classNames ( ) {
var classes = [ ] ;
2021-11-15 13:50:17 +01:00
2022-04-11 14:04:30 +02:00
for ( var i = 0 ; i < arguments . length ; i ++ ) {
var arg = arguments [ i ] ;
if ( ! arg ) continue ;
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
var argType = typeof arg ;
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
if ( argType === 'string' || argType === 'number' ) {
classes . push ( arg ) ;
} else if ( Array . isArray ( arg ) ) {
if ( arg . length ) {
var inner = classNames . apply ( null , arg ) ;
if ( inner ) {
classes . push ( inner ) ;
}
}
} else if ( argType === 'object' ) {
if ( arg . toString === Object . prototype . toString ) {
for ( var key in arg ) {
if ( hasOwn . call ( arg , key ) && arg [ key ] ) {
classes . push ( key ) ;
}
}
} else {
classes . push ( arg . toString ( ) ) ;
}
}
}
2021-11-15 13:50:17 +01:00
2022-04-11 14:04:30 +02:00
return classes . join ( ' ' ) ;
}
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
if ( true && module . exports ) {
classNames . default = classNames ;
module . exports = classNames ;
} else if ( true ) {
// register as 'classnames', consistent with npm package name
! ( _ _WEBPACK _AMD _DEFINE _ARRAY _ _ = [ ] , _ _WEBPACK _AMD _DEFINE _RESULT _ _ = ( function ( ) {
return classNames ;
} ) . apply ( exports , _ _WEBPACK _AMD _DEFINE _ARRAY _ _ ) ,
_ _WEBPACK _AMD _DEFINE _RESULT _ _ !== undefined && ( module . exports = _ _WEBPACK _AMD _DEFINE _RESULT _ _ ) ) ;
} else { }
} ( ) ) ;
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
/***/ } ) ,
2021-11-15 13:50:17 +01:00
2022-04-11 14:04:30 +02:00
/***/ 4827 :
/***/ ( function ( module ) {
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
// This code has been refactored for 140 bytes
// You can see the original here: https://github.com/twolfson/computedStyle/blob/04cd1da2e30fa45844f95f5cb1ac898e9b9ef050/lib/computedStyle.js
var computedStyle = function ( el , prop , getComputedStyle ) {
getComputedStyle = window . getComputedStyle ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
// In one fell swoop
return (
// If we have getComputedStyle
getComputedStyle ?
// Query it
// TODO: From CSS-Query notes, we might need (node, null) for FF
getComputedStyle ( el ) :
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
// Otherwise, we are in IE and use currentStyle
el . currentStyle
) [
// Switch to camelCase for CSSOM
// DEV: Grabbed from jQuery
// https://github.com/jquery/jquery/blob/1.9-stable/src/css.js#L191-L194
// https://github.com/jquery/jquery/blob/1.9-stable/src/core.js#L593-L597
prop . replace ( /-(\w)/gi , function ( word , letter ) {
return letter . toUpperCase ( ) ;
} )
] ;
} ;
2021-11-15 13:50:17 +01:00
2022-04-11 14:04:30 +02:00
module . exports = computedStyle ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
/***/ } ) ,
2021-11-15 13:50:17 +01:00
2022-04-11 14:04:30 +02:00
/***/ 9894 :
/***/ ( function ( module , _ _unused _webpack _exports , _ _webpack _require _ _ ) {
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
// Load in dependencies
var computedStyle = _ _webpack _require _ _ ( 4827 ) ;
2018-12-19 04:16:48 +01:00
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Calculate the ` line-height ` of a given node
* @ param { HTMLElement } node Element to calculate line height of . Must be in the DOM .
* @ returns { Number } ` line-height ` of the element in pixels
2021-05-21 12:14:23 +02:00
* /
2022-04-11 14:04:30 +02:00
function lineHeight ( node ) {
// Grab the line-height via style
var lnHeightStr = computedStyle ( node , 'line-height' ) ;
var lnHeight = parseFloat ( lnHeightStr , 10 ) ;
2019-03-07 10:09:59 +01:00
2022-04-11 14:04:30 +02:00
// If the lineHeight did not contain a unit (i.e. it was numeric), convert it to ems (e.g. '2.3' === '2.3em')
if ( lnHeightStr === lnHeight + '' ) {
// Save the old lineHeight style and update the em unit to the element
var _lnHeightStyle = node . style . lineHeight ;
node . style . lineHeight = lnHeightStr + 'em' ;
2021-11-15 13:50:17 +01:00
2022-04-11 14:04:30 +02:00
// Calculate the em based height
lnHeightStr = computedStyle ( node , 'line-height' ) ;
lnHeight = parseFloat ( lnHeightStr , 10 ) ;
2019-03-07 10:09:59 +01:00
2022-04-11 14:04:30 +02:00
// Revert the lineHeight style
if ( _lnHeightStyle ) {
node . style . lineHeight = _lnHeightStyle ;
} else {
delete node . style . lineHeight ;
}
2021-05-21 12:14:23 +02:00
}
2019-03-07 10:09:59 +01:00
2022-04-11 14:04:30 +02:00
// If the lineHeight is in `pt`, convert it to pixels (4px for 3pt)
// DEV: `em` units are converted to `pt` in IE6
// Conversion ratio from https://developer.mozilla.org/en-US/docs/Web/CSS/length
if ( lnHeightStr . indexOf ( 'pt' ) !== - 1 ) {
lnHeight *= 4 ;
lnHeight /= 3 ;
// Otherwise, if the lineHeight is in `mm`, convert it to pixels (96px for 25.4mm)
} else if ( lnHeightStr . indexOf ( 'mm' ) !== - 1 ) {
lnHeight *= 96 ;
lnHeight /= 25.4 ;
// Otherwise, if the lineHeight is in `cm`, convert it to pixels (96px for 2.54cm)
} else if ( lnHeightStr . indexOf ( 'cm' ) !== - 1 ) {
lnHeight *= 96 ;
lnHeight /= 2.54 ;
// Otherwise, if the lineHeight is in `in`, convert it to pixels (96px for 1in)
} else if ( lnHeightStr . indexOf ( 'in' ) !== - 1 ) {
lnHeight *= 96 ;
// Otherwise, if the lineHeight is in `pc`, convert it to pixels (12pt for 1pc)
} else if ( lnHeightStr . indexOf ( 'pc' ) !== - 1 ) {
lnHeight *= 16 ;
}
2019-03-07 10:09:59 +01:00
2022-04-11 14:04:30 +02:00
// Continue our computation
lnHeight = Math . round ( lnHeight ) ;
2021-11-15 13:50:17 +01:00
2022-04-11 14:04:30 +02:00
// If the line-height is "normal", calculate by font-size
if ( lnHeightStr === 'normal' ) {
// Create a temporary node
var nodeName = node . nodeName ;
var _node = document . createElement ( nodeName ) ;
_node . innerHTML = ' ' ;
2019-03-07 10:09:59 +01:00
2022-04-11 14:04:30 +02:00
// If we have a text area, reset it to only 1 row
// https://github.com/twolfson/line-height/issues/4
if ( nodeName . toUpperCase ( ) === 'TEXTAREA' ) {
_node . setAttribute ( 'rows' , '1' ) ;
}
2019-03-07 10:09:59 +01:00
2022-04-11 14:04:30 +02:00
// Set the font-size of the element
var fontSizeStr = computedStyle ( node , 'font-size' ) ;
_node . style . fontSize = fontSizeStr ;
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
// Remove default padding/border which can affect offset height
// https://github.com/twolfson/line-height/issues/4
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetHeight
_node . style . padding = '0px' ;
_node . style . border = '0px' ;
2021-11-15 13:50:17 +01:00
2022-04-11 14:04:30 +02:00
// Append it to the body
var body = document . body ;
body . appendChild ( _node ) ;
// Assume the line height of the element is the height
var height = _node . offsetHeight ;
lnHeight = height ;
// Remove our child from the DOM
body . removeChild ( _node ) ;
2021-05-21 12:14:23 +02:00
}
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
// Return the calculated height
return lnHeight ;
2019-09-19 17:19:18 +02:00
}
2019-03-07 10:09:59 +01:00
2022-04-11 14:04:30 +02:00
// Export lineHeight
module . exports = lineHeight ;
2019-03-07 10:09:59 +01:00
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
/***/ } ) ,
2019-03-21 13:48:00 +01:00
2022-04-11 14:04:30 +02:00
/***/ 5372 :
/***/ ( function ( module , _ _unused _webpack _exports , _ _webpack _require _ _ ) {
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
"use strict" ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Copyright ( c ) 2013 - present , Facebook , Inc .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree .
2021-05-21 12:14:23 +02:00
* /
2018-12-18 04:14:52 +01:00
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
var ReactPropTypesSecret = _ _webpack _require _ _ ( 9567 ) ;
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
function emptyFunction ( ) { }
function emptyFunctionWithReset ( ) { }
emptyFunctionWithReset . resetWarningCache = emptyFunction ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
module . exports = function ( ) {
function shim ( props , propName , componentName , location , propFullName , secret ) {
if ( secret === ReactPropTypesSecret ) {
// It is still safe when called from React.
return ;
}
var err = new Error (
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
'Use PropTypes.checkPropTypes() to call them. ' +
'Read more at http://fb.me/use-check-prop-types'
) ;
err . name = 'Invariant Violation' ;
throw err ;
} ;
shim . isRequired = shim ;
function getShim ( ) {
return shim ;
} ;
// Important!
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
var ReactPropTypes = {
array : shim ,
bigint : shim ,
bool : shim ,
func : shim ,
number : shim ,
object : shim ,
string : shim ,
symbol : shim ,
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
any : shim ,
arrayOf : getShim ,
element : shim ,
elementType : shim ,
instanceOf : getShim ,
node : shim ,
objectOf : getShim ,
oneOf : getShim ,
oneOfType : getShim ,
shape : getShim ,
exact : getShim ,
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
checkPropTypes : emptyFunctionWithReset ,
resetWarningCache : emptyFunction
} ;
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
ReactPropTypes . PropTypes = ReactPropTypes ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
return ReactPropTypes ;
} ;
2018-12-14 05:41:57 +01:00
2020-10-20 15:36:16 +02:00
2022-04-11 14:04:30 +02:00
/***/ } ) ,
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
/***/ 2652 :
/***/ ( function ( module , _ _unused _webpack _exports , _ _webpack _require _ _ ) {
2018-12-14 05:41:57 +01:00
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Copyright ( c ) 2013 - present , Facebook , Inc .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree .
2021-05-21 12:14:23 +02:00
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
if ( false ) { var throwOnDirectAccess , ReactIs ; } else {
// By explicitly using `prop-types` you are opting into new production behavior.
// http://fb.me/prop-types-in-prod
module . exports = _ _webpack _require _ _ ( 5372 ) ( ) ;
}
/***/ } ) ,
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
/***/ 9567 :
/***/ ( function ( module ) {
2021-05-07 13:48:27 +02:00
2022-04-11 14:04:30 +02:00
"use strict" ;
2019-03-21 13:48:00 +01:00
/ * *
2022-04-11 14:04:30 +02:00
* Copyright ( c ) 2013 - present , Facebook , Inc .
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree .
2019-09-19 17:19:18 +02:00
* /
2021-01-28 03:04:13 +01:00
2022-04-11 14:04:30 +02:00
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED' ;
module . exports = ReactPropTypesSecret ;
/***/ } ) ,
/***/ 5438 :
/***/ ( function ( _ _unused _webpack _module , exports , _ _webpack _require _ _ ) {
"use strict" ;
var _ _extends = ( this && this . _ _extends ) || ( function ( ) {
var extendStatics = Object . setPrototypeOf ||
( { _ _proto _ _ : [ ] } instanceof Array && function ( d , b ) { d . _ _proto _ _ = b ; } ) ||
function ( d , b ) { for ( var p in b ) if ( b . hasOwnProperty ( p ) ) d [ p ] = b [ p ] ; } ;
return function ( d , b ) {
extendStatics ( d , b ) ;
function _ _ ( ) { this . constructor = d ; }
d . prototype = b === null ? Object . create ( b ) : ( _ _ . prototype = b . prototype , new _ _ ( ) ) ;
} ;
} ) ( ) ;
var _ _assign = ( this && this . _ _assign ) || Object . assign || function ( t ) {
for ( var s , i = 1 , n = arguments . length ; i < n ; i ++ ) {
s = arguments [ i ] ;
for ( var p in s ) if ( Object . prototype . hasOwnProperty . call ( s , p ) )
t [ p ] = s [ p ] ;
}
return t ;
} ;
var _ _rest = ( this && this . _ _rest ) || function ( s , e ) {
var t = { } ;
for ( var p in s ) if ( Object . prototype . hasOwnProperty . call ( s , p ) && e . indexOf ( p ) < 0 )
t [ p ] = s [ p ] ;
if ( s != null && typeof Object . getOwnPropertySymbols === "function" )
for ( var i = 0 , p = Object . getOwnPropertySymbols ( s ) ; i < p . length ; i ++ ) if ( e . indexOf ( p [ i ] ) < 0 )
t [ p [ i ] ] = s [ p [ i ] ] ;
return t ;
} ;
exports . _ _esModule = true ;
var React = _ _webpack _require _ _ ( 9196 ) ;
var PropTypes = _ _webpack _require _ _ ( 2652 ) ;
var autosize = _ _webpack _require _ _ ( 6411 ) ;
var _getLineHeight = _ _webpack _require _ _ ( 9894 ) ;
var getLineHeight = _getLineHeight ;
var RESIZED = "autosize:resized" ;
2019-09-19 17:19:18 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* A light replacement for built - in textarea component
* which automaticaly adjusts its height to match the content
2019-03-21 13:48:00 +01:00
* /
2022-04-11 14:04:30 +02:00
var TextareaAutosizeClass = /** @class */ ( function ( _super ) {
_ _extends ( TextareaAutosizeClass , _super ) ;
function TextareaAutosizeClass ( ) {
var _this = _super !== null && _super . apply ( this , arguments ) || this ;
_this . state = {
lineHeight : null
} ;
_this . textarea = null ;
_this . onResize = function ( e ) {
if ( _this . props . onResize ) {
_this . props . onResize ( e ) ;
}
} ;
_this . updateLineHeight = function ( ) {
if ( _this . textarea ) {
_this . setState ( {
lineHeight : getLineHeight ( _this . textarea )
} ) ;
}
} ;
_this . onChange = function ( e ) {
var onChange = _this . props . onChange ;
_this . currentValue = e . currentTarget . value ;
onChange && onChange ( e ) ;
} ;
return _this ;
}
TextareaAutosizeClass . prototype . componentDidMount = function ( ) {
var _this = this ;
var _a = this . props , maxRows = _a . maxRows , async = _a . async ;
if ( typeof maxRows === "number" ) {
this . updateLineHeight ( ) ;
}
if ( typeof maxRows === "number" || async ) {
/ *
the defer is needed to :
- force "autosize" to activate the scrollbar when this . props . maxRows is passed
- support StyledComponents ( see # 71 )
* /
setTimeout ( function ( ) { return _this . textarea && autosize ( _this . textarea ) ; } ) ;
}
else {
this . textarea && autosize ( this . textarea ) ;
}
if ( this . textarea ) {
this . textarea . addEventListener ( RESIZED , this . onResize ) ;
}
} ;
TextareaAutosizeClass . prototype . componentWillUnmount = function ( ) {
if ( this . textarea ) {
this . textarea . removeEventListener ( RESIZED , this . onResize ) ;
autosize . destroy ( this . textarea ) ;
}
} ;
TextareaAutosizeClass . prototype . render = function ( ) {
var _this = this ;
var _a = this , _b = _a . props , onResize = _b . onResize , maxRows = _b . maxRows , onChange = _b . onChange , style = _b . style , innerRef = _b . innerRef , children = _b . children , props = _ _rest ( _b , [ "onResize" , "maxRows" , "onChange" , "style" , "innerRef" , "children" ] ) , lineHeight = _a . state . lineHeight ;
var maxHeight = maxRows && lineHeight ? lineHeight * maxRows : null ;
return ( React . createElement ( "textarea" , _ _assign ( { } , props , { onChange : this . onChange , style : maxHeight ? _ _assign ( { } , style , { maxHeight : maxHeight } ) : style , ref : function ( element ) {
_this . textarea = element ;
if ( typeof _this . props . innerRef === 'function' ) {
_this . props . innerRef ( element ) ;
}
else if ( _this . props . innerRef ) {
_this . props . innerRef . current = element ;
}
} } ) , children ) ) ;
} ;
TextareaAutosizeClass . prototype . componentDidUpdate = function ( ) {
this . textarea && autosize . update ( this . textarea ) ;
} ;
TextareaAutosizeClass . defaultProps = {
rows : 1 ,
async : false
} ;
TextareaAutosizeClass . propTypes = {
rows : PropTypes . number ,
maxRows : PropTypes . number ,
onResize : PropTypes . func ,
innerRef : PropTypes . any ,
async : PropTypes . bool
} ;
return TextareaAutosizeClass ;
} ( React . Component ) ) ;
exports . TextareaAutosize = React . forwardRef ( function ( props , ref ) {
return React . createElement ( TextareaAutosizeClass , _ _assign ( { } , props , { innerRef : ref } ) ) ;
} ) ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
/***/ } ) ,
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
/***/ 773 :
/***/ ( function ( _ _unused _webpack _module , exports , _ _webpack _require _ _ ) {
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
"use strict" ;
var _ _webpack _unused _export _ _ ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
_ _webpack _unused _export _ _ = true ;
var TextareaAutosize _1 = _ _webpack _require _ _ ( 5438 ) ;
exports . Z = TextareaAutosize _1 . TextareaAutosize ;
Block Editor: Update `@wordpress` dependencies to match Gutenberg 4.5.1.
- Update the annotations, api-fetch, block-library, blocks, components, compose, core-data, data, date, dom, edit-post, editor, element, format-library, html-entities, i18n, jest-console, jest-preset-default, keycodes, list-reusable-blocks, notices, nux, plugins, rich-text, scripts, token-lists, url, viewport packages.
- Upgrades React from 16.5.2 to 16.6.3.
- Adds a missing `wp-date` dependency to the editor script.
- Updates changed dependencies in `script-loader.php`.
- Fixes undefined notices in some blocks.
- Removes incorrect `gutenberg` textdomain.
Merges [43891], [43903], and [43919] to trunk.
Props atimmer, aduth, youknowriad, danielbachhuber.
See #45145.
Built from https://develop.svn.wordpress.org/trunk@44262
git-svn-id: http://core.svn.wordpress.org/trunk@44092 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-17 16:37:00 +01:00
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
/***/ } ) ,
2020-01-08 12:57:23 +01:00
2022-04-11 14:04:30 +02:00
/***/ 9196 :
/***/ ( function ( module ) {
2021-11-08 15:29:21 +01:00
2022-04-11 14:04:30 +02:00
"use strict" ;
module . exports = window [ "React" ] ;
2021-11-08 15:29:21 +01:00
2022-04-11 14:04:30 +02:00
/***/ } )
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
/******/ } ) ;
/************************************************************************/
/******/ // The module cache
/******/ var _ _webpack _module _cache _ _ = { } ;
/******/
/******/ // The require function
/******/ function _ _webpack _require _ _ ( moduleId ) {
/******/ // Check if module is in cache
/******/ var cachedModule = _ _webpack _module _cache _ _ [ moduleId ] ;
/******/ if ( cachedModule !== undefined ) {
/******/ return cachedModule . exports ;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = _ _webpack _module _cache _ _ [ moduleId ] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports : { }
/******/ } ;
/******/
/******/ // Execute the module function
/******/ _ _webpack _modules _ _ [ moduleId ] . call ( module . exports , module , module . exports , _ _webpack _require _ _ ) ;
/******/
/******/ // Return the exports of the module
/******/ return module . exports ;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ ! function ( ) {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ _ _webpack _require _ _ . n = function ( module ) {
/******/ var getter = module && module . _ _esModule ?
/******/ function ( ) { return module [ 'default' ] ; } :
/******/ function ( ) { return module ; } ;
/******/ _ _webpack _require _ _ . d ( getter , { a : getter } ) ;
/******/ return getter ;
/******/ } ;
/******/ } ( ) ;
/******/
/******/ /* webpack/runtime/define property getters */
/******/ ! function ( ) {
/******/ // define getter functions for harmony exports
/******/ _ _webpack _require _ _ . d = function ( exports , definition ) {
/******/ for ( var key in definition ) {
/******/ if ( _ _webpack _require _ _ . o ( definition , key ) && ! _ _webpack _require _ _ . o ( exports , key ) ) {
/******/ Object . defineProperty ( exports , key , { enumerable : true , get : definition [ key ] } ) ;
/******/ }
/******/ }
/******/ } ;
/******/ } ( ) ;
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ ! function ( ) {
/******/ _ _webpack _require _ _ . o = function ( obj , prop ) { return Object . prototype . hasOwnProperty . call ( obj , prop ) ; }
/******/ } ( ) ;
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ ! function ( ) {
/******/ // define __esModule on exports
/******/ _ _webpack _require _ _ . r = function ( exports ) {
/******/ if ( typeof Symbol !== 'undefined' && Symbol . toStringTag ) {
/******/ Object . defineProperty ( exports , Symbol . toStringTag , { value : 'Module' } ) ;
/******/ }
/******/ Object . defineProperty ( exports , '__esModule' , { value : true } ) ;
/******/ } ;
/******/ } ( ) ;
/******/
/************************************************************************/
var _ _webpack _exports _ _ = { } ;
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
! function ( ) {
"use strict" ;
// ESM COMPAT FLAG
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
// EXPORTS
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , {
"AlignmentToolbar" : function ( ) { return /* reexport */ AlignmentToolbar ; } ,
"Autocomplete" : function ( ) { return /* reexport */ Autocomplete ; } ,
"AutosaveMonitor" : function ( ) { return /* reexport */ autosave _monitor ; } ,
"BlockAlignmentToolbar" : function ( ) { return /* reexport */ BlockAlignmentToolbar ; } ,
"BlockControls" : function ( ) { return /* reexport */ BlockControls ; } ,
"BlockEdit" : function ( ) { return /* reexport */ BlockEdit ; } ,
"BlockEditorKeyboardShortcuts" : function ( ) { return /* reexport */ BlockEditorKeyboardShortcuts ; } ,
"BlockFormatControls" : function ( ) { return /* reexport */ BlockFormatControls ; } ,
"BlockIcon" : function ( ) { return /* reexport */ BlockIcon ; } ,
"BlockInspector" : function ( ) { return /* reexport */ BlockInspector ; } ,
"BlockList" : function ( ) { return /* reexport */ BlockList ; } ,
"BlockMover" : function ( ) { return /* reexport */ BlockMover ; } ,
"BlockNavigationDropdown" : function ( ) { return /* reexport */ BlockNavigationDropdown ; } ,
"BlockSelectionClearer" : function ( ) { return /* reexport */ BlockSelectionClearer ; } ,
"BlockSettingsMenu" : function ( ) { return /* reexport */ BlockSettingsMenu ; } ,
"BlockTitle" : function ( ) { return /* reexport */ BlockTitle ; } ,
"BlockToolbar" : function ( ) { return /* reexport */ BlockToolbar ; } ,
"ColorPalette" : function ( ) { return /* reexport */ ColorPalette ; } ,
"ContrastChecker" : function ( ) { return /* reexport */ ContrastChecker ; } ,
"CopyHandler" : function ( ) { return /* reexport */ CopyHandler ; } ,
"DefaultBlockAppender" : function ( ) { return /* reexport */ DefaultBlockAppender ; } ,
"DocumentOutline" : function ( ) { return /* reexport */ document _outline ; } ,
"DocumentOutlineCheck" : function ( ) { return /* reexport */ check ; } ,
"EditorHistoryRedo" : function ( ) { return /* reexport */ editor _history _redo ; } ,
"EditorHistoryUndo" : function ( ) { return /* reexport */ editor _history _undo ; } ,
"EditorKeyboardShortcutsRegister" : function ( ) { return /* reexport */ register _shortcuts ; } ,
"EditorNotices" : function ( ) { return /* reexport */ editor _notices ; } ,
"EditorProvider" : function ( ) { return /* reexport */ provider ; } ,
"EditorSnackbars" : function ( ) { return /* reexport */ EditorSnackbars ; } ,
"EntitiesSavedStates" : function ( ) { return /* reexport */ EntitiesSavedStates ; } ,
"ErrorBoundary" : function ( ) { return /* reexport */ error _boundary ; } ,
"FontSizePicker" : function ( ) { return /* reexport */ FontSizePicker ; } ,
"InnerBlocks" : function ( ) { return /* reexport */ InnerBlocks ; } ,
"Inserter" : function ( ) { return /* reexport */ Inserter ; } ,
"InspectorAdvancedControls" : function ( ) { return /* reexport */ InspectorAdvancedControls ; } ,
"InspectorControls" : function ( ) { return /* reexport */ InspectorControls ; } ,
"LocalAutosaveMonitor" : function ( ) { return /* reexport */ local _autosave _monitor ; } ,
"MediaPlaceholder" : function ( ) { return /* reexport */ MediaPlaceholder ; } ,
"MediaUpload" : function ( ) { return /* reexport */ MediaUpload ; } ,
"MediaUploadCheck" : function ( ) { return /* reexport */ MediaUploadCheck ; } ,
"MultiSelectScrollIntoView" : function ( ) { return /* reexport */ MultiSelectScrollIntoView ; } ,
"NavigableToolbar" : function ( ) { return /* reexport */ NavigableToolbar ; } ,
"ObserveTyping" : function ( ) { return /* reexport */ ObserveTyping ; } ,
"PageAttributesCheck" : function ( ) { return /* reexport */ page _attributes _check ; } ,
"PageAttributesOrder" : function ( ) { return /* reexport */ order ; } ,
"PageAttributesParent" : function ( ) { return /* reexport */ page _attributes _parent ; } ,
"PageTemplate" : function ( ) { return /* reexport */ post _template ; } ,
"PanelColorSettings" : function ( ) { return /* reexport */ PanelColorSettings ; } ,
"PlainText" : function ( ) { return /* reexport */ PlainText ; } ,
"PostAuthor" : function ( ) { return /* reexport */ post _author ; } ,
"PostAuthorCheck" : function ( ) { return /* reexport */ PostAuthorCheck ; } ,
"PostComments" : function ( ) { return /* reexport */ post _comments ; } ,
"PostExcerpt" : function ( ) { return /* reexport */ post _excerpt ; } ,
"PostExcerptCheck" : function ( ) { return /* reexport */ post _excerpt _check ; } ,
"PostFeaturedImage" : function ( ) { return /* reexport */ post _featured _image ; } ,
"PostFeaturedImageCheck" : function ( ) { return /* reexport */ post _featured _image _check ; } ,
"PostFormat" : function ( ) { return /* reexport */ PostFormat ; } ,
"PostFormatCheck" : function ( ) { return /* reexport */ post _format _check ; } ,
"PostLastRevision" : function ( ) { return /* reexport */ post _last _revision ; } ,
"PostLastRevisionCheck" : function ( ) { return /* reexport */ post _last _revision _check ; } ,
"PostLockedModal" : function ( ) { return /* reexport */ PostLockedModal ; } ,
"PostPendingStatus" : function ( ) { return /* reexport */ post _pending _status ; } ,
"PostPendingStatusCheck" : function ( ) { return /* reexport */ post _pending _status _check ; } ,
"PostPingbacks" : function ( ) { return /* reexport */ post _pingbacks ; } ,
"PostPreviewButton" : function ( ) { return /* reexport */ post _preview _button ; } ,
"PostPublishButton" : function ( ) { return /* reexport */ post _publish _button ; } ,
"PostPublishButtonLabel" : function ( ) { return /* reexport */ label ; } ,
"PostPublishPanel" : function ( ) { return /* reexport */ post _publish _panel ; } ,
"PostSavedState" : function ( ) { return /* reexport */ PostSavedState ; } ,
"PostSchedule" : function ( ) { return /* reexport */ PostSchedule ; } ,
"PostScheduleCheck" : function ( ) { return /* reexport */ post _schedule _check ; } ,
"PostScheduleLabel" : function ( ) { return /* reexport */ post _schedule _label ; } ,
"PostSlug" : function ( ) { return /* reexport */ post _slug ; } ,
"PostSlugCheck" : function ( ) { return /* reexport */ PostSlugCheck ; } ,
"PostSticky" : function ( ) { return /* reexport */ post _sticky ; } ,
"PostStickyCheck" : function ( ) { return /* reexport */ post _sticky _check ; } ,
"PostSwitchToDraftButton" : function ( ) { return /* reexport */ post _switch _to _draft _button ; } ,
"PostTaxonomies" : function ( ) { return /* reexport */ post _taxonomies ; } ,
"PostTaxonomiesCheck" : function ( ) { return /* reexport */ post _taxonomies _check ; } ,
2022-04-12 17:12:47 +02:00
"PostTaxonomiesFlatTermSelector" : function ( ) { return /* reexport */ flat _term _selector ; } ,
"PostTaxonomiesHierarchicalTermSelector" : function ( ) { return /* reexport */ hierarchical _term _selector ; } ,
2022-04-11 14:04:30 +02:00
"PostTextEditor" : function ( ) { return /* reexport */ PostTextEditor ; } ,
"PostTitle" : function ( ) { return /* reexport */ PostTitle ; } ,
2022-04-12 17:12:47 +02:00
"PostTrash" : function ( ) { return /* reexport */ PostTrash ; } ,
2022-04-11 14:04:30 +02:00
"PostTrashCheck" : function ( ) { return /* reexport */ post _trash _check ; } ,
"PostTypeSupportCheck" : function ( ) { return /* reexport */ post _type _support _check ; } ,
"PostVisibility" : function ( ) { return /* reexport */ post _visibility ; } ,
"PostVisibilityCheck" : function ( ) { return /* reexport */ post _visibility _check ; } ,
"PostVisibilityLabel" : function ( ) { return /* reexport */ post _visibility _label ; } ,
"RichText" : function ( ) { return /* reexport */ RichText ; } ,
"RichTextShortcut" : function ( ) { return /* reexport */ RichTextShortcut ; } ,
"RichTextToolbarButton" : function ( ) { return /* reexport */ RichTextToolbarButton ; } ,
"ServerSideRender" : function ( ) { return /* reexport */ ( external _wp _serverSideRender _default ( ) ) ; } ,
"SkipToSelectedBlock" : function ( ) { return /* reexport */ SkipToSelectedBlock ; } ,
"TableOfContents" : function ( ) { return /* reexport */ table _of _contents ; } ,
"TextEditorGlobalKeyboardShortcuts" : function ( ) { return /* reexport */ TextEditorGlobalKeyboardShortcuts ; } ,
"ThemeSupportCheck" : function ( ) { return /* reexport */ theme _support _check ; } ,
"URLInput" : function ( ) { return /* reexport */ URLInput ; } ,
"URLInputButton" : function ( ) { return /* reexport */ URLInputButton ; } ,
"URLPopover" : function ( ) { return /* reexport */ URLPopover ; } ,
"UnsavedChangesWarning" : function ( ) { return /* reexport */ UnsavedChangesWarning ; } ,
"VisualEditorGlobalKeyboardShortcuts" : function ( ) { return /* reexport */ visual _editor _shortcuts ; } ,
"Warning" : function ( ) { return /* reexport */ Warning ; } ,
"WordCount" : function ( ) { return /* reexport */ WordCount ; } ,
"WritingFlow" : function ( ) { return /* reexport */ WritingFlow ; } ,
"__unstableRichTextInputEvent" : function ( ) { return /* reexport */ _ _unstableRichTextInputEvent ; } ,
"cleanForSlug" : function ( ) { return /* reexport */ cleanForSlug ; } ,
"createCustomColorsHOC" : function ( ) { return /* reexport */ createCustomColorsHOC ; } ,
"getColorClassName" : function ( ) { return /* reexport */ getColorClassName ; } ,
"getColorObjectByAttributeValues" : function ( ) { return /* reexport */ getColorObjectByAttributeValues ; } ,
"getColorObjectByColorValue" : function ( ) { return /* reexport */ getColorObjectByColorValue ; } ,
"getFontSize" : function ( ) { return /* reexport */ getFontSize ; } ,
"getFontSizeClass" : function ( ) { return /* reexport */ getFontSizeClass ; } ,
"getTemplatePartIcon" : function ( ) { return /* reexport */ getTemplatePartIcon ; } ,
"mediaUpload" : function ( ) { return /* reexport */ mediaUpload ; } ,
2022-04-12 17:12:47 +02:00
"store" : function ( ) { return /* reexport */ store _store ; } ,
2022-04-11 14:04:30 +02:00
"storeConfig" : function ( ) { return /* reexport */ storeConfig ; } ,
"transformStyles" : function ( ) { return /* reexport */ external _wp _blockEditor _namespaceObject . transformStyles ; } ,
"userAutocompleter" : function ( ) { return /* reexport */ user ; } ,
"withColorContext" : function ( ) { return /* reexport */ withColorContext ; } ,
"withColors" : function ( ) { return /* reexport */ withColors ; } ,
"withFontSizes" : function ( ) { return /* reexport */ withFontSizes ; }
} ) ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
// NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/selectors.js
var selectors _namespaceObject = { } ;
_ _webpack _require _ _ . r ( selectors _namespaceObject ) ;
_ _webpack _require _ _ . d ( selectors _namespaceObject , {
"__experimentalGetDefaultTemplatePartAreas" : function ( ) { return _ _experimentalGetDefaultTemplatePartAreas ; } ,
"__experimentalGetDefaultTemplateType" : function ( ) { return _ _experimentalGetDefaultTemplateType ; } ,
"__experimentalGetDefaultTemplateTypes" : function ( ) { return _ _experimentalGetDefaultTemplateTypes ; } ,
"__experimentalGetTemplateInfo" : function ( ) { return _ _experimentalGetTemplateInfo ; } ,
"__unstableIsEditorReady" : function ( ) { return _ _unstableIsEditorReady ; } ,
"canInsertBlockType" : function ( ) { return canInsertBlockType ; } ,
"canUserUseUnfilteredHTML" : function ( ) { return canUserUseUnfilteredHTML ; } ,
"didPostSaveRequestFail" : function ( ) { return didPostSaveRequestFail ; } ,
"didPostSaveRequestSucceed" : function ( ) { return didPostSaveRequestSucceed ; } ,
"getActivePostLock" : function ( ) { return getActivePostLock ; } ,
"getAdjacentBlockClientId" : function ( ) { return getAdjacentBlockClientId ; } ,
"getAutosaveAttribute" : function ( ) { return getAutosaveAttribute ; } ,
"getBlock" : function ( ) { return getBlock ; } ,
"getBlockAttributes" : function ( ) { return getBlockAttributes ; } ,
"getBlockCount" : function ( ) { return getBlockCount ; } ,
"getBlockHierarchyRootClientId" : function ( ) { return getBlockHierarchyRootClientId ; } ,
"getBlockIndex" : function ( ) { return getBlockIndex ; } ,
"getBlockInsertionPoint" : function ( ) { return getBlockInsertionPoint ; } ,
"getBlockListSettings" : function ( ) { return getBlockListSettings ; } ,
"getBlockMode" : function ( ) { return getBlockMode ; } ,
"getBlockName" : function ( ) { return getBlockName ; } ,
"getBlockOrder" : function ( ) { return getBlockOrder ; } ,
"getBlockRootClientId" : function ( ) { return getBlockRootClientId ; } ,
"getBlockSelectionEnd" : function ( ) { return getBlockSelectionEnd ; } ,
"getBlockSelectionStart" : function ( ) { return getBlockSelectionStart ; } ,
"getBlocks" : function ( ) { return getBlocks ; } ,
"getBlocksByClientId" : function ( ) { return getBlocksByClientId ; } ,
"getClientIdsOfDescendants" : function ( ) { return getClientIdsOfDescendants ; } ,
"getClientIdsWithDescendants" : function ( ) { return getClientIdsWithDescendants ; } ,
"getCurrentPost" : function ( ) { return getCurrentPost ; } ,
"getCurrentPostAttribute" : function ( ) { return getCurrentPostAttribute ; } ,
"getCurrentPostId" : function ( ) { return getCurrentPostId ; } ,
"getCurrentPostLastRevisionId" : function ( ) { return getCurrentPostLastRevisionId ; } ,
"getCurrentPostRevisionsCount" : function ( ) { return getCurrentPostRevisionsCount ; } ,
"getCurrentPostType" : function ( ) { return getCurrentPostType ; } ,
"getEditedPostAttribute" : function ( ) { return getEditedPostAttribute ; } ,
"getEditedPostContent" : function ( ) { return getEditedPostContent ; } ,
"getEditedPostPreviewLink" : function ( ) { return getEditedPostPreviewLink ; } ,
"getEditedPostSlug" : function ( ) { return getEditedPostSlug ; } ,
"getEditedPostVisibility" : function ( ) { return getEditedPostVisibility ; } ,
"getEditorBlocks" : function ( ) { return getEditorBlocks ; } ,
"getEditorSelection" : function ( ) { return getEditorSelection ; } ,
"getEditorSelectionEnd" : function ( ) { return getEditorSelectionEnd ; } ,
"getEditorSelectionStart" : function ( ) { return getEditorSelectionStart ; } ,
"getEditorSettings" : function ( ) { return getEditorSettings ; } ,
"getFirstMultiSelectedBlockClientId" : function ( ) { return getFirstMultiSelectedBlockClientId ; } ,
"getGlobalBlockCount" : function ( ) { return getGlobalBlockCount ; } ,
"getInserterItems" : function ( ) { return getInserterItems ; } ,
"getLastMultiSelectedBlockClientId" : function ( ) { return getLastMultiSelectedBlockClientId ; } ,
"getMultiSelectedBlockClientIds" : function ( ) { return getMultiSelectedBlockClientIds ; } ,
"getMultiSelectedBlocks" : function ( ) { return getMultiSelectedBlocks ; } ,
"getMultiSelectedBlocksEndClientId" : function ( ) { return getMultiSelectedBlocksEndClientId ; } ,
"getMultiSelectedBlocksStartClientId" : function ( ) { return getMultiSelectedBlocksStartClientId ; } ,
"getNextBlockClientId" : function ( ) { return getNextBlockClientId ; } ,
"getPermalink" : function ( ) { return getPermalink ; } ,
"getPermalinkParts" : function ( ) { return getPermalinkParts ; } ,
"getPostEdits" : function ( ) { return getPostEdits ; } ,
"getPostLockUser" : function ( ) { return getPostLockUser ; } ,
"getPostTypeLabel" : function ( ) { return getPostTypeLabel ; } ,
"getPreviousBlockClientId" : function ( ) { return getPreviousBlockClientId ; } ,
"getSelectedBlock" : function ( ) { return getSelectedBlock ; } ,
"getSelectedBlockClientId" : function ( ) { return getSelectedBlockClientId ; } ,
"getSelectedBlockCount" : function ( ) { return getSelectedBlockCount ; } ,
"getSelectedBlocksInitialCaretPosition" : function ( ) { return getSelectedBlocksInitialCaretPosition ; } ,
"getStateBeforeOptimisticTransaction" : function ( ) { return getStateBeforeOptimisticTransaction ; } ,
"getSuggestedPostFormat" : function ( ) { return getSuggestedPostFormat ; } ,
"getTemplate" : function ( ) { return getTemplate ; } ,
"getTemplateLock" : function ( ) { return getTemplateLock ; } ,
"hasChangedContent" : function ( ) { return hasChangedContent ; } ,
"hasEditorRedo" : function ( ) { return hasEditorRedo ; } ,
"hasEditorUndo" : function ( ) { return hasEditorUndo ; } ,
"hasInserterItems" : function ( ) { return hasInserterItems ; } ,
"hasMultiSelection" : function ( ) { return hasMultiSelection ; } ,
"hasNonPostEntityChanges" : function ( ) { return hasNonPostEntityChanges ; } ,
"hasSelectedBlock" : function ( ) { return hasSelectedBlock ; } ,
"hasSelectedInnerBlock" : function ( ) { return hasSelectedInnerBlock ; } ,
"inSomeHistory" : function ( ) { return inSomeHistory ; } ,
"isAncestorMultiSelected" : function ( ) { return isAncestorMultiSelected ; } ,
"isAutosavingPost" : function ( ) { return isAutosavingPost ; } ,
"isBlockInsertionPointVisible" : function ( ) { return isBlockInsertionPointVisible ; } ,
"isBlockMultiSelected" : function ( ) { return isBlockMultiSelected ; } ,
"isBlockSelected" : function ( ) { return isBlockSelected ; } ,
"isBlockValid" : function ( ) { return isBlockValid ; } ,
"isBlockWithinSelection" : function ( ) { return isBlockWithinSelection ; } ,
"isCaretWithinFormattedText" : function ( ) { return isCaretWithinFormattedText ; } ,
"isCleanNewPost" : function ( ) { return isCleanNewPost ; } ,
"isCurrentPostPending" : function ( ) { return isCurrentPostPending ; } ,
"isCurrentPostPublished" : function ( ) { return isCurrentPostPublished ; } ,
"isCurrentPostScheduled" : function ( ) { return isCurrentPostScheduled ; } ,
"isEditedPostAutosaveable" : function ( ) { return isEditedPostAutosaveable ; } ,
"isEditedPostBeingScheduled" : function ( ) { return isEditedPostBeingScheduled ; } ,
"isEditedPostDateFloating" : function ( ) { return isEditedPostDateFloating ; } ,
"isEditedPostDirty" : function ( ) { return isEditedPostDirty ; } ,
"isEditedPostEmpty" : function ( ) { return isEditedPostEmpty ; } ,
"isEditedPostNew" : function ( ) { return isEditedPostNew ; } ,
"isEditedPostPublishable" : function ( ) { return isEditedPostPublishable ; } ,
"isEditedPostSaveable" : function ( ) { return isEditedPostSaveable ; } ,
"isFirstMultiSelectedBlock" : function ( ) { return isFirstMultiSelectedBlock ; } ,
"isMultiSelecting" : function ( ) { return isMultiSelecting ; } ,
"isPermalinkEditable" : function ( ) { return isPermalinkEditable ; } ,
"isPostAutosavingLocked" : function ( ) { return isPostAutosavingLocked ; } ,
"isPostLockTakeover" : function ( ) { return isPostLockTakeover ; } ,
"isPostLocked" : function ( ) { return isPostLocked ; } ,
"isPostSavingLocked" : function ( ) { return isPostSavingLocked ; } ,
"isPreviewingPost" : function ( ) { return isPreviewingPost ; } ,
"isPublishSidebarEnabled" : function ( ) { return isPublishSidebarEnabled ; } ,
"isPublishingPost" : function ( ) { return isPublishingPost ; } ,
"isSavingNonPostEntityChanges" : function ( ) { return isSavingNonPostEntityChanges ; } ,
"isSavingPost" : function ( ) { return isSavingPost ; } ,
"isSelectionEnabled" : function ( ) { return isSelectionEnabled ; } ,
"isTyping" : function ( ) { return isTyping ; } ,
"isValidTemplate" : function ( ) { return isValidTemplate ; }
} ) ;
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
// NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/actions.js
var actions _namespaceObject = { } ;
_ _webpack _require _ _ . r ( actions _namespaceObject ) ;
_ _webpack _require _ _ . d ( actions _namespaceObject , {
"__experimentalTearDownEditor" : function ( ) { return _ _experimentalTearDownEditor ; } ,
"autosave" : function ( ) { return autosave ; } ,
"clearSelectedBlock" : function ( ) { return clearSelectedBlock ; } ,
"createUndoLevel" : function ( ) { return createUndoLevel ; } ,
"disablePublishSidebar" : function ( ) { return disablePublishSidebar ; } ,
"editPost" : function ( ) { return editPost ; } ,
"enablePublishSidebar" : function ( ) { return enablePublishSidebar ; } ,
"enterFormattedText" : function ( ) { return enterFormattedText ; } ,
"exitFormattedText" : function ( ) { return exitFormattedText ; } ,
"hideInsertionPoint" : function ( ) { return hideInsertionPoint ; } ,
"insertBlock" : function ( ) { return insertBlock ; } ,
"insertBlocks" : function ( ) { return insertBlocks ; } ,
"insertDefaultBlock" : function ( ) { return insertDefaultBlock ; } ,
"lockPostAutosaving" : function ( ) { return lockPostAutosaving ; } ,
"lockPostSaving" : function ( ) { return lockPostSaving ; } ,
"mergeBlocks" : function ( ) { return mergeBlocks ; } ,
"moveBlockToPosition" : function ( ) { return moveBlockToPosition ; } ,
"moveBlocksDown" : function ( ) { return moveBlocksDown ; } ,
"moveBlocksUp" : function ( ) { return moveBlocksUp ; } ,
"multiSelect" : function ( ) { return multiSelect ; } ,
"receiveBlocks" : function ( ) { return receiveBlocks ; } ,
"redo" : function ( ) { return redo ; } ,
"refreshPost" : function ( ) { return refreshPost ; } ,
"removeBlock" : function ( ) { return removeBlock ; } ,
"removeBlocks" : function ( ) { return removeBlocks ; } ,
"replaceBlock" : function ( ) { return replaceBlock ; } ,
"replaceBlocks" : function ( ) { return replaceBlocks ; } ,
"resetBlocks" : function ( ) { return resetBlocks ; } ,
"resetEditorBlocks" : function ( ) { return resetEditorBlocks ; } ,
"resetPost" : function ( ) { return resetPost ; } ,
"savePost" : function ( ) { return savePost ; } ,
"selectBlock" : function ( ) { return selectBlock ; } ,
"setTemplateValidity" : function ( ) { return setTemplateValidity ; } ,
"setupEditor" : function ( ) { return setupEditor ; } ,
"setupEditorState" : function ( ) { return setupEditorState ; } ,
"showInsertionPoint" : function ( ) { return showInsertionPoint ; } ,
"startMultiSelect" : function ( ) { return startMultiSelect ; } ,
"startTyping" : function ( ) { return startTyping ; } ,
"stopMultiSelect" : function ( ) { return stopMultiSelect ; } ,
"stopTyping" : function ( ) { return stopTyping ; } ,
"synchronizeTemplate" : function ( ) { return synchronizeTemplate ; } ,
"toggleBlockMode" : function ( ) { return toggleBlockMode ; } ,
"toggleSelection" : function ( ) { return toggleSelection ; } ,
"trashPost" : function ( ) { return trashPost ; } ,
"undo" : function ( ) { return undo ; } ,
"unlockPostAutosaving" : function ( ) { return unlockPostAutosaving ; } ,
"unlockPostSaving" : function ( ) { return unlockPostSaving ; } ,
"updateBlock" : function ( ) { return updateBlock ; } ,
"updateBlockAttributes" : function ( ) { return updateBlockAttributes ; } ,
"updateBlockListSettings" : function ( ) { return updateBlockListSettings ; } ,
"updateEditorSettings" : function ( ) { return updateEditorSettings ; } ,
"updatePost" : function ( ) { return updatePost ; } ,
"updatePostLock" : function ( ) { return updatePostLock ; }
} ) ;
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
function _extends ( ) {
_extends = Object . assign || function ( target ) {
for ( var i = 1 ; i < arguments . length ; i ++ ) {
var source = arguments [ i ] ;
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
for ( var key in source ) {
if ( Object . prototype . hasOwnProperty . call ( source , key ) ) {
target [ key ] = source [ key ] ;
}
}
}
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
return target ;
} ;
return _extends . apply ( this , arguments ) ;
}
; // CONCATENATED MODULE: external ["wp","element"]
var external _wp _element _namespaceObject = window [ "wp" ] [ "element" ] ;
; // CONCATENATED MODULE: external "lodash"
var external _lodash _namespaceObject = window [ "lodash" ] ;
; // CONCATENATED MODULE: external ["wp","blocks"]
var external _wp _blocks _namespaceObject = window [ "wp" ] [ "blocks" ] ;
; // CONCATENATED MODULE: external ["wp","data"]
var external _wp _data _namespaceObject = window [ "wp" ] [ "data" ] ;
; // CONCATENATED MODULE: external ["wp","coreData"]
var external _wp _coreData _namespaceObject = window [ "wp" ] [ "coreData" ] ;
; // CONCATENATED MODULE: external ["wp","compose"]
var external _wp _compose _namespaceObject = window [ "wp" ] [ "compose" ] ;
; // CONCATENATED MODULE: external ["wp","hooks"]
var external _wp _hooks _namespaceObject = window [ "wp" ] [ "hooks" ] ;
; // CONCATENATED MODULE: external ["wp","blockEditor"]
var external _wp _blockEditor _namespaceObject = window [ "wp" ] [ "blockEditor" ] ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/defaults.js
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* WordPress dependencies
2021-05-21 12:14:23 +02:00
* /
/ * *
2022-04-12 17:12:47 +02:00
* The default post editor settings .
*
* @ property { boolean | Array } allowedBlockTypes Allowed block types
* @ property { boolean } richEditingEnabled Whether rich editing is enabled or not
* @ property { boolean } codeEditingEnabled Whether code editing is enabled or not
* @ property { boolean } enableCustomFields Whether the WordPress custom fields are enabled or not .
* true = the user has opted to show the Custom Fields panel at the bottom of the editor .
* false = the user has opted to hide the Custom Fields panel at the bottom of the editor .
* undefined = the current environment does not support Custom Fields , so the option toggle in Preferences - > Panels to enable the Custom Fields panel is not displayed .
* @ property { number } autosaveInterval How often in seconds the post will be auto - saved via the REST API .
* @ property { number } localAutosaveInterval How often in seconds the post will be backed up to sessionStorage .
* @ property { Array ? } availableTemplates The available post templates
* @ property { boolean } disablePostFormats Whether or not the post formats are disabled
* @ property { Array ? } allowedMimeTypes List of allowed mime types and file extensions
* @ property { number } maxUploadFileSize Maximum upload file size
* @ property { boolean } supportsLayout Whether the editor supports layouts .
2021-05-21 12:14:23 +02:00
* /
2022-04-11 14:04:30 +02:00
const EDITOR _SETTINGS _DEFAULTS = { ... external _wp _blockEditor _namespaceObject . SETTINGS _DEFAULTS ,
richEditingEnabled : true ,
codeEditingEnabled : true ,
enableCustomFields : undefined ,
supportsLayout : true
} ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/reducer.js
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* External dependencies
2021-05-21 12:14:23 +02:00
* /
/ * *
2022-04-11 14:04:30 +02:00
* WordPress dependencies
2021-05-21 12:14:23 +02:00
* /
2022-04-11 14:04:30 +02:00
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Internal dependencies
2021-05-21 12:14:23 +02:00
* /
2020-10-20 15:36:16 +02:00
2022-04-11 14:04:30 +02:00
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns a post attribute value , flattening nested rendered content using its
* raw value in place of its original object form .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ param { * } value Original value .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ return { * } Raw value .
2021-05-21 12:14:23 +02:00
* /
2020-10-20 15:36:16 +02:00
2022-04-11 14:04:30 +02:00
function getPostRawValue ( value ) {
if ( value && 'object' === typeof value && 'raw' in value ) {
return value . raw ;
2021-05-21 12:14:23 +02:00
}
2020-10-20 15:36:16 +02:00
2022-04-11 14:04:30 +02:00
return value ;
}
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns true if the two object arguments have the same keys , or false
* otherwise .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ param { Object } a First object .
* @ param { Object } b Second object .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ return { boolean } Whether the two objects have the same keys .
2021-05-21 12:14:23 +02:00
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
function hasSameKeys ( a , b ) {
return isEqual ( keys ( a ) , keys ( b ) ) ;
}
2019-03-21 13:48:00 +01:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns true if , given the currently dispatching action and the previously
* dispatched action , the two actions are editing the same post property , or
* false otherwise .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ param { Object } action Currently dispatching action .
* @ param { Object } previousAction Previously dispatched action .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ return { boolean } Whether actions are updating the same post property .
2021-05-21 12:14:23 +02:00
* /
2022-04-11 14:04:30 +02:00
function isUpdatingSamePostProperty ( action , previousAction ) {
return action . type === 'EDIT_POST' && hasSameKeys ( action . edits , previousAction . edits ) ;
2021-05-21 12:14:23 +02:00
}
/ * *
2022-04-11 14:04:30 +02:00
* Returns true if , given the currently dispatching action and the previously
* dispatched action , the two actions are modifying the same property such that
* undo history should be batched .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ param { Object } action Currently dispatching action .
* @ param { Object } previousAction Previously dispatched action .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ return { boolean } Whether to overwrite present state .
2019-03-21 13:48:00 +01:00
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
function shouldOverwriteState ( action , previousAction ) {
if ( action . type === 'RESET_EDITOR_BLOCKS' ) {
return ! action . shouldCreateUndoLevel ;
}
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
if ( ! previousAction || action . type !== previousAction . type ) {
return false ;
}
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
return isUpdatingSamePostProperty ( action , previousAction ) ;
}
function postId ( ) {
let state = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : null ;
let action = arguments . length > 1 ? arguments [ 1 ] : undefined ;
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
switch ( action . type ) {
case 'SETUP_EDITOR_STATE' :
return action . post . id ;
}
2020-10-20 15:36:16 +02:00
2022-04-11 14:04:30 +02:00
return state ;
2021-05-21 12:14:23 +02:00
}
2022-04-11 14:04:30 +02:00
function postType ( ) {
let state = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : null ;
let action = arguments . length > 1 ? arguments [ 1 ] : undefined ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
switch ( action . type ) {
case 'SETUP_EDITOR_STATE' :
return action . post . type ;
}
return state ;
2021-05-21 12:14:23 +02:00
}
/ * *
2022-04-11 14:04:30 +02:00
* Reducer returning whether the post blocks match the defined template or not .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ param { Object } state Current state .
* @ param { Object } action Dispatched action .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ return { boolean } Updated state .
2021-05-21 12:14:23 +02:00
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
function template ( ) {
let state = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : {
isValid : true
} ;
let action = arguments . length > 1 ? arguments [ 1 ] : undefined ;
switch ( action . type ) {
case 'SET_TEMPLATE_VALIDITY' :
return { ... state ,
isValid : action . isValid
} ;
}
return state ;
2021-05-21 12:14:23 +02:00
}
/ * *
2022-04-11 14:04:30 +02:00
* Reducer returning current network request state ( whether a request to
* the WP REST API is in progress , successful , or failed ) .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ param { Object } state Current state .
* @ param { Object } action Dispatched action .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ return { Object } Updated state .
2021-05-21 12:14:23 +02:00
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
function saving ( ) {
let state = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : { } ;
let action = arguments . length > 1 ? arguments [ 1 ] : undefined ;
switch ( action . type ) {
case 'REQUEST_POST_UPDATE_START' :
case 'REQUEST_POST_UPDATE_FINISH' :
return {
pending : action . type === 'REQUEST_POST_UPDATE_START' ,
options : action . options || { }
} ;
}
return state ;
}
2020-10-20 15:36:16 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Post Lock State .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ typedef { Object } PostLockState
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ property { boolean } isLocked Whether the post is locked .
* @ property { ? boolean } isTakeover Whether the post editing has been taken over .
* @ property { ? boolean } activePostLock Active post lock value .
* @ property { ? Object } user User that took over the post .
2020-10-20 15:36:16 +02:00
* /
2018-12-14 05:41:57 +01:00
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Reducer returning the post lock status .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ param { PostLockState } state Current state .
* @ param { Object } action Dispatched action .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ return { PostLockState } Updated state .
2021-05-21 12:14:23 +02:00
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
function postLock ( ) {
let state = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : {
isLocked : false
} ;
let action = arguments . length > 1 ? arguments [ 1 ] : undefined ;
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
switch ( action . type ) {
case 'UPDATE_POST_LOCK' :
return action . lock ;
2021-05-20 14:20:04 +02:00
}
2022-04-11 14:04:30 +02:00
return state ;
2021-05-21 12:14:23 +02:00
}
/ * *
2022-04-11 14:04:30 +02:00
* Post saving lock .
*
* When post saving is locked , the post cannot be published or updated .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ param { PostLockState } state Current state .
* @ param { Object } action Dispatched action .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ return { PostLockState } Updated state .
2021-05-21 12:14:23 +02:00
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
function postSavingLock ( ) {
let state = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : { } ;
let action = arguments . length > 1 ? arguments [ 1 ] : undefined ;
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
switch ( action . type ) {
case 'LOCK_POST_SAVING' :
return { ... state ,
[ action . lockName ] : true
} ;
case 'UNLOCK_POST_SAVING' :
return ( 0 , external _lodash _namespaceObject . omit ) ( state , action . lockName ) ;
2021-05-20 14:20:04 +02:00
}
2022-04-11 14:04:30 +02:00
return state ;
}
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Post autosaving lock .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* When post autosaving is locked , the post will not autosave .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ param { PostLockState } state Current state .
* @ param { Object } action Dispatched action .
*
* @ return { PostLockState } Updated state .
2021-05-21 12:14:23 +02:00
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
function postAutosavingLock ( ) {
let state = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : { } ;
let action = arguments . length > 1 ? arguments [ 1 ] : undefined ;
2020-01-08 12:57:23 +01:00
2022-04-11 14:04:30 +02:00
switch ( action . type ) {
case 'LOCK_POST_AUTOSAVING' :
return { ... state ,
[ action . lockName ] : true
} ;
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
case 'UNLOCK_POST_AUTOSAVING' :
return ( 0 , external _lodash _namespaceObject . omit ) ( state , action . lockName ) ;
2021-05-21 12:14:23 +02:00
}
2022-04-11 14:04:30 +02:00
return state ;
2021-05-21 12:14:23 +02:00
}
2018-12-18 04:14:52 +01:00
/ * *
2022-04-11 14:04:30 +02:00
* Reducer returning whether the editor is ready to be rendered .
* The editor is considered ready to be rendered once
* the post object is loaded properly and the initial blocks parsed .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ param { boolean } state
* @ param { Object } action
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ return { boolean } Updated state .
2018-12-18 04:14:52 +01:00
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
function isReady ( ) {
let state = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : false ;
let action = arguments . length > 1 ? arguments [ 1 ] : undefined ;
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
switch ( action . type ) {
case 'SETUP_EDITOR_STATE' :
return true ;
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
case 'TEAR_DOWN_EDITOR' :
return false ;
2021-05-21 12:14:23 +02:00
}
2022-04-11 14:04:30 +02:00
return state ;
}
2021-05-20 14:20:04 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Reducer returning the post editor setting .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ param { Object } state Current state .
* @ param { Object } action Dispatched action .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ return { Object } Updated state .
2021-05-20 14:20:04 +02:00
* /
Block Editor: Update WordPress packages to include the latest bug fixes.
Updated packages:
@wordpress/annotations@1.7.1
@wordpress/api-fetch@3.6.1
@wordpress/babel-plugin-makepot@3.2.1
@wordpress/babel-preset-default@4.6.1
@wordpress/block-directory@1.0.1
@wordpress/block-editor@3.2.1
@wordpress/block-library@2.9.1
@wordpress/blocks@6.7.1
@wordpress/components@8.3.1
@wordpress/compose@3.7.1
@wordpress/core-data@2.7.1
@wordpress/data-controls@1.3.1
@wordpress/data@4.9.1
@wordpress/docgen@1.4.1
@wordpress/dom@2.5.1
@wordpress/e2e-test-utils@2.4.1
@wordpress/e2e-tests@1.7.1
@wordpress/edit-post@3.8.1
@wordpress/editor@9.7.1
@wordpress/element@2.8.1
@wordpress/format-library@1.9.1
@wordpress/i18n@3.6.1
@wordpress/jest-console@3.3.1
@wordpress/jest-preset-default@5.1.1
@wordpress/keycodes@2.6.1
@wordpress/library-export-default-webpack-plugin@1.4.1
@wordpress/list-reusable-blocks@1.8.1
@wordpress/media-utils@1.2.1
@wordpress/notices@1.8.1
@wordpress/nux@3.7.1
@wordpress/plugins@2.7.1
@wordpress/redux-routine@3.6.1
@wordpress/rich-text@3.7.1
@wordpress/scripts@5.0.1
@wordpress/server-side-render@1.3.1
@wordpress/shortcode@2.4.1
@wordpress/token-list@1.6.1
@wordpress/viewport@2.8.1
@wordpress/wordcount@2.6.1
Props epiqueras, youknowriad, donmhico, jorgefilipecosta, soean, mcsf, noisysocks, andraganescu, gziolo, talldanwp, iseulde, nrqsnchz, mapk, karmatosed, joen, afercia, kjellr, desrosj.
Fixes #48186.
Built from https://develop.svn.wordpress.org/trunk@46364
git-svn-id: http://core.svn.wordpress.org/trunk@46163 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-30 22:07:06 +02:00
2022-04-11 14:04:30 +02:00
function editorSettings ( ) {
let state = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : EDITOR _SETTINGS _DEFAULTS ;
let action = arguments . length > 1 ? arguments [ 1 ] : undefined ;
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
switch ( action . type ) {
case 'UPDATE_EDITOR_SETTINGS' :
return { ... state ,
... action . settings
} ;
2021-05-21 12:14:23 +02:00
}
2022-04-11 14:04:30 +02:00
return state ;
}
/* harmony default export */ var reducer = ( ( 0 , external _wp _data _namespaceObject . combineReducers ) ( {
postId ,
postType ,
saving ,
postLock ,
template ,
postSavingLock ,
isReady ,
editorSettings ,
postAutosavingLock
} ) ) ;
; // CONCATENATED MODULE: ./node_modules/rememo/es/rememo.js
2019-09-19 17:19:18 +02:00
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
var LEAF _KEY , hasWeakMap ;
2020-10-20 15:36:16 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Arbitrary value used as key for referencing cache object in WeakMap tree .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ type { Object }
* /
LEAF _KEY = { } ;
/ * *
* Whether environment supports WeakMap .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ type { boolean }
2018-12-18 04:14:52 +01:00
* /
2022-04-11 14:04:30 +02:00
hasWeakMap = typeof WeakMap !== 'undefined' ;
2018-12-14 05:41:57 +01:00
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns the first argument as the sole entry in an array .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ param { * } value Value to return .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ return { Array } Value returned as entry in array .
2021-05-21 12:14:23 +02:00
* /
2022-04-11 14:04:30 +02:00
function arrayOf ( value ) {
return [ value ] ;
2021-05-21 12:14:23 +02:00
}
2022-04-11 14:04:30 +02:00
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns true if the value passed is object - like , or false otherwise . A value
* is object - like if it can support property assignment , e . g . object or array .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ param { * } value Value to test .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ return { boolean } Whether value is object - like .
* /
function isObjectLike ( value ) {
return ! ! value && 'object' === typeof value ;
}
/ * *
* Creates and returns a new cache object .
*
* @ return { Object } Cache object .
2021-05-21 12:14:23 +02:00
* /
2022-04-11 14:04:30 +02:00
function createCache ( ) {
var cache = {
clear : function ( ) {
cache . head = null ;
} ,
} ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
return cache ;
2021-05-20 14:20:04 +02:00
}
2022-04-11 14:04:30 +02:00
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns true if entries within the two arrays are strictly equal by
* reference from a starting index .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ param { Array } a First array .
* @ param { Array } b Second array .
* @ param { number } fromIndex Index from which to start comparison .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ return { boolean } Whether arrays are shallowly equal .
2021-05-21 12:14:23 +02:00
* /
2022-04-11 14:04:30 +02:00
function isShallowEqual ( a , b , fromIndex ) {
var i ;
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
if ( a . length !== b . length ) {
return false ;
}
for ( i = fromIndex ; i < a . length ; i ++ ) {
if ( a [ i ] !== b [ i ] ) {
return false ;
}
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
return true ;
2021-05-21 12:14:23 +02:00
}
2022-04-11 14:04:30 +02:00
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns a memoized selector function . The getDependants function argument is
* called before the memoized selector and is expected to return an immutable
* reference or array of references on which the selector depends for computing
* its own return value . The memoize cache is preserved only as long as those
* dependant references remain the same . If getDependants returns a different
* reference ( s ) , the cache is cleared and the selector value regenerated .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ param { Function } selector Selector function .
* @ param { Function } getDependants Dependant getter returning an immutable
* reference or array of reference used in
* cache bust consideration .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ return { Function } Memoized selector .
2021-05-21 12:14:23 +02:00
* /
2022-04-11 14:04:30 +02:00
/* harmony default export */ function rememo ( selector , getDependants ) {
var rootCache , getCache ;
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
// Use object source as dependant if getter not provided
if ( ! getDependants ) {
getDependants = arrayOf ;
}
/ * *
* Returns the root cache . If WeakMap is supported , this is assigned to the
* root WeakMap cache set , otherwise it is a shared instance of the default
* cache object .
*
* @ return { ( WeakMap | Object ) } Root cache object .
* /
function getRootCache ( ) {
return rootCache ;
}
/ * *
* Returns the cache for a given dependants array . When possible , a WeakMap
* will be used to create a unique cache for each set of dependants . This
* is feasible due to the nature of WeakMap in allowing garbage collection
* to occur on entries where the key object is no longer referenced . Since
* WeakMap requires the key to be an object , this is only possible when the
* dependant is object - like . The root cache is created as a hierarchy where
* each top - level key is the first entry in a dependants set , the value a
* WeakMap where each key is the next dependant , and so on . This continues
* so long as the dependants are object - like . If no dependants are object -
* like , then the cache is shared across all invocations .
*
* @ see isObjectLike
*
* @ param { Array } dependants Selector dependants .
*
* @ return { Object } Cache object .
* /
function getWeakMapCache ( dependants ) {
var caches = rootCache ,
isUniqueByDependants = true ,
i , dependant , map , cache ;
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
for ( i = 0 ; i < dependants . length ; i ++ ) {
dependant = dependants [ i ] ;
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
// Can only compose WeakMap from object-like key.
if ( ! isObjectLike ( dependant ) ) {
isUniqueByDependants = false ;
break ;
}
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
// Does current segment of cache already have a WeakMap?
if ( caches . has ( dependant ) ) {
// Traverse into nested WeakMap.
caches = caches . get ( dependant ) ;
} else {
// Create, set, and traverse into a new one.
map = new WeakMap ( ) ;
caches . set ( dependant , map ) ;
caches = map ;
}
}
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
// We use an arbitrary (but consistent) object as key for the last item
// in the WeakMap to serve as our running cache.
if ( ! caches . has ( LEAF _KEY ) ) {
cache = createCache ( ) ;
cache . isUniqueByDependants = isUniqueByDependants ;
caches . set ( LEAF _KEY , cache ) ;
}
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
return caches . get ( LEAF _KEY ) ;
}
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
// Assign cache handler by availability of WeakMap
getCache = hasWeakMap ? getWeakMapCache : getRootCache ;
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
/ * *
* Resets root memoization cache .
* /
function clear ( ) {
rootCache = hasWeakMap ? new WeakMap ( ) : createCache ( ) ;
}
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
// eslint-disable-next-line jsdoc/check-param-names
/ * *
* The augmented selector call , considering first whether dependants have
* changed before passing it to underlying memoize function .
*
* @ param { Object } source Source object for derivation .
* @ param { ... * } extraArgs Additional arguments to pass to selector .
*
* @ return { * } Selector result .
* /
function callSelector ( /* source, ...extraArgs */ ) {
var len = arguments . length ,
cache , node , i , args , dependants ;
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
// Create copy of arguments (avoid leaking deoptimization).
args = new Array ( len ) ;
for ( i = 0 ; i < len ; i ++ ) {
args [ i ] = arguments [ i ] ;
}
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
dependants = getDependants . apply ( null , args ) ;
cache = getCache ( dependants ) ;
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
// If not guaranteed uniqueness by dependants (primitive type or lack
// of WeakMap support), shallow compare against last dependants and, if
// references have changed, destroy cache to recalculate result.
if ( ! cache . isUniqueByDependants ) {
if ( cache . lastDependants && ! isShallowEqual ( dependants , cache . lastDependants , 0 ) ) {
cache . clear ( ) ;
}
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
cache . lastDependants = dependants ;
}
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
node = cache . head ;
while ( node ) {
// Check whether node arguments match arguments
if ( ! isShallowEqual ( node . args , args , 1 ) ) {
node = node . next ;
continue ;
}
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
// At this point we can assume we've found a match
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
// Surface matched node to head if not already
if ( node !== cache . head ) {
// Adjust siblings to point to each other.
node . prev . next = node . next ;
if ( node . next ) {
node . next . prev = node . prev ;
}
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
node . next = cache . head ;
node . prev = null ;
cache . head . prev = node ;
cache . head = node ;
}
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
// Return immediately
return node . val ;
}
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
// No cached value found. Continue to insertion phase:
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
node = {
// Generate the result from original function
val : selector . apply ( null , args ) ,
} ;
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
// Avoid including the source object in the cache.
args [ 0 ] = null ;
node . args = args ;
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
// Don't need to check whether node is already head, since it would
// have been returned above already if it was
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
// Shift existing head down list
if ( cache . head ) {
cache . head . prev = node ;
node . next = cache . head ;
}
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
cache . head = node ;
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
return node . val ;
}
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
callSelector . getDependants = getDependants ;
callSelector . clear = clear ;
clear ( ) ;
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
return callSelector ;
2020-10-20 15:36:16 +02:00
}
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: external ["wp","date"]
var external _wp _date _namespaceObject = window [ "wp" ] [ "date" ] ;
; // CONCATENATED MODULE: external ["wp","url"]
var external _wp _url _namespaceObject = window [ "wp" ] [ "url" ] ;
; // CONCATENATED MODULE: external ["wp","deprecated"]
var external _wp _deprecated _namespaceObject = window [ "wp" ] [ "deprecated" ] ;
var external _wp _deprecated _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( external _wp _deprecated _namespaceObject ) ;
; // CONCATENATED MODULE: external ["wp","primitives"]
var external _wp _primitives _namespaceObject = window [ "wp" ] [ "primitives" ] ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/layout.js
2021-11-08 15:29:21 +01:00
/ * *
2022-04-11 14:04:30 +02:00
* WordPress dependencies
2021-11-08 15:29:21 +01:00
* /
2022-04-11 14:04:30 +02:00
const layout = ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _primitives _namespaceObject . SVG , {
xmlns : "http://www.w3.org/2000/svg" ,
viewBox : "0 0 24 24"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _primitives _namespaceObject . Path , {
d : "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
} ) ) ;
/* harmony default export */ var library _layout = ( layout ) ;
2021-11-08 15:29:21 +01:00
2022-04-12 17:12:47 +02:00
; // CONCATENATED MODULE: external ["wp","preferences"]
var external _wp _preferences _namespaceObject = window [ "wp" ] [ "preferences" ] ;
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/constants.js
2019-09-19 17:19:18 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Set of post properties for which edits should assume a merging behavior ,
* assuming an object value .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ type { Set }
* /
const EDIT _MERGE _PROPERTIES = new Set ( [ 'meta' ] ) ;
/ * *
* Constant for the store module ( or reducer ) key .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ type { string }
2019-09-19 17:19:18 +02:00
* /
2022-04-11 14:04:30 +02:00
const STORE _NAME = 'core/editor' ;
const SAVE _POST _NOTICE _ID = 'SAVE_POST_NOTICE_ID' ;
const TRASH _POST _NOTICE _ID = 'TRASH_POST_NOTICE_ID' ;
const PERMALINK _POSTNAME _REGEX = /%(?:postname|pagename)%/ ;
const ONE _MINUTE _IN _MS = 60 * 1000 ;
const AUTOSAVE _PROPERTIES = [ 'title' , 'excerpt' , 'content' ] ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/header.js
2019-09-19 17:19:18 +02:00
2021-05-20 14:20:04 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* WordPress dependencies
2021-05-20 14:20:04 +02:00
* /
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
const header = ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _primitives _namespaceObject . SVG , {
xmlns : "http://www.w3.org/2000/svg" ,
viewBox : "0 0 24 24"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _primitives _namespaceObject . Path , {
d : "M18.5 10.5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
} ) ) ;
/* harmony default export */ var library _header = ( header ) ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/footer.js
2020-01-08 12:57:23 +01:00
2019-03-21 13:48:00 +01:00
2022-04-11 14:04:30 +02:00
/ * *
* WordPress dependencies
* /
2019-03-21 13:48:00 +01:00
2022-04-11 14:04:30 +02:00
const footer = ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _primitives _namespaceObject . SVG , {
xmlns : "http://www.w3.org/2000/svg" ,
viewBox : "0 0 24 24"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _primitives _namespaceObject . Path , {
fillRule : "evenodd" ,
d : "M18 5.5h-8v8h8.5V6a.5.5 0 00-.5-.5zm-9.5 8h-3V6a.5.5 0 01.5-.5h2.5v8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
} ) ) ;
/* harmony default export */ var library _footer = ( footer ) ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/sidebar.js
2020-10-13 15:10:30 +02:00
2020-06-26 15:33:47 +02:00
2022-04-11 14:04:30 +02:00
/ * *
* WordPress dependencies
* /
2020-06-26 15:33:47 +02:00
2022-04-11 14:04:30 +02:00
const sidebar = ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _primitives _namespaceObject . SVG , {
xmlns : "http://www.w3.org/2000/svg" ,
viewBox : "0 0 24 24"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _primitives _namespaceObject . Path , {
d : "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
} ) ) ;
/* harmony default export */ var library _sidebar = ( sidebar ) ;
2020-06-26 15:33:47 +02:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/symbol-filled.js
2020-10-20 15:36:16 +02:00
2021-05-20 14:20:04 +02:00
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* WordPress dependencies
2021-05-21 12:14:23 +02:00
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const symbolFilled = ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _primitives _namespaceObject . SVG , {
xmlns : "http://www.w3.org/2000/svg" ,
viewBox : "0 0 24 24"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _primitives _namespaceObject . Path , {
d : "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-17.6 1L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z"
} ) ) ;
/* harmony default export */ var symbol _filled = ( symbolFilled ) ;
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/get-template-part-icon.js
/ * *
* WordPress dependencies
* /
2021-05-20 14:20:04 +02:00
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Helper function to retrieve the corresponding icon by name .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ param { string } iconName The name of the icon .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ return { Object } The corresponding icon .
2021-05-21 12:14:23 +02:00
* /
2020-06-26 15:33:47 +02:00
2022-04-11 14:04:30 +02:00
function getTemplatePartIcon ( iconName ) {
if ( 'header' === iconName ) {
return library _header ;
} else if ( 'footer' === iconName ) {
return library _footer ;
} else if ( 'sidebar' === iconName ) {
return library _sidebar ;
}
return symbol _filled ;
2021-05-21 12:14:23 +02:00
}
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/selectors.js
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* External dependencies
2021-05-21 12:14:23 +02:00
* /
2022-04-11 14:04:30 +02:00
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* WordPress dependencies
2021-05-21 12:14:23 +02:00
* /
2019-09-19 17:19:18 +02:00
2021-05-21 12:14:23 +02:00
2018-12-14 05:41:57 +01:00
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
2022-04-12 17:12:47 +02:00
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Internal dependencies
2021-05-21 12:14:23 +02:00
* /
2018-12-14 05:41:57 +01:00
2020-10-20 15:36:16 +02:00
2022-04-11 14:04:30 +02:00
/ * *
* Shared reference to an empty object for cases where it is important to avoid
* returning a new object reference on every invocation , as in a connected or
* other pure component which performs ` shouldComponentUpdate ` check on props .
* This should be used as a last resort , since the normalized data should be
* maintained by the reducer result in state .
* /
const EMPTY _OBJECT = { } ;
/ * *
* Shared reference to an empty array for cases where it is important to avoid
* returning a new array reference on every invocation , as in a connected or
* other pure component which performs ` shouldComponentUpdate ` check on props .
* This should be used as a last resort , since the normalized data should be
* maintained by the reducer result in state .
* /
const EMPTY _ARRAY = [ ] ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns true if any past editor history snapshots exist , or false otherwise .
2021-05-21 12:14:23 +02:00
*
* @ param { Object } state Global application state .
*
2022-04-11 14:04:30 +02:00
* @ return { boolean } Whether undo history exists .
2021-05-21 12:14:23 +02:00
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
const hasEditorUndo = ( 0 , external _wp _data _namespaceObject . createRegistrySelector ) ( select => ( ) => {
return select ( external _wp _coreData _namespaceObject . store ) . hasUndo ( ) ;
} ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns true if any future editor history snapshots exist , or false
* otherwise .
2021-05-21 12:14:23 +02:00
*
* @ param { Object } state Global application state .
*
2022-04-11 14:04:30 +02:00
* @ return { boolean } Whether redo history exists .
2021-05-21 12:14:23 +02:00
* /
2020-10-20 15:36:16 +02:00
2022-04-11 14:04:30 +02:00
const hasEditorRedo = ( 0 , external _wp _data _namespaceObject . createRegistrySelector ) ( select => ( ) => {
return select ( external _wp _coreData _namespaceObject . store ) . hasRedo ( ) ;
} ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns true if the currently edited post is yet to be saved , or false if
* the post has been saved .
2021-05-21 12:14:23 +02:00
*
* @ param { Object } state Global application state .
*
2022-04-11 14:04:30 +02:00
* @ return { boolean } Whether the post is new .
2021-05-21 12:14:23 +02:00
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
function isEditedPostNew ( state ) {
return getCurrentPost ( state ) . status === 'auto-draft' ;
2021-05-21 12:14:23 +02:00
}
/ * *
2022-04-11 14:04:30 +02:00
* Returns true if content includes unsaved changes , or false otherwise .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ param { Object } state Editor state .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ return { boolean } Whether content includes unsaved changes .
2021-05-21 12:14:23 +02:00
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
function hasChangedContent ( state ) {
const edits = getPostEdits ( state ) ;
return 'blocks' in edits || // `edits` is intended to contain only values which are different from
// the saved post, so the mere presence of a property is an indicator
// that the value is different than what is known to be saved. While
// content in Visual mode is represented by the blocks state, in Text
// mode it is tracked by `edits.content`.
'content' in edits ;
2021-05-21 12:14:23 +02:00
}
/ * *
2022-04-11 14:04:30 +02:00
* Returns true if there are unsaved values for the current edit session , or
* false if the editing state matches the saved or new post .
2021-05-21 12:14:23 +02:00
*
* @ param { Object } state Global application state .
*
2022-04-11 14:04:30 +02:00
* @ return { boolean } Whether unsaved values exist .
2021-05-21 12:14:23 +02:00
* /
2020-10-20 15:36:16 +02:00
2022-04-11 14:04:30 +02:00
const isEditedPostDirty = ( 0 , external _wp _data _namespaceObject . createRegistrySelector ) ( select => state => {
// Edits should contain only fields which differ from the saved post (reset
// at initial load and save complete). Thus, a non-empty edits state can be
// inferred to contain unsaved values.
const postType = getCurrentPostType ( state ) ;
const postId = getCurrentPostId ( state ) ;
if ( select ( external _wp _coreData _namespaceObject . store ) . hasEditsForEntityRecord ( 'postType' , postType , postId ) ) {
return true ;
}
return false ;
} ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns true if there are unsaved edits for entities other than
* the editor ' s post , and false otherwise .
2021-05-21 12:14:23 +02:00
*
* @ param { Object } state Global application state .
*
2022-04-11 14:04:30 +02:00
* @ return { boolean } Whether there are edits or not .
2021-05-21 12:14:23 +02:00
* /
2020-10-20 15:36:16 +02:00
2022-04-11 14:04:30 +02:00
const hasNonPostEntityChanges = ( 0 , external _wp _data _namespaceObject . createRegistrySelector ) ( select => state => {
const dirtyEntityRecords = select ( external _wp _coreData _namespaceObject . store ) . _ _experimentalGetDirtyEntityRecords ( ) ;
const {
type ,
id
} = getCurrentPost ( state ) ;
return ( 0 , external _lodash _namespaceObject . some ) ( dirtyEntityRecords , entityRecord => entityRecord . kind !== 'postType' || entityRecord . name !== type || entityRecord . key !== id ) ;
} ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns true if there are no unsaved values for the current edit session and
* if the currently edited post is new ( has never been saved before ) .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ param { Object } state Global application state .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ return { boolean } Whether new post and unsaved values exist .
2021-05-21 12:14:23 +02:00
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
function isCleanNewPost ( state ) {
return ! isEditedPostDirty ( state ) && isEditedPostNew ( state ) ;
2021-05-21 12:14:23 +02:00
}
/ * *
2022-04-11 14:04:30 +02:00
* Returns the post currently being edited in its last known saved state , not
* including unsaved edits . Returns an object containing relevant default post
* values if the post has not yet been saved .
2021-05-21 12:14:23 +02:00
*
* @ param { Object } state Global application state .
*
2022-04-11 14:04:30 +02:00
* @ return { Object } Post object .
2021-05-21 12:14:23 +02:00
* /
2020-10-20 15:36:16 +02:00
2022-04-11 14:04:30 +02:00
const getCurrentPost = ( 0 , external _wp _data _namespaceObject . createRegistrySelector ) ( select => state => {
const postId = getCurrentPostId ( state ) ;
const postType = getCurrentPostType ( state ) ;
const post = select ( external _wp _coreData _namespaceObject . store ) . getRawEntityRecord ( 'postType' , postType , postId ) ;
2020-10-20 15:36:16 +02:00
2022-04-11 14:04:30 +02:00
if ( post ) {
return post ;
} // This exists for compatibility with the previous selector behavior
// which would guarantee an object return based on the editor reducer's
// default empty object state.
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
return EMPTY _OBJECT ;
} ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns the post type of the post currently being edited .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ param { Object } state Global application state .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ return { string } Post type .
2021-05-21 12:14:23 +02:00
* /
2020-10-20 15:36:16 +02:00
2022-04-11 14:04:30 +02:00
function getCurrentPostType ( state ) {
return state . postType ;
}
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns the ID of the post currently being edited , or null if the post has
* not yet been saved .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ param { Object } state Global application state .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ return { ? number } ID of current post .
2021-05-21 12:14:23 +02:00
* /
2020-10-20 15:36:16 +02:00
2022-04-11 14:04:30 +02:00
function getCurrentPostId ( state ) {
return state . postId ;
2021-05-21 12:14:23 +02:00
}
/ * *
2022-04-11 14:04:30 +02:00
* Returns the number of revisions of the post currently being edited .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ param { Object } state Global application state .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ return { number } Number of revisions .
2021-05-21 12:14:23 +02:00
* /
2022-04-11 14:04:30 +02:00
function getCurrentPostRevisionsCount ( state ) {
return ( 0 , external _lodash _namespaceObject . get ) ( getCurrentPost ( state ) , [ '_links' , 'version-history' , 0 , 'count' ] , 0 ) ;
2021-05-21 12:14:23 +02:00
}
/ * *
2022-04-11 14:04:30 +02:00
* Returns the last revision ID of the post currently being edited ,
* or null if the post has no revisions .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ param { Object } state Global application state .
*
* @ return { ? number } ID of the last revision .
2021-05-21 12:14:23 +02:00
* /
2020-10-20 15:36:16 +02:00
2022-04-11 14:04:30 +02:00
function getCurrentPostLastRevisionId ( state ) {
return ( 0 , external _lodash _namespaceObject . get ) ( getCurrentPost ( state ) , [ '_links' , 'predecessor-version' , 0 , 'id' ] , null ) ;
2021-05-21 12:14:23 +02:00
}
/ * *
2022-04-11 14:04:30 +02:00
* Returns any post values which have been changed in the editor but not yet
* been saved .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ param { Object } state Global application state .
*
* @ return { Object } Object of key value pairs comprising unsaved edits .
2021-05-21 12:14:23 +02:00
* /
2020-10-20 15:36:16 +02:00
2022-04-11 14:04:30 +02:00
const getPostEdits = ( 0 , external _wp _data _namespaceObject . createRegistrySelector ) ( select => state => {
const postType = getCurrentPostType ( state ) ;
const postId = getCurrentPostId ( state ) ;
return select ( external _wp _coreData _namespaceObject . store ) . getEntityRecordEdits ( 'postType' , postType , postId ) || EMPTY _OBJECT ;
} ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns an attribute value of the saved post .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ param { Object } state Global application state .
* @ param { string } attributeName Post attribute name .
*
* @ return { * } Post attribute value .
2021-05-21 12:14:23 +02:00
* /
2020-01-22 23:06:21 +01:00
2022-04-11 14:04:30 +02:00
function getCurrentPostAttribute ( state , attributeName ) {
switch ( attributeName ) {
case 'type' :
return getCurrentPostType ( state ) ;
case 'id' :
return getCurrentPostId ( state ) ;
default :
const post = getCurrentPost ( state ) ;
if ( ! post . hasOwnProperty ( attributeName ) ) {
break ;
}
return getPostRawValue ( post [ attributeName ] ) ;
}
2021-05-21 12:14:23 +02:00
}
/ * *
2022-04-11 14:04:30 +02:00
* Returns a single attribute of the post being edited , preferring the unsaved
* edit if one exists , but merging with the attribute value for the last known
* saved state of the post ( this is needed for some nested attributes like meta ) .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ param { Object } state Global application state .
* @ param { string } attributeName Post attribute name .
*
* @ return { * } Post attribute value .
2021-05-21 12:14:23 +02:00
* /
2020-01-22 23:06:21 +01:00
2022-04-11 14:04:30 +02:00
const getNestedEditedPostProperty = ( state , attributeName ) => {
const edits = getPostEdits ( state ) ;
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
if ( ! edits . hasOwnProperty ( attributeName ) ) {
return getCurrentPostAttribute ( state , attributeName ) ;
}
return { ... getCurrentPostAttribute ( state , attributeName ) ,
... edits [ attributeName ]
} ;
} ;
/ * *
* Returns a single attribute of the post being edited , preferring the unsaved
* edit if one exists , but falling back to the attribute for the last known
* saved state of the post .
*
* @ param { Object } state Global application state .
* @ param { string } attributeName Post attribute name .
*
* @ return { * } Post attribute value .
* /
2021-11-15 13:50:17 +01:00
2022-04-11 14:04:30 +02:00
function getEditedPostAttribute ( state , attributeName ) {
2022-04-12 17:12:47 +02:00
// Special cases.
2022-04-11 14:04:30 +02:00
switch ( attributeName ) {
case 'content' :
return getEditedPostContent ( state ) ;
} // Fall back to saved post value if not edited.
2020-10-20 15:36:16 +02:00
2022-04-11 14:04:30 +02:00
const edits = getPostEdits ( state ) ;
2020-01-22 23:06:21 +01:00
2022-04-11 14:04:30 +02:00
if ( ! edits . hasOwnProperty ( attributeName ) ) {
return getCurrentPostAttribute ( state , attributeName ) ;
} // Merge properties are objects which contain only the patch edit in state,
// and thus must be merged with the current post attribute.
2020-01-22 23:06:21 +01:00
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
if ( EDIT _MERGE _PROPERTIES . has ( attributeName ) ) {
return getNestedEditedPostProperty ( state , attributeName ) ;
}
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
return edits [ attributeName ] ;
}
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns an attribute value of the current autosave revision for a post , or
* null if there is no autosave for the post .
*
* @ deprecated since 5.6 . Callers should use the ` getAutosave( postType, postId, userId ) ` selector
* from the '@wordpress/core-data' package and access properties on the returned
* autosave object using getPostRawValue .
*
* @ param { Object } state Global application state .
* @ param { string } attributeName Autosave attribute name .
*
* @ return { * } Autosave attribute value .
2021-05-21 12:14:23 +02:00
* /
2020-01-08 12:57:23 +01:00
2022-04-11 14:04:30 +02:00
const getAutosaveAttribute = ( 0 , external _wp _data _namespaceObject . createRegistrySelector ) ( select => ( state , attributeName ) => {
if ( ! ( 0 , external _lodash _namespaceObject . includes ) ( AUTOSAVE _PROPERTIES , attributeName ) && attributeName !== 'preview_link' ) {
return ;
}
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const postType = getCurrentPostType ( state ) ;
const postId = getCurrentPostId ( state ) ;
const currentUserId = ( 0 , external _lodash _namespaceObject . get ) ( select ( external _wp _coreData _namespaceObject . store ) . getCurrentUser ( ) , [ 'id' ] ) ;
const autosave = select ( external _wp _coreData _namespaceObject . store ) . getAutosave ( postType , postId , currentUserId ) ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
if ( autosave ) {
return getPostRawValue ( autosave [ attributeName ] ) ;
}
} ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns the current visibility of the post being edited , preferring the
* unsaved value if different than the saved post . The return value is one of
* "private" , "password" , or "public" .
*
* @ param { Object } state Global application state .
*
* @ return { string } Post visibility .
2021-05-21 12:14:23 +02:00
* /
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
function getEditedPostVisibility ( state ) {
const status = getEditedPostAttribute ( state , 'status' ) ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
if ( status === 'private' ) {
return 'private' ;
}
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
const password = getEditedPostAttribute ( state , 'password' ) ;
2020-10-20 15:36:16 +02:00
2022-04-11 14:04:30 +02:00
if ( password ) {
return 'password' ;
}
2019-03-07 10:09:59 +01:00
2022-04-11 14:04:30 +02:00
return 'public' ;
}
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns true if post is pending review .
*
* @ param { Object } state Global application state .
*
* @ return { boolean } Whether current post is pending review .
2021-05-21 12:14:23 +02:00
* /
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
function isCurrentPostPending ( state ) {
return getCurrentPost ( state ) . status === 'pending' ;
}
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Return true if the current post has already been published .
*
* @ param { Object } state Global application state .
* @ param { Object ? } currentPost Explicit current post for bypassing registry selector .
*
* @ return { boolean } Whether the post has been published .
2021-05-21 12:14:23 +02:00
* /
2019-03-07 10:09:59 +01:00
2022-04-11 14:04:30 +02:00
function isCurrentPostPublished ( state , currentPost ) {
const post = currentPost || getCurrentPost ( state ) ;
return [ 'publish' , 'private' ] . indexOf ( post . status ) !== - 1 || post . status === 'future' && ! ( 0 , external _wp _date _namespaceObject . isInTheFuture ) ( new Date ( Number ( ( 0 , external _wp _date _namespaceObject . getDate ) ( post . date ) ) - ONE _MINUTE _IN _MS ) ) ;
}
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns true if post is already scheduled .
*
* @ param { Object } state Global application state .
*
* @ return { boolean } Whether current post is scheduled to be posted .
2021-05-21 12:14:23 +02:00
* /
2019-03-07 10:09:59 +01:00
2022-04-11 14:04:30 +02:00
function isCurrentPostScheduled ( state ) {
return getCurrentPost ( state ) . status === 'future' && ! isCurrentPostPublished ( state ) ;
}
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Return true if the post being edited can be published .
*
* @ param { Object } state Global application state .
*
* @ return { boolean } Whether the post can been published .
2021-05-21 12:14:23 +02:00
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
function isEditedPostPublishable ( state ) {
const post = getCurrentPost ( state ) ; // TODO: Post being publishable should be superset of condition of post
// being saveable. Currently this restriction is imposed at UI.
//
2022-04-12 17:12:47 +02:00
// See: <PostPublishButton /> (`isButtonEnabled` assigned by `isSaveable`).
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
return isEditedPostDirty ( state ) || [ 'publish' , 'private' , 'future' ] . indexOf ( post . status ) === - 1 ;
}
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns true if the post can be saved , or false otherwise . A post must
* contain a title , an excerpt , or non - empty content to be valid for save .
*
* @ param { Object } state Global application state .
*
* @ return { boolean } Whether the post can be saved .
2021-05-21 12:14:23 +02:00
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
function isEditedPostSaveable ( state ) {
if ( isSavingPost ( state ) ) {
return false ;
} // TODO: Post should not be saveable if not dirty. Cannot be added here at
// this time since posts where meta boxes are present can be saved even if
// the post is not dirty. Currently this restriction is imposed at UI, but
// should be moved here.
//
// See: `isEditedPostPublishable` (includes `isEditedPostDirty` condition)
// See: <PostSavedState /> (`forceIsDirty` prop)
// See: <PostPublishButton /> (`forceIsDirty` prop)
2022-04-12 17:12:47 +02:00
// See: https://github.com/WordPress/gutenberg/pull/4184.
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
return ! ! getEditedPostAttribute ( state , 'title' ) || ! ! getEditedPostAttribute ( state , 'excerpt' ) || ! isEditedPostEmpty ( state ) || external _wp _element _namespaceObject . Platform . OS === 'native' ;
}
2019-03-21 13:48:00 +01:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns true if the edited post has content . A post has content if it has at
* least one saveable block or otherwise has a non - empty content property
* assigned .
*
* @ param { Object } state Global application state .
*
* @ return { boolean } Whether post has content .
2019-03-21 13:48:00 +01:00
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
function isEditedPostEmpty ( state ) {
// While the condition of truthy content string is sufficient to determine
// emptiness, testing saveable blocks length is a trivial operation. Since
// this function can be called frequently, optimize for the fast case as a
// condition of the mere existence of blocks. Note that the value of edited
// content takes precedent over block content, and must fall through to the
// default logic.
const blocks = getEditorBlocks ( state ) ;
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
if ( blocks . length ) {
// Pierce the abstraction of the serializer in knowing that blocks are
// joined with with newlines such that even if every individual block
// produces an empty save result, the serialized content is non-empty.
if ( blocks . length > 1 ) {
return false ;
} // There are two conditions under which the optimization cannot be
// assumed, and a fallthrough to getEditedPostContent must occur:
//
// 1. getBlocksForSerialization has special treatment in omitting a
// single unmodified default block.
// 2. Comment delimiters are omitted for a freeform or unregistered
// block in its serialization. The freeform block specifically may
// produce an empty string in its saved output.
//
// For all other content, the single block is assumed to make a post
// non-empty, if only by virtue of its own comment delimiters.
2021-05-20 14:20:04 +02:00
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
const blockName = blocks [ 0 ] . name ;
2019-03-07 10:09:59 +01:00
2022-04-11 14:04:30 +02:00
if ( blockName !== ( 0 , external _wp _blocks _namespaceObject . getDefaultBlockName ) ( ) && blockName !== ( 0 , external _wp _blocks _namespaceObject . getFreeformContentHandlerName ) ( ) ) {
return false ;
}
}
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
return ! getEditedPostContent ( state ) ;
}
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns true if the post can be autosaved , or false otherwise .
*
* @ param { Object } state Global application state .
* @ param { Object } autosave A raw autosave object from the REST API .
*
* @ return { boolean } Whether the post can be autosaved .
2021-05-21 12:14:23 +02:00
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const isEditedPostAutosaveable = ( 0 , external _wp _data _namespaceObject . createRegistrySelector ) ( select => state => {
// A post must contain a title, an excerpt, or non-empty content to be valid for autosaving.
if ( ! isEditedPostSaveable ( state ) ) {
return false ;
} // A post is not autosavable when there is a post autosave lock.
2018-12-14 05:41:57 +01:00
2019-03-07 10:09:59 +01:00
2022-04-11 14:04:30 +02:00
if ( isPostAutosavingLocked ( state ) ) {
return false ;
}
2021-04-15 17:19:43 +02:00
2022-04-11 14:04:30 +02:00
const postType = getCurrentPostType ( state ) ;
const postId = getCurrentPostId ( state ) ;
const hasFetchedAutosave = select ( external _wp _coreData _namespaceObject . store ) . hasFetchedAutosaves ( postType , postId ) ;
const currentUserId = ( 0 , external _lodash _namespaceObject . get ) ( select ( external _wp _coreData _namespaceObject . store ) . getCurrentUser ( ) , [ 'id' ] ) ; // Disable reason - this line causes the side-effect of fetching the autosave
// via a resolver, moving below the return would result in the autosave never
// being fetched.
// eslint-disable-next-line @wordpress/no-unused-vars-before-return
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const autosave = select ( external _wp _coreData _namespaceObject . store ) . getAutosave ( postType , postId , currentUserId ) ; // If any existing autosaves have not yet been fetched, this function is
// unable to determine if the post is autosaveable, so return false.
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
if ( ! hasFetchedAutosave ) {
return false ;
} // If we don't already have an autosave, the post is autosaveable.
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
if ( ! autosave ) {
return true ;
} // To avoid an expensive content serialization, use the content dirtiness
// flag in place of content field comparison against the known autosave.
// This is not strictly accurate, and relies on a tolerance toward autosave
// request failures for unnecessary saves.
2020-10-20 15:36:16 +02:00
2021-04-15 17:19:43 +02:00
2022-04-11 14:04:30 +02:00
if ( hasChangedContent ( state ) ) {
return true ;
} // If the title or excerpt has changed, the post is autosaveable.
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
return [ 'title' , 'excerpt' ] . some ( field => getPostRawValue ( autosave [ field ] ) !== getEditedPostAttribute ( state , field ) ) ;
} ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Return true if the post being edited is being scheduled . Preferring the
* unsaved status values .
*
* @ param { Object } state Global application state .
*
* @ return { boolean } Whether the post has been published .
2021-05-21 12:14:23 +02:00
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
function isEditedPostBeingScheduled ( state ) {
2022-04-12 17:12:47 +02:00
const date = getEditedPostAttribute ( state , 'date' ) ; // Offset the date by one minute (network latency).
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const checkedDate = new Date ( Number ( ( 0 , external _wp _date _namespaceObject . getDate ) ( date ) ) - ONE _MINUTE _IN _MS ) ;
return ( 0 , external _wp _date _namespaceObject . isInTheFuture ) ( checkedDate ) ;
}
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns whether the current post should be considered to have a "floating"
* date ( i . e . that it would publish "Immediately" rather than at a set time ) .
*
* Unlike in the PHP backend , the REST API returns a full date string for posts
* where the 0000 - 00 - 00 T00 : 00 : 00 placeholder is present in the database . To
* infer that a post is set to publish "Immediately" we check whether the date
* and modified date are the same .
*
* @ param { Object } state Editor state .
*
* @ return { boolean } Whether the edited post has a floating date value .
2021-05-21 12:14:23 +02:00
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
function isEditedPostDateFloating ( state ) {
const date = getEditedPostAttribute ( state , 'date' ) ;
const modified = getEditedPostAttribute ( state , 'modified' ) ; // This should be the status of the persisted post
// It shouldn't use the "edited" status otherwise it breaks the
// inferred post data floating status
2022-04-12 17:12:47 +02:00
// See https://github.com/WordPress/gutenberg/issues/28083.
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const status = getCurrentPost ( state ) . status ;
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
if ( status === 'draft' || status === 'auto-draft' || status === 'pending' ) {
return date === modified || date === null ;
}
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
return false ;
}
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns true if the post is currently being saved , or false otherwise .
*
* @ param { Object } state Global application state .
*
* @ return { boolean } Whether post is being saved .
2021-05-21 12:14:23 +02:00
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const isSavingPost = ( 0 , external _wp _data _namespaceObject . createRegistrySelector ) ( select => state => {
const postType = getCurrentPostType ( state ) ;
const postId = getCurrentPostId ( state ) ;
return select ( external _wp _coreData _namespaceObject . store ) . isSavingEntityRecord ( 'postType' , postType , postId ) ;
} ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns true if non - post entities are currently being saved , or false otherwise .
*
* @ param { Object } state Global application state .
*
* @ return { boolean } Whether non - post entities are being saved .
2021-05-21 12:14:23 +02:00
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const isSavingNonPostEntityChanges = ( 0 , external _wp _data _namespaceObject . createRegistrySelector ) ( select => state => {
const entitiesBeingSaved = select ( external _wp _coreData _namespaceObject . store ) . _ _experimentalGetEntitiesBeingSaved ( ) ;
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const {
type ,
id
} = getCurrentPost ( state ) ;
return ( 0 , external _lodash _namespaceObject . some ) ( entitiesBeingSaved , entityRecord => entityRecord . kind !== 'postType' || entityRecord . name !== type || entityRecord . key !== id ) ;
} ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns true if a previous post save was attempted successfully , or false
* otherwise .
*
* @ param { Object } state Global application state .
*
* @ return { boolean } Whether the post was saved successfully .
2021-05-21 12:14:23 +02:00
* /
2021-04-15 17:19:43 +02:00
2022-04-11 14:04:30 +02:00
const didPostSaveRequestSucceed = ( 0 , external _wp _data _namespaceObject . createRegistrySelector ) ( select => state => {
const postType = getCurrentPostType ( state ) ;
const postId = getCurrentPostId ( state ) ;
return ! select ( external _wp _coreData _namespaceObject . store ) . getLastEntitySaveError ( 'postType' , postType , postId ) ;
} ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns true if a previous post save was attempted but failed , or false
* otherwise .
*
* @ param { Object } state Global application state .
*
* @ return { boolean } Whether the post save failed .
2021-05-21 12:14:23 +02:00
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const didPostSaveRequestFail = ( 0 , external _wp _data _namespaceObject . createRegistrySelector ) ( select => state => {
const postType = getCurrentPostType ( state ) ;
const postId = getCurrentPostId ( state ) ;
return ! ! select ( external _wp _coreData _namespaceObject . store ) . getLastEntitySaveError ( 'postType' , postType , postId ) ;
} ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns true if the post is autosaving , or false otherwise .
*
* @ param { Object } state Global application state .
*
* @ return { boolean } Whether the post is autosaving .
2021-05-21 12:14:23 +02:00
* /
2022-04-11 14:04:30 +02:00
function isAutosavingPost ( state ) {
if ( ! isSavingPost ( state ) ) {
return false ;
}
return ! ! ( 0 , external _lodash _namespaceObject . get ) ( state . saving , [ 'options' , 'isAutosave' ] ) ;
}
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns true if the post is being previewed , or false otherwise .
2021-05-21 12:14:23 +02:00
*
* @ param { Object } state Global application state .
*
2022-04-11 14:04:30 +02:00
* @ return { boolean } Whether the post is being previewed .
2021-05-21 12:14:23 +02:00
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
function isPreviewingPost ( state ) {
if ( ! isSavingPost ( state ) ) {
return false ;
}
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
return ! ! ( 0 , external _lodash _namespaceObject . get ) ( state . saving , [ 'options' , 'isPreview' ] ) ;
2021-05-21 12:14:23 +02:00
}
2020-10-20 15:36:16 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns the post preview link
2021-05-21 12:14:23 +02:00
*
* @ param { Object } state Global application state .
*
2022-04-11 14:04:30 +02:00
* @ return { string ? } Preview Link .
2021-05-21 12:14:23 +02:00
* /
2022-04-11 14:04:30 +02:00
function getEditedPostPreviewLink ( state ) {
if ( state . saving . pending || isSavingPost ( state ) ) {
return ;
}
2021-05-21 12:14:23 +02:00
2022-04-12 17:12:47 +02:00
let previewLink = getAutosaveAttribute ( state , 'preview_link' ) ; // Fix for issue: https://github.com/WordPress/gutenberg/issues/33616
// If the post is draft, ignore the preview link from the autosave record,
// because the preview could be a stale autosave if the post was switched from
// published to draft.
// See: https://github.com/WordPress/gutenberg/pull/37952.
2021-05-21 12:14:23 +02:00
2022-04-12 17:12:47 +02:00
if ( ! previewLink || 'draft' === getCurrentPost ( state ) . status ) {
2022-04-11 14:04:30 +02:00
previewLink = getEditedPostAttribute ( state , 'link' ) ;
if ( previewLink ) {
previewLink = ( 0 , external _wp _url _namespaceObject . addQueryArgs ) ( previewLink , {
preview : true
} ) ;
}
}
const featuredImageId = getEditedPostAttribute ( state , 'featured_media' ) ;
if ( previewLink && featuredImageId ) {
return ( 0 , external _wp _url _namespaceObject . addQueryArgs ) ( previewLink , {
_thumbnail _id : featuredImageId
} ) ;
}
return previewLink ;
}
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns a suggested post format for the current post , inferred only if there
* is a single block within the post and it is of a type known to match a
* default post format . Returns null if the format cannot be determined .
2021-05-21 12:14:23 +02:00
*
* @ param { Object } state Global application state .
*
2022-04-11 14:04:30 +02:00
* @ return { ? string } Suggested post format .
2020-10-20 15:36:16 +02:00
* /
2022-04-11 14:04:30 +02:00
function getSuggestedPostFormat ( state ) {
const blocks = getEditorBlocks ( state ) ;
if ( blocks . length > 2 ) return null ;
let name ; // If there is only one block in the content of the post grab its name
// so we can derive a suitable post format from it.
2019-03-07 10:09:59 +01:00
2022-04-11 14:04:30 +02:00
if ( blocks . length === 1 ) {
2022-04-12 17:12:47 +02:00
name = blocks [ 0 ] . name ; // Check for core/embed `video` and `audio` eligible suggestions.
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
if ( name === 'core/embed' ) {
var _blocks$0$attributes ;
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const provider = ( _blocks$0$attributes = blocks [ 0 ] . attributes ) === null || _blocks$0$attributes === void 0 ? void 0 : _blocks$0$attributes . providerNameSlug ;
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
if ( [ 'youtube' , 'vimeo' ] . includes ( provider ) ) {
name = 'core/video' ;
} else if ( [ 'spotify' , 'soundcloud' ] . includes ( provider ) ) {
name = 'core/audio' ;
}
}
} // If there are two blocks in the content and the last one is a text blocks
// grab the name of the first one to also suggest a post format from it.
if ( blocks . length === 2 && blocks [ 1 ] . name === 'core/paragraph' ) {
name = blocks [ 0 ] . name ;
} // We only convert to default post formats in core.
switch ( name ) {
case 'core/image' :
return 'image' ;
case 'core/quote' :
case 'core/pullquote' :
return 'quote' ;
case 'core/gallery' :
return 'gallery' ;
case 'core/video' :
return 'video' ;
case 'core/audio' :
return 'audio' ;
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
default :
return null ;
}
2021-05-21 12:14:23 +02:00
}
2021-11-08 15:29:21 +01:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns the content of the post being edited .
2021-11-08 15:29:21 +01:00
*
* @ param { Object } state Global application state .
*
2022-04-11 14:04:30 +02:00
* @ return { string } Post content .
2021-11-08 15:29:21 +01:00
* /
2022-04-11 14:04:30 +02:00
const getEditedPostContent = ( 0 , external _wp _data _namespaceObject . createRegistrySelector ) ( select => state => {
const postId = getCurrentPostId ( state ) ;
const postType = getCurrentPostType ( state ) ;
const record = select ( external _wp _coreData _namespaceObject . store ) . getEditedEntityRecord ( 'postType' , postType , postId ) ;
2021-11-08 15:29:21 +01:00
2022-04-11 14:04:30 +02:00
if ( record ) {
if ( typeof record . content === 'function' ) {
return record . content ( record ) ;
} else if ( record . blocks ) {
return ( 0 , external _wp _blocks _namespaceObject . _ _unstableSerializeAndClean ) ( record . blocks ) ;
} else if ( record . content ) {
return record . content ;
}
}
2021-11-08 15:29:21 +01:00
2022-04-11 14:04:30 +02:00
return '' ;
2021-11-08 15:29:21 +01:00
} ) ;
2021-01-28 03:04:13 +01:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns true if the post is being published , or false otherwise .
*
* @ param { Object } state Global application state .
*
* @ return { boolean } Whether post is being published .
2021-01-28 03:04:13 +01:00
* /
2022-04-11 14:04:30 +02:00
function isPublishingPost ( state ) {
return isSavingPost ( state ) && ! isCurrentPostPublished ( state ) && getEditedPostAttribute ( state , 'status' ) === 'publish' ;
}
2021-01-28 03:04:13 +01:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns whether the permalink is editable or not .
*
* @ param { Object } state Editor state .
*
* @ return { boolean } Whether or not the permalink is editable .
2021-05-21 12:14:23 +02:00
* /
2022-04-11 14:04:30 +02:00
function isPermalinkEditable ( state ) {
const permalinkTemplate = getEditedPostAttribute ( state , 'permalink_template' ) ;
return PERMALINK _POSTNAME _REGEX . test ( permalinkTemplate ) ;
}
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns the permalink for the post .
2021-01-28 03:04:13 +01:00
*
2022-04-11 14:04:30 +02:00
* @ param { Object } state Editor state .
2021-05-20 14:20:04 +02:00
*
2022-04-11 14:04:30 +02:00
* @ return { ? string } The permalink , or null if the post is not viewable .
2021-01-28 03:04:13 +01:00
* /
2022-04-11 14:04:30 +02:00
function getPermalink ( state ) {
const permalinkParts = getPermalinkParts ( state ) ;
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
if ( ! permalinkParts ) {
return null ;
2021-05-20 14:20:04 +02:00
}
2022-04-11 14:04:30 +02:00
const {
prefix ,
postName ,
suffix
} = permalinkParts ;
2021-01-28 03:04:13 +01:00
2022-04-11 14:04:30 +02:00
if ( isPermalinkEditable ( state ) ) {
return prefix + postName + suffix ;
2021-05-20 14:20:04 +02:00
}
2022-04-11 14:04:30 +02:00
return prefix ;
}
/ * *
* Returns the slug for the post being edited , preferring a manually edited
* value if one exists , then a sanitized version of the current post title , and
* finally the post ID .
*
* @ param { Object } state Editor state .
*
* @ return { string } The current slug to be displayed in the editor
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
function getEditedPostSlug ( state ) {
2022-04-12 17:12:47 +02:00
return getEditedPostAttribute ( state , 'slug' ) || ( 0 , external _wp _url _namespaceObject . cleanForSlug ) ( getEditedPostAttribute ( state , 'title' ) ) || getCurrentPostId ( state ) ;
2021-05-21 12:14:23 +02:00
}
/ * *
2022-04-11 14:04:30 +02:00
* Returns the permalink for a post , split into it ' s three parts : the prefix ,
* the postName , and the suffix .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ param { Object } state Editor state .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ return { Object } An object containing the prefix , postName , and suffix for
* the permalink , or null if the post is not viewable .
2021-05-21 12:14:23 +02:00
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
function getPermalinkParts ( state ) {
const permalinkTemplate = getEditedPostAttribute ( state , 'permalink_template' ) ;
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
if ( ! permalinkTemplate ) {
return null ;
2021-05-20 14:20:04 +02:00
}
2022-04-11 14:04:30 +02:00
const postName = getEditedPostAttribute ( state , 'slug' ) || getEditedPostAttribute ( state , 'generated_slug' ) ;
const [ prefix , suffix ] = permalinkTemplate . split ( PERMALINK _POSTNAME _REGEX ) ;
return {
prefix ,
postName ,
suffix
2021-05-20 14:20:04 +02:00
} ;
2021-05-21 12:14:23 +02:00
}
/ * *
2022-04-11 14:04:30 +02:00
* Returns whether the post is locked .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ param { Object } state Global application state .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ return { boolean } Is locked .
2021-05-21 12:14:23 +02:00
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
function isPostLocked ( state ) {
return state . postLock . isLocked ;
2021-05-21 12:14:23 +02:00
}
2020-10-20 15:36:16 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns whether post saving is locked .
*
* @ param { Object } state Global application state .
*
* @ return { boolean } Is locked .
2020-10-20 15:36:16 +02:00
* /
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
function isPostSavingLocked ( state ) {
return Object . keys ( state . postSavingLock ) . length > 0 ;
}
2020-10-20 15:36:16 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns whether post autosaving is locked .
*
* @ param { Object } state Global application state .
*
* @ return { boolean } Is locked .
2020-10-20 15:36:16 +02:00
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
function isPostAutosavingLocked ( state ) {
return Object . keys ( state . postAutosavingLock ) . length > 0 ;
}
2018-12-14 05:41:57 +01:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns whether the edition of the post has been taken over .
*
* @ param { Object } state Global application state .
*
* @ return { boolean } Is post lock takeover .
2018-12-14 05:41:57 +01:00
* /
2022-04-11 14:04:30 +02:00
function isPostLockTakeover ( state ) {
return state . postLock . isTakeover ;
}
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns details about the post lock user .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ param { Object } state Global application state .
*
* @ return { Object } A user object .
2021-05-21 12:14:23 +02:00
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
function getPostLockUser ( state ) {
return state . postLock . user ;
}
/ * *
* Returns the active post lock .
*
* @ param { Object } state Global application state .
*
* @ return { Object } The lock object .
* /
2021-11-08 15:29:21 +01:00
2022-04-11 14:04:30 +02:00
function getActivePostLock ( state ) {
return state . postLock . activePostLock ;
}
/ * *
* Returns whether or not the user has the unfiltered _html capability .
*
* @ param { Object } state Editor state .
*
* @ return { boolean } Whether the user can or can ' t post unfiltered HTML .
* /
2021-11-08 15:29:21 +01:00
2022-04-11 14:04:30 +02:00
function canUserUseUnfilteredHTML ( state ) {
return ( 0 , external _lodash _namespaceObject . has ) ( getCurrentPost ( state ) , [ '_links' , 'wp:action-unfiltered-html' ] ) ;
}
/ * *
* Returns whether the pre - publish panel should be shown
* or skipped when the user clicks the "publish" button .
*
* @ return { boolean } Whether the pre - publish panel should be shown or not .
* /
2021-11-08 15:29:21 +01:00
2022-04-12 17:12:47 +02:00
const isPublishSidebarEnabled = ( 0 , external _wp _data _namespaceObject . createRegistrySelector ) ( select => ( ) => ! ! select ( external _wp _preferences _namespaceObject . store ) . get ( 'core/edit-post' , 'isPublishSidebarEnabled' ) ) ;
2019-03-21 13:48:00 +01:00
/ * *
2022-04-11 14:04:30 +02:00
* Return the current block list .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ param { Object } state
* @ return { Array } Block list .
2019-03-21 13:48:00 +01:00
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
function getEditorBlocks ( state ) {
return getEditedPostAttribute ( state , 'blocks' ) || EMPTY _ARRAY ;
2021-05-21 12:14:23 +02:00
}
/ * *
2022-04-11 14:04:30 +02:00
* A block selection object .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ typedef { Object } WPBlockSelection
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ property { string } clientId A block client ID .
* @ property { string } attributeKey A block attribute key .
* @ property { number } offset An attribute value offset , based on the rich
* text value . See ` wp.richText.create ` .
2021-05-21 12:14:23 +02:00
* /
2019-09-19 17:19:18 +02:00
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns the current selection start .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ param { Object } state
* @ return { WPBlockSelection } The selection start .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ deprecated since Gutenberg 10.0 . 0.
2021-05-21 12:14:23 +02:00
* /
2022-04-11 14:04:30 +02:00
function getEditorSelectionStart ( state ) {
var _getEditedPostAttribu ;
external _wp _deprecated _default ( ) ( "select('core/editor').getEditorSelectionStart" , {
2022-04-12 17:12:47 +02:00
since : '5.8' ,
2022-04-11 14:04:30 +02:00
alternative : "select('core/editor').getEditorSelection"
} ) ;
return ( _getEditedPostAttribu = getEditedPostAttribute ( state , 'selection' ) ) === null || _getEditedPostAttribu === void 0 ? void 0 : _getEditedPostAttribu . selectionStart ;
2021-05-21 12:14:23 +02:00
}
2020-10-20 15:36:16 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns the current selection end .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ param { Object } state
* @ return { WPBlockSelection } The selection end .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ deprecated since Gutenberg 10.0 . 0.
2020-10-20 15:36:16 +02:00
* /
2019-03-07 10:09:59 +01:00
2022-04-11 14:04:30 +02:00
function getEditorSelectionEnd ( state ) {
var _getEditedPostAttribu2 ;
external _wp _deprecated _default ( ) ( "select('core/editor').getEditorSelectionStart" , {
2022-04-12 17:12:47 +02:00
since : '5.8' ,
2022-04-11 14:04:30 +02:00
alternative : "select('core/editor').getEditorSelection"
} ) ;
return ( _getEditedPostAttribu2 = getEditedPostAttribute ( state , 'selection' ) ) === null || _getEditedPostAttribu2 === void 0 ? void 0 : _getEditedPostAttribu2 . selectionEnd ;
2021-05-21 12:14:23 +02:00
}
2020-10-20 15:36:16 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns the current selection .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ param { Object } state
* @ return { WPBlockSelection } The selection end .
2020-10-20 15:36:16 +02:00
* /
2019-03-07 10:09:59 +01:00
2022-04-11 14:04:30 +02:00
function getEditorSelection ( state ) {
return getEditedPostAttribute ( state , 'selection' ) ;
2021-05-21 12:14:23 +02:00
}
2019-03-07 10:09:59 +01:00
/ * *
2022-04-11 14:04:30 +02:00
* Is the editor ready
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ param { Object } state
* @ return { boolean } is Ready .
2019-03-07 10:09:59 +01:00
* /
2022-04-11 14:04:30 +02:00
function _ _unstableIsEditorReady ( state ) {
return state . isReady ;
2021-05-21 12:14:23 +02:00
}
2020-10-20 15:36:16 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns the post editor settings .
2021-05-20 14:20:04 +02:00
*
2022-04-11 14:04:30 +02:00
* @ param { Object } state Editor state .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ return { Object } The editor settings object .
2020-10-20 15:36:16 +02:00
* /
2019-03-07 10:09:59 +01:00
2022-04-11 14:04:30 +02:00
function getEditorSettings ( state ) {
return state . editorSettings ;
2021-05-21 12:14:23 +02:00
}
2022-04-11 14:04:30 +02:00
/ *
* Backward compatibility
* /
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns state object prior to a specified optimist transaction ID , or ` null `
* if the transaction corresponding to the given ID cannot be found .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ deprecated since Gutenberg 9.7 . 0.
2021-05-21 12:14:23 +02:00
* /
2021-01-28 03:04:13 +01:00
2022-04-11 14:04:30 +02:00
function getStateBeforeOptimisticTransaction ( ) {
external _wp _deprecated _default ( ) ( "select('core/editor').getStateBeforeOptimisticTransaction" , {
since : '5.7' ,
hint : 'No state history is kept on this store anymore'
} ) ;
return null ;
}
/ * *
* Returns true if an optimistic transaction is pending commit , for which the
* before state satisfies the given predicate function .
*
* @ deprecated since Gutenberg 9.7 . 0.
* /
2021-05-07 13:48:27 +02:00
2022-04-11 14:04:30 +02:00
function inSomeHistory ( ) {
external _wp _deprecated _default ( ) ( "select('core/editor').inSomeHistory" , {
since : '5.7' ,
hint : 'No state history is kept on this store anymore'
} ) ;
return false ;
}
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
function getBlockEditorSelector ( name ) {
return ( 0 , external _wp _data _namespaceObject . createRegistrySelector ) ( select => function ( state ) {
external _wp _deprecated _default ( ) ( "`wp.data.select( 'core/editor' )." + name + '`' , {
since : '5.3' ,
2022-04-12 17:12:47 +02:00
alternative : "`wp.data.select( 'core/block-editor' )." + name + '`' ,
version : '6.2'
2021-05-21 12:14:23 +02:00
} ) ;
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
for ( var _len = arguments . length , args = new Array ( _len > 1 ? _len - 1 : 0 ) , _key = 1 ; _key < _len ; _key ++ ) {
args [ _key - 1 ] = arguments [ _key ] ;
2021-05-21 12:14:23 +02:00
}
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
return select ( external _wp _blockEditor _namespaceObject . store ) [ name ] ( ... args ) ;
} ) ;
}
/ * *
* @ see getBlockName in core / block - editor store .
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const getBlockName = getBlockEditorSelector ( 'getBlockName' ) ;
2020-10-20 15:36:16 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see isBlockValid in core / block - editor store .
2020-10-20 15:36:16 +02:00
* /
2019-03-07 10:09:59 +01:00
2022-04-11 14:04:30 +02:00
const isBlockValid = getBlockEditorSelector ( 'isBlockValid' ) ;
2019-03-07 10:09:59 +01:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see getBlockAttributes in core / block - editor store .
2019-03-07 10:09:59 +01:00
* /
2022-04-11 14:04:30 +02:00
const getBlockAttributes = getBlockEditorSelector ( 'getBlockAttributes' ) ;
/ * *
* @ see getBlock in core / block - editor store .
* /
2021-05-19 17:09:27 +02:00
2022-04-11 14:04:30 +02:00
const getBlock = getBlockEditorSelector ( 'getBlock' ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see getBlocks in core / block - editor store .
2021-05-21 12:14:23 +02:00
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const getBlocks = getBlockEditorSelector ( 'getBlocks' ) ;
/ * *
* @ see getClientIdsOfDescendants in core / block - editor store .
* /
2021-11-15 13:50:17 +01:00
2022-04-11 14:04:30 +02:00
const getClientIdsOfDescendants = getBlockEditorSelector ( 'getClientIdsOfDescendants' ) ;
/ * *
* @ see getClientIdsWithDescendants in core / block - editor store .
* /
const getClientIdsWithDescendants = getBlockEditorSelector ( 'getClientIdsWithDescendants' ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see getGlobalBlockCount in core / block - editor store .
2021-05-21 12:14:23 +02:00
* /
2019-03-07 10:09:59 +01:00
2022-04-11 14:04:30 +02:00
const getGlobalBlockCount = getBlockEditorSelector ( 'getGlobalBlockCount' ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see getBlocksByClientId in core / block - editor store .
2021-05-21 12:14:23 +02:00
* /
2022-04-11 14:04:30 +02:00
const getBlocksByClientId = getBlockEditorSelector ( 'getBlocksByClientId' ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see getBlockCount in core / block - editor store .
2021-05-21 12:14:23 +02:00
* /
2022-04-11 14:04:30 +02:00
const getBlockCount = getBlockEditorSelector ( 'getBlockCount' ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see getBlockSelectionStart in core / block - editor store .
2021-05-21 12:14:23 +02:00
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const getBlockSelectionStart = getBlockEditorSelector ( 'getBlockSelectionStart' ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see getBlockSelectionEnd in core / block - editor store .
2021-05-21 12:14:23 +02:00
* /
2021-05-19 17:09:27 +02:00
2022-04-11 14:04:30 +02:00
const getBlockSelectionEnd = getBlockEditorSelector ( 'getBlockSelectionEnd' ) ;
2021-05-20 14:20:04 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see getSelectedBlockCount in core / block - editor store .
2021-05-20 14:20:04 +02:00
* /
2021-05-19 17:09:27 +02:00
2022-04-11 14:04:30 +02:00
const getSelectedBlockCount = getBlockEditorSelector ( 'getSelectedBlockCount' ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see hasSelectedBlock in core / block - editor store .
2021-05-21 12:14:23 +02:00
* /
2019-03-07 10:09:59 +01:00
2022-04-11 14:04:30 +02:00
const hasSelectedBlock = getBlockEditorSelector ( 'hasSelectedBlock' ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see getSelectedBlockClientId in core / block - editor store .
2021-05-21 12:14:23 +02:00
* /
2019-03-07 10:09:59 +01:00
2022-04-11 14:04:30 +02:00
const getSelectedBlockClientId = getBlockEditorSelector ( 'getSelectedBlockClientId' ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see getSelectedBlock in core / block - editor store .
2021-05-21 12:14:23 +02:00
* /
2019-03-07 10:09:59 +01:00
2022-04-11 14:04:30 +02:00
const getSelectedBlock = getBlockEditorSelector ( 'getSelectedBlock' ) ;
2019-03-21 13:48:00 +01:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see getBlockRootClientId in core / block - editor store .
2019-03-21 13:48:00 +01:00
* /
2019-03-07 10:09:59 +01:00
2022-04-11 14:04:30 +02:00
const getBlockRootClientId = getBlockEditorSelector ( 'getBlockRootClientId' ) ;
2019-03-21 13:48:00 +01:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see getBlockHierarchyRootClientId in core / block - editor store .
2019-03-21 13:48:00 +01:00
* /
2022-04-11 14:04:30 +02:00
const getBlockHierarchyRootClientId = getBlockEditorSelector ( 'getBlockHierarchyRootClientId' ) ;
/ * *
* @ see getAdjacentBlockClientId in core / block - editor store .
* /
2020-10-20 15:36:16 +02:00
2022-04-11 14:04:30 +02:00
const getAdjacentBlockClientId = getBlockEditorSelector ( 'getAdjacentBlockClientId' ) ;
/ * *
* @ see getPreviousBlockClientId in core / block - editor store .
* /
2020-10-20 15:36:16 +02:00
2022-04-11 14:04:30 +02:00
const getPreviousBlockClientId = getBlockEditorSelector ( 'getPreviousBlockClientId' ) ;
/ * *
* @ see getNextBlockClientId in core / block - editor store .
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const getNextBlockClientId = getBlockEditorSelector ( 'getNextBlockClientId' ) ;
/ * *
* @ see getSelectedBlocksInitialCaretPosition in core / block - editor store .
* /
2020-10-20 15:36:16 +02:00
2022-04-11 14:04:30 +02:00
const getSelectedBlocksInitialCaretPosition = getBlockEditorSelector ( 'getSelectedBlocksInitialCaretPosition' ) ;
/ * *
* @ see getMultiSelectedBlockClientIds in core / block - editor store .
* /
2020-10-20 15:36:16 +02:00
2022-04-11 14:04:30 +02:00
const getMultiSelectedBlockClientIds = getBlockEditorSelector ( 'getMultiSelectedBlockClientIds' ) ;
/ * *
* @ see getMultiSelectedBlocks in core / block - editor store .
2021-05-21 12:14:23 +02:00
* /
2020-10-20 15:36:16 +02:00
2022-04-11 14:04:30 +02:00
const getMultiSelectedBlocks = getBlockEditorSelector ( 'getMultiSelectedBlocks' ) ;
2019-03-21 13:48:00 +01:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see getFirstMultiSelectedBlockClientId in core / block - editor store .
2019-03-21 13:48:00 +01:00
* /
2022-04-11 14:04:30 +02:00
const getFirstMultiSelectedBlockClientId = getBlockEditorSelector ( 'getFirstMultiSelectedBlockClientId' ) ;
/ * *
* @ see getLastMultiSelectedBlockClientId in core / block - editor store .
* /
2021-11-15 13:50:17 +01:00
2022-04-11 14:04:30 +02:00
const getLastMultiSelectedBlockClientId = getBlockEditorSelector ( 'getLastMultiSelectedBlockClientId' ) ;
/ * *
* @ see isFirstMultiSelectedBlock in core / block - editor store .
* /
2021-11-15 13:50:17 +01:00
2022-04-11 14:04:30 +02:00
const isFirstMultiSelectedBlock = getBlockEditorSelector ( 'isFirstMultiSelectedBlock' ) ;
2021-05-20 14:20:04 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see isBlockMultiSelected in core / block - editor store .
* /
const isBlockMultiSelected = getBlockEditorSelector ( 'isBlockMultiSelected' ) ;
/ * *
* @ see isAncestorMultiSelected in core / block - editor store .
2021-05-20 14:20:04 +02:00
* /
2019-03-07 10:09:59 +01:00
2022-04-11 14:04:30 +02:00
const isAncestorMultiSelected = getBlockEditorSelector ( 'isAncestorMultiSelected' ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see getMultiSelectedBlocksStartClientId in core / block - editor store .
2021-05-21 12:14:23 +02:00
* /
2019-03-21 13:48:00 +01:00
2022-04-11 14:04:30 +02:00
const getMultiSelectedBlocksStartClientId = getBlockEditorSelector ( 'getMultiSelectedBlocksStartClientId' ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see getMultiSelectedBlocksEndClientId in core / block - editor store .
2021-05-21 12:14:23 +02:00
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const getMultiSelectedBlocksEndClientId = getBlockEditorSelector ( 'getMultiSelectedBlocksEndClientId' ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see getBlockOrder in core / block - editor store .
2021-05-21 12:14:23 +02:00
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const getBlockOrder = getBlockEditorSelector ( 'getBlockOrder' ) ;
2019-03-07 10:09:59 +01:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see getBlockIndex in core / block - editor store .
2019-03-07 10:09:59 +01:00
* /
2022-04-11 14:04:30 +02:00
const getBlockIndex = getBlockEditorSelector ( 'getBlockIndex' ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see isBlockSelected in core / block - editor store .
2021-05-21 12:14:23 +02:00
* /
2020-10-20 15:36:16 +02:00
2022-04-11 14:04:30 +02:00
const isBlockSelected = getBlockEditorSelector ( 'isBlockSelected' ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see hasSelectedInnerBlock in core / block - editor store .
2021-05-21 12:14:23 +02:00
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const hasSelectedInnerBlock = getBlockEditorSelector ( 'hasSelectedInnerBlock' ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see isBlockWithinSelection in core / block - editor store .
2021-05-21 12:14:23 +02:00
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const isBlockWithinSelection = getBlockEditorSelector ( 'isBlockWithinSelection' ) ;
2021-05-20 14:20:04 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see hasMultiSelection in core / block - editor store .
2021-05-20 14:20:04 +02:00
* /
2022-04-11 14:04:30 +02:00
const hasMultiSelection = getBlockEditorSelector ( 'hasMultiSelection' ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see isMultiSelecting in core / block - editor store .
2021-05-21 12:14:23 +02:00
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const isMultiSelecting = getBlockEditorSelector ( 'isMultiSelecting' ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see isSelectionEnabled in core / block - editor store .
2021-05-21 12:14:23 +02:00
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const isSelectionEnabled = getBlockEditorSelector ( 'isSelectionEnabled' ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see getBlockMode in core / block - editor store .
2021-05-21 12:14:23 +02:00
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const getBlockMode = getBlockEditorSelector ( 'getBlockMode' ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see isTyping in core / block - editor store .
2021-05-21 12:14:23 +02:00
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const isTyping = getBlockEditorSelector ( 'isTyping' ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see isCaretWithinFormattedText in core / block - editor store .
2021-05-21 12:14:23 +02:00
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const isCaretWithinFormattedText = getBlockEditorSelector ( 'isCaretWithinFormattedText' ) ;
2019-03-21 13:48:00 +01:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see getBlockInsertionPoint in core / block - editor store .
2019-03-21 13:48:00 +01:00
* /
2022-04-11 14:04:30 +02:00
const getBlockInsertionPoint = getBlockEditorSelector ( 'getBlockInsertionPoint' ) ;
2020-10-20 15:36:16 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see isBlockInsertionPointVisible in core / block - editor store .
2020-10-20 15:36:16 +02:00
* /
2019-03-21 13:48:00 +01:00
2022-04-11 14:04:30 +02:00
const isBlockInsertionPointVisible = getBlockEditorSelector ( 'isBlockInsertionPointVisible' ) ;
2020-06-26 15:33:47 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see isValidTemplate in core / block - editor store .
2020-06-26 15:33:47 +02:00
* /
2022-04-11 14:04:30 +02:00
const isValidTemplate = getBlockEditorSelector ( 'isValidTemplate' ) ;
2018-12-14 05:41:57 +01:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see getTemplate in core / block - editor store .
2018-12-14 05:41:57 +01:00
* /
2022-04-11 14:04:30 +02:00
const getTemplate = getBlockEditorSelector ( 'getTemplate' ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see getTemplateLock in core / block - editor store .
2021-05-21 12:14:23 +02:00
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const getTemplateLock = getBlockEditorSelector ( 'getTemplateLock' ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see canInsertBlockType in core / block - editor store .
2021-05-21 12:14:23 +02:00
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const canInsertBlockType = getBlockEditorSelector ( 'canInsertBlockType' ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see getInserterItems in core / block - editor store .
2021-05-21 12:14:23 +02:00
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const getInserterItems = getBlockEditorSelector ( 'getInserterItems' ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see hasInserterItems in core / block - editor store .
2021-05-21 12:14:23 +02:00
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const hasInserterItems = getBlockEditorSelector ( 'hasInserterItems' ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see getBlockListSettings in core / block - editor store .
2021-05-21 12:14:23 +02:00
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const getBlockListSettings = getBlockEditorSelector ( 'getBlockListSettings' ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns the default template types .
*
* @ param { Object } state Global application state .
*
* @ return { Object } The template types .
2021-05-21 12:14:23 +02:00
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
function _ _experimentalGetDefaultTemplateTypes ( state ) {
var _getEditorSettings ;
return ( _getEditorSettings = getEditorSettings ( state ) ) === null || _getEditorSettings === void 0 ? void 0 : _getEditorSettings . defaultTemplateTypes ;
}
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns the default template part areas .
*
* @ param { Object } state Global application state .
*
* @ return { Array } The template part areas .
2021-05-21 12:14:23 +02:00
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const _ _experimentalGetDefaultTemplatePartAreas = rememo ( state => {
var _getEditorSettings2 ;
const areas = ( ( _getEditorSettings2 = getEditorSettings ( state ) ) === null || _getEditorSettings2 === void 0 ? void 0 : _getEditorSettings2 . defaultTemplatePartAreas ) || [ ] ;
return areas === null || areas === void 0 ? void 0 : areas . map ( item => {
return { ... item ,
icon : getTemplatePartIcon ( item . icon )
} ;
} ) ;
} , state => {
var _getEditorSettings3 ;
return [ ( _getEditorSettings3 = getEditorSettings ( state ) ) === null || _getEditorSettings3 === void 0 ? void 0 : _getEditorSettings3 . defaultTemplatePartAreas ] ;
} ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns a default template type searched by slug .
*
* @ param { Object } state Global application state .
* @ param { string } slug The template type slug .
*
* @ return { Object } The template type .
2021-05-21 12:14:23 +02:00
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const _ _experimentalGetDefaultTemplateType = rememo ( ( state , slug ) => ( 0 , external _lodash _namespaceObject . find ) ( _ _experimentalGetDefaultTemplateTypes ( state ) , {
slug
} ) || { } , ( state , slug ) => [ _ _experimentalGetDefaultTemplateTypes ( state ) , slug ] ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Given a template entity , return information about it which is ready to be
* rendered , such as the title , description , and icon .
*
* @ param { Object } state Global application state .
* @ param { Object } template The template for which we need information .
* @ return { Object } Information about the template , including title , description , and icon .
2021-05-21 12:14:23 +02:00
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
function _ _experimentalGetTemplateInfo ( state , template ) {
var _experimentalGetDefa ;
if ( ! template ) {
return { } ;
}
const {
excerpt ,
slug ,
title ,
area
} = template ;
const {
title : defaultTitle ,
description : defaultDescription
} = _ _experimentalGetDefaultTemplateType ( state , slug ) ;
const templateTitle = ( 0 , external _lodash _namespaceObject . isString ) ( title ) ? title : title === null || title === void 0 ? void 0 : title . rendered ;
const templateDescription = ( 0 , external _lodash _namespaceObject . isString ) ( excerpt ) ? excerpt : excerpt === null || excerpt === void 0 ? void 0 : excerpt . raw ;
const templateIcon = ( ( _experimentalGetDefa = _ _experimentalGetDefaultTemplatePartAreas ( state ) . find ( item => area === item . area ) ) === null || _experimentalGetDefa === void 0 ? void 0 : _experimentalGetDefa . icon ) || library _layout ;
return {
title : templateTitle && templateTitle !== slug ? templateTitle : defaultTitle || slug ,
description : templateDescription || defaultDescription ,
icon : templateIcon
} ;
}
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns a post type label depending on the current post .
*
* @ param { Object } state Global application state .
*
* @ return { string | undefined } The post type label if available , otherwise undefined .
2021-05-21 12:14:23 +02:00
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const getPostTypeLabel = ( 0 , external _wp _data _namespaceObject . createRegistrySelector ) ( select => state => {
var _postType$labels ;
const currentPostType = getCurrentPostType ( state ) ;
const postType = select ( external _wp _coreData _namespaceObject . store ) . getPostType ( currentPostType ) ; // Disable reason: Post type labels object is shaped like this.
// eslint-disable-next-line camelcase
return postType === null || postType === void 0 ? void 0 : ( _postType$labels = postType . labels ) === null || _postType$labels === void 0 ? void 0 : _postType$labels . singular _name ;
} ) ;
2022-04-12 17:12:47 +02:00
; // CONCATENATED MODULE: external ["wp","apiFetch"]
var external _wp _apiFetch _namespaceObject = window [ "wp" ] [ "apiFetch" ] ;
var external _wp _apiFetch _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( external _wp _apiFetch _namespaceObject ) ;
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: external ["wp","notices"]
var external _wp _notices _namespaceObject = window [ "wp" ] [ "notices" ] ;
2022-04-12 17:12:47 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/local-autosave.js
/ * *
* Function returning a sessionStorage key to set or retrieve a given post ' s
* automatic session backup .
*
* Keys are crucially prefixed with 'wp-autosave-' so that wp - login . php ' s
* ` loggedout ` handler can clear sessionStorage of any user - private content .
*
* @ see https : //github.com/WordPress/wordpress-develop/blob/6dad32d2aed47e6c0cf2aee8410645f6d7aba6bd/src/wp-login.php#L103
*
* @ param { string } postId Post ID .
* @ param { boolean } isPostNew Whether post new .
*
* @ return { string } sessionStorage key
* /
function postKey ( postId , isPostNew ) {
return ` wp-autosave-block-editor-post- ${ isPostNew ? 'auto-draft' : postId } ` ;
}
function localAutosaveGet ( postId , isPostNew ) {
return window . sessionStorage . getItem ( postKey ( postId , isPostNew ) ) ;
}
function localAutosaveSet ( postId , isPostNew , title , content , excerpt ) {
window . sessionStorage . setItem ( postKey ( postId , isPostNew ) , JSON . stringify ( {
post _title : title ,
content ,
excerpt
} ) ) ;
}
function localAutosaveClear ( postId , isPostNew ) {
window . sessionStorage . removeItem ( postKey ( postId , isPostNew ) ) ;
}
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: external ["wp","i18n"]
var external _wp _i18n _namespaceObject = window [ "wp" ] [ "i18n" ] ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/utils/notice-builder.js
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* WordPress dependencies
2021-05-21 12:14:23 +02:00
* /
2021-05-20 14:20:04 +02:00
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Internal dependencies
2021-05-21 12:14:23 +02:00
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* External dependencies
2021-05-21 12:14:23 +02:00
* /
2021-05-20 14:20:04 +02:00
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Builds the arguments for a success notification dispatch .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ param { Object } data Incoming data to build the arguments from .
2021-11-08 15:29:21 +01:00
*
2022-04-11 14:04:30 +02:00
* @ return { Array } Arguments for dispatch . An empty array signals no
* notification should be sent .
2021-05-21 12:14:23 +02:00
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
function getNotificationArgumentsForSaveSuccess ( data ) {
const {
previousPost ,
post ,
postType
} = data ; // Autosaves are neither shown a notice nor redirected.
if ( ( 0 , external _lodash _namespaceObject . get ) ( data . options , [ 'isAutosave' ] ) ) {
return [ ] ;
2022-04-12 17:12:47 +02:00
} // No notice is shown after trashing a post
if ( post . status === 'trash' && previousPost . status !== 'trash' ) {
return [ ] ;
2021-05-21 12:14:23 +02:00
}
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
const publishStatus = [ 'publish' , 'private' , 'future' ] ;
const isPublished = ( 0 , external _lodash _namespaceObject . includes ) ( publishStatus , previousPost . status ) ;
const willPublish = ( 0 , external _lodash _namespaceObject . includes ) ( publishStatus , post . status ) ;
let noticeMessage ;
2022-04-12 17:12:47 +02:00
let shouldShowLink = ( 0 , external _lodash _namespaceObject . get ) ( postType , [ 'viewable' ] , false ) ;
let isDraft ; // Always should a notice, which will be spoken for accessibility.
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
if ( ! isPublished && ! willPublish ) {
// If saving a non-published post, don't show notice.
2022-04-12 17:12:47 +02:00
noticeMessage = ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Draft saved.' ) ;
isDraft = true ;
2022-04-11 14:04:30 +02:00
} else if ( isPublished && ! willPublish ) {
2022-04-12 17:12:47 +02:00
// If undoing publish status, show specific notice.
2022-04-11 14:04:30 +02:00
noticeMessage = postType . labels . item _reverted _to _draft ;
shouldShowLink = false ;
} else if ( ! isPublished && willPublish ) {
// If publishing or scheduling a post, show the corresponding
2022-04-12 17:12:47 +02:00
// publish message.
2022-04-11 14:04:30 +02:00
noticeMessage = {
publish : postType . labels . item _published ,
private : postType . labels . item _published _privately ,
future : postType . labels . item _scheduled
} [ post . status ] ;
} else {
2022-04-12 17:12:47 +02:00
// Generic fallback notice.
2022-04-11 14:04:30 +02:00
noticeMessage = postType . labels . item _updated ;
}
const actions = [ ] ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
if ( shouldShowLink ) {
actions . push ( {
2022-04-12 17:12:47 +02:00
label : isDraft ? ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'View Preview' ) : postType . labels . view _item ,
2022-04-11 14:04:30 +02:00
url : post . link
} ) ;
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
return [ noticeMessage , {
id : SAVE _POST _NOTICE _ID ,
type : 'snackbar' ,
actions
} ] ;
}
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Builds the fail notification arguments for dispatch .
*
* @ param { Object } data Incoming data to build the arguments with .
*
* @ return { Array } Arguments for dispatch . An empty array signals no
* notification should be sent .
2021-05-21 12:14:23 +02:00
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
function getNotificationArgumentsForSaveFail ( data ) {
const {
post ,
edits ,
error
} = data ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
if ( error && 'rest_autosave_no_changes' === error . code ) {
// Autosave requested a new autosave, but there were no changes. This shouldn't
// result in an error notice for the user.
return [ ] ;
}
2018-12-18 04:14:52 +01:00
2022-04-11 14:04:30 +02:00
const publishStatus = [ 'publish' , 'private' , 'future' ] ;
const isPublished = publishStatus . indexOf ( post . status ) !== - 1 ; // If the post was being published, we show the corresponding publish error message
2022-04-12 17:12:47 +02:00
// Unless we publish an "updating failed" message.
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
const messages = {
publish : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Publishing failed.' ) ,
private : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Publishing failed.' ) ,
future : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Scheduling failed.' )
} ;
let noticeMessage = ! isPublished && publishStatus . indexOf ( edits . status ) !== - 1 ? messages [ edits . status ] : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Updating failed.' ) ; // Check if message string contains HTML. Notice text is currently only
// supported as plaintext, and stripping the tags may muddle the meaning.
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
if ( error . message && ! /<\/?[^>]*>/ . test ( error . message ) ) {
noticeMessage = [ noticeMessage , error . message ] . join ( ' ' ) ;
2021-05-19 17:09:27 +02:00
}
2022-04-11 14:04:30 +02:00
return [ noticeMessage , {
id : SAVE _POST _NOTICE _ID
} ] ;
}
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Builds the trash fail notification arguments for dispatch .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ param { Object } data
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ return { Array } Arguments for dispatch .
2021-05-21 12:14:23 +02:00
* /
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
function getNotificationArgumentsForTrashFail ( data ) {
return [ data . error . message && data . error . code !== 'unknown_error' ? data . error . message : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Trashing failed' ) , {
id : TRASH _POST _NOTICE _ID
} ] ;
}
2021-11-08 15:29:21 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/actions.js
2021-11-08 15:29:21 +01:00
/ * *
* External dependencies
* /
/ * *
* WordPress dependencies
* /
2022-04-11 14:04:30 +02:00
2021-11-08 15:29:21 +01:00
/ * *
* Internal dependencies
* /
2022-04-12 17:12:47 +02:00
2021-11-08 15:29:21 +01:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns an action generator used in signalling that editor has initialized with
* the specified post object and editor settings .
2021-11-08 15:29:21 +01:00
*
2022-04-11 14:04:30 +02:00
* @ param { Object } post Post object .
* @ param { Object } edits Initial edited attributes object .
* @ param { Array ? } template Block Template .
2021-11-08 15:29:21 +01:00
* /
2022-04-12 17:12:47 +02:00
const setupEditor = ( post , edits , template ) => _ref => {
let {
dispatch
} = _ref ;
dispatch . setupEditorState ( post ) ; // Apply a template for new posts only, if exists.
2021-11-08 15:29:21 +01:00
2022-04-11 14:04:30 +02:00
const isNewPost = post . status === 'auto-draft' ;
2021-11-08 15:29:21 +01:00
2022-04-11 14:04:30 +02:00
if ( isNewPost && template ) {
// In order to ensure maximum of a single parse during setup, edits are
// included as part of editor setup action. Assume edited content as
// canonical if provided, falling back to post.
let content ;
2021-11-08 15:29:21 +01:00
2022-04-11 14:04:30 +02:00
if ( ( 0 , external _lodash _namespaceObject . has ) ( edits , [ 'content' ] ) ) {
content = edits . content ;
} else {
content = post . content . raw ;
2021-11-08 15:29:21 +01:00
}
2022-04-11 14:04:30 +02:00
let blocks = ( 0 , external _wp _blocks _namespaceObject . parse ) ( content ) ;
blocks = ( 0 , external _wp _blocks _namespaceObject . synchronizeBlocksWithTemplate ) ( blocks , template ) ;
2022-04-12 17:12:47 +02:00
dispatch . resetEditorBlocks ( blocks , {
2022-04-11 14:04:30 +02:00
_ _unstableShouldCreateUndoLevel : false
} ) ;
2021-11-08 15:29:21 +01:00
}
2022-04-12 17:12:47 +02:00
if ( edits && Object . values ( edits ) . some ( _ref2 => {
var _post$key$raw , _post$key ;
let [ key , edit ] = _ref2 ;
return edit !== ( ( _post$key$raw = ( _post$key = post [ key ] ) === null || _post$key === void 0 ? void 0 : _post$key . raw ) !== null && _post$key$raw !== void 0 ? _post$key$raw : post [ key ] ) ;
} ) ) {
dispatch . editPost ( edits ) ;
2022-04-11 14:04:30 +02:00
}
2022-04-12 17:12:47 +02:00
} ;
2021-11-08 15:29:21 +01:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns an action object signalling that the editor is being destroyed and
* that any necessary state or side - effect cleanup should occur .
*
* @ return { Object } Action object .
2021-11-08 15:29:21 +01:00
* /
2022-04-11 14:04:30 +02:00
function _ _experimentalTearDownEditor ( ) {
return {
type : 'TEAR_DOWN_EDITOR'
} ;
2021-11-08 15:29:21 +01:00
}
/ * *
2022-04-11 14:04:30 +02:00
* Returns an action object used in signalling that the latest version of the
* post has been received , either by initialization or save .
2021-11-08 15:29:21 +01:00
*
2022-04-12 17:12:47 +02:00
* @ deprecated Since WordPress 6.0 .
2021-11-08 15:29:21 +01:00
* /
2022-04-12 17:12:47 +02:00
function resetPost ( ) {
external _wp _deprecated _default ( ) ( "wp.data.dispatch( 'core/editor' ).resetPost" , {
since : '6.0' ,
version : '6.3' ,
alternative : 'Initialize the editor with the setupEditorState action'
} ) ;
2022-04-11 14:04:30 +02:00
return {
2022-04-12 17:12:47 +02:00
type : 'DO_NOTHING'
2022-04-11 14:04:30 +02:00
} ;
2021-11-08 15:29:21 +01:00
}
/ * *
2022-04-11 14:04:30 +02:00
* Returns an action object used in signalling that a patch of updates for the
* latest version of the post have been received .
*
* @ return { Object } Action object .
* @ deprecated since Gutenberg 9.7 . 0.
2021-11-08 15:29:21 +01:00
* /
2022-04-11 14:04:30 +02:00
function updatePost ( ) {
external _wp _deprecated _default ( ) ( "wp.data.dispatch( 'core/editor' ).updatePost" , {
since : '5.7' ,
alternative : 'Use the core entities store instead'
} ) ;
return {
type : 'DO_NOTHING'
} ;
}
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns an action object used to setup the editor state when first opening
* an editor .
*
* @ param { Object } post Post object .
*
* @ return { Object } Action object .
2021-05-21 12:14:23 +02:00
* /
2020-10-20 15:36:16 +02:00
2022-04-11 14:04:30 +02:00
function setupEditorState ( post ) {
return {
type : 'SETUP_EDITOR_STATE' ,
post
} ;
}
2021-11-08 15:29:21 +01:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns an action object used in signalling that attributes of the post have
* been edited .
*
* @ param { Object } edits Post attributes to edit .
* @ param { Object } options Options for the edit .
2021-11-08 15:29:21 +01:00
* /
2022-04-12 17:12:47 +02:00
const editPost = ( edits , options ) => _ref3 => {
let {
select ,
registry
} = _ref3 ;
2022-04-11 14:04:30 +02:00
const {
id ,
type
2022-04-12 17:12:47 +02:00
} = select . getCurrentPost ( ) ;
registry . dispatch ( external _wp _coreData _namespaceObject . store ) . editEntityRecord ( 'postType' , type , id , edits , options ) ;
} ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-12 17:12:47 +02:00
* Action for saving the current post in the editor .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ param { Object } options
2021-05-21 12:14:23 +02:00
* /
2021-05-20 14:20:04 +02:00
2022-04-12 17:12:47 +02:00
const savePost = function ( ) {
2022-04-11 14:04:30 +02:00
let options = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : { } ;
2022-04-12 17:12:47 +02:00
return async _ref4 => {
let {
select ,
dispatch ,
registry
} = _ref4 ;
2021-05-20 14:20:04 +02:00
2022-04-12 17:12:47 +02:00
if ( ! select . isEditedPostSaveable ( ) ) {
return ;
}
2021-05-20 14:20:04 +02:00
2022-04-12 17:12:47 +02:00
const content = select . getEditedPostContent ( ) ;
2021-05-20 14:20:04 +02:00
2022-04-12 17:12:47 +02:00
if ( ! options . isAutosave ) {
dispatch . editPost ( {
content
} , {
undoIgnore : true
} ) ;
}
2019-09-19 17:19:18 +02:00
2022-04-12 17:12:47 +02:00
const previousRecord = select . getCurrentPost ( ) ;
const edits = {
id : previousRecord . id ,
... registry . select ( external _wp _coreData _namespaceObject . store ) . getEntityRecordNonTransientEdits ( 'postType' , previousRecord . type , previousRecord . id ) ,
content
} ;
dispatch ( {
type : 'REQUEST_POST_UPDATE_START' ,
options
2022-04-11 14:04:30 +02:00
} ) ;
2022-04-12 17:12:47 +02:00
await registry . dispatch ( external _wp _coreData _namespaceObject . store ) . saveEntityRecord ( 'postType' , previousRecord . type , edits , options ) ;
dispatch ( {
type : 'REQUEST_POST_UPDATE_FINISH' ,
2022-04-11 14:04:30 +02:00
options
} ) ;
2022-04-12 17:12:47 +02:00
const error = registry . select ( external _wp _coreData _namespaceObject . store ) . getLastEntitySaveError ( 'postType' , previousRecord . type , previousRecord . id ) ;
if ( error ) {
const args = getNotificationArgumentsForSaveFail ( {
post : previousRecord ,
edits ,
error
} ) ;
2019-09-19 17:19:18 +02:00
2022-04-12 17:12:47 +02:00
if ( args . length ) {
registry . dispatch ( external _wp _notices _namespaceObject . store ) . createErrorNotice ( ... args ) ;
}
} else {
const updatedRecord = select . getCurrentPost ( ) ;
const args = getNotificationArgumentsForSaveSuccess ( {
previousPost : previousRecord ,
post : updatedRecord ,
postType : await registry . resolveSelect ( external _wp _coreData _namespaceObject . store ) . getPostType ( updatedRecord . type ) ,
options
} ) ;
2019-09-19 17:19:18 +02:00
2022-04-12 17:12:47 +02:00
if ( args . length ) {
registry . dispatch ( external _wp _notices _namespaceObject . store ) . createSuccessNotice ( ... args ) ;
} // Make sure that any edits after saving create an undo level and are
// considered for change detection.
2019-09-19 17:19:18 +02:00
2022-04-12 17:12:47 +02:00
if ( ! options . isAutosave ) {
registry . dispatch ( external _wp _blockEditor _namespaceObject . store ) . _ _unstableMarkLastChangeAsPersistent ( ) ;
}
2022-04-11 14:04:30 +02:00
}
2022-04-12 17:12:47 +02:00
} ;
} ;
2022-04-11 14:04:30 +02:00
/ * *
2022-04-12 17:12:47 +02:00
* Action for refreshing the current post .
*
* @ deprecated Since WordPress 6.0 .
2022-04-11 14:04:30 +02:00
* /
2021-05-21 12:14:23 +02:00
2022-04-12 17:12:47 +02:00
function refreshPost ( ) {
external _wp _deprecated _default ( ) ( "wp.data.dispatch( 'core/editor' ).refreshPost" , {
since : '6.0' ,
version : '6.3' ,
alternative : 'Use the core entities store instead'
2022-04-11 14:04:30 +02:00
} ) ;
2022-04-12 17:12:47 +02:00
return {
type : 'DO_NOTHING'
} ;
2022-04-11 14:04:30 +02:00
}
/ * *
2022-04-12 17:12:47 +02:00
* Action for trashing the current post in the editor .
2022-04-11 14:04:30 +02:00
* /
2021-05-21 12:14:23 +02:00
2022-04-12 17:12:47 +02:00
const trashPost = ( ) => async _ref5 => {
let {
select ,
dispatch ,
registry
} = _ref5 ;
const postTypeSlug = select . getCurrentPostType ( ) ;
const postType = await registry . resolveSelect ( external _wp _coreData _namespaceObject . store ) . getPostType ( postTypeSlug ) ;
registry . dispatch ( external _wp _notices _namespaceObject . store ) . removeNotice ( TRASH _POST _NOTICE _ID ) ;
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
try {
2022-04-12 17:12:47 +02:00
const post = select . getCurrentPost ( ) ;
await external _wp _apiFetch _default ( ) ( {
2022-04-11 14:04:30 +02:00
path : ` /wp/v2/ ${ postType . rest _base } / ${ post . id } ` ,
method : 'DELETE'
} ) ;
2022-04-12 17:12:47 +02:00
await dispatch . savePost ( ) ;
2022-04-11 14:04:30 +02:00
} catch ( error ) {
2022-04-12 17:12:47 +02:00
registry . dispatch ( external _wp _notices _namespaceObject . store ) . createErrorNotice ( ... getNotificationArgumentsForTrashFail ( {
2022-04-11 14:04:30 +02:00
error
} ) ) ;
}
2022-04-12 17:12:47 +02:00
} ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-12 17:12:47 +02:00
* Action that autosaves the current post . This
2022-04-11 14:04:30 +02:00
* includes server - side autosaving ( default ) and client - side ( a . k . a . local )
* autosaving ( e . g . on the Web , the post might be committed to Session
* Storage ) .
*
* @ param { Object ? } options Extra flags to identify the autosave .
2021-05-21 12:14:23 +02:00
* /
2022-04-12 17:12:47 +02:00
const autosave = function ( ) {
2021-11-15 13:50:17 +01:00
let {
2022-04-11 14:04:30 +02:00
local = false ,
... options
} = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : { } ;
2022-04-12 17:12:47 +02:00
return async _ref6 => {
let {
select ,
dispatch
} = _ref6 ;
if ( local ) {
const post = select . getCurrentPost ( ) ;
const isPostNew = select . isEditedPostNew ( ) ;
const title = select . getEditedPostAttribute ( 'title' ) ;
const content = select . getEditedPostAttribute ( 'content' ) ;
const excerpt = select . getEditedPostAttribute ( 'excerpt' ) ;
localAutosaveSet ( post . id , isPostNew , title , content , excerpt ) ;
} else {
await dispatch . savePost ( {
isAutosave : true ,
... options
} ) ;
}
} ;
} ;
2018-12-14 05:41:57 +01:00
/ * *
2022-04-12 17:12:47 +02:00
* Action that restores last popped state in undo history .
2018-12-14 05:41:57 +01:00
* /
2022-04-12 17:12:47 +02:00
const redo = ( ) => _ref7 => {
let {
registry
} = _ref7 ;
registry . dispatch ( external _wp _coreData _namespaceObject . store ) . redo ( ) ;
} ;
2018-12-14 05:41:57 +01:00
/ * *
2022-04-12 17:12:47 +02:00
* Action that pops a record from undo history and undoes the edit .
2018-12-14 05:41:57 +01:00
* /
2022-04-12 17:12:47 +02:00
const undo = ( ) => _ref8 => {
let {
registry
} = _ref8 ;
registry . dispatch ( external _wp _coreData _namespaceObject . store ) . undo ( ) ;
} ;
2018-12-14 05:41:57 +01:00
/ * *
2022-04-12 17:12:47 +02:00
* Action that creates an undo history record .
2022-04-11 14:04:30 +02:00
*
2022-04-12 17:12:47 +02:00
* @ deprecated Since WordPress 6.0
2018-12-14 05:41:57 +01:00
* /
2022-04-11 14:04:30 +02:00
function createUndoLevel ( ) {
2022-04-12 17:12:47 +02:00
external _wp _deprecated _default ( ) ( "wp.data.dispatch( 'core/editor' ).createUndoLevel" , {
since : '6.0' ,
version : '6.3' ,
alternative : 'Use the core entities store instead'
} ) ;
2022-04-11 14:04:30 +02:00
return {
2022-04-12 17:12:47 +02:00
type : 'DO_NOTHING'
2022-04-11 14:04:30 +02:00
} ;
}
/ * *
2022-04-12 17:12:47 +02:00
* Action that locks the editor .
2022-04-11 14:04:30 +02:00
*
* @ param { Object } lock Details about the post lock status , user , and nonce .
* @ return { Object } Action object .
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
function updatePostLock ( lock ) {
return {
type : 'UPDATE_POST_LOCK' ,
lock
} ;
}
/ * *
2022-04-12 17:12:47 +02:00
* Enable the publish sidebar .
2022-04-11 14:04:30 +02:00
* /
2021-11-08 15:29:21 +01:00
2022-04-12 17:12:47 +02:00
const enablePublishSidebar = ( ) => _ref9 => {
let {
registry
} = _ref9 ;
registry . dispatch ( external _wp _preferences _namespaceObject . store ) . set ( 'core/edit-post' , 'isPublishSidebarEnabled' , true ) ;
} ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-12 17:12:47 +02:00
* Disables the publish sidebar .
2021-05-21 12:14:23 +02:00
* /
2021-05-20 14:20:04 +02:00
2022-04-12 17:12:47 +02:00
const disablePublishSidebar = ( ) => _ref10 => {
let {
registry
} = _ref10 ;
registry . dispatch ( external _wp _preferences _namespaceObject . store ) . set ( 'core/edit-post' , 'isPublishSidebarEnabled' , false ) ;
} ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-12 17:12:47 +02:00
* Action that locks post saving .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ param { string } lockName The lock name .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ example
* ` ` `
* const { subscribe } = wp . data ;
*
* const initialPostStatus = wp . data . select ( 'core/editor' ) . getEditedPostAttribute ( 'status' ) ;
*
* // Only allow publishing posts that are set to a future date.
* if ( 'publish' !== initialPostStatus ) {
*
* // Track locking.
* let locked = false ;
*
* // Watch for the publish event.
* let unssubscribe = subscribe ( ( ) => {
* const currentPostStatus = wp . data . select ( 'core/editor' ) . getEditedPostAttribute ( 'status' ) ;
* if ( 'publish' !== currentPostStatus ) {
*
* // Compare the post date to the current date, lock the post if the date isn't in the future.
* const postDate = new Date ( wp . data . select ( 'core/editor' ) . getEditedPostAttribute ( 'date' ) ) ;
* const currentDate = new Date ( ) ;
* if ( postDate . getTime ( ) <= currentDate . getTime ( ) ) {
* if ( ! locked ) {
* locked = true ;
* wp . data . dispatch ( 'core/editor' ) . lockPostSaving ( 'futurelock' ) ;
* }
* } else {
* if ( locked ) {
* locked = false ;
* wp . data . dispatch ( 'core/editor' ) . unlockPostSaving ( 'futurelock' ) ;
* }
* }
* }
* } ) ;
* }
* ` ` `
*
* @ return { Object } Action object
2021-05-21 12:14:23 +02:00
* /
2022-04-11 14:04:30 +02:00
function lockPostSaving ( lockName ) {
return {
type : 'LOCK_POST_SAVING' ,
lockName
} ;
}
/ * *
2022-04-12 17:12:47 +02:00
* Action that unlocks post saving .
2022-04-11 14:04:30 +02:00
*
* @ param { string } lockName The lock name .
*
* @ example
* ` ` `
* // Unlock post saving with the lock key `mylock`:
* wp . data . dispatch ( 'core/editor' ) . unlockPostSaving ( 'mylock' ) ;
* ` ` `
*
* @ return { Object } Action object
* /
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
function unlockPostSaving ( lockName ) {
2020-10-20 15:36:16 +02:00
return {
2022-04-11 14:04:30 +02:00
type : 'UNLOCK_POST_SAVING' ,
lockName
2020-10-20 15:36:16 +02:00
} ;
2022-04-11 14:04:30 +02:00
}
/ * *
2022-04-12 17:12:47 +02:00
* Action that locks post autosaving .
2022-04-11 14:04:30 +02:00
*
* @ param { string } lockName The lock name .
*
* @ example
* ` ` `
* // Lock post autosaving with the lock key `mylock`:
* wp . data . dispatch ( 'core/editor' ) . lockPostAutosaving ( 'mylock' ) ;
* ` ` `
*
* @ return { Object } Action object
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
function lockPostAutosaving ( lockName ) {
return {
type : 'LOCK_POST_AUTOSAVING' ,
lockName
} ;
}
2018-12-14 05:41:57 +01:00
/ * *
2022-04-12 17:12:47 +02:00
* Action that unlocks post autosaving .
2022-04-11 14:04:30 +02:00
*
* @ param { string } lockName The lock name .
*
* @ example
* ` ` `
* // Unlock post saving with the lock key `mylock`:
* wp . data . dispatch ( 'core/editor' ) . unlockPostAutosaving ( 'mylock' ) ;
* ` ` `
*
* @ return { Object } Action object
2018-12-14 05:41:57 +01:00
* /
2022-04-11 14:04:30 +02:00
function unlockPostAutosaving ( lockName ) {
return {
type : 'UNLOCK_POST_AUTOSAVING' ,
lockName
} ;
}
2021-05-20 14:20:04 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns an action object used to signal that the blocks have been updated .
*
* @ param { Array } blocks Block Array .
* @ param { ? Object } options Optional options .
2021-05-20 14:20:04 +02:00
* /
2019-03-21 13:48:00 +01:00
2022-04-12 17:12:47 +02:00
const resetEditorBlocks = function ( blocks ) {
2022-04-11 14:04:30 +02:00
let options = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : { } ;
2022-04-12 17:12:47 +02:00
return _ref11 => {
let {
select ,
dispatch ,
registry
} = _ref11 ;
2022-04-11 14:04:30 +02:00
const {
2022-04-12 17:12:47 +02:00
_ _unstableShouldCreateUndoLevel ,
selection
} = options ;
const edits = {
blocks ,
selection
} ;
2019-03-21 13:48:00 +01:00
2022-04-12 17:12:47 +02:00
if ( _ _unstableShouldCreateUndoLevel !== false ) {
const {
id ,
type
} = select . getCurrentPost ( ) ;
const noChange = registry . select ( external _wp _coreData _namespaceObject . store ) . getEditedEntityRecord ( 'postType' , type , id ) . blocks === edits . blocks ;
2021-05-21 12:14:23 +02:00
2022-04-12 17:12:47 +02:00
if ( noChange ) {
registry . dispatch ( external _wp _coreData _namespaceObject . store ) . _ _unstableCreateUndoLevel ( 'postType' , type , id ) ;
2018-12-14 05:41:57 +01:00
2022-04-12 17:12:47 +02:00
return ;
} // We create a new function here on every persistent edit
// to make sure the edit makes the post dirty and creates
// a new undo level.
2019-03-21 13:48:00 +01:00
2022-04-12 17:12:47 +02:00
edits . content = _ref12 => {
let {
blocks : blocksForSerialization = [ ]
} = _ref12 ;
return ( 0 , external _wp _blocks _namespaceObject . _ _unstableSerializeAndClean ) ( blocksForSerialization ) ;
} ;
}
dispatch . editPost ( edits ) ;
} ;
} ;
2022-04-11 14:04:30 +02:00
/ *
* Returns an action object used in signalling that the post editor settings have been updated .
*
* @ param { Object } settings Updated settings
*
* @ return { Object } Action object
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
function updateEditorSettings ( settings ) {
return {
type : 'UPDATE_EDITOR_SETTINGS' ,
settings
} ;
}
2021-05-20 14:20:04 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Backward compatibility
2021-05-20 14:20:04 +02:00
* /
2022-04-12 17:12:47 +02:00
const getBlockEditorAction = name => function ( ) {
2022-04-11 14:04:30 +02:00
for ( var _len = arguments . length , args = new Array ( _len ) , _key = 0 ; _key < _len ; _key ++ ) {
args [ _key ] = arguments [ _key ] ;
}
2021-05-20 14:20:04 +02:00
2022-04-12 17:12:47 +02:00
return _ref13 => {
let {
registry
} = _ref13 ;
external _wp _deprecated _default ( ) ( "`wp.data.dispatch( 'core/editor' )." + name + '`' , {
since : '5.3' ,
alternative : "`wp.data.dispatch( 'core/block-editor' )." + name + '`' ,
version : '6.2'
} ) ;
registry . dispatch ( external _wp _blockEditor _namespaceObject . store ) [ name ] ( ... args ) ;
} ;
2022-04-11 14:04:30 +02:00
} ;
2021-11-08 15:29:21 +01:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see resetBlocks in core / block - editor store .
2021-11-08 15:29:21 +01:00
* /
2022-04-11 14:04:30 +02:00
const resetBlocks = getBlockEditorAction ( 'resetBlocks' ) ;
/ * *
* @ see receiveBlocks in core / block - editor store .
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const receiveBlocks = getBlockEditorAction ( 'receiveBlocks' ) ;
/ * *
* @ see updateBlock in core / block - editor store .
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const updateBlock = getBlockEditorAction ( 'updateBlock' ) ;
/ * *
* @ see updateBlockAttributes in core / block - editor store .
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
const updateBlockAttributes = getBlockEditorAction ( 'updateBlockAttributes' ) ;
/ * *
* @ see selectBlock in core / block - editor store .
* /
2018-12-18 04:14:52 +01:00
2022-04-11 14:04:30 +02:00
const selectBlock = getBlockEditorAction ( 'selectBlock' ) ;
/ * *
* @ see startMultiSelect in core / block - editor store .
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
const startMultiSelect = getBlockEditorAction ( 'startMultiSelect' ) ;
2020-10-20 15:36:16 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see stopMultiSelect in core / block - editor store .
2020-10-20 15:36:16 +02:00
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
const stopMultiSelect = getBlockEditorAction ( 'stopMultiSelect' ) ;
/ * *
* @ see multiSelect in core / block - editor store .
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
const multiSelect = getBlockEditorAction ( 'multiSelect' ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see clearSelectedBlock in core / block - editor store .
2021-05-21 12:14:23 +02:00
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
const clearSelectedBlock = getBlockEditorAction ( 'clearSelectedBlock' ) ;
/ * *
* @ see toggleSelection in core / block - editor store .
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
const toggleSelection = getBlockEditorAction ( 'toggleSelection' ) ;
/ * *
* @ see replaceBlocks in core / block - editor store .
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
const replaceBlocks = getBlockEditorAction ( 'replaceBlocks' ) ;
/ * *
* @ see replaceBlock in core / block - editor store .
* /
2021-11-08 15:29:21 +01:00
2022-04-11 14:04:30 +02:00
const replaceBlock = getBlockEditorAction ( 'replaceBlock' ) ;
/ * *
* @ see moveBlocksDown in core / block - editor store .
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
const moveBlocksDown = getBlockEditorAction ( 'moveBlocksDown' ) ;
/ * *
* @ see moveBlocksUp in core / block - editor store .
* /
2018-12-18 04:14:52 +01:00
2022-04-11 14:04:30 +02:00
const moveBlocksUp = getBlockEditorAction ( 'moveBlocksUp' ) ;
/ * *
* @ see moveBlockToPosition in core / block - editor store .
* /
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
const moveBlockToPosition = getBlockEditorAction ( 'moveBlockToPosition' ) ;
/ * *
* @ see insertBlock in core / block - editor store .
* /
2018-12-18 04:14:52 +01:00
2022-04-11 14:04:30 +02:00
const insertBlock = getBlockEditorAction ( 'insertBlock' ) ;
2020-10-20 15:36:16 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see insertBlocks in core / block - editor store .
2020-10-20 15:36:16 +02:00
* /
2018-12-18 04:14:52 +01:00
2022-04-11 14:04:30 +02:00
const insertBlocks = getBlockEditorAction ( 'insertBlocks' ) ;
/ * *
* @ see showInsertionPoint in core / block - editor store .
* /
2018-12-18 04:14:52 +01:00
2022-04-11 14:04:30 +02:00
const showInsertionPoint = getBlockEditorAction ( 'showInsertionPoint' ) ;
/ * *
* @ see hideInsertionPoint in core / block - editor store .
* /
2021-01-28 03:04:13 +01:00
2022-04-11 14:04:30 +02:00
const hideInsertionPoint = getBlockEditorAction ( 'hideInsertionPoint' ) ;
/ * *
* @ see setTemplateValidity in core / block - editor store .
* /
2020-01-08 12:57:23 +01:00
2022-04-11 14:04:30 +02:00
const setTemplateValidity = getBlockEditorAction ( 'setTemplateValidity' ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* @ see synchronizeTemplate in core / block - editor store .
2021-05-21 12:14:23 +02:00
* /
2020-01-08 12:57:23 +01:00
2022-04-11 14:04:30 +02:00
const synchronizeTemplate = getBlockEditorAction ( 'synchronizeTemplate' ) ;
/ * *
* @ see mergeBlocks in core / block - editor store .
* /
2020-01-08 12:57:23 +01:00
2022-04-11 14:04:30 +02:00
const mergeBlocks = getBlockEditorAction ( 'mergeBlocks' ) ;
/ * *
* @ see removeBlocks in core / block - editor store .
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const removeBlocks = getBlockEditorAction ( 'removeBlocks' ) ;
/ * *
* @ see removeBlock in core / block - editor store .
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const removeBlock = getBlockEditorAction ( 'removeBlock' ) ;
/ * *
* @ see toggleBlockMode in core / block - editor store .
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const toggleBlockMode = getBlockEditorAction ( 'toggleBlockMode' ) ;
/ * *
* @ see startTyping in core / block - editor store .
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const startTyping = getBlockEditorAction ( 'startTyping' ) ;
/ * *
* @ see stopTyping in core / block - editor store .
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const stopTyping = getBlockEditorAction ( 'stopTyping' ) ;
/ * *
* @ see enterFormattedText in core / block - editor store .
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const enterFormattedText = getBlockEditorAction ( 'enterFormattedText' ) ;
/ * *
* @ see exitFormattedText in core / block - editor store .
* /
2020-01-08 12:57:23 +01:00
2022-04-11 14:04:30 +02:00
const exitFormattedText = getBlockEditorAction ( 'exitFormattedText' ) ;
/ * *
* @ see insertDefaultBlock in core / block - editor store .
* /
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
const insertDefaultBlock = getBlockEditorAction ( 'insertDefaultBlock' ) ;
/ * *
* @ see updateBlockListSettings in core / block - editor store .
* /
2020-01-08 12:57:23 +01:00
2022-04-11 14:04:30 +02:00
const updateBlockListSettings = getBlockEditorAction ( 'updateBlockListSettings' ) ;
2020-01-08 12:57:23 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/index.js
2020-06-26 15:33:47 +02:00
/ * *
* WordPress dependencies
* /
2021-01-28 03:04:13 +01:00
/ * *
2021-05-21 12:14:23 +02:00
* Internal dependencies
2020-06-26 15:33:47 +02:00
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
/ * *
* Post editor data store configuration .
*
* @ see https : //github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registerStore
*
* @ type { Object }
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
const storeConfig = {
reducer : reducer ,
selectors : selectors _namespaceObject ,
2022-04-12 17:12:47 +02:00
actions : actions _namespaceObject
2022-04-11 14:04:30 +02:00
} ;
2018-12-18 04:14:52 +01:00
/ * *
2022-04-11 14:04:30 +02:00
* Store definition for the editor namespace .
*
* @ see https : //github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
*
* @ type { Object }
2018-12-18 04:14:52 +01:00
* /
2022-04-12 17:12:47 +02:00
const store _store = ( 0 , external _wp _data _namespaceObject . createReduxStore ) ( STORE _NAME , { ... storeConfig
2022-04-11 14:04:30 +02:00
} ) ;
2022-04-12 17:12:47 +02:00
( 0 , external _wp _data _namespaceObject . register ) ( store _store ) ;
2018-12-18 04:14:52 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/custom-sources-backwards-compatibility.js
2021-05-20 14:20:04 +02:00
2021-01-28 03:04:13 +01:00
/ * *
2022-04-11 14:04:30 +02:00
* External dependencies
* /
/ * *
* WordPress dependencies
2021-01-28 03:04:13 +01:00
* /
2020-10-13 15:10:30 +02:00
2021-05-21 12:14:23 +02:00
2018-12-14 05:41:57 +01:00
2021-05-21 12:14:23 +02:00
2018-12-18 04:14:52 +01:00
2021-05-19 17:09:27 +02:00
2021-05-20 14:20:04 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Internal dependencies
2021-05-20 14:20:04 +02:00
* /
2021-05-19 17:09:27 +02:00
2018-12-18 04:14:52 +01:00
2022-04-11 14:04:30 +02:00
/** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */
2020-10-13 15:10:30 +02:00
2022-04-11 14:04:30 +02:00
/** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */
2021-05-19 17:09:27 +02:00
2022-04-11 14:04:30 +02:00
/ * *
* Object whose keys are the names of block attributes , where each value
* represents the meta key to which the block attribute is intended to save .
*
* @ see https : //developer.wordpress.org/reference/functions/register_meta/
*
* @ typedef { Object < string , string > } WPMetaAttributeMapping
* /
2021-05-19 17:09:27 +02:00
2022-04-11 14:04:30 +02:00
/ * *
* Given a mapping of attribute names ( meta source attributes ) to their
* associated meta key , returns a higher order component that overrides its
* ` attributes ` and ` setAttributes ` props to sync any changes with the edited
* post ' s meta keys .
*
* @ param { WPMetaAttributeMapping } metaAttributes Meta attribute mapping .
*
* @ return { WPHigherOrderComponent } Higher - order component .
* /
2021-05-19 17:09:27 +02:00
2022-04-11 14:04:30 +02:00
const createWithMetaAttributeSource = metaAttributes => ( 0 , external _wp _compose _namespaceObject . createHigherOrderComponent ) ( BlockEdit => _ref => {
2021-11-15 13:50:17 +01:00
let {
2022-04-11 14:04:30 +02:00
attributes ,
setAttributes ,
2021-11-15 13:50:17 +01:00
... props
} = _ref ;
2022-04-12 17:12:47 +02:00
const postType = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => select ( store _store ) . getCurrentPostType ( ) , [ ] ) ;
2022-04-11 14:04:30 +02:00
const [ meta , setMeta ] = ( 0 , external _wp _coreData _namespaceObject . useEntityProp ) ( 'postType' , postType , 'meta' ) ;
const mergedAttributes = ( 0 , external _wp _element _namespaceObject . useMemo ) ( ( ) => ( { ... attributes ,
... ( 0 , external _lodash _namespaceObject . mapValues ) ( metaAttributes , metaKey => meta [ metaKey ] )
} ) , [ attributes , meta ] ) ;
return ( 0 , external _wp _element _namespaceObject . createElement ) ( BlockEdit , _extends ( {
attributes : mergedAttributes ,
setAttributes : nextAttributes => {
const nextMeta = ( 0 , external _lodash _namespaceObject . mapKeys ) ( // Filter to intersection of keys between the updated
// attributes and those with an associated meta key.
( 0 , external _lodash _namespaceObject . pickBy ) ( nextAttributes , ( value , key ) => metaAttributes [ key ] ) , // Rename the keys to the expected meta key name.
( value , attributeKey ) => metaAttributes [ attributeKey ] ) ;
2021-11-15 13:50:17 +01:00
2022-04-11 14:04:30 +02:00
if ( ! ( 0 , external _lodash _namespaceObject . isEmpty ) ( nextMeta ) ) {
setMeta ( nextMeta ) ;
}
2021-05-19 17:09:27 +02:00
2022-04-11 14:04:30 +02:00
setAttributes ( nextAttributes ) ;
2021-05-21 12:14:23 +02:00
}
2022-04-11 14:04:30 +02:00
} , props ) ) ;
} , 'withMetaAttributeSource' ) ;
/ * *
* Filters a registered block 's settings to enhance a block' s ` edit ` component
* to upgrade meta - sourced attributes to use the post ' s meta entity property .
*
* @ param { WPBlockSettings } settings Registered block settings .
*
* @ return { WPBlockSettings } Filtered block settings .
* /
2018-12-18 04:14:52 +01:00
2022-04-11 14:04:30 +02:00
function shimAttributeSource ( settings ) {
/** @type {WPMetaAttributeMapping} */
const metaAttributes = ( 0 , external _lodash _namespaceObject . mapValues ) ( ( 0 , external _lodash _namespaceObject . pickBy ) ( settings . attributes , {
source : 'meta'
} ) , 'meta' ) ;
if ( ! ( 0 , external _lodash _namespaceObject . isEmpty ) ( metaAttributes ) ) {
settings . edit = createWithMetaAttributeSource ( metaAttributes ) ( settings . edit ) ;
}
return settings ;
2021-05-20 14:20:04 +02:00
}
2022-04-11 14:04:30 +02:00
( 0 , external _wp _hooks _namespaceObject . addFilter ) ( 'blocks.registerBlockType' , 'core/editor/custom-sources-backwards-compatibility/shim-attribute-source' , shimAttributeSource ) ; // The above filter will only capture blocks registered after the filter was
// added. There may already be blocks registered by this point, and those must
// be updated to apply the shim.
//
// The following implementation achieves this, albeit with a couple caveats:
// - Only blocks registered on the global store will be modified.
// - The block settings are directly mutated, since there is currently no
// mechanism to update an existing block registration. This is the reason for
// `getBlockType` separate from `getBlockTypes`, since the latter returns a
// _copy_ of the block registration (i.e. the mutation would not affect the
// actual registered block settings).
//
// `getBlockTypes` or `getBlockType` implementation could change in the future
// in regards to creating settings clones, but the corresponding end-to-end
// tests for meta blocks should cover against any potential regressions.
//
// In the future, we could support updating block settings, at which point this
// implementation could use that mechanism instead.
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
( 0 , external _wp _data _namespaceObject . select ) ( external _wp _blocks _namespaceObject . store ) . getBlockTypes ( ) . map ( _ref2 => {
let {
name
} = _ref2 ;
return ( 0 , external _wp _data _namespaceObject . select ) ( external _wp _blocks _namespaceObject . store ) . getBlockType ( name ) ;
} ) . forEach ( shimAttributeSource ) ;
2018-12-18 04:14:52 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autocompleters/user.js
2018-12-18 04:14:52 +01:00
2018-12-14 05:41:57 +01:00
2019-03-21 13:48:00 +01:00
/ * *
2021-05-20 14:20:04 +02:00
* WordPress dependencies
2019-03-21 13:48:00 +01:00
* /
2018-12-14 05:41:57 +01:00
2021-05-19 17:09:27 +02:00
2022-04-11 14:04:30 +02:00
/** @typedef {import('@wordpress/components').WPCompleter} WPCompleter */
2019-03-21 13:48:00 +01:00
2022-04-11 14:04:30 +02:00
function getUserLabel ( user ) {
const avatar = user . avatar _urls && user . avatar _urls [ 24 ] ? ( 0 , external _wp _element _namespaceObject . createElement ) ( "img" , {
className : "editor-autocompleters__user-avatar" ,
alt : "" ,
src : user . avatar _urls [ 24 ]
} ) : ( 0 , external _wp _element _namespaceObject . createElement ) ( "span" , {
className : "editor-autocompleters__no-avatar"
} ) ;
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _element _namespaceObject . Fragment , null , avatar , ( 0 , external _wp _element _namespaceObject . createElement ) ( "span" , {
className : "editor-autocompleters__user-name"
} , user . name ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( "span" , {
className : "editor-autocompleters__user-slug"
} , user . slug ) ) ;
}
2019-03-21 13:48:00 +01:00
/ * *
2022-04-11 14:04:30 +02:00
* A user mentions completer .
*
* @ type { WPCompleter }
2019-03-21 13:48:00 +01:00
* /
2022-04-11 14:04:30 +02:00
/* harmony default export */ var user = ( {
name : 'users' ,
className : 'editor-autocompleters__user' ,
triggerPrefix : '@' ,
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
useItems ( filterValue ) {
const users = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => {
const {
getUsers
} = select ( external _wp _coreData _namespaceObject . store ) ;
return getUsers ( {
context : 'view' ,
search : encodeURIComponent ( filterValue )
} ) ;
} , [ filterValue ] ) ;
const options = ( 0 , external _wp _element _namespaceObject . useMemo ) ( ( ) => users ? users . map ( user => ( {
key : ` user- ${ user . slug } ` ,
value : user ,
label : getUserLabel ( user )
} ) ) : [ ] , [ users ] ) ;
return [ options ] ;
} ,
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
getOptionCompletion ( user ) {
return ` @ ${ user . slug } ` ;
}
2021-07-15 20:55:29 +02:00
2022-04-11 14:04:30 +02:00
} ) ;
2021-07-15 20:55:29 +02:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/default-autocompleters.js
2021-07-15 20:55:29 +02:00
/ * *
* External dependencies
* /
/ * *
* WordPress dependencies
* /
2022-04-11 14:04:30 +02:00
/ * *
* Internal dependencies
* /
2021-07-15 20:55:29 +02:00
2022-04-11 14:04:30 +02:00
function setDefaultCompleters ( ) {
let completers = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : [ ] ;
// Provide copies so filters may directly modify them.
completers . push ( ( 0 , external _lodash _namespaceObject . clone ) ( user ) ) ;
return completers ;
2021-07-15 20:55:29 +02:00
}
2022-04-11 14:04:30 +02:00
( 0 , external _wp _hooks _namespaceObject . addFilter ) ( 'editor.Autocomplete.completers' , 'editor/autocompleters/set-default-completers' , setDefaultCompleters ) ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/index.js
/ * *
* Internal dependencies
* /
2021-11-08 15:29:21 +01:00
2021-12-21 08:02:34 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autocompleters/index.js
2019-03-21 13:48:00 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autosave-monitor/index.js
2021-05-20 14:20:04 +02:00
/ * *
2021-05-21 12:14:23 +02:00
* WordPress dependencies
2021-05-20 14:20:04 +02:00
* /
2021-11-08 15:29:21 +01:00
/ * *
* Internal dependencies
* /
2022-04-11 14:04:30 +02:00
/ * *
* AutosaveMonitor invokes ` props.autosave() ` within at most ` interval ` seconds after an unsaved change is detected .
*
* The logic is straightforward : a check is performed every ` props.interval ` seconds . If any changes are detected , ` props.autosave() ` is called .
* The time between the change and the autosave varies but is no larger than ` props.interval ` seconds . Refer to the code below for more details , such as
* the specific way of detecting changes .
*
* There are two caveats :
* * If ` props.isAutosaveable ` happens to be false at a time of checking for changes , the check is retried every second .
* * The timer may be disabled by setting ` props.disableIntervalChecks ` to ` true ` . In that mode , any change will immediately trigger ` props.autosave() ` .
* /
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
class AutosaveMonitor extends external _wp _element _namespaceObject . Component {
constructor ( props ) {
super ( props ) ;
this . needsAutosave = ! ! ( props . isDirty && props . isAutosaveable ) ;
}
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
componentDidMount ( ) {
if ( ! this . props . disableIntervalChecks ) {
this . setAutosaveTimer ( ) ;
}
}
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
componentDidUpdate ( prevProps ) {
if ( this . props . disableIntervalChecks ) {
if ( this . props . editsReference !== prevProps . editsReference ) {
this . props . autosave ( ) ;
}
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
return ;
2021-05-20 14:20:04 +02:00
}
2019-03-21 13:48:00 +01:00
2022-04-11 14:04:30 +02:00
if ( this . props . interval !== prevProps . interval ) {
clearTimeout ( this . timerId ) ;
this . setAutosaveTimer ( ) ;
}
2019-03-21 13:48:00 +01:00
2022-04-11 14:04:30 +02:00
if ( ! this . props . isDirty ) {
this . needsAutosave = false ;
return ;
}
2021-05-19 17:09:27 +02:00
2022-04-11 14:04:30 +02:00
if ( this . props . isAutosaving && ! prevProps . isAutosaving ) {
this . needsAutosave = false ;
return ;
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
if ( this . props . editsReference !== prevProps . editsReference ) {
this . needsAutosave = true ;
}
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
componentWillUnmount ( ) {
clearTimeout ( this . timerId ) ;
}
setAutosaveTimer ( ) {
let timeout = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : this . props . interval * 1000 ;
this . timerId = setTimeout ( ( ) => {
this . autosaveTimerHandler ( ) ;
} , timeout ) ;
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
autosaveTimerHandler ( ) {
if ( ! this . props . isAutosaveable ) {
this . setAutosaveTimer ( 1000 ) ;
return ;
}
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
if ( this . needsAutosave ) {
this . needsAutosave = false ;
this . props . autosave ( ) ;
}
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
this . setAutosaveTimer ( ) ;
}
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
render ( ) {
return null ;
}
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
}
/* harmony default export */ var autosave _monitor = ( ( 0 , external _wp _compose _namespaceObject . compose ) ( [ ( 0 , external _wp _data _namespaceObject . withSelect ) ( ( select , ownProps ) => {
const {
getReferenceByDistinctEdits
} = select ( external _wp _coreData _namespaceObject . store ) ;
const {
isEditedPostDirty ,
isEditedPostAutosaveable ,
isAutosavingPost ,
getEditorSettings
2022-04-12 17:12:47 +02:00
} = select ( store _store ) ;
2022-04-11 14:04:30 +02:00
const {
interval = getEditorSettings ( ) . autosaveInterval
} = ownProps ;
return {
editsReference : getReferenceByDistinctEdits ( ) ,
isDirty : isEditedPostDirty ( ) ,
isAutosaveable : isEditedPostAutosaveable ( ) ,
isAutosaving : isAutosavingPost ( ) ,
interval
} ;
} ) , ( 0 , external _wp _data _namespaceObject . withDispatch ) ( ( dispatch , ownProps ) => ( {
autosave ( ) {
const {
2022-04-12 17:12:47 +02:00
autosave = dispatch ( store _store ) . autosave
2022-04-11 14:04:30 +02:00
} = ownProps ;
autosave ( ) ;
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
} ) ) ] ) ( AutosaveMonitor ) ) ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: external ["wp","richText"]
var external _wp _richText _namespaceObject = window [ "wp" ] [ "richText" ] ;
// EXTERNAL MODULE: ./node_modules/classnames/index.js
var classnames = _ _webpack _require _ _ ( 4403 ) ;
var classnames _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( classnames ) ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/item.js
2021-11-08 15:29:21 +01:00
2022-04-11 14:04:30 +02:00
/ * *
* External dependencies
* /
2021-11-08 15:29:21 +01:00
2022-04-11 14:04:30 +02:00
const TableOfContentsItem = _ref => {
2021-11-15 13:50:17 +01:00
let {
2022-04-11 14:04:30 +02:00
children ,
isValid ,
level ,
href ,
onSelect
2021-11-15 13:50:17 +01:00
} = _ref ;
2022-04-11 14:04:30 +02:00
return ( 0 , external _wp _element _namespaceObject . createElement ) ( "li" , {
className : classnames _default ( ) ( 'document-outline__item' , ` is- ${ level . toLowerCase ( ) } ` , {
'is-invalid' : ! isValid
} )
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( "a" , {
href : href ,
className : "document-outline__button" ,
onClick : onSelect
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( "span" , {
className : "document-outline__emdash" ,
"aria-hidden" : "true"
} ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( "strong" , {
className : "document-outline__level"
} , level ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( "span" , {
className : "document-outline__item-content"
} , children ) ) ) ;
} ;
2019-03-21 13:48:00 +01:00
2022-04-11 14:04:30 +02:00
/* harmony default export */ var document _outline _item = ( TableOfContentsItem ) ;
2019-03-21 13:48:00 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/index.js
2019-03-21 13:48:00 +01:00
2018-12-14 05:41:57 +01:00
/ * *
2018-12-18 04:14:52 +01:00
* External dependencies
2018-12-14 05:41:57 +01:00
* /
/ * *
2018-12-18 04:14:52 +01:00
* WordPress dependencies
2018-12-14 05:41:57 +01:00
* /
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
/ * *
* Internal dependencies
* /
2021-05-21 12:14:23 +02:00
2021-12-21 08:02:34 +01:00
2022-01-24 08:46:21 +01:00
2021-05-20 14:20:04 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Module constants
* /
const emptyHeadingContent = ( 0 , external _wp _element _namespaceObject . createElement ) ( "em" , null , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( '(Empty heading)' ) ) ;
const incorrectLevelContent = [ ( 0 , external _wp _element _namespaceObject . createElement ) ( "br" , {
key : "incorrect-break"
} ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( "em" , {
key : "incorrect-message"
} , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( '(Incorrect heading level)' ) ) ] ;
const singleH1Headings = [ ( 0 , external _wp _element _namespaceObject . createElement ) ( "br" , {
key : "incorrect-break-h1"
} ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( "em" , {
key : "incorrect-message-h1"
} , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( '(Your theme may already use a H1 for the post title)' ) ) ] ;
const multipleH1Headings = [ ( 0 , external _wp _element _namespaceObject . createElement ) ( "br" , {
key : "incorrect-break-multiple-h1"
} ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( "em" , {
key : "incorrect-message-multiple-h1"
} , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( '(Multiple H1 headings are not recommended)' ) ) ] ;
/ * *
* Returns an array of heading blocks enhanced with the following properties :
* level - An integer with the heading level .
* isEmpty - Flag indicating if the heading has no content .
*
* @ param { ? Array } blocks An array of blocks .
*
* @ return { Array } An array of heading blocks enhanced with the properties described above .
2021-05-20 14:20:04 +02:00
* /
2021-05-19 17:09:27 +02:00
2022-04-11 14:04:30 +02:00
const computeOutlineHeadings = function ( ) {
let blocks = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : [ ] ;
return ( 0 , external _lodash _namespaceObject . flatMap ) ( blocks , function ( ) {
let block = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : { } ;
if ( block . name === 'core/heading' ) {
return { ... block ,
level : block . attributes . level ,
isEmpty : isEmptyHeading ( block )
} ;
}
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
return computeOutlineHeadings ( block . innerBlocks ) ;
} ) ;
2021-05-21 12:14:23 +02:00
} ;
2022-04-11 14:04:30 +02:00
const isEmptyHeading = heading => ! heading . attributes . content || heading . attributes . content . length === 0 ;
const DocumentOutline = _ref => {
2021-11-15 13:50:17 +01:00
let {
2022-04-11 14:04:30 +02:00
blocks = [ ] ,
title ,
onSelect ,
isTitleSupported ,
hasOutlineItemsDisabled
2021-11-15 13:50:17 +01:00
} = _ref ;
2022-04-11 14:04:30 +02:00
const headings = computeOutlineHeadings ( blocks ) ;
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
if ( headings . length < 1 ) {
return null ;
}
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
let prevHeadingLevel = 1 ; // Not great but it's the simplest way to locate the title right now.
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
const titleNode = document . querySelector ( '.editor-post-title__input' ) ;
const hasTitle = isTitleSupported && title && titleNode ;
const countByLevel = ( 0 , external _lodash _namespaceObject . countBy ) ( headings , 'level' ) ;
const hasMultipleH1 = countByLevel [ 1 ] > 1 ;
return ( 0 , external _wp _element _namespaceObject . createElement ) ( "div" , {
className : "document-outline"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( "ul" , null , hasTitle && ( 0 , external _wp _element _namespaceObject . createElement ) ( document _outline _item , {
level : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Title' ) ,
isValid : true ,
onSelect : onSelect ,
href : ` # ${ titleNode . id } ` ,
isDisabled : hasOutlineItemsDisabled
} , title ) , headings . map ( ( item , index ) => {
// Headings remain the same, go up by one, or down by any amount.
// Otherwise there are missing levels.
const isIncorrectLevel = item . level > prevHeadingLevel + 1 ;
const isValid = ! item . isEmpty && ! isIncorrectLevel && ! ! item . level && ( item . level !== 1 || ! hasMultipleH1 && ! hasTitle ) ;
prevHeadingLevel = item . level ;
return ( 0 , external _wp _element _namespaceObject . createElement ) ( document _outline _item , {
key : index ,
level : ` H ${ item . level } ` ,
isValid : isValid ,
isDisabled : hasOutlineItemsDisabled ,
href : ` #block- ${ item . clientId } ` ,
onSelect : onSelect
} , item . isEmpty ? emptyHeadingContent : ( 0 , external _wp _richText _namespaceObject . getTextContent ) ( ( 0 , external _wp _richText _namespaceObject . create ) ( {
html : item . attributes . content
} ) ) , isIncorrectLevel && incorrectLevelContent , item . level === 1 && hasMultipleH1 && multipleH1Headings , hasTitle && item . level === 1 && ! hasMultipleH1 && singleH1Headings ) ;
} ) ) ) ;
} ;
/* harmony default export */ var document _outline = ( ( 0 , external _wp _compose _namespaceObject . compose ) ( ( 0 , external _wp _data _namespaceObject . withSelect ) ( select => {
2021-12-21 08:02:34 +01:00
const {
2022-04-11 14:04:30 +02:00
getBlocks
} = select ( external _wp _blockEditor _namespaceObject . store ) ;
2022-01-24 08:46:21 +01:00
const {
2022-04-11 14:04:30 +02:00
getEditedPostAttribute
2022-04-12 17:12:47 +02:00
} = select ( store _store ) ;
2021-11-08 15:29:21 +01:00
const {
2022-04-11 14:04:30 +02:00
getPostType
} = select ( external _wp _coreData _namespaceObject . store ) ;
const postType = getPostType ( getEditedPostAttribute ( 'type' ) ) ;
return {
title : getEditedPostAttribute ( 'title' ) ,
blocks : getBlocks ( ) ,
isTitleSupported : ( 0 , external _lodash _namespaceObject . get ) ( postType , [ 'supports' , 'title' ] , false )
2021-05-21 12:14:23 +02:00
} ;
2022-04-11 14:04:30 +02:00
} ) ) ( DocumentOutline ) ) ;
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/check.js
/ * *
* External dependencies
* /
2021-11-15 13:50:17 +01:00
2022-04-11 14:04:30 +02:00
/ * *
* WordPress dependencies
* /
2021-11-08 15:29:21 +01:00
2021-11-23 06:40:38 +01:00
2021-12-21 08:02:34 +01:00
2022-01-24 08:46:21 +01:00
2022-04-11 14:04:30 +02:00
function DocumentOutlineCheck ( _ref ) {
let {
blocks ,
children
} = _ref ;
const headings = ( 0 , external _lodash _namespaceObject . filter ) ( blocks , block => block . name === 'core/heading' ) ;
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
if ( headings . length < 1 ) {
return null ;
}
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
return children ;
2021-05-20 14:20:04 +02:00
}
2019-03-21 13:48:00 +01:00
2022-04-11 14:04:30 +02:00
/* harmony default export */ var check = ( ( 0 , external _wp _data _namespaceObject . withSelect ) ( select => ( {
blocks : select ( external _wp _blockEditor _namespaceObject . store ) . getBlocks ( )
} ) ) ( DocumentOutlineCheck ) ) ;
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: external ["wp","keyboardShortcuts"]
var external _wp _keyboardShortcuts _namespaceObject = window [ "wp" ] [ "keyboardShortcuts" ] ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/save-shortcut.js
2021-05-20 14:20:04 +02:00
/ * *
* WordPress dependencies
* /
2018-12-14 05:41:57 +01:00
2021-11-08 15:29:21 +01:00
/ * *
* Internal dependencies
* /
2019-03-21 13:48:00 +01:00
2022-04-11 14:04:30 +02:00
function SaveShortcut ( _ref ) {
2021-11-15 13:50:17 +01:00
let {
2022-04-11 14:04:30 +02:00
resetBlocksOnSave
2021-11-15 13:50:17 +01:00
} = _ref ;
2022-04-11 14:04:30 +02:00
const {
resetEditorBlocks ,
savePost
2022-04-12 17:12:47 +02:00
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( store _store ) ;
2022-04-11 14:04:30 +02:00
const {
isEditedPostDirty ,
getPostEdits ,
isPostSavingLocked
2022-04-12 17:12:47 +02:00
} = ( 0 , external _wp _data _namespaceObject . useSelect ) ( store _store ) ;
2022-04-11 14:04:30 +02:00
( 0 , external _wp _keyboardShortcuts _namespaceObject . useShortcut ) ( 'core/editor/save' , event => {
event . preventDefault ( ) ;
/ * *
* Do not save the post if post saving is locked .
* /
2020-07-27 22:10:36 +02:00
2022-04-11 14:04:30 +02:00
if ( isPostSavingLocked ( ) ) {
return ;
} // TODO: This should be handled in the `savePost` effect in
// considering `isSaveable`. See note on `isEditedPostSaveable`
// selector about dirtiness and meta-boxes.
//
// See: `isEditedPostSaveable`
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
if ( ! isEditedPostDirty ( ) ) {
return ;
} // The text editor requires that editor blocks are updated for a
// save to work correctly. Usually this happens when the textarea
// for the code editors blurs, but the shortcut can be used without
// blurring the textarea.
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
if ( resetBlocksOnSave ) {
const postEdits = getPostEdits ( ) ;
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
if ( postEdits . content && typeof postEdits . content === 'string' ) {
const blocks = ( 0 , external _wp _blocks _namespaceObject . parse ) ( postEdits . content ) ;
resetEditorBlocks ( blocks ) ;
}
2021-05-21 12:14:23 +02:00
}
2022-04-11 14:04:30 +02:00
savePost ( ) ;
} ) ;
return null ;
2020-01-22 23:06:21 +01:00
}
2019-03-21 13:48:00 +01:00
2022-04-11 14:04:30 +02:00
/* harmony default export */ var save _shortcut = ( SaveShortcut ) ;
2018-12-18 04:14:52 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/visual-editor-shortcuts.js
2018-12-14 05:41:57 +01:00
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* WordPress dependencies
2021-05-21 12:14:23 +02:00
* /
2022-04-11 14:04:30 +02:00
2018-12-14 05:41:57 +01:00
/ * *
2022-04-11 14:04:30 +02:00
* Internal dependencies
2018-12-14 05:41:57 +01:00
* /
2019-03-21 13:48:00 +01:00
2019-03-07 10:09:59 +01:00
2022-04-11 14:04:30 +02:00
function VisualEditorGlobalKeyboardShortcuts ( ) {
const {
redo ,
undo
2022-04-12 17:12:47 +02:00
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( store _store ) ;
2022-04-11 14:04:30 +02:00
( 0 , external _wp _keyboardShortcuts _namespaceObject . useShortcut ) ( 'core/editor/undo' , event => {
undo ( ) ;
event . preventDefault ( ) ;
} ) ;
( 0 , external _wp _keyboardShortcuts _namespaceObject . useShortcut ) ( 'core/editor/redo' , event => {
redo ( ) ;
event . preventDefault ( ) ;
} ) ;
return ( 0 , external _wp _element _namespaceObject . createElement ) ( save _shortcut , null ) ;
}
/* harmony default export */ var visual _editor _shortcuts = ( VisualEditorGlobalKeyboardShortcuts ) ;
2019-03-21 13:48:00 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/text-editor-shortcuts.js
2019-03-21 13:48:00 +01:00
2019-03-07 10:09:59 +01:00
/ * *
2019-03-21 13:48:00 +01:00
* Internal dependencies
2019-03-07 10:09:59 +01:00
* /
2022-04-11 14:04:30 +02:00
function TextEditorGlobalKeyboardShortcuts ( ) {
return ( 0 , external _wp _element _namespaceObject . createElement ) ( save _shortcut , {
resetBlocksOnSave : true
} ) ;
}
2019-03-07 10:09:59 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/register-shortcuts.js
2020-01-22 23:06:21 +01:00
2021-11-08 15:29:21 +01:00
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* WordPress dependencies
2021-05-21 12:14:23 +02:00
* /
2020-01-22 23:06:21 +01:00
2022-04-11 14:04:30 +02:00
function EditorKeyboardShortcutsRegister ( ) {
2022-04-12 17:12:47 +02:00
// Registering the shortcuts.
2022-04-11 14:04:30 +02:00
const {
registerShortcut
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( external _wp _keyboardShortcuts _namespaceObject . store ) ;
( 0 , external _wp _element _namespaceObject . useEffect ) ( ( ) => {
registerShortcut ( {
name : 'core/editor/save' ,
category : 'global' ,
description : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Save your changes.' ) ,
keyCombination : {
modifier : 'primary' ,
character : 's'
}
} ) ;
registerShortcut ( {
name : 'core/editor/undo' ,
category : 'global' ,
description : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Undo your last changes.' ) ,
keyCombination : {
modifier : 'primary' ,
character : 'z'
}
} ) ;
registerShortcut ( {
name : 'core/editor/redo' ,
category : 'global' ,
description : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Redo your last undo.' ) ,
keyCombination : {
modifier : 'primaryShift' ,
character : 'z'
}
} ) ;
} , [ registerShortcut ] ) ;
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _blockEditor _namespaceObject . BlockEditorKeyboardShortcuts . Register , null ) ;
}
/* harmony default export */ var register _shortcuts = ( EditorKeyboardShortcutsRegister ) ;
; // CONCATENATED MODULE: external ["wp","components"]
var external _wp _components _namespaceObject = window [ "wp" ] [ "components" ] ;
; // CONCATENATED MODULE: external ["wp","keycodes"]
var external _wp _keycodes _namespaceObject = window [ "wp" ] [ "keycodes" ] ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/redo.js
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* WordPress dependencies
2021-05-21 12:14:23 +02:00
* /
2020-01-22 23:06:21 +01:00
2022-04-11 14:04:30 +02:00
const redo _redo = ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _primitives _namespaceObject . SVG , {
xmlns : "http://www.w3.org/2000/svg" ,
viewBox : "0 0 24 24"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _primitives _namespaceObject . Path , {
d : "M15.6 6.5l-1.1 1 2.9 3.3H8c-.9 0-1.7.3-2.3.9-1.4 1.5-1.4 4.2-1.4 5.6v.2h1.5v-.3c0-1.1 0-3.5 1-4.5.3-.3.7-.5 1.3-.5h9.2L14.5 15l1.1 1.1 4.6-4.6-4.6-5z"
} ) ) ;
/* harmony default export */ var library _redo = ( redo _redo ) ;
2020-01-22 23:06:21 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/undo.js
2020-01-22 23:06:21 +01:00
2021-01-28 03:04:13 +01:00
2022-04-11 14:04:30 +02:00
/ * *
* WordPress dependencies
* /
2020-02-10 23:33:27 +01:00
2022-04-11 14:04:30 +02:00
const undo _undo = ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _primitives _namespaceObject . SVG , {
xmlns : "http://www.w3.org/2000/svg" ,
viewBox : "0 0 24 24"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _primitives _namespaceObject . Path , {
d : "M18.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z"
} ) ) ;
/* harmony default export */ var library _undo = ( undo _undo ) ;
2020-01-22 23:06:21 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-history/redo.js
2018-12-14 05:41:57 +01:00
2020-06-26 15:33:47 +02:00
2018-12-14 05:41:57 +01:00
/ * *
2022-04-11 14:04:30 +02:00
* WordPress dependencies
2018-12-14 05:41:57 +01:00
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
/ * *
* Internal dependencies
* /
function EditorHistoryRedo ( props , ref ) {
2022-04-12 17:12:47 +02:00
const hasRedo = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => select ( store _store ) . hasEditorRedo ( ) , [ ] ) ;
2021-05-21 12:14:23 +02:00
const {
2022-04-11 14:04:30 +02:00
redo
2022-04-12 17:12:47 +02:00
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( store _store ) ;
2022-04-11 14:04:30 +02:00
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Button , _extends ( { } , props , {
ref : ref ,
icon : ! ( 0 , external _wp _i18n _namespaceObject . isRTL ) ( ) ? library _redo : library _undo
/* translators: button label text should, if possible, be under 16 characters. */
,
label : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Redo' ) ,
shortcut : external _wp _keycodes _namespaceObject . displayShortcut . primaryShift ( 'z' ) // If there are no redo levels we don't want to actually disable this
// button, because it will remove focus for keyboard users.
// See: https://github.com/WordPress/gutenberg/issues/3486
,
"aria-disabled" : ! hasRedo ,
onClick : hasRedo ? redo : undefined ,
className : "editor-history__redo"
} ) ) ;
2021-05-20 14:20:04 +02:00
}
2022-04-11 14:04:30 +02:00
/* harmony default export */ var editor _history _redo = ( ( 0 , external _wp _element _namespaceObject . forwardRef ) ( EditorHistoryRedo ) ) ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-history/undo.js
2020-06-26 15:33:47 +02:00
2021-05-21 12:14:23 +02:00
/ * *
* WordPress dependencies
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
2021-05-21 12:14:23 +02:00
/ * *
* Internal dependencies
* /
2018-12-14 05:41:57 +01:00
2020-06-26 15:33:47 +02:00
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
function EditorHistoryUndo ( props , ref ) {
2022-04-12 17:12:47 +02:00
const hasUndo = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => select ( store _store ) . hasEditorUndo ( ) , [ ] ) ;
2022-04-11 14:04:30 +02:00
const {
undo
2022-04-12 17:12:47 +02:00
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( store _store ) ;
2022-04-11 14:04:30 +02:00
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Button , _extends ( { } , props , {
ref : ref ,
icon : ! ( 0 , external _wp _i18n _namespaceObject . isRTL ) ( ) ? library _undo : library _redo
/* translators: button label text should, if possible, be under 16 characters. */
,
label : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Undo' ) ,
shortcut : external _wp _keycodes _namespaceObject . displayShortcut . primary ( 'z' ) // If there are no undo levels we don't want to actually disable this
// button, because it will remove focus for keyboard users.
// See: https://github.com/WordPress/gutenberg/issues/3486
,
"aria-disabled" : ! hasUndo ,
onClick : hasUndo ? undo : undefined ,
className : "editor-history__undo"
} ) ) ;
}
/* harmony default export */ var editor _history _undo = ( ( 0 , external _wp _element _namespaceObject . forwardRef ) ( EditorHistoryUndo ) ) ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/template-validation-notice/index.js
2018-12-14 05:41:57 +01:00
2021-05-21 12:14:23 +02:00
/ * *
* WordPress dependencies
* /
2018-12-14 05:41:57 +01:00
2021-11-08 15:29:21 +01:00
2020-02-10 23:33:27 +01:00
2022-04-11 14:04:30 +02:00
function TemplateValidationNotice ( _ref ) {
2021-11-15 13:50:17 +01:00
let {
2022-04-11 14:04:30 +02:00
isValid ,
... props
2021-11-15 13:50:17 +01:00
} = _ref ;
2020-06-26 15:33:47 +02:00
2022-04-11 14:04:30 +02:00
if ( isValid ) {
2021-05-21 12:14:23 +02:00
return null ;
}
2018-12-14 05:53:54 +01:00
2022-04-11 14:04:30 +02:00
const confirmSynchronization = ( ) => {
if ( // eslint-disable-next-line no-alert
window . confirm ( ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Resetting the template may result in loss of content, do you want to continue?' ) ) ) {
props . synchronizeTemplate ( ) ;
}
} ;
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Notice , {
className : "editor-template-validation-notice" ,
isDismissible : false ,
status : "warning" ,
actions : [ {
label : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Keep it as is' ) ,
onClick : props . resetTemplateValidity
} , {
label : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Reset the template' ) ,
onClick : confirmSynchronization
} ]
} , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'The content of your post doesn’ t match the template assigned to your post type.' ) ) ;
2021-05-21 12:14:23 +02:00
}
2022-04-11 14:04:30 +02:00
/* harmony default export */ var template _validation _notice = ( ( 0 , external _wp _compose _namespaceObject . compose ) ( [ ( 0 , external _wp _data _namespaceObject . withSelect ) ( select => ( {
isValid : select ( external _wp _blockEditor _namespaceObject . store ) . isValidTemplate ( )
} ) ) , ( 0 , external _wp _data _namespaceObject . withDispatch ) ( dispatch => {
2021-05-21 12:14:23 +02:00
const {
2022-04-11 14:04:30 +02:00
setTemplateValidity ,
synchronizeTemplate
} = dispatch ( external _wp _blockEditor _namespaceObject . store ) ;
2021-05-21 12:14:23 +02:00
return {
2022-04-11 14:04:30 +02:00
resetTemplateValidity : ( ) => setTemplateValidity ( true ) ,
synchronizeTemplate
2021-05-21 12:14:23 +02:00
} ;
2022-04-11 14:04:30 +02:00
} ) ] ) ( TemplateValidationNotice ) ) ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-notices/index.js
2018-12-14 05:41:57 +01:00
2021-05-21 12:14:23 +02:00
/ * *
* External dependencies
* /
2018-12-14 05:41:57 +01:00
2021-05-21 12:14:23 +02:00
/ * *
* WordPress dependencies
* /
2018-12-14 05:41:57 +01:00
2021-05-21 12:14:23 +02:00
/ * *
* Internal dependencies
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
function EditorNotices ( _ref ) {
2021-11-15 13:50:17 +01:00
let {
2022-04-11 14:04:30 +02:00
notices ,
onRemove
2021-11-15 13:50:17 +01:00
} = _ref ;
2022-04-11 14:04:30 +02:00
const dismissibleNotices = ( 0 , external _lodash _namespaceObject . filter ) ( notices , {
isDismissible : true ,
type : 'default'
2021-05-21 12:14:23 +02:00
} ) ;
2022-04-11 14:04:30 +02:00
const nonDismissibleNotices = ( 0 , external _lodash _namespaceObject . filter ) ( notices , {
isDismissible : false ,
type : 'default'
} ) ;
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _element _namespaceObject . Fragment , null , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . NoticeList , {
notices : nonDismissibleNotices ,
className : "components-editor-notices__pinned"
} ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . NoticeList , {
notices : dismissibleNotices ,
className : "components-editor-notices__dismissible" ,
onRemove : onRemove
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( template _validation _notice , null ) ) ) ;
2021-05-21 12:14:23 +02:00
}
2022-04-11 14:04:30 +02:00
/* harmony default export */ var editor _notices = ( ( 0 , external _wp _compose _namespaceObject . compose ) ( [ ( 0 , external _wp _data _namespaceObject . withSelect ) ( select => ( {
notices : select ( external _wp _notices _namespaceObject . store ) . getNotices ( )
} ) ) , ( 0 , external _wp _data _namespaceObject . withDispatch ) ( dispatch => ( {
onRemove : dispatch ( external _wp _notices _namespaceObject . store ) . removeNotice
} ) ) ] ) ( EditorNotices ) ) ;
2019-03-21 13:48:00 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-snackbars/index.js
2019-03-21 13:48:00 +01:00
2018-12-14 05:41:57 +01:00
2021-05-21 12:14:23 +02:00
/ * *
* External dependencies
* /
2018-12-14 05:41:57 +01:00
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* WordPress dependencies
2021-05-21 12:14:23 +02:00
* /
2018-12-14 05:41:57 +01:00
2021-01-28 03:04:13 +01:00
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
function EditorSnackbars ( ) {
const notices = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => select ( external _wp _notices _namespaceObject . store ) . getNotices ( ) , [ ] ) ;
const {
removeNotice
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( external _wp _notices _namespaceObject . store ) ;
const snackbarNotices = ( 0 , external _lodash _namespaceObject . filter ) ( notices , {
type : 'snackbar'
} ) ;
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . SnackbarList , {
notices : snackbarNotices ,
className : "components-editor-notices__snackbar" ,
onRemove : removeNotice
} ) ;
}
; // CONCATENATED MODULE: external ["wp","htmlEntities"]
var external _wp _htmlEntities _namespaceObject = window [ "wp" ] [ "htmlEntities" ] ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/entity-record-item.js
2020-06-26 15:33:47 +02:00
2021-05-21 12:14:23 +02:00
/ * *
* WordPress dependencies
* /
2020-06-26 15:33:47 +02:00
2021-05-19 17:09:27 +02:00
2020-06-26 15:33:47 +02:00
2021-11-08 15:29:21 +01:00
2021-05-21 12:14:23 +02:00
/ * *
* Internal dependencies
* /
2021-01-28 03:04:13 +01:00
2022-04-11 14:04:30 +02:00
function EntityRecordItem ( _ref ) {
let {
record ,
checked ,
onChange ,
closePanel
} = _ref ;
2021-05-21 12:14:23 +02:00
const {
2022-04-11 14:04:30 +02:00
name ,
kind ,
title ,
key
} = record ;
const parentBlockId = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => {
var _blocks$ ;
// Get entity's blocks.
2021-05-21 12:14:23 +02:00
const {
2022-04-11 14:04:30 +02:00
blocks = [ ]
} = select ( external _wp _coreData _namespaceObject . store ) . getEditedEntityRecord ( kind , name , key ) ; // Get parents of the entity's first block.
2020-06-26 15:33:47 +02:00
2022-04-11 14:04:30 +02:00
const parents = select ( external _wp _blockEditor _namespaceObject . store ) . getBlockParents ( ( _blocks$ = blocks [ 0 ] ) === null || _blocks$ === void 0 ? void 0 : _blocks$ . clientId ) ; // Return closest parent block's clientId.
return parents [ parents . length - 1 ] ;
2022-04-12 17:12:47 +02:00
} , [ ] ) ; // Handle templates that might use default descriptive titles.
2022-04-11 14:04:30 +02:00
const entityRecordTitle = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => {
if ( 'postType' !== kind || 'wp_template' !== name ) {
return title ;
2021-05-21 12:14:23 +02:00
}
2020-06-26 15:33:47 +02:00
2022-04-11 14:04:30 +02:00
const template = select ( external _wp _coreData _namespaceObject . store ) . getEditedEntityRecord ( kind , name , key ) ;
2022-04-12 17:12:47 +02:00
return select ( store _store ) . _ _experimentalGetTemplateInfo ( template ) . title ;
2022-04-11 14:04:30 +02:00
} , [ name , kind , title , key ] ) ;
const isSelected = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => {
const selectedBlockId = select ( external _wp _blockEditor _namespaceObject . store ) . getSelectedBlockClientId ( ) ;
return selectedBlockId === parentBlockId ;
} , [ parentBlockId ] ) ;
const isSelectedText = isSelected ? ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Selected' ) : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Select' ) ;
const {
selectBlock
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( external _wp _blockEditor _namespaceObject . store ) ;
const selectParentBlock = ( 0 , external _wp _element _namespaceObject . useCallback ) ( ( ) => selectBlock ( parentBlockId ) , [ parentBlockId ] ) ;
const selectAndDismiss = ( 0 , external _wp _element _namespaceObject . useCallback ) ( ( ) => {
selectBlock ( parentBlockId ) ;
closePanel ( ) ;
} , [ parentBlockId ] ) ;
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . PanelRow , null , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . CheckboxControl , {
label : ( 0 , external _wp _element _namespaceObject . createElement ) ( "strong" , null , ( 0 , external _wp _htmlEntities _namespaceObject . decodeEntities ) ( entityRecordTitle ) || ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Untitled' ) ) ,
checked : checked ,
onChange : onChange
} ) , parentBlockId ? ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _element _namespaceObject . Fragment , null , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Button , {
onClick : selectParentBlock ,
className : "entities-saved-states__find-entity" ,
disabled : isSelected
} , isSelectedText ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Button , {
onClick : selectAndDismiss ,
className : "entities-saved-states__find-entity-small" ,
disabled : isSelected
} , isSelectedText ) ) : null ) ;
}
2020-06-26 15:33:47 +02:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/entity-type-list.js
2020-06-26 15:33:47 +02:00
2020-01-22 23:06:21 +01:00
2022-04-11 14:04:30 +02:00
/ * *
* External dependencies
* /
/ * *
* WordPress dependencies
* /
2020-01-22 23:06:21 +01:00
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
/ * *
* Internal dependencies
* /
2020-01-22 23:06:21 +01:00
2022-04-19 17:11:17 +02:00
function getEntityDescription ( entity , count ) {
2022-04-11 14:04:30 +02:00
switch ( entity ) {
case 'site' :
2022-04-19 17:11:17 +02:00
return 1 === count ? ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'This change will affect your whole site.' ) : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'These changes will affect your whole site.' ) ;
2020-01-22 23:06:21 +01:00
2022-04-11 14:04:30 +02:00
case 'wp_template' :
2022-04-19 17:11:17 +02:00
return ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'This change will affect pages and posts that use this template.' ) ;
2022-04-11 14:04:30 +02:00
case 'page' :
case 'post' :
return ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'The following content has been modified.' ) ;
}
2021-05-21 12:14:23 +02:00
}
2020-01-22 23:06:21 +01:00
2022-04-11 14:04:30 +02:00
function EntityTypeList ( _ref ) {
let {
list ,
unselectedEntities ,
setUnselectedEntities ,
closePanel
} = _ref ;
2022-04-19 17:11:17 +02:00
const count = list . length ;
2022-04-11 14:04:30 +02:00
const firstRecord = list [ 0 ] ;
2022-04-12 17:12:47 +02:00
const entityConfig = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => select ( external _wp _coreData _namespaceObject . store ) . getEntityConfig ( firstRecord . kind , firstRecord . name ) , [ firstRecord . kind , firstRecord . name ] ) ;
2022-04-11 14:04:30 +02:00
const {
name
} = firstRecord ;
2022-04-19 17:11:17 +02:00
let entityLabel = entityConfig . label ;
2022-04-11 14:04:30 +02:00
2022-04-19 17:11:17 +02:00
if ( name === 'wp_template_part' ) {
entityLabel = 1 === count ? ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Template Part' ) : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Template Parts' ) ;
} // Set description based on type of entity.
const description = getEntityDescription ( name , count ) ;
2022-04-11 14:04:30 +02:00
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . PanelBody , {
title : entityLabel ,
initialOpen : true
} , description && ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . PanelRow , null , description ) , list . map ( record => {
return ( 0 , external _wp _element _namespaceObject . createElement ) ( EntityRecordItem , {
key : record . key || record . property ,
record : record ,
checked : ! ( 0 , external _lodash _namespaceObject . some ) ( unselectedEntities , elt => elt . kind === record . kind && elt . name === record . name && elt . key === record . key && elt . property === record . property ) ,
onChange : value => setUnselectedEntities ( record , value ) ,
closePanel : closePanel
} ) ;
} ) ) ;
}
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/index.js
2020-01-22 23:06:21 +01:00
2021-05-07 13:48:27 +02:00
2021-05-21 12:14:23 +02:00
/ * *
* External dependencies
* /
2021-05-19 17:09:27 +02:00
2020-06-26 15:33:47 +02:00
/ * *
2021-05-20 14:20:04 +02:00
* WordPress dependencies
2020-06-26 15:33:47 +02:00
* /
2021-05-19 17:09:27 +02:00
2020-06-26 15:33:47 +02:00
2022-04-11 14:04:30 +02:00
2021-05-20 14:20:04 +02:00
/ * *
2021-05-21 12:14:23 +02:00
* Internal dependencies
2021-05-20 14:20:04 +02:00
* /
2020-06-26 15:33:47 +02:00
2020-01-22 23:06:21 +01:00
2022-04-11 14:04:30 +02:00
const TRANSLATED _SITE _PROPERTIES = {
title : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Title' ) ,
description : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Tagline' ) ,
site _logo : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Logo' ) ,
site _icon : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Icon' ) ,
show _on _front : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Show on front' ) ,
page _on _front : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Page on front' )
} ;
const PUBLISH _ON _SAVE _ENTITIES = [ {
kind : 'postType' ,
name : 'wp_navigation'
} ] ;
function EntitiesSavedStates ( _ref ) {
let {
close
} = _ref ;
const saveButtonRef = ( 0 , external _wp _element _namespaceObject . useRef ) ( ) ;
2021-05-21 12:14:23 +02:00
const {
2022-04-11 14:04:30 +02:00
dirtyEntityRecords
} = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => {
const dirtyRecords = select ( external _wp _coreData _namespaceObject . store ) . _ _experimentalGetDirtyEntityRecords ( ) ; // Remove site object and decouple into its edited pieces.
2020-06-26 15:33:47 +02:00
2022-04-11 14:04:30 +02:00
const dirtyRecordsWithoutSite = dirtyRecords . filter ( record => ! ( record . kind === 'root' && record . name === 'site' ) ) ;
const siteEdits = select ( external _wp _coreData _namespaceObject . store ) . getEntityRecordEdits ( 'root' , 'site' ) ;
const siteEditsAsEntities = [ ] ;
for ( const property in siteEdits ) {
siteEditsAsEntities . push ( {
kind : 'root' ,
name : 'site' ,
title : TRANSLATED _SITE _PROPERTIES [ property ] || property ,
property
} ) ;
}
const dirtyRecordsWithSiteItems = [ ... dirtyRecordsWithoutSite , ... siteEditsAsEntities ] ;
2021-05-21 12:14:23 +02:00
return {
2022-04-11 14:04:30 +02:00
dirtyEntityRecords : dirtyRecordsWithSiteItems
2021-05-21 12:14:23 +02:00
} ;
} , [ ] ) ;
const {
2022-04-11 14:04:30 +02:00
editEntityRecord ,
saveEditedEntityRecord ,
_ _experimentalSaveSpecifiedEntityEdits : saveSpecifiedEntityEdits
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( external _wp _coreData _namespaceObject . store ) ;
2022-04-12 17:12:47 +02:00
const {
_ _unstableMarkLastChangeAsPersistent
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( external _wp _blockEditor _namespaceObject . store ) ;
2022-04-11 14:04:30 +02:00
const {
createSuccessNotice ,
createErrorNotice
2022-04-12 17:12:47 +02:00
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( external _wp _notices _namespaceObject . store ) ; // To group entities by type.
2020-06-26 15:33:47 +02:00
2022-04-11 14:04:30 +02:00
const partitionedSavables = ( 0 , external _lodash _namespaceObject . groupBy ) ( dirtyEntityRecords , 'name' ) ; // Sort entity groups.
const {
site : siteSavables ,
wp _template : templateSavables ,
wp _template _part : templatePartSavables ,
... contentSavables
} = partitionedSavables ;
const sortedPartitionedSavables = [ siteSavables , templateSavables , templatePartSavables , ... Object . values ( contentSavables ) ] . filter ( Array . isArray ) ; // Unchecked entities to be ignored by save function.
const [ unselectedEntities , _setUnselectedEntities ] = ( 0 , external _wp _element _namespaceObject . useState ) ( [ ] ) ;
const setUnselectedEntities = ( _ref2 , checked ) => {
let {
kind ,
name ,
key ,
property
} = _ref2 ;
if ( checked ) {
_setUnselectedEntities ( unselectedEntities . filter ( elt => elt . kind !== kind || elt . name !== name || elt . key !== key || elt . property !== property ) ) ;
} else {
_setUnselectedEntities ( [ ... unselectedEntities , {
kind ,
name ,
key ,
property
} ] ) ;
}
} ;
const saveCheckedEntities = ( ) => {
const entitiesToSave = dirtyEntityRecords . filter ( _ref3 => {
let {
kind ,
name ,
key ,
property
} = _ref3 ;
return ! ( 0 , external _lodash _namespaceObject . some ) ( unselectedEntities , elt => elt . kind === kind && elt . name === name && elt . key === key && elt . property === property ) ;
} ) ;
close ( entitiesToSave ) ;
const siteItemsToSave = [ ] ;
const pendingSavedRecords = [ ] ;
entitiesToSave . forEach ( _ref4 => {
let {
kind ,
name ,
key ,
property
} = _ref4 ;
if ( 'root' === kind && 'site' === name ) {
siteItemsToSave . push ( property ) ;
} else {
if ( PUBLISH _ON _SAVE _ENTITIES . some ( typeToPublish => typeToPublish . kind === kind && typeToPublish . name === name ) ) {
editEntityRecord ( kind , name , key , {
status : 'publish'
} ) ;
}
pendingSavedRecords . push ( saveEditedEntityRecord ( kind , name , key ) ) ;
}
} ) ;
2020-01-22 23:06:21 +01:00
2022-04-11 14:04:30 +02:00
if ( siteItemsToSave . length ) {
pendingSavedRecords . push ( saveSpecifiedEntityEdits ( 'root' , 'site' , undefined , siteItemsToSave ) ) ;
}
2021-05-21 12:14:23 +02:00
2022-04-12 17:12:47 +02:00
_ _unstableMarkLastChangeAsPersistent ( ) ;
2022-04-11 14:04:30 +02:00
Promise . all ( pendingSavedRecords ) . then ( values => {
if ( values . some ( value => typeof value === 'undefined' ) ) {
createErrorNotice ( ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Saving failed.' ) ) ;
} else {
createSuccessNotice ( ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Site updated.' ) , {
type : 'snackbar'
} ) ;
}
} ) . catch ( error => createErrorNotice ( ` ${ ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Saving failed.' ) } ${ error } ` ) ) ;
} ; // Explicitly define this with no argument passed. Using `close` on
// its own will use the event object in place of the expected saved entities.
2021-11-08 15:29:21 +01:00
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
const dismissPanel = ( 0 , external _wp _element _namespaceObject . useCallback ) ( ( ) => close ( ) , [ close ] ) ;
const [ saveDialogRef , saveDialogProps ] = ( 0 , external _wp _compose _namespaceObject . _ _experimentalUseDialog ) ( {
onClose : ( ) => dismissPanel ( )
} ) ;
return ( 0 , external _wp _element _namespaceObject . createElement ) ( "div" , _extends ( {
ref : saveDialogRef
} , saveDialogProps , {
className : "entities-saved-states__panel"
2022-04-12 17:12:47 +02:00
} ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Flex , {
className : "entities-saved-states__panel-header" ,
gap : 2
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . FlexItem , {
isBlock : true ,
as : external _wp _components _namespaceObject . Button ,
2022-04-11 14:04:30 +02:00
ref : saveButtonRef ,
variant : "primary" ,
disabled : dirtyEntityRecords . length - unselectedEntities . length === 0 ,
onClick : saveCheckedEntities ,
className : "editor-entities-saved-states__save-button"
2022-04-12 17:12:47 +02:00
} , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Save' ) ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . FlexItem , {
isBlock : true ,
as : external _wp _components _namespaceObject . Button ,
variant : "secondary" ,
onClick : dismissPanel
} , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Cancel' ) ) ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( "div" , {
2022-04-11 14:04:30 +02:00
className : "entities-saved-states__text-prompt"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( "strong" , null , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Are you ready to save?' ) ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( "p" , null , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'The following changes have been made to your site, templates, and content.' ) ) ) , sortedPartitionedSavables . map ( list => {
return ( 0 , external _wp _element _namespaceObject . createElement ) ( EntityTypeList , {
key : list [ 0 ] . name ,
list : list ,
closePanel : dismissPanel ,
unselectedEntities : unselectedEntities ,
setUnselectedEntities : setUnselectedEntities
} ) ;
} ) ) ;
}
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/error-boundary/index.js
2018-12-14 05:41:57 +01:00
2021-05-20 14:20:04 +02:00
/ * *
* WordPress dependencies
* /
2021-04-15 17:19:43 +02:00
2018-12-14 05:41:57 +01:00
2021-05-19 17:09:27 +02:00
2018-12-14 05:41:57 +01:00
2021-11-08 15:29:21 +01:00
/ * *
* Internal dependencies
* /
2022-04-11 14:04:30 +02:00
function CopyButton ( _ref ) {
let {
text ,
children
} = _ref ;
const ref = ( 0 , external _wp _compose _namespaceObject . useCopyToClipboard ) ( text ) ;
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Button , {
variant : "secondary" ,
ref : ref
} , children ) ;
}
2021-11-08 15:29:21 +01:00
2022-04-11 14:04:30 +02:00
class ErrorBoundary extends external _wp _element _namespaceObject . Component {
constructor ( ) {
super ( ... arguments ) ;
this . reboot = this . reboot . bind ( this ) ;
this . getContent = this . getContent . bind ( this ) ;
this . state = {
error : null
2021-05-21 12:14:23 +02:00
} ;
2022-04-11 14:04:30 +02:00
}
2021-05-19 17:09:27 +02:00
2022-04-11 14:04:30 +02:00
componentDidCatch ( error ) {
this . setState ( {
error
2021-11-15 13:50:17 +01:00
} ) ;
2022-04-11 14:04:30 +02:00
}
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
reboot ( ) {
this . props . onError ( ) ;
}
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
getContent ( ) {
try {
// While `select` in a component is generally discouraged, it is
// used here because it (a) reduces the chance of data loss in the
// case of additional errors by performing a direct retrieval and
// (b) avoids the performance cost associated with unnecessary
// content serialization throughout the lifetime of a non-erroring
// application.
2022-04-12 17:12:47 +02:00
return ( 0 , external _wp _data _namespaceObject . select ) ( store _store ) . getEditedPostContent ( ) ;
2022-04-11 14:04:30 +02:00
} catch ( error ) { }
}
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
render ( ) {
const {
error
} = this . state ;
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
if ( ! error ) {
return this . props . children ;
}
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _blockEditor _namespaceObject . Warning , {
className : "editor-error-boundary" ,
actions : [ ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Button , {
key : "recovery" ,
onClick : this . reboot ,
variant : "secondary"
} , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Attempt Recovery' ) ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( CopyButton , {
key : "copy-post" ,
text : this . getContent
} , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Copy Post Text' ) ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( CopyButton , {
key : "copy-error" ,
text : error . stack
} , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Copy Error' ) ) ]
} , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'The editor has encountered an unexpected error.' ) ) ;
2021-05-21 12:14:23 +02:00
}
2019-09-19 17:19:18 +02:00
2021-05-21 12:14:23 +02:00
}
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
/* harmony default export */ var error _boundary = ( ErrorBoundary ) ;
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/local-autosave-monitor/index.js
2019-09-19 17:19:18 +02:00
2021-01-28 03:04:13 +01:00
2022-04-11 14:04:30 +02:00
/ * *
* External dependencies
* /
2019-09-19 17:19:18 +02:00
/ * *
2021-05-20 14:20:04 +02:00
* WordPress dependencies
2019-09-19 17:19:18 +02:00
* /
2021-05-20 14:20:04 +02:00
2019-09-19 17:19:18 +02:00
Block Editor: Update WordPress packages to include the latest bug fixes.
Updated packages:
@wordpress/annotations@1.7.1
@wordpress/api-fetch@3.6.1
@wordpress/babel-plugin-makepot@3.2.1
@wordpress/babel-preset-default@4.6.1
@wordpress/block-directory@1.0.1
@wordpress/block-editor@3.2.1
@wordpress/block-library@2.9.1
@wordpress/blocks@6.7.1
@wordpress/components@8.3.1
@wordpress/compose@3.7.1
@wordpress/core-data@2.7.1
@wordpress/data-controls@1.3.1
@wordpress/data@4.9.1
@wordpress/docgen@1.4.1
@wordpress/dom@2.5.1
@wordpress/e2e-test-utils@2.4.1
@wordpress/e2e-tests@1.7.1
@wordpress/edit-post@3.8.1
@wordpress/editor@9.7.1
@wordpress/element@2.8.1
@wordpress/format-library@1.9.1
@wordpress/i18n@3.6.1
@wordpress/jest-console@3.3.1
@wordpress/jest-preset-default@5.1.1
@wordpress/keycodes@2.6.1
@wordpress/library-export-default-webpack-plugin@1.4.1
@wordpress/list-reusable-blocks@1.8.1
@wordpress/media-utils@1.2.1
@wordpress/notices@1.8.1
@wordpress/nux@3.7.1
@wordpress/plugins@2.7.1
@wordpress/redux-routine@3.6.1
@wordpress/rich-text@3.7.1
@wordpress/scripts@5.0.1
@wordpress/server-side-render@1.3.1
@wordpress/shortcode@2.4.1
@wordpress/token-list@1.6.1
@wordpress/viewport@2.8.1
@wordpress/wordcount@2.6.1
Props epiqueras, youknowriad, donmhico, jorgefilipecosta, soean, mcsf, noisysocks, andraganescu, gziolo, talldanwp, iseulde, nrqsnchz, mapk, karmatosed, joen, afercia, kjellr, desrosj.
Fixes #48186.
Built from https://develop.svn.wordpress.org/trunk@46364
git-svn-id: http://core.svn.wordpress.org/trunk@46163 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-30 22:07:06 +02:00
2021-05-20 14:20:04 +02:00
2021-11-08 15:29:21 +01:00
2022-04-11 14:04:30 +02:00
2021-11-08 15:29:21 +01:00
/ * *
* Internal dependencies
* /
2022-04-11 14:04:30 +02:00
const requestIdleCallback = window . requestIdleCallback ? window . requestIdleCallback : window . requestAnimationFrame ;
/ * *
* Function which returns true if the current environment supports browser
* sessionStorage , or false otherwise . The result of this function is cached and
* reused in subsequent invocations .
* /
const hasSessionStorageSupport = ( 0 , external _lodash _namespaceObject . once ) ( ( ) => {
try {
// Private Browsing in Safari 10 and earlier will throw an error when
// attempting to set into sessionStorage. The test here is intentional in
// causing a thrown error as condition bailing from local autosave.
window . sessionStorage . setItem ( '__wpEditorTestSessionStorage' , '' ) ;
window . sessionStorage . removeItem ( '__wpEditorTestSessionStorage' ) ;
return true ;
} catch ( error ) {
return false ;
}
} ) ;
/ * *
* Custom hook which manages the creation of a notice prompting the user to
* restore a local autosave , if one exists .
* /
function useAutosaveNotice ( ) {
2021-05-21 12:14:23 +02:00
const {
2022-04-11 14:04:30 +02:00
postId ,
isEditedPostNew ,
hasRemoteAutosave
} = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => ( {
2022-04-12 17:12:47 +02:00
postId : select ( store _store ) . getCurrentPostId ( ) ,
isEditedPostNew : select ( store _store ) . isEditedPostNew ( ) ,
hasRemoteAutosave : ! ! select ( store _store ) . getEditorSettings ( ) . autosave
2022-04-11 14:04:30 +02:00
} ) , [ ] ) ;
2021-05-21 12:14:23 +02:00
const {
2022-04-11 14:04:30 +02:00
getEditedPostAttribute
2022-04-12 17:12:47 +02:00
} = ( 0 , external _wp _data _namespaceObject . useSelect ) ( store _store ) ;
2022-04-11 14:04:30 +02:00
const {
createWarningNotice ,
removeNotice
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( external _wp _notices _namespaceObject . store ) ;
const {
editPost ,
resetEditorBlocks
2022-04-12 17:12:47 +02:00
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( store _store ) ;
2022-04-11 14:04:30 +02:00
( 0 , external _wp _element _namespaceObject . useEffect ) ( ( ) => {
let localAutosave = localAutosaveGet ( postId , isEditedPostNew ) ;
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
if ( ! localAutosave ) {
return ;
}
Block Editor: Update WordPress packages to include the latest bug fixes.
Updated packages:
@wordpress/annotations@1.7.1
@wordpress/api-fetch@3.6.1
@wordpress/babel-plugin-makepot@3.2.1
@wordpress/babel-preset-default@4.6.1
@wordpress/block-directory@1.0.1
@wordpress/block-editor@3.2.1
@wordpress/block-library@2.9.1
@wordpress/blocks@6.7.1
@wordpress/components@8.3.1
@wordpress/compose@3.7.1
@wordpress/core-data@2.7.1
@wordpress/data-controls@1.3.1
@wordpress/data@4.9.1
@wordpress/docgen@1.4.1
@wordpress/dom@2.5.1
@wordpress/e2e-test-utils@2.4.1
@wordpress/e2e-tests@1.7.1
@wordpress/edit-post@3.8.1
@wordpress/editor@9.7.1
@wordpress/element@2.8.1
@wordpress/format-library@1.9.1
@wordpress/i18n@3.6.1
@wordpress/jest-console@3.3.1
@wordpress/jest-preset-default@5.1.1
@wordpress/keycodes@2.6.1
@wordpress/library-export-default-webpack-plugin@1.4.1
@wordpress/list-reusable-blocks@1.8.1
@wordpress/media-utils@1.2.1
@wordpress/notices@1.8.1
@wordpress/nux@3.7.1
@wordpress/plugins@2.7.1
@wordpress/redux-routine@3.6.1
@wordpress/rich-text@3.7.1
@wordpress/scripts@5.0.1
@wordpress/server-side-render@1.3.1
@wordpress/shortcode@2.4.1
@wordpress/token-list@1.6.1
@wordpress/viewport@2.8.1
@wordpress/wordcount@2.6.1
Props epiqueras, youknowriad, donmhico, jorgefilipecosta, soean, mcsf, noisysocks, andraganescu, gziolo, talldanwp, iseulde, nrqsnchz, mapk, karmatosed, joen, afercia, kjellr, desrosj.
Fixes #48186.
Built from https://develop.svn.wordpress.org/trunk@46364
git-svn-id: http://core.svn.wordpress.org/trunk@46163 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-30 22:07:06 +02:00
2022-04-11 14:04:30 +02:00
try {
localAutosave = JSON . parse ( localAutosave ) ;
} catch ( error ) {
// Not usable if it can't be parsed.
return ;
}
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
const {
post _title : title ,
content ,
excerpt
} = localAutosave ;
const edits = {
title ,
content ,
excerpt
} ;
{
// Only display a notice if there is a difference between what has been
// saved and that which is stored in sessionStorage.
const hasDifference = Object . keys ( edits ) . some ( key => {
return edits [ key ] !== getEditedPostAttribute ( key ) ;
} ) ;
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
if ( ! hasDifference ) {
// If there is no difference, it can be safely ejected from storage.
localAutosaveClear ( postId , isEditedPostNew ) ;
return ;
}
}
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
if ( hasRemoteAutosave ) {
return ;
}
const noticeId = ( 0 , external _lodash _namespaceObject . uniqueId ) ( 'wpEditorAutosaveRestore' ) ;
createWarningNotice ( ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'The backup of this post in your browser is different from the version below.' ) , {
id : noticeId ,
actions : [ {
label : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Restore the backup' ) ,
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
onClick ( ) {
editPost ( ( 0 , external _lodash _namespaceObject . omit ) ( edits , [ 'content' ] ) ) ;
resetEditorBlocks ( ( 0 , external _wp _blocks _namespaceObject . parse ) ( edits . content ) ) ;
removeNotice ( noticeId ) ;
}
2021-05-19 17:09:27 +02:00
2022-04-11 14:04:30 +02:00
} ]
} ) ;
} , [ isEditedPostNew , postId ] ) ;
}
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Custom hook which ejects a local autosave after a successful save occurs .
2021-05-21 12:14:23 +02:00
* /
2021-05-19 17:09:27 +02:00
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
function useAutosavePurge ( ) {
const {
postId ,
isEditedPostNew ,
isDirty ,
isAutosaving ,
didError
} = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => ( {
2022-04-12 17:12:47 +02:00
postId : select ( store _store ) . getCurrentPostId ( ) ,
isEditedPostNew : select ( store _store ) . isEditedPostNew ( ) ,
isDirty : select ( store _store ) . isEditedPostDirty ( ) ,
isAutosaving : select ( store _store ) . isAutosavingPost ( ) ,
didError : select ( store _store ) . didPostSaveRequestFail ( )
2022-04-11 14:04:30 +02:00
} ) , [ ] ) ;
const lastIsDirty = ( 0 , external _wp _element _namespaceObject . useRef ) ( isDirty ) ;
const lastIsAutosaving = ( 0 , external _wp _element _namespaceObject . useRef ) ( isAutosaving ) ;
( 0 , external _wp _element _namespaceObject . useEffect ) ( ( ) => {
if ( ! didError && ( lastIsAutosaving . current && ! isAutosaving || lastIsDirty . current && ! isDirty ) ) {
localAutosaveClear ( postId , isEditedPostNew ) ;
}
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
lastIsDirty . current = isDirty ;
lastIsAutosaving . current = isAutosaving ;
} , [ isDirty , isAutosaving , didError ] ) ; // Once the isEditedPostNew changes from true to false, let's clear the auto-draft autosave.
2021-11-08 15:29:21 +01:00
2022-04-11 14:04:30 +02:00
const wasEditedPostNew = ( 0 , external _wp _compose _namespaceObject . usePrevious ) ( isEditedPostNew ) ;
const prevPostId = ( 0 , external _wp _compose _namespaceObject . usePrevious ) ( postId ) ;
( 0 , external _wp _element _namespaceObject . useEffect ) ( ( ) => {
if ( prevPostId === postId && wasEditedPostNew && ! isEditedPostNew ) {
localAutosaveClear ( postId , true ) ;
}
} , [ isEditedPostNew , postId ] ) ;
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
function LocalAutosaveMonitor ( ) {
const {
autosave
2022-04-12 17:12:47 +02:00
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( store _store ) ;
2022-04-11 14:04:30 +02:00
const deferredAutosave = ( 0 , external _wp _element _namespaceObject . useCallback ) ( ( ) => {
requestIdleCallback ( ( ) => autosave ( {
local : true
} ) ) ;
2021-05-21 12:14:23 +02:00
} , [ ] ) ;
2022-04-11 14:04:30 +02:00
useAutosaveNotice ( ) ;
useAutosavePurge ( ) ;
const {
localAutosaveInterval
} = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => ( {
2022-04-12 17:12:47 +02:00
localAutosaveInterval : select ( store _store ) . getEditorSettings ( ) . localAutosaveInterval
2022-04-11 14:04:30 +02:00
} ) , [ ] ) ;
return ( 0 , external _wp _element _namespaceObject . createElement ) ( autosave _monitor , {
interval : localAutosaveInterval ,
autosave : deferredAutosave
} ) ;
2019-09-19 17:19:18 +02:00
}
2022-04-11 14:04:30 +02:00
/* harmony default export */ var local _autosave _monitor = ( ( 0 , external _wp _compose _namespaceObject . ifCondition ) ( hasSessionStorageSupport ) ( LocalAutosaveMonitor ) ) ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/check.js
2021-05-21 12:14:23 +02:00
/ * *
* External dependencies
* /
2018-12-14 05:41:57 +01:00
2018-12-18 04:14:52 +01:00
/ * *
* WordPress dependencies
* /
2018-12-14 05:41:57 +01:00
2021-05-07 13:48:27 +02:00
2021-05-21 12:14:23 +02:00
/ * *
* Internal dependencies
* /
2021-05-07 13:48:27 +02:00
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
function PageAttributesCheck ( _ref ) {
2021-11-15 13:50:17 +01:00
let {
children
} = _ref ;
2022-04-11 14:04:30 +02:00
const postType = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => {
const {
getEditedPostAttribute
2022-04-12 17:12:47 +02:00
} = select ( store _store ) ;
2022-04-11 14:04:30 +02:00
const {
getPostType
} = select ( external _wp _coreData _namespaceObject . store ) ;
return getPostType ( getEditedPostAttribute ( 'type' ) ) ;
2021-11-08 15:29:21 +01:00
} , [ ] ) ;
2022-04-11 14:04:30 +02:00
const supportsPageAttributes = ( 0 , external _lodash _namespaceObject . get ) ( postType , [ 'supports' , 'page-attributes' ] , false ) ; // Only render fields if post type supports page attributes or available templates exist.
2021-11-08 15:29:21 +01:00
2022-04-11 14:04:30 +02:00
if ( ! supportsPageAttributes ) {
2021-05-21 12:14:23 +02:00
return null ;
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
return children ;
2021-05-21 12:14:23 +02:00
}
2022-04-11 14:04:30 +02:00
/* harmony default export */ var page _attributes _check = ( PageAttributesCheck ) ;
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-type-support-check/index.js
/ * *
* External dependencies
* /
2018-12-14 05:41:57 +01:00
2018-12-18 04:14:52 +01:00
/ * *
* WordPress dependencies
* /
2018-12-14 05:41:57 +01:00
2021-05-20 14:20:04 +02:00
2021-11-08 15:29:21 +01:00
/ * *
* Internal dependencies
* /
2022-04-11 14:04:30 +02:00
/ * *
* A component which renders its own children only if the current editor post
* type supports one of the given ` supportKeys ` prop .
*
* @ param { Object } props Props .
* @ param { string } [ props . postType ] Current post type .
* @ param { WPElement } props . children Children to be rendered if post
* type supports .
* @ param { ( string | string [ ] ) } props . supportKeys String or string array of keys
* to test .
*
* @ return { WPComponent } The component to be rendered .
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
function PostTypeSupportCheck ( _ref ) {
2021-11-15 13:50:17 +01:00
let {
2022-04-11 14:04:30 +02:00
postType ,
children ,
supportKeys
2021-11-15 13:50:17 +01:00
} = _ref ;
2022-04-11 14:04:30 +02:00
let isSupported = true ;
2021-11-15 13:50:17 +01:00
2022-04-11 14:04:30 +02:00
if ( postType ) {
isSupported = ( 0 , external _lodash _namespaceObject . some ) ( ( 0 , external _lodash _namespaceObject . castArray ) ( supportKeys ) , key => ! ! postType . supports [ key ] ) ;
}
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
if ( ! isSupported ) {
return null ;
}
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
return children ;
}
/* harmony default export */ var post _type _support _check = ( ( 0 , external _wp _data _namespaceObject . withSelect ) ( select => {
const {
getEditedPostAttribute
2022-04-12 17:12:47 +02:00
} = select ( store _store ) ;
2022-04-11 14:04:30 +02:00
const {
getPostType
} = select ( external _wp _coreData _namespaceObject . store ) ;
2021-05-21 12:14:23 +02:00
return {
2022-04-11 14:04:30 +02:00
postType : getPostType ( getEditedPostAttribute ( 'type' ) )
2021-05-21 12:14:23 +02:00
} ;
2022-04-11 14:04:30 +02:00
} ) ( PostTypeSupportCheck ) ) ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/order.js
2021-05-21 12:14:23 +02:00
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
/ * *
* External dependencies
* /
2018-12-14 05:41:57 +01:00
2018-12-18 04:14:52 +01:00
/ * *
2021-05-20 14:20:04 +02:00
* WordPress dependencies
2018-12-18 04:14:52 +01:00
* /
2018-12-14 05:41:57 +01:00
2018-12-17 05:52:00 +01:00
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
2021-11-08 15:29:21 +01:00
/ * *
* Internal dependencies
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const PageAttributesOrder = _ref => {
2021-11-15 13:50:17 +01:00
let {
2022-04-11 14:04:30 +02:00
onUpdateOrder ,
order = 0
2021-11-15 13:50:17 +01:00
} = _ref ;
2022-04-11 14:04:30 +02:00
const [ orderInput , setOrderInput ] = ( 0 , external _wp _element _namespaceObject . useState ) ( null ) ;
const setUpdatedOrder = value => {
setOrderInput ( value ) ;
const newOrder = Number ( value ) ;
if ( Number . isInteger ( newOrder ) && ( 0 , external _lodash _namespaceObject . invoke ) ( value , [ 'trim' ] ) !== '' ) {
onUpdateOrder ( Number ( value ) ) ;
}
} ;
const value = orderInput === null ? order : orderInput ;
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . TextControl , {
className : "editor-page-attributes__order" ,
type : "number" ,
label : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Order' ) ,
value : value ,
onChange : setUpdatedOrder ,
size : 6 ,
onBlur : ( ) => {
setOrderInput ( null ) ;
}
} ) ;
} ;
function PageAttributesOrderWithChecks ( props ) {
return ( 0 , external _wp _element _namespaceObject . createElement ) ( post _type _support _check , {
supportKeys : "page-attributes"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( PageAttributesOrder , props ) ) ;
2021-05-21 12:14:23 +02:00
}
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
/* harmony default export */ var order = ( ( 0 , external _wp _compose _namespaceObject . compose ) ( [ ( 0 , external _wp _data _namespaceObject . withSelect ) ( select => {
2021-05-21 12:14:23 +02:00
return {
2022-04-12 17:12:47 +02:00
order : select ( store _store ) . getEditedPostAttribute ( 'menu_order' )
2021-05-21 12:14:23 +02:00
} ;
2022-04-11 14:04:30 +02:00
} ) , ( 0 , external _wp _data _namespaceObject . withDispatch ) ( dispatch => ( {
onUpdateOrder ( order ) {
2022-04-12 17:12:47 +02:00
dispatch ( store _store ) . editPost ( {
2022-04-11 14:04:30 +02:00
menu _order : order
2021-05-21 12:14:23 +02:00
} ) ;
}
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
} ) ) ] ) ( PageAttributesOrderWithChecks ) ) ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/terms.js
2021-05-21 12:14:23 +02:00
/ * *
* External dependencies
* /
2018-12-14 12:02:53 +01:00
2018-12-18 04:14:52 +01:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns terms in a tree form .
*
* @ param { Array } flatTerms Array of terms in flat format .
*
* @ return { Array } Array of terms in tree format .
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
function buildTermsTree ( flatTerms ) {
const flatTermsWithParentAndChildren = flatTerms . map ( term => {
return {
children : [ ] ,
parent : null ,
... term
} ;
2021-05-21 12:14:23 +02:00
} ) ;
2022-04-11 14:04:30 +02:00
const termsByParent = ( 0 , external _lodash _namespaceObject . groupBy ) ( flatTermsWithParentAndChildren , 'parent' ) ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
if ( termsByParent . null && termsByParent . null . length ) {
return flatTermsWithParentAndChildren ;
2021-05-21 12:14:23 +02:00
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
const fillWithChildren = terms => {
return terms . map ( term => {
const children = termsByParent [ term . id ] ;
return { ... term ,
children : children && children . length ? fillWithChildren ( children ) : [ ]
} ;
} ) ;
2021-05-21 12:14:23 +02:00
} ;
2021-05-19 17:09:27 +02:00
2022-04-11 14:04:30 +02:00
return fillWithChildren ( termsByParent [ '0' ] || [ ] ) ;
} // Lodash unescape function handles ' but not ' which may be return in some API requests.
Block Editor: Update `@wordpress` dependencies to match Gutenberg 4.5.1.
- Update the annotations, api-fetch, block-library, blocks, components, compose, core-data, data, date, dom, edit-post, editor, element, format-library, html-entities, i18n, jest-console, jest-preset-default, keycodes, list-reusable-blocks, notices, nux, plugins, rich-text, scripts, token-lists, url, viewport packages.
- Upgrades React from 16.5.2 to 16.6.3.
- Adds a missing `wp-date` dependency to the editor script.
- Updates changed dependencies in `script-loader.php`.
- Fixes undefined notices in some blocks.
- Removes incorrect `gutenberg` textdomain.
Merges [43891], [43903], and [43919] to trunk.
Props atimmer, aduth, youknowriad, danielbachhuber.
See #45145.
Built from https://develop.svn.wordpress.org/trunk@44262
git-svn-id: http://core.svn.wordpress.org/trunk@44092 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-17 16:37:00 +01:00
2022-04-11 14:04:30 +02:00
const unescapeString = arg => {
return ( 0 , external _lodash _namespaceObject . unescape ) ( arg . replace ( ''' , "'" ) ) ;
} ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Returns a term object with name unescaped .
* The unescape of the name property is done using lodash unescape function .
*
* @ param { Object } term The term object to unescape .
*
* @ return { Object } Term object with name property unescaped .
2021-05-21 12:14:23 +02:00
* /
2021-04-15 17:19:43 +02:00
2022-04-11 14:04:30 +02:00
const unescapeTerm = term => {
return { ... term ,
name : unescapeString ( term . name )
} ;
} ;
/ * *
* Returns an array of term objects with names unescaped .
* The unescape of each term is performed using the unescapeTerm function .
*
* @ param { Object [ ] } terms Array of term objects to unescape .
*
* @ return { Object [ ] } Array of term objects unescaped .
* /
Block Editor: Update `@wordpress` dependencies to match Gutenberg 4.5.1.
- Update the annotations, api-fetch, block-library, blocks, components, compose, core-data, data, date, dom, edit-post, editor, element, format-library, html-entities, i18n, jest-console, jest-preset-default, keycodes, list-reusable-blocks, notices, nux, plugins, rich-text, scripts, token-lists, url, viewport packages.
- Upgrades React from 16.5.2 to 16.6.3.
- Adds a missing `wp-date` dependency to the editor script.
- Updates changed dependencies in `script-loader.php`.
- Fixes undefined notices in some blocks.
- Removes incorrect `gutenberg` textdomain.
Merges [43891], [43903], and [43919] to trunk.
Props atimmer, aduth, youknowriad, danielbachhuber.
See #45145.
Built from https://develop.svn.wordpress.org/trunk@44262
git-svn-id: http://core.svn.wordpress.org/trunk@44092 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-17 16:37:00 +01:00
2022-04-11 14:04:30 +02:00
const unescapeTerms = terms => {
return ( 0 , external _lodash _namespaceObject . map ) ( terms , unescapeTerm ) ;
} ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/parent.js
2018-12-14 05:41:57 +01:00
2021-05-21 12:14:23 +02:00
/ * *
* External dependencies
* /
2021-05-19 17:09:27 +02:00
/ * *
2021-05-20 14:20:04 +02:00
* WordPress dependencies
2021-05-19 17:09:27 +02:00
* /
2018-12-14 05:41:57 +01:00
2020-10-20 15:36:16 +02:00
2021-05-20 14:20:04 +02:00
2020-10-20 15:36:16 +02:00
2018-12-14 05:41:57 +01:00
/ * *
2021-05-21 12:14:23 +02:00
* Internal dependencies
2018-12-14 05:41:57 +01:00
* /
2021-05-20 14:20:04 +02:00
2021-11-08 15:29:21 +01:00
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
function getTitle ( post ) {
var _post$title ;
2021-04-15 17:19:43 +02:00
2022-04-11 14:04:30 +02:00
return post !== null && post !== void 0 && ( _post$title = post . title ) !== null && _post$title !== void 0 && _post$title . rendered ? ( 0 , external _wp _htmlEntities _namespaceObject . decodeEntities ) ( post . title . rendered ) : ` # ${ post . id } ( ${ ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'no title' ) } ) ` ;
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
const getItemPriority = ( name , searchValue ) => {
const normalizedName = ( 0 , external _lodash _namespaceObject . deburr ) ( name ) . toLowerCase ( ) ;
const normalizedSearch = ( 0 , external _lodash _namespaceObject . deburr ) ( searchValue ) . toLowerCase ( ) ;
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
if ( normalizedName === normalizedSearch ) {
return 0 ;
2021-05-21 12:14:23 +02:00
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
if ( normalizedName . startsWith ( normalizedSearch ) ) {
return normalizedName . length ;
}
2020-10-20 15:36:16 +02:00
2022-04-11 14:04:30 +02:00
return Infinity ;
} ;
function PageAttributesParent ( ) {
2021-05-21 12:14:23 +02:00
const {
editPost
2022-04-12 17:12:47 +02:00
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( store _store ) ;
2022-04-11 14:04:30 +02:00
const [ fieldValue , setFieldValue ] = ( 0 , external _wp _element _namespaceObject . useState ) ( false ) ;
const {
parentPost ,
parentPostId ,
items ,
postType
} = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => {
const {
getPostType ,
getEntityRecords ,
getEntityRecord
} = select ( external _wp _coreData _namespaceObject . store ) ;
const {
getCurrentPostId ,
getEditedPostAttribute
2022-04-12 17:12:47 +02:00
} = select ( store _store ) ;
2022-04-11 14:04:30 +02:00
const postTypeSlug = getEditedPostAttribute ( 'type' ) ;
const pageId = getEditedPostAttribute ( 'parent' ) ;
const pType = getPostType ( postTypeSlug ) ;
const postId = getCurrentPostId ( ) ;
const isHierarchical = ( 0 , external _lodash _namespaceObject . get ) ( pType , [ 'hierarchical' ] , false ) ;
const query = {
per _page : 100 ,
exclude : postId ,
parent _exclude : postId ,
orderby : 'menu_order' ,
order : 'asc' ,
_fields : 'id,title,parent'
} ; // Perform a search when the field is changed.
2021-04-15 17:19:43 +02:00
2022-04-11 14:04:30 +02:00
if ( ! ! fieldValue ) {
query . search = fieldValue ;
}
2021-04-15 17:19:43 +02:00
2022-04-11 14:04:30 +02:00
return {
parentPostId : pageId ,
parentPost : pageId ? getEntityRecord ( 'postType' , postTypeSlug , pageId ) : null ,
items : isHierarchical ? getEntityRecords ( 'postType' , postTypeSlug , query ) : [ ] ,
postType : pType
} ;
} , [ fieldValue ] ) ;
const isHierarchical = ( 0 , external _lodash _namespaceObject . get ) ( postType , [ 'hierarchical' ] , false ) ;
const parentPageLabel = ( 0 , external _lodash _namespaceObject . get ) ( postType , [ 'labels' , 'parent_item_colon' ] ) ;
const pageItems = items || [ ] ;
const parentOptions = ( 0 , external _wp _element _namespaceObject . useMemo ) ( ( ) => {
const getOptionsFromTree = function ( tree ) {
let level = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : 0 ;
const mappedNodes = tree . map ( treeNode => [ {
value : treeNode . id ,
label : ( 0 , external _lodash _namespaceObject . repeat ) ( '— ' , level ) + ( 0 , external _lodash _namespaceObject . unescape ) ( treeNode . name ) ,
rawName : treeNode . name
} , ... getOptionsFromTree ( treeNode . children || [ ] , level + 1 ) ] ) ;
const sortedNodes = mappedNodes . sort ( ( _ref , _ref2 ) => {
let [ a ] = _ref ;
let [ b ] = _ref2 ;
const priorityA = getItemPriority ( a . rawName , fieldValue ) ;
const priorityB = getItemPriority ( b . rawName , fieldValue ) ;
return priorityA >= priorityB ? 1 : - 1 ;
2021-05-21 12:14:23 +02:00
} ) ;
2022-04-11 14:04:30 +02:00
return ( 0 , external _lodash _namespaceObject . flatten ) ( sortedNodes ) ;
} ;
2021-04-15 17:19:43 +02:00
2022-04-11 14:04:30 +02:00
let tree = pageItems . map ( item => ( {
id : item . id ,
parent : item . parent ,
name : getTitle ( item )
} ) ) ; // Only build a hierarchical tree when not searching.
if ( ! fieldValue ) {
tree = buildTermsTree ( tree ) ;
2021-05-21 12:14:23 +02:00
}
2020-10-20 15:36:16 +02:00
2022-04-11 14:04:30 +02:00
const opts = getOptionsFromTree ( tree ) ; // Ensure the current parent is in the options list.
2020-10-20 15:36:16 +02:00
2022-04-11 14:04:30 +02:00
const optsHasParent = ( 0 , external _lodash _namespaceObject . find ) ( opts , item => item . value === parentPostId ) ;
2020-10-20 15:36:16 +02:00
2022-04-11 14:04:30 +02:00
if ( parentPost && ! optsHasParent ) {
opts . unshift ( {
value : parentPostId ,
label : getTitle ( parentPost )
} ) ;
}
2020-10-27 10:34:46 +01:00
2022-04-11 14:04:30 +02:00
return opts ;
} , [ pageItems , fieldValue ] ) ;
2020-10-27 10:34:46 +01:00
2022-04-11 14:04:30 +02:00
if ( ! isHierarchical || ! parentPageLabel ) {
return null ;
}
/ * *
* Handle user input .
*
* @ param { string } inputValue The current value of the input field .
* /
2020-10-27 10:34:46 +01:00
2019-03-21 13:48:00 +01:00
2022-04-11 14:04:30 +02:00
const handleKeydown = inputValue => {
setFieldValue ( inputValue ) ;
} ;
/ * *
* Handle author selection .
*
* @ param { Object } selectedPostId The selected Author .
* /
2020-10-20 15:36:16 +02:00
2022-04-11 14:04:30 +02:00
const handleChange = selectedPostId => {
editPost ( {
parent : selectedPostId
} ) ;
} ;
2021-11-08 15:29:21 +01:00
2022-04-11 14:04:30 +02:00
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . ComboboxControl , {
className : "editor-page-attributes__parent" ,
label : parentPageLabel ,
value : parentPostId ,
options : parentOptions ,
onFilterValueChange : ( 0 , external _lodash _namespaceObject . debounce ) ( handleKeydown , 300 ) ,
onChange : handleChange
} ) ;
2021-05-21 12:14:23 +02:00
}
2022-04-11 14:04:30 +02:00
/* harmony default export */ var page _attributes _parent = ( PageAttributesParent ) ;
2018-12-18 04:14:52 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-template/index.js
2018-12-18 04:14:52 +01:00
2019-03-21 13:48:00 +01:00
/ * *
2021-05-21 12:14:23 +02:00
* External dependencies
2019-03-21 13:48:00 +01:00
* /
2019-03-07 10:09:59 +01:00
2021-05-07 13:48:27 +02:00
/ * *
2021-05-20 14:20:04 +02:00
* WordPress dependencies
2021-05-07 13:48:27 +02:00
* /
2019-03-21 13:48:00 +01:00
2018-12-18 04:14:52 +01:00
2020-10-13 15:10:30 +02:00
/ * *
2021-05-21 12:14:23 +02:00
* Internal dependencies
2020-10-13 15:10:30 +02:00
* /
2020-06-26 15:33:47 +02:00
2021-11-08 15:29:21 +01:00
2022-04-11 14:04:30 +02:00
function PostTemplate ( _ref ) {
let { } = _ref ;
2021-05-21 12:14:23 +02:00
const {
2022-04-11 14:04:30 +02:00
availableTemplates ,
selectedTemplate ,
isViewable
} = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => {
var _getPostType$viewable , _getPostType ;
2021-05-21 12:14:23 +02:00
const {
getEditedPostAttribute ,
2022-04-11 14:04:30 +02:00
getEditorSettings ,
getCurrentPostType
2022-04-12 17:12:47 +02:00
} = select ( store _store ) ;
2022-04-11 14:04:30 +02:00
const {
getPostType
} = select ( external _wp _coreData _namespaceObject . store ) ;
2021-05-21 12:14:23 +02:00
return {
2022-04-11 14:04:30 +02:00
selectedTemplate : getEditedPostAttribute ( 'template' ) ,
availableTemplates : getEditorSettings ( ) . availableTemplates ,
isViewable : ( _getPostType$viewable = ( _getPostType = getPostType ( getCurrentPostType ( ) ) ) === null || _getPostType === void 0 ? void 0 : _getPostType . viewable ) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false
2021-05-21 12:14:23 +02:00
} ;
} , [ ] ) ;
const {
editPost
2022-04-12 17:12:47 +02:00
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( store _store ) ;
2021-11-15 13:50:17 +01:00
2022-04-11 14:04:30 +02:00
if ( ! isViewable || ( 0 , external _lodash _namespaceObject . isEmpty ) ( availableTemplates ) ) {
2021-05-21 12:14:23 +02:00
return null ;
}
2021-01-28 03:04:13 +01:00
2022-04-11 14:04:30 +02:00
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . SelectControl , {
label : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Template:' ) ,
value : selectedTemplate ,
onChange : templateSlug => {
editPost ( {
template : templateSlug || ''
} ) ;
} ,
options : ( 0 , external _lodash _namespaceObject . map ) ( availableTemplates , ( templateName , templateSlug ) => ( {
value : templateSlug ,
label : templateName
} ) )
} ) ;
2021-05-21 12:14:23 +02:00
}
2022-04-11 14:04:30 +02:00
/* harmony default export */ var post _template = ( PostTemplate ) ;
2021-01-28 03:04:13 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/constants.js
const AUTHORS _QUERY = {
who : 'authors' ,
per _page : 50 ,
_fields : 'id,name' ,
context : 'view' // Allows non-admins to perform requests.
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
} ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/combobox.js
2021-01-28 03:04:13 +01:00
2021-05-20 14:20:04 +02:00
/ * *
2021-05-21 12:14:23 +02:00
* External dependencies
2021-05-20 14:20:04 +02:00
* /
2021-01-28 03:04:13 +01:00
/ * *
* WordPress dependencies
* /
2021-05-20 14:20:04 +02:00
2019-03-21 13:48:00 +01:00
2021-11-08 15:29:21 +01:00
/ * *
* Internal dependencies
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
function PostAuthorCombobox ( ) {
const [ fieldValue , setFieldValue ] = ( 0 , external _wp _element _namespaceObject . useState ) ( ) ;
const {
authorId ,
isLoading ,
authors ,
postAuthor
} = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => {
const {
getUser ,
getUsers ,
isResolving
} = select ( external _wp _coreData _namespaceObject . store ) ;
const {
getEditedPostAttribute
2022-04-12 17:12:47 +02:00
} = select ( store _store ) ;
2022-04-11 14:04:30 +02:00
const author = getUser ( getEditedPostAttribute ( 'author' ) , {
context : 'view'
} ) ;
const query = { ... AUTHORS _QUERY
} ;
2018-12-18 04:14:52 +01:00
2022-04-11 14:04:30 +02:00
if ( fieldValue ) {
query . search = fieldValue ;
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
return {
authorId : getEditedPostAttribute ( 'author' ) ,
postAuthor : author ,
authors : getUsers ( query ) ,
isLoading : isResolving ( 'core' , 'getUsers' , [ query ] )
} ;
} , [ fieldValue ] ) ;
const {
editPost
2022-04-12 17:12:47 +02:00
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( store _store ) ;
2022-04-11 14:04:30 +02:00
const authorOptions = ( 0 , external _wp _element _namespaceObject . useMemo ) ( ( ) => {
const fetchedAuthors = ( authors !== null && authors !== void 0 ? authors : [ ] ) . map ( author => {
return {
value : author . id ,
label : ( 0 , external _wp _htmlEntities _namespaceObject . decodeEntities ) ( author . name )
} ;
} ) ; // Ensure the current author is included in the dropdown list.
2018-12-18 04:14:52 +01:00
2022-04-11 14:04:30 +02:00
const foundAuthor = fetchedAuthors . findIndex ( _ref => {
let {
value
} = _ref ;
return ( postAuthor === null || postAuthor === void 0 ? void 0 : postAuthor . id ) === value ;
} ) ;
if ( foundAuthor < 0 && postAuthor ) {
return [ {
value : postAuthor . id ,
label : ( 0 , external _wp _htmlEntities _namespaceObject . decodeEntities ) ( postAuthor . name )
} , ... fetchedAuthors ] ;
2021-05-21 12:14:23 +02:00
}
2022-04-11 14:04:30 +02:00
return fetchedAuthors ;
} , [ authors , postAuthor ] ) ;
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Handle author selection .
2021-05-21 12:14:23 +02:00
*
2022-04-11 14:04:30 +02:00
* @ param { number } postAuthorId The selected Author .
2021-05-21 12:14:23 +02:00
* /
2018-12-18 04:14:52 +01:00
2022-04-11 14:04:30 +02:00
const handleSelect = postAuthorId => {
if ( ! postAuthorId ) {
return ;
}
2018-12-18 04:14:52 +01:00
2022-04-11 14:04:30 +02:00
editPost ( {
author : postAuthorId
} ) ;
} ;
/ * *
* Handle user input .
*
* @ param { string } inputValue The current value of the input field .
* /
2018-12-18 04:14:52 +01:00
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
const handleKeydown = inputValue => {
setFieldValue ( inputValue ) ;
} ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
if ( ! postAuthor ) {
return null ;
2021-05-21 12:14:23 +02:00
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . ComboboxControl , {
label : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Author' ) ,
options : authorOptions ,
value : authorId ,
onFilterValueChange : ( 0 , external _lodash _namespaceObject . debounce ) ( handleKeydown , 300 ) ,
onChange : handleSelect ,
isLoading : isLoading ,
allowReset : false
} ) ;
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
/* harmony default export */ var combobox = ( PostAuthorCombobox ) ;
2018-12-18 04:14:52 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/select.js
2019-03-21 13:48:00 +01:00
2021-05-19 17:09:27 +02:00
2022-04-11 14:04:30 +02:00
/ * *
* WordPress dependencies
* /
/ * *
* Internal dependencies
* /
function PostAuthorSelect ( ) {
const {
editPost
2022-04-12 17:12:47 +02:00
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( store _store ) ;
2022-04-11 14:04:30 +02:00
const {
postAuthor ,
authors
} = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => {
return {
2022-04-12 17:12:47 +02:00
postAuthor : select ( store _store ) . getEditedPostAttribute ( 'author' ) ,
2022-04-11 14:04:30 +02:00
authors : select ( external _wp _coreData _namespaceObject . store ) . getUsers ( AUTHORS _QUERY )
} ;
} , [ ] ) ;
const authorOptions = ( 0 , external _wp _element _namespaceObject . useMemo ) ( ( ) => {
return ( authors !== null && authors !== void 0 ? authors : [ ] ) . map ( author => {
return {
value : author . id ,
label : ( 0 , external _wp _htmlEntities _namespaceObject . decodeEntities ) ( author . name )
} ;
} ) ;
} , [ authors ] ) ;
const setAuthorId = value => {
const author = Number ( value ) ;
editPost ( {
author
} ) ;
} ;
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . SelectControl , {
className : "post-author-selector" ,
label : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Author' ) ,
options : authorOptions ,
onChange : setAuthorId ,
value : postAuthor
} ) ;
}
/* harmony default export */ var post _author _select = ( PostAuthorSelect ) ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/index.js
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
/ * *
* WordPress dependencies
* /
2021-05-20 14:20:04 +02:00
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
/ * *
* Internal dependencies
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
const minimumUsersForCombobox = 25 ;
function PostAuthor ( ) {
const showCombobox = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => {
const authors = select ( external _wp _coreData _namespaceObject . store ) . getUsers ( AUTHORS _QUERY ) ;
return ( authors === null || authors === void 0 ? void 0 : authors . length ) >= minimumUsersForCombobox ;
} , [ ] ) ;
if ( showCombobox ) {
return ( 0 , external _wp _element _namespaceObject . createElement ) ( combobox , null ) ;
2021-05-21 12:14:23 +02:00
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
return ( 0 , external _wp _element _namespaceObject . createElement ) ( post _author _select , null ) ;
2021-05-21 12:14:23 +02:00
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
/* harmony default export */ var post _author = ( PostAuthor ) ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/check.js
2018-12-14 05:41:57 +01:00
/ * *
2021-05-21 12:14:23 +02:00
* External dependencies
* /
2018-12-18 04:14:52 +01:00
2021-05-20 14:20:04 +02:00
/ * *
* WordPress dependencies
* /
2018-12-18 04:14:52 +01:00
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
/ * *
* Internal dependencies
* /
function PostAuthorCheck ( _ref ) {
let {
children
} = _ref ;
const {
hasAssignAuthorAction ,
hasAuthors
} = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => {
2022-04-12 17:12:47 +02:00
const post = select ( store _store ) . getCurrentPost ( ) ;
2022-04-11 14:04:30 +02:00
const authors = select ( external _wp _coreData _namespaceObject . store ) . getUsers ( AUTHORS _QUERY ) ;
return {
hasAssignAuthorAction : ( 0 , external _lodash _namespaceObject . get ) ( post , [ '_links' , 'wp:action-assign-author' ] , false ) ,
hasAuthors : ( authors === null || authors === void 0 ? void 0 : authors . length ) >= 1
} ;
} , [ ] ) ;
if ( ! hasAssignAuthorAction || ! hasAuthors ) {
return null ;
}
return ( 0 , external _wp _element _namespaceObject . createElement ) ( post _type _support _check , {
supportKeys : "author"
} , children ) ;
}
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-comments/index.js
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
/ * *
* WordPress dependencies
* /
2021-05-21 12:14:23 +02:00
2019-03-07 10:09:59 +01:00
2021-11-08 15:29:21 +01:00
2019-03-07 10:09:59 +01:00
/ * *
2021-05-21 12:14:23 +02:00
* Internal dependencies
2019-03-07 10:09:59 +01:00
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
function PostComments ( _ref ) {
let {
commentStatus = 'open' ,
... props
} = _ref ;
2021-11-08 15:29:21 +01:00
2022-04-11 14:04:30 +02:00
const onToggleComments = ( ) => props . editPost ( {
comment _status : commentStatus === 'open' ? 'closed' : 'open'
} ) ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . CheckboxControl , {
label : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Allow comments' ) ,
checked : commentStatus === 'open' ,
onChange : onToggleComments
} ) ;
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
/* harmony default export */ var post _comments = ( ( 0 , external _wp _compose _namespaceObject . compose ) ( [ ( 0 , external _wp _data _namespaceObject . withSelect ) ( select => {
return {
2022-04-12 17:12:47 +02:00
commentStatus : select ( store _store ) . getEditedPostAttribute ( 'comment_status' )
2022-04-11 14:04:30 +02:00
} ;
} ) , ( 0 , external _wp _data _namespaceObject . withDispatch ) ( dispatch => ( {
2022-04-12 17:12:47 +02:00
editPost : dispatch ( store _store ) . editPost
2022-04-11 14:04:30 +02:00
} ) ) ] ) ( PostComments ) ) ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-excerpt/index.js
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
/ * *
* WordPress dependencies
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
/ * *
* Internal dependencies
* /
function PostExcerpt ( _ref ) {
let {
excerpt ,
onUpdateExcerpt
} = _ref ;
return ( 0 , external _wp _element _namespaceObject . createElement ) ( "div" , {
className : "editor-post-excerpt"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . TextareaControl , {
label : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Write an excerpt (optional)' ) ,
className : "editor-post-excerpt__textarea" ,
onChange : value => onUpdateExcerpt ( value ) ,
value : excerpt
} ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . ExternalLink , {
2022-04-12 17:12:47 +02:00
href : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'https://wordpress.org/support/article/settings-sidebar/#excerpt' )
2022-04-11 14:04:30 +02:00
} , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Learn more about manual excerpts' ) ) ) ;
}
/* harmony default export */ var post _excerpt = ( ( 0 , external _wp _compose _namespaceObject . compose ) ( [ ( 0 , external _wp _data _namespaceObject . withSelect ) ( select => {
return {
2022-04-12 17:12:47 +02:00
excerpt : select ( store _store ) . getEditedPostAttribute ( 'excerpt' )
2022-04-11 14:04:30 +02:00
} ;
} ) , ( 0 , external _wp _data _namespaceObject . withDispatch ) ( dispatch => ( {
onUpdateExcerpt ( excerpt ) {
2022-04-12 17:12:47 +02:00
dispatch ( store _store ) . editPost ( {
2022-04-11 14:04:30 +02:00
excerpt
} ) ;
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
} ) ) ] ) ( PostExcerpt ) ) ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-excerpt/check.js
2018-12-18 04:14:52 +01:00
2018-12-17 05:52:00 +01:00
2020-10-13 15:10:30 +02:00
2022-04-11 14:04:30 +02:00
/ * *
* Internal dependencies
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
function PostExcerptCheck ( props ) {
return ( 0 , external _wp _element _namespaceObject . createElement ) ( post _type _support _check , _extends ( { } , props , {
supportKeys : "excerpt"
} ) ) ;
2021-05-21 12:14:23 +02:00
}
2018-12-18 04:14:52 +01:00
2022-04-11 14:04:30 +02:00
/* harmony default export */ var post _excerpt _check = ( PostExcerptCheck ) ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/theme-support-check/index.js
2021-05-21 12:14:23 +02:00
/ * *
* External dependencies
* /
2020-01-08 12:57:23 +01:00
2021-05-20 14:20:04 +02:00
/ * *
* WordPress dependencies
* /
2018-12-18 04:14:52 +01:00
2021-05-19 17:09:27 +02:00
2021-11-08 15:29:21 +01:00
/ * *
* Internal dependencies
* /
2022-04-11 14:04:30 +02:00
function ThemeSupportCheck ( _ref ) {
2021-11-15 13:50:17 +01:00
let {
2022-04-11 14:04:30 +02:00
themeSupports ,
children ,
postType ,
supportKeys
2021-11-15 13:50:17 +01:00
} = _ref ;
2022-04-11 14:04:30 +02:00
const isSupported = ( 0 , external _lodash _namespaceObject . some ) ( ( 0 , external _lodash _namespaceObject . castArray ) ( supportKeys ) , key => {
const supported = ( 0 , external _lodash _namespaceObject . get ) ( themeSupports , [ key ] , false ) ; // 'post-thumbnails' can be boolean or an array of post types.
// In the latter case, we need to verify `postType` exists
// within `supported`. If `postType` isn't passed, then the check
// should fail.
2021-11-15 13:50:17 +01:00
2022-04-11 14:04:30 +02:00
if ( 'post-thumbnails' === key && ( 0 , external _lodash _namespaceObject . isArray ) ( supported ) ) {
return ( 0 , external _lodash _namespaceObject . includes ) ( supported , postType ) ;
}
return supported ;
} ) ;
if ( ! isSupported ) {
2021-05-21 12:14:23 +02:00
return null ;
}
return children ;
}
2022-04-11 14:04:30 +02:00
/* harmony default export */ var theme _support _check = ( ( 0 , external _wp _data _namespaceObject . withSelect ) ( select => {
2021-05-21 12:14:23 +02:00
const {
2022-04-11 14:04:30 +02:00
getThemeSupports
} = select ( external _wp _coreData _namespaceObject . store ) ;
const {
getEditedPostAttribute
2022-04-12 17:12:47 +02:00
} = select ( store _store ) ;
2021-05-21 12:14:23 +02:00
return {
2022-04-11 14:04:30 +02:00
postType : getEditedPostAttribute ( 'type' ) ,
themeSupports : getThemeSupports ( )
2021-05-21 12:14:23 +02:00
} ;
2022-04-11 14:04:30 +02:00
} ) ( ThemeSupportCheck ) ) ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-featured-image/check.js
2021-05-21 12:14:23 +02:00
2020-01-08 12:57:23 +01:00
2021-05-19 17:09:27 +02:00
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Internal dependencies
2021-05-21 12:14:23 +02:00
* /
2021-05-19 17:09:27 +02:00
2022-04-11 14:04:30 +02:00
function PostFeaturedImageCheck ( props ) {
return ( 0 , external _wp _element _namespaceObject . createElement ) ( theme _support _check , {
supportKeys : "post-thumbnails"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( post _type _support _check , _extends ( { } , props , {
supportKeys : "thumbnail"
} ) ) ) ;
}
/* harmony default export */ var post _featured _image _check = ( PostFeaturedImageCheck ) ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-featured-image/index.js
2019-03-21 13:48:00 +01:00
2021-05-20 14:20:04 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* External dependencies
2021-05-20 14:20:04 +02:00
* /
2019-03-21 13:48:00 +01:00
2022-04-11 14:04:30 +02:00
/ * *
* WordPress dependencies
* /
2021-05-20 14:20:04 +02:00
2021-11-08 15:29:21 +01:00
2021-11-15 13:50:17 +01:00
2021-05-21 12:14:23 +02:00
2019-03-21 13:48:00 +01:00
/ * *
2022-04-11 14:04:30 +02:00
* Internal dependencies
2019-03-21 13:48:00 +01:00
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const ALLOWED _MEDIA _TYPES = [ 'image' ] ; // Used when labels from post type were not yet loaded or when they are not present.
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const DEFAULT _FEATURE _IMAGE _LABEL = ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Featured image' ) ;
2021-11-08 15:29:21 +01:00
2022-04-11 14:04:30 +02:00
const DEFAULT _SET _FEATURE _IMAGE _LABEL = ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Set featured image' ) ;
2021-11-08 15:29:21 +01:00
2022-04-11 14:04:30 +02:00
const DEFAULT _REMOVE _FEATURE _IMAGE _LABEL = ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Remove image' ) ;
function PostFeaturedImage ( _ref ) {
var _media$media _details$ , _media$media _details$2 ;
2021-05-20 14:20:04 +02:00
2021-11-15 13:50:17 +01:00
let {
2022-04-11 14:04:30 +02:00
currentPostId ,
featuredImageId ,
onUpdateImage ,
onDropImage ,
onRemoveImage ,
media ,
postType ,
noticeUI
2021-11-15 13:50:17 +01:00
} = _ref ;
2022-04-11 14:04:30 +02:00
const postLabel = ( 0 , external _lodash _namespaceObject . get ) ( postType , [ 'labels' ] , { } ) ;
const instructions = ( 0 , external _wp _element _namespaceObject . createElement ) ( "p" , null , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'To edit the featured image, you need permission to upload media.' ) ) ;
let mediaWidth , mediaHeight , mediaSourceUrl ;
2021-11-15 13:50:17 +01:00
2022-04-11 14:04:30 +02:00
if ( media ) {
const mediaSize = ( 0 , external _wp _hooks _namespaceObject . applyFilters ) ( 'editor.PostFeaturedImage.imageSize' , 'post-thumbnail' , media . id , currentPostId ) ;
if ( ( 0 , external _lodash _namespaceObject . has ) ( media , [ 'media_details' , 'sizes' , mediaSize ] ) ) {
2022-04-12 17:12:47 +02:00
// Use mediaSize when available.
2022-04-11 14:04:30 +02:00
mediaWidth = media . media _details . sizes [ mediaSize ] . width ;
mediaHeight = media . media _details . sizes [ mediaSize ] . height ;
mediaSourceUrl = media . media _details . sizes [ mediaSize ] . source _url ;
} else {
2022-04-12 17:12:47 +02:00
// Get fallbackMediaSize if mediaSize is not available.
2022-04-11 14:04:30 +02:00
const fallbackMediaSize = ( 0 , external _wp _hooks _namespaceObject . applyFilters ) ( 'editor.PostFeaturedImage.imageSize' , 'thumbnail' , media . id , currentPostId ) ;
if ( ( 0 , external _lodash _namespaceObject . has ) ( media , [ 'media_details' , 'sizes' , fallbackMediaSize ] ) ) {
2022-04-12 17:12:47 +02:00
// Use fallbackMediaSize when mediaSize is not available.
2022-04-11 14:04:30 +02:00
mediaWidth = media . media _details . sizes [ fallbackMediaSize ] . width ;
mediaHeight = media . media _details . sizes [ fallbackMediaSize ] . height ;
mediaSourceUrl = media . media _details . sizes [ fallbackMediaSize ] . source _url ;
} else {
2022-04-12 17:12:47 +02:00
// Use full image size when mediaFallbackSize and mediaSize are not available.
2022-04-11 14:04:30 +02:00
mediaWidth = media . media _details . width ;
mediaHeight = media . media _details . height ;
mediaSourceUrl = media . source _url ;
}
}
}
return ( 0 , external _wp _element _namespaceObject . createElement ) ( post _featured _image _check , null , noticeUI , ( 0 , external _wp _element _namespaceObject . createElement ) ( "div" , {
className : "editor-post-featured-image"
} , media && ( 0 , external _wp _element _namespaceObject . createElement ) ( "div" , {
id : ` editor-post-featured-image- ${ featuredImageId } -describedby ` ,
className : "hidden"
} , media . alt _text && ( 0 , external _wp _i18n _namespaceObject . sprintf ) ( // Translators: %s: The selected image alt text.
( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Current image: %s' ) , media . alt _text ) , ! media . alt _text && ( 0 , external _wp _i18n _namespaceObject . sprintf ) ( // Translators: %s: The selected image filename.
( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'The current image has no alternative text. The file name is: %s' ) , ( ( _media$media _details$ = media . media _details . sizes ) === null || _media$media _details$ === void 0 ? void 0 : ( _media$media _details$2 = _media$media _details$ . full ) === null || _media$media _details$2 === void 0 ? void 0 : _media$media _details$2 . file ) || media . slug ) ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _blockEditor _namespaceObject . MediaUploadCheck , {
fallback : instructions
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _blockEditor _namespaceObject . MediaUpload , {
title : postLabel . featured _image || DEFAULT _FEATURE _IMAGE _LABEL ,
onSelect : onUpdateImage ,
unstableFeaturedImageFlow : true ,
allowedTypes : ALLOWED _MEDIA _TYPES ,
modalClass : "editor-post-featured-image__media-modal" ,
render : _ref2 => {
let {
open
} = _ref2 ;
return ( 0 , external _wp _element _namespaceObject . createElement ) ( "div" , {
className : "editor-post-featured-image__container"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Button , {
className : ! featuredImageId ? 'editor-post-featured-image__toggle' : 'editor-post-featured-image__preview' ,
onClick : open ,
"aria-label" : ! featuredImageId ? null : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Edit or update the image' ) ,
"aria-describedby" : ! featuredImageId ? null : ` editor-post-featured-image- ${ featuredImageId } -describedby `
} , ! ! featuredImageId && media && ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . ResponsiveWrapper , {
naturalWidth : mediaWidth ,
naturalHeight : mediaHeight ,
isInline : true
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( "img" , {
src : mediaSourceUrl ,
alt : ""
} ) ) , ! ! featuredImageId && ! media && ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Spinner , null ) , ! featuredImageId && ( postLabel . set _featured _image || DEFAULT _SET _FEATURE _IMAGE _LABEL ) ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . DropZone , {
onFilesDrop : onDropImage
} ) ) ;
} ,
value : featuredImageId
} ) ) , ! ! featuredImageId && media && ! media . isLoading && ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _blockEditor _namespaceObject . MediaUploadCheck , null , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _blockEditor _namespaceObject . MediaUpload , {
title : postLabel . featured _image || DEFAULT _FEATURE _IMAGE _LABEL ,
onSelect : onUpdateImage ,
unstableFeaturedImageFlow : true ,
allowedTypes : ALLOWED _MEDIA _TYPES ,
modalClass : "editor-post-featured-image__media-modal" ,
render : _ref3 => {
let {
open
} = _ref3 ;
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Button , {
onClick : open ,
variant : "secondary"
} , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Replace Image' ) ) ;
}
} ) ) , ! ! featuredImageId && ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _blockEditor _namespaceObject . MediaUploadCheck , null , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Button , {
onClick : onRemoveImage ,
variant : "link" ,
isDestructive : true
} , postLabel . remove _featured _image || DEFAULT _REMOVE _FEATURE _IMAGE _LABEL ) ) ) ) ;
}
const applyWithSelect = ( 0 , external _wp _data _namespaceObject . withSelect ) ( select => {
const {
getMedia ,
getPostType
} = select ( external _wp _coreData _namespaceObject . store ) ;
const {
getCurrentPostId ,
getEditedPostAttribute
2022-04-12 17:12:47 +02:00
} = select ( store _store ) ;
2022-04-11 14:04:30 +02:00
const featuredImageId = getEditedPostAttribute ( 'featured_media' ) ;
return {
media : featuredImageId ? getMedia ( featuredImageId , {
context : 'view'
} ) : null ,
currentPostId : getCurrentPostId ( ) ,
postType : getPostType ( getEditedPostAttribute ( 'type' ) ) ,
featuredImageId
} ;
} ) ;
const applyWithDispatch = ( 0 , external _wp _data _namespaceObject . withDispatch ) ( ( dispatch , _ref4 , _ref5 ) => {
let {
noticeOperations
} = _ref4 ;
let {
select
} = _ref5 ;
const {
editPost
2022-04-12 17:12:47 +02:00
} = dispatch ( store _store ) ;
2022-04-11 14:04:30 +02:00
return {
onUpdateImage ( image ) {
editPost ( {
featured _media : image . id
} ) ;
} ,
onDropImage ( filesList ) {
select ( external _wp _blockEditor _namespaceObject . store ) . getSettings ( ) . mediaUpload ( {
allowedTypes : [ 'image' ] ,
filesList ,
onFileChange ( _ref6 ) {
let [ image ] = _ref6 ;
editPost ( {
featured _media : image . id
} ) ;
} ,
onError ( message ) {
noticeOperations . removeAllNotices ( ) ;
noticeOperations . createErrorNotice ( message ) ;
}
} ) ;
} ,
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
onRemoveImage ( ) {
editPost ( {
featured _media : 0
} ) ;
}
2021-05-21 12:14:23 +02:00
} ;
2022-04-11 14:04:30 +02:00
} ) ;
/* harmony default export */ var post _featured _image = ( ( 0 , external _wp _compose _namespaceObject . compose ) ( external _wp _components _namespaceObject . withNotices , applyWithSelect , applyWithDispatch , ( 0 , external _wp _components _namespaceObject . withFilters ) ( 'editor.PostFeaturedImage' ) ) ( PostFeaturedImage ) ) ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-format/check.js
2021-05-20 14:20:04 +02:00
2019-03-21 13:48:00 +01:00
/ * *
2021-05-20 14:20:04 +02:00
* WordPress dependencies
2019-03-21 13:48:00 +01:00
* /
2018-12-18 04:14:52 +01:00
2021-11-08 15:29:21 +01:00
/ * *
* Internal dependencies
* /
2018-12-14 05:41:57 +01:00
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
function PostFormatCheck ( _ref ) {
2021-11-15 13:50:17 +01:00
let {
2022-04-11 14:04:30 +02:00
disablePostFormats ,
... props
} = _ref ;
return ! disablePostFormats && ( 0 , external _wp _element _namespaceObject . createElement ) ( post _type _support _check , _extends ( { } , props , {
supportKeys : "post-formats"
} ) ) ;
}
/* harmony default export */ var post _format _check = ( ( 0 , external _wp _data _namespaceObject . withSelect ) ( select => {
2022-04-12 17:12:47 +02:00
const editorSettings = select ( store _store ) . getEditorSettings ( ) ;
2021-05-21 12:14:23 +02:00
return {
2022-04-11 14:04:30 +02:00
disablePostFormats : editorSettings . disablePostFormats
2021-05-21 12:14:23 +02:00
} ;
2022-04-11 14:04:30 +02:00
} ) ( PostFormatCheck ) ) ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-format/index.js
2018-12-14 05:41:57 +01:00
/ * *
2021-05-21 12:14:23 +02:00
* External dependencies
2018-12-14 05:41:57 +01:00
* /
/ * *
* WordPress dependencies
* /
2018-12-17 05:52:00 +01:00
2021-05-21 12:14:23 +02:00
2018-12-17 05:52:00 +01:00
2018-12-14 05:41:57 +01:00
2019-03-07 10:09:59 +01:00
/ * *
2021-05-21 12:14:23 +02:00
* Internal dependencies
2019-03-07 10:09:59 +01:00
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
// All WP post formats, sorted alphabetically by translated name.
2021-11-08 15:29:21 +01:00
2022-04-11 14:04:30 +02:00
const POST _FORMATS = [ {
id : 'aside' ,
caption : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Aside' )
} , {
id : 'audio' ,
caption : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Audio' )
} , {
id : 'chat' ,
caption : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Chat' )
} , {
id : 'gallery' ,
caption : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Gallery' )
} , {
id : 'image' ,
caption : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Image' )
} , {
id : 'link' ,
caption : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Link' )
} , {
id : 'quote' ,
caption : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Quote' )
} , {
id : 'standard' ,
caption : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Standard' )
} , {
id : 'status' ,
caption : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Status' )
} , {
id : 'video' ,
caption : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Video' )
} ] . sort ( ( a , b ) => {
const normalizedA = a . caption . toUpperCase ( ) ;
const normalizedB = b . caption . toUpperCase ( ) ;
2021-05-19 17:09:27 +02:00
2022-04-11 14:04:30 +02:00
if ( normalizedA < normalizedB ) {
return - 1 ;
2021-05-21 12:14:23 +02:00
}
2021-05-19 17:09:27 +02:00
2022-04-11 14:04:30 +02:00
if ( normalizedA > normalizedB ) {
return 1 ;
2021-05-21 12:14:23 +02:00
}
2021-05-19 17:09:27 +02:00
2022-04-11 14:04:30 +02:00
return 0 ;
} ) ;
function PostFormat ( ) {
const instanceId = ( 0 , external _wp _compose _namespaceObject . useInstanceId ) ( PostFormat ) ;
const postFormatSelectorId = ` post-format-selector- ${ instanceId } ` ;
const {
postFormat ,
suggestedFormat ,
supportedFormats
} = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => {
const {
getEditedPostAttribute ,
getSuggestedPostFormat
2022-04-12 17:12:47 +02:00
} = select ( store _store ) ;
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const _postFormat = getEditedPostAttribute ( 'format' ) ;
const themeSupports = select ( external _wp _coreData _namespaceObject . store ) . getThemeSupports ( ) ;
return {
postFormat : _postFormat !== null && _postFormat !== void 0 ? _postFormat : 'standard' ,
suggestedFormat : getSuggestedPostFormat ( ) ,
2022-04-12 17:12:47 +02:00
supportedFormats : themeSupports . formats
2022-04-11 14:04:30 +02:00
} ;
} , [ ] ) ;
2022-04-12 17:12:47 +02:00
const formats = POST _FORMATS . filter ( format => {
// Ensure current format is always in the set.
// The current format may not be a format supported by the theme.
return ( 0 , external _lodash _namespaceObject . includes ) ( supportedFormats , format . id ) || postFormat === format . id ;
} ) ;
2022-04-11 14:04:30 +02:00
const suggestion = ( 0 , external _lodash _namespaceObject . find ) ( formats , format => format . id === suggestedFormat ) ;
2021-05-21 12:14:23 +02:00
const {
2022-04-11 14:04:30 +02:00
editPost
2022-04-12 17:12:47 +02:00
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( store _store ) ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
const onUpdatePostFormat = format => editPost ( {
format
} ) ;
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
return ( 0 , external _wp _element _namespaceObject . createElement ) ( post _format _check , null , ( 0 , external _wp _element _namespaceObject . createElement ) ( "div" , {
className : "editor-post-format"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( "div" , {
className : "editor-post-format__content"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( "label" , {
htmlFor : postFormatSelectorId
} , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Post Format' ) ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . SelectControl , {
value : postFormat ,
onChange : format => onUpdatePostFormat ( format ) ,
id : postFormatSelectorId ,
options : formats . map ( format => ( {
label : format . caption ,
value : format . id
} ) )
} ) ) , suggestion && suggestion . id !== postFormat && ( 0 , external _wp _element _namespaceObject . createElement ) ( "div" , {
className : "editor-post-format__suggestion"
} , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Suggestion:' ) , ' ' , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Button , {
variant : "link" ,
onClick : ( ) => onUpdatePostFormat ( suggestion . id )
} , ( 0 , external _wp _i18n _namespaceObject . sprintf ) (
/* translators: %s: post format */
( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Apply format: %s' ) , suggestion . caption ) ) ) ) ) ;
}
2020-06-26 15:33:47 +02:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/backup.js
2021-05-20 14:20:04 +02:00
2020-06-26 15:33:47 +02:00
/ * *
* WordPress dependencies
* /
2022-04-11 14:04:30 +02:00
const backup = ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _primitives _namespaceObject . SVG , {
xmlns : "http://www.w3.org/2000/svg" ,
viewBox : "0 0 24 24"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _primitives _namespaceObject . Path , {
d : "M5.5 12h1.75l-2.5 3-2.5-3H4a8 8 0 113.134 6.35l.907-1.194A6.5 6.5 0 105.5 12zm9.53 1.97l-2.28-2.28V8.5a.75.75 0 00-1.5 0V12a.747.747 0 00.218.529l1.282-.84-1.28.842 2.5 2.5a.75.75 0 101.06-1.061z"
} ) ) ;
/* harmony default export */ var library _backup = ( backup ) ;
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-last-revision/check.js
2021-05-20 14:20:04 +02:00
2020-06-26 15:33:47 +02:00
/ * *
2021-05-20 14:20:04 +02:00
* WordPress dependencies
2019-03-21 13:48:00 +01:00
* /
2022-04-11 14:04:30 +02:00
/ * *
* Internal dependencies
* /
function PostLastRevisionCheck ( _ref ) {
let {
lastRevisionId ,
revisionsCount ,
children
} = _ref ;
if ( ! lastRevisionId || revisionsCount < 2 ) {
return null ;
}
2019-03-21 13:48:00 +01:00
2022-04-11 14:04:30 +02:00
return ( 0 , external _wp _element _namespaceObject . createElement ) ( post _type _support _check , {
supportKeys : "revisions"
} , children ) ;
}
/* harmony default export */ var post _last _revision _check = ( ( 0 , external _wp _data _namespaceObject . withSelect ) ( select => {
const {
getCurrentPostLastRevisionId ,
getCurrentPostRevisionsCount
2022-04-12 17:12:47 +02:00
} = select ( store _store ) ;
2022-04-11 14:04:30 +02:00
return {
lastRevisionId : getCurrentPostLastRevisionId ( ) ,
revisionsCount : getCurrentPostRevisionsCount ( )
} ;
} ) ( PostLastRevisionCheck ) ) ;
2019-03-21 13:48:00 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-last-revision/index.js
2019-03-21 13:48:00 +01:00
2021-05-20 14:20:04 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* WordPress dependencies
2021-05-20 14:20:04 +02:00
* /
2018-12-14 05:41:57 +01:00
2021-11-08 15:29:21 +01:00
2018-12-14 05:41:57 +01:00
2022-04-12 17:12:47 +02:00
2022-04-11 14:04:30 +02:00
/ * *
* Internal dependencies
* /
2020-06-26 15:33:47 +02:00
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
function LastRevision ( _ref ) {
let {
lastRevisionId ,
revisionsCount
} = _ref ;
return ( 0 , external _wp _element _namespaceObject . createElement ) ( post _last _revision _check , null , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Button , {
2022-04-12 17:12:47 +02:00
href : ( 0 , external _wp _url _namespaceObject . addQueryArgs ) ( 'revision.php' , {
2022-04-11 14:04:30 +02:00
revision : lastRevisionId ,
gutenberg : true
} ) ,
className : "editor-post-last-revision__title" ,
icon : library _backup
} , ( 0 , external _wp _i18n _namespaceObject . sprintf ) (
/* translators: %d: number of revisions */
( 0 , external _wp _i18n _namespaceObject . _n ) ( '%d Revision' , '%d Revisions' , revisionsCount ) , revisionsCount ) ) ) ;
2021-05-21 12:14:23 +02:00
}
2022-04-11 14:04:30 +02:00
/* harmony default export */ var post _last _revision = ( ( 0 , external _wp _data _namespaceObject . withSelect ) ( select => {
2021-05-21 12:14:23 +02:00
const {
2022-04-11 14:04:30 +02:00
getCurrentPostLastRevisionId ,
getCurrentPostRevisionsCount
2022-04-12 17:12:47 +02:00
} = select ( store _store ) ;
2021-05-21 12:14:23 +02:00
return {
2022-04-11 14:04:30 +02:00
lastRevisionId : getCurrentPostLastRevisionId ( ) ,
revisionsCount : getCurrentPostRevisionsCount ( )
2021-05-21 12:14:23 +02:00
} ;
2022-04-11 14:04:30 +02:00
} ) ( LastRevision ) ) ;
2018-12-14 05:41:57 +01:00
2022-04-12 17:12:47 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-locked-modal/index.js
2019-03-21 13:48:00 +01:00
2021-05-21 12:14:23 +02:00
/ * *
* External dependencies
* /
2019-03-21 13:48:00 +01:00
2018-12-18 04:14:52 +01:00
/ * *
2021-05-20 14:20:04 +02:00
* WordPress dependencies
2018-12-18 04:14:52 +01:00
* /
2018-12-14 05:41:57 +01:00
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
2022-04-12 17:12:47 +02:00
2021-05-21 12:14:23 +02:00
/ * *
* Internal dependencies
* /
2021-05-20 14:20:04 +02:00
2022-04-12 17:12:47 +02:00
function PostLockedModal ( ) {
const instanceId = ( 0 , external _wp _compose _namespaceObject . useInstanceId ) ( PostLockedModal ) ;
const hookName = 'core/editor/post-locked-modal-' + instanceId ;
const {
autosave ,
updatePostLock
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( store _store ) ;
const {
isLocked ,
isTakeover ,
user ,
postId ,
postLockUtils ,
activePostLock ,
postType ,
previewLink
} = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => {
2022-04-11 14:04:30 +02:00
const {
2022-04-12 17:12:47 +02:00
isPostLocked ,
isPostLockTakeover ,
getPostLockUser ,
getCurrentPostId ,
getActivePostLock ,
getEditedPostAttribute ,
getEditedPostPreviewLink ,
getEditorSettings
} = select ( store _store ) ;
const {
getPostType
} = select ( external _wp _coreData _namespaceObject . store ) ;
return {
isLocked : isPostLocked ( ) ,
isTakeover : isPostLockTakeover ( ) ,
user : getPostLockUser ( ) ,
postId : getCurrentPostId ( ) ,
postLockUtils : getEditorSettings ( ) . postLockUtils ,
activePostLock : getActivePostLock ( ) ,
postType : getPostType ( getEditedPostAttribute ( 'type' ) ) ,
previewLink : getEditedPostPreviewLink ( )
} ;
} , [ ] ) ;
( 0 , external _wp _element _namespaceObject . useEffect ) ( ( ) => {
/ * *
* Keep the lock refreshed .
*
* When the user does not send a heartbeat in a heartbeat - tick
* the user is no longer editing and another user can start editing .
*
* @ param { Object } data Data to send in the heartbeat request .
* /
function sendPostLock ( data ) {
if ( isLocked ) {
return ;
}
2018-12-14 05:41:57 +01:00
2022-04-12 17:12:47 +02:00
data [ 'wp-refresh-post-lock' ] = {
lock : activePostLock ,
post _id : postId
} ;
2022-04-11 14:04:30 +02:00
}
2022-04-12 17:12:47 +02:00
/ * *
* Refresh post locks : update the lock string or show the dialog if somebody has taken over editing .
*
* @ param { Object } data Data received in the heartbeat request
* /
2021-11-08 15:29:21 +01:00
2021-05-19 17:09:27 +02:00
2022-04-11 14:04:30 +02:00
function receivePostLock ( data ) {
if ( ! data [ 'wp-refresh-post-lock' ] ) {
return ;
}
2021-05-19 17:09:27 +02:00
2022-04-11 14:04:30 +02:00
const received = data [ 'wp-refresh-post-lock' ] ;
2021-05-19 17:09:27 +02:00
2022-04-11 14:04:30 +02:00
if ( received . lock _error ) {
// Auto save and display the takeover modal.
autosave ( ) ;
updatePostLock ( {
isLocked : true ,
isTakeover : true ,
user : {
2022-04-12 17:12:47 +02:00
name : received . lock _error . name ,
avatar : received . lock _error . avatar _src _2x
2022-04-11 14:04:30 +02:00
}
} ) ;
} else if ( received . new _lock ) {
updatePostLock ( {
isLocked : false ,
activePostLock : received . new _lock
} ) ;
}
}
/ * *
* Unlock the post before the window is exited .
* /
2021-05-19 17:09:27 +02:00
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
function releasePostLock ( ) {
if ( isLocked || ! activePostLock ) {
return ;
}
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const data = new window . FormData ( ) ;
data . append ( 'action' , 'wp-remove-post-lock' ) ;
data . append ( '_wpnonce' , postLockUtils . unlockNonce ) ;
data . append ( 'post_ID' , postId ) ;
data . append ( 'active_post_lock' , activePostLock ) ;
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
if ( window . navigator . sendBeacon ) {
window . navigator . sendBeacon ( postLockUtils . ajaxUrl , data ) ;
} else {
const xhr = new window . XMLHttpRequest ( ) ;
xhr . open ( 'POST' , postLockUtils . ajaxUrl , false ) ;
xhr . send ( data ) ;
}
} // Details on these events on the Heartbeat API docs
// https://developer.wordpress.org/plugins/javascript/heartbeat-api/
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
( 0 , external _wp _hooks _namespaceObject . addAction ) ( 'heartbeat.send' , hookName , sendPostLock ) ;
( 0 , external _wp _hooks _namespaceObject . addAction ) ( 'heartbeat.tick' , hookName , receivePostLock ) ;
window . addEventListener ( 'beforeunload' , releasePostLock ) ;
return ( ) => {
( 0 , external _wp _hooks _namespaceObject . removeAction ) ( 'heartbeat.send' , hookName ) ;
( 0 , external _wp _hooks _namespaceObject . removeAction ) ( 'heartbeat.tick' , hookName ) ;
window . removeEventListener ( 'beforeunload' , releasePostLock ) ;
2021-05-21 12:14:23 +02:00
} ;
} , [ ] ) ;
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
if ( ! isLocked ) {
2021-05-21 12:14:23 +02:00
return null ;
}
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const userDisplayName = user . name ;
const userAvatar = user . avatar ;
const unlockUrl = ( 0 , external _wp _url _namespaceObject . addQueryArgs ) ( 'post.php' , {
'get-post-lock' : '1' ,
lockKey : true ,
post : postId ,
action : 'edit' ,
_wpnonce : postLockUtils . nonce
} ) ;
2022-04-12 17:12:47 +02:00
const allPostsUrl = ( 0 , external _wp _url _namespaceObject . addQueryArgs ) ( 'edit.php' , {
2022-04-11 14:04:30 +02:00
post _type : ( 0 , external _lodash _namespaceObject . get ) ( postType , [ 'slug' ] )
} ) ;
2021-05-20 14:20:04 +02:00
2022-04-12 17:12:47 +02:00
const allPostsLabel = ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Exit editor' ) ;
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Modal , {
2022-04-12 17:12:47 +02:00
title : isTakeover ? ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Someone else has taken over this post' ) : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'This post is already being edited' ) ,
2022-04-11 14:04:30 +02:00
focusOnMount : true ,
shouldCloseOnClickOutside : false ,
shouldCloseOnEsc : false ,
isDismissible : false ,
className : "editor-post-locked-modal"
} , ! ! userAvatar && ( 0 , external _wp _element _namespaceObject . createElement ) ( "img" , {
src : userAvatar ,
alt : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Avatar' ) ,
2022-04-12 17:12:47 +02:00
className : "editor-post-locked-modal__avatar" ,
width : 64 ,
height : 64
} ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( "div" , null , ! ! isTakeover && ( 0 , external _wp _element _namespaceObject . createElement ) ( "p" , null , ( 0 , external _wp _element _namespaceObject . createInterpolateElement ) ( userDisplayName ? ( 0 , external _wp _i18n _namespaceObject . sprintf ) (
2022-04-11 14:04:30 +02:00
/* translators: %s: user's display name */
2022-04-12 17:12:47 +02:00
( 0 , external _wp _i18n _namespaceObject . _ _ ) ( '<strong>%s</strong> now has editing control of this posts (<PreviewLink />). Don’ t worry, your changes up to this moment have been saved.' ) , userDisplayName ) : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Another user now has editing control of this post (<PreviewLink />). Don’ t worry, your changes up to this moment have been saved.' ) , {
strong : ( 0 , external _wp _element _namespaceObject . createElement ) ( "strong" , null ) ,
PreviewLink : ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . ExternalLink , {
href : previewLink
} , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'preview' ) )
} ) ) , ! isTakeover && ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _element _namespaceObject . Fragment , null , ( 0 , external _wp _element _namespaceObject . createElement ) ( "p" , null , ( 0 , external _wp _element _namespaceObject . createInterpolateElement ) ( userDisplayName ? ( 0 , external _wp _i18n _namespaceObject . sprintf ) (
2022-04-11 14:04:30 +02:00
/* translators: %s: user's display name */
2022-04-12 17:12:47 +02:00
( 0 , external _wp _i18n _namespaceObject . _ _ ) ( '<strong>%s</strong> is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.' ) , userDisplayName ) : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Another user is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.' ) , {
strong : ( 0 , external _wp _element _namespaceObject . createElement ) ( "strong" , null ) ,
PreviewLink : ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . ExternalLink , {
href : previewLink
} , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'preview' ) )
} ) ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( "p" , null , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'If you take over, the other user will lose editing control to the post, but their changes will be saved.' ) ) ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Flex , {
className : "editor-post-locked-modal__buttons" ,
justify : "flex-end" ,
expanded : false
} , ! isTakeover && ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . FlexItem , null , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Button , {
variant : "tertiary" ,
2022-04-11 14:04:30 +02:00
href : unlockUrl
2022-04-12 17:12:47 +02:00
} , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Take over' ) ) ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . FlexItem , null , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Button , {
variant : "primary" ,
href : allPostsUrl
} , allPostsLabel ) ) ) ) ) ;
2022-04-11 14:04:30 +02:00
}
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-pending-status/check.js
2021-05-20 14:20:04 +02:00
/ * *
2021-05-21 12:14:23 +02:00
* External dependencies
2021-05-20 14:20:04 +02:00
* /
/ * *
* WordPress dependencies
* /
/ * *
2021-05-21 12:14:23 +02:00
* Internal dependencies
2021-05-20 14:20:04 +02:00
* /
2018-12-18 04:14:52 +01:00
2022-04-11 14:04:30 +02:00
function PostPendingStatusCheck ( _ref ) {
let {
hasPublishAction ,
isPublished ,
children
} = _ref ;
2018-12-18 04:14:52 +01:00
2022-04-11 14:04:30 +02:00
if ( isPublished || ! hasPublishAction ) {
return null ;
}
return children ;
}
/* harmony default export */ var post _pending _status _check = ( ( 0 , external _wp _compose _namespaceObject . compose ) ( ( 0 , external _wp _data _namespaceObject . withSelect ) ( select => {
const {
isCurrentPostPublished ,
getCurrentPostType ,
getCurrentPost
2022-04-12 17:12:47 +02:00
} = select ( store _store ) ;
2022-04-11 14:04:30 +02:00
return {
hasPublishAction : ( 0 , external _lodash _namespaceObject . get ) ( getCurrentPost ( ) , [ '_links' , 'wp:action-publish' ] , false ) ,
isPublished : isCurrentPostPublished ( ) ,
postType : getCurrentPostType ( )
} ;
} ) ) ( PostPendingStatusCheck ) ) ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-pending-status/index.js
2018-12-18 04:14:52 +01:00
2021-11-08 15:29:21 +01:00
2018-12-14 05:41:57 +01:00
/ * *
2022-04-11 14:04:30 +02:00
* WordPress dependencies
2021-05-20 14:20:04 +02:00
* /
2022-04-11 14:04:30 +02:00
/ * *
* Internal dependencies
* /
2021-11-08 15:29:21 +01:00
2021-05-20 14:20:04 +02:00
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
function PostPendingStatus ( _ref ) {
2021-11-15 13:50:17 +01:00
let {
2022-04-11 14:04:30 +02:00
status ,
onUpdateStatus
2021-11-15 13:50:17 +01:00
} = _ref ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
const togglePendingStatus = ( ) => {
const updatedStatus = status === 'pending' ? 'draft' : 'pending' ;
onUpdateStatus ( updatedStatus ) ;
} ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
return ( 0 , external _wp _element _namespaceObject . createElement ) ( post _pending _status _check , null , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . CheckboxControl , {
label : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Pending review' ) ,
checked : status === 'pending' ,
onChange : togglePendingStatus
} ) ) ;
}
/* harmony default export */ var post _pending _status = ( ( 0 , external _wp _compose _namespaceObject . compose ) ( ( 0 , external _wp _data _namespaceObject . withSelect ) ( select => ( {
2022-04-12 17:12:47 +02:00
status : select ( store _store ) . getEditedPostAttribute ( 'status' )
2022-04-11 14:04:30 +02:00
} ) ) , ( 0 , external _wp _data _namespaceObject . withDispatch ) ( dispatch => ( {
onUpdateStatus ( status ) {
2022-04-12 17:12:47 +02:00
dispatch ( store _store ) . editPost ( {
2022-04-11 14:04:30 +02:00
status
} ) ;
}
2019-03-07 10:09:59 +01:00
2022-04-11 14:04:30 +02:00
} ) ) ) ( PostPendingStatus ) ) ;
2019-03-21 13:48:00 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-pingbacks/index.js
2021-11-08 15:29:21 +01:00
2019-03-21 13:48:00 +01:00
2022-04-11 14:04:30 +02:00
/ * *
* WordPress dependencies
* /
2018-12-14 05:41:57 +01:00
2019-03-21 13:48:00 +01:00
2022-04-11 14:04:30 +02:00
/ * *
* Internal dependencies
* /
2019-03-21 13:48:00 +01:00
2021-11-08 15:29:21 +01:00
2022-04-11 14:04:30 +02:00
function PostPingbacks ( _ref ) {
let {
pingStatus = 'open' ,
... props
} = _ref ;
2019-03-21 13:48:00 +01:00
2022-04-11 14:04:30 +02:00
const onTogglePingback = ( ) => props . editPost ( {
ping _status : pingStatus === 'open' ? 'closed' : 'open'
} ) ;
2019-03-21 13:48:00 +01:00
2022-04-11 14:04:30 +02:00
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . CheckboxControl , {
label : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Allow pingbacks & trackbacks' ) ,
checked : pingStatus === 'open' ,
onChange : onTogglePingback
} ) ;
}
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
/* harmony default export */ var post _pingbacks = ( ( 0 , external _wp _compose _namespaceObject . compose ) ( [ ( 0 , external _wp _data _namespaceObject . withSelect ) ( select => {
return {
2022-04-12 17:12:47 +02:00
pingStatus : select ( store _store ) . getEditedPostAttribute ( 'ping_status' )
2022-04-11 14:04:30 +02:00
} ;
} ) , ( 0 , external _wp _data _namespaceObject . withDispatch ) ( dispatch => ( {
2022-04-12 17:12:47 +02:00
editPost : dispatch ( store _store ) . editPost
2022-04-11 14:04:30 +02:00
} ) ) ] ) ( PostPingbacks ) ) ;
2019-03-21 13:48:00 +01:00
2022-04-12 17:12:47 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-preview-button/index.js
2021-05-21 12:14:23 +02:00
/ * *
* External dependencies
* /
2018-12-14 05:41:57 +01:00
2022-04-12 17:12:47 +02:00
2021-05-20 14:20:04 +02:00
/ * *
* WordPress dependencies
* /
2018-12-14 05:41:57 +01:00
2021-05-20 14:20:04 +02:00
2022-04-12 17:12:47 +02:00
2019-03-21 13:48:00 +01:00
/ * *
2021-05-21 12:14:23 +02:00
* Internal dependencies
2019-03-21 13:48:00 +01:00
* /
2018-12-18 04:14:52 +01:00
2021-05-20 14:20:04 +02:00
2018-12-14 12:02:53 +01:00
2022-04-12 17:12:47 +02:00
function writeInterstitialMessage ( targetDocument ) {
let markup = ( 0 , external _wp _element _namespaceObject . renderToString ) ( ( 0 , external _wp _element _namespaceObject . createElement ) ( "div" , {
className : "editor-post-preview-button__interstitial-message"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . SVG , {
xmlns : "http://www.w3.org/2000/svg" ,
viewBox : "0 0 96 96"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Path , {
className : "outer" ,
d : "M48 12c19.9 0 36 16.1 36 36S67.9 84 48 84 12 67.9 12 48s16.1-36 36-36" ,
fill : "none"
} ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Path , {
className : "inner" ,
d : "M69.5 46.4c0-3.9-1.4-6.7-2.6-8.8-1.6-2.6-3.1-4.9-3.1-7.5 0-2.9 2.2-5.7 5.4-5.7h.4C63.9 19.2 56.4 16 48 16c-11.2 0-21 5.7-26.7 14.4h2.1c3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3L40 67.5l7-20.9L42 33c-1.7-.1-3.3-.3-3.3-.3-1.7-.1-1.5-2.7.2-2.6 0 0 5.3.4 8.4.4 3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3l11.5 34.3 3.3-10.4c1.6-4.5 2.4-7.8 2.4-10.5zM16.1 48c0 12.6 7.3 23.5 18 28.7L18.8 35c-1.7 4-2.7 8.4-2.7 13zm32.5 2.8L39 78.6c2.9.8 5.9 1.3 9 1.3 3.7 0 7.3-.6 10.6-1.8-.1-.1-.2-.3-.2-.4l-9.8-26.9zM76.2 36c0 3.2-.6 6.9-2.4 11.4L64 75.6c9.5-5.5 15.9-15.8 15.9-27.6 0-5.5-1.4-10.8-3.9-15.3.1 1 .2 2.1.2 3.3z" ,
fill : "none"
} ) ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( "p" , null , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Generating preview…' ) ) ) ) ;
markup += `
< style >
body {
margin : 0 ;
}
. editor - post - preview - button _ _interstitial - message {
display : flex ;
flex - direction : column ;
align - items : center ;
justify - content : center ;
height : 100 vh ;
width : 100 vw ;
}
@ - webkit - keyframes paint {
0 % {
stroke - dashoffset : 0 ;
}
}
@ - moz - keyframes paint {
0 % {
stroke - dashoffset : 0 ;
}
}
@ - o - keyframes paint {
0 % {
stroke - dashoffset : 0 ;
}
}
@ keyframes paint {
0 % {
stroke - dashoffset : 0 ;
}
}
. editor - post - preview - button _ _interstitial - message svg {
width : 192 px ;
height : 192 px ;
stroke : # 555 d66 ;
stroke - width : 0.75 ;
}
. editor - post - preview - button _ _interstitial - message svg . outer ,
. editor - post - preview - button _ _interstitial - message svg . inner {
stroke - dasharray : 280 ;
stroke - dashoffset : 280 ;
- webkit - animation : paint 1.5 s ease infinite alternate ;
- moz - animation : paint 1.5 s ease infinite alternate ;
- o - animation : paint 1.5 s ease infinite alternate ;
animation : paint 1.5 s ease infinite alternate ;
}
p {
text - align : center ;
font - family : - apple - system , BlinkMacSystemFont , "Segoe UI" , Roboto , Oxygen - Sans , Ubuntu , Cantarell , "Helvetica Neue" , sans - serif ;
}
< / s t y l e >
` ;
/ * *
* Filters the interstitial message shown when generating previews .
*
* @ param { string } markup The preview interstitial markup .
* /
markup = ( 0 , external _wp _hooks _namespaceObject . applyFilters ) ( 'editor.PostPreview.interstitialMarkup' , markup ) ;
targetDocument . write ( markup ) ;
targetDocument . title = ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Generating preview…' ) ;
targetDocument . close ( ) ;
}
class PostPreviewButton extends external _wp _element _namespaceObject . Component {
constructor ( ) {
super ( ... arguments ) ;
this . buttonRef = ( 0 , external _wp _element _namespaceObject . createRef ) ( ) ;
this . openPreviewWindow = this . openPreviewWindow . bind ( this ) ;
}
componentDidUpdate ( prevProps ) {
const {
previewLink
} = this . props ; // This relies on the window being responsible to unset itself when
// navigation occurs or a new preview window is opened, to avoid
// unintentional forceful redirects.
if ( previewLink && ! prevProps . previewLink ) {
this . setPreviewWindowLink ( previewLink ) ;
}
}
/ * *
* Sets the preview window ' s location to the given URL , if a preview window
* exists and is not closed .
*
* @ param { string } url URL to assign as preview window location .
* /
setPreviewWindowLink ( url ) {
const {
previewWindow
} = this ;
if ( previewWindow && ! previewWindow . closed ) {
previewWindow . location = url ;
if ( this . buttonRef . current ) {
this . buttonRef . current . focus ( ) ;
}
}
}
getWindowTarget ( ) {
const {
postId
} = this . props ;
return ` wp-preview- ${ postId } ` ;
}
openPreviewWindow ( event ) {
// Our Preview button has its 'href' and 'target' set correctly for a11y
// purposes. Unfortunately, though, we can't rely on the default 'click'
// handler since sometimes it incorrectly opens a new tab instead of reusing
// the existing one.
// https://github.com/WordPress/gutenberg/pull/8330
event . preventDefault ( ) ; // Open up a Preview tab if needed. This is where we'll show the preview.
if ( ! this . previewWindow || this . previewWindow . closed ) {
this . previewWindow = window . open ( '' , this . getWindowTarget ( ) ) ;
} // Focus the Preview tab. This might not do anything, depending on the browser's
// and user's preferences.
// https://html.spec.whatwg.org/multipage/interaction.html#dom-window-focus
this . previewWindow . focus ( ) ;
if ( // If we don't need to autosave the post before previewing, then we simply
// load the Preview URL in the Preview tab.
! this . props . isAutosaveable || // Do not save or overwrite the post, if the post is already locked.
this . props . isPostLocked ) {
this . setPreviewWindowLink ( event . target . href ) ;
return ;
} // Request an autosave. This happens asynchronously and causes the component
// to update when finished.
if ( this . props . isDraft ) {
this . props . savePost ( {
isPreview : true
} ) ;
} else {
this . props . autosave ( {
isPreview : true
} ) ;
} // Display a 'Generating preview' message in the Preview tab while we wait for the
// autosave to finish.
writeInterstitialMessage ( this . previewWindow . document ) ;
}
render ( ) {
const {
previewLink ,
currentPostLink ,
isSaveable ,
role
} = this . props ; // Link to the `?preview=true` URL if we have it, since this lets us see
// changes that were autosaved since the post was last published. Otherwise,
// just link to the post's URL.
const href = previewLink || currentPostLink ;
const classNames = classnames _default ( ) ( {
'editor-post-preview' : ! this . props . className
} , this . props . className ) ;
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Button , {
variant : ! this . props . className ? 'tertiary' : undefined ,
className : classNames ,
href : href ,
target : this . getWindowTarget ( ) ,
disabled : ! isSaveable ,
onClick : this . openPreviewWindow ,
ref : this . buttonRef ,
role : role
} , this . props . textContent ? this . props . textContent : ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _element _namespaceObject . Fragment , null , ( 0 , external _wp _i18n _namespaceObject . _x ) ( 'Preview' , 'imperative verb' ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . VisuallyHidden , {
as : "span"
} ,
/* translators: accessibility text */
( 0 , external _wp _i18n _namespaceObject . _ _ ) ( '(opens in a new tab)' ) ) ) ) ;
}
}
/* harmony default export */ var post _preview _button = ( ( 0 , external _wp _compose _namespaceObject . compose ) ( [ ( 0 , external _wp _data _namespaceObject . withSelect ) ( ( select , _ref ) => {
let {
forcePreviewLink ,
forceIsAutosaveable
} = _ref ;
const {
getCurrentPostId ,
getCurrentPostAttribute ,
getEditedPostAttribute ,
isEditedPostSaveable ,
isEditedPostAutosaveable ,
getEditedPostPreviewLink ,
isPostLocked
} = select ( store _store ) ;
const {
getPostType
} = select ( external _wp _coreData _namespaceObject . store ) ;
const previewLink = getEditedPostPreviewLink ( ) ;
const postType = getPostType ( getEditedPostAttribute ( 'type' ) ) ;
return {
postId : getCurrentPostId ( ) ,
currentPostLink : getCurrentPostAttribute ( 'link' ) ,
previewLink : forcePreviewLink !== undefined ? forcePreviewLink : previewLink ,
isSaveable : isEditedPostSaveable ( ) ,
isAutosaveable : forceIsAutosaveable || isEditedPostAutosaveable ( ) ,
isViewable : ( 0 , external _lodash _namespaceObject . get ) ( postType , [ 'viewable' ] , false ) ,
isDraft : [ 'draft' , 'auto-draft' ] . indexOf ( getEditedPostAttribute ( 'status' ) ) !== - 1 ,
isPostLocked : isPostLocked ( )
} ;
} ) , ( 0 , external _wp _data _namespaceObject . withDispatch ) ( dispatch => ( {
autosave : dispatch ( store _store ) . autosave ,
savePost : dispatch ( store _store ) . savePost
} ) ) , ( 0 , external _wp _compose _namespaceObject . ifCondition ) ( _ref2 => {
let {
isViewable
} = _ref2 ;
return isViewable ;
} ) ] ) ( PostPreviewButton ) ) ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-button/label.js
/ * *
* External dependencies
* /
/ * *
* WordPress dependencies
* /
/ * *
* Internal dependencies
* /
function PublishButtonLabel ( _ref ) {
let {
isPublished ,
isBeingScheduled ,
isSaving ,
isPublishing ,
hasPublishAction ,
isAutosaving ,
hasNonPostEntityChanges
} = _ref ;
if ( isPublishing ) {
/* translators: button label text should, if possible, be under 16 characters. */
return ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Publishing…' ) ;
} else if ( isPublished && isSaving && ! isAutosaving ) {
/* translators: button label text should, if possible, be under 16 characters. */
return ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Updating…' ) ;
} else if ( isBeingScheduled && isSaving && ! isAutosaving ) {
/* translators: button label text should, if possible, be under 16 characters. */
return ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Scheduling…' ) ;
}
if ( ! hasPublishAction ) {
return hasNonPostEntityChanges ? ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Submit for Review…' ) : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Submit for Review' ) ;
2022-04-11 14:04:30 +02:00
} else if ( isPublished ) {
return hasNonPostEntityChanges ? ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Update…' ) : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Update' ) ;
} else if ( isBeingScheduled ) {
return hasNonPostEntityChanges ? ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Schedule…' ) : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Schedule' ) ;
2021-05-21 12:14:23 +02:00
}
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
return ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Publish' ) ;
2021-05-21 12:14:23 +02:00
}
2022-04-11 14:04:30 +02:00
/* harmony default export */ var label = ( ( 0 , external _wp _compose _namespaceObject . compose ) ( [ ( 0 , external _wp _data _namespaceObject . withSelect ) ( ( select , _ref2 ) => {
let {
forceIsSaving
} = _ref2 ;
const {
isCurrentPostPublished ,
isEditedPostBeingScheduled ,
isSavingPost ,
isPublishingPost ,
getCurrentPost ,
getCurrentPostType ,
isAutosavingPost
2022-04-12 17:12:47 +02:00
} = select ( store _store ) ;
2021-05-21 12:14:23 +02:00
return {
2022-04-11 14:04:30 +02:00
isPublished : isCurrentPostPublished ( ) ,
isBeingScheduled : isEditedPostBeingScheduled ( ) ,
isSaving : forceIsSaving || isSavingPost ( ) ,
isPublishing : isPublishingPost ( ) ,
hasPublishAction : ( 0 , external _lodash _namespaceObject . get ) ( getCurrentPost ( ) , [ '_links' , 'wp:action-publish' ] , false ) ,
postType : getCurrentPostType ( ) ,
isAutosaving : isAutosavingPost ( )
2021-05-21 12:14:23 +02:00
} ;
2022-04-11 14:04:30 +02:00
} ) ] ) ( PublishButtonLabel ) ) ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-button/index.js
2021-05-20 14:20:04 +02:00
2018-12-14 12:02:53 +01:00
2018-12-14 05:41:57 +01:00
2018-12-18 04:14:52 +01:00
/ * *
2021-05-21 12:14:23 +02:00
* External dependencies
2018-12-18 04:14:52 +01:00
* /
2022-04-11 14:04:30 +02:00
2018-12-14 05:41:57 +01:00
/ * *
2021-05-20 14:20:04 +02:00
* WordPress dependencies
2018-12-14 05:41:57 +01:00
* /
2021-11-08 15:29:21 +01:00
2022-04-11 14:04:30 +02:00
2021-05-20 14:20:04 +02:00
/ * *
2021-05-21 12:14:23 +02:00
* Internal dependencies
2021-05-20 14:20:04 +02:00
* /
2018-12-14 05:41:57 +01:00
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
class PostPublishButton extends external _wp _element _namespaceObject . Component {
constructor ( props ) {
super ( props ) ;
this . buttonNode = ( 0 , external _wp _element _namespaceObject . createRef ) ( ) ;
this . createOnClick = this . createOnClick . bind ( this ) ;
this . closeEntitiesSavedStates = this . closeEntitiesSavedStates . bind ( this ) ;
this . state = {
entitiesSavedStatesCallback : false
2021-05-21 12:14:23 +02:00
} ;
}
2018-12-18 04:14:52 +01:00
2022-04-11 14:04:30 +02:00
componentDidMount ( ) {
if ( this . props . focusOnMount ) {
this . buttonNode . current . focus ( ) ;
}
}
2018-12-18 04:14:52 +01:00
2022-04-11 14:04:30 +02:00
createOnClick ( callback ) {
var _this = this ;
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
return function ( ) {
for ( var _len = arguments . length , args = new Array ( _len ) , _key = 0 ; _key < _len ; _key ++ ) {
args [ _key ] = arguments [ _key ] ;
}
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const {
hasNonPostEntityChanges ,
setEntitiesSavedStatesCallback
} = _this . props ; // If a post with non-post entities is published, but the user
// elects to not save changes to the non-post entities, those
// entities will still be dirty when the Publish button is clicked.
// We also need to check that the `setEntitiesSavedStatesCallback`
// prop was passed. See https://github.com/WordPress/gutenberg/pull/37383
2021-11-08 15:29:21 +01:00
2022-04-11 14:04:30 +02:00
if ( hasNonPostEntityChanges && setEntitiesSavedStatesCallback ) {
// The modal for multiple entity saving will open,
// hold the callback for saving/publishing the post
// so that we can call it if the post entity is checked.
_this . setState ( {
entitiesSavedStatesCallback : ( ) => callback ( ... args )
} ) ; // Open the save panel by setting its callback.
// To set a function on the useState hook, we must set it
// with another function (() => myFunction). Passing the
// function on its own will cause an error when called.
2021-11-08 15:29:21 +01:00
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
setEntitiesSavedStatesCallback ( ( ) => _this . closeEntitiesSavedStates ) ;
return external _lodash _namespaceObject . noop ;
}
2018-12-18 04:14:52 +01:00
2022-04-11 14:04:30 +02:00
return callback ( ... args ) ;
} ;
}
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
closeEntitiesSavedStates ( savedEntities ) {
const {
postType ,
postId
} = this . props ;
const {
entitiesSavedStatesCallback
} = this . state ;
this . setState ( {
entitiesSavedStatesCallback : false
} , ( ) => {
if ( savedEntities && ( 0 , external _lodash _namespaceObject . some ) ( savedEntities , elt => elt . kind === 'postType' && elt . name === postType && elt . key === postId ) ) {
// The post entity was checked, call the held callback from `createOnClick`.
entitiesSavedStatesCallback ( ) ;
}
} ) ;
}
2018-12-18 04:14:52 +01:00
2022-04-11 14:04:30 +02:00
render ( ) {
const {
forceIsDirty ,
forceIsSaving ,
hasPublishAction ,
isBeingScheduled ,
isOpen ,
isPostSavingLocked ,
isPublishable ,
isPublished ,
isSaveable ,
isSaving ,
isAutoSaving ,
isToggle ,
onSave ,
onStatusChange ,
onSubmit = external _lodash _namespaceObject . noop ,
onToggle ,
visibility ,
hasNonPostEntityChanges ,
isSavingNonPostEntityChanges
} = this . props ;
const isButtonDisabled = ( isSaving || forceIsSaving || ! isSaveable || isPostSavingLocked || ! isPublishable && ! forceIsDirty ) && ( ! hasNonPostEntityChanges || isSavingNonPostEntityChanges ) ;
const isToggleDisabled = ( isPublished || isSaving || forceIsSaving || ! isSaveable || ! isPublishable && ! forceIsDirty ) && ( ! hasNonPostEntityChanges || isSavingNonPostEntityChanges ) ;
let publishStatus ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
if ( ! hasPublishAction ) {
publishStatus = 'pending' ;
} else if ( visibility === 'private' ) {
publishStatus = 'private' ;
} else if ( isBeingScheduled ) {
publishStatus = 'future' ;
} else {
publishStatus = 'publish' ;
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
const onClickButton = ( ) => {
if ( isButtonDisabled ) {
return ;
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
onSubmit ( ) ;
onStatusChange ( publishStatus ) ;
onSave ( ) ;
} ;
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const onClickToggle = ( ) => {
if ( isToggleDisabled ) {
return ;
}
2021-11-08 15:29:21 +01:00
2022-04-11 14:04:30 +02:00
onToggle ( ) ;
2021-05-21 12:14:23 +02:00
} ;
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const buttonProps = {
'aria-disabled' : isButtonDisabled ,
className : 'editor-post-publish-button' ,
isBusy : ! isAutoSaving && isSaving && isPublished ,
variant : 'primary' ,
onClick : this . createOnClick ( onClickButton )
} ;
const toggleProps = {
'aria-disabled' : isToggleDisabled ,
'aria-expanded' : isOpen ,
className : 'editor-post-publish-panel__toggle' ,
isBusy : isSaving && isPublished ,
variant : 'primary' ,
onClick : this . createOnClick ( onClickToggle )
} ;
const toggleChildren = isBeingScheduled ? ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Schedule…' ) : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Publish' ) ;
const buttonChildren = ( 0 , external _wp _element _namespaceObject . createElement ) ( label , {
forceIsSaving : forceIsSaving ,
hasNonPostEntityChanges : hasNonPostEntityChanges
2021-05-21 12:14:23 +02:00
} ) ;
2022-04-11 14:04:30 +02:00
const componentProps = isToggle ? toggleProps : buttonProps ;
const componentChildren = isToggle ? toggleChildren : buttonChildren ;
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _element _namespaceObject . Fragment , null , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Button , _extends ( {
ref : this . buttonNode
} , componentProps , {
className : classnames _default ( ) ( componentProps . className , 'editor-post-publish-button__button' , {
'has-changes-dot' : hasNonPostEntityChanges
} )
} ) , componentChildren ) ) ;
2021-05-21 12:14:23 +02:00
}
2020-01-22 23:06:21 +01:00
2022-04-11 14:04:30 +02:00
}
/* harmony default export */ var post _publish _button = ( ( 0 , external _wp _compose _namespaceObject . compose ) ( [ ( 0 , external _wp _data _namespaceObject . withSelect ) ( select => {
const {
isSavingPost ,
isAutosavingPost ,
isEditedPostBeingScheduled ,
getEditedPostVisibility ,
isCurrentPostPublished ,
isEditedPostSaveable ,
isEditedPostPublishable ,
isPostSavingLocked ,
getCurrentPost ,
getCurrentPostType ,
getCurrentPostId ,
hasNonPostEntityChanges ,
isSavingNonPostEntityChanges
2022-04-12 17:12:47 +02:00
} = select ( store _store ) ;
2022-04-11 14:04:30 +02:00
const _isAutoSaving = isAutosavingPost ( ) ;
return {
isSaving : isSavingPost ( ) || _isAutoSaving ,
isAutoSaving : _isAutoSaving ,
isBeingScheduled : isEditedPostBeingScheduled ( ) ,
visibility : getEditedPostVisibility ( ) ,
isSaveable : isEditedPostSaveable ( ) ,
isPostSavingLocked : isPostSavingLocked ( ) ,
isPublishable : isEditedPostPublishable ( ) ,
isPublished : isCurrentPostPublished ( ) ,
hasPublishAction : ( 0 , external _lodash _namespaceObject . get ) ( getCurrentPost ( ) , [ '_links' , 'wp:action-publish' ] , false ) ,
postType : getCurrentPostType ( ) ,
postId : getCurrentPostId ( ) ,
hasNonPostEntityChanges : hasNonPostEntityChanges ( ) ,
isSavingNonPostEntityChanges : isSavingNonPostEntityChanges ( )
} ;
} ) , ( 0 , external _wp _data _namespaceObject . withDispatch ) ( dispatch => {
const {
editPost ,
savePost
2022-04-12 17:12:47 +02:00
} = dispatch ( store _store ) ;
2022-04-11 14:04:30 +02:00
return {
onStatusChange : status => editPost ( {
status
} , {
undoIgnore : true
} ) ,
onSave : savePost
} ;
} ) ] ) ( PostPublishButton ) ) ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js
2021-05-20 14:20:04 +02:00
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
/ * *
* WordPress dependencies
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
const closeSmall = ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _primitives _namespaceObject . SVG , {
xmlns : "http://www.w3.org/2000/svg" ,
viewBox : "0 0 24 24"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _primitives _namespaceObject . Path , {
d : "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"
} ) ) ;
/* harmony default export */ var close _small = ( closeSmall ) ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/wordpress.js
2018-12-14 05:41:57 +01:00
/ * *
2022-04-11 14:04:30 +02:00
* WordPress dependencies
2018-12-14 05:41:57 +01:00
* /
2022-04-11 14:04:30 +02:00
const wordpress = ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _primitives _namespaceObject . SVG , {
xmlns : "http://www.w3.org/2000/svg" ,
viewBox : "-2 -2 24 24"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _primitives _namespaceObject . Path , {
d : "M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z"
} ) ) ;
/* harmony default export */ var library _wordpress = ( wordpress ) ;
2022-04-12 17:12:47 +02:00
; // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
function _defineProperty ( obj , key , value ) {
if ( key in obj ) {
Object . defineProperty ( obj , key , {
value : value ,
enumerable : true ,
configurable : true ,
writable : true
} ) ;
} else {
obj [ key ] = value ;
}
return obj ;
}
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/utils.js
2021-05-20 14:20:04 +02:00
/ * *
* WordPress dependencies
* /
2020-06-26 15:33:47 +02:00
2022-04-11 14:04:30 +02:00
const visibilityOptions = [ {
value : 'public' ,
label : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Public' ) ,
info : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Visible to everyone.' )
} , {
value : 'private' ,
label : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Private' ) ,
info : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Only visible to site admins and editors.' )
} , {
value : 'password' ,
label : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Password Protected' ) ,
info : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Protected with a password you choose. Only those with the password can view this post.' )
} ] ;
2020-01-22 23:06:21 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/index.js
2021-05-19 17:09:27 +02:00
2022-04-12 17:12:47 +02:00
2022-04-11 14:04:30 +02:00
/ * *
* WordPress dependencies
* /
2018-12-14 05:41:57 +01:00
2019-01-04 20:38:57 +01:00
2018-12-14 05:41:57 +01:00
2021-11-08 15:29:21 +01:00
2021-05-21 12:14:23 +02:00
/ * *
* Internal dependencies
* /
2018-12-14 05:41:57 +01:00
2021-05-19 17:09:27 +02:00
2021-11-08 15:29:21 +01:00
2022-04-11 14:04:30 +02:00
class PostVisibility extends external _wp _element _namespaceObject . Component {
constructor ( props ) {
2021-05-21 12:14:23 +02:00
super ( ... arguments ) ;
2022-04-12 17:12:47 +02:00
_defineProperty ( this , "confirmPrivate" , ( ) => {
const {
onUpdateVisibility ,
onSave
} = this . props ;
onUpdateVisibility ( 'private' ) ;
this . setState ( {
hasPassword : false ,
showPrivateConfirmDialog : false
} ) ;
onSave ( ) ;
} ) ;
_defineProperty ( this , "handleDialogCancel" , ( ) => {
this . setState ( {
showPrivateConfirmDialog : false
} ) ;
} ) ;
2022-04-11 14:04:30 +02:00
this . setPublic = this . setPublic . bind ( this ) ;
this . setPrivate = this . setPrivate . bind ( this ) ;
this . setPasswordProtected = this . setPasswordProtected . bind ( this ) ;
this . updatePassword = this . updatePassword . bind ( this ) ;
2021-05-21 12:14:23 +02:00
this . state = {
2022-04-12 17:12:47 +02:00
hasPassword : ! ! props . password ,
showPrivateConfirmDialog : false
2021-05-21 12:14:23 +02:00
} ;
}
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
setPublic ( ) {
const {
visibility ,
onUpdateVisibility ,
status
} = this . props ;
onUpdateVisibility ( visibility === 'private' ? 'draft' : status ) ;
this . setState ( {
hasPassword : false
} ) ;
2021-05-21 12:14:23 +02:00
}
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
setPrivate ( ) {
this . setState ( {
2022-04-12 17:12:47 +02:00
showPrivateConfirmDialog : true
2022-04-11 14:04:30 +02:00
} ) ;
2021-05-21 12:14:23 +02:00
}
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
setPasswordProtected ( ) {
const {
visibility ,
onUpdateVisibility ,
status ,
password
} = this . props ;
onUpdateVisibility ( visibility === 'private' ? 'draft' : status , password || '' ) ;
2021-05-21 12:14:23 +02:00
this . setState ( {
2022-04-11 14:04:30 +02:00
hasPassword : true
2021-05-21 12:14:23 +02:00
} ) ;
}
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
updatePassword ( event ) {
const {
status ,
onUpdateVisibility
} = this . props ;
onUpdateVisibility ( status , event . target . value ) ;
2021-05-21 12:14:23 +02:00
}
2021-05-20 14:20:04 +02:00
2021-05-21 12:14:23 +02:00
render ( ) {
const {
2022-04-11 14:04:30 +02:00
visibility ,
password ,
instanceId
2021-05-21 12:14:23 +02:00
} = this . props ;
2022-04-11 14:04:30 +02:00
const visibilityHandlers = {
public : {
onSelect : this . setPublic ,
checked : visibility === 'public' && ! this . state . hasPassword
} ,
private : {
onSelect : this . setPrivate ,
checked : visibility === 'private'
} ,
password : {
onSelect : this . setPasswordProtected ,
checked : this . state . hasPassword
}
} ;
return [ ( 0 , external _wp _element _namespaceObject . createElement ) ( "fieldset" , {
key : "visibility-selector" ,
className : "editor-post-visibility__dialog-fieldset"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( "legend" , {
className : "editor-post-visibility__dialog-legend"
} , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Post Visibility' ) ) , visibilityOptions . map ( _ref => {
let {
value ,
label ,
info
} = _ref ;
return ( 0 , external _wp _element _namespaceObject . createElement ) ( "div" , {
key : value ,
className : "editor-post-visibility__choice"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( "input" , {
type : "radio" ,
name : ` editor-post-visibility__setting- ${ instanceId } ` ,
value : value ,
onChange : visibilityHandlers [ value ] . onSelect ,
checked : visibilityHandlers [ value ] . checked ,
id : ` editor-post- ${ value } - ${ instanceId } ` ,
"aria-describedby" : ` editor-post- ${ value } - ${ instanceId } -description ` ,
className : "editor-post-visibility__dialog-radio"
} ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( "label" , {
htmlFor : ` editor-post- ${ value } - ${ instanceId } ` ,
className : "editor-post-visibility__dialog-label"
} , label ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( "p" , {
id : ` editor-post- ${ value } - ${ instanceId } -description ` ,
className : "editor-post-visibility__dialog-info"
} , info ) ) ;
} ) ) , this . state . hasPassword && ( 0 , external _wp _element _namespaceObject . createElement ) ( "div" , {
className : "editor-post-visibility__dialog-password" ,
key : "password-selector"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . VisuallyHidden , {
as : "label" ,
htmlFor : ` editor-post-visibility__dialog-password-input- ${ instanceId } `
} , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Create password' ) ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( "input" , {
className : "editor-post-visibility__dialog-password-input" ,
id : ` editor-post-visibility__dialog-password-input- ${ instanceId } ` ,
type : "text" ,
onChange : this . updatePassword ,
value : password ,
placeholder : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Use a secure password' )
2022-04-12 17:12:47 +02:00
} ) ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . _ _experimentalConfirmDialog , {
key : "private-publish-confirmation" ,
isOpen : this . state . showPrivateConfirmDialog ,
onConfirm : this . confirmPrivate ,
onCancel : this . handleDialogCancel
} , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Would you like to privately publish this post now?' ) ) ] ;
}
}
/* harmony default export */ var post _visibility = ( ( 0 , external _wp _compose _namespaceObject . compose ) ( [ ( 0 , external _wp _data _namespaceObject . withSelect ) ( select => {
const {
getEditedPostAttribute ,
getEditedPostVisibility
} = select ( store _store ) ;
return {
status : getEditedPostAttribute ( 'status' ) ,
visibility : getEditedPostVisibility ( ) ,
password : getEditedPostAttribute ( 'password' )
} ;
} ) , ( 0 , external _wp _data _namespaceObject . withDispatch ) ( dispatch => {
const {
savePost ,
editPost
} = dispatch ( store _store ) ;
return {
onSave : savePost ,
onUpdateVisibility ( status ) {
let password = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : '' ;
editPost ( {
status ,
password
} ) ;
}
} ;
} ) , external _wp _compose _namespaceObject . withInstanceId ] ) ( PostVisibility ) ) ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/label.js
/ * *
* External dependencies
* /
/ * *
* WordPress dependencies
* /
/ * *
* Internal dependencies
* /
function PostVisibilityLabel ( _ref ) {
let {
visibility
} = _ref ;
const getVisibilityLabel = ( ) => ( 0 , external _lodash _namespaceObject . find ) ( visibilityOptions , {
value : visibility
} ) . label ;
return getVisibilityLabel ( visibility ) ;
}
/* harmony default export */ var post _visibility _label = ( ( 0 , external _wp _data _namespaceObject . withSelect ) ( select => ( {
visibility : select ( store _store ) . getEditedPostVisibility ( )
} ) ) ( PostVisibilityLabel ) ) ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-schedule/index.js
/ * *
* WordPress dependencies
* /
/ * *
* Internal dependencies
* /
function getDayOfTheMonth ( ) {
let date = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : new Date ( ) ;
let firstDay = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : true ;
const d = new Date ( date ) ;
return new Date ( d . getFullYear ( ) , d . getMonth ( ) + ( firstDay ? 0 : 1 ) , firstDay ? 1 : 0 ) . toISOString ( ) ;
}
function PostSchedule ( ) {
const {
postDate ,
postType
} = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => ( {
postDate : select ( store _store ) . getEditedPostAttribute ( 'date' ) ,
postType : select ( store _store ) . getCurrentPostType ( )
} ) , [ ] ) ;
const {
editPost
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( store _store ) ;
const onUpdateDate = date => editPost ( {
date
} ) ;
const [ previewedMonth , setPreviewedMonth ] = ( 0 , external _wp _element _namespaceObject . useState ) ( getDayOfTheMonth ( postDate ) ) ; // Pick up published and schduled site posts.
const eventsByPostType = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => select ( external _wp _coreData _namespaceObject . store ) . getEntityRecords ( 'postType' , postType , {
status : 'publish,future' ,
after : getDayOfTheMonth ( previewedMonth ) ,
before : getDayOfTheMonth ( previewedMonth , false ) ,
exclude : [ select ( store _store ) . getCurrentPostId ( ) ]
} ) , [ previewedMonth , postType ] ) ;
const events = ( 0 , external _wp _element _namespaceObject . useMemo ) ( ( ) => ( eventsByPostType || [ ] ) . map ( _ref => {
let {
title ,
type ,
date : eventDate
} = _ref ;
return {
title : title === null || title === void 0 ? void 0 : title . rendered ,
type ,
date : new Date ( eventDate )
} ;
} ) , [ eventsByPostType ] ) ;
const ref = ( 0 , external _wp _element _namespaceObject . useRef ) ( ) ;
const settings = ( 0 , external _wp _date _namespaceObject . _ _experimentalGetSettings ) ( ) ; // To know if the current timezone is a 12 hour time with look for "a" in the time format
// We also make sure this a is not escaped by a "/"
const is12HourTime = /a(?!\\)/i . test ( settings . formats . time . toLowerCase ( ) // Test only the lower case a.
. replace ( /\\\\/g , '' ) // Replace "//" with empty strings.
. split ( '' ) . reverse ( ) . join ( '' ) // Reverse the string and test for "a" not followed by a slash.
) ;
function onChange ( newDate ) {
onUpdateDate ( newDate ) ;
const {
ownerDocument
} = ref . current ;
ownerDocument . activeElement . blur ( ) ;
}
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . DateTimePicker , {
ref : ref ,
currentDate : postDate ,
onChange : onChange ,
is12Hour : is12HourTime ,
events : events ,
onMonthPreviewed : setPreviewedMonth
} ) ;
}
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-schedule/label.js
/ * *
* WordPress dependencies
* /
/ * *
* Internal dependencies
* /
function PostScheduleLabel ( _ref ) {
let {
date ,
isFloating
} = _ref ;
const settings = ( 0 , external _wp _date _namespaceObject . _ _experimentalGetSettings ) ( ) ;
return date && ! isFloating ? ( 0 , external _wp _date _namespaceObject . format ) ( ` ${ settings . formats . date } ${ settings . formats . time } ` , date ) : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Immediately' ) ;
}
/* harmony default export */ var post _schedule _label = ( ( 0 , external _wp _data _namespaceObject . withSelect ) ( select => {
return {
date : select ( store _store ) . getEditedPostAttribute ( 'date' ) ,
isFloating : select ( store _store ) . isEditedPostDateFloating ( )
} ;
} ) ( PostScheduleLabel ) ) ;
; // CONCATENATED MODULE: external ["wp","a11y"]
var external _wp _a11y _namespaceObject = window [ "wp" ] [ "a11y" ] ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/most-used-terms.js
/ * *
* External dependencies
* /
/ * *
* WordPress dependencies
* /
/ * *
* Internal dependencies
* /
const MIN _MOST _USED _TERMS = 3 ;
const DEFAULT _QUERY = {
per _page : 10 ,
orderby : 'count' ,
order : 'desc' ,
hide _empty : true ,
_fields : 'id,name,count' ,
context : 'view'
} ;
function MostUsedTerms ( _ref ) {
let {
onSelect ,
taxonomy
} = _ref ;
const {
_terms ,
showTerms
} = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => {
const mostUsedTerms = select ( external _wp _coreData _namespaceObject . store ) . getEntityRecords ( 'taxonomy' , taxonomy . slug , DEFAULT _QUERY ) ;
return {
_terms : mostUsedTerms ,
showTerms : ( mostUsedTerms === null || mostUsedTerms === void 0 ? void 0 : mostUsedTerms . length ) >= MIN _MOST _USED _TERMS
} ;
} , [ ] ) ;
if ( ! showTerms ) {
return null ;
2021-05-21 12:14:23 +02:00
}
2021-05-20 14:20:04 +02:00
2022-04-12 17:12:47 +02:00
const terms = unescapeTerms ( _terms ) ;
const label = ( 0 , external _lodash _namespaceObject . get ) ( taxonomy , [ 'labels' , 'most_used' ] ) ;
return ( 0 , external _wp _element _namespaceObject . createElement ) ( "div" , {
className : "editor-post-taxonomies__flat-term-most-used"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( "h3" , {
className : "editor-post-taxonomies__flat-term-most-used-label"
} , label ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( "ul" , {
role : "list" ,
className : "editor-post-taxonomies__flat-term-most-used-list"
} , terms . map ( term => ( 0 , external _wp _element _namespaceObject . createElement ) ( "li" , {
key : term . id
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Button , {
variant : "link" ,
onClick : ( ) => onSelect ( term )
} , term . name ) ) ) ) ) ;
2021-05-21 12:14:23 +02:00
}
2021-01-28 03:04:13 +01:00
2022-04-12 17:12:47 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/flat-term-selector.js
2018-12-14 05:41:57 +01:00
2020-02-10 23:33:27 +01:00
2021-05-21 12:14:23 +02:00
/ * *
* External dependencies
* /
2021-04-15 17:19:43 +02:00
2018-12-18 04:14:52 +01:00
/ * *
2019-03-21 13:48:00 +01:00
* WordPress dependencies
2018-12-18 04:14:52 +01:00
* /
2018-12-14 05:41:57 +01:00
2019-03-21 13:48:00 +01:00
2022-04-12 17:12:47 +02:00
2022-04-11 14:04:30 +02:00
/ * *
* Internal dependencies
* /
2022-04-12 17:12:47 +02:00
/ * *
* Shared reference to an empty array for cases where it is important to avoid
* returning a new array reference on every invocation .
*
* @ type { Array < any > }
* /
const flat _term _selector _EMPTY _ARRAY = [ ] ;
/ * *
* Module constants
* /
const MAX _TERMS _SUGGESTIONS = 20 ;
const flat _term _selector _DEFAULT _QUERY = {
per _page : MAX _TERMS _SUGGESTIONS ,
orderby : 'count' ,
order : 'desc' ,
_fields : 'id,name' ,
context : 'view'
} ;
const isSameTermName = ( termA , termB ) => unescapeString ( termA ) . toLowerCase ( ) === unescapeString ( termB ) . toLowerCase ( ) ;
const termNamesToIds = ( names , terms ) => {
return names . map ( termName => ( 0 , external _lodash _namespaceObject . find ) ( terms , term => isSameTermName ( term . name , termName ) ) . id ) ;
} ; // Tries to create a term or fetch it if it already exists.
function findOrCreateTerm ( termName , restBase ) {
const escapedTermName = ( 0 , external _lodash _namespaceObject . escape ) ( termName ) ;
return external _wp _apiFetch _default ( ) ( {
path : ` /wp/v2/ ${ restBase } ` ,
method : 'POST' ,
data : {
name : escapedTermName
}
} ) . catch ( error => {
const errorCode = error . code ;
if ( errorCode === 'term_exists' ) {
// If the terms exist, fetch it instead of creating a new one.
const addRequest = external _wp _apiFetch _default ( ) ( {
path : ( 0 , external _wp _url _namespaceObject . addQueryArgs ) ( ` /wp/v2/ ${ restBase } ` , { ... flat _term _selector _DEFAULT _QUERY ,
search : escapedTermName
} )
} ) . then ( unescapeTerms ) ;
return addRequest . then ( searchResult => {
return ( 0 , external _lodash _namespaceObject . find ) ( searchResult , result => isSameTermName ( result . name , termName ) ) ;
} ) ;
}
return Promise . reject ( error ) ;
} ) . then ( unescapeTerm ) ;
}
function FlatTermSelector ( _ref ) {
2022-04-11 14:04:30 +02:00
let {
2022-04-12 17:12:47 +02:00
slug
2022-04-11 14:04:30 +02:00
} = _ref ;
2022-04-12 17:12:47 +02:00
const [ values , setValues ] = ( 0 , external _wp _element _namespaceObject . useState ) ( [ ] ) ;
const [ search , setSearch ] = ( 0 , external _wp _element _namespaceObject . useState ) ( '' ) ;
const debouncedSearch = ( 0 , external _wp _compose _namespaceObject . useDebounce ) ( setSearch , 500 ) ;
const {
terms ,
termIds ,
taxonomy ,
hasAssignAction ,
hasCreateAction ,
hasResolvedTerms
} = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => {
const {
getCurrentPost ,
getEditedPostAttribute
} = select ( store _store ) ;
const {
getEntityRecords ,
getTaxonomy ,
hasFinishedResolution
} = select ( external _wp _coreData _namespaceObject . store ) ;
const post = getCurrentPost ( ) ;
2022-04-11 14:04:30 +02:00
2022-04-12 17:12:47 +02:00
const _taxonomy = getTaxonomy ( slug ) ;
2022-04-11 14:04:30 +02:00
2022-04-12 17:12:47 +02:00
const _termIds = _taxonomy ? getEditedPostAttribute ( _taxonomy . rest _base ) : flat _term _selector _EMPTY _ARRAY ;
const query = { ... flat _term _selector _DEFAULT _QUERY ,
include : _termIds . join ( ',' ) ,
per _page : - 1
} ;
return {
hasCreateAction : _taxonomy ? ( 0 , external _lodash _namespaceObject . get ) ( post , [ '_links' , 'wp:action-create-' + _taxonomy . rest _base ] , false ) : false ,
hasAssignAction : _taxonomy ? ( 0 , external _lodash _namespaceObject . get ) ( post , [ '_links' , 'wp:action-assign-' + _taxonomy . rest _base ] , false ) : false ,
taxonomy : _taxonomy ,
termIds : _termIds ,
terms : _termIds . length ? getEntityRecords ( 'taxonomy' , slug , query ) : flat _term _selector _EMPTY _ARRAY ,
hasResolvedTerms : hasFinishedResolution ( 'getEntityRecords' , [ 'taxonomy' , slug , query ] )
} ;
} , [ slug ] ) ;
const {
searchResults
} = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => {
const {
getEntityRecords
} = select ( external _wp _coreData _namespaceObject . store ) ;
return {
searchResults : ! ! search ? getEntityRecords ( 'taxonomy' , slug , { ... flat _term _selector _DEFAULT _QUERY ,
search
} ) : flat _term _selector _EMPTY _ARRAY
} ;
} , [ search ] ) ; // Update terms state only after the selectors are resolved.
// We're using this to avoid terms temporarily disappearing on slow networks
// while core data makes REST API requests.
( 0 , external _wp _element _namespaceObject . useEffect ) ( ( ) => {
if ( hasResolvedTerms ) {
2022-05-17 15:30:31 +02:00
const newValues = ( terms !== null && terms !== void 0 ? terms : [ ] ) . map ( term => unescapeString ( term . name ) ) ;
2022-04-12 17:12:47 +02:00
setValues ( newValues ) ;
}
} , [ terms , hasResolvedTerms ] ) ;
const suggestions = ( 0 , external _wp _element _namespaceObject . useMemo ) ( ( ) => {
return ( searchResults !== null && searchResults !== void 0 ? searchResults : [ ] ) . map ( term => unescapeString ( term . name ) ) ;
} , [ searchResults ] ) ;
const {
editPost
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( store _store ) ;
if ( ! hasAssignAction ) {
return null ;
}
function onUpdateTerms ( newTermIds ) {
editPost ( {
[ taxonomy . rest _base ] : newTermIds
} ) ;
}
function onChange ( termNames ) {
2022-05-17 15:30:31 +02:00
const availableTerms = [ ... ( terms !== null && terms !== void 0 ? terms : [ ] ) , ... ( searchResults !== null && searchResults !== void 0 ? searchResults : [ ] ) ] ;
2022-04-12 17:12:47 +02:00
const uniqueTerms = ( 0 , external _lodash _namespaceObject . uniqBy ) ( termNames , term => term . toLowerCase ( ) ) ;
const newTermNames = uniqueTerms . filter ( termName => ! ( 0 , external _lodash _namespaceObject . find ) ( availableTerms , term => isSameTermName ( term . name , termName ) ) ) ; // Optimistically update term values.
// The selector will always re-fetch terms later.
setValues ( uniqueTerms ) ;
if ( newTermNames . length === 0 ) {
return onUpdateTerms ( termNamesToIds ( uniqueTerms , availableTerms ) ) ;
}
if ( ! hasCreateAction ) {
return ;
}
Promise . all ( newTermNames . map ( termName => findOrCreateTerm ( termName , taxonomy . rest _base ) ) ) . then ( newTerms => {
const newAvailableTerms = availableTerms . concat ( newTerms ) ;
return onUpdateTerms ( termNamesToIds ( uniqueTerms , newAvailableTerms ) ) ;
} ) ;
}
function appendTerm ( newTerm ) {
if ( termIds . includes ( newTerm . id ) ) {
return ;
}
const newTermIds = [ ... termIds , newTerm . id ] ;
const termAddedMessage = ( 0 , external _wp _i18n _namespaceObject . sprintf ) (
/* translators: %s: term name. */
( 0 , external _wp _i18n _namespaceObject . _x ) ( '%s added' , 'term' ) , ( 0 , external _lodash _namespaceObject . get ) ( taxonomy , [ 'labels' , 'singular_name' ] , slug === 'post_tag' ? ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Tag' ) : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Term' ) ) ) ;
( 0 , external _wp _a11y _namespaceObject . speak ) ( termAddedMessage , 'assertive' ) ;
onUpdateTerms ( newTermIds ) ;
}
const newTermLabel = ( 0 , external _lodash _namespaceObject . get ) ( taxonomy , [ 'labels' , 'add_new_item' ] , slug === 'post_tag' ? ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Add new tag' ) : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Add new Term' ) ) ;
const singularName = ( 0 , external _lodash _namespaceObject . get ) ( taxonomy , [ 'labels' , 'singular_name' ] , slug === 'post_tag' ? ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Tag' ) : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Term' ) ) ;
const termAddedLabel = ( 0 , external _wp _i18n _namespaceObject . sprintf ) (
/* translators: %s: term name. */
( 0 , external _wp _i18n _namespaceObject . _x ) ( '%s added' , 'term' ) , singularName ) ;
const termRemovedLabel = ( 0 , external _wp _i18n _namespaceObject . sprintf ) (
/* translators: %s: term name. */
( 0 , external _wp _i18n _namespaceObject . _x ) ( '%s removed' , 'term' ) , singularName ) ;
const removeTermLabel = ( 0 , external _wp _i18n _namespaceObject . sprintf ) (
/* translators: %s: term name. */
( 0 , external _wp _i18n _namespaceObject . _x ) ( 'Remove %s' , 'term' ) , singularName ) ;
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _element _namespaceObject . Fragment , null , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . FormTokenField , {
value : values ,
suggestions : suggestions ,
onChange : onChange ,
onInputChange : debouncedSearch ,
maxSuggestions : MAX _TERMS _SUGGESTIONS ,
label : newTermLabel ,
messages : {
added : termAddedLabel ,
removed : termRemovedLabel ,
remove : removeTermLabel
}
} ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( MostUsedTerms , {
taxonomy : taxonomy ,
onSelect : appendTerm
} ) ) ;
2022-04-11 14:04:30 +02:00
}
2022-04-12 17:12:47 +02:00
/* harmony default export */ var flat _term _selector = ( ( 0 , external _wp _components _namespaceObject . withFilters ) ( 'editor.PostTaxonomyType' ) ( FlatTermSelector ) ) ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-tags-panel.js
2022-04-11 14:04:30 +02:00
2022-04-12 17:12:47 +02:00
/ * *
* External dependencies
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
/ * *
* WordPress dependencies
* /
2021-05-21 12:14:23 +02:00
2019-03-21 13:48:00 +01:00
2021-11-08 15:29:21 +01:00
2022-04-12 17:12:47 +02:00
2018-12-14 05:41:57 +01:00
/ * *
2021-05-21 12:14:23 +02:00
* Internal dependencies
2018-12-14 05:41:57 +01:00
* /
2021-05-20 14:20:04 +02:00
2018-12-14 05:41:57 +01:00
2021-05-21 12:14:23 +02:00
2022-04-12 17:12:47 +02:00
const TagsPanel = ( ) => {
const panelBodyTitle = [ ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Suggestion:' ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( "span" , {
className : "editor-post-publish-panel__link" ,
key : "label"
} , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Add tags' ) ) ] ;
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . PanelBody , {
initialOpen : false ,
title : panelBodyTitle
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( "p" , null , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Tags help users and search engines navigate your site and find your content. Add a few keywords to describe your post.' ) ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( flat _term _selector , {
slug : 'post_tag'
} ) ) ;
} ;
2021-05-21 12:14:23 +02:00
2022-04-12 17:12:47 +02:00
class MaybeTagsPanel extends external _wp _element _namespaceObject . Component {
constructor ( props ) {
super ( props ) ;
this . state = {
hadTagsWhenOpeningThePanel : props . hasTags
2022-04-11 14:04:30 +02:00
} ;
2022-04-12 17:12:47 +02:00
}
/ *
* We only want to show the tag panel if the post didn ' t have
* any tags when the user hit the Publish button .
*
* We can 't use the prop.hasTags because it' ll change to true
* if the user adds a new tag within the pre - publish panel .
* This would force a re - render and a new prop . hasTags check ,
* hiding this panel and keeping the user from adding
* more than one tag .
* /
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
2022-04-12 17:12:47 +02:00
render ( ) {
if ( ! this . state . hadTagsWhenOpeningThePanel ) {
return ( 0 , external _wp _element _namespaceObject . createElement ) ( TagsPanel , null ) ;
}
2022-04-11 14:04:30 +02:00
2022-04-12 17:12:47 +02:00
return null ;
2021-05-21 12:14:23 +02:00
}
}
2022-04-11 14:04:30 +02:00
2022-04-12 17:12:47 +02:00
/* harmony default export */ var maybe _tags _panel = ( ( 0 , external _wp _compose _namespaceObject . compose ) ( ( 0 , external _wp _data _namespaceObject . withSelect ) ( select => {
const postType = select ( store _store ) . getCurrentPostType ( ) ;
const tagsTaxonomy = select ( external _wp _coreData _namespaceObject . store ) . getTaxonomy ( 'post_tag' ) ;
const tags = tagsTaxonomy && select ( store _store ) . getEditedPostAttribute ( tagsTaxonomy . rest _base ) ;
2021-05-21 12:14:23 +02:00
return {
2022-04-12 17:12:47 +02:00
areTagsFetched : tagsTaxonomy !== undefined ,
isPostTypeSupported : tagsTaxonomy && ( 0 , external _lodash _namespaceObject . some ) ( tagsTaxonomy . types , type => type === postType ) ,
hasTags : tags && tags . length
2021-05-21 12:14:23 +02:00
} ;
2022-04-12 17:12:47 +02:00
} ) , ( 0 , external _wp _compose _namespaceObject . ifCondition ) ( _ref => {
let {
areTagsFetched ,
isPostTypeSupported
} = _ref ;
return isPostTypeSupported && areTagsFetched ;
} ) ) ( MaybeTagsPanel ) ) ;
2021-05-21 12:14:23 +02:00
2022-04-12 17:12:47 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-post-format-panel.js
2018-12-14 05:41:57 +01:00
2020-06-26 15:33:47 +02:00
2022-04-11 14:04:30 +02:00
/ * *
* External dependencies
* /
2019-03-21 13:48:00 +01:00
/ * *
2021-05-20 14:20:04 +02:00
* WordPress dependencies
2019-03-21 13:48:00 +01:00
* /
2021-11-08 15:29:21 +01:00
2021-05-19 17:09:27 +02:00
2021-05-20 14:20:04 +02:00
2022-04-12 17:12:47 +02:00
2022-04-11 14:04:30 +02:00
/ * *
* Internal dependencies
* /
2022-04-12 17:12:47 +02:00
const getSuggestion = ( supportedFormats , suggestedPostFormat ) => {
const formats = POST _FORMATS . filter ( format => ( 0 , external _lodash _namespaceObject . includes ) ( supportedFormats , format . id ) ) ;
return ( 0 , external _lodash _namespaceObject . find ) ( formats , format => format . id === suggestedPostFormat ) ;
2022-04-11 14:04:30 +02:00
} ;
2022-04-12 17:12:47 +02:00
const PostFormatSuggestion = _ref => {
2022-04-11 14:04:30 +02:00
let {
2022-04-12 17:12:47 +02:00
suggestedPostFormat ,
suggestionText ,
onUpdatePostFormat
2022-04-11 14:04:30 +02:00
} = _ref ;
2022-04-12 17:12:47 +02:00
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Button , {
variant : "link" ,
onClick : ( ) => onUpdatePostFormat ( suggestedPostFormat )
} , suggestionText ) ;
} ;
function PostFormatPanel ( ) {
2022-04-11 14:04:30 +02:00
const {
2022-04-12 17:12:47 +02:00
currentPostFormat ,
suggestion
2022-04-11 14:04:30 +02:00
} = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => {
2022-04-12 17:12:47 +02:00
const {
getEditedPostAttribute ,
getSuggestedPostFormat
} = select ( store _store ) ;
const supportedFormats = ( 0 , external _lodash _namespaceObject . get ) ( select ( external _wp _coreData _namespaceObject . store ) . getThemeSupports ( ) , [ 'formats' ] , [ ] ) ;
2022-04-11 14:04:30 +02:00
return {
2022-04-12 17:12:47 +02:00
currentPostFormat : getEditedPostAttribute ( 'format' ) ,
suggestion : getSuggestion ( supportedFormats , getSuggestedPostFormat ( ) )
2022-04-11 14:04:30 +02:00
} ;
} , [ ] ) ;
2022-04-12 17:12:47 +02:00
const {
editPost
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( store _store ) ;
2022-04-11 14:04:30 +02:00
2022-04-12 17:12:47 +02:00
const onUpdatePostFormat = format => editPost ( {
format
} ) ;
const panelBodyTitle = [ ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Suggestion:' ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( "span" , {
className : "editor-post-publish-panel__link" ,
key : "label"
} , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Use a post format' ) ) ] ;
if ( ! suggestion || suggestion . id === currentPostFormat ) {
2022-04-11 14:04:30 +02:00
return null ;
}
2022-04-12 17:12:47 +02:00
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . PanelBody , {
initialOpen : false ,
title : panelBodyTitle
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( "p" , null , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Your theme uses post formats to highlight different kinds of content, like images or videos. Apply a post format to see this special styling.' ) ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( "p" , null , ( 0 , external _wp _element _namespaceObject . createElement ) ( PostFormatSuggestion , {
onUpdatePostFormat : onUpdatePostFormat ,
suggestedPostFormat : suggestion . id ,
suggestionText : ( 0 , external _wp _i18n _namespaceObject . sprintf ) (
/* translators: %s: post format */
( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Apply the "%1$s" format.' ) , suggestion . caption )
} ) ) ) ;
2022-04-11 14:04:30 +02:00
}
2022-04-12 17:12:47 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/hierarchical-term-selector.js
2021-05-20 14:20:04 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* External dependencies
2021-05-20 14:20:04 +02:00
* /
2018-12-14 05:41:57 +01:00
/ * *
2018-12-18 04:14:52 +01:00
* WordPress dependencies
2018-12-14 05:41:57 +01:00
* /
2018-12-18 04:14:52 +01:00
2018-12-14 05:41:57 +01:00
2021-05-20 14:20:04 +02:00
2022-04-12 17:12:47 +02:00
/ * *
* Internal dependencies
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
/ * *
2022-04-12 17:12:47 +02:00
* Module Constants
* /
const hierarchical _term _selector _DEFAULT _QUERY = {
per _page : - 1 ,
orderby : 'name' ,
order : 'asc' ,
_fields : 'id,name,parent' ,
context : 'view'
} ;
const MIN _TERMS _COUNT _FOR _FILTER = 8 ;
const hierarchical _term _selector _EMPTY _ARRAY = [ ] ;
/ * *
* Sort Terms by Selected .
*
* @ param { Object [ ] } termsTree Array of terms in tree format .
* @ param { number [ ] } terms Selected terms .
*
* @ return { Object [ ] } Sorted array of terms .
2022-04-11 14:04:30 +02:00
* /
2018-12-14 05:41:57 +01:00
2022-04-12 17:12:47 +02:00
function sortBySelected ( termsTree , terms ) {
const treeHasSelection = termTree => {
if ( terms . indexOf ( termTree . id ) !== - 1 ) {
return true ;
}
if ( undefined === termTree . children ) {
return false ;
}
return termTree . children . map ( treeHasSelection ) . filter ( child => child ) . length > 0 ;
} ;
const termOrChildIsSelected = ( termA , termB ) => {
const termASelected = treeHasSelection ( termA ) ;
const termBSelected = treeHasSelection ( termB ) ;
if ( termASelected === termBSelected ) {
return 0 ;
}
if ( termASelected && ! termBSelected ) {
return - 1 ;
}
2018-12-14 05:41:57 +01:00
2022-04-12 17:12:47 +02:00
if ( ! termASelected && termBSelected ) {
return 1 ;
}
2018-12-14 05:41:57 +01:00
2022-04-12 17:12:47 +02:00
return 0 ;
} ;
2021-01-28 03:04:13 +01:00
2022-04-12 17:12:47 +02:00
const newTermTree = [ ... termsTree ] ;
newTermTree . sort ( termOrChildIsSelected ) ;
return newTermTree ;
}
2021-05-07 13:48:27 +02:00
/ * *
2022-04-12 17:12:47 +02:00
* Find term by parent id or name .
2022-04-11 14:04:30 +02:00
*
2022-04-12 17:12:47 +02:00
* @ param { Object [ ] } terms Array of Terms .
* @ param { number | string } parent id .
* @ param { string } name Term name .
* @ return { Object } Term object .
2021-05-07 13:48:27 +02:00
* /
2022-04-12 17:12:47 +02:00
function findTerm ( terms , parent , name ) {
return ( 0 , external _lodash _namespaceObject . find ) ( terms , term => {
return ( ! term . parent && ! parent || parseInt ( term . parent ) === parseInt ( parent ) ) && term . name . toLowerCase ( ) === name . toLowerCase ( ) ;
} ) ;
}
2021-05-20 14:20:04 +02:00
/ * *
2022-04-12 17:12:47 +02:00
* Get filter matcher function .
*
* @ param { string } filterValue Filter value .
* @ return { ( function ( Object ) : ( Object | boolean ) ) } Matcher function .
2021-05-20 14:20:04 +02:00
* /
2021-05-19 17:09:27 +02:00
2022-04-12 17:12:47 +02:00
function getFilterMatcher ( filterValue ) {
const matchTermsForFilter = originalTerm => {
if ( '' === filterValue ) {
return originalTerm ;
} // Shallow clone, because we'll be filtering the term's children and
// don't want to modify the original term.
2021-05-19 17:09:27 +02:00
2022-04-12 17:12:47 +02:00
const term = { ... originalTerm
} ; // Map and filter the children, recursive so we deal with grandchildren
// and any deeper levels.
2018-12-14 05:41:57 +01:00
2022-04-12 17:12:47 +02:00
if ( term . children . length > 0 ) {
term . children = term . children . map ( matchTermsForFilter ) . filter ( child => child ) ;
} // If the term's name contains the filterValue, or it has children
// (i.e. some child matched at some point in the tree) then return it.
2019-03-21 13:48:00 +01:00
2021-01-28 03:04:13 +01:00
2022-04-12 17:12:47 +02:00
if ( - 1 !== term . name . toLowerCase ( ) . indexOf ( filterValue . toLowerCase ( ) ) || term . children . length > 0 ) {
return term ;
} // Otherwise, return false. After mapping, the list of terms will need
// to have false values filtered out.
2021-01-28 03:04:13 +01:00
2022-04-12 17:12:47 +02:00
return false ;
} ;
return matchTermsForFilter ;
2022-04-11 14:04:30 +02:00
}
2022-04-12 17:12:47 +02:00
/ * *
* Hierarchical term selector .
*
* @ param { Object } props Component props .
* @ param { string } props . slug Taxonomy slug .
* @ return { WPElement } Hierarchical term selector component .
* /
2018-12-18 04:14:52 +01:00
2022-04-12 17:12:47 +02:00
function HierarchicalTermSelector ( _ref ) {
2021-11-15 13:50:17 +01:00
let {
2022-04-11 14:04:30 +02:00
slug
2021-11-15 13:50:17 +01:00
} = _ref ;
2022-04-12 17:12:47 +02:00
const [ adding , setAdding ] = ( 0 , external _wp _element _namespaceObject . useState ) ( false ) ;
const [ formName , setFormName ] = ( 0 , external _wp _element _namespaceObject . useState ) ( '' ) ;
/ * *
* @ type { [ number | '' , Function ] }
* /
const [ formParent , setFormParent ] = ( 0 , external _wp _element _namespaceObject . useState ) ( '' ) ;
const [ showForm , setShowForm ] = ( 0 , external _wp _element _namespaceObject . useState ) ( false ) ;
const [ filterValue , setFilterValue ] = ( 0 , external _wp _element _namespaceObject . useState ) ( '' ) ;
const [ filteredTermsTree , setFilteredTermsTree ] = ( 0 , external _wp _element _namespaceObject . useState ) ( [ ] ) ;
const debouncedSpeak = ( 0 , external _wp _compose _namespaceObject . useDebounce ) ( external _wp _a11y _namespaceObject . speak , 500 ) ;
2021-05-21 12:14:23 +02:00
const {
2022-04-11 14:04:30 +02:00
hasCreateAction ,
2022-04-12 17:12:47 +02:00
hasAssignAction ,
terms ,
loading ,
availableTerms ,
taxonomy
2022-04-11 14:04:30 +02:00
} = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => {
2021-05-21 12:14:23 +02:00
const {
getCurrentPost ,
getEditedPostAttribute
2022-04-12 17:12:47 +02:00
} = select ( store _store ) ;
2022-04-11 14:04:30 +02:00
const {
getTaxonomy ,
2022-04-12 17:12:47 +02:00
getEntityRecords ,
isResolving
2022-04-11 14:04:30 +02:00
} = select ( external _wp _coreData _namespaceObject . store ) ;
const _taxonomy = getTaxonomy ( slug ) ;
2021-05-21 12:14:23 +02:00
return {
2022-04-12 17:12:47 +02:00
hasCreateAction : _taxonomy ? ( 0 , external _lodash _namespaceObject . get ) ( getCurrentPost ( ) , [ '_links' , 'wp:action-create-' + _taxonomy . rest _base ] , false ) : false ,
hasAssignAction : _taxonomy ? ( 0 , external _lodash _namespaceObject . get ) ( getCurrentPost ( ) , [ '_links' , 'wp:action-assign-' + _taxonomy . rest _base ] , false ) : false ,
terms : _taxonomy ? getEditedPostAttribute ( _taxonomy . rest _base ) : hierarchical _term _selector _EMPTY _ARRAY ,
loading : isResolving ( 'getEntityRecords' , [ 'taxonomy' , slug , hierarchical _term _selector _DEFAULT _QUERY ] ) ,
availableTerms : getEntityRecords ( 'taxonomy' , slug , hierarchical _term _selector _DEFAULT _QUERY ) || hierarchical _term _selector _EMPTY _ARRAY ,
taxonomy : _taxonomy
2021-05-21 12:14:23 +02:00
} ;
2022-04-11 14:04:30 +02:00
} , [ slug ] ) ;
const {
editPost
2022-04-12 17:12:47 +02:00
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( store _store ) ;
const {
saveEntityRecord
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( external _wp _coreData _namespaceObject . store ) ;
const availableTermsTree = ( 0 , external _wp _element _namespaceObject . useMemo ) ( ( ) => sortBySelected ( buildTermsTree ( availableTerms ) , terms ) , // Remove `terms` from the dependency list to avoid reordering every time
// checking or unchecking a term.
[ availableTerms ] ) ;
2021-05-19 17:09:27 +02:00
2022-04-11 14:04:30 +02:00
if ( ! hasAssignAction ) {
2021-11-08 15:29:21 +01:00
return null ;
2021-05-21 12:14:23 +02:00
}
2022-04-12 17:12:47 +02:00
/ * *
* Append new term .
*
* @ param { Object } term Term object .
* @ return { Promise } A promise that resolves to save term object .
* /
2021-05-20 14:20:04 +02:00
2020-06-26 15:33:47 +02:00
2022-04-12 17:12:47 +02:00
const addTerm = term => {
return saveEntityRecord ( 'taxonomy' , slug , term ) ;
} ;
/ * *
* Update terms for post .
*
* @ param { number [ ] } termIds Term ids .
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
2022-04-12 17:12:47 +02:00
const onUpdateTerms = termIds => {
editPost ( {
[ taxonomy . rest _base ] : termIds
} ) ;
} ;
/ * *
* Handler for checking term .
*
* @ param { number } termId
* /
2020-02-06 22:03:31 +01:00
2018-12-14 05:41:57 +01:00
2022-04-12 17:12:47 +02:00
const onChange = termId => {
const hasTerm = terms . includes ( termId ) ;
const newTerms = hasTerm ? ( 0 , external _lodash _namespaceObject . without ) ( terms , termId ) : [ ... terms , termId ] ;
onUpdateTerms ( newTerms ) ;
} ;
2018-12-14 05:41:57 +01:00
2022-04-12 17:12:47 +02:00
const onChangeFormName = value => {
setFormName ( value ) ;
} ;
/ * *
* Handler for changing form parent .
*
* @ param { number | '' } parentId Parent post id .
* /
2018-12-14 05:41:57 +01:00
2022-04-12 17:12:47 +02:00
const onChangeFormParent = parentId => {
setFormParent ( parentId ) ;
} ;
2018-12-14 05:41:57 +01:00
2022-04-12 17:12:47 +02:00
const onToggleForm = ( ) => {
setShowForm ( ! showForm ) ;
} ;
2018-12-14 05:41:57 +01:00
2022-04-12 17:12:47 +02:00
const onAddTerm = async event => {
event . preventDefault ( ) ;
2020-06-26 15:33:47 +02:00
2022-04-12 17:12:47 +02:00
if ( formName === '' || adding ) {
return ;
} // Check if the term we are adding already exists.
2022-04-11 14:04:30 +02:00
2022-04-12 17:12:47 +02:00
const existingTerm = findTerm ( availableTerms , formParent , formName ) ;
if ( existingTerm ) {
// If the term we are adding exists but is not selected select it.
if ( ! ( 0 , external _lodash _namespaceObject . some ) ( terms , term => term === existingTerm . id ) ) {
onUpdateTerms ( [ ... terms , existingTerm . id ] ) ;
}
setFormName ( '' ) ;
setFormParent ( '' ) ;
return ;
}
setAdding ( true ) ;
const newTerm = await addTerm ( {
name : formName ,
parent : formParent ? formParent : undefined
} ) ;
const termAddedMessage = ( 0 , external _wp _i18n _namespaceObject . sprintf ) (
/* translators: %s: taxonomy name */
( 0 , external _wp _i18n _namespaceObject . _x ) ( '%s added' , 'term' ) , ( 0 , external _lodash _namespaceObject . get ) ( taxonomy , [ 'labels' , 'singular_name' ] , slug === 'category' ? ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Category' ) : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Term' ) ) ) ;
( 0 , external _wp _a11y _namespaceObject . speak ) ( termAddedMessage , 'assertive' ) ;
setAdding ( false ) ;
setFormName ( '' ) ;
setFormParent ( '' ) ;
onUpdateTerms ( [ ... terms , newTerm . id ] ) ;
} ;
2018-12-18 04:14:52 +01:00
2022-04-12 17:12:47 +02:00
const setFilter = value => {
const newFilteredTermsTree = availableTermsTree . map ( getFilterMatcher ( value ) ) . filter ( term => term ) ;
2018-12-14 05:41:57 +01:00
2022-04-12 17:12:47 +02:00
const getResultCount = termsTree => {
let count = 0 ;
2019-03-21 13:48:00 +01:00
2022-04-12 17:12:47 +02:00
for ( let i = 0 ; i < termsTree . length ; i ++ ) {
count ++ ;
2021-11-08 15:29:21 +01:00
2022-04-12 17:12:47 +02:00
if ( undefined !== termsTree [ i ] . children ) {
count += getResultCount ( termsTree [ i ] . children ) ;
}
}
2022-04-11 14:04:30 +02:00
2022-04-12 17:12:47 +02:00
return count ;
2021-05-21 12:14:23 +02:00
} ;
2021-05-19 17:09:27 +02:00
2022-04-12 17:12:47 +02:00
setFilterValue ( value ) ;
setFilteredTermsTree ( newFilteredTermsTree ) ;
const resultCount = getResultCount ( newFilteredTermsTree ) ;
const resultsFoundMessage = ( 0 , external _wp _i18n _namespaceObject . sprintf ) (
/* translators: %d: number of results */
( 0 , external _wp _i18n _namespaceObject . _n ) ( '%d result found.' , '%d results found.' , resultCount ) , resultCount ) ;
debouncedSpeak ( resultsFoundMessage , 'assertive' ) ;
} ;
2021-05-19 17:09:27 +02:00
2022-04-12 17:12:47 +02:00
const renderTerms = renderedTerms => {
return renderedTerms . map ( term => {
return ( 0 , external _wp _element _namespaceObject . createElement ) ( "div" , {
key : term . id ,
className : "editor-post-taxonomies__hierarchical-terms-choice"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . CheckboxControl , {
checked : terms . indexOf ( term . id ) !== - 1 ,
onChange : ( ) => {
const termId = parseInt ( term . id , 10 ) ;
onChange ( termId ) ;
} ,
label : ( 0 , external _lodash _namespaceObject . unescape ) ( term . name )
} ) , ! ! term . children . length && ( 0 , external _wp _element _namespaceObject . createElement ) ( "div" , {
className : "editor-post-taxonomies__hierarchical-terms-subchoices"
} , renderTerms ( term . children ) ) ) ;
} ) ;
} ;
2018-12-14 05:41:57 +01:00
2022-04-12 17:12:47 +02:00
const labelWithFallback = ( labelProperty , fallbackIsCategory , fallbackIsNotCategory ) => ( 0 , external _lodash _namespaceObject . get ) ( taxonomy , [ 'labels' , labelProperty ] , slug === 'category' ? fallbackIsCategory : fallbackIsNotCategory ) ;
2018-12-14 05:41:57 +01:00
2022-04-12 17:12:47 +02:00
const newTermButtonLabel = labelWithFallback ( 'add_new_item' , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Add new category' ) , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Add new term' ) ) ;
const newTermLabel = labelWithFallback ( 'new_item_name' , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Add new category' ) , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Add new term' ) ) ;
const parentSelectLabel = labelWithFallback ( 'parent_item' , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Parent Category' ) , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Parent Term' ) ) ;
const noParentOption = ` — ${ parentSelectLabel } — ` ;
const newTermSubmitLabel = newTermButtonLabel ;
const filterLabel = ( 0 , external _lodash _namespaceObject . get ) ( taxonomy , [ 'labels' , 'search_items' ] , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Search Terms' ) ) ;
const groupLabel = ( 0 , external _lodash _namespaceObject . get ) ( taxonomy , [ 'name' ] , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Terms' ) ) ;
const showFilter = availableTerms . length >= MIN _TERMS _COUNT _FOR _FILTER ;
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _element _namespaceObject . Fragment , null , showFilter && ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . TextControl , {
className : "editor-post-taxonomies__hierarchical-terms-filter" ,
label : filterLabel ,
value : filterValue ,
onChange : setFilter
} ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( "div" , {
className : "editor-post-taxonomies__hierarchical-terms-list" ,
tabIndex : "0" ,
role : "group" ,
"aria-label" : groupLabel
} , renderTerms ( '' !== filterValue ? filteredTermsTree : availableTermsTree ) ) , ! loading && hasCreateAction && ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Button , {
onClick : onToggleForm ,
className : "editor-post-taxonomies__hierarchical-terms-add" ,
"aria-expanded" : showForm ,
variant : "link"
} , newTermButtonLabel ) , showForm && ( 0 , external _wp _element _namespaceObject . createElement ) ( "form" , {
onSubmit : onAddTerm
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . TextControl , {
className : "editor-post-taxonomies__hierarchical-terms-input" ,
label : newTermLabel ,
value : formName ,
onChange : onChangeFormName ,
required : true
} ) , ! ! availableTerms . length && ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . TreeSelect , {
label : parentSelectLabel ,
noOptionLabel : noParentOption ,
onChange : onChangeFormParent ,
selectedId : formParent ,
tree : availableTermsTree
} ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Button , {
variant : "secondary" ,
type : "submit" ,
className : "editor-post-taxonomies__hierarchical-terms-submit"
} , newTermSubmitLabel ) ) ) ;
2021-05-21 12:14:23 +02:00
}
2022-04-11 14:04:30 +02:00
2022-04-12 17:12:47 +02:00
/* harmony default export */ var hierarchical _term _selector = ( ( 0 , external _wp _components _namespaceObject . withFilters ) ( 'editor.PostTaxonomyType' ) ( HierarchicalTermSelector ) ) ;
2022-04-11 14:04:30 +02:00
2022-04-12 17:12:47 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-category-panel.js
2018-12-14 05:41:57 +01:00
2021-05-19 17:09:27 +02:00
2021-05-21 12:14:23 +02:00
/ * *
* External dependencies
* /
2021-05-19 17:09:27 +02:00
2021-05-21 12:14:23 +02:00
/ * *
* WordPress dependencies
* /
2021-05-19 17:09:27 +02:00
2018-12-14 05:41:57 +01:00
2019-03-21 13:48:00 +01:00
2018-12-14 05:41:57 +01:00
2019-03-21 13:48:00 +01:00
2022-04-12 17:12:47 +02:00
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Internal dependencies
2021-05-21 12:14:23 +02:00
* /
2018-12-14 05:41:57 +01:00
2021-05-19 17:09:27 +02:00
2019-03-21 13:48:00 +01:00
2021-05-19 17:09:27 +02:00
2022-04-12 17:12:47 +02:00
function MaybeCategoryPanel ( ) {
const hasNoCategory = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => {
var _select$getEntityReco ;
2021-11-08 15:29:21 +01:00
2022-04-12 17:12:47 +02:00
const postType = select ( store _store ) . getCurrentPostType ( ) ;
const categoriesTaxonomy = select ( external _wp _coreData _namespaceObject . store ) . getTaxonomy ( 'category' ) ;
const defaultCategorySlug = 'uncategorized' ;
const defaultCategory = ( _select$getEntityReco = select ( external _wp _coreData _namespaceObject . store ) . getEntityRecords ( 'taxonomy' , 'category' , {
slug : defaultCategorySlug
} ) ) === null || _select$getEntityReco === void 0 ? void 0 : _select$getEntityReco [ 0 ] ;
const postTypeSupportsCategories = categoriesTaxonomy && ( 0 , external _lodash _namespaceObject . some ) ( categoriesTaxonomy . types , type => type === postType ) ;
const categories = categoriesTaxonomy && select ( store _store ) . getEditedPostAttribute ( categoriesTaxonomy . rest _base ) ; // This boolean should return true if everything is loaded
// ( categoriesTaxonomy, defaultCategory )
// and the post has not been assigned a category different than "uncategorized".
2022-04-11 14:04:30 +02:00
2022-04-12 17:12:47 +02:00
return ! ! categoriesTaxonomy && ! ! defaultCategory && postTypeSupportsCategories && ( ( categories === null || categories === void 0 ? void 0 : categories . length ) === 0 || ( categories === null || categories === void 0 ? void 0 : categories . length ) === 1 && defaultCategory . id === categories [ 0 ] ) ;
2022-04-11 14:04:30 +02:00
} , [ ] ) ;
2022-04-12 17:12:47 +02:00
const [ shouldShowPanel , setShouldShowPanel ] = ( 0 , external _wp _element _namespaceObject . useState ) ( false ) ;
( 0 , external _wp _element _namespaceObject . useEffect ) ( ( ) => {
// We use state to avoid hiding the panel if the user edits the categories
// and adds one within the panel itself (while visible).
if ( hasNoCategory ) {
setShouldShowPanel ( true ) ;
}
} , [ hasNoCategory ] ) ;
2022-04-11 14:04:30 +02:00
2022-04-12 17:12:47 +02:00
if ( ! shouldShowPanel ) {
2022-04-11 14:04:30 +02:00
return null ;
}
2022-04-12 17:12:47 +02:00
const panelBodyTitle = [ ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Suggestion:' ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( "span" , {
className : "editor-post-publish-panel__link" ,
key : "label"
} , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Assign a category' ) ) ] ;
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . PanelBody , {
initialOpen : false ,
title : panelBodyTitle
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( "p" , null , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Categories provide a helpful way to group related posts together and to quickly tell readers what a post is about.' ) ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( hierarchical _term _selector , {
slug : "category"
} ) ) ;
2022-04-11 14:04:30 +02:00
}
2018-12-14 05:41:57 +01:00
2022-04-12 17:12:47 +02:00
/* harmony default export */ var maybe _category _panel = ( MaybeCategoryPanel ) ;
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/prepublish.js
2021-05-19 17:09:27 +02:00
2018-12-14 05:41:57 +01:00
2021-05-21 12:14:23 +02:00
/ * *
* External dependencies
* /
2018-12-14 05:41:57 +01:00
2021-05-21 12:14:23 +02:00
/ * *
* WordPress dependencies
* /
2018-12-14 05:41:57 +01:00
2018-12-17 05:52:00 +01:00
2018-12-14 05:41:57 +01:00
2021-05-21 12:14:23 +02:00
/ * *
* Internal dependencies
* /
2018-12-14 05:41:57 +01:00
2021-11-08 15:29:21 +01:00
2018-12-14 05:41:57 +01:00
2019-03-21 13:48:00 +01:00
2018-12-14 05:41:57 +01:00
2021-05-19 17:09:27 +02:00
2022-04-12 17:12:47 +02:00
2022-04-11 14:04:30 +02:00
function PostPublishPanelPrepublish ( _ref ) {
let {
children
} = _ref ;
const {
isBeingScheduled ,
isRequestingSiteIcon ,
hasPublishAction ,
siteIconUrl ,
siteTitle ,
siteHome
} = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => {
const {
getCurrentPost ,
isEditedPostBeingScheduled
2022-04-12 17:12:47 +02:00
} = select ( store _store ) ;
2022-04-11 14:04:30 +02:00
const {
getEntityRecord ,
isResolving
} = select ( external _wp _coreData _namespaceObject . store ) ;
const siteData = getEntityRecord ( 'root' , '__unstableBase' , undefined ) || { } ;
return {
hasPublishAction : ( 0 , external _lodash _namespaceObject . get ) ( getCurrentPost ( ) , [ '_links' , 'wp:action-publish' ] , false ) ,
isBeingScheduled : isEditedPostBeingScheduled ( ) ,
isRequestingSiteIcon : isResolving ( 'getEntityRecord' , [ 'root' , '__unstableBase' , undefined ] ) ,
siteIconUrl : siteData . site _icon _url ,
siteTitle : siteData . name ,
siteHome : siteData . home && ( 0 , external _wp _url _namespaceObject . filterURLForDisplay ) ( siteData . home )
} ;
} , [ ] ) ;
let siteIcon = ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Icon , {
className : "components-site-icon" ,
size : "36px" ,
icon : library _wordpress
} ) ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
if ( siteIconUrl ) {
siteIcon = ( 0 , external _wp _element _namespaceObject . createElement ) ( "img" , {
alt : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Site Icon' ) ,
className : "components-site-icon" ,
src : siteIconUrl
} ) ;
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
if ( isRequestingSiteIcon ) {
siteIcon = null ;
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
let prePublishTitle , prePublishBodyText ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
if ( ! hasPublishAction ) {
prePublishTitle = ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Are you ready to submit for review?' ) ;
prePublishBodyText = ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'When you’ re ready, submit your work for review, and an Editor will be able to approve it for you.' ) ;
} else if ( isBeingScheduled ) {
prePublishTitle = ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Are you ready to schedule?' ) ;
prePublishBodyText = ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Your work will be published at the specified date and time.' ) ;
} else {
prePublishTitle = ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Are you ready to publish?' ) ;
prePublishBodyText = ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Double-check your settings before publishing.' ) ;
}
return ( 0 , external _wp _element _namespaceObject . createElement ) ( "div" , {
className : "editor-post-publish-panel__prepublish"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( "div" , null , ( 0 , external _wp _element _namespaceObject . createElement ) ( "strong" , null , prePublishTitle ) ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( "p" , null , prePublishBodyText ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( "div" , {
className : "components-site-card"
} , siteIcon , ( 0 , external _wp _element _namespaceObject . createElement ) ( "div" , {
className : "components-site-info"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( "span" , {
className : "components-site-name"
} , ( 0 , external _wp _htmlEntities _namespaceObject . decodeEntities ) ( siteTitle ) || ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( '(Untitled)' ) ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( "span" , {
className : "components-site-home"
} , siteHome ) ) ) , hasPublishAction && ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _element _namespaceObject . Fragment , null , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . PanelBody , {
initialOpen : false ,
title : [ ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Visibility:' ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( "span" , {
className : "editor-post-publish-panel__link" ,
key : "label"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( post _visibility _label , null ) ) ]
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( post _visibility , null ) ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . PanelBody , {
initialOpen : false ,
title : [ ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Publish:' ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( "span" , {
className : "editor-post-publish-panel__link" ,
key : "label"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( post _schedule _label , null ) ) ]
2022-04-12 17:12:47 +02:00
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( PostSchedule , null ) ) ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( PostFormatPanel , null ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( maybe _tags _panel , null ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( maybe _category _panel , null ) , children ) ;
2021-11-08 15:29:21 +01:00
}
2022-04-11 14:04:30 +02:00
/* harmony default export */ var prepublish = ( PostPublishPanelPrepublish ) ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/postpublish.js
2021-11-08 15:29:21 +01:00
/ * *
2022-04-11 14:04:30 +02:00
* External dependencies
2021-11-08 15:29:21 +01:00
* /
2018-12-14 05:41:57 +01:00
2021-11-08 15:29:21 +01:00
/ * *
2022-04-11 14:04:30 +02:00
* WordPress dependencies
2021-11-08 15:29:21 +01:00
* /
2018-12-14 05:41:57 +01:00
2021-11-08 15:29:21 +01:00
/ * *
2022-04-11 14:04:30 +02:00
* Internal dependencies
* /
const POSTNAME = '%postname%' ;
/ * *
* Returns URL for a future post .
2021-11-08 15:29:21 +01:00
*
2022-04-11 14:04:30 +02:00
* @ param { Object } post Post object .
*
* @ return { string } PostPublish URL .
2021-11-08 15:29:21 +01:00
* /
2022-04-11 14:04:30 +02:00
const getFuturePostUrl = post => {
const {
2021-11-15 13:50:17 +01:00
slug
2022-04-11 14:04:30 +02:00
} = post ;
2021-11-08 15:29:21 +01:00
2022-04-11 14:04:30 +02:00
if ( post . permalink _template . includes ( POSTNAME ) ) {
return post . permalink _template . replace ( POSTNAME , slug ) ;
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
return post . permalink _template ;
} ;
2020-10-20 15:36:16 +02:00
2022-04-11 14:04:30 +02:00
function postpublish _CopyButton ( _ref ) {
let {
text ,
onCopy ,
children
} = _ref ;
const ref = ( 0 , external _wp _compose _namespaceObject . useCopyToClipboard ) ( text , onCopy ) ;
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Button , {
variant : "secondary" ,
ref : ref
} , children ) ;
}
class PostPublishPanelPostpublish extends external _wp _element _namespaceObject . Component {
constructor ( ) {
super ( ... arguments ) ;
this . state = {
showCopyConfirmation : false
2021-11-08 15:29:21 +01:00
} ;
2022-04-11 14:04:30 +02:00
this . onCopy = this . onCopy . bind ( this ) ;
this . onSelectInput = this . onSelectInput . bind ( this ) ;
this . postLink = ( 0 , external _wp _element _namespaceObject . createRef ) ( ) ;
}
2019-03-21 13:48:00 +01:00
2022-04-11 14:04:30 +02:00
componentDidMount ( ) {
if ( this . props . focusOnMount ) {
this . postLink . current . focus ( ) ;
}
}
componentWillUnmount ( ) {
clearTimeout ( this . dismissCopyConfirmation ) ;
}
onCopy ( ) {
this . setState ( {
showCopyConfirmation : true
} ) ;
clearTimeout ( this . dismissCopyConfirmation ) ;
this . dismissCopyConfirmation = setTimeout ( ( ) => {
this . setState ( {
showCopyConfirmation : false
} ) ;
} , 4000 ) ;
2021-05-21 12:14:23 +02:00
}
2020-10-20 15:36:16 +02:00
2022-04-11 14:04:30 +02:00
onSelectInput ( event ) {
event . target . select ( ) ;
}
2020-10-20 15:36:16 +02:00
2022-04-11 14:04:30 +02:00
render ( ) {
const {
children ,
isScheduled ,
post ,
postType
} = this . props ;
const postLabel = ( 0 , external _lodash _namespaceObject . get ) ( postType , [ 'labels' , 'singular_name' ] ) ;
const viewPostLabel = ( 0 , external _lodash _namespaceObject . get ) ( postType , [ 'labels' , 'view_item' ] ) ;
const addNewPostLabel = ( 0 , external _lodash _namespaceObject . get ) ( postType , [ 'labels' , 'add_new_item' ] ) ;
const link = post . status === 'future' ? getFuturePostUrl ( post ) : post . link ;
const addLink = ( 0 , external _wp _url _namespaceObject . addQueryArgs ) ( 'post-new.php' , {
post _type : post . type
} ) ;
const postPublishNonLinkHeader = isScheduled ? ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _element _namespaceObject . Fragment , null , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'is now scheduled. It will go live on' ) , ' ' , ( 0 , external _wp _element _namespaceObject . createElement ) ( post _schedule _label , null ) , "." ) : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'is now live.' ) ;
return ( 0 , external _wp _element _namespaceObject . createElement ) ( "div" , {
className : "post-publish-panel__postpublish"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . PanelBody , {
className : "post-publish-panel__postpublish-header"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( "a" , {
ref : this . postLink ,
href : link
} , ( 0 , external _wp _htmlEntities _namespaceObject . decodeEntities ) ( post . title ) || ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( '(no title)' ) ) , ' ' , postPublishNonLinkHeader ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . PanelBody , null , ( 0 , external _wp _element _namespaceObject . createElement ) ( "p" , {
className : "post-publish-panel__postpublish-subheader"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( "strong" , null , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'What’ s next?' ) ) ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( "div" , {
className : "post-publish-panel__postpublish-post-address-container"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . TextControl , {
className : "post-publish-panel__postpublish-post-address" ,
readOnly : true ,
label : ( 0 , external _wp _i18n _namespaceObject . sprintf ) (
/* translators: %s: post type singular name */
( 0 , external _wp _i18n _namespaceObject . _ _ ) ( '%s address' ) , postLabel ) ,
value : ( 0 , external _wp _url _namespaceObject . safeDecodeURIComponent ) ( link ) ,
onFocus : this . onSelectInput
} ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( "div" , {
className : "post-publish-panel__postpublish-post-address__copy-button-wrap"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( postpublish _CopyButton , {
text : link ,
onCopy : this . onCopy
} , this . state . showCopyConfirmation ? ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Copied!' ) : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Copy' ) ) ) ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( "div" , {
className : "post-publish-panel__postpublish-buttons"
} , ! isScheduled && ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Button , {
variant : "primary" ,
href : link
} , viewPostLabel ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Button , {
variant : isScheduled ? 'primary' : 'secondary' ,
href : addLink
} , addNewPostLabel ) ) ) , children ) ;
}
2020-10-20 15:36:16 +02:00
2022-04-11 14:04:30 +02:00
}
2020-10-20 15:36:16 +02:00
2022-04-11 14:04:30 +02:00
/* harmony default export */ var postpublish = ( ( 0 , external _wp _data _namespaceObject . withSelect ) ( select => {
const {
getEditedPostAttribute ,
getCurrentPost ,
isCurrentPostScheduled
2022-04-12 17:12:47 +02:00
} = select ( store _store ) ;
2022-04-11 14:04:30 +02:00
const {
getPostType
} = select ( external _wp _coreData _namespaceObject . store ) ;
return {
post : getCurrentPost ( ) ,
postType : getPostType ( getEditedPostAttribute ( 'type' ) ) ,
isScheduled : isCurrentPostScheduled ( )
2021-11-08 15:29:21 +01:00
} ;
2022-04-11 14:04:30 +02:00
} ) ( PostPublishPanelPostpublish ) ) ;
2019-03-21 13:48:00 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/index.js
2019-03-21 13:48:00 +01:00
2018-12-17 05:52:00 +01:00
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
/ * *
* External dependencies
* /
2018-12-17 05:52:00 +01:00
2022-04-11 14:04:30 +02:00
/ * *
* WordPress dependencies
* /
2018-12-14 05:41:57 +01:00
2019-03-21 13:48:00 +01:00
2021-04-15 17:19:43 +02:00
2019-03-21 13:48:00 +01:00
2022-04-11 14:04:30 +02:00
/ * *
* Internal dependencies
* /
2019-03-21 13:48:00 +01:00
2022-04-11 14:04:30 +02:00
class PostPublishPanel extends external _wp _element _namespaceObject . Component {
constructor ( ) {
super ( ... arguments ) ;
this . onSubmit = this . onSubmit . bind ( this ) ;
}
2021-04-15 17:19:43 +02:00
2022-04-11 14:04:30 +02:00
componentDidUpdate ( prevProps ) {
// Automatically collapse the publish sidebar when a post
// is published and the user makes an edit.
if ( prevProps . isPublished && ! this . props . isSaving && this . props . isDirty ) {
this . props . onClose ( ) ;
}
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
onSubmit ( ) {
const {
onClose ,
hasPublishAction ,
isPostTypeViewable
} = this . props ;
2019-03-21 13:48:00 +01:00
2022-04-11 14:04:30 +02:00
if ( ! hasPublishAction || ! isPostTypeViewable ) {
onClose ( ) ;
}
}
2021-11-08 15:29:21 +01:00
2022-04-11 14:04:30 +02:00
render ( ) {
const {
forceIsDirty ,
forceIsSaving ,
isBeingScheduled ,
isPublished ,
isPublishSidebarEnabled ,
isScheduled ,
isSaving ,
isSavingNonPostEntityChanges ,
onClose ,
onTogglePublishSidebar ,
PostPublishExtension ,
PrePublishExtension ,
... additionalProps
} = this . props ;
const propsForPanel = ( 0 , external _lodash _namespaceObject . omit ) ( additionalProps , [ 'hasPublishAction' , 'isDirty' , 'isPostTypeViewable' ] ) ;
const isPublishedOrScheduled = isPublished || isScheduled && isBeingScheduled ;
const isPrePublish = ! isPublishedOrScheduled && ! isSaving ;
const isPostPublish = isPublishedOrScheduled && ! isSaving ;
return ( 0 , external _wp _element _namespaceObject . createElement ) ( "div" , _extends ( {
className : "editor-post-publish-panel"
} , propsForPanel ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( "div" , {
className : "editor-post-publish-panel__header"
} , isPostPublish ? ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Button , {
onClick : onClose ,
icon : close _small ,
label : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Close panel' )
} ) : ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _element _namespaceObject . Fragment , null , ( 0 , external _wp _element _namespaceObject . createElement ) ( "div" , {
className : "editor-post-publish-panel__header-publish-button"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( post _publish _button , {
focusOnMount : true ,
onSubmit : this . onSubmit ,
forceIsDirty : forceIsDirty ,
forceIsSaving : forceIsSaving
} ) ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( "div" , {
className : "editor-post-publish-panel__header-cancel-button"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Button , {
disabled : isSavingNonPostEntityChanges ,
onClick : onClose ,
variant : "secondary"
} , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Cancel' ) ) ) ) ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( "div" , {
className : "editor-post-publish-panel__content"
} , isPrePublish && ( 0 , external _wp _element _namespaceObject . createElement ) ( prepublish , null , PrePublishExtension && ( 0 , external _wp _element _namespaceObject . createElement ) ( PrePublishExtension , null ) ) , isPostPublish && ( 0 , external _wp _element _namespaceObject . createElement ) ( postpublish , {
focusOnMount : true
} , PostPublishExtension && ( 0 , external _wp _element _namespaceObject . createElement ) ( PostPublishExtension , null ) ) , isSaving && ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Spinner , null ) ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( "div" , {
className : "editor-post-publish-panel__footer"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . CheckboxControl , {
label : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Always show pre-publish checks.' ) ,
checked : isPublishSidebarEnabled ,
onChange : onTogglePublishSidebar
} ) ) ) ;
}
2021-11-08 15:29:21 +01:00
2022-04-11 14:04:30 +02:00
}
/* harmony default export */ var post _publish _panel = ( ( 0 , external _wp _compose _namespaceObject . compose ) ( [ ( 0 , external _wp _data _namespaceObject . withSelect ) ( select => {
const {
getPostType
} = select ( external _wp _coreData _namespaceObject . store ) ;
const {
getCurrentPost ,
getEditedPostAttribute ,
isCurrentPostPublished ,
isCurrentPostScheduled ,
isEditedPostBeingScheduled ,
isEditedPostDirty ,
isSavingPost ,
isSavingNonPostEntityChanges
2022-04-12 17:12:47 +02:00
} = select ( store _store ) ;
2022-04-11 14:04:30 +02:00
const {
isPublishSidebarEnabled
2022-04-12 17:12:47 +02:00
} = select ( store _store ) ;
2022-04-11 14:04:30 +02:00
const postType = getPostType ( getEditedPostAttribute ( 'type' ) ) ;
return {
hasPublishAction : ( 0 , external _lodash _namespaceObject . get ) ( getCurrentPost ( ) , [ '_links' , 'wp:action-publish' ] , false ) ,
isPostTypeViewable : ( 0 , external _lodash _namespaceObject . get ) ( postType , [ 'viewable' ] , false ) ,
isBeingScheduled : isEditedPostBeingScheduled ( ) ,
isDirty : isEditedPostDirty ( ) ,
isPublished : isCurrentPostPublished ( ) ,
isPublishSidebarEnabled : isPublishSidebarEnabled ( ) ,
isSaving : isSavingPost ( ) ,
isSavingNonPostEntityChanges : isSavingNonPostEntityChanges ( ) ,
isScheduled : isCurrentPostScheduled ( )
} ;
} ) , ( 0 , external _wp _data _namespaceObject . withDispatch ) ( ( dispatch , _ref ) => {
let {
isPublishSidebarEnabled
} = _ref ;
const {
disablePublishSidebar ,
enablePublishSidebar
2022-04-12 17:12:47 +02:00
} = dispatch ( store _store ) ;
2022-04-11 14:04:30 +02:00
return {
onTogglePublishSidebar : ( ) => {
if ( isPublishSidebarEnabled ) {
disablePublishSidebar ( ) ;
} else {
enablePublishSidebar ( ) ;
}
}
} ;
} ) , external _wp _components _namespaceObject . withFocusReturn , external _wp _components _namespaceObject . withConstrainedTabbing ] ) ( PostPublishPanel ) ) ;
2019-03-21 13:48:00 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/cloud-upload.js
2020-06-26 15:33:47 +02:00
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* WordPress dependencies
2021-05-21 12:14:23 +02:00
* /
2020-06-26 15:33:47 +02:00
2022-04-11 14:04:30 +02:00
const cloudUpload = ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _primitives _namespaceObject . SVG , {
xmlns : "http://www.w3.org/2000/svg" ,
viewBox : "0 0 24 24"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _primitives _namespaceObject . Path , {
d : "M17.3 10.1c0-2.5-2.1-4.4-4.8-4.4-2.2 0-4.1 1.4-4.6 3.3h-.2C5.7 9 4 10.7 4 12.8c0 2.1 1.7 3.8 3.7 3.8h9c1.8 0 3.2-1.5 3.2-3.3.1-1.6-1.1-2.9-2.6-3.2zm-.5 5.1h-4v-2.4L14 14l1-1-3-3-3 3 1 1 1.2-1.2v2.4H7.7c-1.2 0-2.2-1.1-2.2-2.3s1-2.4 2.2-2.4H9l.3-1.1c.4-1.3 1.7-2.2 3.2-2.2 1.8 0 3.3 1.3 3.3 2.9v1.3l1.3.2c.8.1 1.4.9 1.4 1.8 0 1-.8 1.8-1.7 1.8z"
} ) ) ;
/* harmony default export */ var cloud _upload = ( cloudUpload ) ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js
2021-05-21 12:14:23 +02:00
/ * *
* WordPress dependencies
* /
2019-03-21 13:48:00 +01:00
2022-04-11 14:04:30 +02:00
/** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */
2021-11-08 15:29:21 +01:00
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Return an SVG icon .
*
* @ param { IconProps } props icon is the SVG component to render
* size is a number specifiying the icon size in pixels
* Other props will be passed to wrapped SVG component
*
* @ return { JSX . Element } Icon component
2021-05-21 12:14:23 +02:00
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
function Icon ( _ref ) {
2021-11-15 13:50:17 +01:00
let {
2022-04-11 14:04:30 +02:00
icon ,
size = 24 ,
... props
2021-11-15 13:50:17 +01:00
} = _ref ;
2022-04-11 14:04:30 +02:00
return ( 0 , external _wp _element _namespaceObject . cloneElement ) ( icon , {
width : size ,
height : size ,
... props
2021-05-21 12:14:23 +02:00
} ) ;
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
/* harmony default export */ var icon = ( Icon ) ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js
2018-12-14 05:41:57 +01:00
2021-05-21 12:14:23 +02:00
/ * *
* WordPress dependencies
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
const check _check = ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _primitives _namespaceObject . SVG , {
xmlns : "http://www.w3.org/2000/svg" ,
viewBox : "0 0 24 24"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _primitives _namespaceObject . Path , {
d : "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"
} ) ) ;
/* harmony default export */ var library _check = ( check _check ) ;
2018-12-17 05:52:00 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/cloud.js
2018-12-17 05:52:00 +01:00
2021-11-08 15:29:21 +01:00
/ * *
2022-04-11 14:04:30 +02:00
* WordPress dependencies
2021-11-08 15:29:21 +01:00
* /
2022-04-11 14:04:30 +02:00
const cloud = ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _primitives _namespaceObject . SVG , {
xmlns : "http://www.w3.org/2000/svg" ,
viewBox : "0 0 24 24"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _primitives _namespaceObject . Path , {
d : "M17.3 10.1c0-2.5-2.1-4.4-4.8-4.4-2.2 0-4.1 1.4-4.6 3.3h-.2C5.7 9 4 10.7 4 12.8c0 2.1 1.7 3.8 3.7 3.8h9c1.8 0 3.2-1.5 3.2-3.3.1-1.6-1.1-2.9-2.6-3.2zm-.5 5.1h-9c-1.2 0-2.2-1.1-2.2-2.3s1-2.4 2.2-2.4h1.3l.3-1.1c.4-1.3 1.7-2.2 3.2-2.2 1.8 0 3.3 1.3 3.3 2.9v1.3l1.3.2c.8.1 1.4.9 1.4 1.8-.1 1-.9 1.8-1.8 1.8z"
} ) ) ;
/* harmony default export */ var library _cloud = ( cloud ) ;
2021-11-08 15:29:21 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-switch-to-draft-button/index.js
2018-12-14 05:41:57 +01:00
2021-05-21 12:14:23 +02:00
/ * *
* WordPress dependencies
* /
2019-03-21 13:48:00 +01:00
2020-02-10 23:33:27 +01:00
2018-12-14 05:41:57 +01:00
2022-04-12 17:12:47 +02:00
2021-11-08 15:29:21 +01:00
/ * *
* Internal dependencies
* /
2020-06-26 15:33:47 +02:00
2022-04-11 14:04:30 +02:00
function PostSwitchToDraftButton ( _ref ) {
let {
isSaving ,
isPublished ,
isScheduled ,
onClick
} = _ref ;
const isMobileViewport = ( 0 , external _wp _compose _namespaceObject . useViewportMatch ) ( 'small' , '<' ) ;
2022-04-12 17:12:47 +02:00
const [ showConfirmDialog , setShowConfirmDialog ] = ( 0 , external _wp _element _namespaceObject . useState ) ( false ) ;
2022-04-11 14:04:30 +02:00
if ( ! isPublished && ! isScheduled ) {
return null ;
2021-05-21 12:14:23 +02:00
}
2018-12-14 12:02:53 +01:00
2022-04-12 17:12:47 +02:00
let alertMessage ;
2018-12-14 12:02:53 +01:00
2022-04-12 17:12:47 +02:00
if ( isPublished ) {
alertMessage = ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Are you sure you want to unpublish this post?' ) ;
} else if ( isScheduled ) {
alertMessage = ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Are you sure you want to unschedule this post?' ) ;
}
2018-12-14 05:41:57 +01:00
2022-04-12 17:12:47 +02:00
const handleConfirm = ( ) => {
setShowConfirmDialog ( false ) ;
onClick ( ) ;
2021-05-21 12:14:23 +02:00
} ;
2020-06-26 15:33:47 +02:00
2022-04-12 17:12:47 +02:00
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _element _namespaceObject . Fragment , null , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Button , {
2022-04-11 14:04:30 +02:00
className : "editor-post-switch-to-draft" ,
2022-04-12 17:12:47 +02:00
onClick : ( ) => {
setShowConfirmDialog ( true ) ;
} ,
2022-04-11 14:04:30 +02:00
disabled : isSaving ,
variant : "tertiary"
2022-04-12 17:12:47 +02:00
} , isMobileViewport ? ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Draft' ) : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Switch to draft' ) ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . _ _experimentalConfirmDialog , {
isOpen : showConfirmDialog ,
onConfirm : handleConfirm ,
onCancel : ( ) => setShowConfirmDialog ( false )
} , alertMessage ) ) ;
2021-05-21 12:14:23 +02:00
}
2020-02-06 22:03:31 +01:00
2022-04-11 14:04:30 +02:00
/* harmony default export */ var post _switch _to _draft _button = ( ( 0 , external _wp _compose _namespaceObject . compose ) ( [ ( 0 , external _wp _data _namespaceObject . withSelect ) ( select => {
const {
isSavingPost ,
isCurrentPostPublished ,
isCurrentPostScheduled
2022-04-12 17:12:47 +02:00
} = select ( store _store ) ;
2022-04-11 14:04:30 +02:00
return {
isSaving : isSavingPost ( ) ,
isPublished : isCurrentPostPublished ( ) ,
isScheduled : isCurrentPostScheduled ( )
} ;
} ) , ( 0 , external _wp _data _namespaceObject . withDispatch ) ( dispatch => {
const {
editPost ,
savePost
2022-04-12 17:12:47 +02:00
} = dispatch ( store _store ) ;
2022-04-11 14:04:30 +02:00
return {
onClick : ( ) => {
editPost ( {
status : 'draft'
} ) ;
savePost ( ) ;
}
} ;
} ) ] ) ( PostSwitchToDraftButton ) ) ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-saved-state/index.js
2020-06-26 15:33:47 +02:00
2020-02-06 22:03:31 +01:00
2021-05-21 12:14:23 +02:00
/ * *
* External dependencies
* /
2018-12-14 05:41:57 +01:00
2021-05-21 12:14:23 +02:00
/ * *
* WordPress dependencies
* /
2018-12-14 05:41:57 +01:00
2021-05-21 12:14:23 +02:00
/ * *
* Internal dependencies
* /
2018-12-14 05:41:57 +01:00
2021-11-08 15:29:21 +01:00
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Component showing whether the post is saved or not and providing save
* buttons .
*
* @ param { Object } props Component props .
* @ param { ? boolean } props . forceIsDirty Whether to force the post to be marked
* as dirty .
* @ param { ? boolean } props . forceIsSaving Whether to force the post to be marked
* as being saved .
* @ param { ? boolean } props . showIconLabels Whether interface buttons show labels instead of icons
* @ return { import ( '@wordpress/element' ) . WPComponent } The component .
2021-05-21 12:14:23 +02:00
* /
2018-12-14 12:02:53 +01:00
2022-04-11 14:04:30 +02:00
function PostSavedState ( _ref ) {
let {
forceIsDirty ,
forceIsSaving ,
showIconLabels = false
} = _ref ;
const [ forceSavedMessage , setForceSavedMessage ] = ( 0 , external _wp _element _namespaceObject . useState ) ( false ) ;
const isLargeViewport = ( 0 , external _wp _compose _namespaceObject . useViewportMatch ) ( 'small' ) ;
2021-05-21 12:14:23 +02:00
const {
2022-04-11 14:04:30 +02:00
isAutosaving ,
isDirty ,
isNew ,
isPending ,
isPublished ,
isSaveable ,
isSaving ,
isScheduled ,
hasPublishAction
} = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => {
var _getCurrentPost$ _link , _getCurrentPost , _getCurrentPost$ _link2 ;
2021-05-21 12:14:23 +02:00
const {
2022-04-11 14:04:30 +02:00
isEditedPostNew ,
isCurrentPostPublished ,
isCurrentPostScheduled ,
isEditedPostDirty ,
isSavingPost ,
isEditedPostSaveable ,
getCurrentPost ,
isAutosavingPost ,
getEditedPostAttribute
2022-04-12 17:12:47 +02:00
} = select ( store _store ) ;
2021-05-21 12:14:23 +02:00
return {
2022-04-11 14:04:30 +02:00
isAutosaving : isAutosavingPost ( ) ,
isDirty : forceIsDirty || isEditedPostDirty ( ) ,
isNew : isEditedPostNew ( ) ,
isPending : 'pending' === getEditedPostAttribute ( 'status' ) ,
isPublished : isCurrentPostPublished ( ) ,
isSaving : forceIsSaving || isSavingPost ( ) ,
isSaveable : isEditedPostSaveable ( ) ,
isScheduled : isCurrentPostScheduled ( ) ,
hasPublishAction : ( _getCurrentPost$ _link = ( _getCurrentPost = getCurrentPost ( ) ) === null || _getCurrentPost === void 0 ? void 0 : ( _getCurrentPost$ _link2 = _getCurrentPost . _links ) === null || _getCurrentPost$ _link2 === void 0 ? void 0 : _getCurrentPost$ _link2 [ 'wp:action-publish' ] ) !== null && _getCurrentPost$ _link !== void 0 ? _getCurrentPost$ _link : false
2021-05-21 12:14:23 +02:00
} ;
2022-04-11 14:04:30 +02:00
} , [ forceIsDirty , forceIsSaving ] ) ;
const {
savePost
2022-04-12 17:12:47 +02:00
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( store _store ) ;
2022-04-11 14:04:30 +02:00
const wasSaving = ( 0 , external _wp _compose _namespaceObject . usePrevious ) ( isSaving ) ;
( 0 , external _wp _element _namespaceObject . useEffect ) ( ( ) => {
let timeoutId ;
2018-12-14 12:02:53 +01:00
2022-04-11 14:04:30 +02:00
if ( wasSaving && ! isSaving ) {
setForceSavedMessage ( true ) ;
timeoutId = setTimeout ( ( ) => {
setForceSavedMessage ( false ) ;
} , 1000 ) ;
2021-05-21 12:14:23 +02:00
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
return ( ) => clearTimeout ( timeoutId ) ;
} , [ isSaving ] ) ; // Once the post has been submitted for review this button
// is not needed for the contributor role.
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
if ( ! hasPublishAction && isPending ) {
return null ;
2021-05-21 12:14:23 +02:00
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
if ( isPublished || isScheduled ) {
return ( 0 , external _wp _element _namespaceObject . createElement ) ( post _switch _to _draft _button , null ) ;
2021-05-21 12:14:23 +02:00
}
2022-04-11 14:04:30 +02:00
/* translators: button label text should, if possible, be under 16 characters. */
2018-12-14 05:41:57 +01:00
2021-11-08 15:29:21 +01:00
2022-04-11 14:04:30 +02:00
const label = isPending ? ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Save as pending' ) : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Save draft' ) ;
/* translators: button label text should, if possible, be under 16 characters. */
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
const shortLabel = ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Save' ) ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
const isSaved = forceSavedMessage || ! isNew && ! isDirty ;
const isSavedState = isSaving || isSaved ;
const isDisabled = isSaving || isSaved || ! isSaveable ;
let text ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
if ( isSaving ) {
text = isAutosaving ? ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Autosaving' ) : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Saving' ) ;
} else if ( isSaved ) {
text = ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Saved' ) ;
} else if ( isLargeViewport ) {
text = label ;
} else if ( showIconLabels ) {
text = shortLabel ;
} // Use common Button instance for all saved states so that focus is not
// lost.
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Button , {
className : isSaveable || isSaving ? classnames _default ( ) ( {
'editor-post-save-draft' : ! isSavedState ,
'editor-post-saved-state' : isSavedState ,
'is-saving' : isSaving ,
'is-autosaving' : isAutosaving ,
'is-saved' : isSaved ,
[ ( 0 , external _wp _components _namespaceObject . _ _unstableGetAnimateClassName ) ( {
type : 'loading'
} ) ] : isSaving
} ) : undefined ,
onClick : isDisabled ? undefined : ( ) => savePost ( ) ,
shortcut : external _wp _keycodes _namespaceObject . displayShortcut . primary ( 's' ) ,
variant : isLargeViewport ? 'tertiary' : undefined ,
icon : isLargeViewport ? undefined : cloud _upload ,
2022-04-12 17:12:47 +02:00
label : showIconLabels ? undefined : label ,
2022-04-11 14:04:30 +02:00
"aria-disabled" : isDisabled
} , isSavedState && ( 0 , external _wp _element _namespaceObject . createElement ) ( icon , {
icon : isSaved ? library _check : library _cloud
} ) , text ) ;
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-schedule/check.js
/ * *
* External dependencies
2022-04-12 17:12:47 +02:00
* /
2020-01-08 12:57:23 +01:00
/ * *
2022-04-12 17:12:47 +02:00
* WordPress dependencies
2020-01-08 12:57:23 +01:00
* /
2022-04-11 14:04:30 +02:00
2021-11-08 15:29:21 +01:00
/ * *
2022-04-12 17:12:47 +02:00
* Internal dependencies
2022-04-11 14:04:30 +02:00
* /
2021-11-08 15:29:21 +01:00
2022-04-12 17:12:47 +02:00
function PostScheduleCheck ( _ref ) {
let {
hasPublishAction ,
children
} = _ref ;
2021-11-08 15:29:21 +01:00
2022-04-12 17:12:47 +02:00
if ( ! hasPublishAction ) {
return null ;
}
2021-05-19 17:09:27 +02:00
2022-04-12 17:12:47 +02:00
return children ;
}
/* harmony default export */ var post _schedule _check = ( ( 0 , external _wp _compose _namespaceObject . compose ) ( [ ( 0 , external _wp _data _namespaceObject . withSelect ) ( select => {
const {
getCurrentPost ,
getCurrentPostType
} = select ( store _store ) ;
return {
hasPublishAction : ( 0 , external _lodash _namespaceObject . get ) ( getCurrentPost ( ) , [ '_links' , 'wp:action-publish' ] , false ) ,
postType : getCurrentPostType ( )
2022-04-11 14:04:30 +02:00
} ;
2022-04-12 17:12:47 +02:00
} ) ] ) ( PostScheduleCheck ) ) ;
2018-12-17 05:52:00 +01:00
2022-04-12 17:12:47 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-slug/check.js
2018-12-18 04:14:52 +01:00
2018-12-14 05:41:57 +01:00
/ * *
2022-04-12 17:12:47 +02:00
* Internal dependencies
2022-04-11 14:04:30 +02:00
* /
2022-04-12 17:12:47 +02:00
function PostSlugCheck ( _ref ) {
let {
children
} = _ref ;
return ( 0 , external _wp _element _namespaceObject . createElement ) ( post _type _support _check , {
supportKeys : "slug"
} , children ) ;
2022-04-11 14:04:30 +02:00
}
2022-04-12 17:12:47 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-slug/index.js
2022-04-11 14:04:30 +02:00
2022-04-12 17:12:47 +02:00
/ * *
* WordPress dependencies
* /
2021-05-20 14:20:04 +02:00
2018-12-18 04:14:52 +01:00
2022-04-11 14:04:30 +02:00
2018-12-18 04:14:52 +01:00
2022-04-11 14:04:30 +02:00
/ * *
2022-04-12 17:12:47 +02:00
* Internal dependencies
2022-04-11 14:04:30 +02:00
* /
2019-03-21 13:48:00 +01:00
2018-12-14 05:41:57 +01:00
2022-04-12 17:12:47 +02:00
class PostSlug extends external _wp _element _namespaceObject . Component {
constructor ( _ref ) {
let {
postSlug ,
postTitle ,
postID
} = _ref ;
super ( ... arguments ) ;
this . state = {
editedSlug : ( 0 , external _wp _url _namespaceObject . safeDecodeURIComponent ) ( postSlug ) || ( 0 , external _wp _url _namespaceObject . cleanForSlug ) ( postTitle ) || postID
2022-04-11 14:04:30 +02:00
} ;
2022-04-12 17:12:47 +02:00
this . setSlug = this . setSlug . bind ( this ) ;
2022-04-11 14:04:30 +02:00
}
2019-03-21 13:48:00 +01:00
2022-04-12 17:12:47 +02:00
setSlug ( event ) {
const {
postSlug ,
onUpdateSlug
} = this . props ;
const {
value
} = event . target ;
const editedSlug = ( 0 , external _wp _url _namespaceObject . cleanForSlug ) ( value ) ;
2019-03-21 13:48:00 +01:00
2022-04-12 17:12:47 +02:00
if ( editedSlug === postSlug ) {
return ;
}
2019-03-21 13:48:00 +01:00
2022-04-12 17:12:47 +02:00
onUpdateSlug ( editedSlug ) ;
}
2018-12-14 05:41:57 +01:00
2022-04-12 17:12:47 +02:00
render ( ) {
const {
instanceId
} = this . props ;
const {
editedSlug
} = this . state ;
const inputId = 'editor-post-slug-' + instanceId ;
return ( 0 , external _wp _element _namespaceObject . createElement ) ( PostSlugCheck , null , ( 0 , external _wp _element _namespaceObject . createElement ) ( "label" , {
htmlFor : inputId
} , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Slug' ) ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( "input" , {
autoComplete : "off" ,
spellCheck : "false" ,
type : "text" ,
id : inputId ,
value : editedSlug ,
onChange : event => this . setState ( {
editedSlug : event . target . value
} ) ,
onBlur : this . setSlug ,
className : "editor-post-slug__input"
} ) ) ;
}
2018-12-18 04:14:52 +01:00
2022-04-12 17:12:47 +02:00
}
/* harmony default export */ var post _slug = ( ( 0 , external _wp _compose _namespaceObject . compose ) ( [ ( 0 , external _wp _data _namespaceObject . withSelect ) ( select => {
const {
getCurrentPost ,
getEditedPostAttribute
} = select ( store _store ) ;
const {
id
} = getCurrentPost ( ) ;
return {
postSlug : getEditedPostAttribute ( 'slug' ) ,
postTitle : getEditedPostAttribute ( 'title' ) ,
postID : id
2022-04-11 14:04:30 +02:00
} ;
2022-04-12 17:12:47 +02:00
} ) , ( 0 , external _wp _data _namespaceObject . withDispatch ) ( dispatch => {
const {
editPost
} = dispatch ( store _store ) ;
return {
onUpdateSlug ( slug ) {
editPost ( {
slug
} ) ;
}
2018-12-18 04:14:52 +01:00
2022-04-11 14:04:30 +02:00
} ;
2022-04-12 17:12:47 +02:00
} ) , external _wp _compose _namespaceObject . withInstanceId ] ) ( PostSlug ) ) ;
2019-03-21 13:48:00 +01:00
2022-04-12 17:12:47 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-sticky/check.js
/ * *
* External dependencies
* /
2019-03-21 13:48:00 +01:00
2022-04-12 17:12:47 +02:00
/ * *
* WordPress dependencies
* /
2019-03-21 13:48:00 +01:00
2021-05-19 17:09:27 +02:00
2018-12-18 04:14:52 +01:00
2022-04-12 17:12:47 +02:00
/ * *
* Internal dependencies
* /
2019-03-21 13:48:00 +01:00
2018-12-14 05:41:57 +01:00
2022-04-12 17:12:47 +02:00
function PostStickyCheck ( _ref ) {
let {
hasStickyAction ,
postType ,
children
} = _ref ;
2019-03-21 13:48:00 +01:00
2022-04-12 17:12:47 +02:00
if ( postType !== 'post' || ! hasStickyAction ) {
return null ;
}
2019-03-21 13:48:00 +01:00
2022-04-12 17:12:47 +02:00
return children ;
}
/* harmony default export */ var post _sticky _check = ( ( 0 , external _wp _compose _namespaceObject . compose ) ( [ ( 0 , external _wp _data _namespaceObject . withSelect ) ( select => {
const post = select ( store _store ) . getCurrentPost ( ) ;
return {
hasStickyAction : ( 0 , external _lodash _namespaceObject . get ) ( post , [ '_links' , 'wp:action-sticky' ] , false ) ,
postType : select ( store _store ) . getCurrentPostType ( )
2022-04-11 14:04:30 +02:00
} ;
2022-04-12 17:12:47 +02:00
} ) ] ) ( PostStickyCheck ) ) ;
2019-03-21 13:48:00 +01:00
2022-04-12 17:12:47 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-sticky/index.js
2021-11-08 15:29:21 +01:00
2019-03-21 13:48:00 +01:00
2022-04-12 17:12:47 +02:00
/ * *
* WordPress dependencies
* /
2018-12-14 05:41:57 +01:00
2021-05-19 17:09:27 +02:00
2018-12-18 04:14:52 +01:00
2022-04-12 17:12:47 +02:00
/ * *
* Internal dependencies
* /
2022-04-11 14:04:30 +02:00
2022-04-12 17:12:47 +02:00
function PostSticky ( _ref ) {
let {
onUpdateSticky ,
postSticky = false
} = _ref ;
return ( 0 , external _wp _element _namespaceObject . createElement ) ( post _sticky _check , null , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . CheckboxControl , {
label : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Stick to the top of the blog' ) ,
checked : postSticky ,
onChange : ( ) => onUpdateSticky ( ! postSticky )
} ) ) ;
2021-05-21 12:14:23 +02:00
}
2022-04-12 17:12:47 +02:00
/* harmony default export */ var post _sticky = ( ( 0 , external _wp _compose _namespaceObject . compose ) ( [ ( 0 , external _wp _data _namespaceObject . withSelect ) ( select => {
return {
postSticky : select ( store _store ) . getEditedPostAttribute ( 'sticky' )
} ;
} ) , ( 0 , external _wp _data _namespaceObject . withDispatch ) ( dispatch => {
return {
onUpdateSticky ( postSticky ) {
dispatch ( store _store ) . editPost ( {
sticky : postSticky
} ) ;
}
2021-05-21 12:14:23 +02:00
2022-04-12 17:12:47 +02:00
} ;
} ) ] ) ( PostSticky ) ) ;
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/index.js
2021-05-21 12:14:23 +02:00
2018-12-18 04:14:52 +01:00
2022-04-11 14:04:30 +02:00
/ * *
* External dependencies
* /
2018-12-18 04:14:52 +01:00
2021-05-20 14:20:04 +02:00
/ * *
* WordPress dependencies
* /
2018-12-18 04:14:52 +01:00
2022-04-11 14:04:30 +02:00
2021-05-20 14:20:04 +02:00
/ * *
2021-05-21 12:14:23 +02:00
* Internal dependencies
2021-05-20 14:20:04 +02:00
* /
2018-12-18 04:14:52 +01:00
2019-03-07 10:09:59 +01:00
2021-05-21 12:14:23 +02:00
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
function PostTaxonomies ( _ref ) {
let {
postType ,
taxonomies ,
taxonomyWrapper = external _lodash _namespaceObject . identity
} = _ref ;
const availableTaxonomies = ( 0 , external _lodash _namespaceObject . filter ) ( taxonomies , taxonomy => ( 0 , external _lodash _namespaceObject . includes ) ( taxonomy . types , postType ) ) ;
2022-04-26 15:42:07 +02:00
const visibleTaxonomies = ( 0 , external _lodash _namespaceObject . filter ) ( availableTaxonomies , // In some circumstances .visibility can end up as undefined so optional chaining operator required.
// https://github.com/WordPress/gutenberg/issues/40326
taxonomy => {
var _taxonomy$visibility ;
return ( _taxonomy$visibility = taxonomy . visibility ) === null || _taxonomy$visibility === void 0 ? void 0 : _taxonomy$visibility . show _ui ;
} ) ;
2022-04-11 14:04:30 +02:00
return visibleTaxonomies . map ( taxonomy => {
const TaxonomyComponent = taxonomy . hierarchical ? hierarchical _term _selector : flat _term _selector ;
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _element _namespaceObject . Fragment , {
key : ` taxonomy- ${ taxonomy . slug } `
} , taxonomyWrapper ( ( 0 , external _wp _element _namespaceObject . createElement ) ( TaxonomyComponent , {
slug : taxonomy . slug
} ) , taxonomy ) ) ;
} ) ;
}
/* harmony default export */ var post _taxonomies = ( ( 0 , external _wp _compose _namespaceObject . compose ) ( [ ( 0 , external _wp _data _namespaceObject . withSelect ) ( select => {
return {
2022-04-12 17:12:47 +02:00
postType : select ( store _store ) . getCurrentPostType ( ) ,
2022-04-11 14:04:30 +02:00
taxonomies : select ( external _wp _coreData _namespaceObject . store ) . getTaxonomies ( {
per _page : - 1
} )
} ;
} ) ] ) ( PostTaxonomies ) ) ;
2018-12-18 04:14:52 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/check.js
2021-05-20 14:20:04 +02:00
/ * *
2021-05-21 12:14:23 +02:00
* External dependencies
2021-05-20 14:20:04 +02:00
* /
2018-12-18 04:14:52 +01:00
2021-05-21 12:14:23 +02:00
/ * *
* WordPress dependencies
* /
2018-12-18 04:14:52 +01:00
2019-03-07 10:09:59 +01:00
2022-04-11 14:04:30 +02:00
2021-11-08 15:29:21 +01:00
/ * *
* Internal dependencies
* /
2022-04-11 14:04:30 +02:00
function PostTaxonomiesCheck ( _ref ) {
2021-11-15 13:50:17 +01:00
let {
2022-04-11 14:04:30 +02:00
postType ,
taxonomies ,
children
2021-11-15 13:50:17 +01:00
} = _ref ;
2022-04-11 14:04:30 +02:00
const hasTaxonomies = ( 0 , external _lodash _namespaceObject . some ) ( taxonomies , taxonomy => ( 0 , external _lodash _namespaceObject . includes ) ( taxonomy . types , postType ) ) ;
if ( ! hasTaxonomies ) {
return null ;
}
return children ;
2021-05-21 12:14:23 +02:00
}
2022-04-11 14:04:30 +02:00
/* harmony default export */ var post _taxonomies _check = ( ( 0 , external _wp _compose _namespaceObject . compose ) ( [ ( 0 , external _wp _data _namespaceObject . withSelect ) ( select => {
return {
2022-04-12 17:12:47 +02:00
postType : select ( store _store ) . getCurrentPostType ( ) ,
2022-04-11 14:04:30 +02:00
taxonomies : select ( external _wp _coreData _namespaceObject . store ) . getTaxonomies ( {
per _page : - 1
} )
} ;
} ) ] ) ( PostTaxonomiesCheck ) ) ;
// EXTERNAL MODULE: ./node_modules/react-autosize-textarea/lib/index.js
var lib = _ _webpack _require _ _ ( 773 ) ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-text-editor/index.js
2018-12-14 05:41:57 +01:00
2021-05-21 12:14:23 +02:00
/ * *
* External dependencies
* /
2018-12-14 05:41:57 +01:00
2021-05-20 14:20:04 +02:00
/ * *
* WordPress dependencies
* /
2018-12-17 05:52:00 +01:00
2018-12-18 04:14:52 +01:00
2018-12-17 05:52:00 +01:00
2021-11-08 15:29:21 +01:00
2018-12-14 05:41:57 +01:00
2021-05-21 12:14:23 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Internal dependencies
2021-05-21 12:14:23 +02:00
* /
2019-03-21 13:48:00 +01:00
2022-04-11 14:04:30 +02:00
function PostTextEditor ( ) {
2022-04-12 17:12:47 +02:00
const postContent = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => select ( store _store ) . getEditedPostContent ( ) , [ ] ) ;
2021-11-08 15:29:21 +01:00
const {
2022-04-11 14:04:30 +02:00
editPost ,
resetEditorBlocks
2022-04-12 17:12:47 +02:00
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( store _store ) ;
2022-04-11 14:04:30 +02:00
const [ value , setValue ] = ( 0 , external _wp _element _namespaceObject . useState ) ( postContent ) ;
const [ isDirty , setIsDirty ] = ( 0 , external _wp _element _namespaceObject . useState ) ( false ) ;
const instanceId = ( 0 , external _wp _compose _namespaceObject . useInstanceId ) ( PostTextEditor ) ;
2022-05-10 16:49:35 +02:00
const valueRef = ( 0 , external _wp _element _namespaceObject . useRef ) ( ) ;
2022-04-11 14:04:30 +02:00
if ( ! isDirty && value !== postContent ) {
setValue ( postContent ) ;
}
2021-11-08 15:29:21 +01:00
/ * *
2022-04-11 14:04:30 +02:00
* Handles a textarea change event to notify the onChange prop callback and
* reflect the new value in the component ' s own state . This marks the start
* of the user ' s edits , if not already changed , preventing future props
* changes to value from replacing the rendered value . This is expected to
* be followed by a reset to dirty state via ` stopEditing ` .
2021-11-08 15:29:21 +01:00
*
2022-04-11 14:04:30 +02:00
* @ see stopEditing
*
* @ param { Event } event Change event .
2021-11-08 15:29:21 +01:00
* /
2022-04-11 14:04:30 +02:00
const onChange = event => {
const newValue = event . target . value ;
editPost ( {
content : newValue
} ) ;
setValue ( newValue ) ;
setIsDirty ( true ) ;
2021-11-08 15:29:21 +01:00
} ;
2022-04-11 14:04:30 +02:00
/ * *
* Function called when the user has completed their edits , responsible for
* ensuring that changes , if made , are surfaced to the onPersist prop
* callback and resetting dirty state .
* /
2021-11-08 15:29:21 +01:00
2022-04-11 14:04:30 +02:00
const stopEditing = ( ) => {
if ( isDirty ) {
const blocks = ( 0 , external _wp _blocks _namespaceObject . parse ) ( value ) ;
resetEditorBlocks ( blocks ) ;
setIsDirty ( false ) ;
}
} ;
2022-05-10 16:49:35 +02:00
( 0 , external _wp _element _namespaceObject . useEffect ) ( ( ) => {
valueRef . current = value ;
} , [ value ] ) ; // Ensure changes aren't lost when component unmounts.
( 0 , external _wp _element _namespaceObject . useEffect ) ( ( ) => {
return ( ) => {
const blocks = ( 0 , external _wp _blocks _namespaceObject . parse ) ( valueRef . current ) ;
resetEditorBlocks ( blocks ) ;
} ;
} , [ ] ) ;
2022-04-11 14:04:30 +02:00
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _element _namespaceObject . Fragment , null , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . VisuallyHidden , {
as : "label" ,
htmlFor : ` post-content- ${ instanceId } `
} , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Type text or HTML' ) ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( lib /* default */ . Z , {
autoComplete : "off" ,
dir : "auto" ,
value : value ,
onChange : onChange ,
onBlur : stopEditing ,
className : "editor-post-text-editor" ,
id : ` post-content- ${ instanceId } ` ,
placeholder : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Start writing with text or HTML' )
} ) ) ;
2021-05-21 12:14:23 +02:00
}
2021-05-19 17:09:27 +02:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-title/index.js
2018-12-14 05:41:57 +01:00
2021-05-19 17:09:27 +02:00
2022-04-11 14:04:30 +02:00
/ * *
* External dependencies
* /
2021-05-19 17:09:27 +02:00
2021-05-20 14:20:04 +02:00
/ * *
* WordPress dependencies
* /
2018-12-14 05:41:57 +01:00
2018-12-18 04:14:52 +01:00
2021-05-19 17:09:27 +02:00
2018-12-18 04:14:52 +01:00
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
/ * *
* Internal dependencies
* /
2021-05-19 17:09:27 +02:00
2022-04-11 14:04:30 +02:00
/ * *
* Constants
* /
const REGEXP _NEWLINES = /[\r\n]+/g ;
function PostTitle ( ) {
const ref = ( 0 , external _wp _element _namespaceObject . useRef ) ( ) ;
const [ isSelected , setIsSelected ] = ( 0 , external _wp _element _namespaceObject . useState ) ( false ) ;
2021-05-21 12:14:23 +02:00
const {
2022-04-11 14:04:30 +02:00
editPost
2022-04-12 17:12:47 +02:00
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( store _store ) ;
2022-04-11 14:04:30 +02:00
const {
insertDefaultBlock ,
clearSelectedBlock ,
insertBlocks
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( external _wp _blockEditor _namespaceObject . store ) ;
const {
isCleanNewPost ,
title ,
placeholder ,
isFocusMode ,
hasFixedToolbar
} = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => {
2021-05-21 12:14:23 +02:00
const {
2022-04-11 14:04:30 +02:00
getEditedPostAttribute ,
isCleanNewPost : _isCleanNewPost
2022-04-12 17:12:47 +02:00
} = select ( store _store ) ;
2022-04-11 14:04:30 +02:00
const {
getSettings
} = select ( external _wp _blockEditor _namespaceObject . store ) ;
const {
titlePlaceholder ,
focusMode ,
hasFixedToolbar : _hasFixedToolbar
} = getSettings ( ) ;
2021-05-21 12:14:23 +02:00
return {
2022-04-11 14:04:30 +02:00
isCleanNewPost : _isCleanNewPost ( ) ,
title : getEditedPostAttribute ( 'title' ) ,
placeholder : titlePlaceholder ,
isFocusMode : focusMode ,
hasFixedToolbar : _hasFixedToolbar
2021-05-21 12:14:23 +02:00
} ;
} , [ ] ) ;
2022-04-11 14:04:30 +02:00
( 0 , external _wp _element _namespaceObject . useEffect ) ( ( ) => {
if ( ! ref . current ) {
2021-05-21 12:14:23 +02:00
return ;
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
const {
ownerDocument
} = ref . current ;
const {
activeElement ,
body
} = ownerDocument ; // Only autofocus the title when the post is entirely empty. This should
// only happen for a new post, which means we focus the title on new
// post so the author can start typing right away, without needing to
// click anything.
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
if ( isCleanNewPost && ( ! activeElement || body === activeElement ) ) {
ref . current . focus ( ) ;
2021-05-21 12:14:23 +02:00
}
2022-04-11 14:04:30 +02:00
} , [ isCleanNewPost ] ) ;
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
function onEnterPress ( ) {
insertDefaultBlock ( undefined , undefined , 0 ) ;
2021-05-21 12:14:23 +02:00
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
function onInsertBlockAfter ( blocks ) {
insertBlocks ( blocks , 0 ) ;
}
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
function onUpdate ( newTitle ) {
editPost ( {
title : newTitle
} ) ;
}
2018-12-17 20:06:59 +01:00
2022-04-11 14:04:30 +02:00
const [ selection , setSelection ] = ( 0 , external _wp _element _namespaceObject . useState ) ( { } ) ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
function onSelect ( ) {
setIsSelected ( true ) ;
clearSelectedBlock ( ) ;
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
function onUnselect ( ) {
setIsSelected ( false ) ;
setSelection ( { } ) ;
}
2019-03-21 13:48:00 +01:00
2022-04-11 14:04:30 +02:00
function onChange ( value ) {
onUpdate ( value . replace ( REGEXP _NEWLINES , ' ' ) ) ;
}
2019-03-21 13:48:00 +01:00
2022-04-11 14:04:30 +02:00
function onKeyDown ( event ) {
if ( event . keyCode === external _wp _keycodes _namespaceObject . ENTER ) {
event . preventDefault ( ) ;
onEnterPress ( ) ;
}
}
2019-03-21 13:48:00 +01:00
2022-04-11 14:04:30 +02:00
function onPaste ( event ) {
const clipboardData = event . clipboardData ;
let plainText = '' ;
let html = '' ; // IE11 only supports `Text` as an argument for `getData` and will
// otherwise throw an invalid argument error, so we try the standard
// arguments first, then fallback to `Text` if they fail.
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
try {
plainText = clipboardData . getData ( 'text/plain' ) ;
html = clipboardData . getData ( 'text/html' ) ;
} catch ( error1 ) {
try {
html = clipboardData . getData ( 'Text' ) ;
} catch ( error2 ) {
// Some browsers like UC Browser paste plain text by default and
// don't support clipboardData at all, so allow default
// behaviour.
return ;
}
} // Allows us to ask for this information when we get a report.
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
window . console . log ( 'Received HTML:\n\n' , html ) ;
window . console . log ( 'Received plain text:\n\n' , plainText ) ;
const content = ( 0 , external _wp _blocks _namespaceObject . pasteHandler ) ( {
HTML : html ,
plainText
2021-05-21 12:14:23 +02:00
} ) ;
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
if ( typeof content !== 'string' && content . length ) {
event . preventDefault ( ) ;
const [ firstBlock ] = content ;
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
if ( ! title && ( firstBlock . name === 'core/heading' || firstBlock . name === 'core/paragraph' ) ) {
onUpdate ( firstBlock . attributes . content ) ;
onInsertBlockAfter ( content . slice ( 1 ) ) ;
} else {
onInsertBlockAfter ( content ) ;
}
}
} // The wp-block className is important for editor styles.
// This same block is used in both the visual and the code editor.
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const className = classnames _default ( ) ( 'wp-block wp-block-post-title block-editor-block-list__block editor-post-title editor-post-title__input rich-text' , {
'is-selected' : isSelected ,
'is-focus-mode' : isFocusMode ,
'has-fixed-toolbar' : hasFixedToolbar
} ) ;
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const decodedPlaceholder = ( 0 , external _wp _htmlEntities _namespaceObject . decodeEntities ) ( placeholder ) || ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Add title' ) ;
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const {
ref : richTextRef
} = ( 0 , external _wp _richText _namespaceObject . _ _unstableUseRichText ) ( {
value : title ,
onChange ,
placeholder : decodedPlaceholder ,
selectionStart : selection . start ,
selectionEnd : selection . end ,
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
onSelectionChange ( newStart , newEnd ) {
setSelection ( sel => {
const {
start ,
end
} = sel ;
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
if ( start === newStart && end === newEnd ) {
return sel ;
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
return {
start : newStart ,
end : newEnd
} ;
} ) ;
} ,
2019-03-21 13:48:00 +01:00
2022-04-11 14:04:30 +02:00
_ _unstableDisableFormats : true ,
preserveWhiteSpace : true
} ) ;
/* eslint-disable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */
2019-03-21 13:48:00 +01:00
2022-04-11 14:04:30 +02:00
return ( 0 , external _wp _element _namespaceObject . createElement ) ( post _type _support _check , {
supportKeys : "title"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( "h1" , {
ref : ( 0 , external _wp _compose _namespaceObject . useMergeRefs ) ( [ richTextRef , ref ] ) ,
contentEditable : true ,
className : className ,
"aria-label" : decodedPlaceholder ,
role : "textbox" ,
"aria-multiline" : "true" ,
onFocus : onSelect ,
onBlur : onUnselect ,
onKeyDown : onKeyDown ,
onKeyPress : onUnselect ,
onPaste : onPaste
} ) ) ;
/* eslint-enable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */
}
2019-03-21 13:48:00 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-trash/index.js
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
/ * *
* WordPress dependencies
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
/ * *
* Internal dependencies
* /
2018-12-14 05:41:57 +01:00
2022-04-12 17:12:47 +02:00
function PostTrash ( ) {
const {
2022-04-11 14:04:30 +02:00
isNew ,
2022-04-12 17:12:47 +02:00
postId
} = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => {
const store = select ( store _store ) ;
return {
isNew : store . isEditedPostNew ( ) ,
postId : store . getCurrentPostId ( )
} ;
} , [ ] ) ;
const {
trashPost
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( store _store ) ;
Block Editor: Update `@wordpress` dependencies to match Gutenberg 4.5.1.
- Update the annotations, api-fetch, block-library, blocks, components, compose, core-data, data, date, dom, edit-post, editor, element, format-library, html-entities, i18n, jest-console, jest-preset-default, keycodes, list-reusable-blocks, notices, nux, plugins, rich-text, scripts, token-lists, url, viewport packages.
- Upgrades React from 16.5.2 to 16.6.3.
- Adds a missing `wp-date` dependency to the editor script.
- Updates changed dependencies in `script-loader.php`.
- Fixes undefined notices in some blocks.
- Removes incorrect `gutenberg` textdomain.
Merges [43891], [43903], and [43919] to trunk.
Props atimmer, aduth, youknowriad, danielbachhuber.
See #45145.
Built from https://develop.svn.wordpress.org/trunk@44262
git-svn-id: http://core.svn.wordpress.org/trunk@44092 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-17 16:37:00 +01:00
2022-04-11 14:04:30 +02:00
if ( isNew || ! postId ) {
return null ;
}
Block Editor: Update `@wordpress` dependencies to match Gutenberg 4.5.1.
- Update the annotations, api-fetch, block-library, blocks, components, compose, core-data, data, date, dom, edit-post, editor, element, format-library, html-entities, i18n, jest-console, jest-preset-default, keycodes, list-reusable-blocks, notices, nux, plugins, rich-text, scripts, token-lists, url, viewport packages.
- Upgrades React from 16.5.2 to 16.6.3.
- Adds a missing `wp-date` dependency to the editor script.
- Updates changed dependencies in `script-loader.php`.
- Fixes undefined notices in some blocks.
- Removes incorrect `gutenberg` textdomain.
Merges [43891], [43903], and [43919] to trunk.
Props atimmer, aduth, youknowriad, danielbachhuber.
See #45145.
Built from https://develop.svn.wordpress.org/trunk@44262
git-svn-id: http://core.svn.wordpress.org/trunk@44092 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-17 16:37:00 +01:00
2022-04-11 14:04:30 +02:00
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Button , {
className : "editor-post-trash" ,
isDestructive : true ,
2022-04-12 17:12:47 +02:00
variant : "secondary" ,
onClick : ( ) => trashPost ( )
2022-04-11 14:04:30 +02:00
} , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Move to trash' ) ) ;
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-trash/check.js
/ * *
* WordPress dependencies
* /
2020-06-26 15:33:47 +02:00
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
/ * *
* Internal dependencies
* /
2018-12-18 04:14:52 +01:00
2021-04-15 13:03:35 +02:00
2019-03-07 10:09:59 +01:00
2022-04-11 14:04:30 +02:00
function PostTrashCheck ( _ref ) {
let {
isNew ,
postId ,
canUserDelete ,
children
} = _ref ;
2020-10-13 15:10:30 +02:00
2022-04-11 14:04:30 +02:00
if ( isNew || ! postId || ! canUserDelete ) {
return null ;
}
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
return children ;
}
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
/* harmony default export */ var post _trash _check = ( ( 0 , external _wp _data _namespaceObject . withSelect ) ( select => {
const {
isEditedPostNew ,
getCurrentPostId ,
getCurrentPostType
2022-04-12 17:12:47 +02:00
} = select ( store _store ) ;
2022-04-11 14:04:30 +02:00
const {
getPostType ,
canUser
} = select ( external _wp _coreData _namespaceObject . store ) ;
const postId = getCurrentPostId ( ) ;
const postType = getPostType ( getCurrentPostType ( ) ) ;
const resource = ( postType === null || postType === void 0 ? void 0 : postType . rest _base ) || '' ; // eslint-disable-line camelcase
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
return {
isNew : isEditedPostNew ( ) ,
postId ,
canUserDelete : postId && resource ? canUser ( 'delete' , resource , postId ) : false
} ;
} ) ( PostTrashCheck ) ) ;
2020-10-13 15:10:30 +02:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/check.js
/ * *
* External dependencies
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
/ * *
* WordPress dependencies
* /
2018-12-14 05:41:57 +01:00
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
/ * *
* Internal dependencies
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
function PostVisibilityCheck ( _ref ) {
let {
hasPublishAction ,
render
} = _ref ;
const canEdit = hasPublishAction ;
return render ( {
canEdit
} ) ;
}
/* harmony default export */ var post _visibility _check = ( ( 0 , external _wp _compose _namespaceObject . compose ) ( [ ( 0 , external _wp _data _namespaceObject . withSelect ) ( select => {
const {
getCurrentPost ,
getCurrentPostType
2022-04-12 17:12:47 +02:00
} = select ( store _store ) ;
2022-04-11 14:04:30 +02:00
return {
hasPublishAction : ( 0 , external _lodash _namespaceObject . get ) ( getCurrentPost ( ) , [ '_links' , 'wp:action-publish' ] , false ) ,
postType : getCurrentPostType ( )
} ;
} ) ] ) ( PostVisibilityCheck ) ) ;
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/info.js
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
/ * *
* WordPress dependencies
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const info = ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _primitives _namespaceObject . SVG , {
xmlns : "http://www.w3.org/2000/svg" ,
viewBox : "0 0 24 24"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _primitives _namespaceObject . Path , {
d : "M12 3.2c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8 0-4.8-4-8.8-8.8-8.8zm0 16c-4 0-7.2-3.3-7.2-7.2C4.8 8 8 4.8 12 4.8s7.2 3.3 7.2 7.2c0 4-3.2 7.2-7.2 7.2zM11 17h2v-6h-2v6zm0-8h2V7h-2v2z"
} ) ) ;
/* harmony default export */ var library _info = ( info ) ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: external ["wp","wordcount"]
var external _wp _wordcount _namespaceObject = window [ "wp" ] [ "wordcount" ] ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/word-count/index.js
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
/ * *
* WordPress dependencies
* /
2018-12-14 05:41:57 +01:00
2019-03-21 13:48:00 +01:00
2022-04-11 14:04:30 +02:00
/ * *
* Internal dependencies
* /
2020-02-10 23:33:27 +01:00
2020-06-26 15:33:47 +02:00
2022-04-11 14:04:30 +02:00
function WordCount ( ) {
2022-04-12 17:12:47 +02:00
const content = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => select ( store _store ) . getEditedPostAttribute ( 'content' ) , [ ] ) ;
2022-04-11 14:04:30 +02:00
/ *
* translators : If your word count is based on single characters ( e . g . East Asian characters ) ,
* enter 'characters_excluding_spaces' or 'characters_including_spaces' . Otherwise , enter 'words' .
* Do not translate into your own language .
* /
2021-05-19 17:09:27 +02:00
2022-04-11 14:04:30 +02:00
const wordCountType = ( 0 , external _wp _i18n _namespaceObject . _x ) ( 'words' , 'Word count type. Do not translate!' ) ;
2019-03-21 13:48:00 +01:00
2022-04-11 14:04:30 +02:00
return ( 0 , external _wp _element _namespaceObject . createElement ) ( "span" , {
className : "word-count"
} , ( 0 , external _wp _wordcount _namespaceObject . count ) ( content , wordCountType ) ) ;
}
2021-07-15 20:55:29 +02:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/character-count/index.js
/ * *
* WordPress dependencies
* /
2021-11-08 15:29:21 +01:00
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
/ * *
* Internal dependencies
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
function CharacterCount ( ) {
2022-04-12 17:12:47 +02:00
const content = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => select ( store _store ) . getEditedPostAttribute ( 'content' ) , [ ] ) ;
2022-04-11 14:04:30 +02:00
return ( 0 , external _wp _wordcount _namespaceObject . count ) ( content , 'characters_including_spaces' ) ;
}
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/table-of-contents/panel.js
2021-05-20 14:20:04 +02:00
2018-12-14 05:41:57 +01:00
2020-06-26 15:33:47 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* WordPress dependencies
2020-06-26 15:33:47 +02:00
* /
2018-12-14 05:41:57 +01:00
2019-03-21 13:48:00 +01:00
2021-05-20 14:20:04 +02:00
/ * *
2021-05-21 12:14:23 +02:00
* Internal dependencies
2021-05-20 14:20:04 +02:00
* /
2018-12-18 04:14:52 +01:00
2018-12-14 05:41:57 +01:00
2018-12-18 04:14:52 +01:00
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
function TableOfContentsPanel ( _ref ) {
let {
hasOutlineItemsDisabled ,
onRequestClose
} = _ref ;
const {
headingCount ,
paragraphCount ,
numberOfBlocks
} = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => {
const {
getGlobalBlockCount
} = select ( external _wp _blockEditor _namespaceObject . store ) ;
return {
headingCount : getGlobalBlockCount ( 'core/heading' ) ,
paragraphCount : getGlobalBlockCount ( 'core/paragraph' ) ,
numberOfBlocks : getGlobalBlockCount ( )
} ;
} , [ ] ) ;
return (
/ *
* Disable reason : The ` list ` ARIA role is redundant but
* Safari + VoiceOver won ' t announce the list otherwise .
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
/* eslint-disable jsx-a11y/no-redundant-roles */
( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _element _namespaceObject . Fragment , null , ( 0 , external _wp _element _namespaceObject . createElement ) ( "div" , {
className : "table-of-contents__wrapper" ,
role : "note" ,
"aria-label" : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Document Statistics' ) ,
tabIndex : "0"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( "ul" , {
role : "list" ,
className : "table-of-contents__counts"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( "li" , {
className : "table-of-contents__count"
} , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Characters' ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( "span" , {
className : "table-of-contents__number"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( CharacterCount , null ) ) ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( "li" , {
className : "table-of-contents__count"
} , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Words' ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( WordCount , null ) ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( "li" , {
className : "table-of-contents__count"
} , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Headings' ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( "span" , {
className : "table-of-contents__number"
} , headingCount ) ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( "li" , {
className : "table-of-contents__count"
} , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Paragraphs' ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( "span" , {
className : "table-of-contents__number"
} , paragraphCount ) ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( "li" , {
className : "table-of-contents__count"
} , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Blocks' ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( "span" , {
className : "table-of-contents__number"
} , numberOfBlocks ) ) ) ) , headingCount > 0 && ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _element _namespaceObject . Fragment , null , ( 0 , external _wp _element _namespaceObject . createElement ) ( "hr" , null ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( "h2" , {
className : "table-of-contents__title"
} , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Document Outline' ) ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( document _outline , {
onSelect : onRequestClose ,
hasOutlineItemsDisabled : hasOutlineItemsDisabled
} ) ) )
/* eslint-enable jsx-a11y/no-redundant-roles */
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
) ;
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
/* harmony default export */ var panel = ( TableOfContentsPanel ) ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/table-of-contents/index.js
2021-05-21 12:14:23 +02:00
2021-05-20 14:20:04 +02:00
2018-12-14 05:41:57 +01:00
2021-05-20 14:20:04 +02:00
/ * *
2021-05-21 12:14:23 +02:00
* WordPress dependencies
2021-05-20 14:20:04 +02:00
* /
2018-12-14 05:41:57 +01:00
2018-12-14 05:53:54 +01:00
2021-05-20 14:20:04 +02:00
2021-05-21 12:14:23 +02:00
2018-12-14 05:41:57 +01:00
2021-05-20 14:20:04 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Internal dependencies
2021-05-20 14:20:04 +02:00
* /
2021-01-28 03:04:13 +01:00
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
function TableOfContents ( _ref , ref ) {
let {
hasOutlineItemsDisabled ,
repositionDropdown ,
... props
} = _ref ;
const hasBlocks = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => ! ! select ( external _wp _blockEditor _namespaceObject . store ) . getBlockCount ( ) , [ ] ) ;
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Dropdown , {
position : repositionDropdown ? 'middle right right' : 'bottom' ,
className : "table-of-contents" ,
contentClassName : "table-of-contents__popover" ,
renderToggle : _ref2 => {
let {
isOpen ,
onToggle
} = _ref2 ;
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Button , _extends ( { } , props , {
ref : ref ,
onClick : hasBlocks ? onToggle : undefined ,
icon : library _info ,
"aria-expanded" : isOpen ,
"aria-haspopup" : "true"
/* translators: button label text should, if possible, be under 16 characters. */
,
label : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Details' ) ,
tooltipPosition : "bottom" ,
"aria-disabled" : ! hasBlocks
} ) ) ;
} ,
renderContent : _ref3 => {
let {
onClose
} = _ref3 ;
return ( 0 , external _wp _element _namespaceObject . createElement ) ( panel , {
onRequestClose : onClose ,
hasOutlineItemsDisabled : hasOutlineItemsDisabled
} ) ;
2021-05-21 12:14:23 +02:00
}
2022-04-11 14:04:30 +02:00
} ) ;
}
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
/* harmony default export */ var table _of _contents = ( ( 0 , external _wp _element _namespaceObject . forwardRef ) ( TableOfContents ) ) ;
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/unsaved-changes-warning/index.js
/ * *
* WordPress dependencies
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
/ * *
* Warns the user if there are unsaved changes before leaving the editor .
* Compatible with Post Editor and Site Editor .
*
* @ return { WPComponent } The component .
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
function UnsavedChangesWarning ( ) {
const isDirty = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => {
return ( ) => {
const {
_ _experimentalGetDirtyEntityRecords
} = select ( external _wp _coreData _namespaceObject . store ) ;
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
const dirtyEntityRecords = _ _experimentalGetDirtyEntityRecords ( ) ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
return dirtyEntityRecords . length > 0 ;
} ;
} , [ ] ) ;
/ * *
* Warns the user if there are unsaved changes before leaving the editor .
*
* @ param { Event } event ` beforeunload ` event .
*
* @ return { ? string } Warning prompt message , if unsaved changes exist .
* /
Block Editor: Update `@wordpress` dependencies to match Gutenberg 4.5.1.
- Update the annotations, api-fetch, block-library, blocks, components, compose, core-data, data, date, dom, edit-post, editor, element, format-library, html-entities, i18n, jest-console, jest-preset-default, keycodes, list-reusable-blocks, notices, nux, plugins, rich-text, scripts, token-lists, url, viewport packages.
- Upgrades React from 16.5.2 to 16.6.3.
- Adds a missing `wp-date` dependency to the editor script.
- Updates changed dependencies in `script-loader.php`.
- Fixes undefined notices in some blocks.
- Removes incorrect `gutenberg` textdomain.
Merges [43891], [43903], and [43919] to trunk.
Props atimmer, aduth, youknowriad, danielbachhuber.
See #45145.
Built from https://develop.svn.wordpress.org/trunk@44262
git-svn-id: http://core.svn.wordpress.org/trunk@44092 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-17 16:37:00 +01:00
2022-04-11 14:04:30 +02:00
const warnIfUnsavedChanges = event => {
// We need to call the selector directly in the listener to avoid race
// conditions with `BrowserURL` where `componentDidUpdate` gets the
// new value of `isEditedPostDirty` before this component does,
// causing this component to incorrectly think a trashed post is still dirty.
if ( isDirty ( ) ) {
event . returnValue = ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'You have unsaved changes. If you proceed, they will be lost.' ) ;
return event . returnValue ;
}
} ;
( 0 , external _wp _element _namespaceObject . useEffect ) ( ( ) => {
window . addEventListener ( 'beforeunload' , warnIfUnsavedChanges ) ;
return ( ) => {
window . removeEventListener ( 'beforeunload' , warnIfUnsavedChanges ) ;
} ;
} , [ ] ) ;
return null ;
2021-05-21 12:14:23 +02:00
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: external ["wp","reusableBlocks"]
var external _wp _reusableBlocks _namespaceObject = window [ "wp" ] [ "reusableBlocks" ] ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/provider/with-registry-provider.js
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
/ * *
* WordPress dependencies
* /
Block Editor: Update `@wordpress` dependencies to match Gutenberg 4.5.1.
- Update the annotations, api-fetch, block-library, blocks, components, compose, core-data, data, date, dom, edit-post, editor, element, format-library, html-entities, i18n, jest-console, jest-preset-default, keycodes, list-reusable-blocks, notices, nux, plugins, rich-text, scripts, token-lists, url, viewport packages.
- Upgrades React from 16.5.2 to 16.6.3.
- Adds a missing `wp-date` dependency to the editor script.
- Updates changed dependencies in `script-loader.php`.
- Fixes undefined notices in some blocks.
- Removes incorrect `gutenberg` textdomain.
Merges [43891], [43903], and [43919] to trunk.
Props atimmer, aduth, youknowriad, danielbachhuber.
See #45145.
Built from https://develop.svn.wordpress.org/trunk@44262
git-svn-id: http://core.svn.wordpress.org/trunk@44092 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-17 16:37:00 +01:00
2020-06-26 15:33:47 +02:00
2018-12-14 05:41:57 +01:00
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
/ * *
* Internal dependencies
* /
2019-09-19 17:19:18 +02:00
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
const withRegistryProvider = ( 0 , external _wp _compose _namespaceObject . createHigherOrderComponent ) ( WrappedComponent => ( 0 , external _wp _data _namespaceObject . withRegistry ) ( props => {
const {
useSubRegistry = true ,
registry ,
... additionalProps
} = props ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
if ( ! useSubRegistry ) {
return ( 0 , external _wp _element _namespaceObject . createElement ) ( WrappedComponent , additionalProps ) ;
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
const [ subRegistry , setSubRegistry ] = ( 0 , external _wp _element _namespaceObject . useState ) ( null ) ;
( 0 , external _wp _element _namespaceObject . useEffect ) ( ( ) => {
const newRegistry = ( 0 , external _wp _data _namespaceObject . createRegistry ) ( {
'core/block-editor' : external _wp _blockEditor _namespaceObject . storeConfig
} , registry ) ;
newRegistry . registerStore ( 'core/editor' , storeConfig ) ;
setSubRegistry ( newRegistry ) ;
} , [ registry ] ) ;
2020-10-13 15:10:30 +02:00
2022-04-11 14:04:30 +02:00
if ( ! subRegistry ) {
return null ;
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _data _namespaceObject . RegistryProvider , {
value : subRegistry
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( WrappedComponent , additionalProps ) ) ;
} ) , 'withRegistryProvider' ) ;
/* harmony default export */ var with _registry _provider = ( withRegistryProvider ) ;
2020-10-13 15:10:30 +02:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: external ["wp","mediaUtils"]
var external _wp _mediaUtils _namespaceObject = window [ "wp" ] [ "mediaUtils" ] ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/media-upload/index.js
/ * *
* External dependencies
* /
2020-10-13 15:10:30 +02:00
2022-04-11 14:04:30 +02:00
/ * *
* WordPress dependencies
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
/ * *
* Internal dependencies
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
/ * *
* Upload a media file when the file upload button is activated .
* Wrapper around mediaUpload ( ) that injects the current post ID .
*
* @ param { Object } $0 Parameters object passed to the function .
* @ param { ? Object } $0 . additionalData Additional data to include in the request .
* @ param { string } $0 . allowedTypes Array with the types of media that can be uploaded , if unset all types are allowed .
* @ param { Array } $0 . filesList List of files .
* @ param { ? number } $0 . maxUploadFileSize Maximum upload size in bytes allowed for the site .
* @ param { Function } $0 . onError Function called when an error happens .
* @ param { Function } $0 . onFileChange Function called each time a file or a temporary representation of the file is available .
* /
2018-12-17 05:52:00 +01:00
2022-04-11 14:04:30 +02:00
function mediaUpload ( _ref ) {
let {
additionalData = { } ,
allowedTypes ,
filesList ,
maxUploadFileSize ,
onError = external _lodash _namespaceObject . noop ,
onFileChange
} = _ref ;
const {
getCurrentPostId ,
getEditorSettings
2022-04-12 17:12:47 +02:00
} = ( 0 , external _wp _data _namespaceObject . select ) ( store _store ) ;
2022-04-11 14:04:30 +02:00
const wpAllowedMimeTypes = getEditorSettings ( ) . allowedMimeTypes ;
maxUploadFileSize = maxUploadFileSize || getEditorSettings ( ) . maxUploadFileSize ;
( 0 , external _wp _mediaUtils _namespaceObject . uploadMedia ) ( {
allowedTypes ,
filesList ,
onFileChange ,
additionalData : {
post : getCurrentPostId ( ) ,
... additionalData
} ,
maxUploadFileSize ,
onError : _ref2 => {
let {
message
} = _ref2 ;
return onError ( message ) ;
} ,
wpAllowedMimeTypes
} ) ;
}
2021-05-21 12:14:23 +02:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/provider/use-block-editor-settings.js
/ * *
* External dependencies
* /
2021-05-19 17:09:27 +02:00
2019-09-19 17:19:18 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* WordPress dependencies
2019-09-19 17:19:18 +02:00
* /
2018-12-14 05:41:57 +01:00
2020-10-13 15:10:30 +02:00
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
/ * *
* Internal dependencies
* /
2020-06-26 15:33:47 +02:00
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
/ * *
* React hook used to compute the block editor settings to use for the post editor .
*
* @ param { Object } settings EditorProvider settings prop .
* @ param { boolean } hasTemplate Whether template mode is enabled .
*
* @ return { Object } Block Editor Settings .
* /
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
function useBlockEditorSettings ( settings , hasTemplate ) {
2022-05-17 15:30:31 +02:00
var _settings$ _ _experimen , _settings$ _ _experimen2 ;
2022-04-11 14:04:30 +02:00
const {
reusableBlocks ,
hasUploadPermissions ,
canUseUnfilteredHTML ,
2022-04-12 17:12:47 +02:00
userCanCreatePages ,
pageOnFront
2022-04-11 14:04:30 +02:00
} = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => {
const {
canUserUseUnfilteredHTML
2022-04-12 17:12:47 +02:00
} = select ( store _store ) ;
2022-04-11 14:04:30 +02:00
const isWeb = external _wp _element _namespaceObject . Platform . OS === 'web' ;
const {
canUser ,
2022-04-12 17:12:47 +02:00
getEntityRecord
2022-04-11 14:04:30 +02:00
} = select ( external _wp _coreData _namespaceObject . store ) ;
2022-04-12 17:12:47 +02:00
const siteSettings = getEntityRecord ( 'root' , 'site' ) ;
2022-04-11 14:04:30 +02:00
return {
canUseUnfilteredHTML : canUserUseUnfilteredHTML ( ) ,
reusableBlocks : isWeb ? select ( external _wp _coreData _namespaceObject . store ) . getEntityRecords ( 'postType' , 'wp_block' , {
per _page : - 1
} ) : [ ] ,
// Reusable blocks are fetched in the native version of this hook.
hasUploadPermissions : ( 0 , external _lodash _namespaceObject . defaultTo ) ( canUser ( 'create' , 'media' ) , true ) ,
2022-04-12 17:12:47 +02:00
userCanCreatePages : canUser ( 'create' , 'pages' ) ,
pageOnFront : siteSettings === null || siteSettings === void 0 ? void 0 : siteSettings . page _on _front
2022-04-11 14:04:30 +02:00
} ;
} , [ ] ) ;
2022-05-17 15:30:31 +02:00
const settingsBlockPatterns = ( _settings$ _ _experimen = settings . _ _experimentalAdditionalBlockPatterns ) !== null && _settings$ _ _experimen !== void 0 ? _settings$ _ _experimen : // WP 6.0
settings . _ _experimentalBlockPatterns ; // WP 5.9
const settingsBlockPatternCategories = ( _settings$ _ _experimen2 = settings . _ _experimentalAdditionalBlockPatternCategories ) !== null && _settings$ _ _experimen2 !== void 0 ? _settings$ _ _experimen2 : // WP 6.0
settings . _ _experimentalBlockPatternCategories ; // WP 5.9
2022-04-12 17:12:47 +02:00
const {
2022-05-17 15:30:31 +02:00
restBlockPatterns ,
restBlockPatternCategories
2022-04-12 17:12:47 +02:00
} = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => ( {
2022-05-17 15:30:31 +02:00
restBlockPatterns : select ( external _wp _coreData _namespaceObject . store ) . getBlockPatterns ( ) ,
restBlockPatternCategories : select ( external _wp _coreData _namespaceObject . store ) . getBlockPatternCategories ( )
} ) , [ ] ) ;
const blockPatterns = ( 0 , external _wp _element _namespaceObject . useMemo ) ( ( ) => ( 0 , external _lodash _namespaceObject . unionBy ) ( settingsBlockPatterns , restBlockPatterns , 'name' ) , [ settingsBlockPatterns , restBlockPatterns ] ) ;
const blockPatternCategories = ( 0 , external _wp _element _namespaceObject . useMemo ) ( ( ) => ( 0 , external _lodash _namespaceObject . unionBy ) ( settingsBlockPatternCategories , restBlockPatternCategories , 'name' ) , [ settingsBlockPatternCategories , restBlockPatternCategories ] ) ;
2022-04-11 14:04:30 +02:00
const {
undo
2022-04-12 17:12:47 +02:00
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( store _store ) ;
2022-04-11 14:04:30 +02:00
const {
saveEntityRecord
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( external _wp _coreData _namespaceObject . store ) ;
/ * *
* Creates a Post entity .
* This is utilised by the Link UI to allow for on - the - fly creation of Posts / Pages .
*
* @ param { Object } options parameters for the post being created . These mirror those used on 3 rd param of saveEntityRecord .
* @ return { Object } the post type object that was created .
* /
2020-06-26 15:33:47 +02:00
2022-04-11 14:04:30 +02:00
const createPageEntity = options => {
if ( ! userCanCreatePages ) {
return Promise . reject ( {
message : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'You do not have permission to create Pages.' )
} ) ;
}
2020-06-26 15:33:47 +02:00
2022-04-11 14:04:30 +02:00
return saveEntityRecord ( 'postType' , 'page' , options ) ;
} ;
2021-05-19 17:09:27 +02:00
2022-04-12 17:12:47 +02:00
return ( 0 , external _wp _element _namespaceObject . useMemo ) ( ( ) => ( { ... ( 0 , external _lodash _namespaceObject . pick ) ( settings , [ '__experimentalBlockDirectory' , '__experimentalDiscussionSettings' , '__experimentalFeatures' , '__experimentalPreferredStyleVariations' , '__experimentalSetIsInserterOpened' , '__unstableGalleryWithImageBlocks' , 'alignWide' , 'allowedBlockTypes' , 'bodyPlaceholder' , 'canLockBlocks' , 'codeEditingEnabled' , 'colors' , 'disableCustomColors' , 'disableCustomFontSizes' , 'disableCustomGradients' , 'enableCustomLineHeight' , 'enableCustomSpacing' , 'enableCustomUnits' , 'focusMode' , 'fontSizes' , 'gradients' , 'generateAnchors' , 'hasFixedToolbar' , 'hasReducedUI' , 'imageDefaultSize' , 'imageDimensions' , 'imageEditing' , 'imageSizes' , 'isRTL' , 'keepCaretInsideBlock' , 'maxWidth' , 'onUpdateDefaultBlockStyles' , 'styles' , 'template' , 'templateLock' , 'titlePlaceholder' , 'supportsLayout' , 'widgetTypesToHideFromLegacyWidgetBlock' , '__unstableResolvedAssets' ] ) ,
2022-04-11 14:04:30 +02:00
mediaUpload : hasUploadPermissions ? mediaUpload : undefined ,
_ _experimentalReusableBlocks : reusableBlocks ,
2022-04-12 17:12:47 +02:00
_ _experimentalBlockPatterns : blockPatterns ,
_ _experimentalBlockPatternCategories : blockPatternCategories ,
2022-04-11 14:04:30 +02:00
_ _experimentalFetchLinkSuggestions : ( search , searchOptions ) => ( 0 , external _wp _coreData _namespaceObject . _ _experimentalFetchLinkSuggestions ) ( search , searchOptions , settings ) ,
_ _experimentalFetchRichUrlData : external _wp _coreData _namespaceObject . _ _experimentalFetchUrlData ,
_ _experimentalCanUserUseUnfilteredHTML : canUseUnfilteredHTML ,
_ _experimentalUndo : undo ,
outlineMode : hasTemplate ,
_ _experimentalCreatePageEntity : createPageEntity ,
2022-04-12 17:12:47 +02:00
_ _experimentalUserCanCreatePages : userCanCreatePages ,
pageOnFront ,
_ _experimentalPreferPatternsOnRoot : hasTemplate
} ) , [ settings , hasUploadPermissions , reusableBlocks , blockPatterns , blockPatternCategories , canUseUnfilteredHTML , undo , hasTemplate , userCanCreatePages , pageOnFront ] ) ;
2022-04-11 14:04:30 +02:00
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
/* harmony default export */ var use _block _editor _settings = ( useBlockEditorSettings ) ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/provider/index.js
2018-12-14 05:41:57 +01:00
2019-09-19 17:19:18 +02:00
/ * *
* WordPress dependencies
* /
2018-12-17 05:52:00 +01:00
2020-10-13 15:10:30 +02:00
2021-11-08 15:29:21 +01:00
2018-12-14 05:41:57 +01:00
2018-12-18 04:14:52 +01:00
2018-12-14 05:41:57 +01:00
2021-05-20 14:20:04 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Internal dependencies
2021-05-20 14:20:04 +02:00
* /
2018-12-14 05:41:57 +01:00
2019-09-19 17:19:18 +02:00
2021-05-20 14:20:04 +02:00
2019-09-19 17:19:18 +02:00
2022-04-11 14:04:30 +02:00
function EditorProvider ( _ref ) {
let {
_ _unstableTemplate ,
post ,
settings ,
recovery ,
initialEdits ,
children
} = _ref ;
const defaultBlockContext = ( 0 , external _wp _element _namespaceObject . useMemo ) ( ( ) => {
if ( post . type === 'wp_template' ) {
return { } ;
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
return {
postId : post . id ,
postType : post . type
} ;
} , [ post . id , post . type ] ) ;
const {
selection ,
isReady
} = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => {
const {
getEditorSelection ,
_ _unstableIsEditorReady
2022-04-12 17:12:47 +02:00
} = select ( store _store ) ;
2022-04-11 14:04:30 +02:00
return {
isReady : _ _unstableIsEditorReady ( ) ,
selection : getEditorSelection ( )
} ;
} , [ ] ) ;
const {
id ,
type
} = _ _unstableTemplate !== null && _ _unstableTemplate !== void 0 ? _ _unstableTemplate : post ;
const [ blocks , onInput , onChange ] = ( 0 , external _wp _coreData _namespaceObject . useEntityBlockEditor ) ( 'postType' , type , {
id
} ) ;
const editorSettings = use _block _editor _settings ( settings , ! ! _ _unstableTemplate ) ;
const {
updatePostLock ,
setupEditor ,
updateEditorSettings ,
_ _experimentalTearDownEditor
2022-04-12 17:12:47 +02:00
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( store _store ) ;
2022-04-11 14:04:30 +02:00
const {
createWarningNotice
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( external _wp _notices _namespaceObject . store ) ; // Initialize and tear down the editor.
// Ideally this should be synced on each change and not just something you do once.
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
( 0 , external _wp _element _namespaceObject . useLayoutEffect ) ( ( ) => {
// Assume that we don't need to initialize in the case of an error recovery.
if ( recovery ) {
return ;
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
updatePostLock ( settings . postLock ) ;
setupEditor ( post , initialEdits , settings . template ) ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
if ( settings . autosave ) {
createWarningNotice ( ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'There is an autosave of this post that is more recent than the version below.' ) , {
id : 'autosave-exists' ,
actions : [ {
label : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'View the autosave' ) ,
url : settings . autosave . editLink
} ]
} ) ;
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
return ( ) => {
_ _experimentalTearDownEditor ( ) ;
} ;
2022-04-12 17:12:47 +02:00
} , [ ] ) ; // Synchronize the editor settings as they change.
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
( 0 , external _wp _element _namespaceObject . useEffect ) ( ( ) => {
updateEditorSettings ( settings ) ;
} , [ settings ] ) ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
if ( ! isReady ) {
return null ;
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _coreData _namespaceObject . EntityProvider , {
kind : "root" ,
type : "site"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _coreData _namespaceObject . EntityProvider , {
kind : "postType" ,
type : post . type ,
id : post . id
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _blockEditor _namespaceObject . BlockContextProvider , {
value : defaultBlockContext
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _blockEditor _namespaceObject . BlockEditorProvider , {
value : blocks ,
onChange : onChange ,
onInput : onInput ,
selection : selection ,
settings : editorSettings ,
useSubRegistry : false
} , children , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _reusableBlocks _namespaceObject . ReusableBlocksMenuItems , null ) ) ) ) ) ;
}
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
/* harmony default export */ var provider = ( with _registry _provider ( EditorProvider ) ) ;
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: external ["wp","serverSideRender"]
var external _wp _serverSideRender _namespaceObject = window [ "wp" ] [ "serverSideRender" ] ;
var external _wp _serverSideRender _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( external _wp _serverSideRender _namespaceObject ) ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/deprecated.js
2018-12-14 05:41:57 +01:00
2022-04-12 17:12:47 +02:00
// Block Creation Components.
2021-05-21 12:14:23 +02:00
2021-01-28 03:04:13 +01:00
/ * *
2022-04-11 14:04:30 +02:00
* WordPress dependencies
2021-01-28 03:04:13 +01:00
* /
2022-04-11 14:04:30 +02:00
function deprecateComponent ( name , Wrapped ) {
let staticsToHoist = arguments . length > 2 && arguments [ 2 ] !== undefined ? arguments [ 2 ] : [ ] ;
const Component = ( 0 , external _wp _element _namespaceObject . forwardRef ) ( ( props , ref ) => {
external _wp _deprecated _default ( ) ( 'wp.editor.' + name , {
since : '5.3' ,
2022-04-12 17:12:47 +02:00
alternative : 'wp.blockEditor.' + name ,
version : '6.2'
2022-04-11 14:04:30 +02:00
} ) ;
return ( 0 , external _wp _element _namespaceObject . createElement ) ( Wrapped , _extends ( {
ref : ref
} , props ) ) ;
} ) ;
staticsToHoist . forEach ( staticName => {
Component [ staticName ] = deprecateComponent ( name + '.' + staticName , Wrapped [ staticName ] ) ;
} ) ;
return Component ;
}
function deprecateFunction ( name , func ) {
return function ( ) {
external _wp _deprecated _default ( ) ( 'wp.editor.' + name , {
since : '5.3' ,
2022-04-12 17:12:47 +02:00
alternative : 'wp.blockEditor.' + name ,
version : '6.2'
2022-04-11 14:04:30 +02:00
} ) ;
return func ( ... arguments ) ;
} ;
2021-05-21 12:14:23 +02:00
}
2021-01-28 03:04:13 +01:00
2022-04-11 14:04:30 +02:00
const RichText = deprecateComponent ( 'RichText' , external _wp _blockEditor _namespaceObject . RichText , [ 'Content' ] ) ;
RichText . isEmpty = deprecateFunction ( 'RichText.isEmpty' , external _wp _blockEditor _namespaceObject . RichText . isEmpty ) ;
const Autocomplete = deprecateComponent ( 'Autocomplete' , external _wp _blockEditor _namespaceObject . Autocomplete ) ;
const AlignmentToolbar = deprecateComponent ( 'AlignmentToolbar' , external _wp _blockEditor _namespaceObject . AlignmentToolbar ) ;
const BlockAlignmentToolbar = deprecateComponent ( 'BlockAlignmentToolbar' , external _wp _blockEditor _namespaceObject . BlockAlignmentToolbar ) ;
const BlockControls = deprecateComponent ( 'BlockControls' , external _wp _blockEditor _namespaceObject . BlockControls , [ 'Slot' ] ) ;
const BlockEdit = deprecateComponent ( 'BlockEdit' , external _wp _blockEditor _namespaceObject . BlockEdit ) ;
const BlockEditorKeyboardShortcuts = deprecateComponent ( 'BlockEditorKeyboardShortcuts' , external _wp _blockEditor _namespaceObject . BlockEditorKeyboardShortcuts ) ;
const BlockFormatControls = deprecateComponent ( 'BlockFormatControls' , external _wp _blockEditor _namespaceObject . BlockFormatControls , [ 'Slot' ] ) ;
const BlockIcon = deprecateComponent ( 'BlockIcon' , external _wp _blockEditor _namespaceObject . BlockIcon ) ;
const BlockInspector = deprecateComponent ( 'BlockInspector' , external _wp _blockEditor _namespaceObject . BlockInspector ) ;
const BlockList = deprecateComponent ( 'BlockList' , external _wp _blockEditor _namespaceObject . BlockList ) ;
const BlockMover = deprecateComponent ( 'BlockMover' , external _wp _blockEditor _namespaceObject . BlockMover ) ;
const BlockNavigationDropdown = deprecateComponent ( 'BlockNavigationDropdown' , external _wp _blockEditor _namespaceObject . BlockNavigationDropdown ) ;
const BlockSelectionClearer = deprecateComponent ( 'BlockSelectionClearer' , external _wp _blockEditor _namespaceObject . BlockSelectionClearer ) ;
const BlockSettingsMenu = deprecateComponent ( 'BlockSettingsMenu' , external _wp _blockEditor _namespaceObject . BlockSettingsMenu ) ;
const BlockTitle = deprecateComponent ( 'BlockTitle' , external _wp _blockEditor _namespaceObject . BlockTitle ) ;
const BlockToolbar = deprecateComponent ( 'BlockToolbar' , external _wp _blockEditor _namespaceObject . BlockToolbar ) ;
const ColorPalette = deprecateComponent ( 'ColorPalette' , external _wp _blockEditor _namespaceObject . ColorPalette ) ;
const ContrastChecker = deprecateComponent ( 'ContrastChecker' , external _wp _blockEditor _namespaceObject . ContrastChecker ) ;
const CopyHandler = deprecateComponent ( 'CopyHandler' , external _wp _blockEditor _namespaceObject . CopyHandler ) ;
const DefaultBlockAppender = deprecateComponent ( 'DefaultBlockAppender' , external _wp _blockEditor _namespaceObject . DefaultBlockAppender ) ;
const FontSizePicker = deprecateComponent ( 'FontSizePicker' , external _wp _blockEditor _namespaceObject . FontSizePicker ) ;
const Inserter = deprecateComponent ( 'Inserter' , external _wp _blockEditor _namespaceObject . Inserter ) ;
const InnerBlocks = deprecateComponent ( 'InnerBlocks' , external _wp _blockEditor _namespaceObject . InnerBlocks , [ 'ButtonBlockAppender' , 'DefaultBlockAppender' , 'Content' ] ) ;
const InspectorAdvancedControls = deprecateComponent ( 'InspectorAdvancedControls' , external _wp _blockEditor _namespaceObject . InspectorAdvancedControls , [ 'Slot' ] ) ;
const InspectorControls = deprecateComponent ( 'InspectorControls' , external _wp _blockEditor _namespaceObject . InspectorControls , [ 'Slot' ] ) ;
const PanelColorSettings = deprecateComponent ( 'PanelColorSettings' , external _wp _blockEditor _namespaceObject . PanelColorSettings ) ;
const PlainText = deprecateComponent ( 'PlainText' , external _wp _blockEditor _namespaceObject . PlainText ) ;
const RichTextShortcut = deprecateComponent ( 'RichTextShortcut' , external _wp _blockEditor _namespaceObject . RichTextShortcut ) ;
const RichTextToolbarButton = deprecateComponent ( 'RichTextToolbarButton' , external _wp _blockEditor _namespaceObject . RichTextToolbarButton ) ;
const _ _unstableRichTextInputEvent = deprecateComponent ( '__unstableRichTextInputEvent' , external _wp _blockEditor _namespaceObject . _ _unstableRichTextInputEvent ) ;
const MediaPlaceholder = deprecateComponent ( 'MediaPlaceholder' , external _wp _blockEditor _namespaceObject . MediaPlaceholder ) ;
const MediaUpload = deprecateComponent ( 'MediaUpload' , external _wp _blockEditor _namespaceObject . MediaUpload ) ;
const MediaUploadCheck = deprecateComponent ( 'MediaUploadCheck' , external _wp _blockEditor _namespaceObject . MediaUploadCheck ) ;
const MultiSelectScrollIntoView = deprecateComponent ( 'MultiSelectScrollIntoView' , external _wp _blockEditor _namespaceObject . MultiSelectScrollIntoView ) ;
const NavigableToolbar = deprecateComponent ( 'NavigableToolbar' , external _wp _blockEditor _namespaceObject . NavigableToolbar ) ;
const ObserveTyping = deprecateComponent ( 'ObserveTyping' , external _wp _blockEditor _namespaceObject . ObserveTyping ) ;
const SkipToSelectedBlock = deprecateComponent ( 'SkipToSelectedBlock' , external _wp _blockEditor _namespaceObject . SkipToSelectedBlock ) ;
const URLInput = deprecateComponent ( 'URLInput' , external _wp _blockEditor _namespaceObject . URLInput ) ;
const URLInputButton = deprecateComponent ( 'URLInputButton' , external _wp _blockEditor _namespaceObject . URLInputButton ) ;
const URLPopover = deprecateComponent ( 'URLPopover' , external _wp _blockEditor _namespaceObject . URLPopover ) ;
const Warning = deprecateComponent ( 'Warning' , external _wp _blockEditor _namespaceObject . Warning ) ;
const WritingFlow = deprecateComponent ( 'WritingFlow' , external _wp _blockEditor _namespaceObject . WritingFlow ) ;
const createCustomColorsHOC = deprecateFunction ( 'createCustomColorsHOC' , external _wp _blockEditor _namespaceObject . createCustomColorsHOC ) ;
const getColorClassName = deprecateFunction ( 'getColorClassName' , external _wp _blockEditor _namespaceObject . getColorClassName ) ;
const getColorObjectByAttributeValues = deprecateFunction ( 'getColorObjectByAttributeValues' , external _wp _blockEditor _namespaceObject . getColorObjectByAttributeValues ) ;
const getColorObjectByColorValue = deprecateFunction ( 'getColorObjectByColorValue' , external _wp _blockEditor _namespaceObject . getColorObjectByColorValue ) ;
const getFontSize = deprecateFunction ( 'getFontSize' , external _wp _blockEditor _namespaceObject . getFontSize ) ;
const getFontSizeClass = deprecateFunction ( 'getFontSizeClass' , external _wp _blockEditor _namespaceObject . getFontSizeClass ) ;
const withColorContext = deprecateFunction ( 'withColorContext' , external _wp _blockEditor _namespaceObject . withColorContext ) ;
const withColors = deprecateFunction ( 'withColors' , external _wp _blockEditor _namespaceObject . withColors ) ;
const withFontSizes = deprecateFunction ( 'withFontSizes' , external _wp _blockEditor _namespaceObject . withFontSizes ) ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/index.js
2022-04-12 17:12:47 +02:00
// Block Creation Components.
// Post Related Components.
2021-01-28 03:04:13 +01:00
2019-09-19 17:19:18 +02:00
2021-01-28 03:04:13 +01:00
2018-12-14 05:41:57 +01:00
2019-09-19 17:19:18 +02:00
2018-12-14 05:41:57 +01:00
2019-03-07 10:09:59 +01:00
2019-09-19 17:19:18 +02:00
2021-01-28 03:04:13 +01:00
2019-09-19 17:19:18 +02:00
2021-05-20 14:20:04 +02:00
2019-03-07 10:09:59 +01:00
2021-11-08 15:29:21 +01:00
2019-03-07 10:09:59 +01:00
2022-04-12 17:12:47 +02:00
// State Related Components.
2019-03-07 10:09:59 +01:00
2022-04-12 17:12:47 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/url.js
/ * *
* WordPress dependencies
* /
2022-04-11 14:04:30 +02:00
2019-03-07 10:09:59 +01:00
2022-04-12 17:12:47 +02:00
/ * *
* Performs some basic cleanup of a string for use as a post slug
*
* This replicates some of what sanitize _title ( ) does in WordPress core , but
* is only designed to approximate what the slug will be .
*
* Converts Latin - 1 Supplement and Latin Extended - A letters to basic Latin letters .
* Removes combining diacritical marks . Converts whitespace , periods ,
* and forward slashes to hyphens . Removes any remaining non - word characters
* except hyphens and underscores . Converts remaining string to lowercase .
* It does not account for octets , HTML entities , or other encoded characters .
*
* @ param { string } string Title or slug to be processed
*
* @ return { string } Processed string
* /
2019-03-07 10:09:59 +01:00
2022-04-12 17:12:47 +02:00
function cleanForSlug ( string ) {
external _wp _deprecated _default ( ) ( 'wp.editor.cleanForSlug' , {
since : '12.7' ,
plugin : 'Gutenberg' ,
alternative : 'wp.url.cleanForSlug'
} ) ;
return ( 0 , external _wp _url _namespaceObject . cleanForSlug ) ( string ) ;
}
2019-03-07 10:09:59 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/index.js
2021-05-20 14:20:04 +02:00
/ * *
2022-04-11 14:04:30 +02:00
* Internal dependencies
2021-05-20 14:20:04 +02:00
* /
2019-03-07 10:09:59 +01:00
2018-12-14 05:41:57 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/index.js
/ * *
* Internal dependencies
* /
2018-12-14 05:41:57 +01:00
2019-03-07 10:09:59 +01:00
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
/ *
* Backward compatibility
* /
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
} ( ) ;
( window . wp = window . wp || { } ) . editor = _ _webpack _exports _ _ ;
/******/ } ) ( )
;