@wordpress/format-library 4.31.0 → 4.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/bold/index.js.map +1 -1
  3. package/build/code/index.js.map +1 -1
  4. package/build/default-formats.js.map +1 -1
  5. package/build/default-formats.native.js.map +1 -1
  6. package/build/image/index.js.map +1 -1
  7. package/build/index.js.map +1 -1
  8. package/build/italic/index.js.map +1 -1
  9. package/build/keyboard/index.js.map +1 -1
  10. package/build/language/index.js.map +1 -1
  11. package/build/link/index.js +23 -42
  12. package/build/link/index.js.map +1 -1
  13. package/build/link/index.native.js.map +1 -1
  14. package/build/link/inline.js +2 -1
  15. package/build/link/inline.js.map +1 -1
  16. package/build/link/modal-screens/link-picker-screen.native.js.map +1 -1
  17. package/build/link/modal-screens/link-settings-screen.native.js.map +1 -1
  18. package/build/link/modal-screens/screens.native.js.map +1 -1
  19. package/build/link/modal.native.js.map +1 -1
  20. package/build/link/use-link-instance-key.js.map +1 -1
  21. package/build/link/utils.js.map +1 -1
  22. package/build/lock-unlock.js.map +1 -1
  23. package/build/non-breaking-space/index.js.map +1 -1
  24. package/build/strikethrough/index.js.map +1 -1
  25. package/build/subscript/index.js.map +1 -1
  26. package/build/superscript/index.js.map +1 -1
  27. package/build/text-color/index.js +1 -1
  28. package/build/text-color/index.js.map +1 -1
  29. package/build/text-color/index.native.js +4 -4
  30. package/build/text-color/index.native.js.map +1 -1
  31. package/build/text-color/inline.js.map +1 -1
  32. package/build/text-color/inline.native.js +17 -38
  33. package/build/text-color/inline.native.js.map +1 -1
  34. package/build/underline/index.js.map +1 -1
  35. package/build/unknown/index.js +12 -7
  36. package/build/unknown/index.js.map +1 -1
  37. package/build-module/bold/index.js.map +1 -1
  38. package/build-module/code/index.js.map +1 -1
  39. package/build-module/default-formats.js.map +1 -1
  40. package/build-module/default-formats.native.js.map +1 -1
  41. package/build-module/image/index.js.map +1 -1
  42. package/build-module/index.js.map +1 -1
  43. package/build-module/italic/index.js.map +1 -1
  44. package/build-module/keyboard/index.js.map +1 -1
  45. package/build-module/language/index.js.map +1 -1
  46. package/build-module/link/index.js +23 -42
  47. package/build-module/link/index.js.map +1 -1
  48. package/build-module/link/index.native.js.map +1 -1
  49. package/build-module/link/inline.js +2 -1
  50. package/build-module/link/inline.js.map +1 -1
  51. package/build-module/link/modal-screens/link-picker-screen.native.js.map +1 -1
  52. package/build-module/link/modal-screens/link-settings-screen.native.js.map +1 -1
  53. package/build-module/link/modal-screens/screens.native.js.map +1 -1
  54. package/build-module/link/modal.native.js.map +1 -1
  55. package/build-module/link/use-link-instance-key.js.map +1 -1
  56. package/build-module/link/utils.js.map +1 -1
  57. package/build-module/lock-unlock.js.map +1 -1
  58. package/build-module/non-breaking-space/index.js.map +1 -1
  59. package/build-module/strikethrough/index.js.map +1 -1
  60. package/build-module/subscript/index.js.map +1 -1
  61. package/build-module/superscript/index.js.map +1 -1
  62. package/build-module/text-color/index.js.map +1 -1
  63. package/build-module/text-color/index.native.js +1 -1
  64. package/build-module/text-color/index.native.js.map +1 -1
  65. package/build-module/text-color/inline.js.map +1 -1
  66. package/build-module/text-color/inline.native.js +17 -39
  67. package/build-module/text-color/inline.native.js.map +1 -1
  68. package/build-module/underline/index.js.map +1 -1
  69. package/build-module/unknown/index.js +13 -8
  70. package/build-module/unknown/index.js.map +1 -1
  71. package/build-style/style-rtl.css +1 -1
  72. package/build-style/style.css +1 -1
  73. package/package.json +14 -14
  74. package/src/link/index.js +25 -41
  75. package/src/link/inline.js +2 -1
  76. package/src/text-color/index.native.js +1 -1
  77. package/src/text-color/inline.native.js +27 -49
  78. package/src/text-color/test/__snapshots__/index.native.js.snap +0 -6
  79. package/src/text-color/test/index.native.js +4 -39
  80. package/src/unknown/index.js +16 -10
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_native","_element","_components","_screens","_interopRequireDefault","LinkPickerScreen","navigation","useNavigation","route","useRoute","navigateToLinkTimeoutRef","useRef","navigateBackTimeoutRef","onLinkPicked","url","title","Keyboard","dismiss","current","setTimeout","navigate","linkSettingsScreens","settings","inputValue","text","onCancel","goBack","useEffect","clearTimeout","params","useMemo","_react","createElement","LinkPicker","value","_default","exports","default"],"sources":["@wordpress/format-library/src/link/modal-screens/link-picker-screen.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { Keyboard } from 'react-native';\nimport { useNavigation, useRoute } from '@react-navigation/native';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, useMemo, useRef } from '@wordpress/element';\n\nimport { LinkPicker } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport linkSettingsScreens from './screens';\n\nconst LinkPickerScreen = () => {\n\tconst navigation = useNavigation();\n\tconst route = useRoute();\n\tconst navigateToLinkTimeoutRef = useRef( null );\n\tconst navigateBackTimeoutRef = useRef( null );\n\n\tconst onLinkPicked = ( { url, title } ) => {\n\t\tKeyboard.dismiss();\n\t\tnavigateToLinkTimeoutRef.current = setTimeout( () => {\n\t\t\tnavigation.navigate( linkSettingsScreens.settings, {\n\t\t\t\tinputValue: url,\n\t\t\t\ttext: title,\n\t\t\t} );\n\t\t}, 100 );\n\t};\n\n\tconst onCancel = () => {\n\t\tKeyboard.dismiss();\n\t\tnavigateBackTimeoutRef.current = setTimeout( () => {\n\t\t\tnavigation.goBack();\n\t\t}, 100 );\n\t};\n\n\tuseEffect( () => {\n\t\treturn () => {\n\t\t\tclearTimeout( navigateToLinkTimeoutRef.current );\n\t\t\tclearTimeout( navigateBackTimeoutRef.current );\n\t\t};\n\t}, [] );\n\n\tconst { inputValue } = route.params;\n\treturn useMemo( () => {\n\t\treturn (\n\t\t\t<LinkPicker\n\t\t\t\tvalue={ inputValue }\n\t\t\t\tonLinkPicked={ onLinkPicked }\n\t\t\t\tonCancel={ onCancel }\n\t\t\t/>\n\t\t);\n\t}, [ inputValue ] );\n};\n\nexport default LinkPickerScreen;\n"],"mappings":";;;;;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AAM;IAAEK;EAAW,CAAC,GAAGf,KAAK,CAACqB,MAAM;EACnC,OAAO,IAAAC,gBAAO,EAAE,MAAM;IACrB,OACC,IAAAC,MAAA,CAAAC,aAAA,EAAC9B,WAAA,CAAA+B,UAAU;MACVC,KAAK,EAAGX,UAAY;MACpBV,YAAY,EAAGA,YAAc;MAC7BY,QAAQ,EAAGA;IAAU,CACrB,CAAC;EAEJ,CAAC,EAAE,CAAEF,UAAU,CAAG,CAAC;AACpB,CAAC;AAAC,IAAAY,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEahC,gBAAgB"}
1
+ {"version":3,"names":["_reactNative","require","_native","_element","_components","_screens","_interopRequireDefault","LinkPickerScreen","navigation","useNavigation","route","useRoute","navigateToLinkTimeoutRef","useRef","navigateBackTimeoutRef","onLinkPicked","url","title","Keyboard","dismiss","current","setTimeout","navigate","linkSettingsScreens","settings","inputValue","text","onCancel","goBack","useEffect","clearTimeout","params","useMemo","_react","createElement","LinkPicker","value","_default","exports","default"],"sources":["@wordpress/format-library/src/link/modal-screens/link-picker-screen.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { Keyboard } from 'react-native';\nimport { useNavigation, useRoute } from '@react-navigation/native';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, useMemo, useRef } from '@wordpress/element';\n\nimport { LinkPicker } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport linkSettingsScreens from './screens';\n\nconst LinkPickerScreen = () => {\n\tconst navigation = useNavigation();\n\tconst route = useRoute();\n\tconst navigateToLinkTimeoutRef = useRef( null );\n\tconst navigateBackTimeoutRef = useRef( null );\n\n\tconst onLinkPicked = ( { url, title } ) => {\n\t\tKeyboard.dismiss();\n\t\tnavigateToLinkTimeoutRef.current = setTimeout( () => {\n\t\t\tnavigation.navigate( linkSettingsScreens.settings, {\n\t\t\t\tinputValue: url,\n\t\t\t\ttext: title,\n\t\t\t} );\n\t\t}, 100 );\n\t};\n\n\tconst onCancel = () => {\n\t\tKeyboard.dismiss();\n\t\tnavigateBackTimeoutRef.current = setTimeout( () => {\n\t\t\tnavigation.goBack();\n\t\t}, 100 );\n\t};\n\n\tuseEffect( () => {\n\t\treturn () => {\n\t\t\tclearTimeout( navigateToLinkTimeoutRef.current );\n\t\t\tclearTimeout( navigateBackTimeoutRef.current );\n\t\t};\n\t}, [] );\n\n\tconst { inputValue } = route.params;\n\treturn useMemo( () => {\n\t\treturn (\n\t\t\t<LinkPicker\n\t\t\t\tvalue={ inputValue }\n\t\t\t\tonLinkPicked={ onLinkPicked }\n\t\t\t\tonCancel={ onCancel }\n\t\t\t/>\n\t\t);\n\t}, [ inputValue ] );\n};\n\nexport default LinkPickerScreen;\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAKA,IAAAE,QAAA,GAAAF,OAAA;AAEA,IAAAG,WAAA,GAAAH,OAAA;AAKA,IAAAI,QAAA,GAAAC,sBAAA,CAAAL,OAAA;AAhBA;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;AACA;;AAGA,MAAMM,gBAAgB,GAAGA,CAAA,KAAM;EAC9B,MAAMC,UAAU,GAAG,IAAAC,qBAAa,EAAC,CAAC;EAClC,MAAMC,KAAK,GAAG,IAAAC,gBAAQ,EAAC,CAAC;EACxB,MAAMC,wBAAwB,GAAG,IAAAC,eAAM,EAAE,IAAK,CAAC;EAC/C,MAAMC,sBAAsB,GAAG,IAAAD,eAAM,EAAE,IAAK,CAAC;EAE7C,MAAME,YAAY,GAAGA,CAAE;IAAEC,GAAG;IAAEC;EAAM,CAAC,KAAM;IAC1CC,qBAAQ,CAACC,OAAO,CAAC,CAAC;IAClBP,wBAAwB,CAACQ,OAAO,GAAGC,UAAU,CAAE,MAAM;MACpDb,UAAU,CAACc,QAAQ,CAAEC,gBAAmB,CAACC,QAAQ,EAAE;QAClDC,UAAU,EAAET,GAAG;QACfU,IAAI,EAAET;MACP,CAAE,CAAC;IACJ,CAAC,EAAE,GAAI,CAAC;EACT,CAAC;EAED,MAAMU,QAAQ,GAAGA,CAAA,KAAM;IACtBT,qBAAQ,CAACC,OAAO,CAAC,CAAC;IAClBL,sBAAsB,CAACM,OAAO,GAAGC,UAAU,CAAE,MAAM;MAClDb,UAAU,CAACoB,MAAM,CAAC,CAAC;IACpB,CAAC,EAAE,GAAI,CAAC;EACT,CAAC;EAED,IAAAC,kBAAS,EAAE,MAAM;IAChB,OAAO,MAAM;MACZC,YAAY,CAAElB,wBAAwB,CAACQ,OAAQ,CAAC;MAChDU,YAAY,CAAEhB,sBAAsB,CAACM,OAAQ,CAAC;IAC/C,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAM;IAAEK;EAAW,CAAC,GAAGf,KAAK,CAACqB,MAAM;EACnC,OAAO,IAAAC,gBAAO,EAAE,MAAM;IACrB,OACC,IAAAC,MAAA,CAAAC,aAAA,EAAC9B,WAAA,CAAA+B,UAAU;MACVC,KAAK,EAAGX,UAAY;MACpBV,YAAY,EAAGA,YAAc;MAC7BY,QAAQ,EAAGA;IAAU,CACrB,CAAC;EAEJ,CAAC,EAAE,CAAEF,UAAU,CAAG,CAAC;AACpB,CAAC;AAAC,IAAAY,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEahC,gBAAgB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_native","require","_i18n","_element","_url","_components","_richText","_icons","_utils","_screens","_interopRequireDefault","_modal","LinkSettingsScreen","onRemove","onClose","onChange","speak","value","isActive","activeAttributes","isVisible","text","setText","useState","getTextContent","slice","opensInNewWindow","setOpensInNewWindows","target","linkValues","setLinkValues","isActiveLink","isRemovingLink","shouldEnableBottomSheetMaxHeight","onHandleClosingBottomSheet","listProps","useContext","BottomSheetContext","navigation","useNavigation","route","useRoute","inputValue","url","params","onLinkCellPressed","navigate","linkSettingsScreens","picker","useEffect","submit","skipStateUpdates","submitLink","shouldCloseBottomSheet","removeLink","clearFormat","activeFormats","prependHTTP","linkText","format","createLinkFormat","newAttributes","isCollapsed","toInsert","applyFormat","create","length","insert","start","end","textLength","needsSelectionUpdate","isValidHref","__","submitValue","unsubscribe","addListener","useMemo","shouldShowLinkOptions","_react","createElement","Fragment","BottomSheet","LinkCell","onPress","Cell","icon","textColor","label","placeholder","onChangeValue","onSubmit","separatorType","undefined","SwitchCell","external","onValueChange","labelStyle","styles","clearLinkButton","safeAreaBottomInset","_default","exports","default"],"sources":["@wordpress/format-library/src/link/modal-screens/link-settings-screen.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { useNavigation, useRoute } from '@react-navigation/native';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState, useContext, useEffect, useMemo } from '@wordpress/element';\nimport { prependHTTP } from '@wordpress/url';\nimport { BottomSheet, BottomSheetContext } from '@wordpress/components';\nimport {\n\tcreate,\n\tinsert,\n\tisCollapsed,\n\tapplyFormat,\n\tgetTextContent,\n\tslice,\n} from '@wordpress/rich-text';\nimport { external, textColor } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { createLinkFormat, isValidHref } from '../utils';\nimport linkSettingsScreens from './screens';\n\nimport styles from '../modal.scss';\n\nconst LinkSettingsScreen = ( {\n\tonRemove,\n\tonClose,\n\tonChange,\n\tspeak,\n\tvalue,\n\tisActive,\n\tactiveAttributes,\n\tisVisible,\n} ) => {\n\tconst [ text, setText ] = useState( getTextContent( slice( value ) ) );\n\tconst [ opensInNewWindow, setOpensInNewWindows ] = useState(\n\t\tactiveAttributes.target === '_blank'\n\t);\n\tconst [ linkValues, setLinkValues ] = useState( {\n\t\tisActiveLink: isActive,\n\t\tisRemovingLink: false,\n\t} );\n\n\tconst {\n\t\tshouldEnableBottomSheetMaxHeight,\n\t\tonHandleClosingBottomSheet,\n\t\tlistProps,\n\t} = useContext( BottomSheetContext );\n\n\tconst navigation = useNavigation();\n\tconst route = useRoute();\n\tconst { inputValue = activeAttributes.url || '' } = route.params || {};\n\tconst onLinkCellPressed = () => {\n\t\tshouldEnableBottomSheetMaxHeight( false );\n\t\tnavigation.navigate( linkSettingsScreens.picker, { inputValue } );\n\t};\n\tuseEffect( () => {\n\t\tonHandleClosingBottomSheet( () => {\n\t\t\tsubmit( inputValue, { skipStateUpdates: true } );\n\t\t} );\n\t}, [ inputValue, opensInNewWindow, text ] );\n\n\tuseEffect( () => {\n\t\tconst { isActiveLink, isRemovingLink } = linkValues;\n\t\tif ( !! inputValue && ! isActiveLink && isVisible ) {\n\t\t\tsubmitLink( { shouldCloseBottomSheet: false } );\n\t\t} else if (\n\t\t\t( ( inputValue === '' && isActiveLink ) || isRemovingLink ) &&\n\t\t\tisVisible\n\t\t) {\n\t\t\tremoveLink( { shouldCloseBottomSheet: false } );\n\t\t}\n\t}, [\n\t\tinputValue,\n\t\tisVisible,\n\t\tlinkValues.isActiveLink,\n\t\tlinkValues.isRemovingLink,\n\t] );\n\n\tconst clearFormat = ( { skipStateUpdates = false } = {} ) => {\n\t\tonChange( { ...value, activeFormats: [] } );\n\t\tif ( ! skipStateUpdates ) {\n\t\t\tsetLinkValues( { isActiveLink: false, isRemovingLink: true } );\n\t\t}\n\t};\n\n\tconst submitLink = ( {\n\t\tshouldCloseBottomSheet = true,\n\t\tskipStateUpdates = false,\n\t} = {} ) => {\n\t\tconst url = prependHTTP( inputValue );\n\t\tconst linkText = text || inputValue;\n\t\tconst format = createLinkFormat( {\n\t\t\turl,\n\t\t\topensInNewWindow,\n\t\t\ttext: linkText,\n\t\t} );\n\t\tlet newAttributes;\n\t\tif ( isCollapsed( value ) && ! isActive ) {\n\t\t\t// Insert link.\n\t\t\tconst toInsert = applyFormat(\n\t\t\t\tcreate( { text: linkText } ),\n\t\t\t\tformat,\n\t\t\t\t0,\n\t\t\t\tlinkText.length\n\t\t\t);\n\t\t\tnewAttributes = insert( value, toInsert );\n\t\t} else if ( text !== getTextContent( slice( value ) ) ) {\n\t\t\t// Edit text in selected link.\n\t\t\tconst toInsert = applyFormat(\n\t\t\t\tcreate( { text } ),\n\t\t\t\tformat,\n\t\t\t\t0,\n\t\t\t\ttext.length\n\t\t\t);\n\t\t\tnewAttributes = insert( value, toInsert, value.start, value.end );\n\t\t} else {\n\t\t\t// Transform selected text into link.\n\t\t\tnewAttributes = applyFormat( value, format );\n\t\t}\n\t\t// Move selection to end of link.\n\t\tconst textLength = newAttributes.text.length;\n\t\t// check for zero width spaces\n\t\tif ( newAttributes.end > textLength ) {\n\t\t\tnewAttributes.start = textLength;\n\t\t\tnewAttributes.end = textLength;\n\t\t} else {\n\t\t\tnewAttributes.start = newAttributes.end;\n\t\t}\n\t\tnewAttributes.activeFormats = [];\n\t\tonChange( { ...newAttributes, needsSelectionUpdate: true } );\n\t\tif ( ! skipStateUpdates ) {\n\t\t\tsetLinkValues( { isActiveLink: true, isRemovingLink: false } );\n\t\t}\n\n\t\tif ( ! isValidHref( url ) ) {\n\t\t\tspeak(\n\t\t\t\t__(\n\t\t\t\t\t'Warning: the link has been inserted but may have errors. Please test it.'\n\t\t\t\t),\n\t\t\t\t'assertive'\n\t\t\t);\n\t\t} else if ( isActive ) {\n\t\t\tspeak( __( 'Link edited.' ), 'assertive' );\n\t\t} else {\n\t\t\tspeak( __( 'Link inserted' ), 'assertive' );\n\t\t}\n\n\t\tif ( shouldCloseBottomSheet ) {\n\t\t\tonClose();\n\t\t}\n\t};\n\n\tconst removeLink = ( {\n\t\tshouldCloseBottomSheet = true,\n\t\tskipStateUpdates = false,\n\t} = {} ) => {\n\t\tclearFormat( { skipStateUpdates } );\n\t\tonRemove();\n\t\tif ( shouldCloseBottomSheet ) {\n\t\t\tonClose();\n\t\t}\n\t};\n\n\tconst submit = ( submitValue, { skipStateUpdates = false } = {} ) => {\n\t\tif ( submitValue === '' ) {\n\t\t\tremoveLink( { skipStateUpdates } );\n\t\t} else {\n\t\t\tsubmitLink( { skipStateUpdates } );\n\t\t}\n\t};\n\n\tuseEffect( () => {\n\t\tconst unsubscribe = navigation.addListener( 'focus', () => {\n\t\t\tconst { params = {} } = route;\n\t\t\tif ( ! text && params.text ) {\n\t\t\t\tsetText( params.text );\n\t\t\t}\n\t\t} );\n\t\treturn unsubscribe;\n\t}, [ navigation, route.params?.text, text ] );\n\n\treturn useMemo( () => {\n\t\tconst shouldShowLinkOptions = !! inputValue;\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BottomSheet.LinkCell\n\t\t\t\t\tvalue={ inputValue }\n\t\t\t\t\tonPress={ onLinkCellPressed }\n\t\t\t\t/>\n\t\t\t\t<BottomSheet.Cell\n\t\t\t\t\ticon={ textColor }\n\t\t\t\t\tlabel={ __( 'Link text' ) }\n\t\t\t\t\tvalue={ text }\n\t\t\t\t\tplaceholder={ __( 'Add link text' ) }\n\t\t\t\t\tonChangeValue={ setText }\n\t\t\t\t\tonSubmit={ submit }\n\t\t\t\t\tseparatorType={ shouldShowLinkOptions ? undefined : 'none' }\n\t\t\t\t/>\n\t\t\t\t{ shouldShowLinkOptions && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<BottomSheet.SwitchCell\n\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\tvalue={ opensInNewWindow }\n\t\t\t\t\t\t\tonValueChange={ setOpensInNewWindows }\n\t\t\t\t\t\t\tseparatorType={ 'fullWidth' }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BottomSheet.Cell\n\t\t\t\t\t\t\tlabel={ __( 'Remove link' ) }\n\t\t\t\t\t\t\tlabelStyle={ styles.clearLinkButton }\n\t\t\t\t\t\t\tseparatorType={ 'none' }\n\t\t\t\t\t\t\tonPress={ removeLink }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t}, [ inputValue, text, opensInNewWindow, listProps.safeAreaBottomInset ] );\n};\n\nexport default LinkSettingsScreen;\n"],"mappings":";;;;;;;;AAGA,IAAAA,OAAA,GAAAC,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MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAE,QAAA,QACC,IAAAF,MAAA,CAAAC,aAAA,EAAC3E,WAAA,CAAA6E,WAAW,CAACY,UAAU;MACtBR,IAAI,EAAGS,eAAU;MACjBP,KAAK,EAAG,IAAAf,QAAE,EAAE,iBAAkB,CAAG;MACjCxD,KAAK,EAAGS,gBAAkB;MAC1BsE,aAAa,EAAGrE,oBAAsB;MACtCiE,aAAa,EAAG;IAAa,CAC7B,CAAC,EACF,IAAAb,MAAA,CAAAC,aAAA,EAAC3E,WAAA,CAAA6E,WAAW,CAACG,IAAI;MAChBG,KAAK,EAAG,IAAAf,QAAE,EAAE,aAAc,CAAG;MAC7BwB,UAAU,EAAGC,cAAM,CAACC,eAAiB;MACrCP,aAAa,EAAG,MAAQ;MACxBR,OAAO,EAAG9B;IAAY,CACtB,CACA,CAEF,CAAC;EAEL,CAAC,EAAE,CAAEZ,UAAU,EAAErB,IAAI,EAAEK,gBAAgB,EAAES,SAAS,CAACiE,mBAAmB,CAAG,CAAC;AAC3E,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEa3F,kBAAkB"}
1
+ {"version":3,"names":["_native","require","_i18n","_element","_url","_components","_richText","_icons","_utils","_screens","_interopRequireDefault","_modal","LinkSettingsScreen","onRemove","onClose","onChange","speak","value","isActive","activeAttributes","isVisible","text","setText","useState","getTextContent","slice","opensInNewWindow","setOpensInNewWindows","target","linkValues","setLinkValues","isActiveLink","isRemovingLink","shouldEnableBottomSheetMaxHeight","onHandleClosingBottomSheet","listProps","useContext","BottomSheetContext","navigation","useNavigation","route","useRoute","inputValue","url","params","onLinkCellPressed","navigate","linkSettingsScreens","picker","useEffect","submit","skipStateUpdates","submitLink","shouldCloseBottomSheet","removeLink","clearFormat","activeFormats","prependHTTP","linkText","format","createLinkFormat","newAttributes","isCollapsed","toInsert","applyFormat","create","length","insert","start","end","textLength","needsSelectionUpdate","isValidHref","__","submitValue","unsubscribe","addListener","useMemo","shouldShowLinkOptions","_react","createElement","Fragment","BottomSheet","LinkCell","onPress","Cell","icon","textColor","label","placeholder","onChangeValue","onSubmit","separatorType","undefined","SwitchCell","external","onValueChange","labelStyle","styles","clearLinkButton","safeAreaBottomInset","_default","exports","default"],"sources":["@wordpress/format-library/src/link/modal-screens/link-settings-screen.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { useNavigation, useRoute } from '@react-navigation/native';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState, useContext, useEffect, useMemo } from '@wordpress/element';\nimport { prependHTTP } from '@wordpress/url';\nimport { BottomSheet, BottomSheetContext } from '@wordpress/components';\nimport {\n\tcreate,\n\tinsert,\n\tisCollapsed,\n\tapplyFormat,\n\tgetTextContent,\n\tslice,\n} from '@wordpress/rich-text';\nimport { external, textColor } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { createLinkFormat, isValidHref } from '../utils';\nimport linkSettingsScreens from './screens';\n\nimport styles from '../modal.scss';\n\nconst LinkSettingsScreen = ( {\n\tonRemove,\n\tonClose,\n\tonChange,\n\tspeak,\n\tvalue,\n\tisActive,\n\tactiveAttributes,\n\tisVisible,\n} ) => {\n\tconst [ text, setText ] = useState( getTextContent( slice( value ) ) );\n\tconst [ opensInNewWindow, setOpensInNewWindows ] = useState(\n\t\tactiveAttributes.target === '_blank'\n\t);\n\tconst [ linkValues, setLinkValues ] = useState( {\n\t\tisActiveLink: isActive,\n\t\tisRemovingLink: false,\n\t} );\n\n\tconst {\n\t\tshouldEnableBottomSheetMaxHeight,\n\t\tonHandleClosingBottomSheet,\n\t\tlistProps,\n\t} = useContext( BottomSheetContext );\n\n\tconst navigation = useNavigation();\n\tconst route = useRoute();\n\tconst { inputValue = activeAttributes.url || '' } = route.params || {};\n\tconst onLinkCellPressed = () => {\n\t\tshouldEnableBottomSheetMaxHeight( false );\n\t\tnavigation.navigate( linkSettingsScreens.picker, { inputValue } );\n\t};\n\tuseEffect( () => {\n\t\tonHandleClosingBottomSheet( () => {\n\t\t\tsubmit( inputValue, { skipStateUpdates: true } );\n\t\t} );\n\t}, [ inputValue, opensInNewWindow, text ] );\n\n\tuseEffect( () => {\n\t\tconst { isActiveLink, isRemovingLink } = linkValues;\n\t\tif ( !! inputValue && ! isActiveLink && isVisible ) {\n\t\t\tsubmitLink( { shouldCloseBottomSheet: false } );\n\t\t} else if (\n\t\t\t( ( inputValue === '' && isActiveLink ) || isRemovingLink ) &&\n\t\t\tisVisible\n\t\t) {\n\t\t\tremoveLink( { shouldCloseBottomSheet: false } );\n\t\t}\n\t}, [\n\t\tinputValue,\n\t\tisVisible,\n\t\tlinkValues.isActiveLink,\n\t\tlinkValues.isRemovingLink,\n\t] );\n\n\tconst clearFormat = ( { skipStateUpdates = false } = {} ) => {\n\t\tonChange( { ...value, activeFormats: [] } );\n\t\tif ( ! skipStateUpdates ) {\n\t\t\tsetLinkValues( { isActiveLink: false, isRemovingLink: true } );\n\t\t}\n\t};\n\n\tconst submitLink = ( {\n\t\tshouldCloseBottomSheet = true,\n\t\tskipStateUpdates = false,\n\t} = {} ) => {\n\t\tconst url = prependHTTP( inputValue );\n\t\tconst linkText = text || inputValue;\n\t\tconst format = createLinkFormat( {\n\t\t\turl,\n\t\t\topensInNewWindow,\n\t\t\ttext: linkText,\n\t\t} );\n\t\tlet newAttributes;\n\t\tif ( isCollapsed( value ) && ! isActive ) {\n\t\t\t// Insert link.\n\t\t\tconst toInsert = applyFormat(\n\t\t\t\tcreate( { text: linkText } ),\n\t\t\t\tformat,\n\t\t\t\t0,\n\t\t\t\tlinkText.length\n\t\t\t);\n\t\t\tnewAttributes = insert( value, toInsert );\n\t\t} else if ( text !== getTextContent( slice( value ) ) ) {\n\t\t\t// Edit text in selected link.\n\t\t\tconst toInsert = applyFormat(\n\t\t\t\tcreate( { text } ),\n\t\t\t\tformat,\n\t\t\t\t0,\n\t\t\t\ttext.length\n\t\t\t);\n\t\t\tnewAttributes = insert( value, toInsert, value.start, value.end );\n\t\t} else {\n\t\t\t// Transform selected text into link.\n\t\t\tnewAttributes = applyFormat( value, format );\n\t\t}\n\t\t// Move selection to end of link.\n\t\tconst textLength = newAttributes.text.length;\n\t\t// check for zero width spaces\n\t\tif ( newAttributes.end > textLength ) {\n\t\t\tnewAttributes.start = textLength;\n\t\t\tnewAttributes.end = textLength;\n\t\t} else {\n\t\t\tnewAttributes.start = newAttributes.end;\n\t\t}\n\t\tnewAttributes.activeFormats = [];\n\t\tonChange( { ...newAttributes, needsSelectionUpdate: true } );\n\t\tif ( ! skipStateUpdates ) {\n\t\t\tsetLinkValues( { isActiveLink: true, isRemovingLink: false } );\n\t\t}\n\n\t\tif ( ! isValidHref( url ) ) {\n\t\t\tspeak(\n\t\t\t\t__(\n\t\t\t\t\t'Warning: the link has been inserted but may have errors. Please test it.'\n\t\t\t\t),\n\t\t\t\t'assertive'\n\t\t\t);\n\t\t} else if ( isActive ) {\n\t\t\tspeak( __( 'Link edited.' ), 'assertive' );\n\t\t} else {\n\t\t\tspeak( __( 'Link inserted' ), 'assertive' );\n\t\t}\n\n\t\tif ( shouldCloseBottomSheet ) {\n\t\t\tonClose();\n\t\t}\n\t};\n\n\tconst removeLink = ( {\n\t\tshouldCloseBottomSheet = true,\n\t\tskipStateUpdates = false,\n\t} = {} ) => {\n\t\tclearFormat( { skipStateUpdates } );\n\t\tonRemove();\n\t\tif ( shouldCloseBottomSheet ) {\n\t\t\tonClose();\n\t\t}\n\t};\n\n\tconst submit = ( submitValue, { skipStateUpdates = false } = {} ) => {\n\t\tif ( submitValue === '' ) {\n\t\t\tremoveLink( { skipStateUpdates } );\n\t\t} else {\n\t\t\tsubmitLink( { skipStateUpdates } );\n\t\t}\n\t};\n\n\tuseEffect( () => {\n\t\tconst unsubscribe = navigation.addListener( 'focus', () => {\n\t\t\tconst { params = {} } = route;\n\t\t\tif ( ! text && params.text ) {\n\t\t\t\tsetText( params.text );\n\t\t\t}\n\t\t} );\n\t\treturn unsubscribe;\n\t}, [ navigation, route.params?.text, text ] );\n\n\treturn useMemo( () => {\n\t\tconst shouldShowLinkOptions = !! inputValue;\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BottomSheet.LinkCell\n\t\t\t\t\tvalue={ inputValue }\n\t\t\t\t\tonPress={ onLinkCellPressed }\n\t\t\t\t/>\n\t\t\t\t<BottomSheet.Cell\n\t\t\t\t\ticon={ textColor }\n\t\t\t\t\tlabel={ __( 'Link text' ) }\n\t\t\t\t\tvalue={ text }\n\t\t\t\t\tplaceholder={ __( 'Add link text' ) }\n\t\t\t\t\tonChangeValue={ setText }\n\t\t\t\t\tonSubmit={ submit }\n\t\t\t\t\tseparatorType={ shouldShowLinkOptions ? undefined : 'none' }\n\t\t\t\t/>\n\t\t\t\t{ shouldShowLinkOptions && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<BottomSheet.SwitchCell\n\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\tvalue={ opensInNewWindow }\n\t\t\t\t\t\t\tonValueChange={ setOpensInNewWindows }\n\t\t\t\t\t\t\tseparatorType={ 'fullWidth' }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BottomSheet.Cell\n\t\t\t\t\t\t\tlabel={ __( 'Remove link' ) }\n\t\t\t\t\t\t\tlabelStyle={ styles.clearLinkButton }\n\t\t\t\t\t\t\tseparatorType={ 'none' }\n\t\t\t\t\t\t\tonPress={ removeLink }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t}, [ inputValue, text, opensInNewWindow, listProps.safeAreaBottomInset ] );\n};\n\nexport default LinkSettingsScreen;\n"],"mappings":";;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,IAAA,GAAAH,OAAA;AACA,IAAAI,W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AU;MACtBR,IAAI,EAAGS,eAAU;MACjBP,KAAK,EAAG,IAAAf,QAAE,EAAE,iBAAkB,CAAG;MACjCxD,KAAK,EAAGS,gBAAkB;MAC1BsE,aAAa,EAAGrE,oBAAsB;MACtCiE,aAAa,EAAG;IAAa,CAC7B,CAAC,EACF,IAAAb,MAAA,CAAAC,aAAA,EAAC3E,WAAA,CAAA6E,WAAW,CAACG,IAAI;MAChBG,KAAK,EAAG,IAAAf,QAAE,EAAE,aAAc,CAAG;MAC7BwB,UAAU,EAAGC,cAAM,CAACC,eAAiB;MACrCP,aAAa,EAAG,MAAQ;MACxBR,OAAO,EAAG9B;IAAY,CACtB,CACA,CAEF,CAAC;EAEL,CAAC,EAAE,CAAEZ,UAAU,EAAErB,IAAI,EAAEK,gBAAgB,EAAES,SAAS,CAACiE,mBAAmB,CAAG,CAAC;AAC3E,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEa3F,kBAAkB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["settings","picker"],"sources":["@wordpress/format-library/src/link/modal-screens/screens.native.js"],"sourcesContent":["export default {\n\tsettings: 'linkSettings',\n\tpicker: 'linkPicker',\n};\n"],"mappings":";;;;;;iCAAe;EACdA,QAAQ,EAAE,cAAc;EACxBC,MAAM,EAAE;AACT,CAAC"}
1
+ {"version":3,"names":["settings","picker"],"sources":["@wordpress/format-library/src/link/modal-screens/screens.native.js"],"sourcesContent":["export default {\n\tsettings: 'linkSettings',\n\tpicker: 'linkPicker',\n};\n"],"mappings":";;;;;;iCAAe;EACdA,QAAQ,EAAE,cAAc;EACxBC,MAAM,EAAE;AACT,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_components","_screens","_interopRequireDefault","_linkSettingsScreen","_linkPickerScreen","ModalLinkUI","isVisible","restProps","useMemo","_react","createElement","BottomSheet","hideHeader","onClose","hasNavigation","testID","NavigationContainer","animate","main","NavigationScreen","name","screens","settings","default","picker","isScrollable","fullScreen","_default","exports","withSpokenMessages"],"sources":["@wordpress/format-library/src/link/modal.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { BottomSheet, withSpokenMessages } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport screens from './modal-screens/screens';\nimport LinkSettingsScreen from './modal-screens/link-settings-screen';\nimport LinkPickerScreen from './modal-screens/link-picker-screen';\n\nconst ModalLinkUI = ( { isVisible, ...restProps } ) => {\n\treturn useMemo( () => {\n\t\treturn (\n\t\t\t<BottomSheet\n\t\t\t\tisVisible={ isVisible }\n\t\t\t\thideHeader\n\t\t\t\tonClose={ restProps.onClose }\n\t\t\t\thasNavigation\n\t\t\t\ttestID=\"link-settings-modal\"\n\t\t\t>\n\t\t\t\t<BottomSheet.NavigationContainer animate main>\n\t\t\t\t\t<BottomSheet.NavigationScreen name={ screens.settings }>\n\t\t\t\t\t\t<LinkSettingsScreen\n\t\t\t\t\t\t\tisVisible={ isVisible }\n\t\t\t\t\t\t\t{ ...restProps }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BottomSheet.NavigationScreen>\n\t\t\t\t\t<BottomSheet.NavigationScreen\n\t\t\t\t\t\tname={ screens.picker }\n\t\t\t\t\t\tisScrollable\n\t\t\t\t\t\tfullScreen\n\t\t\t\t\t>\n\t\t\t\t\t\t<LinkPickerScreen />\n\t\t\t\t\t</BottomSheet.NavigationScreen>\n\t\t\t\t</BottomSheet.NavigationContainer>\n\t\t\t</BottomSheet>\n\t\t);\n\t}, [ isVisible ] );\n};\n\nexport default withSpokenMessages( ModalLinkUI );\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAKA,IAAAE,QAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,mBAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,iBAAA,GAAAF,sBAAA,CAAAH,OAAA;AAXA;AACA;AACA;;AAIA;AACA;AACA;;AAKA,MAAMM,WAAW,GAAGA,CAAE;EAAEC,SAAS;EAAE,GAAGC;AAAU,CAAC,KAAM;EACtD,OAAO,IAAAC,gBAAO,EAAE,MAAM;IACrB,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACV,WAAA,CAAAW,WAAW;MACXL,SAAS,EAAGA,SAAW;MACvBM,UAAU;MACVC,OAAO,EAAGN,SAAS,CAACM,OAAS;MAC7BC,aAAa;MACbC,MAAM,EAAC;IAAqB,GAE5B,IAAAN,MAAA,CAAAC,aAAA,EAACV,WAAA,CAAAW,WAAW,CAACK,mBAAmB;MAACC,OAAO;MAACC,IAAI;IAAA,GAC5C,IAAAT,MAAA,CAAAC,aAAA,EAACV,WAAA,CAAAW,WAAW,CAACQ,gBAAgB;MAACC,IAAI,EAAGC,gBAAO,CAACC;IAAU,GACtD,IAAAb,MAAA,CAAAC,aAAA,EAACP,mBAAA,CAAAoB,OAAkB;MAClBjB,SAAS,EAAGA,SAAW;MAAA,GAClBC;IAAS,CACd,CAC4B,CAAC,EAC/B,IAAAE,MAAA,CAAAC,aAAA,EAACV,WAAA,CAAAW,WAAW,CAACQ,gBAAgB;MAC5BC,IAAI,EAAGC,gBAAO,CAACG,MAAQ;MACvBC,YAAY;MACZC,UAAU;IAAA,GAEV,IAAAjB,MAAA,CAAAC,aAAA,EAACN,iBAAA,CAAAmB,OAAgB,MAAE,CACU,CACE,CACrB,CAAC;EAEhB,CAAC,EAAE,CAAEjB,SAAS,CAAG,CAAC;AACnB,CAAC;AAAC,IAAAqB,QAAA,GAAAC,OAAA,CAAAL,OAAA,GAEa,IAAAM,8BAAkB,EAAExB,WAAY,CAAC"}
1
+ {"version":3,"names":["_element","require","_components","_screens","_interopRequireDefault","_linkSettingsScreen","_linkPickerScreen","ModalLinkUI","isVisible","restProps","useMemo","_react","createElement","BottomSheet","hideHeader","onClose","hasNavigation","testID","NavigationContainer","animate","main","NavigationScreen","name","screens","settings","default","picker","isScrollable","fullScreen","_default","exports","withSpokenMessages"],"sources":["@wordpress/format-library/src/link/modal.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { BottomSheet, withSpokenMessages } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport screens from './modal-screens/screens';\nimport LinkSettingsScreen from './modal-screens/link-settings-screen';\nimport LinkPickerScreen from './modal-screens/link-picker-screen';\n\nconst ModalLinkUI = ( { isVisible, ...restProps } ) => {\n\treturn useMemo( () => {\n\t\treturn (\n\t\t\t<BottomSheet\n\t\t\t\tisVisible={ isVisible }\n\t\t\t\thideHeader\n\t\t\t\tonClose={ restProps.onClose }\n\t\t\t\thasNavigation\n\t\t\t\ttestID=\"link-settings-modal\"\n\t\t\t>\n\t\t\t\t<BottomSheet.NavigationContainer animate main>\n\t\t\t\t\t<BottomSheet.NavigationScreen name={ screens.settings }>\n\t\t\t\t\t\t<LinkSettingsScreen\n\t\t\t\t\t\t\tisVisible={ isVisible }\n\t\t\t\t\t\t\t{ ...restProps }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BottomSheet.NavigationScreen>\n\t\t\t\t\t<BottomSheet.NavigationScreen\n\t\t\t\t\t\tname={ screens.picker }\n\t\t\t\t\t\tisScrollable\n\t\t\t\t\t\tfullScreen\n\t\t\t\t\t>\n\t\t\t\t\t\t<LinkPickerScreen />\n\t\t\t\t\t</BottomSheet.NavigationScreen>\n\t\t\t\t</BottomSheet.NavigationContainer>\n\t\t\t</BottomSheet>\n\t\t);\n\t}, [ isVisible ] );\n};\n\nexport default withSpokenMessages( ModalLinkUI );\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAKA,IAAAE,QAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,mBAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,iBAAA,GAAAF,sBAAA,CAAAH,OAAA;AAXA;AACA;AACA;;AAIA;AACA;AACA;;AAKA,MAAMM,WAAW,GAAGA,CAAE;EAAEC,SAAS;EAAE,GAAGC;AAAU,CAAC,KAAM;EACtD,OAAO,IAAAC,gBAAO,EAAE,MAAM;IACrB,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACV,WAAA,CAAAW,WAAW;MACXL,SAAS,EAAGA,SAAW;MACvBM,UAAU;MACVC,OAAO,EAAGN,SAAS,CAACM,OAAS;MAC7BC,aAAa;MACbC,MAAM,EAAC;IAAqB,GAE5B,IAAAN,MAAA,CAAAC,aAAA,EAACV,WAAA,CAAAW,WAAW,CAACK,mBAAmB;MAACC,OAAO;MAACC,IAAI;IAAA,GAC5C,IAAAT,MAAA,CAAAC,aAAA,EAACV,WAAA,CAAAW,WAAW,CAACQ,gBAAgB;MAACC,IAAI,EAAGC,gBAAO,CAACC;IAAU,GACtD,IAAAb,MAAA,CAAAC,aAAA,EAACP,mBAAA,CAAAoB,OAAkB;MAClBjB,SAAS,EAAGA,SAAW;MAAA,GAClBC;IAAS,CACd,CAC4B,CAAC,EAC/B,IAAAE,MAAA,CAAAC,aAAA,EAACV,WAAA,CAAAW,WAAW,CAACQ,gBAAgB;MAC5BC,IAAI,EAAGC,gBAAO,CAACG,MAAQ;MACvBC,YAAY;MACZC,UAAU;IAAA,GAEV,IAAAjB,MAAA,CAAAC,aAAA,EAACN,iBAAA,CAAAmB,OAAgB,MAAE,CACU,CACE,CACrB,CAAC;EAEhB,CAAC,EAAE,CAAEjB,SAAS,CAAG,CAAC;AACnB,CAAC;AAAC,IAAAqB,QAAA,GAAAC,OAAA,CAAAL,OAAA,GAEa,IAAAM,8BAAkB,EAAExB,WAAY,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["weakMap","WeakMap","id","prefix","getKey","_id","useLinkInstanceKey","instance","has","get","set","_default","exports","default"],"sources":["@wordpress/format-library/src/link/use-link-instance-key.js"],"sourcesContent":["// Weakly referenced map allows unused ids to be garbage collected.\nconst weakMap = new WeakMap();\n\n// Incrementing zero-based ID value.\nlet id = -1;\n\nconst prefix = 'link-control-instance';\n\nfunction getKey( _id ) {\n\treturn `${ prefix }-${ _id }`;\n}\n\n/**\n * Builds a unique link control key for the given object reference.\n *\n * @param {Object} instance an unique object reference specific to this link control instance.\n * @return {string | undefined} the unique key to use for this link control.\n */\nfunction useLinkInstanceKey( instance ) {\n\tif ( ! instance ) {\n\t\treturn;\n\t}\n\tif ( weakMap.has( instance ) ) {\n\t\treturn getKey( weakMap.get( instance ) );\n\t}\n\n\tid += 1;\n\n\tweakMap.set( instance, id );\n\n\treturn getKey( id );\n}\n\nexport default useLinkInstanceKey;\n"],"mappings":";;;;;;AAAA;AACA,MAAMA,OAAO,GAAG,IAAIC,OAAO,CAAC,CAAC;;AAE7B;AACA,IAAIC,EAAE,GAAG,CAAC,CAAC;AAEX,MAAMC,MAAM,GAAG,uBAAuB;AAEtC,SAASC,MAAMA,CAAEC,GAAG,EAAG;EACtB,OAAQ,GAAGF,MAAQ,IAAIE,GAAK,EAAC;AAC9B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,kBAAkBA,CAAEC,QAAQ,EAAG;EACvC,IAAK,CAAEA,QAAQ,EAAG;IACjB;EACD;EACA,IAAKP,OAAO,CAACQ,GAAG,CAAED,QAAS,CAAC,EAAG;IAC9B,OAAOH,MAAM,CAAEJ,OAAO,CAACS,GAAG,CAAEF,QAAS,CAAE,CAAC;EACzC;EAEAL,EAAE,IAAI,CAAC;EAEPF,OAAO,CAACU,GAAG,CAAEH,QAAQ,EAAEL,EAAG,CAAC;EAE3B,OAAOE,MAAM,CAAEF,EAAG,CAAC;AACpB;AAAC,IAAAS,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcP,kBAAkB"}
1
+ {"version":3,"names":["weakMap","WeakMap","id","prefix","getKey","_id","useLinkInstanceKey","instance","has","get","set","_default","exports","default"],"sources":["@wordpress/format-library/src/link/use-link-instance-key.js"],"sourcesContent":["// Weakly referenced map allows unused ids to be garbage collected.\nconst weakMap = new WeakMap();\n\n// Incrementing zero-based ID value.\nlet id = -1;\n\nconst prefix = 'link-control-instance';\n\nfunction getKey( _id ) {\n\treturn `${ prefix }-${ _id }`;\n}\n\n/**\n * Builds a unique link control key for the given object reference.\n *\n * @param {Object} instance an unique object reference specific to this link control instance.\n * @return {string | undefined} the unique key to use for this link control.\n */\nfunction useLinkInstanceKey( instance ) {\n\tif ( ! instance ) {\n\t\treturn;\n\t}\n\tif ( weakMap.has( instance ) ) {\n\t\treturn getKey( weakMap.get( instance ) );\n\t}\n\n\tid += 1;\n\n\tweakMap.set( instance, id );\n\n\treturn getKey( id );\n}\n\nexport default useLinkInstanceKey;\n"],"mappings":";;;;;;AAAA;AACA,MAAMA,OAAO,GAAG,IAAIC,OAAO,CAAC,CAAC;;AAE7B;AACA,IAAIC,EAAE,GAAG,CAAC,CAAC;AAEX,MAAMC,MAAM,GAAG,uBAAuB;AAEtC,SAASC,MAAMA,CAAEC,GAAG,EAAG;EACtB,OAAQ,GAAGF,MAAQ,IAAIE,GAAK,EAAC;AAC9B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,kBAAkBA,CAAEC,QAAQ,EAAG;EACvC,IAAK,CAAEA,QAAQ,EAAG;IACjB;EACD;EACA,IAAKP,OAAO,CAACQ,GAAG,CAAED,QAAS,CAAC,EAAG;IAC9B,OAAOH,MAAM,CAAEJ,OAAO,CAACS,GAAG,CAAEF,QAAS,CAAE,CAAC;EACzC;EAEAL,EAAE,IAAI,CAAC;EAEPF,OAAO,CAACU,GAAG,CAAEH,QAAQ,EAAEL,EAAG,CAAC;EAE3B,OAAOE,MAAM,CAAEF,EAAG,CAAC;AACpB;AAAC,IAAAS,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcP,kBAAkB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_url","require","isValidHref","href","trimmedHref","trim","test","protocol","getProtocol","isValidProtocol","startsWith","authority","getAuthority","isValidAuthority","path","getPath","isValidPath","queryString","getQueryString","isValidQueryString","fragment","getFragment","isValidFragment","createLinkFormat","url","type","id","opensInNewWindow","nofollow","format","attributes","target","rel","getFormatBoundary","value","startIndex","start","endIndex","end","EMPTY_BOUNDARIES","formats","targetFormat","initialIndex","length","newFormats","slice","formatAtStart","find","formatAtEnd","formatAtEndMinusOne","index","indexOf","walkingArgs","walkToStart","walkToEnd","walkToBoundary","targetFormatRef","formatIndex","direction","directions","forwards","backwards","directionIncrement","inverseDirectionIncrement","partialRight","fn","partialArgs","args"],"sources":["@wordpress/format-library/src/link/utils.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tgetProtocol,\n\tisValidProtocol,\n\tgetAuthority,\n\tisValidAuthority,\n\tgetPath,\n\tisValidPath,\n\tgetQueryString,\n\tisValidQueryString,\n\tgetFragment,\n\tisValidFragment,\n} from '@wordpress/url';\n\n/**\n * Check for issues with the provided href.\n *\n * @param {string} href The href.\n *\n * @return {boolean} Is the href invalid?\n */\nexport function isValidHref( href ) {\n\tif ( ! href ) {\n\t\treturn false;\n\t}\n\n\tconst trimmedHref = href.trim();\n\n\tif ( ! trimmedHref ) {\n\t\treturn false;\n\t}\n\n\t// Does the href start with something that looks like a URL protocol?\n\tif ( /^\\S+:/.test( trimmedHref ) ) {\n\t\tconst protocol = getProtocol( trimmedHref );\n\t\tif ( ! isValidProtocol( protocol ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Add some extra checks for http(s) URIs, since these are the most common use-case.\n\t\t// This ensures URIs with an http protocol have exactly two forward slashes following the protocol.\n\t\tif (\n\t\t\tprotocol.startsWith( 'http' ) &&\n\t\t\t! /^https?:\\/\\/[^\\/\\s]/i.test( trimmedHref )\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst authority = getAuthority( trimmedHref );\n\t\tif ( ! isValidAuthority( authority ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst path = getPath( trimmedHref );\n\t\tif ( path && ! isValidPath( path ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst queryString = getQueryString( trimmedHref );\n\t\tif ( queryString && ! isValidQueryString( queryString ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst fragment = getFragment( trimmedHref );\n\t\tif ( fragment && ! isValidFragment( fragment ) ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t// Validate anchor links.\n\tif ( trimmedHref.startsWith( '#' ) && ! isValidFragment( trimmedHref ) ) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n/**\n * Generates the format object that will be applied to the link text.\n *\n * @param {Object} options\n * @param {string} options.url The href of the link.\n * @param {string} options.type The type of the link.\n * @param {string} options.id The ID of the link.\n * @param {boolean} options.opensInNewWindow Whether this link will open in a new window.\n * @param {boolean} options.nofollow Whether this link is marked as no follow relationship.\n * @return {Object} The final format object.\n */\nexport function createLinkFormat( {\n\turl,\n\ttype,\n\tid,\n\topensInNewWindow,\n\tnofollow,\n} ) {\n\tconst format = {\n\t\ttype: 'core/link',\n\t\tattributes: {\n\t\t\turl,\n\t\t},\n\t};\n\n\tif ( type ) format.attributes.type = type;\n\tif ( id ) format.attributes.id = id;\n\n\tif ( opensInNewWindow ) {\n\t\tformat.attributes.target = '_blank';\n\t\tformat.attributes.rel = format.attributes.rel\n\t\t\t? format.attributes.rel + ' noreferrer noopener'\n\t\t\t: 'noreferrer noopener';\n\t}\n\n\tif ( nofollow ) {\n\t\tformat.attributes.rel = format.attributes.rel\n\t\t\t? format.attributes.rel + ' nofollow'\n\t\t\t: 'nofollow';\n\t}\n\n\treturn format;\n}\n\n/* eslint-disable jsdoc/no-undefined-types */\n/**\n * Get the start and end boundaries of a given format from a rich text value.\n *\n *\n * @param {RichTextValue} value the rich text value to interrogate.\n * @param {string} format the identifier for the target format (e.g. `core/link`, `core/bold`).\n * @param {number?} startIndex optional startIndex to seek from.\n * @param {number?} endIndex optional endIndex to seek from.\n * @return {Object}\tobject containing start and end values for the given format.\n */\n/* eslint-enable jsdoc/no-undefined-types */\nexport function getFormatBoundary(\n\tvalue,\n\tformat,\n\tstartIndex = value.start,\n\tendIndex = value.end\n) {\n\tconst EMPTY_BOUNDARIES = {\n\t\tstart: null,\n\t\tend: null,\n\t};\n\n\tconst { formats } = value;\n\tlet targetFormat;\n\tlet initialIndex;\n\n\tif ( ! formats?.length ) {\n\t\treturn EMPTY_BOUNDARIES;\n\t}\n\n\t// Clone formats to avoid modifying source formats.\n\tconst newFormats = formats.slice();\n\n\tconst formatAtStart = newFormats[ startIndex ]?.find(\n\t\t( { type } ) => type === format.type\n\t);\n\n\tconst formatAtEnd = newFormats[ endIndex ]?.find(\n\t\t( { type } ) => type === format.type\n\t);\n\n\tconst formatAtEndMinusOne = newFormats[ endIndex - 1 ]?.find(\n\t\t( { type } ) => type === format.type\n\t);\n\n\tif ( !! formatAtStart ) {\n\t\t// Set values to conform to \"start\"\n\t\ttargetFormat = formatAtStart;\n\t\tinitialIndex = startIndex;\n\t} else if ( !! formatAtEnd ) {\n\t\t// Set values to conform to \"end\"\n\t\ttargetFormat = formatAtEnd;\n\t\tinitialIndex = endIndex;\n\t} else if ( !! formatAtEndMinusOne ) {\n\t\t// This is an edge case which will occur if you create a format, then place\n\t\t// the caret just before the format and hit the back ARROW key. The resulting\n\t\t// value object will have start and end +1 beyond the edge of the format boundary.\n\t\ttargetFormat = formatAtEndMinusOne;\n\t\tinitialIndex = endIndex - 1;\n\t} else {\n\t\treturn EMPTY_BOUNDARIES;\n\t}\n\n\tconst index = newFormats[ initialIndex ].indexOf( targetFormat );\n\n\tconst walkingArgs = [ newFormats, initialIndex, targetFormat, index ];\n\n\t// Walk the startIndex \"backwards\" to the leading \"edge\" of the matching format.\n\tstartIndex = walkToStart( ...walkingArgs );\n\n\t// Walk the endIndex \"forwards\" until the trailing \"edge\" of the matching format.\n\tendIndex = walkToEnd( ...walkingArgs );\n\n\t// Safe guard: start index cannot be less than 0.\n\tstartIndex = startIndex < 0 ? 0 : startIndex;\n\n\t// // Return the indicies of the \"edges\" as the boundaries.\n\treturn {\n\t\tstart: startIndex,\n\t\tend: endIndex,\n\t};\n}\n\n/**\n * Walks forwards/backwards towards the boundary of a given format within an\n * array of format objects. Returns the index of the boundary.\n *\n * @param {Array} formats the formats to search for the given format type.\n * @param {number} initialIndex the starting index from which to walk.\n * @param {Object} targetFormatRef a reference to the format type object being sought.\n * @param {number} formatIndex the index at which we expect the target format object to be.\n * @param {string} direction either 'forwards' or 'backwards' to indicate the direction.\n * @return {number} the index of the boundary of the given format.\n */\nfunction walkToBoundary(\n\tformats,\n\tinitialIndex,\n\ttargetFormatRef,\n\tformatIndex,\n\tdirection\n) {\n\tlet index = initialIndex;\n\n\tconst directions = {\n\t\tforwards: 1,\n\t\tbackwards: -1,\n\t};\n\n\tconst directionIncrement = directions[ direction ] || 1; // invalid direction arg default to forwards\n\tconst inverseDirectionIncrement = directionIncrement * -1;\n\n\twhile (\n\t\tformats[ index ] &&\n\t\tformats[ index ][ formatIndex ] === targetFormatRef\n\t) {\n\t\t// Increment/decrement in the direction of operation.\n\t\tindex = index + directionIncrement;\n\t}\n\n\t// Restore by one in inverse direction of operation\n\t// to avoid out of bounds.\n\tindex = index + inverseDirectionIncrement;\n\n\treturn index;\n}\n\nconst partialRight =\n\t( fn, ...partialArgs ) =>\n\t( ...args ) =>\n\t\tfn( ...args, ...partialArgs );\n\nconst walkToStart = partialRight( walkToBoundary, 'backwards' );\n\nconst walkToEnd = partialRight( walkToBoundary, 'forwards' );\n"],"mappings":";;;;;;;;AAGA,IAAAA,IAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,WAAWA,CAAEC,IAAI,EAAG;EACnC,IAAK,CAAEA,IAAI,EAAG;IACb,OAAO,KAAK;EACb;EAEA,MAAMC,WAAW,GAAGD,IAAI,CAACE,IAAI,CAAC,CAAC;EAE/B,IAAK,CAAED,WAAW,EAAG;IACpB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CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASkB,cAAcA,CACtBf,OAAO,EACPE,YAAY,EACZc,eAAe,EACfC,WAAW,EACXC,SAAS,EACR;EACD,IAAIR,KAAK,GAAGR,YAAY;EAExB,MAAMiB,UAAU,GAAG;IAClBC,QAAQ,EAAE,CAAC;IACXC,SAAS,EAAE,CAAC;EACb,CAAC;EAED,MAAMC,kBAAkB,GAAGH,UAAU,CAAED,SAAS,CAAE,IAAI,CAAC,CAAC,CAAC;EACzD,MAAMK,yBAAyB,GAAGD,kBAAkB,GAAG,CAAC,CAAC;EAEzD,OACCtB,OAAO,CAAEU,KAAK,CAAE,IAChBV,OAAO,CAAEU,KAAK,CAAE,CAAEO,WAAW,CAAE,KAAKD,eAAe,EAClD;IACD;IACAN,KAAK,GAAGA,KAAK,GAAGY,kBAAkB;EACnC;;EAEA;EACA;EACAZ,KAAK,GAAGA,KAAK,GAAGa,yBAAyB;EAEzC,OAAOb,KAAK;AACb;AAEA,MAAMc,YAAY,GACjBA,CAAEC,EAAE,EAAE,GAAGC,WAAW,KACpB,CAAE,GAAGC,IAAI,KACRF,EAAE,CAAE,GAAGE,IAAI,EAAE,GAAGD,WAAY,CAAC;AAE/B,MAAMb,WAAW,GAAGW,YAAY,CAAET,cAAc,EAAE,WAAY,CAAC;AAE/D,MAAMD,SAAS,GAAGU,YAAY,CAAET,cAAc,EAAE,UAAW,CAAC"}
1
+ {"version":3,"names":["_url","require","isValidHref","href","trimmedHref","trim","test","protocol","getProtocol","isValidProtocol","startsWith","authority","getAuthority","isValidAuthority","path","getPath","isValidPath","queryString","getQueryString","isValidQueryString","fragment","getFragment","isValidFragment","createLinkFormat","url","type","id","opensInNewWindow","nofollow","format","attributes","target","rel","getFormatBoundary","value","startIndex","start","endIndex","end","EMPTY_BOUNDARIES","formats","targetFormat","initialIndex","length","newFormats","slice","formatAtStart","find","formatAtEnd","formatAtEndMinusOne","index","indexOf","walkingArgs","walkToStart","walkToEnd","walkToBoundary","targetFormatRef","formatIndex","direction","directions","forwards","backwards","directionIncrement","inverseDirectionIncrement","partialRight","fn","partialArgs","args"],"sources":["@wordpress/format-library/src/link/utils.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tgetProtocol,\n\tisValidProtocol,\n\tgetAuthority,\n\tisValidAuthority,\n\tgetPath,\n\tisValidPath,\n\tgetQueryString,\n\tisValidQueryString,\n\tgetFragment,\n\tisValidFragment,\n} from '@wordpress/url';\n\n/**\n * Check for issues with the provided href.\n *\n * @param {string} href The href.\n *\n * @return {boolean} Is the href invalid?\n */\nexport function isValidHref( href ) {\n\tif ( ! href ) {\n\t\treturn false;\n\t}\n\n\tconst trimmedHref = href.trim();\n\n\tif ( ! trimmedHref ) {\n\t\treturn false;\n\t}\n\n\t// Does the href start with something that looks like a URL protocol?\n\tif ( /^\\S+:/.test( trimmedHref ) ) {\n\t\tconst protocol = getProtocol( trimmedHref );\n\t\tif ( ! isValidProtocol( protocol ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Add some extra checks for http(s) URIs, since these are the most common use-case.\n\t\t// This ensures URIs with an http protocol have exactly two forward slashes following the protocol.\n\t\tif (\n\t\t\tprotocol.startsWith( 'http' ) &&\n\t\t\t! /^https?:\\/\\/[^\\/\\s]/i.test( trimmedHref )\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst authority = getAuthority( trimmedHref );\n\t\tif ( ! isValidAuthority( authority ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst path = getPath( trimmedHref );\n\t\tif ( path && ! isValidPath( path ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst queryString = getQueryString( trimmedHref );\n\t\tif ( queryString && ! isValidQueryString( queryString ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst fragment = getFragment( trimmedHref );\n\t\tif ( fragment && ! isValidFragment( fragment ) ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t// Validate anchor links.\n\tif ( trimmedHref.startsWith( '#' ) && ! isValidFragment( trimmedHref ) ) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n/**\n * Generates the format object that will be applied to the link text.\n *\n * @param {Object} options\n * @param {string} options.url The href of the link.\n * @param {string} options.type The type of the link.\n * @param {string} options.id The ID of the link.\n * @param {boolean} options.opensInNewWindow Whether this link will open in a new window.\n * @param {boolean} options.nofollow Whether this link is marked as no follow relationship.\n * @return {Object} The final format object.\n */\nexport function createLinkFormat( {\n\turl,\n\ttype,\n\tid,\n\topensInNewWindow,\n\tnofollow,\n} ) {\n\tconst format = {\n\t\ttype: 'core/link',\n\t\tattributes: {\n\t\t\turl,\n\t\t},\n\t};\n\n\tif ( type ) format.attributes.type = type;\n\tif ( id ) format.attributes.id = id;\n\n\tif ( opensInNewWindow ) {\n\t\tformat.attributes.target = '_blank';\n\t\tformat.attributes.rel = format.attributes.rel\n\t\t\t? format.attributes.rel + ' noreferrer noopener'\n\t\t\t: 'noreferrer noopener';\n\t}\n\n\tif ( nofollow ) {\n\t\tformat.attributes.rel = format.attributes.rel\n\t\t\t? format.attributes.rel + ' nofollow'\n\t\t\t: 'nofollow';\n\t}\n\n\treturn format;\n}\n\n/* eslint-disable jsdoc/no-undefined-types */\n/**\n * Get the start and end boundaries of a given format from a rich text value.\n *\n *\n * @param {RichTextValue} value the rich text value to interrogate.\n * @param {string} format the identifier for the target format (e.g. `core/link`, `core/bold`).\n * @param {number?} startIndex optional startIndex to seek from.\n * @param {number?} endIndex optional endIndex to seek from.\n * @return {Object}\tobject containing start and end values for the given format.\n */\n/* eslint-enable jsdoc/no-undefined-types */\nexport function getFormatBoundary(\n\tvalue,\n\tformat,\n\tstartIndex = value.start,\n\tendIndex = value.end\n) {\n\tconst EMPTY_BOUNDARIES = {\n\t\tstart: null,\n\t\tend: null,\n\t};\n\n\tconst { formats } = value;\n\tlet targetFormat;\n\tlet initialIndex;\n\n\tif ( ! formats?.length ) {\n\t\treturn EMPTY_BOUNDARIES;\n\t}\n\n\t// Clone formats to avoid modifying source formats.\n\tconst newFormats = formats.slice();\n\n\tconst formatAtStart = newFormats[ startIndex ]?.find(\n\t\t( { type } ) => type === format.type\n\t);\n\n\tconst formatAtEnd = newFormats[ endIndex ]?.find(\n\t\t( { type } ) => type === format.type\n\t);\n\n\tconst formatAtEndMinusOne = newFormats[ endIndex - 1 ]?.find(\n\t\t( { type } ) => type === format.type\n\t);\n\n\tif ( !! formatAtStart ) {\n\t\t// Set values to conform to \"start\"\n\t\ttargetFormat = formatAtStart;\n\t\tinitialIndex = startIndex;\n\t} else if ( !! formatAtEnd ) {\n\t\t// Set values to conform to \"end\"\n\t\ttargetFormat = formatAtEnd;\n\t\tinitialIndex = endIndex;\n\t} else if ( !! formatAtEndMinusOne ) {\n\t\t// This is an edge case which will occur if you create a format, then place\n\t\t// the caret just before the format and hit the back ARROW key. The resulting\n\t\t// value object will have start and end +1 beyond the edge of the format boundary.\n\t\ttargetFormat = formatAtEndMinusOne;\n\t\tinitialIndex = endIndex - 1;\n\t} else {\n\t\treturn EMPTY_BOUNDARIES;\n\t}\n\n\tconst index = newFormats[ initialIndex ].indexOf( targetFormat );\n\n\tconst walkingArgs = [ newFormats, initialIndex, targetFormat, index ];\n\n\t// Walk the startIndex \"backwards\" to the leading \"edge\" of the matching format.\n\tstartIndex = walkToStart( ...walkingArgs );\n\n\t// Walk the endIndex \"forwards\" until the trailing \"edge\" of the matching format.\n\tendIndex = walkToEnd( ...walkingArgs );\n\n\t// Safe guard: start index cannot be less than 0.\n\tstartIndex = startIndex < 0 ? 0 : startIndex;\n\n\t// // Return the indicies of the \"edges\" as the boundaries.\n\treturn {\n\t\tstart: startIndex,\n\t\tend: endIndex,\n\t};\n}\n\n/**\n * Walks forwards/backwards towards the boundary of a given format within an\n * array of format objects. Returns the index of the boundary.\n *\n * @param {Array} formats the formats to search for the given format type.\n * @param {number} initialIndex the starting index from which to walk.\n * @param {Object} targetFormatRef a reference to the format type object being sought.\n * @param {number} formatIndex the index at which we expect the target format object to be.\n * @param {string} direction either 'forwards' or 'backwards' to indicate the direction.\n * @return {number} the index of the boundary of the given format.\n */\nfunction walkToBoundary(\n\tformats,\n\tinitialIndex,\n\ttargetFormatRef,\n\tformatIndex,\n\tdirection\n) {\n\tlet index = initialIndex;\n\n\tconst directions = {\n\t\tforwards: 1,\n\t\tbackwards: -1,\n\t};\n\n\tconst directionIncrement = directions[ direction ] || 1; // invalid direction arg default to forwards\n\tconst inverseDirectionIncrement = directionIncrement * -1;\n\n\twhile (\n\t\tformats[ index ] &&\n\t\tformats[ index ][ formatIndex ] === targetFormatRef\n\t) {\n\t\t// Increment/decrement in the direction of operation.\n\t\tindex = index + directionIncrement;\n\t}\n\n\t// Restore by one in inverse direction of operation\n\t// to avoid out of bounds.\n\tindex = index + inverseDirectionIncrement;\n\n\treturn index;\n}\n\nconst partialRight =\n\t( fn, ...partialArgs ) =>\n\t( ...args ) =>\n\t\tfn( ...args, ...partialArgs );\n\nconst walkToStart = partialRight( walkToBoundary, 'backwards' );\n\nconst walkToEnd = partialRight( walkToBoundary, 'forwards' );\n"],"mappings":";;;;;;;;AAGA,IAAAA,IAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,WAAWA,CAAEC,IAAI,EAAG;EACnC,IAAK,CAAEA,IAAI,EAAG;IACb,OAAO,KAAK;EACb;EAEA,MAAMC,WAAW,GAAGD,IAAI,CAACE,IAAI,CAAC,CAAC;EAE/B,IAAK,CAAED,WAAW,EAAG;IACpB,OAAO,KAAK;EACb;;EAEA;EACA,IAAK,OAAO,CAACE,IAAI,CAAEF,WAAY,CAAC,EAAG;IAClC,MAAMG,QAAQ,GAAG,IAAAC,gBAAW,EAAEJ,WAAY,CAAC;IAC3C,IAAK,CAAE,IAAAK,oBAAe,EAAEF,QAAS,CAAC,EAAG;MACpC,OAAO,KAAK;IACb;;IAEA;IACA;IACA,IACCA,QAAQ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AE,CAAC;EACb,CAAC;EAED,MAAMC,kBAAkB,GAAGH,UAAU,CAAED,SAAS,CAAE,IAAI,CAAC,CAAC,CAAC;EACzD,MAAMK,yBAAyB,GAAGD,kBAAkB,GAAG,CAAC,CAAC;EAEzD,OACCtB,OAAO,CAAEU,KAAK,CAAE,IAChBV,OAAO,CAAEU,KAAK,CAAE,CAAEO,WAAW,CAAE,KAAKD,eAAe,EAClD;IACD;IACAN,KAAK,GAAGA,KAAK,GAAGY,kBAAkB;EACnC;;EAEA;EACA;EACAZ,KAAK,GAAGA,KAAK,GAAGa,yBAAyB;EAEzC,OAAOb,KAAK;AACb;AAEA,MAAMc,YAAY,GACjBA,CAAEC,EAAE,EAAE,GAAGC,WAAW,KACpB,CAAE,GAAGC,IAAI,KACRF,EAAE,CAAE,GAAGE,IAAI,EAAE,GAAGD,WAAY,CAAC;AAE/B,MAAMb,WAAW,GAAGW,YAAY,CAAET,cAAc,EAAE,WAAY,CAAC;AAE/D,MAAMD,SAAS,GAAGU,YAAY,CAAET,cAAc,EAAE,UAAW,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_privateApis","require","lock","unlock","__dangerousOptInToUnstableAPIsOnlyForCoreModules","exports"],"sources":["@wordpress/format-library/src/lock-unlock.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',\n\t\t'@wordpress/format-library'\n\t);\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGO,MAAM;EAAEC,IAAI;EAAEC;AAAO,CAAC,GAC5B,IAAAC,6DAAgD,EAC/C,iHAAiH,EACjH,2BACD,CAAC;AAACC,OAAA,CAAAF,MAAA,GAAAA,MAAA;AAAAE,OAAA,CAAAH,IAAA,GAAAA,IAAA"}
1
+ {"version":3,"names":["_privateApis","require","lock","unlock","__dangerousOptInToUnstableAPIsOnlyForCoreModules","exports"],"sources":["@wordpress/format-library/src/lock-unlock.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',\n\t\t'@wordpress/format-library'\n\t);\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGO,MAAM;EAAEC,IAAI;EAAEC;AAAO,CAAC,GAC5B,IAAAC,6DAAgD,EAC/C,iHAAiH,EACjH,2BACD,CAAC;AAACC,OAAA,CAAAF,MAAA,GAAAA,MAAA;AAAAE,OAAA,CAAAH,IAAA,GAAAA,IAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_richText","_blockEditor","name","title","__","nonBreakingSpace","exports","tagName","className","edit","value","onChange","addNonBreakingSpace","insert","_react","createElement","RichTextShortcut","type","character","onUse"],"sources":["@wordpress/format-library/src/non-breaking-space/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { insert } from '@wordpress/rich-text';\nimport { RichTextShortcut } from '@wordpress/block-editor';\n\nconst name = 'core/non-breaking-space';\nconst title = __( 'Non breaking space' );\n\nexport const nonBreakingSpace = {\n\tname,\n\ttitle,\n\ttagName: 'nbsp',\n\tclassName: null,\n\tedit( { value, onChange } ) {\n\t\tfunction addNonBreakingSpace() {\n\t\t\tonChange( insert( value, '\\u00a0' ) );\n\t\t}\n\n\t\treturn (\n\t\t\t<RichTextShortcut\n\t\t\t\ttype=\"primaryShift\"\n\t\t\t\tcharacter=\" \"\n\t\t\t\tonUse={ addNonBreakingSpace }\n\t\t\t/>\n\t\t);\n\t},\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AALA;AACA;AACA;;AAKA,MAAMG,IAAI,GAAG,yBAAyB;AACtC,MAAMC,KAAK,GAAG,IAAAC,QAAE,EAAE,oBAAqB,CAAC;AAEjC,MAAMC,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG;EAC/BH,IAAI;EACJC,KAAK;EACLI,OAAO,EAAE,MAAM;EACfC,SAAS,EAAE,IAAI;EACfC,IAAIA,CAAE;IAAEC,KAAK;IAAEC;EAAS,CAAC,EAAG;IAC3B,SAASC,mBAAmBA,CAAA,EAAG;MAC9BD,QAAQ,CAAE,IAAAE,gBAAM,EAAEH,KAAK,EAAE,QAAS,CAAE,CAAC;IACtC;IAEA,OACC,IAAAI,MAAA,CAAAC,aAAA,EAACd,YAAA,CAAAe,gBAAgB;MAChBC,IAAI,EAAC,cAAc;MACnBC,SAAS,EAAC,GAAG;MACbC,KAAK,EAAGP;IAAqB,CAC7B,CAAC;EAEJ;AACD,CAAC"}
1
+ {"version":3,"names":["_i18n","require","_richText","_blockEditor","name","title","__","nonBreakingSpace","exports","tagName","className","edit","value","onChange","addNonBreakingSpace","insert","_react","createElement","RichTextShortcut","type","character","onUse"],"sources":["@wordpress/format-library/src/non-breaking-space/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { insert } from '@wordpress/rich-text';\nimport { RichTextShortcut } from '@wordpress/block-editor';\n\nconst name = 'core/non-breaking-space';\nconst title = __( 'Non breaking space' );\n\nexport const nonBreakingSpace = {\n\tname,\n\ttitle,\n\ttagName: 'nbsp',\n\tclassName: null,\n\tedit( { value, onChange } ) {\n\t\tfunction addNonBreakingSpace() {\n\t\t\tonChange( insert( value, '\\u00a0' ) );\n\t\t}\n\n\t\treturn (\n\t\t\t<RichTextShortcut\n\t\t\t\ttype=\"primaryShift\"\n\t\t\t\tcharacter=\" \"\n\t\t\t\tonUse={ addNonBreakingSpace }\n\t\t\t/>\n\t\t);\n\t},\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AALA;AACA;AACA;;AAKA,MAAMG,IAAI,GAAG,yBAAyB;AACtC,MAAMC,KAAK,GAAG,IAAAC,QAAE,EAAE,oBAAqB,CAAC;AAEjC,MAAMC,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG;EAC/BH,IAAI;EACJC,KAAK;EACLI,OAAO,EAAE,MAAM;EACfC,SAAS,EAAE,IAAI;EACfC,IAAIA,CAAE;IAAEC,KAAK;IAAEC;EAAS,CAAC,EAAG;IAC3B,SAASC,mBAAmBA,CAAA,EAAG;MAC9BD,QAAQ,CAAE,IAAAE,gBAAM,EAAEH,KAAK,EAAE,QAAS,CAAE,CAAC;IACtC;IAEA,OACC,IAAAI,MAAA,CAAAC,aAAA,EAACd,YAAA,CAAAe,gBAAgB;MAChBC,IAAI,EAAC,cAAc;MACnBC,SAAS,EAAC,GAAG;MACbC,KAAK,EAAGP;IAAqB,CAC7B,CAAC;EAEJ;AACD,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_richText","_blockEditor","_icons","name","title","__","strikethrough","exports","tagName","className","edit","isActive","value","onChange","onFocus","onClick","toggleFormat","type","_react","createElement","Fragment","RichTextShortcut","character","onUse","RichTextToolbarButton","icon","formatStrikethrough","role"],"sources":["@wordpress/format-library/src/strikethrough/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { toggleFormat } from '@wordpress/rich-text';\nimport {\n\tRichTextToolbarButton,\n\tRichTextShortcut,\n} from '@wordpress/block-editor';\nimport { formatStrikethrough } from '@wordpress/icons';\n\nconst name = 'core/strikethrough';\nconst title = __( 'Strikethrough' );\n\nexport const strikethrough = {\n\tname,\n\ttitle,\n\ttagName: 's',\n\tclassName: null,\n\tedit( { isActive, value, onChange, onFocus } ) {\n\t\tfunction onClick() {\n\t\t\tonChange( toggleFormat( value, { type: name, title } ) );\n\t\t\tonFocus();\n\t\t}\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<RichTextShortcut\n\t\t\t\t\ttype=\"access\"\n\t\t\t\t\tcharacter=\"d\"\n\t\t\t\t\tonUse={ onClick }\n\t\t\t\t/>\n\t\t\t\t<RichTextToolbarButton\n\t\t\t\t\ticon={ formatStrikethrough }\n\t\t\t\t\ttitle={ title }\n\t\t\t\t\tonClick={ onClick }\n\t\t\t\t\tisActive={ isActive }\n\t\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t},\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAIA,IAAAG,MAAA,GAAAH,OAAA;AATA;AACA;AACA;;AASA,MAAMI,IAAI,GAAG,oBAAoB;AACjC,MAAMC,KAAK,GAAG,IAAAC,QAAE,EAAE,eAAgB,CAAC;AAE5B,MAAMC,aAAa,GAAAC,OAAA,CAAAD,aAAA,GAAG;EAC5BH,IAAI;EACJC,KAAK;EACLI,OAAO,EAAE,GAAG;EACZC,SAAS,EAAE,IAAI;EACfC,IAAIA,CAAE;IAAEC,QAAQ;IAAEC,KAAK;IAAEC,QAAQ;IAAEC;EAAQ,CAAC,EAAG;IAC9C,SAASC,OAAOA,CAAA,EAAG;MAClBF,QAAQ,CAAE,IAAAG,sBAAY,EAAEJ,KAAK,EAAE;QAAEK,IAAI,EAAEd,IAAI;QAAEC;MAAM,CAAE,CAAE,CAAC;MACxDU,OAAO,CAAC,CAAC;IACV;IAEA,OACC,IAAAI,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAE,QAAA,QACC,IAAAF,MAAA,CAAAC,aAAA,EAAClB,YAAA,CAAAoB,gBAAgB;MAChBJ,IAAI,EAAC,QAAQ;MACbK,SAAS,EAAC,GAAG;MACbC,KAAK,EAAGR;IAAS,CACjB,CAAC,EACF,IAAAG,MAAA,CAAAC,aAAA,EAAClB,YAAA,CAAAuB,qBAAqB;MACrBC,IAAI,EAAGC,0BAAqB;MAC5BtB,KAAK,EAAGA,KAAO;MACfW,OAAO,EAAGA,OAAS;MACnBJ,QAAQ,EAAGA,QAAU;MACrBgB,IAAI,EAAC;IAAkB,CACvB,CACA,CAAC;EAEL;AACD,CAAC"}
1
+ {"version":3,"names":["_i18n","require","_richText","_blockEditor","_icons","name","title","__","strikethrough","exports","tagName","className","edit","isActive","value","onChange","onFocus","onClick","toggleFormat","type","_react","createElement","Fragment","RichTextShortcut","character","onUse","RichTextToolbarButton","icon","formatStrikethrough","role"],"sources":["@wordpress/format-library/src/strikethrough/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { toggleFormat } from '@wordpress/rich-text';\nimport {\n\tRichTextToolbarButton,\n\tRichTextShortcut,\n} from '@wordpress/block-editor';\nimport { formatStrikethrough } from '@wordpress/icons';\n\nconst name = 'core/strikethrough';\nconst title = __( 'Strikethrough' );\n\nexport const strikethrough = {\n\tname,\n\ttitle,\n\ttagName: 's',\n\tclassName: null,\n\tedit( { isActive, value, onChange, onFocus } ) {\n\t\tfunction onClick() {\n\t\t\tonChange( toggleFormat( value, { type: name, title } ) );\n\t\t\tonFocus();\n\t\t}\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<RichTextShortcut\n\t\t\t\t\ttype=\"access\"\n\t\t\t\t\tcharacter=\"d\"\n\t\t\t\t\tonUse={ onClick }\n\t\t\t\t/>\n\t\t\t\t<RichTextToolbarButton\n\t\t\t\t\ticon={ formatStrikethrough }\n\t\t\t\t\ttitle={ title }\n\t\t\t\t\tonClick={ onClick }\n\t\t\t\t\t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richText","_blockEditor","_icons","name","title","__","subscript","exports","tagName","className","edit","isActive","value","onChange","onFocus","onToggle","toggleFormat","type","onClick","_react","createElement","RichTextToolbarButton","icon","subscriptIcon","role"],"sources":["@wordpress/format-library/src/subscript/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { toggleFormat } from '@wordpress/rich-text';\nimport { RichTextToolbarButton } from '@wordpress/block-editor';\nimport { subscript as subscriptIcon } from '@wordpress/icons';\n\nconst name = 'core/subscript';\nconst title = __( 'Subscript' );\n\nexport const subscript = {\n\tname,\n\ttitle,\n\ttagName: 'sub',\n\tclassName: null,\n\tedit( { isActive, value, onChange, onFocus } ) {\n\t\tfunction onToggle() {\n\t\t\tonChange( toggleFormat( value, { type: name, title } ) );\n\t\t}\n\n\t\tfunction onClick() {\n\t\t\tonToggle();\n\t\t\tonFocus();\n\t\t}\n\n\t\treturn (\n\t\t\t<RichTextToolbarButton\n\t\t\t\ticon={ subscriptIcon }\n\t\t\t\ttitle={ title }\n\t\t\t\tonClick={ onClick }\n\t\t\t\tisActive={ isActive }\n\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t/>\n\t\t);\n\t},\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AANA;AACA;AACA;;AAMA,MAAMI,IAAI,GAAG,gBAAgB;AAC7B,MAAMC,KAAK,GAAG,IAAAC,QAAE,EAAE,WAAY,CAAC;AAExB,MAAMC,SAAS,GAAAC,OAAA,CAAAD,SAAA,GAAG;EACxBH,IAAI;EACJC,KAAK;EACLI,OAAO,EAAE,KAAK;EACdC,SAAS,EAAE,IAAI;EACfC,IAAIA,CAAE;IAAEC,QAAQ;IAAEC,KAAK;IAAEC,QAAQ;IAAEC;EAAQ,CAAC,EAAG;IAC9C,SAASC,QAAQA,CAAA,EAAG;MACnBF,QAAQ,CAAE,IAAAG,sBAAY,EAAEJ,KAAK,EAAE;QAAEK,IAAI,EAAEd,IAAI;QAAEC;MAAM,CAAE,CAAE,CAAC;IACzD;IAEA,SAASc,OAAOA,CAAA,EAAG;MAClBH,QAAQ,CAAC,CAAC;MACVD,OAAO,CAAC,CAAC;IACV;IAEA,OACC,IAAAK,MAAA,CAAAC,aAAA,EAACnB,YAAA,CAAAoB,qBAAqB;MACrBC,IAAI,EAAGC,gBAAe;MACtBnB,KAAK,EAAGA,KAAO;MACfc,OAAO,EAAGA,OAAS;MACnBP,QAAQ,EAAGA,QAAU;MACrBa,IAAI,EAAC;IAAkB,CACvB,CAAC;EAEJ;AACD,CAAC"}
1
+ {"version":3,"names":["_i18n","require","_richText","_blockEditor","_icons","name","title","__","subscript","exports","tagName","className","edit","isActive","value","onChange","onFocus","onToggle","toggleFormat","type","onClick","_react","createElement","RichTextToolbarButton","icon","subscriptIcon","role"],"sources":["@wordpress/format-library/src/subscript/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { toggleFormat } from '@wordpress/rich-text';\nimport { RichTextToolbarButton } from '@wordpress/block-editor';\nimport { subscript as subscriptIcon } from '@wordpress/icons';\n\nconst name = 'core/subscript';\nconst title = __( 'Subscript' );\n\nexport const subscript = {\n\tname,\n\ttitle,\n\ttagName: 'sub',\n\tclassName: null,\n\tedit( { isActive, value, onChange, onFocus } ) {\n\t\tfunction onToggle() {\n\t\t\tonChange( toggleFormat( value, { type: name, title } ) );\n\t\t}\n\n\t\tfunction onClick() {\n\t\t\tonToggle();\n\t\t\tonFocus();\n\t\t}\n\n\t\treturn (\n\t\t\t<RichTextToolbarButton\n\t\t\t\ticon={ subscriptIcon }\n\t\t\t\ttitle={ title }\n\t\t\t\tonClick={ onClick }\n\t\t\t\tisActive={ isActive }\n\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t/>\n\t\t);\n\t},\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AANA;AACA;AACA;;AAMA,MAAMI,IAAI,GAAG,gBAAgB;AAC7B,MAAMC,KAAK,GAAG,IAAAC,QAAE,EAAE,WAAY,CAAC;AAExB,MAAMC,SAAS,GAAAC,OAAA,CAAAD,SAAA,GAAG;EACxBH,IAAI;EACJC,KAAK;EACLI,OAAO,EAAE,KAAK;EACdC,SAAS,EAAE,IAAI;EACfC,IAAIA,CAAE;IAAEC,QAAQ;IAAEC,KAAK;IAAEC,QAAQ;IAAEC;EAAQ,CAAC,EAAG;IAC9C,SAASC,QAAQA,CAAA,EAAG;MACnBF,QAAQ,CAAE,IAAAG,sBAAY,EAAEJ,KAAK,EAAE;QAAEK,IAAI,EAAEd,IAAI;QAAEC;MAAM,CAAE,CAAE,CAAC;IACzD;IAEA,SAASc,OAAOA,CAAA,EAAG;MAClBH,QAAQ,CAAC,CAAC;MACVD,OAAO,CAAC,CAAC;IACV;IAEA,OACC,IAAAK,MAAA,CAAAC,aAAA,EAACnB,YAAA,CAAAoB,qBAAqB;MACrBC,IAAI,EAAGC,gBAAe;MACtBnB,KAAK,EAAGA,KAAO;MACfc,OAAO,EAAGA,OAAS;MACnBP,QAAQ,EAAGA,QAAU;MACrBa,IAAI,EAAC;IAAkB,CACvB,CAAC;EAEJ;AACD,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_richText","_blockEditor","_icons","name","title","__","superscript","exports","tagName","className","edit","isActive","value","onChange","onFocus","onToggle","toggleFormat","type","onClick","_react","createElement","RichTextToolbarButton","icon","superscriptIcon","role"],"sources":["@wordpress/format-library/src/superscript/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { toggleFormat } from '@wordpress/rich-text';\nimport { RichTextToolbarButton } from '@wordpress/block-editor';\nimport { superscript as superscriptIcon } from '@wordpress/icons';\n\nconst name = 'core/superscript';\nconst title = __( 'Superscript' );\n\nexport const superscript = {\n\tname,\n\ttitle,\n\ttagName: 'sup',\n\tclassName: null,\n\tedit( { isActive, value, onChange, onFocus } ) {\n\t\tfunction onToggle() {\n\t\t\tonChange( toggleFormat( value, { type: name, title } ) );\n\t\t}\n\n\t\tfunction onClick() {\n\t\t\tonToggle();\n\t\t\tonFocus();\n\t\t}\n\n\t\treturn (\n\t\t\t<RichTextToolbarButton\n\t\t\t\ticon={ superscriptIcon }\n\t\t\t\ttitle={ title }\n\t\t\t\tonClick={ onClick }\n\t\t\t\tisActive={ isActive }\n\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t/>\n\t\t);\n\t},\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AANA;AACA;AACA;;AAMA,MAAMI,IAAI,GAAG,kBAAkB;AAC/B,MAAMC,KAAK,GAAG,IAAAC,QAAE,EAAE,aAAc,CAAC;AAE1B,MAAMC,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG;EAC1BH,IAAI;EACJC,KAAK;EACLI,OAAO,EAAE,KAAK;EACdC,SAAS,EAAE,IAAI;EACfC,IAAIA,CAAE;IAAEC,QAAQ;IAAEC,KAAK;IAAEC,QAAQ;IAAEC;EAAQ,CAAC,EAAG;IAC9C,SAASC,QAAQA,CAAA,EAAG;MACnBF,QAAQ,CAAE,IAAAG,sBAAY,EAAEJ,KAAK,EAAE;QAAEK,IAAI,EAAEd,IAAI;QAAEC;MAAM,CAAE,CAAE,CAAC;IACzD;IAEA,SAASc,OAAOA,CAAA,EAAG;MAClBH,QAAQ,CAAC,CAAC;MACVD,OAAO,CAAC,CAAC;IACV;IAEA,OACC,IAAAK,MAAA,CAAAC,aAAA,EAACnB,YAAA,CAAAoB,qBAAqB;MACrBC,IAAI,EAAGC,kBAAiB;MACxBnB,KAAK,EAAGA,KAAO;MACfc,OAAO,EAAGA,OAAS;MACnBP,QAAQ,EAAGA,QAAU;MACrBa,IAAI,EAAC;IAAkB,CACvB,CAAC;EAEJ;AACD,CAAC"}
1
+ {"version":3,"names":["_i18n","require","_richText","_blockEditor","_icons","name","title","__","superscript","exports","tagName","className","edit","isActive","value","onChange","onFocus","onToggle","toggleFormat","type","onClick","_react","createElement","RichTextToolbarButton","icon","superscriptIcon","role"],"sources":["@wordpress/format-library/src/superscript/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { toggleFormat } from '@wordpress/rich-text';\nimport { RichTextToolbarButton } from '@wordpress/block-editor';\nimport { superscript as superscriptIcon } from '@wordpress/icons';\n\nconst name = 'core/superscript';\nconst title = __( 'Superscript' );\n\nexport const superscript = {\n\tname,\n\ttitle,\n\ttagName: 'sup',\n\tclassName: null,\n\tedit( { isActive, value, onChange, onFocus } ) {\n\t\tfunction onToggle() {\n\t\t\tonChange( toggleFormat( value, { type: name, title } ) );\n\t\t}\n\n\t\tfunction onClick() {\n\t\t\tonToggle();\n\t\t\tonFocus();\n\t\t}\n\n\t\treturn (\n\t\t\t<RichTextToolbarButton\n\t\t\t\ticon={ superscriptIcon }\n\t\t\t\ttitle={ title }\n\t\t\t\tonClick={ onClick }\n\t\t\t\tisActive={ isActive }\n\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t/>\n\t\t);\n\t},\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AANA;AACA;AACA;;AAMA,MAAMI,IAAI,GAAG,kBAAkB;AAC/B,MAAMC,KAAK,GAAG,IAAAC,QAAE,EAAE,aAAc,CAAC;AAE1B,MAAMC,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG;EAC1BH,IAAI;EACJC,KAAK;EACLI,OAAO,EAAE,KAAK;EACdC,SAAS,EAAE,IAAI;EACfC,IAAIA,CAAE;IAAEC,QAAQ;IAAEC,KAAK;IAAEC,QAAQ;IAAEC;EAAQ,CAAC,EAAG;IAC9C,SAASC,QAAQA,CAAA,EAAG;MACnBF,QAAQ,CAAE,IAAAG,sBAAY,EAAEJ,KAAK,EAAE;QAAEK,IAAI,EAAEd,IAAI;QAAEC;MAAM,CAAE,CAAE,CAAC;IACzD;IAEA,SAASc,OAAOA,CAAA,EAAG;MAClBH,QAAQ,CAAC,CAAC;MACVD,OAAO,CAAC,CAAC;IACV;IAEA,OACC,IAAAK,MAAA,CAAAC,aAAA,EAACnB,YAAA,CAAAoB,qBAAqB;MACrBC,IAAI,EAAGC,kBAAiB;MACxBnB,KAAK,EAAGA,KAAO;MACfc,OAAO,EAAGA,OAAS;MACnBP,QAAQ,EAAGA,QAAU;MACrBa,IAAI,EAAC;IAAkB,CACvB,CAAC;EAEJ;AACD,CAAC","ignoreList":[]}
@@ -12,7 +12,7 @@ var _icons = require("@wordpress/icons");
12
12
  var _richText = require("@wordpress/rich-text");
13
13
  var _inline = _interopRequireWildcard(require("./inline"));
14
14
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
15
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
15
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
16
16
  /**
17
17
  * WordPress dependencies
18
18
  */
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_element","_blockEditor","_icons","_richText","_inline","_interopRequireWildcard","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","transparentValue","exports","name","title","__","EMPTY_ARRAY","getComputedStyleProperty","element","property","ownerDocument","defaultView","style","getComputedStyle","value","getPropertyValue","parentElement","fillComputedColors","color","backgroundColor","TextColorEdit","onChange","isActive","activeAttributes","contentRef","allowCustomControl","colors","useSettings","isAddingColor","setIsAddingColor","useState","enableIsAddingColor","useCallback","disableIsAddingColor","colorIndicatorStyle","useMemo","current","getActiveColors","hasColorsToChoose","length","_react","createElement","Fragment","RichTextToolbarButton","className","icon","Icon","keys","textColorIcon","colorIcon","onClick","removeFormat","role","onClose","textColor","tagName","attributes","class","edit"],"sources":["@wordpress/format-library/src/text-color/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useCallback, useMemo, useState } from '@wordpress/element';\nimport { RichTextToolbarButton, useSettings } from '@wordpress/block-editor';\nimport {\n\tIcon,\n\tcolor as colorIcon,\n\ttextColor as textColorIcon,\n} from '@wordpress/icons';\nimport { removeFormat } from '@wordpress/rich-text';\n\n/**\n * Internal dependencies\n */\nimport { default as InlineColorUI, getActiveColors } from './inline';\n\nexport const transparentValue = 'rgba(0, 0, 0, 0)';\n\nconst name = 'core/text-color';\nconst title = __( 'Highlight' );\n\nconst EMPTY_ARRAY = [];\n\nfunction getComputedStyleProperty( element, property ) {\n\tconst { ownerDocument } = element;\n\tconst { defaultView } = ownerDocument;\n\tconst style = defaultView.getComputedStyle( element );\n\tconst value = style.getPropertyValue( property );\n\n\tif (\n\t\tproperty === 'background-color' &&\n\t\tvalue === transparentValue &&\n\t\telement.parentElement\n\t) {\n\t\treturn getComputedStyleProperty( element.parentElement, property );\n\t}\n\n\treturn value;\n}\n\nfunction fillComputedColors( element, { color, backgroundColor } ) {\n\tif ( ! color && ! backgroundColor ) {\n\t\treturn;\n\t}\n\n\treturn {\n\t\tcolor: color || getComputedStyleProperty( element, 'color' ),\n\t\tbackgroundColor:\n\t\t\tbackgroundColor === transparentValue\n\t\t\t\t? getComputedStyleProperty( element, 'background-color' )\n\t\t\t\t: backgroundColor,\n\t};\n}\n\nfunction TextColorEdit( {\n\tvalue,\n\tonChange,\n\tisActive,\n\tactiveAttributes,\n\tcontentRef,\n} ) {\n\tconst [ allowCustomControl, colors = EMPTY_ARRAY ] = useSettings(\n\t\t'color.custom',\n\t\t'color.palette'\n\t);\n\tconst [ isAddingColor, setIsAddingColor ] = useState( false );\n\tconst enableIsAddingColor = useCallback(\n\t\t() => setIsAddingColor( true ),\n\t\t[ setIsAddingColor ]\n\t);\n\tconst disableIsAddingColor = useCallback(\n\t\t() => setIsAddingColor( false ),\n\t\t[ setIsAddingColor ]\n\t);\n\tconst colorIndicatorStyle = useMemo(\n\t\t() =>\n\t\t\tfillComputedColors(\n\t\t\t\tcontentRef.current,\n\t\t\t\tgetActiveColors( value, name, colors )\n\t\t\t),\n\t\t[ value, colors ]\n\t);\n\n\tconst hasColorsToChoose = colors.length || ! allowCustomControl;\n\tif ( ! hasColorsToChoose && ! isActive ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<RichTextToolbarButton\n\t\t\t\tclassName=\"format-library-text-color-button\"\n\t\t\t\tisActive={ isActive }\n\t\t\t\ticon={\n\t\t\t\t\t<Icon\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\tObject.keys( activeAttributes ).length\n\t\t\t\t\t\t\t\t? textColorIcon\n\t\t\t\t\t\t\t\t: colorIcon\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstyle={ colorIndicatorStyle }\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\ttitle={ title }\n\t\t\t\t// If has no colors to choose but a color is active remove the color onClick.\n\t\t\t\tonClick={\n\t\t\t\t\thasColorsToChoose\n\t\t\t\t\t\t? enableIsAddingColor\n\t\t\t\t\t\t: () => onChange( removeFormat( value, name ) )\n\t\t\t\t}\n\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t/>\n\t\t\t{ isAddingColor && (\n\t\t\t\t<InlineColorUI\n\t\t\t\t\tname={ name }\n\t\t\t\t\tonClose={ disableIsAddingColor }\n\t\t\t\t\tactiveAttributes={ activeAttributes }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t\tisActive={ isActive }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport const textColor = {\n\tname,\n\ttitle,\n\ttagName: 'mark',\n\tclassName: 'has-inline-color',\n\tattributes: {\n\t\tstyle: 'style',\n\t\tclass: 'class',\n\t},\n\tedit: TextColorEdit,\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAKA,IAAAI,SAAA,GAAAJ,OAAA;AAKA,IAAAK,OAAA,GAAAC,uBAAA,CAAAN,OAAA;AAAqE,SAAAO,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,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ACrCT,KAAK,EAAGA,KAAO;IACfO,QAAQ,EAAGA,QAAU;IACrBG,UAAU,EAAGA,UAAY;IACzBF,QAAQ,EAAGA;EAAU,CACrB,CAED,CAAC;AAEL;AAEO,MAAMgC,SAAS,GAAApD,OAAA,CAAAoD,SAAA,GAAG;EACxBnD,IAAI;EACJC,KAAK;EACLmD,OAAO,EAAE,MAAM;EACfX,SAAS,EAAE,kBAAkB;EAC7BY,UAAU,EAAE;IACX5C,KAAK,EAAE,OAAO;IACd6C,KAAK,EAAE;EACR,CAAC;EACDC,IAAI,EAAEtC;AACP,CAAC"}
1
+ {"version":3,"names":["_i18n","require","_element","_blockEditor","_icons","_richText","_inline","_interopRequireWildcard","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","transparentValue","exports","name","title","__","EMPTY_ARRAY","getComputedStyleProperty","element","property","ownerDocument","defaultView","style","getComputedStyle","value","getPropertyValue","parentElement","fillComputedColors","color","backgroundColor","TextColorEdit","onChange","isActive","activeAttributes","contentRef","allowCustomControl","colors","useSettings","isAddingColor","setIsAddingColor","useState","enableIsAddingColor","useCallback","disableIsAddingColor","colorIndicatorStyle","useMemo","current","getActiveColors","hasColorsToChoose","length","_react","createElement","Fragment","RichTextToolbarButton","className","icon","Icon","keys","textColorIcon","colorIcon","onClick","removeFormat","role","onClose","textColor","tagName","attributes","class","edit"],"sources":["@wordpress/format-library/src/text-color/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useCallback, useMemo, useState } from '@wordpress/element';\nimport { RichTextToolbarButton, useSettings } from '@wordpress/block-editor';\nimport {\n\tIcon,\n\tcolor as colorIcon,\n\ttextColor as textColorIcon,\n} from '@wordpress/icons';\nimport { removeFormat } from '@wordpress/rich-text';\n\n/**\n * Internal dependencies\n */\nimport { default as InlineColorUI, getActiveColors } from './inline';\n\nexport const transparentValue = 'rgba(0, 0, 0, 0)';\n\nconst name = 'core/text-color';\nconst title = __( 'Highlight' );\n\nconst EMPTY_ARRAY = [];\n\nfunction getComputedStyleProperty( element, property ) {\n\tconst { ownerDocument } = element;\n\tconst { defaultView } = ownerDocument;\n\tconst style = defaultView.getComputedStyle( element );\n\tconst value = style.getPropertyValue( property );\n\n\tif (\n\t\tproperty === 'background-color' &&\n\t\tvalue === transparentValue &&\n\t\telement.parentElement\n\t) {\n\t\treturn getComputedStyleProperty( element.parentElement, property );\n\t}\n\n\treturn value;\n}\n\nfunction fillComputedColors( element, { color, backgroundColor } ) {\n\tif ( ! color && ! backgroundColor ) {\n\t\treturn;\n\t}\n\n\treturn {\n\t\tcolor: color || getComputedStyleProperty( element, 'color' ),\n\t\tbackgroundColor:\n\t\t\tbackgroundColor === transparentValue\n\t\t\t\t? getComputedStyleProperty( element, 'background-color' )\n\t\t\t\t: backgroundColor,\n\t};\n}\n\nfunction TextColorEdit( {\n\tvalue,\n\tonChange,\n\tisActive,\n\tactiveAttributes,\n\tcontentRef,\n} ) {\n\tconst [ allowCustomControl, colors = EMPTY_ARRAY ] = useSettings(\n\t\t'color.custom',\n\t\t'color.palette'\n\t);\n\tconst [ isAddingColor, setIsAddingColor ] = useState( false );\n\tconst enableIsAddingColor = useCallback(\n\t\t() => setIsAddingColor( true ),\n\t\t[ setIsAddingColor ]\n\t);\n\tconst disableIsAddingColor = useCallback(\n\t\t() => setIsAddingColor( false ),\n\t\t[ setIsAddingColor ]\n\t);\n\tconst colorIndicatorStyle = useMemo(\n\t\t() =>\n\t\t\tfillComputedColors(\n\t\t\t\tcontentRef.current,\n\t\t\t\tgetActiveColors( value, name, colors )\n\t\t\t),\n\t\t[ value, colors ]\n\t);\n\n\tconst hasColorsToChoose = colors.length || ! allowCustomControl;\n\tif ( ! hasColorsToChoose && ! isActive ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<RichTextToolbarButton\n\t\t\t\tclassName=\"format-library-text-color-button\"\n\t\t\t\tisActive={ isActive }\n\t\t\t\ticon={\n\t\t\t\t\t<Icon\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\tObject.keys( activeAttributes ).length\n\t\t\t\t\t\t\t\t? textColorIcon\n\t\t\t\t\t\t\t\t: colorIcon\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstyle={ colorIndicatorStyle }\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\ttitle={ title }\n\t\t\t\t// If has no colors to choose but a color is active remove the color onClick.\n\t\t\t\tonClick={\n\t\t\t\t\thasColorsToChoose\n\t\t\t\t\t\t? enableIsAddingColor\n\t\t\t\t\t\t: () => onChange( removeFormat( value, name ) )\n\t\t\t\t}\n\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t/>\n\t\t\t{ isAddingColor && (\n\t\t\t\t<InlineColorUI\n\t\t\t\t\tname={ name }\n\t\t\t\t\tonClose={ disableIsAddingColor }\n\t\t\t\t\tactiveAttributes={ activeAttributes }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t\tisActive={ isActive }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport const textColor = {\n\tname,\n\ttitle,\n\ttagName: 'mark',\n\tclassName: 'has-inline-color',\n\tattributes: {\n\t\tstyle: 'style',\n\t\tclass: 'class',\n\t},\n\tedit: TextColorEdit,\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAKA,IAAAI,SAAA,GAAAJ,OAAA;AAKA,IAAAK,OAAA,GAAAC,uBAAA,CAAAN,OAAA;AAAqE,SAAAO,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF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AAU;IACrBG,UAAU,EAAGA,UAAY;IACzBF,QAAQ,EAAGA;EAAU,CACrB,CAED,CAAC;AAEL;AAEO,MAAMgC,SAAS,GAAApD,OAAA,CAAAoD,SAAA,GAAG;EACxBnD,IAAI;EACJC,KAAK;EACLmD,OAAO,EAAE,MAAM;EACfX,SAAS,EAAE,kBAAkB;EAC7BY,UAAU,EAAE;IACX5C,KAAK,EAAE,OAAO;IACd6C,KAAK,EAAE;EACR,CAAC;EACDC,IAAI,EAAEtC;AACP,CAAC","ignoreList":[]}
@@ -14,8 +14,8 @@ var _components = require("@wordpress/components");
14
14
  var _icons = require("@wordpress/icons");
15
15
  var _richText = require("@wordpress/rich-text");
16
16
  var _compose = require("@wordpress/compose");
17
- var _inline = require("./inline.js");
18
- var _inline2 = _interopRequireDefault(require("./inline"));
17
+ var _inlineNative = require("./inline.native.js");
18
+ var _inline = _interopRequireDefault(require("./inline"));
19
19
  var _style = _interopRequireDefault(require("./style.scss"));
20
20
  /**
21
21
  * External dependencies
@@ -71,7 +71,7 @@ function TextColorEdit({
71
71
  const [isAddingColor, setIsAddingColor] = (0, _element.useState)(false);
72
72
  const enableIsAddingColor = (0, _element.useCallback)(() => setIsAddingColor(true), [setIsAddingColor]);
73
73
  const disableIsAddingColor = (0, _element.useCallback)(() => setIsAddingColor(false), [setIsAddingColor]);
74
- const colorIndicatorStyle = (0, _element.useMemo)(() => fillComputedColors(contentRef, (0, _inline.getActiveColors)(value, name, colors)), [value, colors]);
74
+ const colorIndicatorStyle = (0, _element.useMemo)(() => fillComputedColors(contentRef, (0, _inlineNative.getActiveColors)(value, name, colors)), [value, colors]);
75
75
  const hasColorsToChoose = colors.length || !allowCustomControl;
76
76
  const onPressButton = (0, _element.useCallback)(() => {
77
77
  if (hasColorsToChoose) {
@@ -114,7 +114,7 @@ function TextColorEdit({
114
114
  // If has no colors to choose but a color is active remove the color onClick
115
115
  ,
116
116
  onClick: onPressButton
117
- }))), isAddingColor && (0, _react.createElement)(_inline2.default, {
117
+ }))), isAddingColor && (0, _react.createElement)(_inline.default, {
118
118
  name: name,
119
119
  onClose: disableIsAddingColor,
120
120
  activeAttributes: activeAttributes,
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_i18n","_element","_blockEditor","_components","_icons","_richText","_compose","_inline","_inline2","_interopRequireDefault","_style","name","title","__","getComputedStyleProperty","element","property","_element$props$style","style","props","backgroundColor","baseColors","color","background","fillComputedColors","TextColorEdit","value","onChange","isActive","activeAttributes","contentRef","allowCustomControl","useSettings","colors","useMobileGlobalStylesColors","isAddingColor","setIsAddingColor","useState","enableIsAddingColor","useCallback","disableIsAddingColor","colorIndicatorStyle","useMemo","getActiveColors","hasColorsToChoose","length","onPressButton","removeFormat","outlineStyle","usePreferredColorSchemeStyle","styles","borderWidth","StyleSheet","hairlineWidth","isActiveStyle","customContainerStyles","_react","createElement","Fragment","BlockControls","ToolbarGroup","View","pointerEvents","ToolbarButton","icon","Icon","Object","keys","textColorIcon","colorIcon","extraProps","onClick","default","onClose","textColor","exports","tagName","className","attributes","class","edit"],"sources":["@wordpress/format-library/src/text-color/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { StyleSheet, View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useCallback, useMemo, useState } from '@wordpress/element';\nimport { BlockControls, useSettings } from '@wordpress/block-editor';\nimport {\n\tToolbarGroup,\n\tToolbarButton,\n\tuseMobileGlobalStylesColors,\n} from '@wordpress/components';\nimport {\n\tIcon,\n\tcolor as colorIcon,\n\ttextColor as textColorIcon,\n} from '@wordpress/icons';\nimport { removeFormat } from '@wordpress/rich-text';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { getActiveColors } from './inline.js';\nimport { default as InlineColorUI } from './inline';\nimport styles from './style.scss';\n\nconst name = 'core/text-color';\nconst title = __( 'Text color' );\n\nfunction getComputedStyleProperty( element, property ) {\n\tconst style = element?.props?.style ?? {};\n\n\tif ( property === 'background-color' ) {\n\t\tconst { backgroundColor, baseColors } = style;\n\n\t\tif ( backgroundColor !== 'transparent' ) {\n\t\t\treturn backgroundColor;\n\t\t} else if ( baseColors && baseColors?.color?.background ) {\n\t\t\treturn baseColors?.color?.background;\n\t\t}\n\n\t\treturn 'transparent';\n\t}\n}\n\nfunction fillComputedColors( element, { color, backgroundColor } ) {\n\tif ( ! color && ! backgroundColor ) {\n\t\treturn;\n\t}\n\n\treturn {\n\t\tcolor: color || getComputedStyleProperty( element, 'color' ),\n\t\tbackgroundColor: getComputedStyleProperty(\n\t\t\telement,\n\t\t\t'background-color'\n\t\t),\n\t};\n}\n\nfunction TextColorEdit( {\n\tvalue,\n\tonChange,\n\tisActive,\n\tactiveAttributes,\n\tcontentRef,\n} ) {\n\tconst [ allowCustomControl ] = useSettings( 'color.custom' );\n\tconst colors = useMobileGlobalStylesColors();\n\tconst [ isAddingColor, setIsAddingColor ] = useState( false );\n\tconst enableIsAddingColor = useCallback(\n\t\t() => setIsAddingColor( true ),\n\t\t[ setIsAddingColor ]\n\t);\n\tconst disableIsAddingColor = useCallback(\n\t\t() => setIsAddingColor( false ),\n\t\t[ setIsAddingColor ]\n\t);\n\tconst colorIndicatorStyle = useMemo(\n\t\t() =>\n\t\t\tfillComputedColors(\n\t\t\t\tcontentRef,\n\t\t\t\tgetActiveColors( value, name, colors )\n\t\t\t),\n\t\t[ value, colors ]\n\t);\n\n\tconst hasColorsToChoose = colors.length || ! allowCustomControl;\n\n\tconst onPressButton = useCallback( () => {\n\t\tif ( hasColorsToChoose ) {\n\t\t\tenableIsAddingColor();\n\t\t} else {\n\t\t\tonChange( removeFormat( value, name ) );\n\t\t}\n\t}, [ hasColorsToChoose, value ] );\n\n\tconst outlineStyle = [\n\t\tusePreferredColorSchemeStyle(\n\t\t\tstyles[ 'components-inline-color__outline' ],\n\t\t\tstyles[ 'components-inline-color__outline--dark' ]\n\t\t),\n\t\t{ borderWidth: StyleSheet.hairlineWidth },\n\t];\n\n\tif ( ! hasColorsToChoose && ! isActive ) {\n\t\treturn null;\n\t}\n\n\tconst isActiveStyle = {\n\t\t...colorIndicatorStyle,\n\t\t...( ! colorIndicatorStyle?.backgroundColor\n\t\t\t? { backgroundColor: 'transparent' }\n\t\t\t: {} ),\n\t\t...styles[ 'components-inline-color--is-active' ],\n\t};\n\n\tconst customContainerStyles =\n\t\tstyles[ 'components-inline-color__button-container' ];\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t{ isActive && (\n\t\t\t\t\t\t<View style={ outlineStyle } pointerEvents=\"none\" />\n\t\t\t\t\t) }\n\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tname=\"text-color\"\n\t\t\t\t\t\tisActive={ isActive }\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\tObject.keys( activeAttributes ).length\n\t\t\t\t\t\t\t\t\t\t? textColorIcon\n\t\t\t\t\t\t\t\t\t\t: colorIcon\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\t\tcolorIndicatorStyle?.color && {\n\t\t\t\t\t\t\t\t\t\tcolor: colorIndicatorStyle.color,\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttitle={ title }\n\t\t\t\t\t\textraProps={ {\n\t\t\t\t\t\t\tisActiveStyle,\n\t\t\t\t\t\t\tcustomContainerStyles,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\t// If has no colors to choose but a color is active remove the color onClick\n\t\t\t\t\t\tonClick={ onPressButton }\n\t\t\t\t\t/>\n\t\t\t\t</ToolbarGroup>\n\t\t\t</BlockControls>\n\t\t\t{ isAddingColor && (\n\t\t\t\t<InlineColorUI\n\t\t\t\t\tname={ name }\n\t\t\t\t\tonClose={ disableIsAddingColor }\n\t\t\t\t\tactiveAttributes={ activeAttributes }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport const textColor = {\n\tname,\n\ttitle,\n\ttagName: 'mark',\n\tclassName: 'has-inline-color',\n\tattributes: {\n\t\tstyle: 'style',\n\t\tclass: 'class',\n\t},\n\tedit: TextColorEdit,\n};\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AAKA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAKA,IAAAQ,OAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAC,sBAAA,CAAAV,OAAA;AACA,IAAAW,MAAA,GAAAD,sBAAA,CAAAV,OAAA;AA7BA;AACA;AACA;;AAGA;AACA;AACA;;AAiBA;AACA;AACA;;AAKA,MAAMY,IAAI,GAAG,iBAAiB;AAC9B,MAAMC,KAAK,GAAG,IAAAC,QAAE,EAAE,YAAa,CAAC;AAEhC,SAASC,wBAAwBA,CAAEC,OAAO,EAAEC,QAAQ,EAAG;EAAA,IAAAC,oBAAA;EACtD,MAAMC,KAAK,IAAAD,oBAAA,GAAGF,OAAO,EAAEI,KAAK,EAAED,KAAK,cAAAD,oBAAA,cAAAA,oBAAA,GAAI,CAAC,CAAC;EAEzC,IAAKD,QAAQ,KAAK,kBAAkB,EAAG;IACtC,MAAM;MAAEI,eAAe;MAAEC;IAAW,CAAC,GAAGH,KAAK;IAE7C,IAAKE,eAAe,KAAK,aAAa,EAAG;MACxC,OAAOA,eAAe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AGA,QAAU;IACrBoC,IAAI,EACH,IAAAR,MAAA,CAAAC,aAAA,EAACrD,MAAA,CAAA6D,IAAI;MACJD,IAAI,EACHE,MAAM,CAACC,IAAI,CAAEtC,gBAAiB,CAAC,CAACgB,MAAM,GACnCuB,gBAAa,GACbC,YACH;MACDnD,KAAK,EACJuB,mBAAmB,EAAEnB,KAAK,IAAI;QAC7BA,KAAK,EAAEmB,mBAAmB,CAACnB;MAC5B;IACA,CACD,CACD;IACDV,KAAK,EAAGA,KAAO;IACf0D,UAAU,EAAG;MACZhB,aAAa;MACbC;IACD;IACA;IAAA;IACAgB,OAAO,EAAGzB;EAAe,CACzB,CACY,CACA,CAAC,EACdX,aAAa,IACd,IAAAqB,MAAA,CAAAC,aAAA,EAACjD,QAAA,CAAAgE,OAAa;IACb7D,IAAI,EAAGA,IAAM;IACb8D,OAAO,EAAGjC,oBAAsB;IAChCX,gBAAgB,EAAGA,gBAAkB;IACrCH,KAAK,EAAGA,KAAO;IACfC,QAAQ,EAAGA,QAAU;IACrBG,UAAU,EAAGA;EAAY,CACzB,CAED,CAAC;AAEL;AAEO,MAAM4C,SAAS,GAAAC,OAAA,CAAAD,SAAA,GAAG;EACxB/D,IAAI;EACJC,KAAK;EACLgE,OAAO,EAAE,MAAM;EACfC,SAAS,EAAE,kBAAkB;EAC7BC,UAAU,EAAE;IACX5D,KAAK,EAAE,OAAO;IACd6D,KAAK,EAAE;EACR,CAAC;EACDC,IAAI,EAAEvD;AACP,CAAC"}
1
+ {"version":3,"names":["_reactNative","require","_i18n","_element","_blockEditor","_components","_icons","_richText","_compose","_inlineNative","_inline","_interopRequireDefault","_style","name","title","__","getComputedStyleProperty","element","property","_element$props$style","style","props","backgroundColor","baseColors","color","background","fillComputedColors","TextColorEdit","value","onChange","isActive","activeAttributes","contentRef","allowCustomControl","useSettings","colors","useMobileGlobalStylesColors","isAddingColor","setIsAddingColor","useState","enableIsAddingColor","useCallback","disableIsAddingColor","colorIndicatorStyle","useMemo","getActiveColors","hasColorsToChoose","length","onPressButton","removeFormat","outlineStyle","usePreferredColorSchemeStyle","styles","borderWidth","StyleSheet","hairlineWidth","isActiveStyle","customContainerStyles","_react","createElement","Fragment","BlockControls","ToolbarGroup","View","pointerEvents","ToolbarButton","icon","Icon","Object","keys","textColorIcon","colorIcon","extraProps","onClick","default","onClose","textColor","exports","tagName","className","attributes","class","edit"],"sources":["@wordpress/format-library/src/text-color/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { StyleSheet, View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useCallback, useMemo, useState } from '@wordpress/element';\nimport { BlockControls, useSettings } from '@wordpress/block-editor';\nimport {\n\tToolbarGroup,\n\tToolbarButton,\n\tuseMobileGlobalStylesColors,\n} from '@wordpress/components';\nimport {\n\tIcon,\n\tcolor as colorIcon,\n\ttextColor as textColorIcon,\n} from '@wordpress/icons';\nimport { removeFormat } from '@wordpress/rich-text';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { getActiveColors } from './inline.native.js';\nimport { default as InlineColorUI } from './inline';\nimport styles from './style.scss';\n\nconst name = 'core/text-color';\nconst title = __( 'Text color' );\n\nfunction getComputedStyleProperty( element, property ) {\n\tconst style = element?.props?.style ?? {};\n\n\tif ( property === 'background-color' ) {\n\t\tconst { backgroundColor, baseColors } = style;\n\n\t\tif ( backgroundColor !== 'transparent' ) {\n\t\t\treturn backgroundColor;\n\t\t} else if ( baseColors && baseColors?.color?.background ) {\n\t\t\treturn baseColors?.color?.background;\n\t\t}\n\n\t\treturn 'transparent';\n\t}\n}\n\nfunction fillComputedColors( element, { color, backgroundColor } ) {\n\tif ( ! color && ! backgroundColor ) {\n\t\treturn;\n\t}\n\n\treturn {\n\t\tcolor: color || getComputedStyleProperty( element, 'color' ),\n\t\tbackgroundColor: getComputedStyleProperty(\n\t\t\telement,\n\t\t\t'background-color'\n\t\t),\n\t};\n}\n\nfunction TextColorEdit( {\n\tvalue,\n\tonChange,\n\tisActive,\n\tactiveAttributes,\n\tcontentRef,\n} ) {\n\tconst [ allowCustomControl ] = useSettings( 'color.custom' );\n\tconst colors = useMobileGlobalStylesColors();\n\tconst [ isAddingColor, setIsAddingColor ] = useState( false );\n\tconst enableIsAddingColor = useCallback(\n\t\t() => setIsAddingColor( true ),\n\t\t[ setIsAddingColor ]\n\t);\n\tconst disableIsAddingColor = useCallback(\n\t\t() => setIsAddingColor( false ),\n\t\t[ setIsAddingColor ]\n\t);\n\tconst colorIndicatorStyle = useMemo(\n\t\t() =>\n\t\t\tfillComputedColors(\n\t\t\t\tcontentRef,\n\t\t\t\tgetActiveColors( value, name, colors )\n\t\t\t),\n\t\t[ value, colors ]\n\t);\n\n\tconst hasColorsToChoose = colors.length || ! allowCustomControl;\n\n\tconst onPressButton = useCallback( () => {\n\t\tif ( hasColorsToChoose ) {\n\t\t\tenableIsAddingColor();\n\t\t} else {\n\t\t\tonChange( removeFormat( value, name ) );\n\t\t}\n\t}, [ hasColorsToChoose, value ] );\n\n\tconst outlineStyle = [\n\t\tusePreferredColorSchemeStyle(\n\t\t\tstyles[ 'components-inline-color__outline' ],\n\t\t\tstyles[ 'components-inline-color__outline--dark' ]\n\t\t),\n\t\t{ borderWidth: StyleSheet.hairlineWidth },\n\t];\n\n\tif ( ! hasColorsToChoose && ! isActive ) {\n\t\treturn null;\n\t}\n\n\tconst isActiveStyle = {\n\t\t...colorIndicatorStyle,\n\t\t...( ! colorIndicatorStyle?.backgroundColor\n\t\t\t? { backgroundColor: 'transparent' }\n\t\t\t: {} ),\n\t\t...styles[ 'components-inline-color--is-active' ],\n\t};\n\n\tconst customContainerStyles =\n\t\tstyles[ 'components-inline-color__button-container' ];\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t{ isActive && (\n\t\t\t\t\t\t<View style={ outlineStyle } pointerEvents=\"none\" />\n\t\t\t\t\t) }\n\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tname=\"text-color\"\n\t\t\t\t\t\tisActive={ isActive }\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\tObject.keys( activeAttributes ).length\n\t\t\t\t\t\t\t\t\t\t? textColorIcon\n\t\t\t\t\t\t\t\t\t\t: colorIcon\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\t\tcolorIndicatorStyle?.color && {\n\t\t\t\t\t\t\t\t\t\tcolor: colorIndicatorStyle.color,\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttitle={ title }\n\t\t\t\t\t\textraProps={ {\n\t\t\t\t\t\t\tisActiveStyle,\n\t\t\t\t\t\t\tcustomContainerStyles,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\t// If has no colors to choose but a color is active remove the color onClick\n\t\t\t\t\t\tonClick={ onPressButton }\n\t\t\t\t\t/>\n\t\t\t\t</ToolbarGroup>\n\t\t\t</BlockControls>\n\t\t\t{ isAddingColor && (\n\t\t\t\t<InlineColorUI\n\t\t\t\t\tname={ name }\n\t\t\t\t\tonClose={ disableIsAddingColor }\n\t\t\t\t\tactiveAttributes={ activeAttributes }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport const textColor = {\n\tname,\n\ttitle,\n\ttagName: 'mark',\n\tclassName: 'has-inline-color',\n\tattributes: {\n\t\tstyle: 'style',\n\t\tclass: 'class',\n\t},\n\tedit: TextColorEdit,\n};\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;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C,EACdX,aAAa,IACd,IAAAqB,MAAA,CAAAC,aAAA,EAACjD,OAAA,CAAAgE,OAAa;IACb7D,IAAI,EAAGA,IAAM;IACb8D,OAAO,EAAGjC,oBAAsB;IAChCX,gBAAgB,EAAGA,gBAAkB;IACrCH,KAAK,EAAGA,KAAO;IACfC,QAAQ,EAAGA,QAAU;IACrBG,UAAU,EAAGA;EAAY,CACzB,CAED,CAAC;AAEL;AAEO,MAAM4C,SAAS,GAAAC,OAAA,CAAAD,SAAA,GAAG;EACxB/D,IAAI;EACJC,KAAK;EACLgE,OAAO,EAAE,MAAM;EACfC,SAAS,EAAE,kBAAkB;EAC7BC,UAAU,EAAE;IACX5D,KAAK,EAAE,OAAO;IACd6D,KAAK,EAAE;EACR,CAAC;EACDC,IAAI,EAAEvD;AACP,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_data","_richText","_blockEditor","_components","_i18n","_index","_lockUnlock","Tabs","unlock","componentsPrivateApis","TABS","name","title","__","parseCSS","css","split","reduce","accumulator","rule","property","value","color","transparentValue","backgroundColor","parseClassName","className","colorSettings","startsWith","endsWith","colorSlug","replace","colorObject","getColorObjectByAttributeValues","getActiveColors","activeColorFormat","getActiveFormat","attributes","style","class","setColors","colors","removeFormat","styles","classNames","push","join","getColorObjectByColorValue","getColorClassName","slug","length","applyFormat","type","ColorPicker","onChange","useSelect","select","_getSettings$colors","getSettings","blockEditorStore","onColorChange","useCallback","activeColors","useMemo","_react","createElement","ColorPalette","InlineColorUI","onClose","contentRef","isActive","popoverAnchor","useAnchor","editableContentElement","current","settings","Popover","anchor","TabList","map","tab","Tab","tabId","key","TabPanel","focusable"],"sources":["@wordpress/format-library/src/text-color/inline.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tapplyFormat,\n\tremoveFormat,\n\tgetActiveFormat,\n\tuseAnchor,\n} from '@wordpress/rich-text';\nimport {\n\tColorPalette,\n\tgetColorClassName,\n\tgetColorObjectByColorValue,\n\tgetColorObjectByAttributeValues,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tPopover,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { textColor as settings, transparentValue } from './index';\nimport { unlock } from '../lock-unlock';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nconst TABS = [\n\t{ name: 'color', title: __( 'Text' ) },\n\t{ name: 'backgroundColor', title: __( 'Background' ) },\n];\n\nfunction parseCSS( css = '' ) {\n\treturn css.split( ';' ).reduce( ( accumulator, rule ) => {\n\t\tif ( rule ) {\n\t\t\tconst [ property, value ] = rule.split( ':' );\n\t\t\tif ( property === 'color' ) accumulator.color = value;\n\t\t\tif ( property === 'background-color' && value !== transparentValue )\n\t\t\t\taccumulator.backgroundColor = value;\n\t\t}\n\t\treturn accumulator;\n\t}, {} );\n}\n\nexport function parseClassName( className = '', colorSettings ) {\n\treturn className.split( ' ' ).reduce( ( accumulator, name ) => {\n\t\t// `colorSlug` could contain dashes, so simply match the start and end.\n\t\tif ( name.startsWith( 'has-' ) && name.endsWith( '-color' ) ) {\n\t\t\tconst colorSlug = name\n\t\t\t\t.replace( /^has-/, '' )\n\t\t\t\t.replace( /-color$/, '' );\n\t\t\tconst colorObject = getColorObjectByAttributeValues(\n\t\t\t\tcolorSettings,\n\t\t\t\tcolorSlug\n\t\t\t);\n\t\t\taccumulator.color = colorObject.color;\n\t\t}\n\t\treturn accumulator;\n\t}, {} );\n}\n\nexport function getActiveColors( value, name, colorSettings ) {\n\tconst activeColorFormat = getActiveFormat( value, name );\n\n\tif ( ! activeColorFormat ) {\n\t\treturn {};\n\t}\n\n\treturn {\n\t\t...parseCSS( activeColorFormat.attributes.style ),\n\t\t...parseClassName( activeColorFormat.attributes.class, colorSettings ),\n\t};\n}\n\nfunction setColors( value, name, colorSettings, colors ) {\n\tconst { color, backgroundColor } = {\n\t\t...getActiveColors( value, name, colorSettings ),\n\t\t...colors,\n\t};\n\n\tif ( ! color && ! backgroundColor ) {\n\t\treturn removeFormat( value, name );\n\t}\n\n\tconst styles = [];\n\tconst classNames = [];\n\tconst attributes = {};\n\n\tif ( backgroundColor ) {\n\t\tstyles.push( [ 'background-color', backgroundColor ].join( ':' ) );\n\t} else {\n\t\t// Override default browser color for mark element.\n\t\tstyles.push( [ 'background-color', transparentValue ].join( ':' ) );\n\t}\n\n\tif ( color ) {\n\t\tconst colorObject = getColorObjectByColorValue( colorSettings, color );\n\n\t\tif ( colorObject ) {\n\t\t\tclassNames.push( getColorClassName( 'color', colorObject.slug ) );\n\t\t} else {\n\t\t\tstyles.push( [ 'color', color ].join( ':' ) );\n\t\t}\n\t}\n\n\tif ( styles.length ) attributes.style = styles.join( ';' );\n\tif ( classNames.length ) attributes.class = classNames.join( ' ' );\n\n\treturn applyFormat( value, { type: name, attributes } );\n}\n\nfunction ColorPicker( { name, property, value, onChange } ) {\n\tconst colors = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().colors ?? [];\n\t}, [] );\n\tconst onColorChange = useCallback(\n\t\t( color ) => {\n\t\t\tonChange(\n\t\t\t\tsetColors( value, name, colors, { [ property ]: color } )\n\t\t\t);\n\t\t},\n\t\t[ colors, onChange, property ]\n\t);\n\tconst activeColors = useMemo(\n\t\t() => getActiveColors( value, name, colors ),\n\t\t[ name, value, colors ]\n\t);\n\n\treturn (\n\t\t<ColorPalette\n\t\t\tvalue={ activeColors[ property ] }\n\t\t\tonChange={ onColorChange }\n\t\t/>\n\t);\n}\n\nexport default function InlineColorUI( {\n\tname,\n\tvalue,\n\tonChange,\n\tonClose,\n\tcontentRef,\n\tisActive,\n} ) {\n\tconst popoverAnchor = useAnchor( {\n\t\teditableContentElement: contentRef.current,\n\t\tsettings: { ...settings, isActive },\n\t} );\n\n\treturn (\n\t\t<Popover\n\t\t\tonClose={ onClose }\n\t\t\tclassName=\"format-library__inline-color-popover\"\n\t\t\tanchor={ popoverAnchor }\n\t\t>\n\t\t\t<Tabs>\n\t\t\t\t<Tabs.TabList>\n\t\t\t\t\t{ TABS.map( ( tab ) => (\n\t\t\t\t\t\t<Tabs.Tab tabId={ tab.name } key={ tab.name }>\n\t\t\t\t\t\t\t{ tab.title }\n\t\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t\t) ) }\n\t\t\t\t</Tabs.TabList>\n\t\t\t\t{ TABS.map( ( tab ) => (\n\t\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\t\ttabId={ tab.name }\n\t\t\t\t\t\tfocusable={ false }\n\t\t\t\t\t\tkey={ tab.name }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ColorPicker\n\t\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\t\tproperty={ tab.name }\n\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t) ) }\n\t\t\t</Tabs>\n\t\t</Popover>\n\t);\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAMA,IAAAG,YAAA,GAAAH,OAAA;AAOA,IAAAI,WAAA,GAAAJ,OAAA;AAIA,IAAAK,KAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AA5BA;AACA;AACA;;AAsBA;AACA;AACA;;AAIA,MAAM;EAAEQ;AAAK,CAAC,GAAG,IAAAC,kBAAM,EAAEC,uBAAsB,CAAC;AAEhD,MAAMC,IAAI,GAAG,CACZ;EAAEC,IAAI,EAAE,OAAO;EAAEC,KAAK,EAAE,IAAAC,QAAE,EAAE,MAAO;AAAE,CAAC,EACtC;EAAEF,IAAI,E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AAG4D,GAAG,CAACrE,IAAM;IACrBU,KAAK,EAAGA,KAAO;IACfiC,QAAQ,EAAGA;EAAU,CACrB,CACa,CACd,CACG,CACE,CAAC;AAEZ"}
1
+ {"version":3,"names":["_element","require","_data","_richText","_blockEditor","_components","_i18n","_index","_lockUnlock","Tabs","unlock","componentsPrivateApis","TABS","name","title","__","parseCSS","css","split","reduce","accumulator","rule","property","value","color","transparentValue","backgroundColor","parseClassName","className","colorSettings","startsWith","endsWith","colorSlug","replace","colorObject","getColorObjectByAttributeValues","getActiveColors","activeColorFormat","getActiveFormat","attributes","style","class","setColors","colors","removeFormat","styles","classNames","push","join","getColorObjectByColorValue","getColorClassName","slug","length","applyFormat","type","ColorPicker","onChange","useSelect","select","_getSettings$colors","getSettings","blockEditorStore","onColorChange","useCallback","activeColors","useMemo","_react","createElement","ColorPalette","InlineColorUI","onClose","contentRef","isActive","popoverAnchor","useAnchor","editableContentElement","current","settings","Popover","anchor","TabList","map","tab","Tab","tabId","key","TabPanel","focusable"],"sources":["@wordpress/format-library/src/text-color/inline.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tapplyFormat,\n\tremoveFormat,\n\tgetActiveFormat,\n\tuseAnchor,\n} from '@wordpress/rich-text';\nimport {\n\tColorPalette,\n\tgetColorClassName,\n\tgetColorObjectByColorValue,\n\tgetColorObjectByAttributeValues,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tPopover,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { textColor as settings, transparentValue } from './index';\nimport { unlock } from '../lock-unlock';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nconst TABS = [\n\t{ name: 'color', title: __( 'Text' ) },\n\t{ name: 'backgroundColor', title: __( 'Background' ) },\n];\n\nfunction parseCSS( css = '' ) {\n\treturn css.split( ';' ).reduce( ( accumulator, rule ) => {\n\t\tif ( rule ) {\n\t\t\tconst [ property, value ] = rule.split( ':' );\n\t\t\tif ( property === 'color' ) accumulator.color = value;\n\t\t\tif ( property === 'background-color' && value !== transparentValue )\n\t\t\t\taccumulator.backgroundColor = value;\n\t\t}\n\t\treturn accumulator;\n\t}, {} );\n}\n\nexport function parseClassName( className = '', colorSettings ) {\n\treturn className.split( ' ' ).reduce( ( accumulator, name ) => {\n\t\t// `colorSlug` could contain dashes, so simply match the start and end.\n\t\tif ( name.startsWith( 'has-' ) && name.endsWith( '-color' ) ) {\n\t\t\tconst colorSlug = name\n\t\t\t\t.replace( /^has-/, '' )\n\t\t\t\t.replace( /-color$/, '' );\n\t\t\tconst colorObject = getColorObjectByAttributeValues(\n\t\t\t\tcolorSettings,\n\t\t\t\tcolorSlug\n\t\t\t);\n\t\t\taccumulator.color = colorObject.color;\n\t\t}\n\t\treturn accumulator;\n\t}, {} );\n}\n\nexport function getActiveColors( value, name, colorSettings ) {\n\tconst activeColorFormat = getActiveFormat( value, name );\n\n\tif ( ! activeColorFormat ) {\n\t\treturn {};\n\t}\n\n\treturn {\n\t\t...parseCSS( activeColorFormat.attributes.style ),\n\t\t...parseClassName( activeColorFormat.attributes.class, colorSettings ),\n\t};\n}\n\nfunction setColors( value, name, colorSettings, colors ) {\n\tconst { color, backgroundColor } = {\n\t\t...getActiveColors( value, name, colorSettings ),\n\t\t...colors,\n\t};\n\n\tif ( ! color && ! backgroundColor ) {\n\t\treturn removeFormat( value, name );\n\t}\n\n\tconst styles = [];\n\tconst classNames = [];\n\tconst attributes = {};\n\n\tif ( backgroundColor ) {\n\t\tstyles.push( [ 'background-color', backgroundColor ].join( ':' ) );\n\t} else {\n\t\t// Override default browser color for mark element.\n\t\tstyles.push( [ 'background-color', transparentValue ].join( ':' ) );\n\t}\n\n\tif ( color ) {\n\t\tconst colorObject = getColorObjectByColorValue( colorSettings, color );\n\n\t\tif ( colorObject ) {\n\t\t\tclassNames.push( getColorClassName( 'color', colorObject.slug ) );\n\t\t} else {\n\t\t\tstyles.push( [ 'color', color ].join( ':' ) );\n\t\t}\n\t}\n\n\tif ( styles.length ) attributes.style = styles.join( ';' );\n\tif ( classNames.length ) attributes.class = classNames.join( ' ' );\n\n\treturn applyFormat( value, { type: name, attributes } );\n}\n\nfunction ColorPicker( { name, property, value, onChange } ) {\n\tconst colors = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().colors ?? [];\n\t}, [] );\n\tconst onColorChange = useCallback(\n\t\t( color ) => {\n\t\t\tonChange(\n\t\t\t\tsetColors( value, name, colors, { [ property ]: color } )\n\t\t\t);\n\t\t},\n\t\t[ colors, onChange, property ]\n\t);\n\tconst activeColors = useMemo(\n\t\t() => getActiveColors( value, name, colors ),\n\t\t[ name, value, colors ]\n\t);\n\n\treturn (\n\t\t<ColorPalette\n\t\t\tvalue={ activeColors[ property ] }\n\t\t\tonChange={ onColorChange }\n\t\t/>\n\t);\n}\n\nexport default function InlineColorUI( {\n\tname,\n\tvalue,\n\tonChange,\n\tonClose,\n\tcontentRef,\n\tisActive,\n} ) {\n\tconst popoverAnchor = useAnchor( {\n\t\teditableContentElement: contentRef.current,\n\t\tsettings: { ...settings, isActive },\n\t} );\n\n\treturn (\n\t\t<Popover\n\t\t\tonClose={ onClose }\n\t\t\tclassName=\"format-library__inline-color-popover\"\n\t\t\tanchor={ popoverAnchor }\n\t\t>\n\t\t\t<Tabs>\n\t\t\t\t<Tabs.TabList>\n\t\t\t\t\t{ TABS.map( ( tab ) => (\n\t\t\t\t\t\t<Tabs.Tab tabId={ tab.name } key={ tab.name }>\n\t\t\t\t\t\t\t{ tab.title }\n\t\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t\t) ) }\n\t\t\t\t</Tabs.TabList>\n\t\t\t\t{ TABS.map( ( tab ) => (\n\t\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\t\ttabId={ tab.name }\n\t\t\t\t\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E,GAAGA,gBAAQ;MAAEL;IAAS;EACnC,CAAE,CAAC;EAEH,OACC,IAAAN,MAAA,CAAAC,aAAA,EAAC9D,WAAA,CAAAyE,OAAO;IACPR,OAAO,EAAGA,OAAS;IACnB1C,SAAS,EAAC,sCAAsC;IAChDmD,MAAM,EAAGN;EAAe,GAExB,IAAAP,MAAA,CAAAC,aAAA,EAAC1D,IAAI,QACJ,IAAAyD,MAAA,CAAAC,aAAA,EAAC1D,IAAI,CAACuE,OAAO,QACVpE,IAAI,CAACqE,GAAG,CAAIC,GAAG,IAChB,IAAAhB,MAAA,CAAAC,aAAA,EAAC1D,IAAI,CAAC0E,GAAG;IAACC,KAAK,EAAGF,GAAG,CAACrE,IAAM;IAACwE,GAAG,EAAGH,GAAG,CAACrE;EAAM,GAC1CqE,GAAG,CAACpE,KACG,CACT,CACW,CAAC,EACbF,IAAI,CAACqE,GAAG,CAAIC,GAAG,IAChB,IAAAhB,MAAA,CAAAC,aAAA,EAAC1D,IAAI,CAAC6E,QAAQ;IACbF,KAAK,EAAGF,GAAG,CAACrE,IAAM;IAClB0E,SAAS,EAAG,KAAO;IACnBF,GAAG,EAAGH,GAAG,CAACrE;EAAM,GAEhB,IAAAqD,MAAA,CAAAC,aAAA,EAACZ,WAAW;IACX1C,IAAI,EAAGA,IAAM;IACbS,QAAQ,EAAG4D,GAAG,CAACrE,IAAM;IACrBU,KAAK,EAAGA,KAAO;IACfiC,QAAQ,EAAGA;EAAU,CACrB,CACa,CACd,CACG,CACE,CAAC;AAEZ","ignoreList":[]}
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = InlineColorUI;
7
+ exports.getActiveColors = getActiveColors;
7
8
  var _react = require("react");
8
9
  var _element = require("@wordpress/element");
9
10
  var _richText = require("@wordpress/rich-text");
@@ -39,7 +40,7 @@ function getActiveColors(value, name, colorSettings) {
39
40
  ...(0, _inline.parseClassName)(activeColorFormat.attributes.class, colorSettings)
40
41
  };
41
42
  }
42
- function setColors(value, name, colorSettings, colors) {
43
+ function setColors(value, name, colorSettings, colors, contentRef) {
43
44
  const {
44
45
  color,
45
46
  backgroundColor
@@ -47,7 +48,8 @@ function setColors(value, name, colorSettings, colors) {
47
48
  ...getActiveColors(value, name, colorSettings),
48
49
  ...colors
49
50
  };
50
- if (!color && !backgroundColor) {
51
+ if (!color) {
52
+ contentRef?.onRemoveMarkFormatting();
51
53
  return (0, _richText.removeFormat)(value, name);
52
54
  }
53
55
  const styles = [];
@@ -75,55 +77,30 @@ function setColors(value, name, colorSettings, colors) {
75
77
  attributes
76
78
  };
77
79
  const hasNoSelection = value.start === value.end;
78
- const isAtTheEnd = value.end === value.text.length;
79
- const previousCharacter = value.text.charAt(value.end - 1);
80
-
81
- // Force formatting due to limitations in the native implementation
82
- if (hasNoSelection && (value.text.length === 0 || previousCharacter === ' ' && isAtTheEnd)) {
83
- // For cases where there's no text selected, there's a space before
84
- // the current caret position and it's at the end of the text.
85
- return (0, _richText.applyFormat)(value, format, value.start - 1, value.end + 1);
86
- } else if (hasNoSelection && isAtTheEnd) {
87
- // If there's no selection and is at the end of the text
88
- // manually add the format within the current caret position.
89
- const newFormat = (0, _richText.applyFormat)(value, format);
90
- const {
91
- activeFormats
92
- } = newFormat;
93
- newFormat.formats[value.start] = [...(activeFormats?.filter(({
94
- type
95
- }) => type !== format.type) || []), format];
96
- return newFormat;
97
- } else if (hasNoSelection) {
98
- return (0, _richText.removeFormat)(value, format);
80
+ if (hasNoSelection) {
81
+ contentRef?.onMarkFormatting(color);
99
82
  }
100
83
  return (0, _richText.applyFormat)(value, format);
101
84
  }
102
85
  function ColorPicker({
103
86
  name,
104
87
  value,
105
- onChange
88
+ onChange,
89
+ contentRef
106
90
  }) {
107
91
  const property = 'color';
108
92
  const colors = (0, _components.useMobileGlobalStylesColors)();
109
93
  const colorSettings = (0, _blockEditor.useMultipleOriginColorsAndGradients)();
110
94
  const onColorChange = (0, _element.useCallback)(color => {
111
- if (color !== '') {
112
- onChange(setColors(value, name, colors, {
113
- [property]: color
114
- }));
115
- // Remove formatting if the color was reset, there's no
116
- // current selection and the previous character is a space
117
- } else if (value?.start === value?.end && value.text?.charAt(value?.end - 1) === ' ') {
118
- onChange((0, _richText.removeFormat)(value, name, value.end - 1, value.end));
119
- } else {
120
- onChange((0, _richText.removeFormat)(value, name));
121
- }
122
- }, [colors, onChange, property]);
95
+ onChange(setColors(value, name, colors, {
96
+ [property]: color
97
+ }, contentRef));
98
+ }, [colors, contentRef, name, onChange, value]);
123
99
  const activeColors = (0, _element.useMemo)(() => getActiveColors(value, name, colors), [name, value, colors]);
124
100
  return (0, _react.createElement)(_components.ColorSettings, {
125
101
  colorValue: activeColors[property],
126
102
  onColorChange: onColorChange,
103
+ onColorCleared: onColorChange,
127
104
  defaultSettings: colorSettings,
128
105
  hideNavigation: true
129
106
  });
@@ -132,7 +109,8 @@ function InlineColorUI({
132
109
  name,
133
110
  value,
134
111
  onChange,
135
- onClose
112
+ onClose,
113
+ contentRef
136
114
  }) {
137
115
  return (0, _react.createElement)(_components.BottomSheet, {
138
116
  isVisible: true,
@@ -153,7 +131,8 @@ function InlineColorUI({
153
131
  }, (0, _react.createElement)(ColorPicker, {
154
132
  name: name,
155
133
  value: value,
156
- onChange: onChange
134
+ onChange: onChange,
135
+ contentRef: contentRef
157
136
  }))));
158
137
  }
159
138
  //# sourceMappingURL=inline.native.js.map