📄 wysiwyg_editor.htm
字号:
<!--<?php
print <<<EOT
-->
<style type="text/css">
.wysiwyg{
padding:1px;
background-color:#F0F0EE;
width:560px;
border:1px solid #CCCCCC;
}
.htmlarea { background: #fff; }
.toolbar {
cursor: default;
background: #F0F0EE;
padding: 1px 1px 2px 1px;
border-bottom: 1px solid #CCCCCC;
}
.button {
background: #F0F0EE;
color: ButtonText;
border: 1px solid #F0F0EE;
padding: 1px;
margin: 0px;
width: 18px;
height: 18px;
}
.buttonHover {
border: 1px solid;
border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight;
}
.buttonActive,.buttonPressed {
padding: 2px 0px 0px 2px;
border: 1px solid;
border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow;
}
.buttonPressed {
background: ButtonHighlight;
}
.indicator {
padding: 0px 3px;
overflow: hidden;
width: 20px;
text-align: center;
cursor: default;
border: 1px solid ButtonShadow;
}
.buttonDisabled img {
filter: alpha(opacity = 25);
-moz-opacity: 0.25;
}
.separator {
position: relative;
margin: 3px;
border-left: 1px solid ButtonShadow;
border-right: 1px solid ButtonHighlight;
width: 0px;
height: 16px;
padding: 0px;
}
.space { width: 5px; }
.toolbar select { font: 11px Tahoma,Verdana,sans-serif; }
.toolbar select,
.toolbar select:hover,
.toolbar select:active { background: FieldFace; color: ButtonText; }
</style>
<script type="text/javascript">
var editor = null;
var imgpath="{$imgpath}";
var bbsurl="{$B_url}";
function initEditor() {
editor = new WYSIWYD("wysiwyg");
editor.init();
return false;
}
WYSIWYD.Config = function () {
this.baseURL = document.baseURI || document.URL;
if (this.baseURL && this.baseURL.match(/(.*)\/([^\/]?)/)){
this.baseURL = RegExp.$1 + "/";
}
this.imgURL = imgpath + "/post/c_editor/";
this.toolbar = [
[ "fontname", "space","fontsize", "space","formatblock", "space"],
[ "bold", "italic", "underline", "strikethrough", "separator",
"subscript", "superscript", "separator",
"copy", "cut", "paste","RemoveFormat","separator",
"undo", "redo","separator",
"rm","wmv","flash","separator",
"quote","code","br"
],
[ "justifyleft", "justifycenter", "justifyright", "justifyfull", "separator",
"forecolor", "hilitecolor", "separator",
"insertorderedlist", "insertunorderedlist", "outdent", "indent", "separator",
"createlink", "unlink", "separator",
"inserthorizontalrule","insertimage", "inserttable","separator",
"sale","htmlmode" //"soft",
]
];
this.fontname = {
"字体": '',
"宋体": '宋体',
"新宋体": '新宋体',
"楷体_GB2312": '楷体_GB2312',
"黑体": '黑体',
"Arial": 'arial,helvetica,sans-serif',
"Courier New": 'courier new,courier,monospace',
"Georgia": 'georgia,times new roman,times,serif',
"Tahoma": 'tahoma,arial,helvetica,sans-serif',
"Times New Roman": 'times new roman,times,serif',
"Verdana": 'verdana,arial,helvetica,sans-serif',
"impact": 'impact',
"WingDings": 'wingdings'
};
this.fontsize = {
"字号": "",
"1 (8 pt)": "1",
"2 (10 pt)": "2",
"3 (12 pt)": "3",
"4 (14 pt)": "4",
"5 (18 pt)": "5",
"6 (24 pt)": "6",
"7 (36 pt)": "7"
};
this.formatblock = {
"段落格式": "",
"普通": "p",
"标题一": "h1",
"标题二": "h2",
"标题三": "h3",
"标题四": "h4",
"标题五": "h5",
"标题六": "h6",
"已编排格式": "pre"
};
this.btnList = {
RemoveFormat:[ "RemoveFormat", "removeformat.gif", false, function(e) {e.execCommand("RemoveFormat");} ],
bold: [ "粗体", "bold.gif", false, function(e) {e.execCommand("bold");} ],
italic: [ "斜体", "italic.gif", false, function(e) {e.execCommand("italic");} ],
underline: [ "下划线", "underline.gif", false, function(e) {e.execCommand("underline");} ],
strikethrough: [ "删除线", "strike.gif", false, function(e) {e.execCommand("strikethrough");} ],
subscript: [ "下标", "sub.gif", false, function(e) {e.execCommand("subscript");} ],
superscript: [ "上标", "sup.gif", false, function(e) {e.execCommand("superscript");} ],
justifyleft: [ "左对齐", "justifyleft.gif", false, function(e) {e.execCommand("justifyleft");} ],
justifycenter: [ "居中", "center.gif", false, function(e) {e.execCommand("justifycenter");} ],
justifyright: [ "右对齐", "justifyright.gif", false, function(e) {e.execCommand("justifyright");} ],
justifyfull: [ "左右平等", "justify.gif", false, function(e) {e.execCommand("justifyfull");} ],
insertorderedlist: [ "有序列表", "list_num.gif", false, function(e) {e.execCommand("insertorderedlist");} ],
insertunorderedlist: [ "无序列表", "list_bullet.gif", false, function(e) {e.execCommand("insertunorderedlist");} ],
outdent: [ "取消缩进", "outdent.gif", false, function(e) {e.execCommand("outdent");} ],
indent: [ "缩进", "indent.gif", false, function(e) {e.execCommand("indent");} ],
forecolor: [ "字体颜色", "color_fg.gif", false, function(e) {e.execCommand("forecolor");} ],
hilitecolor: [ "背景颜色", "color_bg.gif", false, function(e) {e.execCommand("hilitecolor");} ],
inserthorizontalrule: [ "插入水平线", "hr.gif", false, function(e) {e.execCommand("inserthorizontalrule");} ],
createlink: [ "插入url链接", "createlink.gif", false, function(e) {e.execCommand("createlink", true);} ],
unlink: [ "删除链接", "unlink.gif", false, function(e) {e.execCommand("unlink", true);} ],
insertimage: [ "插入图片", "image.gif", false, insertImage ],
inserttable: [ "插入表格", "table.gif", false, insertTable ],
htmlmode: [ "源码", "html.gif", true, function(e) {e.execCommand("htmlmode");} ],
undo: [ "撤消", "undo.gif", false, function(e) {e.execCommand("undo");} ],
redo: [ "恢复", "redo.gif", false, function(e) {e.execCommand("redo");} ],
cut: [ "剪切", "cut.gif", false, function(e) {e.execCommand("cut");} ],
copy: [ "复制", "copy.gif", false, function(e) {e.execCommand("copy");} ],
paste: [ "粘贴", "paste.gif", false, function(e) {e.execCommand("paste");} ],
rm: [ "插入rm电影文件", "rm.gif", false, rming ],
wmv: [ "插入wmv在线播放", "mpeg.gif", false, wmv ],
flash: [ "插入flash动画", "swf.gif", false, setswf ],
quote: [ "插入引用", "quote.gif", false, quote ],
code: [ "插入代码", "code.gif", false, code ],
br: [ "换行", "br.gif", false, br ],
sale: [ "发表交易帖", "sale.gif", false, saletable ],
soft: [ "发布软件", "soft.gif", false, softtable ]
};
for (var i in this.btnList) {
var btn = this.btnList[i];
btn[1] = this.imgURL + btn[1];
}
};
</script>
<body onload="initEditor()">
<div class="wysiwyg">
<textarea id="wysiwyg" name="atc_content" rows="60" cols="10" style="border:0px;width:100%; height:350px" tabindex="100">{$atc_content}</textarea>
</div>
</body>
<!--
EOT;
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -