-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
49 lines (42 loc) · 1.44 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/**
* @author [S. Mahdi Mir-Ismaili](https://mirismaili.github.io)
* Created on 1397/11/9 (2019/1/29).
*/
"use strict";
const editorManager = liveEditor.editorManager
// For ES6-module-system use below import instead of above assignment (Also see index.html. Another change is needed in that file).
//import {editorManager} from "./node_modules/@live-html-editor/browser/dist/bundle.esm.js";
window.onload = () => {
editorManager.config({
serverUrl: 'http://127.0.0.1:3000',
sourceFiles: [
{ // Source 1:
// This is ON SERVER'S LOCAL MACHINE and can be relative. If so
// the base-path would be SERVER'S WORKING DIRECTORY.
path: './index.html',
// Can be automatically detected from the file's extension. So is
// unnecessary in this case. This determines how the result must
// be written down to the file.
writeMethod: 'html',
// `index` is useful when you have multiple live-editors.
// Then `index` comes from: [live-editor=INDEX] and must be UNIQUE.
domPath: index => '[live-editor]',
},
//
// { // Another source:
//
// // See the above note.
// path: './README.md',
//
// // This is also unnecessary (in this case). See the above note.
// writeMethod: 'markdown',
// }
],
codeStyle: {
wrapOn: 0,
}
});
editorManager.start();
// When you don't need this any more run below command. You can start it again.
//liveEditor.editorManager.shutdown();
}