Jump to:

794 Posts in 408 Topics by 304 members

Widgets

SilverStripe Forums » Widgets » HTML widget in 2.3.0

Discuss SilverStripe Widgets.

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

Page: 1 2 3
Go to End
Author Topic: 7205 Views
  • AndrewMK
    Avatar
    Community Member
    23 Posts

    HTML widget in 2.3.0 Link to this post

    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?

  • Anonymous user
    Avatar
    Community Member
    2 Posts

    Re: HTML widget in 2.3.0 Link to this post

    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?

  • Nivanka
    Avatar
    Community Member
    395 Posts

    Re: HTML widget in 2.3.0 Link to this post

    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 .

  • FungshuiElephant
    Avatar
    Community Member
    57 Posts

    Re: HTML widget in 2.3.0 Link to this post

    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
  • FungshuiElephant
    Avatar
    Community Member
    57 Posts

    Re: HTML widget in 2.3.0 Link to this post

    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?

  • FungshuiElephant
    Avatar
    Community Member
    57 Posts

    Re: HTML widget in 2.3.0 Link to this post

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

  • Anonymous user
    Avatar
    Community Member
    2 Posts

    Re: HTML widget in 2.3.0 Link to this post

    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?

  • FungshuiElephant
    Avatar
    Community Member
    57 Posts

    Re: HTML widget in 2.3.0 Link to this post

    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 http://open.silverstripe.org/ticket/2836 for information on a related bug.

    7205 Views
Page: 1 2 3
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.