Method: Ueditor::Utils.js_replace

Defined in:
lib/ueditor/utils.rb

.js_replace(dom_id, options = {}) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/ueditor/utils.rb', line 16

def js_replace(dom_id, options = {})
  js_options = applay_options(options)
  editor_id = "#{Ueditor.config.dom_prefix}#{dom_id}"
  js = ""
  if js_options.blank?
    js << "var #{editor_id} = new baidu.editor.ui.Editor();"
  else
    js << "var #{editor_id}= new baidu.editor.ui.Editor({ #{js_options} });"
  end
  js << "#{editor_id}.render('#{dom_id}');"
end