묻고답하기
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
[제로님] 에디터 콤포넌트 Code Highlighter 스크롤바에 대한 ........
2008.10.14 19:48
안녕하세요?
BNU 님의 에디터 콤포넌트 Code Highlighter 를 사용하고 있습니다
그런데 가로로 좀 긴줄이 있으면 어김없이 스크롤바가 생겨 난감합니다
아무리 소스코드를 들여다 봐도 콤포넌트에서는 방법을 찾질 못하겠네요.
ZBXE 문제일까요?
해결할 방법이 있을까요?
꼭 필요한건데...... ㅠ.ㅠ
/**
* Code Syntax Highlighter.
* Version 1.5.1
* Copyright (C) 2004-2007 Alex Gorbatchev.
* http://www.dreamprojections.com/syntaxhighlighter/
*
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General
* Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//
// create namespaces
//
var dp = {
sh :
{
Toolbar : {},
Utils : {},
RegexLib: {},
Brushes : {},
Strings : {
AboutDialog : '<html><head><title>About...</title></head><body class="dp-about"><table cellspacing="0"><tr><td class="copy"><p class="title">dp.SyntaxHighlighter</div><div class="para">Version: {V}</p><p><a href="http://www.dreamprojections.com/syntaxhighlighter/?ref=about" target="_blank">http://www.dreamprojections.com/syntaxhighlighter</a></p>©2004-2007 Alex Gorbatchev.</td></tr><tr><td class="footer"><input type="button" class="close" value="OK" onClick="window.close()"/></td></tr></table></body></html>'
},
ClipboardSwf : null,
Version : '1.5.1'
}
};
// make an alias
dp.SyntaxHighlighter = dp.sh;
//
댓글 3
-
forest535
2008.10.14 20:05
-
forest535
2008.10.14 20:17
http://homepage.hamburg.de/bandara/shBrush/Core.uncompressed.js.html
제작자 홈에 올려져 있는 코드도 스크롤이 생기는군요...ㅠ.ㅠ -
후티
2008.11.11 16:42
이 방법이 정확한것인지는 모르겠지만^^;; 저는 이렇게 해결 했습니다.
SyntaxHighlighter.css 파일
.dp-highlighter
{
font-family: "Consolas", "Courier New", "Courier", "mono", "serif";
font-size: 12px;
background-color: #E7E5DC;
width: 350;
table-layout:fixed;
word-break:break-all;
height : auto ;
overflow: auto;
padding-top: 1px; /* adds a little border on top when controls are hidden */
}
이상과 같이 다음 세줄 추가해 주니.. 일단 제가 원하는 모양으로 나오네요;;
table-layout:fixed;
word-break:break-all;
height : auto ;
참고만; 하시기 바랍니다
짧은 코등
function transHTML($xml_obj) { $code_type = $xml_obj->attrs->code_type; $option_file_path = $xml_obj->attrs->file_path; $option_description = $xml_obj->attrs->description; $option_first_line = $xml_obj->attrs->first_line; $option_collapse = $xml_obj->attrs->collapse; $option_nogutter = $xml_obj->attrs->nogutter; $option_nocontrols = $xml_obj->attrs->nocontrols; if($option_collapse == 'true') $option = $option.':collapse'; if($option_nogutter == 'true') $option = $option.':nogutter'; if($option_nocontrols == 'true' && $option_collapse != 'true') $option = $option.':nocontrols'; if($option_first_line > 1) $option = $option.":firstline[$option_first_line]"; $body = $xml_obj->body; $body = preg_replace('@(<br\\s*/?>)(\n)?@i' , "\n", $body); $body = strip_tags($body); if(!$GLOBALS['_called_editor_component_code_highlighter_']) { $GLOBALS['_called_editor_component_code_highlighter_'] = true; $js_code = <<<dpScript <script type="text/javascript"> dp.SyntaxHighlighter.ClipboardSwf = '{$this->component_path}script/clipboard.swf'; dp.SyntaxHighlighter.HighlightAll('code'); </script> dpScript; Context::addHtmlFooter($js_code); Context::addCSSFile($this->component_path.'+ 'css/SyntaxHighlighter.css'); Context::addJsFile($this->component_path.'script/shCore.js'); } Context::addJsFile($this->component_path.'script/shBrush'.$code_type.'.js'); $output = null; if($option_file_path != null || $option_description != null) { $output .= '<div class="ch_infobox">'; if($option_file_path != null) $output .= '<span class="file_path">'.$option_file_path.'</span>'; if($option_description != null) $output .= '<span class="description">'.$option_description.'</span>'; $output .= '</div>'; } $output .= sprintf('<pre name="code" class="%s">%s</pre>', $code_type.$option, $body); return $output; } }