Default Value of Field type Texteditor

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • tovoro
    replied
    Thanks a lot for the hint!

    This is better, right? Any review is highly appreciated :-)

    custom/Espo/Custom/Resources/metadata/fields/wysiwyg.json

    Code:
    {
    {
    "params": [
    {
    "name": "required",
    "type": "bool",
    "default": false
    },
    {
    "name": "default",
    "type": "text",
    "view": "custom:views/admin/field-manager/fields/wysiwyg/default"
    },
    {
    "name": "height",
    "type": "int"
    },
    {
    "name": "minHeight",
    "type": "int"
    },
    {
    "name": "readOnly",
    "type": "bool"
    },
    {
    "name": "readOnlyAfterCreate",
    "type": "bool"
    },
    {
    "name": "attachmentField",
    "type": "varchar",
    "hidden": true
    },
    {
    "name": "useIframe",
    "type": "bool"
    },
    {
    "name": "maxLength",
    "type": "int"
    },
    {
    "name": "audited",
    "type": "bool",
    "tooltip": true
    }
    ]
    }​

    Leave a comment:


  • yuri
    replied
    This breaks all other field parameters..

    Leave a comment:


  • tovoro
    replied
    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;
    }
    }
    });

    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
    Last edited by tovoro; 07-23-2025, 06:39 AM.

    Leave a comment:


  • tovoro
    replied
    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:	66
Size:	130.4 KB
ID:	119604

    Leave a comment:


  • item
    replied
    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

    Leave a comment:


  • tovoro
    started a topic Default Value of Field type Texteditor

    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...
Working...