ueditor_hightlighter.html
3.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<script
src="${BASE_PATH }static/component/ueditor/third-party/SyntaxHighlighter/shCore.js"></script>
<link
href="${BASE_PATH }static/component/ueditor/third-party/SyntaxHighlighter/shCoreDefault.css"
rel="stylesheet" type="text/css">
<!--
<script
src="${BASE_PATH }static/component/syntaxhighlighter/scripts/shCore.js"></script>
<link
href="${BASE_PATH }static/component/syntaxhighlighter/styles/shCoreDefault.css"
rel="stylesheet" type="text/css">
-->
<script src="${BASE_PATH }static/component/syntaxhighlighter/scripts/shBrushBash.js"></script>
<script src="${BASE_PATH }static/component/syntaxhighlighter/scripts/shBrushCss.js"></script>
<script src="${BASE_PATH }static/component/syntaxhighlighter/scripts/shBrushJava.js"></script>
<script
src="${BASE_PATH }static/component/syntaxhighlighter/scripts/shBrushJavaFX.js"></script>
<script
src="${BASE_PATH }static/component/syntaxhighlighter/scripts/shBrushJScript.js"></script>
<script src="${BASE_PATH }static/component/syntaxhighlighter/scripts/shBrushPhp.js"></script>
<script src="${BASE_PATH }static/component/syntaxhighlighter/scripts/shBrushSql.js"></script>
<script src="${BASE_PATH }static/component/syntaxhighlighter/scripts/shBrushXml.js"></script>
<script type="text/javascript">
$(function () {
// Line wrap back
var shLineWrap = function () {
$('.syntaxhighlighter').each(function () {
// Fetch
var $sh = $(this),
$gutter = $sh.find('td.gutter'),
$code = $sh.find('td.code')
;
// Cycle through lines
$gutter.children('.line').each(function (i) {
// Fetch
var $gutterLine = $(this),
$codeLine = $code.find('.line:nth-child(' + (i + 1) + ')')
;
//alert($gutterLine);
// Fetch height
var height = $codeLine.height() || 0;
if (!height) {
height = 'auto';
}
else {
height = height += 'px';
//alert(height);
}
// Copy height over
$gutterLine.attr('style', 'height: ' + height + ' !important'); // fix by Edi, for JQuery 1.7+ under Firefox 15.0
// console.debug($gutterLine.height(), height, $gutterLine.text(), $codeLine);
});
});
};
// Line wrap back when syntax highlighter has done it's stuff
var shLineWrapWhenReady = function () {
if ($('.syntaxhighlighter').length === 0) {
setTimeout(shLineWrapWhenReady, 10);
}
else {
shLineWrap();
}
};
// Fire
shLineWrapWhenReady();});
$(function() {
SyntaxHighlighter.all();
});
</script>
<style>
.syntaxhighlighter {
width: 100% !important;
margin: .3em 0 .3em 0 !important;
position: relative !important;
overflow: auto !important;
background-color: #f5f5f5 !important;
border: 1px solid #ccc !important;
word-break: break-all;
}
.syntaxhighlighter td.code .container textarea {
box-sizing: border-box !important;
position: absolute !important;
left: 0 !important;
top: 0 !important;
width: 100% !important;
height: 100% !important;
border: none !important;
background: white !important;
padding-left: 1em !important;
overflow: hidden !important;
white-space: pre !important;
}
</style>