ํ์ฌ ๋ฐฐํฌ ์ค์ธ ์ฃผ์ ์น ์๋ํฐ๋ค์ ๋ผ๋ผ๋ฒจ ํ๋ก์ ํธ์์ ์ฆ์ ์ฌ์ฉํ ์ ์๋๋ก ํตํฉํ ํ๋ฌ๊ทธ์ธ์ ๋๋ค.
ํ๋์ ํจํค์ง๋ก TinyMCE, Summernote, Naver Smart Editor ๋ฑ ๋ค์ํ ์๋ํฐ๋ฅผ ์ค์ ํ๋๋ก ์์ ๋กญ๊ฒ ๊ต์ฒดํ์ธ์.
์ด ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ ๊ธธ๋ผ(Gilra) (Online Fortune Service)์ ์ปค๋ฎค๋ํฐ Q&A, 1:1 ์๋ด์, ๊ณต์ง์ฌํญ ๊ธฐ๋ฅ์ ๊ตฌ์ถํ๋ ๋ฐ ์ค์ ๋ก ์ฌ์ฉ๋์์ต๋๋ค. ํนํ ์ฌ์ฃผ ๋ช ๋ฐ ์ด๋ฏธ์ง ์๋ ์ฒจ๋ถ ๋ฐ ์ ๋ฌธ๊ฐ ๋ต๋ณ ์์คํ ์ ๊ตฌํํ๋ฉฐ ์์ ์ฑ๊ณผ ์ ์ฐ์ฑ์ด ๊ฒ์ฆ๋์์ต๋๋ค.
- Multi-Editor Support: 5์ข ์ด์์ ์ ๋ช ์๋ํฐ ์๋ฒฝ ์ง์ (Summernote ์ถ๊ฐ)
- Blade Component Ready:
<x-editor-components />ํ๊ทธ๋ก ๊ฐํธํ๊ฒ ์ฝ์ - Smart Instance Management: ํ ํ์ด์ง ๋ด ์ฌ๋ฌ ๊ฐ์ ์๋ํฐ ์ธ์คํด์ค๋ฅผ ์ธ์ ๊ธฐ๋ฐ์ผ๋ก ์๋ ๊ด๋ฆฌ
- Defer-loading Compatible: jQuery
deferํ๊ฒฝ์์๋ ๋ก๋ฉ ์์ ๊ผฌ์ ์์ด ์์ ์ ์ผ๋ก ์๋ - Image Upload System: ์ปค์คํ
์ ์ฅ ๊ฒฝ๋ก ์ค์ ์ ์ง์ํ๋ ์ ์ฉ Trait ์ ๊ณต (
SmartEditor) - Cosmic Dark Theme: ๋คํฌ ๋ชจ๋ UI ํ๊ฒฝ์ ์ต์ ํ๋ CSS ์ปค์คํ ์ง์
์์ธํ ์ฌ์ฉ๋ฒ๊ณผ ์ปค์คํ ๊ฐ์ด๋๋ ๊ณต์ ์ฌ์ดํธ์์ ํ์ธํ์ค ์ ์์ต๋๋ค.
composer require wangta69/laravel-editorphp artisan pondol:install-editor์ด ๋ช
๋ น์ด๋ฅผ ์คํํ๋ฉด config/pondol-editor.php ํ์ผ๊ณผ public/plugins/editor ํด๋์ ํ์ํ ์ ์ ํ์ผ๋ค์ด ์์ฑ๋ฉ๋๋ค.
config/pondol-editor.php ํ์ผ์์ ๊ธฐ๋ณธ์ผ๋ก ์ฌ์ฉํ ์๋ํฐ ํ
ํ๋ฆฟ๊ณผ ๋ผ์ฐํ
์ต์
์ ์์ ํ ์ ์์ต๋๋ค.
| Key | Editor Name | License | ํน์ง |
|---|---|---|---|
summernote |
Summernote | MIT | ์ถ์ฒ. ๊ฐ๋ณ๊ณ ๋ผ์ด์ ์ค ๋ฌธ๊ตฌ ์๋ ์์ ๋ฌด๋ฃ ์๋ํฐ |
tinymce |
TinyMCE | Community | ๊ฐ์ฅ ๊ฐ๋ ฅํ ๊ธฐ๋ฅ๊ณผ ์ ์ธ๊ณ์ ์ธ ์์ ์ฑ |
smart-editor |
Naver Smart Editor | Open Source | ๊ตญ๋ด ์ฌ์ฉ์์๊ฒ ์น์ํ ๋ค์ด๋ฒ ์คํ์ผ |
richtext |
RichText Editor | Commercial | ๋งค์ฐ ๊ฐ๋ฒผ์ด ๊ณ ์ฑ๋ฅ ์๋ํฐ |
froala |
Froala Editor | Commercial | ์ธ๋ จ๋ ๋์์ธ๊ณผ ๋ชจ๋ฐ์ผ ์ต์ ํ ์๋ํฐ |
์ค์ ํ์ผ์ ์ง์ ๋ ๊ธฐ๋ณธ ์๋ํฐ๋ฅผ ๋ถ๋ฌ์ต๋๋ค.
Before:
<form>
<textarea name="comment"></textarea>
<button type="submit">Save</button>
</form>After (Component ๋ฐฉ์):
<form>
<x-editor-components name="comment" id="comment-id" value="์ด๊ธฐ ๋ด์ฉ" />
<button type="submit">Save</button>
</form>After (Blade Include ๋ฐฉ์):
<form>
@include ('editor::default', ['name'=>'comment', 'id'=>'comment-id',
'value'=>'', 'attr'=>['class'=>'']])
<button type="submit">Save</button>
</form>๊ธฐ๋ณธ ์ค์ ๊ณผ ์๊ด์์ด ํ์ด์ง๋ง๋ค ๋ค๋ฅธ ์๋ํฐ๋ฅผ ์ฌ์ฉํ๊ณ ์ถ์ ๋ ์ ์ฉํฉ๋๋ค.
TinyMCE ์ ์ฉ ์:
@include('editor::tinymce.editor', [ 'name' => 'comment', 'id' => 'comment-id',
'value' => $data->content, 'attr' => ['class' => 'form-control'] ])type ์์ฑ์ ํตํด ์ธ์
๊ธฐ๋ฐ์ ์ธ์คํด์ค ๊ด๋ฆฌ๊ฐ ๊ฐ๋ฅํฉ๋๋ค.
<!-- ์ฒซ ๋ฒ์งธ ์๋ํฐ (์์: ๊ธฐ์กด ์ธ์
์ด๊ธฐํ) -->
<x-editor-components name="content1" id="editor1" type="start" />
<!-- ์ค๊ฐ ์๋ํฐ๋ค -->
<x-editor-components name="content2" id="editor2" />
<!-- ๋ง์ง๋ง ์๋ํฐ (์ข
๋ฃ: ์ธ์
์ ๋ฆฌ ๋ฐ ์ ์ฒด ๋ก๋) -->
<x-editor-components name="content3" id="editor3" type="end" />๋ณธ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ jQuery๊ฐ defer๋ก ๋ก๋๋๋ ์ต์ ์น ํ๊ฒฝ์์๋ ์์ ์ ์ผ๋ก ์๋ํฉ๋๋ค. ๋ชจ๋ ์ด๊ธฐํ ์ฝ๋๋ window.load ์์ ์ ์คํ๋์ด ๋ผ์ด๋ธ๋ฌ๋ฆฌ ๋ถ์ฌ๋ก ์ธํ Uncaught ReferenceError๋ฅผ ๋ฐฉ์งํฉ๋๋ค.
์ด๋ฏธ์ง ์ ๋ก๋ ๊ฒฝ๋ก๋ฅผ ์ปจํธ๋กค๋ฌ์์ ์ ๋์ ์ผ๋ก ์ง์ ํ ์ ์์ต๋๋ค.
use Pondol\Editor\Traits\SmartEditor;
class PostController extends Controller
{
use SmartEditor;
public function uploadImage(Request $request)
{
// _uploadStore ๋ฉ์๋๊ฐ ์ ํจ์ฑ ๊ฒ์ฌ ๋ฐ ์ ์ฅ์ ์๋์ผ๋ก ์ฒ๋ฆฌํฉ๋๋ค.
// ๋ ๋ฒ์งธ ์ธ์๋ก storage/app/public ํ์์ ์ ์ฅ ๊ฒฝ๋ก๋ฅผ ์ง์ ํ ์ ์์ต๋๋ค.
$result = $this->_uploadStore($request, 'uploads/posts');
if ($result['error']) {
return response()->json(['success' => false, 'message' => 'Upload failed']);
}
return $result['url'];
}
}๊ธธ๋ผ(Gilra) ์๋น์ค์ ๊ฐ์ ๋คํฌ ํ ๋ง ํ๊ฒฝ์ ์ํด ์๋ํฐ์ ๋ฐฐ๊ฒฝ ๋ฐ ํด๋ฐ ์์์ ์ค๋ฒ๋ผ์ด๋ฉํ ์ ์์ต๋๋ค.
/* Summernote Dark Mode ์์ */
.note-editor {
background-color: #1b263b !important;
}
.note-toolbar {
background-color: #2a3b57 !important;
}
.note-editable {
color: #fff !important;
}์ค์น ํ ์๋ ์ฃผ์๋ก ์ ์ํ์ฌ ๊ฐ ์๋ํฐ๊ฐ ์ ์์ ์ผ๋ก ๋ ๋๋ง๋๋์ง ์ฆ์ ํ ์คํธํ ์ ์์ต๋๋ค.
- ๊ธฐ๋ณธ ํ
์คํธ:
https://your-domain.com/editor/richtext - ์ค๋งํธ ์๋ํฐ:
https://your-domain.com/editor/smart-editor - TinyMCE:
https://your-domain.com/editor/tinymce - Summernote:
https://your-domain.com/editor/summernote
๋ค์ํ ํ๊ฒฝ์์ ์ผ๊ด๋๊ณ ์ธ๋ จ๋ ํธ์ง ๊ฒฝํ์ ์ ๊ณตํฉ๋๋ค.
- Issues: ๋ฒ๊ทธ๋ ๊ฐ์ ์ฌํญ์ GitHub Issues์ ๋จ๊ฒจ์ฃผ์ธ์.
- Support: onstory.fun
- Real-world Case: ๊ธธ๋ผ(Gilra) ์ด์ธ ์๋น์ค
Copyright ยฉ wangta69. Licensed under the MIT License.