Ticket #9053 (closed Bug: fixed)

Opened 3 years ago

Last modified 3 years ago

kupu 1.4.9+ breaks PloneFormGen rich text fields

Reported by: smcmahon Owned by: wichert
Priority: critical Milestone: 3.3
Component: Visual Editor Keywords:
Cc:

Description

The kupu fix in 1.4.9, documented:

  • 7409 "edit without kupu" does not appear on edit form (the fix for this make the link appear but only in source mode).

implicitly assumes that kupu is being used to edit an object. This unnecessarily breaks PloneFormGen, which uses the RichTextWidget for form editing.

The following patch allows PFG's rich text field to function while maintaining the #7409 fix. I'd love to see this go into Plone 3.3 release. Thanks!

===================================================================
--- kupu_wysiwyg_support.html   (revision 63249)
+++ kupu_wysiwyg_support.html   (working copy)
@@ -442,10 +442,13 @@
     </textarea>
     </div>
   
-    <div class="kupuoverride" tal:condition="python:exists('kupu_content') and allowed and len(allowed)!=1" tal:define="floated widget/allow_file_upload | python:1;                 klass python:test(exists('kupu_content') and len(kupu_content), ' kupusourceoverride', '');                 gAC nocall:field/getAllowedContentTypes|nothing;                 allowed python:gAC and gAC(context) or path('field/allowable_content_types|nothing');" tal:attributes="style python:test(floated, 'float:left;;', '');class string:kupuoverride$klass"><span class="discreet"><a class="forcekupu" href="#" i18n:translate="suppress-kupu" i18n:attributes="title title_suppress_kupu;" tal:define="fs fieldset|nothing;fs python:test(fs,'&amp;fieldset=%s'%fs,'');         editaction python:context.getActionInfo('object/edit')['url'];" tal:attributes="href string:${editaction}?kupu.suppress=${fieldName}${fs};" title="reload current page without kupu">
-         Edit without visual editor
-      </a></span>
-    </div>
+    <tal:guard tal:define="ti context/getTypeInfo | nothing"
+               tal:condition="python: ti and ti.listActionInfos('object/edit', check_condition=0)">
+       <div class="kupuoverride" tal:condition="python:exists('kupu_content') and allowed and len(allowed)!=1" tal:define="floated widget/allow_file_upload | python:1;                 klass python:test(exists('kupu_content') and len(kupu_content), ' kupusourceoverride', '');                 gAC nocall:field/getAllowedContentTypes|nothing;                 allowed python:gAC and gAC(context) or path('field/allowable_content_types|nothing');" tal:attributes="style python:test(floated, 'float:left;;', '');class string:kupuoverride$klass"><span class="discreet"><a class="forcekupu" href="#" i18n:translate="suppress-kupu" i18n:attributes="title title_suppress_kupu;" tal:define="fs fieldset|nothing;fs python:test(fs,'&amp;fieldset=%s'%fs,'');         editaction python:context.getActionInfo('object/edit')['url'];" tal:attributes="href string:${editaction}?kupu.suppress=${fieldName}${fs};" title="reload current page without kupu">
+            Edit without visual editor
+         </a></span>
+       </div>
+    </tal:guard>

Change History

comment:1 Changed 3 years ago by wichert

  • Owner changed from duncan to wichert
  • Status changed from new to assigned
  • Priority changed from major to critical
  • Milestone changed from 3.x to 3.3

comment:2 Changed 3 years ago by wichert

Fix commited in kupu, revision 66091.

Steve, can you confirm that current kupu trunk works correctly for you?

comment:3 Changed 3 years ago by wichert

  • Status changed from assigned to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.