在部落格內建文字編輯器

2022-09-16 09:24:10 字數 769 閱讀 2745

我用的是最簡單粗暴的編輯器kindeditor。官網:

注意id_content是繫結的textarea,下面的引數是根據自己的需求訂製編輯器,具體內容可以看文件:

#

urls.py

path('

upload/

', views.upload, name='

upload')

#views.py

defupload(request):

img = request.files.get('

upload_img')

path = os.path.join(settings.media_root, '

add_article_img

', img.name)

with open(path, 'wb

') as f:

for line in

img:

f.write(line)

response ='#

檔案預覽,引數必須是url

}

return jsonresponse(response)

部落格之富文字編輯器

文件說明 因為article content 不是文字字串,而是包含標籤的html字串 但是文章描述 desc 只需要拿文字字串,不拿標籤字串 desc bs.text 0 150 過濾非法標籤,decompose 會刪除script和link標籤 為什麼要刪除這些標籤,因為kineditor儲存的...

文字編輯器

include stdio.h include string.h include stdlib.h define len sizeof struct linetable struct linetable main 輸出並加入行號 display struct linetable head else ...

文字編輯器

text editer文字編輯器 data ref container tec type ref to cl gui custom container.data ref edit type ref to cl gui textedit.data text line 85 work area it t...