Keep formatting on pasting plain text

Build 1501 on 14/Nov/2017  This topic last edited on: 17/Mar/2016, at 16:49

By default, GN4 won't keep the formatting of the selected paragraphs when you paste over a plain text - the pasted text appears in the default format.

Example:

The text in a local frame is formatted by means of palettes to the specific font and type size. If you select the entire text in the frame, and than paste over a plain (or formatted) text from another software, by default, the formatting would be gone:

Click to toggle graphic size

Since the version 2.1, the preference Keep formatting on paste external is added, that maintains the formatting:

Click to toggle graphic size

Find the preference on the General sub-tab of the Extra tab on the Preferences of the Articles main tab, or while editing text on the Pages main tab:

Click to toggle graphic size

Caveats

It works only if you enable in your personal preferences Keep formatting on paste external, otherwise it destroys the formatting as before. The default setting is off.

Have in mind that the paste is a different operation than typing over a selection. For the description on how you can preserve the formatting when overwriting the selection, see Keep formatting when overwriting selection.

It works if you use CTRL+A to select all text, but not with other selection methods e.g. mouse. This because the trick is based on a silent copy of the first paragraph style to an internal clipboard. The copy is performed by the script that runs when you press CTRL+A. It would not be easy & possible to add the same to the manual selection by mouse, as it, technically speaking, triggers any captable event.

The paste operation replicates on all paragraphs the formatting of the first paragraph of the original text. If the formatting in the original text had variated formatting by paragraph, those variations are lost.

As “select all” and “paste” are two separate operations, that user perform one after another but not necessarily consecutive, with who knows how many other operation in the meantime, the script keeps the formatting to be pasted for a predefined period of time. The default time is 30 seconds. If you wait longer to paste, or if you abort paste whatsoever, the formatting in the “internal clipboard” will be cleared. This is to avoid silly problems with unexpected formatting paste, because an old value has been stored and never reused.

See also

Keep formatting on joining two paragraphs

Keep formatting when overwriting selection

Keep formatting when deleting selection

Keep formatting on Return key