@wordpress/block-editor 12.19.3 → 12.19.5
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/build/components/block-actions/index.js +45 -32
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/block-bindings-toolbar-indicator/index.js +25 -0
- package/build/components/block-bindings-toolbar-indicator/index.js.map +1 -0
- package/build/components/block-edit/context.js +2 -1
- package/build/components/block-edit/context.js.map +1 -1
- package/build/components/block-edit/index.js +8 -3
- package/build/components/block-edit/index.js.map +1 -1
- package/build/components/block-inspector/index.js +5 -4
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +8 -1
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +3 -3
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build/components/block-preview/index.js +4 -0
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +12 -10
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-toolbar/index.js +14 -5
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/global-styles/border-panel.js +21 -8
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/index.js +6 -0
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/shadow-panel-components.js +80 -23
- package/build/components/global-styles/shadow-panel-components.js.map +1 -1
- package/build/components/inspector-controls-tabs/styles-tab.js +1 -1
- package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build/components/link-control/link-preview.js +4 -1
- package/build/components/link-control/link-preview.js.map +1 -1
- package/build/components/list-view/block-select-button.js +10 -2
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/use-clipboard-handler.js +2 -1
- package/build/components/list-view/use-clipboard-handler.js.map +1 -1
- package/build/components/rich-text/index.js +46 -26
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/use-enter.js +3 -0
- package/build/components/rich-text/use-enter.js.map +1 -1
- package/build/components/url-popover/index.js +3 -3
- package/build/components/url-popover/index.js.map +1 -1
- package/build/components/writing-flow/use-clipboard-handler.js +2 -1
- package/build/components/writing-flow/use-clipboard-handler.js.map +1 -1
- package/build/components/writing-flow/utils.js +23 -6
- package/build/components/writing-flow/utils.js.map +1 -1
- package/build/hooks/block-hooks.js +34 -8
- package/build/hooks/block-hooks.js.map +1 -1
- package/build/hooks/border.js +6 -4
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/use-bindings-attributes.js +171 -48
- package/build/hooks/use-bindings-attributes.js.map +1 -1
- package/build/private-apis.js +5 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +40 -6
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +0 -10
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +0 -8
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +1 -16
- package/build/store/reducer.js.map +1 -1
- package/build-module/components/block-actions/index.js +45 -32
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/block-bindings-toolbar-indicator/index.js +18 -0
- package/build-module/components/block-bindings-toolbar-indicator/index.js.map +1 -0
- package/build-module/components/block-edit/context.js +1 -0
- package/build-module/components/block-edit/context.js.map +1 -1
- package/build-module/components/block-edit/index.js +9 -4
- package/build-module/components/block-edit/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +6 -5
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +9 -2
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +3 -3
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build-module/components/block-preview/index.js +4 -0
- package/build-module/components/block-preview/index.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +12 -10
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +14 -5
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +22 -10
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/index.js +1 -1
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/shadow-panel-components.js +82 -24
- package/build-module/components/global-styles/shadow-panel-components.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/styles-tab.js +2 -2
- package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build-module/components/link-control/link-preview.js +5 -2
- package/build-module/components/link-control/link-preview.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +11 -3
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/use-clipboard-handler.js +3 -2
- package/build-module/components/list-view/use-clipboard-handler.js.map +1 -1
- package/build-module/components/rich-text/index.js +47 -28
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/use-enter.js +3 -0
- package/build-module/components/rich-text/use-enter.js.map +1 -1
- package/build-module/components/url-popover/index.js +3 -3
- package/build-module/components/url-popover/index.js.map +1 -1
- package/build-module/components/writing-flow/use-clipboard-handler.js +3 -2
- package/build-module/components/writing-flow/use-clipboard-handler.js.map +1 -1
- package/build-module/components/writing-flow/utils.js +22 -7
- package/build-module/components/writing-flow/utils.js.map +1 -1
- package/build-module/hooks/block-hooks.js +34 -8
- package/build-module/hooks/block-hooks.js.map +1 -1
- package/build-module/hooks/border.js +7 -5
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/use-bindings-attributes.js +172 -49
- package/build-module/hooks/use-bindings-attributes.js.map +1 -1
- package/build-module/private-apis.js +5 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +40 -6
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +0 -9
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +0 -6
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +1 -16
- package/build-module/store/reducer.js.map +1 -1
- package/build-style/content-rtl.css +1 -0
- package/build-style/content.css +1 -0
- package/build-style/default-editor-styles-rtl.css +1 -0
- package/build-style/default-editor-styles.css +1 -0
- package/build-style/style-rtl.css +70 -14
- package/build-style/style.css +70 -14
- package/package.json +8 -8
- package/src/components/block-actions/index.js +57 -47
- package/src/components/block-bindings-toolbar-indicator/index.js +20 -0
- package/src/components/block-bindings-toolbar-indicator/style.scss +14 -0
- package/src/components/block-edit/context.js +1 -0
- package/src/components/block-edit/index.js +5 -1
- package/src/components/block-inspector/index.js +7 -5
- package/src/components/block-list/use-block-props/index.js +12 -2
- package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +3 -7
- package/src/components/block-preview/index.js +6 -1
- package/src/components/block-settings-menu/block-settings-dropdown.js +12 -9
- package/src/components/block-toolbar/index.js +14 -4
- package/src/components/block-toolbar/style.scss +11 -6
- package/src/components/global-styles/border-panel.js +33 -22
- package/src/components/global-styles/index.js +5 -1
- package/src/components/global-styles/shadow-panel-components.js +92 -23
- package/src/components/global-styles/style.scss +33 -10
- package/src/components/inspector-controls-tabs/styles-tab.js +2 -2
- package/src/components/link-control/link-preview.js +9 -2
- package/src/components/link-control/style.scss +9 -0
- package/src/components/list-view/block-select-button.js +16 -2
- package/src/components/list-view/style.scss +8 -0
- package/src/components/list-view/use-clipboard-handler.js +3 -2
- package/src/components/rich-text/index.js +75 -52
- package/src/components/rich-text/use-enter.js +4 -0
- package/src/components/url-popover/index.js +5 -5
- package/src/components/url-popover/style.scss +1 -0
- package/src/components/writing-flow/use-clipboard-handler.js +3 -2
- package/src/components/writing-flow/utils.js +31 -16
- package/src/hooks/block-hooks.js +46 -8
- package/src/hooks/block-hooks.scss +6 -0
- package/src/hooks/border.js +16 -4
- package/src/hooks/use-bindings-attributes.js +215 -65
- package/src/private-apis.js +4 -0
- package/src/store/actions.js +54 -14
- package/src/store/private-actions.js +0 -10
- package/src/store/private-selectors.js +0 -8
- package/src/store/reducer.js +0 -15
- package/src/style.scss +1 -0
|
@@ -4,6 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
+
exports.PrivateRichText = void 0;
|
|
7
8
|
Object.defineProperty(exports, "RichTextShortcut", {
|
|
8
9
|
enumerable: true,
|
|
9
10
|
get: function () {
|
|
@@ -34,6 +35,7 @@ var _components = require("@wordpress/components");
|
|
|
34
35
|
var _blocks = require("@wordpress/blocks");
|
|
35
36
|
var _autocomplete = require("../autocomplete");
|
|
36
37
|
var _blockEdit = require("../block-edit");
|
|
38
|
+
var _context = require("../block-edit/context");
|
|
37
39
|
var _formatToolbarContainer = _interopRequireDefault(require("./format-toolbar-container"));
|
|
38
40
|
var _store = require("../../store");
|
|
39
41
|
var _useUndoAutomaticChange = require("./use-undo-automatic-change");
|
|
@@ -129,15 +131,18 @@ function RichTextWrapper({
|
|
|
129
131
|
__unstableDisableFormats: disableFormats,
|
|
130
132
|
disableLineBreaks,
|
|
131
133
|
__unstableAllowPrefixTransformations,
|
|
134
|
+
disableEditing,
|
|
132
135
|
...props
|
|
133
136
|
}, forwardedRef) {
|
|
134
137
|
props = removeNativeProps(props);
|
|
135
138
|
const anchorRef = (0, _element.useRef)();
|
|
139
|
+
const context = (0, _blockEdit.useBlockEditContext)();
|
|
136
140
|
const {
|
|
137
141
|
clientId,
|
|
138
142
|
isSelected: isBlockSelected,
|
|
139
143
|
name: blockName
|
|
140
|
-
} =
|
|
144
|
+
} = context;
|
|
145
|
+
const blockBindings = context[_context.blockBindingsKey];
|
|
141
146
|
const selector = select => {
|
|
142
147
|
// Avoid subscribing to the block editor store if the block is not
|
|
143
148
|
// selected.
|
|
@@ -148,26 +153,35 @@ function RichTextWrapper({
|
|
|
148
153
|
}
|
|
149
154
|
const {
|
|
150
155
|
getSelectionStart,
|
|
151
|
-
getSelectionEnd
|
|
152
|
-
getBlockAttributes
|
|
156
|
+
getSelectionEnd
|
|
153
157
|
} = select(_store.store);
|
|
154
158
|
const selectionStart = getSelectionStart();
|
|
155
159
|
const selectionEnd = getSelectionEnd();
|
|
156
|
-
const blockBindings = getBlockAttributes(clientId)?.metadata?.bindings;
|
|
157
160
|
let isSelected;
|
|
158
161
|
if (originalIsSelected === undefined) {
|
|
159
162
|
isSelected = selectionStart.clientId === clientId && selectionEnd.clientId === clientId && selectionStart.attributeKey === identifier;
|
|
160
163
|
} else if (originalIsSelected) {
|
|
161
164
|
isSelected = selectionStart.clientId === clientId;
|
|
162
165
|
}
|
|
163
|
-
|
|
166
|
+
return {
|
|
167
|
+
selectionStart: isSelected ? selectionStart.offset : undefined,
|
|
168
|
+
selectionEnd: isSelected ? selectionEnd.offset : undefined,
|
|
169
|
+
isSelected
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
const {
|
|
173
|
+
selectionStart,
|
|
174
|
+
selectionEnd,
|
|
175
|
+
isSelected
|
|
176
|
+
} = (0, _data.useSelect)(selector, [clientId, identifier, originalIsSelected, isBlockSelected]);
|
|
177
|
+
const disableBoundBlocks = (0, _data.useSelect)(select => {
|
|
164
178
|
// Disable Rich Text editing if block bindings specify that.
|
|
165
|
-
let
|
|
166
|
-
if (blockBindings &&
|
|
179
|
+
let _disableBoundBlocks = false;
|
|
180
|
+
if (blockBindings && (0, _useBindingsAttributes.canBindBlock)(blockName)) {
|
|
167
181
|
const blockTypeAttributes = (0, _blocks.getBlockType)(blockName).attributes;
|
|
168
182
|
const {
|
|
169
183
|
getBlockBindingsSource
|
|
170
|
-
} = (0, _lockUnlock.unlock)(select(
|
|
184
|
+
} = (0, _lockUnlock.unlock)(select(_blocks.store));
|
|
171
185
|
for (const [attribute, args] of Object.entries(blockBindings)) {
|
|
172
186
|
if (blockTypeAttributes?.[attribute]?.source !== 'rich-text') {
|
|
173
187
|
break;
|
|
@@ -176,24 +190,14 @@ function RichTextWrapper({
|
|
|
176
190
|
// If the source is not defined, or if its value of `lockAttributesEditing` is `true`, disable it.
|
|
177
191
|
const blockBindingsSource = getBlockBindingsSource(args.source);
|
|
178
192
|
if (!blockBindingsSource || blockBindingsSource.lockAttributesEditing) {
|
|
179
|
-
|
|
193
|
+
_disableBoundBlocks = true;
|
|
180
194
|
break;
|
|
181
195
|
}
|
|
182
196
|
}
|
|
183
197
|
}
|
|
184
|
-
return
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
isSelected,
|
|
188
|
-
shouldDisableEditing
|
|
189
|
-
};
|
|
190
|
-
};
|
|
191
|
-
const {
|
|
192
|
-
selectionStart,
|
|
193
|
-
selectionEnd,
|
|
194
|
-
isSelected,
|
|
195
|
-
shouldDisableEditing
|
|
196
|
-
} = (0, _data.useSelect)(selector, [clientId, identifier, originalIsSelected, isBlockSelected]);
|
|
198
|
+
return _disableBoundBlocks;
|
|
199
|
+
}, [blockBindings, blockName]);
|
|
200
|
+
const shouldDisableEditing = disableEditing || disableBoundBlocks;
|
|
197
201
|
const {
|
|
198
202
|
getSelectionStart,
|
|
199
203
|
getSelectionEnd,
|
|
@@ -389,14 +393,30 @@ function RichTextWrapper({
|
|
|
389
393
|
"data-wp-block-attribute-key": identifier
|
|
390
394
|
}));
|
|
391
395
|
}
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
396
|
+
|
|
397
|
+
// This is the private API for the RichText component.
|
|
398
|
+
// It allows access to all props, not just the public ones.
|
|
399
|
+
const PrivateRichText = exports.PrivateRichText = (0, _withDeprecations.withDeprecations)((0, _element.forwardRef)(RichTextWrapper));
|
|
400
|
+
PrivateRichText.Content = _content.Content;
|
|
401
|
+
PrivateRichText.isEmpty = value => {
|
|
395
402
|
return !value || value.length === 0;
|
|
396
403
|
};
|
|
397
404
|
|
|
405
|
+
// This is the public API for the RichText component.
|
|
406
|
+
// We wrap the PrivateRichText component to hide some props from the public API.
|
|
398
407
|
/**
|
|
399
408
|
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/rich-text/README.md
|
|
400
409
|
*/
|
|
401
|
-
|
|
410
|
+
const PublicForwardedRichTextContainer = (0, _element.forwardRef)((props, ref) => {
|
|
411
|
+
return (0, _react.createElement)(PrivateRichText, {
|
|
412
|
+
ref: ref,
|
|
413
|
+
...props,
|
|
414
|
+
disableEditing: false
|
|
415
|
+
});
|
|
416
|
+
});
|
|
417
|
+
PublicForwardedRichTextContainer.Content = _content.Content;
|
|
418
|
+
PublicForwardedRichTextContainer.isEmpty = value => {
|
|
419
|
+
return !value || value.length === 0;
|
|
420
|
+
};
|
|
421
|
+
var _default = exports.default = PublicForwardedRichTextContainer;
|
|
402
422
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_classnames","_interopRequireDefault","require","_element","_data","_compose","_richText","_components","_blocks","_autocomplete","_blockEdit","_formatToolbarContainer","_store","_useUndoAutomaticChange","_useMarkPersistent","_usePasteHandler","_useBeforeInputRules","_useInputRules","_useDelete","_useEnter","_useFormatTypes","_useRemoveBrowserShortcuts","_useShortcuts","_useInputEvents","_useInsertReplacementText","_useFirefoxCompat","_formatEdit","_utils","_content","_withDeprecations","_lockUnlock","_useBindingsAttributes","_shortcut","_toolbarButton","_inputEvent","keyboardShortcutContext","exports","createContext","inputEventContext","removeNativeProps","props","__unstableMobileNoFocusOnMount","deleteEnter","placeholderTextColor","textAlign","selectionColor","tagsToEliminate","disableEditingMenu","fontSize","fontFamily","fontWeight","fontStyle","minWidth","maxWidth","setRef","disableSuggestions","disableAutocorrection","restProps","RichTextWrapper","children","tagName","value","adjustedValue","onChange","adjustedOnChange","isSelected","originalIsSelected","multiline","inlineToolbar","wrapperClassName","autocompleters","onReplace","placeholder","allowedFormats","withoutInteractiveFormatting","onRemove","onMerge","onSplit","__unstableOnSplitAtEnd","onSplitAtEnd","__unstableOnSplitAtDoubleLineEnd","onSplitAtDoubleLineEnd","identifier","preserveWhiteSpace","__unstablePastePlainText","pastePlainText","__unstableEmbedURLOnPaste","__unstableDisableFormats","disableFormats","disableLineBreaks","__unstableAllowPrefixTransformations","forwardedRef","anchorRef","useRef","clientId","isBlockSelected","name","blockName","useBlockEditContext","selector","select","getSelectionStart","getSelectionEnd","getBlockAttributes","blockEditorStore","selectionStart","selectionEnd","blockBindings","metadata","bindings","undefined","attributeKey","shouldDisableEditing","BLOCK_BINDINGS_ALLOWED_BLOCKS","blockTypeAttributes","getBlockType","attributes","getBlockBindingsSource","unlock","attribute","args","Object","entries","source","blockBindingsSource","lockAttributesEditing","offset","useSelect","getBlockRootClientId","selectionChange","useDispatch","adjustedAllowedFormats","getAllowedFormats","hasFormats","length","onSelectionChange","useCallback","start","end","selection","unset","formatTypes","prepareHandlers","valueHandlers","changeHandlers","dependencies","useFormatTypes","addEditorOnlyFormats","reduce","accumulator","fn","text","formats","removeEditorOnlyFormats","forEach","formatType","__experimentalCreatePrepareEditableTree","removeFormat","addInvisibleFormats","getValue","ref","richTextRef","useRichText","html","__unstableFormats","__unstableText","values","changeHandler","__unstableIsSelected","__unstableDependencies","__unstableAfterParse","__unstableBeforeSerialize","__unstableAddInvisibleFormats","autocompleteProps","useBlockEditorAutocompleteProps","completers","record","useMarkPersistent","keyboardShortcuts","Set","inputEvents","onFocus","current","focus","TagName","_react","createElement","Fragment","Provider","Popover","__unstableSlotNameProvider","default","inline","editableContentElement","role","useMergeRefs","useBeforeInputRules","useInputRules","useInsertReplacementText","useRemoveBrowserShortcuts","useShortcuts","useInputEvents","useUndoAutomaticChange","usePasteHandler","useDelete","useEnter","useFirefoxCompat","contentEditable","suppressContentEditableWarning","className","classnames","tabIndex","ForwardedRichTextContainer","withDeprecations","forwardRef","Content","isEmpty","_default"],"sources":["@wordpress/block-editor/src/components/rich-text/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseRef,\n\tuseCallback,\n\tforwardRef,\n\tcreateContext,\n} from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useMergeRefs } from '@wordpress/compose';\nimport {\n\t__unstableUseRichText as useRichText,\n\tremoveFormat,\n} from '@wordpress/rich-text';\nimport { Popover } from '@wordpress/components';\nimport { getBlockType } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { useBlockEditorAutocompleteProps } from '../autocomplete';\nimport { useBlockEditContext } from '../block-edit';\nimport FormatToolbarContainer from './format-toolbar-container';\nimport { store as blockEditorStore } from '../../store';\nimport { useUndoAutomaticChange } from './use-undo-automatic-change';\nimport { useMarkPersistent } from './use-mark-persistent';\nimport { usePasteHandler } from './use-paste-handler';\nimport { useBeforeInputRules } from './use-before-input-rules';\nimport { useInputRules } from './use-input-rules';\nimport { useDelete } from './use-delete';\nimport { useEnter } from './use-enter';\nimport { useFormatTypes } from './use-format-types';\nimport { useRemoveBrowserShortcuts } from './use-remove-browser-shortcuts';\nimport { useShortcuts } from './use-shortcuts';\nimport { useInputEvents } from './use-input-events';\nimport { useInsertReplacementText } from './use-insert-replacement-text';\nimport { useFirefoxCompat } from './use-firefox-compat';\nimport FormatEdit from './format-edit';\nimport { getAllowedFormats } from './utils';\nimport { Content } from './content';\nimport { withDeprecations } from './with-deprecations';\nimport { unlock } from '../../lock-unlock';\nimport { BLOCK_BINDINGS_ALLOWED_BLOCKS } from '../../hooks/use-bindings-attributes';\n\nexport const keyboardShortcutContext = createContext();\nexport const inputEventContext = createContext();\n\n/**\n * Removes props used for the native version of RichText so that they are not\n * passed to the DOM element and log warnings.\n *\n * @param {Object} props Props to filter.\n *\n * @return {Object} Filtered props.\n */\nfunction removeNativeProps( props ) {\n\tconst {\n\t\t__unstableMobileNoFocusOnMount,\n\t\tdeleteEnter,\n\t\tplaceholderTextColor,\n\t\ttextAlign,\n\t\tselectionColor,\n\t\ttagsToEliminate,\n\t\tdisableEditingMenu,\n\t\tfontSize,\n\t\tfontFamily,\n\t\tfontWeight,\n\t\tfontStyle,\n\t\tminWidth,\n\t\tmaxWidth,\n\t\tsetRef,\n\t\tdisableSuggestions,\n\t\tdisableAutocorrection,\n\t\t...restProps\n\t} = props;\n\treturn restProps;\n}\n\nexport function RichTextWrapper(\n\t{\n\t\tchildren,\n\t\ttagName = 'div',\n\t\tvalue: adjustedValue = '',\n\t\tonChange: adjustedOnChange,\n\t\tisSelected: originalIsSelected,\n\t\tmultiline,\n\t\tinlineToolbar,\n\t\twrapperClassName,\n\t\tautocompleters,\n\t\tonReplace,\n\t\tplaceholder,\n\t\tallowedFormats,\n\t\twithoutInteractiveFormatting,\n\t\tonRemove,\n\t\tonMerge,\n\t\tonSplit,\n\t\t__unstableOnSplitAtEnd: onSplitAtEnd,\n\t\t__unstableOnSplitAtDoubleLineEnd: onSplitAtDoubleLineEnd,\n\t\tidentifier,\n\t\tpreserveWhiteSpace,\n\t\t__unstablePastePlainText: pastePlainText,\n\t\t__unstableEmbedURLOnPaste,\n\t\t__unstableDisableFormats: disableFormats,\n\t\tdisableLineBreaks,\n\t\t__unstableAllowPrefixTransformations,\n\t\t...props\n\t},\n\tforwardedRef\n) {\n\tprops = removeNativeProps( props );\n\n\tconst anchorRef = useRef();\n\tconst {\n\t\tclientId,\n\t\tisSelected: isBlockSelected,\n\t\tname: blockName,\n\t} = useBlockEditContext();\n\tconst selector = ( select ) => {\n\t\t// Avoid subscribing to the block editor store if the block is not\n\t\t// selected.\n\t\tif ( ! isBlockSelected ) {\n\t\t\treturn { isSelected: false };\n\t\t}\n\n\t\tconst { getSelectionStart, getSelectionEnd, getBlockAttributes } =\n\t\t\tselect( blockEditorStore );\n\t\tconst selectionStart = getSelectionStart();\n\t\tconst selectionEnd = getSelectionEnd();\n\t\tconst blockBindings =\n\t\t\tgetBlockAttributes( clientId )?.metadata?.bindings;\n\n\t\tlet isSelected;\n\n\t\tif ( originalIsSelected === undefined ) {\n\t\t\tisSelected =\n\t\t\t\tselectionStart.clientId === clientId &&\n\t\t\t\tselectionEnd.clientId === clientId &&\n\t\t\t\tselectionStart.attributeKey === identifier;\n\t\t} else if ( originalIsSelected ) {\n\t\t\tisSelected = selectionStart.clientId === clientId;\n\t\t}\n\n\t\t// Disable Rich Text editing if block bindings specify that.\n\t\tlet shouldDisableEditing = false;\n\t\tif ( blockBindings && blockName in BLOCK_BINDINGS_ALLOWED_BLOCKS ) {\n\t\t\tconst blockTypeAttributes = getBlockType( blockName ).attributes;\n\t\t\tconst { getBlockBindingsSource } = unlock(\n\t\t\t\tselect( blockEditorStore )\n\t\t\t);\n\t\t\tfor ( const [ attribute, args ] of Object.entries(\n\t\t\t\tblockBindings\n\t\t\t) ) {\n\t\t\t\tif (\n\t\t\t\t\tblockTypeAttributes?.[ attribute ]?.source !== 'rich-text'\n\t\t\t\t) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\t// If the source is not defined, or if its value of `lockAttributesEditing` is `true`, disable it.\n\t\t\t\tconst blockBindingsSource = getBlockBindingsSource(\n\t\t\t\t\targs.source\n\t\t\t\t);\n\t\t\t\tif (\n\t\t\t\t\t! blockBindingsSource ||\n\t\t\t\t\tblockBindingsSource.lockAttributesEditing\n\t\t\t\t) {\n\t\t\t\t\tshouldDisableEditing = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tselectionStart: isSelected ? selectionStart.offset : undefined,\n\t\t\tselectionEnd: isSelected ? selectionEnd.offset : undefined,\n\t\t\tisSelected,\n\t\t\tshouldDisableEditing,\n\t\t};\n\t};\n\tconst { selectionStart, selectionEnd, isSelected, shouldDisableEditing } =\n\t\tuseSelect( selector, [\n\t\t\tclientId,\n\t\t\tidentifier,\n\t\t\toriginalIsSelected,\n\t\t\tisBlockSelected,\n\t\t] );\n\tconst { getSelectionStart, getSelectionEnd, getBlockRootClientId } =\n\t\tuseSelect( blockEditorStore );\n\tconst { selectionChange } = useDispatch( blockEditorStore );\n\tconst adjustedAllowedFormats = getAllowedFormats( {\n\t\tallowedFormats,\n\t\tdisableFormats,\n\t} );\n\tconst hasFormats =\n\t\t! adjustedAllowedFormats || adjustedAllowedFormats.length > 0;\n\n\tconst onSelectionChange = useCallback(\n\t\t( start, end ) => {\n\t\t\tconst selection = {};\n\t\t\tconst unset = start === undefined && end === undefined;\n\n\t\t\tif ( typeof start === 'number' || unset ) {\n\t\t\t\t// If we are only setting the start (or the end below), which\n\t\t\t\t// means a partial selection, and we're not updating a selection\n\t\t\t\t// with the same client ID, abort. This means the selected block\n\t\t\t\t// is a parent block.\n\t\t\t\tif (\n\t\t\t\t\tend === undefined &&\n\t\t\t\t\tgetBlockRootClientId( clientId ) !==\n\t\t\t\t\t\tgetBlockRootClientId( getSelectionEnd().clientId )\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tselection.start = {\n\t\t\t\t\tclientId,\n\t\t\t\t\tattributeKey: identifier,\n\t\t\t\t\toffset: start,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif ( typeof end === 'number' || unset ) {\n\t\t\t\tif (\n\t\t\t\t\tstart === undefined &&\n\t\t\t\t\tgetBlockRootClientId( clientId ) !==\n\t\t\t\t\t\tgetBlockRootClientId( getSelectionStart().clientId )\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tselection.end = {\n\t\t\t\t\tclientId,\n\t\t\t\t\tattributeKey: identifier,\n\t\t\t\t\toffset: end,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tselectionChange( selection );\n\t\t},\n\t\t[ clientId, identifier ]\n\t);\n\n\tconst {\n\t\tformatTypes,\n\t\tprepareHandlers,\n\t\tvalueHandlers,\n\t\tchangeHandlers,\n\t\tdependencies,\n\t} = useFormatTypes( {\n\t\tclientId,\n\t\tidentifier,\n\t\twithoutInteractiveFormatting,\n\t\tallowedFormats: adjustedAllowedFormats,\n\t} );\n\n\tfunction addEditorOnlyFormats( value ) {\n\t\treturn valueHandlers.reduce(\n\t\t\t( accumulator, fn ) => fn( accumulator, value.text ),\n\t\t\tvalue.formats\n\t\t);\n\t}\n\n\tfunction removeEditorOnlyFormats( value ) {\n\t\tformatTypes.forEach( ( formatType ) => {\n\t\t\t// Remove formats created by prepareEditableTree, because they are editor only.\n\t\t\tif ( formatType.__experimentalCreatePrepareEditableTree ) {\n\t\t\t\tvalue = removeFormat(\n\t\t\t\t\tvalue,\n\t\t\t\t\tformatType.name,\n\t\t\t\t\t0,\n\t\t\t\t\tvalue.text.length\n\t\t\t\t);\n\t\t\t}\n\t\t} );\n\n\t\treturn value.formats;\n\t}\n\n\tfunction addInvisibleFormats( value ) {\n\t\treturn prepareHandlers.reduce(\n\t\t\t( accumulator, fn ) => fn( accumulator, value.text ),\n\t\t\tvalue.formats\n\t\t);\n\t}\n\n\tconst {\n\t\tvalue,\n\t\tgetValue,\n\t\tonChange,\n\t\tref: richTextRef,\n\t} = useRichText( {\n\t\tvalue: adjustedValue,\n\t\tonChange( html, { __unstableFormats, __unstableText } ) {\n\t\t\tadjustedOnChange( html );\n\t\t\tObject.values( changeHandlers ).forEach( ( changeHandler ) => {\n\t\t\t\tchangeHandler( __unstableFormats, __unstableText );\n\t\t\t} );\n\t\t},\n\t\tselectionStart,\n\t\tselectionEnd,\n\t\tonSelectionChange,\n\t\tplaceholder,\n\t\t__unstableIsSelected: isSelected,\n\t\t__unstableDisableFormats: disableFormats,\n\t\tpreserveWhiteSpace,\n\t\t__unstableDependencies: [ ...dependencies, tagName ],\n\t\t__unstableAfterParse: addEditorOnlyFormats,\n\t\t__unstableBeforeSerialize: removeEditorOnlyFormats,\n\t\t__unstableAddInvisibleFormats: addInvisibleFormats,\n\t} );\n\tconst autocompleteProps = useBlockEditorAutocompleteProps( {\n\t\tonReplace,\n\t\tcompleters: autocompleters,\n\t\trecord: value,\n\t\tonChange,\n\t} );\n\n\tuseMarkPersistent( { html: adjustedValue, value } );\n\n\tconst keyboardShortcuts = useRef( new Set() );\n\tconst inputEvents = useRef( new Set() );\n\n\tfunction onFocus() {\n\t\tanchorRef.current?.focus();\n\t}\n\n\tconst TagName = tagName;\n\treturn (\n\t\t<>\n\t\t\t{ isSelected && (\n\t\t\t\t<keyboardShortcutContext.Provider value={ keyboardShortcuts }>\n\t\t\t\t\t<inputEventContext.Provider value={ inputEvents }>\n\t\t\t\t\t\t<Popover.__unstableSlotNameProvider value=\"__unstable-block-tools-after\">\n\t\t\t\t\t\t\t{ children &&\n\t\t\t\t\t\t\t\tchildren( { value, onChange, onFocus } ) }\n\n\t\t\t\t\t\t\t<FormatEdit\n\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\tformatTypes={ formatTypes }\n\t\t\t\t\t\t\t\tforwardedRef={ anchorRef }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Popover.__unstableSlotNameProvider>\n\t\t\t\t\t</inputEventContext.Provider>\n\t\t\t\t</keyboardShortcutContext.Provider>\n\t\t\t) }\n\t\t\t{ isSelected && hasFormats && (\n\t\t\t\t<FormatToolbarContainer\n\t\t\t\t\tinline={ inlineToolbar }\n\t\t\t\t\teditableContentElement={ anchorRef.current }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<TagName\n\t\t\t\t// Overridable props.\n\t\t\t\trole=\"textbox\"\n\t\t\t\taria-multiline={ ! disableLineBreaks }\n\t\t\t\taria-label={ placeholder }\n\t\t\t\taria-readonly={ shouldDisableEditing }\n\t\t\t\t{ ...props }\n\t\t\t\t{ ...autocompleteProps }\n\t\t\t\tref={ useMergeRefs( [\n\t\t\t\t\t// Rich text ref must be first because its focus listener\n\t\t\t\t\t// must be set up before any other ref calls .focus() on\n\t\t\t\t\t// mount.\n\t\t\t\t\trichTextRef,\n\t\t\t\t\tforwardedRef,\n\t\t\t\t\tautocompleteProps.ref,\n\t\t\t\t\tprops.ref,\n\t\t\t\t\tuseBeforeInputRules( { value, onChange } ),\n\t\t\t\t\tuseInputRules( {\n\t\t\t\t\t\tgetValue,\n\t\t\t\t\t\tonChange,\n\t\t\t\t\t\t__unstableAllowPrefixTransformations,\n\t\t\t\t\t\tformatTypes,\n\t\t\t\t\t\tonReplace,\n\t\t\t\t\t\tselectionChange,\n\t\t\t\t\t} ),\n\t\t\t\t\tuseInsertReplacementText(),\n\t\t\t\t\tuseRemoveBrowserShortcuts(),\n\t\t\t\t\tuseShortcuts( keyboardShortcuts ),\n\t\t\t\t\tuseInputEvents( inputEvents ),\n\t\t\t\t\tuseUndoAutomaticChange(),\n\t\t\t\t\tusePasteHandler( {\n\t\t\t\t\t\tisSelected,\n\t\t\t\t\t\tdisableFormats,\n\t\t\t\t\t\tonChange,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tformatTypes,\n\t\t\t\t\t\ttagName,\n\t\t\t\t\t\tonReplace,\n\t\t\t\t\t\tonSplit,\n\t\t\t\t\t\t__unstableEmbedURLOnPaste,\n\t\t\t\t\t\tpastePlainText,\n\t\t\t\t\t} ),\n\t\t\t\t\tuseDelete( {\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tonMerge,\n\t\t\t\t\t\tonRemove,\n\t\t\t\t\t} ),\n\t\t\t\t\tuseEnter( {\n\t\t\t\t\t\tremoveEditorOnlyFormats,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tonReplace,\n\t\t\t\t\t\tonSplit,\n\t\t\t\t\t\tonChange,\n\t\t\t\t\t\tdisableLineBreaks,\n\t\t\t\t\t\tonSplitAtEnd,\n\t\t\t\t\t\tonSplitAtDoubleLineEnd,\n\t\t\t\t\t} ),\n\t\t\t\t\tuseFirefoxCompat(),\n\t\t\t\t\tanchorRef,\n\t\t\t\t] ) }\n\t\t\t\tcontentEditable={ ! shouldDisableEditing }\n\t\t\t\tsuppressContentEditableWarning={ true }\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'block-editor-rich-text__editable',\n\t\t\t\t\tprops.className,\n\t\t\t\t\t'rich-text'\n\t\t\t\t) }\n\t\t\t\t// Setting tabIndex to 0 is unnecessary, the element is already\n\t\t\t\t// focusable because it's contentEditable. This also fixes a\n\t\t\t\t// Safari bug where it's not possible to Shift+Click multi\n\t\t\t\t// select blocks when Shift Clicking into an element with\n\t\t\t\t// tabIndex because Safari will focus the element. However,\n\t\t\t\t// Safari will correctly ignore nested contentEditable elements.\n\t\t\t\ttabIndex={\n\t\t\t\t\tprops.tabIndex === 0 && ! shouldDisableEditing\n\t\t\t\t\t\t? null\n\t\t\t\t\t\t: props.tabIndex\n\t\t\t\t}\n\t\t\t\tdata-wp-block-attribute-key={ identifier }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nconst ForwardedRichTextContainer = withDeprecations(\n\tforwardRef( RichTextWrapper )\n);\n\nForwardedRichTextContainer.Content = Content;\nForwardedRichTextContainer.isEmpty = ( value ) => {\n\treturn ! value || value.length === 0;\n};\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/rich-text/README.md\n */\nexport default ForwardedRichTextContainer;\nexport { RichTextShortcut } from './shortcut';\nexport { RichTextToolbarButton } from './toolbar-button';\nexport { __unstableRichTextInputEvent } from './input-event';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AAMA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAIA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AAKA,IAAAO,aAAA,GAAAP,OAAA;AACA,IAAAQ,UAAA,GAAAR,OAAA;AACA,IAAAS,uBAAA,GAAAV,sBAAA,CAAAC,OAAA;A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CH,0BAA0B,CAACI,OAAO,GAAK3J,KAAK,IAAM;EACjD,OAAO,CAAEA,KAAK,IAAIA,KAAK,CAACyE,MAAM,KAAK,CAAC;AACrC,CAAC;;AAED;AACA;AACA;AAFA,IAAAmF,QAAA,GAAArL,OAAA,CAAA2J,OAAA,GAGeqB,0BAA0B"}
|
|
1
|
+
{"version":3,"names":["_classnames","_interopRequireDefault","require","_element","_data","_compose","_richText","_components","_blocks","_autocomplete","_blockEdit","_context","_formatToolbarContainer","_store","_useUndoAutomaticChange","_useMarkPersistent","_usePasteHandler","_useBeforeInputRules","_useInputRules","_useDelete","_useEnter","_useFormatTypes","_useRemoveBrowserShortcuts","_useShortcuts","_useInputEvents","_useInsertReplacementText","_useFirefoxCompat","_formatEdit","_utils","_content","_withDeprecations","_lockUnlock","_useBindingsAttributes","_shortcut","_toolbarButton","_inputEvent","keyboardShortcutContext","exports","createContext","inputEventContext","removeNativeProps","props","__unstableMobileNoFocusOnMount","deleteEnter","placeholderTextColor","textAlign","selectionColor","tagsToEliminate","disableEditingMenu","fontSize","fontFamily","fontWeight","fontStyle","minWidth","maxWidth","setRef","disableSuggestions","disableAutocorrection","restProps","RichTextWrapper","children","tagName","value","adjustedValue","onChange","adjustedOnChange","isSelected","originalIsSelected","multiline","inlineToolbar","wrapperClassName","autocompleters","onReplace","placeholder","allowedFormats","withoutInteractiveFormatting","onRemove","onMerge","onSplit","__unstableOnSplitAtEnd","onSplitAtEnd","__unstableOnSplitAtDoubleLineEnd","onSplitAtDoubleLineEnd","identifier","preserveWhiteSpace","__unstablePastePlainText","pastePlainText","__unstableEmbedURLOnPaste","__unstableDisableFormats","disableFormats","disableLineBreaks","__unstableAllowPrefixTransformations","disableEditing","forwardedRef","anchorRef","useRef","context","useBlockEditContext","clientId","isBlockSelected","name","blockName","blockBindings","blockBindingsKey","selector","select","getSelectionStart","getSelectionEnd","blockEditorStore","selectionStart","selectionEnd","undefined","attributeKey","offset","useSelect","disableBoundBlocks","_disableBoundBlocks","canBindBlock","blockTypeAttributes","getBlockType","attributes","getBlockBindingsSource","unlock","blocksStore","attribute","args","Object","entries","source","blockBindingsSource","lockAttributesEditing","shouldDisableEditing","getBlockRootClientId","selectionChange","useDispatch","adjustedAllowedFormats","getAllowedFormats","hasFormats","length","onSelectionChange","useCallback","start","end","selection","unset","formatTypes","prepareHandlers","valueHandlers","changeHandlers","dependencies","useFormatTypes","addEditorOnlyFormats","reduce","accumulator","fn","text","formats","removeEditorOnlyFormats","forEach","formatType","__experimentalCreatePrepareEditableTree","removeFormat","addInvisibleFormats","getValue","ref","richTextRef","useRichText","html","__unstableFormats","__unstableText","values","changeHandler","__unstableIsSelected","__unstableDependencies","__unstableAfterParse","__unstableBeforeSerialize","__unstableAddInvisibleFormats","autocompleteProps","useBlockEditorAutocompleteProps","completers","record","useMarkPersistent","keyboardShortcuts","Set","inputEvents","onFocus","current","focus","TagName","_react","createElement","Fragment","Provider","Popover","__unstableSlotNameProvider","default","inline","editableContentElement","role","useMergeRefs","useBeforeInputRules","useInputRules","useInsertReplacementText","useRemoveBrowserShortcuts","useShortcuts","useInputEvents","useUndoAutomaticChange","usePasteHandler","useDelete","useEnter","useFirefoxCompat","contentEditable","suppressContentEditableWarning","className","classnames","tabIndex","PrivateRichText","withDeprecations","forwardRef","Content","isEmpty","PublicForwardedRichTextContainer","_default"],"sources":["@wordpress/block-editor/src/components/rich-text/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseRef,\n\tuseCallback,\n\tforwardRef,\n\tcreateContext,\n} from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useMergeRefs } from '@wordpress/compose';\nimport {\n\t__unstableUseRichText as useRichText,\n\tremoveFormat,\n} from '@wordpress/rich-text';\nimport { Popover } from '@wordpress/components';\nimport { getBlockType, store as blocksStore } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { useBlockEditorAutocompleteProps } from '../autocomplete';\nimport { useBlockEditContext } from '../block-edit';\nimport { blockBindingsKey } from '../block-edit/context';\nimport FormatToolbarContainer from './format-toolbar-container';\nimport { store as blockEditorStore } from '../../store';\nimport { useUndoAutomaticChange } from './use-undo-automatic-change';\nimport { useMarkPersistent } from './use-mark-persistent';\nimport { usePasteHandler } from './use-paste-handler';\nimport { useBeforeInputRules } from './use-before-input-rules';\nimport { useInputRules } from './use-input-rules';\nimport { useDelete } from './use-delete';\nimport { useEnter } from './use-enter';\nimport { useFormatTypes } from './use-format-types';\nimport { useRemoveBrowserShortcuts } from './use-remove-browser-shortcuts';\nimport { useShortcuts } from './use-shortcuts';\nimport { useInputEvents } from './use-input-events';\nimport { useInsertReplacementText } from './use-insert-replacement-text';\nimport { useFirefoxCompat } from './use-firefox-compat';\nimport FormatEdit from './format-edit';\nimport { getAllowedFormats } from './utils';\nimport { Content } from './content';\nimport { withDeprecations } from './with-deprecations';\nimport { unlock } from '../../lock-unlock';\nimport { canBindBlock } from '../../hooks/use-bindings-attributes';\n\nexport const keyboardShortcutContext = createContext();\nexport const inputEventContext = createContext();\n\n/**\n * Removes props used for the native version of RichText so that they are not\n * passed to the DOM element and log warnings.\n *\n * @param {Object} props Props to filter.\n *\n * @return {Object} Filtered props.\n */\nfunction removeNativeProps( props ) {\n\tconst {\n\t\t__unstableMobileNoFocusOnMount,\n\t\tdeleteEnter,\n\t\tplaceholderTextColor,\n\t\ttextAlign,\n\t\tselectionColor,\n\t\ttagsToEliminate,\n\t\tdisableEditingMenu,\n\t\tfontSize,\n\t\tfontFamily,\n\t\tfontWeight,\n\t\tfontStyle,\n\t\tminWidth,\n\t\tmaxWidth,\n\t\tsetRef,\n\t\tdisableSuggestions,\n\t\tdisableAutocorrection,\n\t\t...restProps\n\t} = props;\n\treturn restProps;\n}\n\nexport function RichTextWrapper(\n\t{\n\t\tchildren,\n\t\ttagName = 'div',\n\t\tvalue: adjustedValue = '',\n\t\tonChange: adjustedOnChange,\n\t\tisSelected: originalIsSelected,\n\t\tmultiline,\n\t\tinlineToolbar,\n\t\twrapperClassName,\n\t\tautocompleters,\n\t\tonReplace,\n\t\tplaceholder,\n\t\tallowedFormats,\n\t\twithoutInteractiveFormatting,\n\t\tonRemove,\n\t\tonMerge,\n\t\tonSplit,\n\t\t__unstableOnSplitAtEnd: onSplitAtEnd,\n\t\t__unstableOnSplitAtDoubleLineEnd: onSplitAtDoubleLineEnd,\n\t\tidentifier,\n\t\tpreserveWhiteSpace,\n\t\t__unstablePastePlainText: pastePlainText,\n\t\t__unstableEmbedURLOnPaste,\n\t\t__unstableDisableFormats: disableFormats,\n\t\tdisableLineBreaks,\n\t\t__unstableAllowPrefixTransformations,\n\t\tdisableEditing,\n\t\t...props\n\t},\n\tforwardedRef\n) {\n\tprops = removeNativeProps( props );\n\n\tconst anchorRef = useRef();\n\tconst context = useBlockEditContext();\n\tconst { clientId, isSelected: isBlockSelected, name: blockName } = context;\n\tconst blockBindings = context[ blockBindingsKey ];\n\tconst selector = ( select ) => {\n\t\t// Avoid subscribing to the block editor store if the block is not\n\t\t// selected.\n\t\tif ( ! isBlockSelected ) {\n\t\t\treturn { isSelected: false };\n\t\t}\n\n\t\tconst { getSelectionStart, getSelectionEnd } =\n\t\t\tselect( blockEditorStore );\n\t\tconst selectionStart = getSelectionStart();\n\t\tconst selectionEnd = getSelectionEnd();\n\n\t\tlet isSelected;\n\n\t\tif ( originalIsSelected === undefined ) {\n\t\t\tisSelected =\n\t\t\t\tselectionStart.clientId === clientId &&\n\t\t\t\tselectionEnd.clientId === clientId &&\n\t\t\t\tselectionStart.attributeKey === identifier;\n\t\t} else if ( originalIsSelected ) {\n\t\t\tisSelected = selectionStart.clientId === clientId;\n\t\t}\n\n\t\treturn {\n\t\t\tselectionStart: isSelected ? selectionStart.offset : undefined,\n\t\t\tselectionEnd: isSelected ? selectionEnd.offset : undefined,\n\t\t\tisSelected,\n\t\t};\n\t};\n\tconst { selectionStart, selectionEnd, isSelected } = useSelect( selector, [\n\t\tclientId,\n\t\tidentifier,\n\t\toriginalIsSelected,\n\t\tisBlockSelected,\n\t] );\n\n\tconst disableBoundBlocks = useSelect(\n\t\t( select ) => {\n\t\t\t// Disable Rich Text editing if block bindings specify that.\n\t\t\tlet _disableBoundBlocks = false;\n\t\t\tif ( blockBindings && canBindBlock( blockName ) ) {\n\t\t\t\tconst blockTypeAttributes =\n\t\t\t\t\tgetBlockType( blockName ).attributes;\n\t\t\t\tconst { getBlockBindingsSource } = unlock(\n\t\t\t\t\tselect( blocksStore )\n\t\t\t\t);\n\t\t\t\tfor ( const [ attribute, args ] of Object.entries(\n\t\t\t\t\tblockBindings\n\t\t\t\t) ) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tblockTypeAttributes?.[ attribute ]?.source !==\n\t\t\t\t\t\t'rich-text'\n\t\t\t\t\t) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\t// If the source is not defined, or if its value of `lockAttributesEditing` is `true`, disable it.\n\t\t\t\t\tconst blockBindingsSource = getBlockBindingsSource(\n\t\t\t\t\t\targs.source\n\t\t\t\t\t);\n\t\t\t\t\tif (\n\t\t\t\t\t\t! blockBindingsSource ||\n\t\t\t\t\t\tblockBindingsSource.lockAttributesEditing\n\t\t\t\t\t) {\n\t\t\t\t\t\t_disableBoundBlocks = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn _disableBoundBlocks;\n\t\t},\n\t\t[ blockBindings, blockName ]\n\t);\n\n\tconst shouldDisableEditing = disableEditing || disableBoundBlocks;\n\n\tconst { getSelectionStart, getSelectionEnd, getBlockRootClientId } =\n\t\tuseSelect( blockEditorStore );\n\tconst { selectionChange } = useDispatch( blockEditorStore );\n\tconst adjustedAllowedFormats = getAllowedFormats( {\n\t\tallowedFormats,\n\t\tdisableFormats,\n\t} );\n\tconst hasFormats =\n\t\t! adjustedAllowedFormats || adjustedAllowedFormats.length > 0;\n\n\tconst onSelectionChange = useCallback(\n\t\t( start, end ) => {\n\t\t\tconst selection = {};\n\t\t\tconst unset = start === undefined && end === undefined;\n\n\t\t\tif ( typeof start === 'number' || unset ) {\n\t\t\t\t// If we are only setting the start (or the end below), which\n\t\t\t\t// means a partial selection, and we're not updating a selection\n\t\t\t\t// with the same client ID, abort. This means the selected block\n\t\t\t\t// is a parent block.\n\t\t\t\tif (\n\t\t\t\t\tend === undefined &&\n\t\t\t\t\tgetBlockRootClientId( clientId ) !==\n\t\t\t\t\t\tgetBlockRootClientId( getSelectionEnd().clientId )\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tselection.start = {\n\t\t\t\t\tclientId,\n\t\t\t\t\tattributeKey: identifier,\n\t\t\t\t\toffset: start,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif ( typeof end === 'number' || unset ) {\n\t\t\t\tif (\n\t\t\t\t\tstart === undefined &&\n\t\t\t\t\tgetBlockRootClientId( clientId ) !==\n\t\t\t\t\t\tgetBlockRootClientId( getSelectionStart().clientId )\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tselection.end = {\n\t\t\t\t\tclientId,\n\t\t\t\t\tattributeKey: identifier,\n\t\t\t\t\toffset: end,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tselectionChange( selection );\n\t\t},\n\t\t[ clientId, identifier ]\n\t);\n\n\tconst {\n\t\tformatTypes,\n\t\tprepareHandlers,\n\t\tvalueHandlers,\n\t\tchangeHandlers,\n\t\tdependencies,\n\t} = useFormatTypes( {\n\t\tclientId,\n\t\tidentifier,\n\t\twithoutInteractiveFormatting,\n\t\tallowedFormats: adjustedAllowedFormats,\n\t} );\n\n\tfunction addEditorOnlyFormats( value ) {\n\t\treturn valueHandlers.reduce(\n\t\t\t( accumulator, fn ) => fn( accumulator, value.text ),\n\t\t\tvalue.formats\n\t\t);\n\t}\n\n\tfunction removeEditorOnlyFormats( value ) {\n\t\tformatTypes.forEach( ( formatType ) => {\n\t\t\t// Remove formats created by prepareEditableTree, because they are editor only.\n\t\t\tif ( formatType.__experimentalCreatePrepareEditableTree ) {\n\t\t\t\tvalue = removeFormat(\n\t\t\t\t\tvalue,\n\t\t\t\t\tformatType.name,\n\t\t\t\t\t0,\n\t\t\t\t\tvalue.text.length\n\t\t\t\t);\n\t\t\t}\n\t\t} );\n\n\t\treturn value.formats;\n\t}\n\n\tfunction addInvisibleFormats( value ) {\n\t\treturn prepareHandlers.reduce(\n\t\t\t( accumulator, fn ) => fn( accumulator, value.text ),\n\t\t\tvalue.formats\n\t\t);\n\t}\n\n\tconst {\n\t\tvalue,\n\t\tgetValue,\n\t\tonChange,\n\t\tref: richTextRef,\n\t} = useRichText( {\n\t\tvalue: adjustedValue,\n\t\tonChange( html, { __unstableFormats, __unstableText } ) {\n\t\t\tadjustedOnChange( html );\n\t\t\tObject.values( changeHandlers ).forEach( ( changeHandler ) => {\n\t\t\t\tchangeHandler( __unstableFormats, __unstableText );\n\t\t\t} );\n\t\t},\n\t\tselectionStart,\n\t\tselectionEnd,\n\t\tonSelectionChange,\n\t\tplaceholder,\n\t\t__unstableIsSelected: isSelected,\n\t\t__unstableDisableFormats: disableFormats,\n\t\tpreserveWhiteSpace,\n\t\t__unstableDependencies: [ ...dependencies, tagName ],\n\t\t__unstableAfterParse: addEditorOnlyFormats,\n\t\t__unstableBeforeSerialize: removeEditorOnlyFormats,\n\t\t__unstableAddInvisibleFormats: addInvisibleFormats,\n\t} );\n\tconst autocompleteProps = useBlockEditorAutocompleteProps( {\n\t\tonReplace,\n\t\tcompleters: autocompleters,\n\t\trecord: value,\n\t\tonChange,\n\t} );\n\n\tuseMarkPersistent( { html: adjustedValue, value } );\n\n\tconst keyboardShortcuts = useRef( new Set() );\n\tconst inputEvents = useRef( new Set() );\n\n\tfunction onFocus() {\n\t\tanchorRef.current?.focus();\n\t}\n\n\tconst TagName = tagName;\n\treturn (\n\t\t<>\n\t\t\t{ isSelected && (\n\t\t\t\t<keyboardShortcutContext.Provider value={ keyboardShortcuts }>\n\t\t\t\t\t<inputEventContext.Provider value={ inputEvents }>\n\t\t\t\t\t\t<Popover.__unstableSlotNameProvider value=\"__unstable-block-tools-after\">\n\t\t\t\t\t\t\t{ children &&\n\t\t\t\t\t\t\t\tchildren( { value, onChange, onFocus } ) }\n\n\t\t\t\t\t\t\t<FormatEdit\n\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\tformatTypes={ formatTypes }\n\t\t\t\t\t\t\t\tforwardedRef={ anchorRef }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Popover.__unstableSlotNameProvider>\n\t\t\t\t\t</inputEventContext.Provider>\n\t\t\t\t</keyboardShortcutContext.Provider>\n\t\t\t) }\n\t\t\t{ isSelected && hasFormats && (\n\t\t\t\t<FormatToolbarContainer\n\t\t\t\t\tinline={ inlineToolbar }\n\t\t\t\t\teditableContentElement={ anchorRef.current }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<TagName\n\t\t\t\t// Overridable props.\n\t\t\t\trole=\"textbox\"\n\t\t\t\taria-multiline={ ! disableLineBreaks }\n\t\t\t\taria-label={ placeholder }\n\t\t\t\taria-readonly={ shouldDisableEditing }\n\t\t\t\t{ ...props }\n\t\t\t\t{ ...autocompleteProps }\n\t\t\t\tref={ useMergeRefs( [\n\t\t\t\t\t// Rich text ref must be first because its focus listener\n\t\t\t\t\t// must be set up before any other ref calls .focus() on\n\t\t\t\t\t// mount.\n\t\t\t\t\trichTextRef,\n\t\t\t\t\tforwardedRef,\n\t\t\t\t\tautocompleteProps.ref,\n\t\t\t\t\tprops.ref,\n\t\t\t\t\tuseBeforeInputRules( { value, onChange } ),\n\t\t\t\t\tuseInputRules( {\n\t\t\t\t\t\tgetValue,\n\t\t\t\t\t\tonChange,\n\t\t\t\t\t\t__unstableAllowPrefixTransformations,\n\t\t\t\t\t\tformatTypes,\n\t\t\t\t\t\tonReplace,\n\t\t\t\t\t\tselectionChange,\n\t\t\t\t\t} ),\n\t\t\t\t\tuseInsertReplacementText(),\n\t\t\t\t\tuseRemoveBrowserShortcuts(),\n\t\t\t\t\tuseShortcuts( keyboardShortcuts ),\n\t\t\t\t\tuseInputEvents( inputEvents ),\n\t\t\t\t\tuseUndoAutomaticChange(),\n\t\t\t\t\tusePasteHandler( {\n\t\t\t\t\t\tisSelected,\n\t\t\t\t\t\tdisableFormats,\n\t\t\t\t\t\tonChange,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tformatTypes,\n\t\t\t\t\t\ttagName,\n\t\t\t\t\t\tonReplace,\n\t\t\t\t\t\tonSplit,\n\t\t\t\t\t\t__unstableEmbedURLOnPaste,\n\t\t\t\t\t\tpastePlainText,\n\t\t\t\t\t} ),\n\t\t\t\t\tuseDelete( {\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tonMerge,\n\t\t\t\t\t\tonRemove,\n\t\t\t\t\t} ),\n\t\t\t\t\tuseEnter( {\n\t\t\t\t\t\tremoveEditorOnlyFormats,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tonReplace,\n\t\t\t\t\t\tonSplit,\n\t\t\t\t\t\tonChange,\n\t\t\t\t\t\tdisableLineBreaks,\n\t\t\t\t\t\tonSplitAtEnd,\n\t\t\t\t\t\tonSplitAtDoubleLineEnd,\n\t\t\t\t\t} ),\n\t\t\t\t\tuseFirefoxCompat(),\n\t\t\t\t\tanchorRef,\n\t\t\t\t] ) }\n\t\t\t\tcontentEditable={ ! shouldDisableEditing }\n\t\t\t\tsuppressContentEditableWarning={ true }\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'block-editor-rich-text__editable',\n\t\t\t\t\tprops.className,\n\t\t\t\t\t'rich-text'\n\t\t\t\t) }\n\t\t\t\t// Setting tabIndex to 0 is unnecessary, the element is already\n\t\t\t\t// focusable because it's contentEditable. This also fixes a\n\t\t\t\t// Safari bug where it's not possible to Shift+Click multi\n\t\t\t\t// select blocks when Shift Clicking into an element with\n\t\t\t\t// tabIndex because Safari will focus the element. However,\n\t\t\t\t// Safari will correctly ignore nested contentEditable elements.\n\t\t\t\ttabIndex={\n\t\t\t\t\tprops.tabIndex === 0 && ! shouldDisableEditing\n\t\t\t\t\t\t? null\n\t\t\t\t\t\t: props.tabIndex\n\t\t\t\t}\n\t\t\t\tdata-wp-block-attribute-key={ identifier }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\n// This is the private API for the RichText component.\n// It allows access to all props, not just the public ones.\nexport const PrivateRichText = withDeprecations(\n\tforwardRef( RichTextWrapper )\n);\n\nPrivateRichText.Content = Content;\nPrivateRichText.isEmpty = ( value ) => {\n\treturn ! value || value.length === 0;\n};\n\n// This is the public API for the RichText component.\n// We wrap the PrivateRichText component to hide some props from the public API.\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/rich-text/README.md\n */\nconst PublicForwardedRichTextContainer = forwardRef( ( props, ref ) => {\n\treturn (\n\t\t<PrivateRichText ref={ ref } { ...props } disableEditing={ false } />\n\t);\n} );\n\nPublicForwardedRichTextContainer.Content = Content;\nPublicForwardedRichTextContainer.isEmpty = ( value ) => {\n\treturn ! value || value.length === 0;\n};\n\nexport default PublicForwardedRichTextContainer;\nexport { RichTextShortcut } from './shortcut';\nexport { RichTextToolbarButton } from './toolbar-button';\nexport { __unstableRichTextInputEvent } from './input-event';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AAMA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAIA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AAKA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IACA;IAAA;IACAE,QAAQ,EACP9K,KAAK,CAAC8K,QAAQ,KAAK,CAAC,IAAI,CAAEpF,oBAAoB,GAC3C,IAAI,GACJ1F,KAAK,CAAC8K,QACT;IACD,+BAA8BpI;EAAY,CAC1C,CACA,CAAC;AAEL;;AAEA;AACA;AACO,MAAMqI,eAAe,GAAAnL,OAAA,CAAAmL,eAAA,GAAG,IAAAC,kCAAgB,EAC9C,IAAAC,mBAAU,EAAE/J,eAAgB,CAC7B,CAAC;AAED6J,eAAe,CAACG,OAAO,GAAGA,gBAAO;AACjCH,eAAe,CAACI,OAAO,GAAK9J,KAAK,IAAM;EACtC,OAAO,CAAEA,KAAK,IAAIA,KAAK,CAAC4E,MAAM,KAAK,CAAC;AACrC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,MAAMmF,gCAAgC,GAAG,IAAAH,mBAAU,EAAE,CAAEjL,KAAK,EAAE2H,GAAG,KAAM;EACtE,OACC,IAAAyB,MAAA,CAAAC,aAAA,EAAC0B,eAAe;IAACpD,GAAG,EAAGA,GAAK;IAAA,GAAM3H,KAAK;IAAGmD,cAAc,EAAG;EAAO,CAAE,CAAC;AAEvE,CAAE,CAAC;AAEHiI,gCAAgC,CAACF,OAAO,GAAGA,gBAAO;AAClDE,gCAAgC,CAACD,OAAO,GAAK9J,KAAK,IAAM;EACvD,OAAO,CAAEA,KAAK,IAAIA,KAAK,CAAC4E,MAAM,KAAK,CAAC;AACrC,CAAC;AAAC,IAAAoF,QAAA,GAAAzL,OAAA,CAAA8J,OAAA,GAEa0B,gCAAgC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_compose","_keycodes","_richText","_blocks","_data","_store","_splitValue","useEnter","props","registry","useRegistry","__unstableMarkAutomaticChange","useDispatch","blockEditorStore","propsRef","useRef","current","useRefEffect","element","onKeyDown","event","defaultPrevented","keyCode","ENTER","removeEditorOnlyFormats","value","onReplace","onSplit","onChange","disableLineBreaks","onSplitAtEnd","onSplitAtDoubleLineEnd","preventDefault","_value","formats","canSplit","transforms","getBlockTransforms","filter","type","transformation","findTransform","item","regExp","test","text","transform","content","start","end","shiftKey","insert","splitValue","length","slice","batch","remove","addEventListener","removeEventListener"],"sources":["@wordpress/block-editor/src/components/rich-text/use-enter.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRef } from '@wordpress/element';\nimport { useRefEffect } from '@wordpress/compose';\nimport { ENTER } from '@wordpress/keycodes';\nimport { insert, remove } from '@wordpress/rich-text';\nimport { getBlockTransforms, findTransform } from '@wordpress/blocks';\nimport { useDispatch, useRegistry } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { splitValue } from './split-value';\n\nexport function useEnter( props ) {\n\tconst registry = useRegistry();\n\tconst { __unstableMarkAutomaticChange } = useDispatch( blockEditorStore );\n\tconst propsRef = useRef( props );\n\tpropsRef.current = props;\n\treturn useRefEffect( ( element ) => {\n\t\tfunction onKeyDown( event ) {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( event.keyCode !== ENTER ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst {\n\t\t\t\tremoveEditorOnlyFormats,\n\t\t\t\tvalue,\n\t\t\t\tonReplace,\n\t\t\t\tonSplit,\n\t\t\t\tonChange,\n\t\t\t\tdisableLineBreaks,\n\t\t\t\tonSplitAtEnd,\n\t\t\t\tonSplitAtDoubleLineEnd,\n\t\t\t} = propsRef.current;\n\n\t\t\tevent.preventDefault();\n\n\t\t\tconst _value = { ...value };\n\t\t\t_value.formats = removeEditorOnlyFormats( value );\n\t\t\tconst canSplit = onReplace && onSplit;\n\n\t\t\tif ( onReplace ) {\n\t\t\t\tconst transforms = getBlockTransforms( 'from' ).filter(\n\t\t\t\t\t( { type } ) => type === 'enter'\n\t\t\t\t);\n\t\t\t\tconst transformation = findTransform( transforms, ( item ) => {\n\t\t\t\t\treturn item.regExp.test( _value.text );\n\t\t\t\t} );\n\n\t\t\t\tif ( transformation ) {\n\t\t\t\t\tonReplace( [\n\t\t\t\t\t\ttransformation.transform( {\n\t\t\t\t\t\t\tcontent: _value.text,\n\t\t\t\t\t\t} ),\n\t\t\t\t\t] );\n\t\t\t\t\t__unstableMarkAutomaticChange();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst { text, start, end } = _value;\n\n\t\t\tif ( event.shiftKey ) {\n\t\t\t\tif ( ! disableLineBreaks ) {\n\t\t\t\t\tonChange( insert( _value, '\\n' ) );\n\t\t\t\t}\n\t\t\t} else if ( canSplit ) {\n\t\t\t\tsplitValue( {\n\t\t\t\t\tvalue: _value,\n\t\t\t\t\tonReplace,\n\t\t\t\t\tonSplit,\n\t\t\t\t} );\n\t\t\t} else if ( onSplitAtEnd && start === end && end === text.length ) {\n\t\t\t\tonSplitAtEnd();\n\t\t\t} else if (\n\t\t\t\t// For some blocks it's desirable to split at the end of the\n\t\t\t\t// block when there are two line breaks at the end of the\n\t\t\t\t// block, so triple Enter exits the block.\n\t\t\t\tonSplitAtDoubleLineEnd &&\n\t\t\t\tstart === end &&\n\t\t\t\tend === text.length &&\n\t\t\t\ttext.slice( -2 ) === '\\n\\n'\n\t\t\t) {\n\t\t\t\tregistry.batch( () => {\n\t\t\t\t\t_value.start = _value.end - 2;\n\t\t\t\t\tonChange( remove( _value ) );\n\t\t\t\t\tonSplitAtDoubleLineEnd();\n\t\t\t\t} );\n\t\t\t} else if ( ! disableLineBreaks ) {\n\t\t\t\tonChange( insert( _value, '\\n' ) );\n\t\t\t}\n\t\t}\n\n\t\telement.addEventListener( 'keydown', onKeyDown );\n\t\treturn () => {\n\t\t\telement.removeEventListener( 'keydown', onKeyDown );\n\t\t};\n\t}, [] );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AAdA;AACA;AACA;;AAQA;AACA;AACA;;AAIO,SAASQ,QAAQA,CAAEC,KAAK,EAAG;EACjC,MAAMC,QAAQ,GAAG,IAAAC,iBAAW,EAAC,CAAC;EAC9B,MAAM;IAAEC;EAA8B,CAAC,GAAG,IAAAC,iBAAW,EAAEC,YAAiB,CAAC;EACzE,MAAMC,QAAQ,GAAG,IAAAC,eAAM,EAAEP,KAAM,CAAC;EAChCM,QAAQ,CAACE,OAAO,GAAGR,KAAK;EACxB,OAAO,IAAAS,qBAAY,EAAIC,OAAO,IAAM;IACnC,SAASC,SAASA,CAAEC,KAAK,EAAG;MAC3B,IAAKA,KAAK,CAACC,gBAAgB,EAAG;QAC7B;MACD;MAEA,
|
|
1
|
+
{"version":3,"names":["_element","require","_compose","_keycodes","_richText","_blocks","_data","_store","_splitValue","useEnter","props","registry","useRegistry","__unstableMarkAutomaticChange","useDispatch","blockEditorStore","propsRef","useRef","current","useRefEffect","element","onKeyDown","event","target","contentEditable","defaultPrevented","keyCode","ENTER","removeEditorOnlyFormats","value","onReplace","onSplit","onChange","disableLineBreaks","onSplitAtEnd","onSplitAtDoubleLineEnd","preventDefault","_value","formats","canSplit","transforms","getBlockTransforms","filter","type","transformation","findTransform","item","regExp","test","text","transform","content","start","end","shiftKey","insert","splitValue","length","slice","batch","remove","addEventListener","removeEventListener"],"sources":["@wordpress/block-editor/src/components/rich-text/use-enter.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRef } from '@wordpress/element';\nimport { useRefEffect } from '@wordpress/compose';\nimport { ENTER } from '@wordpress/keycodes';\nimport { insert, remove } from '@wordpress/rich-text';\nimport { getBlockTransforms, findTransform } from '@wordpress/blocks';\nimport { useDispatch, useRegistry } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { splitValue } from './split-value';\n\nexport function useEnter( props ) {\n\tconst registry = useRegistry();\n\tconst { __unstableMarkAutomaticChange } = useDispatch( blockEditorStore );\n\tconst propsRef = useRef( props );\n\tpropsRef.current = props;\n\treturn useRefEffect( ( element ) => {\n\t\tfunction onKeyDown( event ) {\n\t\t\tif ( event.target.contentEditable !== 'true' ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( event.keyCode !== ENTER ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst {\n\t\t\t\tremoveEditorOnlyFormats,\n\t\t\t\tvalue,\n\t\t\t\tonReplace,\n\t\t\t\tonSplit,\n\t\t\t\tonChange,\n\t\t\t\tdisableLineBreaks,\n\t\t\t\tonSplitAtEnd,\n\t\t\t\tonSplitAtDoubleLineEnd,\n\t\t\t} = propsRef.current;\n\n\t\t\tevent.preventDefault();\n\n\t\t\tconst _value = { ...value };\n\t\t\t_value.formats = removeEditorOnlyFormats( value );\n\t\t\tconst canSplit = onReplace && onSplit;\n\n\t\t\tif ( onReplace ) {\n\t\t\t\tconst transforms = getBlockTransforms( 'from' ).filter(\n\t\t\t\t\t( { type } ) => type === 'enter'\n\t\t\t\t);\n\t\t\t\tconst transformation = findTransform( transforms, ( item ) => {\n\t\t\t\t\treturn item.regExp.test( _value.text );\n\t\t\t\t} );\n\n\t\t\t\tif ( transformation ) {\n\t\t\t\t\tonReplace( [\n\t\t\t\t\t\ttransformation.transform( {\n\t\t\t\t\t\t\tcontent: _value.text,\n\t\t\t\t\t\t} ),\n\t\t\t\t\t] );\n\t\t\t\t\t__unstableMarkAutomaticChange();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst { text, start, end } = _value;\n\n\t\t\tif ( event.shiftKey ) {\n\t\t\t\tif ( ! disableLineBreaks ) {\n\t\t\t\t\tonChange( insert( _value, '\\n' ) );\n\t\t\t\t}\n\t\t\t} else if ( canSplit ) {\n\t\t\t\tsplitValue( {\n\t\t\t\t\tvalue: _value,\n\t\t\t\t\tonReplace,\n\t\t\t\t\tonSplit,\n\t\t\t\t} );\n\t\t\t} else if ( onSplitAtEnd && start === end && end === text.length ) {\n\t\t\t\tonSplitAtEnd();\n\t\t\t} else if (\n\t\t\t\t// For some blocks it's desirable to split at the end of the\n\t\t\t\t// block when there are two line breaks at the end of the\n\t\t\t\t// block, so triple Enter exits the block.\n\t\t\t\tonSplitAtDoubleLineEnd &&\n\t\t\t\tstart === end &&\n\t\t\t\tend === text.length &&\n\t\t\t\ttext.slice( -2 ) === '\\n\\n'\n\t\t\t) {\n\t\t\t\tregistry.batch( () => {\n\t\t\t\t\t_value.start = _value.end - 2;\n\t\t\t\t\tonChange( remove( _value ) );\n\t\t\t\t\tonSplitAtDoubleLineEnd();\n\t\t\t\t} );\n\t\t\t} else if ( ! disableLineBreaks ) {\n\t\t\t\tonChange( insert( _value, '\\n' ) );\n\t\t\t}\n\t\t}\n\n\t\telement.addEventListener( 'keydown', onKeyDown );\n\t\treturn () => {\n\t\t\telement.removeEventListener( 'keydown', onKeyDown );\n\t\t};\n\t}, [] );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AAdA;AACA;AACA;;AAQA;AACA;AACA;;AAIO,SAASQ,QAAQA,CAAEC,KAAK,EAAG;EACjC,MAAMC,QAAQ,GAAG,IAAAC,iBAAW,EAAC,CAAC;EAC9B,MAAM;IAAEC;EAA8B,CAAC,GAAG,I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|
|
@@ -80,9 +80,9 @@ const URLPopover = (0, _element.forwardRef)(({
|
|
|
80
80
|
onClick: toggleSettingsVisibility,
|
|
81
81
|
"aria-expanded": isSettingsExpanded,
|
|
82
82
|
size: "compact"
|
|
83
|
-
})), showSettings && (0, _react.createElement)("div", {
|
|
84
|
-
className: "block-editor-url-
|
|
85
|
-
}, renderSettings())
|
|
83
|
+
}))), showSettings && (0, _react.createElement)("div", {
|
|
84
|
+
className: "block-editor-url-popover__settings"
|
|
85
|
+
}, renderSettings()), additionalControls && !showSettings && (0, _react.createElement)("div", {
|
|
86
86
|
className: "block-editor-url-popover__additional-controls"
|
|
87
87
|
}, additionalControls));
|
|
88
88
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_element","_components","_icons","_deprecated","_interopRequireDefault","_linkViewer","_linkEditor","_lockUnlock","__experimentalPopoverLegacyPositionToPlacement","unlock","componentsPrivateApis","DEFAULT_PLACEMENT","URLPopover","forwardRef","additionalControls","children","renderSettings","placement","focusOnMount","position","popoverProps","ref","undefined","deprecated","since","alternative","computedPlacement","isSettingsExpanded","setIsSettingsExpanded","useState","showSettings","toggleSettingsVisibility","_react","createElement","Popover","className","shift","variant","Button","icon","chevronDown","label","__","onClick","size","LinkEditor","LinkViewer","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/url-popover/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { forwardRef, useState } from '@wordpress/element';\nimport {\n\tButton,\n\tPopover,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { chevronDown } from '@wordpress/icons';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport LinkViewer from './link-viewer';\nimport LinkEditor from './link-editor';\nimport { unlock } from '../../lock-unlock';\n\nconst { __experimentalPopoverLegacyPositionToPlacement } = unlock(\n\tcomponentsPrivateApis\n);\n\nconst DEFAULT_PLACEMENT = 'bottom';\n\nconst URLPopover = forwardRef(\n\t(\n\t\t{\n\t\t\tadditionalControls,\n\t\t\tchildren,\n\t\t\trenderSettings,\n\t\t\t// The DEFAULT_PLACEMENT value is assigned inside the function's body\n\t\t\tplacement,\n\t\t\tfocusOnMount = 'firstElement',\n\t\t\t// Deprecated\n\t\t\tposition,\n\t\t\t// Rest\n\t\t\t...popoverProps\n\t\t},\n\t\tref\n\t) => {\n\t\tif ( position !== undefined ) {\n\t\t\tdeprecated( '`position` prop in wp.blockEditor.URLPopover', {\n\t\t\t\tsince: '6.2',\n\t\t\t\talternative: '`placement` prop',\n\t\t\t} );\n\t\t}\n\n\t\t// Compute popover's placement:\n\t\t// - give priority to `placement` prop, if defined\n\t\t// - otherwise, compute it from the legacy `position` prop (if defined)\n\t\t// - finally, fallback to the DEFAULT_PLACEMENT.\n\t\tlet computedPlacement;\n\t\tif ( placement !== undefined ) {\n\t\t\tcomputedPlacement = placement;\n\t\t} else if ( position !== undefined ) {\n\t\t\tcomputedPlacement =\n\t\t\t\t__experimentalPopoverLegacyPositionToPlacement( position );\n\t\t}\n\t\tcomputedPlacement = computedPlacement || DEFAULT_PLACEMENT;\n\n\t\tconst [ isSettingsExpanded, setIsSettingsExpanded ] = useState( false );\n\n\t\tconst showSettings = !! renderSettings && isSettingsExpanded;\n\n\t\tconst toggleSettingsVisibility = () => {\n\t\t\tsetIsSettingsExpanded( ! isSettingsExpanded );\n\t\t};\n\n\t\treturn (\n\t\t\t<Popover\n\t\t\t\tref={ ref }\n\t\t\t\tclassName=\"block-editor-url-popover\"\n\t\t\t\tfocusOnMount={ focusOnMount }\n\t\t\t\tplacement={ computedPlacement }\n\t\t\t\tshift\n\t\t\t\tvariant=\"toolbar\"\n\t\t\t\t{ ...popoverProps }\n\t\t\t>\n\t\t\t\t<div className=\"block-editor-url-popover__input-container\">\n\t\t\t\t\t<div className=\"block-editor-url-popover__row\">\n\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t{ !! renderSettings && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tclassName=\"block-editor-url-popover__settings-toggle\"\n\t\t\t\t\t\t\t\ticon={ chevronDown }\n\t\t\t\t\t\t\t\tlabel={ __( 'Link settings' ) }\n\t\t\t\t\t\t\t\tonClick={ toggleSettingsVisibility }\n\t\t\t\t\t\t\t\taria-expanded={ isSettingsExpanded }\n\t\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</div>\n\t\t\t\t\t{ showSettings && (\n\t\t\t\t\t
|
|
1
|
+
{"version":3,"names":["_i18n","require","_element","_components","_icons","_deprecated","_interopRequireDefault","_linkViewer","_linkEditor","_lockUnlock","__experimentalPopoverLegacyPositionToPlacement","unlock","componentsPrivateApis","DEFAULT_PLACEMENT","URLPopover","forwardRef","additionalControls","children","renderSettings","placement","focusOnMount","position","popoverProps","ref","undefined","deprecated","since","alternative","computedPlacement","isSettingsExpanded","setIsSettingsExpanded","useState","showSettings","toggleSettingsVisibility","_react","createElement","Popover","className","shift","variant","Button","icon","chevronDown","label","__","onClick","size","LinkEditor","LinkViewer","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/url-popover/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { forwardRef, useState } from '@wordpress/element';\nimport {\n\tButton,\n\tPopover,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { chevronDown } from '@wordpress/icons';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport LinkViewer from './link-viewer';\nimport LinkEditor from './link-editor';\nimport { unlock } from '../../lock-unlock';\n\nconst { __experimentalPopoverLegacyPositionToPlacement } = unlock(\n\tcomponentsPrivateApis\n);\n\nconst DEFAULT_PLACEMENT = 'bottom';\n\nconst URLPopover = forwardRef(\n\t(\n\t\t{\n\t\t\tadditionalControls,\n\t\t\tchildren,\n\t\t\trenderSettings,\n\t\t\t// The DEFAULT_PLACEMENT value is assigned inside the function's body\n\t\t\tplacement,\n\t\t\tfocusOnMount = 'firstElement',\n\t\t\t// Deprecated\n\t\t\tposition,\n\t\t\t// Rest\n\t\t\t...popoverProps\n\t\t},\n\t\tref\n\t) => {\n\t\tif ( position !== undefined ) {\n\t\t\tdeprecated( '`position` prop in wp.blockEditor.URLPopover', {\n\t\t\t\tsince: '6.2',\n\t\t\t\talternative: '`placement` prop',\n\t\t\t} );\n\t\t}\n\n\t\t// Compute popover's placement:\n\t\t// - give priority to `placement` prop, if defined\n\t\t// - otherwise, compute it from the legacy `position` prop (if defined)\n\t\t// - finally, fallback to the DEFAULT_PLACEMENT.\n\t\tlet computedPlacement;\n\t\tif ( placement !== undefined ) {\n\t\t\tcomputedPlacement = placement;\n\t\t} else if ( position !== undefined ) {\n\t\t\tcomputedPlacement =\n\t\t\t\t__experimentalPopoverLegacyPositionToPlacement( position );\n\t\t}\n\t\tcomputedPlacement = computedPlacement || DEFAULT_PLACEMENT;\n\n\t\tconst [ isSettingsExpanded, setIsSettingsExpanded ] = useState( false );\n\n\t\tconst showSettings = !! renderSettings && isSettingsExpanded;\n\n\t\tconst toggleSettingsVisibility = () => {\n\t\t\tsetIsSettingsExpanded( ! isSettingsExpanded );\n\t\t};\n\n\t\treturn (\n\t\t\t<Popover\n\t\t\t\tref={ ref }\n\t\t\t\tclassName=\"block-editor-url-popover\"\n\t\t\t\tfocusOnMount={ focusOnMount }\n\t\t\t\tplacement={ computedPlacement }\n\t\t\t\tshift\n\t\t\t\tvariant=\"toolbar\"\n\t\t\t\t{ ...popoverProps }\n\t\t\t>\n\t\t\t\t<div className=\"block-editor-url-popover__input-container\">\n\t\t\t\t\t<div className=\"block-editor-url-popover__row\">\n\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t{ !! renderSettings && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tclassName=\"block-editor-url-popover__settings-toggle\"\n\t\t\t\t\t\t\t\ticon={ chevronDown }\n\t\t\t\t\t\t\t\tlabel={ __( 'Link settings' ) }\n\t\t\t\t\t\t\t\tonClick={ toggleSettingsVisibility }\n\t\t\t\t\t\t\t\taria-expanded={ isSettingsExpanded }\n\t\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t{ showSettings && (\n\t\t\t\t\t<div className=\"block-editor-url-popover__settings\">\n\t\t\t\t\t\t{ renderSettings() }\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t{ additionalControls && ! showSettings && (\n\t\t\t\t\t<div className=\"block-editor-url-popover__additional-controls\">\n\t\t\t\t\t\t{ additionalControls }\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</Popover>\n\t\t);\n\t}\n);\n\nURLPopover.LinkEditor = LinkEditor;\n\nURLPopover.LinkViewer = LinkViewer;\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/url-popover/README.md\n */\nexport default URLPopover;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAC,sBAAA,CAAAL,OAAA;AAKA,IAAAM,WAAA,GAAAD,sBAAA,CAAAL,OAAA;AACA,IAAAO,WAAA,GAAAF,sBAAA,CAAAL,OAAA;AACA,IAAAQ,WAAA,GAAAR,OAAA;AAlBA;AACA;AACA;;AAWA;AACA;AACA;;AAKA,MAAM;EAAES;AAA+C,CAAC,GAAG,IAAAC,kBAAM,EAChEC,uBACD,CAAC;AAED,MAAMC,iBAAiB,GAAG,QAAQ;AAElC,MAAMC,UAAU,GAAG,IAAAC,mBAAU,EAC5B,CACC;EACCC,kBAAkB;EAClBC,QAAQ;EACRC,cAAc;EACd;EACAC,SAAS;EAC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C;IACrDI,IAAI,EAAGC,kBAAa;IACpBC,KAAK,EAAG,IAAAC,QAAE,EAAE,eAAgB,CAAG;IAC/BC,OAAO,EAAGZ,wBAA0B;IACpC,iBAAgBJ,kBAAoB;IACpCiB,IAAI,EAAC;EAAS,CACd,CAEE,CACD,CAAC,EACJd,YAAY,IACb,IAAAE,MAAA,CAAAC,aAAA;IAAKE,SAAS,EAAC;EAAoC,GAChDnB,cAAc,CAAC,CACb,CACL,EACCF,kBAAkB,IAAI,CAAEgB,YAAY,IACrC,IAAAE,MAAA,CAAAC,aAAA;IAAKE,SAAS,EAAC;EAA+C,GAC3DrB,kBACE,CAEE,CAAC;AAEZ,CACD,CAAC;AAEDF,UAAU,CAACiC,UAAU,GAAGA,mBAAU;AAElCjC,UAAU,CAACkC,UAAU,GAAGA,mBAAU;;AAElC;AACA;AACA;AAFA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAGerC,UAAU"}
|
|
@@ -19,6 +19,7 @@ var _utils = require("./utils");
|
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
function useClipboardHandler() {
|
|
22
|
+
const registry = (0, _data.useRegistry)();
|
|
22
23
|
const {
|
|
23
24
|
getBlocksByClientId,
|
|
24
25
|
getSelectedBlockClientIds,
|
|
@@ -93,7 +94,7 @@ function useClipboardHandler() {
|
|
|
93
94
|
const inBetweenBlocks = getBlocksByClientId(selectedBlockClientIds.slice(1, selectedBlockClientIds.length - 1));
|
|
94
95
|
blocks = [head, ...inBetweenBlocks, tail];
|
|
95
96
|
}
|
|
96
|
-
(0, _utils.setClipboardBlocks)(event, blocks);
|
|
97
|
+
(0, _utils.setClipboardBlocks)(event, blocks, registry);
|
|
97
98
|
}
|
|
98
99
|
}
|
|
99
100
|
if (event.type === 'cut') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_dom","require","_data","_compose","_store","_useNotifyCopy","_utils","useClipboardHandler","getBlocksByClientId","getSelectedBlockClientIds","hasMultiSelection","getSettings","__unstableIsFullySelected","__unstableIsSelectionCollapsed","__unstableIsSelectionMergeable","__unstableGetSelectedBlocksWithPartialSelection","canInsertBlockType","useSelect","blockEditorStore","flashBlock","removeBlocks","replaceBlocks","__unstableDeleteSelection","__unstableExpandSelection","insertBlocks","useDispatch","notifyCopy","useNotifyCopy","useRefEffect","node","handler","event","defaultPrevented","selectedBlockClientIds","length","target","ownerDocument","hasSelection","type","documentHasUncollapsedSelection","documentHasSelection","contains","activeElement","preventDefault","isSelectionMergeable","shouldHandleWholeBlocks","expandSelectionIsNeeded","blocks","head","tail","inBetweenBlocks","slice","setClipboardBlocks","contentEditable","__experimentalCanUserUseUnfilteredHTML","canUserUseUnfilteredHTML","getPasteBlocks","selectedBlockClientId","every","block","name","undefined","addEventListener","removeEventListener"],"sources":["@wordpress/block-editor/src/components/writing-flow/use-clipboard-handler.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tdocumentHasSelection,\n\tdocumentHasUncollapsedSelection,\n} from '@wordpress/dom';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { useNotifyCopy } from '../../utils/use-notify-copy';\nimport { getPasteBlocks, setClipboardBlocks } from './utils';\n\nexport default function useClipboardHandler() {\n\tconst {\n\t\tgetBlocksByClientId,\n\t\tgetSelectedBlockClientIds,\n\t\thasMultiSelection,\n\t\tgetSettings,\n\t\t__unstableIsFullySelected,\n\t\t__unstableIsSelectionCollapsed,\n\t\t__unstableIsSelectionMergeable,\n\t\t__unstableGetSelectedBlocksWithPartialSelection,\n\t\tcanInsertBlockType,\n\t} = useSelect( blockEditorStore );\n\tconst {\n\t\tflashBlock,\n\t\tremoveBlocks,\n\t\treplaceBlocks,\n\t\t__unstableDeleteSelection,\n\t\t__unstableExpandSelection,\n\t\tinsertBlocks,\n\t} = useDispatch( blockEditorStore );\n\tconst notifyCopy = useNotifyCopy();\n\n\treturn useRefEffect( ( node ) => {\n\t\tfunction handler( event ) {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\t// This was likely already handled in rich-text/use-paste-handler.js.\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\n\t\t\tif ( selectedBlockClientIds.length === 0 ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Always handle multiple selected blocks.\n\t\t\tif ( ! hasMultiSelection() ) {\n\t\t\t\tconst { target } = event;\n\t\t\t\tconst { ownerDocument } = target;\n\t\t\t\t// If copying, only consider actual text selection as selection.\n\t\t\t\t// Otherwise, any focus on an input field is considered.\n\t\t\t\tconst hasSelection =\n\t\t\t\t\tevent.type === 'copy' || event.type === 'cut'\n\t\t\t\t\t\t? documentHasUncollapsedSelection( ownerDocument )\n\t\t\t\t\t\t: documentHasSelection( ownerDocument );\n\n\t\t\t\t// Let native copy behaviour take over in input fields.\n\t\t\t\tif ( hasSelection ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( ! node.contains( event.target.ownerDocument.activeElement ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tevent.preventDefault();\n\n\t\t\tconst isSelectionMergeable = __unstableIsSelectionMergeable();\n\t\t\tconst shouldHandleWholeBlocks =\n\t\t\t\t__unstableIsSelectionCollapsed() || __unstableIsFullySelected();\n\t\t\tconst expandSelectionIsNeeded =\n\t\t\t\t! shouldHandleWholeBlocks && ! isSelectionMergeable;\n\t\t\tif ( event.type === 'copy' || event.type === 'cut' ) {\n\t\t\t\tif ( selectedBlockClientIds.length === 1 ) {\n\t\t\t\t\tflashBlock( selectedBlockClientIds[ 0 ] );\n\t\t\t\t}\n\t\t\t\t// If we have a partial selection that is not mergeable, just\n\t\t\t\t// expand the selection to the whole blocks.\n\t\t\t\tif ( expandSelectionIsNeeded ) {\n\t\t\t\t\t__unstableExpandSelection();\n\t\t\t\t} else {\n\t\t\t\t\tnotifyCopy( event.type, selectedBlockClientIds );\n\t\t\t\t\tlet blocks;\n\t\t\t\t\t// Check if we have partial selection.\n\t\t\t\t\tif ( shouldHandleWholeBlocks ) {\n\t\t\t\t\t\tblocks = getBlocksByClientId( selectedBlockClientIds );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst [ head, tail ] =\n\t\t\t\t\t\t\t__unstableGetSelectedBlocksWithPartialSelection();\n\t\t\t\t\t\tconst inBetweenBlocks = getBlocksByClientId(\n\t\t\t\t\t\t\tselectedBlockClientIds.slice(\n\t\t\t\t\t\t\t\t1,\n\t\t\t\t\t\t\t\tselectedBlockClientIds.length - 1\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t\t\tblocks = [ head, ...inBetweenBlocks, tail ];\n\t\t\t\t\t}\n\n\t\t\t\t\tsetClipboardBlocks( event, blocks );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( event.type === 'cut' ) {\n\t\t\t\t// We need to also check if at the start we needed to\n\t\t\t\t// expand the selection, as in this point we might have\n\t\t\t\t// programmatically fully selected the blocks above.\n\t\t\t\tif ( shouldHandleWholeBlocks && ! expandSelectionIsNeeded ) {\n\t\t\t\t\tremoveBlocks( selectedBlockClientIds );\n\t\t\t\t} else {\n\t\t\t\t\tevent.target.ownerDocument.activeElement.contentEditable = false;\n\t\t\t\t\t__unstableDeleteSelection();\n\t\t\t\t}\n\t\t\t} else if ( event.type === 'paste' ) {\n\t\t\t\tconst {\n\t\t\t\t\t__experimentalCanUserUseUnfilteredHTML:\n\t\t\t\t\t\tcanUserUseUnfilteredHTML,\n\t\t\t\t} = getSettings();\n\t\t\t\tconst blocks = getPasteBlocks(\n\t\t\t\t\tevent,\n\t\t\t\t\tcanUserUseUnfilteredHTML\n\t\t\t\t);\n\n\t\t\t\tif ( selectedBlockClientIds.length === 1 ) {\n\t\t\t\t\tconst [ selectedBlockClientId ] = selectedBlockClientIds;\n\n\t\t\t\t\tif (\n\t\t\t\t\t\tblocks.every( ( block ) =>\n\t\t\t\t\t\t\tcanInsertBlockType(\n\t\t\t\t\t\t\t\tblock.name,\n\t\t\t\t\t\t\t\tselectedBlockClientId\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t) {\n\t\t\t\t\t\tinsertBlocks(\n\t\t\t\t\t\t\tblocks,\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\tselectedBlockClientId\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treplaceBlocks(\n\t\t\t\t\tselectedBlockClientIds,\n\t\t\t\t\tblocks,\n\t\t\t\t\tblocks.length - 1,\n\t\t\t\t\t-1\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tnode.ownerDocument.addEventListener( 'copy', handler );\n\t\tnode.ownerDocument.addEventListener( 'cut', handler );\n\t\tnode.ownerDocument.addEventListener( 'paste', handler );\n\n\t\treturn () => {\n\t\t\tnode.ownerDocument.removeEventListener( 'copy', handler );\n\t\t\tnode.ownerDocument.removeEventListener( 'cut', handler );\n\t\t\tnode.ownerDocument.removeEventListener( 'paste', handler );\n\t\t};\n\t}, [] );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,IAAA,GAAAC,OAAA;AAIA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAfA;AACA;AACA;;AAQA;AACA;AACA;;AAKe,SAASM,mBAAmBA,CAAA,EAAG;EAC7C,MAAM;IACLC,mBAAmB;IACnBC,yBAAyB;IACzBC,iBAAiB;IACjBC,WAAW;IACXC,yBAAyB;IACzBC,8BAA8B;IAC9BC,8BAA8B;IAC9BC,+CAA+C;IAC/CC;EACD,CAAC,GAAG,IAAAC,eAAS,EAAEC,YAAiB,CAAC;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D,CAAC;QAED,IAAKtB,sBAAsB,CAACC,MAAM,KAAK,CAAC,EAAG;UAC1C,MAAM,CAAEuB,qBAAqB,CAAE,GAAGxB,sBAAsB;UAExD,IACCc,MAAM,CAACW,KAAK,CAAIC,KAAK,IACpB3C,kBAAkB,CACjB2C,KAAK,CAACC,IAAI,EACVH,qBACD,CACD,CAAC,EACA;YACDjC,YAAY,CACXuB,MAAM,EACNc,SAAS,EACTJ,qBACD,CAAC;YACD;UACD;QACD;QAEApC,aAAa,CACZY,sBAAsB,EACtBc,MAAM,EACNA,MAAM,CAACb,MAAM,GAAG,CAAC,EACjB,CAAC,CACF,CAAC;MACF;IACD;IAEAL,IAAI,CAACO,aAAa,CAAC0B,gBAAgB,CAAE,MAAM,EAAEhC,OAAQ,CAAC;IACtDD,IAAI,CAACO,aAAa,CAAC0B,gBAAgB,CAAE,KAAK,EAAEhC,OAAQ,CAAC;IACrDD,IAAI,CAACO,aAAa,CAAC0B,gBAAgB,CAAE,OAAO,EAAEhC,OAAQ,CAAC;IAEvD,OAAO,MAAM;MACZD,IAAI,CAACO,aAAa,CAAC2B,mBAAmB,CAAE,MAAM,EAAEjC,OAAQ,CAAC;MACzDD,IAAI,CAACO,aAAa,CAAC2B,mBAAmB,CAAE,KAAK,EAAEjC,OAAQ,CAAC;MACxDD,IAAI,CAACO,aAAa,CAAC2B,mBAAmB,CAAE,OAAO,EAAEjC,OAAQ,CAAC;IAC3D,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;AACR"}
|
|
1
|
+
{"version":3,"names":["_dom","require","_data","_compose","_store","_useNotifyCopy","_utils","useClipboardHandler","registry","useRegistry","getBlocksByClientId","getSelectedBlockClientIds","hasMultiSelection","getSettings","__unstableIsFullySelected","__unstableIsSelectionCollapsed","__unstableIsSelectionMergeable","__unstableGetSelectedBlocksWithPartialSelection","canInsertBlockType","useSelect","blockEditorStore","flashBlock","removeBlocks","replaceBlocks","__unstableDeleteSelection","__unstableExpandSelection","insertBlocks","useDispatch","notifyCopy","useNotifyCopy","useRefEffect","node","handler","event","defaultPrevented","selectedBlockClientIds","length","target","ownerDocument","hasSelection","type","documentHasUncollapsedSelection","documentHasSelection","contains","activeElement","preventDefault","isSelectionMergeable","shouldHandleWholeBlocks","expandSelectionIsNeeded","blocks","head","tail","inBetweenBlocks","slice","setClipboardBlocks","contentEditable","__experimentalCanUserUseUnfilteredHTML","canUserUseUnfilteredHTML","getPasteBlocks","selectedBlockClientId","every","block","name","undefined","addEventListener","removeEventListener"],"sources":["@wordpress/block-editor/src/components/writing-flow/use-clipboard-handler.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tdocumentHasSelection,\n\tdocumentHasUncollapsedSelection,\n} from '@wordpress/dom';\nimport { useDispatch, useRegistry, useSelect } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { useNotifyCopy } from '../../utils/use-notify-copy';\nimport { getPasteBlocks, setClipboardBlocks } from './utils';\n\nexport default function useClipboardHandler() {\n\tconst registry = useRegistry();\n\tconst {\n\t\tgetBlocksByClientId,\n\t\tgetSelectedBlockClientIds,\n\t\thasMultiSelection,\n\t\tgetSettings,\n\t\t__unstableIsFullySelected,\n\t\t__unstableIsSelectionCollapsed,\n\t\t__unstableIsSelectionMergeable,\n\t\t__unstableGetSelectedBlocksWithPartialSelection,\n\t\tcanInsertBlockType,\n\t} = useSelect( blockEditorStore );\n\tconst {\n\t\tflashBlock,\n\t\tremoveBlocks,\n\t\treplaceBlocks,\n\t\t__unstableDeleteSelection,\n\t\t__unstableExpandSelection,\n\t\tinsertBlocks,\n\t} = useDispatch( blockEditorStore );\n\tconst notifyCopy = useNotifyCopy();\n\n\treturn useRefEffect( ( node ) => {\n\t\tfunction handler( event ) {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\t// This was likely already handled in rich-text/use-paste-handler.js.\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\n\t\t\tif ( selectedBlockClientIds.length === 0 ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Always handle multiple selected blocks.\n\t\t\tif ( ! hasMultiSelection() ) {\n\t\t\t\tconst { target } = event;\n\t\t\t\tconst { ownerDocument } = target;\n\t\t\t\t// If copying, only consider actual text selection as selection.\n\t\t\t\t// Otherwise, any focus on an input field is considered.\n\t\t\t\tconst hasSelection =\n\t\t\t\t\tevent.type === 'copy' || event.type === 'cut'\n\t\t\t\t\t\t? documentHasUncollapsedSelection( ownerDocument )\n\t\t\t\t\t\t: documentHasSelection( ownerDocument );\n\n\t\t\t\t// Let native copy behaviour take over in input fields.\n\t\t\t\tif ( hasSelection ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( ! node.contains( event.target.ownerDocument.activeElement ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tevent.preventDefault();\n\n\t\t\tconst isSelectionMergeable = __unstableIsSelectionMergeable();\n\t\t\tconst shouldHandleWholeBlocks =\n\t\t\t\t__unstableIsSelectionCollapsed() || __unstableIsFullySelected();\n\t\t\tconst expandSelectionIsNeeded =\n\t\t\t\t! shouldHandleWholeBlocks && ! isSelectionMergeable;\n\t\t\tif ( event.type === 'copy' || event.type === 'cut' ) {\n\t\t\t\tif ( selectedBlockClientIds.length === 1 ) {\n\t\t\t\t\tflashBlock( selectedBlockClientIds[ 0 ] );\n\t\t\t\t}\n\t\t\t\t// If we have a partial selection that is not mergeable, just\n\t\t\t\t// expand the selection to the whole blocks.\n\t\t\t\tif ( expandSelectionIsNeeded ) {\n\t\t\t\t\t__unstableExpandSelection();\n\t\t\t\t} else {\n\t\t\t\t\tnotifyCopy( event.type, selectedBlockClientIds );\n\t\t\t\t\tlet blocks;\n\t\t\t\t\t// Check if we have partial selection.\n\t\t\t\t\tif ( shouldHandleWholeBlocks ) {\n\t\t\t\t\t\tblocks = getBlocksByClientId( selectedBlockClientIds );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst [ head, tail ] =\n\t\t\t\t\t\t\t__unstableGetSelectedBlocksWithPartialSelection();\n\t\t\t\t\t\tconst inBetweenBlocks = getBlocksByClientId(\n\t\t\t\t\t\t\tselectedBlockClientIds.slice(\n\t\t\t\t\t\t\t\t1,\n\t\t\t\t\t\t\t\tselectedBlockClientIds.length - 1\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t\t\tblocks = [ head, ...inBetweenBlocks, tail ];\n\t\t\t\t\t}\n\n\t\t\t\t\tsetClipboardBlocks( event, blocks, registry );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( event.type === 'cut' ) {\n\t\t\t\t// We need to also check if at the start we needed to\n\t\t\t\t// expand the selection, as in this point we might have\n\t\t\t\t// programmatically fully selected the blocks above.\n\t\t\t\tif ( shouldHandleWholeBlocks && ! expandSelectionIsNeeded ) {\n\t\t\t\t\tremoveBlocks( selectedBlockClientIds );\n\t\t\t\t} else {\n\t\t\t\t\tevent.target.ownerDocument.activeElement.contentEditable = false;\n\t\t\t\t\t__unstableDeleteSelection();\n\t\t\t\t}\n\t\t\t} else if ( event.type === 'paste' ) {\n\t\t\t\tconst {\n\t\t\t\t\t__experimentalCanUserUseUnfilteredHTML:\n\t\t\t\t\t\tcanUserUseUnfilteredHTML,\n\t\t\t\t} = getSettings();\n\t\t\t\tconst blocks = getPasteBlocks(\n\t\t\t\t\tevent,\n\t\t\t\t\tcanUserUseUnfilteredHTML\n\t\t\t\t);\n\n\t\t\t\tif ( selectedBlockClientIds.length === 1 ) {\n\t\t\t\t\tconst [ selectedBlockClientId ] = selectedBlockClientIds;\n\n\t\t\t\t\tif (\n\t\t\t\t\t\tblocks.every( ( block ) =>\n\t\t\t\t\t\t\tcanInsertBlockType(\n\t\t\t\t\t\t\t\tblock.name,\n\t\t\t\t\t\t\t\tselectedBlockClientId\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t) {\n\t\t\t\t\t\tinsertBlocks(\n\t\t\t\t\t\t\tblocks,\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\tselectedBlockClientId\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treplaceBlocks(\n\t\t\t\t\tselectedBlockClientIds,\n\t\t\t\t\tblocks,\n\t\t\t\t\tblocks.length - 1,\n\t\t\t\t\t-1\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tnode.ownerDocument.addEventListener( 'copy', handler );\n\t\tnode.ownerDocument.addEventListener( 'cut', handler );\n\t\tnode.ownerDocument.addEventListener( 'paste', handler );\n\n\t\treturn () => {\n\t\t\tnode.ownerDocument.removeEventListener( 'copy', handler );\n\t\t\tnode.ownerDocument.removeEventListener( 'cut', handler );\n\t\t\tnode.ownerDocument.removeEventListener( 'paste', handler );\n\t\t};\n\t}, [] );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,IAAA,GAAAC,OAAA;AAIA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAfA;AACA;AACA;;AAQA;AACA;AACA;;AAKe,SAASM,mBAAmBA,CAAA,EAAG;EAC7C,MAAMC,QAAQ,GAAG,IAAAC,iBAAW,EAAC,CAAC;EAC9B,MAAM;IACLC,mBAAmB;IACnBC,yBAAyB;IACzBC,iBAAiB;IACjBC,WAAW;IACXC,yBAAyB;IACzBC,8BAA8B;IAC9BC,8BAA8B;IAC9BC,+CAA+C;IAC/CC;EACD,CAAC,GAAG,IAAAC,eAAS,EAAEC,YAAiB,CAAC;EACjC,MAAM;IACLC,UAAU;IACVC,YAAY;IACZC,aAAa;IACbC,yBAAyB;IACzBC,yBAAyB;IACzBC;EACD,CAAC,GA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BAAqB,CAAE,GAAGxB,sBAAsB;UAExD,IACCc,MAAM,CAACW,KAAK,CAAIC,KAAK,IACpB3C,kBAAkB,CACjB2C,KAAK,CAACC,IAAI,EACVH,qBACD,CACD,CAAC,EACA;YACDjC,YAAY,CACXuB,MAAM,EACNc,SAAS,EACTJ,qBACD,CAAC;YACD;UACD;QACD;QAEApC,aAAa,CACZY,sBAAsB,EACtBc,MAAM,EACNA,MAAM,CAACb,MAAM,GAAG,CAAC,EACjB,CAAC,CACF,CAAC;MACF;IACD;IAEAL,IAAI,CAACO,aAAa,CAAC0B,gBAAgB,CAAE,MAAM,EAAEhC,OAAQ,CAAC;IACtDD,IAAI,CAACO,aAAa,CAAC0B,gBAAgB,CAAE,KAAK,EAAEhC,OAAQ,CAAC;IACrDD,IAAI,CAACO,aAAa,CAAC0B,gBAAgB,CAAE,OAAO,EAAEhC,OAAQ,CAAC;IAEvD,OAAO,MAAM;MACZD,IAAI,CAACO,aAAa,CAAC2B,mBAAmB,CAAE,MAAM,EAAEjC,OAAQ,CAAC;MACzDD,IAAI,CAACO,aAAa,CAAC2B,mBAAmB,CAAE,KAAK,EAAEjC,OAAQ,CAAC;MACxDD,IAAI,CAACO,aAAa,CAAC2B,mBAAmB,CAAE,OAAO,EAAEjC,OAAQ,CAAC;IAC3D,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;AACR"}
|
|
@@ -4,10 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getPasteBlocks = getPasteBlocks;
|
|
7
|
+
exports.requiresWrapperOnCopy = void 0;
|
|
7
8
|
exports.setClipboardBlocks = setClipboardBlocks;
|
|
8
9
|
var _dom = require("@wordpress/dom");
|
|
9
10
|
var _blocks2 = require("@wordpress/blocks");
|
|
10
11
|
var _pasting = require("../../utils/pasting");
|
|
12
|
+
var _store = require("../../store");
|
|
11
13
|
/**
|
|
12
14
|
* WordPress dependencies
|
|
13
15
|
*/
|
|
@@ -16,18 +18,33 @@ var _pasting = require("../../utils/pasting");
|
|
|
16
18
|
* Internal dependencies
|
|
17
19
|
*/
|
|
18
20
|
|
|
21
|
+
const requiresWrapperOnCopy = exports.requiresWrapperOnCopy = Symbol('requiresWrapperOnCopy');
|
|
22
|
+
|
|
19
23
|
/**
|
|
20
24
|
* Sets the clipboard data for the provided blocks, with both HTML and plain
|
|
21
25
|
* text representations.
|
|
22
26
|
*
|
|
23
|
-
* @param {ClipboardEvent} event
|
|
24
|
-
* @param {WPBlock[]} blocks
|
|
27
|
+
* @param {ClipboardEvent} event Clipboard event.
|
|
28
|
+
* @param {WPBlock[]} blocks Blocks to set as clipboard data.
|
|
29
|
+
* @param {Object} registry The registry to select from.
|
|
25
30
|
*/
|
|
26
|
-
function setClipboardBlocks(event, blocks) {
|
|
31
|
+
function setClipboardBlocks(event, blocks, registry) {
|
|
27
32
|
let _blocks = blocks;
|
|
28
|
-
const
|
|
29
|
-
if (
|
|
30
|
-
|
|
33
|
+
const [firstBlock] = blocks;
|
|
34
|
+
if (firstBlock) {
|
|
35
|
+
const firstBlockType = registry.select(_blocks2.store).getBlockType(firstBlock.name);
|
|
36
|
+
if (firstBlockType[requiresWrapperOnCopy]) {
|
|
37
|
+
const {
|
|
38
|
+
getBlockRootClientId,
|
|
39
|
+
getBlockName,
|
|
40
|
+
getBlockAttributes
|
|
41
|
+
} = registry.select(_store.store);
|
|
42
|
+
const wrapperBlockClientId = getBlockRootClientId(firstBlock.clientId);
|
|
43
|
+
const wrapperBlockName = getBlockName(wrapperBlockClientId);
|
|
44
|
+
if (wrapperBlockName) {
|
|
45
|
+
_blocks = (0, _blocks2.createBlock)(wrapperBlockName, getBlockAttributes(wrapperBlockClientId), _blocks);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
31
48
|
}
|
|
32
49
|
const serialized = (0, _blocks2.serialize)(_blocks);
|
|
33
50
|
event.clipboardData.setData('text/plain', toPlainText(serialized));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_dom","require","_blocks2","_pasting","setClipboardBlocks","event","blocks","_blocks","
|
|
1
|
+
{"version":3,"names":["_dom","require","_blocks2","_pasting","_store","requiresWrapperOnCopy","exports","Symbol","setClipboardBlocks","event","blocks","registry","_blocks","firstBlock","firstBlockType","select","blocksStore","getBlockType","name","getBlockRootClientId","getBlockName","getBlockAttributes","blockEditorStore","wrapperBlockClientId","clientId","wrapperBlockName","createBlock","serialized","serialize","clipboardData","setData","toPlainText","getPasteBlocks","canUserUseUnfilteredHTML","plainText","html","files","getPasteEventData","length","fromTransforms","getBlockTransforms","reduce","accumulator","file","transformation","findTransform","transform","type","isMatch","push","flat","pasteHandler","HTML","mode","replace","stripHTML","trim"],"sources":["@wordpress/block-editor/src/components/writing-flow/utils.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport {\n\tserialize,\n\tcreateBlock,\n\tpasteHandler,\n\tfindTransform,\n\tgetBlockTransforms,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { getPasteEventData } from '../../utils/pasting';\nimport { store as blockEditorStore } from '../../store';\n\nexport const requiresWrapperOnCopy = Symbol( 'requiresWrapperOnCopy' );\n\n/**\n * Sets the clipboard data for the provided blocks, with both HTML and plain\n * text representations.\n *\n * @param {ClipboardEvent} event Clipboard event.\n * @param {WPBlock[]} blocks Blocks to set as clipboard data.\n * @param {Object} registry The registry to select from.\n */\nexport function setClipboardBlocks( event, blocks, registry ) {\n\tlet _blocks = blocks;\n\n\tconst [ firstBlock ] = blocks;\n\n\tif ( firstBlock ) {\n\t\tconst firstBlockType = registry\n\t\t\t.select( blocksStore )\n\t\t\t.getBlockType( firstBlock.name );\n\n\t\tif ( firstBlockType[ requiresWrapperOnCopy ] ) {\n\t\t\tconst { getBlockRootClientId, getBlockName, getBlockAttributes } =\n\t\t\t\tregistry.select( blockEditorStore );\n\t\t\tconst wrapperBlockClientId = getBlockRootClientId(\n\t\t\t\tfirstBlock.clientId\n\t\t\t);\n\t\t\tconst wrapperBlockName = getBlockName( wrapperBlockClientId );\n\n\t\t\tif ( wrapperBlockName ) {\n\t\t\t\t_blocks = createBlock(\n\t\t\t\t\twrapperBlockName,\n\t\t\t\t\tgetBlockAttributes( wrapperBlockClientId ),\n\t\t\t\t\t_blocks\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst serialized = serialize( _blocks );\n\n\tevent.clipboardData.setData( 'text/plain', toPlainText( serialized ) );\n\tevent.clipboardData.setData( 'text/html', serialized );\n}\n\n/**\n * Returns the blocks to be pasted from the clipboard event.\n *\n * @param {ClipboardEvent} event The clipboard event.\n * @param {boolean} canUserUseUnfilteredHTML Whether the user can or can't post unfiltered HTML.\n * @return {Array|string} A list of blocks or a string, depending on `handlerMode`.\n */\nexport function getPasteBlocks( event, canUserUseUnfilteredHTML ) {\n\tconst { plainText, html, files } = getPasteEventData( event );\n\tlet blocks = [];\n\n\tif ( files.length ) {\n\t\tconst fromTransforms = getBlockTransforms( 'from' );\n\t\tblocks = files\n\t\t\t.reduce( ( accumulator, file ) => {\n\t\t\t\tconst transformation = findTransform(\n\t\t\t\t\tfromTransforms,\n\t\t\t\t\t( transform ) =>\n\t\t\t\t\t\ttransform.type === 'files' &&\n\t\t\t\t\t\ttransform.isMatch( [ file ] )\n\t\t\t\t);\n\t\t\t\tif ( transformation ) {\n\t\t\t\t\taccumulator.push( transformation.transform( [ file ] ) );\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t}, [] )\n\t\t\t.flat();\n\t} else {\n\t\tblocks = pasteHandler( {\n\t\t\tHTML: html,\n\t\t\tplainText,\n\t\t\tmode: 'BLOCKS',\n\t\t\tcanUserUseUnfilteredHTML,\n\t\t} );\n\t}\n\n\treturn blocks;\n}\n\n/**\n * Given a string of HTML representing serialized blocks, returns the plain\n * text extracted after stripping the HTML of any tags and fixing line breaks.\n *\n * @param {string} html Serialized blocks.\n * @return {string} The plain-text content with any html removed.\n */\nfunction toPlainText( html ) {\n\t// Manually handle BR tags as line breaks prior to `stripHTML` call\n\thtml = html.replace( /<br>/g, '\\n' );\n\n\tconst plainText = stripHTML( html ).trim();\n\n\t// Merge any consecutive line breaks\n\treturn plainText.replace( /\\n\\n+/g, '\\n\\n' );\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAYA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAjBA;AACA;AACA;;AAWA;AACA;AACA;;AAIO,MAAMI,qBAAqB,GAAAC,OAAA,CAAAD,qBAAA,GAAGE,MAAM,CAAE,uBAAwB,CAAC;;AAEtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,kBAAkBA,CAAEC,KAAK,EAAEC,MAAM,EAAEC,QAAQ,EAAG;EAC7D,IAAIC,OAAO,GAAGF,MAAM;EAEpB,MAAM,CAAEG,UAAU,CAAE,GAAGH,MAAM;EAE7B,IAAKG,UAAU,EAAG;IACjB,MAAMC,cAAc,GAAGH,QAAQ,CAC7BI,MAAM,CAAEC,cAAY,CAAC,CACrBC,YAAY,CAAEJ,UAAU,CAACK,IAAK,CAAC;IAEjC,IAAKJ,cAAc,CAAET,qBAAqB,CAAE,EAAG;MAC9C,MAAM;QAAEc,oBAAoB;QAAEC,YAAY;QAAEC;MAAmB,CAAC,GAC/DV,QAAQ,CAACI,MAAM,CAAEO,YAAiB,CAAC;MACpC,MAAMC,oBAAoB,GAAGJ,oBAAoB,CAChDN,UAAU,CAACW,QACZ,CAAC;MACD,MAAMC,gBAAgB,GAAGL,YAAY,CAAEG,oBAAqB,CAAC;MAE7D,IAAKE,gBAAgB,EAAG;QACvBb,OAAO,GAAG,IAAAc,oBAAW,EACpBD,gBAAgB,EAChBJ,kBAAkB,CAAEE,oBAAqB,CAAC,EAC1CX,OACD,CAAC;MACF;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