12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="apple-mobile-web-app-capable" content="yes" />
- <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1"/>
- <meta name="theme-color" content="#ff9224">
- <script src="../script/jquery.min.js"></script>
-
- <!-- Editor -->
- <link href="script/suneditor/suneditor.min.css" rel="stylesheet">
-
- <script src="script/suneditor/suneditor.min.js"></script>
- <script src="script/suneditor/en.js"></script>
- <style>
- body{
- margin: 0px;
- }
- #editorWrapper{
- position: fixed;
- left: 0px;
- top: 0px;
- width: 100%;
- height: 100%;
- }
- #maineditor{
- width: calc(100% - 10px);
- height: 300px;
- }
- </style>
- </head>
- <body>
- <div id="editorWrapper">
- <textarea id="maineditor"></textarea>
- </div>
-
- <script>
- //Start a new editor if there is no file ported in
- var editor;
- if (parent.inputFiles == null){
- //New Editor
- initEditor();
- parent.handleWindowResize();
- }else{
- //Get the filepath and load it
- var file = parent.inputFiles;
- //Load the given file
- $.getJSON("../media?file=" + file.filepath, function(data){
- $("#maineditor").html(data.Content);
- $(parent.document).find("#title").val(data.Title);
- $(parent.document).find("#tags").val(data.Tags.join(", "));
- $(parent.document).find("#savepath").text(file.filepath);
- parent.editingFile = file.filepath;
-
- initEditor();
- parent.handleWindowResize();
- });
- }
-
-
- function getContent(){
- return editor.getContents();
- }
- function initEditor(){
- editor = SUNEDITOR.create(document.getElementById('maineditor'),
- {
- lang: SUNEDITOR_LANG['en'],
- buttonList: [
- ['undo', 'redo'],
- ['font', 'fontSize', 'formatBlock'],
- ['paragraphStyle', 'blockquote'],
- ['bold', 'underline', 'italic', 'strike', 'subscript', 'superscript'],
- ['fontColor', 'hiliteColor'],
- ['removeFormat'],
- '/', // Line break
- ['outdent', 'indent'],
- ['align', 'horizontalRule', 'list', 'lineHeight'],
- ['table', 'link', 'image', 'video', 'audio' /** ,'math' */], // You must add the 'katex' library at options to use the 'math' plugin.
- /** ['imageGallery'] */ // You must add the "imageGalleryUrl".
- ['showBlocks', 'codeView']
- ],
- "resizingBar": false,
- }
- );
- return editor;
- }
- </script>
- </body>
- </html>
|