Support » Plugin: Cooked - Recipe Plugin » Save as default template broken

  • Resolved Sandra

    (@foodcat)


    Hi,
    I started using your plugin last week, thanks for making it šŸ™‚

    But with the new update a bug went into it. It occurs if you want to save a default template.

    Uncaught TypeError: Cannot read property 'getContent' of null
        at HTMLAnchorElement.<anonymous> (cooked-functions.min.js:1)
        at HTMLAnchorElement.dispatch (load-scripts.php:3)
        at HTMLAnchorElement.r.handle (load-scripts.php:3)

    You also can’t restore your default template to new recipes.
    Thanks for your help. If you need more information feel free to ask me.

    • This topic was modified 4 years ago by Sandra.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Boxy Studio

    (@boxystudio)

    @foodcat:

    Thanks for letting me know! I’ll take a look at this bug for the next update.

    Plugin Author Boxy Studio

    (@boxystudio)

    @foodcat: I can’t seem to recreate this issue on my development or demo sites. Can you let me know where you’re seeing this error and whether you’re seeing it with only new recipes or all recipes?

    Thread Starter Sandra

    (@foodcat)

    I found the reason:
    If you open the editor in text mode first (so TinyMCE isn’t initialized) the error occurs. So you can’t save your templates only using text mode.
    The problem I have: the TinyMCE adds some p in my bootstrap rows where there should be, so I nearly use text mode all the time.
    So you have to initialize tinymce first or make a simple if that for saving (pseudocode):

    var valueoffield= null;
     if (tinymce.get("_recipe_settings_content") is null) { 
    valueoffield=document.getElementById('_recipe_settings_content').value; 
    } else {
    valueoffield=tinymce.get("_recipe_settings_content");
    }

    restoring

    var newvalueoffield= getSavedDataFromDatabase();
     if (tinymce.get("_recipe_settings_content") is null) { document.getElementById('_recipe_settings_content').value(newvalueoffield); 
    } else {
    tinymce.get("_recipe_settings_content").setContent(newvalueoffield);
    }

    I hope, I explained things clearly ^^”

    I also found something strange:
    If you open a new recipe the standard, you saved loads- fine. If you press restore now, the plugins first config loads – bug or feature ;).

    • This reply was modified 4 years ago by Sandra.
    • This reply was modified 4 years ago by Sandra.
    Plugin Author Boxy Studio

    (@boxystudio)

    Thanks so much for letting me know. I will have this fixed in the next update. šŸ™‚

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Save as default template broken’ is closed to new replies.