Copy and Paste in the Rich Content Editor
Summarize
Summary of Copy and Paste in the Rich Content Editor
This document explains how to use the copy and paste functionality within the Rich Content Editor as of the Yokohama release (updated April 25, 2025). It covers how to copy and paste HTML and CSS source code for canvas elements, directly edit CSS styling, and migrate content from other sources while maintaining or adjusting formatting.
Show less
Key Features
- Copy and Paste HTML/CSS: Allows pasting of HTML and CSS code to add or modify content styling on the canvas.
- Background-color Handling: From the May 2025 release, pasted background colors will not display in the right-hand panel unless converted to
background-imagestyling, which supports layering of background colors, gradients, and images. - Color Opacity: New color opacity functionality is available but only supported via hex color codes (with 8-character syntax
#rrggbbaa) added through the edit code feature; the standard color input only accepts 6-character hex codes. - Edit Code Feature: Enables converting
rgba()colors to hex codes for accurate rendering and styling adjustments. - Component Toolbar: Copying components on the canvas requires using the component toolbar, as standard ctrl+v does not duplicate components as expected.
Limitations and Best Practices
- Browser behaviors vary; some paste functions work in Chrome but not in Firefox or Safari.
- Pasting highlighted text within text components is generally unsupported across browsers.
- Copying large content chunks may cause display or behavior issues; copying smaller sections is recommended.
- Some styles, such as font names, may fail to apply; clearing existing styling before pasting can help.
- Content pasted with script tags may be sanitized and removed upon saving and reloading.
- Hex color codes must begin with a hash (#) and can include opacity when using 8-character syntax via the edit code modal.
- When no component is selected, pasted content appears at the end of the canvas; if a component is selected, content pastes underneath it or within nested components if applicable.
- Selecting pink areas on the canvas will deselect components; green areas maintain selection.
Practical Application for ServiceNow Customers
ServiceNow customers using the Rich Content Editor can efficiently migrate and style content by copying and pasting HTML/CSS code. To ensure consistent visual presentation, convert background colors to background-image styles and use hex color codes with opacity handled via the edit code feature. Understanding the paste behavior depending on component selection helps manage content placement accurately. Awareness of browser limitations and best practices like pasting smaller chunks and clearing styles can prevent common issues during content editing. This guidance enables customers to maintain robust styling and content structure in their ServiceNow environment.
Copy and paste HTML and CSS source code for elements in the canvas.
Directly edit the CSS for an element to add styling, or copy-paste code to migrate content from other sources.
Limitations
- Browsers might display different copy-paste behaviors due to browser functional differences.
-
Copying a component on canvas doesn’t duplicate as expected on ctrl+v, so you must access the component toolbar.
-
Pasting highlighted text isn’t supported within text components, so behaviors that work in Chrome might not work in Firefox or Safari.
-
We recommend adding colors of pasted content in hex code format (#rrggbbaa to add opacity, or you can use #rrggbb).
- The hash-tag (#) is required.
- Hex codes start with a pound sign or hash-tag (#) followed by 6 letters if there is no color opacity, or 8 letters if there is color opacity.
- The 8-character syntax only works if it is added to the element CSS through the edit-code feature. The color input field on the right-hand panel only accepts 6-character syntax.
- You can also open the edit code modal to adjust the rgba() colors of the component to hex code to reflect the styling.
If certain styling isn’t applied (for example Font name) or adjusting any of the settings for the pasted content doesn’t work, try to clear the styling first by selecting the “x" next to Font name.
- If your pasted content doesn’t display as expected or behaves incorrectly, try to copy a smaller chunk instead of a big section at once.
- • If your pasted content is displayed differently before and after saving and reloading, it might be due to some script tags removed by the HTML sanitizer.
Deselected Areas
-
If you select the Pink areas, it deselects any component that is selected on the canvas.
-
If you select the Green areas, it keeps the current component selected.
Additional Rich Content Actions and Behaviors
- Add colors in hex code format (
#rrggbbaato add opacity or just#rrggbb). - Open the edit code modal to adjust the rgba() colors of the component to hex code to reflect the styling.
- If a component is selected, content pastes underneath it.
- If a component is being edited, the following paste behavior occurs:
- If the source is plain text, the content pastes into the current component, and matches the pasted text to the destination styling.
- If the source is formatted, it’s appended under the most current component.
- If the component enables nested components (for example Tab, Accordion, or Row), then content is appended within the parent container.
- If components are deselected when selected out of the canvas, it enables paste with source formatting.
For more information on editing source code, see Editing source code in the Rich Content Editor