2

I have tried so many things and I still can't make this work.

In Joomla 2.5.20, with JCE 2.3.4.4, on a Mac, I have the following scenario:

In the editor, I have a set of divs, and if I select them (either visually by dragging the cursor, or via a click in the path) and copy them with cmd + copy, when I paste it (either via the shortcut, or the paste dialog), the pasted content has no <div>'s because these were converted to <br>'s!

One thing I noticed, is that the pasted content in the paste dialog has the divs, so the conversion/stripping is done when placing into the editor, not when copying!

I would like it not to strip the <div> nor convert it to anything else.

I have tried adding div to the "keep tags" (profiles > [my profile] > plugin parameters > clipboard) but that makes it worse, it not only removes the <div> tag but also any other tags.

I am using the super-admin, which doesn't have text filtering, and the JCE profile doesn't have the "cleanup HTML" nor "validate HTML". All other filters in JCE are off (don't strip class attributes, etc).

Anyone has a solution for this?

  • Use a different editor. I think it's not possible to avoid it. – Anibal Jul 15 '14 at 16:00
  • In the profile, do you have allow paste as html on? – Faye Jul 16 '14 at 15:40
  • @REactionFaye yes it is on, I tried all that I could think of, the next step is to contact the developer of JCE. – jackJoe Jul 16 '14 at 18:52
2

I understand what you're trying to accomplish, but I don't think you'll find a WYSIWYG that will let you copy text, then re-paste it with the html intact and be confident it will not break. All it takes is for your user to paste the text with their cursor in the wrong spot by one character, and the whole thing goes to pot.

Even using a templater, like NoNumber, the user can destroy it by inserting the template while still inside another div - which, by the way, JCE will force.

There is a balance of careful construction when putting together repeating blocks of data that a user may need to add to, or remove. If you have consistent data, I recommend using a CCK. K2, or Sobipro are the ones I've used. If you have less consistent data, create each block as an article (with a template so when they make a new one, they can just drop a fresh template in), then load that category with a module.

We actually don't want our clients playing in their module areas if at all possible, so we will put their content into an article (when custom html), then load that content into a module with NoNumber Articles Anywhere, then load that module into our layout. If we have to create two columns of content, often each column gets it's own article, and those are then loaded via module into the page to ensure they can't break the structure.

We started doing this because of our move to responsive design and it has made a HUGE difference. We get very few calls from clients who have wrecked their content layouts.

So, I know this isn't a true answer to your question - it's more of a 'if you've reached that point that your layout is too complex for your clients to edit, it's time to rethink how you present that content to your users'.

  • Good points, but I already have that (modules and "closed" structure) for the users (but in this case that won't apply), having more articles to get a row of blocks is not very practical neither for the user nor the server. tinyMCE does paste the divs (not the original ones, but divs nonetheless, but I have so many things done to the JCE component that I cannot just change it to another one. – jackJoe Jul 16 '14 at 18:51
  • I see your dilemma. Sorry I can't be more helpful. In the past we used to teach our clients how to toggle source and copy and paste the divs directly, but now we try to avoid those situations. – Faye Jul 16 '14 at 18:59
0

If you're pasting into the styled view, click on the "Source Code Editor" button.

JCE Source Code Editor Button

This will get you a view like this: JCE Source Code view

Paste the HTML into the location you want.

If find the fullscreen button useful when looking at the source code view as it's not as cramped…

JCE Full Screen mode button

  • thank you for the suggestion, but this needs to be done in the styled view, the user won't know how to do it in HTML. – jackJoe Jul 16 '14 at 8:48
  • The you have a problem because as far as we've been able to tell JCE only takes "style" attributes and strips any structural elements when pasting in the styled view. Have you considered the templates (or snippets) for this sort of stuff? – Craig Jul 16 '14 at 9:22
  • Yes I have, and I even have my own template button, but that doesn't help if the user would like to copy a div in the content (updated by the user) and paste it somewhere else. My request if for something truly WYSIWYG because the users that are going to edit the content don't know HTML. – jackJoe Jul 16 '14 at 9:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.