thinkphp6 个人博客

huwhois de78c84232 .. 10 tháng trước cách đây
app d2b35f5639 .. 10 tháng trước cách đây
config e34e08f141 .. 10 tháng trước cách đây
data 0469249fc6 新分支 11 tháng trước cách đây
extend 1be3b2595a 后台编辑器由 ueditor 改为 ckeditor5 3 năm trước cách đây
public d2b35f5639 .. 10 tháng trước cách đây
route d2b35f5639 .. 10 tháng trước cách đây
runtime f9b3e590e1 init 3 năm trước cách đây
temp da9f8c6ebe .. 1 năm trước cách đây
vendor 0469249fc6 新分支 11 tháng trước cách đây
view de78c84232 .. 10 tháng trước cách đây
.example.env f9b3e590e1 init 3 năm trước cách đây
.gitignore 0469249fc6 新分支 11 tháng trước cách đây
.travis.yml f9b3e590e1 init 3 năm trước cách đây
LICENSE 3f75465558 Initial commit 3 năm trước cách đây
LICENSE.txt f9b3e590e1 init 3 năm trước cách đây
README.md d988e69eb5 .. 3 năm trước cách đây
composer.json b8e02868f4 更换parsedown版本 10 tháng trước cách đây
composer.lock b8e02868f4 更换parsedown版本 10 tháng trước cách đây
think f9b3e590e1 init 3 năm trước cách đây

README.md

blog_tp6

thinkphp6 个人博客

修改 UEditor.all.js 配置

me.commands['insertcode'] = {
    execCommand : function(cmd,lang){
        // ... 省略
        if(pre){
            pre.className = lang; /*'brush:'+lang+';toolbar:false;';*/
        }else{
            // ... 省略
            me.execCommand('inserthtml','<pre id="coder" class="'+lang+'">'+code+'</pre>',true);
            // ... 省略
        }
    },
    // ... 省略
};

修改 Parsedown.php

24 行

    function text($text)
    {
       // ... 省略
    }

// ===> 改为
        function text($text)
    {
        $Elements = $this->textElements($text);

        # convert to markup
        $markup = $this->elements($Elements);

        # trim line breaks
        $markup = trim($markup, "\n");

        return $markup;
    }

    protected function textElements($text)
    {
        # make sure no definitions are set
        $this->DefinitionData = array();

        # standardize line breaks
        $text = str_replace(array("\r\n", "\r"), "\n", $text);

        # remove surrounding line breaks
        $text = trim($text, "\n");

        # split text into lines
        $lines = explode("\n", $text);

        # iterate through lines to identify blocks
        return $this->linesElements($lines);
    }

blockHeader 修改

    protected function blockHeader($Line)
    {
        $level = strspn($Line['text'], '#');

        if ($level > 6)
        {
            return;
        }

        $text = trim($Line['text'], '#');

        if ($this->strictMode and isset($text[0]) and $text[0] !== ' ')
        {
            return;
        }

        $text = trim($text, ' ');

        $Block = array(
            'element' => array(
                'name' => 'h' . $level,
                'handler' => array(
                    'function' => 'lineElements',
                    'argument' => $text,
                    'destination' => 'elements',
                )
            ),
        );

        return $Block;
    }

2022-03-25

  1. 后台富文本编辑器由 ueditor 改为 ckeditor
  2. 新增 ckeditor 图片上传接口