123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- /**
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
- * For licensing, see https://ckeditor.com/legal/ckeditor-oss-license
- */
- CKEDITOR.editorConfig = function( config ) {
- // Define changes to default configuration here. For example:
- // config.language = 'fr';
- // config.uiColor = '#AADC6E';
- config.font_names =
- '宋体/SimSun;' +
- '黑体/SimHei;' +
- '仿宋/FangSong;' +
- '楷体/KaiTi;' +
- '隶书/LiSu;' +
- '幼圆/YouYuan;' +
- '微软雅黑/Microsoft YaHei;' +
- config.font_names;
- // 确保字体插件被加载
- config.extraPlugins = 'font';
- // 可选:设置默认字体
- config.font_defaultLabel = '宋体';
- // 可选:允许所有字体大小
- config.fontSize_sizes = '8/8px;9/9px;10/10px;11/11px;12/12px;14/14px;16/16px;18/18px;20/20px;22/22px;24/24px;26/26px;28/28px;36/36px;48/48px;72/72px';
- // 可选:设置默认字体大小
- config.fontSize_defaultLabel = '12px';
- // 设置内容CSS
- config.contentsCss = '/public/ckeditor/custom-ckeditor.css';
- // 允许额外的CSS类
- config.extraAllowedContent = 'div(page-break)';
- // 设置编辑器的宽度,高度可以设置为自动
- config.width = '100%';
- config.height = 'auto';
- // 添加分页符插件(如果需要)
- config.extraPlugins = 'pagebreak';
- // 设置工具栏位置在编辑区域上方
- config.toolbarLocation = 'top';
- // 设置正确的上传URL
- var uploadUrl = 'http://58.246.234.210:8084/upload/file';
- // 设置图片上传的参数名为 'file'
- config.imageUploadParam = 'file';
- // 设置文件浏览器上传URL和方法
- config.filebrowserUploadUrl = uploadUrl;
- config.filebrowserImageUploadUrl = uploadUrl;
- /* config.filebrowserUploadMethod = 'form'; */
- /* // 确保 'image' 插件被加载
- config.extraPlugins = (config.extraPlugins ? config.extraPlugins + ',image' : 'image');
- // 配置图片上传
- config.uploadUrl = uploadUrl;
- // 自定义文件上传处理
- config.uploadFile = function( file, successCallback, failureCallback ) {
- var xhr = new XMLHttpRequest();
- var fd = new FormData();
-
- fd.append('file', file); // 使用 'file' 作为参数名
- xhr.open('POST', uploadUrl, true);
- xhr.onload = function() {
- if (xhr.status === 200) {
- var response = JSON.parse(xhr.responseText);
- successCallback(response.url);
- } else {
- console.error('Server responded with:', xhr.status, xhr.statusText);
- console.error('Response text:', xhr.responseText);
- failureCallback('Upload failed: ' + xhr.status + ' ' + xhr.statusText);
- }
- };
- xhr.onerror = function() {
- console.error('Network error occurred');
- failureCallback('Network error occurred');
- };
- xhr.send(fd);
- }; */
- };
|