UNPKG

@wordpress/block-library

Version:
8 lines (7 loc) 1.22 kB
{ "version": 3, "sources": ["../../src/code/save.js"], "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { RichText, useBlockProps } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { escape } from './utils';\n\nexport default function save( { attributes } ) {\n\treturn (\n\t\t<pre { ...useBlockProps.save() }>\n\t\t\t<RichText.Content\n\t\t\t\ttagName=\"code\"\n\t\t\t\t// To do: `escape` encodes characters in shortcodes and URLs to\n\t\t\t\t// prevent embedding in PHP. Ideally checks for the code block,\n\t\t\t\t// or pre/code tags, should be made on the PHP side?\n\t\t\t\tvalue={ escape(\n\t\t\t\t\ttypeof attributes.content === 'string'\n\t\t\t\t\t\t? attributes.content\n\t\t\t\t\t\t: attributes.content.toHTMLString( {\n\t\t\t\t\t\t\t\tpreserveWhiteSpace: true,\n\t\t\t\t\t\t } )\n\t\t\t\t) }\n\t\t\t/>\n\t\t</pre>\n\t);\n}\n"], "mappings": ";AAGA,SAAS,UAAU,qBAAqB;AAKxC,SAAS,cAAc;AAKpB;AAHY,SAAR,KAAuB,EAAE,WAAW,GAAI;AAC9C,SACC,oBAAC,SAAM,GAAG,cAAc,KAAK,GAC5B;AAAA,IAAC,SAAS;AAAA,IAAT;AAAA,MACA,SAAQ;AAAA,MAIR,OAAQ;AAAA,QACP,OAAO,WAAW,YAAY,WAC3B,WAAW,UACX,WAAW,QAAQ,aAAc;AAAA,UACjC,oBAAoB;AAAA,QACpB,CAAE;AAAA,MACN;AAAA;AAAA,EACD,GACD;AAEF;", "names": [] }