@@ -28,7 +28,7 @@ foreach ($filelist as $key => $ff) { | |||||
$alter = ""; | $alter = ""; | ||||
if (count($offFiles) == 0) { | if (count($offFiles) == 0) { | ||||
$alter = 'EOT | |||||
$alter = ' | |||||
<div class="alert alert-danger maintable mb-2" style="margin:0 auto;" role="alert"> | <div class="alert alert-danger maintable mb-2" style="margin:0 auto;" role="alert"> | ||||
无法同官方网站文件服务器通信,校验时候无法保证本地文件是否同官方服务器文件是否一致。 | 无法同官方网站文件服务器通信,校验时候无法保证本地文件是否同官方服务器文件是否一致。 | ||||
</div>'; | </div>'; | ||||
@@ -173,7 +173,7 @@ function SpGetEditor($fname, $fvalue, $nheight = "350", $etype = "Basic", $gtype | |||||
} else if ($GLOBALS['cfg_html_editor'] == 'ckeditor') { | } else if ($GLOBALS['cfg_html_editor'] == 'ckeditor') { | ||||
$addConfig = ""; | $addConfig = ""; | ||||
if (defined("DEDEADMIN")) { | if (defined("DEDEADMIN")) { | ||||
$addConfig = ",{allowedContent:true,filebrowserImageUploadUrl:'./dialog/select_images_post.php',filebrowserUploadUrl:'./dialog/select_media_post.php?ck=1',extraPlugins:'html5video,dedepagebreak,ddfilebrowser'}"; | |||||
$addConfig = ",{allowedContent:true,filebrowserImageUploadUrl:'./dialog/select_images_post.php',filebrowserUploadUrl:'./dialog/select_media_post.php?ck=1',extraPlugins:'html5video,dedepagebreak,ddfilebrowser,textindent'}"; | |||||
// $addConfig = ",{filebrowserImageUploadUrl:'./dialog/select_images_post.php'}"; | // $addConfig = ",{filebrowserImageUploadUrl:'./dialog/select_images_post.php'}"; | ||||
} | } | ||||
$code = <<<EOT | $code = <<<EOT | ||||
@@ -11,7 +11,7 @@ CKEDITOR.editorConfig = function (config) { | |||||
{ name: 'forms', groups: ['forms'] }, | { name: 'forms', groups: ['forms'] }, | ||||
'/', | '/', | ||||
{ name: 'basicstyles', groups: ['basicstyles', 'cleanup'] }, | { name: 'basicstyles', groups: ['basicstyles', 'cleanup'] }, | ||||
{ name: 'paragraph', groups: ['list', 'indent', 'blocks', 'align', 'bidi', 'paragraph'] }, | |||||
{ name: 'paragraph', groups: ['list', 'indent', 'blocks', 'align', 'bidi', 'paragraph','textindent'] }, | |||||
{ name: 'links', groups: ['links'] }, | { name: 'links', groups: ['links'] }, | ||||
{ name: 'insert', groups: ['insert'] }, | { name: 'insert', groups: ['insert'] }, | ||||
'/', | '/', | ||||
@@ -20,7 +20,7 @@ CKEDITOR.editorConfig = function (config) { | |||||
{ name: 'tools', groups: ['tools'] } | { name: 'tools', groups: ['tools'] } | ||||
]; | ]; | ||||
config.extraPlugins = 'html5video,dedepagebreak'; | |||||
config.extraPlugins = 'html5video,dedepagebreak,textindent'; | |||||
config.removeButtons = 'About,ShowBlocks,Iframe,Flash,Form,Checkbox,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField'; | config.removeButtons = 'About,ShowBlocks,Iframe,Flash,Form,Checkbox,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField'; | ||||
@@ -0,0 +1,95 @@ | |||||
CKEDITOR.plugins.add( 'textindent', { | |||||
icons: 'textindent', | |||||
init: function( editor ) { | |||||
var indentation = editor.config.indentation; | |||||
var indentationKey = editor.config.indentationKey; | |||||
if(typeof(indentation) == 'undefined') | |||||
indentation = '2em'; | |||||
if(typeof(indentationKey) == 'undefined') | |||||
indentationKey = 'tab'; | |||||
editor.ui.addButton( 'textindent', { | |||||
label: '缩进', | |||||
command: 'ident-paragraph', | |||||
toolbar: "textindent" | |||||
}); | |||||
if( indentationKey !== false){ | |||||
editor.on('key', function(ev) { | |||||
if(ev.data.domEvent.$.key.toLowerCase() === indentationKey.toLowerCase().trim() || ev.data.keyCode === indentationKey){ | |||||
editor.execCommand('ident-paragraph'); | |||||
ev.cancel(); | |||||
} | |||||
}); | |||||
} | |||||
editor.on( 'selectionChange', function() | |||||
{ | |||||
var style_textindente = new CKEDITOR.style({ | |||||
element: 'p', | |||||
styles: { 'text-indent': indentation }, | |||||
overrides: [{ | |||||
element: 'text-indent', attributes: { 'size': '0'} | |||||
}] | |||||
}); | |||||
if( style_textindente.checkActive(editor.elementPath(), editor) ) | |||||
editor.getCommand('ident-paragraph').setState(CKEDITOR.TRISTATE_ON); | |||||
else | |||||
editor.getCommand('ident-paragraph').setState(CKEDITOR.TRISTATE_OFF); | |||||
}); | |||||
editor.addCommand("ident-paragraph", { | |||||
allowedContent: 'p{text-indent}', | |||||
requiredContent: 'p', | |||||
exec: function(evt) { | |||||
var range = editor.getSelection().getRanges()[0]; | |||||
var walker = new CKEDITOR.dom.walker( range ), | |||||
node; | |||||
var state = editor.getCommand('ident-paragraph').state; | |||||
while ( ( node = walker.next() ) ) { | |||||
if ( node.type == CKEDITOR.NODE_ELEMENT ) { | |||||
if(node.getName() === "p"){ | |||||
editor.fire('saveSnapshot'); | |||||
if( state == CKEDITOR.TRISTATE_ON){ | |||||
node.removeStyle("text-indent"); | |||||
editor.getCommand('ident-paragraph').setState(CKEDITOR.TRISTATE_OFF); | |||||
} | |||||
else{ | |||||
node.setStyle( "text-indent", indentation ); | |||||
editor.getCommand('ident-paragraph').setState(CKEDITOR.TRISTATE_ON); | |||||
} | |||||
} | |||||
} | |||||
} | |||||
if(node === null){ | |||||
node = editor.getSelection().getStartElement().getAscendant('p', true); | |||||
editor.fire('saveSnapshot'); | |||||
if( state == CKEDITOR.TRISTATE_ON){ | |||||
node.removeStyle("text-indent"); | |||||
editor.getCommand('ident-paragraph').setState(CKEDITOR.TRISTATE_OFF); | |||||
} | |||||
else{ | |||||
node.setStyle( "text-indent", indentation ); | |||||
editor.getCommand('ident-paragraph').setState(CKEDITOR.TRISTATE_ON); | |||||
} | |||||
} | |||||
} | |||||
}); | |||||
} | |||||
}); |