Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1191 2017-03-13 16:42:10

Hennie
Member
From: Nederland
Registered: 2009-02-06
Posts: 18
Website

Re: hak_tinymce WYSIWYG article editor

Is hak_tinymce dead?

Offline

#1192 2017-03-14 20:42:23

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,208

Re: hak_tinymce WYSIWYG article editor

Hennie wrote #304693:

Is hak_tinymce dead?

hakjoon wrote #279395:

However as everyone can see I’m not around much anymore. I’m not really doing much PHP these days, and I’ve only been superficially keeping up with TXP.

This plugin could really benefit from a new maintainer who has more time for it. I would love to help transition someone over if anyone is interested.

As much as I love keeping this under my wing because it keeps me attached to this community that I really enjoy at this point I’m doing the community a disservice by not having someone else take it on.

2 years ago. But never say never.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#1193 2017-05-21 00:48:33

mericson
Member
Registered: 2004-05-24
Posts: 137
Website

Re: hak_tinymce WYSIWYG article editor

hak_tinymce does not appear to be compatible with TextPattern 4.6.x. I don’t see the “toggle editor” option when creating or editing an article.

Has anyone figured out a work-around ?

Offline

#1194 2017-05-21 03:43:14

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 989
Website

Re: hak_tinymce WYSIWYG article editor

Yes, I upgraded a site a couple months ago that relied on hak_tinymce. I simply found the latest version of CKEditor and cobbled together a simple plugin that injects the appropriate JavaScript into Textpattern’s write tab.

First, I downloaded CKEditor here, and placed the files in a directory called “plugins” in my document root.

Then I made a plugin with the following function:

register_callback('pax_write_append', 'article');

function pax_write_append() {

  $out = '<script src="/plugins/ckeditor/ckeditor.js"></script>';
  $out .= '<script>';
  $out .= 'CKEDITOR.replace("body"); \n';

  /**
   * Uncomment this line to add CKEditor to the Excerpt field
   */
  // $out .= 'CKEDITOR.replace("excerpt"); \n';
  $out .= '</script>';

  echo $out;

}

It has worked perfectly with Textpattern 4.6.*, but it does behave differently than TinyMCE. TinyMCE allowed the client to add PayPal buttons (which include HTML form elements) in the body of an article, but CKEditor strips form markup out. To fix that, I created a different workaround, which is beyond the scope of this post.

I tried installing the latest version of TinyMCE in a similar fashion before switching to CKEditor, but it didn’t work and I can’t remember why. Someone pointed me to Kuopassa’s CKEditor plugin here too, but when I tried it out, I think I found my solution simpler.

Good luck!

Offline

#1195 2019-07-10 11:18:11

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 566
Website

Re: hak_tinymce WYSIWYG article editor

I found why it doesn’t works on TXP v4.6.2

The scripts are not being injected to the write page, and the tinyMCE.triggerSave(); doesn’t fire because the listener is being called before jQuery has been loaded or before the article_form has been created.
Important to mention that I have been upgraded from TXP v4.5.7 so I already had everything set in the database for this plugin, not sure about a clean setup.

To make it works:

1.
I manually placed the scripts into txplib_head.php file just before the </head> part.
(Alternatively you can place the scripts into txplib_html.php file inside the end_page() function.)
Be aware that this makes the scripts to run everywhere on TXP not just on the write page, so you may want to use an if-statement otherwise it may cause security holes I think.

Here are the 2 scripts:

<script language='javascript' type='text/javascript' src='tiny_mce/tiny_mce.js'></script>
<script language='javascript' type='text/javascript' src='index.php?event=hak_tinymce_js'></script>

2.
Edit the plugin code and look for:

$('form.async').on('click', 'input[type=submit]', function (evt) {
    tinyMCE.triggerSave();
});

then wrap if with a jQuery document ready function as:

$(document).ready(function(){
    $('form.async').on('click', 'input[type=submit]', function (evt) {
        tinyMCE.triggerSave();
    });
});

I personally do not like it selecting the form by form.async, I prefer using the ID of the form as $('#article_form'), but anyway it works both ways.

3.
As etc mentioned, change to mysqli

etc wrote #301250:

Hello, welcome to the forum. We have switched to mysqli functions in 4.6, so this could be a compatibility issue. Try to replace $mysqlversion = mysql_get_server_info(); in the plugins code with

global $DB;
$mysqlversion = mysqli_get_server_info($DB->link);

so…
If someone can fix the injecting scripts issue and the submit form listener and the mysqli and can share the code it will be great please instead of doing it manually.

Last edited by THE BLUE DRAGON (2019-07-11 09:14:20)

Offline

#1196 2019-07-10 14:08:12

hakjoon
Moderator
From: Arlington, VA
Registered: 2004-07-29
Posts: 1,634
Website

Re: hak_tinymce WYSIWYG article editor

I thought everyone had moved on to new plugins at this point so I let the download link die since I didn’t think it worked anymore. If people are still using this I can make the last release available again, and I’d be happy to release a working version, update txp resources, etc

I don’t have a working PHP dev environment but if anyone wants to submit a PR with the fixes the repo is here


Shoving is the answer – pusher robot

Offline

#1197 2019-07-11 09:24:55

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 566
Website

Re: hak_tinymce WYSIWYG article editor

hakjoon wrote #318676:

I thought everyone had moved on to new plugins at this point so I let the download link die since I didn’t think it worked anymore. If people are still using this I can make the last release available again, and I’d be happy to release a working version, update txp resources, etc

I don’t have a working PHP dev environment but if anyone wants to submit a PR with the fixes the repo is here

Thanks, I have an old site with this TinyMCE plugin of yours and about 8 custom buttons inner-plugins that I have created for a client back in the day, so it is more comfortable for me to keep using it instead of switching to an other editor and re-developing the inner-plugins.

But anyway, are there any new WYSIWYG editor TXP plugins for v4.6.2 please?

Offline

Board footer

Powered by FluxBB