Please login or register.

Login with username, password and session length
Advanced search  

News:

You need/want an older version of sNews ? Download an older/unsupported version here.

Pages: 1 [2]

Author Topic: Simple way to add the TinyMCE WYSIWYG editor  (Read 9808 times)

Creatium

  • Jr. Member
  • **
  • Karma: 0
  • Posts: 55
Re: Simple way to add the TinyMCE WYSIWYG editor
« Reply #15 on: October 17, 2009, 03:06:52 PM »

Yabadabaduuu!!!! It works :). Thank you
Logged
Aurea praxis, sterilis theoria.

kreatur

  • Jr. Member
  • **
  • Karma: 0
  • Posts: 73
    • RoManga
Re: Simple way to add the TinyMCE WYSIWYG editor
« Reply #16 on: October 27, 2009, 06:06:59 PM »

Hi, i'm having several problems with this.

1. Preview doesn't work. When i write the article pressing the button does nothing, doesn't expand the preview window. When i'm editing the article it opens with the current content but doesn't change with what i modify inside the article.


2. Whenever i edit an article i always get the TinyMCE window without background. What i mean is i can see through it all the way to the background image of the site, and that one being dark-colored i can't see my writing unless i select it. Maybe someone can point me to the corect selector i have to modify in my sylesheet, giving it a background-color: #fff.  I already have this for textarea.
Let me give you a screenshot to make it easy:

Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
Re: Simple way to add the TinyMCE WYSIWYG editor
« Reply #17 on: October 27, 2009, 10:21:21 PM »

Hi, i'm having several problems with this.

1. Preview doesn't work. When i write the article pressing the button does nothing, doesn't expand the preview window. When i'm editing the article it opens with the current content but doesn't change with what i modify inside the article.

2. Whenever i edit an article i always get the TinyMCE window without background.

1. the default sNews Preview panel will not work with MCE enabled. You should not need it since MCE's panel is WYSIWYG.

2. Assuming you are using the default sNews stylesheet, In your css/style.css file, look for textarea and add background:#fff; after padding:3px; (on a new line).
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

kreatur

  • Jr. Member
  • **
  • Karma: 0
  • Posts: 73
    • RoManga
Re: Simple way to add the TinyMCE WYSIWYG editor
« Reply #18 on: October 28, 2009, 11:58:19 AM »

Oh, you're right about the preview, i only noticed because of the background.
I already thought about textarea but it seems i'm missing something. I have this:

input, textarea, select {
   border: 1px solid #464646;
   padding: 2px 5px;
   font-size: 8pt;
   background: #ffffff;
   color: #666666;
   font-family: Arial, Helvetica, sans-serif;
}

and it still doesn't make it white.
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
Re: Simple way to add the TinyMCE WYSIWYG editor
« Reply #19 on: October 28, 2009, 01:34:54 PM »

Oh, you're right about the preview, i only noticed because of the background.
I already thought about textarea but it seems i'm missing something. I have this:

input, textarea, select {
   border: 1px solid #464646;
   padding: 2px 5px;
   font-size: 8pt;
   background: #ffffff;
   color: #666666;
   font-family: Arial, Helvetica, sans-serif;
}

and it still doesn't make it white.

Try adding a separate declaration to your stylesheet... with another color to see if it has any effect... like this:

