@wordpress/block-editor 13.0.0 → 13.1.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.
- package/CHANGELOG.md +2 -0
- package/build/components/block-actions/index.js +4 -6
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/block-draggable/index.js +1 -1
- package/build/components/block-draggable/index.js.map +1 -1
- package/build/components/block-list/block.js +2 -2
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +2 -2
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +3 -1
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-lock/use-block-lock.js +2 -4
- package/build/components/block-lock/use-block-lock.js.map +1 -1
- package/build/components/block-mover/index.js +1 -1
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-mover/index.native.js +1 -1
- package/build/components/block-mover/index.native.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-switcher/block-variation-transformations.js +1 -3
- package/build/components/block-switcher/block-variation-transformations.js.map +1 -1
- package/build/components/block-switcher/index.js +13 -6
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-toolbar/index.js +6 -10
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +2 -2
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/button-block-appender/index.js +4 -1
- package/build/components/button-block-appender/index.js.map +1 -1
- package/build/components/date-format-picker/index.js +18 -10
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/global-styles/background-panel.js +3 -3
- package/build/components/global-styles/background-panel.js.map +1 -1
- package/build/components/global-styles/hooks.js +2 -2
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +14 -1
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/inserter/block-types-tab.js +3 -3
- package/build/components/inserter/block-types-tab.js.map +1 -1
- package/build/components/inserter/block-types-tab.native.js +1 -1
- package/build/components/inserter/block-types-tab.native.js.map +1 -1
- package/build/components/inserter/hooks/use-block-types-state.js +3 -2
- package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build/components/link-control/link-preview.js +13 -1
- package/build/components/link-control/link-preview.js.map +1 -1
- package/build/components/link-control/search-input.js +1 -1
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/list-view/block.js +7 -6
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +3 -1
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/use-clipboard-handler.js +1 -1
- package/build/components/list-view/use-clipboard-handler.js.map +1 -1
- package/build/components/provider/use-block-sync.js +1 -7
- package/build/components/provider/use-block-sync.js.map +1 -1
- package/build/components/rich-text/index.native.js +4 -0
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/native/index.native.js +6 -4
- package/build/components/rich-text/native/index.native.js.map +1 -1
- package/build/components/spacing-sizes-control/hooks/use-spacing-sizes.js +9 -12
- package/build/components/spacing-sizes-control/hooks/use-spacing-sizes.js.map +1 -1
- package/build/components/use-block-commands/index.js +3 -3
- package/build/components/use-block-commands/index.js.map +1 -1
- package/build/components/writing-flow/use-clipboard-handler.js +22 -3
- package/build/components/writing-flow/use-clipboard-handler.js.map +1 -1
- package/build/hooks/block-bindings.js +19 -16
- package/build/hooks/block-bindings.js.map +1 -1
- package/build/hooks/block-style-variation.js +2 -2
- package/build/hooks/block-style-variation.js.map +1 -1
- package/build/hooks/use-bindings-attributes.js +7 -2
- package/build/hooks/use-bindings-attributes.js.map +1 -1
- package/build/private-apis.js +3 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +4 -4
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +1 -36
- package/build/store/private-actions.js.map +1 -1
- package/build/store/selectors.js +19 -20
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/block-actions/index.js +4 -6
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/block-draggable/index.js +1 -1
- package/build-module/components/block-draggable/index.js.map +1 -1
- package/build-module/components/block-list/block.js +2 -2
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +2 -2
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +3 -1
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-lock/use-block-lock.js +2 -4
- package/build-module/components/block-lock/use-block-lock.js.map +1 -1
- package/build-module/components/block-mover/index.js +1 -1
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-mover/index.native.js +1 -1
- package/build-module/components/block-mover/index.native.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-switcher/block-variation-transformations.js +1 -3
- package/build-module/components/block-switcher/block-variation-transformations.js.map +1 -1
- package/build-module/components/block-switcher/index.js +15 -8
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +7 -10
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +2 -2
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/button-block-appender/index.js +4 -1
- package/build-module/components/button-block-appender/index.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +19 -11
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/global-styles/background-panel.js +4 -4
- package/build-module/components/global-styles/background-panel.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +2 -2
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +14 -1
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.js +3 -3
- package/build-module/components/inserter/block-types-tab.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.native.js +1 -1
- package/build-module/components/inserter/block-types-tab.native.js.map +1 -1
- package/build-module/components/inserter/hooks/use-block-types-state.js +4 -3
- package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build-module/components/link-control/link-preview.js +15 -1
- package/build-module/components/link-control/link-preview.js.map +1 -1
- package/build-module/components/link-control/search-input.js +1 -1
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/list-view/block.js +7 -6
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +3 -1
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/use-clipboard-handler.js +1 -1
- package/build-module/components/list-view/use-clipboard-handler.js.map +1 -1
- package/build-module/components/provider/use-block-sync.js +1 -7
- package/build-module/components/provider/use-block-sync.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +4 -0
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/native/index.native.js +6 -4
- package/build-module/components/rich-text/native/index.native.js.map +1 -1
- package/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.js +9 -12
- package/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.js.map +1 -1
- package/build-module/components/use-block-commands/index.js +3 -3
- package/build-module/components/use-block-commands/index.js.map +1 -1
- package/build-module/components/writing-flow/use-clipboard-handler.js +23 -4
- package/build-module/components/writing-flow/use-clipboard-handler.js.map +1 -1
- package/build-module/hooks/block-bindings.js +20 -17
- package/build-module/hooks/block-bindings.js.map +1 -1
- package/build-module/hooks/block-style-variation.js +2 -2
- package/build-module/hooks/block-style-variation.js.map +1 -1
- package/build-module/hooks/use-bindings-attributes.js +7 -2
- package/build-module/hooks/use-bindings-attributes.js.map +1 -1
- package/build-module/private-apis.js +3 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +4 -4
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +1 -35
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/selectors.js +19 -20
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/content-rtl.css +1 -1
- package/build-style/content.css +1 -1
- package/build-style/style-rtl.css +13 -17
- package/build-style/style.css +13 -17
- package/package.json +31 -31
- package/src/components/block-actions/index.js +3 -7
- package/src/components/block-canvas/style.scss +2 -2
- package/src/components/block-draggable/index.js +1 -1
- package/src/components/block-list/block.js +2 -2
- package/src/components/block-list/block.native.js +2 -2
- package/src/components/block-list/use-in-between-inserter.js +3 -1
- package/src/components/block-lock/use-block-lock.js +2 -4
- package/src/components/block-mover/index.js +1 -1
- package/src/components/block-mover/index.native.js +1 -1
- package/src/components/block-settings-menu/block-settings-dropdown.js +1 -1
- package/src/components/block-switcher/block-variation-transformations.js +4 -9
- package/src/components/block-switcher/index.js +27 -12
- package/src/components/block-switcher/style.scss +5 -0
- package/src/components/block-toolbar/index.js +7 -9
- package/src/components/block-toolbar/style.scss +9 -6
- package/src/components/block-tools/block-selection-button.js +2 -2
- package/src/components/block-variation-picker/content.scss +1 -1
- package/src/components/button-block-appender/index.js +2 -0
- package/src/components/date-format-picker/index.js +25 -13
- package/src/components/global-styles/background-panel.js +13 -4
- package/src/components/global-styles/hooks.js +2 -4
- package/src/components/global-styles/use-global-styles-output.js +24 -4
- package/src/components/inserter/block-types-tab.js +0 -1
- package/src/components/inserter/block-types-tab.native.js +2 -1
- package/src/components/inserter/hooks/use-block-types-state.js +10 -5
- package/src/components/inserter/style.scss +4 -0
- package/src/components/link-control/link-preview.js +19 -1
- package/src/components/link-control/search-input.js +1 -1
- package/src/components/list-view/block.js +7 -7
- package/src/components/list-view/branch.js +5 -1
- package/src/components/list-view/use-clipboard-handler.js +1 -6
- package/src/components/provider/use-block-sync.js +0 -6
- package/src/components/rich-text/index.native.js +4 -0
- package/src/components/rich-text/native/index.native.js +3 -1
- package/src/components/spacing-sizes-control/hooks/use-spacing-sizes.js +7 -4
- package/src/components/use-block-commands/index.js +3 -4
- package/src/components/writing-flow/use-clipboard-handler.js +29 -7
- package/src/hooks/block-bindings.js +28 -22
- package/src/hooks/block-style-variation.js +2 -2
- package/src/hooks/use-bindings-attributes.js +11 -1
- package/src/private-apis.js +2 -0
- package/src/store/actions.js +4 -10
- package/src/store/private-actions.js +1 -34
- package/src/store/selectors.js +22 -27
- package/src/style.scss +0 -1
- package/build/components/block-bindings-toolbar-indicator/index.js +0 -106
- package/build/components/block-bindings-toolbar-indicator/index.js.map +0 -1
- package/build/store/undo-ignore.js +0 -11
- package/build/store/undo-ignore.js.map +0 -1
- package/build-module/components/block-bindings-toolbar-indicator/index.js +0 -99
- package/build-module/components/block-bindings-toolbar-indicator/index.js.map +0 -1
- package/build-module/store/undo-ignore.js +0 -5
- package/build-module/store/undo-ignore.js.map +0 -1
- package/src/components/block-bindings-toolbar-indicator/index.js +0 -135
- package/src/components/block-bindings-toolbar-indicator/style.scss +0 -12
- package/src/store/undo-ignore.js +0 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["View","Platform","Dimensions","memize","colord","RCTAztecView","showUserSuggestions","showXpostSuggestions","BlockFormatControls","getPxFromCssUnit","Component","compose","debounce","withPreferredColorScheme","withSelect","childrenBlock","decodeEntities","BACKSPACE","DELETE","ENTER","isURL","atSymbol","plus","__","applyFormat","getActiveFormat","getActiveFormats","insert","getTextContent","isEmpty","create","toHTMLString","isCollapsed","remove","useFormatTypes","FormatEdit","getFormatColors","styles","ToolbarButtonWithOptions","Fragment","_Fragment","jsx","_jsx","jsxs","_jsxs","flatColorPalettes","colorsPalettes","theme","custom","default","getSelectionColor","currentSelectionColor","defaultSelectionColor","baseGlobalStyles","isBlockBasedTheme","selectionColor","colordTextColor","colordBackgroundColor","color","background","isColordTextReadable","isReadable","text","gutenbergFormatNamesToAztec","EMPTY_PARAGRAPH_TAGS","DEFAULT_FONT_SIZE","MIN_LINE_HEIGHT","RichText","constructor","value","selectionStart","selectionEnd","arguments","isIOS","OS","createRecord","bind","onChangeFromAztec","onKeyDown","handleEnter","handleDelete","onPaste","onFocus","onBlur","onTextUpdate","onContentSizeChange","onFormatChange","formatToValue","maxSize","debounceCreateUndoLevel","onCreateUndoLevel","onSelectionChange","onSelectionChangeFromAztec","valueToFormat","getHtmlToRender","handleSuggestionFunc","handleUserSuggestion","handleXpostSuggestion","suggestionOptions","insertString","manipulateEventCounterToForceNativeToRefresh","shouldDropEventFromAztec","state","activeFormats","selectedFormat","height","currentFontSize","getFontSize","needsSelectionUpdate","savedContent","isTouched","lastAztecEventType","lastHistoryValue","getRecord","start","end","colorPalette","props","currentValue","formats","replacements","newFormats","preserveWhiteSpace","html","range","Math","min","length","removeRootTagsProducedByAztec","getActiveFormatNames","record","formatTypes","map","name","filter","undefined","Boolean","changeHandlers","Object","fromEntries","entries","key","startsWith","values","forEach","changeHandler","onChange","setState","string","toInsert","__unstableOnCreateUndoLevel","toString","result","removeRootTag","tagName","tagsToEliminate","element","removeTag","tag","openingTagRegexp","RegExp","closingTagRegexp","replace","event","contentWithoutRootTag","nativeEvent","lastEventCount","eventCount","comesFromAztec","firedAfterTextChanged","refresh","contentSize","defaultPrevented","customEditableOnKeyDown","preventDefault","KeyCodes","keyCode","handleTriggerKeyCodes","onEnter","shiftKey","isReverse","onDelete","hasActiveFormats","newValue","triggeredOption","find","option","triggeredKeyCode","triggerChar","charCodeAt","useTrigger","charAt","onClick","areMentionsSupported","areXPostsSupported","allOptions","supported","title","label","icon","op","suggestionFunction","prefix","then","suggestion","catch","pastedText","pastedHtml","files","currentRecord","trimmedText","trim","linkedRecord","type","attributes","href","window","console","log","plainText","unstableOnFocus","hasChanged","isManual","logText","shouldDrop","shouldFocusTextInputAfterMerge","prevProps","__unstableIsSelected","isSelected","blockIsSelected","__unstableMobileNoFocusOnMount","prevIsSelected","prevBlockIsSelected","noSelectionValues","textInputWasNotFocused","realStart","realEnd","max","Array","isArray","toHTML","format","shouldComponentUpdate","nextProps","nextState","reversed","fontSize","style","lineHeight","componentDidMount","_editor","focus","componentDidUpdate","_this$value$toString$","lastCharacterPosition","blur","currentFontSizeStyle","getParsedFontSize","prevFontSizeStyle","isDifferentTag","componentWillUnmount","clearCurrentSelectionOnUnmount","isFocused","extraAttributes","getEditableProps","className","_getPxFromCssUnit","width","get","cssUnitOptions","selectedPxValue","parseFloat","tagNameFontSize","elements","typography","newFontSize","getLineHeight","tagNameLineHeight","newLineHeight","getIsBlockBasedTheme","isNaN","getBlockUseDefaultFont","tagsToMatch","test","getLinkTextColor","defaultColor","customColor","linkColor","isValid","toHex","getPlaceholderTextColor","_ref","_ref2","getStylesFromColorScheme","placeholderTextColor","placeholderStyle","richTextPlaceholder","richTextPlaceholderDark","defaultPlaceholderTextColor","placeholderOpacity","inheritPlaceholderColor","placeholderColor","globalStylesPlaceholderColor","render","children","minWidth","maxWidth","parentBlockStyles","accessibilityLabel","disableEditingMenu","disableSuggestions","containerWidth","editableProps","blockUseDefaultFont","textDecorationColor","defaultTextDecorationColor","fontFamily","defaultFontFamily","richText","richTextDark","linkTextColor","currentSelectionStart","currentSelectionEnd","selection","brBeforeParaMatches","match","warn","count","newSelectionStart","newSelectionEnd","containerStyles","padding","backgroundColor","EditableView","editableTagName","ref","nativeEditorRef","minHeight","placeholder","deleteEnter","triggerKeyCodes","blockType","maxImagesWidth","fontWeight","fontStyle","isMultiline","textAlign","id","disableAutocorrection","forwardedRef","options","defaultProps","withFormatTypes","WrappedComponent","clientId","identifier","withoutInteractiveFormatting","allowedFormats","select","getBlockParents","getBlock","getSettings","parents","parentBlock","childrenStyles","settings","__experimentalGlobalStylesBaseStyles","colorPalettes","__experimentalFeatures","palette","colors","capabilities","mentions","xposts"],"sources":["@wordpress/block-editor/src/components/rich-text/native/index.native.js"],"sourcesContent":["/* eslint no-console: [\"error\", { allow: [\"warn\"] }] */\n\n/**\n * External dependencies\n */\nimport { View, Platform, Dimensions } from 'react-native';\nimport memize from 'memize';\nimport { colord } from 'colord';\n\n/**\n * WordPress dependencies\n */\nimport RCTAztecView from '@wordpress/react-native-aztec';\nimport {\n\tshowUserSuggestions,\n\tshowXpostSuggestions,\n} from '@wordpress/react-native-bridge';\nimport { BlockFormatControls } from '@wordpress/block-editor';\nimport { getPxFromCssUnit } from '@wordpress/components';\nimport { Component } from '@wordpress/element';\nimport {\n\tcompose,\n\tdebounce,\n\twithPreferredColorScheme,\n} from '@wordpress/compose';\nimport { withSelect } from '@wordpress/data';\nimport { childrenBlock } from '@wordpress/blocks';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { BACKSPACE, DELETE, ENTER } from '@wordpress/keycodes';\nimport { isURL } from '@wordpress/url';\nimport { atSymbol, plus } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tapplyFormat,\n\tgetActiveFormat,\n\tgetActiveFormats,\n\tinsert,\n\tgetTextContent,\n\tisEmpty,\n\tcreate,\n\ttoHTMLString,\n\tisCollapsed,\n\tremove,\n} from '@wordpress/rich-text';\n\n/**\n * Internal dependencies\n */\nimport { useFormatTypes } from './use-format-types';\nimport FormatEdit from './format-edit';\nimport { getFormatColors } from './get-format-colors';\nimport styles from './style.scss';\nimport ToolbarButtonWithOptions from './toolbar-button-with-options';\n\n// The flattened color palettes array is memoized to ensure that the same array instance is\n// returned for the colors palettes. This value might be used as a prop, so having the same\n// instance will prevent unnecessary re-renders of the RichText component.\nconst flatColorPalettes = memize( ( colorsPalettes ) => [\n\t...( colorsPalettes?.theme || [] ),\n\t...( colorsPalettes?.custom || [] ),\n\t...( colorsPalettes?.default || [] ),\n] );\n\nconst getSelectionColor = memize(\n\t(\n\t\tcurrentSelectionColor,\n\t\tdefaultSelectionColor,\n\t\tbaseGlobalStyles,\n\t\tisBlockBasedTheme\n\t) => {\n\t\tlet selectionColor = defaultSelectionColor;\n\t\tif ( currentSelectionColor ) {\n\t\t\tselectionColor = currentSelectionColor;\n\t\t}\n\n\t\tif ( isBlockBasedTheme ) {\n\t\t\tconst colordTextColor = colord( selectionColor );\n\t\t\tconst colordBackgroundColor = colord(\n\t\t\t\tbaseGlobalStyles?.color?.background\n\t\t\t);\n\t\t\tconst isColordTextReadable = colordTextColor.isReadable(\n\t\t\t\tcolordBackgroundColor\n\t\t\t);\n\t\t\tif ( ! isColordTextReadable ) {\n\t\t\t\tselectionColor = baseGlobalStyles?.color?.text;\n\t\t\t}\n\t\t}\n\n\t\treturn selectionColor;\n\t}\n);\n\nconst gutenbergFormatNamesToAztec = {\n\t'core/bold': 'bold',\n\t'core/italic': 'italic',\n\t'core/strikethrough': 'strikethrough',\n\t'core/text-color': 'mark',\n};\n\nconst EMPTY_PARAGRAPH_TAGS = '<p></p>';\nconst DEFAULT_FONT_SIZE = 16;\nconst MIN_LINE_HEIGHT = 1;\n\nexport class RichText extends Component {\n\tconstructor( { value, selectionStart, selectionEnd } ) {\n\t\tsuper( ...arguments );\n\n\t\tthis.isIOS = Platform.OS === 'ios';\n\t\tthis.createRecord = this.createRecord.bind( this );\n\t\tthis.onChangeFromAztec = this.onChangeFromAztec.bind( this );\n\t\tthis.onKeyDown = this.onKeyDown.bind( this );\n\t\tthis.handleEnter = this.handleEnter.bind( this );\n\t\tthis.handleDelete = this.handleDelete.bind( this );\n\t\tthis.onPaste = this.onPaste.bind( this );\n\t\tthis.onFocus = this.onFocus.bind( this );\n\t\tthis.onBlur = this.onBlur.bind( this );\n\t\tthis.onTextUpdate = this.onTextUpdate.bind( this );\n\t\tthis.onContentSizeChange = this.onContentSizeChange.bind( this );\n\t\tthis.onFormatChange = this.onFormatChange.bind( this );\n\t\tthis.formatToValue = memize( this.formatToValue.bind( this ), {\n\t\t\tmaxSize: 1,\n\t\t} );\n\t\tthis.debounceCreateUndoLevel = debounce( this.onCreateUndoLevel, 1000 );\n\t\t// This prevents a bug in Aztec which triggers onSelectionChange twice on format change.\n\t\tthis.onSelectionChange = this.onSelectionChange.bind( this );\n\t\tthis.onSelectionChangeFromAztec =\n\t\t\tthis.onSelectionChangeFromAztec.bind( this );\n\t\tthis.valueToFormat = this.valueToFormat.bind( this );\n\t\tthis.getHtmlToRender = this.getHtmlToRender.bind( this );\n\t\tthis.handleSuggestionFunc = this.handleSuggestionFunc.bind( this );\n\t\tthis.handleUserSuggestion = this.handleSuggestionFunc(\n\t\t\tshowUserSuggestions,\n\t\t\t'@'\n\t\t).bind( this );\n\t\tthis.handleXpostSuggestion = this.handleSuggestionFunc(\n\t\t\tshowXpostSuggestions,\n\t\t\t'+'\n\t\t).bind( this );\n\t\tthis.suggestionOptions = this.suggestionOptions.bind( this );\n\t\tthis.insertString = this.insertString.bind( this );\n\t\tthis.manipulateEventCounterToForceNativeToRefresh =\n\t\t\tthis.manipulateEventCounterToForceNativeToRefresh.bind( this );\n\t\tthis.shouldDropEventFromAztec =\n\t\t\tthis.shouldDropEventFromAztec.bind( this );\n\t\tthis.state = {\n\t\t\tactiveFormats: [],\n\t\t\tselectedFormat: null,\n\t\t\theight: 0,\n\t\t\tcurrentFontSize: this.getFontSize( arguments[ 0 ] ),\n\t\t};\n\t\tthis.needsSelectionUpdate = false;\n\t\tthis.savedContent = '';\n\t\tthis.isTouched = false;\n\t\tthis.lastAztecEventType = null;\n\n\t\tthis.lastHistoryValue = value;\n\n\t\t// Internal values that are update synchronously, unlike props.\n\t\tthis.value = value;\n\t\tthis.selectionStart = selectionStart;\n\t\tthis.selectionEnd = selectionEnd;\n\t}\n\n\t/**\n\t * Get the current record (value and selection) from props and state.\n\t *\n\t * @return {Object} The current record (value and selection).\n\t */\n\tgetRecord() {\n\t\tconst {\n\t\t\tselectionStart: start,\n\t\t\tselectionEnd: end,\n\t\t\tcolorPalette,\n\t\t} = this.props;\n\t\tconst { value } = this.props;\n\t\tconst currentValue = this.formatToValue( value );\n\n\t\tconst { formats, replacements, text } = currentValue;\n\t\tconst { activeFormats } = this.state;\n\t\tconst newFormats = getFormatColors( formats, colorPalette );\n\n\t\treturn {\n\t\t\tformats: newFormats,\n\t\t\treplacements,\n\t\t\ttext,\n\t\t\tstart,\n\t\t\tend,\n\t\t\tactiveFormats,\n\t\t};\n\t}\n\n\t/**\n\t * Creates a RichText value \"record\" from the current content and selection\n\t * information\n\t *\n\t *\n\t * @return {Object} A RichText value with formats and selection.\n\t */\n\tcreateRecord() {\n\t\tconst { preserveWhiteSpace } = this.props;\n\t\tconst value = {\n\t\t\tstart: this.selectionStart,\n\t\t\tend: this.selectionEnd,\n\t\t\t...create( {\n\t\t\t\thtml: this.value,\n\t\t\t\trange: null,\n\t\t\t\tpreserveWhiteSpace,\n\t\t\t} ),\n\t\t};\n\t\tconst start = Math.min( this.selectionStart, value.text.length );\n\t\tconst end = Math.min( this.selectionEnd, value.text.length );\n\t\treturn { ...value, start, end };\n\t}\n\n\tvalueToFormat( value ) {\n\t\t// Remove the outer root tags.\n\t\treturn this.removeRootTagsProducedByAztec( toHTMLString( { value } ) );\n\t}\n\n\tgetActiveFormatNames( record ) {\n\t\tconst { formatTypes } = this.props;\n\n\t\treturn formatTypes\n\t\t\t.map( ( { name } ) => name )\n\t\t\t.filter( ( name ) => {\n\t\t\t\treturn getActiveFormat( record, name ) !== undefined;\n\t\t\t} )\n\t\t\t.map( ( name ) => gutenbergFormatNamesToAztec[ name ] )\n\t\t\t.filter( Boolean );\n\t}\n\n\tonFormatChange( record ) {\n\t\tconst { start = 0, end = 0, activeFormats = [] } = record;\n\t\tconst changeHandlers = Object.fromEntries(\n\t\t\tObject.entries( this.props ).filter( ( [ key ] ) =>\n\t\t\t\tkey.startsWith( 'format_on_change_functions_' )\n\t\t\t)\n\t\t);\n\n\t\tObject.values( changeHandlers ).forEach( ( changeHandler ) => {\n\t\t\tchangeHandler( record.formats, record.text );\n\t\t} );\n\n\t\tthis.value = this.valueToFormat( record );\n\t\tthis.props.onChange( this.value );\n\t\tthis.setState( { activeFormats } );\n\t\tthis.props.onSelectionChange( start, end );\n\t\tthis.selectionStart = start;\n\t\tthis.selectionEnd = end;\n\n\t\tthis.onCreateUndoLevel();\n\n\t\tthis.lastAztecEventType = 'format change';\n\t}\n\n\tinsertString( record, string ) {\n\t\tif ( record && string ) {\n\t\t\tthis.manipulateEventCounterToForceNativeToRefresh(); // force a refresh on the native side\n\t\t\tconst toInsert = insert( record, string );\n\t\t\tthis.onFormatChange( toInsert );\n\t\t}\n\t}\n\n\tonCreateUndoLevel() {\n\t\tconst { __unstableOnCreateUndoLevel: onCreateUndoLevel } = this.props;\n\t\t// If the content is the same, no level needs to be created.\n\t\tif ( this.lastHistoryValue?.toString() === this.value?.toString() ) {\n\t\t\treturn;\n\t\t}\n\n\t\tonCreateUndoLevel();\n\t\tthis.lastHistoryValue = this.value;\n\t}\n\n\t/*\n\t * Cleans up any root tags produced by aztec.\n\t * TODO: This should be removed on a later version when aztec doesn't return the top tag of the text being edited\n\t */\n\tremoveRootTagsProducedByAztec( html ) {\n\t\tlet result = this.removeRootTag( this.props.tagName, html );\n\n\t\tif ( this.props.tagsToEliminate ) {\n\t\t\tthis.props.tagsToEliminate.forEach( ( element ) => {\n\t\t\t\tresult = this.removeTag( element, result );\n\t\t\t} );\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tremoveRootTag( tag, html ) {\n\t\tconst openingTagRegexp = RegExp( '^<' + tag + '[^>]*>', 'gim' );\n\t\tconst closingTagRegexp = RegExp( '</' + tag + '>$', 'gim' );\n\n\t\treturn html\n\t\t\t.replace( openingTagRegexp, '' )\n\t\t\t.replace( closingTagRegexp, '' );\n\t}\n\n\tremoveTag( tag, html ) {\n\t\tconst openingTagRegexp = RegExp( '<' + tag + '>', 'gim' );\n\t\tconst closingTagRegexp = RegExp( '</' + tag + '>', 'gim' );\n\t\treturn html\n\t\t\t.replace( openingTagRegexp, '' )\n\t\t\t.replace( closingTagRegexp, '' );\n\t}\n\n\t/*\n\t * Handles any case where the content of the AztecRN instance has changed\n\t */\n\tonChangeFromAztec( event ) {\n\t\tif ( this.shouldDropEventFromAztec( event, 'onChange' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst contentWithoutRootTag = this.removeRootTagsProducedByAztec(\n\t\t\tevent.nativeEvent.text\n\t\t);\n\t\t// On iOS, onChange can be triggered after selection changes, even though there are no content changes.\n\t\tif ( contentWithoutRootTag === this.value?.toString() ) {\n\t\t\treturn;\n\t\t}\n\t\tthis.lastEventCount = event.nativeEvent.eventCount;\n\t\tthis.comesFromAztec = true;\n\t\tthis.firedAfterTextChanged = true; // The onChange event always fires after the fact.\n\t\tthis.onTextUpdate( event );\n\t\tthis.lastAztecEventType = 'input';\n\t}\n\n\tonTextUpdate( event ) {\n\t\tconst contentWithoutRootTag = this.removeRootTagsProducedByAztec(\n\t\t\tevent.nativeEvent.text\n\t\t);\n\n\t\tthis.debounceCreateUndoLevel();\n\t\tconst refresh = this.value?.toString() !== contentWithoutRootTag;\n\t\tthis.value = contentWithoutRootTag;\n\n\t\t// We don't want to refresh if our goal is just to create a record.\n\t\tif ( refresh ) {\n\t\t\tthis.props.onChange( contentWithoutRootTag );\n\t\t}\n\t}\n\n\t/*\n\t * Handles any case where the content of the AztecRN instance has changed in size\n\t */\n\tonContentSizeChange( contentSize ) {\n\t\tthis.setState( contentSize );\n\t\tthis.lastAztecEventType = 'content size change';\n\t}\n\n\tonKeyDown( event ) {\n\t\tif ( event.defaultPrevented ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Add stubs for conformance in downstream autocompleters logic.\n\t\tthis.customEditableOnKeyDown?.( {\n\t\t\tpreventDefault: () => undefined,\n\t\t\t...event,\n\t\t\tkey: RCTAztecView.KeyCodes[ event?.keyCode ],\n\t\t} );\n\n\t\tthis.handleDelete( event );\n\t\tthis.handleEnter( event );\n\t\tthis.handleTriggerKeyCodes( event );\n\t}\n\n\thandleEnter( event ) {\n\t\tif ( event.keyCode !== ENTER ) {\n\t\t\treturn;\n\t\t}\n\t\tconst { onEnter } = this.props;\n\n\t\tif ( ! onEnter ) {\n\t\t\treturn;\n\t\t}\n\n\t\tonEnter( {\n\t\t\tvalue: this.createRecord(),\n\t\t\tonChange: this.onFormatChange,\n\t\t\tshiftKey: event.shiftKey,\n\t\t} );\n\t\tthis.lastAztecEventType = 'input';\n\t}\n\n\thandleDelete( event ) {\n\t\tif ( this.shouldDropEventFromAztec( event, 'handleDelete' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { keyCode } = event;\n\n\t\tif ( keyCode !== DELETE && keyCode !== BACKSPACE ) {\n\t\t\treturn;\n\t\t}\n\t\tconst isReverse = keyCode === BACKSPACE;\n\n\t\tconst { onDelete } = this.props;\n\t\tthis.lastEventCount = event.nativeEvent.eventCount;\n\t\tthis.comesFromAztec = true;\n\t\tthis.firedAfterTextChanged = event.nativeEvent.firedAfterTextChanged;\n\t\tconst value = this.createRecord();\n\t\tconst { start, end, text, activeFormats } = value;\n\t\tconst hasActiveFormats = activeFormats && !! activeFormats.length;\n\t\tlet newValue;\n\n\t\t// Always handle full content deletion ourselves.\n\t\tif ( start === 0 && end !== 0 && end >= text.length ) {\n\t\t\tnewValue = remove( value );\n\t\t\tthis.onFormatChange( newValue );\n\t\t\tevent.preventDefault();\n\t\t\treturn;\n\t\t}\n\n\t\t// Only process delete if the key press occurs at an uncollapsed edge.\n\t\tif (\n\t\t\t! isCollapsed( value ) ||\n\t\t\thasActiveFormats ||\n\t\t\t( isReverse && start !== 0 ) ||\n\t\t\t( ! isReverse && end !== text.length )\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tonDelete( { isReverse, value } );\n\n\t\tevent.preventDefault();\n\t\tthis.lastAztecEventType = 'input';\n\t}\n\n\thandleTriggerKeyCodes( event ) {\n\t\tconst { keyCode } = event;\n\t\tconst triggeredOption = this.suggestionOptions().find( ( option ) => {\n\t\t\tconst triggeredKeyCode = option.triggerChar.charCodeAt( 0 );\n\t\t\treturn triggeredKeyCode === keyCode;\n\t\t} );\n\n\t\tif ( triggeredOption ) {\n\t\t\tconst record = this.getRecord();\n\t\t\tconst text = getTextContent( record );\n\t\t\t// Only respond to the trigger if the selection is on the start of text or line\n\t\t\t// or if the character before is a space.\n\t\t\tconst useTrigger =\n\t\t\t\ttext.length === 0 ||\n\t\t\t\trecord.start === 0 ||\n\t\t\t\ttext.charAt( record.start - 1 ) === '\\n' ||\n\t\t\t\ttext.charAt( record.start - 1 ) === ' ';\n\n\t\t\tif ( useTrigger && triggeredOption.onClick ) {\n\t\t\t\ttriggeredOption.onClick();\n\t\t\t} else {\n\t\t\t\tthis.insertString( record, triggeredOption.triggerChar );\n\t\t\t}\n\t\t}\n\t}\n\n\tsuggestionOptions() {\n\t\tconst { areMentionsSupported, areXPostsSupported } = this.props;\n\t\tconst allOptions = [\n\t\t\t{\n\t\t\t\tsupported: areMentionsSupported,\n\t\t\t\ttitle: __( 'Insert mention' ),\n\t\t\t\tonClick: this.handleUserSuggestion,\n\t\t\t\ttriggerChar: '@',\n\t\t\t\tvalue: 'mention',\n\t\t\t\tlabel: __( 'Mention' ),\n\t\t\t\ticon: atSymbol,\n\t\t\t},\n\t\t\t{\n\t\t\t\tsupported: areXPostsSupported,\n\t\t\t\ttitle: __( 'Insert crosspost' ),\n\t\t\t\tonClick: this.handleXpostSuggestion,\n\t\t\t\ttriggerChar: '+',\n\t\t\t\tvalue: 'crosspost',\n\t\t\t\tlabel: __( 'Crosspost' ),\n\t\t\t\ticon: plus,\n\t\t\t},\n\t\t];\n\t\treturn allOptions.filter( ( op ) => op.supported );\n\t}\n\n\thandleSuggestionFunc( suggestionFunction, prefix ) {\n\t\treturn () => {\n\t\t\tconst record = this.getRecord();\n\t\t\tsuggestionFunction()\n\t\t\t\t.then( ( suggestion ) => {\n\t\t\t\t\tthis.insertString( record, `${ prefix }${ suggestion } ` );\n\t\t\t\t} )\n\t\t\t\t.catch( () => {} );\n\t\t};\n\t}\n\n\t/**\n\t * Handles a paste event from the native Aztec Wrapper.\n\t *\n\t * @param {Object} event The paste event which wraps `nativeEvent`.\n\t */\n\tonPaste( event ) {\n\t\tconst { onPaste, onChange } = this.props;\n\t\tconst { activeFormats = [] } = this.state;\n\n\t\tconst { pastedText, pastedHtml, files } = event.nativeEvent;\n\t\tconst currentRecord = this.createRecord();\n\n\t\tevent.preventDefault();\n\n\t\t// There is a selection, check if a URL is pasted.\n\t\tif ( ! isCollapsed( currentRecord ) ) {\n\t\t\tconst trimmedText = ( pastedHtml || pastedText )\n\t\t\t\t.replace( /<[^>]+>/g, '' )\n\t\t\t\t.trim();\n\n\t\t\t// A URL was pasted, turn the selection into a link.\n\t\t\tif ( isURL( trimmedText ) ) {\n\t\t\t\tconst linkedRecord = applyFormat( currentRecord, {\n\t\t\t\t\ttype: 'a',\n\t\t\t\t\tattributes: {\n\t\t\t\t\t\thref: decodeEntities( trimmedText ),\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t\tthis.value = this.valueToFormat( linkedRecord );\n\t\t\t\tonChange( this.value );\n\n\t\t\t\t// Allows us to ask for this information when we get a report.\n\t\t\t\twindow.console.log( 'Created link:\\n\\n', trimmedText );\n\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tif ( onPaste ) {\n\t\t\tonPaste( {\n\t\t\t\tvalue: currentRecord,\n\t\t\t\tonChange: this.onFormatChange,\n\t\t\t\thtml: pastedHtml,\n\t\t\t\tplainText: pastedText,\n\t\t\t\tfiles,\n\t\t\t\tactiveFormats,\n\t\t\t} );\n\t\t}\n\t}\n\n\tonFocus() {\n\t\tthis.isTouched = true;\n\n\t\tconst { unstableOnFocus, onSelectionChange } = this.props;\n\n\t\tif ( unstableOnFocus ) {\n\t\t\tunstableOnFocus();\n\t\t}\n\n\t\t// We know for certain that on focus, the old selection is invalid. It\n\t\t// will be recalculated on `selectionchange`.\n\n\t\tonSelectionChange( this.selectionStart, this.selectionEnd );\n\n\t\tthis.lastAztecEventType = 'focus';\n\t}\n\n\tonBlur( event ) {\n\t\tthis.isTouched = false;\n\n\t\t// Check if value is up to date with latest state of native AztecView.\n\t\tif (\n\t\t\tevent.nativeEvent.text &&\n\t\t\tevent.nativeEvent.text !== this.props.value?.toString()\n\t\t) {\n\t\t\tthis.onTextUpdate( event );\n\t\t}\n\n\t\tif ( this.props.onBlur ) {\n\t\t\tthis.props.onBlur( event );\n\t\t}\n\n\t\tthis.lastAztecEventType = 'blur';\n\t}\n\n\tonSelectionChange( start, end ) {\n\t\tconst hasChanged =\n\t\t\tthis.selectionStart !== start || this.selectionEnd !== end;\n\n\t\tthis.selectionStart = start;\n\t\tthis.selectionEnd = end;\n\n\t\t// This is a manual selection change event if onChange was not triggered just before\n\t\t// and we did not just trigger a text update\n\t\t// `onChange` could be the last event and could have been triggered a long time ago so\n\t\t// this approach is not perfectly reliable.\n\t\tconst isManual =\n\t\t\tthis.lastAztecEventType !== 'input' &&\n\t\t\tthis.props.value?.toString() === this.value?.toString();\n\t\tif ( hasChanged && isManual ) {\n\t\t\tconst value = this.createRecord();\n\t\t\tconst activeFormats = getActiveFormats( value );\n\t\t\tthis.setState( { activeFormats } );\n\t\t}\n\n\t\tthis.props.onSelectionChange( start, end );\n\t}\n\n\tshouldDropEventFromAztec( event, logText ) {\n\t\tconst shouldDrop =\n\t\t\t! this.isIOS && event.nativeEvent.eventCount <= this.lastEventCount;\n\t\tif ( shouldDrop ) {\n\t\t\twindow.console.log(\n\t\t\t\t`Dropping ${ logText } from Aztec as its event counter is older than latest sent to the native side. Got ${ event.nativeEvent.eventCount } but lastEventCount is ${ this.lastEventCount }.`\n\t\t\t);\n\t\t}\n\t\treturn shouldDrop;\n\t}\n\n\t/**\n\t * Determines whether the text input should receive focus after an update.\n\t * For cases where a RichText with a value is merged with an empty one.\n\t *\n\t * @param {Object} prevProps - The previous props of the component.\n\t * @return {boolean} True if the text input should receive focus, false otherwise.\n\t */\n\tshouldFocusTextInputAfterMerge( prevProps ) {\n\t\tconst {\n\t\t\t__unstableIsSelected: isSelected,\n\t\t\tblockIsSelected,\n\t\t\tselectionStart,\n\t\t\tselectionEnd,\n\t\t\t__unstableMobileNoFocusOnMount,\n\t\t} = this.props;\n\n\t\tconst {\n\t\t\t__unstableIsSelected: prevIsSelected,\n\t\t\tblockIsSelected: prevBlockIsSelected,\n\t\t} = prevProps;\n\n\t\tconst noSelectionValues =\n\t\t\tselectionStart === undefined && selectionEnd === undefined;\n\t\tconst textInputWasNotFocused = ! prevIsSelected && ! isSelected;\n\n\t\treturn (\n\t\t\t! __unstableMobileNoFocusOnMount &&\n\t\t\tnoSelectionValues &&\n\t\t\ttextInputWasNotFocused &&\n\t\t\t! prevBlockIsSelected &&\n\t\t\tblockIsSelected\n\t\t);\n\t}\n\n\tonSelectionChangeFromAztec( start, end, text, event ) {\n\t\tif ( this.shouldDropEventFromAztec( event, 'onSelectionChange' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// `end` can be less than `start` on iOS\n\t\t// Let's fix that here so `rich-text/slice` can work properly.\n\t\tconst realStart = Math.min( start, end );\n\t\tconst realEnd = Math.max( start, end );\n\n\t\t// Check and dicsard stray event, where the text and selection is equal to the ones already cached.\n\t\tconst contentWithoutRootTag = this.removeRootTagsProducedByAztec(\n\t\t\tevent.nativeEvent.text\n\t\t);\n\t\tif (\n\t\t\tcontentWithoutRootTag === this.value?.toString() &&\n\t\t\trealStart === this.selectionStart &&\n\t\t\trealEnd === this.selectionEnd\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.comesFromAztec = true;\n\t\tthis.firedAfterTextChanged = true; // Selection change event always fires after the fact.\n\n\t\t// Update text before updating selection\n\t\t// Make sure there are changes made to the content before upgrading it upward.\n\t\tthis.onTextUpdate( event );\n\n\t\t// Aztec can send us selection change events after it has lost focus.\n\t\t// For instance the autocorrect feature will complete a partially written\n\t\t// word when resigning focus, causing a selection change event.\n\t\t// Forwarding this selection change could cause this RichText to regain\n\t\t// focus and start a focus loop.\n\t\t//\n\t\t// See https://github.com/wordpress-mobile/gutenberg-mobile/issues/1696\n\t\tif ( this.props.__unstableIsSelected ) {\n\t\t\tthis.onSelectionChange( realStart, realEnd );\n\t\t}\n\t\t// Update lastEventCount to prevent Aztec from re-rendering the content it just sent.\n\t\tthis.lastEventCount = event.nativeEvent.eventCount;\n\n\t\tthis.lastAztecEventType = 'selection change';\n\t}\n\n\tisEmpty() {\n\t\treturn isEmpty( this.formatToValue( this.props.value ) );\n\t}\n\n\tformatToValue( value ) {\n\t\tconst { preserveWhiteSpace } = this.props;\n\t\t// Handle deprecated `children` and `node` sources.\n\t\tif ( Array.isArray( value ) ) {\n\t\t\treturn create( {\n\t\t\t\thtml: childrenBlock.toHTML( value ),\n\t\t\t\tpreserveWhiteSpace,\n\t\t\t} );\n\t\t}\n\n\t\tif ( this.props.format === 'string' ) {\n\t\t\treturn create( {\n\t\t\t\thtml: value,\n\t\t\t\tpreserveWhiteSpace,\n\t\t\t} );\n\t\t}\n\n\t\t// Guard for blocks passing `null` in onSplit callbacks. May be removed\n\t\t// if onSplit is revised to not pass a `null` value.\n\t\tif ( value === null ) {\n\t\t\treturn create();\n\t\t}\n\n\t\treturn value;\n\t}\n\n\tmanipulateEventCounterToForceNativeToRefresh() {\n\t\tif ( this.isIOS ) {\n\t\t\tthis.lastEventCount = undefined;\n\t\t\treturn;\n\t\t}\n\n\t\tif ( typeof this.lastEventCount !== 'undefined' ) {\n\t\t\tthis.lastEventCount += 100; // bump by a hundred, hopefully native hasn't bombarded the JS side in the meantime.\n\t\t} // no need to bump when 'undefined' as native side won't receive the key when the value is undefined, and that will cause force updating anyway,\n\t\t// see https://github.com/WordPress/gutenberg/blob/82e578dcc75e67891c750a41a04c1e31994192fc/packages/react-native-aztec/android/src/main/java/org/wordpress/mobile/ReactNativeAztec/ReactAztecManager.java#L213-L215\n\t}\n\n\tshouldComponentUpdate( nextProps, nextState ) {\n\t\tif (\n\t\t\tnextProps.tagName !== this.props.tagName ||\n\t\t\tnextProps.reversed !== this.props.reversed ||\n\t\t\tnextProps.start !== this.props.start\n\t\t) {\n\t\t\tthis.manipulateEventCounterToForceNativeToRefresh(); // force a refresh on the native side\n\t\t\tthis.value = undefined;\n\t\t\treturn true;\n\t\t}\n\n\t\t// TODO: Please re-introduce the check to avoid updating the content right after an `onChange` call.\n\t\t// It was removed in https://github.com/WordPress/gutenberg/pull/12417 to fix undo/redo problem.\n\n\t\t// If the component is changed React side (undo/redo/merging/splitting/custom text actions)\n\t\t// we need to make sure the native is updated as well.\n\n\t\t// Also, don't trust the \"this.lastContent\" as on Android, incomplete text events arrive\n\t\t// with only some of the text, while the virtual keyboard's suggestion system does its magic.\n\t\t// ** compare with this.lastContent for optimizing performance by not forcing Aztec with text it already has\n\t\t// , but compare with props.value to not lose \"half word\" text because of Android virtual keyb autosuggestion behavior\n\t\tif (\n\t\t\ttypeof nextProps.value !== 'undefined' &&\n\t\t\ttypeof this.props.value !== 'undefined' &&\n\t\t\t( ! this.comesFromAztec || ! this.firedAfterTextChanged ) &&\n\t\t\tnextProps.value?.toString() !== this.props.value?.toString()\n\t\t) {\n\t\t\t// Gutenberg seems to try to mirror the caret state even on events that only change the content so,\n\t\t\t// let's force caret update if state has selection set.\n\t\t\tif (\n\t\t\t\ttypeof nextProps.selectionStart !== 'undefined' &&\n\t\t\t\ttypeof nextProps.selectionEnd !== 'undefined'\n\t\t\t) {\n\t\t\t\tthis.needsSelectionUpdate = true;\n\t\t\t}\n\n\t\t\tthis.manipulateEventCounterToForceNativeToRefresh(); // force a refresh on the native side\n\t\t}\n\n\t\tif ( ! this.comesFromAztec ) {\n\t\t\tif (\n\t\t\t\ttypeof nextProps.selectionStart !== 'undefined' &&\n\t\t\t\ttypeof nextProps.selectionEnd !== 'undefined' &&\n\t\t\t\tnextProps.selectionStart !== this.props.selectionStart &&\n\t\t\t\tnextProps.selectionStart !== this.selectionStart &&\n\t\t\t\tnextProps.__unstableIsSelected\n\t\t\t) {\n\t\t\t\tthis.needsSelectionUpdate = true;\n\t\t\t\tthis.manipulateEventCounterToForceNativeToRefresh(); // force a refresh on the native side\n\t\t\t}\n\n\t\t\t// For font size changes from a prop value a force refresh\n\t\t\t// is needed without the selection update.\n\t\t\tif ( nextProps?.fontSize !== this.props?.fontSize ) {\n\t\t\t\tthis.manipulateEventCounterToForceNativeToRefresh(); // force a refresh on the native side\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\t( nextProps?.style?.fontSize !== this.props?.style?.fontSize &&\n\t\t\t\t\tnextState.currentFontSize !==\n\t\t\t\t\t\tthis.state.currentFontSize ) ||\n\t\t\t\tnextState.currentFontSize !== this.state.currentFontSize ||\n\t\t\t\tnextProps?.style?.lineHeight !== this.props?.style?.lineHeight\n\t\t\t) {\n\t\t\t\tthis.needsSelectionUpdate = true;\n\t\t\t\tthis.manipulateEventCounterToForceNativeToRefresh(); // force a refresh on the native side\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tcomponentDidMount() {\n\t\t// Request focus if wrapping block is selected and parent hasn't inhibited the focus request. This method of focusing\n\t\t// is trying to implement the web-side counterpart of BlockList's `focusTabbable` where the BlockList is focusing an\n\t\t// inputbox by searching the DOM. We don't have the DOM in RN so, using the combination of blockIsSelected and __unstableMobileNoFocusOnMount\n\t\t// to determine if we should focus the RichText.\n\t\tif (\n\t\t\tthis.props.blockIsSelected &&\n\t\t\t! this.props.__unstableMobileNoFocusOnMount\n\t\t) {\n\t\t\tthis._editor.focus();\n\t\t\tthis.onSelectionChange(\n\t\t\t\tthis.props.selectionStart || 0,\n\t\t\t\tthis.props.selectionEnd || 0\n\t\t\t);\n\t\t}\n\t}\n\n\tcomponentDidUpdate( prevProps ) {\n\t\tconst { style, tagName } = this.props;\n\t\tconst { currentFontSize } = this.state;\n\n\t\tif ( this.props.value?.toString() !== this.value?.toString() ) {\n\t\t\tthis.value = this.props.value;\n\t\t}\n\t\tconst { __unstableIsSelected: prevIsSelected } = prevProps;\n\t\tconst { __unstableIsSelected: isSelected } = this.props;\n\n\t\tif ( isSelected && ! prevIsSelected ) {\n\t\t\tthis._editor.focus();\n\t\t\t// Update selection props explicitly when component is selected as Aztec won't call onSelectionChange\n\t\t\t// if its internal value hasn't change. When created, default value is 0, 0.\n\t\t\tthis.onSelectionChange(\n\t\t\t\tthis.props.selectionStart || 0,\n\t\t\t\tthis.props.selectionEnd || 0\n\t\t\t);\n\t\t} else if ( this.shouldFocusTextInputAfterMerge( prevProps ) ) {\n\t\t\t// Since this is happening when merging blocks, the selection should be at the last character position.\n\t\t\t// As a fallback the internal selectionEnd value is used.\n\t\t\tconst lastCharacterPosition =\n\t\t\t\tthis.value?.toString().length ?? this.selectionEnd;\n\t\t\tthis._editor.focus();\n\t\t\tthis.props.onSelectionChange(\n\t\t\t\tlastCharacterPosition,\n\t\t\t\tlastCharacterPosition\n\t\t\t);\n\t\t} else if ( ! isSelected && prevIsSelected ) {\n\t\t\tthis._editor.blur();\n\t\t}\n\n\t\t// For font size values changes from the font size picker\n\t\t// we compare previous values to refresh the selected font size,\n\t\t// this is also used when the tag name changes\n\t\t// e.g Heading block and a level change like h1->h2.\n\t\tconst currentFontSizeStyle = this.getParsedFontSize( style?.fontSize );\n\t\tconst prevFontSizeStyle = this.getParsedFontSize(\n\t\t\tprevProps?.style?.fontSize\n\t\t);\n\t\tconst isDifferentTag = prevProps.tagName !== tagName;\n\t\tif (\n\t\t\t( currentFontSize &&\n\t\t\t\t( currentFontSizeStyle || prevFontSizeStyle ) &&\n\t\t\t\tcurrentFontSizeStyle !== currentFontSize ) ||\n\t\t\tisDifferentTag\n\t\t) {\n\t\t\tthis.setState( {\n\t\t\t\tcurrentFontSize: this.getFontSize( this.props ),\n\t\t\t} );\n\t\t}\n\t}\n\n\tcomponentWillUnmount() {\n\t\tconst { clearCurrentSelectionOnUnmount } = this.props;\n\n\t\t// There are cases when the component is unmounted e.g. scrolling in a\n\t\t// long post due to virtualization, so the block selection needs to be cleared\n\t\t// so it doesn't auto-focus when it's added back.\n\t\tif ( this._editor?.isFocused() ) {\n\t\t\tclearCurrentSelectionOnUnmount?.();\n\t\t}\n\t}\n\n\tgetHtmlToRender( record, tagName ) {\n\t\t// Save back to HTML from React tree.\n\t\tlet value = this.valueToFormat( record );\n\n\t\tif ( value === undefined ) {\n\t\t\tthis.manipulateEventCounterToForceNativeToRefresh(); // force a refresh on the native side\n\t\t\tvalue = '';\n\t\t}\n\t\t// On android if content is empty we need to send no content or else the placeholder will not show.\n\t\tif (\n\t\t\t! this.isIOS &&\n\t\t\t( value?.toString() === '' ||\n\t\t\t\tvalue?.toString() === EMPTY_PARAGRAPH_TAGS )\n\t\t) {\n\t\t\treturn '';\n\t\t}\n\n\t\tif ( tagName ) {\n\t\t\tlet extraAttributes = ``;\n\t\t\tif ( tagName === `ol` ) {\n\t\t\t\tif ( this.props.reversed ) {\n\t\t\t\t\textraAttributes += ` reversed`;\n\t\t\t\t}\n\t\t\t\tif ( this.props.start ) {\n\t\t\t\t\textraAttributes += ` start=${ this.props.start }`;\n\t\t\t\t}\n\t\t\t}\n\t\t\tvalue = `<${ tagName }${ extraAttributes }>${ value }</${ tagName }>`;\n\t\t}\n\t\treturn value;\n\t}\n\n\tgetEditableProps() {\n\t\treturn {\n\t\t\t// Overridable props.\n\t\t\tstyle: {},\n\t\t\tclassName: 'rich-text',\n\t\t\tonKeyDown: () => null,\n\t\t};\n\t}\n\n\tgetParsedFontSize( fontSize ) {\n\t\tconst { height, width } = Dimensions.get( 'window' );\n\t\tconst cssUnitOptions = { height, width, fontSize: DEFAULT_FONT_SIZE };\n\n\t\tif ( ! fontSize ) {\n\t\t\treturn fontSize;\n\t\t}\n\n\t\tconst selectedPxValue =\n\t\t\tgetPxFromCssUnit( fontSize, cssUnitOptions ) ?? DEFAULT_FONT_SIZE;\n\n\t\treturn parseFloat( selectedPxValue );\n\t}\n\n\tgetFontSize( props ) {\n\t\tconst { baseGlobalStyles, tagName, fontSize, style } = props;\n\t\tconst tagNameFontSize =\n\t\t\tbaseGlobalStyles?.elements?.[ tagName ]?.typography?.fontSize;\n\n\t\tlet newFontSize = DEFAULT_FONT_SIZE;\n\n\t\t// Disables line-height rendering for pre elements until we fix some issues with AztecAndroid.\n\t\tif ( tagName === 'pre' && ! this.isIOS ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// For block-based themes, get the default editor font size.\n\t\tif ( baseGlobalStyles?.typography?.fontSize && tagName === 'p' ) {\n\t\t\tnewFontSize = baseGlobalStyles?.typography?.fontSize;\n\t\t}\n\n\t\t// For block-based themes, get the default element font size\n\t\t// e.g h1, h2.\n\t\tif ( tagNameFontSize ) {\n\t\t\tnewFontSize = tagNameFontSize;\n\t\t}\n\n\t\t// For font size values provided from the styles,\n\t\t// usually from values set from the font size picker.\n\t\tif ( style?.fontSize ) {\n\t\t\tnewFontSize = style.fontSize;\n\t\t}\n\n\t\t// Fall-back to a font size provided from its props (if there's any)\n\t\t// and there are no other default values to use.\n\t\tif ( fontSize && ! tagNameFontSize && ! style?.fontSize ) {\n\t\t\tnewFontSize = fontSize;\n\t\t}\n\n\t\t// We need to always convert to px units because the selected value\n\t\t// could be coming from the web where it could be stored as a different unit.\n\t\tconst selectedPxValue = this.getParsedFontSize( newFontSize );\n\n\t\treturn selectedPxValue;\n\t}\n\n\tgetLineHeight() {\n\t\tconst { baseGlobalStyles, tagName, lineHeight, style } = this.props;\n\t\tconst tagNameLineHeight =\n\t\t\tbaseGlobalStyles?.elements?.[ tagName ]?.typography?.lineHeight;\n\t\tlet newLineHeight;\n\n\t\t// Disables line-height rendering for pre elements until we fix some issues with AztecAndroid.\n\t\tif ( tagName === 'pre' && ! this.isIOS ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif ( ! this.getIsBlockBasedTheme() ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// For block-based themes, get the default editor line height.\n\t\tif ( baseGlobalStyles?.typography?.lineHeight && tagName === 'p' ) {\n\t\t\tnewLineHeight = parseFloat(\n\t\t\t\tbaseGlobalStyles?.typography?.lineHeight\n\t\t\t);\n\t\t}\n\n\t\t// For block-based themes, get the default element line height\n\t\t// e.g h1, h2.\n\t\tif ( tagNameLineHeight ) {\n\t\t\tnewLineHeight = parseFloat( tagNameLineHeight );\n\t\t}\n\n\t\t// For line height values provided from the styles,\n\t\t// usually from values set from the line height picker.\n\t\tif ( style?.lineHeight ) {\n\t\t\tnewLineHeight = parseFloat( style.lineHeight );\n\t\t}\n\n\t\t// Fall-back to a line height provided from its props (if there's any)\n\t\t// and there are no other default values to use.\n\t\tif ( lineHeight && ! tagNameLineHeight && ! style?.lineHeight ) {\n\t\t\tnewLineHeight = lineHeight;\n\t\t}\n\n\t\t// Check the final value is not over the minimum supported value.\n\t\tif ( newLineHeight && newLineHeight < MIN_LINE_HEIGHT ) {\n\t\t\tnewLineHeight = MIN_LINE_HEIGHT;\n\t\t}\n\n\t\t// Until we parse CSS values correctly, avoid passing NaN values to Aztec\n\t\tif ( isNaN( newLineHeight ) ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn newLineHeight;\n\t}\n\n\tgetIsBlockBasedTheme() {\n\t\tconst { baseGlobalStyles } = this.props;\n\n\t\treturn (\n\t\t\tbaseGlobalStyles && Object.entries( baseGlobalStyles ).length !== 0\n\t\t);\n\t}\n\n\tgetBlockUseDefaultFont() {\n\t\t// For block-based themes it enables using the defaultFont\n\t\t// in Aztec for iOS so it allows customizing the font size\n\t\t// for the Preformatted/Code and Heading blocks.\n\t\tif ( ! this.isIOS ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { tagName } = this.props;\n\t\tconst isBlockBasedTheme = this.getIsBlockBasedTheme();\n\t\tconst tagsToMatch = /pre|h([1-6])$/gm;\n\n\t\treturn isBlockBasedTheme && tagsToMatch.test( tagName );\n\t}\n\n\tgetLinkTextColor( defaultColor ) {\n\t\tconst { style } = this.props;\n\t\tconst customColor = style?.linkColor && colord( style.linkColor );\n\n\t\treturn customColor && customColor.isValid()\n\t\t\t? customColor.toHex()\n\t\t\t: defaultColor;\n\t}\n\n\tgetPlaceholderTextColor() {\n\t\tconst {\n\t\t\tbaseGlobalStyles,\n\t\t\tgetStylesFromColorScheme,\n\t\t\tplaceholderTextColor,\n\t\t\tstyle,\n\t\t} = this.props;\n\n\t\t// Default placeholder text color.\n\t\tconst placeholderStyle = getStylesFromColorScheme(\n\t\t\tstyles.richTextPlaceholder,\n\t\t\tstyles.richTextPlaceholderDark\n\t\t);\n\t\tconst { color: defaultPlaceholderTextColor } = placeholderStyle;\n\t\t// Custom 63% opacity for theme and inherited colors.\n\t\tconst placeholderOpacity = 'A1';\n\n\t\t// Determine inherited placeholder color if available.\n\t\tconst inheritPlaceholderColor = style?.placeholderColor\n\t\t\t? `${ style.placeholderColor }${ placeholderOpacity }`\n\t\t\t: undefined;\n\n\t\t// If using block-based themes, derive the placeholder color from global styles.\n\t\tconst globalStylesPlaceholderColor = baseGlobalStyles?.color?.text\n\t\t\t? `${ baseGlobalStyles.color.text }${ placeholderOpacity }`\n\t\t\t: undefined;\n\n\t\treturn (\n\t\t\tinheritPlaceholderColor ??\n\t\t\tplaceholderTextColor ??\n\t\t\tglobalStylesPlaceholderColor ??\n\t\t\tdefaultPlaceholderTextColor\n\t\t);\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\ttagName,\n\t\t\tstyle,\n\t\t\t__unstableIsSelected: isSelected,\n\t\t\tchildren,\n\t\t\tgetStylesFromColorScheme,\n\t\t\tminWidth,\n\t\t\tmaxWidth,\n\t\t\tformatTypes,\n\t\t\tparentBlockStyles,\n\t\t\taccessibilityLabel,\n\t\t\tdisableEditingMenu = false,\n\t\t\tbaseGlobalStyles,\n\t\t\tselectionStart,\n\t\t\tselectionEnd,\n\t\t\tdisableSuggestions,\n\t\t\tcontainerWidth,\n\t\t} = this.props;\n\t\tconst { currentFontSize } = this.state;\n\n\t\tconst record = this.getRecord();\n\t\tconst html = this.getHtmlToRender( record, tagName );\n\t\tconst editableProps = this.getEditableProps();\n\t\tconst blockUseDefaultFont = this.getBlockUseDefaultFont();\n\n\t\tconst fontSize = currentFontSize;\n\t\tconst lineHeight = this.getLineHeight();\n\n\t\tconst {\n\t\t\tcolor: defaultColor,\n\t\t\ttextDecorationColor: defaultTextDecorationColor,\n\t\t\tfontFamily: defaultFontFamily,\n\t\t} = getStylesFromColorScheme( styles.richText, styles.richTextDark );\n\t\tconst linkTextColor = this.getLinkTextColor(\n\t\t\tdefaultTextDecorationColor\n\t\t);\n\n\t\tconst currentSelectionStart = selectionStart ?? 0;\n\t\tconst currentSelectionEnd = selectionEnd ?? 0;\n\t\tlet selection = null;\n\t\tif ( this.needsSelectionUpdate ) {\n\t\t\tthis.needsSelectionUpdate = false;\n\t\t\tselection = {\n\t\t\t\tstart: currentSelectionStart,\n\t\t\t\tend: currentSelectionEnd,\n\t\t\t};\n\n\t\t\t// On AztecAndroid, setting the caret to an out-of-bounds position will crash the editor so, let's check for some cases.\n\t\t\tif ( ! this.isIOS ) {\n\t\t\t\t// The following regular expression is used in Aztec here:\n\t\t\t\t// https://github.com/wordpress-mobile/AztecEditor-Android/blob/b1fad439d56fa6d4aa0b78526fef355c59d00dd3/aztec/src/main/kotlin/org/wordpress/aztec/AztecParser.kt#L656\n\t\t\t\tconst brBeforeParaMatches = html.match( /(<br>)+<\\/p>$/g );\n\t\t\t\tif ( brBeforeParaMatches ) {\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t'Oops, BR tag(s) at the end of content. Aztec will remove them, adapting the selection...'\n\t\t\t\t\t);\n\t\t\t\t\tconst count = (\n\t\t\t\t\t\tbrBeforeParaMatches[ 0 ].match( /br/g ) || []\n\t\t\t\t\t).length;\n\t\t\t\t\tif ( count > 0 ) {\n\t\t\t\t\t\tlet newSelectionStart = currentSelectionStart - count;\n\t\t\t\t\t\tif ( newSelectionStart < 0 ) {\n\t\t\t\t\t\t\tnewSelectionStart = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlet newSelectionEnd = currentSelectionEnd - count;\n\t\t\t\t\t\tif ( newSelectionEnd < 0 ) {\n\t\t\t\t\t\t\tnewSelectionEnd = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tselection = {\n\t\t\t\t\t\t\tstart: newSelectionStart,\n\t\t\t\t\t\t\tend: newSelectionEnd,\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\n\t\tif ( this.comesFromAztec ) {\n\t\t\tthis.comesFromAztec = false;\n\t\t\tthis.firedAfterTextChanged = false;\n\t\t}\n\n\t\t// Logic below assures that `RichText` width will always have equal value when container is almost fully filled.\n\t\tconst width =\n\t\t\tmaxWidth && this.state.width && maxWidth - this.state.width < 10\n\t\t\t\t? maxWidth\n\t\t\t\t: this.state.width;\n\t\tconst containerStyles = [\n\t\t\tstyle?.padding &&\n\t\t\t\tstyle?.backgroundColor && {\n\t\t\t\t\tpadding: style.padding,\n\t\t\t\t\tbackgroundColor: style.backgroundColor,\n\t\t\t\t},\n\t\t\tcontainerWidth && {\n\t\t\t\twidth: containerWidth,\n\t\t\t},\n\t\t];\n\n\t\tconst defaultSelectionColor = getStylesFromColorScheme(\n\t\t\tstyles[ 'rich-text-selection' ],\n\t\t\tstyles[ 'rich-text-selection--dark' ]\n\t\t).color;\n\t\tconst selectionColor = getSelectionColor(\n\t\t\tthis.props.selectionColor,\n\t\t\tdefaultSelectionColor,\n\t\t\tbaseGlobalStyles,\n\t\t\tthis.getIsBlockBasedTheme()\n\t\t);\n\n\t\tconst EditableView = ( props ) => {\n\t\t\tthis.customEditableOnKeyDown = props?.onKeyDown;\n\n\t\t\treturn <></>;\n\t\t};\n\n\t\treturn (\n\t\t\t<View style={ containerStyles }>\n\t\t\t\t{ children &&\n\t\t\t\t\tchildren( {\n\t\t\t\t\t\tisSelected,\n\t\t\t\t\t\tvalue: record,\n\t\t\t\t\t\tonChange: this.onFormatChange,\n\t\t\t\t\t\tonFocus: () => {},\n\t\t\t\t\t\teditableProps,\n\t\t\t\t\t\teditableTagName: EditableView,\n\t\t\t\t\t} ) }\n\t\t\t\t<RCTAztecView\n\t\t\t\t\taccessibilityLabel={ accessibilityLabel }\n\t\t\t\t\tref={ ( ref ) => {\n\t\t\t\t\t\tthis._editor = ref;\n\n\t\t\t\t\t\tif ( this.props.nativeEditorRef ) {\n\t\t\t\t\t\t\tthis.props.nativeEditorRef( ref );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\tbackgroundColor: styles.richText.backgroundColor,\n\t\t\t\t\t\t...style,\n\t\t\t\t\t\t...( this.isIOS && minWidth && maxWidth\n\t\t\t\t\t\t\t? { width }\n\t\t\t\t\t\t\t: { maxWidth } ),\n\t\t\t\t\t\tminHeight: this.state.height,\n\t\t\t\t\t} }\n\t\t\t\t\tblockUseDefaultFont={ blockUseDefaultFont }\n\t\t\t\t\ttext={ {\n\t\t\t\t\t\ttext: html,\n\t\t\t\t\t\teventCount: this.lastEventCount,\n\t\t\t\t\t\tselection,\n\t\t\t\t\t\tlinkTextColor,\n\t\t\t\t\t\ttag: tagName,\n\t\t\t\t\t} }\n\t\t\t\t\tplaceholder={ this.props.placeholder }\n\t\t\t\t\tplaceholderTextColor={ this.getPlaceholderTextColor() }\n\t\t\t\t\tdeleteEnter={ this.props.deleteEnter }\n\t\t\t\t\tonChange={ this.onChangeFromAztec }\n\t\t\t\t\tonFocus={ this.onFocus }\n\t\t\t\t\tonBlur={ this.onBlur }\n\t\t\t\t\tonKeyDown={ this.onKeyDown }\n\t\t\t\t\ttriggerKeyCodes={\n\t\t\t\t\t\tdisableEditingMenu\n\t\t\t\t\t\t\t? []\n\t\t\t\t\t\t\t: this.suggestionOptions().map(\n\t\t\t\t\t\t\t\t\t( op ) => op.triggerChar\n\t\t\t\t\t\t\t )\n\t\t\t\t\t}\n\t\t\t\t\tonPaste={ this.onPaste }\n\t\t\t\t\tactiveFormats={ this.getActiveFormatNames( record ) }\n\t\t\t\t\tonContentSizeChange={ this.onContentSizeChange }\n\t\t\t\t\tonSelectionChange={ this.onSelectionChangeFromAztec }\n\t\t\t\t\tblockType={ { tag: tagName } }\n\t\t\t\t\tcolor={\n\t\t\t\t\t\t( style && style.color ) ||\n\t\t\t\t\t\t( parentBlockStyles && parentBlockStyles.color ) ||\n\t\t\t\t\t\t( baseGlobalStyles && baseGlobalStyles?.color?.text ) ||\n\t\t\t\t\t\tdefaultColor\n\t\t\t\t\t}\n\t\t\t\t\tmaxImagesWidth={ 200 }\n\t\t\t\t\tfontFamily={ this.props.fontFamily || defaultFontFamily }\n\t\t\t\t\tfontSize={ fontSize }\n\t\t\t\t\tlineHeight={ lineHeight }\n\t\t\t\t\tfontWeight={ this.props.fontWeight }\n\t\t\t\t\tfontStyle={ this.props.fontStyle }\n\t\t\t\t\tdisableEditingMenu={ disableEditingMenu }\n\t\t\t\t\tisMultiline={ false }\n\t\t\t\t\ttextAlign={ this.props.textAlign }\n\t\t\t\t\t{ ...( this.isIOS ? { maxWidth } : {} ) }\n\t\t\t\t\tminWidth={ minWidth }\n\t\t\t\t\tid={ this.props.id }\n\t\t\t\t\tselectionColor={ selectionColor }\n\t\t\t\t\tdisableAutocorrection={ this.props.disableAutocorrection }\n\t\t\t\t/>\n\t\t\t\t{ isSelected && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<FormatEdit\n\t\t\t\t\t\t\tforwardedRef={ this._editor }\n\t\t\t\t\t\t\tformatTypes={ formatTypes }\n\t\t\t\t\t\t\tvalue={ record }\n\t\t\t\t\t\t\tonChange={ this.onFormatChange }\n\t\t\t\t\t\t\tonFocus={ () => {} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ ! disableSuggestions && (\n\t\t\t\t\t\t\t<BlockFormatControls>\n\t\t\t\t\t\t\t\t<ToolbarButtonWithOptions\n\t\t\t\t\t\t\t\t\toptions={ this.suggestionOptions() }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</BlockFormatControls>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</View>\n\t\t);\n\t}\n}\n\nRichText.defaultProps = {\n\tformat: 'string',\n\tvalue: '',\n\ttagName: 'div',\n};\n\nconst withFormatTypes = ( WrappedComponent ) => ( props ) => {\n\tconst {\n\t\tclientId,\n\t\tidentifier,\n\t\twithoutInteractiveFormatting,\n\t\tallowedFormats,\n\t} = props;\n\tconst { formatTypes } = useFormatTypes( {\n\t\tclientId,\n\t\tidentifier,\n\t\twithoutInteractiveFormatting,\n\t\tallowedFormats,\n\t} );\n\n\treturn <WrappedComponent { ...props } formatTypes={ formatTypes } />;\n};\n\nexport default compose( [\n\twithSelect( ( select, { clientId } ) => {\n\t\tconst { getBlockParents, getBlock, getSettings } =\n\t\t\tselect( 'core/block-editor' );\n\t\tconst parents = getBlockParents( clientId, true );\n\t\tconst parentBlock = parents ? getBlock( parents[ 0 ] ) : undefined;\n\t\tconst parentBlockStyles = parentBlock?.attributes?.childrenStyles;\n\n\t\tconst settings = getSettings();\n\t\tconst baseGlobalStyles = settings?.__experimentalGlobalStylesBaseStyles;\n\n\t\tconst colorPalettes = settings?.__experimentalFeatures?.color?.palette;\n\t\tconst colorPalette = colorPalettes\n\t\t\t? flatColorPalettes( colorPalettes )\n\t\t\t: settings?.colors;\n\n\t\treturn {\n\t\t\tareMentionsSupported: settings?.capabilities?.mentions === true,\n\t\t\tareXPostsSupported: settings?.capabilities?.xposts === true,\n\t\t\tparentBlockStyles,\n\t\t\tbaseGlobalStyles,\n\t\t\tcolorPalette,\n\t\t};\n\t} ),\n\twithPreferredColorScheme,\n\twithFormatTypes,\n] )( RichText );\n"],"mappings":"AAAA;;AAEA;AACA;AACA;AACA,SAASA,IAAI,EAAEC,QAAQ,EAAEC,UAAU,QAAQ,cAAc;AACzD,OAAOC,MAAM,MAAM,QAAQ;AAC3B,SAASC,MAAM,QAAQ,QAAQ;;AAE/B;AACA;AACA;AACA,OAAOC,YAAY,MAAM,+BAA+B;AACxD,SACCC,mBAAmB,EACnBC,oBAAoB,QACd,gCAAgC;AACvC,SAASC,mBAAmB,QAAQ,yBAAyB;AAC7D,SAASC,gBAAgB,QAAQ,uBAAuB;AACxD,SAASC,SAAS,QAAQ,oBAAoB;AAC9C,SACCC,OAAO,EACPC,QAAQ,EACRC,wBAAwB,QAClB,oB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gBAAgB;IAChB+D;EACD,CAAC;AACF,CAAE,CAAC,EACHvG,wBAAwB,EACxBmV,eAAe,CACd,CAAC,CAAE7R,QAAS,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["View","Platform","Dimensions","memize","colord","RCTAztecView","showUserSuggestions","showXpostSuggestions","BlockFormatControls","getPxFromCssUnit","Component","compose","debounce","withPreferredColorScheme","withSelect","childrenBlock","decodeEntities","BACKSPACE","DELETE","ENTER","isURL","atSymbol","plus","__","applyFormat","getActiveFormat","getActiveFormats","insert","getTextContent","isEmpty","create","toHTMLString","isCollapsed","remove","useFormatTypes","FormatEdit","getFormatColors","styles","ToolbarButtonWithOptions","Fragment","_Fragment","jsx","_jsx","jsxs","_jsxs","flatColorPalettes","colorsPalettes","theme","custom","default","getSelectionColor","currentSelectionColor","defaultSelectionColor","baseGlobalStyles","isBlockBasedTheme","selectionColor","colordTextColor","colordBackgroundColor","color","background","isColordTextReadable","isReadable","text","gutenbergFormatNamesToAztec","EMPTY_PARAGRAPH_TAGS","DEFAULT_FONT_SIZE","MIN_LINE_HEIGHT","RichText","constructor","value","selectionStart","selectionEnd","arguments","isIOS","OS","createRecord","bind","onChangeFromAztec","onKeyDown","handleEnter","handleDelete","onPaste","onFocus","onBlur","onTextUpdate","onContentSizeChange","onFormatChange","formatToValue","maxSize","debounceCreateUndoLevel","onCreateUndoLevel","onSelectionChange","onSelectionChangeFromAztec","valueToFormat","getHtmlToRender","handleSuggestionFunc","handleUserSuggestion","handleXpostSuggestion","suggestionOptions","insertString","manipulateEventCounterToForceNativeToRefresh","shouldDropEventFromAztec","state","activeFormats","selectedFormat","height","currentFontSize","getFontSize","needsSelectionUpdate","savedContent","isTouched","lastAztecEventType","lastHistoryValue","getRecord","start","end","colorPalette","props","currentValue","formats","replacements","newFormats","preserveWhiteSpace","html","range","Math","min","length","removeRootTagsProducedByAztec","getActiveFormatNames","record","formatTypes","map","name","filter","undefined","Boolean","changeHandlers","Object","fromEntries","entries","key","startsWith","values","forEach","changeHandler","onChange","setState","string","toInsert","__unstableOnCreateUndoLevel","toString","result","removeRootTag","tagName","tagsToEliminate","element","removeTag","tag","openingTagRegexp","RegExp","closingTagRegexp","replace","event","contentWithoutRootTag","nativeEvent","lastEventCount","eventCount","comesFromAztec","firedAfterTextChanged","refresh","contentSize","defaultPrevented","customEditableOnKeyDown","preventDefault","KeyCodes","keyCode","handleTriggerKeyCodes","onEnter","shiftKey","isReverse","onDelete","hasActiveFormats","newValue","triggeredOption","find","option","triggeredKeyCode","triggerChar","charCodeAt","useTrigger","charAt","onClick","areMentionsSupported","areXPostsSupported","allOptions","supported","title","label","icon","op","suggestionFunction","prefix","then","suggestion","catch","pastedText","pastedHtml","files","currentRecord","trimmedText","trim","linkedRecord","type","attributes","href","window","console","log","plainText","unstableOnFocus","hasChanged","isManual","logText","shouldDrop","shouldFocusTextInputAfterMerge","prevProps","__unstableIsSelected","isSelected","blockIsSelected","__unstableMobileNoFocusOnMount","prevIsSelected","prevBlockIsSelected","noSelectionValues","textInputWasNotFocused","realStart","realEnd","max","Array","isArray","toHTML","format","shouldComponentUpdate","nextProps","nextState","reversed","fontSize","style","lineHeight","componentDidMount","_editor","focus","componentDidUpdate","_this$value$toString$","lastCharacterPosition","blur","currentFontSizeStyle","getParsedFontSize","prevFontSizeStyle","isDifferentTag","componentWillUnmount","clearCurrentSelectionOnUnmount","isFocused","extraAttributes","getEditableProps","className","_getPxFromCssUnit","width","get","cssUnitOptions","selectedPxValue","parseFloat","tagNameFontSize","elements","typography","newFontSize","getLineHeight","tagNameLineHeight","newLineHeight","getIsBlockBasedTheme","isNaN","getBlockUseDefaultFont","tagsToMatch","test","getLinkTextColor","defaultColor","customColor","linkColor","isValid","toHex","getPlaceholderTextColor","_ref","_ref2","getStylesFromColorScheme","placeholderTextColor","placeholderStyle","richTextPlaceholder","richTextPlaceholderDark","defaultPlaceholderTextColor","placeholderOpacity","inheritPlaceholderColor","placeholderColor","globalStylesPlaceholderColor","render","children","minWidth","maxWidth","parentBlockStyles","accessibilityLabel","disableEditingMenu","disableSuggestions","containerWidth","editableProps","blockUseDefaultFont","textDecorationColor","defaultTextDecorationColor","fontFamily","defaultFontFamily","richText","richTextDark","linkTextColor","currentSelectionStart","currentSelectionEnd","selection","brBeforeParaMatches","match","warn","count","newSelectionStart","newSelectionEnd","containerStyles","padding","backgroundColor","EditableView","editableTagName","ref","nativeEditorRef","minHeight","placeholder","deleteEnter","triggerKeyCodes","blockType","maxImagesWidth","fontWeight","fontStyle","isMultiline","textAlign","id","disableAutocorrection","forwardedRef","options","defaultProps","withFormatTypes","WrappedComponent","clientId","identifier","withoutInteractiveFormatting","allowedFormats","select","getBlockParents","getBlock","getSettings","parents","parentBlock","childrenStyles","settings","__experimentalGlobalStylesBaseStyles","colorPalettes","__experimentalFeatures","palette","colors","capabilities","mentions","xposts"],"sources":["@wordpress/block-editor/src/components/rich-text/native/index.native.js"],"sourcesContent":["/* eslint no-console: [\"error\", { allow: [\"warn\"] }] */\n\n/**\n * External dependencies\n */\nimport { View, Platform, Dimensions } from 'react-native';\nimport memize from 'memize';\nimport { colord } from 'colord';\n\n/**\n * WordPress dependencies\n */\nimport RCTAztecView from '@wordpress/react-native-aztec';\nimport {\n\tshowUserSuggestions,\n\tshowXpostSuggestions,\n} from '@wordpress/react-native-bridge';\nimport { BlockFormatControls } from '@wordpress/block-editor';\nimport { getPxFromCssUnit } from '@wordpress/components';\nimport { Component } from '@wordpress/element';\nimport {\n\tcompose,\n\tdebounce,\n\twithPreferredColorScheme,\n} from '@wordpress/compose';\nimport { withSelect } from '@wordpress/data';\nimport { childrenBlock } from '@wordpress/blocks';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { BACKSPACE, DELETE, ENTER } from '@wordpress/keycodes';\nimport { isURL } from '@wordpress/url';\nimport { atSymbol, plus } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tapplyFormat,\n\tgetActiveFormat,\n\tgetActiveFormats,\n\tinsert,\n\tgetTextContent,\n\tisEmpty,\n\tcreate,\n\ttoHTMLString,\n\tisCollapsed,\n\tremove,\n} from '@wordpress/rich-text';\n\n/**\n * Internal dependencies\n */\nimport { useFormatTypes } from './use-format-types';\nimport FormatEdit from './format-edit';\nimport { getFormatColors } from './get-format-colors';\nimport styles from './style.scss';\nimport ToolbarButtonWithOptions from './toolbar-button-with-options';\n\n// The flattened color palettes array is memoized to ensure that the same array instance is\n// returned for the colors palettes. This value might be used as a prop, so having the same\n// instance will prevent unnecessary re-renders of the RichText component.\nconst flatColorPalettes = memize( ( colorsPalettes ) => [\n\t...( colorsPalettes?.theme || [] ),\n\t...( colorsPalettes?.custom || [] ),\n\t...( colorsPalettes?.default || [] ),\n] );\n\nconst getSelectionColor = memize(\n\t(\n\t\tcurrentSelectionColor,\n\t\tdefaultSelectionColor,\n\t\tbaseGlobalStyles,\n\t\tisBlockBasedTheme\n\t) => {\n\t\tlet selectionColor = defaultSelectionColor;\n\t\tif ( currentSelectionColor ) {\n\t\t\tselectionColor = currentSelectionColor;\n\t\t}\n\n\t\tif ( isBlockBasedTheme ) {\n\t\t\tconst colordTextColor = colord( selectionColor );\n\t\t\tconst colordBackgroundColor = colord(\n\t\t\t\tbaseGlobalStyles?.color?.background\n\t\t\t);\n\t\t\tconst isColordTextReadable = colordTextColor.isReadable(\n\t\t\t\tcolordBackgroundColor\n\t\t\t);\n\t\t\tif ( ! isColordTextReadable ) {\n\t\t\t\tselectionColor = baseGlobalStyles?.color?.text;\n\t\t\t}\n\t\t}\n\n\t\treturn selectionColor;\n\t}\n);\n\nconst gutenbergFormatNamesToAztec = {\n\t'core/bold': 'bold',\n\t'core/italic': 'italic',\n\t'core/strikethrough': 'strikethrough',\n\t'core/text-color': 'mark',\n};\n\nconst EMPTY_PARAGRAPH_TAGS = '<p></p>';\nconst DEFAULT_FONT_SIZE = 16;\nconst MIN_LINE_HEIGHT = 1;\n\nexport class RichText extends Component {\n\tconstructor( { value, selectionStart, selectionEnd } ) {\n\t\tsuper( ...arguments );\n\n\t\tthis.isIOS = Platform.OS === 'ios';\n\t\tthis.createRecord = this.createRecord.bind( this );\n\t\tthis.onChangeFromAztec = this.onChangeFromAztec.bind( this );\n\t\tthis.onKeyDown = this.onKeyDown.bind( this );\n\t\tthis.handleEnter = this.handleEnter.bind( this );\n\t\tthis.handleDelete = this.handleDelete.bind( this );\n\t\tthis.onPaste = this.onPaste.bind( this );\n\t\tthis.onFocus = this.onFocus.bind( this );\n\t\tthis.onBlur = this.onBlur.bind( this );\n\t\tthis.onTextUpdate = this.onTextUpdate.bind( this );\n\t\tthis.onContentSizeChange = this.onContentSizeChange.bind( this );\n\t\tthis.onFormatChange = this.onFormatChange.bind( this );\n\t\tthis.formatToValue = memize( this.formatToValue.bind( this ), {\n\t\t\tmaxSize: 1,\n\t\t} );\n\t\tthis.debounceCreateUndoLevel = debounce( this.onCreateUndoLevel, 1000 );\n\t\t// This prevents a bug in Aztec which triggers onSelectionChange twice on format change.\n\t\tthis.onSelectionChange = this.onSelectionChange.bind( this );\n\t\tthis.onSelectionChangeFromAztec =\n\t\t\tthis.onSelectionChangeFromAztec.bind( this );\n\t\tthis.valueToFormat = this.valueToFormat.bind( this );\n\t\tthis.getHtmlToRender = this.getHtmlToRender.bind( this );\n\t\tthis.handleSuggestionFunc = this.handleSuggestionFunc.bind( this );\n\t\tthis.handleUserSuggestion = this.handleSuggestionFunc(\n\t\t\tshowUserSuggestions,\n\t\t\t'@'\n\t\t).bind( this );\n\t\tthis.handleXpostSuggestion = this.handleSuggestionFunc(\n\t\t\tshowXpostSuggestions,\n\t\t\t'+'\n\t\t).bind( this );\n\t\tthis.suggestionOptions = this.suggestionOptions.bind( this );\n\t\tthis.insertString = this.insertString.bind( this );\n\t\tthis.manipulateEventCounterToForceNativeToRefresh =\n\t\t\tthis.manipulateEventCounterToForceNativeToRefresh.bind( this );\n\t\tthis.shouldDropEventFromAztec =\n\t\t\tthis.shouldDropEventFromAztec.bind( this );\n\t\tthis.state = {\n\t\t\tactiveFormats: [],\n\t\t\tselectedFormat: null,\n\t\t\theight: 0,\n\t\t\tcurrentFontSize: this.getFontSize( arguments[ 0 ] ),\n\t\t};\n\t\tthis.needsSelectionUpdate = false;\n\t\tthis.savedContent = '';\n\t\tthis.isTouched = false;\n\t\tthis.lastAztecEventType = null;\n\n\t\tthis.lastHistoryValue = value;\n\n\t\t// Internal values that are update synchronously, unlike props.\n\t\tthis.value = value;\n\t\tthis.selectionStart = selectionStart;\n\t\tthis.selectionEnd = selectionEnd;\n\t}\n\n\t/**\n\t * Get the current record (value and selection) from props and state.\n\t *\n\t * @return {Object} The current record (value and selection).\n\t */\n\tgetRecord() {\n\t\tconst {\n\t\t\tselectionStart: start,\n\t\t\tselectionEnd: end,\n\t\t\tcolorPalette,\n\t\t} = this.props;\n\t\tconst { value } = this.props;\n\t\tconst currentValue = this.formatToValue( value );\n\n\t\tconst { formats, replacements, text } = currentValue;\n\t\tconst { activeFormats } = this.state;\n\t\tconst newFormats = getFormatColors( formats, colorPalette );\n\n\t\treturn {\n\t\t\tformats: newFormats,\n\t\t\treplacements,\n\t\t\ttext,\n\t\t\tstart,\n\t\t\tend,\n\t\t\tactiveFormats,\n\t\t};\n\t}\n\n\t/**\n\t * Creates a RichText value \"record\" from the current content and selection\n\t * information\n\t *\n\t *\n\t * @return {Object} A RichText value with formats and selection.\n\t */\n\tcreateRecord() {\n\t\tconst { preserveWhiteSpace } = this.props;\n\t\tconst value = {\n\t\t\tstart: this.selectionStart,\n\t\t\tend: this.selectionEnd,\n\t\t\t...create( {\n\t\t\t\thtml: this.value,\n\t\t\t\trange: null,\n\t\t\t\tpreserveWhiteSpace,\n\t\t\t} ),\n\t\t};\n\t\tconst start = Math.min( this.selectionStart, value.text.length );\n\t\tconst end = Math.min( this.selectionEnd, value.text.length );\n\t\treturn { ...value, start, end };\n\t}\n\n\tvalueToFormat( value ) {\n\t\t// Remove the outer root tags.\n\t\treturn this.removeRootTagsProducedByAztec( toHTMLString( { value } ) );\n\t}\n\n\tgetActiveFormatNames( record ) {\n\t\tconst { formatTypes } = this.props;\n\n\t\treturn formatTypes\n\t\t\t.map( ( { name } ) => name )\n\t\t\t.filter( ( name ) => {\n\t\t\t\treturn getActiveFormat( record, name ) !== undefined;\n\t\t\t} )\n\t\t\t.map( ( name ) => gutenbergFormatNamesToAztec[ name ] )\n\t\t\t.filter( Boolean );\n\t}\n\n\tonFormatChange( record ) {\n\t\tconst { start = 0, end = 0, activeFormats = [] } = record;\n\t\tconst changeHandlers = Object.fromEntries(\n\t\t\tObject.entries( this.props ).filter( ( [ key ] ) =>\n\t\t\t\tkey.startsWith( 'format_on_change_functions_' )\n\t\t\t)\n\t\t);\n\n\t\tObject.values( changeHandlers ).forEach( ( changeHandler ) => {\n\t\t\tchangeHandler( record.formats, record.text );\n\t\t} );\n\n\t\tthis.value = this.valueToFormat( record );\n\t\tthis.props.onChange( this.value );\n\t\tthis.setState( { activeFormats } );\n\t\tthis.props.onSelectionChange( start, end );\n\t\tthis.selectionStart = start;\n\t\tthis.selectionEnd = end;\n\n\t\tthis.onCreateUndoLevel();\n\n\t\tthis.lastAztecEventType = 'format change';\n\t}\n\n\tinsertString( record, string ) {\n\t\tif ( record && string ) {\n\t\t\tthis.manipulateEventCounterToForceNativeToRefresh(); // force a refresh on the native side\n\t\t\tconst toInsert = insert( record, string );\n\t\t\tthis.onFormatChange( toInsert );\n\t\t}\n\t}\n\n\tonCreateUndoLevel() {\n\t\tconst { __unstableOnCreateUndoLevel: onCreateUndoLevel } = this.props;\n\t\t// If the content is the same, no level needs to be created.\n\t\tif ( this.lastHistoryValue?.toString() === this.value?.toString() ) {\n\t\t\treturn;\n\t\t}\n\n\t\tonCreateUndoLevel();\n\t\tthis.lastHistoryValue = this.value;\n\t}\n\n\t/*\n\t * Cleans up any root tags produced by aztec.\n\t * TODO: This should be removed on a later version when aztec doesn't return the top tag of the text being edited\n\t */\n\tremoveRootTagsProducedByAztec( html ) {\n\t\tlet result = this.removeRootTag( this.props.tagName, html );\n\n\t\tif ( this.props.tagsToEliminate ) {\n\t\t\tthis.props.tagsToEliminate.forEach( ( element ) => {\n\t\t\t\tresult = this.removeTag( element, result );\n\t\t\t} );\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tremoveRootTag( tag, html ) {\n\t\tconst openingTagRegexp = RegExp( '^<' + tag + '[^>]*>', 'gim' );\n\t\tconst closingTagRegexp = RegExp( '</' + tag + '>$', 'gim' );\n\n\t\treturn html\n\t\t\t.replace( openingTagRegexp, '' )\n\t\t\t.replace( closingTagRegexp, '' );\n\t}\n\n\tremoveTag( tag, html ) {\n\t\tconst openingTagRegexp = RegExp( '<' + tag + '>', 'gim' );\n\t\tconst closingTagRegexp = RegExp( '</' + tag + '>', 'gim' );\n\t\treturn html\n\t\t\t.replace( openingTagRegexp, '' )\n\t\t\t.replace( closingTagRegexp, '' );\n\t}\n\n\t/*\n\t * Handles any case where the content of the AztecRN instance has changed\n\t */\n\tonChangeFromAztec( event ) {\n\t\tif ( this.shouldDropEventFromAztec( event, 'onChange' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst contentWithoutRootTag = this.removeRootTagsProducedByAztec(\n\t\t\tevent.nativeEvent.text\n\t\t);\n\t\t// On iOS, onChange can be triggered after selection changes, even though there are no content changes.\n\t\tif ( contentWithoutRootTag === this.value?.toString() ) {\n\t\t\treturn;\n\t\t}\n\t\tthis.lastEventCount = event.nativeEvent.eventCount;\n\t\tthis.comesFromAztec = true;\n\t\tthis.firedAfterTextChanged = true; // The onChange event always fires after the fact.\n\t\tthis.onTextUpdate( event );\n\t\tthis.lastAztecEventType = 'input';\n\t}\n\n\tonTextUpdate( event ) {\n\t\tconst contentWithoutRootTag = this.removeRootTagsProducedByAztec(\n\t\t\tevent.nativeEvent.text\n\t\t);\n\n\t\tthis.debounceCreateUndoLevel();\n\t\tconst refresh = this.value?.toString() !== contentWithoutRootTag;\n\t\tthis.value = contentWithoutRootTag;\n\n\t\t// We don't want to refresh if our goal is just to create a record.\n\t\tif ( refresh ) {\n\t\t\tthis.props.onChange( contentWithoutRootTag );\n\t\t}\n\t}\n\n\t/*\n\t * Handles any case where the content of the AztecRN instance has changed in size\n\t */\n\tonContentSizeChange( contentSize ) {\n\t\tthis.setState( contentSize );\n\t\tthis.lastAztecEventType = 'content size change';\n\t}\n\n\tonKeyDown( event ) {\n\t\tif ( event.defaultPrevented ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Add stubs for conformance in downstream autocompleters logic.\n\t\tthis.customEditableOnKeyDown?.( {\n\t\t\tpreventDefault: () => undefined,\n\t\t\t...event,\n\t\t\tkey: RCTAztecView.KeyCodes[ event?.keyCode ],\n\t\t} );\n\n\t\tthis.handleDelete( event );\n\t\tthis.handleEnter( event );\n\t\tthis.handleTriggerKeyCodes( event );\n\t}\n\n\thandleEnter( event ) {\n\t\tif ( event.keyCode !== ENTER ) {\n\t\t\treturn;\n\t\t}\n\t\tconst { onEnter } = this.props;\n\n\t\tif ( ! onEnter ) {\n\t\t\treturn;\n\t\t}\n\n\t\tonEnter( {\n\t\t\tvalue: this.createRecord(),\n\t\t\tonChange: this.onFormatChange,\n\t\t\tshiftKey: event.shiftKey,\n\t\t} );\n\t\tthis.lastAztecEventType = 'input';\n\t}\n\n\thandleDelete( event ) {\n\t\tif ( this.shouldDropEventFromAztec( event, 'handleDelete' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { keyCode } = event;\n\n\t\tif ( keyCode !== DELETE && keyCode !== BACKSPACE ) {\n\t\t\treturn;\n\t\t}\n\t\tconst isReverse = keyCode === BACKSPACE;\n\n\t\tconst { onDelete } = this.props;\n\t\tthis.lastEventCount = event.nativeEvent.eventCount;\n\t\tthis.comesFromAztec = true;\n\t\tthis.firedAfterTextChanged = event.nativeEvent.firedAfterTextChanged;\n\t\tconst value = this.createRecord();\n\t\tconst { start, end, text, activeFormats } = value;\n\t\tconst hasActiveFormats = activeFormats && !! activeFormats.length;\n\t\tlet newValue;\n\n\t\t// Always handle full content deletion ourselves.\n\t\tif ( start === 0 && end !== 0 && end >= text.length ) {\n\t\t\tnewValue = remove( value );\n\t\t\tthis.onFormatChange( newValue );\n\t\t\tevent.preventDefault();\n\t\t\treturn;\n\t\t}\n\n\t\t// Only process delete if the key press occurs at an uncollapsed edge.\n\t\tif (\n\t\t\t! isCollapsed( value ) ||\n\t\t\thasActiveFormats ||\n\t\t\t( isReverse && start !== 0 ) ||\n\t\t\t( ! isReverse && end !== text.length )\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( onDelete ) {\n\t\t\tonDelete( { isReverse, value } );\n\t\t}\n\n\t\tevent.preventDefault();\n\t\tthis.lastAztecEventType = 'input';\n\t}\n\n\thandleTriggerKeyCodes( event ) {\n\t\tconst { keyCode } = event;\n\t\tconst triggeredOption = this.suggestionOptions().find( ( option ) => {\n\t\t\tconst triggeredKeyCode = option.triggerChar.charCodeAt( 0 );\n\t\t\treturn triggeredKeyCode === keyCode;\n\t\t} );\n\n\t\tif ( triggeredOption ) {\n\t\t\tconst record = this.getRecord();\n\t\t\tconst text = getTextContent( record );\n\t\t\t// Only respond to the trigger if the selection is on the start of text or line\n\t\t\t// or if the character before is a space.\n\t\t\tconst useTrigger =\n\t\t\t\ttext.length === 0 ||\n\t\t\t\trecord.start === 0 ||\n\t\t\t\ttext.charAt( record.start - 1 ) === '\\n' ||\n\t\t\t\ttext.charAt( record.start - 1 ) === ' ';\n\n\t\t\tif ( useTrigger && triggeredOption.onClick ) {\n\t\t\t\ttriggeredOption.onClick();\n\t\t\t} else {\n\t\t\t\tthis.insertString( record, triggeredOption.triggerChar );\n\t\t\t}\n\t\t}\n\t}\n\n\tsuggestionOptions() {\n\t\tconst { areMentionsSupported, areXPostsSupported } = this.props;\n\t\tconst allOptions = [\n\t\t\t{\n\t\t\t\tsupported: areMentionsSupported,\n\t\t\t\ttitle: __( 'Insert mention' ),\n\t\t\t\tonClick: this.handleUserSuggestion,\n\t\t\t\ttriggerChar: '@',\n\t\t\t\tvalue: 'mention',\n\t\t\t\tlabel: __( 'Mention' ),\n\t\t\t\ticon: atSymbol,\n\t\t\t},\n\t\t\t{\n\t\t\t\tsupported: areXPostsSupported,\n\t\t\t\ttitle: __( 'Insert crosspost' ),\n\t\t\t\tonClick: this.handleXpostSuggestion,\n\t\t\t\ttriggerChar: '+',\n\t\t\t\tvalue: 'crosspost',\n\t\t\t\tlabel: __( 'Crosspost' ),\n\t\t\t\ticon: plus,\n\t\t\t},\n\t\t];\n\t\treturn allOptions.filter( ( op ) => op.supported );\n\t}\n\n\thandleSuggestionFunc( suggestionFunction, prefix ) {\n\t\treturn () => {\n\t\t\tconst record = this.getRecord();\n\t\t\tsuggestionFunction()\n\t\t\t\t.then( ( suggestion ) => {\n\t\t\t\t\tthis.insertString( record, `${ prefix }${ suggestion } ` );\n\t\t\t\t} )\n\t\t\t\t.catch( () => {} );\n\t\t};\n\t}\n\n\t/**\n\t * Handles a paste event from the native Aztec Wrapper.\n\t *\n\t * @param {Object} event The paste event which wraps `nativeEvent`.\n\t */\n\tonPaste( event ) {\n\t\tconst { onPaste, onChange } = this.props;\n\t\tconst { activeFormats = [] } = this.state;\n\n\t\tconst { pastedText, pastedHtml, files } = event.nativeEvent;\n\t\tconst currentRecord = this.createRecord();\n\n\t\tevent.preventDefault();\n\n\t\t// There is a selection, check if a URL is pasted.\n\t\tif ( ! isCollapsed( currentRecord ) ) {\n\t\t\tconst trimmedText = ( pastedHtml || pastedText )\n\t\t\t\t.replace( /<[^>]+>/g, '' )\n\t\t\t\t.trim();\n\n\t\t\t// A URL was pasted, turn the selection into a link.\n\t\t\tif ( isURL( trimmedText ) ) {\n\t\t\t\tconst linkedRecord = applyFormat( currentRecord, {\n\t\t\t\t\ttype: 'a',\n\t\t\t\t\tattributes: {\n\t\t\t\t\t\thref: decodeEntities( trimmedText ),\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t\tthis.value = this.valueToFormat( linkedRecord );\n\t\t\t\tonChange( this.value );\n\n\t\t\t\t// Allows us to ask for this information when we get a report.\n\t\t\t\twindow.console.log( 'Created link:\\n\\n', trimmedText );\n\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tif ( onPaste ) {\n\t\t\tonPaste( {\n\t\t\t\tvalue: currentRecord,\n\t\t\t\tonChange: this.onFormatChange,\n\t\t\t\thtml: pastedHtml,\n\t\t\t\tplainText: pastedText,\n\t\t\t\tfiles,\n\t\t\t\tactiveFormats,\n\t\t\t} );\n\t\t}\n\t}\n\n\tonFocus() {\n\t\tthis.isTouched = true;\n\n\t\tconst { unstableOnFocus, onSelectionChange } = this.props;\n\n\t\tif ( unstableOnFocus ) {\n\t\t\tunstableOnFocus();\n\t\t}\n\n\t\t// We know for certain that on focus, the old selection is invalid. It\n\t\t// will be recalculated on `selectionchange`.\n\n\t\tonSelectionChange( this.selectionStart, this.selectionEnd );\n\n\t\tthis.lastAztecEventType = 'focus';\n\t}\n\n\tonBlur( event ) {\n\t\tthis.isTouched = false;\n\n\t\t// Check if value is up to date with latest state of native AztecView.\n\t\tif (\n\t\t\tevent.nativeEvent.text &&\n\t\t\tevent.nativeEvent.text !== this.props.value?.toString()\n\t\t) {\n\t\t\tthis.onTextUpdate( event );\n\t\t}\n\n\t\tif ( this.props.onBlur ) {\n\t\t\tthis.props.onBlur( event );\n\t\t}\n\n\t\tthis.lastAztecEventType = 'blur';\n\t}\n\n\tonSelectionChange( start, end ) {\n\t\tconst hasChanged =\n\t\t\tthis.selectionStart !== start || this.selectionEnd !== end;\n\n\t\tthis.selectionStart = start;\n\t\tthis.selectionEnd = end;\n\n\t\t// This is a manual selection change event if onChange was not triggered just before\n\t\t// and we did not just trigger a text update\n\t\t// `onChange` could be the last event and could have been triggered a long time ago so\n\t\t// this approach is not perfectly reliable.\n\t\tconst isManual =\n\t\t\tthis.lastAztecEventType !== 'input' &&\n\t\t\tthis.props.value?.toString() === this.value?.toString();\n\t\tif ( hasChanged && isManual ) {\n\t\t\tconst value = this.createRecord();\n\t\t\tconst activeFormats = getActiveFormats( value );\n\t\t\tthis.setState( { activeFormats } );\n\t\t}\n\n\t\tthis.props.onSelectionChange( start, end );\n\t}\n\n\tshouldDropEventFromAztec( event, logText ) {\n\t\tconst shouldDrop =\n\t\t\t! this.isIOS && event.nativeEvent.eventCount <= this.lastEventCount;\n\t\tif ( shouldDrop ) {\n\t\t\twindow.console.log(\n\t\t\t\t`Dropping ${ logText } from Aztec as its event counter is older than latest sent to the native side. Got ${ event.nativeEvent.eventCount } but lastEventCount is ${ this.lastEventCount }.`\n\t\t\t);\n\t\t}\n\t\treturn shouldDrop;\n\t}\n\n\t/**\n\t * Determines whether the text input should receive focus after an update.\n\t * For cases where a RichText with a value is merged with an empty one.\n\t *\n\t * @param {Object} prevProps - The previous props of the component.\n\t * @return {boolean} True if the text input should receive focus, false otherwise.\n\t */\n\tshouldFocusTextInputAfterMerge( prevProps ) {\n\t\tconst {\n\t\t\t__unstableIsSelected: isSelected,\n\t\t\tblockIsSelected,\n\t\t\tselectionStart,\n\t\t\tselectionEnd,\n\t\t\t__unstableMobileNoFocusOnMount,\n\t\t} = this.props;\n\n\t\tconst {\n\t\t\t__unstableIsSelected: prevIsSelected,\n\t\t\tblockIsSelected: prevBlockIsSelected,\n\t\t} = prevProps;\n\n\t\tconst noSelectionValues =\n\t\t\tselectionStart === undefined && selectionEnd === undefined;\n\t\tconst textInputWasNotFocused = ! prevIsSelected && ! isSelected;\n\n\t\treturn (\n\t\t\t! __unstableMobileNoFocusOnMount &&\n\t\t\tnoSelectionValues &&\n\t\t\ttextInputWasNotFocused &&\n\t\t\t! prevBlockIsSelected &&\n\t\t\tblockIsSelected\n\t\t);\n\t}\n\n\tonSelectionChangeFromAztec( start, end, text, event ) {\n\t\tif ( this.shouldDropEventFromAztec( event, 'onSelectionChange' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// `end` can be less than `start` on iOS\n\t\t// Let's fix that here so `rich-text/slice` can work properly.\n\t\tconst realStart = Math.min( start, end );\n\t\tconst realEnd = Math.max( start, end );\n\n\t\t// Check and dicsard stray event, where the text and selection is equal to the ones already cached.\n\t\tconst contentWithoutRootTag = this.removeRootTagsProducedByAztec(\n\t\t\tevent.nativeEvent.text\n\t\t);\n\t\tif (\n\t\t\tcontentWithoutRootTag === this.value?.toString() &&\n\t\t\trealStart === this.selectionStart &&\n\t\t\trealEnd === this.selectionEnd\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.comesFromAztec = true;\n\t\tthis.firedAfterTextChanged = true; // Selection change event always fires after the fact.\n\n\t\t// Update text before updating selection\n\t\t// Make sure there are changes made to the content before upgrading it upward.\n\t\tthis.onTextUpdate( event );\n\n\t\t// Aztec can send us selection change events after it has lost focus.\n\t\t// For instance the autocorrect feature will complete a partially written\n\t\t// word when resigning focus, causing a selection change event.\n\t\t// Forwarding this selection change could cause this RichText to regain\n\t\t// focus and start a focus loop.\n\t\t//\n\t\t// See https://github.com/wordpress-mobile/gutenberg-mobile/issues/1696\n\t\tif ( this.props.__unstableIsSelected ) {\n\t\t\tthis.onSelectionChange( realStart, realEnd );\n\t\t}\n\t\t// Update lastEventCount to prevent Aztec from re-rendering the content it just sent.\n\t\tthis.lastEventCount = event.nativeEvent.eventCount;\n\n\t\tthis.lastAztecEventType = 'selection change';\n\t}\n\n\tisEmpty() {\n\t\treturn isEmpty( this.formatToValue( this.props.value ) );\n\t}\n\n\tformatToValue( value ) {\n\t\tconst { preserveWhiteSpace } = this.props;\n\t\t// Handle deprecated `children` and `node` sources.\n\t\tif ( Array.isArray( value ) ) {\n\t\t\treturn create( {\n\t\t\t\thtml: childrenBlock.toHTML( value ),\n\t\t\t\tpreserveWhiteSpace,\n\t\t\t} );\n\t\t}\n\n\t\tif ( this.props.format === 'string' ) {\n\t\t\treturn create( {\n\t\t\t\thtml: value,\n\t\t\t\tpreserveWhiteSpace,\n\t\t\t} );\n\t\t}\n\n\t\t// Guard for blocks passing `null` in onSplit callbacks. May be removed\n\t\t// if onSplit is revised to not pass a `null` value.\n\t\tif ( value === null ) {\n\t\t\treturn create();\n\t\t}\n\n\t\treturn value;\n\t}\n\n\tmanipulateEventCounterToForceNativeToRefresh() {\n\t\tif ( this.isIOS ) {\n\t\t\tthis.lastEventCount = undefined;\n\t\t\treturn;\n\t\t}\n\n\t\tif ( typeof this.lastEventCount !== 'undefined' ) {\n\t\t\tthis.lastEventCount += 100; // bump by a hundred, hopefully native hasn't bombarded the JS side in the meantime.\n\t\t} // no need to bump when 'undefined' as native side won't receive the key when the value is undefined, and that will cause force updating anyway,\n\t\t// see https://github.com/WordPress/gutenberg/blob/82e578dcc75e67891c750a41a04c1e31994192fc/packages/react-native-aztec/android/src/main/java/org/wordpress/mobile/ReactNativeAztec/ReactAztecManager.java#L213-L215\n\t}\n\n\tshouldComponentUpdate( nextProps, nextState ) {\n\t\tif (\n\t\t\tnextProps.tagName !== this.props.tagName ||\n\t\t\tnextProps.reversed !== this.props.reversed ||\n\t\t\tnextProps.start !== this.props.start\n\t\t) {\n\t\t\tthis.manipulateEventCounterToForceNativeToRefresh(); // force a refresh on the native side\n\t\t\tthis.value = undefined;\n\t\t\treturn true;\n\t\t}\n\n\t\t// TODO: Please re-introduce the check to avoid updating the content right after an `onChange` call.\n\t\t// It was removed in https://github.com/WordPress/gutenberg/pull/12417 to fix undo/redo problem.\n\n\t\t// If the component is changed React side (undo/redo/merging/splitting/custom text actions)\n\t\t// we need to make sure the native is updated as well.\n\n\t\t// Also, don't trust the \"this.lastContent\" as on Android, incomplete text events arrive\n\t\t// with only some of the text, while the virtual keyboard's suggestion system does its magic.\n\t\t// ** compare with this.lastContent for optimizing performance by not forcing Aztec with text it already has\n\t\t// , but compare with props.value to not lose \"half word\" text because of Android virtual keyb autosuggestion behavior\n\t\tif (\n\t\t\ttypeof nextProps.value !== 'undefined' &&\n\t\t\ttypeof this.props.value !== 'undefined' &&\n\t\t\t( ! this.comesFromAztec || ! this.firedAfterTextChanged ) &&\n\t\t\tnextProps.value?.toString() !== this.props.value?.toString()\n\t\t) {\n\t\t\t// Gutenberg seems to try to mirror the caret state even on events that only change the content so,\n\t\t\t// let's force caret update if state has selection set.\n\t\t\tif (\n\t\t\t\ttypeof nextProps.selectionStart !== 'undefined' &&\n\t\t\t\ttypeof nextProps.selectionEnd !== 'undefined'\n\t\t\t) {\n\t\t\t\tthis.needsSelectionUpdate = true;\n\t\t\t}\n\n\t\t\tthis.manipulateEventCounterToForceNativeToRefresh(); // force a refresh on the native side\n\t\t}\n\n\t\tif ( ! this.comesFromAztec ) {\n\t\t\tif (\n\t\t\t\ttypeof nextProps.selectionStart !== 'undefined' &&\n\t\t\t\ttypeof nextProps.selectionEnd !== 'undefined' &&\n\t\t\t\tnextProps.selectionStart !== this.props.selectionStart &&\n\t\t\t\tnextProps.selectionStart !== this.selectionStart &&\n\t\t\t\tnextProps.__unstableIsSelected\n\t\t\t) {\n\t\t\t\tthis.needsSelectionUpdate = true;\n\t\t\t\tthis.manipulateEventCounterToForceNativeToRefresh(); // force a refresh on the native side\n\t\t\t}\n\n\t\t\t// For font size changes from a prop value a force refresh\n\t\t\t// is needed without the selection update.\n\t\t\tif ( nextProps?.fontSize !== this.props?.fontSize ) {\n\t\t\t\tthis.manipulateEventCounterToForceNativeToRefresh(); // force a refresh on the native side\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\t( nextProps?.style?.fontSize !== this.props?.style?.fontSize &&\n\t\t\t\t\tnextState.currentFontSize !==\n\t\t\t\t\t\tthis.state.currentFontSize ) ||\n\t\t\t\tnextState.currentFontSize !== this.state.currentFontSize ||\n\t\t\t\tnextProps?.style?.lineHeight !== this.props?.style?.lineHeight\n\t\t\t) {\n\t\t\t\tthis.needsSelectionUpdate = true;\n\t\t\t\tthis.manipulateEventCounterToForceNativeToRefresh(); // force a refresh on the native side\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tcomponentDidMount() {\n\t\t// Request focus if wrapping block is selected and parent hasn't inhibited the focus request. This method of focusing\n\t\t// is trying to implement the web-side counterpart of BlockList's `focusTabbable` where the BlockList is focusing an\n\t\t// inputbox by searching the DOM. We don't have the DOM in RN so, using the combination of blockIsSelected and __unstableMobileNoFocusOnMount\n\t\t// to determine if we should focus the RichText.\n\t\tif (\n\t\t\tthis.props.blockIsSelected &&\n\t\t\t! this.props.__unstableMobileNoFocusOnMount\n\t\t) {\n\t\t\tthis._editor.focus();\n\t\t\tthis.onSelectionChange(\n\t\t\t\tthis.props.selectionStart || 0,\n\t\t\t\tthis.props.selectionEnd || 0\n\t\t\t);\n\t\t}\n\t}\n\n\tcomponentDidUpdate( prevProps ) {\n\t\tconst { style, tagName } = this.props;\n\t\tconst { currentFontSize } = this.state;\n\n\t\tif ( this.props.value?.toString() !== this.value?.toString() ) {\n\t\t\tthis.value = this.props.value;\n\t\t}\n\t\tconst { __unstableIsSelected: prevIsSelected } = prevProps;\n\t\tconst { __unstableIsSelected: isSelected } = this.props;\n\n\t\tif ( isSelected && ! prevIsSelected ) {\n\t\t\tthis._editor.focus();\n\t\t\t// Update selection props explicitly when component is selected as Aztec won't call onSelectionChange\n\t\t\t// if its internal value hasn't change. When created, default value is 0, 0.\n\t\t\tthis.onSelectionChange(\n\t\t\t\tthis.props.selectionStart || 0,\n\t\t\t\tthis.props.selectionEnd || 0\n\t\t\t);\n\t\t} else if ( this.shouldFocusTextInputAfterMerge( prevProps ) ) {\n\t\t\t// Since this is happening when merging blocks, the selection should be at the last character position.\n\t\t\t// As a fallback the internal selectionEnd value is used.\n\t\t\tconst lastCharacterPosition =\n\t\t\t\tthis.value?.toString().length ?? this.selectionEnd;\n\t\t\tthis._editor.focus();\n\t\t\tthis.props.onSelectionChange(\n\t\t\t\tlastCharacterPosition,\n\t\t\t\tlastCharacterPosition\n\t\t\t);\n\t\t} else if ( ! isSelected && prevIsSelected ) {\n\t\t\tthis._editor.blur();\n\t\t}\n\n\t\t// For font size values changes from the font size picker\n\t\t// we compare previous values to refresh the selected font size,\n\t\t// this is also used when the tag name changes\n\t\t// e.g Heading block and a level change like h1->h2.\n\t\tconst currentFontSizeStyle = this.getParsedFontSize( style?.fontSize );\n\t\tconst prevFontSizeStyle = this.getParsedFontSize(\n\t\t\tprevProps?.style?.fontSize\n\t\t);\n\t\tconst isDifferentTag = prevProps.tagName !== tagName;\n\t\tif (\n\t\t\t( currentFontSize &&\n\t\t\t\t( currentFontSizeStyle || prevFontSizeStyle ) &&\n\t\t\t\tcurrentFontSizeStyle !== currentFontSize ) ||\n\t\t\tisDifferentTag\n\t\t) {\n\t\t\tthis.setState( {\n\t\t\t\tcurrentFontSize: this.getFontSize( this.props ),\n\t\t\t} );\n\t\t}\n\t}\n\n\tcomponentWillUnmount() {\n\t\tconst { clearCurrentSelectionOnUnmount } = this.props;\n\n\t\t// There are cases when the component is unmounted e.g. scrolling in a\n\t\t// long post due to virtualization, so the block selection needs to be cleared\n\t\t// so it doesn't auto-focus when it's added back.\n\t\tif ( this._editor?.isFocused() ) {\n\t\t\tclearCurrentSelectionOnUnmount?.();\n\t\t}\n\t}\n\n\tgetHtmlToRender( record, tagName ) {\n\t\t// Save back to HTML from React tree.\n\t\tlet value = this.valueToFormat( record );\n\n\t\tif ( value === undefined ) {\n\t\t\tthis.manipulateEventCounterToForceNativeToRefresh(); // force a refresh on the native side\n\t\t\tvalue = '';\n\t\t}\n\t\t// On android if content is empty we need to send no content or else the placeholder will not show.\n\t\tif (\n\t\t\t! this.isIOS &&\n\t\t\t( value?.toString() === '' ||\n\t\t\t\tvalue?.toString() === EMPTY_PARAGRAPH_TAGS )\n\t\t) {\n\t\t\treturn '';\n\t\t}\n\n\t\tif ( tagName ) {\n\t\t\tlet extraAttributes = ``;\n\t\t\tif ( tagName === `ol` ) {\n\t\t\t\tif ( this.props.reversed ) {\n\t\t\t\t\textraAttributes += ` reversed`;\n\t\t\t\t}\n\t\t\t\tif ( this.props.start ) {\n\t\t\t\t\textraAttributes += ` start=${ this.props.start }`;\n\t\t\t\t}\n\t\t\t}\n\t\t\tvalue = `<${ tagName }${ extraAttributes }>${ value }</${ tagName }>`;\n\t\t}\n\t\treturn value;\n\t}\n\n\tgetEditableProps() {\n\t\treturn {\n\t\t\t// Overridable props.\n\t\t\tstyle: {},\n\t\t\tclassName: 'rich-text',\n\t\t\tonKeyDown: () => null,\n\t\t};\n\t}\n\n\tgetParsedFontSize( fontSize ) {\n\t\tconst { height, width } = Dimensions.get( 'window' );\n\t\tconst cssUnitOptions = { height, width, fontSize: DEFAULT_FONT_SIZE };\n\n\t\tif ( ! fontSize ) {\n\t\t\treturn fontSize;\n\t\t}\n\n\t\tconst selectedPxValue =\n\t\t\tgetPxFromCssUnit( fontSize, cssUnitOptions ) ?? DEFAULT_FONT_SIZE;\n\n\t\treturn parseFloat( selectedPxValue );\n\t}\n\n\tgetFontSize( props ) {\n\t\tconst { baseGlobalStyles, tagName, fontSize, style } = props;\n\t\tconst tagNameFontSize =\n\t\t\tbaseGlobalStyles?.elements?.[ tagName ]?.typography?.fontSize;\n\n\t\tlet newFontSize = DEFAULT_FONT_SIZE;\n\n\t\t// Disables line-height rendering for pre elements until we fix some issues with AztecAndroid.\n\t\tif ( tagName === 'pre' && ! this.isIOS ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// For block-based themes, get the default editor font size.\n\t\tif ( baseGlobalStyles?.typography?.fontSize && tagName === 'p' ) {\n\t\t\tnewFontSize = baseGlobalStyles?.typography?.fontSize;\n\t\t}\n\n\t\t// For block-based themes, get the default element font size\n\t\t// e.g h1, h2.\n\t\tif ( tagNameFontSize ) {\n\t\t\tnewFontSize = tagNameFontSize;\n\t\t}\n\n\t\t// For font size values provided from the styles,\n\t\t// usually from values set from the font size picker.\n\t\tif ( style?.fontSize ) {\n\t\t\tnewFontSize = style.fontSize;\n\t\t}\n\n\t\t// Fall-back to a font size provided from its props (if there's any)\n\t\t// and there are no other default values to use.\n\t\tif ( fontSize && ! tagNameFontSize && ! style?.fontSize ) {\n\t\t\tnewFontSize = fontSize;\n\t\t}\n\n\t\t// We need to always convert to px units because the selected value\n\t\t// could be coming from the web where it could be stored as a different unit.\n\t\tconst selectedPxValue = this.getParsedFontSize( newFontSize );\n\n\t\treturn selectedPxValue;\n\t}\n\n\tgetLineHeight() {\n\t\tconst { baseGlobalStyles, tagName, lineHeight, style } = this.props;\n\t\tconst tagNameLineHeight =\n\t\t\tbaseGlobalStyles?.elements?.[ tagName ]?.typography?.lineHeight;\n\t\tlet newLineHeight;\n\n\t\t// Disables line-height rendering for pre elements until we fix some issues with AztecAndroid.\n\t\tif ( tagName === 'pre' && ! this.isIOS ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif ( ! this.getIsBlockBasedTheme() ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// For block-based themes, get the default editor line height.\n\t\tif ( baseGlobalStyles?.typography?.lineHeight && tagName === 'p' ) {\n\t\t\tnewLineHeight = parseFloat(\n\t\t\t\tbaseGlobalStyles?.typography?.lineHeight\n\t\t\t);\n\t\t}\n\n\t\t// For block-based themes, get the default element line height\n\t\t// e.g h1, h2.\n\t\tif ( tagNameLineHeight ) {\n\t\t\tnewLineHeight = parseFloat( tagNameLineHeight );\n\t\t}\n\n\t\t// For line height values provided from the styles,\n\t\t// usually from values set from the line height picker.\n\t\tif ( style?.lineHeight ) {\n\t\t\tnewLineHeight = parseFloat( style.lineHeight );\n\t\t}\n\n\t\t// Fall-back to a line height provided from its props (if there's any)\n\t\t// and there are no other default values to use.\n\t\tif ( lineHeight && ! tagNameLineHeight && ! style?.lineHeight ) {\n\t\t\tnewLineHeight = lineHeight;\n\t\t}\n\n\t\t// Check the final value is not over the minimum supported value.\n\t\tif ( newLineHeight && newLineHeight < MIN_LINE_HEIGHT ) {\n\t\t\tnewLineHeight = MIN_LINE_HEIGHT;\n\t\t}\n\n\t\t// Until we parse CSS values correctly, avoid passing NaN values to Aztec\n\t\tif ( isNaN( newLineHeight ) ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn newLineHeight;\n\t}\n\n\tgetIsBlockBasedTheme() {\n\t\tconst { baseGlobalStyles } = this.props;\n\n\t\treturn (\n\t\t\tbaseGlobalStyles && Object.entries( baseGlobalStyles ).length !== 0\n\t\t);\n\t}\n\n\tgetBlockUseDefaultFont() {\n\t\t// For block-based themes it enables using the defaultFont\n\t\t// in Aztec for iOS so it allows customizing the font size\n\t\t// for the Preformatted/Code and Heading blocks.\n\t\tif ( ! this.isIOS ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { tagName } = this.props;\n\t\tconst isBlockBasedTheme = this.getIsBlockBasedTheme();\n\t\tconst tagsToMatch = /pre|h([1-6])$/gm;\n\n\t\treturn isBlockBasedTheme && tagsToMatch.test( tagName );\n\t}\n\n\tgetLinkTextColor( defaultColor ) {\n\t\tconst { style } = this.props;\n\t\tconst customColor = style?.linkColor && colord( style.linkColor );\n\n\t\treturn customColor && customColor.isValid()\n\t\t\t? customColor.toHex()\n\t\t\t: defaultColor;\n\t}\n\n\tgetPlaceholderTextColor() {\n\t\tconst {\n\t\t\tbaseGlobalStyles,\n\t\t\tgetStylesFromColorScheme,\n\t\t\tplaceholderTextColor,\n\t\t\tstyle,\n\t\t} = this.props;\n\n\t\t// Default placeholder text color.\n\t\tconst placeholderStyle = getStylesFromColorScheme(\n\t\t\tstyles.richTextPlaceholder,\n\t\t\tstyles.richTextPlaceholderDark\n\t\t);\n\t\tconst { color: defaultPlaceholderTextColor } = placeholderStyle;\n\t\t// Custom 63% opacity for theme and inherited colors.\n\t\tconst placeholderOpacity = 'A1';\n\n\t\t// Determine inherited placeholder color if available.\n\t\tconst inheritPlaceholderColor = style?.placeholderColor\n\t\t\t? `${ style.placeholderColor }${ placeholderOpacity }`\n\t\t\t: undefined;\n\n\t\t// If using block-based themes, derive the placeholder color from global styles.\n\t\tconst globalStylesPlaceholderColor = baseGlobalStyles?.color?.text\n\t\t\t? `${ baseGlobalStyles.color.text }${ placeholderOpacity }`\n\t\t\t: undefined;\n\n\t\treturn (\n\t\t\tinheritPlaceholderColor ??\n\t\t\tplaceholderTextColor ??\n\t\t\tglobalStylesPlaceholderColor ??\n\t\t\tdefaultPlaceholderTextColor\n\t\t);\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\ttagName,\n\t\t\tstyle,\n\t\t\t__unstableIsSelected: isSelected,\n\t\t\tchildren,\n\t\t\tgetStylesFromColorScheme,\n\t\t\tminWidth,\n\t\t\tmaxWidth,\n\t\t\tformatTypes,\n\t\t\tparentBlockStyles,\n\t\t\taccessibilityLabel,\n\t\t\tdisableEditingMenu = false,\n\t\t\tbaseGlobalStyles,\n\t\t\tselectionStart,\n\t\t\tselectionEnd,\n\t\t\tdisableSuggestions,\n\t\t\tcontainerWidth,\n\t\t} = this.props;\n\t\tconst { currentFontSize } = this.state;\n\n\t\tconst record = this.getRecord();\n\t\tconst html = this.getHtmlToRender( record, tagName );\n\t\tconst editableProps = this.getEditableProps();\n\t\tconst blockUseDefaultFont = this.getBlockUseDefaultFont();\n\n\t\tconst fontSize = currentFontSize;\n\t\tconst lineHeight = this.getLineHeight();\n\n\t\tconst {\n\t\t\tcolor: defaultColor,\n\t\t\ttextDecorationColor: defaultTextDecorationColor,\n\t\t\tfontFamily: defaultFontFamily,\n\t\t} = getStylesFromColorScheme( styles.richText, styles.richTextDark );\n\t\tconst linkTextColor = this.getLinkTextColor(\n\t\t\tdefaultTextDecorationColor\n\t\t);\n\n\t\tconst currentSelectionStart = selectionStart ?? 0;\n\t\tconst currentSelectionEnd = selectionEnd ?? 0;\n\t\tlet selection = null;\n\t\tif ( this.needsSelectionUpdate ) {\n\t\t\tthis.needsSelectionUpdate = false;\n\t\t\tselection = {\n\t\t\t\tstart: currentSelectionStart,\n\t\t\t\tend: currentSelectionEnd,\n\t\t\t};\n\n\t\t\t// On AztecAndroid, setting the caret to an out-of-bounds position will crash the editor so, let's check for some cases.\n\t\t\tif ( ! this.isIOS ) {\n\t\t\t\t// The following regular expression is used in Aztec here:\n\t\t\t\t// https://github.com/wordpress-mobile/AztecEditor-Android/blob/b1fad439d56fa6d4aa0b78526fef355c59d00dd3/aztec/src/main/kotlin/org/wordpress/aztec/AztecParser.kt#L656\n\t\t\t\tconst brBeforeParaMatches = html.match( /(<br>)+<\\/p>$/g );\n\t\t\t\tif ( brBeforeParaMatches ) {\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t'Oops, BR tag(s) at the end of content. Aztec will remove them, adapting the selection...'\n\t\t\t\t\t);\n\t\t\t\t\tconst count = (\n\t\t\t\t\t\tbrBeforeParaMatches[ 0 ].match( /br/g ) || []\n\t\t\t\t\t).length;\n\t\t\t\t\tif ( count > 0 ) {\n\t\t\t\t\t\tlet newSelectionStart = currentSelectionStart - count;\n\t\t\t\t\t\tif ( newSelectionStart < 0 ) {\n\t\t\t\t\t\t\tnewSelectionStart = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlet newSelectionEnd = currentSelectionEnd - count;\n\t\t\t\t\t\tif ( newSelectionEnd < 0 ) {\n\t\t\t\t\t\t\tnewSelectionEnd = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tselection = {\n\t\t\t\t\t\t\tstart: newSelectionStart,\n\t\t\t\t\t\t\tend: newSelectionEnd,\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\n\t\tif ( this.comesFromAztec ) {\n\t\t\tthis.comesFromAztec = false;\n\t\t\tthis.firedAfterTextChanged = false;\n\t\t}\n\n\t\t// Logic below assures that `RichText` width will always have equal value when container is almost fully filled.\n\t\tconst width =\n\t\t\tmaxWidth && this.state.width && maxWidth - this.state.width < 10\n\t\t\t\t? maxWidth\n\t\t\t\t: this.state.width;\n\t\tconst containerStyles = [\n\t\t\tstyle?.padding &&\n\t\t\t\tstyle?.backgroundColor && {\n\t\t\t\t\tpadding: style.padding,\n\t\t\t\t\tbackgroundColor: style.backgroundColor,\n\t\t\t\t},\n\t\t\tcontainerWidth && {\n\t\t\t\twidth: containerWidth,\n\t\t\t},\n\t\t];\n\n\t\tconst defaultSelectionColor = getStylesFromColorScheme(\n\t\t\tstyles[ 'rich-text-selection' ],\n\t\t\tstyles[ 'rich-text-selection--dark' ]\n\t\t).color;\n\t\tconst selectionColor = getSelectionColor(\n\t\t\tthis.props.selectionColor,\n\t\t\tdefaultSelectionColor,\n\t\t\tbaseGlobalStyles,\n\t\t\tthis.getIsBlockBasedTheme()\n\t\t);\n\n\t\tconst EditableView = ( props ) => {\n\t\t\tthis.customEditableOnKeyDown = props?.onKeyDown;\n\n\t\t\treturn <></>;\n\t\t};\n\n\t\treturn (\n\t\t\t<View style={ containerStyles }>\n\t\t\t\t{ children &&\n\t\t\t\t\tchildren( {\n\t\t\t\t\t\tisSelected,\n\t\t\t\t\t\tvalue: record,\n\t\t\t\t\t\tonChange: this.onFormatChange,\n\t\t\t\t\t\tonFocus: () => {},\n\t\t\t\t\t\teditableProps,\n\t\t\t\t\t\teditableTagName: EditableView,\n\t\t\t\t\t} ) }\n\t\t\t\t<RCTAztecView\n\t\t\t\t\taccessibilityLabel={ accessibilityLabel }\n\t\t\t\t\tref={ ( ref ) => {\n\t\t\t\t\t\tthis._editor = ref;\n\n\t\t\t\t\t\tif ( this.props.nativeEditorRef ) {\n\t\t\t\t\t\t\tthis.props.nativeEditorRef( ref );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\tbackgroundColor: styles.richText.backgroundColor,\n\t\t\t\t\t\t...style,\n\t\t\t\t\t\t...( this.isIOS && minWidth && maxWidth\n\t\t\t\t\t\t\t? { width }\n\t\t\t\t\t\t\t: { maxWidth } ),\n\t\t\t\t\t\tminHeight: this.state.height,\n\t\t\t\t\t} }\n\t\t\t\t\tblockUseDefaultFont={ blockUseDefaultFont }\n\t\t\t\t\ttext={ {\n\t\t\t\t\t\ttext: html,\n\t\t\t\t\t\teventCount: this.lastEventCount,\n\t\t\t\t\t\tselection,\n\t\t\t\t\t\tlinkTextColor,\n\t\t\t\t\t\ttag: tagName,\n\t\t\t\t\t} }\n\t\t\t\t\tplaceholder={ this.props.placeholder }\n\t\t\t\t\tplaceholderTextColor={ this.getPlaceholderTextColor() }\n\t\t\t\t\tdeleteEnter={ this.props.deleteEnter }\n\t\t\t\t\tonChange={ this.onChangeFromAztec }\n\t\t\t\t\tonFocus={ this.onFocus }\n\t\t\t\t\tonBlur={ this.onBlur }\n\t\t\t\t\tonKeyDown={ this.onKeyDown }\n\t\t\t\t\ttriggerKeyCodes={\n\t\t\t\t\t\tdisableEditingMenu\n\t\t\t\t\t\t\t? []\n\t\t\t\t\t\t\t: this.suggestionOptions().map(\n\t\t\t\t\t\t\t\t\t( op ) => op.triggerChar\n\t\t\t\t\t\t\t )\n\t\t\t\t\t}\n\t\t\t\t\tonPaste={ this.onPaste }\n\t\t\t\t\tactiveFormats={ this.getActiveFormatNames( record ) }\n\t\t\t\t\tonContentSizeChange={ this.onContentSizeChange }\n\t\t\t\t\tonSelectionChange={ this.onSelectionChangeFromAztec }\n\t\t\t\t\tblockType={ { tag: tagName } }\n\t\t\t\t\tcolor={\n\t\t\t\t\t\t( style && style.color ) ||\n\t\t\t\t\t\t( parentBlockStyles && parentBlockStyles.color ) ||\n\t\t\t\t\t\t( baseGlobalStyles && baseGlobalStyles?.color?.text ) ||\n\t\t\t\t\t\tdefaultColor\n\t\t\t\t\t}\n\t\t\t\t\tmaxImagesWidth={ 200 }\n\t\t\t\t\tfontFamily={ this.props.fontFamily || defaultFontFamily }\n\t\t\t\t\tfontSize={ fontSize }\n\t\t\t\t\tlineHeight={ lineHeight }\n\t\t\t\t\tfontWeight={ this.props.fontWeight }\n\t\t\t\t\tfontStyle={ this.props.fontStyle }\n\t\t\t\t\tdisableEditingMenu={ disableEditingMenu }\n\t\t\t\t\tisMultiline={ false }\n\t\t\t\t\ttextAlign={ this.props.textAlign }\n\t\t\t\t\t{ ...( this.isIOS ? { maxWidth } : {} ) }\n\t\t\t\t\tminWidth={ minWidth }\n\t\t\t\t\tid={ this.props.id }\n\t\t\t\t\tselectionColor={ selectionColor }\n\t\t\t\t\tdisableAutocorrection={ this.props.disableAutocorrection }\n\t\t\t\t/>\n\t\t\t\t{ isSelected && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<FormatEdit\n\t\t\t\t\t\t\tforwardedRef={ this._editor }\n\t\t\t\t\t\t\tformatTypes={ formatTypes }\n\t\t\t\t\t\t\tvalue={ record }\n\t\t\t\t\t\t\tonChange={ this.onFormatChange }\n\t\t\t\t\t\t\tonFocus={ () => {} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ ! disableSuggestions && (\n\t\t\t\t\t\t\t<BlockFormatControls>\n\t\t\t\t\t\t\t\t<ToolbarButtonWithOptions\n\t\t\t\t\t\t\t\t\toptions={ this.suggestionOptions() }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</BlockFormatControls>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</View>\n\t\t);\n\t}\n}\n\nRichText.defaultProps = {\n\tformat: 'string',\n\tvalue: '',\n\ttagName: 'div',\n};\n\nconst withFormatTypes = ( WrappedComponent ) => ( props ) => {\n\tconst {\n\t\tclientId,\n\t\tidentifier,\n\t\twithoutInteractiveFormatting,\n\t\tallowedFormats,\n\t} = props;\n\tconst { formatTypes } = useFormatTypes( {\n\t\tclientId,\n\t\tidentifier,\n\t\twithoutInteractiveFormatting,\n\t\tallowedFormats,\n\t} );\n\n\treturn <WrappedComponent { ...props } formatTypes={ formatTypes } />;\n};\n\nexport default compose( [\n\twithSelect( ( select, { clientId } ) => {\n\t\tconst { getBlockParents, getBlock, getSettings } =\n\t\t\tselect( 'core/block-editor' );\n\t\tconst parents = getBlockParents( clientId, true );\n\t\tconst parentBlock = parents ? getBlock( parents[ 0 ] ) : undefined;\n\t\tconst parentBlockStyles = parentBlock?.attributes?.childrenStyles;\n\n\t\tconst settings = getSettings();\n\t\tconst baseGlobalStyles = settings?.__experimentalGlobalStylesBaseStyles;\n\n\t\tconst colorPalettes = settings?.__experimentalFeatures?.color?.palette;\n\t\tconst colorPalette = colorPalettes\n\t\t\t? flatColorPalettes( colorPalettes )\n\t\t\t: settings?.colors;\n\n\t\treturn {\n\t\t\tareMentionsSupported: settings?.capabilities?.mentions === true,\n\t\t\tareXPostsSupported: settings?.capabilities?.xposts === true,\n\t\t\tparentBlockStyles,\n\t\t\tbaseGlobalStyles,\n\t\t\tcolorPalette,\n\t\t};\n\t} ),\n\twithPreferredColorScheme,\n\twithFormatTypes,\n] )( RichText );\n"],"mappings":"AAAA;;AAEA;AACA;AACA;AACA,SAASA,IAAI,EAAEC,QAAQ,EAAEC,UAAU,QAAQ,cAAc;AACzD,OAAOC,MAAM,MAAM,QAAQ;AAC3B,SAASC,MAAM,QAAQ,QAAQ;;AAE/B;AACA;AACA;AACA,OAAOC,YAAY,MAAM,+BAA+B;AACxD,SACCC,mBAAmB,EACnBC,oBAAoB,QACd,gCAAgC;AACvC,SAASC,mBAAmB,QAAQ,yBAAyB;AAC7D,SAASC,gBAAgB,QAAQ,uBAAuB;AACxD,SAASC,SAAS,QAAQ,oBAAoB;AAC9C,SACCC,OAAO,EACPC,QAAQ,EACRC,wBAAwB,QAClB,oBAAoB;AAC3B,SAASC,UAAU,QAAQ,iBAAiB;AAC5C,SAASC,aAAa,QAAQ,mBAAmB;AACjD,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,SAAS,EAAEC,MAAM,EAAEC,KAAK,QAAQ,qBAAqB;AAC9D,SAASC,KAAK,QAAQ,gBAAgB;AACtC,SAASC,QAAQ,EAAEC,IAAI,QAAQ,kBAAkB;AACjD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,WAAW,EACXC,eAAe,EACfC,gBAAgB,EAChBC,MAAM,EACNC,cAAc,EACdC,OAAO,EACPC,MAAM,EACNC,YAAY,EACZC,WAAW,EACXC,MAAM,QACA,sBAAsB;;AAE7B;AACA;AACA;AACA,SAASC,cAAc,QAAQ,oBAAoB;AACnD,O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,eAAe;IAAEC,QAAQ;IAAEC;EAAY,CAAC,GAC/CH,MAAM,CAAE,mBAAoB,CAAC;EAC9B,MAAMI,OAAO,GAAGH,eAAe,CAAEL,QAAQ,EAAE,IAAK,CAAC;EACjD,MAAMS,WAAW,GAAGD,OAAO,GAAGF,QAAQ,CAAEE,OAAO,CAAE,CAAC,CAAG,CAAC,GAAGnO,SAAS;EAClE,MAAM4K,iBAAiB,GAAGwD,WAAW,EAAErJ,UAAU,EAAEsJ,cAAc;EAEjE,MAAMC,QAAQ,GAAGJ,WAAW,CAAC,CAAC;EAC9B,MAAMpT,gBAAgB,GAAGwT,QAAQ,EAAEC,oCAAoC;EAEvE,MAAMC,aAAa,GAAGF,QAAQ,EAAEG,sBAAsB,EAAEtT,KAAK,EAAEuT,OAAO;EACtE,MAAM7P,YAAY,GAAG2P,aAAa,GAC/BlU,iBAAiB,CAAEkU,aAAc,CAAC,GAClCF,QAAQ,EAAEK,MAAM;EAEnB,OAAO;IACNjL,oBAAoB,EAAE4K,QAAQ,EAAEM,YAAY,EAAEC,QAAQ,KAAK,IAAI;IAC/DlL,kBAAkB,EAAE2K,QAAQ,EAAEM,YAAY,EAAEE,MAAM,KAAK,IAAI;IAC3DlE,iBAAiB;IACjB9P,gBAAgB;IAChB+D;EACD,CAAC;AACF,CAAE,CAAC,EACHvG,wBAAwB,EACxBmV,eAAe,CACd,CAAC,CAAE7R,QAAS,CAAC","ignoreList":[]}
|
|
@@ -23,22 +23,19 @@ export default function useSpacingSizes() {
|
|
|
23
23
|
name: __('None'),
|
|
24
24
|
slug: '0',
|
|
25
25
|
size: 0
|
|
26
|
-
}, ...customSizes, ...themeSizes, ...defaultSizes]
|
|
26
|
+
}, ...customSizes, ...themeSizes, ...defaultSizes];
|
|
27
|
+
|
|
28
|
+
// Using numeric slugs opts-in to sorting by slug.
|
|
29
|
+
if (sizes.every(({
|
|
30
|
+
slug
|
|
31
|
+
}) => /^[0-9]/.test(slug))) {
|
|
32
|
+
sizes.sort((a, b) => compare(a.slug, b.slug));
|
|
33
|
+
}
|
|
27
34
|
return sizes.length > RANGE_CONTROL_MAX_SIZE ? [{
|
|
28
35
|
name: __('Default'),
|
|
29
36
|
slug: 'default',
|
|
30
37
|
size: undefined
|
|
31
|
-
}, ...sizes] :
|
|
32
|
-
// See https://github.com/WordPress/gutenberg/pull/44247 for reasoning
|
|
33
|
-
// to use the index as the name in the range control.
|
|
34
|
-
sizes.map(({
|
|
35
|
-
slug,
|
|
36
|
-
size
|
|
37
|
-
}, i) => ({
|
|
38
|
-
name: i,
|
|
39
|
-
slug,
|
|
40
|
-
size
|
|
41
|
-
}));
|
|
38
|
+
}, ...sizes] : sizes;
|
|
42
39
|
}, [customSizes, themeSizes, defaultSizes]);
|
|
43
40
|
}
|
|
44
41
|
//# sourceMappingURL=use-spacing-sizes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useMemo","__","useSettings","RANGE_CONTROL_MAX_SIZE","EMPTY_ARRAY","compare","Intl","Collator","numeric","useSpacingSizes","customSpacingSizes","themeSpacingSizes","defaultSpacingSizes","defaultSpacingSizesEnabled","customSizes","themeSizes","defaultSizes","sizes","name","slug","size","
|
|
1
|
+
{"version":3,"names":["useMemo","__","useSettings","RANGE_CONTROL_MAX_SIZE","EMPTY_ARRAY","compare","Intl","Collator","numeric","useSpacingSizes","customSpacingSizes","themeSpacingSizes","defaultSpacingSizes","defaultSpacingSizesEnabled","customSizes","themeSizes","defaultSizes","sizes","name","slug","size","every","test","sort","a","b","length","undefined"],"sources":["@wordpress/block-editor/src/components/spacing-sizes-control/hooks/use-spacing-sizes.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useSettings } from '../../use-settings';\nimport { RANGE_CONTROL_MAX_SIZE } from '../utils';\n\nconst EMPTY_ARRAY = [];\n\nconst compare = new Intl.Collator( 'und', { numeric: true } ).compare;\n\nexport default function useSpacingSizes() {\n\tconst [\n\t\tcustomSpacingSizes,\n\t\tthemeSpacingSizes,\n\t\tdefaultSpacingSizes,\n\t\tdefaultSpacingSizesEnabled,\n\t] = useSettings(\n\t\t'spacing.spacingSizes.custom',\n\t\t'spacing.spacingSizes.theme',\n\t\t'spacing.spacingSizes.default',\n\t\t'spacing.defaultSpacingSizes'\n\t);\n\n\tconst customSizes = customSpacingSizes ?? EMPTY_ARRAY;\n\n\tconst themeSizes = themeSpacingSizes ?? EMPTY_ARRAY;\n\n\tconst defaultSizes =\n\t\tdefaultSpacingSizes && defaultSpacingSizesEnabled !== false\n\t\t\t? defaultSpacingSizes\n\t\t\t: EMPTY_ARRAY;\n\n\treturn useMemo( () => {\n\t\tconst sizes = [\n\t\t\t{ name: __( 'None' ), slug: '0', size: 0 },\n\t\t\t...customSizes,\n\t\t\t...themeSizes,\n\t\t\t...defaultSizes,\n\t\t];\n\n\t\t// Using numeric slugs opts-in to sorting by slug.\n\t\tif ( sizes.every( ( { slug } ) => /^[0-9]/.test( slug ) ) ) {\n\t\t\tsizes.sort( ( a, b ) => compare( a.slug, b.slug ) );\n\t\t}\n\n\t\treturn sizes.length > RANGE_CONTROL_MAX_SIZE\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: __( 'Default' ),\n\t\t\t\t\t\tslug: 'default',\n\t\t\t\t\t\tsize: undefined,\n\t\t\t\t\t},\n\t\t\t\t\t...sizes,\n\t\t\t ]\n\t\t\t: sizes;\n\t}, [ customSizes, themeSizes, defaultSizes ] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,SAASC,WAAW,QAAQ,oBAAoB;AAChD,SAASC,sBAAsB,QAAQ,UAAU;AAEjD,MAAMC,WAAW,GAAG,EAAE;AAEtB,MAAMC,OAAO,GAAG,IAAIC,IAAI,CAACC,QAAQ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AEH,WAAW,EAAEC,UAAU,EAAEC,YAAY,CAAG,CAAC;AAC/C","ignoreList":[]}
|
|
@@ -49,7 +49,7 @@ export const useTransformCommands = () => {
|
|
|
49
49
|
blocks: selectedBlocks,
|
|
50
50
|
clientIds: selectedBlockClientIds,
|
|
51
51
|
possibleBlockTransformations: getBlockTransformItems(selectedBlocks, rootClientId),
|
|
52
|
-
canRemove: canRemoveBlocks(selectedBlockClientIds
|
|
52
|
+
canRemove: canRemoveBlocks(selectedBlockClientIds),
|
|
53
53
|
invalidSelection: false
|
|
54
54
|
};
|
|
55
55
|
}, []);
|
|
@@ -140,7 +140,7 @@ const useActionsCommands = () => {
|
|
|
140
140
|
};
|
|
141
141
|
}
|
|
142
142
|
const rootClientId = getBlockRootClientId(clientIds[0]);
|
|
143
|
-
const canMove = canMoveBlocks(clientIds
|
|
143
|
+
const canMove = canMoveBlocks(clientIds) && getBlockCount(rootClientId) !== 1;
|
|
144
144
|
const commands = [];
|
|
145
145
|
if (canMove) {
|
|
146
146
|
commands.push({
|
|
@@ -238,7 +238,7 @@ const useQuickActionsCommands = () => {
|
|
|
238
238
|
const canDuplicate = blocks.every(block => {
|
|
239
239
|
return !!block && hasBlockSupport(block.name, 'multiple', true) && canInsertBlockType(block.name, rootClientId);
|
|
240
240
|
});
|
|
241
|
-
const canRemove = canRemoveBlocks(clientIds
|
|
241
|
+
const canRemove = canRemoveBlocks(clientIds);
|
|
242
242
|
const commands = [];
|
|
243
243
|
if (canDuplicate) {
|
|
244
244
|
commands.push({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","sprintf","hasBlockSupport","store","blocksStore","switchToBlockType","isTemplatePart","useSelect","useDispatch","useCommandLoader","copy","trash","remove","plus","add","group","ungroup","moveTo","move","BlockIcon","blockEditorStore","jsx","_jsx","useTransformCommands","replaceBlocks","multiSelect","blocks","clientIds","canRemove","possibleBlockTransformations","invalidSelection","select","getBlockRootClientId","getBlockTransformItems","getSelectedBlockClientIds","getBlocksByClientId","canRemoveBlocks","selectedBlockClientIds","selectedBlocks","filter","block","length","rootClientId","isLoading","commands","isTemplate","selectForMultipleBlocks","insertedBlocks","clientId","onBlockTransform","name","newBlocks","hasPossibleBlockTransformations","map","transformation","title","icon","replace","label","callback","close","useActionsCommands","canMoveBlocks","getBlockCount","setBlockMovingClientId","setNavigationMode","selectBlock","canMove","push","command","useQuickActionsCommands","isUngroupable","isGroupable","_isUngroupable","_isGroupable","canInsertBlockType","getDefaultBlockName","getGroupingBlockName","removeBlocks","duplicateBlocks","insertAfterBlock","insertBeforeBlock","onGroup","groupingBlockName","onUngroup","innerBlocks","canInsertDefaultBlock","canDuplicate","every","Array","isArray","useBlockCommands","hook","context"],"sources":["@wordpress/block-editor/src/components/use-block-commands/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\thasBlockSupport,\n\tstore as blocksStore,\n\tswitchToBlockType,\n\tisTemplatePart,\n} from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useCommandLoader } from '@wordpress/commands';\nimport {\n\tcopy,\n\ttrash as remove,\n\tplus as add,\n\tgroup,\n\tungroup,\n\tmoveTo as move,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport BlockIcon from '../block-icon';\nimport { store as blockEditorStore } from '../../store';\n\nexport const useTransformCommands = () => {\n\tconst { replaceBlocks, multiSelect } = useDispatch( blockEditorStore );\n\tconst {\n\t\tblocks,\n\t\tclientIds,\n\t\tcanRemove,\n\t\tpossibleBlockTransformations,\n\t\tinvalidSelection,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockRootClientId,\n\t\t\tgetBlockTransformItems,\n\t\t\tgetSelectedBlockClientIds,\n\t\t\tgetBlocksByClientId,\n\t\t\tcanRemoveBlocks,\n\t\t} = select( blockEditorStore );\n\n\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\t\tconst selectedBlocks = getBlocksByClientId( selectedBlockClientIds );\n\n\t\t// selectedBlocks can have `null`s when something tries to call `selectBlock` with an inexistent clientId.\n\t\t// These nulls will cause fatal errors down the line.\n\t\t// In order to prevent discrepancies between selectedBlockClientIds and selectedBlocks, we effectively treat the entire selection as invalid.\n\t\t// @see https://github.com/WordPress/gutenberg/pull/59410#issuecomment-2006304536\n\t\tif ( selectedBlocks.filter( ( block ) => ! block ).length > 0 ) {\n\t\t\treturn {\n\t\t\t\tinvalidSelection: true,\n\t\t\t};\n\t\t}\n\n\t\tconst rootClientId = getBlockRootClientId(\n\t\t\tselectedBlockClientIds[ 0 ]\n\t\t);\n\t\treturn {\n\t\t\tblocks: selectedBlocks,\n\t\t\tclientIds: selectedBlockClientIds,\n\t\t\tpossibleBlockTransformations: getBlockTransformItems(\n\t\t\t\tselectedBlocks,\n\t\t\t\trootClientId\n\t\t\t),\n\t\t\tcanRemove: canRemoveBlocks( selectedBlockClientIds, rootClientId ),\n\t\t\tinvalidSelection: false,\n\t\t};\n\t}, [] );\n\n\tif ( invalidSelection ) {\n\t\treturn {\n\t\t\tisLoading: false,\n\t\t\tcommands: [],\n\t\t};\n\t}\n\tconst isTemplate = blocks.length === 1 && isTemplatePart( blocks[ 0 ] );\n\n\tfunction selectForMultipleBlocks( insertedBlocks ) {\n\t\tif ( insertedBlocks.length > 1 ) {\n\t\t\tmultiSelect(\n\t\t\t\tinsertedBlocks[ 0 ].clientId,\n\t\t\t\tinsertedBlocks[ insertedBlocks.length - 1 ].clientId\n\t\t\t);\n\t\t}\n\t}\n\n\t// Simple block tranformation based on the `Block Transforms` API.\n\tfunction onBlockTransform( name ) {\n\t\tconst newBlocks = switchToBlockType( blocks, name );\n\t\treplaceBlocks( clientIds, newBlocks );\n\t\tselectForMultipleBlocks( newBlocks );\n\t}\n\n\t/**\n\t * The `isTemplate` check is a stopgap solution here.\n\t * Ideally, the Transforms API should handle this\n\t * by allowing to exclude blocks from wildcard transformations.\n\t */\n\tconst hasPossibleBlockTransformations =\n\t\t!! possibleBlockTransformations.length && canRemove && ! isTemplate;\n\n\tif (\n\t\t! clientIds ||\n\t\tclientIds.length < 1 ||\n\t\t! hasPossibleBlockTransformations\n\t) {\n\t\treturn { isLoading: false, commands: [] };\n\t}\n\n\tconst commands = possibleBlockTransformations.map( ( transformation ) => {\n\t\tconst { name, title, icon } = transformation;\n\t\treturn {\n\t\t\tname: 'core/block-editor/transform-to-' + name.replace( '/', '-' ),\n\t\t\t// translators: %s: block title/name.\n\t\t\tlabel: sprintf( __( 'Transform to %s' ), title ),\n\t\t\ticon: <BlockIcon icon={ icon } />,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tonBlockTransform( name );\n\t\t\t\tclose();\n\t\t\t},\n\t\t};\n\t} );\n\n\treturn { isLoading: false, commands };\n};\n\nconst useActionsCommands = () => {\n\tconst { clientIds } = useSelect( ( select ) => {\n\t\tconst { getSelectedBlockClientIds } = select( blockEditorStore );\n\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\n\t\treturn {\n\t\t\tclientIds: selectedBlockClientIds,\n\t\t};\n\t}, [] );\n\n\tconst { getBlockRootClientId, canMoveBlocks, getBlockCount } =\n\t\tuseSelect( blockEditorStore );\n\n\tconst { setBlockMovingClientId, setNavigationMode, selectBlock } =\n\t\tuseDispatch( blockEditorStore );\n\n\tif ( ! clientIds || clientIds.length < 1 ) {\n\t\treturn { isLoading: false, commands: [] };\n\t}\n\n\tconst rootClientId = getBlockRootClientId( clientIds[ 0 ] );\n\n\tconst canMove =\n\t\tcanMoveBlocks( clientIds, rootClientId ) &&\n\t\tgetBlockCount( rootClientId ) !== 1;\n\n\tconst commands = [];\n\n\tif ( canMove ) {\n\t\tcommands.push( {\n\t\t\tname: 'move-to',\n\t\t\tlabel: __( 'Move to' ),\n\t\t\tcallback: () => {\n\t\t\t\tsetNavigationMode( true );\n\t\t\t\tselectBlock( clientIds[ 0 ] );\n\t\t\t\tsetBlockMovingClientId( clientIds[ 0 ] );\n\t\t\t},\n\t\t\ticon: move,\n\t\t} );\n\t}\n\n\treturn {\n\t\tisLoading: false,\n\t\tcommands: commands.map( ( command ) => ( {\n\t\t\t...command,\n\t\t\tname: 'core/block-editor/action-' + command.name,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tcommand.callback();\n\t\t\t\tclose();\n\t\t\t},\n\t\t} ) ),\n\t};\n};\n\nconst useQuickActionsCommands = () => {\n\tconst { clientIds, isUngroupable, isGroupable } = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetSelectedBlockClientIds,\n\t\t\tisUngroupable: _isUngroupable,\n\t\t\tisGroupable: _isGroupable,\n\t\t} = select( blockEditorStore );\n\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\n\t\treturn {\n\t\t\tclientIds: selectedBlockClientIds,\n\t\t\tisUngroupable: _isUngroupable(),\n\t\t\tisGroupable: _isGroupable(),\n\t\t};\n\t}, [] );\n\tconst {\n\t\tcanInsertBlockType,\n\t\tgetBlockRootClientId,\n\t\tgetBlocksByClientId,\n\t\tcanRemoveBlocks,\n\t} = useSelect( blockEditorStore );\n\tconst { getDefaultBlockName, getGroupingBlockName } =\n\t\tuseSelect( blocksStore );\n\n\tconst blocks = getBlocksByClientId( clientIds );\n\n\tconst {\n\t\tremoveBlocks,\n\t\treplaceBlocks,\n\t\tduplicateBlocks,\n\t\tinsertAfterBlock,\n\t\tinsertBeforeBlock,\n\t} = useDispatch( blockEditorStore );\n\n\tconst onGroup = () => {\n\t\tif ( ! blocks.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst groupingBlockName = getGroupingBlockName();\n\n\t\t// Activate the `transform` on `core/group` which does the conversion.\n\t\tconst newBlocks = switchToBlockType( blocks, groupingBlockName );\n\n\t\tif ( ! newBlocks ) {\n\t\t\treturn;\n\t\t}\n\t\treplaceBlocks( clientIds, newBlocks );\n\t};\n\tconst onUngroup = () => {\n\t\tif ( ! blocks.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst innerBlocks = blocks[ 0 ].innerBlocks;\n\n\t\tif ( ! innerBlocks.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\treplaceBlocks( clientIds, innerBlocks );\n\t};\n\n\tif ( ! clientIds || clientIds.length < 1 ) {\n\t\treturn { isLoading: false, commands: [] };\n\t}\n\n\tconst rootClientId = getBlockRootClientId( clientIds[ 0 ] );\n\tconst canInsertDefaultBlock = canInsertBlockType(\n\t\tgetDefaultBlockName(),\n\t\trootClientId\n\t);\n\tconst canDuplicate = blocks.every( ( block ) => {\n\t\treturn (\n\t\t\t!! block &&\n\t\t\thasBlockSupport( block.name, 'multiple', true ) &&\n\t\t\tcanInsertBlockType( block.name, rootClientId )\n\t\t);\n\t} );\n\tconst canRemove = canRemoveBlocks( clientIds, rootClientId );\n\n\tconst commands = [];\n\n\tif ( canDuplicate ) {\n\t\tcommands.push( {\n\t\t\tname: 'duplicate',\n\t\t\tlabel: __( 'Duplicate' ),\n\t\t\tcallback: () => duplicateBlocks( clientIds, true ),\n\t\t\ticon: copy,\n\t\t} );\n\t}\n\n\tif ( canInsertDefaultBlock ) {\n\t\tcommands.push(\n\t\t\t{\n\t\t\t\tname: 'add-before',\n\t\t\t\tlabel: __( 'Add before' ),\n\t\t\t\tcallback: () => {\n\t\t\t\t\tconst clientId = Array.isArray( clientIds )\n\t\t\t\t\t\t? clientIds[ 0 ]\n\t\t\t\t\t\t: clientId;\n\t\t\t\t\tinsertBeforeBlock( clientId );\n\t\t\t\t},\n\t\t\t\ticon: add,\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'add-after',\n\t\t\t\tlabel: __( 'Add after' ),\n\t\t\t\tcallback: () => {\n\t\t\t\t\tconst clientId = Array.isArray( clientIds )\n\t\t\t\t\t\t? clientIds[ clientIds.length - 1 ]\n\t\t\t\t\t\t: clientId;\n\t\t\t\t\tinsertAfterBlock( clientId );\n\t\t\t\t},\n\t\t\t\ticon: add,\n\t\t\t}\n\t\t);\n\t}\n\n\tif ( isGroupable ) {\n\t\tcommands.push( {\n\t\t\tname: 'Group',\n\t\t\tlabel: __( 'Group' ),\n\t\t\tcallback: onGroup,\n\t\t\ticon: group,\n\t\t} );\n\t}\n\n\tif ( isUngroupable ) {\n\t\tcommands.push( {\n\t\t\tname: 'ungroup',\n\t\t\tlabel: __( 'Ungroup' ),\n\t\t\tcallback: onUngroup,\n\t\t\ticon: ungroup,\n\t\t} );\n\t}\n\n\tif ( canRemove ) {\n\t\tcommands.push( {\n\t\t\tname: 'remove',\n\t\t\tlabel: __( 'Delete' ),\n\t\t\tcallback: () => removeBlocks( clientIds, true ),\n\t\t\ticon: remove,\n\t\t} );\n\t}\n\n\treturn {\n\t\tisLoading: false,\n\t\tcommands: commands.map( ( command ) => ( {\n\t\t\t...command,\n\t\t\tname: 'core/block-editor/action-' + command.name,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tcommand.callback();\n\t\t\t\tclose();\n\t\t\t},\n\t\t} ) ),\n\t};\n};\n\nexport const useBlockCommands = () => {\n\tuseCommandLoader( {\n\t\tname: 'core/block-editor/blockTransforms',\n\t\thook: useTransformCommands,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/block-editor/blockActions',\n\t\thook: useActionsCommands,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/block-editor/blockQuickActions',\n\t\thook: useQuickActionsCommands,\n\t\tcontext: 'block-selection-edit',\n\t} );\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SACCC,eAAe,EACfC,KAAK,IAAIC,WAAW,EACpBC,iBAAiB,EACjBC,cAAc,QACR,mBAAmB;AAC1B,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,gBAAgB,QAAQ,qBAAqB;AACtD,SACCC,IAAI,EACJC,KAAK,IAAIC,MAAM,EACfC,IAAI,IAAIC,GAAG,EACXC,KAAK,EACLC,OAAO,EACPC,MAAM,IAAIC,IAAI,QACR,kBAAkB;;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E;EACV,CAAE,CAAC;AACJ,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["__","sprintf","hasBlockSupport","store","blocksStore","switchToBlockType","isTemplatePart","useSelect","useDispatch","useCommandLoader","copy","trash","remove","plus","add","group","ungroup","moveTo","move","BlockIcon","blockEditorStore","jsx","_jsx","useTransformCommands","replaceBlocks","multiSelect","blocks","clientIds","canRemove","possibleBlockTransformations","invalidSelection","select","getBlockRootClientId","getBlockTransformItems","getSelectedBlockClientIds","getBlocksByClientId","canRemoveBlocks","selectedBlockClientIds","selectedBlocks","filter","block","length","rootClientId","isLoading","commands","isTemplate","selectForMultipleBlocks","insertedBlocks","clientId","onBlockTransform","name","newBlocks","hasPossibleBlockTransformations","map","transformation","title","icon","replace","label","callback","close","useActionsCommands","canMoveBlocks","getBlockCount","setBlockMovingClientId","setNavigationMode","selectBlock","canMove","push","command","useQuickActionsCommands","isUngroupable","isGroupable","_isUngroupable","_isGroupable","canInsertBlockType","getDefaultBlockName","getGroupingBlockName","removeBlocks","duplicateBlocks","insertAfterBlock","insertBeforeBlock","onGroup","groupingBlockName","onUngroup","innerBlocks","canInsertDefaultBlock","canDuplicate","every","Array","isArray","useBlockCommands","hook","context"],"sources":["@wordpress/block-editor/src/components/use-block-commands/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\thasBlockSupport,\n\tstore as blocksStore,\n\tswitchToBlockType,\n\tisTemplatePart,\n} from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useCommandLoader } from '@wordpress/commands';\nimport {\n\tcopy,\n\ttrash as remove,\n\tplus as add,\n\tgroup,\n\tungroup,\n\tmoveTo as move,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport BlockIcon from '../block-icon';\nimport { store as blockEditorStore } from '../../store';\n\nexport const useTransformCommands = () => {\n\tconst { replaceBlocks, multiSelect } = useDispatch( blockEditorStore );\n\tconst {\n\t\tblocks,\n\t\tclientIds,\n\t\tcanRemove,\n\t\tpossibleBlockTransformations,\n\t\tinvalidSelection,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockRootClientId,\n\t\t\tgetBlockTransformItems,\n\t\t\tgetSelectedBlockClientIds,\n\t\t\tgetBlocksByClientId,\n\t\t\tcanRemoveBlocks,\n\t\t} = select( blockEditorStore );\n\n\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\t\tconst selectedBlocks = getBlocksByClientId( selectedBlockClientIds );\n\n\t\t// selectedBlocks can have `null`s when something tries to call `selectBlock` with an inexistent clientId.\n\t\t// These nulls will cause fatal errors down the line.\n\t\t// In order to prevent discrepancies between selectedBlockClientIds and selectedBlocks, we effectively treat the entire selection as invalid.\n\t\t// @see https://github.com/WordPress/gutenberg/pull/59410#issuecomment-2006304536\n\t\tif ( selectedBlocks.filter( ( block ) => ! block ).length > 0 ) {\n\t\t\treturn {\n\t\t\t\tinvalidSelection: true,\n\t\t\t};\n\t\t}\n\n\t\tconst rootClientId = getBlockRootClientId(\n\t\t\tselectedBlockClientIds[ 0 ]\n\t\t);\n\t\treturn {\n\t\t\tblocks: selectedBlocks,\n\t\t\tclientIds: selectedBlockClientIds,\n\t\t\tpossibleBlockTransformations: getBlockTransformItems(\n\t\t\t\tselectedBlocks,\n\t\t\t\trootClientId\n\t\t\t),\n\t\t\tcanRemove: canRemoveBlocks( selectedBlockClientIds ),\n\t\t\tinvalidSelection: false,\n\t\t};\n\t}, [] );\n\n\tif ( invalidSelection ) {\n\t\treturn {\n\t\t\tisLoading: false,\n\t\t\tcommands: [],\n\t\t};\n\t}\n\tconst isTemplate = blocks.length === 1 && isTemplatePart( blocks[ 0 ] );\n\n\tfunction selectForMultipleBlocks( insertedBlocks ) {\n\t\tif ( insertedBlocks.length > 1 ) {\n\t\t\tmultiSelect(\n\t\t\t\tinsertedBlocks[ 0 ].clientId,\n\t\t\t\tinsertedBlocks[ insertedBlocks.length - 1 ].clientId\n\t\t\t);\n\t\t}\n\t}\n\n\t// Simple block tranformation based on the `Block Transforms` API.\n\tfunction onBlockTransform( name ) {\n\t\tconst newBlocks = switchToBlockType( blocks, name );\n\t\treplaceBlocks( clientIds, newBlocks );\n\t\tselectForMultipleBlocks( newBlocks );\n\t}\n\n\t/**\n\t * The `isTemplate` check is a stopgap solution here.\n\t * Ideally, the Transforms API should handle this\n\t * by allowing to exclude blocks from wildcard transformations.\n\t */\n\tconst hasPossibleBlockTransformations =\n\t\t!! possibleBlockTransformations.length && canRemove && ! isTemplate;\n\n\tif (\n\t\t! clientIds ||\n\t\tclientIds.length < 1 ||\n\t\t! hasPossibleBlockTransformations\n\t) {\n\t\treturn { isLoading: false, commands: [] };\n\t}\n\n\tconst commands = possibleBlockTransformations.map( ( transformation ) => {\n\t\tconst { name, title, icon } = transformation;\n\t\treturn {\n\t\t\tname: 'core/block-editor/transform-to-' + name.replace( '/', '-' ),\n\t\t\t// translators: %s: block title/name.\n\t\t\tlabel: sprintf( __( 'Transform to %s' ), title ),\n\t\t\ticon: <BlockIcon icon={ icon } />,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tonBlockTransform( name );\n\t\t\t\tclose();\n\t\t\t},\n\t\t};\n\t} );\n\n\treturn { isLoading: false, commands };\n};\n\nconst useActionsCommands = () => {\n\tconst { clientIds } = useSelect( ( select ) => {\n\t\tconst { getSelectedBlockClientIds } = select( blockEditorStore );\n\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\n\t\treturn {\n\t\t\tclientIds: selectedBlockClientIds,\n\t\t};\n\t}, [] );\n\n\tconst { getBlockRootClientId, canMoveBlocks, getBlockCount } =\n\t\tuseSelect( blockEditorStore );\n\n\tconst { setBlockMovingClientId, setNavigationMode, selectBlock } =\n\t\tuseDispatch( blockEditorStore );\n\n\tif ( ! clientIds || clientIds.length < 1 ) {\n\t\treturn { isLoading: false, commands: [] };\n\t}\n\n\tconst rootClientId = getBlockRootClientId( clientIds[ 0 ] );\n\n\tconst canMove =\n\t\tcanMoveBlocks( clientIds ) && getBlockCount( rootClientId ) !== 1;\n\n\tconst commands = [];\n\n\tif ( canMove ) {\n\t\tcommands.push( {\n\t\t\tname: 'move-to',\n\t\t\tlabel: __( 'Move to' ),\n\t\t\tcallback: () => {\n\t\t\t\tsetNavigationMode( true );\n\t\t\t\tselectBlock( clientIds[ 0 ] );\n\t\t\t\tsetBlockMovingClientId( clientIds[ 0 ] );\n\t\t\t},\n\t\t\ticon: move,\n\t\t} );\n\t}\n\n\treturn {\n\t\tisLoading: false,\n\t\tcommands: commands.map( ( command ) => ( {\n\t\t\t...command,\n\t\t\tname: 'core/block-editor/action-' + command.name,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tcommand.callback();\n\t\t\t\tclose();\n\t\t\t},\n\t\t} ) ),\n\t};\n};\n\nconst useQuickActionsCommands = () => {\n\tconst { clientIds, isUngroupable, isGroupable } = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetSelectedBlockClientIds,\n\t\t\tisUngroupable: _isUngroupable,\n\t\t\tisGroupable: _isGroupable,\n\t\t} = select( blockEditorStore );\n\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\n\t\treturn {\n\t\t\tclientIds: selectedBlockClientIds,\n\t\t\tisUngroupable: _isUngroupable(),\n\t\t\tisGroupable: _isGroupable(),\n\t\t};\n\t}, [] );\n\tconst {\n\t\tcanInsertBlockType,\n\t\tgetBlockRootClientId,\n\t\tgetBlocksByClientId,\n\t\tcanRemoveBlocks,\n\t} = useSelect( blockEditorStore );\n\tconst { getDefaultBlockName, getGroupingBlockName } =\n\t\tuseSelect( blocksStore );\n\n\tconst blocks = getBlocksByClientId( clientIds );\n\n\tconst {\n\t\tremoveBlocks,\n\t\treplaceBlocks,\n\t\tduplicateBlocks,\n\t\tinsertAfterBlock,\n\t\tinsertBeforeBlock,\n\t} = useDispatch( blockEditorStore );\n\n\tconst onGroup = () => {\n\t\tif ( ! blocks.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst groupingBlockName = getGroupingBlockName();\n\n\t\t// Activate the `transform` on `core/group` which does the conversion.\n\t\tconst newBlocks = switchToBlockType( blocks, groupingBlockName );\n\n\t\tif ( ! newBlocks ) {\n\t\t\treturn;\n\t\t}\n\t\treplaceBlocks( clientIds, newBlocks );\n\t};\n\tconst onUngroup = () => {\n\t\tif ( ! blocks.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst innerBlocks = blocks[ 0 ].innerBlocks;\n\n\t\tif ( ! innerBlocks.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\treplaceBlocks( clientIds, innerBlocks );\n\t};\n\n\tif ( ! clientIds || clientIds.length < 1 ) {\n\t\treturn { isLoading: false, commands: [] };\n\t}\n\n\tconst rootClientId = getBlockRootClientId( clientIds[ 0 ] );\n\tconst canInsertDefaultBlock = canInsertBlockType(\n\t\tgetDefaultBlockName(),\n\t\trootClientId\n\t);\n\tconst canDuplicate = blocks.every( ( block ) => {\n\t\treturn (\n\t\t\t!! block &&\n\t\t\thasBlockSupport( block.name, 'multiple', true ) &&\n\t\t\tcanInsertBlockType( block.name, rootClientId )\n\t\t);\n\t} );\n\tconst canRemove = canRemoveBlocks( clientIds );\n\n\tconst commands = [];\n\n\tif ( canDuplicate ) {\n\t\tcommands.push( {\n\t\t\tname: 'duplicate',\n\t\t\tlabel: __( 'Duplicate' ),\n\t\t\tcallback: () => duplicateBlocks( clientIds, true ),\n\t\t\ticon: copy,\n\t\t} );\n\t}\n\n\tif ( canInsertDefaultBlock ) {\n\t\tcommands.push(\n\t\t\t{\n\t\t\t\tname: 'add-before',\n\t\t\t\tlabel: __( 'Add before' ),\n\t\t\t\tcallback: () => {\n\t\t\t\t\tconst clientId = Array.isArray( clientIds )\n\t\t\t\t\t\t? clientIds[ 0 ]\n\t\t\t\t\t\t: clientId;\n\t\t\t\t\tinsertBeforeBlock( clientId );\n\t\t\t\t},\n\t\t\t\ticon: add,\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'add-after',\n\t\t\t\tlabel: __( 'Add after' ),\n\t\t\t\tcallback: () => {\n\t\t\t\t\tconst clientId = Array.isArray( clientIds )\n\t\t\t\t\t\t? clientIds[ clientIds.length - 1 ]\n\t\t\t\t\t\t: clientId;\n\t\t\t\t\tinsertAfterBlock( clientId );\n\t\t\t\t},\n\t\t\t\ticon: add,\n\t\t\t}\n\t\t);\n\t}\n\n\tif ( isGroupable ) {\n\t\tcommands.push( {\n\t\t\tname: 'Group',\n\t\t\tlabel: __( 'Group' ),\n\t\t\tcallback: onGroup,\n\t\t\ticon: group,\n\t\t} );\n\t}\n\n\tif ( isUngroupable ) {\n\t\tcommands.push( {\n\t\t\tname: 'ungroup',\n\t\t\tlabel: __( 'Ungroup' ),\n\t\t\tcallback: onUngroup,\n\t\t\ticon: ungroup,\n\t\t} );\n\t}\n\n\tif ( canRemove ) {\n\t\tcommands.push( {\n\t\t\tname: 'remove',\n\t\t\tlabel: __( 'Delete' ),\n\t\t\tcallback: () => removeBlocks( clientIds, true ),\n\t\t\ticon: remove,\n\t\t} );\n\t}\n\n\treturn {\n\t\tisLoading: false,\n\t\tcommands: commands.map( ( command ) => ( {\n\t\t\t...command,\n\t\t\tname: 'core/block-editor/action-' + command.name,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tcommand.callback();\n\t\t\t\tclose();\n\t\t\t},\n\t\t} ) ),\n\t};\n};\n\nexport const useBlockCommands = () => {\n\tuseCommandLoader( {\n\t\tname: 'core/block-editor/blockTransforms',\n\t\thook: useTransformCommands,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/block-editor/blockActions',\n\t\thook: useActionsCommands,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/block-editor/blockQuickActions',\n\t\thook: useQuickActionsCommands,\n\t\tcontext: 'block-selection-edit',\n\t} );\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SACCC,eAAe,EACfC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