How to insert new line 2 times using 'comment.appendText' or 'comment.appendMarkdown'



已于 2023年10月14日 发布

I'm trying to edit a comment using the ZAF comment object. I tried to show the comment including new line twice using comment.appendText or comment.appendMarkdown as below examples but these didn't work well:

  • comment.appendText - \n
const client = ZAFClient.init();
client.invoke('comment.appendText', "First line\n\nThird line").then(~~~~~~

First line Third line

  • comment.appendText - separate multiple calls
const client = ZAFClient.init();
client.invoke('comment.appendText', "First line").then(~~~~~~
client.invoke('comment.appendText', "").then(~~~~~~
client.invoke('comment.appendText', "Third line").then(~~~~~~

First line

Third line

  • comment.appendMarkdown - \n
const client = ZAFClient.init();
client.invoke('comment.appendMarkdown', "First line\n\nThird line").then(~~~~~~

First line

Third line

  • comment.appendMarkdown - 2 spaces
const client = ZAFClient.init();
client.invoke('comment.appendMarkdown', "First line Third line").then(~~~~~~

First line Third line

  • comment.appendMarkdown - <br>
const client = ZAFClient.init();
client.invoke('comment.appendMarkdown', "First line<br><br>Third line").then(~~~~~~

First line<br><br>Third line

  • comment.appendMarkdown - separate multiple calls
const client = ZAFClient.init();
client.invoke('comment.appendMarkdown', "First line").then(~~~~~~
client.invoke('comment.appendMarkdown', "").then(~~~~~~
client.invoke('comment.appendMarkdown', "Third line").then(~~~~~~

First line

Third line

 

 

Does anyone know how to achieve inserting new line twice using comment.appendText or comment.appendMarkdown?

Note: As my few times research, I could find the workaround using commnet.appendHtml and <p> tag like below but if anyone has another idea, I would like to know it:

const client = ZAFClient.init();
client.invoke('comment.appendHtml', "First line<p></p><p></p>Third line").then(~~~~~~

First line

 

Third line


0

2

0 条评论

登录以发表评论。

找不到所需的内容?

新建帖子