* adjust for ueditor and markdown.

This commit is contained in:
wangyidong
2016-11-03 21:20:41 +08:00
parent ab4bf80092
commit ef096bfa82
3 changed files with 19 additions and 15 deletions
+1 -1
View File
@@ -161,7 +161,7 @@ $(function()
<div class='hide' id='lastCommentBox'>
<form method='post' action='<?php echo $this->createLink('action', 'editComment', "actionID=$action->id")?>'>
<table align='center' class='table table-form bd-0'>
<tr><td style='padding-right: 0'><?php echo html::textarea('lastComment', htmlspecialchars($action->comment),"rows='5' class='form-control'");?></td></tr>
<tr><td style='padding-right: 0'><?php echo html::textarea('lastComment', htmlspecialchars($action->comment), "style='width:100%;height:100px'");?></td></tr>
<tr><td><?php echo html::submitButton() . html::a("javascript:toggleComment($action->id)", $lang->goback, '', "class='btn'");?></td></tr>
</table>
</form>
+4 -1
View File
@@ -14,20 +14,23 @@ $editor['id'] = explode(',', $editor['id']);
<script language='javascript'>
var markdownEditor = <?php echo json_encode($editor);?>;
var toolbar = ["bold", "italic", "heading", "|", "quote", "unordered-list", "ordered-list", "|", "link", "image", "code", "table", "|", "preview", "side-by-side", "fullscreen", "|", "guide"];
var withchange = ["bold", "italic", "heading", "|", "quote", "unordered-list", "ordered-list", "|", "link", "image", "code", "table", "|", "preview", "side-by-side", "fullscreen", "|", "guide", {name: "html", action: function customFunction(editor){toggleEditor("html")}, className:'fa fa-exchange', title:"HTML"}];
$(document).ready(initMarkdown);
function initMarkdown(afterInit)
{
$.each(markdownEditor.id, function(key, markdownEditorID)
{
if(typeof(markdownEditor.tools) != 'undefined' && markdownEditor.tools == 'withchange') toolbar = withchange;
var options =
{
toolbar:toolbar,
element:document.getElementById(markdownEditorID),
status: false
};
if(!window.markdownEditor) window.markdownEditor = {};
markdown = new SimpleMDE(options);
window.markdownEditor['#'] = window.markdownEditor[markdownEditorID] = markdown;
console.log(markdown);
markdown.codemirror.on("focus", function()
{
window.markdownEditor[markdownEditorID].toggleSideBySide();
+14 -13
View File
@@ -19,16 +19,14 @@ js::set('kuid', $uid);
var editor = <?php echo json_encode($editor);?>;
var toolbars = [[
'fullscreen', 'source', '|',
'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', '|',
'paragraph', 'fontfamily', 'fontsize', '|',
'indent', '|',
'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|',
'simpleupload', 'emotion', 'insertvideo', 'map', 'insertcode', '|',
'link', 'unlink', 'anchor', '|',
'horizontal', 'date', 'time', '|',
'forecolor', 'backcolor', 'bold', 'italic', 'underline', 'strikethrough', 'superscript', 'subscript', 'blockquote', 'pasteplain', '|',
'insertorderedlist', 'insertunorderedlist', 'justifyleft', 'justifycenter', 'justifyright', '|',
'simpleupload', 'insertvideo', 'insertcode', '|',
'link', 'unlink', '|',
'inserttable', '|',
'preview', 'searchreplace', 'drafts', 'help'
'fullscreen', 'source', '|',
'preview', 'help'
]];
$(document).ready(initUeditor);
@@ -47,12 +45,15 @@ function initUeditor(afterInit)
$.each(editor.id, function(key, editorID)
{
if(!window.editor) window.editor = {};
ueditor = UE.getEditor(editorID, options);
window.editor['#'] = window.editor[editorID] = ueditor;
ueditor.addListener('ready', function()
if($('#' + editorID).size() != 0)
{
$('#' + editorID).find('.edui-editor').css('z-index', '5');
});
ueditor = UE.getEditor(editorID, options);
window.editor['#'] = window.editor[editorID] = ueditor;
ueditor.addListener('ready', function()
{
$('#' + editorID).find('.edui-editor').css('z-index', '5');
});
}
});
if($.isFunction(afterInit)) afterInit();