textarea { background-color: #ff0000; }
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
Re: Simple way to add the TinyMCE WYSIWYG editor
« Reply #20 on: October 28, 2009, 03:03:18 PM »

I think that the TinyMCE textarea appearance is controlled by its own style declarations (but I could be wrong on that, I've only used Tiny a couple of times), so changing the sNews textarea styles probably won't make a difference.

If you can find out the id or classname of the TinyMCE textarea then you could target it specifically in your stylesheet, otherwise you'd have to find where Tiny sets its styles, find the textarea style and change it accordingly. That's my guess anyway.

In fact, it could be the following bit that is the problem -- taken from the "o2k7" theme's ui.css (I'm just guessing that o2k7 represents the 'advanced' theme -- I haven't tested it):

Quote
.o2k7Skin table, .o2k7Skin tbody, .o2k7Skin a, .o2k7Skin img, .o2k7Skin tr, .o2k7Skin div, .o2k7Skin td, .o2k7Skin iframe, .o2k7Skin span, .o2k7Skin *, .o2k7Skin .mceText {border:0; margin:0; padding:0; background:transparent; white-space:nowrap; text-decoration:none; font-weight:normal; cursor:default; color:#000; vertical-align:baseline; width:auto; border-collapse:separate; text-align:left}

Since Tiny appears to place its stuff in a table layout, the transparent background would cause the body background to bleed through to the top, so it kind of makes sense. As I said, my best guess is you need to find the appropriate Tiny stylesheet and change the bits for the elements in question in that particular stylesheet for it to work, optionally to figure out what id or classname the offending element has and target it in your own stylesheet.
« Last Edit: October 28, 2009, 03:11:55 PM by Fred K (agentsmith) »
Logged

kreatur

  • Jr. Member
  • **
  • Karma: 0
  • Posts: 73
    • RoManga
Re: Simple way to add the TinyMCE WYSIWYG editor
« Reply #21 on: October 28, 2009, 05:17:06 PM »

There's no change in adding another declaration and picking another color for textarea, so i'm thinking Fred has a good idea, i just have to look harder into it, because the o2k7 change he sugested doesn't fix the problem. I'll edit this once i have a solution.
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
Re: Simple way to add the TinyMCE WYSIWYG editor
« Reply #22 on: October 28, 2009, 08:16:33 PM »

That's quite probable Fred. It's in top of the o2k7 and default ui.css files for both simple and advanced themes.
I'd replace the 'transparent' in all 4 files for a test, tho I don't have it running in any of my projects right now.
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

Katalonian

  • Newbie
  • *
  • Karma: 0
  • Posts: 38
    • My personal web page
Re: Simple way to add the TinyMCE WYSIWYG editor
« Reply #23 on: April 16, 2010, 01:34:20 PM »

after successful install of this editor,can i delete the default snews text editor functions/buttons?
if yes, how?)
Logged
non-php guy

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
Re: Simple way to add the TinyMCE WYSIWYG editor
« Reply #24 on: April 16, 2010, 02:25:28 PM »

I haven't replaced the default textarea with a WYSIWYG editor yet in 1.7, though I plan to attempt it soon.

But... search your snews.php file... within the // ARTICLES FORM function... for buttons(); ... which is the function-name tag that calls the buttons into the function. You can simply comment it out with a couple of forward slashes - // buttons(); - to disable it (rather than delete it so it's there in case you want to enable it again sometime in the future).

You can also search the file for the function itself with function buttons() and comment the whole function out as well... so it isn't being loaded anymore... but it really doesn't matter since it isn't being called to action once you disable the actual function-name tag (above).
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

Meubelstad

  • Newbie
  • *
  • Karma: 0
  • Posts: 7
Re: Simple way to add the TinyMCE WYSIWYG editor
« Reply #25 on: September 17, 2010, 11:04:51 PM »

Hi all,

I'm new to Snews but so far I love it. If implemented the TinyMCE editor as discribed in this topic. All works fine but as it is a WYSIWYG editor I would like to remove the styling buttons wich come with Snews and the Preview option since it doesn't work. I still have some trouble finding the right codes to alter. Hope you can help.
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
Re: Simple way to add the TinyMCE WYSIWYG editor
« Reply #26 on: September 18, 2010, 04:18:35 PM »

I'm new to Snews but so far I love it. If implemented the TinyMCE editor as discribed in this topic. All works fine but as it is a WYSIWYG editor I would like to remove the styling buttons wich come with Snews and the Preview option since it doesn't work. I still have some trouble finding the right codes to alter. Hope you can help.

Search your snews.php file for // ARTICLES FORM - which takes you to the beginning of the form_articles($contents) function. This function ends just above // ARTICLES - ADMIN LIST.

Disable the complete function (so you still have it for reference while working) and replace it with this one, to which I have added reference comments to help you find the places you need to disable.
NOTE: Copy and paste the function only... not the opening and closing PHP-tags:
Code: [Select]
<?php

// ARTICLES FORM
function form_articles($contents) {
 
if (is_numeric($_GET['id']) && !is_null($_GET['id'])) {
$id $_GET['id'];
$query mysql_query('SELECT * FROM '._PRE.'articles'.' WHERE id='.$id);
$r mysql_fetch_array($query);
$article_category $r['category'];
$edit_option $r['position']==$r['position'];
$edit_page $r['page_extra'];
$extraid $r['extraid'];
switch ($edit_option) {
case 1:
$frm_fieldset l('edit').' '.l('article');
$toggle_div='show';
$frm_position1 'selected="selected"';
break;
case 2:
$frm_fieldset l('edit').' '.l('extra_contents');
$toggle_div='show';
$frm_position2 'selected="selected"';
break;
case 3:
$frm_fieldset l('edit').' '.l('page');
$toggle_div='show';
$frm_position3 'selected="selected"';
break;
}
$frm_action _SITE.'?action=process&amp;task=admin_article&amp;id='.$id;
$frm_title $_SESSION[_SITE.'temp']['title'] ? $_SESSION[_SITE.'temp']['title'] : $r['title'];
$frm_sef_title $_SESSION[_SITE.'temp']['seftitle'] ? cleanSEF($_SESSION[_SITE.'temp']['seftitle']) : $r['seftitle'];
$frm_text str_replace('&''&amp;'$_SESSION[_SITE.'temp']['text'] ? $_SESSION[_SITE.'temp']['text'] : $r['text']);
$frm_meta_desc $_SESSION[_SITE.'temp']['description_meta'] ?
cleanSEF($_SESSION[_SITE.'temp']['description_meta']) : $r['description_meta'];
$frm_meta_key $_SESSION[_SITE.'temp']['keywords_meta'] ?
cleanSEF($_SESSION[_SITE.'temp']['keywords_meta']) : $r['keywords_meta'];
$frm_display_title $r['displaytitle'] == 'YES' 'ok' '';
$frm_display_info $r['displayinfo'] == 'YES' 'ok' '';
$frm_publish $r['published'] == 'ok' '';
$show_in_subcats $r['show_in_subcats'] == 'YES' 'ok' '';
$frm_showonhome $r['show_on_home'] == 'YES' 'ok' '';
$frm_commentable = ($r['commentable'] == 'YES' || $r['commentable'] == 'FREEZ') ? 'ok' '';
$frm_task 'edit_article';
$frm_submit l('edit');
} else {
switch ($contents) {
case 'article_new':
$frm_fieldset l('article_new');
$toggle_div='';
$pos 1;
$frm_position1 'selected="selected"';
break;
case 'extra_new':
$frm_fieldset l('extra_new');
$toggle_div='';
$pos 2;
$frm_position2 'selected="selected"';
break;
case 'page_new':
$frm_fieldset l('page_new');
$toggle_div='';
$pos 3;
$frm_position3 'selected="selected"';
break;
}
if (empty($frm_fieldset)) {
$frm_fieldset =  l('article_new');
}
$frm_action _SITE.'?action=process&amp;task=admin_article';
$frm_title $_SESSION[_SITE.'temp']['title'];
$frm_sef_title cleanSEF($_SESSION[_SITE.'temp']['seftitle']);
$frm_text $_SESSION[_SITE.'temp']['text'];
$frm_meta_desc cleanSEF($_SESSION[_SITE.'temp']['description_meta']);
$frm_meta_key cleanSEF($_SESSION[_SITE.'temp']['keywords_meta']);
$frm_display_title 'ok';
$frm_display_info = ($contents == 'extra_new') ? '' 'ok';
$frm_publish 'ok';
$show_in_subcats 'ok';
$frm_showonhome s('display_new_on_home') == 'on' 'ok' '';
$frm_commentable = ($contents == 'extra_new' || $contents == 'page_new' || s('enable_comments') != 'YES') ? '' 'ok';
$frm_task 'add_article';
$frm_submit l('submit');
}
$catnum mysql_fetch_assoc(mysql_query("SELECT COUNT(id) as catnum FROM "._PRE.'categories'.""));
 
if ($contents == 'article_new' && $catnum['catnum'] < 1) {
 
echo l('create_cat');
 
} else {
echo html_input('form''''post''''''''''''''''''''post'$frm_action'');
echo '<div class="adminpanel">';
if ($toggle_div=='show') {
echo html_input('fieldset''''''''''''''''''''''''''''<a title="'.$frm_fieldset.
'" onclick="toggle(\'edit_article\')" style="cursor: pointer;">'.$frm_fieldset.'</a>');
echo '<div id="edit_article" style="display: none;">';
} else {
echo html_input('fieldset'''''''''''''''''''''''''''$frm_fieldset);
}
echo html_input('text''title''at'$frm_titlel('title'), '''onchange="genSEF(this,document.forms[\'post\'].seftitle)"''onkeyup="genSEF(this,document.forms[\'post\'].seftitle)"''''''''''''''');
if ($contents == 'extra_new' || $edit_option == 2) {
echo '<div style="display: none;">';
echo html_input('text''seftitle''as'$frm_sef_titlel('sef_title'), '''''''''''''''''''');
echo '</div>';
} else {
echo html_input('text''seftitle''as'$frm_sef_titlel('sef_title'), '''''''''''''''''''');
}
echo html_input('textarea''text''txt'$frm_textl('text'), '''''''''''2''100''''''');
# BUTTONS FUNCTION-TAG - generates sNews Editor buttons here
buttons();
if ($contents != 'page_new' && $edit_option != 3) {
echo '<p><label for="cat">';
echo ($contents == 'extra_new' || $edit_option == 2) ?  l('appear_category') : l('category');
if ($contents == 'extra_new' || $edit_option == 2) {
echo ':</label><br /><select name="define_category" id="cat" onchange="dependancy(\'extra\');">';
echo '<option value="-1"'.($article_category == -' selected="selected"' '').'>'.l('all').'</option>';
echo '<option value="-3"'.($article_category == -' selected="selected"' '').'>'.l('page_only').'</option>';
    }
    else echo ':</label><br /><select name="define_category" id="cat" onchange="dependancy(\'snews_articles\');">';
$category_query 'SELECT id,name,subcat FROM '._PRE.'categories'.'
WHERE published = \'YES\' AND subcat = 0 ORDER BY catorder,id ASC'
;
$category_result mysql_query($category_query);
while ($cat mysql_fetch_array($category_result)) {
echo '<option value="'.$cat['id'].'"';
if ($article_category == $cat['id']) {
echo ' selected="selected"';
}
echo '>'.$cat['name'].'</option>';
$subquery 'SELECT id,name,subcat FROM '._PRE.'categories'.'
WHERE subcat = '
.$cat['id'].' ORDER BY catorder,id ASC';
$subresult mysql_query($subquery);
while ($s mysql_fetch_array($subresult)) {
echo '<option value="'.$s['id'].'"';
if ($article_category == $s['id']) {
echo ' selected="selected"';
}
echo '>--'.$s['name'].'</option>';
}
}
echo '</select></p>';
if ($contents == 'extra_new' || $edit_option == 2) {
$none_display $article_category == -'none' 'inline';
echo '<div id="def_page" style="display:'.$none_display.';"><p><label for="dp">'.l('appear_page').':</label>
<br /><select name="define_page" id="dp">'
;
echo '<option value="0"'.($edit_option != '2' ' selected="selected"' '').'>'.l('all').'</option>';
$query 'SELECT id,title FROM '._PRE.'articles'.' WHERE position = 3 ORDER BY id ASC';
$result mysql_query($query);
while ($r mysql_fetch_array($result)) {
echo '<option value="'.$r['id'].'"';
if ($edit_page == $r['id']) {
echo ' selected="selected"';
}
echo '>'.$r['title'].'</option>';
}
echo '</select><br />'.
html_input('checkbox''show_in_subcats''asc''YES'l('show_in_subcats'), ''''''''$show_in_subcats'''''''''').'</p></div>';
}
}
if ($contents == 'article_new' || $edit_option == 1) {
  echo html_input('checkbox''show_on_home''sho''YES'l('show_on_home'), ''''''''$frm_showonhome'''''''''');
}
echo html_input('checkbox''publish_article''pu''YES'l('publish_article'), ''''''''$frm_publish'''''''''');
if ($toggle_div=='show') {
echo '</div>';
}
echo '</fieldset></div>';
# PREVIEW PANEL
echo '<div class="adminpanel">';
echo html_input('fieldset''''''''''''''''''''''''''''<a title="'.l('preview').
'" onclick="toggle(\'preview\')" style="cursor: pointer;">'.l('preview').'</a>');
echo '<div id="preview" style="display: none;"></div></fieldset></div>';
# CUSTOMIZE PANEL
echo '<div class="adminpanel">';
echo html_input('fieldset''''''''''''''''''''''''''''<a title="'.l('customize').
'" onclick="toggle(\'customize\')" style="cursor: pointer;">'.l('customize').'</a>');
echo '<div id="customize" style="display: none;">';
if ($contents == 'extra_new' || $edit_option == 2) {
if (s('enable_extras') == 'YES') {
echo '<p><label for="ext">'.l('define_extra').'</label><br />';
echo '<select name="define_extra" id="ext">';
$extra_query 'SELECT id,name FROM '._PRE.'extras'.' ORDER BY id ASC';
$extra_result mysql_query($extra_query);
while ($ex mysql_fetch_array($extra_result)) {
echo '<option value="'.$ex['id'].'"';
if ($extraid == $ex['id']) {
echo ' selected="selected"';
}
echo '>'.$ex['name'].'</option>';
}
echo '</select></p>';
} else {
echo html_input('hidden''define_extra''ext'1'''''''''''''''''''''');
}
}
if (!empty($id)) {
echo '<p><label for="pos">'.l('position').':</label>
<br /><select name="position" id="pos">'
;
echo '<option value="1"'.$frm_position1.'>'.l('center').'</option>';
echo '<option value="2"'.$frm_position2.'>'.l('side').'</option>';
echo '<option value="3"'.$frm_position3.'>'.l('display_page').'</option>';
echo '</select></p>';
} else {
echo html_input('hidden''position''position'$pos'''''''''''''''''''''');
}
if ($contents != 'extra_new' && $edit_option != '2') {
echo html_input('text''description_meta''dm'$frm_meta_descl('description_meta'), '''''''''''''''''''');
echo html_input('text''keywords_meta''km'$frm_meta_keyl('keywords_meta'), '''''''''''''''''''');
}
echo html_input('checkbox''display_title''dti''YES'l('display_title'), ''''''''$frm_display_title'''''''''');
if ($contents != 'extra_new' && $edit_option != '2') {
echo html_input('checkbox''display_info''di''YES'l('display_info'), ''''''''$frm_display_info'''''''''');
echo html_input('checkbox''commentable''ca''YES'l('enable_commenting'), ''''''''$frm_commentable'''''''''');
if (!empty($id)) {
echo '<p><input name="freeze" type="checkbox" id="fc"';
if ($r['commentable'] == 'FREEZ') {
echo ' checked="checked" />';
} else if ($r['commentable'] == 'YES') {
echo ' />';
} else {
echo ' />';
}
echo ' <label for="fc"> '.l('freeze_comments').'</label></p>';
}
}
echo '</div></fieldset></div>';
# END: CUSTOMIZE PANEL
# PUBLISH DATE PANEL
if ($contents == 'article_new' || $edit_option == 1) {
echo '<div class="adminpanel">';
echo html_input('fieldset''''''''''''''''''''''''''''<a title="'.l('publish_date').
'" onclick="toggle(\'admin_publish_date\')" style="cursor: pointer;">'.l('publish_date').'</a>');
echo '<div id="admin_publish_date" style="display: none;">';
# Patch Nov.22.09 - 1 new string, defines check-box status.
$onoff_status $r['published'] == '2' 'ok' ''// Variable inserted in check-box string show is as checked if enabled.
echo html_input('checkbox''fposting''fp''YES'l('enable'), ''''''''$onoff_status'''''''''');
echo '<p>'.l('server_time').': '.date('d.m.Y. H:i:s').'</p>';
echo '<p>'.l('article_date').'</p>';
!empty($id) ? posting_time($r['date']) : posting_time();
echo '</div></fieldset></div>';
}
# END: PUBLISH DATE PANEL
echo '<p>';
echo html_input('hidden''task''task''admin_article''''''''''''''''''''''');
echo html_input('submit'$frm_task$frm_task$frm_submit'''button''''''''''''''''''');
if (!empty($id)) {
echo html_input('hidden''article_category''article_category'$article_category'''''''''''''''''''''');
echo html_input('hidden''id''id'$id'''''''''''''''''''''');
echo html_input('submit''delete_article''delete_article'l('delete'), '',
'button''onclick="javascript: return pop()"''''''''''''''''');
}
echo '</p></form>';
}}

?>


To disable the sNews Editor buttons in this function, find # BUTTONS FUNCTION-TAG in the function and, under it, comment out the buttons(); function-tag by adding foward-slashes to the front of it as so: // buttons();

To disable the sNews Preview panel in this function, find # PREVIEW PANEL. The four strings under it generate the Preview panel. Disable them, from the comment note down, by commenting that section out so that it looks like (excluding the PHP-tags, of course):
Code: [Select]
<?php

/* ------------------
# PREVIEW PANEL
echo '<div class="adminpanel">';
echo html_input('fieldset', '', '', '', '', '', '', '', '', '', '', '', '', '', '<a title="'.l('preview').
'" onclick="toggle(\'preview\')" style="cursor: pointer;">'.l('preview').'</a>');
echo '<div id="preview" style="display: none;"></div></fieldset></div>';
//----------------*/

?>


And... don't forget to add your Tiny mod(s) where they belong in the function, as you had them in the one you disabled.
« Last Edit: September 18, 2010, 04:21:15 PM by Keyrocks »
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

Tropy

  • Newbie
  • *
  • Karma: 1
  • Posts: 25
Re: Simple way to add the TinyMCE WYSIWYG editor
« Reply #27 on: November 18, 2012, 09:53:03 PM »

hy guy's

have some probs with the tinymce

cause the german Specialchars like

,,, will be replaced with the equivalent html code
Code: [Select]
&auml;&uuml; &ouml; &szlig;
i think its with in the tinymce and snews did not parse them to html.

im using snews 1.7
anybody can help?

mfg tropy

okay found a way that works!
http://snewscms.com/forum/index.php/topic,8497.0.html


« Last Edit: December 27, 2012, 02:32:51 PM by Tropy »
Logged

Tropy

  • Newbie
  • *
  • Karma: 1
  • Posts: 25
Re: Simple way to add the TinyMCE WYSIWYG editor
« Reply #28 on: December 27, 2012, 02:34:38 PM »

but not in the extra block knows sombody where i have to set same code for extras?

set some extra groupings in template

and ther the german specialchars are not parsed or i think parsed twice.


mfg Tropy
Logged
Pages: 1 [2]