# -*- coding: utf-8; -*-
#
# preview.rb: view preview automatically
#
# Copyright (c) MATSUOKA Kohei
# Distributed under the GPL2 or any later version.
#
@conf['preview.interval'] ||= 10
@conf['preview.min_width'] ||= 896
if /\A(form|edit|preview)\z/ === @mode then
enable_js('preview.js')
add_js_setting('$tDiary.plugin.preview')
add_js_setting('$tDiary.plugin.preview.interval', @conf['preview.interval'].to_json)
add_js_setting('$tDiary.plugin.preview.minWidth', @conf['preview.min_width'].to_json)
end
add_conf_proc('preview', @preview_label_conf, 'update') do
if @mode == 'saveconf'
@conf['preview.interval'] = @cgi.params['preview.interval'][0].to_i
@conf['preview.min_width'] = @cgi.params['preview.min_width'][0].to_i
end
ERB.new(%q{
<%= @preview_label_interval %>
<%= @preview_label_min_width %>
}).result(binding)
end