WordPress.org

Ready to get started?Download WordPress

Forums

Magic Fields
TinyMCE Visual/HTML toggle doesn't work on WP3.1 + Magic Fields 1.5.3 (57 posts)

  1. figureone
    Member
    Posted 3 years ago #

    Great plugin!
    Just upgraded to WP 3.1, and the Visual editor / HTML editor toggle buttons above the TinyMCE editor no longer work.

    http://wordpress.org/extend/plugins/magic-fields/

  2. hunk
    Member
    Plugin Author

    Posted 3 years ago #

    sorry a forget add a slider script, please update a 1.5.4.

    Sorry

  3. figureone
    Member
    Posted 3 years ago #

    Excellent, thanks! However, if I have a Quantity:Multiple write panel, the Visual/HTML toggle doesn't work for the first section (if I add more sections, it works fine on them). No javascript errors are being thrown, though.
    Hope it's an easy fix, and thanks for the quick response!

  4. figureone
    Member
    Posted 3 years ago #

    Also, this issue is occurring on a WordPress multisite build...not sure if the issues are related, but after upgrading to WP 3.1 I am also seeing similar problems to what existed before Magic Fields 1.5.1 (that is, content fields disappearing when saving/publishing/updating a page).

  5. hotgluemedia
    Member
    Posted 3 years ago #

    We're experiencing what I think may be a related issue on a client site running WP3.1 and MF1.5.4 (PHP5/Apache server). Every once in a while, but not all the time, the content in a multi-line widget will not save unless the "HTML" button is toggled. When this happens, even though the "HTML" button is toggled, the content is still shown as if it were using the visual editor.

    I've been able to replicate the issue in several browsers (Chrome 9, FF 3.6, and IE8) and on pages with multiple multi-line MFs and single-line MFs, with different types of content. There doesn't appear to be any way to determine when the issue will happen.

    Love the plugin - would appreciate some guidance. :)

  6. figureone
    Member
    Posted 3 years ago #

    Yep, that's exactly what happens for me--neither the Visual or HTML button is toggled on some multi-line widgets, and if you update the page in that state (neither button selected), the data in that field will be lost. If you manually click the HTML button, the TinyMCE editor stays (i.e., it doesn't switch to a textarea), but the data will be saved.

    In my limited debugging, it's always the first magic field section that you edit that has this problem. If I have a quantity:multiple write panel, any subsequent section I add will work perfectly. Also note, if I edit an existing page that has multiple magic field sections, whichever one I click on to edit first (it doesn't have to be the first one at the top) will not work.

    I'm pretty sure it's not a database issue and should be able to be fixed with some jQuery or javascript calls. The data loss seems to occur because the textarea that doesn't have the Visual/HTML toggle selected is not tied to the form submit, so the data never gets sent back to the database.

    Again, thanks for the awesome plugin! It has made development of public online courses at the university I work for so much easier.

  7. hunk
    Member
    Plugin Author

    Posted 3 years ago #

    ok quick fix comment this line 1198 in js/groups.js
    tinyMCE.init(options);

    and check if everything is working properly. if it works pleasetell me to add it to the current version

  8. figureone
    Member
    Posted 3 years ago #

    Yes, that fix works for me!

    In my quick testing, all multiline textboxes worked fine when toggling between Visual/HTML (TinyMCE/textarea). Kudos to you for hunting that down! I'd say it's safe to include in an update, but the one thing I haven't tested is interaction with other TinyMCE extension plugins (I have the latest version of TinyMCE Advanced installed, but nothing else).

    I'll let you know if I run into any problems. Again, thanks!

  9. hotgluemedia
    Member
    Posted 3 years ago #

    That seems to have done the trick - thank you!!!

  10. hotgluemedia
    Member
    Posted 3 years ago #

    Update - the patch worked, but created another problem: the upload/insert media buttons have disappeared. Had to roll back the patch.

  11. autumnmist
    Member
    Posted 3 years ago #

    Having the same problem with WP 3.1 and Magic Fields 1.5.4 (toggle between HTML and Visual doesn't always work and all my linebreaks get stripped away in Visual mode).

    Commenting out line 1198 didn't help. I still can't access HTML mode and Visual mode removes all paragraphs.

  12. autumnmist
    Member
    Posted 3 years ago #

    Update: If I comment out 1198, I can usually access HTML mode but all the HTML tags/formatting (particularly paragraph tags) gets stripped away when I do that.

    I'm pretty sure this isn't WordPress' doing since I disabled wpautop

  13. hunk
    Member
    Plugin Author

    Posted 3 years ago #

    Hi hotgluemedia, this buttons are in fullscreen mode

  14. hotgluemedia
    Member
    Posted 3 years ago #

    Yes, but without the patch they appear in both places.

  15. hOBOJoE
    Member
    Posted 3 years ago #

    This happens to me as well :( Only solution I've found so far is to try to click the HTML button before the page finishes loading...

  16. figureone
    Member
    Posted 3 years ago #

    Just a quick summary of where this bug stands:

    Applying this:
    * comment out line 1198 in js/groups.js:
    tinyMCE.init(options);

    Causes this:
    * Fixed data loss if you don't click Visual/HTML buttons on 1st magic field;
    * Breaks Upload/Insert media buttons;
    * Breaks other TinyMCE init stuff (how it treats line breaks, etc.)

    Just looking for an update here, thanks guys!

    p.s. any one remember this:
    http://www.youtube.com/watch?v=NA90IlymdZ4
    this is cooler: vimeo.com/21362582

  17. cebradesign
    Member
    Posted 3 years ago #

    I have the same problems that @figureone, specially that it cleans all line breaks of the text... :\

  18. autumnmist
    Member
    Posted 3 years ago #

    Well at least for me, while commenting out line 1198 might sometimes fix data loss if you don't click the Visual/HTML buttons, when if I go back and edit the same post/etc again, the act of going back and loading that post automatically triggers the loss of paragraphs and linebreaks again.

  19. jcx1028
    Member
    Posted 3 years ago #

    These disappearing line breaks are killing me (like on this page, for instance). Anyone who can come up with a solution will have my heartfelt thanks.

  20. figureone
    Member
    Posted 3 years ago #

    i just gave Britney 1 star because of that wall of text!

  21. cebradesign
    Member
    Posted 3 years ago #

    I also gave 1 star to Britney...
    Who would have thought it? xD

  22. figureone
    Member
    Posted 3 years ago #

    Ok, so I fixed this problem. In short, it was caused by orphaned field entries in the wp_mf_panel_custom_field table. If you delete the orphaned entries (be careful!), the Visual/HTML buttons will once again work properly.

    If you're interested in the details:
    Basically, since I have a WP Multisite setup, I initially was creating write panels and fields for each site, before I realized that Magic Fields currently has a set of write panels that are shared across all sites (I believe this is a bug that's on the developers' list). When I realized I was duplicating write panels, I deleted the extra panels, but somehow the fields I had created got left in wp_mf_panel_custom_field. So I ended up with several custom fields that had the duplicate names in wp_mf_panel_custom_field. This, in turn, was causing the bug with TinyMCE and the Visual/HTML buttons--basically, because there were multiple custom field entries in the database with the same name, when I went to edit one of those fields on a page, multiple spans would be created that contained the TinyMCE iframe (the span ids were based on the custom field name, like so: magicfields_FIELDNAME_1_1_parent). So the TinyMCE javascript code to switch between the HTML view (textarea) and Visual view (TinyMCE iframe) was showing/hiding only one of these spans, and the other one was staying visible on top and blocking the HTML view from ever showing.

    So, if you are having this problem and want to fix it, you'll have to jump into your database and delete some table rows by hand. This is dangerous, so only do this if you are comfortable doing so!

    First make a list of the custom fields that are in use (not orphaned):
    * In the WordPress dashboard, go to the Magic Fields Write Panels page: /wp-admin/admin.php?page=MagicFieldsMenu
    * For each of your write panels, click on Edit Fields/Groups
    * For every "Group Name / Field Label," hover over the link and look at the custom-field-id querystring variable
    * Keep track of all these IDs.

    Now, in your favorite database editor/view (I use phpmyadmin for MySQL):
    * Open up your WordPress database and browse the wp_mf_panel_custom_field table
    * The "id" column contains the custom-field-ids that you recorded earlier. If you see IDs that aren't in the list you made, they are orphaned. If they have the same "name" as ones that aren't orphaned, it will cause the problem outlined in this thread.
    * At this point, if you're comfortable, delete the rows that contain the orphaned fields. I'd strongly suggest first backing up your database, or at least recording the info for the rows you are deleting so you can restore them if you did something wrong.

    Good luck!

  23. hotgluemedia
    Member
    Posted 3 years ago #

    Thanks for the thorough writeup, figureone. It doesn't look like that's a universal fix, though - the DB for the site we're having problems on has no dupes. (It's also not a multisite, but I checked anyway just in case.)

  24. figureone
    Member
    Posted 3 years ago #

    @hotgluemedia, are there any repeated names in the wp_mf_panel_custom_field table?
    Even if you're not running multisite, and even if none of the fields are orphaned, if two have the same name then there will be collision (I think).

  25. hotgluemedia
    Member
    Posted 3 years ago #

    Nope - everything's unique. :(

  26. figureone
    Member
    Posted 3 years ago #

    Darn. If you can try to give me specifics on when the Visual/HTML buttons don't work, I can try to replicate it on my end, and do some more debugging.
    Or, if possible, send me a copy of your wp_mf_* tables in your database in case there's a problem there... I'm at prar@hawaii.edu

    P.S. Just occurred to me--did you role back the patch @hunk suggested? (line 1198 in js/groups.js: comment out tinyMCE.init(options);). My fix was for the original issue, not the missing Insert Media buttons caused by hunk's patch.

  27. hotgluemedia
    Member
    Posted 3 years ago #

    I haven't been able to narrow it down any further than my original post -

    Every once in a while, but not all the time, the content in a multi-line widget will not save unless the "HTML" button is toggled. When this happens, even though the "HTML" button is toggled, the content is still shown as if it were using the visual editor.

    I've been able to replicate the issue in several browsers (Chrome 9, FF 3.6, and IE8) and on pages with multiple multi-line MFs and single-line MFs, with different types of content. There doesn't appear to be any way to determine when the issue will happen.

    Yes - I rolled back the patch. Since this is happening on a live (and heavily-used) client site, the missing media buttons was unacceptable, so we immediately rolled it back. For now, I just have them always clicking the HTML button.

    Thanks for the offer - I'll get that sent over to you today. :)

  28. autumnmist
    Member
    Posted 3 years ago #

    Alas, I also had no orphaned fields in my wp_mf_panel_custom_field table. Two of my fields in different custom panels had the same name, so I adjusted them to be different. Unfortunately, I still have the same problem with linebreaks and paragraphs being removed.

    For me, this happens every single time I load a post that previously had content containing <p> or <br>. The post will save with the line/paragraph breaks but upon loading the post again for editing, the tags are removed.

  29. figureone
    Member
    Posted 3 years ago #

    Ok, 2 issues here:

    1) Visual/HTML toggle buttons don't work on some magic fields.
    2) TinyMCE is stripping out paragraph and break tags.

    The 1st issue is unresolved (still looking into it, @hotgluemedia).

    For the 2nd issue, two questions for @autumnmist:
    * Does this problem only happen to magic field write panels, or does it also happen to the page's main editable content area (the TinyMCE panel at the top of the edit page)?
    * Do you have any other TinyMCE-related plugins installed? I have the TinyMCE Advanced plugin installed, and it has an option to "Stop removing the p and br tags when saving and show them in the HTML editor." It works well for me.

  30. autumnmist
    Member
    Posted 3 years ago #

    All my Magic Field custom panels are set to hide the main editable content area, so I'm not sure if it happens only to the main content area. However certainly the other parts of my site (regular non-MF posts and pages) don't have problems with the stripping of paragraphs and break tags.

    I don't have any other TinyMCE plugins installed.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic