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
09:00 - 17:00 Europe/London (BST)

Please create a new Ticket and we will get back to you as soon as we can.

#111806 CSS styles conversion

Posted in ‘Editor’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Latest post by Resilience on Thursday, 15 September 2022 10:43 BST

Resilience
Hi, I have a fairly complex problem and I will try to describe it as best I can.
I am creating a web app that, by means of some forms, stores texts, images and tables in a mysql database. Then I export the data in a CSV file and send it to a company that has to provide automatic pagination. This company uses Adobe Indesign Server.
I created my app using the "Fabrik" software installed in Joomla. As an editor I used JCE Pro and everything works fine. The problem is that all the data is stored in html and the Indesign server does not interpret the html.
I would need to "convert" the html tags to another format. Here is an example:
<h1> Example title H1 </h1> should become <Tit100H1> Example title H1 </Tit100H1>
The Tit100H1 tag is a tag that refers to a style appropriately configured in Adobe Indesign.
Then there are other tags that I should convert but it is still the same operation.
Can you advise me how to do this conversion? I have no idea how to do it.
Thanks for those who want to help me.

Ryan
You would need to do this with some additional javascript in a pre-save process. For example, create a new file called editor.js in media/jce/js/ and add the following:

tinyMCE.onAddEditor.add(function (mgr, ed) {
  ed.onSaveContent.add(function (ed, o) {
    o.content = o.content.replace(/<(\/?)h1([^>]*)>/gi, '<$1Tit100H1$2>');
  });

  ed.onBeforeSetContent.add(function (ed, o) {
    o.content = o.content.replace(/<(\/?)Tit100H1([^>]*)>/gi, '<$1h1$2>');
  });
});

Ryan Demmer

Lead Developer / CEO / CTO

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

Resilience
[quotePost id="111832"]You would need to do this with some additional javascript in a pre-save process. For example, create a new file called editor.js in media/jce/js/ and add the following:

tinyMCE.onAddEditor.add(function (mgr, ed) {
  ed.onSaveContent.add(function (ed, o) {
    o.content = o.content.replace(/<(\/?)h1([^>]*)>/gi, '<$1Tit100H1$2>');
  });

  ed.onBeforeSetContent.add(function (ed, o) {
    o.content = o.content.replace(/<(\/?)Tit100H1([^>]*)>/gi, '<$1h1$2>');
  });
});
[/quotePost] Thanks Ryan, thanks so much, I'll start rehearsing right away. I will have to find the way to duplicate the records because I need the original HTML code to view the previews of the contents for the revision and eventual correction of the same. Thanks again.