From 3a0ac64d3cc056b02b6a175fcc71c471d0676502 Mon Sep 17 00:00:00 2001 From: Alquen Antonio Sarmiento Date: Thu, 28 Nov 2024 12:59:09 +0800 Subject: [PATCH] fix(text): only use the custom onPaste (for pasting block) when text is the default block and the current text is empty --- src/block/text/edit.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/block/text/edit.js b/src/block/text/edit.js index 84ad8c26c..b14552f01 100644 --- a/src/block/text/edit.js +++ b/src/block/text/edit.js @@ -22,7 +22,11 @@ import { ConditionalDisplay, Transform, } from '~stackable/block-components' -import { version as VERSION, i18n } from 'stackable' +import { + version as VERSION, + i18n, + settings, +} from 'stackable' import classnames from 'classnames' import { InspectorTabs, @@ -144,7 +148,8 @@ const Edit = props => { onMerge={ mergeBlocks } onRemove={ onRemove } onReplace={ onReplace } - onPaste={ onPaste } + // Only use the custom onPaste (for pasting block) when text is the default block and the current text is empty + onPaste={ settings.stackable_enable_text_default_block && props.attributes.text === '' ? onPaste : undefined } /> { props.isHovered && }