本帖最后由 文艺君猫王 于 2014-6-9 18:29 编辑
X3.1测试无误!,其他版本可用于思路参考。
动刀的文件有两个,请提前备份: 1. static/image/editor/editor_function.js 2. template/default/home/spacecp_blog.htm
开始了 ↓
文件:static/image/editor/editor_function.js 操作:复制一份,重命名为:bgeditor_function.js
编辑:editor_function.js 查找: - function insertImage(image, url, width, heigh) {
- url = typeof url == 'undefined' || url === null ? image : url;
- width = typeof width == 'undefined' || width === null ? 0 : parseInt(width);
- height = typeof height == 'undefined' || height === null ? 0 : parseInt(height);
- var html = '<p><a href="' + url + '" target="_blank"><img src="'+image+'"'+(width?' width="'+width+'"':'')+(height?' height="'+height+'"':'')+'></a></p>';
- edit_insert(html);
- }
复制代码替换为: - function insertImage(image, url, width, height,subject) {
- url = typeof url == 'undefined' || url === null ? image : url;
- width = typeof width == 'undefined' || width === null ? 0 : parseInt(width);
- height = typeof height == 'undefined' || height === null ? 0 : parseInt(height);
- subject = $('title').value;
- var html = '<p><a href="' + url + '" target="_blank"><img alt="'+subject+'" src="'+image+'"'+(width?' width="'+width+'"':'')+(height?' height="'+height+'"':'')+'></a></p>';
- edit_insert(html);
- }
复制代码再编辑:bgeditor_function.js 查找: - function insertImage(image, url, width, heigh) {
- url = typeof url == 'undefined' || url === null ? image : url;
- width = typeof width == 'undefined' || width === null ? 0 : parseInt(width);
- height = typeof height == 'undefined' || height === null ? 0 : parseInt(height);
- var html = '<p><a href="' + url + '" target="_blank"><img src="'+image+'"'+(width?' width="'+width+'"':'')+(height?' height="'+height+'"':'')+'></a></p>';
- edit_insert(html);
- }
复制代码替换为: - <blockquote><blockquote>function insertImage(image, url, width, height,subject) {
复制代码再编辑:template/default/home/spacecp_blog.htm
测试:发布一篇带有图片的文章;
验证:在点击发布之前,切换到源代码(纯文本)查看 Alt="这里是否有了文章标题呢?(前提是你写了标题)";
结果: 1. 有,则操作成功。恭喜您! 2. 无,则操作失败,请还原备份再细心操作一遍,如还不行,可选择回复本贴寻求帮助。 |