UNPKG

@wordpress/block-library

Version:
1 lines • 1.07 kB
{"version":3,"file":"save.mjs","names":[],"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,oBAAC,OAAD;EAAK,GAAK,cAAc,KAAK;EAC5B,UAAA,oBAAC,SAAS,SAAV;GACC,SAAQ;GAIR,OAAQ,OACP,OAAO,WAAW,YAAY,WAC3B,WAAW,UACX,WAAW,QAAQ,aAAc,EACjC,oBAAoB,KACrB,CAAE,CACL;EACA,CAAA;CACG,CAAA;AAEP"}