التمييز النحوي لا يتم نسخه عند النسخ واللصق إلى مكان يدعم النص الملون

عندما قمت بنسخ ما يلي من منصة Discourse إلى عميل البريد الإلكتروني الخاص بي:

@@ -1,11 +1,11 @@
-جائزة المتطوع الشاب – احتفاء بالمتطوعين الشباب، الذين تتراوح أعمارهم بين 16 و24 عامًا، ويبذلون جهدًا إضافيًا في مجتمعاتهم المحلية، مُظهرين قيمنا وأهمية التواصل والعمل.
+تُكرّم جائزة المتطوع الشاب المتطوعين الشباب، الذين تتراوح أعمارهم بين 16 و24 عامًا، ويبذلون جهدًا إضافيًا في مجتمعاتهم المحلية، مُظهرين قيمنا وأهمية التواصل والعمل.
 
 هل تعرف شابًا:
 
-كان يتطوع مع برنامج مراقبة الأحياء ويُحدث تأثيرًا إيجابيًا في مجتمعه.
+• كان يتطوع مع برنامج مراقبة الأحياء ويُحدث تأثيرًا إيجابيًا في مجتمعه؟
 
-يُضحي بوقته لدعم مجتمعه المحلي (بنوك الطعام، ومراكز المجموعات المجتمعية، ومشرّدي الشوارع، والمجموعات الدينية)
+• يُضحي بوقته لدعم مجتمعه المحلي (بنوك الطعام، ومراكز المجموعات المجتمعية، ومشرّدي الشوارع، والمجموعات الدينية)؟
 
-نظّم أنشطة جمع تبرعات مع مدرسته أو كليته، أو قام بتنظيم حملات لجمع القمامة أو فعاليات محلية أخرى.
+• نظّم أنشطة جمع تبرعات مع مدرسته أو كليته، أو قام بتنظيم حملات لجمع القمامة أو فعاليات محلية أخرى؟
 
-تعتقد أن هذا المتطوع الشاب يستحق التقدير على جهوده والتزامه تجاه مجتمعه.
+في هذه الحالة، هل تعتقد أن هذا المتطوع الشاب يستحق التقدير على جهوده والتزامه تجاه مجتمعه؟

…فإنه لم يُكرّر التلوين.

هل استخدمت diff؟ ربما لا يدعم عميل البريد الإلكتروني الخاص بك ذلك؟

- هنا بعض النص
+ هنا المزيد من النص

@Lilly، نعم. تحديد diff ضروري لعرض التلوين في نظام Discourse:

  1. ```
    @@ -1,11 +1,11 @@
    -Young volunteer award – celebrating young volunteers, aged 16-24, who go the extra mile in their local communities, demonstrating our values and the importance of connection and action.
    +The Young Volunteer Award celebrates young volunteers, aged 16–24, who go the extra mile in their local communities, demonstrating our values and the importance of connection and action.
     
     Do you know a young person who:
     
    -Has been volunteering with Neighbourhood Watch and making a positive impact in their community.
    +• Has been volunteering with Neighbourhood Watch and making a positive impact in their community?
     
    -Gives up their time to support their local community (foodbanks, community hubs and groups, homeless, faith groups)
    +• Gives up their time to support their local community (foodbanks, community hubs and groups, homeless, faith groups)?
     
    -Held fundraising activities with their school or college or have organised litter picks or other local events.
    +• Held fundraising activities with their school or college or have organised litter picks or other local events?
     
    -You think this young volunteer deserves to be recognised for their hard work and commitment to their community.
    +If so, do you think this young volunteer deserves to be recognised for their hard work and commitment to their community?
    ```
    
  2. @@ -1,11 +1,11 @@
    -Young volunteer award – celebrating young volunteers, aged 16-24, who go the extra mile in their local communities, demonstrating our values and the importance of connection and action.
    +The Young Volunteer Award celebrates young volunteers, aged 16–24, who go the extra mile in their local communities, demonstrating our values and the importance of connection and action.
     
     Do you know a young person who:
     
    -Has been volunteering with Neighbourhood Watch and making a positive impact in their community.
    +• Has been volunteering with Neighbourhood Watch and making a positive impact in their community?
     
    -Gives up their time to support their local community (foodbanks, community hubs and groups, homeless, faith groups)
    +• Gives up their time to support their local community (foodbanks, community hubs and groups, homeless, faith groups)?
     
    -Held fundraising activities with their school or college or have organised litter picks or other local events.
    +• Held fundraising activities with their school or college or have organised litter picks or other local events?
     
    -You think this young volunteer deserves to be recognised for their hard work and commitment to their community.
    +If so, do you think this young volunteer deserves to be recognised for their hard work and commitment to their community?
    

