Jump to content

CKEditor table deletion not working


bbeer
 Share

Recommended Posts

Hi all

when I try to delete a table by right clicking into the table, then delete table, the table reappears after savaging the page. However when the table is deleted in html mode then it is gone. However this is not a smart option for clients.

PW Version 2.4.0

CKEditor Version 1.2.0

Your help is much appreciated!

Link to comment
Share on other sites

Sorry that I push on this subject again, but this is getting really urgent.

I use CKEditor with a TextaeraLanguage field.

When using tables, CFE add endless <p>   </p>, really unpredictable. It is impossible to control text like this. 

  • Even worse, some language tabs are not displayed, as they should, but in the text itself. 
  • Text disappears completely, if it was not saved.
  • when changing language, it is easily possible that the format of the field you choose now breaks, without even activating CFE
  • all <br /> are being replaced by <p>   </p>

I need urgent help. Also paid help if necessary.

Thanks a lot

Link to comment
Share on other sites

I'd be happy to help. Can I take a look somewhere? You can PM me the login details. Don't know if I can make it today, but I can take a look tomorrow early in the morning before work or in the evening (Amsterdam timezone).

I have a PW 2.4 with CKE 1.2.0 (default config) and have no problems. Have you tried other browsers? Have you installed any plugins in CKE? You also may want to switch the field to plain textarea and then back.

  • Like 1
Link to comment
Share on other sites

Hi all

back to the topic. we are closer already and found out that CKE is adding a lot of additional tags. 

ie. <p> </p>, it also wraps text inside td's and list inside paragrahps which we really can't use, because we use the content with a pdf generator. Is it possible to limit CKE that he does not add additional tags inside li and tds? that would really help a lot.

your help is much appreciated.

Link to comment
Share on other sites

Hi all

after trying a lot of option, I really need to ask how the proper syntax for extra allowed content is. Whenever I use extra allowed content I get an error

Error: Call to a member function set() on a non-object (line 118 of /public_html/entwicklung/site/modules/MarkupHTMLPurifier/MarkupHTMLPurifier.module)

In one setup I would need CKEditor to just allow table tbody tr td br em li a. I also realized that CKEditor is adding p to li elements, which is no good.

Your help is much appreciated.

Link to comment
Share on other sites

Add the following to your Extra Allowed Content (Input tab when editing your field)

table[class](*)
tr[class](*)
td[class](*)
tbody[class](*)
em[class](*)
br[class](*)

What the above mean is that those tags will be allowed and they will also be allowed to have 'classes'. 

Have a read from here downwards for some quirks with HTML5

Also see the setting Beautify Markup Toggles: helps remove empty <p></p> tags and  

Btw, why do you need the <em> again? You already have that with CKEditor...Also inbuilt lists work just fine for me...No extra <p> added.

Edited by kongondo
  • Like 1
Link to comment
Share on other sites

thanks kongondo

does not solve the problem. As soon as I add anything to Extra Allowed Content I get the above mentioned error. Further more I have only one line to add Extra allowed content, so separated it by , like

table[class](*), tr[class](*), td[class](*), tbody[class](*), em[class](*), br[class](*)

on line 118 is following code.

like $this->settings->set($key, $value); 

Where can I find Beautify Markup Toggles settings?

 
Thanks for your help!
Link to comment
Share on other sites

I see now that according to your first post, you have CKEditor version 1.2.0? No wonder it doesn't work :-)...I am on PW 2.5 with CKEditor 4.4.3. CKEditor is now the default editor in PW. I think your version is the old one from the modules directory. I urge you to upgrade to PW 2.5  :-).

The extra allowed content in PW 2.5 is a textarea. The code I posted above should be entered just as I have shown. One line of code per line. When you upgrade you will also be able to see the 'Beautify....' settings...

Edited by kongondo
Link to comment
Share on other sites

I've updated InputfieldCKEditor to Version 1.2 which includes ckeditor 4.4.2

this is a PW 2.4 Installation. So that means I will have to update to PW 2.5 if that should work correct right?

Will do so, hope that helps.

Link to comment
Share on other sites

well it happens that inside td's are p. which for our need is really a no go.

The same with li's. under certain circumstances there are p inside li's which breaks the layout in the pdf.

The main problem is that with tcpdf you can only use inline styles. We are using PW to generate a dynamic manual, so there is no other way but to give the client a wysywyg editor.

Link to comment
Share on other sites

To answer my question. I am guessing you added 'Table' to the CKEditor Toolbar. You are then inserting tables using the Table icon, correct? I have tested this too and it works fine. I can right click and delete the table and it disappears; it doesn't come back after save :-). I have also double checked and there are no <p>s in the <td>s. The only way to get <p>s inside the <td> is if you type and press enter to create a new line within the <td> :-). I think that's what your client is doing? Unrelated, but good to know that using the tab key to move within cells works fine

Link to comment
Share on other sites

Ok after updating and testing, there is still an issue, that there are paragraph's inside td's like here

<table border="1" cellpadding="0" cellspacing="0"><tbody>
<tr>
<td style="width:45px">
<p> 1</p>
</td>
<td style="width:170px">
<p> Besfestigungsdichtung</p>
</td>
</tr>
<tr>
<td style="width:45px">
<p> 2</p>
</td>
<td style="width:170px">
<p> Befestigungsklammer</p>
</td>
</tr>
</tbody>
</table>

even when opening the editor and closing it again they resist. is there a way to have them remove on save, or some other way? It would be one hell of work if we would have to reenter all that content.

Link to comment
Share on other sites

If you only need to remove them once, so that you can work further with the cleaned texts, just use the api like this:

$text = $page->getUnformatted("body"); // Just to be sure that no textformatters change something
$page->of(false);

$text = str_replace("<p>", "", $text);
$text = str_replace("</p>", "", $text);

$page->body = $text;
$page->save("body");

Edit: If you have normal paragraphs, too, you should use a more sophisticated search/replace option.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...