MCPcopy Index your code
hub / github.com/cnodejs/nodeclub / createEpicEditor

Function createEpicEditor

public/javascripts/editor.js:7–87  ·  view source on GitHub ↗

* 创建一个 EpicEditor * * @param {Element} textarea * @return {EpicEditor}

(textarea)

Source from the content-addressed store, hash-verified

5 * @return {EpicEditor}
6 */
7function createEpicEditor (textarea) {
8 var $node = $(textarea);
9 var id = $node.attr('id');
10 var h = $node.height();
11 $node.before('<div id="editor_' + id + '" style="height:' + h + 'px; border: 1px solid #DDD; border-radius: 4px;"></div>');
12 $node.hide();
13
14 var opts = {
15 container: 'editor_' + id,
16 textarea: id,
17 basePath: '/public/libs/epiceditor',
18 clientSideStorage: false,
19 useNativeFullscreen: true,
20 parser: marked,
21 theme: {
22 base: '/themes/base/epiceditor.css',
23 preview: '/themes/preview/github.css',
24 editor: '/themes/editor/epic-light.css'
25 },
26 button: {
27 preview: true,
28 fullscreen: true,
29 bar: true
30 },
31 focusOnLoad: false,
32 shortcut: {
33 modifier: 18,
34 fullscreen: 70,
35 preview: 80
36 },
37 string: {
38 togglePreview: '预览',
39 toggleEdit: '编辑',
40 toggleFullscreen: '全屏'
41 },
42 autogrow: {
43 minHeight: 200
44 }
45 };
46
47 var editor = new EpicEditor(opts);
48
49 // 进入全屏模式时,给编辑器增加一些额外的样式
50 function _fullscreenenter ($e) {
51 var d = {
52 margin: '90px 8px 8px 8px',
53 padding: '8px',
54 border: '1px solid #aaa',
55 width: $e.width() - 34,
56 height: $e.height() - 114
57 };
58 setTimeout(function () {
59 $e.css(d);
60 }, 100);
61 }
62 function _fullscreenexit ($e) {
63 $e.css({
64 margin: '0',

Callers 1

editor.jsFile · 0.85

Calls 1

fullscreenenterFunction · 0.85

Tested by

no test coverage detected