Forum

Thread tagged as: Error, Addons, Blog

"Missing" Markitup toolbar in Blog app (not a cache issue)

Hullo,

I've noticed strange behaviour when using a textarea with the Markitup editor in the official Blog add-on.

Basically, in some configurations, textareas that have editor="markitup" do not show a toolbar until after content has been added to that field and saved.

TL;DR: The issue seems tied to the "order" parameter: if a textarea without the markitup editor appears in the form's "order" before a textarea that DOES have a markitup editor specified, the markitup toolbar does not immediately load. I have only noticed this behaviour in the Blog add-on.

The best example is with the stock post.html template that ships with the Blog add-on. If we strip all the extraneous code, we're left with three fields to fill in: the Title, Post, and Excerpt. Such as:

<perch:blog id="postTitle" type="text" label="Title" required="true" size="xl autowidth" order="1" />
<perch:blog id="postDescHTML" type="textarea" label="Post" order="2" editor="markitup" markdown="true" size="xxl autowidth" required="true" />
<perch:blog id="excerpt" type="textarea" label="Excerpt" markdown="true" order="3" suppress="true" size="s" />

In this configuration, everything works fine, and the postDescHTML field shows the markitup toolbar as it should.

However, if you swap the "order" of the "excerpt" and the "postDescHTML" fields, the error occurs. So if we do this...

<perch:blog id="postTitle" type="text" label="Title" required="true" size="xl autowidth" order="1" />
<perch:blog id="postDescHTML" type="textarea" label="Post" order="3" editor="markitup" markdown="true" size="xxl autowidth" required="true" />
<perch:blog id="excerpt" type="textarea" label="Excerpt" markdown="true" order="2" suppress="true" size="s" />

The markitup editor no longer appears above the postDescHTML textarea.

So, with that configuration, to get the toolbar to appear, I have to do this:

  1. Blog
  2. Add Post
  3. Fill out required fields
  4. Save (still no toolbar)
  5. Save a second time (toolbar appears)

It's worth noting the behaviour persists after leaving the post and returning. So, if I follow the 5 steps above (so I can see the toolbars), then I leave the post edit form, when I return I need to save the page once more to have the toolbars return.

Curiously, if both textareas have editor="markitup" set, the toolbars DO load.

I have replicated this in Safari, Chrome, and Firefox. Clearing the cache in each does not help.

Running Perch 2.8.3 and Blog 4.6.

Here are the latest error logs in MAMP:

[20-Mar-2015 00:14:07 UTC] PHP Notice:  Undefined offset: 1 in /path/to/website/admin/core/lib/PerchFieldTypes.class.php on line 692
[20-Mar-2015 00:53:23 UTC] PHP Notice:  Undefined index: postDateTime in /path/to/website/admin/addons/apps/perch_blog/PerchBlog_Post.class.php on line 84

Let me know if there's anything else I can provide.

Richard Terrick

Richard Terrick 3 points

  • 6 years ago

I have also had this problem on and off. Sometimes just getting out of the blog input form and back in on my sites will bring the markitup back.

Drew McLellan

Drew McLellan 2638 points
Perch Support

We'll see if we can reproduce that.