<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>A few fragment questions</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=119381890" />
  <subtitle>A few fragment questions</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=119381890</id>
  <updated>2026-04-04T23:12:03Z</updated>
  <dc:date>2026-04-04T23:12:03Z</dc:date>
  <entry>
    <title>RE: A few fragment questions</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119390454" />
    <author>
      <name>Christoph Rabel</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119390454</id>
    <updated>2020-06-14T12:10:53Z</updated>
    <published>2020-06-14T12:10:53Z</published>
    <summary type="html">Yes, that&amp;#39;s the feature I was referring to when I said, 7.3.2 is necessary. It is a really great feature and lays the groundwork for what I want to achieve. I can basically build anything with that. Create a frame (or several) and put the pieces into it. Superflexible.&lt;br /&gt;But there is a limit.&lt;br /&gt;In theory I could create a table fragment with a dropzone,  a row fragment with a dropzone and a fields fragment. The editor drags a table on the page, drags a row into the table, then drags the fields into the rows. &lt;strong&gt;The caveat&lt;/strong&gt;: For a 5x5 table, the editor would have to drag 25 fields into the table, which is kinda &lt;strong&gt;tedious&lt;/strong&gt;.&lt;br /&gt;There are certainly other ways too, but I see a lot of possibilies to enhance the experience of the editor with my idea. In the end, AlloyEditor does something similar, it adds convenience buttons to make a text bold or add a link to it. I probably could implement this as an editor plugin (with emphasis on probably), but I would rather find a more direct, specific to that fragment, approach.</summary>
    <dc:creator>Christoph Rabel</dc:creator>
    <dc:date>2020-06-14T12:10:53Z</dc:date>
  </entry>
  <entry>
    <title>RE: A few fragment questions</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119389851" />
    <author>
      <name>Olaf Kock</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119389851</id>
    <updated>2020-06-14T09:35:46Z</updated>
    <published>2020-06-14T09:35:46Z</published>
    <summary type="html">There&amp;#39;s this paragraph &amp;#34;LPS-113660 Support drop zones in fragments so that page creators can add any fragment or widget inside&amp;#34; (and the following ones) in &lt;a href="https://liferay.dev/blogs/-/blogs/liferay-portal-7-3-ce-ga3-release"&gt;Jamie&amp;#39;s announcement&lt;/a&gt;... Does that come close to being useful for your requirement, only that you&amp;#39;d like to have it more structured with a button instead of a dropzone?&lt;br /&gt;Or is that what you were aware of all the time already, which led you to the requirement of requiring 7.3.2 anyway, in order to implement your envisioned solution?</summary>
    <dc:creator>Olaf Kock</dc:creator>
    <dc:date>2020-06-14T09:35:46Z</dc:date>
  </entry>
  <entry>
    <title>RE: A few fragment questions</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119385860" />
    <author>
      <name>Olaf Kock</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119385860</id>
    <updated>2020-06-13T18:44:52Z</updated>
    <published>2020-06-13T18:44:52Z</published>
    <summary type="html">I think I know what you mean, but used unprecise words in my answer. I agree with the ideas you stated, and thinking of it: You&amp;#39;re right - no upgrade issues to expect I believe (now). &lt;br /&gt;Maybe I should first look at the current 7.3.2 implementation before judging if it&amp;#39;ll be straightforward or not. Your idea definitely sounds interesting</summary>
    <dc:creator>Olaf Kock</dc:creator>
    <dc:date>2020-06-13T18:44:52Z</dc:date>
  </entry>
  <entry>
    <title>RE: A few fragment questions</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119388202" />
    <author>
      <name>Christoph Rabel</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119388202</id>
    <updated>2020-06-13T18:31:57Z</updated>
    <published>2020-06-13T18:31:57Z</published>
    <summary type="html">Again: I think, you misunderstand me. I don&amp;#39;t want to update the fragments. &lt;br /&gt;Let me try it with an analogy (It doesn&amp;#39;t fit perfectly, but which analogy does?)&lt;br /&gt; Fragments are similar to Java classes. When I place them on a page, an instance is created. Now, Fragments can contain editable fields, they would be the variables. I do not want to mess with the Java class, I want to update the variables of the instance.&lt;br /&gt;That&amp;#39;s actually not difficult using Javascript. The tricky part is tell the system that the variable was changed and the object has to be persisted.&lt;br /&gt;---&lt;br /&gt;This shouldn&amp;#39;t be an upgrade issue at all. The &amp;#34;variable&amp;#34; already can contain &amp;#34;anything&amp;#34;. So, Liferay shouldn&amp;#39;t care what the content is. Sure, I can mess up and insert illformed html, but otherwise I should be fine.&lt;br /&gt;And Webcontent just doesn&amp;#39;t cut it for the things I have in mind. I need the drag&amp;amp;drop features and the flexible layouts. What I want to do actually needs at least 7.3.2, can&amp;#39;t be done before that  ...</summary>
    <dc:creator>Christoph Rabel</dc:creator>
    <dc:date>2020-06-13T18:31:57Z</dc:date>
  </entry>
  <entry>
    <title>RE: A few fragment questions</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119385509" />
    <author>
      <name>Olaf Kock</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119385509</id>
    <updated>2020-06-13T18:11:48Z</updated>
    <published>2020-06-13T18:11:48Z</published>
    <summary type="html">I wasn&amp;#39;t sure if fragments can be updated on the fly, without appearing in the list of fragments, but I guess that&amp;#39;s possible. But unless directly supported it&amp;#39;ll be really messy with a potential upgrade nightmare...&lt;br /&gt;Consider classic structured WebContent articles, where you can have repeating elements... Not as WYSIWYG, but a lot cleaner and easier to migrate later</summary>
    <dc:creator>Olaf Kock</dc:creator>
    <dc:date>2020-06-13T18:11:48Z</dc:date>
  </entry>
  <entry>
    <title>RE: A few fragment questions</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119387814" />
    <author>
      <name>Christoph Rabel</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119387814</id>
    <updated>2020-06-13T16:10:58Z</updated>
    <published>2020-06-13T16:10:58Z</published>
    <summary type="html">1) I believe so too and I probably could have found out myself, but I decided to be lazy and ask it here ;)&lt;br /&gt;2/3) Just to be clear, I do not want to create new fragments, I want to edit the content of editable elements inside of a fragment using Javascript. &lt;br /&gt;Liferay doesn&amp;#39;t care, what &amp;#34;Some content&amp;#34; is, so I should be able to replace it, as long as I do not mess with the editable tag itself.&lt;br /&gt;&amp;lt;lfr-editable&amp;gt;Some content&amp;lt;/lfr-editable&amp;gt; &lt;br /&gt;I checked the request myself and I believe, I could construct the post request to the backend myself or maybe I could simulate the right kind of &amp;#34;click&amp;#34; to trigger it, but these things would be hackish and quite fragile . I&amp;#39;d rather just call an API and tell it &amp;#34;hey, I have changed, persist me&amp;#34;.</summary>
    <dc:creator>Christoph Rabel</dc:creator>
    <dc:date>2020-06-13T16:10:58Z</dc:date>
  </entry>
  <entry>
    <title>RE: A few fragment questions</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119384323" />
    <author>
      <name>Olaf Kock</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119384323</id>
    <updated>2020-06-13T09:47:46Z</updated>
    <published>2020-06-13T09:47:46Z</published>
    <summary type="html">1) is probably simple: Detect &amp;lt;body class=&amp;#34;&lt;em&gt;has-edit-mode-menu&lt;/em&gt; ...&amp;#34;&amp;gt;&lt;br /&gt;2 and 3 seem to be harder, looking at the requests that go back and forth when editing a fragment: It seems that you&amp;#39;d have to implement dynamic creation of new fragments through JS (utilizing the API used on SiteBuilder/PageFragments). But then, it&amp;#39;s likely that these dynamically created fragments (with 2, 3, 4 or 15 dynamically created elements) would also appear in the list of fragments as soon as they&amp;#39;re in. &lt;br /&gt;It might be easier to go with a variation that utilizes the configuration of a plugin - less WYSIWYG, but &lt;em&gt;might&lt;/em&gt; have an option to go into a direction that you&amp;#39;re thinking of.&lt;br /&gt;Disclaimer: I&amp;#39;m saying this on the basis of the 7.2 features, I haven&amp;#39;t yet looked at new features in 7.3 fragments and content pages.</summary>
    <dc:creator>Olaf Kock</dc:creator>
    <dc:date>2020-06-13T09:47:46Z</dc:date>
  </entry>
  <entry>
    <title>A few fragment questions</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119381889" />
    <author>
      <name>Christoph Rabel</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119381889</id>
    <updated>2020-06-12T15:05:35Z</updated>
    <published>2020-06-12T15:05:35Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;Let's say, I create a simple fragment. (pseudocode, I didn't test it, just to show the idea)&lt;br&gt;&lt;pre&gt;&lt;code&gt;&amp;lt;table id="123" &amp;nbsp; data-lfr-editable-id="sometable" data-lfr-editable-type="rich-text"&amp;gt;something&amp;lt;/table&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;pre&gt;&lt;code&gt;&amp;amp;lt;#if ISEDITMODE&amp;amp;gt;
&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;button onclick="addRow()"&amp;gt;AddRow&amp;lt;/button&amp;gt;
&amp;lt;!--#if--&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;pre&gt;&lt;code&gt;function(fragmentElement, configuration) {
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; addRow() { 
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; fragmentElement.append(" ...") 
&amp;amp;nbsp;&amp;amp;nbsp; };
};&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;----&lt;br&gt;The idea is to create a fragment and allow the editor to change it by clicking a button. In this case, add a row to a table. The mechanism, once it works, would be really useful. Please note that I actually do not look for a solution for tables. I am interested in a general mechanism.&lt;br&gt;Questions:&lt;br&gt;1) How do I determine if I am in EDIT mode? (In Freemarker and/or in Javascript)&lt;br&gt;2) How do I trigger a save event?&lt;br&gt;I mean, when I do that, the change is simply lost if I don't click inside of the element and "trigger it manually". Or let me rephrase: How can I implement addRow so that my change is persisted?&lt;br&gt;3) Is there a builtin way to do something like that?&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Christoph Rabel</dc:creator>
    <dc:date>2020-06-12T15:05:35Z</dc:date>
  </entry>
</feed>
