Post by blizeH » Sat Nov 30, 2013 10:52 pm

When copying and pasting I often find that it adds other tags (i.e. span tags with font styles) that we don't want

We've tried copying into TextEdit and pasting from there, but sometimes the formatting still changes.

Is there anyway to either keep the font completely consistent (i.e. ignore the spans etc) or maybe adding a 'Remove formatting' button to the editor?

Thanks

New member

Posts

Joined
Sat Jan 14, 2012 4:20 am

Post by MarketInSG » Sun Dec 01, 2013 12:16 am

pasting it into a notepad should remove all formats, then copy from notepad into your text editor


User avatar
Guru Member

Posts

Joined
Wed Nov 16, 2011 11:53 am
Location - Singapore

Post by butte » Sun Dec 01, 2013 2:13 pm

blizeH, you'll need to put the resident editor into Source mode (toggle the button off the top left corner of the box) in order to silence the mess that wysiwyg mode will make, and Save while in Source mode, when you insert streamlined text. You can disable the wysiwyg editor outright but you might not want to go that far initially. As MarketInSG said, you can put the text into a pure ascii text editor, but that will probably not strip tags -- with find/replace you can get rid of all tags (you mentioned ignorning span and so forth), then when the text is cleansed of what you do not want, you can copy/paste it into the box and Save it. In Source mode you can also exercise control over whatever tags you DO want. At the very least wysiwyg mode will pepper text with opening and closing <p> and </p> tags.

Guru Member

Posts

Joined
Wed Mar 20, 2013 6:58 am

Post by parkookk » Wed Dec 06, 2023 12:41 am

Hi,
I have OC3038 with the original wysiwyg CKEditor.
I have removed and re-indent all my products description codes, removing all those annoying <spans> and then after a few months I found out all of them gone back to where they were before!!! all the code is on one very long line again and now I have to buy a train ticket again to catch the end of it.

It made me to pull all my hair from my bald head and now wondered if someone out there can help me.

The problem is that CKEditor adds <span style="font-size: 14px;"> on all paragraphs and makes it very difficult to change them in future in case I decide to go to 16px and also I have already set my font size in stylesheet and would like to control them that way globally with ease.

I am using English OpenCart 3.0.3.8, Default Template/Theme, php 7.4, Latest Brave Browser (No Ads-Blocker, etc.)


User avatar
Active Member

Posts

Joined
Thu Jan 17, 2013 11:56 pm
Location - london

Post by johnp » Wed Dec 06, 2023 1:17 am

parkookk wrote:
Wed Dec 06, 2023 12:41 am
Hi,
I have OC3038 with the original wysiwyg CKEditor.
I have removed and re-indent all my products description codes, removing all those annoying <spans> and then after a few months I found out all of them gone back to where they were before!!! all the code is on one very long line again and now I have to buy a train ticket again to catch the end of it.

It made me to pull all my hair from my bald head and now wondered if someone out there can help me.

The problem is that CKEditor adds <span style="font-size: 14px;"> on all paragraphs and makes it very difficult to change them in future in case I decide to go to 16px and also I have already set my font size in stylesheet and would like to control them that way globally with ease.
You could investigate TinyMCE. As far as I'm aware that only adds <p></p> tags.

https://www.opencart.com/index.php?rout ... n_id=45214

Opencart 1.5.6.5/OC Bootstrap Pro/VQMOD lover, user and geek.
Affordable Service £££ - Opencart Installs, Fixing, Development and Upgrades
Plus Ecommerce, Marketing, Mailing List Management and More
FREE Guidance and Advice at https://www.ecommerce-help.co.uk


User avatar
Active Member

Posts

Joined
Fri Mar 25, 2011 10:25 am
Location - Surrey, UK

Post by paulfeakins » Wed Dec 06, 2023 6:59 pm

blizeH wrote:
Sat Nov 30, 2013 10:52 pm
When copying and pasting I often find that it adds other tags (i.e. span tags with font styles) that we don't want
I can't believe the other developers above don't know about the keyboard shortcut.

Instead of Ctrl + V use Ctrl + Shift + V. That will paste without any styles.

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Legendary Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by JNeuhoff » Wed Dec 06, 2023 8:57 pm

paulfeakins wrote:
Wed Dec 06, 2023 6:59 pm
I can't believe the other developers above don't know about the keyboard shortcut.
There are surprisingly quite a few end users who careless copy from dirty MS Word documents into the Opencart product description without giving it any further thoughts about the resulting potential issues. It's always best to have a modified CKEditor or Summernote editor which strips off the markup before pasting the text into the description.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member
Online

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by paulfeakins » Thu Dec 07, 2023 8:13 pm

JNeuhoff wrote:
Wed Dec 06, 2023 8:57 pm
There are surprisingly quite a few end users who careless copy from dirty MS Word documents into the Opencart product description without giving it any further thoughts about the resulting potential issues.
Yes loads of "normal" users do this - why would they understand code? But I'm shocked that more developers don't know the way to paste plain text only.

JNeuhoff wrote:
Wed Dec 06, 2023 8:57 pm
It's always best to have a modified CKEditor or Summernote editor which strips off the markup before pasting the text into the description.
Is there an extension for this?

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Legendary Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by JNeuhoff » Thu Dec 07, 2023 9:25 pm

paulfeakins wrote:
Thu Dec 07, 2023 8:13 pm
JNeuhoff wrote:
Wed Dec 06, 2023 8:57 pm
It's always best to have a modified CKEditor or Summernote editor which strips off the markup before pasting the text into the description.
Is there an extension for this?
For Summernote I use this simple modification in the admin/view/javascript/summernote/opencart.js :

Code: Select all

			......
  			},
			callbacks: {
				onPaste: function (e) {
					var bufferText = ((e.originalEvent || e).clipboardData || window.clipboardData).getData('Text');
					e.preventDefault();
					document.execCommand('insertText', false, bufferText);
				}
			}
			......
I am sure there is something equivalent for CKEditor, too.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member
Online

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by paulfeakins » Fri Dec 08, 2023 10:30 pm

JNeuhoff wrote:
Thu Dec 07, 2023 9:25 pm
I use this simple modification in the admin/view/javascript/summernote/opencart.js
Very nice indeed.

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Legendary Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom
Who is online

Users browsing this forum: No registered users and 11 guests