From 97b851e8a6578f3de05e48c310db36071795094c Mon Sep 17 00:00:00 2001 From: liangjiami <2249412933@qq.com> Date: Thu, 17 Jul 2025 11:30:52 +0800 Subject: [PATCH] 1 --- .../view/mobile/topic_nas/help_detail.html | 23 +++++++++++++++++++ public/static/index/mobile/css/public.css | 12 ++++------ 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/app/index/view/mobile/topic_nas/help_detail.html b/app/index/view/mobile/topic_nas/help_detail.html index af4840d0..c99ac59e 100644 --- a/app/index/view/mobile/topic_nas/help_detail.html +++ b/app/index/view/mobile/topic_nas/help_detail.html @@ -172,6 +172,29 @@ }) }, 300); }); + // 英文单词截断 + // 1. 基础CSS保证(必须) + $('.ql-editor').css({ + 'word-break': 'normal', + 'overflow-wrap': 'anywhere', + 'overflow-x': 'hidden' + }); + + // 2. 智能处理文本节点 + $('.ql-editor').contents().each(function() { + if (this.nodeType === 3) { // 只处理文本节点 + const $wrapper = $('').addClass('word-wrapper'); + $(this).replaceWith($wrapper.text(this.nodeValue)); + } + }); + + // 3. 处理长单词(10个字符以上) + $('.word-wrapper').html(function(_, html) { + return html.replace(/([a-zA-Z]{10,})/g, function(match) { + return match.replace(/([a-z])([A-Z])/g, '$1$2') + .replace(/(.{5})/g, '$1'); + }); + }); }); {/block} \ No newline at end of file diff --git a/public/static/index/mobile/css/public.css b/public/static/index/mobile/css/public.css index 3dbb4bd8..0ac54041 100755 --- a/public/static/index/mobile/css/public.css +++ b/public/static/index/mobile/css/public.css @@ -156,12 +156,12 @@ body { -moz-tab-size: 4; text-align: left; word-wrap: normal; - overflow-wrap: normal; - word-break: normal; - hyphens: manual; - white-space: normal; + +} +.word-wrapper { + display: inline-block; + max-width: 100%; } - .ql-editor>* { cursor: text; word-break: normal; @@ -172,8 +172,6 @@ body { margin: 0; padding: 0; 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 {