UNPKG

4.54 kBSource Map (JSON)View Raw
1{"version":3,"sources":["@wordpress/block-library/src/shortcode/index.js"],"names":["name","settings","title","description","icon","category","attributes","text","type","source","transforms","from","tag","shortcode","attrs","content","priority","supports","customClassName","className","html","edit","setAttributes","instanceId","inputId","save"],"mappings":";;;;;;;AAIA;;AADA;;AAEA;;AACA;;AACA;;AACA;;AARA;;;AAUO,IAAMA,IAAI,GAAG,gBAAb;;AAEA,IAAMC,QAAQ,GAAG;AACvBC,EAAAA,KAAK,EAAE,cAAI,WAAJ,CADgB;AAGvBC,EAAAA,WAAW,EAAE,cAAI,+DAAJ,CAHU;AAKvBC,EAAAA,IAAI,EAAE,4BAAC,eAAD;AAAK,IAAA,OAAO,EAAC,WAAb;AAAyB,IAAA,KAAK,EAAC;AAA/B,KAA4D,4BAAC,gBAAD;AAAM,IAAA,CAAC,EAAC;AAAR,IAA5D,CALiB;AAOvBC,EAAAA,QAAQ,EAAE,SAPa;AASvBC,EAAAA,UAAU,EAAE;AACXC,IAAAA,IAAI,EAAE;AACLC,MAAAA,IAAI,EAAE,QADD;AAELC,MAAAA,MAAM,EAAE;AAFH;AADK,GATW;AAgBvBC,EAAAA,UAAU,EAAE;AACXC,IAAAA,IAAI,EAAE,CACL;AACCH,MAAAA,IAAI,EAAE,WADP;AAEC;AACA;AACA;AACA;AACA;AACA;AACA;AACAI,MAAAA,GAAG,EAAE,kBATN;AAUCN,MAAAA,UAAU,EAAE;AACXC,QAAAA,IAAI,EAAE;AACLC,UAAAA,IAAI,EAAE,QADD;AAELK,UAAAA,SAAS,EAAE,mBAAEC,KAAF,QAA0B;AAAA,gBAAfC,OAAe,QAAfA,OAAe;AACpC,mBAAO,oBAAS,kBAAOA,OAAP,CAAT,CAAP;AACA;AAJI;AADK,OAVb;AAkBCC,MAAAA,QAAQ,EAAE;AAlBX,KADK;AADK,GAhBW;AAyCvBC,EAAAA,QAAQ,EAAE;AACTC,IAAAA,eAAe,EAAE,KADR;AAETC,IAAAA,SAAS,EAAE,KAFF;AAGTC,IAAAA,IAAI,EAAE;AAHG,GAzCa;AA+CvBC,EAAAA,IAAI,EAAE,6BACL,iBAAiD;AAAA,QAA7Cf,UAA6C,SAA7CA,UAA6C;AAAA,QAAjCgB,aAAiC,SAAjCA,aAAiC;AAAA,QAAlBC,UAAkB,SAAlBA,UAAkB;AAChD,QAAMC,OAAO,oCAA8BD,UAA9B,CAAb;AAEA,WACC;AAAK,MAAA,SAAS,EAAC;AAAf,OACC;AAAO,MAAA,OAAO,EAAGC;AAAjB,OACC,4BAAC,oBAAD;AAAU,MAAA,IAAI,EAAC;AAAf,MADD,EAEG,cAAI,WAAJ,CAFH,CADD,EAKC,4BAAC,sBAAD;AACC,MAAA,SAAS,EAAC,eADX;AAEC,MAAA,EAAE,EAAGA,OAFN;AAGC,MAAA,KAAK,EAAGlB,UAAU,CAACC,IAHpB;AAIC,MAAA,WAAW,EAAG,cAAI,uBAAJ,CAJf;AAKC,MAAA,QAAQ,EAAG,kBAAEA,IAAF;AAAA,eAAYe,aAAa,CAAE;AAAEf,UAAAA,IAAI,EAAJA;AAAF,SAAF,CAAzB;AAAA;AALZ,MALD,CADD;AAeA,GAnBI,CA/CiB;AAqEvBkB,EAAAA,IArEuB,uBAqEA;AAAA,QAAfnB,UAAe,SAAfA,UAAe;AACtB,WAAO,4BAAC,gBAAD,QAAWA,UAAU,CAACC,IAAtB,CAAP;AACA;AAvEsB,CAAjB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { removep, autop } from '@wordpress/autop';\nimport { RawHTML } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Dashicon, SVG, Path } from '@wordpress/components';\nimport { PlainText } from '@wordpress/block-editor';\nimport { withInstanceId } from '@wordpress/compose';\n\nexport const name = 'core/shortcode';\n\nexport const settings = {\n\ttitle: __( 'Shortcode' ),\n\n\tdescription: __( 'Insert additional custom elements with a WordPress shortcode.' ),\n\n\ticon: <SVG viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><Path d=\"M8.5,21.4l1.9,0.5l5.2-19.3l-1.9-0.5L8.5,21.4z M3,19h4v-2H5V7h2V5H3V19z M17,5v2h2v10h-2v2h4V5H17z\" /></SVG>,\n\n\tcategory: 'widgets',\n\n\tattributes: {\n\t\ttext: {\n\t\t\ttype: 'string',\n\t\t\tsource: 'html',\n\t\t},\n\t},\n\n\ttransforms: {\n\t\tfrom: [\n\t\t\t{\n\t\t\t\ttype: 'shortcode',\n\t\t\t\t// Per \"Shortcode names should be all lowercase and use all\n\t\t\t\t// letters, but numbers and underscores should work fine too.\n\t\t\t\t// Be wary of using hyphens (dashes), you'll be better off not\n\t\t\t\t// using them.\" in https://codex.wordpress.org/Shortcode_API\n\t\t\t\t// Require that the first character be a letter. This notably\n\t\t\t\t// prevents footnote markings ([1]) from being caught as\n\t\t\t\t// shortcodes.\n\t\t\t\ttag: '[a-z][a-z0-9_-]*',\n\t\t\t\tattributes: {\n\t\t\t\t\ttext: {\n\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\tshortcode: ( attrs, { content } ) => {\n\t\t\t\t\t\t\treturn removep( autop( content ) );\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tpriority: 20,\n\t\t\t},\n\t\t],\n\t},\n\n\tsupports: {\n\t\tcustomClassName: false,\n\t\tclassName: false,\n\t\thtml: false,\n\t},\n\n\tedit: withInstanceId(\n\t\t( { attributes, setAttributes, instanceId } ) => {\n\t\t\tconst inputId = `blocks-shortcode-input-${ instanceId }`;\n\n\t\t\treturn (\n\t\t\t\t<div className=\"wp-block-shortcode\">\n\t\t\t\t\t<label htmlFor={ inputId }>\n\t\t\t\t\t\t<Dashicon icon=\"shortcode\" />\n\t\t\t\t\t\t{ __( 'Shortcode' ) }\n\t\t\t\t\t</label>\n\t\t\t\t\t<PlainText\n\t\t\t\t\t\tclassName=\"input-control\"\n\t\t\t\t\t\tid={ inputId }\n\t\t\t\t\t\tvalue={ attributes.text }\n\t\t\t\t\t\tplaceholder={ __( 'Write shortcode here…' ) }\n\t\t\t\t\t\tonChange={ ( text ) => setAttributes( { text } ) }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\t),\n\n\tsave( { attributes } ) {\n\t\treturn <RawHTML>{ attributes.text }</RawHTML>;\n\t},\n};\n"]}
\No newline at end of file