هل تقصد أنني أكتب CommonMark في عميلي؟

إذا كان الأمر كذلك، فهذا من اختصاص مكان آخر:

بدلاً من ذلك، أشير إلى النسخ مباشرةً من التنسيق المُصغَّر هنا، مثل:

نعم، أنا أعرف ذلك بوضوح، ولهذا كنت أسألك.

@ليلي، كما يمكنك رؤية في /1، أنني استخدمته، ومع ذلك.

آه، اعتذاري، ظننت في البداية أن ذلك لقطة شاشة.

إعجاب واحد (1)

اليوم، يعتمد الأمر على كيفية نسخك له.

باستخدام زر النسخ:

يضع فقط النسخة النصية في الحافظة، من بين أمور أخرى:

TIMESTAMP,TARGETS,SAVE_TARGETS,MULTIPLE,UTF8_STRING,STRING,TEXT,text/plain,text/plain;charset=utf-8,chromium/x-internal-source-rfh-token,chromium/x-source-url

لكن نسخ النص الفعلي يعمل:

بما أنك تنسخ HTML المُصاغ عبر المتصفح بدلاً من تفاعل Discourse مع الحافظة، فإن text/HTML متاح كتنسيق لمتحصي الحافظة:

<span class="hljs-meta" style="color: rgb(133, 133, 133); font-style: italic; font-family: &quot;JetBrains Mono&quot;, Consolas, Monaco, monospace; font-size: 15.75px; font-variant-ligatures: none; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: pre; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">@@ -1,11 +1,11 @@</span><span style="color: rgb(199, 199, 199); font-family: &quot;JetBrains Mono&quot;, Consolas, Monaco, monospace; font-size: 15.75px; font-style: normal; font-variant-ligatures: none; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: pre; background-color: rgba(0, 0, 0, 0.25); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">\n</span><span class="hljs-deletion" style="background: none 0% 0% / auto repeat scroll padding-box border-box rgb(79, 24, 11); color: rgb(222, 113, 118); font-family: &quot;JetBrains Mono&quot;, Consolas, Monaco, monospace; font-size: 15.75px; font-style: normal; font-variant-ligatures: none; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: pre; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">-Young volunteer award \xe2\x80\x93 celebrating young volunteers, aged 16-24, who go the extra mile in their local communities, demonstrating our values and the importance of connection and action.</span><span style="color: rgb(199, 199, 199); font-family: &quot;JetBrains Mono&quot;, Consolas, Monaco, monospace; font-size: 15.75px; font-style: normal; font-variant-ligatures: none; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: pre; background-color: rgba(0, 0, 0, 0.25); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">\n</span><span class="hljs-addition" style="background: none 0% 0% / auto repeat scroll padding-box border-box rgb(11, 66, 32); color: rgb(118, 196, 144); font-family: &quot;JetBrains Mono&quot;, Consolas, Monaco, monospace; font-size: 15.75px; font-style: normal; font-variant-ligatures: none; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: pre; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">+The Young Volunteer Award celebrates young volunteers, aged 16\xe2\x80\x9324, who go the extra mile in their local communities, demonstrating our values and the importance of connection and action.</span><span style="color: rgb(199, 199, 199); font-family: &quot;JetBrains Mono&quot;, Consolas, Monaco, monospace; font-size: 15.75px; font-style: normal; font-variant-ligatures: none; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: pre; background-color: rgba(0, 0, 0, 0.25); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">\n</span><br class="Apple-interchange-newline">

لدعم ذلك عبر زر النسخ، سنحتاج إلى إضافة القدرة على أخذ النسخة الملونة المُصاغة (بما أنها ملونة عبر مكتبة) وإرسالها إلى الحافظة بتنسيق text/html. من المرجح أن هذا ممكن (ربما حتى كعنصر سمة)، ولكن في غضون ذلك، هناك دائمًا خيار النسخ عبر التحديد.

