You need to be logged in to post in the forum - Log In

An active JCE Pro Subscription is required to post in the forum - Buy a Subscription

Support is currently Offline

Official support hours:
Monday To Friday
From 09:00 To 17:00 Europe/London (BST)

Please post your question in the Forum and we will get back to you as soon as we can.

  Monday, 28 November 2016
  16 Replies
  4K Visits
I have added in the pluginparameter with tables "table table-bordered table-hover". These are bootsrap classes. And that works great.

However, often people paste tables form textprocessors to the article.

Is it possible to add the classes automaticly to those pasted tables? Because to add them by hand is to complicated for my editors.

Travel the world with me !

more than a month ago
·
#93704
Accepted Answer
Do this instead:


tinyMCE.onAddEditor.add(function (mgr, ed) {
ed.settings.paste_postprocess = function(pl, o) {
ed.dom.addClass(ed.dom.select('table', o.node), 'table table-bordered table-hover');
}
});

Just because you're not paranoid doesn't mean everybody isn't out to get you.

more than a month ago
·
#88226
There is no option in the Clipboard parameters for this, so it would need to be done using javascript via an editor event, eg:

Create a file called editor.js in /media/jce/js/ containing the following code:

(function() {
tinyMCE.onAddEditor.add(function(mgr, ed) {
ed.onInit.add(function() {
ed.onAfterPaste.add(function() {
ed.dom.addClass(ed.dom.select('table'), 'table table-bordered table-hover');
});
});
});
})();

Just because you're not paranoid doesn't mean everybody isn't out to get you.

more than a month ago
·
#93703
Hi Ryan,
Very late respons, but I just implemented this, but does not work. Any more suggestions? I can see at the backend that editor.js is loaded.

Travel the world with me !

more than a month ago
·
#93704
Accepted Answer
Do this instead:


tinyMCE.onAddEditor.add(function (mgr, ed) {
ed.settings.paste_postprocess = function(pl, o) {
ed.dom.addClass(ed.dom.select('table', o.node), 'table table-bordered table-hover');
}
});

Just because you're not paranoid doesn't mean everybody isn't out to get you.

more than a month ago
·
#93705
Do this instead:


tinyMCE.onAddEditor.add(function (mgr, ed) {
ed.settings.paste_postprocess = function(pl, o) {
ed.dom.addClass(ed.dom.select('table', o.node), 'table table-bordered table-hover');
}
});


Wow, Your fast. And it works. Impressive!

Kuddo's and more. Thanks a lot. This will help me very much. Awesome! :D

Travel the world with me !

more than a month ago
·
#94795
[*] Hu Ryan,
I'm working on a new site (J3.8 & JCEpro latest) but both solutions seems to not work (anymore?). Any idea how to solve this.?

[*] Hu Ryan,
I'm working on a new site (J3.8 & JCEpro latest) but both solutions seems to not work (anymore?). Any idea how to solve this.?



I made stupid mistake, sorry. It still works. :p Thanks.

Travel the world with me !

3 weeks ago
·
#114630
HI Ryan,
This does not seem to work anymore in Joomla 4. Do you know how I can use it in Joomla 4?

Travel the world with me !

3 weeks ago
·
#114631
Please try:


tinyMCE.onAddEditor.add(function (mgr, ed) {
ed.onPreInit.add(function () {
ed.onPastePostProcess.add(function (pl, o) {
ed.dom.addClass(ed.dom.select('table', o.node), 'table table-bordered table-hover');
});
});
});

Just because you're not paranoid doesn't mean everybody isn't out to get you.

3 weeks ago
·
#114632
Please try:


tinyMCE.onAddEditor.add(function (mgr, ed) {
ed.onPreInit.add(function () {
ed.onPastePostProcess.add(function (pl, o) {
ed.dom.addClass(ed.dom.select('table', o.node), 'table table-bordered table-hover');
});
});
});


Hi Ryan,

I put the file editor.js in /media/com_jce/js/

I deleted all cache and cookies. But it does not seem to work.
Any other suggestion maybe.
Thanks

Travel the world with me !

3 weeks ago
·
#114633
Please try (it might not look much different, but it is. Tested and working) :


tinyMCE.onAddEditor.add(function (mgr, ed) {
ed.onPreInit.add(function (ed) {
ed.onPastePostProcess.add(function (ed, o) {
ed.dom.addClass(ed.dom.select('table', o.node), 'table table-bordered table-hover');
});
});
});

Just because you're not paranoid doesn't mean everybody isn't out to get you.

3 weeks ago
·
#114635
Please try (it might not look much different, but it is. Tested and working) :


tinyMCE.onAddEditor.add(function (mgr, ed) {
ed.onPreInit.add(function (ed) {
ed.onPastePostProcess.add(function (ed, o) {
ed.dom.addClass(ed.dom.select('table', o.node), 'table table-bordered table-hover');
});
});
});


Hi Ryan,

I tried several times and deleted cookies and cache. Also tried another browser.
Maybe I need to adjust a setting in Joomla/JCE?

I attached my JCE profile just to be sure.

Travel the world with me !

3 weeks ago
·
#114637
This will only work with content pasted in from outside the editor. Is the table code coming from an external source?

Just because you're not paranoid doesn't mean everybody isn't out to get you.

3 weeks ago
·
#114638
This will only work with content pasted in from outside the editor. Is the table code coming from an external source?


HI Ryan,
Maybe I'm doing something wrong somewhere?

If I paste a table from Libreoffice I get:

<table border="0">


If I copy table from a website I get:

<table>


I also don't understand, because it's working with you.

Travel the world with me !

3 weeks ago
·
#114639

Just because you're not paranoid doesn't mean everybody isn't out to get you.

3 weeks ago
·
#114641
Your editor.js file still contains the old code:
https://cdn.joomlacontenteditor.net/tmp/87299-auto-add-classes-to-pasted-tables.jpg

Just because you're not paranoid doesn't mean everybody isn't out to get you.

3 weeks ago
·
#114642
Your editor.js file still contains the old code:
https://cdn.joomlacontenteditor.net/tmp/87299-auto-add-classes-to-pasted-tables.jpg


Sorry Ryan,
I made stupid mistake, I put it in media/com_jce/js instead of media/jce/js

It working now.

Thanks a lot, awesome support. Sorry for the inconvenience

Travel the world with me !

  • Page :
  • 1
There are no replies made for this post yet.
Be one of the first to reply to this post!