Default Value of Field type Texteditor

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tovoro
    Junior Member
    • Jul 2025
    • 3

    #1

    Default Value of Field type Texteditor

    Hello

    It would be great if we could use the texteditor in the default value of a custom field with type texteditor, so we could have some nicely formatted default values for fields in our Quotes for example.

    This is already mentioned on Github: https://github.com/espocrm/espocrm/issues/3331

    Is there a way to change this in the code and if yes, can someone point me in the right direction? Will it affect upgrades? I have not developed anything within espocrm yet.

    Thanks for your help
    Tobi



    Is your feature request related to a problem? Please describe. This should be fairly obvious - The way it is now, it is not possible to take advantage of the editor for the default value, it's only...
  • item
    Active Community Member
    • Mar 2017
    • 1536

    #2
    Hi,
    If i understand you can change the "view" of the field.. in upgrade safe.

    You can create a json at
    custom/Espo/Custom/Resources/metadata/entityDefs/YourEntity.json.

    PHP Code:

    {
        
    "fields": {
            
    "description": {
                
    "type""text",
                
    "view""views/fields/wysiwyg"    // This is the new view of out-of-box description field
            
    }

    clearCache and rebuild (from admin section)
    Try it .. i don't know how is in database but certainly perfect. (someone can correct if it's bad proposition)
    Last edited by item; 07-16-2025, 03:04 PM. Reason: EDIT : Zut, it's a Feature Request.. sorry
    If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​

    Comment

    • tovoro
      Junior Member
      • Jul 2025
      • 3

      #3
      Thanks a lot for your reply.

      I tried but I dont think this is what im looking for.

      Im looking to have this field in the custom field settings to have a wyswiwyg editor available, so I can format the defautl value of the field.


      Click image for larger version

Name:	CleanShot 2025-07-21 at 09.39.42@2x.png
Views:	7
Size:	130.4 KB
ID:	119604

      Comment

      • tovoro
        Junior Member
        • Jul 2025
        • 3

        #4
        With the help of AI I figured out a solution which is update-safe.

        Just add these two custom files

        espocrm/client/custom/src/views/admin/field-manager/fields/wysiwyg/default.js

        [CODE]
        define(['views/fields/wysiwyg'], function (WysiwygFieldView) {
        return class extends WysiwygFieldView {
        setup() {
        super.setup();
        this.name = 'default';
        this.height = 200;
        this.minHeight = 150;
        }
        }
        });/CODE]


        espocrm/custom/Espo/Custom/Resources/metadata/fields/wysiwyg.json
        Code:
        {
        "params": [
        {
        "name": "default",
        "type": "text",
        "view": "custom:views/admin/field-manager/fields/wysiwyg/default"
        }
        ]
        }​
        Click image for larger version

Name:	CleanShot 2025-07-22 at 21.12.17@2x.png
Views:	3
Size:	73.4 KB
ID:	119661


        Seems to work fine for me

        Comment

        Working...