WordPress.org

Ready to get started?Download WordPress

Forums

WordPress Front-end Editor
[resolved] Editor saves injected content. (6 posts)

  1. Bobby
    Member
    Posted 6 months ago #

    Greetings!

    Just doing some more testing and tried this plugin on a test site. This test site has a js function that for each link checks an external site and grabs an icon depending on the link. It then inserts the icon into the page and displays it to the user.

    With the Front end Editor plugin, because this js function loads, it loads the icons correctly, but then upon saving the post, these icons are also saved. Therefore when the page is viewed and the links are checked and inserted, there is a double-up of said icons.

    What would be a workaround?

    http://wordpress.org/plugins/wp-front-end-editor/

  2. Janneke Van Dorpe
    Member
    Plugin Author

    Posted 6 months ago #

    I would use css instead for that. But yeah, that's a problem if you really want to keep that.

  3. Bobby
    Member
    Posted 6 months ago #

    The function isn't really possible with css as it grabs the icons from an external site using php. Perhaps there is a way to disable some js from loading when editing via the front end...

    Is there something in this plugin that I can use to detect when it is editing via the front end? i.e. a class added to the body etc? Then i can add in an if statement to my js to stop it from loading.

    Also just wanted to write about this experience just as an FYI in case this causes problems in the future.

  4. Janneke Van Dorpe
    Member
    Plugin Author

    Posted 6 months ago #

    Why is it not possible? Surely you can add CSS rules with PHP.

    Yeah, I know, thanks. In some cases there might not be a CSS solution. And it still breaks the editor initially…

    For now you could use this, but I should warn you that this might break in the future of course.

    if ( WP_Front_End_Editor::is_edit() )

  5. Bobby
    Member
    Posted 6 months ago #

    The js/php function is pretty complex but saves me a tonne of time automagically injecting icons scraped from another site.

    Anyway, I'll work something out, thanks for the info. Keep up the great work!

  6. Janneke Van Dorpe
    Member
    Plugin Author

    Posted 5 months ago #

    I'm going to close mark this as resolved. Unfortunately it's impossible for us to prevent JS changes, it will be up to the user/plugin to prevent this from happening. I'll soon add some functions so you can exclude the JS from that page (probably is_edit()). For now you could also use the classes 'wp-fee-body', 'wp-fee-post' and 'wp-fee-content'. Hope that helps.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.