2024-01-31 07:59:56 -05:00
/******/ ( ( ) => { // webpackBootstrap
2022-04-11 08:04:30 -04:00
/******/ "use strict" ;
/******/ // The require scope
/******/ var _ _webpack _require _ _ = { } ;
/******/
/************************************************************************/
/******/ /* webpack/runtime/make namespace object */
2024-01-31 07:59:56 -05:00
/******/ ( ( ) => {
2022-04-11 08:04:30 -04:00
/******/ // define __esModule on exports
2024-01-31 07:59:56 -05:00
/******/ _ _webpack _require _ _ . r = ( exports ) => {
2022-04-11 08:04:30 -04:00
/******/ if ( typeof Symbol !== 'undefined' && Symbol . toStringTag ) {
/******/ Object . defineProperty ( exports , Symbol . toStringTag , { value : 'Module' } ) ;
/******/ }
/******/ Object . defineProperty ( exports , '__esModule' , { value : true } ) ;
2018-12-14 06:02:53 -05:00
/******/ } ;
2024-01-31 07:59:56 -05:00
/******/ } ) ( ) ;
2022-04-11 08:04:30 -04:00
/******/
2018-12-14 06:02:53 -05:00
/************************************************************************/
2022-04-11 08:04:30 -04:00
var _ _webpack _exports _ _ = { } ;
2020-06-29 07:50:29 -04:00
// ESM COMPAT FLAG
2018-12-14 06:02:53 -05:00
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
2018-12-17 22:14:52 -05:00
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: external ["wp","richText"]
2024-01-31 07:59:56 -05:00
const external _wp _richText _namespaceObject = window [ "wp" ] [ "richText" ] ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: external ["wp","i18n"]
2024-01-31 07:59:56 -05:00
const external _wp _i18n _namespaceObject = window [ "wp" ] [ "i18n" ] ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: external ["wp","blockEditor"]
2024-01-31 07:59:56 -05:00
const external _wp _blockEditor _namespaceObject = window [ "wp" ] [ "blockEditor" ] ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: external ["wp","primitives"]
2024-01-31 07:59:56 -05:00
const external _wp _primitives _namespaceObject = window [ "wp" ] [ "primitives" ] ;
2024-05-31 14:59:00 -04:00
; // CONCATENATED MODULE: external "ReactJSXRuntime"
const external _ReactJSXRuntime _namespaceObject = window [ "ReactJSXRuntime" ] ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-bold.js
2021-05-21 06:14:23 -04:00
/ * *
* WordPress dependencies
* /
2024-05-31 14:59:00 -04:00
const formatBold = /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . SVG , {
2021-05-21 06:14:23 -04:00
xmlns : "http://www.w3.org/2000/svg" ,
2024-05-31 14:59:00 -04:00
viewBox : "0 0 24 24" ,
children : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . Path , {
d : "M14.7 11.3c1-.6 1.5-1.6 1.5-3 0-2.3-1.3-3.4-4-3.4H7v14h5.8c1.4 0 2.5-.3 3.3-1 .8-.7 1.2-1.7 1.2-2.9.1-1.9-.8-3.1-2.6-3.7zm-5.1-4h2.3c.6 0 1.1.1 1.4.4.3.3.5.7.5 1.2s-.2 1-.5 1.2c-.3.3-.8.4-1.4.4H9.6V7.3zm4.6 9c-.4.3-1 .4-1.7.4H9.6v-3.9h2.9c.7 0 1.3.2 1.7.5.4.3.6.8.6 1.5s-.2 1.2-.6 1.5z"
} )
} ) ;
2024-01-31 07:59:56 -05:00
/* harmony default export */ const format _bold = ( formatBold ) ;
2020-02-10 17:33:27 -05:00
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/bold/index.js
2018-12-14 06:02:53 -05:00
/ * *
* WordPress dependencies
* /
2020-02-10 17:33:27 -05:00
2024-05-31 14:59:00 -04:00
2021-05-19 11:09:27 -04:00
const bold _name = 'core/bold' ;
2022-04-11 08:04:30 -04:00
const title = ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Bold' ) ;
2021-05-19 11:09:27 -04:00
const bold = {
2018-12-17 22:14:52 -05:00
name : bold _name ,
2021-05-19 11:09:27 -04:00
title ,
2018-12-16 23:52:00 -05:00
tagName : 'strong' ,
className : null ,
2023-06-27 10:24:19 -04:00
edit ( {
isActive ,
value ,
onChange ,
onFocus
} ) {
2020-02-06 16:03:31 -05:00
function onToggle ( ) {
2022-04-11 08:04:30 -04:00
onChange ( ( 0 , external _wp _richText _namespaceObject . toggleFormat ) ( value , {
2021-11-08 09:29:21 -05:00
type : bold _name ,
title
2018-12-14 06:02:53 -05:00
} ) ) ;
2020-02-06 16:03:31 -05:00
}
function onClick ( ) {
2022-04-11 08:04:30 -04:00
onChange ( ( 0 , external _wp _richText _namespaceObject . toggleFormat ) ( value , {
2021-11-08 09:29:21 -05:00
type : bold _name
} ) ) ;
2020-02-06 16:03:31 -05:00
onFocus ( ) ;
}
2024-05-31 14:59:00 -04:00
return /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( external _ReactJSXRuntime _namespaceObject . Fragment , {
children : [ /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _blockEditor _namespaceObject . RichTextShortcut , {
type : "primary" ,
character : "b" ,
onUse : onToggle
} ) , /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _blockEditor _namespaceObject . RichTextToolbarButton , {
name : "bold" ,
icon : format _bold ,
title : title ,
onClick : onClick ,
isActive : isActive ,
shortcutType : "primary" ,
shortcutCharacter : "b"
} ) , /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _blockEditor _namespaceObject . _ _unstableRichTextInputEvent , {
inputType : "formatBold" ,
onInput : onToggle
} ) ]
} ) ;
2018-12-14 06:02:53 -05:00
}
} ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/code.js
/ * *
* WordPress dependencies
* /
2024-05-31 14:59:00 -04:00
const code = /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . SVG , {
2022-04-11 08:04:30 -04:00
viewBox : "0 0 24 24" ,
2024-05-31 14:59:00 -04:00
xmlns : "http://www.w3.org/2000/svg" ,
children : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . Path , {
d : "M20.8 10.7l-4.3-4.3-1.1 1.1 4.3 4.3c.1.1.1.3 0 .4l-4.3 4.3 1.1 1.1 4.3-4.3c.7-.8.7-1.9 0-2.6zM4.2 11.8l4.3-4.3-1-1-4.3 4.3c-.7.7-.7 1.8 0 2.5l4.3 4.3 1.1-1.1-4.3-4.3c-.2-.1-.2-.3-.1-.4z"
} )
} ) ;
2024-01-31 07:59:56 -05:00
/* harmony default export */ const library _code = ( code ) ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/code/index.js
2018-12-14 06:02:53 -05:00
/ * *
* WordPress dependencies
* /
2020-02-10 17:33:27 -05:00
2024-05-31 14:59:00 -04:00
2021-05-19 11:09:27 -04:00
const code _name = 'core/code' ;
2022-04-11 08:04:30 -04:00
const code _title = ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Inline code' ) ;
2021-05-19 11:09:27 -04:00
const code _code = {
2018-12-17 22:14:52 -05:00
name : code _name ,
2019-09-19 11:19:18 -04:00
title : code _title ,
2018-12-16 23:52:00 -05:00
tagName : 'code' ,
className : null ,
2021-05-19 11:09:27 -04:00
_ _unstableInputRule ( value ) {
const BACKTICK = '`' ;
const {
start ,
text
} = value ;
2023-09-26 10:23:26 -04:00
const characterBefore = text [ start - 1 ] ;
2019-09-19 11:19:18 -04:00
2023-09-26 10:23:26 -04:00
// Quick check the text for the necessary character.
2019-09-19 11:19:18 -04:00
if ( characterBefore !== BACKTICK ) {
return value ;
}
2023-06-27 10:24:19 -04:00
if ( start - 2 < 0 ) {
return value ;
}
const indexBefore = text . lastIndexOf ( BACKTICK , start - 2 ) ;
2019-09-19 11:19:18 -04:00
if ( indexBefore === - 1 ) {
return value ;
}
2021-05-19 11:09:27 -04:00
const startIndex = indexBefore ;
const endIndex = start - 2 ;
2019-09-19 11:19:18 -04:00
if ( startIndex === endIndex ) {
return value ;
}
2022-04-11 08:04:30 -04:00
value = ( 0 , external _wp _richText _namespaceObject . remove ) ( value , startIndex , startIndex + 1 ) ;
value = ( 0 , external _wp _richText _namespaceObject . remove ) ( value , endIndex , endIndex + 1 ) ;
value = ( 0 , external _wp _richText _namespaceObject . applyFormat ) ( value , {
2019-09-19 11:19:18 -04:00
type : code _name
} , startIndex , endIndex ) ;
return value ;
} ,
2023-06-27 10:24:19 -04:00
edit ( {
value ,
onChange ,
onFocus ,
isActive
} ) {
2020-02-06 16:03:31 -05:00
function onClick ( ) {
2022-04-11 08:04:30 -04:00
onChange ( ( 0 , external _wp _richText _namespaceObject . toggleFormat ) ( value , {
2021-11-08 09:29:21 -05:00
type : code _name ,
title : code _title
2018-12-14 06:02:53 -05:00
} ) ) ;
2020-02-06 16:03:31 -05:00
onFocus ( ) ;
}
2024-05-31 14:59:00 -04:00
return /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( external _ReactJSXRuntime _namespaceObject . Fragment , {
children : [ /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _blockEditor _namespaceObject . RichTextShortcut , {
type : "access" ,
character : "x" ,
onUse : onClick
} ) , /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _blockEditor _namespaceObject . RichTextToolbarButton , {
icon : library _code ,
title : code _title ,
onClick : onClick ,
isActive : isActive ,
role : "menuitemcheckbox"
} ) ]
} ) ;
2018-12-14 06:02:53 -05:00
}
2021-05-19 11:09:27 -04:00
} ;
2018-12-17 22:14:52 -05:00
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: external ["wp","components"]
2024-01-31 07:59:56 -05:00
const external _wp _components _namespaceObject = window [ "wp" ] [ "components" ] ;
Editor: Update the WordPress packages to the Gutenberg 16.7 RC2 version.
This patch, somewhat small brings a lot to WordPress.
This includes features like:
- DataViews.
- Customization tools like box shadow, background size and repeat.
- UI improvements in the site editor.
- Preferences sharing between the post and site editors.
- Unified panels and editors between post and site editors.
- Improved template mode in the post editor.
- Iterations to multiple interactive blocks.
- Preparing the blocks and UI for pattern overrides.
- and a lot more.
Props luisherranz, gziolo, isabel_brison, costdev, jonsurrell, peterwilsoncc, get_dave, antonvlasenko, desrosj.
See #60315.
Built from https://develop.svn.wordpress.org/trunk@57377
git-svn-id: http://core.svn.wordpress.org/trunk@56883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-29 16:07:12 -05:00
; // CONCATENATED MODULE: external ["wp","element"]
2024-01-31 07:59:56 -05:00
const external _wp _element _namespaceObject = window [ "wp" ] [ "element" ] ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/keyboard-return.js
/ * *
* WordPress dependencies
* /
2024-05-31 14:59:00 -04:00
const keyboardReturn = /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . SVG , {
xmlns : "http://www.w3.org/2000/svg" ,
children : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . Path , {
d : "m6.734 16.106 2.176-2.38-1.093-1.028-3.846 4.158 3.846 4.158 1.093-1.028-2.176-2.38h2.811c1.125 0 2.25.03 3.374 0 1.428-.001 3.362-.25 4.963-1.277 1.66-1.065 2.868-2.906 2.868-5.859 0-2.479-1.327-4.896-3.65-5.93-1.82-.813-3.044-.8-4.806-.788l-.567.002v1.5c.184 0 .368 0 .553-.002 1.82-.007 2.704-.014 4.21.657 1.854.827 2.76 2.657 2.76 4.561 0 2.472-.973 3.824-2.178 4.596-1.258.807-2.864 1.04-4.163 1.04h-.02c-1.115.03-2.229 0-3.344 0H6.734Z"
} )
} ) ;
2024-01-31 07:59:56 -05:00
/* harmony default export */ const keyboard _return = ( keyboardReturn ) ;
2019-09-19 11:19:18 -04:00
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/image/index.js
2018-12-14 06:02:53 -05:00
/ * *
* WordPress dependencies
* /
2019-03-07 04:09:59 -05:00
2024-05-31 14:59:00 -04:00
2021-05-19 11:09:27 -04:00
const ALLOWED _MEDIA _TYPES = [ 'image' ] ;
const image _name = 'core/image' ;
2022-04-11 08:04:30 -04:00
const image _title = ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Inline image' ) ;
2021-05-19 11:09:27 -04:00
const image _image = {
2018-12-17 22:14:52 -05:00
name : image _name ,
2019-09-19 11:19:18 -04:00
title : image _title ,
2022-04-11 08:04:30 -04:00
keywords : [ ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'photo' ) , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'media' ) ] ,
2018-12-14 06:02:53 -05:00
object : true ,
2018-12-16 23:52:00 -05:00
tagName : 'img' ,
className : null ,
2018-12-14 06:02:53 -05:00
attributes : {
className : 'class' ,
style : 'style' ,
url : 'src' ,
alt : 'alt'
} ,
2021-01-27 21:04:13 -05:00
edit : Edit
} ;
2023-06-27 10:24:19 -04:00
function InlineUI ( {
value ,
onChange ,
activeObjectAttributes ,
contentRef
} ) {
2021-05-19 11:09:27 -04:00
const {
style
} = activeObjectAttributes ;
2023-06-27 10:24:19 -04:00
const [ width , setWidth ] = ( 0 , external _wp _element _namespaceObject . useState ) ( style ? . replace ( /\D/g , '' ) ) ;
2022-09-20 11:43:29 -04:00
const popoverAnchor = ( 0 , external _wp _richText _namespaceObject . useAnchor ) ( {
editableContentElement : contentRef . current ,
2021-01-27 21:04:13 -05:00
settings : image _image
} ) ;
2024-05-31 14:59:00 -04:00
return /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _components _namespaceObject . Popover , {
2023-02-07 02:04:52 -05:00
placement : "bottom" ,
2021-01-27 21:04:13 -05:00
focusOnMount : false ,
2022-09-20 11:43:29 -04:00
anchor : popoverAnchor ,
2024-05-31 14:59:00 -04:00
className : "block-editor-format-toolbar__image-popover" ,
children : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( "form" , {
className : "block-editor-format-toolbar__image-container-content" ,
onSubmit : event => {
const newReplacements = value . replacements . slice ( ) ;
newReplacements [ value . start ] = {
type : image _name ,
attributes : {
... activeObjectAttributes ,
style : width ? ` width: ${ width } px; ` : ''
}
} ;
onChange ( {
... value ,
replacements : newReplacements
} ) ;
event . preventDefault ( ) ;
} ,
children : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( external _wp _components _namespaceObject . _ _experimentalHStack , {
alignment : "bottom" ,
spacing : "0" ,
children : [ /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _components _namespaceObject . _ _experimentalNumberControl , {
className : "block-editor-format-toolbar__image-container-value" ,
label : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Width' ) ,
value : width ,
min : 1 ,
onChange : newWidth => setWidth ( newWidth )
} ) , /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _components _namespaceObject . Button , {
className : "block-editor-format-toolbar__image-container-button" ,
icon : keyboard _return ,
label : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Apply' ) ,
type : "submit"
} ) ]
} )
} )
} ) ;
2021-01-27 21:04:13 -05:00
}
2023-06-27 10:24:19 -04:00
function Edit ( {
value ,
onChange ,
onFocus ,
isObjectActive ,
activeObjectAttributes ,
contentRef
} ) {
2024-05-31 14:59:00 -04:00
return /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( external _wp _blockEditor _namespaceObject . MediaUploadCheck , {
children : [ /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _blockEditor _namespaceObject . MediaUpload , {
allowedTypes : ALLOWED _MEDIA _TYPES ,
onSelect : ( {
id ,
url ,
alt ,
width : imgWidth
} ) => {
onChange ( ( 0 , external _wp _richText _namespaceObject . insertObject ) ( value , {
type : image _name ,
attributes : {
className : ` wp-image- ${ id } ` ,
style : ` width: ${ Math . min ( imgWidth , 150 ) } px; ` ,
url ,
alt
}
} ) ) ;
onFocus ( ) ;
} ,
render : ( {
open
} ) => /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _blockEditor _namespaceObject . RichTextToolbarButton , {
icon : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _components _namespaceObject . SVG , {
xmlns : "http://www.w3.org/2000/svg" ,
viewBox : "0 0 24 24" ,
children : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _components _namespaceObject . Path , {
d : "M4 18.5h16V17H4v1.5zM16 13v1.5h4V13h-4zM5.1 15h7.8c.6 0 1.1-.5 1.1-1.1V6.1c0-.6-.5-1.1-1.1-1.1H5.1C4.5 5 4 5.5 4 6.1v7.8c0 .6.5 1.1 1.1 1.1zm.4-8.5h7V10l-1-1c-.3-.3-.8-.3-1 0l-1.6 1.5-1.2-.7c-.3-.2-.6-.2-.9 0l-1.3 1V6.5zm0 6.1l1.8-1.3 1.3.8c.3.2.7.2.9-.1l1.5-1.4 1.5 1.4v1.5h-7v-.9z"
} )
} ) ,
title : image _title ,
onClick : open ,
isActive : isObjectActive
} )
} ) , isObjectActive && /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( InlineUI , {
value : value ,
onChange : onChange ,
activeObjectAttributes : activeObjectAttributes ,
contentRef : contentRef
} ) ]
} ) ;
2021-01-27 21:04:13 -05:00
}
2018-12-14 06:02:53 -05:00
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-italic.js
2021-05-21 06:14:23 -04:00
/ * *
* WordPress dependencies
* /
2024-05-31 14:59:00 -04:00
const formatItalic = /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . SVG , {
2021-05-21 06:14:23 -04:00
xmlns : "http://www.w3.org/2000/svg" ,
2024-05-31 14:59:00 -04:00
viewBox : "0 0 24 24" ,
children : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . Path , {
d : "M12.5 5L10 19h1.9l2.5-14z"
} )
} ) ;
2024-01-31 07:59:56 -05:00
/* harmony default export */ const format _italic = ( formatItalic ) ;
2020-02-10 17:33:27 -05:00
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/italic/index.js
2018-12-14 06:02:53 -05:00
/ * *
* WordPress dependencies
* /
2020-02-10 17:33:27 -05:00
2024-05-31 14:59:00 -04:00
2021-05-19 11:09:27 -04:00
const italic _name = 'core/italic' ;
2022-04-11 08:04:30 -04:00
const italic _title = ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Italic' ) ;
2021-05-19 11:09:27 -04:00
const italic = {
2018-12-17 22:14:52 -05:00
name : italic _name ,
2019-09-19 11:19:18 -04:00
title : italic _title ,
2018-12-16 23:52:00 -05:00
tagName : 'em' ,
className : null ,
2023-06-27 10:24:19 -04:00
edit ( {
isActive ,
value ,
onChange ,
onFocus
} ) {
2020-02-06 16:03:31 -05:00
function onToggle ( ) {
2022-04-11 08:04:30 -04:00
onChange ( ( 0 , external _wp _richText _namespaceObject . toggleFormat ) ( value , {
2021-11-08 09:29:21 -05:00
type : italic _name ,
title : italic _title
2018-12-14 06:02:53 -05:00
} ) ) ;
2020-02-06 16:03:31 -05:00
}
function onClick ( ) {
2022-04-11 08:04:30 -04:00
onChange ( ( 0 , external _wp _richText _namespaceObject . toggleFormat ) ( value , {
2021-11-08 09:29:21 -05:00
type : italic _name
} ) ) ;
2020-02-06 16:03:31 -05:00
onFocus ( ) ;
}
2024-05-31 14:59:00 -04:00
return /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( external _ReactJSXRuntime _namespaceObject . Fragment , {
children : [ /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _blockEditor _namespaceObject . RichTextShortcut , {
type : "primary" ,
character : "i" ,
onUse : onToggle
} ) , /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _blockEditor _namespaceObject . RichTextToolbarButton , {
name : "italic" ,
icon : format _italic ,
title : italic _title ,
onClick : onClick ,
isActive : isActive ,
shortcutType : "primary" ,
shortcutCharacter : "i"
} ) , /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _blockEditor _namespaceObject . _ _unstableRichTextInputEvent , {
inputType : "formatItalic" ,
onInput : onToggle
} ) ]
} ) ;
2018-12-14 06:02:53 -05:00
}
} ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: external ["wp","url"]
2024-01-31 07:59:56 -05:00
const external _wp _url _namespaceObject = window [ "wp" ] [ "url" ] ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: external ["wp","htmlEntities"]
2024-01-31 07:59:56 -05:00
const external _wp _htmlEntities _namespaceObject = window [ "wp" ] [ "htmlEntities" ] ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/link.js
/ * *
* WordPress dependencies
* /
2018-12-14 06:02:53 -05:00
2024-05-31 14:59:00 -04:00
const link _link = /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . SVG , {
2022-04-11 08:04:30 -04:00
xmlns : "http://www.w3.org/2000/svg" ,
2024-05-31 14:59:00 -04:00
viewBox : "0 0 24 24" ,
children : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . Path , {
d : "M10 17.389H8.444A5.194 5.194 0 1 1 8.444 7H10v1.5H8.444a3.694 3.694 0 0 0 0 7.389H10v1.5ZM14 7h1.556a5.194 5.194 0 0 1 0 10.39H14v-1.5h1.556a3.694 3.694 0 0 0 0-7.39H14V7Zm-4.5 6h5v-1.5h-5V13Z"
} )
} ) ;
2024-01-31 07:59:56 -05:00
/* harmony default export */ const library _link = ( link _link ) ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: external ["wp","a11y"]
2024-01-31 07:59:56 -05:00
const external _wp _a11y _namespaceObject = window [ "wp" ] [ "a11y" ] ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: external ["wp","data"]
2024-01-31 07:59:56 -05:00
const external _wp _data _namespaceObject = window [ "wp" ] [ "data" ] ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/link/utils.js
2018-12-17 22:14:52 -05:00
/ * *
* WordPress dependencies
* /
2018-12-14 06:02:53 -05:00
2023-09-26 10:23:26 -04:00
2018-12-17 22:14:52 -05:00
/ * *
* Check for issues with the provided href .
*
* @ param { string } href The href .
*
* @ return { boolean } Is the href invalid ?
* /
function isValidHref ( href ) {
if ( ! href ) {
return false ;
}
2021-05-19 11:09:27 -04:00
const trimmedHref = href . trim ( ) ;
2018-12-17 22:14:52 -05:00
if ( ! trimmedHref ) {
return false ;
2023-09-26 10:23:26 -04:00
}
2018-12-17 22:14:52 -05:00
2023-09-26 10:23:26 -04:00
// Does the href start with something that looks like a URL protocol?
2018-12-17 22:14:52 -05:00
if ( /^\S+:/ . test ( trimmedHref ) ) {
2022-04-11 08:04:30 -04:00
const protocol = ( 0 , external _wp _url _namespaceObject . getProtocol ) ( trimmedHref ) ;
if ( ! ( 0 , external _wp _url _namespaceObject . isValidProtocol ) ( protocol ) ) {
2018-12-17 22:14:52 -05:00
return false ;
2023-09-26 10:23:26 -04:00
}
2018-12-17 22:14:52 -05:00
2023-09-26 10:23:26 -04:00
// Add some extra checks for http(s) URIs, since these are the most common use-case.
// This ensures URIs with an http protocol have exactly two forward slashes following the protocol.
2022-09-20 11:43:29 -04:00
if ( protocol . startsWith ( 'http' ) && ! /^https?:\/\/[^\/\s]/i . test ( trimmedHref ) ) {
2018-12-17 22:14:52 -05:00
return false ;
}
2022-04-11 08:04:30 -04:00
const authority = ( 0 , external _wp _url _namespaceObject . getAuthority ) ( trimmedHref ) ;
if ( ! ( 0 , external _wp _url _namespaceObject . isValidAuthority ) ( authority ) ) {
2018-12-17 22:14:52 -05:00
return false ;
}
2022-04-11 08:04:30 -04:00
const path = ( 0 , external _wp _url _namespaceObject . getPath ) ( trimmedHref ) ;
if ( path && ! ( 0 , external _wp _url _namespaceObject . isValidPath ) ( path ) ) {
2018-12-17 22:14:52 -05:00
return false ;
}
2022-04-11 08:04:30 -04:00
const queryString = ( 0 , external _wp _url _namespaceObject . getQueryString ) ( trimmedHref ) ;
if ( queryString && ! ( 0 , external _wp _url _namespaceObject . isValidQueryString ) ( queryString ) ) {
2018-12-17 22:14:52 -05:00
return false ;
}
2022-04-11 08:04:30 -04:00
const fragment = ( 0 , external _wp _url _namespaceObject . getFragment ) ( trimmedHref ) ;
if ( fragment && ! ( 0 , external _wp _url _namespaceObject . isValidFragment ) ( fragment ) ) {
2018-12-17 22:14:52 -05:00
return false ;
}
2023-09-26 10:23:26 -04:00
}
2018-12-17 22:14:52 -05:00
2023-09-26 10:23:26 -04:00
// Validate anchor links.
2022-09-20 11:43:29 -04:00
if ( trimmedHref . startsWith ( '#' ) && ! ( 0 , external _wp _url _namespaceObject . isValidFragment ) ( trimmedHref ) ) {
2018-12-17 22:14:52 -05:00
return false ;
}
return true ;
}
2023-09-26 10:23:26 -04:00
2019-03-07 04:09:59 -05:00
/ * *
* Generates the format object that will be applied to the link text .
*
2019-09-19 11:19:18 -04:00
* @ param { Object } options
* @ param { string } options . url The href of the link .
2020-06-26 09:33:47 -04:00
* @ param { string } options . type The type of the link .
* @ param { string } options . id The ID of the link .
2019-09-19 11:19:18 -04:00
* @ param { boolean } options . opensInNewWindow Whether this link will open in a new window .
2023-09-26 10:23:26 -04:00
* @ param { boolean } options . nofollow Whether this link is marked as no follow relationship .
2019-03-07 04:09:59 -05:00
* @ return { Object } The final format object .
* /
2023-06-27 10:24:19 -04:00
function createLinkFormat ( {
url ,
type ,
id ,
2023-09-26 10:23:26 -04:00
opensInNewWindow ,
nofollow
2023-06-27 10:24:19 -04:00
} ) {
2021-05-19 11:09:27 -04:00
const format = {
2019-03-07 04:09:59 -05:00
type : 'core/link' ,
attributes : {
2021-05-19 11:09:27 -04:00
url
2019-03-07 04:09:59 -05:00
}
} ;
2024-05-23 15:39:28 -04:00
if ( type ) {
format . attributes . type = type ;
}
if ( id ) {
format . attributes . id = id ;
}
2019-03-07 04:09:59 -05:00
if ( opensInNewWindow ) {
format . attributes . target = '_blank' ;
2023-09-26 10:23:26 -04:00
format . attributes . rel = format . attributes . rel ? format . attributes . rel + ' noreferrer noopener' : 'noreferrer noopener' ;
}
if ( nofollow ) {
format . attributes . rel = format . attributes . rel ? format . attributes . rel + ' nofollow' : 'nofollow' ;
2019-03-07 04:09:59 -05:00
}
return format ;
}
2021-11-08 09:29:21 -05:00
2023-09-26 10:23:26 -04:00
/* eslint-disable jsdoc/no-undefined-types */
2021-11-08 09:29:21 -05:00
/ * *
* Get the start and end boundaries of a given format from a rich text value .
*
*
* @ param { RichTextValue } value the rich text value to interrogate .
* @ param { string } format the identifier for the target format ( e . g . ` core/link ` , ` core/bold ` ) .
* @ param { number ? } startIndex optional startIndex to seek from .
* @ param { number ? } endIndex optional endIndex to seek from .
* @ return { Object } object containing start and end values for the given format .
* /
/* eslint-enable jsdoc/no-undefined-types */
2023-06-27 10:24:19 -04:00
function getFormatBoundary ( value , format , startIndex = value . start , endIndex = value . end ) {
2021-11-08 09:29:21 -05:00
const EMPTY _BOUNDARIES = {
start : null ,
end : null
} ;
const {
formats
} = value ;
let targetFormat ;
let initialIndex ;
2023-06-27 10:24:19 -04:00
if ( ! formats ? . length ) {
2021-11-08 09:29:21 -05:00
return EMPTY _BOUNDARIES ;
2023-09-26 10:23:26 -04:00
}
2021-11-08 09:29:21 -05:00
2023-09-26 10:23:26 -04:00
// Clone formats to avoid modifying source formats.
2021-11-08 09:29:21 -05:00
const newFormats = formats . slice ( ) ;
2023-06-27 10:24:19 -04:00
const formatAtStart = newFormats [ startIndex ] ? . find ( ( {
type
} ) => type === format . type ) ;
const formatAtEnd = newFormats [ endIndex ] ? . find ( ( {
type
} ) => type === format . type ) ;
const formatAtEndMinusOne = newFormats [ endIndex - 1 ] ? . find ( ( {
type
} ) => type === format . type ) ;
2021-11-08 09:29:21 -05:00
if ( ! ! formatAtStart ) {
// Set values to conform to "start"
targetFormat = formatAtStart ;
initialIndex = startIndex ;
} else if ( ! ! formatAtEnd ) {
// Set values to conform to "end"
targetFormat = formatAtEnd ;
initialIndex = endIndex ;
} else if ( ! ! formatAtEndMinusOne ) {
// This is an edge case which will occur if you create a format, then place
// the caret just before the format and hit the back ARROW key. The resulting
// value object will have start and end +1 beyond the edge of the format boundary.
targetFormat = formatAtEndMinusOne ;
initialIndex = endIndex - 1 ;
} else {
return EMPTY _BOUNDARIES ;
}
const index = newFormats [ initialIndex ] . indexOf ( targetFormat ) ;
2023-09-26 10:23:26 -04:00
const walkingArgs = [ newFormats , initialIndex , targetFormat , index ] ;
2021-11-08 09:29:21 -05:00
2023-09-26 10:23:26 -04:00
// Walk the startIndex "backwards" to the leading "edge" of the matching format.
startIndex = walkToStart ( ... walkingArgs ) ;
2021-11-08 09:29:21 -05:00
2023-09-26 10:23:26 -04:00
// Walk the endIndex "forwards" until the trailing "edge" of the matching format.
endIndex = walkToEnd ( ... walkingArgs ) ;
2021-11-08 09:29:21 -05:00
2023-09-26 10:23:26 -04:00
// Safe guard: start index cannot be less than 0.
startIndex = startIndex < 0 ? 0 : startIndex ;
2021-11-08 09:29:21 -05:00
2023-09-26 10:23:26 -04:00
// // Return the indicies of the "edges" as the boundaries.
2021-11-08 09:29:21 -05:00
return {
start : startIndex ,
end : endIndex
} ;
}
2023-09-26 10:23:26 -04:00
2021-11-08 09:29:21 -05:00
/ * *
* Walks forwards / backwards towards the boundary of a given format within an
* array of format objects . Returns the index of the boundary .
*
* @ param { Array } formats the formats to search for the given format type .
* @ param { number } initialIndex the starting index from which to walk .
* @ param { Object } targetFormatRef a reference to the format type object being sought .
* @ param { number } formatIndex the index at which we expect the target format object to be .
* @ param { string } direction either 'forwards' or 'backwards' to indicate the direction .
* @ return { number } the index of the boundary of the given format .
* /
function walkToBoundary ( formats , initialIndex , targetFormatRef , formatIndex , direction ) {
let index = initialIndex ;
const directions = {
forwards : 1 ,
backwards : - 1
} ;
const directionIncrement = directions [ direction ] || 1 ; // invalid direction arg default to forwards
const inverseDirectionIncrement = directionIncrement * - 1 ;
while ( formats [ index ] && formats [ index ] [ formatIndex ] === targetFormatRef ) {
// Increment/decrement in the direction of operation.
index = index + directionIncrement ;
2023-09-26 10:23:26 -04:00
}
2021-11-08 09:29:21 -05:00
2023-09-26 10:23:26 -04:00
// Restore by one in inverse direction of operation
// to avoid out of bounds.
2021-11-08 09:29:21 -05:00
index = index + inverseDirectionIncrement ;
return index ;
}
2023-06-27 10:24:19 -04:00
const partialRight = ( fn , ... partialArgs ) => ( ... args ) => fn ( ... args , ... partialArgs ) ;
2022-09-20 11:43:29 -04:00
const walkToStart = partialRight ( walkToBoundary , 'backwards' ) ;
const walkToEnd = partialRight ( walkToBoundary , 'forwards' ) ;
2018-12-17 22:14:52 -05:00
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/link/inline.js
2018-12-14 06:02:53 -05:00
/ * *
* WordPress dependencies
* /
2021-11-08 09:29:21 -05:00
2023-09-26 10:23:26 -04:00
2018-12-14 06:02:53 -05:00
/ * *
* Internal dependencies
* /
2024-05-31 14:59:00 -04:00
2023-09-26 10:23:26 -04:00
const LINK _SETTINGS = [ ... external _wp _blockEditor _namespaceObject . _ _experimentalLinkControl . DEFAULT _LINK _SETTINGS , {
id : 'nofollow' ,
title : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Mark as nofollow' )
} ] ;
2023-06-27 10:24:19 -04:00
function InlineLinkUI ( {
isActive ,
activeAttributes ,
value ,
onChange ,
2024-02-09 13:22:22 -05:00
onFocusOutside ,
2023-06-27 10:24:19 -04:00
stopAddingLink ,
2024-03-12 10:08:24 -04:00
contentRef ,
focusOnMount
2023-06-27 10:24:19 -04:00
} ) {
2023-09-26 10:23:26 -04:00
const richLinkTextValue = getRichTextValueFromSelection ( value , isActive ) ;
2021-11-08 09:29:21 -05:00
2023-09-26 10:23:26 -04:00
// Get the text content minus any HTML tags.
2021-11-08 09:29:21 -05:00
const richTextText = richLinkTextValue . text ;
2024-02-13 08:12:17 -05:00
const {
selectionChange
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( external _wp _blockEditor _namespaceObject . store ) ;
2021-11-08 09:29:21 -05:00
const {
createPageEntity ,
2024-02-13 08:12:17 -05:00
userCanCreatePages ,
selectionStart
2022-04-11 08:04:30 -04:00
} = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => {
2021-11-08 09:29:21 -05:00
const {
2024-02-13 08:12:17 -05:00
getSettings ,
getSelectionStart
2022-04-11 08:04:30 -04:00
} = select ( external _wp _blockEditor _namespaceObject . store ) ;
2021-11-08 09:29:21 -05:00
const _settings = getSettings ( ) ;
return {
createPageEntity : _settings . _ _experimentalCreatePageEntity ,
2024-02-13 08:12:17 -05:00
userCanCreatePages : _settings . _ _experimentalUserCanCreatePages ,
selectionStart : getSelectionStart ( )
2021-11-08 09:29:21 -05:00
} ;
} , [ ] ) ;
2023-09-26 10:23:26 -04:00
const linkValue = ( 0 , external _wp _element _namespaceObject . useMemo ) ( ( ) => ( {
2020-02-06 16:03:31 -05:00
url : activeAttributes . url ,
2020-06-26 09:33:47 -04:00
type : activeAttributes . type ,
id : activeAttributes . id ,
2021-05-19 11:09:27 -04:00
opensInNewTab : activeAttributes . target === '_blank' ,
2023-09-26 10:23:26 -04:00
nofollow : activeAttributes . rel ? . includes ( 'nofollow' ) ,
title : richTextText
} ) , [ activeAttributes . id , activeAttributes . rel , activeAttributes . target , activeAttributes . type , activeAttributes . url , richTextText ] ) ;
2021-11-08 09:29:21 -05:00
function removeLink ( ) {
2022-04-11 08:04:30 -04:00
const newValue = ( 0 , external _wp _richText _namespaceObject . removeFormat ) ( value , 'core/link' ) ;
2021-11-08 09:29:21 -05:00
onChange ( newValue ) ;
stopAddingLink ( ) ;
2023-09-26 10:23:26 -04:00
( 0 , external _wp _a11y _namespaceObject . speak ) ( ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Link removed.' ) , 'assertive' ) ;
2021-11-08 09:29:21 -05:00
}
2020-02-06 16:03:31 -05:00
function onChangeLink ( nextValue ) {
Editor: Update the WordPress packages to the Gutenberg 16.7 RC2 version.
This patch, somewhat small brings a lot to WordPress.
This includes features like:
- DataViews.
- Customization tools like box shadow, background size and repeat.
- UI improvements in the site editor.
- Preferences sharing between the post and site editors.
- Unified panels and editors between post and site editors.
- Improved template mode in the post editor.
- Iterations to multiple interactive blocks.
- Preparing the blocks and UI for pattern overrides.
- and a lot more.
Props luisherranz, gziolo, isabel_brison, costdev, jonsurrell, peterwilsoncc, get_dave, antonvlasenko, desrosj.
See #60315.
Built from https://develop.svn.wordpress.org/trunk@57377
git-svn-id: http://core.svn.wordpress.org/trunk@56883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-29 16:07:12 -05:00
const hasLink = linkValue ? . url ;
const isNewLink = ! hasLink ;
2023-09-26 10:23:26 -04:00
// Merge the next value with the current link value.
nextValue = {
... linkValue ,
2021-05-19 11:09:27 -04:00
... nextValue
2023-09-26 10:23:26 -04:00
} ;
2022-04-11 08:04:30 -04:00
const newUrl = ( 0 , external _wp _url _namespaceObject . prependHTTP ) ( nextValue . url ) ;
2021-11-08 09:29:21 -05:00
const linkFormat = createLinkFormat ( {
2020-02-06 16:03:31 -05:00
url : newUrl ,
2020-06-26 09:33:47 -04:00
type : nextValue . type ,
id : nextValue . id !== undefined && nextValue . id !== null ? String ( nextValue . id ) : undefined ,
2023-09-26 10:23:26 -04:00
opensInNewWindow : nextValue . opensInNewTab ,
nofollow : nextValue . nofollow
2020-02-06 16:03:31 -05:00
} ) ;
2021-11-08 09:29:21 -05:00
const newText = nextValue . title || newUrl ;
2024-02-09 13:22:22 -05:00
// Scenario: we have any active text selection or an active format.
let newValue ;
2022-04-11 08:04:30 -04:00
if ( ( 0 , external _wp _richText _namespaceObject . isCollapsed ) ( value ) && ! isActive ) {
2021-11-08 09:29:21 -05:00
// Scenario: we don't have any actively selected text or formats.
2024-02-09 13:22:22 -05:00
const inserted = ( 0 , external _wp _richText _namespaceObject . insert ) ( value , newText ) ;
2024-02-13 08:12:17 -05:00
newValue = ( 0 , external _wp _richText _namespaceObject . applyFormat ) ( inserted , linkFormat , value . start , value . start + newText . length ) ;
onChange ( newValue ) ;
// Close the Link UI.
stopAddingLink ( ) ;
// Move the selection to the end of the inserted link outside of the format boundary
// so the user can continue typing after the link.
selectionChange ( {
clientId : selectionStart . clientId ,
identifier : selectionStart . attributeKey ,
start : value . start + newText . length + 1
} ) ;
return ;
2024-02-09 13:22:22 -05:00
} else if ( newText === richTextText ) {
newValue = ( 0 , external _wp _richText _namespaceObject . applyFormat ) ( value , linkFormat ) ;
2020-02-06 16:03:31 -05:00
} else {
2024-02-09 13:22:22 -05:00
// Scenario: Editing an existing link.
// Create new RichText value for the new text in order that we
// can apply formats to it.
newValue = ( 0 , external _wp _richText _namespaceObject . create ) ( {
text : newText
} ) ;
// Apply the new Link format to this new text value.
newValue = ( 0 , external _wp _richText _namespaceObject . applyFormat ) ( newValue , linkFormat , 0 , newText . length ) ;
// Get the boundaries of the active link format.
const boundary = getFormatBoundary ( value , {
type : 'core/link'
} ) ;
// Split the value at the start of the active link format.
// Passing "start" as the 3rd parameter is required to ensure
// the second half of the split value is split at the format's
// start boundary and avoids relying on the value's "end" property
// which may not correspond correctly.
const [ valBefore , valAfter ] = ( 0 , external _wp _richText _namespaceObject . split ) ( value , boundary . start , boundary . start ) ;
// Update the original (full) RichTextValue replacing the
// target text with the *new* RichTextValue containing:
// 1. The new text content.
// 2. The new link format.
// As "replace" will operate on the first match only, it is
// run only against the second half of the value which was
// split at the active format's boundary. This avoids a bug
// with incorrectly targetted replacements.
// See: https://github.com/WordPress/gutenberg/issues/41771.
// Note original formats will be lost when applying this change.
// That is expected behaviour.
// See: https://github.com/WordPress/gutenberg/pull/33849#issuecomment-936134179.
const newValAfter = ( 0 , external _wp _richText _namespaceObject . replace ) ( valAfter , richTextText , newValue ) ;
newValue = ( 0 , external _wp _richText _namespaceObject . concat ) ( valBefore , newValAfter ) ;
2023-09-26 10:23:26 -04:00
}
2024-02-09 13:22:22 -05:00
onChange ( newValue ) ;
2020-02-10 17:33:27 -05:00
Editor: Update the WordPress packages to the Gutenberg 16.7 RC2 version.
This patch, somewhat small brings a lot to WordPress.
This includes features like:
- DataViews.
- Customization tools like box shadow, background size and repeat.
- UI improvements in the site editor.
- Preferences sharing between the post and site editors.
- Unified panels and editors between post and site editors.
- Improved template mode in the post editor.
- Iterations to multiple interactive blocks.
- Preparing the blocks and UI for pattern overrides.
- and a lot more.
Props luisherranz, gziolo, isabel_brison, costdev, jonsurrell, peterwilsoncc, get_dave, antonvlasenko, desrosj.
See #60315.
Built from https://develop.svn.wordpress.org/trunk@57377
git-svn-id: http://core.svn.wordpress.org/trunk@56883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-29 16:07:12 -05:00
// Focus should only be returned to the rich text on submit if this link is not
// being created for the first time. If it is then focus should remain within the
// Link UI because it should remain open for the user to modify the link they have
// just created.
if ( ! isNewLink ) {
2024-02-09 13:22:22 -05:00
stopAddingLink ( ) ;
2020-02-10 17:33:27 -05:00
}
2020-02-06 16:03:31 -05:00
if ( ! isValidHref ( newUrl ) ) {
2023-09-26 10:23:26 -04:00
( 0 , external _wp _a11y _namespaceObject . speak ) ( ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Warning: the link has been inserted but may have errors. Please test it.' ) , 'assertive' ) ;
2020-02-06 16:03:31 -05:00
} else if ( isActive ) {
2023-09-26 10:23:26 -04:00
( 0 , external _wp _a11y _namespaceObject . speak ) ( ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Link edited.' ) , 'assertive' ) ;
2020-02-06 16:03:31 -05:00
} else {
2023-09-26 10:23:26 -04:00
( 0 , external _wp _a11y _namespaceObject . speak ) ( ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Link inserted.' ) , 'assertive' ) ;
2018-12-14 06:02:53 -05:00
}
2020-02-06 16:03:31 -05:00
}
2022-09-20 11:43:29 -04:00
const popoverAnchor = ( 0 , external _wp _richText _namespaceObject . useAnchor ) ( {
editableContentElement : contentRef . current ,
2024-02-13 08:12:17 -05:00
settings : {
... build _module _link _link ,
isActive
}
2023-09-26 10:23:26 -04:00
} ) ;
2021-11-08 09:29:21 -05:00
async function handleCreate ( pageTitle ) {
const page = await createPageEntity ( {
title : pageTitle ,
status : 'draft'
} ) ;
return {
id : page . id ,
type : page . type ,
title : page . title . rendered ,
url : page . link ,
kind : 'post-type'
} ;
}
function createButtonText ( searchTerm ) {
2023-09-26 10:23:26 -04:00
return ( 0 , external _wp _element _namespaceObject . createInterpolateElement ) ( ( 0 , external _wp _i18n _namespaceObject . sprintf ) ( /* translators: %s: search term. */
2023-07-14 00:33:18 -04:00
( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Create page: <mark>%s</mark>' ) , searchTerm ) , {
2024-05-31 14:59:00 -04:00
mark : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( "mark" , { } )
2021-11-08 09:29:21 -05:00
} ) ;
}
2024-05-31 14:59:00 -04:00
return /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _components _namespaceObject . Popover , {
2022-09-20 11:43:29 -04:00
anchor : popoverAnchor ,
2024-05-23 15:39:28 -04:00
animate : false ,
2020-02-06 16:03:31 -05:00
onClose : stopAddingLink ,
2024-02-09 13:22:22 -05:00
onFocusOutside : onFocusOutside ,
2023-02-07 02:04:52 -05:00
placement : "bottom" ,
2024-05-23 15:39:28 -04:00
offset : 8 ,
2024-03-12 10:08:24 -04:00
shift : true ,
focusOnMount : focusOnMount ,
2024-05-31 14:59:00 -04:00
constrainTabbing : true ,
children : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _blockEditor _namespaceObject . _ _experimentalLinkControl , {
value : linkValue ,
onChange : onChangeLink ,
onRemove : removeLink ,
hasRichPreviews : true ,
createSuggestion : createPageEntity && handleCreate ,
withCreateSuggestion : userCanCreatePages ,
createSuggestionButtonText : createButtonText ,
hasTextControl : true ,
settings : LINK _SETTINGS ,
showInitialSuggestions : true ,
suggestionsQuery : {
// always show Pages as initial suggestions
initialSuggestionsSearchOptions : {
type : 'post' ,
subtype : 'page' ,
perPage : 20
}
Editor: Update the WordPress packages to the Gutenberg 16.7 RC2 version.
This patch, somewhat small brings a lot to WordPress.
This includes features like:
- DataViews.
- Customization tools like box shadow, background size and repeat.
- UI improvements in the site editor.
- Preferences sharing between the post and site editors.
- Unified panels and editors between post and site editors.
- Improved template mode in the post editor.
- Iterations to multiple interactive blocks.
- Preparing the blocks and UI for pattern overrides.
- and a lot more.
Props luisherranz, gziolo, isabel_brison, costdev, jonsurrell, peterwilsoncc, get_dave, antonvlasenko, desrosj.
See #60315.
Built from https://develop.svn.wordpress.org/trunk@57377
git-svn-id: http://core.svn.wordpress.org/trunk@56883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-29 16:07:12 -05:00
}
2024-05-31 14:59:00 -04:00
} )
} ) ;
2020-02-06 16:03:31 -05:00
}
2021-11-08 09:29:21 -05:00
function getRichTextValueFromSelection ( value , isActive ) {
// Default to the selection ranges on the RichTextValue object.
let textStart = value . start ;
2023-09-26 10:23:26 -04:00
let textEnd = value . end ;
// If the format is currently active then the rich text value
2021-11-08 09:29:21 -05:00
// should always be taken from the bounds of the active format
// and not the selected text.
if ( isActive ) {
const boundary = getFormatBoundary ( value , {
type : 'core/link'
} ) ;
2023-09-26 10:23:26 -04:00
textStart = boundary . start ;
2021-11-08 09:29:21 -05:00
2023-09-26 10:23:26 -04:00
// Text *selection* always extends +1 beyond the edge of the format.
// We account for that here.
2021-11-08 09:29:21 -05:00
textEnd = boundary . end + 1 ;
2023-09-26 10:23:26 -04:00
}
2021-11-08 09:29:21 -05:00
2023-09-26 10:23:26 -04:00
// Get a RichTextValue containing the selected text content.
2022-04-11 08:04:30 -04:00
return ( 0 , external _wp _richText _namespaceObject . slice ) ( value , textStart , textEnd ) ;
2021-11-08 09:29:21 -05:00
}
2024-01-31 07:59:56 -05:00
/* harmony default export */ const inline = ( InlineLinkUI ) ;
2018-12-14 06:02:53 -05:00
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/link/index.js
2021-01-27 21:04:13 -05:00
/ * *
* WordPress dependencies
* /
2018-12-14 06:02:53 -05:00
2020-06-26 09:33:47 -04:00
2023-09-26 10:23:26 -04:00
2018-12-14 06:02:53 -05:00
/ * *
2021-01-27 21:04:13 -05:00
* Internal dependencies
2018-12-14 06:02:53 -05:00
* /
2024-05-31 14:59:00 -04:00
2021-05-19 11:09:27 -04:00
const link _name = 'core/link' ;
2022-04-11 08:04:30 -04:00
const link _title = ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Link' ) ;
2023-06-27 10:24:19 -04:00
function link _Edit ( {
isActive ,
activeAttributes ,
value ,
onChange ,
onFocus ,
contentRef
} ) {
2024-05-23 15:39:28 -04:00
const [ addingLink , setAddingLink ] = ( 0 , external _wp _element _namespaceObject . useState ) ( false ) ;
2024-03-12 10:08:24 -04:00
2024-02-09 13:22:22 -05:00
// We only need to store the button element that opened the popover. We can ignore the other states, as they will be handled by the onFocus prop to return to the rich text field.
const [ openedBy , setOpenedBy ] = ( 0 , external _wp _element _namespaceObject . useState ) ( null ) ;
2024-03-12 10:08:24 -04:00
( 0 , external _wp _element _namespaceObject . useEffect ) ( ( ) => {
// When the link becomes inactive (i.e. isActive is false), reset the editingLink state
// and the creatingLink state. This means that if the Link UI is displayed and the link
// becomes inactive (e.g. used arrow keys to move cursor outside of link bounds), the UI will close.
if ( ! isActive ) {
2024-05-23 15:39:28 -04:00
setAddingLink ( false ) ;
2024-03-12 10:08:24 -04:00
}
} , [ isActive ] ) ;
2024-02-09 13:22:22 -05:00
( 0 , external _wp _element _namespaceObject . useLayoutEffect ) ( ( ) => {
const editableContentElement = contentRef . current ;
if ( ! editableContentElement ) {
return ;
}
function handleClick ( event ) {
// There is a situation whereby there is an existing link in the rich text
// and the user clicks on the leftmost edge of that link and fails to activate
// the link format, but the click event still fires on the `<a>` element.
2024-03-12 10:08:24 -04:00
// This causes the `editingLink` state to be set to `true` and the link UI
2024-02-09 13:22:22 -05:00
// to be rendered in "creating" mode. We need to check isActive to see if
// we have an active link format.
2024-05-23 15:39:28 -04:00
const link = event . target . closest ( '[contenteditable] a' ) ;
if ( ! link ||
2024-03-12 10:08:24 -04:00
// other formats (e.g. bold) may be nested within the link.
! isActive ) {
2024-02-09 13:22:22 -05:00
return ;
}
2024-05-23 15:39:28 -04:00
setAddingLink ( true ) ;
setOpenedBy ( {
el : link ,
action : 'click'
2024-03-12 10:08:24 -04:00
} ) ;
2024-02-09 13:22:22 -05:00
}
editableContentElement . addEventListener ( 'click' , handleClick ) ;
return ( ) => {
editableContentElement . removeEventListener ( 'click' , handleClick ) ;
} ;
2024-02-13 08:12:17 -05:00
} , [ contentRef , isActive ] ) ;
2024-02-09 13:22:22 -05:00
function addLink ( target ) {
2022-04-11 08:04:30 -04:00
const text = ( 0 , external _wp _richText _namespaceObject . getTextContent ) ( ( 0 , external _wp _richText _namespaceObject . slice ) ( value ) ) ;
2024-02-09 13:22:22 -05:00
if ( ! isActive && text && ( 0 , external _wp _url _namespaceObject . isURL ) ( text ) && isValidHref ( text ) ) {
2022-04-11 08:04:30 -04:00
onChange ( ( 0 , external _wp _richText _namespaceObject . applyFormat ) ( value , {
2021-01-27 21:04:13 -05:00
type : link _name ,
attributes : {
url : text
}
} ) ) ;
2024-02-09 13:22:22 -05:00
} else if ( ! isActive && text && ( 0 , external _wp _url _namespaceObject . isEmail ) ( text ) ) {
2022-04-11 08:04:30 -04:00
onChange ( ( 0 , external _wp _richText _namespaceObject . applyFormat ) ( value , {
2021-01-27 21:04:13 -05:00
type : link _name ,
attributes : {
2021-05-19 11:09:27 -04:00
url : ` mailto: ${ text } `
2021-01-27 21:04:13 -05:00
}
} ) ) ;
} else {
2024-02-09 13:22:22 -05:00
if ( target ) {
2024-05-23 15:39:28 -04:00
setOpenedBy ( {
el : target ,
action : null // We don't need to distinguish between click or keyboard here
} ) ;
2024-03-12 10:08:24 -04:00
}
2024-05-23 15:39:28 -04:00
setAddingLink ( true ) ;
2021-01-27 21:04:13 -05:00
}
}
2024-02-09 13:22:22 -05:00
/ * *
* Runs when the popover is closed via escape keypress , unlinking the selected text ,
* but _not _ on a click outside the popover . onFocusOutside handles that .
* /
function stopAddingLink ( ) {
// Don't let the click handler on the toolbar button trigger again.
// There are two places for us to return focus to on Escape keypress:
// 1. The rich text field.
// 2. The toolbar button.
// The toolbar button is the only one we need to handle returning focus to.
// Otherwise, we rely on the passed in onFocus to return focus to the rich text field.
// Close the popover
2024-05-23 15:39:28 -04:00
setAddingLink ( false ) ;
2024-03-12 10:08:24 -04:00
2024-02-09 13:22:22 -05:00
// Return focus to the toolbar button or the rich text field
2024-05-23 15:39:28 -04:00
if ( openedBy ? . el ? . tagName === 'BUTTON' ) {
openedBy . el . focus ( ) ;
2024-02-09 13:22:22 -05:00
} else {
2023-06-27 10:24:19 -04:00
onFocus ( ) ;
}
2024-02-09 13:22:22 -05:00
// Remove the openedBy state
setOpenedBy ( null ) ;
}
// Test for this:
// 1. Click on the link button
// 2. Click the Options button in the top right of header
// 3. Focus should be in the dropdown of the Options button
// 4. Press Escape
// 5. Focus should be on the Options button
function onFocusOutside ( ) {
2024-05-23 15:39:28 -04:00
setAddingLink ( false ) ;
2024-02-09 13:22:22 -05:00
setOpenedBy ( null ) ;
2021-01-27 21:04:13 -05:00
}
function onRemoveFormat ( ) {
2022-04-11 08:04:30 -04:00
onChange ( ( 0 , external _wp _richText _namespaceObject . removeFormat ) ( value , link _name ) ) ;
( 0 , external _wp _a11y _namespaceObject . speak ) ( ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Link removed.' ) , 'assertive' ) ;
2021-01-27 21:04:13 -05:00
}
2024-05-23 15:39:28 -04:00
// Only autofocus if we have clicked a link within the editor
const shouldAutoFocus = ! ( openedBy ? . el ? . tagName === 'A' && openedBy ? . action === 'click' ) ;
2024-05-31 14:59:00 -04:00
return /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( external _ReactJSXRuntime _namespaceObject . Fragment , {
children : [ /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _blockEditor _namespaceObject . RichTextShortcut , {
type : "primary" ,
character : "k" ,
onUse : addLink
} ) , /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _blockEditor _namespaceObject . RichTextShortcut , {
type : "primaryShift" ,
character : "k" ,
onUse : onRemoveFormat
} ) , /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _blockEditor _namespaceObject . RichTextToolbarButton , {
name : "link" ,
icon : library _link ,
title : isActive ? ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Link' ) : link _title ,
onClick : event => {
addLink ( event . currentTarget ) ;
} ,
isActive : isActive || addingLink ,
shortcutType : "primary" ,
shortcutCharacter : "k" ,
"aria-haspopup" : "true" ,
"aria-expanded" : addingLink
} ) , addingLink && /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( inline , {
stopAddingLink : stopAddingLink ,
onFocusOutside : onFocusOutside ,
isActive : isActive ,
activeAttributes : activeAttributes ,
value : value ,
onChange : onChange ,
contentRef : contentRef ,
focusOnMount : shouldAutoFocus ? 'firstElement' : false
} ) ]
} ) ;
2021-01-27 21:04:13 -05:00
}
2022-04-11 08:04:30 -04:00
const build _module _link _link = {
2018-12-17 22:14:52 -05:00
name : link _name ,
2019-09-19 11:19:18 -04:00
title : link _title ,
2018-12-17 22:14:52 -05:00
tagName : 'a' ,
className : null ,
attributes : {
url : 'href' ,
2020-06-26 09:33:47 -04:00
type : 'data-type' ,
id : 'data-id' ,
Editor: Update the WordPress packages to the Gutenberg 16.7 RC2 version.
This patch, somewhat small brings a lot to WordPress.
This includes features like:
- DataViews.
- Customization tools like box shadow, background size and repeat.
- UI improvements in the site editor.
- Preferences sharing between the post and site editors.
- Unified panels and editors between post and site editors.
- Improved template mode in the post editor.
- Iterations to multiple interactive blocks.
- Preparing the blocks and UI for pattern overrides.
- and a lot more.
Props luisherranz, gziolo, isabel_brison, costdev, jonsurrell, peterwilsoncc, get_dave, antonvlasenko, desrosj.
See #60315.
Built from https://develop.svn.wordpress.org/trunk@57377
git-svn-id: http://core.svn.wordpress.org/trunk@56883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-29 16:07:12 -05:00
_id : 'id' ,
2023-09-26 10:23:26 -04:00
target : 'target' ,
rel : 'rel'
2018-12-17 22:14:52 -05:00
} ,
2023-06-27 10:24:19 -04:00
_ _unstablePasteRule ( value , {
html ,
plainText
} ) {
2023-09-26 10:23:26 -04:00
const pastedText = ( html || plainText ) . replace ( /<[^>]+>/g , '' ) . trim ( ) ;
2019-09-19 11:19:18 -04:00
2023-09-26 10:23:26 -04:00
// A URL was pasted, turn the selection into a link.
Editor: Update the WordPress packages to the Gutenberg 16.7 RC2 version.
This patch, somewhat small brings a lot to WordPress.
This includes features like:
- DataViews.
- Customization tools like box shadow, background size and repeat.
- UI improvements in the site editor.
- Preferences sharing between the post and site editors.
- Unified panels and editors between post and site editors.
- Improved template mode in the post editor.
- Iterations to multiple interactive blocks.
- Preparing the blocks and UI for pattern overrides.
- and a lot more.
Props luisherranz, gziolo, isabel_brison, costdev, jonsurrell, peterwilsoncc, get_dave, antonvlasenko, desrosj.
See #60315.
Built from https://develop.svn.wordpress.org/trunk@57377
git-svn-id: http://core.svn.wordpress.org/trunk@56883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-29 16:07:12 -05:00
// For the link pasting feature, allow only http(s) protocols.
if ( ! ( 0 , external _wp _url _namespaceObject . isURL ) ( pastedText ) || ! /^https?:/ . test ( pastedText ) ) {
2019-09-19 11:19:18 -04:00
return value ;
2023-09-26 10:23:26 -04:00
}
2019-09-19 11:19:18 -04:00
2023-09-26 10:23:26 -04:00
// Allows us to ask for this information when we get a report.
2019-09-19 11:19:18 -04:00
window . console . log ( 'Created link:\n\n' , pastedText ) ;
Editor: Update the WordPress packages to the Gutenberg 16.7 RC2 version.
This patch, somewhat small brings a lot to WordPress.
This includes features like:
- DataViews.
- Customization tools like box shadow, background size and repeat.
- UI improvements in the site editor.
- Preferences sharing between the post and site editors.
- Unified panels and editors between post and site editors.
- Improved template mode in the post editor.
- Iterations to multiple interactive blocks.
- Preparing the blocks and UI for pattern overrides.
- and a lot more.
Props luisherranz, gziolo, isabel_brison, costdev, jonsurrell, peterwilsoncc, get_dave, antonvlasenko, desrosj.
See #60315.
Built from https://develop.svn.wordpress.org/trunk@57377
git-svn-id: http://core.svn.wordpress.org/trunk@56883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-29 16:07:12 -05:00
const format = {
2019-09-19 11:19:18 -04:00
type : link _name ,
attributes : {
2022-04-11 08:04:30 -04:00
url : ( 0 , external _wp _htmlEntities _namespaceObject . decodeEntities ) ( pastedText )
2019-09-19 11:19:18 -04:00
}
Editor: Update the WordPress packages to the Gutenberg 16.7 RC2 version.
This patch, somewhat small brings a lot to WordPress.
This includes features like:
- DataViews.
- Customization tools like box shadow, background size and repeat.
- UI improvements in the site editor.
- Preferences sharing between the post and site editors.
- Unified panels and editors between post and site editors.
- Improved template mode in the post editor.
- Iterations to multiple interactive blocks.
- Preparing the blocks and UI for pattern overrides.
- and a lot more.
Props luisherranz, gziolo, isabel_brison, costdev, jonsurrell, peterwilsoncc, get_dave, antonvlasenko, desrosj.
See #60315.
Built from https://develop.svn.wordpress.org/trunk@57377
git-svn-id: http://core.svn.wordpress.org/trunk@56883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-29 16:07:12 -05:00
} ;
if ( ( 0 , external _wp _richText _namespaceObject . isCollapsed ) ( value ) ) {
return ( 0 , external _wp _richText _namespaceObject . insert ) ( value , ( 0 , external _wp _richText _namespaceObject . applyFormat ) ( ( 0 , external _wp _richText _namespaceObject . create ) ( {
text : plainText
} ) , format , 0 , plainText . length ) ) ;
}
return ( 0 , external _wp _richText _namespaceObject . applyFormat ) ( value , format ) ;
2019-09-19 11:19:18 -04:00
} ,
2021-01-27 21:04:13 -05:00
edit : link _Edit
2018-12-17 22:14:52 -05:00
} ;
2018-12-14 06:02:53 -05:00
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-strikethrough.js
/ * *
* WordPress dependencies
* /
2024-05-31 14:59:00 -04:00
const formatStrikethrough = /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . SVG , {
2022-04-11 08:04:30 -04:00
xmlns : "http://www.w3.org/2000/svg" ,
2024-05-31 14:59:00 -04:00
viewBox : "0 0 24 24" ,
children : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . Path , {
d : "M9.1 9v-.5c0-.6.2-1.1.7-1.4.5-.3 1.2-.5 2-.5.7 0 1.4.1 2.1.3.7.2 1.4.5 2.1.9l.2-1.9c-.6-.3-1.2-.5-1.9-.7-.8-.1-1.6-.2-2.4-.2-1.5 0-2.7.3-3.6 1-.8.7-1.2 1.5-1.2 2.6V9h2zM20 12H4v1h8.3c.3.1.6.2.8.3.5.2.9.5 1.1.8.3.3.4.7.4 1.2 0 .7-.2 1.1-.8 1.5-.5.3-1.2.5-2.1.5-.8 0-1.6-.1-2.4-.3-.8-.2-1.5-.5-2.2-.8L7 18.1c.5.2 1.2.4 2 .6.8.2 1.6.3 2.4.3 1.7 0 3-.3 3.9-1 .9-.7 1.3-1.6 1.3-2.8 0-.9-.2-1.7-.7-2.2H20v-1z"
} )
} ) ;
2024-01-31 07:59:56 -05:00
/* harmony default export */ const format _strikethrough = ( formatStrikethrough ) ;
2020-02-10 17:33:27 -05:00
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/strikethrough/index.js
2018-12-14 06:02:53 -05:00
/ * *
* WordPress dependencies
* /
2020-02-10 17:33:27 -05:00
2024-05-31 14:59:00 -04:00
2021-05-19 11:09:27 -04:00
const strikethrough _name = 'core/strikethrough' ;
2022-04-11 08:04:30 -04:00
const strikethrough _title = ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Strikethrough' ) ;
2021-05-19 11:09:27 -04:00
const strikethrough = {
2018-12-17 22:14:52 -05:00
name : strikethrough _name ,
2019-09-19 11:19:18 -04:00
title : strikethrough _title ,
2019-03-21 08:48:00 -04:00
tagName : 's' ,
2018-12-16 23:52:00 -05:00
className : null ,
2023-06-27 10:24:19 -04:00
edit ( {
isActive ,
value ,
onChange ,
onFocus
} ) {
2020-02-06 16:03:31 -05:00
function onClick ( ) {
2022-04-11 08:04:30 -04:00
onChange ( ( 0 , external _wp _richText _namespaceObject . toggleFormat ) ( value , {
2021-11-08 09:29:21 -05:00
type : strikethrough _name ,
title : strikethrough _title
2018-12-14 06:02:53 -05:00
} ) ) ;
2020-02-06 16:03:31 -05:00
onFocus ( ) ;
}
2024-05-31 14:59:00 -04:00
return /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( external _ReactJSXRuntime _namespaceObject . Fragment , {
children : [ /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _blockEditor _namespaceObject . RichTextShortcut , {
type : "access" ,
character : "d" ,
onUse : onClick
} ) , /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _blockEditor _namespaceObject . RichTextToolbarButton , {
icon : format _strikethrough ,
title : strikethrough _title ,
onClick : onClick ,
isActive : isActive ,
role : "menuitemcheckbox"
} ) ]
} ) ;
2018-12-14 06:02:53 -05:00
}
} ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/underline/index.js
2019-03-07 04:09:59 -05:00
/ * *
* WordPress dependencies
* /
2024-05-31 14:59:00 -04:00
2021-05-19 11:09:27 -04:00
const underline _name = 'core/underline' ;
2022-04-11 08:04:30 -04:00
const underline _title = ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Underline' ) ;
2021-05-19 11:09:27 -04:00
const underline = {
2019-03-07 04:09:59 -05:00
name : underline _name ,
2021-11-08 09:29:21 -05:00
title : underline _title ,
2019-03-07 04:09:59 -05:00
tagName : 'span' ,
className : null ,
attributes : {
style : 'style'
} ,
2023-06-27 10:24:19 -04:00
edit ( {
value ,
onChange
} ) {
2021-05-19 11:09:27 -04:00
const onToggle = ( ) => {
2022-04-11 08:04:30 -04:00
onChange ( ( 0 , external _wp _richText _namespaceObject . toggleFormat ) ( value , {
2019-03-07 04:09:59 -05:00
type : underline _name ,
attributes : {
style : 'text-decoration: underline;'
2021-11-08 09:29:21 -05:00
} ,
title : underline _title
2019-03-07 04:09:59 -05:00
} ) ) ;
} ;
2024-05-31 14:59:00 -04:00
return /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( external _ReactJSXRuntime _namespaceObject . Fragment , {
children : [ /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _blockEditor _namespaceObject . RichTextShortcut , {
type : "primary" ,
character : "u" ,
onUse : onToggle
} ) , /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _blockEditor _namespaceObject . _ _unstableRichTextInputEvent , {
inputType : "formatUnderline" ,
onInput : onToggle
} ) ]
} ) ;
2019-03-07 04:09:59 -05:00
}
} ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js
/ * *
* WordPress dependencies
* /
2023-09-26 10:23:26 -04:00
2022-04-11 08:04:30 -04:00
/** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */
/ * *
* Return an SVG icon .
*
2023-09-26 10:23:26 -04:00
* @ 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
* @ param { import ( 'react' ) . ForwardedRef < HTMLElement > } ref The forwarded ref to the SVG element .
2022-04-11 08:04:30 -04:00
*
* @ return { JSX . Element } Icon component
* /
2023-06-27 10:24:19 -04:00
function Icon ( {
icon ,
size = 24 ,
... props
2023-09-26 10:23:26 -04:00
} , ref ) {
2022-04-11 08:04:30 -04:00
return ( 0 , external _wp _element _namespaceObject . cloneElement ) ( icon , {
width : size ,
height : size ,
2023-09-26 10:23:26 -04:00
... props ,
ref
2022-04-11 08:04:30 -04:00
} ) ;
}
2024-01-31 07:59:56 -05:00
/* harmony default export */ const icon = ( ( 0 , external _wp _element _namespaceObject . forwardRef ) ( Icon ) ) ;
2020-06-26 09:33:47 -04:00
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/text-color.js
2021-11-08 09:29:21 -05:00
/ * *
* WordPress dependencies
* /
2024-05-31 14:59:00 -04:00
const textColor = /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . SVG , {
2021-11-08 09:29:21 -05:00
xmlns : "http://www.w3.org/2000/svg" ,
2024-05-31 14:59:00 -04:00
viewBox : "0 0 24 24" ,
children : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . Path , {
d : "M12.9 6h-2l-4 11h1.9l1.1-3h4.2l1.1 3h1.9L12.9 6zm-2.5 6.5l1.5-4.9 1.7 4.9h-3.2z"
} )
} ) ;
2024-01-31 07:59:56 -05:00
/* harmony default export */ const text _color = ( textColor ) ;
2020-02-10 17:33:27 -05:00
2023-02-07 02:04:52 -05:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/color.js
/ * *
* WordPress dependencies
* /
2024-05-31 14:59:00 -04:00
const color = /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . SVG , {
2023-02-07 02:04:52 -05:00
viewBox : "0 0 24 24" ,
2024-05-31 14:59:00 -04:00
xmlns : "http://www.w3.org/2000/svg" ,
children : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . Path , {
d : "M17.2 10.9c-.5-1-1.2-2.1-2.1-3.2-.6-.9-1.3-1.7-2.1-2.6L12 4l-1 1.1c-.6.9-1.3 1.7-2 2.6-.8 1.2-1.5 2.3-2 3.2-.6 1.2-1 2.2-1 3 0 3.4 2.7 6.1 6.1 6.1s6.1-2.7 6.1-6.1c0-.8-.3-1.8-1-3zm-5.1 7.6c-2.5 0-4.6-2.1-4.6-4.6 0-.3.1-1 .8-2.3.5-.9 1.1-1.9 2-3.1.7-.9 1.3-1.7 1.8-2.3.7.8 1.3 1.6 1.8 2.3.8 1.1 1.5 2.2 2 3.1.7 1.3.8 2 .8 2.3 0 2.5-2.1 4.6-4.6 4.6z"
} )
} ) ;
2024-01-31 07:59:56 -05:00
/* harmony default export */ const library _color = ( color ) ;
2023-02-07 02:04:52 -05:00
Editor: Update the WordPress packages to the Gutenberg 16.7 RC2 version.
This patch, somewhat small brings a lot to WordPress.
This includes features like:
- DataViews.
- Customization tools like box shadow, background size and repeat.
- UI improvements in the site editor.
- Preferences sharing between the post and site editors.
- Unified panels and editors between post and site editors.
- Improved template mode in the post editor.
- Iterations to multiple interactive blocks.
- Preparing the blocks and UI for pattern overrides.
- and a lot more.
Props luisherranz, gziolo, isabel_brison, costdev, jonsurrell, peterwilsoncc, get_dave, antonvlasenko, desrosj.
See #60315.
Built from https://develop.svn.wordpress.org/trunk@57377
git-svn-id: http://core.svn.wordpress.org/trunk@56883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-29 16:07:12 -05:00
; // CONCATENATED MODULE: external ["wp","privateApis"]
2024-01-31 07:59:56 -05:00
const external _wp _privateApis _namespaceObject = window [ "wp" ] [ "privateApis" ] ;
Editor: Update the WordPress packages to the Gutenberg 16.7 RC2 version.
This patch, somewhat small brings a lot to WordPress.
This includes features like:
- DataViews.
- Customization tools like box shadow, background size and repeat.
- UI improvements in the site editor.
- Preferences sharing between the post and site editors.
- Unified panels and editors between post and site editors.
- Improved template mode in the post editor.
- Iterations to multiple interactive blocks.
- Preparing the blocks and UI for pattern overrides.
- and a lot more.
Props luisherranz, gziolo, isabel_brison, costdev, jonsurrell, peterwilsoncc, get_dave, antonvlasenko, desrosj.
See #60315.
Built from https://develop.svn.wordpress.org/trunk@57377
git-svn-id: http://core.svn.wordpress.org/trunk@56883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-29 16:07:12 -05:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/lock-unlock.js
/ * *
* WordPress dependencies
* /
const {
lock ,
unlock
} = ( 0 , external _wp _privateApis _namespaceObject . _ _dangerousOptInToUnstableAPIsOnlyForCoreModules ) ( 'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.' , '@wordpress/format-library' ) ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/text-color/inline.js
2020-02-10 17:33:27 -05:00
/ * *
* WordPress dependencies
* /
2021-11-08 09:29:21 -05:00
2023-09-26 10:23:26 -04:00
2021-01-27 21:04:13 -05:00
/ * *
* Internal dependencies
* /
Editor: Update the WordPress packages to the Gutenberg 16.7 RC2 version.
This patch, somewhat small brings a lot to WordPress.
This includes features like:
- DataViews.
- Customization tools like box shadow, background size and repeat.
- UI improvements in the site editor.
- Preferences sharing between the post and site editors.
- Unified panels and editors between post and site editors.
- Improved template mode in the post editor.
- Iterations to multiple interactive blocks.
- Preparing the blocks and UI for pattern overrides.
- and a lot more.
Props luisherranz, gziolo, isabel_brison, costdev, jonsurrell, peterwilsoncc, get_dave, antonvlasenko, desrosj.
See #60315.
Built from https://develop.svn.wordpress.org/trunk@57377
git-svn-id: http://core.svn.wordpress.org/trunk@56883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-29 16:07:12 -05:00
2024-05-31 14:59:00 -04:00
Editor: Update the WordPress packages to the Gutenberg 16.7 RC2 version.
This patch, somewhat small brings a lot to WordPress.
This includes features like:
- DataViews.
- Customization tools like box shadow, background size and repeat.
- UI improvements in the site editor.
- Preferences sharing between the post and site editors.
- Unified panels and editors between post and site editors.
- Improved template mode in the post editor.
- Iterations to multiple interactive blocks.
- Preparing the blocks and UI for pattern overrides.
- and a lot more.
Props luisherranz, gziolo, isabel_brison, costdev, jonsurrell, peterwilsoncc, get_dave, antonvlasenko, desrosj.
See #60315.
Built from https://develop.svn.wordpress.org/trunk@57377
git-svn-id: http://core.svn.wordpress.org/trunk@56883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-29 16:07:12 -05:00
const {
Tabs
} = unlock ( external _wp _components _namespaceObject . privateApis ) ;
const TABS = [ {
name : 'color' ,
title : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Text' )
} , {
name : 'backgroundColor' ,
title : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Background' )
} ] ;
2023-06-27 10:24:19 -04:00
function parseCSS ( css = '' ) {
2021-11-08 09:29:21 -05:00
return css . split ( ';' ) . reduce ( ( accumulator , rule ) => {
if ( rule ) {
const [ property , value ] = rule . split ( ':' ) ;
2024-05-23 15:39:28 -04:00
if ( property === 'color' ) {
accumulator . color = value ;
}
if ( property === 'background-color' && value !== transparentValue ) {
accumulator . backgroundColor = value ;
}
2021-11-08 09:29:21 -05:00
}
return accumulator ;
} , { } ) ;
}
2023-06-27 10:24:19 -04:00
function parseClassName ( className = '' , colorSettings ) {
2021-11-08 09:29:21 -05:00
return className . split ( ' ' ) . reduce ( ( accumulator , name ) => {
2021-12-13 20:57:26 -05:00
// `colorSlug` could contain dashes, so simply match the start and end.
if ( name . startsWith ( 'has-' ) && name . endsWith ( '-color' ) ) {
const colorSlug = name . replace ( /^has-/ , '' ) . replace ( /-color$/ , '' ) ;
2022-04-11 08:04:30 -04:00
const colorObject = ( 0 , external _wp _blockEditor _namespaceObject . getColorObjectByAttributeValues ) ( colorSettings , colorSlug ) ;
2021-11-08 09:29:21 -05:00
accumulator . color = colorObject . color ;
}
return accumulator ;
} , { } ) ;
}
function getActiveColors ( value , name , colorSettings ) {
2022-04-11 08:04:30 -04:00
const activeColorFormat = ( 0 , external _wp _richText _namespaceObject . getActiveFormat ) ( value , name ) ;
2020-02-10 17:33:27 -05:00
if ( ! activeColorFormat ) {
2021-11-08 09:29:21 -05:00
return { } ;
2020-02-10 17:33:27 -05:00
}
2023-09-26 10:23:26 -04:00
return {
... parseCSS ( activeColorFormat . attributes . style ) ,
2021-11-08 09:29:21 -05:00
... parseClassName ( activeColorFormat . attributes . class , colorSettings )
} ;
}
function setColors ( value , name , colorSettings , colors ) {
const {
color ,
backgroundColor
2023-09-26 10:23:26 -04:00
} = {
... getActiveColors ( value , name , colorSettings ) ,
2021-11-08 09:29:21 -05:00
... colors
} ;
if ( ! color && ! backgroundColor ) {
2022-04-11 08:04:30 -04:00
return ( 0 , external _wp _richText _namespaceObject . removeFormat ) ( value , name ) ;
2021-11-08 09:29:21 -05:00
}
const styles = [ ] ;
const classNames = [ ] ;
const attributes = { } ;
if ( backgroundColor ) {
styles . push ( [ 'background-color' , backgroundColor ] . join ( ':' ) ) ;
} else {
// Override default browser color for mark element.
2021-12-13 20:57:26 -05:00
styles . push ( [ 'background-color' , transparentValue ] . join ( ':' ) ) ;
2020-02-10 17:33:27 -05:00
}
2021-11-08 09:29:21 -05:00
if ( color ) {
2022-04-11 08:04:30 -04:00
const colorObject = ( 0 , external _wp _blockEditor _namespaceObject . getColorObjectByColorValue ) ( colorSettings , color ) ;
2021-11-08 09:29:21 -05:00
if ( colorObject ) {
2022-04-11 08:04:30 -04:00
classNames . push ( ( 0 , external _wp _blockEditor _namespaceObject . getColorClassName ) ( 'color' , colorObject . slug ) ) ;
2021-11-08 09:29:21 -05:00
} else {
styles . push ( [ 'color' , color ] . join ( ':' ) ) ;
}
2020-02-10 17:33:27 -05:00
}
2024-05-23 15:39:28 -04:00
if ( styles . length ) {
attributes . style = styles . join ( ';' ) ;
}
if ( classNames . length ) {
attributes . class = classNames . join ( ' ' ) ;
}
2022-04-11 08:04:30 -04:00
return ( 0 , external _wp _richText _namespaceObject . applyFormat ) ( value , {
2021-11-08 09:29:21 -05:00
type : name ,
attributes
} ) ;
2020-02-10 17:33:27 -05:00
}
2023-06-27 10:24:19 -04:00
function ColorPicker ( {
name ,
property ,
value ,
onChange
} ) {
2022-04-11 08:04:30 -04:00
const colors = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => {
2022-09-20 11:43:29 -04:00
var _getSettings$colors ;
2021-05-19 11:09:27 -04:00
const {
getSettings
2022-04-11 08:04:30 -04:00
} = select ( external _wp _blockEditor _namespaceObject . store ) ;
2022-09-20 11:43:29 -04:00
return ( _getSettings$colors = getSettings ( ) . colors ) !== null && _getSettings$colors !== void 0 ? _getSettings$colors : [ ] ;
2021-11-08 09:29:21 -05:00
} , [ ] ) ;
2022-04-11 08:04:30 -04:00
const onColorChange = ( 0 , external _wp _element _namespaceObject . useCallback ) ( color => {
2021-11-08 09:29:21 -05:00
onChange ( setColors ( value , name , colors , {
[ property ] : color
} ) ) ;
} , [ colors , onChange , property ] ) ;
2022-04-11 08:04:30 -04:00
const activeColors = ( 0 , external _wp _element _namespaceObject . useMemo ) ( ( ) => getActiveColors ( value , name , colors ) , [ name , value , colors ] ) ;
2024-05-31 14:59:00 -04:00
return /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _blockEditor _namespaceObject . ColorPalette , {
2021-11-08 09:29:21 -05:00
value : activeColors [ property ] ,
2020-02-10 17:33:27 -05:00
onChange : onColorChange
} ) ;
2021-11-08 09:29:21 -05:00
}
2023-06-27 10:24:19 -04:00
function InlineColorUI ( {
name ,
value ,
onChange ,
onClose ,
2024-02-13 08:12:17 -05:00
contentRef ,
isActive
2023-06-27 10:24:19 -04:00
} ) {
Update npm packages to latest.
The npm packages needed a further update for beta 2 in preparation for 6.4.
Props @mmaattiiaass , @wildworks , @aaronrobertshaw, @bartkalisz, @mamaduka, @artemiosans, @youknowriad, @czapla, @richtabor, @glendaviesnz, @pbking, @cbravobernal, @madhudollu, @kevin940726, @adamsilverstein, @get_dave, @ntsekouras, @ramonopoly, @jffng, @swissspidy, @carlosgprim, @siobhyb, @mikachan.
See #59411.
Built from https://develop.svn.wordpress.org/trunk@56755
git-svn-id: http://core.svn.wordpress.org/trunk@56267 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-02 14:58:22 -04:00
const popoverAnchor = ( 0 , external _wp _richText _namespaceObject . useAnchor ) ( {
editableContentElement : contentRef . current ,
2024-02-13 08:12:17 -05:00
settings : {
... text _color _textColor ,
isActive
}
Update npm packages to latest.
The npm packages needed a further update for beta 2 in preparation for 6.4.
Props @mmaattiiaass , @wildworks , @aaronrobertshaw, @bartkalisz, @mamaduka, @artemiosans, @youknowriad, @czapla, @richtabor, @glendaviesnz, @pbking, @cbravobernal, @madhudollu, @kevin940726, @adamsilverstein, @get_dave, @ntsekouras, @ramonopoly, @jffng, @swissspidy, @carlosgprim, @siobhyb, @mikachan.
See #59411.
Built from https://develop.svn.wordpress.org/trunk@56755
git-svn-id: http://core.svn.wordpress.org/trunk@56267 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-02 14:58:22 -04:00
} ) ;
2024-05-31 14:59:00 -04:00
return /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _components _namespaceObject . Popover , {
2020-02-10 17:33:27 -05:00
onClose : onClose ,
Editor: Update the WordPress packages to the Gutenberg 16.7 RC2 version.
This patch, somewhat small brings a lot to WordPress.
This includes features like:
- DataViews.
- Customization tools like box shadow, background size and repeat.
- UI improvements in the site editor.
- Preferences sharing between the post and site editors.
- Unified panels and editors between post and site editors.
- Improved template mode in the post editor.
- Iterations to multiple interactive blocks.
- Preparing the blocks and UI for pattern overrides.
- and a lot more.
Props luisherranz, gziolo, isabel_brison, costdev, jonsurrell, peterwilsoncc, get_dave, antonvlasenko, desrosj.
See #60315.
Built from https://develop.svn.wordpress.org/trunk@57377
git-svn-id: http://core.svn.wordpress.org/trunk@56883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-29 16:07:12 -05:00
className : "format-library__inline-color-popover" ,
2024-05-31 14:59:00 -04:00
anchor : popoverAnchor ,
children : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( Tabs , {
children : [ /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( Tabs . TabList , {
children : TABS . map ( tab => /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( Tabs . Tab , {
tabId : tab . name ,
children : tab . title
} , tab . name ) )
} ) , TABS . map ( tab => /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( Tabs . TabPanel , {
tabId : tab . name ,
focusable : false ,
children : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( ColorPicker , {
name : name ,
property : tab . name ,
value : value ,
onChange : onChange
} )
} , tab . name ) ) ]
} )
} ) ;
2020-10-20 09:36:16 -04:00
}
2020-02-10 17:33:27 -05:00
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/text-color/index.js
2020-02-10 17:33:27 -05:00
/ * *
* WordPress dependencies
* /
2023-09-26 10:23:26 -04:00
2020-02-10 17:33:27 -05:00
/ * *
* Internal dependencies
* /
2024-05-31 14:59:00 -04:00
2021-12-13 20:57:26 -05:00
const transparentValue = 'rgba(0, 0, 0, 0)' ;
2021-05-19 11:09:27 -04:00
const text _color _name = 'core/text-color' ;
2022-04-11 08:04:30 -04:00
const text _color _title = ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Highlight' ) ;
2021-05-19 11:09:27 -04:00
const EMPTY _ARRAY = [ ] ;
2021-11-08 09:29:21 -05:00
function getComputedStyleProperty ( element , property ) {
const {
ownerDocument
} = element ;
const {
defaultView
} = ownerDocument ;
const style = defaultView . getComputedStyle ( element ) ;
const value = style . getPropertyValue ( property ) ;
2021-12-13 20:57:26 -05:00
if ( property === 'background-color' && value === transparentValue && element . parentElement ) {
2021-11-08 09:29:21 -05:00
return getComputedStyleProperty ( element . parentElement , property ) ;
}
return value ;
}
2023-06-27 10:24:19 -04:00
function fillComputedColors ( element , {
color ,
backgroundColor
} ) {
2021-11-08 09:29:21 -05:00
if ( ! color && ! backgroundColor ) {
return ;
}
return {
color : color || getComputedStyleProperty ( element , 'color' ) ,
2021-12-13 20:57:26 -05:00
backgroundColor : backgroundColor === transparentValue ? getComputedStyleProperty ( element , 'background-color' ) : backgroundColor
2021-11-08 09:29:21 -05:00
} ;
}
2023-06-27 10:24:19 -04:00
function TextColorEdit ( {
value ,
onChange ,
isActive ,
activeAttributes ,
contentRef
} ) {
Editor: Update the WordPress packages to the Gutenberg 16.7 RC2 version.
This patch, somewhat small brings a lot to WordPress.
This includes features like:
- DataViews.
- Customization tools like box shadow, background size and repeat.
- UI improvements in the site editor.
- Preferences sharing between the post and site editors.
- Unified panels and editors between post and site editors.
- Improved template mode in the post editor.
- Iterations to multiple interactive blocks.
- Preparing the blocks and UI for pattern overrides.
- and a lot more.
Props luisherranz, gziolo, isabel_brison, costdev, jonsurrell, peterwilsoncc, get_dave, antonvlasenko, desrosj.
See #60315.
Built from https://develop.svn.wordpress.org/trunk@57377
git-svn-id: http://core.svn.wordpress.org/trunk@56883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-29 16:07:12 -05:00
const [ allowCustomControl , colors = EMPTY _ARRAY ] = ( 0 , external _wp _blockEditor _namespaceObject . useSettings ) ( 'color.custom' , 'color.palette' ) ;
2022-04-11 08:04:30 -04:00
const [ isAddingColor , setIsAddingColor ] = ( 0 , external _wp _element _namespaceObject . useState ) ( false ) ;
const enableIsAddingColor = ( 0 , external _wp _element _namespaceObject . useCallback ) ( ( ) => setIsAddingColor ( true ) , [ setIsAddingColor ] ) ;
const disableIsAddingColor = ( 0 , external _wp _element _namespaceObject . useCallback ) ( ( ) => setIsAddingColor ( false ) , [ setIsAddingColor ] ) ;
const colorIndicatorStyle = ( 0 , external _wp _element _namespaceObject . useMemo ) ( ( ) => fillComputedColors ( contentRef . current , getActiveColors ( value , text _color _name , colors ) ) , [ value , colors ] ) ;
2022-09-20 11:43:29 -04:00
const hasColorsToChoose = colors . length || ! allowCustomControl ;
2020-02-17 18:02:14 -05:00
if ( ! hasColorsToChoose && ! isActive ) {
return null ;
}
2024-05-31 14:59:00 -04:00
return /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( external _ReactJSXRuntime _namespaceObject . Fragment , {
children : [ /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _blockEditor _namespaceObject . RichTextToolbarButton , {
className : "format-library-text-color-button" ,
isActive : isActive ,
icon : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( icon , {
icon : Object . keys ( activeAttributes ) . length ? text _color : library _color ,
style : colorIndicatorStyle
} ) ,
title : text _color _title
// If has no colors to choose but a color is active remove the color onClick.
,
onClick : hasColorsToChoose ? enableIsAddingColor : ( ) => onChange ( ( 0 , external _wp _richText _namespaceObject . removeFormat ) ( value , text _color _name ) ) ,
role : "menuitemcheckbox"
} ) , isAddingColor && /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( InlineColorUI , {
name : text _color _name ,
onClose : disableIsAddingColor ,
activeAttributes : activeAttributes ,
value : value ,
onChange : onChange ,
contentRef : contentRef ,
isActive : isActive
} ) ]
} ) ;
2020-02-10 17:33:27 -05:00
}
2021-11-08 09:29:21 -05:00
const text _color _textColor = {
2020-02-10 17:33:27 -05:00
name : text _color _name ,
title : text _color _title ,
2021-11-08 09:29:21 -05:00
tagName : 'mark' ,
2020-02-10 17:33:27 -05:00
className : 'has-inline-color' ,
attributes : {
style : 'style' ,
class : 'class'
} ,
edit : TextColorEdit
} ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/subscript.js
2021-05-21 06:14:23 -04:00
/ * *
* WordPress dependencies
* /
2024-05-31 14:59:00 -04:00
const subscript = /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . SVG , {
2021-05-21 06:14:23 -04:00
xmlns : "http://www.w3.org/2000/svg" ,
2024-05-31 14:59:00 -04:00
viewBox : "0 0 24 24" ,
children : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . Path , {
d : "M16.9 18.3l.8-1.2c.4-.6.7-1.2.9-1.6.2-.4.3-.8.3-1.2 0-.3-.1-.7-.2-1-.1-.3-.4-.5-.6-.7-.3-.2-.6-.3-1-.3s-.8.1-1.1.2c-.3.1-.7.3-1 .6l.2 1.3c.3-.3.5-.5.8-.6s.6-.2.9-.2c.3 0 .5.1.7.2.2.2.2.4.2.7 0 .3-.1.5-.2.8-.1.3-.4.7-.8 1.3L15 19.4h4.3v-1.2h-2.4zM14.1 7.2h-2L9.5 11 6.9 7.2h-2l3.6 5.3L4.7 18h2l2.7-4 2.7 4h2l-3.8-5.5 3.8-5.3z"
} )
} ) ;
2024-01-31 07:59:56 -05:00
/* harmony default export */ const library _subscript = ( subscript ) ;
2020-06-26 09:33:47 -04:00
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/subscript/index.js
2020-06-26 09:33:47 -04:00
/ * *
* WordPress dependencies
* /
2024-05-31 14:59:00 -04:00
2021-05-19 11:09:27 -04:00
const subscript _name = 'core/subscript' ;
2022-04-11 08:04:30 -04:00
const subscript _title = ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Subscript' ) ;
2021-05-19 11:09:27 -04:00
const subscript _subscript = {
2020-06-26 09:33:47 -04:00
name : subscript _name ,
title : subscript _title ,
tagName : 'sub' ,
className : null ,
2023-06-27 10:24:19 -04:00
edit ( {
isActive ,
value ,
onChange ,
onFocus
} ) {
2020-06-26 09:33:47 -04:00
function onToggle ( ) {
2022-04-11 08:04:30 -04:00
onChange ( ( 0 , external _wp _richText _namespaceObject . toggleFormat ) ( value , {
2021-11-08 09:29:21 -05:00
type : subscript _name ,
title : subscript _title
2020-06-26 09:33:47 -04:00
} ) ) ;
}
function onClick ( ) {
onToggle ( ) ;
onFocus ( ) ;
}
2024-05-31 14:59:00 -04:00
return /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _blockEditor _namespaceObject . RichTextToolbarButton , {
2021-05-21 06:14:23 -04:00
icon : library _subscript ,
2020-06-26 09:33:47 -04:00
title : subscript _title ,
onClick : onClick ,
2021-11-08 09:29:21 -05:00
isActive : isActive ,
role : "menuitemcheckbox"
2020-06-26 09:33:47 -04:00
} ) ;
}
2021-05-19 11:09:27 -04:00
} ;
2020-06-26 09:33:47 -04:00
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/superscript.js
2021-05-21 06:14:23 -04:00
/ * *
* WordPress dependencies
* /
2024-05-31 14:59:00 -04:00
const superscript = /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . SVG , {
2021-05-21 06:14:23 -04:00
xmlns : "http://www.w3.org/2000/svg" ,
2024-05-31 14:59:00 -04:00
viewBox : "0 0 24 24" ,
children : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . Path , {
d : "M16.9 10.3l.8-1.3c.4-.6.7-1.2.9-1.6.2-.4.3-.8.3-1.2 0-.3-.1-.7-.2-1-.2-.2-.4-.4-.7-.6-.3-.2-.6-.3-1-.3s-.8.1-1.1.2c-.3.1-.7.3-1 .6l.1 1.3c.3-.3.5-.5.8-.6s.6-.2.9-.2c.3 0 .5.1.7.2.2.2.2.4.2.7 0 .3-.1.5-.2.8-.1.3-.4.7-.8 1.3l-1.8 2.8h4.3v-1.2h-2.2zm-2.8-3.1h-2L9.5 11 6.9 7.2h-2l3.6 5.3L4.7 18h2l2.7-4 2.7 4h2l-3.8-5.5 3.8-5.3z"
} )
} ) ;
2024-01-31 07:59:56 -05:00
/* harmony default export */ const library _superscript = ( superscript ) ;
2020-06-26 09:33:47 -04:00
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/superscript/index.js
2020-06-26 09:33:47 -04:00
/ * *
* WordPress dependencies
* /
2024-05-31 14:59:00 -04:00
2021-05-19 11:09:27 -04:00
const superscript _name = 'core/superscript' ;
2022-04-11 08:04:30 -04:00
const superscript _title = ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Superscript' ) ;
2021-05-19 11:09:27 -04:00
const superscript _superscript = {
2020-06-26 09:33:47 -04:00
name : superscript _name ,
title : superscript _title ,
tagName : 'sup' ,
className : null ,
2023-06-27 10:24:19 -04:00
edit ( {
isActive ,
value ,
onChange ,
onFocus
} ) {
2020-06-26 09:33:47 -04:00
function onToggle ( ) {
2022-04-11 08:04:30 -04:00
onChange ( ( 0 , external _wp _richText _namespaceObject . toggleFormat ) ( value , {
2021-11-08 09:29:21 -05:00
type : superscript _name ,
title : superscript _title
2020-06-26 09:33:47 -04:00
} ) ) ;
}
function onClick ( ) {
onToggle ( ) ;
onFocus ( ) ;
}
2024-05-31 14:59:00 -04:00
return /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _blockEditor _namespaceObject . RichTextToolbarButton , {
2021-05-21 06:14:23 -04:00
icon : library _superscript ,
2020-06-26 09:33:47 -04:00
title : superscript _title ,
onClick : onClick ,
2021-11-08 09:29:21 -05:00
isActive : isActive ,
role : "menuitemcheckbox"
2020-06-26 09:33:47 -04:00
} ) ;
}
} ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/button.js
/ * *
* WordPress dependencies
* /
2024-05-31 14:59:00 -04:00
const button _button = /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . SVG , {
2022-04-11 08:04:30 -04:00
viewBox : "0 0 24 24" ,
2024-05-31 14:59:00 -04:00
xmlns : "http://www.w3.org/2000/svg" ,
children : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . Path , {
d : "M8 12.5h8V11H8v1.5Z M19 6.5H5a2 2 0 0 0-2 2V15a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8.5a2 2 0 0 0-2-2ZM5 8h14a.5.5 0 0 1 .5.5V15a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V8.5A.5.5 0 0 1 5 8Z"
} )
} ) ;
2024-01-31 07:59:56 -05:00
/* harmony default export */ const library _button = ( button _button ) ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/keyboard/index.js
2021-01-27 21:04:13 -05:00
/ * *
* WordPress dependencies
* /
2024-05-31 14:59:00 -04:00
2021-05-19 11:09:27 -04:00
const keyboard _name = 'core/keyboard' ;
2022-04-11 08:04:30 -04:00
const keyboard _title = ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Keyboard input' ) ;
2021-05-19 11:09:27 -04:00
const keyboard = {
2021-01-27 21:04:13 -05:00
name : keyboard _name ,
title : keyboard _title ,
tagName : 'kbd' ,
className : null ,
2023-06-27 10:24:19 -04:00
edit ( {
isActive ,
value ,
onChange ,
onFocus
} ) {
2021-01-27 21:04:13 -05:00
function onToggle ( ) {
2022-04-11 08:04:30 -04:00
onChange ( ( 0 , external _wp _richText _namespaceObject . toggleFormat ) ( value , {
2021-11-08 09:29:21 -05:00
type : keyboard _name ,
title : keyboard _title
2021-01-27 21:04:13 -05:00
} ) ) ;
}
function onClick ( ) {
onToggle ( ) ;
onFocus ( ) ;
}
2024-05-31 14:59:00 -04:00
return /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _blockEditor _namespaceObject . RichTextToolbarButton , {
2022-04-11 08:04:30 -04:00
icon : library _button ,
2021-01-27 21:04:13 -05:00
title : keyboard _title ,
onClick : onClick ,
2021-11-08 09:29:21 -05:00
isActive : isActive ,
role : "menuitemcheckbox"
2021-01-27 21:04:13 -05:00
} ) ;
}
} ;
2023-02-07 02:04:52 -05:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/help.js
/ * *
* WordPress dependencies
* /
2024-05-31 14:59:00 -04:00
const help = /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . SVG , {
2023-02-07 02:04:52 -05:00
xmlns : "http://www.w3.org/2000/svg" ,
2024-05-31 14:59:00 -04:00
viewBox : "0 0 24 24" ,
children : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . Path , {
d : "M12 4.75a7.25 7.25 0 100 14.5 7.25 7.25 0 000-14.5zM3.25 12a8.75 8.75 0 1117.5 0 8.75 8.75 0 01-17.5 0zM12 8.75a1.5 1.5 0 01.167 2.99c-.465.052-.917.44-.917 1.01V14h1.5v-.845A3 3 0 109 10.25h1.5a1.5 1.5 0 011.5-1.5zM11.25 15v1.5h1.5V15h-1.5z"
} )
} ) ;
2024-01-31 07:59:56 -05:00
/* harmony default export */ const library _help = ( help ) ;
2023-02-07 02:04:52 -05:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/unknown/index.js
/ * *
* WordPress dependencies
* /
2024-05-31 14:59:00 -04:00
2023-02-07 02:04:52 -05:00
const unknown _name = 'core/unknown' ;
const unknown _title = ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Clear Unknown Formatting' ) ;
2024-05-23 15:39:28 -04:00
function selectionContainsUnknownFormats ( value ) {
if ( ( 0 , external _wp _richText _namespaceObject . isCollapsed ) ( value ) ) {
return false ;
}
const selectedValue = ( 0 , external _wp _richText _namespaceObject . slice ) ( value ) ;
return selectedValue . formats . some ( formats => {
return formats . some ( format => format . type === unknown _name ) ;
} ) ;
}
2023-02-07 02:04:52 -05:00
const unknown = {
name : unknown _name ,
title : unknown _title ,
tagName : '*' ,
className : null ,
2023-06-27 10:24:19 -04:00
edit ( {
isActive ,
value ,
onChange ,
onFocus
} ) {
2024-05-23 15:39:28 -04:00
if ( ! isActive && ! selectionContainsUnknownFormats ( value ) ) {
return null ;
}
2023-02-07 02:04:52 -05:00
function onClick ( ) {
onChange ( ( 0 , external _wp _richText _namespaceObject . removeFormat ) ( value , unknown _name ) ) ;
onFocus ( ) ;
}
2024-05-31 14:59:00 -04:00
return /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _blockEditor _namespaceObject . RichTextToolbarButton , {
2023-02-07 02:04:52 -05:00
name : "unknown" ,
icon : library _help ,
title : unknown _title ,
onClick : onClick ,
isActive : true
} ) ;
}
} ;
2023-06-27 10:24:19 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/language.js
/ * *
* WordPress dependencies
* /
2024-05-31 14:59:00 -04:00
const language = /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . SVG , {
2023-06-27 10:24:19 -04:00
xmlns : "http://www.w3.org/2000/svg" ,
2024-05-31 14:59:00 -04:00
viewBox : "0 0 24 24" ,
children : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . Path , {
d : "M17.5 10h-1.7l-3.7 10.5h1.7l.9-2.6h3.9l.9 2.6h1.7L17.5 10zm-2.2 6.3 1.4-4 1.4 4h-2.8zm-4.8-3.8c1.6-1.8 2.9-3.6 3.7-5.7H16V5.2h-5.8V3H8.8v2.2H3v1.5h9.6c-.7 1.6-1.8 3.1-3.1 4.6C8.6 10.2 7.8 9 7.2 8H5.6c.6 1.4 1.7 2.9 2.9 4.4l-2.4 2.4c-.3.4-.7.8-1.1 1.2l1 1 1.2-1.2c.8-.8 1.6-1.5 2.3-2.3.8.9 1.7 1.7 2.5 2.5l.6-1.5c-.7-.6-1.4-1.3-2.1-2z"
} )
} ) ;
2024-01-31 07:59:56 -05:00
/* harmony default export */ const library _language = ( language ) ;
2023-06-27 10:24:19 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/language/index.js
/ * *
* WordPress dependencies
* /
2023-09-26 10:23:26 -04:00
2023-06-27 10:24:19 -04:00
/ * *
* WordPress dependencies
* /
2024-05-31 14:59:00 -04:00
2023-06-27 10:24:19 -04:00
const language _name = 'core/language' ;
const language _title = ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Language' ) ;
const language _language = {
name : language _name ,
tagName : 'bdo' ,
className : null ,
edit : language _Edit ,
title : language _title
} ;
function language _Edit ( {
isActive ,
value ,
onChange ,
contentRef
} ) {
const [ isPopoverVisible , setIsPopoverVisible ] = ( 0 , external _wp _element _namespaceObject . useState ) ( false ) ;
const togglePopover = ( ) => {
setIsPopoverVisible ( state => ! state ) ;
} ;
2024-05-31 14:59:00 -04:00
return /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( external _ReactJSXRuntime _namespaceObject . Fragment , {
children : [ /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _blockEditor _namespaceObject . RichTextToolbarButton , {
icon : library _language ,
label : language _title ,
title : language _title ,
onClick : ( ) => {
if ( isActive ) {
onChange ( ( 0 , external _wp _richText _namespaceObject . removeFormat ) ( value , language _name ) ) ;
} else {
togglePopover ( ) ;
}
} ,
isActive : isActive ,
role : "menuitemcheckbox"
} ) , isPopoverVisible && /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( InlineLanguageUI , {
value : value ,
onChange : onChange ,
onClose : togglePopover ,
contentRef : contentRef
} ) ]
} ) ;
2023-06-27 10:24:19 -04:00
}
function InlineLanguageUI ( {
value ,
contentRef ,
onChange ,
onClose
} ) {
const popoverAnchor = ( 0 , external _wp _richText _namespaceObject . useAnchor ) ( {
editableContentElement : contentRef . current ,
settings : language _language
} ) ;
const [ lang , setLang ] = ( 0 , external _wp _element _namespaceObject . useState ) ( '' ) ;
const [ dir , setDir ] = ( 0 , external _wp _element _namespaceObject . useState ) ( 'ltr' ) ;
2024-05-31 14:59:00 -04:00
return /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _components _namespaceObject . Popover , {
2023-06-27 10:24:19 -04:00
className : "block-editor-format-toolbar__language-popover" ,
anchor : popoverAnchor ,
2024-05-31 14:59:00 -04:00
onClose : onClose ,
children : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( "form" , {
className : "block-editor-format-toolbar__language-container-content" ,
onSubmit : event => {
event . preventDefault ( ) ;
onChange ( ( 0 , external _wp _richText _namespaceObject . applyFormat ) ( value , {
type : language _name ,
attributes : {
lang ,
dir
}
} ) ) ;
onClose ( ) ;
} ,
children : [ /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _components _namespaceObject . TextControl , {
label : language _title ,
value : lang ,
onChange : val => setLang ( val ) ,
help : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'A valid language attribute, like "en" or "fr".' )
} ) , /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _components _namespaceObject . SelectControl , {
label : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Text direction' ) ,
value : dir ,
options : [ {
label : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Left to right' ) ,
value : 'ltr'
} , {
label : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Right to left' ) ,
value : 'rtl'
} ] ,
onChange : val => setDir ( val )
} ) , /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _components _namespaceObject . _ _experimentalHStack , {
alignment : "right" ,
children : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _components _namespaceObject . Button , {
variant : "primary" ,
type : "submit" ,
text : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Apply' )
} )
} ) ]
} )
} ) ;
2023-06-27 10:24:19 -04:00
}
2024-05-23 15:39:28 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/non-breaking-space/index.js
/ * *
* WordPress dependencies
* /
2024-05-31 14:59:00 -04:00
2024-05-23 15:39:28 -04:00
const non _breaking _space _name = 'core/non-breaking-space' ;
const non _breaking _space _title = ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Non breaking space' ) ;
const nonBreakingSpace = {
name : non _breaking _space _name ,
title : non _breaking _space _title ,
tagName : 'nbsp' ,
className : null ,
edit ( {
value ,
onChange
} ) {
function addNonBreakingSpace ( ) {
onChange ( ( 0 , external _wp _richText _namespaceObject . insert ) ( value , '\u00a0' ) ) ;
}
2024-05-31 14:59:00 -04:00
return /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _blockEditor _namespaceObject . RichTextShortcut , {
2024-05-23 15:39:28 -04:00
type : "primaryShift" ,
character : " " ,
onUse : addNonBreakingSpace
} ) ;
}
} ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/default-formats.js
2018-12-17 22:14:52 -05:00
/ * *
* Internal dependencies
* /
2018-12-16 23:52:00 -05:00
2019-03-07 04:09:59 -05:00
2020-02-10 17:33:27 -05:00
2020-06-26 09:33:47 -04:00
2021-01-27 21:04:13 -05:00
2023-02-07 02:04:52 -05:00
2023-06-27 10:24:19 -04:00
2024-05-23 15:39:28 -04:00
/* harmony default export */ const default _formats = ( [ bold , code _code , image _image , italic , build _module _link _link , strikethrough , underline , text _color _textColor , subscript _subscript , superscript _superscript , keyboard , unknown , language _language , nonBreakingSpace ] ) ;
2019-03-07 04:09:59 -05:00
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/index.js
2018-12-17 22:14:52 -05:00
/ * *
* WordPress dependencies
* /
2018-12-16 23:52:00 -05:00
2023-09-26 10:23:26 -04:00
2019-03-07 04:09:59 -05:00
/ * *
* Internal dependencies
* /
2018-12-16 23:52:00 -05:00
2023-06-27 10:24:19 -04:00
default _formats . forEach ( ( {
name ,
... settings
} ) => ( 0 , external _wp _richText _namespaceObject . registerFormatType ) ( name , settings ) ) ;
2018-12-16 23:52:00 -05:00
2022-04-11 08:04:30 -04:00
( window . wp = window . wp || { } ) . formatLibrary = _ _webpack _exports _ _ ;
/******/ } ) ( )
;