{"id":30611,"date":"2024-11-25T11:23:04","date_gmt":"2024-11-25T03:23:04","guid":{"rendered":"https:\/\/fwq.ai\/blog\/30611\/"},"modified":"2024-11-25T11:23:04","modified_gmt":"2024-11-25T03:23:04","slug":"dedecms-5-7%e4%bb%a3%e7%a0%81%e9%ab%98%e4%ba%ae%e6%80%8e%e4%b9%88%e5%ae%9e%e7%8e%b0","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/30611\/","title":{"rendered":"DedeCms 5.7\u4ee3\u7801\u9ad8\u4eae\u600e\u4e48\u5b9e\u73b0"},"content":{"rendered":"<p style=\"text-align: center\"><strong><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/020\/5e0411a345a26141.jpg\" class=\"aligncenter\" title=\"DedeCms 5.7\u4ee3\u7801\u9ad8\u4eae\u600e\u4e48\u5b9e\u73b0\u63d2\u56fe\" alt=\"DedeCms 5.7\u4ee3\u7801\u9ad8\u4eae\u600e\u4e48\u5b9e\u73b0\u63d2\u56fe\" \/><\/strong><\/p>\n<p><strong> 5.7\u4ee3\u7801\u9ad8\u4eae\u600e\u4e48\u5b9e\u73b0\uff1f<\/strong><\/p>\n<p>\u65e0\u8bba\u5efa\u535a\u5ba2\u7f51\u7ad9\u8fd8\u662fCMS\u7c7b\u578b\u7f51\u7ad9\uff0c\u5f88\u591a\u90fd\u9700\u8981\u4ee3\u7801\u9ad8\u4eae\uff0c\u7ec7\u68a6CMS\u662f\u56fd\u5185\u6bd4\u8f83\u4f18\u79c0\u7684CMS\u5efa\u7ad9\u7cfb\u7edf\u4e4b\u4e00\uff0c\u4e0d\u50cfWordpress\u4e00\u6837\u6709\u5927\u628a\u5927\u628a\u7684\u63d2\u4ef6\u53ef\u7528\uff0c\u6211\u7528\u7684\u662f\u6700\u65b0\u7684dedeCMS 5.7\uff0c\u5728\u7f51\u4e0a\u641c\u4e86\u5f88\u957f\u65f6\u95f4\u8d44\u6599\uff0c\u5927\u90fd\u5199\u7684\u662fCKEditor\u548cSyntaxHighlighter\u6574\u5408\u7684\u6587\u7ae0\uff0c\u4f46\u662fdedecms\u5c06ckeditor\u505a\u4e86\u96c6\u6210\uff0c\u548c\u4e00\u822c\u7684\u53ea\u9488\u5bf9\u4e8eckeditor\u5bf9config.js\u4fee\u6539\u4e0d\u540c\u3002<\/p>\n<p>\u63a8\u8350\u5b66\u4e60\uff1a<\/p>\n<p>\u6240\u4ee5\u53ea\u80fd\u81ea\u5df1\u7422\u78e8\u4fee\u6539\u4e86\uff0c\u73b0\u5c06\u65b9\u6cd5\u5199\u51fa\u4f9b\u7ad9\u957f\u670b\u53cb\u4eec\u53c2\u8003\uff1a&nbsp;<\/p>\n<p>\u4e00\u3001\u9996\u5148\u53bbSyntaxHighlighter\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\uff0c\u7f51\u5740\uff1ahttp:\/\/alexgorbatchev.com\/SyntaxHighlighter\/download\/\uff0c\u5efa\u8bae\u4e0b\u8f7d2.1\u7248\u672c\uff0c3.0\u7248\u672c\u7684\u8c8c\u4f3c\u4e0d\u652f\u6301\u81ea\u52a8\u6362\u884c\uff0c\u8fd9\u91cc\u4f7f\u7528\u7684\u662f2.1.382\u7248\u672c\u3002\u5c06\u4e0b\u8f7d\u7684\u6587\u4ef6\u89e3\u538b\u5728syntaxHighlight\u6587\u4ef6\u5939\u91cc\uff0c\u53bb\u9664\u91cc\u9762\u65e0\u7528\u7684\u6587\u4ef6\uff0c\u53ea\u7559\u4e0bscripts\u548cstyles\u6587\u4ef6\u5939\u3002&nbsp;<\/p>\n<p>\u4e8c\u3001\u65b0\u5efadialogs\u6587\u4ef6\u5939\uff0c\u5728\u91cc\u9762\u65b0\u5efa\u4e00\u4e2a\u540d\u4e3asyntaxhighlight.js\u7684\u6587\u4ef6\uff0c\u56e0\u4ee3\u7801\u91cf\u8fc7\u5927\uff0c\u4e0d\u5b9c\u8d34\u51fa\uff0c\u8bf7\u76f4\u63a5\u4e0b\u8f7dsyntaxhighlight.js&nbsp;<\/p>\n<p>\u5982\u679c\u60f3\u4fee\u6539\u4ee3\u7801\u533a\u57df\u7684\u6837\u5f0f\u8bf7\u5728\u4ee5\u4e0b\u4ee3\u7801\u5904\u4fee\u6539<\/p>\n<p>\u4ee3\u7801\u5982\u4e0b:<\/p>\n<pre>onOk&nbsp;:&nbsp;function()&nbsp;{&nbsp;\nvar&nbsp;i&nbsp;=&nbsp;this.getParentEditor();&nbsp;\nvar&nbsp;h&nbsp;=&nbsp;i.getSelection();&nbsp;\nvar&nbsp;g&nbsp;=&nbsp;h.getStartElement();&nbsp;\nvar&nbsp;l&nbsp;=&nbsp;g&nbsp;&amp;amp;&amp;amp;&nbsp;g.getAscendant(\"pre\",&nbsp;true);&nbsp;\nvar&nbsp;j&nbsp;=&nbsp;f();&nbsp;\nthis.commitContent(j);&nbsp;\nvar&nbsp;k&nbsp;=&nbsp;e(j);&nbsp;\nvar&nbsp;m&nbsp;=&nbsp;CKEDITOR.dom.element&nbsp;\n.createFromHtml('<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<table>\n  \u6807\u7b7e\u91cc\u7684\u6837\u5f0f\u3002&nbsp;<br \/>\n<\/table>\n<table>\n<tbody>\n<tr>\n<td>\n<pre>'&nbsp;\n+&nbsp;c(j.code)&nbsp;+\"<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4e09\u3001\u7136\u540e\u65b0\u5efaimages\u6587\u4ef6\u5939\uff0c\u5b58\u653e\u4e00\u4e2asyntaxhighlight.gif\u56fe\u7247\u6587\u4ef6\uff0c\u8be5\u56fe\u7247\u6587\u4ef6\u5728\u7f16\u8f91\u5668\u5de5\u5177\u680f\u4e0a\u663e\u793a\uff0c\u53ef\u4ee5\u4f7f\u752816*16\u50cf\u7d20\u7684\u56fe\u7247&nbsp;<\/p>\n<p>\u56db\u3001\u65b0\u5efalang\u6587\u4ef6\u5939\uff0c\u662f\u8bed\u8a00\u5305\uff0c\u91cc\u9762\u6709\u4e24\u4e2a\u6587\u4ef6\uff0c\u4e00\u4e2a\u662f\u4e2d\u6587cn.js\u4e00\u4e2a\u662f\u82f1\u6587en.js\uff0c\u4ee3\u7801\u5185\u5bb9\u5982\u4e0b\uff1a&nbsp;<\/p>\n<p>\u3000en.js\u4ee3\u7801\u5982\u4e0b\uff1a&nbsp;<\/p>\n<p>\u4ee3\u7801\u5982\u4e0b:<\/p>\n<pre>CKEDITOR.plugins.setLang('syntaxhighlight',&nbsp;'en',&nbsp;\n{&nbsp;\nsyntaxhighlight:&nbsp;\n{&nbsp;\ntitle:&nbsp;'Add&nbsp;or&nbsp;update&nbsp;a&nbsp;code&nbsp;snippet',&nbsp;\nsourceTab:&nbsp;'Source&nbsp;code',&nbsp;\nlangLbl:&nbsp;'Select&nbsp;language',&nbsp;\nadvancedTab:&nbsp;'Advanced',&nbsp;\nhideGutter:&nbsp;'Hide&nbsp;gutter',&nbsp;\nhideGutterLbl:&nbsp;'Hide&nbsp;gutter&nbsp;&amp;amp;&nbsp;line&nbsp;numbers.',&nbsp;\nhideControls:&nbsp;'Hide&nbsp;controls',&nbsp;\nhideControlsLbl:&nbsp;'Hide&nbsp;code&nbsp;controls&nbsp;at&nbsp;the&nbsp;top&nbsp;of&nbsp;the&nbsp;code&nbsp;block.',&nbsp;\ncollapse:&nbsp;'Collapse',&nbsp;\ncollapseLbl:&nbsp;'Collapse&nbsp;the&nbsp;code&nbsp;block&nbsp;by&nbsp;default.&nbsp;(controls&nbsp;need&nbsp;to&nbsp;be&nbsp;turned&nbsp;on)',&nbsp;\nshowColumns:&nbsp;'Show&nbsp;columns',&nbsp;\nshowColumnsLbl:&nbsp;'Show&nbsp;row&nbsp;columns&nbsp;in&nbsp;the&nbsp;first&nbsp;line.',&nbsp;\nlineWrap:&nbsp;'Disable&nbsp;line&nbsp;wrapping',&nbsp;\nlineWrapLbl:&nbsp;'Switch&nbsp;off&nbsp;line&nbsp;wrapping.',&nbsp;\nlineCount:&nbsp;'Default&nbsp;line&nbsp;count',&nbsp;\nhighlight:&nbsp;'Highlight&nbsp;lines',&nbsp;\nhighlightLbl:&nbsp;'Enter&nbsp;a&nbsp;comma&nbsp;seperated&nbsp;lines&nbsp;of&nbsp;lines&nbsp;you&nbsp;want&nbsp;to&nbsp;highlight,&nbsp;eg&nbsp;&lt;em&gt;3,10,15&lt;\/em&gt;.'&nbsp;\n}&nbsp;\n});<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>cn.js\u4ee3\u7801\u5982\u4e0b\uff1a&nbsp;<\/p>\n<p>\u4ee3\u7801\u5982\u4e0b:<\/p>\n<pre>CKEDITOR.plugins.setLang('syntaxhighlight',&nbsp;'cn',&nbsp;\n{&nbsp;\nsyntaxhighlight:&nbsp;\n{&nbsp;\ntitle:&nbsp;'\u6dfb\u52a0\u6216\u66f4\u65b0\u4ee3\u7801',&nbsp;\nsourceTab:&nbsp;'\u4ee3\u7801',&nbsp;\nlangLbl:&nbsp;'\u9009\u62e9\u8bed\u8a00',&nbsp;\nadvancedTab:&nbsp;'\u9ad8\u7ea7',&nbsp;\nhideGutter:&nbsp;'\u9690\u85cf\u5206\u5272\u7ebf',&nbsp;\nhideGutterLbl:&nbsp;'\u9690\u85cf\u5206\u5272\u7ebf\u548c\u884c\u53f7',&nbsp;\nhideControls:&nbsp;'\u9690\u85cf\u5de5\u5177\u680f',&nbsp;\nhideControlsLbl:&nbsp;'\u9690\u85cf\u6d6e\u52a8\u5de5\u5177\u680f',&nbsp;\ncollapse:&nbsp;'\u4ee3\u7801\u6298\u53e0',&nbsp;\ncollapseLbl:&nbsp;'\u9ed8\u8ba4\u6298\u53e0\u4ee3\u7801\u5757&nbsp;(\u9700\u8981\u542f\u7528\u5de5\u5177\u680f)',&nbsp;\nlineWrap:&nbsp;'\u81ea\u52a8\u6362\u884c',&nbsp;\nlineWrapLbl:&nbsp;'\u5173\u95ed\u81ea\u52a8\u6362\u884c',&nbsp;\nautoLinks:&nbsp;'\u81ea\u52a8\u94fe\u63a5',&nbsp;\nautoLinksLbl:&nbsp;'\u4e0d\u81ea\u52a8\u8f6c\u6362\u8d85\u94fe\u63a5',&nbsp;\nlineCount:&nbsp;'\u8d77\u59cb\u884c\u53f7',&nbsp;\nhighlight:&nbsp;'\u9ad8\u4eae\u884c\u53f7',&nbsp;\nhighlightLbl:&nbsp;'\u8f93\u5165\u4ee5\u9017\u53f7\u5206\u9694\u7684\u884c\u53f7,&nbsp;\u5982&nbsp;&lt;em&gt;3,10,15&lt;\/em&gt;.'&nbsp;\n}&nbsp;\n});<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4e94\u3001\u65b0\u5efaplugin.js\u6587\u4ef6\uff0c\u8be5\u6587\u4ef6\u662fckeditor\u63d2\u4ef6\u5fc5\u987b\u5f97\u6587\u4ef6\uff0c\u91cc\u9762\u662f\u5bf9\u8be5\u63d2\u4ef6\u7684\u4e00\u4e9b\u914d\u7f6e\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a&nbsp;<\/p>\n<p>\u4ee3\u7801\u5982\u4e0b:<\/p>\n<pre>CKEDITOR.plugins.add(\"syntaxhighlight\",&nbsp;{&nbsp;\nrequires&nbsp;:&nbsp;[&nbsp;\"dialog\"&nbsp;],&nbsp;\nlang&nbsp;:&nbsp;[&nbsp;\"cn\"&nbsp;],&nbsp;\ninit&nbsp;:&nbsp;function(a)&nbsp;{&nbsp;\nvar&nbsp;b&nbsp;=&nbsp;\"syntaxhighlight\";&nbsp;\nvar&nbsp;c&nbsp;=&nbsp;a.addCommand(b,&nbsp;new&nbsp;CKEDITOR.dialogCommand(b));&nbsp;\nc.modes&nbsp;=&nbsp;{&nbsp;\nwysiwyg&nbsp;:&nbsp;1,&nbsp;\nsource&nbsp;:&nbsp;1&nbsp;\n};&nbsp;\nc.canUndo&nbsp;=&nbsp;false;&nbsp;\na.ui.addButton(\"Code\",&nbsp;{&nbsp;\nlabel&nbsp;:&nbsp;a.lang.syntaxhighlight.title,&nbsp;\ncommand&nbsp;:&nbsp;b,&nbsp;\nicon&nbsp;:&nbsp;this.path&nbsp;+&nbsp;\"images\/syntaxhighlight.gif\"&nbsp;\n});&nbsp;\nCKEDITOR.dialog.add(b,&nbsp;this.path&nbsp;+&nbsp;\"dialogs\/syntaxhighlight.js\")&nbsp;\n}&nbsp;\n});<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u516d\u3001\u7531\u4e8ededecms 5.7\u81ea\u5df1\u96c6\u6210\u4e86\u4e00\u4e2adedepage\u63d2\u4ef6\uff0c\u7528\u6765\u6dfb\u52a0ckeditor\u81ea\u5b9a\u4e49\u63d2\u4ef6\uff0c\u5728\/include\/ckeditor\/dedepage\u6587\u4ef6\u5939\u4e0b\uff0c\u6253\u5f00plugin.js\u6587\u4ef6\u5728\u6700\u540e\u9762\u6dfb\u52a0\uff1a&nbsp;<\/p>\n<p>requires : [&#8216;syntaxhighlight&#8217;]\uff0c\u5176\u4e2dsyntaxhighlight\u4e3a\u4ee3\u7801\u9ad8\u4eae\u63d2\u4ef6\u7684\u6587\u4ef6\u5939\u540d\uff0c\u6dfb\u52a0\u5b8c\u4e4b\u540e\u7684\u4ee3\u7801\u5982\u4e0b\uff1a&nbsp;<\/p>\n<pre>[code]&nbsp;\n\/\/&nbsp;Register&nbsp;a&nbsp;plugin&nbsp;named&nbsp;\"dedepage\".&nbsp;\n(function()&nbsp;\n{&nbsp;\nCKEDITOR.plugins.add(&nbsp;'dedepage',&nbsp;\n{&nbsp;\ninit&nbsp;:&nbsp;function(&nbsp;editor&nbsp;)&nbsp;\n{&nbsp;\n\/\/&nbsp;Register&nbsp;the&nbsp;command.&nbsp;\neditor.addCommand(&nbsp;'dedepage',{&nbsp;\nexec&nbsp;:&nbsp;function(&nbsp;editor&nbsp;)&nbsp;\n{&nbsp;\n\/\/&nbsp;Create&nbsp;the&nbsp;element&nbsp;that&nbsp;represents&nbsp;a&nbsp;print&nbsp;break.&nbsp;\n\/\/&nbsp;alert('dedepageCmd!');&nbsp;\neditor.insertHtml(\"\n\");&nbsp;\n}&nbsp;\n});&nbsp;\n\/\/&nbsp;alert('dedepage!');&nbsp;\n\/\/&nbsp;Register&nbsp;the&nbsp;toolbar&nbsp;button.&nbsp;\neditor.ui.addButton(&nbsp;'MyPage',&nbsp;\n{&nbsp;\nlabel&nbsp;:&nbsp;'\u63d2\u5165\u5206\u9875\u7b26',&nbsp;\ncommand&nbsp;:&nbsp;'dedepage',&nbsp;\nicon:&nbsp;'images\/dedepage.gif'&nbsp;\n});&nbsp;\n\/\/&nbsp;alert(editor.name);&nbsp;\n},&nbsp;\nrequires&nbsp;:&nbsp;[&nbsp;'fakeobjects'&nbsp;],&nbsp;\nrequires&nbsp;:&nbsp;['syntaxhighlight']&nbsp;\n});&nbsp;\n})();&nbsp;\n[\/code]<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4e03\u3001\u4fee\u6539\/include\/ckeditor\/ckeditor.inc.php\u6587\u4ef6\uff0c\u5728$toolbar[&#8216;Basic&#8217;]\u6570\u7ec4\u7684\u6700\u540e\u4e00\u884c\u6dfb\u52a0\u5143\u7d20Code,\u4fee\u6539\u540e\u4ee3\u7801\u5982\u4e0b\uff1a&nbsp;<\/p>\n<p>\u4ee3\u7801\u5982\u4e0b:<\/p>\n<pre>$toolbar['Basic']&nbsp;=&nbsp;array(&nbsp;\narray(&nbsp;'Source','-','Templates'),&nbsp;\narray(&nbsp;'Cut','Copy','Paste','PasteText','PasteFromWord','-','Print'),&nbsp;\narray(&nbsp;'Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'),&nbsp;\narray(&nbsp;'ShowBlocks'),array('Image','Flash'),array('Maximize'),'\/',&nbsp;\narray(&nbsp;'Bold','Italic','Underline','Strike','-'),&nbsp;\narray(&nbsp;'NumberedList','BulletedList','-','Outdent','Indent','Blockquote'),&nbsp;\narray(&nbsp;'JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'),&nbsp;\narray(&nbsp;'Table','HorizontalRule','Smiley','SpecialChar'),&nbsp;\narray(&nbsp;'Link','Unlink','Anchor'),'\/',&nbsp;\narray(&nbsp;'Styles','Format','Font','FontSize'),&nbsp;\narray(&nbsp;'TextColor',&nbsp;'BGColor',&nbsp;'MyPage','Code')&nbsp;\n);<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u81f3\u6b64\uff0c\u7f16\u8f91\u5668\u7684\u4fee\u6539\u5df2\u7ecf\u5b8c\u6210\uff0c\u4fee\u6539\u540e\u7684syntaxhighlight\u6587\u4ef6\u5939\u6587\u4ef6\u76ee\u5f55\u7ed3\u6784\u56fe\u5982\u4e0b\u56fe\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/image\/251\/906\/234\/1577324755531648.png\" class=\"aligncenter\" title=\"DedeCms 5.7\u4ee3\u7801\u9ad8\u4eae\u600e\u4e48\u5b9e\u73b0\u63d2\u56fe1\" alt=\"DedeCms 5.7\u4ee3\u7801\u9ad8\u4eae\u600e\u4e48\u5b9e\u73b0\u63d2\u56fe1\" \/><\/p>\n<p>\u3000\u3000\u5c06syntaxhighlight\u6587\u4ef6\u5939\u4e0a\u4f20\u5230\/include\/ckeditor\/plugins\/\u6587\u4ef6\u5939\u4e0b\uff0c\u6253\u5f00\u540e\u53f0\uff0c\u6dfb\u52a0\u6587\u7ae0\u8bd5\u4e00\u4e0b\uff0c\u770b\u770b\u7f16\u8f91\u5668\u7684\u4e0a\u6700\u540e\u4e00\u884c\u662f\u5426\u51fa\u73b0\u4e86\u5982\u56fe\u6240\u793a\u7684\u6309\u94ae\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/image\/194\/830\/814\/1577324753858903.png\" class=\"aligncenter\" title=\"DedeCms 5.7\u4ee3\u7801\u9ad8\u4eae\u600e\u4e48\u5b9e\u73b0\u63d2\u56fe2\" alt=\"DedeCms 5.7\u4ee3\u7801\u9ad8\u4eae\u600e\u4e48\u5b9e\u73b0\u63d2\u56fe2\" \/><\/p>\n<p>\u3000\u3000\u70b9\u51fb\u6309\u94ae\u5f39\u51fa\u5982\u4e0b\u56fe\u6240\u793a\u7684\u5bf9\u8bdd\u6846\u8f93\u5165\u4ee3\u7801\uff0c\u5e76\u4e14\u53ef\u4ee5\u5207\u6362\u5230\u9ad8\u7ea7\u9009\u9879\u5bf9\u4ee3\u7801\u9ad8\u4eae\u663e\u793a\u505a\u4e00\u4e9b\u914d\u7f6e\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/image\/746\/521\/452\/1577324742314860.png\" class=\"aligncenter\" title=\"DedeCms 5.7\u4ee3\u7801\u9ad8\u4eae\u600e\u4e48\u5b9e\u73b0\u63d2\u56fe3\" alt=\"DedeCms 5.7\u4ee3\u7801\u9ad8\u4eae\u600e\u4e48\u5b9e\u73b0\u63d2\u56fe3\" \/><\/p>\n<p>\u516b\u3001\u4f46\u662f\u5149\u8fd9\u4e9b\u8fd8\u4e0d\u591f\uff0c\u8fd8\u8981\u5728\u6587\u7ae0\u6a21\u677f\u6587\u4ef6\/templets\/default\/article_article.htm\u6587\u4ef6\u91cc\u5f15\u5165\u9ad8\u4eae\u663e\u793a\u7684\u7b14\u5237JS\u6587\u4ef6\u548cCSS\u6587\u4ef6\uff0c\u7531\u4e8e\u662f\u9700\u8981\u5f15\u5165\u5f88\u591aJS\uff0c\u6240\u4ee5\u5efa\u8bae\u5c06\u5f15\u5165\u7684\u4ee3\u7801\u653e\u5728<\/p>\n<table>\n  &#8220;);&nbsp; if&nbsp;(l)&nbsp;{&nbsp; m.insertBefore(l);&nbsp; l.remove()&nbsp; }&nbsp;else&nbsp;{&nbsp; i.insertElement(m)&nbsp; }&nbsp; },<br \/>\n<\/table>\n<p>\u4ee5\u4e0a\u5c31\u662fDedeCms 5.7\u4ee3\u7801\u9ad8\u4eae\u600e\u4e48\u5b9e\u73b0\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>5.7\u4ee3\u7801\u9ad8\u4eae\u600e\u4e48\u5b9e\u73b0\uff1f \u65e0\u8bba\u5efa\u535a\u5ba2\u7f51\u7ad9\u8fd8\u662fCMS\u7c7b\u578b\u7f51\u7ad9\uff0c\u5f88\u591a\u90fd\u9700\u8981\u4ee3\u7801\u9ad8\u4eae\uff0c\u7ec7\u68a6CMS\u662f\u56fd\u5185\u6bd4\u8f83\u4f18\u79c0\u7684CMS\u5efa\u7ad9\u7cfb\u7edf\u4e4b\u4e00\uff0c\u4e0d\u50cfWordpress\u4e00\u6837\u6709\u5927\u628a\u5927\u628a\u7684\u63d2\u4ef6\u53ef\u7528\uff0c\u6211\u7528\u7684\u662f\u6700\u65b0\u7684dedeCMS 5.7\uff0c\u5728\u7f51\u4e0a\u641c\u4e86\u5f88\u957f\u65f6\u95f4\u8d44\u6599\uff0c\u5927\u90fd\u5199\u7684\u662fCKEditor\u548cSyntaxHighlighter\u6574\u5408\u7684\u6587\u7ae0\uff0c\u4f46\u662fdedecms\u5c06ckeditor\u505a\u4e86\u96c6\u6210\uff0c\u548c\u4e00\u822c\u7684\u53ea\u9488\u5bf9\u4e8eckeditor\u5bf9config.js\u4fee\u6539\u4e0d\u540c\u3002 \u63a8\u8350\u5b66\u4e60\uff1a \u6240\u4ee5\u53ea\u80fd\u81ea\u5df1\u7422\u78e8\u4fee\u6539\u4e86\uff0c\u73b0\u5c06\u65b9\u6cd5\u5199\u51fa\u4f9b\u7ad9\u957f\u670b\u53cb\u4eec\u53c2\u8003\uff1a&nbsp; \u4e00\u3001\u9996\u5148\u53bbSyntaxHighlighter\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\uff0c\u7f51\u5740\uff1ahttp:\/\/alexgorbatchev.com\/SyntaxHighlighter\/download\/\uff0c\u5efa\u8bae\u4e0b\u8f7d2.1\u7248\u672c\uff0c3.0\u7248\u672c\u7684\u8c8c\u4f3c\u4e0d\u652f\u6301\u81ea\u52a8\u6362\u884c\uff0c\u8fd9\u91cc\u4f7f\u7528\u7684\u662f2.1.382\u7248\u672c\u3002\u5c06\u4e0b\u8f7d\u7684\u6587\u4ef6\u89e3\u538b\u5728syntaxHighlight\u6587\u4ef6\u5939\u91cc\uff0c\u53bb\u9664\u91cc\u9762\u65e0\u7528\u7684\u6587\u4ef6\uff0c\u53ea\u7559\u4e0bscripts\u548cstyles\u6587\u4ef6\u5939\u3002&nbsp; \u4e8c\u3001\u65b0\u5efadialogs\u6587\u4ef6\u5939\uff0c\u5728\u91cc\u9762\u65b0\u5efa\u4e00\u4e2a\u540d\u4e3asyntaxhighlight.js\u7684\u6587\u4ef6\uff0c\u56e0\u4ee3\u7801\u91cf\u8fc7\u5927\uff0c\u4e0d\u5b9c\u8d34\u51fa\uff0c\u8bf7\u76f4\u63a5\u4e0b\u8f7dsyntaxhighlight.js&nbsp; \u5982\u679c\u60f3\u4fee\u6539\u4ee3\u7801\u533a\u57df\u7684\u6837\u5f0f\u8bf7\u5728\u4ee5\u4e0b\u4ee3\u7801\u5904\u4fee\u6539 \u4ee3\u7801\u5982\u4e0b: onOk&nbsp;:&nbsp;function()&nbsp;{&nbsp; var&nbsp;i&nbsp;=&nbsp;this.getParentEditor();&nbsp; var&nbsp;h&nbsp;=&nbsp;i.getSelection();&nbsp; var&nbsp;g&nbsp;=&nbsp;h.getStartElement();&nbsp; var&nbsp;l&nbsp;=&nbsp;g&nbsp;&amp;amp;&amp;amp;&nbsp;g.getAscendant(&#8220;pre&#8221;,&nbsp;true);&nbsp; var&nbsp;j&nbsp;=&nbsp;f();&nbsp; this.commitContent(j);&nbsp; var&nbsp;k&nbsp;=&nbsp;e(j);&nbsp; var&nbsp;m&nbsp;=&nbsp;CKEDITOR.dom.element&nbsp; .createFromHtml(&#8216; \u767b\u5f55\u540e\u590d\u5236 \u6807\u7b7e\u91cc\u7684\u6837\u5f0f\u3002&nbsp; &#8216;&nbsp; +&nbsp;c(j.code)&nbsp;+&#8221; \u767b\u5f55\u540e\u590d\u5236 \u4e09\u3001\u7136\u540e\u65b0\u5efaimages\u6587\u4ef6\u5939\uff0c\u5b58\u653e\u4e00\u4e2asyntaxhighlight.gif\u56fe\u7247\u6587\u4ef6\uff0c\u8be5\u56fe\u7247\u6587\u4ef6\u5728\u7f16\u8f91\u5668\u5de5\u5177\u680f\u4e0a\u663e\u793a\uff0c\u53ef\u4ee5\u4f7f\u752816*16\u50cf\u7d20\u7684\u56fe\u7247&nbsp; \u56db\u3001\u65b0\u5efalang\u6587\u4ef6\u5939\uff0c\u662f\u8bed\u8a00\u5305\uff0c\u91cc\u9762\u6709\u4e24\u4e2a\u6587\u4ef6\uff0c\u4e00\u4e2a\u662f\u4e2d\u6587cn.js\u4e00\u4e2a\u662f\u82f1\u6587en.js\uff0c\u4ee3\u7801\u5185\u5bb9\u5982\u4e0b\uff1a&nbsp; \u3000en.js\u4ee3\u7801\u5982\u4e0b\uff1a&nbsp; \u4ee3\u7801\u5982\u4e0b: CKEDITOR.plugins.setLang(&#8216;syntaxhighlight&#8217;,&nbsp;&#8216;en&#8217;,&nbsp; {&nbsp; syntaxhighlight:&nbsp; {&nbsp; title:&nbsp;&#8216;Add&nbsp;or&nbsp;update&nbsp;a&nbsp;code&nbsp;snippet&#8217;,&nbsp; sourceTab:&nbsp;&#8216;Source&nbsp;code&#8217;,&nbsp; langLbl:&nbsp;&#8216;Select&nbsp;language&#8217;,&nbsp; advancedTab:&nbsp;&#8216;Advanced&#8217;,&nbsp; hideGutter:&nbsp;&#8216;Hide&nbsp;gutter&#8217;,&nbsp; hideGutterLbl:&nbsp;&#8216;Hide&nbsp;gutter&nbsp;&amp;amp;&nbsp;line&nbsp;numbers.&#8217;,&nbsp; hideControls:&nbsp;&#8216;Hide&nbsp;controls&#8217;,&nbsp; hideControlsLbl:&nbsp;&#8216;Hide&nbsp;code&nbsp;controls&nbsp;at&nbsp;the&nbsp;top&nbsp;of&nbsp;the&nbsp;code&nbsp;block.&#8217;,&nbsp; collapse:&nbsp;&#8216;Collapse&#8217;,&nbsp; collapseLbl:&nbsp;&#8216;Collapse&nbsp;the&nbsp;code&nbsp;block&nbsp;by&nbsp;default.&nbsp;(controls&nbsp;need&nbsp;to&nbsp;be&nbsp;turned&nbsp;on)&#8217;,&nbsp; showColumns:&nbsp;&#8216;Show&nbsp;columns&#8217;,&nbsp; showColumnsLbl:&nbsp;&#8216;Show&nbsp;row&nbsp;columns&nbsp;in&nbsp;the&nbsp;first&nbsp;line.&#8217;,&nbsp; lineWrap:&nbsp;&#8216;Disable&nbsp;line&nbsp;wrapping&#8217;,&nbsp; lineWrapLbl:&nbsp;&#8216;Switch&nbsp;off&nbsp;line&nbsp;wrapping.&#8217;,&nbsp; lineCount:&nbsp;&#8216;Default&nbsp;line&nbsp;count&#8217;,&nbsp; highlight:&nbsp;&#8216;Highlight&nbsp;lines&#8217;,&nbsp; highlightLbl:&nbsp;&#8216;Enter&nbsp;a&nbsp;comma&nbsp;seperated&nbsp;lines&nbsp;of&nbsp;lines&nbsp;you&nbsp;want&nbsp;to&nbsp;highlight,&nbsp;eg&nbsp;&lt;em&gt;3,10,15&lt;\/em&gt;.&#8217;&nbsp; }&nbsp; }); \u767b\u5f55\u540e\u590d\u5236 cn.js\u4ee3\u7801\u5982\u4e0b\uff1a&nbsp; \u4ee3\u7801\u5982\u4e0b: CKEDITOR.plugins.setLang(&#8216;syntaxhighlight&#8217;,&nbsp;&#8216;cn&#8217;,&nbsp; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[],"class_list":["post-30611","post","type-post","status-publish","format-standard","hentry","category-cms"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/30611","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=30611"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/30611\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=30611"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=30611"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=30611"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}