Compare commits
18 Commits
66da36a907
...
52259d573c
| Author | SHA1 | Date | |
|---|---|---|---|
| 52259d573c | |||
| a680391d86 | |||
| 0e0ed64b38 | |||
| 5221b43c01 | |||
| a373ee7163 | |||
| 07692a2a29 | |||
| 3c7bdd8ac9 | |||
| db3b704d89 | |||
| 6e3e0d59db | |||
| f8884aa736 | |||
| 8e62d95864 | |||
| 7bf88fd578 | |||
| a4330c1216 | |||
| 6c80dbabeb | |||
| e0009fb8fa | |||
| 702e874e08 | |||
| 7e486e463c | |||
| df482bbcdd |
@@ -172,6 +172,45 @@
|
||||
})
|
||||
}, 300);
|
||||
});
|
||||
// 英文截断
|
||||
// 处理 #rendered-content 内的内容
|
||||
$('#rendered-content').html(function(i, html) {
|
||||
// 1. 先保护真正的空行(只包含 的标签)
|
||||
html = html.replace(/<(p|h[1-6])>(<strong>)?( | )*(<\/strong>)?<\/\1>/g, function(match) {
|
||||
// 统一空行格式为 <p> </p> 或 <h2> </h2> 形式
|
||||
return match.replace(/(<p>|<h[1-6]>)\s*(<strong>)?\s*( | )*\s*(<\/strong>)?\s*(<\/p>|<\/h[1-6]>)/,
|
||||
function(m) {
|
||||
var tag = m.match(/<(p|h[1-6])>/)[1];
|
||||
return '<' + tag + '> </' + tag + '>';
|
||||
});
|
||||
});
|
||||
|
||||
// 2. 替换其他 为普通空格(保留单词间的空格)
|
||||
html = html.replace(/ (?=\w)/g, ' ');
|
||||
|
||||
return html;
|
||||
});
|
||||
|
||||
// 添加CSS样式确保英文单词完整换行
|
||||
$('#rendered-content').css({
|
||||
'word-wrap': 'break-word',
|
||||
'overflow-wrap': 'break-word',
|
||||
'word-break': 'normal',
|
||||
'white-space': 'normal'
|
||||
});
|
||||
|
||||
// 优化英文单词间的空格处理
|
||||
$('#rendered-content').find('p, h1, h2, h3, h4, h5, h6').each(function() {
|
||||
var $el = $(this);
|
||||
// 只处理非空行
|
||||
if ($el.html().trim() !== ' ') {
|
||||
var html = $el.html()
|
||||
.replace(/([a-zA-Z])( | )+([a-zA-Z])/g, '$1 $3') // 单词间保留一个空格
|
||||
.replace(/(\d)( | )+([a-zA-Z])/g, '$1 $3') // 数字和单词间
|
||||
.replace(/([a-zA-Z])( | )+(\d)/g, '$1 $3'); // 单词和数字间
|
||||
$el.html(html);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{/block}
|
||||
@@ -144,7 +144,21 @@ body {
|
||||
margin: 0;
|
||||
padding: 0
|
||||
}
|
||||
|
||||
/* 空白占位符样式 */
|
||||
.space-char {
|
||||
display: inline;
|
||||
white-space: pre; /* 保留空白 */
|
||||
position: relative;
|
||||
padding-right: 0.15em; /* 视觉间距补偿 */
|
||||
}
|
||||
.space-char:after {
|
||||
content: " ";
|
||||
visibility: hidden;
|
||||
}
|
||||
.space-replaced {
|
||||
display: inline;
|
||||
white-space: normal;
|
||||
}
|
||||
.ql-editor {
|
||||
box-sizing: border-box;
|
||||
line-height: 1.42;
|
||||
@@ -155,23 +169,37 @@ body {
|
||||
tab-size: 4;
|
||||
-moz-tab-size: 4;
|
||||
text-align: left;
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word; /* 兼容旧浏览器 */
|
||||
overflow-wrap: break-word; /* 优先在空格处换行,避免单词拆分 */
|
||||
word-break: normal; /* 禁止强制拆分单词 */
|
||||
hyphens: auto; /* 可选:超长单词用连字符换行(更优雅) */
|
||||
word-wrap: break-word;
|
||||
overflow-wrap: break-word;
|
||||
word-break: normal;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.ql-editor>* {
|
||||
cursor: text
|
||||
cursor: text;
|
||||
word-break: normal;
|
||||
overflow-wrap: normal;
|
||||
}
|
||||
|
||||
.ql-editor p,.ql-editor ol,.ql-editor ul,.ql-editor pre,.ql-editor blockquote,.ql-editor h1,.ql-editor h2,.ql-editor h3,.ql-editor h4,.ql-editor h5,.ql-editor h6 {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
counter-reset: list-1 list-2 list-3 list-4 list-5 list-6 list-7 list-8 list-9
|
||||
counter-reset: list-1 list-2 list-3 list-4 list-5 list-6 list-7 list-8 list-9;
|
||||
word-wrap: break-word;
|
||||
overflow-wrap: break-word;
|
||||
word-break: keep-all;
|
||||
white-space: normal;
|
||||
}
|
||||
/* 移动端优化 */
|
||||
@media (max-width: 768px) {
|
||||
.narshelpCenterdetail-app .nhlp-app-content {
|
||||
width: 95%;
|
||||
}
|
||||
.ql-editor p,
|
||||
.ql-editor li {
|
||||
display: block; /* 移动端改用块级布局 */
|
||||
}
|
||||
}
|
||||
|
||||
.ql-editor ol,.ql-editor ul {
|
||||
padding-left: 1.5em
|
||||
}
|
||||
|
||||
@@ -40,9 +40,12 @@
|
||||
}
|
||||
|
||||
.narshelpCenterdetail-app .nhlp-app-content {
|
||||
margin: 1.25rem;
|
||||
/* margin: 1rem; */
|
||||
height: 100%;
|
||||
margin-top: 9.2vh;
|
||||
width: 90%;
|
||||
margin: 0 auto;
|
||||
margin-top: 5rem;
|
||||
}
|
||||
|
||||
.narshelpCenterdetail-app #rendered-content img {
|
||||
|
||||
@@ -212,6 +212,7 @@
|
||||
.header-PC #header .nav3 .choesCountry {
|
||||
position: relative;
|
||||
margin-left: 15%;
|
||||
display: flex;
|
||||
}
|
||||
.header-PC #header .nav3 .choesCountry .topCountry {
|
||||
display: none;
|
||||
|
||||
@@ -410,7 +410,7 @@
|
||||
flex-direction: column;
|
||||
}
|
||||
.orico_Page_prdetail .oriprdetail .oriprInfo img {
|
||||
max-width: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
.orico_Page_prdetail .oriprdetail .oriprInfo .titleprinfo {
|
||||
text-align: center;
|
||||
|
||||
@@ -254,21 +254,23 @@ div{
|
||||
tab-size: 4;
|
||||
-moz-tab-size: 4;
|
||||
text-align: left;
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word; /* 兼容旧浏览器 */
|
||||
overflow-wrap: break-word; /* 优先在空格处换行,避免单词拆分 */
|
||||
word-break: normal; /* 禁止强制拆分单词 */
|
||||
hyphens: auto; /* 可选:超长单词用连字符换行(更优雅) */
|
||||
word-wrap: normal;
|
||||
overflow-wrap: normal;
|
||||
word-break: normal;
|
||||
hyphens: manual;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.ql-editor>* {
|
||||
cursor: text
|
||||
cursor: text;
|
||||
}
|
||||
|
||||
.ql-editor p,.ql-editor ol,.ql-editor ul,.ql-editor pre,.ql-editor blockquote,.ql-editor h1,.ql-editor h2,.ql-editor h3,.ql-editor h4,.ql-editor h5,.ql-editor h6 {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
counter-reset: list-1 list-2 list-3 list-4 list-5 list-6 list-7 list-8 list-9
|
||||
counter-reset: list-1 list-2 list-3 list-4 list-5 list-6 list-7 list-8 list-9;
|
||||
overflow-wrap: anywhere;
|
||||
word-break: keep-all;
|
||||
}
|
||||
|
||||
.ql-editor ol,.ql-editor ul {
|
||||
|
||||
Reference in New Issue
Block a user