u1jodi1q 发表于 2024-10-3 18:17:00

emlog6.0 替换默认编辑器为CKeditor


    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">安装完emlog,发布<span style="color: black;">文案</span>的时候,<span style="color: black;">发掘</span>默认的kindeditor编辑器实在太难用了,于是将默认编辑器修改为CKeditor。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">文案</span>的操作<span style="color: black;">过程</span>为作者<span style="color: black;">实质</span>操作过程。</p>
    <h1 style="color: black; text-align: left; margin-bottom: 10px;">下载CKEditor</h1>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">日前</span>官网CKEditor的最新版本为4.13.1, <span style="color: black;">意见</span>下载Full Package版本,功能齐全。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">下载<span style="color: black;">位置</span>:</p>https://ckeditor.com/ckeditor-4/download/
    <h1 style="color: black; text-align: left; margin-bottom: 10px;">安装替换编辑器</h1>将下载好的压缩包解压到 emlog站点admin目录下(emlog根目录为/opt)<span style="color: black;">#unzip ckeditor_4.13.1_full.zip -d /tmp</span><span style="color: black;">#mv /tmp/ckeditor /opt/emlog/admin/</span>修改 admin/views/ 文件夹下的 write.php和 page.php 文件,找到如下代码进行修改:<span style="color: black;">&lt;<span style="color: black;">script</span> <span style="color: black;">charset</span>=<span style="color: black;">"utf-8"</span> <span style="color: black;">src</span>=<span style="color: black;">"./editor/kindeditor.js?v=&lt;?php echo Option::EMLOG_VERSION; ?&gt;"</span>&gt;</span><span style="color: black;">&lt;/<span style="color: black;">script</span>&gt;</span>
    <span style="color: black;">&lt;<span style="color: black;">script</span> <span style="color: black;">charset</span>=<span style="color: black;">"utf-8"</span> <span style="color: black;">src</span>=<span style="color: black;">"./editor/lang/zh_CN.js?v=&lt;?php echo Option::EMLOG_VERSION; ?&gt;"</span>&gt;</span><span style="color: black;">&lt;/<span style="color: black;">script</span>&gt;</span>

    <span style="color: black;">&lt;<span style="color: black;">script</span>&gt;</span><span style="color: black;">
      loadEditor(<span style="color: black;">content</span>);
      loadEditor(<span style="color: black;">excerpt</span>);
    </span><span style="color: black;">&lt;/<span style="color: black;">script</span>&gt;</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">将<span style="color: black;">以上</span>代码修改为</p><span style="color: black;">&lt;<span style="color: black;">script</span> <span style="color: black;">type</span>=<span style="color: black;">"text/javascript"</span> <span style="color: black;">src</span>=<span style="color: black;">"./ckeditor/ckeditor.js"</span>&gt;</span><span style="color: black;">&lt;/<span style="color: black;">script</span>&gt;</span>
    <span style="color: black;">&lt;<span style="color: black;">script</span>&gt;</span><span style="color: black;">CKEDITOR.replace(<span style="color: black;">content</span> );
      CKEDITOR.replace(<span style="color: black;">excerpt</span>);
    </span><span style="color: black;">&lt;/<span style="color: black;">script</span>&gt;</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">到此为止,全功能的CKEditor就<span style="color: black;">能够</span>用了。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">修改后的页面如下:</p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/pgc-image/66e8b1e8ee0c44169d36106fbddbc981~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1728112654&amp;x-signature=msuVbuOg0jd%2FsCndghYp7LLCpDY%3D" style="width: 50%; margin-bottom: 20px;">
      <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">修改后的编辑器</p>
    </div>




j8typz 发表于 2024-10-18 11:19:15

你说得对,我们一起加油,未来可期。
页: [1]
查看完整版本: emlog6.0 替换默认编辑器为CKeditor