Page 1 of 1

Keeping formatting when pasting text to text editor

Posted: Wed Jun 20, 2018 3:19 am
by DoTheWriteThing
When I paste text, in this case code, the indenting gets lost. I get round this by editing the topic file in Sublime text.
Is there a setting which forces Flare to keep the original formatting?

Re: Keeping formatting when pasting text to text editor

Posted: Wed Jun 20, 2018 3:23 am
by ChoccieMuffin
Some people use a <pre> rather than a <p> for pasting code. I don't, so can't add any more detail, but others have found that works for them.

Re: Keeping formatting when pasting text to text editor

Posted: Wed Jun 20, 2018 1:01 pm
by Rona Kwestel
I do what you do, DTWT. Would love a better solution.

And for the record, I use <pre> tags, and it doesn't make a difference. The TextEditor is one of the low points of the Flare UI. It has several other flaws that wear me to the bone.

Re: Keeping formatting when pasting text to text editor

Posted: Wed Jun 20, 2018 1:24 pm
by RamonS
I understand the aggravation, but HTML5 does not know anything about tabs and tabstops. Indentation requires either styles or non-breaking spaces.
Depending on how many indentation levels are needed, adding styles might be the way to go (see https://www.w3schools.com/cssref/pr_tex ... indent.asp)....although applying them to each of the paragraphs is likely to get old really fast.
Would be neat to assign an indentation value for the tab key acting as accelerator. Pressing tab would then autoapply the proper style based on the style (or lack thereof) that is currently assigned. With tab values at 10% pressing Tab key three times would give a 30% indent. Feature request?

Re: Keeping formatting when pasting text to text editor

Posted: Fri Jun 22, 2018 1:04 am
by marcinse
What works for me is this:
1. Create a new paragraph and assign the <pre> style to it. That means it will preserve the formatting as set, including any spaces and line breaks.
2. Copy and paste the code into that <pre> block. Flare will insert the code as a bunch of <p>'s.
3. Immediately look for the little Paste icon that will appear directly beneath and to the right of the last block added.
4. Click that icon to open a little drop-down menu and select Paste Inline Text. Now all the pasted code should be within the <pre> block and the formatting should look right.
5. Highlight the <pre> block.
6. From the Paragraph pane in the toolbar, select Group.
7. Select <div>.

What I also do, is add a class to the div, so that the code is formatted how we want it - dark background and so on.

Re: Keeping formatting when pasting text to text editor

Posted: Fri Jun 22, 2018 7:04 am
by Rona Kwestel
Bless you, marcinse. I never noticed that Paste icon! So much time to be saved going forward.

I actually just style the <pre> tag with class="code", and that seems to work without adding the enclosing div. Any advantage to one over the other? But also good to remember that "Group" function, which I think I was once vaguely aware of and forgot existed. So double thanks!

Re: Keeping formatting when pasting text to text editor

Posted: Wed Jun 27, 2018 7:46 am
by DoTheWriteThing
marcinse wrote:What works for me is this:
1. Create a new paragraph and assign the <pre> style to it. That means it will preserve the formatting as set, including any spaces and line breaks.
2. Copy and paste the code into that <pre> block. Flare will insert the code as a bunch of <p>'s.
3. Immediately look for the little Paste icon that will appear directly beneath and to the right of the last block added.
4. Click that icon to open a little drop-down menu and select Paste Inline Text. Now all the pasted code should be within the <pre> block and the formatting should look right.
5. Highlight the <pre> block.
6. From the Paragraph pane in the toolbar, select Group.
7. Select <div>.

What I also do, is add a class to the div, so that the code is formatted how we want it - dark background and so on.
Hi Marcinse,
Thank you for this, I was going to write
I have tried that. But it seems to add a big margin at the left.
However, I just tried pasting from Sublime text, and all the formatting is retained. What is going on here? I don't know...

Re: Keeping formatting when pasting text to text editor

Posted: Wed Jan 16, 2019 2:22 am
by itauthor
The TextEditor is one of the low points of the Flare UI. It has several other flaws that wear me to the bone.
I couldn't agree more. Come on MadCap - sort this out. The editor is the fundamental part of Flare and it's barely usable.

Re: Keeping formatting when pasting text to text editor

Posted: Wed Jan 16, 2019 5:07 am
by Nita Beck
itauthor wrote:Come on MadCap - sort this out. The editor is the fundamental part of Flare and it's barely usable.
These are peer-to-peer forums. MadCap folk sometimes join us but they don’t generally follow the discussions. I suggest you submit a bug report/feature request (however you view this) to get MadCap’s attention.

Re: Keeping formatting when pasting text to text editor

Posted: Thu Jan 31, 2019 9:59 am
by DebbieN
Thank you - this works great and solves a number of issues that I am encountering.

However, I am running into an issue with superimposed text when employing the new <div>. The new code block - when viewed in HTML - appears under the preceding text.

How do I get Flare to honor distinct lines of text??

Probably a newbie issue - but, this also occurs in other instances. Still trying to figure out the rhyme or reason. I don't want to manually insert lines breaks. That defeats using responsive HTML.

Re: Keeping formatting when pasting text to text editor

Posted: Thu Sep 10, 2020 7:02 am
by moshe
I am running into an issue with superimposed text when employing the new <div>. The new code block - when viewed in HTML - appears under the preceding text.
This is another "feature" of the Flare XML editor. The editor does not display <div>s well at all. To avoid <div>s superimposed or appearing under surrounding tags, I find that I have to insert manual break tags <br /> before and after any <div> in Flare.
Also, the block structure bars to the left of the editor window do not display <div>s properly, nor can you reliably select a <div> in the structure bars.

Re: Keeping formatting when pasting text to text editor

Posted: Fri Sep 11, 2020 1:14 am
by NorthEast
moshe wrote:
I am running into an issue with superimposed text when employing the new <div>. The new code block - when viewed in HTML - appears under the preceding text.
This is another "feature" of the Flare XML editor. The editor does not display <div>s well at all. To avoid <div>s superimposed or appearing under surrounding tags, I find that I have to insert manual break tags <br /> before and after any <div> in Flare.
Also, the block structure bars to the left of the editor window do not display <div>s properly, nor can you reliably select a <div> in the structure bars.
In the XML Editor's toolbar, click the Show tags icon (looks like an eye), and de-select Object Positioning. That stops Flare trying to display elements in position, and stops these sort of problems.