News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Problem in wysiwyg editor in RC5

Started by Krashsite, June 05, 2011, 02:32:29 PM

Previous topic - Next topic

mashby

Still a lot of unknowns. What source did this come from?
Quote from: Krash. on June 09, 2011, 11:42:56 PM

This was copied from your post above using Select link -

/* Styles for the general looks for the Curve theme.------------------------------------------------------- *//* Normal, standard links. */a:link, a:visited{    color: #346;    text-decoration: none;}a:hover{    text-decoration: underline;    cursor: pointer;}/* Links that open in a new window. */a.new_win:link, a.new_win:visited{    color: #346;    text-decoration: none;}a.new_win:hover{    text-decoration: underline;}/* Tables should show empty cells. */table{    empty-cells: show;}
Which Select link did you use?
Always be a little kinder than necessary.
- James M. Barrie

Sir Osis of Liver


- If I copy the code from the code window in any of these posts using Select or manually, Preview and Post have linebreaks stripped.

- If I copy the same code into Notepad, then copy it from Notepad to the editor, it displays correctly.

- If I disable wysiwyg, it displays correctly either way.

- If I re-enable wysiwyg with the text still in the editor, the linebreaks are stripped.


Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Sir Osis of Liver

Quote from: mashby on June 10, 2011, 12:01:55 AM
Still a lot of unknowns. What source did this come from?

Your post #30, Ant's code.

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Sir Osis of Liver

 
Copied from Wordpad, wysiwyg enabled -


// The main sub template above the content.
function template_main_above()
{
global $context, $settings, $options, $scripturl, $txt, $modSettings, $user_info;
// Show right to left and the character set for ease of translating.
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"', $context['right_to_left'] ? ' dir="rtl"' : '', '><head>
<meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '" />
<meta name="description" content="', $context['page_title'], '" />', empty($context['robot_no_index']) ? '' : '
<meta name="robots" content="noindex" />', '
<meta name="keywords" content="PHP, MySQL, bulletin, board, free, open, source, smf, simple, machines, forum" />
<script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/script.js?fin11"></script>
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
var smf_theme_url = "', $settings['theme_url'], '";
var smf_images_url = "', $settings['images_url'], '";
var smf_scripturl = "', $scripturl, '";
var smf_iso_case_folding = ', $context['server']['iso_case_folding'] ? 'true' : 'false', ';
var smf_charset = "', $context['character_set'], '";
// ]]></script>
<title>', $context['page_title'], '</title>';
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Sir Osis of Liver

 
Copied from the previous post, wysiwyg enabled -

// The main sub template above the content.function template_main_above(){global $context, $settings, $options, $scripturl, $txt, $modSettings, $user_info;// Show right to left and the character set for ease of translating.echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"', $context['right_to_left'] ? ' dir="rtl"' : '', '><head><meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '" /><meta name="description" content="', $context['page_title'], '" />', empty($context['robot_no_index']) ? '' : '<meta name="robots" content="noindex" />', '<meta name="keywords" content="PHP, MySQL, bulletin, board, free, open, source, smf, simple, machines, forum" /><script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/script.js?fin11"></script><script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[var smf_theme_url = "', $settings['theme_url'], '";var smf_images_url = "', $settings['images_url'], '";var smf_scripturl = "', $scripturl, '";var smf_iso_case_folding = ', $context['server']['iso_case_folding'] ? 'true' : 'false', ';var smf_charset = "', $context['character_set'], '";// ]]></script><title>', $context['page_title'], '</title>';
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Sir Osis of Liver


Copied from the first post, wysiwyg disabled -

// The main sub template above the content.
function template_main_above()
{
global $context, $settings, $options, $scripturl, $txt, $modSettings, $user_info;
// Show right to left and the character set for ease of translating.
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"', $context['right_to_left'] ? ' dir="rtl"' : '', '><head>
<meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '" />
<meta name="description" content="', $context['page_title'], '" />', empty($context['robot_no_index']) ? '' : '
<meta name="robots" content="noindex" />', '
<meta name="keywords" content="PHP, MySQL, bulletin, board, free, open, source, smf, simple, machines, forum" />
<script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/script.js?fin11"></script>
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
var smf_theme_url = "', $settings['theme_url'], '";
var smf_images_url = "', $settings['images_url'], '";
var smf_scripturl = "', $scripturl, '";
var smf_iso_case_folding = ', $context['server']['iso_case_folding'] ? 'true' : 'false', ';
var smf_charset = "', $context['character_set'], '";
// ]]></script>
<title>', $context['page_title'], '</title>';
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Sir Osis of Liver

 
Ok, confirmed.  Linebreaks are stripped in preview and post when code is copied from a code window in a post directly to the reply textarea with wysiwyg enabled.  If the code is copied from a code window to Notepad or Wordpad, then copied from there to the reply textarea, it previews and posts correctly.

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Arantor

* Once Upon A Star suspects this is related to the fact that IE doesn't like handling the content as output by the code tag seeing how it doesn't have actual line break characters in it...

Antechinus

Ok, but why can't Mashby and I reproduce this even though we have the same OS as Krash and are using the same browsers?

Also, why is Krash getting exactly the same problem with Firefox?

Arantor

*shrug* I know there are issues with the newline characters being stripped from code blocks. I can reproduce it in IE8 64-bit, as it happens, because I had to fix it in <that other thing> but my fix won't be suitable for SMF.

Antechinus

Ok, but Krash is using 32 bit. Same as myself and Mashby. TBH this looks like something weird with Krash's pooter, although I cannot think what it might be.

Sir Osis of Liver


If you look up the thread, I believe mashby got it once (reply #30).  Only tried it once in FF last night, didn't get it, but I hadn't nailed down the cause yet.

If the code block doesn't contain linebreaks, how does it display correctly in Notepad?  And why is it fixed by copying it into and out of Notepad?

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

mashby

My reply #30 was copying from here where is was already messed up though:
Quote from: Krash. on June 09, 2011, 11:40:48 PM

This was copied from Notepad into the textarea -

  /* Styles for the general looks for the Curve theme.------------------------------------------------------- *//* Normal, standard links. */a:link, a:visited{    color: #346;    text-decoration: none;}a:hover{    text-decoration: underline;    cursor: pointer;}/* Links that open in a new window. */a.new_win:link, a.new_win:visited{    color: #346;    text-decoration: none;}a.new_win:hover{    text-decoration: underline;}/* Tables should show empty cells. */table{    empty-cells: show;
Always be a little kinder than necessary.
- James M. Barrie

Sir Osis of Liver

#53

Don't know if I can explain this so you'll understand it, but here goes.

Was trying unsuccessfully to replicate the problem in FF3.5, which I did early in this thread.  Copy the code block from a post into the reply textarea, wysiwyg enabled, works fine.

Back to IE8, problem occurs every time.

Well, almost every time.

Switching back and forth between FF and IE, copying the code block from one or the other, and trying it in both, I came up with this wierd result.

- If I copy the code block in FF, and paste it into the reply textarea in either FF or IE, wysiwyg enabled, it previews/posts correctly in both.

- If I copy the code block in IE, and paste it into the reply textarea in either FF or IE, wysiwyg enabled, it previews/posts incorrectly in both - linebreaks are stripped.

Go figure.

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Sir Osis of Liver


Not sure if this is significant, but look at post #25 here -

http://www.simplemachines.org/community/index.php?topic=437744.msg3073966#new

Posted this last night.  It was late, and not 100% sure how I did it, but believe I copied the code block from Wordpad into the Reply editor, wysiwyg enabled.  Pretty sure it looked normal after I posted it, but today the linebreaks are stripped.

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Illori


Advertisement: