Keeping formatting when pasting text to text editor

This forum is for all Flare issues not related to any of the other categories.
Post Reply
DoTheWriteThing
Propeller Head
Posts: 27
Joined: Mon May 14, 2018 6:21 am

Keeping formatting when pasting text to text editor

Post 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?
ChoccieMuffin
Senior Propellus Maximus
Posts: 2630
Joined: Wed Apr 14, 2010 8:01 am
Location: Surrey, UK

Re: Keeping formatting when pasting text to text editor

Post 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.
Started as a newbie with Flare 6.1, now using Flare 2023.
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
Rona Kwestel
Sr. Propeller Head
Posts: 212
Joined: Wed Apr 04, 2007 11:50 am

Re: Keeping formatting when pasting text to text editor

Post 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.
RamonS
Senior Propellus Maximus
Posts: 4293
Joined: Thu Feb 02, 2006 9:29 am
Location: The Electric City

Re: Keeping formatting when pasting text to text editor

Post 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?
marcinse
Jr. Propeller Head
Posts: 2
Joined: Thu Jun 21, 2018 8:28 am

Re: Keeping formatting when pasting text to text editor

Post 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.
Rona Kwestel
Sr. Propeller Head
Posts: 212
Joined: Wed Apr 04, 2007 11:50 am

Re: Keeping formatting when pasting text to text editor

Post 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!
DoTheWriteThing
Propeller Head
Posts: 27
Joined: Mon May 14, 2018 6:21 am

Re: Keeping formatting when pasting text to text editor

Post 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...
itauthor
Propeller Head
Posts: 32
Joined: Wed Jul 23, 2008 7:51 am
Location: Oxford, UK
Contact:

Re: Keeping formatting when pasting text to text editor

Post 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.
Nita Beck
Senior Propellus Maximus
Posts: 3667
Joined: Thu Feb 02, 2006 9:57 am
Location: Pittsford, NY

Re: Keeping formatting when pasting text to text editor

Post 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.
Nita
Image
RETIRED, but still fond of all the Flare friends I've made. See you around now and then!
DebbieN
Jr. Propeller Head
Posts: 1
Joined: Wed Jan 23, 2019 9:58 am

Re: Keeping formatting when pasting text to text editor

Post 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.
moshe
Propeller Head
Posts: 45
Joined: Tue Apr 05, 2016 10:10 pm
Location: Jerusalem, Israel

Re: Keeping formatting when pasting text to text editor

Post 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.
Moshe Davis
Jerusalem, Israel
NorthEast
Master Propellus Maximus
Posts: 6359
Joined: Mon Mar 05, 2007 8:33 am

Re: Keeping formatting when pasting text to text editor

Post 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.
Post Reply