Dear GS Users and Developers,
dear shawn_a and Felix:
For all the interested I will post my very, very basic - but working - plugin for SunEditor version 2.23.4 and try to describe step by step how to go about using it.
I did it with version 3.3.10 of GS. Yes, I know I should have used the latest version, but I tried to press on and this one was already installed on my localhost.
1) Head to https://github.com/JiHong88/SunEditor and download SunEditor-master.zip by clicking on the green button labeled "Clone or download" and choosing "Download ZIP" in the small box which opens below the green button.
2) In principle, you have many choices where to save and extract the to be downloaded ZIP file. I chose the path .../admin/template/js because there is also the folder ckeditor.
So, download "SunEditor-master.zip" in the folder js and extract it there. The complete path to the folder will be then .../admin/template/js/SunEditor-master.
3) In the path SunEditor-master/dist/ open the file suneditor.min.js with an editor (say, Notepad++) and replace the code
else t+=e.replace(/(?!>)\s+?(?=<)/g,"");
with
else t+=e.replace(/(?!>)\s+?(?=<)/g," ");
and the odd nbsp behavior I mentioned in my last post is gone. The developer of SunEditor knows what changes I made.
(Note: I simply wanted to add this file to this post, but this forum software didn't allow js files and files larger than 200 kB, that's why you have to do the changes yourself.)
4) In the path SunEditor-master/dist/css/ delete the file suneditor.min.css and replace it with the file suneditor.min.css (same name) I added to this post. This css file contains some changes which were necessary to get a better integration of SunEditor with GS.
5) Open your GS website (preferably on your local computer as there is always the chance for things going haywire ...) and head to admin/settings.php.
Here you find below the heading "User Profile" a checkbox labeled "Enable the HTML editor", which to my knowledge exists for enabling CKEditor.
Uncheck this checkbox and click on "Save Settings".
6) In the path [Your Website] ... /theme/[Your Theme folder]/ open the file header.inc.php in an editor (say, Notepad++).
Example: If you are using the theme Bootstrap3 the last part of the path to the file header.inc.php is .../theme/Bootstrap3/header.inc.php.
7) Having opened the file header.inc.php in an editor you can add the small css file called suneditor_helper.css which makes the use of SunEditor easier resp. helps to utilize its full potential.
The position I used in the header.inc.php file was just before
<?php get_header(); ?>
</head>
If you don't have <?php get_header(); ?> or something with a similar function, then use the position directly above </head>.
What goes into that position?
<link href="<?php get_theme_url(); ?>/css/suneditor_helper.css" rel="stylesheet">
Here, the css file suneditor_helper.css is in the folder "css" in the folder of my theme ("Bootstrap3") which itself is in the folder called "theme", giving the path .../theme/Bootstrap3/css/suneditor_helper.css.
You can always create a folder called "css" in the folder of your theme to emulate this situation if there is none - or you can use your own path.
8) Copy the plugin called "SunEditor_for_GS.php" from this post and put it in the usual plugins folder of your GS installation and activate it in the usual way in the path .../admin/plugins.php.
9) Navigate to .../admin/pages.php and find SunEditor at the ready when creating or editing pages.
It would be great if you were as kind as to report how SunEditor works for you and what problems you experienced with installing it in GS.
Best regards
Samson
_____________________________
Downloads from Github (https://github.com/JiHong88/SunEditor):
SunEditor-master.zip
Downloads from this post:
suneditor.min.css (Size: 51.68 KB / Downloads: 6)
suneditor_helper.css (Size: 2.2 KB / Downloads: 6)
SunEditor_for_GS.php (Size: 4.59 KB / Downloads: 7)
dear shawn_a and Felix:
For all the interested I will post my very, very basic - but working - plugin for SunEditor version 2.23.4 and try to describe step by step how to go about using it.
I did it with version 3.3.10 of GS. Yes, I know I should have used the latest version, but I tried to press on and this one was already installed on my localhost.
1) Head to https://github.com/JiHong88/SunEditor and download SunEditor-master.zip by clicking on the green button labeled "Clone or download" and choosing "Download ZIP" in the small box which opens below the green button.
2) In principle, you have many choices where to save and extract the to be downloaded ZIP file. I chose the path .../admin/template/js because there is also the folder ckeditor.
So, download "SunEditor-master.zip" in the folder js and extract it there. The complete path to the folder will be then .../admin/template/js/SunEditor-master.
3) In the path SunEditor-master/dist/ open the file suneditor.min.js with an editor (say, Notepad++) and replace the code
else t+=e.replace(/(?!>)\s+?(?=<)/g,"");
with
else t+=e.replace(/(?!>)\s+?(?=<)/g," ");
and the odd nbsp behavior I mentioned in my last post is gone. The developer of SunEditor knows what changes I made.
(Note: I simply wanted to add this file to this post, but this forum software didn't allow js files and files larger than 200 kB, that's why you have to do the changes yourself.)
4) In the path SunEditor-master/dist/css/ delete the file suneditor.min.css and replace it with the file suneditor.min.css (same name) I added to this post. This css file contains some changes which were necessary to get a better integration of SunEditor with GS.
5) Open your GS website (preferably on your local computer as there is always the chance for things going haywire ...) and head to admin/settings.php.
Here you find below the heading "User Profile" a checkbox labeled "Enable the HTML editor", which to my knowledge exists for enabling CKEditor.
Uncheck this checkbox and click on "Save Settings".
6) In the path [Your Website] ... /theme/[Your Theme folder]/ open the file header.inc.php in an editor (say, Notepad++).
Example: If you are using the theme Bootstrap3 the last part of the path to the file header.inc.php is .../theme/Bootstrap3/header.inc.php.
7) Having opened the file header.inc.php in an editor you can add the small css file called suneditor_helper.css which makes the use of SunEditor easier resp. helps to utilize its full potential.
The position I used in the header.inc.php file was just before
<?php get_header(); ?>
</head>
If you don't have <?php get_header(); ?> or something with a similar function, then use the position directly above </head>.
What goes into that position?
<link href="<?php get_theme_url(); ?>/css/suneditor_helper.css" rel="stylesheet">
Here, the css file suneditor_helper.css is in the folder "css" in the folder of my theme ("Bootstrap3") which itself is in the folder called "theme", giving the path .../theme/Bootstrap3/css/suneditor_helper.css.
You can always create a folder called "css" in the folder of your theme to emulate this situation if there is none - or you can use your own path.
8) Copy the plugin called "SunEditor_for_GS.php" from this post and put it in the usual plugins folder of your GS installation and activate it in the usual way in the path .../admin/plugins.php.
9) Navigate to .../admin/pages.php and find SunEditor at the ready when creating or editing pages.
It would be great if you were as kind as to report how SunEditor works for you and what problems you experienced with installing it in GS.
Best regards
Samson
_____________________________
Downloads from Github (https://github.com/JiHong88/SunEditor):
SunEditor-master.zip
Downloads from this post:
suneditor.min.css (Size: 51.68 KB / Downloads: 6)
suneditor_helper.css (Size: 2.2 KB / Downloads: 6)
SunEditor_for_GS.php (Size: 4.59 KB / Downloads: 7)