3 إعجابات

@supermathie، شكرًا لك. إذن، يبدو أن المشكلة تكمن في عميلي (protonMail/webClients، الإصدار 5.0.115.3 β):

Screencast20260522180439

ومع ذلك، يفشل التلوين أيضًا في التكرار داخل thunderbird-149.0.1-2.fc44، على الرغم من أنه يبدو أنه يعمل بشكل صحيح لديك:

هل لديك أي فكرة عما تفعله بشكل مختلف، إن وجد؟

عند النسخ إلى ProtonMail، وبما أنه عميل ويب، يبدو أنه يستخدم نسخة النص العادي. لاحظ عدم وجود تمييز في التنسيق، رغم أنه من الصعب التمييز لأنك تتجاوز الخطوط.

مقارنةً بلصق المحتوى في Thunderbird:

يتم التقاط بعض عناصر التنسيق، لكن ليس كلها.

إذا قمت بالنسخ، يتم التقاط كل شيء:

أعتقد أن حل هذه المشكلة يتطلب التمييز بين ما إذا كان:

  • لا يتم نسخ جميع الأنماط
  • لا يتم لصق جميع الأنماط

قد يساعد البدء من متصفح نظيف بدون إضافات في تحديد السبب؟ على سبيل المثال، إذا استخدمت متصفحًا خاصًا بدون إضافات وما إلى ذلك، سأحصل على:

هذا السكربت الذي كتبته سيمنحك أيضًا رؤية داخل الحافظة، مما قد يساعد.

(أو ربما Arch » Fedora :face_with_tongue:)

إعجاب واحد (1)

@supermathie، ذلك لأن ورقة الأنماط الافتراضية لـ ProtonMail سيئة للغاية.

وفقًا لتوجيهاتك، تأكدت من أن متصفح فايرفوكس نفسه (وليس حتى ملفي الشخصي، إذ تتكرر المشكلة مع ملف جديد في about:profiles) يفشل في نسخه:

أنا ممتن جدًا!

نعم! أحصل على نفس السلوك.

ومن الناحية الدقيقة، لا يُعدّ هذا خطأ. ففايرفوكس ينسخ HTML كما طُلب منه تمامًا:

<meta http-equiv="content-type" content="text/html; charset=utf-8">
<p dir="auto">عندما نسخت ما يلي من منصة ديسكورش إلى عميل البريد الإلكتروني الخاص بي:</p>
<pre data-code-wrap="diff" dir="auto" class="codeblock-buttons">
		<div class="codeblock-button-wrapper" style="right: 0px;"></div>
		<code class="lang-diff hljs language-diff" data-highlighted="yes">
			<span class="hljs-meta">@@ -1,11 +1,11 @@</span>
			<span class="hljs-deletion">-Young volunteer award – celebrating young volunteers, aged 16-24, who go the extra mile in their local communities, demonstrating our values and the importance of connection and action.</span>
			<span class="hljs-addition">+The Young Volunteer Award celebrates young volunteers, aged 16–24, who go the extra mile in their local communities, demonstrating our values and the importance of connection and action.</span>
		</code>
	</pre>

الاختلاف الناتج بعد اللصق يعود إلى أن كروميوم يقوم بتضمين الأنماط (inline styles) بينما لا يفعل فايرفوكس ذلك. وتبسيط الأمر إلى سطر واحد يسلط الضوء[1] على ما يحدث:

<span
  class="hljs-deletion">
-Young volunteer award – celebrating young volunteers, aged 16-24, who go the extra mile in their local communities, demonstrating our values and the importance of connection and action.
</span>
<span
  class="hljs-deletion"
  style="background: none 0% 0% / auto repeat scroll padding-box border-box rgb(255, 224, 224); color: rgb(192, 45, 46);">
-Young volunteer award – celebrating young volunteers, aged 16-24, who go the extra mile in their local communities, demonstrating our values and the importance of connection and action.
</span>

(تم إضافة فواصل أسطر)

كروميوم يقوم بتضمين النمط style="background: none 0% 0% / auto repeat scroll padding-box border-box rgb(255, 224, 224); color: rgb(192, 45, 46);" من class="hljs-deletion" إلى عنصر span، لأن ما يتم لصقه فيه على الأرجح لا يحتوي على هذا النمط.


  1. هاها ↩︎