Browse Source

富文本编辑器支持附件上传

master
tianya 4 months ago
parent
commit
7fcf8a08b8
5 changed files with 25 additions and 1 deletions
  1. +4
    -0
      src/dede/dialog/select_soft.php
  2. +1
    -1
      src/include/inc/inc_fun_funAdmin.php
  3. BIN
      src/static/ckeditor/plugins/ddfilebrowser/icons/ddfilebrowser.png
  4. +20
    -0
      src/static/ckeditor/plugins/ddfilebrowser/plugin.js
  5. BIN
      src/static/img/addon.gif

+ 4
- 0
src/dede/dialog/select_soft.php View File

@@ -72,6 +72,10 @@ if (!empty($noeditor)) {
window.opener.CKEDITOR.tools.callFunction(funcNum, reimg);
}
if (window.opener.CKEDITOR.instances.<?php echo $f ?>) {
let addonHTML = `<a href='${reimg}' target='_blank'><img src='<?php echo $cfg_cmspath ?>/static/img/addon.gif' border='0' />附件:${reimg}</a>`;
window.opener.CKEDITOR.instances["<?php echo $f ?>"].insertHtml(addonHTML);
}
window.close();
}
</SCRIPT>


+ 1
- 1
src/include/inc/inc_fun_funAdmin.php View File

@@ -173,7 +173,7 @@ function SpGetEditor($fname, $fvalue, $nheight = "350", $etype = "Basic", $gtype
} else if ($GLOBALS['cfg_html_editor'] == 'ckeditor') {
$addConfig = "";
if (defined("DEDEADMIN")) {
$addConfig = ",{filebrowserImageUploadUrl:'./dialog/select_images_post.php',filebrowserUploadUrl:'./dialog/select_media_post.php?ck=1'}";
$addConfig = ",{filebrowserImageUploadUrl:'./dialog/select_images_post.php',filebrowserUploadUrl:'./dialog/select_media_post.php?ck=1',extraPlugins:'html5video,dedepagebreak,ddfilebrowser'}";
// $addConfig = ",{filebrowserImageUploadUrl:'./dialog/select_images_post.php'}";
}
$code = <<<EOT


BIN
src/static/ckeditor/plugins/ddfilebrowser/icons/ddfilebrowser.png View File

Before After
Width: 16  |  Height: 16  |  Size: 1.2KB

+ 20
- 0
src/static/ckeditor/plugins/ddfilebrowser/plugin.js View File

@@ -0,0 +1,20 @@
CKEDITOR.plugins.add("ddfilebrowser", {
icons: "ddfilebrowser",
init: function (a) {
a.addCommand("openDDFileBrowser",
{
exec: function (a)
{
if ($Nav() == 'IE') { var posLeft = window.event.clientX - 200; var posTop = window.event.clientY - 50; }
else { var posLeft = 100; var posTop = 100; }
window.open("./dialog/select_soft.php?f=" + a.name, "popUpImagesWin", "scrollbars=yes,resizable=yes,statebar=no,width=600,height=400,left=" + posLeft + ", top=" + posTop);
}
});
a.ui.addButton("DDFileBrowser",
{
label: "插入附件",
command: "openDDFileBrowser",
toolbar: "insert"
})
}
});

BIN
src/static/img/addon.gif View File

Before After
Width: 18  |  Height: 18  |  Size: 681B Width: 16  |  Height: 16  |  Size: 1.4KB

Loading…
Cancel
Save