簡體   English   中英

TinyMCE刪除了我的代碼並更改了我的html,所有解決方案都無法正常工作

[英]TinyMCE removes my code and changes my html, none of the solution is working

我使用的是Tiny MCE編輯器,當我保存html文本時,它會自動刪除我的內容,我已經在不同的論壇上查看了許多解決方案,但沒有一個解決此問題。

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Receipt Creation Failure</title> </head> <body style="font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#333;"> <div style="border:1px; border-color:#003; border-style:solid; width:600px; float:left"> <div style="float:left; padding-top:20px; width:560px; padding:20px; min-height:200px; "> <strong>Dear Team, </strong><br /> <br /> There was a payment attempt from the Test named <b>{TestName}</b> placed at <b>{TestLocation}</b>. <br This is a system generated message, please do not reply to this email address since it is not monitored.<br /> <br /> <strong>Thank you <br /> xyz Support Team </strong></div> <div style="width:580px; padding:10px; background-color:#132c4d; height:10px; text-align:right; clear:both; color:#FFF; text-decoration:none"><a style="color:#FFF; text-decoration:none;" href="https://emaar.service-now.com/" target="_blank">Contact Us</a> | <a href="http://xyz.ae/" target="_blank" style=" color:#FFF; text-decoration:none;">xyz.ae</a></div> </div> </body> </html> 

當我保存此信息時,它將轉換為

 <p>Receipt Creation Failure</p> <div style="border: 1px; border-color: #003; border-style: solid; width: 600px; float: left;"> <div style="float: left; padding-top: 20px; width: 560px; padding: 20px; min-height: 200px;"><strong>Dear Team, </strong><br /> <br /> There was a payment attempt from the Test named <strong>{TestName}</strong> placed at <strong>{TestLocation}</strong>. <br /> <br /> <strong>Thank you <br /> xyz Support Team </strong></div> <div style="width: 580px; padding: 10px; background-color: #132c4d; height: 10px; text-align: right; clear: both; color: #fff; text-decoration: none;"><a style="color: #fff; text-decoration: none;" href="https://emaar.service-now.com/" target="_blank">Contact Us</a> | <a style="color: #fff; text-decoration: none;" href="http://xyz.ae/" target="_blank">xyz.ae</a></div> </div> 

請幫忙。

這不是答案,但是注釋並不擅長格式化代碼。

  1. 這是一個內容編輯器,對於doctype和標頭,它的行為不會像您期望的那樣。
  2. 嘗試修剪HTML,僅保留<body>的內容。 在您的情況下:

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Receipt Creation Failure</title> </head> <body style="font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#333;"> <div style="border:1px; border-color:#003; border-style:solid; width:600px; float:left"> <div style="float:left; padding-top:20px; width:560px; padding:20px; min-height:200px; "> <strong>Dear Team, </strong> <br /> <br /> There was a payment attempt from the Test named <b>{TestName}</b> placed at <b>{TestLocation}</b>. <br This is a system generated message, please do not reply to this email address since it is not monitored.<br /> <br /> <strong>Thank you <br /> xyz Support Team </strong> </div> <div style="width:580px; padding:10px; background-color:#132c4d; height:10px; text-align:right; clear:both; color:#FFF; text-decoration:none"> <a style="color:#FFF; text-decoration:none;" href="https://emaar.service-now.com/" target="_blank">Contact Us</a> | <a href="http://xyz.ae/" target="_blank" style=" color:#FFF; text-decoration:none;">xyz.ae</a> </div> </div> </body> </html> 

成為:

 <div style="border:1px; border-color:#003; border-style:solid; width:600px; float:left"> <div style="float:left; padding-top:20px; width:560px; padding:20px; min-height:200px; "> <strong>Dear Team, </strong> <br /> <br /> There was a payment attempt from the Test named <b>{TestName}</b> placed at <b>{TestLocation}</b>. <br This is a system generated message, please do not reply to this email address since it is not monitored.<br /> <br /> <strong>Thank you <br /> xyz Support Team </strong> </div> <div style="width:580px; padding:10px; background-color:#132c4d; height:10px; text-align:right; clear:both; color:#FFF; text-decoration:none"> <a style="color:#FFF; text-decoration:none;" href="https://emaar.service-now.com/" target="_blank">Contact Us</a> | <a href="http://xyz.ae/" target="_blank" style=" color:#FFF; text-decoration:none;">xyz.ae</a> </div> </div> 

  1. 格式錯誤的HTML:

    <br This is a system generated message, please do not reply to this email address since it is not monitored.

最后,您應該或多或少擁有TinyMCE所得到的。

您是否嘗試過tinyMCE.activeEditor.getContent({format : 'raw'});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM