[MGNLUI-3164] Enable freemarker highlighting in code fields Created: 02/Sep/14  Updated: 05/Dec/14  Resolved: 23/Sep/14

Status: Closed
Project: Magnolia UI
Component/s: None
Affects Version/s: None
Fix Version/s: 5.3.4

Type: Improvement Priority: Neutral
Reporter: Christian Ringele Assignee: Aleksandr Pchelintcev
Resolution: Fixed Votes: 0
Labels: support
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File Screen Shot 2014-09-22 at 5.20.46 PM.png     PNG File Screen Shot 2014-09-22 at 5.21.23 PM.png    
Issue Links:
Relates
duplicate
is duplicated by MGNLUI-2406 BasicTextCodeField doesn't support fr... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Date of First Response:

 Description   

The freemarker code is not highlitghted anymore in the inplace templating module.

The reason is, that the vaadin library in use for the form field:
info.magnolia.ui.form.field.factory.BasicTextCodeFieldFactory.checkModeType(String)
is not supporting freemarker code:
org.vaadin.aceeditor.AceMode



 Comments   
Comment by Aleksandr Pchelintcev [ 21/Sep/14 ]

Fixed the issue by making several compromises:

  • Forcing ACE Editor to pick the themes/highlighting from the local folder instead of the CDN that is hardcoded in Vaadin wrapper.
    • The amount of JS files is pretty big, not all of them are relevant, not sure we want to keep them all.
  • Added manual mapping for FTL in BasicTextCodeFieldFactory#checkModeType. For the case when there is no mapping in AceMode enum from the wrapper - changed the logic so that the unsanitized string is returned.
Comment by Christopher Zimmermann [ 22/Sep/14 ]

Please update the javadoc on BasicTextCodeFieldFactory#checkModeType.

Im noticing that in Resources module now many of the files have little warning icons which display messages when you roll over them. I think this may be introduced by this change and they should be disabled - all of the ones that I saw were not helpful because they didnt really understand the context of the code or css.
For example see:
Resources App:
/sample-css
/templating-kit/js/libs/jquery.ui.datepicker

This might be helpful: http://japhr.blogspot.ch/2013/06/setting-jshint-options-in-ace-from-dart.html

Comment by Christopher Zimmermann [ 25/Sep/14 ]

Two minor things:
I would rename BasicTextCodeFieldFactory.checkModeType to getModeType - since its more about getting a proper mode type.

Fix typo in javadoc for that method
'flt' -> 'ftl'
Or does it even really need that TODO statement - what are we actually planning to do or add there?

Generated at Mon Feb 12 09:03:51 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.