<!DOCTYPE html>
<html lang="zh">
<head>
	<th:block th:include="include :: header('Summernote富文本编辑器')" />
	<th:block th:include="include :: summernote-css" />
</head>
<body class="gray-bg">
    <div class="wrapper wrapper-content">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>Summernote 富文本编辑器</h5>
                    </div>
                    <div class="ibox-content no-padding">
                        <div class="summernote">
                            <h2>圣钰SaaS后台管理系统</h2>
                            <p>
                                <b>当前版本：</b>v1.0.0
                            </p>
                            <p>
                                <span class="label label-warning">基于apache-2.0开源协议</span>
                            </p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-content">
                        <h2>Summernote</h2>
                        <p>
                            Summernote是一个简单的基于Bootstrap的WYSIWYG富文本编辑器
                        </p>
                        <div class="alert alert-warning"> 官方文档请参考：
                            <a href="https://github.com/summernote/summernote">https://github.com/summernote/summernote</a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>编辑/保存为html代码示例</h5>
                        <button id="edit" class="btn btn-primary btn-xs m-l-sm" onclick="edit()" type="button">编辑</button>
                        <button id="save" class="btn btn-primary  btn-xs" onclick="save()" type="button">保存</button>
                    </div>
                    <div class="ibox-content" id="eg">

                        <div class="click2edit wrapper">
                            <p>
                                <b>当前版本：</b>v1.0.0
                            </p>
                            <p>
                                <span class="label label-warning">基于apache-2.0开源协议</span>
                            </p>
                        </div>

                    </div>
                </div>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: summernote-js" />
    <script>
        $(document).ready(function () {
            $('.summernote').summernote({
                lang: 'zh-CN'
            });
        });
        var edit = function () {
            $("#eg").addClass("no-padding");
            $('.click2edit').summernote({
                lang: 'zh-CN',
                focus: true
            });
        };
        var save = function () {
            $("#eg").removeClass("no-padding");
            var aHTML = $('.click2edit').summernote('code');
            $('.click2edit').summernote('destroy');
        };
    </script>
</body>
</html>
