{"id":228781,"date":"2022-10-20T19:20:00","date_gmt":"2022-10-20T16:20:00","guid":{"rendered":"https:\/\/wordpress.mediadoma.com\/?p=228781"},"modified":"2022-11-09T04:14:54","modified_gmt":"2022-11-09T01:14:54","slug":"formatujte-vmist-publikacii-za-dopomogoju-registerformattype","status":"publish","type":"post","link":"https:\/\/wordpress.mediadoma.com\/uk\/formatujte-vmist-publikacii-za-dopomogoju-registerformattype\/","title":{"rendered":"\u0424\u043e\u0440\u043c\u0430\u0442\u0443\u0439\u0442\u0435 \u0432\u043c\u0456\u0441\u0442 \u043f\u0443\u0431\u043b\u0456\u043a\u0430\u0446\u0456\u0457 \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e registerFormatType"},"content":{"rendered":"\n<p>\u0412\u0438 \u043c\u043e\u0436\u0435\u0442\u0435 \u043b\u0435\u0433\u043a\u043e \u0434\u043e\u0434\u0430\u0442\u0438 \u0432\u043b\u0430\u0441\u043d\u0456 \u043a\u043d\u043e\u043f\u043a\u0438 \u043d\u0430 \u043f\u0430\u043d\u0435\u043b\u044c \u0456\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0456\u0432 WordPress Gutenberg, \u0430\u043b\u0435 \u0447\u0438 \u0437\u043d\u0430\u0454\u0442\u0435 \u0432\u0438, \u0449\u043e \u0442\u0430\u043a\u043e\u0436 \u043c\u043e\u0436\u043d\u0430 \u0434\u043e\u0434\u0430\u0442\u0438 \u0435\u043b\u0435\u043c\u0435\u043d\u0442\u0438 \u043a\u0435\u0440\u0443\u0432\u0430\u043d\u043d\u044f \u0442\u0438\u043f\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0443 \u0432 \u043c\u0435\u043d\u044e \u0444\u043e\u0440\u043c\u0430\u0442\u0443?<\/p>\n<p>\u0423 \u0446\u044c\u043e\u043c\u0443 \u043f\u043e\u0441\u0456\u0431\u043d\u0438\u043a\u0443 \u043c\u0438 \u0440\u043e\u0437\u0433\u043b\u044f\u043d\u0435\u043c\u043e, \u044f\u043a \u0434\u043e\u0434\u0430\u0442\u0438 \u0435\u043b\u0435\u043c\u0435\u043d\u0442 \u043a\u0435\u0440\u0443\u0432\u0430\u043d\u043d\u044f \u0444\u043e\u0440\u043c\u0430\u0442\u0443\u0432\u0430\u043d\u043d\u044f\u043c <code>registerFormatType<\/code>, \u044f\u043a\u0438\u0439 \u0434\u043e\u0437\u0432\u043e\u043b\u0438\u0442\u044c \u043d\u0430\u043c \u0432\u0438\u0431\u0440\u0430\u0442\u0438 \u043a\u043e\u043b\u0456\u0440 \u0432\u0438\u0434\u0456\u043b\u0435\u043d\u043d\u044f \u0432\u0438\u0434\u0456\u043b\u0435\u043d\u043e\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0443 \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u0447\u043d\u043e\u0433\u043e <code>&lt;mark&gt;<\/code>\u0442\u0435\u0433\u0443 HTML.<\/p>\n<p>\u0423\u0432\u0435\u0441\u044c \u043a\u043e\u0434, \u044f\u043a\u0438\u0439 \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u0454\u0442\u044c\u0441\u044f \u0432 \u0446\u044c\u043e\u043c\u0443 \u043f\u0456\u0434\u0440\u0443\u0447\u043d\u0438\u043a\u0443, \u043c\u043e\u0436\u043d\u0430 \u0437\u043d\u0430\u0439\u0442\u0438 \u0432 <strong>\u0431\u0435\u0437\u043a\u043e\u0448\u0442\u043e\u0432\u043d\u043e\u043c\u0443<\/strong> <a href=\"https:\/\/wholesomecode.ltd\/plugins\/highlighter\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">\u043f\u043b\u0430\u0433\u0456\u043d\u0456 Highlighter<\/a>.<\/p>\n<p>\u0412\u0430\u0440\u0442\u043e \u0437\u0430\u0437\u043d\u0430\u0447\u0438\u0442\u0438, \u0449\u043e \u0432\u0438 \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0435 \u043b\u0438\u0448\u0435 \u0437\u0430\u0441\u0442\u043e\u0441\u043e\u0432\u0443\u0432\u0430\u0442\u0438 \u0444\u043e\u0440\u043c\u0430\u0442\u0438 \u0434\u043e \u0432\u0438\u0434\u0456\u043b\u0435\u043d\u043e\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0443 \u0443 \u0432\u0430\u0448\u0438\u0445 \u0431\u043b\u043e\u043a\u0430\u0445, \u0430\u043b\u0435 \u0442\u0430\u043a\u043e\u0436 \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u0432\u0430\u0442\u0438 \u0457\u0445 \u0434\u043b\u044f \u0432\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044f \u0456\u043d\u0448\u0438\u0445 \u043e\u0431&#8217;\u0454\u043a\u0442\u0456\u0432 \u0431\u0435\u0437\u043f\u043e\u0441\u0435\u0440\u0435\u0434\u043d\u044c\u043e \u0432 \u0431\u043b\u043e\u043a\u0438, \u043d\u0430\u043f\u0440\u0438\u043a\u043b\u0430\u0434 \u0432\u0431\u0443\u0434\u043e\u0432\u0430\u043d\u0438\u0445 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u044c \u0456 \u0437\u043d\u0430\u0447\u043a\u0456\u0432.<\/p>\n<p>\u0417\u0430\u0441\u0442\u043e\u0441\u0443\u0432\u0430\u043d\u043d\u044f \u0442\u0438\u043f\u0443 \u0444\u043e\u0440\u043c\u0430\u0442\u0443 \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e \u043f\u043b\u0430\u0433\u0456\u043d\u0430 Highlighter.<\/p>\n<p>\u0423 \u0432\u0456\u0434\u0435\u043e \u0432\u0438\u0449\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043f\u043b\u0430\u0433\u0456\u043d Highlighter \u0456 \u043d\u0430\u0448 \u0442\u0438\u043f \u0444\u043e\u0440\u043c\u0430\u0442\u0443 \u0432 \u0434\u0456\u0457. \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e \u043d\u044c\u043e\u0433\u043e.<\/p>\n<h2>\u043f\u0435\u0440\u0435\u0434\u0443\u043c\u043e\u0432\u0438<\/h2>\n<ul>\n<li>\u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u0456\u0431\u043d\u0438\u043a \u00ab<a href=\"https:\/\/wholesomecode.ltd\/guides\/creating-plugin-wordpress-gutenberg\/\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">\u0421\u0442\u0432\u043e\u0440\u0435\u043d\u043d\u044f \u043f\u043b\u0430\u0433\u0456\u043d\u0430 \u0434\u043b\u044f \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0430 \u0431\u043b\u043e\u043a\u0456\u0432 WordPress\u00bb (Gutenberg)<\/a>, \u0449\u043e\u0431 \u043f\u043e\u0447\u0430\u0442\u0438 \u0441\u0442\u0432\u043e\u0440\u044e\u0432\u0430\u0442\u0438 \u043f\u043b\u0430\u0433\u0456\u043d.<\/li>\n<li>\u0417\u0430 \u0431\u0430\u0436\u0430\u043d\u043d\u044f\u043c <a href=\"https:\/\/wholesomecode.ltd\/plugins\/highlighter\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">\u0437\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0442\u0435 \u0431\u0435\u0437\u043a\u043e\u0448\u0442\u043e\u0432\u043d\u0438\u0439 \u043f\u043b\u0430\u0433\u0456\u043d \u00abHighlighter\u00bb<\/a> \u0456 \u043f\u0435\u0440\u0435\u0433\u043b\u044f\u043d\u044c\u0442\u0435 \u0444\u0430\u0439\u043b<code>\/src\/formats\/highlight.js<\/code><\/li>\n<\/ul>\n<h2>\u041d\u0430\u043b\u0430\u0448\u0442\u0443\u0439\u0442\u0435 \u0444\u0430\u0439\u043b\u0438 \u043f\u043b\u0430\u0433\u0456\u043d\u0456\u0432<\/h2>\n<p>\u042f\u043a\u0449\u043e \u0432\u0438 \u0432\u0438\u043a\u043e\u043d\u0430\u043b\u0438 \u043f\u0435\u0440\u0435\u0434\u0443\u043c\u043e\u0432\u0438 \u0442\u0430 \u0434\u043e\u0442\u0440\u0438\u043c\u0443\u0432\u0430\u043b\u0438\u0441\u044f \u043f\u043e\u0441\u0456\u0431\u043d\u0438\u043a\u0430 \u0437 \u043f\u043b\u0430\u0433\u0456\u043d\u0456\u0432, \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0456\u0431\u043d\u043e \u043f\u0440\u043e\u0434\u043e\u0432\u0436\u0438\u0442\u0438 \u0442\u0430 \u0432\u0438\u0434\u0430\u043b\u0438\u0442\u0438 \u043a\u0443\u043f\u0443 \u0446\u0438\u0445 \u0444\u0430\u0439\u043b\u0456\u0432.<\/p>\n<ul>\n<li>\u0423 \u043f\u0430\u043f\u0446\u0456 src \u0432\u0438\u0434\u0430\u043b\u0456\u0442\u044c \u0443\u0441\u0435, \u043a\u0440\u0456\u043c \u0444\u0430\u0439\u043b\u0456\u0432 <code>index.js<\/code>\u0456 .<code>style.scss<\/code><\/li>\n<li>\u0412\u0438\u0434\u0430\u043b\u0456\u0442\u044c \u0432\u043c\u0456\u0441\u0442 <code>index.js<\/code>\u0456 <code>style.scss<\/code>\u043f\u043e\u0432\u043d\u0456\u0441\u0442\u044e.<\/li>\n<li>\u0423 <code>\/build<\/code>\u043f\u0430\u043f\u0446\u0456 \u0432\u0438\u0434\u0430\u043b\u0438\u0442\u0438 \u0432\u0441\u0456 \u0444\u0430\u0439\u043b\u0438. \u041c\u0438 \u0432\u0456\u0434\u043d\u043e\u0432\u0438\u043c\u043e \u0457\u0445 \u043f\u0456\u0437\u043d\u0456\u0448\u0435.<\/li>\n<li>\u0412\u0438\u0434\u0430\u043b\u0438\u0442\u0438 <code>block.json<\/code>. \u041c\u0438 \u0441\u044c\u043e\u0433\u043e\u0434\u043d\u0456 \u043d\u0435 \u0431\u0443\u0434\u0443\u0454\u043c\u043e \u043a\u0432\u0430\u0440\u0442\u0430\u043b, \u0442\u043e\u043c\u0443 \u043d\u0430\u043c \u0446\u0435 \u043d\u0435 \u043f\u043e\u0442\u0440\u0456\u0431\u043d\u043e.<\/li>\n<\/ul>\n<h3>\u041f\u043e\u0441\u0442\u0430\u0432\u0442\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0456\u0457 \u0432 \u0447\u0435\u0440\u0433\u0443<\/h3>\n<p>\u0423 \u0433\u043e\u043b\u043e\u0432\u043d\u0438\u0439 \u0444\u0430\u0439\u043b \u043f\u043b\u0430\u0433\u0456\u043d\u0430 (<code>wholesome-plugin.php<\/code>\u044f\u043a\u0449\u043e \u0432\u0438 \u0434\u043e\u0441\u043b\u0456\u0432\u043d\u043e \u0434\u043e\u0442\u0440\u0438\u043c\u0443\u0432\u0430\u043b\u0438\u0441\u044f \u043f\u043e\u043f\u0435\u0440\u0435\u0434\u043d\u044c\u043e\u0433\u043e \u043f\u0456\u0434\u0440\u0443\u0447\u043d\u0438\u043a\u0430) \u0434\u043e\u0434\u0430\u0439\u0442\u0435 \u043d\u0430\u0441\u0442\u0443\u043f\u043d\u0438\u0439 \u043a\u043e\u0434, \u0449\u043e\u0431 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u0438 \u0432 \u0447\u0435\u0440\u0433\u0443 JavaScript \u0456 CSS \u0434\u043b\u044f \u0432\u0430\u0448\u043e\u0433\u043e \u043f\u043b\u0430\u0433\u0456\u043d\u0430.<\/p>\n<pre><code>&lt;?php\n\nfunction setup(): void {\n\n    load_plugin_textdomain( 'wholesome-highlighter', false, ROOT_DIR. 'languages' );\n\n    add_action( 'enqueue_block_editor_assets', __NAMESPACE__. 'enqueue_block_editor_assets', 10 );\n\n    add_action( 'enqueue_block_assets', __NAMESPACE__. 'enqueue_block_styles', 10 );\n}\n\nfunction enqueue_block_editor_assets(): void {\n\n    $asset_path = ROOT_DIR. '\/build\/index.asset.php';\n\n    if (! file_exists( $asset_path)) {\n        throw new Error(\n            esc_html__( 'You need to run `npm start` or `npm run build` in the root of the plugin \"wholesome-highlighter\" first.', 'wholesome-highlighter') );\n    }\n\n    $scripts = '\/build\/index.js';\n    $assets  = include $asset_path;\n\n    wp_enqueue_script(\n        PLUGIN_SLUG. '-block-scripts',\n        plugins_url( $scripts, ROOT_FILE ),\n        $assets['dependencies'],\n        $assets['version'],\n        false\n    );\n\n    wp_set_script_translations(\n        PLUGIN_SLUG. '-block-scripts',\n        'wholesome-highlighter',\n        ROOT_DIR. 'languages'\n    );\n}\nadd_action( 'plugins_loaded', __NAMESPACE__. 'setup' );\n\nfunction enqueue_block_styles(): void {\n\n    $styles = '\/build\/style-index.css';\n\n    wp_enqueue_style(\n        PLUGIN_SLUG. '-block-styles',\n        plugins_url( $styles, ROOT_FILE ),\n        array(),\n        filemtime( ROOT_DIR. $styles) );\n}\n\nadd_action( 'plugins_loaded', __NAMESPACE__. 'setup' );\n<\/code><\/pre>\n<ol>\n<li>\u0417\u0430\u0440\u0435\u0454\u0441\u0442\u0440\u0443\u0439\u0442\u0435 \u0442\u0438\u043f \u0444\u043e\u0440\u043c\u0430\u0442\u0443<\/li>\n<\/ol>\n<hr \/>\n<p>\u0412\u0456\u0434\u043a\u0440\u0438\u0439\u0442\u0435 <code>\/src\/index.js<\/code>\u0444\u0430\u0439\u043b \u0456 \u0434\u043e\u0434\u0430\u0439\u0442\u0435 \u043d\u0430\u0441\u0442\u0443\u043f\u043d\u0438\u0439 \u043a\u043e\u0434.<\/p>\n<pre><code>\nimport { RichTextToolbarButton } from '@wordpress\/block-editor';\nimport { __ } from '@wordpress\/i18n';\n\nconst HighlighterButton = ({ isActive, onChange, value}) =&gt; {\n    return (&lt;RichTextToolbarButton\n            icon='edit'\n            isActive={ isActive }\n            title={ __( 'Highlight', 'wholesome-highlighter') }\n        \/&gt;) };\n<\/code><\/pre>\n<p>\u0426\u0435 \u0441\u0442\u0432\u043e\u0440\u044e\u0454 \u043d\u0430\u0448\u0443 \u043a\u043d\u043e\u043f\u043a\u0443 \u0432\u0438\u0434\u0456\u043b\u0435\u043d\u043d\u044f, \u044f\u043a\u0430 \u0437\u2019\u044f\u0432\u0438\u0442\u044c\u0441\u044f \u0432 \u043c\u0435\u043d\u044e \u0444\u043e\u0440\u043c\u0430\u0442\u0443. \u0422\u0435\u043f\u0435\u0440 \u043c\u0438 \u0431\u0443\u0434\u0435\u043c\u043e \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u0432\u0430\u0442\u0438 <code>registerFormatType<\/code>\u0434\u043b\u044f \u0440\u0435\u0454\u0441\u0442\u0440\u0430\u0446\u0456\u0457 \u0444\u043e\u0440\u043c\u0430\u0442\u0443.<\/p>\n<p>\u041f\u043e-\u043f\u0435\u0440\u0448\u0435, \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0456\u0431\u043d\u043e \u0432\u0456\u0434\u0440\u0435\u0434\u0430\u0433\u0443\u0432\u0430\u0442\u0438 \u043d\u0430\u0448 \u0456\u043c\u043f\u043e\u0440\u0442, \u0449\u043e\u0431 \u0442\u0430\u043a\u043e\u0436 \u0456\u043c\u043f\u043e\u0440\u0442\u0443\u0432\u0430\u0442\u0438 <code>registerFormatType<\/code>\u0437 <code>@wordpress\/rich-text<\/code>.<\/p>\n<pre><code>import { registerFormatType, toggleFormat } from '@wordpress\/rich-text';\n<\/code><\/pre>\n<p>\u041f\u043e\u0442\u0456\u043c \u0437\u0430\u0440\u0435\u0454\u0441\u0442\u0440\u0443\u0439\u0442\u0435 \u0444\u043e\u0440\u043c\u0430\u0442, \u0434\u043e\u0434\u0430\u0432\u0448\u0438 \u043d\u0430\u0437\u0432\u0443 \u0444\u043e\u0440\u043c\u0430\u0442\u0443 (<code>wholesome\/highlighter<\/code>) \u0456 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0448\u0438 \u043e\u0431\u2019\u0454\u043a\u0442 \u0456\u0437 \u043d\u0430\u0432\u0435\u0434\u0435\u043d\u0438\u043c\u0438 \u043d\u0438\u0436\u0447\u0435 \u0432\u043b\u0430\u0441\u0442\u0438\u0432\u043e\u0441\u0442\u044f\u043c\u0438. <code>toggleFormat<\/code>\u0431\u0443\u0434\u0435 \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u0430\u043d\u043e \u043f\u0456\u0437\u043d\u0456\u0448\u0435 \u0434\u043b\u044f \u043d\u0430\u0448\u043e\u0457 \u043f\u043e\u0434\u0456\u0457 \u043a\u043b\u0430\u0446\u0430\u043d\u043d\u044f.<\/p>\n<ul>\n<li><code>className<\/code>: \u0456\u043c\u2019\u044f \u043a\u043b\u0430\u0441\u0443, \u044f\u043a\u0435 \u0431\u0443\u0434\u0435 \u0434\u043e\u0434\u0430\u043d\u043e \u0434\u043e \u0442\u0435\u0433\u0443, \u044f\u043a\u0438\u0439 \u043e\u0442\u043e\u0447\u0443\u0454 \u0432\u0438\u0434\u0456\u043b\u0435\u043d\u0438\u0439 \u0442\u0435\u043a\u0441\u0442.<\/li>\n<li><code>edit<\/code>: \u043a\u043d\u043e\u043f\u043a\u0430, \u044f\u043a\u0443 \u043c\u0438 \u0440\u0430\u043d\u0456\u0448\u0435 \u0437\u0430\u0440\u0435\u0454\u0441\u0442\u0440\u0443\u0432\u0430\u043b\u0438.<\/li>\n<li><code>tagName<\/code>: \u0442\u0438\u043f \u0442\u0435\u0433\u0443, \u044f\u043a\u0438\u0439 \u0431\u0443\u0434\u0435 \u0437\u0430\u0441\u0442\u043e\u0441\u043e\u0432\u0430\u043d\u043e \u0434\u043e \u0432\u0438\u0434\u0456\u043b\u0435\u043d\u043e\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0443. \u0423 \u0446\u044c\u043e\u043c\u0443 \u0432\u0438\u043f\u0430\u0434\u043a\u0443 \u043c\u0438 \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u0454\u043c\u043e <code>&lt;mark&gt;<\/code>\u0441\u0435\u043c\u0430\u043d\u0442\u0438\u0447\u043d\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0443 \u0440\u043e\u0437\u043c\u0456\u0442\u043a\u0443 \u0434\u043b\u044f \u0432\u0438\u0434\u0456\u043b\u0435\u043d\u043d\u044f \u0442\u0435\u043a\u0441\u0442\u0443.<\/li>\n<li><code>title<\/code>: \u041d\u0430\u0437\u0432\u0430 \u0444\u043e\u0440\u043c\u0430\u0442\u0443.<\/li>\n<\/ul>\n<pre><code>\nregisterFormatType(\n    'wholesome\/highlighter', {\n        className: 'wholesome-highlight',\n        edit: HighlighterButton,\n        tagName: 'mark',\n        title: __( 'Highlight', 'wholesome-highlighter' ),\n    }\n);\n<\/code><\/pre>\n<h3>\u041e\u0431\u0440\u043e\u0431\u043a\u0430 \u043a\u043b\u0430\u0446\u0430\u043d\u043d\u044f<\/h3>\n<p>\u0422\u0435\u043f\u0435\u0440, \u043a\u043e\u043b\u0438 \u043c\u0438 \u0434\u043e\u0434\u0430\u043b\u0438 \u043a\u043d\u043e\u043f\u043a\u0443 \u0434\u043e \u043c\u0435\u043d\u044e \u0444\u043e\u0440\u043c\u0430\u0442\u0443\u0432\u0430\u043d\u043d\u044f, \u0432\u0441\u0435, \u0449\u043e \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0456\u0431\u043d\u043e \u0437\u0440\u043e\u0431\u0438\u0442\u0438, \u0446\u0435 \u043e\u0431\u0440\u043e\u0431\u0438\u0442\u0438 \u043f\u043e\u0434\u0456\u044e \u043a\u043b\u0430\u0446\u0430\u043d\u043d\u044f.<\/p>\n<p><a href=\"https:\/\/wordpress.mediadoma.com\/wp-content\/uploads\/2022\/01\/post-168405-61e7cb11d77e2.png\" data-rel=\"lightbox\"><img decoding=\"async\" class=\"SDStudio-light-box-enable SDStudio-editor-tools-md-imp\" src=\"https:\/\/wordpress.mediadoma.com\/wp-content\/uploads\/2022\/01\/post-168405-61e7cb11d77e2.png\" alt=\"\u0424\u043e\u0440\u043c\u0430\u0442\u0443\u0439\u0442\u0435 \u0432\u043c\u0456\u0441\u0442 \u043f\u0443\u0431\u043b\u0456\u043a\u0430\u0446\u0456\u0457 \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e registerFormatType\" ><\/a><\/p>\n<p>\u0412\u0456\u0434\u0440\u0435\u0434\u0430\u0433\u0443\u0439\u0442\u0435 <code>RichTextToolbarButton<\/code>\u0442\u0430 \u0434\u043e\u0434\u0430\u0439\u0442\u0435 <code>onClick<\/code>\u043f\u043e\u0434\u0456\u044e.<\/p>\n<pre><code>&lt;RichTextToolbarButton\n  icon='edit'\n  isActive={ isActive }\n  onClick={() =&gt; {\n    onChange(\n      toggleFormat( value, {\n        type: 'wholesome\/highlighter',\n      }) );\n  } }\n  title={ __( 'Highlight', 'wholesome-highlighter') }\n\/&gt;\n<\/code><\/pre>\n<p>\u041d\u0430 \u0442\u0440\u0438\u0433\u0435\u0440\u0456 \u043c\u0438 \u0432\u0438\u043a\u043b\u0438\u043a\u0430\u0454\u043c\u043e <code>toggleFormat<\/code>\u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044f (\u044f\u043a\u0435 \u0454 \u0432\u0438\u0434\u0456\u043b\u0435\u043d\u0438\u043c \u0442\u0435\u043a\u0441\u0442\u043e\u043c) \u0456 \u043f\u0435\u0440\u0435\u0434\u0430\u0454\u043c\u043e \u043e\u0431\u2019\u0454\u043a\u0442 \u0456\u0437 <code>type<\/code>\u0432\u043b\u0430\u0441\u0442\u0438\u0432\u0456\u0441\u0442\u044e, \u0432\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e\u044e \u0434\u043b\u044f \u0456\u043c\u0435\u043d\u0456 \u043d\u0430\u0448\u043e\u0433\u043e \u0444\u043e\u0440\u043c\u0430\u0442\u0443.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440, \u043a\u043e\u043b\u0438 \u043a\u043d\u043e\u043f\u043a\u0443 \u043d\u0430\u0442\u0438\u0441\u043d\u0443\u0442\u0438 \u0441\u043f\u043e\u0447\u0430\u0442\u043a\u0443, <code>&lt;mark&gt;<\/code>\u0434\u043e \u0432\u0438\u0434\u0456\u043b\u0435\u043d\u043e\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0443 \u0431\u0443\u0434\u0435 \u0437\u0430\u0441\u0442\u043e\u0441\u043e\u0432\u0430\u043d\u043e \u0442\u0435\u0433 HTML, \u0430 \u043f\u0440\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u043c\u0443 \u043d\u0430\u0442\u0438\u0441\u043a\u0430\u043d\u043d\u0456 \u0432\u0456\u043d \u043f\u0435\u0440\u0435\u043c\u043a\u043d\u0435 \u0444\u043e\u0440\u043c\u0430\u0442, \u0437\u043d\u043e\u0432\u0443 \u0432\u0438\u0434\u0430\u043b\u0438\u0432\u0448\u0438 \u0439\u043e\u0433\u043e.<\/p>\n<p>\u0429\u043e\u0431 \u043f\u0435\u0440\u0435\u0433\u043b\u044f\u043d\u0443\u0442\u0438 \u043a\u043e\u0434 \u043f\u043e\u0432\u043d\u0456\u0441\u0442\u044e \u0442\u0430 \u043f\u0435\u0440\u0435\u0433\u043b\u044f\u043d\u0443\u0442\u0438 \u043e\u0441\u0442\u0430\u043d\u043d\u0456 \u043e\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044f <a href=\"https:\/\/github.com\/wholesomecode\/wholesome-highlighter\/blob\/master\/src\/formats\/highlight.js\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">, \u043f\u0435\u0440\u0435\u0433\u043b\u044f\u043d\u044c\u0442\u0435 \u043f\u043e\u0432\u043d\u0438\u0439 <code>\/src\/formats\/highlight.js<\/code>\u0444\u0430\u0439\u043b \u0443 \u043f\u043b\u0430\u0433\u0456\u043d\u0456 Highlighter<\/a>.<\/p>\n<p>\u041d\u0430\u0432\u0435\u0434\u0435\u043d\u0438\u0439 \u0432\u0438\u0449\u0435 \u043a\u043e\u0434 \u0437\u0430\u0440\u0435\u0454\u0441\u0442\u0440\u0443\u0454 \u0431\u043b\u043e\u043a \u0434\u043b\u044f \u0432\u0441\u0456\u0445 \u0442\u0438\u043f\u0456\u0432 \u0431\u043b\u043e\u043a\u0456\u0432. \u041e\u0434\u043d\u0430\u043a, \u044f\u043a\u0449\u043e \u0432\u0438 \u0445\u043e\u0447\u0435\u0442\u0435, \u0449\u043e\u0431 \u0431\u043b\u043e\u043a \u0437\u2019\u044f\u0432\u043b\u044f\u0432\u0441\u044f \u043b\u0438\u0448\u0435 \u043d\u0430 \u043f\u0435\u0432\u043d\u0438\u0445 \u0442\u0438\u043f\u0430\u0445 \u0431\u043b\u043e\u043a\u0456\u0432, \u0446\u0435 \u0442\u0430\u043a\u043e\u0436 \u043c\u043e\u0436\u043d\u0430 \u0437\u0440\u043e\u0431\u0438\u0442\u0438.<\/p>\n<p>\u0414\u043b\u044f \u0446\u044c\u043e\u0433\u043e \u043d\u0430\u043c \u0437\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u0432\u0430\u0442\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0432\u0438\u0449\u043e\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443 ifCondition \u0456 \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u0432\u0430\u0442\u0438 Select, \u0449\u043e\u0431 \u0432\u0438\u0437\u043d\u0430\u0447\u0438\u0442\u0438 \u0442\u0438\u043f \u0431\u043b\u043e\u043a\u0443, \u044f\u043a\u0438\u0439 \u043c\u0438 \u0432\u0438\u0431\u0440\u0430\u043b\u0438.<\/p>\n<p>\u0414\u043b\u044f \u0446\u044c\u043e\u0433\u043e \u0434\u043e\u0434\u0430\u0439\u0442\u0435 \u043d\u0430\u0432\u0435\u0434\u0435\u043d\u0456 \u043d\u0438\u0436\u0447\u0435 \u0456\u043c\u043f\u043e\u0440\u0442\u043e\u0432\u0430\u043d\u0456 \u0444\u0430\u0439\u043b\u0438.<\/p>\n<pre><code>import { ifCondition  } from '@wordpress\/compose';\nimport { useSelect } from '@wordpress\/data';\n<\/code><\/pre>\n<p>\u041d\u0430\u0434 <code>registerFormatType<\/code>\u0431\u043b\u043e\u043a\u043e\u043c \u043a\u043e\u0434\u0443 \u0434\u043e\u0434\u0430\u0439\u0442\u0435 \u043d\u0430\u0441\u0442\u0443\u043f\u043d\u0438\u0439 \u0431\u043b\u043e\u043a \u043a\u043e\u0434\u0443 \u0434\u043b\u044f \u0441\u0442\u0432\u043e\u0440\u0435\u043d\u043d\u044f.<\/p>\n<pre><code>\nvar HighlighterButtonContainer = ifCondition( (props) =&gt; {\n    const selectedBlock = useSelect( (select) =&gt; select('core\/block-editor').getSelectedBlock() );\n    return (selectedBlock &amp;&amp;\n        selectedBlock.name === 'core\/paragraph'\n    ); \n} )( HighlighterButton );\n<\/code><\/pre>\n<p>\u042f\u043a \u0432\u0438 \u043c\u043e\u0436\u0435\u0442\u0435 \u0431\u0430\u0447\u0438\u0442\u0438 \u0437 \u043a\u043e\u0434\u0443, \u044f\u043a\u0449\u043e \u0432\u0438\u0431\u0440\u0430\u043d\u0438\u0439 \u0431\u043b\u043e\u043a \u0454 <code>core\/paragraph<\/code>\u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u043c \u0432\u0438\u0449\u043e\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443 <code>ifCondition<\/code>, \u0432\u0456\u043d \u043f\u043e\u0432\u0435\u0440\u043d\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044f true, \u0430 \u043e\u0442\u0436\u0435, \u0434\u043e\u0437\u0432\u043e\u043b\u0438\u0442\u044c \u0432\u0456\u0434\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u0438 \u043a\u043d\u043e\u043f\u043a\u0443.<\/p>\n<p>\u0412\u0441\u0435, \u0449\u043e \u043d\u0430\u043c \u0437\u0430\u0440\u0430\u0437 \u043f\u043e\u0442\u0440\u0456\u0431\u043d\u043e \u0437\u0440\u043e\u0431\u0438\u0442\u0438, \u0446\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u0438 \u041a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440, \u044f\u043a\u0438\u0439 \u043c\u0438 \u0449\u043e\u0439\u043d\u043e \u0441\u0442\u0432\u043e\u0440\u0438\u043b\u0438, \u0443 <code>registerBlockType<\/code>\u0431\u043b\u043e\u043a \u043a\u043e\u0434\u0443, \u0456 \u043d\u0430\u0448 \u043a\u043e\u0434 \u0433\u043e\u0442\u043e\u0432\u0438\u0439.<\/p>\n<pre><code>\nregisterFormatType(\n    'wholesome\/highlighter', {\n        className: 'wholesome-highlight',\n        edit: HighlighterButtonContainer,\n        tagName: 'mark',\n        title: __( 'Highlight', 'wholesome-highlighter' ),\n    }\n);\n<\/code><\/pre>\n<p>\u0429\u043e\u0431 \u043f\u0435\u0440\u0435\u0433\u043b\u044f\u043d\u0443\u0442\u0438 \u043a\u043e\u0434 \u043f\u043e\u0432\u043d\u0456\u0441\u0442\u044e <a href=\"https:\/\/github.com\/wholesomecode\/wholesome-highlighter\/blob\/master\/src\/formats\/highlight-paragraph.js\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">, \u043f\u043e\u0434\u0438\u0432\u0456\u0442\u044c\u0441\u044f \u043d\u0430 <code>\/src\/formats\/highlight-paragraph.js<\/code>\u0444\u0430\u0439\u043b \u0443 \u043f\u043b\u0430\u0433\u0456\u043d\u0456 Highlighter<\/a>.<\/p>\n<ul>\n<li>\u0420\u043e\u0437\u0432\u0438\u0432\u0430\u0439\u0442\u0435 \u0440\u0435\u0447\u0456 \u0434\u0430\u043b\u0456, <a href=\"https:\/\/wholesomecode.ltd\/blog\/use-a-modal-popup-to-add-additional-attributes-with-registerblockformat\/\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">\u0434\u043e\u0434\u0430\u044e\u0447\u0438 \u0432\u043b\u0430\u0441\u043d\u0456 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0438 \u0434\u043e \u0441\u0432\u043e\u0433\u043e \u0441\u043f\u0435\u0446\u0456\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0444\u043e\u0440\u043c\u0430\u0442\u0443 \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e \u043c\u043e\u0434\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u043f\u043b\u0438\u0432\u043d\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0433\u043b\u044f\u0434\u0443<\/a>.<\/li>\n<li><a href=\"https:\/\/wholesomecode.ltd\/guides\/add-sidebar-controls-to-your-custom-wordpress-block-with-inspectorcontrols\/\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">\u0414\u043e\u0434\u0430\u0439\u0442\u0435 \u0431\u0456\u0447\u043d\u0443 \u043f\u0430\u043d\u0435\u043b\u044c \u0431\u043b\u043e\u043a\u0443 \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e InspectorControls<\/a><\/li>\n<li>\u041f\u043e\u0434\u0438\u0432\u0456\u0442\u044c\u0441\u044f \u043d\u0430 \u0441\u0442\u0432\u043e\u0440\u0435\u043d\u043d\u044f <a href=\"https:\/\/wholesomecode.ltd\/guides\/create-settings-page-wordpress-gutenberg-components\/\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">\u0441\u0442\u043e\u0440\u0456\u043d\u043a\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0456\u0432 \u0456 \u043d\u0430\u043b\u0430\u0448\u0442\u0443\u0432\u0430\u043d\u044c \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0456\u0432 Gutenberg<\/a><\/li>\n<\/ul>\n<p><div id=\"PostUnique_PostSource\" style=\"padding-top: 50px\">\u0414\u0436\u0435\u0440\u0435\u043b\u043e \u0437\u0430\u043f\u0438\u0441\u0443:  <a target=\"_blank\" rel=\"noopener nofollow\" href=\"\/\/wholesomecode.ltd\" class=\"external external_icon\">wholesomecode.ltd<\/a><\/div><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0412\u0438 \u043c\u043e\u0436\u0435\u0442\u0435 \u043b\u0435\u0433\u043a\u043e \u0434\u043e\u0434\u0430\u0442\u0438 \u0432\u043b\u0430\u0441\u043d\u0456 \u043a\u043d\u043e\u043f\u043a\u0438 \u043d\u0430 \u043f\u0430\u043d\u0435\u043b\u044c \u0456\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0456\u0432 \u0443 WordPress Gutenberg, \u0430\u043b\u0435 \u0447\u0438 \u0437\u043d\u0430\u0454\u0442\u0435 \u0432\u0438, \u0449\u043e \u0442\u0430\u043a\u043e\u0436 \u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u043e\u0434\u0430\u0442\u0438 \u0435\u043b\u0435\u043c\u0435\u043d\u0442\u0438 \u043a\u0435\u0440\u0443\u0432\u0430\u043d\u043d\u044f \u0442\u0438\u043f\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0443 \u0434\u043e \u043c\u0435\u043d\u044e \u0444\u043e\u0440\u043c\u0430\u0442\u0443? \u0423 \u0446\u044c\u043e\u043c\u0443 \u043f\u043e\u0441\u0456\u0431\u043d\u0438\u043a\u0443 \u043c\u0438 \u0437\u0431\u0438\u0440\u0430\u0454\u043c\u043e\u0441\u044f&#8230;<\/p>\n","protected":false},"author":1,"featured_media":221122,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_wp_rev_ctl_limit":""},"categories":[756,902,849,923,725],"tags":[1174],"class_list":["post-228781","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-vidkryte-dzherelo","category-kod-3","category-pidruchnyky","category-inshyj","category-rozrobnyk","tag-affiai-uk"],"_links":{"self":[{"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/posts\/228781","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/comments?post=228781"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/posts\/228781\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/media\/221122"}],"wp:attachment":[{"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/media?parent=228781"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/categories?post=228781"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/tags?post=228781"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}