在EpicEditor上设置动态值

时间:2013-08-09 12:35:56

标签: javascript html editor epiceditor

我正在使用EpicEditor。以下是我通过epiceditor初始化的代码:

 var opts = {
    container: 'epiceditor',
    textarea: null,
    theme: {
        base: '/themes/base/epiceditor.css',
        preview: '/themes/preview/github.css',
        editor: '/themes/editor/epic-light.css'
    },
    basePath: '/epiceditor',
    clientSideStorage: false
}
var editor = new EpicEditor(opts);
editor.load();

我有一些价值,我从数据库中取出并希望在epicedior上显示。我是epicEditor的新手,不知道怎么做。有人可以帮我这个!任何关于EpicEditor的专家!!!

1 个答案:

答案 0 :(得分:2)

尝试将“textarea”属性设置为要将内容同步到EpicEditor的textarea字段ID。

我的配置是这样的:

var opts = {
    container: 'epiceditor',
    textarea: null,
    basePath: 'epiceditor',
    clientSideStorage: true,
    localStorageName: 'epiceditor',
    useNativeFullscreen: true,
    parser: marked,
    file: {
        name: 'epiceditor',
        defaultContent: '',
        autoSave: 100
    },
    theme: {
        base: '/themes/base/epiceditor.css',
        preview: '/themes/preview/preview-dark.css',
        editor: '/themes/editor/epic-dark.css'
    },
    button: {
        preview: true,
        fullscreen: true
    },
    focusOnLoad: false,
    shortcut: {
        modifier: 18,
        fullscreen: 70,
        preview: 80
    },
    string: {
        togglePreview: 'Toggle Preview Mode',
        toggleEdit: 'Toggle Edit Mode',
        toggleFullscreen: 'Enter Fullscreen'
    }
}
var editor = new EpicEditor(opts);

您可以查看更多API here