Module: OrdarsRailsEditor::EditorHelper
- Defined in:
- app/helpers/ordars_rails_editor/editor_helper.rb
Instance Method Summary collapse
Instance Method Details
#ore_editor(name:, content: nil, placeholder: "내용을 입력하세요", upload_url: nil, attach_name: nil, max_images: nil, max_videos: nil, max_mb: nil, attach: true, image: true, id: nil) ⇒ Object
리치텍스트 에디터 렌더.
<%= ore_editor name: "board_post[content]", content: @post.content_html,
upload_url: upload_path, attach_name: "attachment_file_ids[]",
placeholder: "내용을 입력하세요" %>
옵션:
name: (필수) 본문 HTML 이 실릴 폼 필드 이름
content: 초기 HTML (수정 폼)
placeholder: 빈 에디터 안내 문구
upload_url: 첨부/이미지 업로드 엔드포인트 (미지정 = 로컬 모드: 이미지 dataURL·첨부 목록만)
attach_name: 첨부 file_id hidden input 이름 (예: "attachment_file_ids[]")
max_images: / max_videos: / max_mb: 첨부 한도 표시·게이지 기준
attach: false 면 하단 첨부 패널 없이 본문 에디터만
image: false 면 툴바 「이미지 본문 삽입」 버튼 숨김 (예: 이메일 — dataURL 이미지는 Gmail 이 차단)
id: 에디터 루트 DOM id (기본 자동 생성)
⚠저장 시 서버에서 반드시 OrdarsRailsEditor::Sanitizer.clean 을 통과시킬 것.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/helpers/ordars_rails_editor/editor_helper.rb', line 23 def ore_editor(name:, content: nil, placeholder: "내용을 입력하세요", upload_url: nil, attach_name: nil, max_images: nil, max_videos: nil, max_mb: nil, attach: true, image: true, id: nil) render partial: "ordars_rails_editor/editor", locals: { input_name: name, content: content.to_s, placeholder: placeholder, upload_url: upload_url, attach_name: attach_name, max_images: max_images || OrdarsRailsEditor.default_max_images, max_videos: max_videos || OrdarsRailsEditor.default_max_videos, max_mb: max_mb || OrdarsRailsEditor.default_max_total_mb, show_attach: attach, show_image: image, editor_id: id || "ore-editor-#{SecureRandom.hex(4)}" } end |