Azure / api-management-developer-portal

Developer portal provided by the Azure API Management service.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pasting multiline text to formatted block results in only first line inside the block

Suunto-PekkaV opened this issue · comments

Bug description

Pasting multiline text to formatted block results in only the first line inside the block. The rest of the lines are pasted as normal text after the formatted block.

This makes copy-pasting code snippets very inconvenient.

Reproduction steps

  1. Copy any multiline text from text editor such as Visual Studio Code, Notepad++, Notepad to clipboard.
  2. In the developer portal, add a text widget and an empty formatted block to it by choosing "Formatted" option in the toolbar.
  3. Focus the empty formatted block and paste the text from clipboard into it.
1-empty-formatted-block

The result looks like this:
2-result-after-pasting

Expected behavior

The whole multiline is pasted inside the formatted block.

Is your portal managed or self-hosted?

Managed

Environment

  • Operating system: Windows 10
  • Browser: Google Chrome

Additional context

Pasting the text has different results depending on where the text is copied.

Visual Studio Code, Notepad++, Notepad
Results like in this bug description.

Pre-formatted text on a web page
All text is pasted inside the formatted block, but the line breaks are lost.

IntelliJ IDEA
All text is pasted inside the formatted block, but indentation is lost.

Message in Teams chat
Everything is pasted correctly inside the block, except if there's an empty line which results in all text after that pasted after the formatted block.

hello @Suunto-PekkaV , thanks for reaching out.
The actions you perform over the text from the text widget are applied to the selected lines. If you select all the lines and then choose "Formatted" option from the toolbar, the option should be applied to all the lines.
I believe what is happening for you is that you only have the first line selected and this is why the option is only applied for that line. Could you please confirm whether this is the case or not? Thanks!

Hi, thanks for looking into this.

This bug is about copy-pasting text into an existing formatted block. There's another closed issue about selecting existing regular text and then applying the "Formatted" option to it:
#140

The solution there is to write the line breaks with CTRL-Enter, which does work. But that doesn't help much with copy-pasted texts because you have to go and manually replace all line breaks with the "CTRL-Enter" -one after pasting.

I also tried this:

  1. Add a formatted text block, input some lines and focus all of them:
formatted-block-with-many-lines-selected 2. Paste a multiline text.

However, the results is exactly the same as in original bug description.

oh, I understand now. But this is by design: if you want to have a multiline formatted text block you can't use \n (which is by default when using copy+paste) but you have to use Ctrl+Enter to create the line-break.

Since the text widget works directly with HTML and Ctrl+Enter doesn't have a standard character associated, it would be pretty hard to "fix" this.

I have created an internal work item for to investigate this further for possible solutions. Thank you for reporting it! 😊

For managed portal, please create a support request using azure help and support center

https://learn.microsoft.com/en-us/azure/azure-portal/supportability/how-to-create-azure-support-request