UNPKG

@wordpress/block-library

Version:
1 lines • 1.19 kB
{"version":3,"file":"save.cjs","names":["useBlockProps","RichText","escape"],"sources":["../../src/code/save.jsx"],"sourcesContent":["import { RichText, useBlockProps } from '@wordpress/block-editor';\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\t} )\n\t\t\t\t) }\n\t\t\t/>\n\t\t</pre>\n\t);\n}\n"],"mappings":";;;;;;;;;AAGA,SAAwB,KAAM,EAAE,cAAe;CAC9C,OACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EAAK,GAAKA,wBAAAA,cAAc,KAAK;EAC5B,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,wBAAAA,SAAS,SAAV;GACC,SAAQ;GAIR,QAAA,GAAQC,WAAAA,OAAAA,CACP,OAAO,WAAW,YAAY,WAC3B,WAAW,UACX,WAAW,QAAQ,aAAc,EACjC,oBAAoB,KACrB,CAAE,CACL;EACA,CAAA;CACG,CAAA;AAEP"}