diff --git a/src/components/ItaliaTheme/manage/Widgets/SimpleTextEditorWidget.jsx b/src/components/ItaliaTheme/manage/Widgets/SimpleTextEditorWidget.jsx new file mode 100644 index 000000000..10b8e98b1 --- /dev/null +++ b/src/components/ItaliaTheme/manage/Widgets/SimpleTextEditorWidget.jsx @@ -0,0 +1,102 @@ +/** + * Edit simple text block. + * @module components/Widgets/SimpleTextEditorWidget/SimpleTextEditorWidget + * + * E' un editor di testo da mettere nei blocchi, senza formattazione. + */ + +import React from 'react'; +import { connect } from 'react-redux'; +import PropTypes from 'prop-types'; +import { defineMessages, useIntl } from 'react-intl'; +import { useInView } from 'react-intersection-observer'; + +import { handleKeyDetached } from '@plone/volto-slate/blocks/Text/keyboard'; +import { + uploadContent, + saveSlateBlockSelection, +} from '@plone/volto-slate/actions'; +import { commonSearchBlockMessages } from '../../../../helpers'; +import config from '@plone/volto/registry'; + +const messages = defineMessages({ + text: { + id: 'Type text…', + defaultMessage: 'Type text…', + }, +}); + +const SimpleTextEditorWidget = (props) => { + const intl = useIntl(); + const { + data, + setSelected, + onSelectBlock, + onChangeBlock, + block, + value, + selected, + placeholder, + } = props; + const { ref, inView } = useInView({ + threshold: 0, + rootMargin: '0px 0px 200px 0px', + }); + + const handleKey = (event) => { + const { slate } = config.settings; + + const handlers = slate.textblockDetachedKeyboardHandlers[event.key]; + + if (handlers) { + // a handler can return `true` to signify it has handled the event in this + // case, the execution flow is stopped + const handlerProps = { getBlockProps: () => props }; + return handlers.find((handler) => + handler({ editor: handlerProps, event }), + ); + } + }; + + return ( +
+