Support » Plugin: Preserved HTML Editor Markup » [Plugin: Preserved HTML Editor Markup] FAQ? Does this plugin actually disable wpautop?

Viewing 15 replies - 1 through 15 (of 19 total)
  • Plugin Author MarcusPope

    (@marcuspope)

    @dandv – Yep, it’s 100% disabled. There are actually two versions of wpautop, one in php and one in JavaScript. My plugin will disable both of them which is how I support switching between Visual and HTML tabs.

    And though my plugin offers the option to inject Paragraph tags, it does it in a much more intelligent way that shouldn’t cause the issue reported in the github ticket you referenced.

    But I’m not bug proof so if there is a compatibility issue with the Pods framework let me know and I’ll do what I can to fix it. I’ve added your question to the FAQ in version 1.3.

    Thanks!
    -Marcus

    I’m also listening if you notice anything I need to be aware of in regards to the Pods Framework.

    Well, even though the plugin is enabled, <p> tags are still inserted.

    I have the following code in the HTML editor of a page:

    <p>We plan to be located … Map below:</p>

    <div id=”mapdiv”></div>
    <script src=”http://www.openlayers.org/api/OpenLayers.js”></script>
    <script>
    map = new OpenLayers.Map(“mapdiv”);
    map.addLayer(new OpenLayers.Layer.OSM());

    //Set start centrepoint and zoom
    var lonLat = new OpenLayers.LonLat( -122.4000, 37.5050 )
    .transform(
    new OpenLayers.Projection(“EPSG:4326”), // transform from WGS 1984
    map.getProjectionObject() // to Spherical Mercator Projection
    );
    var zoom=10;
    map.setCenter (lonLat, zoom);

    </script>

    <p>One would hope the location above would work…

    …but if you look at the page source, you’ll see <p> tags inserted where linebreaks used to be in the <script> section.

    Maybe this is actually (currently) intended behavior, but it certainly breaks scripts.

    There are actually <p> and br tags where there were no linebreaks at all:

    <div id=”mapdiv”></div>
    <p> <script src=”http://www.openlayers.org/api/OpenLayers.js”></script>
    <script>

    I just want the “HTML” tab in the page editor to be raw HTML. No “smart” paragraph or line break crap; those should be reserved for the Visual editor.

    How can I do this?

    Plugin Author MarcusPope

    (@marcuspope)

    @dandv – That’s interesting because your code works for me. I edited a new page, pasted your code in (I added a closing P tag where the elipsis were) updated and viewed the page source. Here is what I got:


    <article>
    <p>We plan to be located … Map below:</p>

    <div id="mapdiv"></div>
    <script src="http://www.openlayers.org/api/OpenLayers.js"></script>
    <script>
    map = new OpenLayers.Map("mapdiv");
    map.addLayer(new OpenLayers.Layer.OSM());

    //Set start centrepoint and zoom
    var lonLat = new OpenLayers.LonLat( -122.4000, 37.5050 )
    .transform(
    new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984
    map.getProjectionObject() // to Spherical Mercator Projection
    );
    var zoom=10;
    map.setCenter (lonLat, zoom);

    </script>

    <p>One would hope the location above would work</p>
    </article>

    No P tags, other than those that were specified. I tested this on a clean wordpress install v 3.4.1. Is there something in your theme or other plugins that could be injecting them?

    It did however expose a bug I have in the tab switch logic where the browser is injecting a CDATA block definition and my plugin is not correctly handling the transition back to HTML.

    I’ll be honest and say that I didn’t intend for this plugin to preserve script blocks, just html markup. But I’m pleased to see that it works in addition to allowing for inline scripts and styles.

    But I’m definitely interested in fixing whatever is causing your installation to break so if you don’t mind answering the following I’d appreciate it:

    1. What version of WP?
    1. What other plugins are installed?
    1. What’s the full html source you are trying to use? (you might need to email it to me if it’s a lot, but invalid markup can cause a lot of problems.)

    You might also want to try using the code block I tested with to make sure it wasn’t specific to code after the elipsis.

    Thanks!
    -Marcus

    Plugin Author MarcusPope

    (@marcuspope)

    @dandv – Also, is the pods framework open source or available for me to trial? It’s quite possible they implement their own wpautop hooks that I’m not capable of disabling via a plugin. A download link to that would be great if it’s available.

    We don’t implement any wpautop hooks in any form as part of our core functionality. We don’t use the_content filter either.

    Sorry, forgot to mention – The Pods Framework is a freely available open source project: http://podsframework.org/

    It’s on GitHub, and we have a new major version coming out too.

    1.x Stable: https://github.com/pods-framework/pods/tree/master

    2.0 Beta: https://github.com/pods-framework/pods/tree/2.0

    Plugin Author MarcusPope

    (@marcuspope)

    Ah, I see, so Scott, you develop the pods framework. Ok, well I’ll setup the framework on a staging site and try out my plugin. I’ll let you know what I find. Thanks for the links.

    Plugin Author MarcusPope

    (@marcuspope)

    The good news is that I can reproduce the problem with the PODS plugin activated. The bad news is I don’t have time to fix it today. I’ll see if I can work on it before the week is up, but that’s rapidly closing in. I should definitely have some time on Labor day so hopefully you can hang on till then 😀

    Thanks,
    Marcus

    Plugin Author MarcusPope

    (@marcuspope)

    @scott – So my ability to reproduce the problem was a result of a unicode character in the pasted output when I copied my code sample from above. The elipsis caused malformed html and the browser showed closing p tags. So, with proper html and Pods enabled, the system still worked for me.

    The only piece from PODS I didn’t test was when an editor is embedded into a pod. Firstly, I don’t know enough about pods on how to view that pod, or inject it, or really anything. However I can say that it loads its own editor when a Paragraph Text column is used. And it does setup a client-side wpautop and tweaks the editor to reformat the source markup.

    @dandv – So if the markup is being munged I would attribute it to the following issues:

    1. The markup itself isn’t well formed. I’m assuming the wordpress support site truncated your code snippet or you did, but you do have an elipsis at the end of the code sample and no closing P tag. I recommend using the w3c validator to test the code sample.

    2. There is a different plugin causing a conflict with my plugin, which I’m also happy to investigate, if you don’t mind testing each one, one at a time.

    3. You are trying to enter that code into an editor instantiated by Pods, yet because it’s a different instance of the editor, I’m not able to correct the markup. If this was the case I recommend trying to paste that markup into a regular page or post, and see if it works for you.

    @scott, if you can fill in some details on where that editor is accessible from I can try to confirm #3.

    I still need to fix the issue related to switching between editors causing a garbled output on switch back to html, but that’s a lower priority since the code block does work if you don’t switch. So I’ll have an update sometime this weekend.

    We use the wp_editor for TinyMCE instances:

    http://codex.wordpress.org/Function_Reference/wp_editor

    What can we do to support your JS hooks if we call wp_editor separately from the main editor?

    @dandv I thought you said this issue existed in your main content editor, were you saying that it was happening in a TinyMCE field that Pods created?

    Plugin Author MarcusPope

    (@marcuspope)

    @scott, are you sure about using the built in editor? It looks like the pods code overwrites the global $wp_editor with the WP_Pre_33_Editor class in pods\ui\wp-editor.php. If that’s only loaded for the editor in Pods, and @dandv was having an issue in the main content editor, then there’s nothing for you to do. I’ll need more info from him, since I could use both together.

    Otherwise, I’m not quite sure what it would take to fix the custom editor in wp-editor.php. It should really just need the calls to wpautop removed. But I’m not even sure if my js logic is loaded with that custom editor and that would also be necessary, so my best suggestion would be to use the default editor. If there is something you need the default editor to do in that class, I might be able to help you there. But it looks like you were just trying to get the latest features before 3.3 was released maybe? The code comments and readme file seem to indicated so.

    Thanks!
    -Marcus

    WP_Pre_33_Editor is only called for WP versions prior to 3.3, it’s actually the standalone source directly from azaozz, the same person who merged that code into WP 3.3 — If he’s running WP 3.3+ then it’s calling wp_editor directly.

    Will have to see what @dandv says to help us further figure this out.

    Plugin Author MarcusPope

    (@marcuspope)

    Hmm, I’m still not sure about that. I see checks for $wp_version around the plupload logic, but the inclusion of WP_Pre_33_Editor happens every time. I followed the call stack, and it seems that it is instantiated from the pods_ui_manage calls in manage_content.php. I’m not sure at what point in the callstack that code is executed (mostly because I only perused the source code,) but if it’s after tiny_mce_before_init or admin_init then it would undo my fixes.

    I double checked the code and WP_Pre_33_Editor is included, I’m going to push it inside of the wp_editor function check. It runs wp_editor if the function exists.

    As for the point that it runs, we currently call wp_editor() as needed, on the field it’s used on itself. Is there anything you suggest to further support your hooks? We pretty much have the flexibility to do whatever you need, but based on how the forms are setup to run, we don’t know what fields / forms will appear until the form is called, which is after admin_init.

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘[Plugin: Preserved HTML Editor Markup] FAQ? Does this plugin actually disable wpautop?’ is closed to new replies.