Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Widgets /

Discuss SilverStripe Widgets.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

HTML widget in 2.3.0


Go to End
Reply


20 Posts   7566 Views

Avatar
AndrewMK

Community Member, 23 Posts

2 March 2009 at 4:09pm

Hi,

I installed the HTML widget on a new 2.3.0 site (have previously used widget on 2.2.3 sites) and the text editor not displaying when you first drag the widget onto the widget area seems to make the entire page un-saveable or unable to be published. all you get is an error 'e =null'

Can anyone assist?

Avatar
Anonymous user

Community Member, 2 Posts

26 March 2009 at 6:58am

I have the same problem with HTML widget after upgrading to 2.3.1. When you click "Save" or "Save and publish" the page loads for ever but nothing happens.

Any one have a soulution?

Avatar
Nivanka

Community Member, 400 Posts

27 March 2009 at 2:44pm

I had the same issues, but I managed to get it. I used Firebug, and checked whether there is a HTMLEditor there was but it was hidden, I removed made it visible, and added some content and did a save and publish.

After that I never saw it is hidden. There must be some bug in this, but my tip can serve you to make your website :P.

Avatar
FungshuiElephant

Community Member, 57 Posts

30 March 2009 at 10:43pm

Edited: 30/03/2009 10:44pm

I too have the same problem (SS2.3.0)

One of the pages in the API documentation mentions that you can only have one global instance of the TinyMCE editor but I have tested a DoubleContentPage type that had two HTMLEditorFields on the Root.Content.Main tab and it worked flawlessly.

I also modified the HTMLContent widget, changing the HTMLEditorField to a TextArea field, and I could then add it to the widgets section and save text without issue (obviously no TinyMCE editor). I then changed the TextArea field back to a HTMLEditorField (in HTMLContentWidget.php) and got the TinyMCE editor when I refreshed the page. I can edit, save and publish BUT for some reason the TinyMCE editor is not editing just the TextArea but the stuff immediately arround it.

As a comparison between expected and actual behaviour see the attached picture. There is a Content field on the Root.Content.Main tab, it has a label above it and a grey box arround it. On the Root.Content.Widget tab I have an HTMLContent field but instead of the TinyMCE editor just editing the contents of this field it also allows me to edit the label and I get a field within a field. The only thing HTMLContent should contain is 222222222222222222222 but as you can probably just about make out is also contains the HTML paragraph tags, the grey box that should *surround* the editor and the field name.

I guess this might be caused by a lack of, or too many of, the right identifying tags that the javascript that adds the editor hooks into.

Don't have any more time to spend on this now, but this may help someone solve it; ultimately I think this will need to be fixed by the Silverstripe team. To get round it I may use a modified version of the Random Content Widget that displays all child pages rather than one random one. This may be nicer from a user perspective because it avoids having the TinyMCE editor stick out of the side of the widget box (see screenshot), although I'm sure that's fixable too.

Attached Files
Avatar
FungshuiElephant

Community Member, 57 Posts

30 March 2009 at 11:29pm

Further to last post, I turned off Javascript to see what the raw page looked like and found this:

      <div id="Widget[6][HTMLContent]" class="field htmleditor ">
         <label class="left" for="HTMLContent">HTMLContent</label>
         <div class="middleColumn">
            <textarea class="htmleditor typography" rows="20" cols="20" style="width: 97%; height: 320px" tinymce="true" id="Widget[6][HTMLContent]" name="Widget[6][HTMLContent]">
               &lt;p&gt;&lt;label class="left" for="HTMLContent"&gt;HTMLContent&lt;/label&gt;&lt;/p&gt;&lt;div class="middleColumn"&gt;&lt;textarea id="Widget[6][HTMLContent]" class="htmleditor typography" style="width: 97%; height: 320px;" cols="20" rows="20" name="Widget[6][HTMLContent]"&gt;&amp;lt;p&amp;gt;11111111111111&amp;lt;/p&amp;gt;&lt;/textarea&gt;&lt;/div&gt;
            </textarea>
         </div>
      </div>

Looking at the contents of the textarea, and converting the escaped tags, we see that it starts

<p><label class="left" ...


which we can see further up the html. So why is it getting confused, well it's probably due to the duplicated id Widget[6][HTMLContent] which is used for the outer div and the textarea.

So, that looks like the problem, the question is, how do we fix it?

Avatar
FungshuiElephant

Community Member, 57 Posts

31 March 2009 at 12:02am

Probably related to http://www.silverstripe.org/widgets-2/show/252154 which has been submitted as a bug.

Avatar
Anonymous user

Community Member, 2 Posts

9 April 2009 at 3:38am

So is it a bug in the HTML widget or in the latest relese of SilverStripe that cause this problem? And will it be fixed in the next relese of SilverStripe?

Avatar
FungshuiElephant

Community Member, 57 Posts

20 April 2009 at 9:30pm

Edited: 24/05/2009 12:30am

As far as I'm concerned it's a SilverStripe bug.
<br >
<br >You can use the widget but without the TinyMCE editor by editing the widget:
<br >
<br >
<br >To edit the HTMLContentWidget:
<br >Change the HTMLEditorField to a TextareaField in the getCMSField function in HtmlContentWidget.php
<br >Add?flush=1 and reload the CMS page you're editing.
<br >You should now be able to delete the widget.
<br >
<br >You can actually use the widget with this modified interface. Just paste HTML into the textarea in the CMS; it's only the javascript that adds the TinyMCE editor that's a bit broken.
<br >

<br >
<br >Will it be fixed in the next version (2.3.2) of SS?
<br >No. Last time I looked there wasn't anybody looking at this, so it's unlikely to be fixed anytime soon. See [url]http://open.silverstripe.org/ticket/2836[/url] for information on a related bug.

Go to Top