sashsvamir/laravel-codemirror
Composer 安装命令:
composer require sashsvamir/laravel-codemirror
包简介
Turn your blade textarea component to Codemirror code editor in Laravel
README 文档
README
This is component replace your textarea element to codemirror editor.
Installation:
composer require sashsvamir/laravel-codemirror
Setup
To replace textarea by codemirror components, you should wrap textarea
element by codemirror component <x-slbc::textarea-codemirror>:
<x-slbc::textarea-codemirror> <textarea name="body">Your text here</textarea> </x-slbc::textarea-codemirror>
You can pass codemirror mode (see: https://codemirror.net/doc/manual.html#option_mode) with mode attribute:
<x-slbc::textarea-codemirror mode="javascript"> <textarea name="body">const foo = 'bar';</textarea> </x-slbc::textarea-codemirror>
Note
If you want to save form data with ajax request, you must update hidden source textarea by running method querySelectorAll() on textarea element:
form.querySelectorAll('textarea').forEach(textarea => { if (textarea.updateFromWysiwyg) { textarea.updateFromWysiwyg() } })
统计信息
- 总下载量: 133
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-03-05